_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q2900
Tx_Oelib_ConfigurationRegistry.getCompleteTypoScriptSetup
train
private function getCompleteTypoScriptSetup() { $pageUid = \Tx_Oelib_PageFinder::getInstance()->getPageUid(); if ($pageUid === 0) { return []; } if ($this->existsFrontEnd()) { return $this->getFrontEndController()->tmpl->setup; } /** @var TemplateService $template */ $template = GeneralUtility::makeInstance(TemplateService::class); $template->tt_track = 0; $template->init(); /** @var PageRepository $page */ $page = GeneralUtility::makeInstance(PageRepository::class); $rootline = $page->getRootLine($pageUid); $template->runThroughTemplates($rootline, 0); $template->generateConfig(); return $template->setup; }
php
{ "resource": "" }
q2901
Tx_Oelib_ConfigurationRegistry.existsFrontEnd
train
private function existsFrontEnd() { $frontEndController = $this->getFrontEndController(); return ($frontEndController !== null) && is_object($frontEndController->tmpl) && $frontEndController->tmpl->loaded; }
php
{ "resource": "" }
q2902
ThemeSettings.restrictAdminBarVisibility
train
public function restrictAdminBarVisibility() { // Don't go further if not logged in or within admin panel if (is_admin() || !is_user_logged_in()) { return; } $data = $this->getData(); // Don't go further if no setting if ( !isset($data['admin_bar']) || empty($data['admin_bar'])) { return; } $access = $data['admin_bar']; // Is current user's role within our access roles? $user = wp_get_current_user(); $role = $user->roles; $role = (count($role) > 0) ? $role[0] : ''; $isUserIncluded = in_array($role, $access['roles']); // Hide admin bar if required if (($access['mode'] == 'show' && !$isUserIncluded) || ($access['mode'] == 'hide' && $isUserIncluded) ) { show_admin_bar(false); } }
php
{ "resource": "" }
q2903
ThemeSettings.restrictAdminPanelAccess
train
private function restrictAdminPanelAccess() { // Don't restrict anything when doing AJAX or CLI stuff if ((defined('DOING_AJAX') && DOING_AJAX) || (defined('WP_CLI') && WP_CLI) || !is_user_logged_in()) { return; } $data = $this->getData(); // Don't go further if no setting if ( !isset($data['admin_access']) || empty($data['admin_access']) || !is_admin()) { return; } $access = $data['admin_access']; // Is current user's role within our access roles? $user = wp_get_current_user(); $role = $user->roles; $role = (count($role) > 0) ? $role[0] : ''; $isUserIncluded = in_array($role, $access['roles']); // Redirect to website home if required if (($access['mode'] == 'allow' && !$isUserIncluded) || ($access['mode'] == 'forbid' && $isUserIncluded) ) { wp_redirect(home_url()); exit; } }
php
{ "resource": "" }
q2904
Emogrifier.parseCssShorthandValue
train
private function parseCssShorthandValue($value) { $values = preg_split('/\\s+/', $value); $css = []; $css['top'] = $values[0]; $css['right'] = (count($values) > 1) ? $values[1] : $css['top']; $css['bottom'] = (count($values) > 2) ? $values[2] : $css['top']; $css['left'] = (count($values) > 3) ? $values[3] : $css['right']; return $css; }
php
{ "resource": "" }
q2905
Emogrifier.clearAllCaches
train
private function clearAllCaches() { $this->clearCache(self::CACHE_KEY_CSS); $this->clearCache(self::CACHE_KEY_SELECTOR); $this->clearCache(self::CACHE_KEY_XPATH); $this->clearCache(self::CACHE_KEY_CSS_DECLARATIONS_BLOCK); $this->clearCache(self::CACHE_KEY_COMBINED_STYLES); }
php
{ "resource": "" }
q2906
Emogrifier.clearCache
train
private function clearCache($key) { $allowedCacheKeys = [ self::CACHE_KEY_CSS, self::CACHE_KEY_SELECTOR, self::CACHE_KEY_XPATH, self::CACHE_KEY_CSS_DECLARATIONS_BLOCK, self::CACHE_KEY_COMBINED_STYLES, ]; if (!in_array($key, $allowedCacheKeys, true)) { throw new \InvalidArgumentException('Invalid cache key: ' . $key, 1391822035); } $this->caches[$key] = []; }
php
{ "resource": "" }
q2907
Emogrifier.normalizeStyleAttributes
train
private function normalizeStyleAttributes(\DOMElement $node) { $normalizedOriginalStyle = preg_replace_callback( '/[A-z\\-]+(?=\\:)/S', function (array $m) { return strtolower($m[0]); }, $node->getAttribute('style') ); // in order to not overwrite existing style attributes in the HTML, we // have to save the original HTML styles $nodePath = $node->getNodePath(); if (!isset($this->styleAttributesForNodes[$nodePath])) { $this->styleAttributesForNodes[$nodePath] = $this->parseCssDeclarationsBlock($normalizedOriginalStyle); $this->visitedNodes[$nodePath] = $node; } $node->setAttribute('style', $normalizedOriginalStyle); }
php
{ "resource": "" }
q2908
Emogrifier.getBodyElement
train
private function getBodyElement(\DOMDocument $document) { $bodyElement = $document->getElementsByTagName('body')->item(0); if ($bodyElement === null) { throw new \BadMethodCallException( 'getBodyElement method may only be called after ensureExistenceOfBodyElement has been called.', 1508173775427 ); } return $bodyElement; }
php
{ "resource": "" }
q2909
Emogrifier.createRawXmlDocument
train
private function createRawXmlDocument() { $xmlDocument = new \DOMDocument; $xmlDocument->encoding = 'UTF-8'; $xmlDocument->strictErrorChecking = false; $xmlDocument->formatOutput = true; $libXmlState = libxml_use_internal_errors(true); $xmlDocument->loadHTML($this->getUnifiedHtml()); libxml_clear_errors(); libxml_use_internal_errors($libXmlState); $xmlDocument->normalizeDocument(); return $xmlDocument; }
php
{ "resource": "" }
q2910
Emogrifier.getUnifiedHtml
train
private function getUnifiedHtml() { $htmlWithoutUnprocessableTags = $this->removeUnprocessableTags($this->html); $htmlWithDocumentType = $this->ensureDocumentType($htmlWithoutUnprocessableTags); return $this->addContentTypeMetaTag($htmlWithDocumentType); }
php
{ "resource": "" }
q2911
StatusTrait.onlyOffline
train
public static function onlyOffline() { $instance = new static; $column = $instance->getQualifiedStatusColumn(); return $instance->withoutGlobalScope(StatusScope::class)->where($column, false); }
php
{ "resource": "" }
q2912
Collection.current
train
public function current() { $currentKey = $this->keys[$this->position]; return isset($this->items[$currentKey]) ? $this->items[$currentKey] : null; }
php
{ "resource": "" }
q2913
Collection.valid
train
public function valid() { if (!isset($this->keys[$this->position])) { return false; } $currentKey = $this->keys[$this->position]; return isset($this->items[$currentKey]); }
php
{ "resource": "" }
q2914
Tx_Oelib_DataMapper.getModel
train
public function getModel(array $data) { if (!isset($data['uid'])) { throw new \InvalidArgumentException('$data must contain an element "uid".', 1331319491); } $model = $this->find($data['uid']); if ($model->isGhost()) { $this->fillModel($model, $data); } return $model; }
php
{ "resource": "" }
q2915
Tx_Oelib_DataMapper.getListOfModels
train
public function getListOfModels(array $dataOfModels) { $list = new \Tx_Oelib_List(); foreach ($dataOfModels as $modelRecord) { $list->add($this->getModel($modelRecord)); } return $list; }
php
{ "resource": "" }
q2916
Tx_Oelib_DataMapper.existsModel
train
public function existsModel($uid, $allowHidden = false) { $model = $this->find($uid); if ($model->isGhost()) { $this->load($model); } return $model->isLoaded() && (!$model->isHidden() || $allowHidden); }
php
{ "resource": "" }
q2917
Tx_Oelib_DataMapper.createRelations
train
protected function createRelations(array &$data, \Tx_Oelib_Model $model) { foreach (array_keys($this->relations) as $key) { if ($this->isOneToManyRelationConfigured($key)) { $this->createOneToManyRelation($data, $key, $model); } elseif ($this->isManyToOneRelationConfigured($key)) { $this->createManyToOneRelation($data, $key); } else { if ($this->isManyToManyRelationConfigured($key)) { $this->createMToNRelation($data, $key, $model); } else { $this->createCommaSeparatedRelation($data, $key, $model); } } } }
php
{ "resource": "" }
q2918
Tx_Oelib_DataMapper.getRelationConfigurationFromTca
train
private function getRelationConfigurationFromTca($key) { $tca = \Tx_Oelib_Db::getTcaForTable($this->getTableName()); if (!isset($tca['columns'][$key])) { throw new \BadMethodCallException( 'In the table ' . $this->getTableName() . ', the column ' . $key . ' does not have a TCA entry.', 1331319627 ); } return $tca['columns'][$key]['config']; }
php
{ "resource": "" }
q2919
Tx_Oelib_DataMapper.getNewGhost
train
public function getNewGhost() { $model = $this->createGhost($this->map->getNewUid()); $this->registerModelAsMemoryOnlyDummy($model); return $model; }
php
{ "resource": "" }
q2920
Tx_Oelib_DataMapper.save
train
public function save(\Tx_Oelib_Model $model) { if ($this->isModelAMemoryOnlyDummy($model)) { throw new \InvalidArgumentException( 'This model is a memory-only dummy that must not be saved.', 1331319682 ); } if (!$this->hasDatabaseAccess() || !$model->isDirty() || !$model->isLoaded() || $model->isReadOnly() ) { return; } $data = $this->getPreparedModelData($model); $this->cacheModelByKeys($model, $data); if ($model->hasUid()) { \Tx_Oelib_Db::update($this->getTableName(), 'uid = ' . $model->getUid(), $data); $this->deleteManyToManyRelationIntermediateRecords($model); } else { $this->prepareDataForNewRecord($data); $model->setUid(\Tx_Oelib_Db::insert($this->getTableName(), $data)); $this->map->add($model); } if ($model->isDeleted()) { $model->markAsDead(); } else { $model->markAsClean(); // We save the 1:n relations after marking this model as clean // in order to avoid infinite loops when the foreign model tries // to save this parent. $this->saveOneToManyRelationRecords($model); $this->createManyToManyRelationIntermediateRecords($model); } }
php
{ "resource": "" }
q2921
Tx_Oelib_DataMapper.getPreparedModelData
train
private function getPreparedModelData(\Tx_Oelib_Model $model) { if (!$model->hasUid()) { $model->setCreationDate(); } $model->setTimestamp(); $data = $model->getData(); foreach ($this->relations as $key => $relation) { if ($this->isOneToManyRelationConfigured($key)) { $functionName = 'count'; } elseif ($this->isManyToOneRelationConfigured($key)) { $functionName = 'getUid'; if ($data[$key] instanceof \Tx_Oelib_Model) { $this->saveManyToOneRelatedModels( $data[$key], \Tx_Oelib_MapperRegistry::get($relation) ); } } else { if ($this->isManyToManyRelationConfigured($key)) { $functionName = 'count'; } else { $functionName = 'getUids'; } if ($data[$key] instanceof \Tx_Oelib_List) { $this->saveManyToManyAndCommaSeparatedRelatedModels( $data[$key], \Tx_Oelib_MapperRegistry::get($relation) ); } } $data[$key] = (isset($data[$key]) && is_object($data[$key])) ? $data[$key]->$functionName() : 0; } return $data; }
php
{ "resource": "" }
q2922
Tx_Oelib_DataMapper.prepareDataForNewRecord
train
protected function prepareDataForNewRecord(array &$data) { if ($this->testingFramework === null) { return; } $tableName = $this->getTableName(); $this->testingFramework->markTableAsDirty($tableName); $data[$this->testingFramework->getDummyColumnName($tableName)] = 1; }
php
{ "resource": "" }
q2923
Tx_Oelib_DataMapper.deleteOneToManyRelations
train
private function deleteOneToManyRelations(\Tx_Oelib_Model $model) { $data = $model->getData(); foreach ($this->relations as $key => $mapperName) { if ($this->isOneToManyRelationConfigured($key)) { $relatedModels = $data[$key]; if (!is_object($relatedModels)) { continue; } $mapper = \Tx_Oelib_MapperRegistry::get($mapperName); /** @var \Tx_Oelib_Model $relatedModel */ foreach ($relatedModels as $relatedModel) { $mapper->delete($relatedModel); } } } }
php
{ "resource": "" }
q2924
Tx_Oelib_DataMapper.getUniversalWhereClause
train
protected function getUniversalWhereClause($allowHiddenRecords = false) { $tableName = $this->getTableName(); if ($this->testingFramework !== null) { $dummyColumnName = $this->testingFramework->getDummyColumnName($tableName); $leftPart = \Tx_Oelib_Db::tableHasColumn($this->getTableName(), $dummyColumnName) ? $dummyColumnName . ' = 1' : '1 = 1'; } else { $leftPart = '1 = 1'; } return $leftPart . \Tx_Oelib_Db::enableFields($tableName, ($allowHiddenRecords ? 1 : -1)); }
php
{ "resource": "" }
q2925
Tx_Oelib_DataMapper.registerModelAsMemoryOnlyDummy
train
private function registerModelAsMemoryOnlyDummy(\Tx_Oelib_Model $model) { if (!$model->hasUid()) { return; } $this->uidsOfMemoryOnlyDummyModels[$model->getUid()] = true; }
php
{ "resource": "" }
q2926
Tx_Oelib_DataMapper.findByWhereClause
train
protected function findByWhereClause($whereClause = '', $sorting = '', $limit = '') { $orderBy = ''; $tca = \Tx_Oelib_Db::getTcaForTable($this->getTableName()); if ($sorting !== '') { $orderBy = $sorting; } elseif (isset($tca['ctrl']['default_sortby'])) { $matches = []; if (preg_match( '/^ORDER BY (.+)$/', $tca['ctrl']['default_sortby'], $matches )) { $orderBy = $matches[1]; } } $completeWhereClause = ($whereClause === '') ? '' : $whereClause . ' AND '; $rows = \Tx_Oelib_Db::selectMultiple( '*', $this->getTableName(), $completeWhereClause . $this->getUniversalWhereClause(), '', $orderBy, $limit ); return $this->getListOfModels($rows); }
php
{ "resource": "" }
q2927
Tx_Oelib_DataMapper.findByPageUid
train
public function findByPageUid($pageUids, $sorting = '', $limit = '') { if (($pageUids === '') || ($pageUids === '0') || ($pageUids === 0)) { return $this->findByWhereClause('', $sorting, $limit); } return $this->findByWhereClause($this->getTableName() . '.pid IN (' . $pageUids . ')', $sorting, $limit); }
php
{ "resource": "" }
q2928
Tx_Oelib_DataMapper.findOneByKeyFromCache
train
protected function findOneByKeyFromCache($key, $value) { if ($key === '') { throw new \InvalidArgumentException('$key must not be empty.', 1416847364); } if (!isset($this->cacheByKey[$key])) { throw new \InvalidArgumentException('"' . $key . '" is not a valid key for this mapper.', 1331319882); } if ($value === '') { throw new \InvalidArgumentException('$value must not be empty.', 1331319892); } if (!isset($this->cacheByKey[$key][$value])) { throw new \Tx_Oelib_Exception_NotFound(); } return $this->cacheByKey[$key][$value]; }
php
{ "resource": "" }
q2929
Tx_Oelib_DataMapper.findOneByCompoundKeyFromCache
train
public function findOneByCompoundKeyFromCache($value) { if ($value === '') { throw new \InvalidArgumentException('$value must not be empty.', 1331319992); } if (!isset($this->cacheByCompoundKey[$value])) { throw new \Tx_Oelib_Exception_NotFound(); } return $this->cacheByCompoundKey[$value]; }
php
{ "resource": "" }
q2930
Tx_Oelib_DataMapper.cacheModelByCompoundKey
train
protected function cacheModelByCompoundKey(\Tx_Oelib_Model $model, array $data) { if (empty($this->compoundKeyParts)) { throw new \BadMethodCallException( 'The compound key parts are not defined.', 1363806895 ); } $values = []; foreach ($this->compoundKeyParts as $key) { if (isset($data[$key])) { $values[] = $data[$key]; } } if (count($this->compoundKeyParts) === count($values)) { $value = implode('.', $values); if ($value !== '') { $this->cacheByCompoundKey[$value] = $model; } } }
php
{ "resource": "" }
q2931
Tx_Oelib_DataMapper.findOneByKey
train
public function findOneByKey($key, $value) { try { $model = $this->findOneByKeyFromCache($key, $value); } catch (\Tx_Oelib_Exception_NotFound $exception) { $model = $this->findSingleByWhereClause([$key => $value]); } return $model; }
php
{ "resource": "" }
q2932
Tx_Oelib_DataMapper.findOneByCompoundKey
train
public function findOneByCompoundKey(array $compoundKeyValues) { if (empty($compoundKeyValues)) { throw new \InvalidArgumentException( get_class($this) . '::compoundKeyValues must not be empty.', 1354976660 ); } try { $model = $this->findOneByCompoundKeyFromCache($this->extractCompoundKeyValues($compoundKeyValues)); } catch (\Tx_Oelib_Exception_NotFound $exception) { $model = $this->findSingleByWhereClause($compoundKeyValues); } return $model; }
php
{ "resource": "" }
q2933
Tx_Oelib_DataMapper.extractCompoundKeyValues
train
protected function extractCompoundKeyValues(array $compoundKeyValues) { $values = []; foreach ($this->compoundKeyParts as $key) { if (!isset($compoundKeyValues[$key])) { throw new \InvalidArgumentException( get_class($this) . '::keyValue does not contain all compound keys.', 1354976661 ); } $values[] = $compoundKeyValues[$key]; } return implode('.', $values); }
php
{ "resource": "" }
q2934
Tx_Oelib_DataMapper.countByWhereClause
train
public function countByWhereClause($whereClause = '') { $completeWhereClause = ($whereClause === '') ? '' : $whereClause . ' AND '; return \Tx_Oelib_Db::count($this->getTableName(), $completeWhereClause . $this->getUniversalWhereClause()); }
php
{ "resource": "" }
q2935
Tx_Oelib_DataMapper.countByPageUid
train
public function countByPageUid($pageUids) { if (($pageUids === '') || ($pageUids === '0')) { return $this->countByWhereClause(''); } return $this->countByWhereClause($this->getTableName() . '.pid IN (' . $pageUids . ')'); }
php
{ "resource": "" }
q2936
GiroCheckout_SDK_Tools.getCreditCardLogoName
train
public static function getCreditCardLogoName($visa_msc = false, $amex = false, $jcb = false) { if( $visa_msc == false && $amex == false && $jcb == false ) { return null; } $logoName = ''; if( $visa_msc ) { $logoName .= 'visa_msc_'; } if( $amex ) { $logoName .= 'amex_'; } if( $jcb ) { $logoName .= 'jcb_'; } $logoName .= '40px.png'; return $logoName; }
php
{ "resource": "" }
q2937
DataTablesRepositoryHelper.appendOrder
train
public static function appendOrder(QueryBuilder $queryBuilder, DataTablesWrapperInterface $dtWrapper) { foreach ($dtWrapper->getRequest()->getOrder() as $dtOrder) { $dtColumn = array_values($dtWrapper->getColumns())[$dtOrder->getColumn()]; if (false === $dtColumn->getOrderable()) { continue; } $queryBuilder->addOrderBy($dtColumn->getMapping()->getAlias(), $dtOrder->getDir()); } }
php
{ "resource": "" }
q2938
DataTablesRepositoryHelper.appendWhere
train
public static function appendWhere(QueryBuilder $queryBuilder, DataTablesWrapperInterface $dtWrapper) { $operator = static::determineOperator($dtWrapper); if (null === $operator) { return; } $wheres = []; $params = []; $values = []; foreach ($dtWrapper->getRequest()->getColumns() as $dtColumn) { if (true === $dtColumn->getSearchable() && ("OR" === $operator || "" !== $dtColumn->getSearch()->getValue())) { $wheres[] = DataTablesMappingHelper::getWhere($dtColumn->getMapping()); $params[] = DataTablesMappingHelper::getParam($dtColumn->getMapping()); $values[] = "%" . ("AND" === $operator ? $dtColumn->getSearch()->getValue() : $dtWrapper->getRequest()->getSearch()->getValue()) . "%"; } } $queryBuilder->andWhere("(" . implode(" " . $operator . " ", $wheres) . ")"); for ($i = count($params) - 1; 0 <= $i; --$i) { $queryBuilder->setParameter($params[$i], $values[$i]); } }
php
{ "resource": "" }
q2939
DataTablesRepositoryHelper.determineOperator
train
public static function determineOperator(DataTablesWrapperInterface $dtWrapper) { foreach ($dtWrapper->getRequest()->getColumns() as $dtColumn) { if (false === $dtColumn->getSearchable()) { continue; } if ("" !== $dtColumn->getSearch()->getValue()) { return "AND"; } } // Check if the wrapper defines a search. if ("" !== $dtWrapper->getRequest()->getSearch()->getValue()) { return "OR"; } return null; }
php
{ "resource": "" }
q2940
Library.init
train
final public function init($sName, $xDialog) { // Set the library name $this->sName = $sName; // Set the dialog $this->xDialog = $xDialog; // Set the Response instance $this->setResponse($xDialog->response()); // Set the default URI. $this->sUri = $this->xDialog->getOption('dialogs.lib.uri', $this->sUri); // Set the library URI. $this->sUri = rtrim($this->getOption('uri', $this->sUri), '/'); // Set the subdir $this->sSubDir = trim($this->getOption('subdir', $this->sSubDir), '/'); // Set the version number $this->sVersion = trim($this->getOption('version', $this->sVersion), '/'); }
php
{ "resource": "" }
q2941
Library.hasOption
train
final public function hasOption($sName) { $sName = 'dialogs.' . $this->getName() . '.' . $sName; return $this->xDialog->hasOption($sName); }
php
{ "resource": "" }
q2942
Configuration.create
train
public static function create($mapping = array()) { $defaultMapping = array( 'autoload' => self::DEFAULT_INITIALIZER_NS . '\Autoload', 'dependencies' => self::DEFAULT_INITIALIZER_NS . '\Dependencies', 'general-settings' => self::DEFAULT_INITIALIZER_NS . '\ThemeSettings', 'customizer' => self::DEFAULT_INITIALIZER_NS . '\Customizer', 'image-sizes' => self::DEFAULT_INITIALIZER_NS . '\ImageSizes', 'widget-areas' => self::DEFAULT_INITIALIZER_NS . '\WidgetAreas', 'menu-locations' => self::DEFAULT_INITIALIZER_NS . '\MenuLocations', 'theme-supports' => self::DEFAULT_INITIALIZER_NS . '\ThemeSupports', 'assets' => self::DEFAULT_INITIALIZER_NS . '\Assets', 'templates' => self::DEFAULT_INITIALIZER_NS . '\Templates' ); $finalMapping = array_merge($defaultMapping, $mapping); return new Configuration($finalMapping); }
php
{ "resource": "" }
q2943
Configuration.apply
train
public function apply() { foreach ($this->initializers as $id => $initializer) { do_action('baobab/configuration/before-initializer?id=' . $id); $initializer->run(); do_action('baobab/configuration/after-initializer?id=' . $id); } }
php
{ "resource": "" }
q2944
Configuration.getOrThrow
train
public function getOrThrow($section, $key) { if ( !isset($this->initializers[$section])) { throw new UnknownSectionException($section); } return $this->initializers[$section]->getSettingOrThrow($key); }
php
{ "resource": "" }
q2945
Configuration.get
train
public function get($section, $key, $defaultValue = null) { if ( !isset($this->initializers[$section])) { return $defaultValue; } return $this->initializers[$section]->getSetting($key, $defaultValue); }
php
{ "resource": "" }
q2946
Tx_Oelib_ViewHelpers_UppercaseViewHelper.render
train
public function render() { $renderedChildren = $this->renderChildren(); $encoding = mb_detect_encoding($renderedChildren); return mb_strtoupper($renderedChildren, $encoding); }
php
{ "resource": "" }
q2947
MustacheUtil.loadHelpers
train
public static function loadHelpers() { // set-up helper container $helpers = array(); // load defaults $helperDir = Config::getOption("sourceDir").DIRECTORY_SEPARATOR."_mustache-components/helpers"; $helperExt = Config::getOption("mustacheHelperExt"); $helperExt = $helperExt ? $helperExt : "helper.php"; if (is_dir($helperDir)) { // loop through the filter dir... $finder = new Finder(); $finder->files()->name("*\.".$helperExt)->in($helperDir); $finder->sortByName(); foreach ($finder as $file) { // see if the file should be ignored or not $baseName = $file->getBasename(); if ($baseName[0] != "_") { include($file->getPathname()); // $key may or may not be defined in the included file // $helper needs to be defined in the included file if (isset($helper)) { if (!isset($key)) { $key = $file->getBasename(".".$helperExt); } $helpers[$key] = $helper; unset($helper); unset($key); } } } } return $helpers; }
php
{ "resource": "" }
q2948
Tx_Oelib_Mail.setSubject
train
public function setSubject($subject) { if ($subject === '') { throw new \InvalidArgumentException('$subject must not be empty.', 1331488802); } if ((strpos($subject, CR) !== false) || (strpos($subject, LF) !== false)) { throw new \InvalidArgumentException( '$subject must not contain any line breaks or carriage returns.', 1331488817 ); } $this->setAsString('subject', $subject); }
php
{ "resource": "" }
q2949
Tx_Oelib_Mail.setHTMLMessage
train
public function setHTMLMessage($message) { if ($message === '') { throw new \InvalidArgumentException('$message must not be empty.', 1331488845); } if ($this->hasCssFile()) { $this->loadEmogrifierClass(); $emogrifier = new Emogrifier($message, $this->getCssFile()); $messageToStore = $emogrifier->emogrify(); } else { $messageToStore = $message; } $this->setAsString('html_message', $messageToStore); }
php
{ "resource": "" }
q2950
Tx_Oelib_Mail.setCssFile
train
public function setCssFile($cssFile) { if (!$this->cssFileIsCached($cssFile)) { $absoluteFileName = GeneralUtility::getFileAbsFileName($cssFile); if (($cssFile !== '') && is_readable($absoluteFileName) ) { self::$cssFileCache[$cssFile] = file_get_contents($absoluteFileName); } else { self::$cssFileCache[$cssFile] = ''; } } $this->setAsString('cssFile', self::$cssFileCache[$cssFile]); }
php
{ "resource": "" }
q2951
Tx_Oelib_Mapper_FrontEndUser.getGroupMembers
train
public function getGroupMembers($groupUids) { if ($groupUids === '') { throw new \InvalidArgumentException('$groupUids must not be an empty string.', 1331488505); } return $this->getListOfModels( \Tx_Oelib_Db::selectMultiple( '*', $this->getTableName(), $this->getUniversalWhereClause() . ' AND ' . 'usergroup REGEXP \'(^|,)(' . implode('|', GeneralUtility::intExplode(',', $groupUids)) . ')($|,)\'' ) ); }
php
{ "resource": "" }
q2952
AuthHelper.generateAppCredentials
train
public function generateAppCredentials($apiKey, $apiSecret) { $apiKey = urlencode($apiKey); $apiSecret = urlencode($apiSecret); $credentials = base64_encode("{$apiKey}:{$apiSecret}"); return $credentials; }
php
{ "resource": "" }
q2953
MetadataAwareStringFrontend.insertMetadata
train
protected function insertMetadata($content, $entryIdentifier, array $tags, $lifetime) { if (!is_string($content)) { throw new InvalidDataTypeException('Given data is of type "' . gettype($content) . '", but a string is expected for string cache.', 1433155737); } $metadata = array( 'identifier' => $entryIdentifier, 'tags' => $tags, 'lifetime' => $lifetime ); $metadataJson = json_encode($metadata); $this->metadata[$entryIdentifier] = $metadata; return $metadataJson . self::SEPARATOR . $content; }
php
{ "resource": "" }
q2954
MetadataAwareStringFrontend.extractMetadata
train
protected function extractMetadata($entryIdentifier, $content) { $separatorIndex = strpos($content, self::SEPARATOR); if ($separatorIndex === false) { $exception = new InvalidDataTypeException('Could not find cache metadata in entry with identifier ' . $entryIdentifier, 1433155925); if ($this->environment->getContext()->isProduction()) { $this->logger->logException($exception); } else { throw $exception; } } $metadataJson = substr($content, 0, $separatorIndex); $metadata = json_decode($metadataJson, true); if ($metadata === null) { $exception = new InvalidDataTypeException('Invalid cache metadata in entry with identifier ' . $entryIdentifier, 1433155926); if ($this->environment->getContext()->isProduction()) { $this->logger->logException($exception); } else { throw $exception; } } $this->metadata[$entryIdentifier] = $metadata; return substr($content, $separatorIndex + 1); }
php
{ "resource": "" }
q2955
Intuition.setLang
train
public function setLang( $lang ) { if ( !IntuitionUtil::nonEmptyStr( $lang ) ) { return false; } $this->currentLanguage = $this->normalizeLang( $lang ); return true; }
php
{ "resource": "" }
q2956
Intuition.getMessagesFunctions
train
protected function getMessagesFunctions() { if ( $this->messagesFunctions == null ) { $this->messagesFunctions = MessagesFunctions::getInstance( $this->localBaseDir, $this ); } return $this->messagesFunctions; }
php
{ "resource": "" }
q2957
Intuition.msg
train
public function msg( $key = 0, $options = [], $fail = null ) { if ( !IntuitionUtil::nonEmptyStr( $key ) ) { // Invalid message key return $this->bracketMsg( $key, $fail ); } $defaultOptions = [ 'domain' => $this->getDomain(), 'lang' => $this->getLang(), 'variables' => [], 'raw-variables' => false, 'escape' => 'plain', 'parsemag' => true, 'externallinks' => false, // Set to a wiki article path for converting 'wikilinks' => false, ]; // If $options was a domain string, convert it now. if ( IntuitionUtil::nonEmptyStr( $options ) ) { $options = [ 'domain' => $options ]; } // If $options is still not an array, ignore it and use default // Otherwise merge the options with the defaults. if ( !is_array( $options ) ) { // @codeCoverageIgnoreStart $options = $defaultOptions; } else { // @codeCoverageIgnoreEnd $options = array_merge( $defaultOptions, $options ); } // Normalise key. First character is case-insensitive. $key = lcfirst( $key ); $msg = $this->rawMsg( $options['domain'], $options['lang'], $key ); if ( $msg === null ) { $this->errTrigger( "Message \"$key\" for lang \"{$options['lang']}\" in domain \"{$options['domain']}\" not found", __METHOD__, E_NOTICE ); return $this->bracketMsg( $key, $fail ); } // Now that we've got the message, apply any post processing $escapeDone = false; // If using raw variables, escape message before replacement if ( $options['raw-variables'] === true ) { $msg = IntuitionUtil::strEscape( $msg, $options['escape'] ); $escapeDone = true; } // Replace variables foreach ( $options['variables'] as $i => $val ) { $n = $i + 1; $msg = str_replace( "\$$n", $val, $msg ); } if ( $options['parsemag'] === true ) { $msg = $this->getMessagesFunctions()->parse( $msg, $options['lang'] ); } // If not using raw vars, escape the message now (after variable replacement). if ( !$escapeDone ) { $escapeDone = true; $msg = IntuitionUtil::strEscape( $msg, $options['escape'] ); } if ( is_string( $options['wikilinks'] ) ) { $msg = IntuitionUtil::parseWikiLinks( $msg, $options['wikilinks'] ); } if ( $options['externallinks'] ) { $msg = IntuitionUtil::parseExternalLinks( $msg ); } return $msg; }
php
{ "resource": "" }
q2958
Intuition.setMsg
train
public function setMsg( $key, $message, $domain = null, $lang = null ) { $domain = IntuitionUtil::nonEmptyStr( $domain ) ? $this->normalizeDomain( $domain ) : $this->getDomain(); $lang = IntuitionUtil::nonEmptyStr( $lang ) ? $this->normalizeLang( $lang ) : $this->getLang(); $this->messageBlob[$domain][$lang][$key] = $message; }
php
{ "resource": "" }
q2959
Intuition.setMsgs
train
public function setMsgs( $messagesByKey, $domain = null, $lang = null ) { foreach ( $messagesByKey as $key => $message ) { $this->setMsg( $key, $message, $domain, $lang ); } }
php
{ "resource": "" }
q2960
Intuition.registerDomain
train
public function registerDomain( $domain, $dir, $info = [] ) { $info['dir'] = $dir; $this->domainInfos[ $this->normalizeDomain( $domain ) ] = $info; }
php
{ "resource": "" }
q2961
Intuition.addDomainInfo
train
public function addDomainInfo( $domain, array $info ) { $domain = $this->normalizeDomain( $domain ); if ( isset( $this->domainInfos[ $domain ] ) ) { $this->domainInfos[ $domain ] += $info; } }
php
{ "resource": "" }
q2962
Intuition.listMsgs
train
public function listMsgs( $domain ) { $domain = $this->normalizeDomain( $domain ); $this->ensureLoaded( $domain, 'en' ); // Ignore load failure to allow listing of messages that // were manually registered (in case there are any). if ( !isset( $this->messageBlob[$domain]['en'] ) ) { return []; } return array_keys( $this->messageBlob[$domain]['en'] ); }
php
{ "resource": "" }
q2963
Intuition.getLangFallbacks
train
public function getLangFallbacks( $lang ) { if ( self::$fallbackCache === null ) { // Lazy-initialize self::$fallbackCache = $this->fetchLangFallbacks(); } $lang = $this->normalizeLang( $lang ); return isset( self::$fallbackCache[$lang] ) ? self::$fallbackCache[$lang] : [ 'en' ]; }
php
{ "resource": "" }
q2964
Intuition.getLangName
train
public function getLangName( $lang = false ) { $lang = $lang ? $this->normalizeLang( $lang ) : $this->getLang(); return $this->getLangNames()[$lang] ?? ''; }
php
{ "resource": "" }
q2965
Intuition.getLangNames
train
public function getLangNames() { // Lazy-load and cache if ( $this->langNames === null ) { $path = $this->localBaseDir . '/language/mw-classes/Names.php'; // @codeCoverageIgnoreStart if ( !is_readable( $path ) ) { $this->errTrigger( 'Names.php is missing', __METHOD__, E_NOTICE ); $this->langNames = []; return []; } // @codeCoverageIgnoreEnd // Load it require_once $path; $this->langNames = \MediaWiki\Languages\Data\Names::$names; } return $this->langNames; }
php
{ "resource": "" }
q2966
Intuition.addAvailableLang
train
public function addAvailableLang( $code, $name ) { // Initialise $this->langNames so that we can extend it $this->getLangNames(); $normalizedCode = $this->normalizeLang( $code ); $this->langNames[$normalizedCode] = $name; $this->availableLanguages[$normalizedCode] = $name; }
php
{ "resource": "" }
q2967
Intuition.ensureLoaded
train
protected function ensureLoaded( $domain, $lang ) { if ( isset( $this->loadedDomains[ $domain ][ $lang ] ) ) { // Already tried return $this->loadedDomains[ $domain ][ $lang ]; } // Validate input and protect against path traversal if ( !IntuitionUtil::nonEmptyStrs( $domain, $lang ) || strcspn( $domain, ":/\\\000" ) !== strlen( $domain ) || strcspn( $lang, ":/\\\000" ) !== strlen( $lang ) ) { $this->errTrigger( 'Illegal domain or lang', __METHOD__, E_NOTICE ); return false; } $this->loadedDomains[ $domain ][ $lang ] = false; if ( !isset( self::$messageCache[ $domain ][ $lang ] ) ) { // Load from disk $domainInfo = $this->getDomainInfo( $domain ); if ( !$domainInfo ) { // Unknown domain. Perhaps dev-mode only with // messages provided via setMsgs()? return false; } $file = $domainInfo['dir'] . "/$lang.json"; $this->loadMessageFile( $domain, $lang, $file ); } else { // Load from static cache, e.g. from a previous instance of this class $this->setMsgs( self::$messageCache[ $domain ][ $lang ], $domain, $lang ); } $this->loadedDomains[ $domain ][ $lang ] = true; return true; }
php
{ "resource": "" }
q2968
Intuition.setExpiryTrackerCookie
train
protected function setExpiryTrackerCookie( $lifetime ) { $val = time() + $lifetime; $this->setCookie( 'track-expire', $val, $lifetime, TSINT_COOKIE_NOTRACK ); return true; }
php
{ "resource": "" }
q2969
Intuition.renewCookies
train
public function renewCookies( $lifetime = 2592000 ) { foreach ( $this->getCookieNames() as $key => $name ) { if ( $key === 'track-expire' ) { continue; } if ( isset( $_COOKIE[$name] ) ) { $this->setCookie( $key, $_COOKIE[$name], $lifetime, TSINT_COOKIE_NOTRACK ); } } $this->setExpiryTrackerCookie( $lifetime ); return true; }
php
{ "resource": "" }
q2970
Intuition.wipeCookies
train
public function wipeCookies() { foreach ( $this->getCookieNames() as $key => $name ) { $this->setCookie( $key, '', -3600, TSINT_COOKIE_NOTRACK ); unset( $_COOKIE[$name] ); } return true; }
php
{ "resource": "" }
q2971
Intuition.getCookieExpiration
train
public function getCookieExpiration() { $name = $this->getCookieName( 'track-expire' ); return isset( $_COOKIE[$name] ) ? intval( $_COOKIE[$name] ) : 0; }
php
{ "resource": "" }
q2972
Intuition.getPromoBox
train
public function getPromoBox( $imgSize = 28, $helpTranslateDomain = TSINT_HELP_CURRENT ) { // Logo if ( is_int( $imgSize ) && $imgSize > 0 ) { $src = '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Tool_labs_logo.svg/' . '/' . $imgSize . 'px-Tool_labs_logo.svg.png'; $src_2x = '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Tool_labs_logo.svg/' . '/' . ( $imgSize * 2 ) . 'px-Tool_labs_logo.svg.png'; $img = IntuitionUtil::tag( '', 'img', [ 'src' => $src, 'srcset' => "$src 1x, $src_2x 2x", 'width' => $imgSize, 'height' => $imgSize, 'alt' => '', 'title' => '', 'class' => 'int-logo', ] ); } else { $img = ''; } // Promo message $promoMsgOpts = [ 'domain' => 'tsintuition', 'escape' => 'html', 'raw-variables' => true, 'variables' => [ '<a href="//translatewiki.net/">translatewiki.net</a>', '<a href="' . $this->dashboardHome . '">Intuition</a>' ], ]; $poweredHtml = $this->msg( 'bl-promo', $promoMsgOpts ); // "Help translation" link $translateGroup = null; if ( $helpTranslateDomain === TSINT_HELP_ALL ) { $translateGroup = 'tsint-0-all'; $twLinkText = $this->msg( 'help-translate-all', 'tsintuition' ); } elseif ( $helpTranslateDomain === TSINT_HELP_CURRENT ) { $domain = $this->getDomain(); $translateGroup = $this->isLocalDomain( $domain ) ? "tsint-{$domain}" : "int-{$domain}"; $twLinkText = $this->msg( 'help-translate-tool', 'tsintuition' ); } elseif ( $helpTranslateDomain !== TSINT_HELP_NONE ) { // Custom domain $domain = $this->normalizeDomain( $helpTranslateDomain ); $translateGroup = $this->isLocalDomain( $domain ) ? "tsint-{$domain}" : "int-{$domain}"; $twLinkText = $this->msg( 'help-translate-tool', 'tsintuition' ); } $helpTranslateLink = ''; if ( $translateGroup ) { // https://translatewiki.net/w/i.php?language=nl&title=Special:Translate&group=tsint-0-all $twParams = [ 'title' => 'Special:Translate', 'language' => $this->getLang(), 'group' => $translateGroup, ]; $twParams = http_build_query( $twParams ); $helpTranslateLink = '<small>(' . IntuitionUtil::tag( $twLinkText, 'a', [ 'href' => "https://translatewiki.net/w/i.php?$twParams", 'title' => $this->msg( 'help-translate-tooltip', 'tsintuition' ) ] ) . ')</small>'; } // Build output return '<div class="int-promobox"><p><a href="' . htmlspecialchars( $this->getDashboardReturnToUrl() ) . "\">$img</a> " . "$poweredHtml {$this->dashboardBacklink()} $helpTranslateLink</p></div>"; }
php
{ "resource": "" }
q2973
Intuition.getDashboardReturnToUrl
train
public function getDashboardReturnToUrl() { $p = [ 'returnto' => $_SERVER['SCRIPT_NAME'], 'returntoquery' => http_build_query( $_GET ), ]; return rtrim( $this->dashboardHome, '/' ) . '/?' . http_build_query( $p ) . '#tab-settingsform'; }
php
{ "resource": "" }
q2974
Intuition.redirectTo
train
public function redirectTo( $url = 0, $code = 302 ) { if ( $url === null ) { $this->redirectTo = null; return true; } if ( !is_string( $url ) || !is_int( $code ) ) { return false; } $this->redirectTo = [ $url, $code ]; return true; }
php
{ "resource": "" }
q2975
Intuition.dateFormatted
train
public function dateFormatted( $first = null, $second = null, $lang = null ) { // One argument or less if ( $second === null ) { // No arguments if ( $first === null ) { $format = $this->msg( 'dateformat', 'general' ); $timestamp = time(); // Timestamp only } elseif ( is_int( $first ) ) { $format = $this->msg( 'dateformat', 'general' ); $timestamp = $first; // Date string only } elseif ( strtotime( $first ) ) { $format = $this->msg( 'dateformat', 'general' ); $timestamp = strtotime( $first ); // Format only } else { $format = $first; $timestamp = time(); } // Two arguments } else { $format = $first; $timestamp = is_int( $second ) ? $second : strtotime( $second ); } // Save current setlocale $saved = setlocale( LC_ALL, 0 ); // Overwrite for current language setlocale( LC_ALL, $this->getLocale( $lang ) ); $return = strftime( $format, $timestamp ); // Reset back to what it was setlocale( LC_ALL, $saved ); return $return; }
php
{ "resource": "" }
q2976
Intuition.initLangSelect
train
protected function initLangSelect( $option = null ) { if ( $option !== null && $option !== false && $option !== '' && $this->setLang( $option ) ) { return true; } if ( $this->getUseRequestParam() ) { $key = $this->paramNames['userlang']; if ( isset( $_GET[ $key ] ) && $this->setLang( $_GET[ $key ] ) ) { return true; } if ( isset( $_POST[ $key ] ) && $this->setLang( $_POST[ $key ] ) ) { return true; } } if ( isset( $_COOKIE[ $this->cookieNames['userlang'] ] ) ) { $set = $this->setLang( $_COOKIE[ $this->cookieNames['userlang'] ] ); if ( $set ) { return true; } } $acceptableLanguages = IntuitionUtil::getAcceptableLanguages(); foreach ( $acceptableLanguages as $acceptLang => $qVal ) { // If the lang code is known (we have a display name for it), // and we were able to set it, end the search. if ( $this->getLangName( $acceptLang ) && $this->setLang( $acceptLang ) ) { return true; } } // After this, we'll be choosing from // user-specified languages with a $qVal of 0. foreach ( $acceptableLanguages as $acceptLang => $qVal ) { // Some browsers show (apparently by default) only a tag, // such as "ru-RU", "fr-FR" or "es-mx". The browser should // provide a qval. Providing only a lang code is invalid. // See RFC 2616 section 1.4 <https://tools.ietf.org/html/rfc2616#page-105>. if ( !$qVal ) { continue; } // Progressively truncate $acceptLang (from the right) to each hyphen, // checking each time to see if the remaining string is an available language. while ( strpos( $acceptLang, '-' ) !== false ) { $acceptLang = substr( $acceptLang, 0, strrpos( $acceptLang, '-' ) ); if ( $this->getLangName( $acceptLang ) && $this->setLang( $acceptLang ) ) { return true; } } } // Fallback return !!$this->setLang( 'en' ); }
php
{ "resource": "" }
q2977
Intuition.isRtl
train
public function isRtl( $lang = null ) { static $rtlLanguages = null; $lang = $lang ? $this->normalizeLang( $lang ) : $this->getLang(); if ( $rtlLanguages === null ) { $file = $this->localBaseDir . '/language/rtl.json'; $rtlLanguages = json_decode( file_get_contents( $file ), true ); } return in_array( $lang, $rtlLanguages ); }
php
{ "resource": "" }
q2978
Entity.delete
train
public function delete() { $url = "entities"; if ($this->_id) { $url .= "/{$this->_id}"; } if ($this->_type) { $url .= "?type={$this->_type}"; } return $this->_orion->delete($url); }
php
{ "resource": "" }
q2979
Entity.getAttribute
train
public function getAttribute($attr) { $url = "entities/{$this->_id}/attrs/$attr"; if ($this->_type) { $url .= "?type={$this->_type}"; } return $this->_orion->get($url); }
php
{ "resource": "" }
q2980
Entity.getAttributeValue
train
public function getAttributeValue($attr, &$request = null) { $url = "entities/{$this->_id}/attrs/$attr/value"; if ($this->_type) { $url .= "?type={$this->_type}"; } return $this->_orion->get($url, $request, "text/plain","text/plain"); }
php
{ "resource": "" }
q2981
Entity.deleteAttribute
train
public function deleteAttribute($attr) { $url = "entities/{$this->_id}/attrs/$attr"; if ($this->_type) { $url .= "?type={$this->_type}"; } return $this->_orion->delete($url); }
php
{ "resource": "" }
q2982
Entity.replaceAttributes
train
public function replaceAttributes(array $attrs) { $url = "entities/{$this->_id}/attrs"; if ($this->_type) { $url .= "?type={$this->_type}"; } $updateEntity = new ContextFactory($attrs); return $this->_orion->put($url, $updateEntity); }
php
{ "resource": "" }
q2983
Entity.appendAttribute
train
public function appendAttribute($attr, $value, $type, $metadata = null, $options = []) { $attrs = [ $attr => [ "value" => $value, "type" => $type ] ]; if ($metadata != null) { $attrs['metadata'] = $metadata; } return $this->appendAttributes($attrs, $options); }
php
{ "resource": "" }
q2984
Entity.appendAttributes
train
public function appendAttributes(array $attrs, $options = ["option" => "append"]) { $url = "entities/{$this->_id}/attrs"; if ($this->_type) { $url .= "?type={$this->_type}"; } if (count($options) > 0) { $prefix = ($this->_type) ? "&" : "?"; $url .= $prefix . urldecode(http_build_query($options)); } $updateEntity = new ContextFactory($attrs); return $this->_orion->create($url, $updateEntity); }
php
{ "resource": "" }
q2985
Entity.coordsQueryString
train
private function coordsQueryString(array $coords) { $count = count($coords); //If is a simple lat long array if ($count == 2) { if (is_numeric($coords[0]) && is_numeric($coords[1])) { /** * Orion uses Lat/Lng value instead Lng/Lat as GeoJson format, * since a geoJson is passed it should be reversed to fit on Orion Format. * All function of array_reverse uses */ return implode(',', array_reverse($coords)); // return implode(',', $coords); } elseif (is_array($coords[0]) && is_array($coords[1])) { //Maybe is a 2 points line foreach ($coords[0] as $key => $coord) { $coords[0][$key] = implode(',', array_reverse($coord)); // $coords[0][$key] = implode(',', $coord); } return implode(";", $coords[0]); } } //If is a polygon geometry, multiple polygons aren't supported if ($count == 1 && is_array($coords[0]) && count($coords[0]) >= 3) { foreach ($coords[0] as $key => $coord) { $coords[0][$key] = implode(',', array_reverse($coord)); // $coords[0][$key] = implode(',', $coord); } return implode(";", $coords[0]); } //Maybe is a 3 points + line: if ($count > 2) { $first = $coords[0]; $last = end($coords); reset($coords); //but just maybe, be kind with me or sugest a new function to do that. if (is_array($first) && is_array($last)) { foreach ($coords as $key => $coord) { $coords[$key] = implode(',', $coord); } return implode(";", $coords); } } throw new \LogicException("You got me! :( Please report it to https://github.com/VM9/orion-explorer-php-frame-work/issues "); }
php
{ "resource": "" }
q2986
Entity.geoQuery
train
public function geoQuery($georel, $geoJson, array $modifiers = [], array $options = [], &$request = null) { if (is_string($geoJson)) { $geoJson = json_decode($geoJson); } elseif (is_array($geoJson)) { $geoJson = (object) $geoJson; } if ($geoJson == null) { throw new \Exception('$geoJson Param should be a valid GeoJson object or string'); } array_unshift($modifiers, $georel); $options["georel"] = implode(";", $modifiers); $options["geometry"] = strtolower($geoJson->type); $options["coords"] = $this->coordsQueryString($geoJson->coordinates); return $this->getContext($options, $request); }
php
{ "resource": "" }
q2987
Entity.getCoveredBy
train
public function getCoveredBy($geoJson, array $modifiers = [], array $options = [], &$request = null) { return $this->geoQuery("coveredBy", $geoJson, $modifiers, $options, $request); }
php
{ "resource": "" }
q2988
Entity.getIntersections
train
public function getIntersections($geoJson, array $modifiers = [], array $options = [], &$request = null) { return $this->geoQuery("intersects", $geoJson, $modifiers, $options, $request); }
php
{ "resource": "" }
q2989
Entity.getDisjoints
train
public function getDisjoints($geoJson, array $modifiers = [], array $options = [], &$request = null) { return $this->geoQuery("disjoint", $geoJson, $modifiers, $options, $request); }
php
{ "resource": "" }
q2990
Entity.getGeoEquals
train
public function getGeoEquals($geoJson, array $modifiers = [], array $options = [], &$request) { return $this->geoQuery("equals", $geoJson, $modifiers, $options, $request); }
php
{ "resource": "" }
q2991
GiroCheckout_SDK_Debug_helper.init
train
public function init($logFilePrefix) { self::$logFileName = date('Y-m-d_H-i-s') . '-' . ucfirst($logFilePrefix) . '-' . md5(time()) . '.log'; $ssl = null; $this->writeLog(sprintf($this->debugStrings['start'], date('Y-m-d H:i:s'))); if (in_array('curl', get_loaded_extensions())) { $curl_version = curl_version(); $curl = $curl_version['version']; $ssl = $curl_version['ssl_version']; } else { $curl = 'no'; } if (!$ssl && in_array('openssl', get_loaded_extensions())) { $ssl = 'yes'; } if (!$ssl) { $ssl = 'no'; } $this->writeLog(sprintf($this->debugStrings['php-ini'], PHP_VERSION, $curl, $ssl)); }
php
{ "resource": "" }
q2992
GiroCheckout_SDK_Debug_helper.logParamsSet
train
public function logParamsSet($paramsArray) { $paramsString = ''; foreach ($paramsArray as $k => $v) { $paramsString .= "$k=$v\r\n"; } $this->writeLog(sprintf($this->debugStrings['params set'], date('Y-m-d H:i:s'), $paramsString)); }
php
{ "resource": "" }
q2993
GiroCheckout_SDK_Debug_helper.logReplyParams
train
public function logReplyParams($params) { $paramsString = ''; foreach ($params as $k => $v) { $paramsString .= "$k=" . print_r($v, true) . "\r\n"; } $this->writeLog(sprintf($this->debugStrings['replyParams'], date('Y-m-d H:i:s'), $paramsString)); }
php
{ "resource": "" }
q2994
GiroCheckout_SDK_Debug_helper.logNotificationInput
train
public function logNotificationInput($paramsArray) { $this->writeLog(sprintf($this->debugStrings['notifyInput'], date('Y-m-d H:i:s'), print_r($paramsArray, 1))); }
php
{ "resource": "" }
q2995
GiroCheckout_SDK_Debug_helper.logNotificationParams
train
public function logNotificationParams($paramsArray) { $this->writeLog(sprintf($this->debugStrings['notifyParams'], date('Y-m-d H:i:s'), print_r($paramsArray, 1))); }
php
{ "resource": "" }
q2996
GiroCheckout_SDK_Debug_helper.writeLog
train
public function writeLog($string) { $Config = GiroCheckout_SDK_Config::getInstance(); $path = str_replace('\\', '/', $Config->getConfig('DEBUG_LOG_PATH')); if (!is_dir($path)) { if (!mkdir($path)) { error_log('Log directory does not exist. Please create directory: ' . $path . '.'); } //write .htaccess to log directory $htfp = fopen($path . '/.htaccess', 'w'); fwrite($htfp, "Order allow,deny\nDeny from all"); fclose($htfp); } if (!self::$fp) { self::$fp = fopen($path . '/' . self::$logFileName, 'a'); if (!self::$fp) { error_log('Log File (' . $path . '/' . self::$logFileName . ') is not writeable.'); } } fwrite(self::$fp, $string); }
php
{ "resource": "" }
q2997
WordPressLoopExtension.register
train
public function register($compiler) { $this->registerStartLoopQuery($compiler); $this->registerEmptyLoopBranch($compiler); $this->registerEndLoop($compiler); }
php
{ "resource": "" }
q2998
DataTablesColumn.setOrderSequence
train
public function setOrderSequence($orderSequence) { if (false === in_array($orderSequence, DataTablesEnumerator::enumOrderSequences())) { $orderSequence = null; } $this->orderSequence = $orderSequence; return $this; }
php
{ "resource": "" }
q2999
SitemapGenerator.add
train
public function add($object) { if (is_a($object, 'Closure')) { return $this->closures[] = $object; } $this->validateObject($object); $data = $object->getSitemapData(); $this->addRaw($data); }
php
{ "resource": "" }