_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q3200
DataTablesFactory.parseColumns
train
protected static function parseColumns(array $rawColumns, DataTablesWrapperInterface $wrapper) { $dtColumns = []; foreach ($rawColumns as $current) { $dtColumn = static::parseColumn($current, $wrapper); if (null === $dtColumn) {
php
{ "resource": "" }
q3201
DataTablesFactory.parseOrder
train
protected static function parseOrder(array $rawOrder) { $dtOrder = new DataTablesOrder(); if (false === static::isValidRawOrder($rawOrder)) { return $dtOrder; }
php
{ "resource": "" }
q3202
DataTablesFactory.parseOrders
train
protected static function parseOrders(array $rawOrders) { $dtOrders = []; foreach ($rawOrders as $current) {
php
{ "resource": "" }
q3203
DataTablesFactory.parseSearch
train
protected static function parseSearch(array $rawSearch) { $dtSearch = new DataTablesSearch(); if (false === static::isValidRawSearch($rawSearch)) { return $dtSearch; }
php
{ "resource": "" }
q3204
ObjectRegistry.register
train
public function register($nickname, $object) { if (isset($this->autoInstantiations[$nickname])) {
php
{ "resource": "" }
q3205
ObjectRegistry.get
train
public function get($nickname) { if (isset($this->autoInstantiations[$nickname])) {
php
{ "resource": "" }
q3206
MailruResourceOwner.getLocation
train
public function getLocation() { $country = $this->getCountry(); $city = $this->getCity();
php
{ "resource": "" }
q3207
WhiteHTMLFilter.loadHTML
train
public function loadHTML($html) { $html = str_replace(chr(13), '', $html); $html = '<?xml version="1.0" encoding="utf-8" ?><' . $this->PARENT_TAG_NAME . '>'
php
{ "resource": "" }
q3208
WhiteHTMLFilter.outputHtml
train
public function outputHtml() { $result = ''; if (!is_null($this->dom)) { //SaveXML : <br/><img/> //SaveHTML: <br><img> $result = trim($this->dom->saveXML($this->getRealElement()));
php
{ "resource": "" }
q3209
WhiteHTMLFilter.cleanNodes
train
private function cleanNodes(DOMElement $elem, $isFirstNode = false) { $nodeName = strtolower($elem->nodeName); $textContent = $elem->textContent; if ($isFirstNode || array_key_exists($nodeName, $this->config->WhiteListTag)) { if ($elem->hasAttributes()) { $this->cleanAttributes($elem); } /* * Iterate over the element's children. The reason we go backwards is because * going forwards will cause indexes to change when elements get removed */ if ($elem->hasChildNodes()) { $children = $elem->childNodes; $index = $children->length; while (--$index >= 0) { $cleanNode = $children->item($index);// DOMElement or DOMText if ($cleanNode instanceof DOMElement) { $this->cleanNodes($cleanNode); } }
php
{ "resource": "" }
q3210
WhiteHTMLFilter.cleanAttributes
train
private function cleanAttributes(DOMElement $elem) { $tagName = strtolower($elem->nodeName); $attributes = $elem->attributes; $attributesWhiteList = $this->config->WhiteListHtmlGlobalAttributes; $attributesFilterMap = array(); $allowDataAttribute = in_array("data-*", $attributesWhiteList); $whiteListAttr = $this->config->getWhiteListAttr($tagName); foreach ($whiteListAttr as $key => $val) { if (is_string($val)) { $attributesWhiteList[] = $val; } if ($val instanceof Closure) { $attributesWhiteList[] = $key; $attributesFilterMap[$key] = $val; } } $index = $attributes->length; while (--$index >= 0) { /* foreach会有一个严重的的问题: href="JavaScript:alert("customAttr="xxx"");" 这样嵌套的不合法的属性,会被解析出两个属性: 1. href="JavaScript:alert(" 2. customAttr="xxx" 但是foreach只能拿到一个。 foreach ($elem->attributes->item() as $attrName => $domAttr) { */ /* @var $domAttr DOMAttr */ $domAttr = $attributes->item($index); $attrName = strtolower($domAttr->name); $attrValue = $domAttr->value; // 如果不在白名单attr中,而且允许data-*,且不是data-*,则删除 if (!in_array($attrName, $attributesWhiteList) && $allowDataAttribute && (stripos($attrName, "data-")
php
{ "resource": "" }
q3211
WhiteHTMLFilter.cleanAttrValue
train
private function cleanAttrValue(DOMAttr $domAttr) { $attrName = strtolower($domAttr->name); if ($attrName === 'style' && !empty($this->config->WhiteListStyle)) { $styles = explode(';', $domAttr->value); foreach ($styles as $key => &$subStyle) { $subStyle = array_map("trim", explode(':', strtolower($subStyle), 2)); if (empty($subStyle[0]) || !in_array($subStyle[0], $this->config->WhiteListStyle)) { unset($styles[$key]); } } $implodeFunc = function ($styleSheet) { return implode(':', $styleSheet); }; $domAttr->ownerElement->setAttribute($attrName, implode(';', array_map($implodeFunc, $styles)) . ';'); } if ($attrName
php
{ "resource": "" }
q3212
WhiteHTMLFilter.clean
train
public function clean() { $this->removedTags = array(); $elem = $this->getRealElement(); if (is_null($elem)) { return array(); }
php
{ "resource": "" }
q3213
NGSIAPIv1.getEntities
train
public function getEntities($type = false, $offset = 0, $limit = 1000, $details = "on") { if ($type) { $url = $this->url . "contextTypes/" . $type; } else { $url = $this->url . "contextEntities/"; } $ret = $this->restRequest($url . "?offset=$offset&limit=$limit&details=$details", 'GET')->getResponseBody(); $Context = (new Context\Context($ret))->get(); $Entities = []; if($Context instanceof \stdClass && isset($Context->errorCode)){ switch ((int) $Context->errorCode->code) { case 404: case 500: throw new Exception\GeneralException($Context->errorCode->reasonPhrase,(int)$Context->errorCode->code, null, $ret); default: case 200: break; } }else{ throw new Exception\GeneralException("Malformed Orion Response",500, null, $ret); }
php
{ "resource": "" }
q3214
Util.strEscape
train
public static function strEscape( $str, $escape = 'plain' ) { switch ( $escape ) { case 'html' : case 'htmlspecialchars' : $str = htmlspecialchars( $str ); break; case 'htmlentities':
php
{ "resource": "" }
q3215
Util.tag
train
public static function tag( $str, $wrapTag = 0, $attributes = [] ) { $selfclose = [ 'link', 'input', 'br', 'img' ]; if ( !is_string( $str ) ) { return ''; } if ( !is_string( $wrapTag ) ) { return $str; } $wrapTag = trim( strtolower( $wrapTag ) ); $attrString = ''; if ( is_array( $attributes ) ) { foreach ( $attributes as $attrKey => $attrVal ) { $attrKey = htmlspecialchars( trim( strtolower( $attrKey ) ), ENT_QUOTES ); $attrVal = htmlspecialchars(
php
{ "resource": "" }
q3216
Util.getAcceptableLanguages
train
public static function getAcceptableLanguages( $rawList = false ) { // Implementation based on MediaWiki 1.21's WebRequest::getAcceptLang // Which is based on http://www.thefutureoftheweb.com/blog/use-accept-language-header // @codeCoverageIgnoreStart if ( $rawList === false ) { $rawList = isset( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : ''; } // @codeCoverageIgnoreEnd // Return the language codes in lower case $rawList = strtolower( $rawList ); // The list of elements is separated by comma and optional LWS // Extract the language-range and, if present, the q-value $lang_parse = null; preg_match_all( '/([a-z]{1,8}(-[a-z]{1,8})*|\*)\s*(;\s*q\s*=\s*(1(\.0{0,3})?|0(\.[0-9]{0,3})?)?)?/', $rawList, $lang_parse ); if ( !count( $lang_parse[1] ) ) { return []; } $langcodes = $lang_parse[1]; $qvalues = $lang_parse[4]; $indices = range( 0, count( $lang_parse[1] ) - 1 ); // Set default q
php
{ "resource": "" }
q3217
Util.parseExternalLinks
train
public static function parseExternalLinks( $text ) { static $urlProtocols = false; static $counter = 0; // @codeCoverageIgnoreStart if ( !$urlProtocols ) { if ( function_exists( 'wfUrlProtocols' ) ) { // Allow custom protocols $urlProtocols = wfUrlProtocols(); } else { $urlProtocols = 'https?:\/\/|ftp:\/\/'; } } // @codeCoverageIgnoreEnd $extLinkBracketedRegex = '/(?:(<[^>]*)|' . '\[(((?i)' . $urlProtocols . ')' . self::EXT_LINK_URL_CLASS . '+)\p{Zs}*([^\]\\x00-\\x08\\x0a-\\x1F]*?)\]|' . '(((?i)' . $urlProtocols . ')' . self::EXT_LINK_URL_CLASS . '+))/Su'; return preg_replace_callback( $extLinkBracketedRegex, function ( array $bits ) use ( &$counter ) { // @codeCoverageIgnoreStart if ( $bits[1] != '' ) { return $bits[1];
php
{ "resource": "" }
q3218
Util.parseWikiLinks
train
public static function parseWikiLinks( $text, $articlePath ) { self::$articlePath = $articlePath; return preg_replace_callback( '/\[\[:?([^]|]+)(?:\|([^]]*))?\]\]/', function ( array $bits ) { if ( !isset( $bits[2] ) || $bits[2] == '' ) { $bits[2] = strtr( $bits[1], '_', ' ' ); } $article = html_entity_decode( $bits[1], ENT_QUOTES, 'UTF-8'
php
{ "resource": "" }
q3219
Util.prettyEncodedWikiUrl
train
public static function prettyEncodedWikiUrl( $articlePath, $article ) { $s = strtr( $article, ' ', '_' ); $s = urlencode( $s ); $s = str_ireplace( [ '%3B', '%40', '%24', '%21', '%2A', '%28', '%29', '%2C', '%2F', '%3A' ],
php
{ "resource": "" }
q3220
FileUploader.upload
train
public function upload(ApiClientContract $api, $path, $body, array $params = [], $verifyChecksum = true) { $response = $api->request('PUT', $path, [ 'headers' => $this->convertUploadParamsToHeaders($body, $params, $verifyChecksum), 'body' => $body, 'query' => $this->extractQueryParameters($params),
php
{ "resource": "" }
q3221
FileUploader.convertUploadParamsToHeaders
train
protected function convertUploadParamsToHeaders($body = null, array $params = [], $verifyChecksum = true) { $headers = []; if ($verifyChecksum) { $headers['ETag'] = md5($body); } $availableParams = [ 'contentType' => 'Content-Type',
php
{ "resource": "" }
q3222
FileUploader.extractQueryParameters
train
protected function extractQueryParameters(array $params) { $availableParams = ['extract-archive']; $query = []; foreach ($params as $key => $value) {
php
{ "resource": "" }
q3223
TokenStorage.getToken
train
public function getToken() { $token = $this->cache->get($this->tokenName); if ($token === false) { $token = Algorithms::generateRandomToken(20);
php
{ "resource": "" }
q3224
DataTablesOrder.setDir
train
public function setDir($dir) { if (false === in_array($dir, DataTablesEnumerator::enumDirs())) { $dir = self::DATATABLES_DIR_ASC;
php
{ "resource": "" }
q3225
ApiClient.getHttpClient
train
public function getHttpClient() { if (!is_null($this->httpClient)) { return $this->httpClient; }
php
{ "resource": "" }
q3226
ApiClient.authenticate
train
public function authenticate() { if (!is_null($this->token)) { return; } $response = $this->authenticationResponse(); if (!$response->hasHeader('X-Auth-Token')) { throw new AuthenticationFailedException('Given credentials are wrong.', 403); } if (!$response->hasHeader('X-Storage-Url')) {
php
{ "resource": "" }
q3227
ApiClient.authenticationResponse
train
public function authenticationResponse() { $client = new Client(); try { $response = $client->request('GET', static::AUTH_URL, [ 'headers' => [ 'X-Auth-User' => $this->username, 'X-Auth-Key' => $this->password, ], ]);
php
{ "resource": "" }
q3228
LanguageEo.iconv
train
function iconv( $in, $out, $string ) { if ( strcasecmp( $in, 'x' ) == 0 && strcasecmp( $out, 'utf-8' ) == 0 ) { return preg_replace_callback ( '/([cghjsu]x?)((?:xx)*)(?!x)/i', array( $this, 'strrtxuCallback' ), $string ); } elseif ( strcasecmp( $in, 'UTF-8' ) == 0 && strcasecmp( $out, 'x' ) == 0 ) { # Double Xs only if they follow cxapelutaj literoj. return preg_replace_callback(
php
{ "resource": "" }
q3229
GiroCheckout_SDK_TransactionType_helper.getTransactionTypeByName
train
public static function getTransactionTypeByName($transType) { switch ($transType) { //credit card apis case 'creditCardTransaction': return new GiroCheckout_SDK_CreditCardTransaction(); case 'creditCardCapture': return new GiroCheckout_SDK_CreditCardCapture(); case 'creditCardRefund': return new GiroCheckout_SDK_CreditCardRefund(); case 'creditCardGetPKN': return new GiroCheckout_SDK_CreditCardGetPKN(); case 'creditCardRecurringTransaction': return new GiroCheckout_SDK_CreditCardRecurringTransaction(); case 'creditCardVoid': return new GiroCheckout_SDK_CreditCardVoid(); //direct debit apis case 'directDebitTransaction': return new GiroCheckout_SDK_DirectDebitTransaction(); case 'directDebitGetPKN': return new GiroCheckout_SDK_DirectDebitGetPKN(); case 'directDebitTransactionWithPaymentPage': return new GiroCheckout_SDK_DirectDebitTransactionWithPaymentPage(); case 'directDebitCapture': return new GiroCheckout_SDK_DirectDebitCapture(); case 'directDebitRefund': return new GiroCheckout_SDK_DirectDebitRefund(); case 'directDebitVoid': return new GiroCheckout_SDK_DirectDebitVoid(); //giropay apis case 'giropayBankstatus': return new GiroCheckout_SDK_GiropayBankstatus(); case 'giropayIDCheck': return new GiroCheckout_SDK_GiropayIDCheck(); case 'giropayTransaction': return new GiroCheckout_SDK_GiropayTransaction(); case 'giropayIssuerList':
php
{ "resource": "" }
q3230
ControllerInspector.getRoutable
train
public function getRoutable($controller, $prefix) { $routable = []; $reflection = new ReflectionClass($controller); $methods = $reflection->getMethods(ReflectionMethod::IS_PUBLIC); // To get the routable methods, we will simply spin through all methods on the // controller instance checking to see if it belongs to the given class and // is a publicly routable method. If so, we will add it to this listings. foreach ($methods as $method) { if ($this->isRoutable($method)) { $data = $this->getMethodData($method, $prefix); $routable[$method->name][] = $data;
php
{ "resource": "" }
q3231
ControllerInspector.getMethodData
train
public function getMethodData(ReflectionMethod $method, $prefix) { $verb = $this->getVerb($name = $method->name);
php
{ "resource": "" }
q3232
Tx_Oelib_Model_BackEndUser.getLanguage
train
public function getLanguage() { $configuration = $this->getConfiguration(); $result = !empty($configuration['lang']) ? $configuration['lang']
php
{ "resource": "" }
q3233
Tx_Oelib_Model_BackEndUser.getAllGroups
train
public function getAllGroups() { $result = new \Tx_Oelib_List(); $groupsToProcess = $this->getGroups(); do { $groupsForNextStep = new \Tx_Oelib_List(); $result->append($groupsToProcess); /** @var \Tx_Oelib_Model_BackEndUserGroup $group */ foreach ($groupsToProcess as $group) { $subgroups = $group->getSubgroups(); /** @var \Tx_Oelib_Model_BackEndUserGroup $subgroup */ foreach ($subgroups as $subgroup) {
php
{ "resource": "" }
q3234
Tx_Oelib_Model_BackEndUser.getConfiguration
train
private function getConfiguration() { if (empty($this->configuration)) {
php
{ "resource": "" }
q3235
Response.getErrorData
train
public function getErrorData($key = null) { if ($this->isSuccessful()) { return null; } // get error data (array in data) $data = isset($this->getData('data')[0]) ? $this->getData('data')[0] : null;
php
{ "resource": "" }
q3236
Response.getMessage
train
public function getMessage() { if ($this->getErrorMessage()) { return $this->getErrorMessage() . ' (' . $this->getErrorFieldName() . ')'; } if ($this->isSuccessful()) { return ($this->getStatus()) ? ucfirst($this->getStatus())
php
{ "resource": "" }
q3237
Response.getHttpResponseCodeText
train
public function getHttpResponseCodeText() { $code = $this->getHttpResponseCode(); $statusTexts = \Symfony\Component\HttpFoundation\Response::$statusTexts;
php
{ "resource": "" }
q3238
AbstractController.buildDataTablesResponse
train
protected function buildDataTablesResponse(Request $request, $name, ActionResponse $output) { if (true === $request->isXmlHttpRequest()) { return new JsonResponse($output); } // Notify the user. switch ($output->getStatus()) { case 200: $this->notifySuccess($output->getNotify()); break; case 404:
php
{ "resource": "" }
q3239
AbstractController.exportDataTablesCallback
train
protected function exportDataTablesCallback(DataTablesProviderInterface $dtProvider, DataTablesRepositoryInterface $repository, DataTablesCSVExporterInterface $dtExporter, $windows) { $em = $this->getDoctrine()->getManager(); $stream = fopen("php://output", "w+"); // Export the columns. fputcsv($stream, DataTablesExportHelper::convert($dtExporter->exportColumns(), $windows), ";"); // Paginates. $total = $repository->dataTablesCountExported($dtProvider); $pages = PaginateHelper::getPagesCount($total, DataTablesRepositoryInterface::REPOSITORY_LIMIT); // Handle each page. for ($i = 0; $i < $pages; ++$i) { // Get the offset and limit. list($offset, $limit) = PaginateHelper::getPageOffsetAndLimit($i, DataTablesRepositoryInterface::REPOSITORY_LIMIT, $total); // Get the export query with offset and limit. $result = $repository->dataTablesExportAll($dtProvider) ->setFirstResult($offset) ->setMaxResults($limit) ->getQuery() ->iterate();
php
{ "resource": "" }
q3240
AbstractController.getDataTablesColumn
train
protected function getDataTablesColumn(DataTablesProviderInterface $dtProvider, $data) { $this->getLogger()->debug(sprintf("DataTables controller search for a column with name \"%s\"", $data)); $dtColumn = $this->getDataTablesWrapper($dtProvider)->getColumn($data); if (null === $dtColumn) {
php
{ "resource": "" }
q3241
AbstractController.getDataTablesEntityById
train
protected function getDataTablesEntityById(DataTablesProviderInterface $dtProvider, $id) { $repository = $this->getDataTablesRepository($dtProvider); $this->getLogger()->debug(sprintf("DataTables controller search for an entity [%s]", $id)); $entity = $repository->find($id); if (null === $entity) {
php
{ "resource": "" }
q3242
AbstractController.getDataTablesURL
train
protected function getDataTablesURL(DataTablesProviderInterface $dtProvider) { $this->getLogger()->debug(sprintf("DataTables controller search for an URL with name \"%s\"", $dtProvider->getName())); if (false === ($dtProvider instanceof DataTablesRouterInterface)) { return $this->getRouter()->generate("jquery_datatables_index", ["name"
php
{ "resource": "" }
q3243
AbstractController.getDataTablesWrapper
train
protected function getDataTablesWrapper(DataTablesProviderInterface $dtProvider) { $url = $this->getDataTablesURL($dtProvider); $dtWrapper = DataTablesFactory::newWrapper($url, $dtProvider, $this->getKernelEventListener()->getUser()); foreach ($dtProvider->getColumns() as $dtColumn) { $this->getLogger()->debug(sprintf("DataTables provider \"%s\" add a column \"%s\"", $dtProvider->getName(), $dtColumn->getData()));
php
{ "resource": "" }
q3244
AbstractController.prepareActionResponse
train
protected function prepareActionResponse($status, $notificationId) { $response = new ActionResponse();
php
{ "resource": "" }
q3245
GalleryHubController.PaginatedGalleries
train
public function PaginatedGalleries() { $children = $this->AllChildren(); $limit = $this->ThumbnailsPerPage; $list = ArrayList::create(); foreach ($children as $child) { $image = $child->SortedImages()->first(); $child_data = $child->toMap(); $child_data["Link"] = $child->Link(); if ($image) { $child_data["GalleryThumbnail"] = $this->ScaledImage($image, true); } else {
php
{ "resource": "" }
q3246
FluentFilesLoader.setParam
train
protected function setParam($key, $value, $trimLeadingSlashes = true) { $this->params[$key]
php
{ "resource": "" }
q3247
FluentFilesLoader.limit
train
public function limit($limit, $markerFile = '') { return $this->setParam('limit', intval($limit), false)
php
{ "resource": "" }
q3248
FluentFilesLoader.find
train
public function find($path) { $file = $this->findFileAt($path); if (is_null($file)) { throw new FileNotFoundException('File "'.$path.'" was not found.');
php
{ "resource": "" }
q3249
FluentFilesLoader.findFileAt
train
protected function findFileAt($path) { try { $files = $this->fromDirectory('') ->withPrefix($path) ->withDelimiter('') ->limit(1)
php
{ "resource": "" }
q3250
FluentFilesLoader.get
train
public function get() { $response = $this->api->request('GET', $this->containerUrl, [ 'query' => $this->buildParams(), ]); if ($response->getStatusCode() !== 200) { throw new ApiRequestFailedException('Unable to list container files.', $response->getStatusCode()); } $files = json_decode($response->getBody(), true); if ($this->asFileObjects === true) { $this->asFileObjects = false; return $this->getFilesCollectionFromArrays($files); } // Add 'filename' attribute to each file, so users
php
{ "resource": "" }
q3251
Tx_Oelib_AbstractMailer.formatEmailBody
train
protected function formatEmailBody($rawEmailBody) { if (!$this->enableFormatting) { return $rawEmailBody; }
php
{ "resource": "" }
q3252
Tx_Oelib_SalutationSwitcher.getAvailableLanguages
train
private function getAvailableLanguages() { if ($this->availableLanguages === null) { $this->availableLanguages = []; if (!empty($this->LLkey)) { $this->availableLanguages[] = $this->LLkey; } // The key for English is "default", not "en". $this->availableLanguages = str_replace( 'en', 'default', $this->availableLanguages ); // Remove duplicates in case the default language is the same as the fall-back language. $this->availableLanguages = array_unique($this->availableLanguages);
php
{ "resource": "" }
q3253
Tx_Oelib_SalutationSwitcher.getSuffixesToTry
train
private function getSuffixesToTry() { if ($this->suffixesToTry === null) { $this->suffixesToTry = []; if (isset($this->conf['salutation'])) { if
php
{ "resource": "" }
q3254
Tx_Oelib_Visibility_Tree.buildTreeFromArray
train
private function buildTreeFromArray( array $treeStructure, \Tx_Oelib_Visibility_Node $parentNode ) { foreach ($treeStructure as $nodeKey => $nodeContents) { /** @var \Tx_Oelib_Visibility_Node $childNode */ $childNode = GeneralUtility::makeInstance(\Tx_Oelib_Visibility_Node::class); $parentNode->addChild($childNode); if (is_array($nodeContents)) {
php
{ "resource": "" }
q3255
Tx_Oelib_Visibility_Tree.getKeysOfHiddenSubparts
train
public function getKeysOfHiddenSubparts() { $keysToHide = []; foreach ($this->nodes as $key => $node) { if (!$node->isVisible()) {
php
{ "resource": "" }
q3256
Tx_Oelib_Visibility_Tree.makeNodesVisible
train
public function makeNodesVisible(array $nodeKeys) { foreach ($nodeKeys as $nodeKey) {
php
{ "resource": "" }
q3257
GiroCheckout_SDK_Curl_helper.submit
train
public static function submit($url, $params) { $Config = GiroCheckout_SDK_Config::getInstance(); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); // For Windows environments if( defined('__GIROSOLUTION_SDK_CERT__') ) { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_CAINFO, str_replace('\\', '/', __GIROSOLUTION_SDK_CERT__)); } // For Windows environments if( defined('__GIROSOLUTION_SDK_SSL_VERIFY_OFF__') && __GIROSOLUTION_SDK_SSL_VERIFY_OFF__ ) { curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); } if ($Config->getConfig('CURLOPT_SSL_VERIFYPEER')) { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $Config->getConfig('CURLOPT_SSL_VERIFYPEER')); } if ($Config->getConfig('CURLOPT_CAINFO')) { curl_setopt($ch, CURLOPT_CAINFO, $Config->getConfig('CURLOPT_CAINFO')); } if ($Config->getConfig('CURLOPT_SSL_VERIFYHOST')) { curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $Config->getConfig('CURLOPT_SSL_VERIFYHOST')); } if ($Config->getConfig('CURLOPT_CONNECTTIMEOUT')) { curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $Config->getConfig('CURLOPT_CONNECTTIMEOUT')); }
php
{ "resource": "" }
q3258
GiroCheckout_SDK_Curl_helper.getJSONResponseToArray
train
public static function getJSONResponseToArray($string) { $json = json_decode($string,true);
php
{ "resource": "" }
q3259
GiroCheckout_SDK_Curl_helper.getHeaderAndBody
train
private static function getHeaderAndBody($response) { $header = self::http_parse_headers(substr($response,
php
{ "resource": "" }
q3260
Tx_Oelib_BackEndLoginManager.getLoggedInUser
train
public function getLoggedInUser($mapperName = \Tx_Oelib_Mapper_BackEndUser::class) { if ($mapperName === '') { throw new \InvalidArgumentException('$mapperName must not be empty.', 1331318483); } if (!$this->isLoggedIn()) { return null; } if ($this->loggedInUser) { return $this->loggedInUser; } /** @var \Tx_Oelib_Mapper_BackEndUser $mapper */
php
{ "resource": "" }
q3261
Package.boot
train
public function boot(\Neos\Flow\Core\Bootstrap $bootstrap) { $dispatcher = $bootstrap->getSignalSlotDispatcher(); $dispatcher->connect(ConfigurationManager::class, 'configurationManagerReady', function (ConfigurationManager $configurationManager) use ($dispatcher) { $enabled = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'MOC.Varnish.enabled'); if ((boolean)$enabled === true) { $dispatcher->connect('Neos\Neos\Service\PublishingService', 'nodePublished',
php
{ "resource": "" }
q3262
Customizer.defaultPanel
train
public static function defaultPanel() { $argCount = func_num_args(); $args = func_get_args(); $sections = array();
php
{ "resource": "" }
q3263
Customizer.panel
train
public static function panel($title, $description) { $argCount = func_num_args(); $args = func_get_args(); $sections = array(); for ($i = 2; $i < $argCount; ++$i) { $sections[$args[$i]['id']] = $args[$i]; }
php
{ "resource": "" }
q3264
NextrasOrmEventsExtension.loadEntityMapping
train
private function loadEntityMapping(): array { $mapping = []; $builder = $this->getContainerBuilder(); $repositories = $builder->findByType(IRepository::class); foreach ($repositories as $repository) { /** @var string $repositoryClass */ $repositoryClass = $repository->getEntity(); // Skip invalid repositoryClass name if (!class_exists($repositoryClass)) { throw new ServiceCreationException(sprintf("Repository class '%s' not found", $repositoryClass)); } // Skip invalid subtype ob IRepository
php
{ "resource": "" }
q3265
GalleryPageController.Gallery
train
public function Gallery() { if ($this->Images()->exists()) { // Create a list of images with generated gallery image and thumbnail $images = ArrayList::create(); $pages = $this->PaginatedImages(); foreach ($this->PaginatedImages() as $image) { $image_data = $image->toMap(); $image_data["GalleryImage"] = $this->GalleryImage($image);
php
{ "resource": "" }
q3266
GiroCheckout_SDK_Request_Cart.addItem
train
public function addItem($p_strName, $p_iQuantity, $p_iGrossAmt, $p_strEAN = "") { if (empty($p_strName) || empty($p_iQuantity) || !isset($p_iGrossAmt)) { throw new GiroCheckout_SDK_Exception_helper('Name, quantity and amount are mandatory for cart items'); } $aItem = array( "name" => $p_strName,
php
{ "resource": "" }
q3267
GiroCheckout_SDK_Request_Cart.getAllItems
train
public function getAllItems() { if (version_compare(phpversion(), '5.3.0', '<')) { return json_encode($this->m_aItems); } else {
php
{ "resource": "" }
q3268
subscribeContext.notifyConditions
train
public function notifyConditions($type, $condValues = array()) { if (!is_array($condValues)) { $condValues = array($condValues);
php
{ "resource": "" }
q3269
DataTablesWrapper.removeColumn
train
public function removeColumn(DataTablesColumnInterface $column) { if (true === array_key_exists($column->getData(), $this->columns)) {
php
{ "resource": "" }
q3270
Strings.sanitizeJsVarName
train
public static function sanitizeJsVarName($str) { $out = preg_replace("/ /", '_', trim($str));
php
{ "resource": "" }
q3271
ContextFactory.addAttribute
train
public function addAttribute($name, $value, $type = "Integer", $metadata = null) { $attr = (object) [ "value" => $value, "type" => $type ];
php
{ "resource": "" }
q3272
Tx_Oelib_Visibility_Node.setParent
train
public function setParent(\Tx_Oelib_Visibility_Node $parentNode) { if ($this->parentNode !== null) { throw new \InvalidArgumentException('This node already
php
{ "resource": "" }
q3273
TextualDateExtension.textualDateFilter
train
public function textualDateFilter($date) { if ( ! $date instanceof \DateTime) { throw new \InvalidArgumentException('Textual Date Filter expects input to be a instance of DateTime'); } $now = new \DateTime('now'); $diff = $now->diff($date); $diffUnit = $this->getHighestDiffUnitAndValue($diff); $temporalModifier = ($diff->invert)? 'ago':'next'; $translationString = $temporalModifier. '.' .$diffUnit['unit']; // Override yesterday and tomorrow
php
{ "resource": "" }
q3274
TextualDateExtension.getHighestDiffUnitAndValue
train
protected function getHighestDiffUnitAndValue($diff) { // Manually define props due to Reflection Bug #53439 (PHP) $properties = array('y', 'm', 'd', 'h', 'i', 's'); foreach($properties as $prop) { if ($diff->$prop > 0) {
php
{ "resource": "" }
q3275
GiroCheckout_SDK_ResponseCode_helper.getMessage
train
public static function getMessage( $code, $lang = 'EN' ) { if( $code < 0 ) { return null; } //code invalid $lang = strtoupper( $lang ); if( !array_key_exists( $lang, self::$code ) ) { //language not found $lang = 'EN';
php
{ "resource": "" }
q3276
AjaxHandler.registerHooks
train
protected function registerHooks() { // Our callbacks are registered only on the admin side even for guest and frontend callbacks if (is_admin()) { switch ($this->accessType) { case 'guest': Hooks::action('wp_ajax_nopriv_' . static::$ACTION, $this, 'doAjax'); break; case 'logged': Hooks::action('wp_ajax_' . static::$ACTION, $this, 'doAjax'); break; case 'any': Hooks::action('wp_ajax_nopriv_' . static::$ACTION, $this, 'doAjax');
php
{ "resource": "" }
q3277
AjaxHandler.addGlobalVariables
train
public function addGlobalVariables($vars) { $globalVars = $this->getGlobalVariables(); if ($globalVars == null || empty($globalVars)) {
php
{ "resource": "" }
q3278
Tx_Oelib_TemplateRegistry.getByFileName
train
public function getByFileName($fileName) { if (!isset($this->templates[$fileName])) { /** @var \Tx_Oelib_Template $template */ $template = GeneralUtility::makeInstance(\Tx_Oelib_Template::class);
php
{ "resource": "" }
q3279
GiroCheckout_SDK_Config.setConfig
train
public function setConfig($key,$value) { switch ($key) { //curl options case 'CURLOPT_CAINFO': case 'CURLOPT_SSL_VERIFYPEER': case 'CURLOPT_SSL_VERIFYHOST': case 'CURLOPT_CONNECTTIMEOUT': // Proxy case 'CURLOPT_PROXY': case 'CURLOPT_PROXYPORT': case 'CURLOPT_PROXYUSERPWD':
php
{ "resource": "" }
q3280
AbstractDataTablesTwigExtension.encodeOptions
train
protected function encodeOptions(array $options) { if (0 === count($options)) { return "{}"; } ksort($options);
php
{ "resource": "" }
q3281
AbstractDataTablesTwigExtension.jQueryDataTablesStandalone
train
protected function jQueryDataTablesStandalone($selector, $language, array $options) { if (null !== $language) { $options["language"] = ["url" => DataTablesWrapperHelper::getLanguageURL($language)]; } $searches = ["%selector%", "%options%"]; $replaces = [$selector, $this->encodeOptions($options)];
php
{ "resource": "" }
q3282
AbstractDataTablesTwigExtension.renderDataTablesColumn
train
private function renderDataTablesColumn(DataTablesColumnInterface $dtColumn, $rowScope = false) { $attributes = []; $attributes["scope"] = true === $rowScope ? "row" : null; $attributes["class"] = $dtColumn->getClassname();
php
{ "resource": "" }
q3283
AbstractDataTablesTwigExtension.renderDataTablesRow
train
private function renderDataTablesRow(DataTablesWrapperInterface $dtWrapper, $wrapper) { $innerHTML = ""; $count = count($dtWrapper->getColumns()); for ($i = 0; $i < $count; ++$i) { $dtColumn = array_values($dtWrapper->getColumns())[$i];
php
{ "resource": "" }
q3284
Tx_Oelib_List.rebuildUidCache
train
private function rebuildUidCache() { $this->hasItemWithoutUid = false; /** @var \Tx_Oelib_Model $item */ foreach ($this as $item) { if ($item->hasUid()) { $uid = $item->getUid();
php
{ "resource": "" }
q3285
Tx_Oelib_List.sort
train
public function sort($callbackFunction) { $items = iterator_to_array($this, false); usort($items, $callbackFunction); /** @var \Tx_Oelib_Model $item */ foreach ($items as $item) {
php
{ "resource": "" }
q3286
Tx_Oelib_List.purgeCurrent
train
public function purgeCurrent() { if (!$this->valid()) { return; } if ($this->current()->hasUid()) { $uid = $this->current()->getUid(); if (isset($this->uids[$uid])) {
php
{ "resource": "" }
q3287
Tx_Oelib_Model.resetData
train
public function resetData(array $data) { $this->data = $data; if ($this->existsKey('uid')) { if (!$this->hasUid()) { $this->setUid((int)$this->data['uid']); } unset($this->data['uid']); }
php
{ "resource": "" }
q3288
Tx_Oelib_Model.setUid
train
public function setUid($uid) { if ($this->hasUid()) { throw new \BadMethodCallException('The UID of a model cannot be set a second time.', 1331489260); }
php
{ "resource": "" }
q3289
Tx_Oelib_Model.load
train
private function load() { if ($this->isVirgin()) { throw new \BadMethodCallException( get_class($this) . '#' . $this->getUid() . ': Please call setData() directly after instantiation first.', 1331489395 ); } if ($this->isGhost()) { if (!$this->hasLoadCallBack()) { throw new \BadMethodCallException(
php
{ "resource": "" }
q3290
Tx_Oelib_Model.setToDeleted
train
public function setToDeleted() { if ($this->isLoaded()) { $this->data['deleted'] =
php
{ "resource": "" }
q3291
Tx_Oelib_Model.isEmpty
train
public function isEmpty() { if ($this->isGhost()) { $this->load();
php
{ "resource": "" }
q3292
DataTablesEnumerator.enumParameters
train
public static function enumParameters() { return [ DataTablesRequestInterface::DATATABLES_PARAMETER_COLUMNS, DataTablesRequestInterface::DATATABLES_PARAMETER_DRAW,
php
{ "resource": "" }
q3293
DataTablesEnumerator.enumTypes
train
public static function enumTypes() { return [ DataTablesColumnInterface::DATATABLES_TYPE_DATE, DataTablesColumnInterface::DATATABLES_TYPE_HTML,
php
{ "resource": "" }
q3294
Tx_Oelib_IdentityMap.add
train
public function add(\Tx_Oelib_Model $model) { if (!$model->hasUid()) { throw new \InvalidArgumentException('Add() requires a model that has a UID.', 1331488748); }
php
{ "resource": "" }
q3295
Tx_Oelib_IdentityMap.get
train
public function get($uid) { if ($uid <= 0) { throw new \InvalidArgumentException('$uid must be > 0.', 1331488761); } if (!isset($this->items[$uid])) { throw new \Tx_Oelib_Exception_NotFound( 'This map currently does
php
{ "resource": "" }
q3296
ClientFactory.getKeyAuthClient
train
public function getKeyAuthClient($forceNew = false) { if ( ! isset($this->instances[self::CLIENT_KEY]) || $forceNew)
php
{ "resource": "" }
q3297
ClientFactory.getOauthClient
train
public function getOauthClient($forceNew = false) { if ( ! isset($this->instances[self::CLIENT_OAUTH]) || $forceNew) {
php
{ "resource": "" }
q3298
ClientFactory.getUpdatedOauthConfig
train
public function getUpdatedOauthConfig() { $token = $this->session->has(self::SESSION_TOKEN_KEY) ? $this->session->get(self::SESSION_TOKEN_KEY) : false; $tokenSecret = $this->session->has(self::SESSION_TOKEN_SECRET_KEY) ? $this->session->get(self::SESSION_TOKEN_SECRET_KEY)
php
{ "resource": "" }
q3299
ClientFactory.setSessionTokens
train
public function setSessionTokens($token, $tokenSecret = null) { $this->session->set(self::SESSION_TOKEN_KEY, $token);
php
{ "resource": "" }