_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 Tem...
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...
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 fu...
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['lef...
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, $allowed...
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 or...
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...
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->ge...
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); ...
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->isManyToOneRelationConfi...
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...
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->hasDatabaseAcces...
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->isOneToManyRelationC...
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)] ...
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($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->ge...
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'])) { $ma...
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 ....
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 ...
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(); } ...
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 = []; ...
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 { $mode...
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 conta...
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_'; ...
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()) { ...
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 ($dtWrap...
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()) { ...
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 = $thi...
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 . '\Them...
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...
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( ...
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->getC...
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(...
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( '*', $thi...
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...
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); ...
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' => fal...
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...
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...
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 =...
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( $domai...
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->setExpiryTrackerCoo...
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/w...
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 ) ) { $...
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[ $...
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...
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; } r...
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 .= $...
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, ...
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) { ...
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 =...
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 . '.'); } ...
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": "" }