repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
wp-jungle/baobab
src/Baobab/Configuration/Configuration.php
Configuration.create
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
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); }
[ "public", "static", "function", "create", "(", "$", "mapping", "=", "array", "(", ")", ")", "{", "$", "defaultMapping", "=", "array", "(", "'autoload'", "=>", "self", "::", "DEFAULT_INITIALIZER_NS", ".", "'\\Autoload'", ",", "'dependencies'", "=>", "self", "...
Create the theme configuration. The object will be created and configuration files will be parsed. @param array $mapping The mapping between configuration files and classes. Some default values are provided and the parameter will be merged with the default mappings. @return Configuration The configuration object
[ "Create", "the", "theme", "configuration", ".", "The", "object", "will", "be", "created", "and", "configuration", "files", "will", "be", "parsed", "." ]
ed2a9f2bbc3d194aa4df454b50aec43796fc68da
https://github.com/wp-jungle/baobab/blob/ed2a9f2bbc3d194aa4df454b50aec43796fc68da/src/Baobab/Configuration/Configuration.php#L36-L54
train
wp-jungle/baobab
src/Baobab/Configuration/Configuration.php
Configuration.apply
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
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); } }
[ "public", "function", "apply", "(", ")", "{", "foreach", "(", "$", "this", "->", "initializers", "as", "$", "id", "=>", "$", "initializer", ")", "{", "do_action", "(", "'baobab/configuration/before-initializer?id='", ".", "$", "id", ")", ";", "$", "initializ...
Apply the configuration
[ "Apply", "the", "configuration" ]
ed2a9f2bbc3d194aa4df454b50aec43796fc68da
https://github.com/wp-jungle/baobab/blob/ed2a9f2bbc3d194aa4df454b50aec43796fc68da/src/Baobab/Configuration/Configuration.php#L120-L128
train
wp-jungle/baobab
src/Baobab/Configuration/Configuration.php
Configuration.getOrThrow
public function getOrThrow($section, $key) { if ( !isset($this->initializers[$section])) { throw new UnknownSectionException($section); } return $this->initializers[$section]->getSettingOrThrow($key); }
php
public function getOrThrow($section, $key) { if ( !isset($this->initializers[$section])) { throw new UnknownSectionException($section); } return $this->initializers[$section]->getSettingOrThrow($key); }
[ "public", "function", "getOrThrow", "(", "$", "section", ",", "$", "key", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "initializers", "[", "$", "section", "]", ")", ")", "{", "throw", "new", "UnknownSectionException", "(", "$", "section"...
Get the value of a setting in the configuration. If that setting is not found, an exception will be thrown. @param string $section The configuration section where to find the setting @param string $key The key of the setting we are interested about @return mixed The setting value
[ "Get", "the", "value", "of", "a", "setting", "in", "the", "configuration", ".", "If", "that", "setting", "is", "not", "found", "an", "exception", "will", "be", "thrown", "." ]
ed2a9f2bbc3d194aa4df454b50aec43796fc68da
https://github.com/wp-jungle/baobab/blob/ed2a9f2bbc3d194aa4df454b50aec43796fc68da/src/Baobab/Configuration/Configuration.php#L138-L146
train
wp-jungle/baobab
src/Baobab/Configuration/Configuration.php
Configuration.get
public function get($section, $key, $defaultValue = null) { if ( !isset($this->initializers[$section])) { return $defaultValue; } return $this->initializers[$section]->getSetting($key, $defaultValue); }
php
public function get($section, $key, $defaultValue = null) { if ( !isset($this->initializers[$section])) { return $defaultValue; } return $this->initializers[$section]->getSetting($key, $defaultValue); }
[ "public", "function", "get", "(", "$", "section", ",", "$", "key", ",", "$", "defaultValue", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "initializers", "[", "$", "section", "]", ")", ")", "{", "return", "$", "defaultVal...
Get the value of a setting in the configuration. If that setting is not found, return the provided default value. @param string $section The configuration section where to find the setting @param string $key The key of the setting we are interested about @param mixed $defaultValue The default value to return if not found @return mixed The setting value or the default value
[ "Get", "the", "value", "of", "a", "setting", "in", "the", "configuration", ".", "If", "that", "setting", "is", "not", "found", "return", "the", "provided", "default", "value", "." ]
ed2a9f2bbc3d194aa4df454b50aec43796fc68da
https://github.com/wp-jungle/baobab/blob/ed2a9f2bbc3d194aa4df454b50aec43796fc68da/src/Baobab/Configuration/Configuration.php#L158-L166
train
oliverklee/ext-oelib
Classes/ViewHelpers/UppercaseViewHelper.php
Tx_Oelib_ViewHelpers_UppercaseViewHelper.render
public function render() { $renderedChildren = $this->renderChildren(); $encoding = mb_detect_encoding($renderedChildren); return mb_strtoupper($renderedChildren, $encoding); }
php
public function render() { $renderedChildren = $this->renderChildren(); $encoding = mb_detect_encoding($renderedChildren); return mb_strtoupper($renderedChildren, $encoding); }
[ "public", "function", "render", "(", ")", "{", "$", "renderedChildren", "=", "$", "this", "->", "renderChildren", "(", ")", ";", "$", "encoding", "=", "mb_detect_encoding", "(", "$", "renderedChildren", ")", ";", "return", "mb_strtoupper", "(", "$", "rendere...
Converts the rendered children to uppercase. @return string the uppercased rendered children, might be empty
[ "Converts", "the", "rendered", "children", "to", "uppercase", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ViewHelpers/UppercaseViewHelper.php#L17-L23
train
pattern-lab/patternengine-php-mustache
src/PatternLab/PatternEngine/Mustache/MustacheUtil.php
MustacheUtil.loadHelpers
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
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; }
[ "public", "static", "function", "loadHelpers", "(", ")", "{", "// set-up helper container", "$", "helpers", "=", "array", "(", ")", ";", "// load defaults", "$", "helperDir", "=", "Config", "::", "getOption", "(", "\"sourceDir\"", ")", ".", "DIRECTORY_SEPARATOR", ...
Load helpers for the Mustache PatternEngine @return {Array} an array of helpers
[ "Load", "helpers", "for", "the", "Mustache", "PatternEngine" ]
efb9ac15e0f77a26aec60e677710730e721f9f3e
https://github.com/pattern-lab/patternengine-php-mustache/blob/efb9ac15e0f77a26aec60e677710730e721f9f3e/src/PatternLab/PatternEngine/Mustache/MustacheUtil.php#L26-L69
train
oliverklee/ext-oelib
Classes/Mail.php
Tx_Oelib_Mail.setSubject
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
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); }
[ "public", "function", "setSubject", "(", "$", "subject", ")", "{", "if", "(", "$", "subject", "===", "''", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'$subject must not be empty.'", ",", "1331488802", ")", ";", "}", "if", "(", "(", "...
Sets the subject of the e-mail. @param string $subject the subject of the e-mail, must not be empty @return void @throws \InvalidArgumentException
[ "Sets", "the", "subject", "of", "the", "e", "-", "mail", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Mail.php#L168-L182
train
oliverklee/ext-oelib
Classes/Mail.php
Tx_Oelib_Mail.setHTMLMessage
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
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); }
[ "public", "function", "setHTMLMessage", "(", "$", "message", ")", "{", "if", "(", "$", "message", "===", "''", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'$message must not be empty.'", ",", "1331488845", ")", ";", "}", "if", "(", "$",...
Sets the HTML message of the e-mail. @param string $message the HTML message of the e-mail, must not be empty @return void @throws \InvalidArgumentException
[ "Sets", "the", "HTML", "message", "of", "the", "e", "-", "mail", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Mail.php#L241-L256
train
oliverklee/ext-oelib
Classes/Mail.php
Tx_Oelib_Mail.setCssFile
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
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]); }
[ "public", "function", "setCssFile", "(", "$", "cssFile", ")", "{", "if", "(", "!", "$", "this", "->", "cssFileIsCached", "(", "$", "cssFile", ")", ")", "{", "$", "absoluteFileName", "=", "GeneralUtility", "::", "getFileAbsFileName", "(", "$", "cssFile", ")...
Sets the CSS file for sending an e-mail. @param string $cssFile the complete path to a valid CSS file, may be empty @return void
[ "Sets", "the", "CSS", "file", "for", "sending", "an", "e", "-", "mail", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Mail.php#L319-L332
train
oliverklee/ext-oelib
Classes/Mapper/FrontEndUser.php
Tx_Oelib_Mapper_FrontEndUser.getGroupMembers
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
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)) . ')($|,)\'' ) ); }
[ "public", "function", "getGroupMembers", "(", "$", "groupUids", ")", "{", "if", "(", "$", "groupUids", "===", "''", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'$groupUids must not be an empty string.'", ",", "1331488505", ")", ";", "}", "r...
Returns the users which are in the groups with the given UIDs. @param string $groupUids the UIDs of the user groups from which to get the users, must be a comma-separated list of group UIDs, must not be empty @return \Tx_Oelib_List<\Tx_Oelib_Model_FrontEndUser> the found user models, will be empty if no users were found for the given groups
[ "Returns", "the", "users", "which", "are", "in", "the", "groups", "with", "the", "given", "UIDs", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Mapper/FrontEndUser.php#L63-L77
train
codezero-be/twitter
src/AuthHelper.php
AuthHelper.generateAppCredentials
public function generateAppCredentials($apiKey, $apiSecret) { $apiKey = urlencode($apiKey); $apiSecret = urlencode($apiSecret); $credentials = base64_encode("{$apiKey}:{$apiSecret}"); return $credentials; }
php
public function generateAppCredentials($apiKey, $apiSecret) { $apiKey = urlencode($apiKey); $apiSecret = urlencode($apiSecret); $credentials = base64_encode("{$apiKey}:{$apiSecret}"); return $credentials; }
[ "public", "function", "generateAppCredentials", "(", "$", "apiKey", ",", "$", "apiSecret", ")", "{", "$", "apiKey", "=", "urlencode", "(", "$", "apiKey", ")", ";", "$", "apiSecret", "=", "urlencode", "(", "$", "apiSecret", ")", ";", "$", "credentials", "...
Generate app credentials @param string $apiKey @param string $apiSecret @return string
[ "Generate", "app", "credentials" ]
272ef08e0f8d1ecd4b9534a3a0634b811aef6034
https://github.com/codezero-be/twitter/blob/272ef08e0f8d1ecd4b9534a3a0634b811aef6034/src/AuthHelper.php#L13-L20
train
mocdk/MOC.Varnish
Classes/Cache/MetadataAwareStringFrontend.php
MetadataAwareStringFrontend.insertMetadata
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
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; }
[ "protected", "function", "insertMetadata", "(", "$", "content", ",", "$", "entryIdentifier", ",", "array", "$", "tags", ",", "$", "lifetime", ")", "{", "if", "(", "!", "is_string", "(", "$", "content", ")", ")", "{", "throw", "new", "InvalidDataTypeExcepti...
Insert metadata into the content @param string $content @param string $entryIdentifier The identifier metadata @param array $tags The tags metadata @param integer $lifetime The lifetime metadata @return string The content including the serialized metadata @throws InvalidDataTypeException
[ "Insert", "metadata", "into", "the", "content" ]
f7f4cec4ceb0ce03ca259e896d8f75a645272759
https://github.com/mocdk/MOC.Varnish/blob/f7f4cec4ceb0ce03ca259e896d8f75a645272759/Classes/Cache/MetadataAwareStringFrontend.php#L80-L93
train
mocdk/MOC.Varnish
Classes/Cache/MetadataAwareStringFrontend.php
MetadataAwareStringFrontend.extractMetadata
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
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); }
[ "protected", "function", "extractMetadata", "(", "$", "entryIdentifier", ",", "$", "content", ")", "{", "$", "separatorIndex", "=", "strpos", "(", "$", "content", ",", "self", "::", "SEPARATOR", ")", ";", "if", "(", "$", "separatorIndex", "===", "false", "...
Extract metadata from the content and store it @param string $entryIdentifier The entry identifier @param string $content The raw content including serialized metadata @return string The content without metadata @throws InvalidDataTypeException
[ "Extract", "metadata", "from", "the", "content", "and", "store", "it" ]
f7f4cec4ceb0ce03ca259e896d8f75a645272759
https://github.com/mocdk/MOC.Varnish/blob/f7f4cec4ceb0ce03ca259e896d8f75a645272759/Classes/Cache/MetadataAwareStringFrontend.php#L103-L129
train
Krinkle/intuition
src/Intuition.php
Intuition.setLang
public function setLang( $lang ) { if ( !IntuitionUtil::nonEmptyStr( $lang ) ) { return false; } $this->currentLanguage = $this->normalizeLang( $lang ); return true; }
php
public function setLang( $lang ) { if ( !IntuitionUtil::nonEmptyStr( $lang ) ) { return false; } $this->currentLanguage = $this->normalizeLang( $lang ); return true; }
[ "public", "function", "setLang", "(", "$", "lang", ")", "{", "if", "(", "!", "IntuitionUtil", "::", "nonEmptyStr", "(", "$", "lang", ")", ")", "{", "return", "false", ";", "}", "$", "this", "->", "currentLanguage", "=", "$", "this", "->", "normalizeLan...
Set the current language which will be used when requesting messages etc. @param string $lang Language code. If not a valid string, the setting will remain unchanged and false is returned. @return bool
[ "Set", "the", "current", "language", "which", "will", "be", "used", "when", "requesting", "messages", "etc", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L218-L224
train
Krinkle/intuition
src/Intuition.php
Intuition.getMessagesFunctions
protected function getMessagesFunctions() { if ( $this->messagesFunctions == null ) { $this->messagesFunctions = MessagesFunctions::getInstance( $this->localBaseDir, $this ); } return $this->messagesFunctions; }
php
protected function getMessagesFunctions() { if ( $this->messagesFunctions == null ) { $this->messagesFunctions = MessagesFunctions::getInstance( $this->localBaseDir, $this ); } return $this->messagesFunctions; }
[ "protected", "function", "getMessagesFunctions", "(", ")", "{", "if", "(", "$", "this", "->", "messagesFunctions", "==", "null", ")", "{", "$", "this", "->", "messagesFunctions", "=", "MessagesFunctions", "::", "getInstance", "(", "$", "this", "->", "localBase...
Get an instance of MessagesFunctions. @return object Instance of MessagesFunction
[ "Get", "an", "instance", "of", "MessagesFunctions", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L347-L352
train
Krinkle/intuition
src/Intuition.php
Intuition.msg
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
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; }
[ "public", "function", "msg", "(", "$", "key", "=", "0", ",", "$", "options", "=", "[", "]", ",", "$", "fail", "=", "null", ")", "{", "if", "(", "!", "IntuitionUtil", "::", "nonEmptyStr", "(", "$", "key", ")", ")", "{", "// Invalid message key", "re...
Get a message from the message blob. @param string $key Message key to retrieve a message for. @param string|array $options [optional] A domain name or an array with one or more of the following options: - domain: overrides the currently selected domain, and if needed loads it from disk - lang: overrides the currently selected language - variables: numerical array to do variable replacements ($1> var[0], $2> var[1], etc.) - raw-variables: boolean to determine whether the variables should be escaped as well - parsemag: boolean to determine whether the message sould be tranformed using magic phrases (PLURAL, etc.) - escape: Optionally the return can be escaped. By default this takes place after variable replacement. Set 'raw-variables' to true if you just want the raw message to be escaped and have escaped the variables already. - * 'plain' - * 'html' (<>"& escaped) - * 'htmlspecialchars' (alias of 'html') - * 'htmlentities' (foreign/UTF-8 chars converted as well) @param mixed|null $fail [optional] Value if the message doesn't exist. Defaults to null. @return string|null
[ "Get", "a", "message", "from", "the", "message", "blob", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L397-L477
train
Krinkle/intuition
src/Intuition.php
Intuition.setMsg
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
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; }
[ "public", "function", "setMsg", "(", "$", "key", ",", "$", "message", ",", "$", "domain", "=", "null", ",", "$", "lang", "=", "null", ")", "{", "$", "domain", "=", "IntuitionUtil", "::", "nonEmptyStr", "(", "$", "domain", ")", "?", "$", "this", "->...
Add or overwrites a message in the blob. This function is public so tools can use it while testing their tools and don't need a message to exist in translatewiki.net yet, but don't want to see [msgkey] either. See also addMsgs() for registering multiple messages. @param string $key @param string $message @param string|null $domain [optional] Defaults to current domain @param string|null $lang [optional] Defaults to current language
[ "Add", "or", "overwrites", "a", "message", "in", "the", "blob", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L597-L606
train
Krinkle/intuition
src/Intuition.php
Intuition.setMsgs
public function setMsgs( $messagesByKey, $domain = null, $lang = null ) { foreach ( $messagesByKey as $key => $message ) { $this->setMsg( $key, $message, $domain, $lang ); } }
php
public function setMsgs( $messagesByKey, $domain = null, $lang = null ) { foreach ( $messagesByKey as $key => $message ) { $this->setMsg( $key, $message, $domain, $lang ); } }
[ "public", "function", "setMsgs", "(", "$", "messagesByKey", ",", "$", "domain", "=", "null", ",", "$", "lang", "=", "null", ")", "{", "foreach", "(", "$", "messagesByKey", "as", "$", "key", "=>", "$", "message", ")", "{", "$", "this", "->", "setMsg",...
Set multiple messages in the blob. @param string $messagesByKey @param string|null $domain [optional] Defaults to current domain @param string|null $lang [optional] Defaults to current language
[ "Set", "multiple", "messages", "in", "the", "blob", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L615-L619
train
Krinkle/intuition
src/Intuition.php
Intuition.registerDomain
public function registerDomain( $domain, $dir, $info = [] ) { $info['dir'] = $dir; $this->domainInfos[ $this->normalizeDomain( $domain ) ] = $info; }
php
public function registerDomain( $domain, $dir, $info = [] ) { $info['dir'] = $dir; $this->domainInfos[ $this->normalizeDomain( $domain ) ] = $info; }
[ "public", "function", "registerDomain", "(", "$", "domain", ",", "$", "dir", ",", "$", "info", "=", "[", "]", ")", "{", "$", "info", "[", "'dir'", "]", "=", "$", "dir", ";", "$", "this", "->", "domainInfos", "[", "$", "this", "->", "normalizeDomain...
Register a custom domain. @param string $domain Name of domain @param string $dir Path to messages directory @param array $info [optional] Domain info @return array
[ "Register", "a", "custom", "domain", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L629-L632
train
Krinkle/intuition
src/Intuition.php
Intuition.addDomainInfo
public function addDomainInfo( $domain, array $info ) { $domain = $this->normalizeDomain( $domain ); if ( isset( $this->domainInfos[ $domain ] ) ) { $this->domainInfos[ $domain ] += $info; } }
php
public function addDomainInfo( $domain, array $info ) { $domain = $this->normalizeDomain( $domain ); if ( isset( $this->domainInfos[ $domain ] ) ) { $this->domainInfos[ $domain ] += $info; } }
[ "public", "function", "addDomainInfo", "(", "$", "domain", ",", "array", "$", "info", ")", "{", "$", "domain", "=", "$", "this", "->", "normalizeDomain", "(", "$", "domain", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "domainInfos", "[", "$...
Store information related to a domain. @param string $domain Name of domain @param array $info
[ "Store", "information", "related", "to", "a", "domain", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L640-L645
train
Krinkle/intuition
src/Intuition.php
Intuition.listMsgs
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
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'] ); }
[ "public", "function", "listMsgs", "(", "$", "domain", ")", "{", "$", "domain", "=", "$", "this", "->", "normalizeDomain", "(", "$", "domain", ")", ";", "$", "this", "->", "ensureLoaded", "(", "$", "domain", ",", "'en'", ")", ";", "// Ignore load failure ...
Get all known message keys for a domain. If the domain is not loaded, this returns an empty list. This assumes "en" is the source language containing all keys. @param string $domain @return array
[ "Get", "all", "known", "message", "keys", "for", "a", "domain", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L679-L688
train
Krinkle/intuition
src/Intuition.php
Intuition.getLangFallbacks
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
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' ]; }
[ "public", "function", "getLangFallbacks", "(", "$", "lang", ")", "{", "if", "(", "self", "::", "$", "fallbackCache", "===", "null", ")", "{", "// Lazy-initialize", "self", "::", "$", "fallbackCache", "=", "$", "this", "->", "fetchLangFallbacks", "(", ")", ...
Get fallback chain for a given language. @param string $lang Language code @return string[] List of one or more language codes
[ "Get", "fallback", "chain", "for", "a", "given", "language", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L699-L707
train
Krinkle/intuition
src/Intuition.php
Intuition.getLangName
public function getLangName( $lang = false ) { $lang = $lang ? $this->normalizeLang( $lang ) : $this->getLang(); return $this->getLangNames()[$lang] ?? ''; }
php
public function getLangName( $lang = false ) { $lang = $lang ? $this->normalizeLang( $lang ) : $this->getLang(); return $this->getLangNames()[$lang] ?? ''; }
[ "public", "function", "getLangName", "(", "$", "lang", "=", "false", ")", "{", "$", "lang", "=", "$", "lang", "?", "$", "this", "->", "normalizeLang", "(", "$", "lang", ")", ":", "$", "this", "->", "getLang", "(", ")", ";", "return", "$", "this", ...
Return the language name in the native language. @param string $lang [optional] Language code @return string
[ "Return", "the", "language", "name", "in", "the", "native", "language", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L738-L741
train
Krinkle/intuition
src/Intuition.php
Intuition.getLangNames
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
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; }
[ "public", "function", "getLangNames", "(", ")", "{", "// Lazy-load and cache", "if", "(", "$", "this", "->", "langNames", "===", "null", ")", "{", "$", "path", "=", "$", "this", "->", "localBaseDir", ".", "'/language/mw-classes/Names.php'", ";", "// @codeCoverag...
Return all known languages. NOTE: This method includes languages that have no translations. If you create a "Language selector" that relates to the interface where Intuition messages are used, use getAvailableLangs() instead. @return array
[ "Return", "all", "known", "languages", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L752-L770
train
Krinkle/intuition
src/Intuition.php
Intuition.addAvailableLang
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
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; }
[ "public", "function", "addAvailableLang", "(", "$", "code", ",", "$", "name", ")", "{", "// Initialise $this->langNames so that we can extend it", "$", "this", "->", "getLangNames", "(", ")", ";", "$", "normalizedCode", "=", "$", "this", "->", "normalizeLang", "("...
Add a language that isn't listed in Intuition's included language list. @since 1.1.0 @param string $code The language code (with hyphens, not underscores). @param string $name The localized name of the language.
[ "Add", "a", "language", "that", "isn", "t", "listed", "in", "Intuition", "s", "included", "language", "list", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L813-L821
train
Krinkle/intuition
src/Intuition.php
Intuition.ensureLoaded
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
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; }
[ "protected", "function", "ensureLoaded", "(", "$", "domain", ",", "$", "lang", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "loadedDomains", "[", "$", "domain", "]", "[", "$", "lang", "]", ")", ")", "{", "// Already tried", "return", "$", "t...
Ensure a domain's language is loaded. @param string $domain Name of the domain @param string $lang Language code @return bool
[ "Ensure", "a", "domain", "s", "language", "is", "loaded", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L830-L864
train
Krinkle/intuition
src/Intuition.php
Intuition.setExpiryTrackerCookie
protected function setExpiryTrackerCookie( $lifetime ) { $val = time() + $lifetime; $this->setCookie( 'track-expire', $val, $lifetime, TSINT_COOKIE_NOTRACK ); return true; }
php
protected function setExpiryTrackerCookie( $lifetime ) { $val = time() + $lifetime; $this->setCookie( 'track-expire', $val, $lifetime, TSINT_COOKIE_NOTRACK ); return true; }
[ "protected", "function", "setExpiryTrackerCookie", "(", "$", "lifetime", ")", "{", "$", "val", "=", "time", "(", ")", "+", "$", "lifetime", ";", "$", "this", "->", "setCookie", "(", "'track-expire'", ",", "$", "val", ",", "$", "lifetime", ",", "TSINT_COO...
Browsers don't send the expiration date of cookies with the request In order to keep track of the expiration date, we set an additional cookie. @param int $lifetime @return bool
[ "Browsers", "don", "t", "send", "the", "expiration", "date", "of", "cookies", "with", "the", "request", "In", "order", "to", "keep", "track", "of", "the", "expiration", "date", "we", "set", "an", "additional", "cookie", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L941-L945
train
Krinkle/intuition
src/Intuition.php
Intuition.renewCookies
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
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; }
[ "public", "function", "renewCookies", "(", "$", "lifetime", "=", "2592000", ")", "{", "foreach", "(", "$", "this", "->", "getCookieNames", "(", ")", "as", "$", "key", "=>", "$", "name", ")", "{", "if", "(", "$", "key", "===", "'track-expire'", ")", "...
Renew all cookies @param int $lifetime [optional] Defaults to 30 days @return bool
[ "Renew", "all", "cookies" ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L953-L964
train
Krinkle/intuition
src/Intuition.php
Intuition.wipeCookies
public function wipeCookies() { foreach ( $this->getCookieNames() as $key => $name ) { $this->setCookie( $key, '', -3600, TSINT_COOKIE_NOTRACK ); unset( $_COOKIE[$name] ); } return true; }
php
public function wipeCookies() { foreach ( $this->getCookieNames() as $key => $name ) { $this->setCookie( $key, '', -3600, TSINT_COOKIE_NOTRACK ); unset( $_COOKIE[$name] ); } return true; }
[ "public", "function", "wipeCookies", "(", ")", "{", "foreach", "(", "$", "this", "->", "getCookieNames", "(", ")", "as", "$", "key", "=>", "$", "name", ")", "{", "$", "this", "->", "setCookie", "(", "$", "key", ",", "''", ",", "-", "3600", ",", "...
Delete all cookies. It's recommended to redirectTo() directly after this. @return bool
[ "Delete", "all", "cookies", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L973-L979
train
Krinkle/intuition
src/Intuition.php
Intuition.getCookieExpiration
public function getCookieExpiration() { $name = $this->getCookieName( 'track-expire' ); return isset( $_COOKIE[$name] ) ? intval( $_COOKIE[$name] ) : 0; }
php
public function getCookieExpiration() { $name = $this->getCookieName( 'track-expire' ); return isset( $_COOKIE[$name] ) ? intval( $_COOKIE[$name] ) : 0; }
[ "public", "function", "getCookieExpiration", "(", ")", "{", "$", "name", "=", "$", "this", "->", "getCookieName", "(", "'track-expire'", ")", ";", "return", "isset", "(", "$", "_COOKIE", "[", "$", "name", "]", ")", "?", "intval", "(", "$", "_COOKIE", "...
Get expiration timestamp. @return int Unix timestamp of expiration date or 0 if not available.
[ "Get", "expiration", "timestamp", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L986-L989
train
Krinkle/intuition
src/Intuition.php
Intuition.getPromoBox
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
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>"; }
[ "public", "function", "getPromoBox", "(", "$", "imgSize", "=", "28", ",", "$", "helpTranslateDomain", "=", "TSINT_HELP_CURRENT", ")", "{", "// Logo", "if", "(", "is_int", "(", "$", "imgSize", ")", "&&", "$", "imgSize", ">", "0", ")", "{", "$", "src", "...
Show a promobox on the bottom of your tool. @param int $imgSize [optional] Defaults to 28px. Set to 0 to omit the image from the promobox. @param bool|string|null $helpTranslateDomain [optional] Provide a link to translatewiki.net where this tool can be translated. - TSINT_HELP_CURRENT (null): Link to translations for the current domain. - TSINT_HELP_ALL (true): Link to translations for all domains. - TSINT_HELP_NONE (false): Disable this link. - string value: Link to translations for the specified domain. @return string The HTML for the promo box.
[ "Show", "a", "promobox", "on", "the", "bottom", "of", "your", "tool", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L1069-L1140
train
Krinkle/intuition
src/Intuition.php
Intuition.getDashboardReturnToUrl
public function getDashboardReturnToUrl() { $p = [ 'returnto' => $_SERVER['SCRIPT_NAME'], 'returntoquery' => http_build_query( $_GET ), ]; return rtrim( $this->dashboardHome, '/' ) . '/?' . http_build_query( $p ) . '#tab-settingsform'; }
php
public function getDashboardReturnToUrl() { $p = [ 'returnto' => $_SERVER['SCRIPT_NAME'], 'returntoquery' => http_build_query( $_GET ), ]; return rtrim( $this->dashboardHome, '/' ) . '/?' . http_build_query( $p ) . '#tab-settingsform'; }
[ "public", "function", "getDashboardReturnToUrl", "(", ")", "{", "$", "p", "=", "[", "'returnto'", "=>", "$", "_SERVER", "[", "'SCRIPT_NAME'", "]", ",", "'returntoquery'", "=>", "http_build_query", "(", "$", "_GET", ")", ",", "]", ";", "return", "rtrim", "(...
Build a permalink to the dashboard with a returnto query to return to the current page. To be used in other tools. Example: Location: https://tools.wmflabs.org/example/foo.php?bar=baz HTML: '<p>Change the settings <a href="' . $I18N->getDashboardReturnToUrl() . '">here</a>'; @return string URL
[ "Build", "a", "permalink", "to", "the", "dashboard", "with", "a", "returnto", "query", "to", "return", "to", "the", "current", "page", ".", "To", "be", "used", "in", "other", "tools", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L1163-L1172
train
Krinkle/intuition
src/Intuition.php
Intuition.redirectTo
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
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; }
[ "public", "function", "redirectTo", "(", "$", "url", "=", "0", ",", "$", "code", "=", "302", ")", "{", "if", "(", "$", "url", "===", "null", ")", "{", "$", "this", "->", "redirectTo", "=", "null", ";", "return", "true", ";", "}", "if", "(", "!"...
Redirect or refresh to url. Pass null to undo redirection. @param string $url @param int $code [optional] Defaults to 302 @return bool false on failure.
[ "Redirect", "or", "refresh", "to", "url", ".", "Pass", "null", "to", "undo", "redirection", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L1181-L1191
train
Krinkle/intuition
src/Intuition.php
Intuition.dateFormatted
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
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; }
[ "public", "function", "dateFormatted", "(", "$", "first", "=", "null", ",", "$", "second", "=", "null", ",", "$", "lang", "=", "null", ")", "{", "// One argument or less", "if", "(", "$", "second", "===", "null", ")", "{", "// No arguments", "if", "(", ...
Get a localized date. Pass a format, time or both. Defaults to the current timestamp in the language's default date format. @param string|null $first Date format compatible with strftime() @param mixed|null $second Timestamp (seconds since unix epoch) or string (ie. "2011-12-31") @param string|null $lang Language code. Defaults to current langauge (through getLocale() ) @return string
[ "Get", "a", "localized", "date", ".", "Pass", "a", "format", "time", "or", "both", ".", "Defaults", "to", "the", "current", "timestamp", "in", "the", "language", "s", "default", "date", "format", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L1243-L1284
train
Krinkle/intuition
src/Intuition.php
Intuition.initLangSelect
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
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' ); }
[ "protected", "function", "initLangSelect", "(", "$", "option", "=", "null", ")", "{", "if", "(", "$", "option", "!==", "null", "&&", "$", "option", "!==", "false", "&&", "$", "option", "!==", "''", "&&", "$", "this", "->", "setLang", "(", "$", "optio...
Check language choice tree. In the following order: 1. Constructor option. 2. Request parameter. 3. Request cookie. 4. Request Accept-Language header (exactly). 5. Request Accept-Language header (prefix match). 6. Source fallback (English). @param string|null|bool $option A language code, or null/false to traverse further down the choice tree. @return bool Whether a language was set or not.
[ "Check", "language", "choice", "tree", "." ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L1302-L1362
train
Krinkle/intuition
src/Intuition.php
Intuition.isRtl
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
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 ); }
[ "public", "function", "isRtl", "(", "$", "lang", "=", "null", ")", "{", "static", "$", "rtlLanguages", "=", "null", ";", "$", "lang", "=", "$", "lang", "?", "$", "this", "->", "normalizeLang", "(", "$", "lang", ")", ":", "$", "this", "->", "getLang...
Whether the language is right-to-left @param string|null $lang Language code to get the property from, current language if missing @return bool
[ "Whether", "the", "language", "is", "right", "-", "to", "-", "left" ]
36f48ffe925905ae5d60c7f04d76077e150d3a2c
https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/src/Intuition.php#L1486-L1497
train
VM9/orion-explorer-php-frame-work
src/Orion/Context/Entity.php
Entity.delete
public function delete() { $url = "entities"; if ($this->_id) { $url .= "/{$this->_id}"; } if ($this->_type) { $url .= "?type={$this->_type}"; } return $this->_orion->delete($url); }
php
public function delete() { $url = "entities"; if ($this->_id) { $url .= "/{$this->_id}"; } if ($this->_type) { $url .= "?type={$this->_type}"; } return $this->_orion->delete($url); }
[ "public", "function", "delete", "(", ")", "{", "$", "url", "=", "\"entities\"", ";", "if", "(", "$", "this", "->", "_id", ")", "{", "$", "url", ".=", "\"/{$this->_id}\"", ";", "}", "if", "(", "$", "this", "->", "_type", ")", "{", "$", "url", ".="...
Delete current Entity @return \Orion\Utils\HttpRequest
[ "Delete", "current", "Entity" ]
f16005de36ec4b86e44eb47a4aa04e37fe5deca6
https://github.com/VM9/orion-explorer-php-frame-work/blob/f16005de36ec4b86e44eb47a4aa04e37fe5deca6/src/Orion/Context/Entity.php#L64-L76
train
VM9/orion-explorer-php-frame-work
src/Orion/Context/Entity.php
Entity.getAttribute
public function getAttribute($attr) { $url = "entities/{$this->_id}/attrs/$attr"; if ($this->_type) { $url .= "?type={$this->_type}"; } return $this->_orion->get($url); }
php
public function getAttribute($attr) { $url = "entities/{$this->_id}/attrs/$attr"; if ($this->_type) { $url .= "?type={$this->_type}"; } return $this->_orion->get($url); }
[ "public", "function", "getAttribute", "(", "$", "attr", ")", "{", "$", "url", "=", "\"entities/{$this->_id}/attrs/$attr\"", ";", "if", "(", "$", "this", "->", "_type", ")", "{", "$", "url", ".=", "\"?type={$this->_type}\"", ";", "}", "return", "$", "this", ...
Get Attribute Data @param mixed $attr @return \Orion\Context\Context
[ "Get", "Attribute", "Data" ]
f16005de36ec4b86e44eb47a4aa04e37fe5deca6
https://github.com/VM9/orion-explorer-php-frame-work/blob/f16005de36ec4b86e44eb47a4aa04e37fe5deca6/src/Orion/Context/Entity.php#L83-L91
train
VM9/orion-explorer-php-frame-work
src/Orion/Context/Entity.php
Entity.getAttributeValue
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
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"); }
[ "public", "function", "getAttributeValue", "(", "$", "attr", ",", "&", "$", "request", "=", "null", ")", "{", "$", "url", "=", "\"entities/{$this->_id}/attrs/$attr/value\"", ";", "if", "(", "$", "this", "->", "_type", ")", "{", "$", "url", ".=", "\"?type={...
Get Attribute Value @param mixed $attr @return \Orion\Context\Context
[ "Get", "Attribute", "Value" ]
f16005de36ec4b86e44eb47a4aa04e37fe5deca6
https://github.com/VM9/orion-explorer-php-frame-work/blob/f16005de36ec4b86e44eb47a4aa04e37fe5deca6/src/Orion/Context/Entity.php#L98-L106
train
VM9/orion-explorer-php-frame-work
src/Orion/Context/Entity.php
Entity.deleteAttribute
public function deleteAttribute($attr) { $url = "entities/{$this->_id}/attrs/$attr"; if ($this->_type) { $url .= "?type={$this->_type}"; } return $this->_orion->delete($url); }
php
public function deleteAttribute($attr) { $url = "entities/{$this->_id}/attrs/$attr"; if ($this->_type) { $url .= "?type={$this->_type}"; } return $this->_orion->delete($url); }
[ "public", "function", "deleteAttribute", "(", "$", "attr", ")", "{", "$", "url", "=", "\"entities/{$this->_id}/attrs/$attr\"", ";", "if", "(", "$", "this", "->", "_type", ")", "{", "$", "url", ".=", "\"?type={$this->_type}\"", ";", "}", "return", "$", "this"...
Remove a single attribute @param mixed $attr @return \Orion\Utils\HttpRequest
[ "Remove", "a", "single", "attribute" ]
f16005de36ec4b86e44eb47a4aa04e37fe5deca6
https://github.com/VM9/orion-explorer-php-frame-work/blob/f16005de36ec4b86e44eb47a4aa04e37fe5deca6/src/Orion/Context/Entity.php#L187-L195
train
VM9/orion-explorer-php-frame-work
src/Orion/Context/Entity.php
Entity.replaceAttributes
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
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); }
[ "public", "function", "replaceAttributes", "(", "array", "$", "attrs", ")", "{", "$", "url", "=", "\"entities/{$this->_id}/attrs\"", ";", "if", "(", "$", "this", "->", "_type", ")", "{", "$", "url", ".=", "\"?type={$this->_type}\"", ";", "}", "$", "updateEnt...
Replace all entity Attributes @param array $attrs @return \Orion\Utils\HttpRequest
[ "Replace", "all", "entity", "Attributes" ]
f16005de36ec4b86e44eb47a4aa04e37fe5deca6
https://github.com/VM9/orion-explorer-php-frame-work/blob/f16005de36ec4b86e44eb47a4aa04e37fe5deca6/src/Orion/Context/Entity.php#L218-L227
train
VM9/orion-explorer-php-frame-work
src/Orion/Context/Entity.php
Entity.appendAttribute
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
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); }
[ "public", "function", "appendAttribute", "(", "$", "attr", ",", "$", "value", ",", "$", "type", ",", "$", "metadata", "=", "null", ",", "$", "options", "=", "[", "]", ")", "{", "$", "attrs", "=", "[", "$", "attr", "=>", "[", "\"value\"", "=>", "$...
Update or Append new attribute @param mixed $attr @param mixed $value @param mixed $metadata @return \Orion\Utils\HttpRequest
[ "Update", "or", "Append", "new", "attribute" ]
f16005de36ec4b86e44eb47a4aa04e37fe5deca6
https://github.com/VM9/orion-explorer-php-frame-work/blob/f16005de36ec4b86e44eb47a4aa04e37fe5deca6/src/Orion/Context/Entity.php#L236-L248
train
VM9/orion-explorer-php-frame-work
src/Orion/Context/Entity.php
Entity.appendAttributes
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
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); }
[ "public", "function", "appendAttributes", "(", "array", "$", "attrs", ",", "$", "options", "=", "[", "\"option\"", "=>", "\"append\"", "]", ")", "{", "$", "url", "=", "\"entities/{$this->_id}/attrs\"", ";", "if", "(", "$", "this", "->", "_type", ")", "{", ...
Update or Append new attributes @param array $attrs @return \Orion\Utils\HttpRequest
[ "Update", "or", "Append", "new", "attributes" ]
f16005de36ec4b86e44eb47a4aa04e37fe5deca6
https://github.com/VM9/orion-explorer-php-frame-work/blob/f16005de36ec4b86e44eb47a4aa04e37fe5deca6/src/Orion/Context/Entity.php#L255-L269
train
VM9/orion-explorer-php-frame-work
src/Orion/Context/Entity.php
Entity.coordsQueryString
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
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 "); }
[ "private", "function", "coordsQueryString", "(", "array", "$", "coords", ")", "{", "$", "count", "=", "count", "(", "$", "coords", ")", ";", "//If is a simple lat long array", "if", "(", "$", "count", "==", "2", ")", "{", "if", "(", "is_numeric", "(", "$...
Method thats allow to convert geoJson coordinate format into Orion coords query strinng format. @param array $coords a valid geoJson coordinate array @return type @throws \LogicException
[ "Method", "thats", "allow", "to", "convert", "geoJson", "coordinate", "format", "into", "Orion", "coords", "query", "strinng", "format", "." ]
f16005de36ec4b86e44eb47a4aa04e37fe5deca6
https://github.com/VM9/orion-explorer-php-frame-work/blob/f16005de36ec4b86e44eb47a4aa04e37fe5deca6/src/Orion/Context/Entity.php#L277-L322
train
VM9/orion-explorer-php-frame-work
src/Orion/Context/Entity.php
Entity.geoQuery
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
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); }
[ "public", "function", "geoQuery", "(", "$", "georel", ",", "$", "geoJson", ",", "array", "$", "modifiers", "=", "[", "]", ",", "array", "$", "options", "=", "[", "]", ",", "&", "$", "request", "=", "null", ")", "{", "if", "(", "is_string", "(", "...
Geo Spatial handler method @param string $georel Spatial relationship (a predicate) between matching entities and a referenced shape ($geoJson) @param string|array|stdClass $geoJson http://geojson.org/geojson-spec.html @param array $modifiers @param array $options @param mixed $request @return \Orion\Context\Context @throws \Exception
[ "Geo", "Spatial", "handler", "method" ]
f16005de36ec4b86e44eb47a4aa04e37fe5deca6
https://github.com/VM9/orion-explorer-php-frame-work/blob/f16005de36ec4b86e44eb47a4aa04e37fe5deca6/src/Orion/Context/Entity.php#L334-L352
train
VM9/orion-explorer-php-frame-work
src/Orion/Context/Entity.php
Entity.getCoveredBy
public function getCoveredBy($geoJson, array $modifiers = [], array $options = [], &$request = null) { return $this->geoQuery("coveredBy", $geoJson, $modifiers, $options, $request); }
php
public function getCoveredBy($geoJson, array $modifiers = [], array $options = [], &$request = null) { return $this->geoQuery("coveredBy", $geoJson, $modifiers, $options, $request); }
[ "public", "function", "getCoveredBy", "(", "$", "geoJson", ",", "array", "$", "modifiers", "=", "[", "]", ",", "array", "$", "options", "=", "[", "]", ",", "&", "$", "request", "=", "null", ")", "{", "return", "$", "this", "->", "geoQuery", "(", "\...
Denotes that matching entities are those that exist entirely within the reference geometry. When resolving a query of this type, the border of the shape must be considered to be part of the shape @param GeoJson $geoJson http://geojson.org/geojson-spec.html @param array $modifiers @param array $options @param pointer $request @return type
[ "Denotes", "that", "matching", "entities", "are", "those", "that", "exist", "entirely", "within", "the", "reference", "geometry", ".", "When", "resolving", "a", "query", "of", "this", "type", "the", "border", "of", "the", "shape", "must", "be", "considered", ...
f16005de36ec4b86e44eb47a4aa04e37fe5deca6
https://github.com/VM9/orion-explorer-php-frame-work/blob/f16005de36ec4b86e44eb47a4aa04e37fe5deca6/src/Orion/Context/Entity.php#L391-L393
train
VM9/orion-explorer-php-frame-work
src/Orion/Context/Entity.php
Entity.getIntersections
public function getIntersections($geoJson, array $modifiers = [], array $options = [], &$request = null) { return $this->geoQuery("intersects", $geoJson, $modifiers, $options, $request); }
php
public function getIntersections($geoJson, array $modifiers = [], array $options = [], &$request = null) { return $this->geoQuery("intersects", $geoJson, $modifiers, $options, $request); }
[ "public", "function", "getIntersections", "(", "$", "geoJson", ",", "array", "$", "modifiers", "=", "[", "]", ",", "array", "$", "options", "=", "[", "]", ",", "&", "$", "request", "=", "null", ")", "{", "return", "$", "this", "->", "geoQuery", "(", ...
Denotes that matching entities are those intersecting with the reference geometry @param GeoJson $geoJson http://geojson.org/geojson-spec.html @param array $modifiers @param array $options @param pointer $request @return type
[ "Denotes", "that", "matching", "entities", "are", "those", "intersecting", "with", "the", "reference", "geometry" ]
f16005de36ec4b86e44eb47a4aa04e37fe5deca6
https://github.com/VM9/orion-explorer-php-frame-work/blob/f16005de36ec4b86e44eb47a4aa04e37fe5deca6/src/Orion/Context/Entity.php#L403-L405
train
VM9/orion-explorer-php-frame-work
src/Orion/Context/Entity.php
Entity.getDisjoints
public function getDisjoints($geoJson, array $modifiers = [], array $options = [], &$request = null) { return $this->geoQuery("disjoint", $geoJson, $modifiers, $options, $request); }
php
public function getDisjoints($geoJson, array $modifiers = [], array $options = [], &$request = null) { return $this->geoQuery("disjoint", $geoJson, $modifiers, $options, $request); }
[ "public", "function", "getDisjoints", "(", "$", "geoJson", ",", "array", "$", "modifiers", "=", "[", "]", ",", "array", "$", "options", "=", "[", "]", ",", "&", "$", "request", "=", "null", ")", "{", "return", "$", "this", "->", "geoQuery", "(", "\...
Denotes that matching entities are those not intersecting with the reference geometry @param GeoJson $geoJson http://geojson.org/geojson-spec.html @param array $modifiers @param array $options @param pointer $request @return type
[ "Denotes", "that", "matching", "entities", "are", "those", "not", "intersecting", "with", "the", "reference", "geometry" ]
f16005de36ec4b86e44eb47a4aa04e37fe5deca6
https://github.com/VM9/orion-explorer-php-frame-work/blob/f16005de36ec4b86e44eb47a4aa04e37fe5deca6/src/Orion/Context/Entity.php#L415-L417
train
VM9/orion-explorer-php-frame-work
src/Orion/Context/Entity.php
Entity.getGeoEquals
public function getGeoEquals($geoJson, array $modifiers = [], array $options = [], &$request) { return $this->geoQuery("equals", $geoJson, $modifiers, $options, $request); }
php
public function getGeoEquals($geoJson, array $modifiers = [], array $options = [], &$request) { return $this->geoQuery("equals", $geoJson, $modifiers, $options, $request); }
[ "public", "function", "getGeoEquals", "(", "$", "geoJson", ",", "array", "$", "modifiers", "=", "[", "]", ",", "array", "$", "options", "=", "[", "]", ",", "&", "$", "request", ")", "{", "return", "$", "this", "->", "geoQuery", "(", "\"equals\"", ","...
The geometry associated to the position of matching entities and the reference geometry must be exactly the same @param GeoJson $geoJson http://geojson.org/geojson-spec.html @param array $modifiers @param array $options @param mixed $request @return type
[ "The", "geometry", "associated", "to", "the", "position", "of", "matching", "entities", "and", "the", "reference", "geometry", "must", "be", "exactly", "the", "same" ]
f16005de36ec4b86e44eb47a4aa04e37fe5deca6
https://github.com/VM9/orion-explorer-php-frame-work/blob/f16005de36ec4b86e44eb47a4aa04e37fe5deca6/src/Orion/Context/Entity.php#L427-L429
train
girosolution/girocheckout_sdk
src/girocheckout-sdk/helper/GiroCheckout_SDK_Debug_helper.php
GiroCheckout_SDK_Debug_helper.init
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
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)); }
[ "public", "function", "init", "(", "$", "logFilePrefix", ")", "{", "self", "::", "$", "logFileName", "=", "date", "(", "'Y-m-d_H-i-s'", ")", ".", "'-'", ".", "ucfirst", "(", "$", "logFilePrefix", ")", ".", "'-'", ".", "md5", "(", "time", "(", ")", ")...
Initialisation of the debug log, stores information about the environment. @param string $logFilePrefix Is prefixed to the log file name
[ "Initialisation", "of", "the", "debug", "log", "stores", "information", "about", "the", "environment", "." ]
4360f8894452a9c8f41b07f021746105e27a8575
https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/helper/GiroCheckout_SDK_Debug_helper.php#L70-L94
train
girosolution/girocheckout_sdk
src/girocheckout-sdk/helper/GiroCheckout_SDK_Debug_helper.php
GiroCheckout_SDK_Debug_helper.logParamsSet
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
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)); }
[ "public", "function", "logParamsSet", "(", "$", "paramsArray", ")", "{", "$", "paramsString", "=", "''", ";", "foreach", "(", "$", "paramsArray", "as", "$", "k", "=>", "$", "v", ")", "{", "$", "paramsString", ".=", "\"$k=$v\\r\\n\"", ";", "}", "$", "th...
Logs parameters which were set before sending. @param array $paramsArray Array of parameters
[ "Logs", "parameters", "which", "were", "set", "before", "sending", "." ]
4360f8894452a9c8f41b07f021746105e27a8575
https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/helper/GiroCheckout_SDK_Debug_helper.php#L110-L118
train
girosolution/girocheckout_sdk
src/girocheckout-sdk/helper/GiroCheckout_SDK_Debug_helper.php
GiroCheckout_SDK_Debug_helper.logReplyParams
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
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)); }
[ "public", "function", "logReplyParams", "(", "$", "params", ")", "{", "$", "paramsString", "=", "''", ";", "foreach", "(", "$", "params", "as", "$", "k", "=>", "$", "v", ")", "{", "$", "paramsString", ".=", "\"$k=\"", ".", "print_r", "(", "$", "v", ...
Logs processed reply params from json array @param array $params Parameters
[ "Logs", "processed", "reply", "params", "from", "json", "array" ]
4360f8894452a9c8f41b07f021746105e27a8575
https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/helper/GiroCheckout_SDK_Debug_helper.php#L167-L175
train
girosolution/girocheckout_sdk
src/girocheckout-sdk/helper/GiroCheckout_SDK_Debug_helper.php
GiroCheckout_SDK_Debug_helper.logNotificationInput
public function logNotificationInput($paramsArray) { $this->writeLog(sprintf($this->debugStrings['notifyInput'], date('Y-m-d H:i:s'), print_r($paramsArray, 1))); }
php
public function logNotificationInput($paramsArray) { $this->writeLog(sprintf($this->debugStrings['notifyInput'], date('Y-m-d H:i:s'), print_r($paramsArray, 1))); }
[ "public", "function", "logNotificationInput", "(", "$", "paramsArray", ")", "{", "$", "this", "->", "writeLog", "(", "sprintf", "(", "$", "this", "->", "debugStrings", "[", "'notifyInput'", "]", ",", "date", "(", "'Y-m-d H:i:s'", ")", ",", "print_r", "(", ...
Logs parameters which were used for Notification @param array $paramsArray Array of parameters
[ "Logs", "parameters", "which", "were", "used", "for", "Notification" ]
4360f8894452a9c8f41b07f021746105e27a8575
https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/helper/GiroCheckout_SDK_Debug_helper.php#L182-L184
train
girosolution/girocheckout_sdk
src/girocheckout-sdk/helper/GiroCheckout_SDK_Debug_helper.php
GiroCheckout_SDK_Debug_helper.logNotificationParams
public function logNotificationParams($paramsArray) { $this->writeLog(sprintf($this->debugStrings['notifyParams'], date('Y-m-d H:i:s'), print_r($paramsArray, 1))); }
php
public function logNotificationParams($paramsArray) { $this->writeLog(sprintf($this->debugStrings['notifyParams'], date('Y-m-d H:i:s'), print_r($paramsArray, 1))); }
[ "public", "function", "logNotificationParams", "(", "$", "paramsArray", ")", "{", "$", "this", "->", "writeLog", "(", "sprintf", "(", "$", "this", "->", "debugStrings", "[", "'notifyParams'", "]", ",", "date", "(", "'Y-m-d H:i:s'", ")", ",", "print_r", "(", ...
logs parameters which were used for Notification @param array $paramsArray Array of parameters
[ "logs", "parameters", "which", "were", "used", "for", "Notification" ]
4360f8894452a9c8f41b07f021746105e27a8575
https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/helper/GiroCheckout_SDK_Debug_helper.php#L191-L193
train
girosolution/girocheckout_sdk
src/girocheckout-sdk/helper/GiroCheckout_SDK_Debug_helper.php
GiroCheckout_SDK_Debug_helper.writeLog
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
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); }
[ "public", "function", "writeLog", "(", "$", "string", ")", "{", "$", "Config", "=", "GiroCheckout_SDK_Config", "::", "getInstance", "(", ")", ";", "$", "path", "=", "str_replace", "(", "'\\\\'", ",", "'/'", ",", "$", "Config", "->", "getConfig", "(", "'D...
Writes log into log file @param string $string Text to write to log
[ "Writes", "log", "into", "log", "file" ]
4360f8894452a9c8f41b07f021746105e27a8575
https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/helper/GiroCheckout_SDK_Debug_helper.php#L218-L240
train
wp-jungle/baobab
src/Baobab/Blade/WordPressLoopExtension.php
WordPressLoopExtension.register
public function register($compiler) { $this->registerStartLoopQuery($compiler); $this->registerEmptyLoopBranch($compiler); $this->registerEndLoop($compiler); }
php
public function register($compiler) { $this->registerStartLoopQuery($compiler); $this->registerEmptyLoopBranch($compiler); $this->registerEndLoop($compiler); }
[ "public", "function", "register", "(", "$", "compiler", ")", "{", "$", "this", "->", "registerStartLoopQuery", "(", "$", "compiler", ")", ";", "$", "this", "->", "registerEmptyLoopBranch", "(", "$", "compiler", ")", ";", "$", "this", "->", "registerEndLoop",...
Register the extension in the compiler @param BladeCompiler $compiler The blade compiler to extend
[ "Register", "the", "extension", "in", "the", "compiler" ]
ed2a9f2bbc3d194aa4df454b50aec43796fc68da
https://github.com/wp-jungle/baobab/blob/ed2a9f2bbc3d194aa4df454b50aec43796fc68da/src/Baobab/Blade/WordPressLoopExtension.php#L21-L26
train
webeweb/jquery-datatables-bundle
API/DataTablesColumn.php
DataTablesColumn.setOrderSequence
public function setOrderSequence($orderSequence) { if (false === in_array($orderSequence, DataTablesEnumerator::enumOrderSequences())) { $orderSequence = null; } $this->orderSequence = $orderSequence; return $this; }
php
public function setOrderSequence($orderSequence) { if (false === in_array($orderSequence, DataTablesEnumerator::enumOrderSequences())) { $orderSequence = null; } $this->orderSequence = $orderSequence; return $this; }
[ "public", "function", "setOrderSequence", "(", "$", "orderSequence", ")", "{", "if", "(", "false", "===", "in_array", "(", "$", "orderSequence", ",", "DataTablesEnumerator", "::", "enumOrderSequences", "(", ")", ")", ")", "{", "$", "orderSequence", "=", "null"...
Set the order sequence. @param string $orderSequence The order sequence. @return DataTablesColumnInterface Returns this column.
[ "Set", "the", "order", "sequence", "." ]
b53df9585a523fa1617128e6b467a5e574262a94
https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/API/DataTablesColumn.php#L371-L377
train
vinicius73/SeoTools
src/Vinicius73/SEO/Generators/SitemapGenerator.php
SitemapGenerator.add
public function add($object) { if (is_a($object, 'Closure')) { return $this->closures[] = $object; } $this->validateObject($object); $data = $object->getSitemapData(); $this->addRaw($data); }
php
public function add($object) { if (is_a($object, 'Closure')) { return $this->closures[] = $object; } $this->validateObject($object); $data = $object->getSitemapData(); $this->addRaw($data); }
[ "public", "function", "add", "(", "$", "object", ")", "{", "if", "(", "is_a", "(", "$", "object", ",", "'Closure'", ")", ")", "{", "return", "$", "this", "->", "closures", "[", "]", "=", "$", "object", ";", "}", "$", "this", "->", "validateObject",...
Add a SitemapAware object to the sitemap. @param mixed $object
[ "Add", "a", "SitemapAware", "object", "to", "the", "sitemap", "." ]
5d2543482921713e0676c310ff8b23b2989443a1
https://github.com/vinicius73/SeoTools/blob/5d2543482921713e0676c310ff8b23b2989443a1/src/Vinicius73/SEO/Generators/SitemapGenerator.php#L64-L74
train
vinicius73/SeoTools
src/Vinicius73/SEO/Generators/SitemapGenerator.php
SitemapGenerator.addAll
public function addAll($objects) { if (is_a($objects, 'Closure')) { return $this->closures[] = $objects; } foreach ($objects as $object) { $this->add($object); } }
php
public function addAll($objects) { if (is_a($objects, 'Closure')) { return $this->closures[] = $objects; } foreach ($objects as $object) { $this->add($object); } }
[ "public", "function", "addAll", "(", "$", "objects", ")", "{", "if", "(", "is_a", "(", "$", "objects", ",", "'Closure'", ")", ")", "{", "return", "$", "this", "->", "closures", "[", "]", "=", "$", "objects", ";", "}", "foreach", "(", "$", "objects"...
Add multiple SitemapAware objects to the sitemap. @param array|Traversable $objects
[ "Add", "multiple", "SitemapAware", "objects", "to", "the", "sitemap", "." ]
5d2543482921713e0676c310ff8b23b2989443a1
https://github.com/vinicius73/SeoTools/blob/5d2543482921713e0676c310ff8b23b2989443a1/src/Vinicius73/SEO/Generators/SitemapGenerator.php#L81-L90
train
vinicius73/SeoTools
src/Vinicius73/SEO/Generators/SitemapGenerator.php
SitemapGenerator.addRaw
public function addRaw($data) { $this->validateData($data); $data['location'] = trim($data['location'], '/'); $this->entries[] = $this->replaceAttributes($data); }
php
public function addRaw($data) { $this->validateData($data); $data['location'] = trim($data['location'], '/'); $this->entries[] = $this->replaceAttributes($data); }
[ "public", "function", "addRaw", "(", "$", "data", ")", "{", "$", "this", "->", "validateData", "(", "$", "data", ")", ";", "$", "data", "[", "'location'", "]", "=", "trim", "(", "$", "data", "[", "'location'", "]", ",", "'/'", ")", ";", "$", "thi...
Add a raw entry to the sitemap. @param array $data
[ "Add", "a", "raw", "entry", "to", "the", "sitemap", "." ]
5d2543482921713e0676c310ff8b23b2989443a1
https://github.com/vinicius73/SeoTools/blob/5d2543482921713e0676c310ff8b23b2989443a1/src/Vinicius73/SEO/Generators/SitemapGenerator.php#L97-L104
train
vinicius73/SeoTools
src/Vinicius73/SEO/Generators/SitemapGenerator.php
SitemapGenerator.contains
public function contains($url) { $url = trim($url, '/'); foreach ($this->entries as $entry) { if ($entry['loc'] == $url) { return TRUE; } } return FALSE; }
php
public function contains($url) { $url = trim($url, '/'); foreach ($this->entries as $entry) { if ($entry['loc'] == $url) { return TRUE; } } return FALSE; }
[ "public", "function", "contains", "(", "$", "url", ")", "{", "$", "url", "=", "trim", "(", "$", "url", ",", "'/'", ")", ";", "foreach", "(", "$", "this", "->", "entries", "as", "$", "entry", ")", "{", "if", "(", "$", "entry", "[", "'loc'", "]",...
Check if the sitemap contains an url. @param string $url @return boolean
[ "Check", "if", "the", "sitemap", "contains", "an", "url", "." ]
5d2543482921713e0676c310ff8b23b2989443a1
https://github.com/vinicius73/SeoTools/blob/5d2543482921713e0676c310ff8b23b2989443a1/src/Vinicius73/SEO/Generators/SitemapGenerator.php#L113-L124
train
vinicius73/SeoTools
src/Vinicius73/SEO/Generators/SitemapGenerator.php
SitemapGenerator.generateIndex
public function generateIndex() { $this->loadClosures(); $xml = new XMLWriter(); $xml->openMemory(); $xml->writeRaw('<?xml version="1.0" encoding="UTF-8"?>'); $xml->writeRaw('<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'); foreach ($this->entries as $data) { $xml->startElement('sitemap'); foreach ($data as $attribute => $value) { $xml->writeElement($attribute, $value); } $xml->endElement(); } $xml->writeRaw('</sitemapindex>'); return $xml->outputMemory(); }
php
public function generateIndex() { $this->loadClosures(); $xml = new XMLWriter(); $xml->openMemory(); $xml->writeRaw('<?xml version="1.0" encoding="UTF-8"?>'); $xml->writeRaw('<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'); foreach ($this->entries as $data) { $xml->startElement('sitemap'); foreach ($data as $attribute => $value) { $xml->writeElement($attribute, $value); } $xml->endElement(); } $xml->writeRaw('</sitemapindex>'); return $xml->outputMemory(); }
[ "public", "function", "generateIndex", "(", ")", "{", "$", "this", "->", "loadClosures", "(", ")", ";", "$", "xml", "=", "new", "XMLWriter", "(", ")", ";", "$", "xml", "->", "openMemory", "(", ")", ";", "$", "xml", "->", "writeRaw", "(", "'<?xml vers...
Generate the xml for the sitemap. @return string
[ "Generate", "the", "xml", "for", "the", "sitemap", "." ]
5d2543482921713e0676c310ff8b23b2989443a1
https://github.com/vinicius73/SeoTools/blob/5d2543482921713e0676c310ff8b23b2989443a1/src/Vinicius73/SEO/Generators/SitemapGenerator.php#L169-L192
train
vinicius73/SeoTools
src/Vinicius73/SEO/Generators/SitemapGenerator.php
SitemapGenerator.replaceAttributes
protected function replaceAttributes($data) { foreach ($data as $attribute => $value) { $replacement = $this->replaceAttribute($attribute); unset($data[$attribute]); $data[$replacement] = $value; } return $data; }
php
protected function replaceAttributes($data) { foreach ($data as $attribute => $value) { $replacement = $this->replaceAttribute($attribute); unset($data[$attribute]); $data[$replacement] = $value; } return $data; }
[ "protected", "function", "replaceAttributes", "(", "$", "data", ")", "{", "foreach", "(", "$", "data", "as", "$", "attribute", "=>", "$", "value", ")", "{", "$", "replacement", "=", "$", "this", "->", "replaceAttribute", "(", "$", "attribute", ")", ";", ...
Replace the attribute names with their replacements. @param array $data @return array
[ "Replace", "the", "attribute", "names", "with", "their", "replacements", "." ]
5d2543482921713e0676c310ff8b23b2989443a1
https://github.com/vinicius73/SeoTools/blob/5d2543482921713e0676c310ff8b23b2989443a1/src/Vinicius73/SEO/Generators/SitemapGenerator.php#L245-L254
train
vinicius73/SeoTools
src/Vinicius73/SEO/Generators/SitemapGenerator.php
SitemapGenerator.replaceAttribute
protected function replaceAttribute($attribute) { if (array_key_exists($attribute, $this->replacements)) { return $this->replacements[$attribute]; } return $attribute; }
php
protected function replaceAttribute($attribute) { if (array_key_exists($attribute, $this->replacements)) { return $this->replacements[$attribute]; } return $attribute; }
[ "protected", "function", "replaceAttribute", "(", "$", "attribute", ")", "{", "if", "(", "array_key_exists", "(", "$", "attribute", ",", "$", "this", "->", "replacements", ")", ")", "{", "return", "$", "this", "->", "replacements", "[", "$", "attribute", "...
Replace an attribute with it's replacement if available. @param string $attribute @return string
[ "Replace", "an", "attribute", "with", "it", "s", "replacement", "if", "available", "." ]
5d2543482921713e0676c310ff8b23b2989443a1
https://github.com/vinicius73/SeoTools/blob/5d2543482921713e0676c310ff8b23b2989443a1/src/Vinicius73/SEO/Generators/SitemapGenerator.php#L263-L270
train
vinicius73/SeoTools
src/Vinicius73/SEO/Generators/SitemapGenerator.php
SitemapGenerator.loadClosures
protected function loadClosures() { foreach ($this->closures as $closure) { $instance = $closure(); if (is_array($instance) || $instance instanceof Traversable) { $this->addAll($instance); } else { $this->add($instance); } } }
php
protected function loadClosures() { foreach ($this->closures as $closure) { $instance = $closure(); if (is_array($instance) || $instance instanceof Traversable) { $this->addAll($instance); } else { $this->add($instance); } } }
[ "protected", "function", "loadClosures", "(", ")", "{", "foreach", "(", "$", "this", "->", "closures", "as", "$", "closure", ")", "{", "$", "instance", "=", "$", "closure", "(", ")", ";", "if", "(", "is_array", "(", "$", "instance", ")", "||", "$", ...
Load the lazy loaded elements. @return void
[ "Load", "the", "lazy", "loaded", "elements", "." ]
5d2543482921713e0676c310ff8b23b2989443a1
https://github.com/vinicius73/SeoTools/blob/5d2543482921713e0676c310ff8b23b2989443a1/src/Vinicius73/SEO/Generators/SitemapGenerator.php#L277-L288
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkTemplateFile
protected function checkTemplateFile($canUseFlexforms = false) { if (TYPO3_MODE === 'BE') { return; } $this->checkForNonEmptyString( 'templateFile', $canUseFlexforms, 's_template_special', 'This value specifies the HTML template which is essential when ' . 'creating any output from this extension.' ); if (($this->getFrontEndController() !== null) && $this->objectToCheck->hasConfValueString('templateFile', 's_template_special') ) { $rawFileName = $this->objectToCheck->getConfValueString( 'templateFile', 's_template_special', true ); if (!is_file($this->getFrontEndController()->tmpl->getFileName($rawFileName))) { $message = 'The specified HTML template file <strong>' . htmlspecialchars($rawFileName) . '</strong> cannot be read. ' . 'The HTML template file is essential when creating any ' . 'output from this extension. ' . 'Please either create the file <strong>' . $rawFileName . '</strong> or select an existing file using the TS setup ' . 'variable <strong>' . $this->getTSSetupPath() . 'templateFile</strong>'; if ($canUseFlexforms) { $message .= ' or via FlexForms'; } $message .= '.'; $this->setErrorMessage($message); } } }
php
protected function checkTemplateFile($canUseFlexforms = false) { if (TYPO3_MODE === 'BE') { return; } $this->checkForNonEmptyString( 'templateFile', $canUseFlexforms, 's_template_special', 'This value specifies the HTML template which is essential when ' . 'creating any output from this extension.' ); if (($this->getFrontEndController() !== null) && $this->objectToCheck->hasConfValueString('templateFile', 's_template_special') ) { $rawFileName = $this->objectToCheck->getConfValueString( 'templateFile', 's_template_special', true ); if (!is_file($this->getFrontEndController()->tmpl->getFileName($rawFileName))) { $message = 'The specified HTML template file <strong>' . htmlspecialchars($rawFileName) . '</strong> cannot be read. ' . 'The HTML template file is essential when creating any ' . 'output from this extension. ' . 'Please either create the file <strong>' . $rawFileName . '</strong> or select an existing file using the TS setup ' . 'variable <strong>' . $this->getTSSetupPath() . 'templateFile</strong>'; if ($canUseFlexforms) { $message .= ' or via FlexForms'; } $message .= '.'; $this->setErrorMessage($message); } } }
[ "protected", "function", "checkTemplateFile", "(", "$", "canUseFlexforms", "=", "false", ")", "{", "if", "(", "TYPO3_MODE", "===", "'BE'", ")", "{", "return", ";", "}", "$", "this", "->", "checkForNonEmptyString", "(", "'templateFile'", ",", "$", "canUseFlexfo...
Checks whether the HTML template is provided and the file exists. @param bool $canUseFlexforms whether the template can also be selected via flexforms @return void
[ "Checks", "whether", "the", "HTML", "template", "is", "provided", "and", "the", "file", "exists", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L304-L343
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkForNonEmptyString
public function checkForNonEmptyString( $fieldName, $canUseFlexforms, $sheet, $explanation ) { $value = $this->objectToCheck->getConfValueString($fieldName, $sheet); $this->checkForNonEmptyStringValue( $value, $fieldName, $canUseFlexforms, $explanation ); }
php
public function checkForNonEmptyString( $fieldName, $canUseFlexforms, $sheet, $explanation ) { $value = $this->objectToCheck->getConfValueString($fieldName, $sheet); $this->checkForNonEmptyStringValue( $value, $fieldName, $canUseFlexforms, $explanation ); }
[ "public", "function", "checkForNonEmptyString", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "explanation", ")", "{", "$", "value", "=", "$", "this", "->", "objectToCheck", "->", "getConfValueString", "(", "$", "fieldName", ...
Checks whether a configuration value contains a non-empty-string. @param string $fieldName TS setup field name to extract, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param string $explanation a sentence explaining what that configuration value is needed for and why it needs to be non-empty, must not be empty @return void
[ "Checks", "whether", "a", "configuration", "value", "contains", "a", "non", "-", "empty", "-", "string", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L403-L416
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkIfSingleInSetNotEmpty
protected function checkIfSingleInSetNotEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, array $allowedValues ) { $this->checkForNonEmptyString( $fieldName, $canUseFlexforms, $sheet, $explanation ); $this->checkIfSingleInSetOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, $allowedValues ); }
php
protected function checkIfSingleInSetNotEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, array $allowedValues ) { $this->checkForNonEmptyString( $fieldName, $canUseFlexforms, $sheet, $explanation ); $this->checkIfSingleInSetOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, $allowedValues ); }
[ "protected", "function", "checkIfSingleInSetNotEmpty", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "explanation", ",", "array", "$", "allowedValues", ")", "{", "$", "this", "->", "checkForNonEmptyString", "(", "$", "fieldName...
Checks whether a configuration value is non-empty and lies within a set of allowed values. @param string $fieldName TS setup field name to extract, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @param string[] $allowedValues allowed values (must not be empty) @return void
[ "Checks", "whether", "a", "configuration", "value", "is", "non", "-", "empty", "and", "lies", "within", "a", "set", "of", "allowed", "values", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L475-L495
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkIfSingleInSetOrEmpty
protected function checkIfSingleInSetOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, array $allowedValues ) { if ($this->objectToCheck->hasConfValueString($fieldName, $sheet)) { $value = $this->objectToCheck->getConfValueString($fieldName, $sheet); $this->checkIfSingleInSetOrEmptyValue( $value, $fieldName, $canUseFlexforms, $explanation, $allowedValues ); } }
php
protected function checkIfSingleInSetOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, array $allowedValues ) { if ($this->objectToCheck->hasConfValueString($fieldName, $sheet)) { $value = $this->objectToCheck->getConfValueString($fieldName, $sheet); $this->checkIfSingleInSetOrEmptyValue( $value, $fieldName, $canUseFlexforms, $explanation, $allowedValues ); } }
[ "protected", "function", "checkIfSingleInSetOrEmpty", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "explanation", ",", "array", "$", "allowedValues", ")", "{", "if", "(", "$", "this", "->", "objectToCheck", "->", "hasConfVal...
Checks whether a configuration value either is empty or lies within a set of allowed values. @param string $fieldName TS setup field name to extract, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @param string[] $allowedValues allowed values (must not be empty) @return void
[ "Checks", "whether", "a", "configuration", "value", "either", "is", "empty", "or", "lies", "within", "a", "set", "of", "allowed", "values", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L517-L534
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkIfBoolean
protected function checkIfBoolean($fieldName, $canUseFlexforms, $sheet, $explanation) { $this->checkIfSingleInSetNotEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, ['0', '1'] ); }
php
protected function checkIfBoolean($fieldName, $canUseFlexforms, $sheet, $explanation) { $this->checkIfSingleInSetNotEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, ['0', '1'] ); }
[ "protected", "function", "checkIfBoolean", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "explanation", ")", "{", "$", "this", "->", "checkIfSingleInSetNotEmpty", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", ...
Checks whether a configuration value has a boolean value. @param string $fieldName TS setup field name to extract, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @return void
[ "Checks", "whether", "a", "configuration", "value", "has", "a", "boolean", "value", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L598-L607
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkIfMultiInSetOrEmpty
protected function checkIfMultiInSetOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, array $allowedValues ) { if ($this->objectToCheck->hasConfValueString($fieldName, $sheet)) { $allValues = GeneralUtility::trimExplode( ',', $this->objectToCheck->getConfValueString($fieldName, $sheet), true ); $overviewOfValues = '(' . implode(', ', $allowedValues) . ')'; foreach ($allValues as $currentValue) { if (!in_array($currentValue, $allowedValues, true)) { $message = 'The TS setup variable <strong>' . $this->getTSSetupPath() . $fieldName . '</strong> contains the value <strong>' . htmlspecialchars($currentValue) . '</strong>, ' . 'but only the following values are allowed: ' . '<br /><strong>' . $overviewOfValues . '</strong><br />' . $explanation; $this->setErrorMessageAndRequestCorrection( $fieldName, $canUseFlexforms, $message ); } } } }
php
protected function checkIfMultiInSetOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, array $allowedValues ) { if ($this->objectToCheck->hasConfValueString($fieldName, $sheet)) { $allValues = GeneralUtility::trimExplode( ',', $this->objectToCheck->getConfValueString($fieldName, $sheet), true ); $overviewOfValues = '(' . implode(', ', $allowedValues) . ')'; foreach ($allValues as $currentValue) { if (!in_array($currentValue, $allowedValues, true)) { $message = 'The TS setup variable <strong>' . $this->getTSSetupPath() . $fieldName . '</strong> contains the value <strong>' . htmlspecialchars($currentValue) . '</strong>, ' . 'but only the following values are allowed: ' . '<br /><strong>' . $overviewOfValues . '</strong><br />' . $explanation; $this->setErrorMessageAndRequestCorrection( $fieldName, $canUseFlexforms, $message ); } } } }
[ "protected", "function", "checkIfMultiInSetOrEmpty", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "explanation", ",", "array", "$", "allowedValues", ")", "{", "if", "(", "$", "this", "->", "objectToCheck", "->", "hasConfValu...
Checks whether a configuration value either is empty or its comma-separated values lie within a set of allowed values. @param string $fieldName TS setup field name to extract, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @param string[] $allowedValues allowed values (must not be empty) @return void
[ "Checks", "whether", "a", "configuration", "value", "either", "is", "empty", "or", "its", "comma", "-", "separated", "values", "lie", "within", "a", "set", "of", "allowed", "values", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L930-L962
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkIfSingleInTableNotEmpty
public function checkIfSingleInTableNotEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, $tableName ) { $this->checkIfSingleInSetNotEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, $this->getDbColumnNames($tableName) ); }
php
public function checkIfSingleInTableNotEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, $tableName ) { $this->checkIfSingleInSetNotEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, $this->getDbColumnNames($tableName) ); }
[ "public", "function", "checkIfSingleInTableNotEmpty", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "explanation", ",", "$", "tableName", ")", "{", "$", "this", "->", "checkIfSingleInSetNotEmpty", "(", "$", "fieldName", ",", ...
Checks whether a configuration value is non-empty and is one of the column names of a given DB table. @param string $fieldName TS setup field name to extract, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @param string $tableName a DB table name (must not be empty) @return void
[ "Checks", "whether", "a", "configuration", "value", "is", "non", "-", "empty", "and", "is", "one", "of", "the", "column", "names", "of", "a", "given", "DB", "table", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L984-L998
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkIfSingleInTableOrEmpty
protected function checkIfSingleInTableOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, $tableName ) { $this->checkIfSingleInSetOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, $this->getDbColumnNames($tableName) ); }
php
protected function checkIfSingleInTableOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, $tableName ) { $this->checkIfSingleInSetOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, $this->getDbColumnNames($tableName) ); }
[ "protected", "function", "checkIfSingleInTableOrEmpty", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "explanation", ",", "$", "tableName", ")", "{", "$", "this", "->", "checkIfSingleInSetOrEmpty", "(", "$", "fieldName", ",", ...
Checks whether a configuration value either is empty or is one of the column names of a given DB table. @param string $fieldName TS setup field name to extract, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @param string $tableName a DB table name (must not be empty) @return void
[ "Checks", "whether", "a", "configuration", "value", "either", "is", "empty", "or", "is", "one", "of", "the", "column", "names", "of", "a", "given", "DB", "table", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L1020-L1034
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkIfMultiInTableOrEmpty
protected function checkIfMultiInTableOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, $tableName ) { $this->checkIfMultiInSetOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, $this->getDbColumnNames($tableName) ); }
php
protected function checkIfMultiInTableOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, $tableName ) { $this->checkIfMultiInSetOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, $this->getDbColumnNames($tableName) ); }
[ "protected", "function", "checkIfMultiInTableOrEmpty", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "explanation", ",", "$", "tableName", ")", "{", "$", "this", "->", "checkIfMultiInSetOrEmpty", "(", "$", "fieldName", ",", "...
Checks whether a configuration value either is empty or its comma-separated values is a column name of a given DB table. @param string $fieldName TS setup field name to extract, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @param string $tableName a DB table name (must not be empty) @return void
[ "Checks", "whether", "a", "configuration", "value", "either", "is", "empty", "or", "its", "comma", "-", "separated", "values", "is", "a", "column", "name", "of", "a", "given", "DB", "table", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L1092-L1106
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkRegExp
protected function checkRegExp( $fieldName, $canUseFlexforms, $sheet, $explanation, $regExp ) { $value = $this->objectToCheck->getConfValueString($fieldName, $sheet); if (!preg_match($regExp, $value)) { $message = 'The TS setup variable <strong>' . $this->getTSSetupPath() . $fieldName . '</strong> contains the value <strong>' . htmlspecialchars($value) . '</strong> which isn\'t valid. ' . $explanation; $this->setErrorMessageAndRequestCorrection( $fieldName, $canUseFlexforms, $message ); } }
php
protected function checkRegExp( $fieldName, $canUseFlexforms, $sheet, $explanation, $regExp ) { $value = $this->objectToCheck->getConfValueString($fieldName, $sheet); if (!preg_match($regExp, $value)) { $message = 'The TS setup variable <strong>' . $this->getTSSetupPath() . $fieldName . '</strong> contains the value <strong>' . htmlspecialchars($value) . '</strong> which isn\'t valid. ' . $explanation; $this->setErrorMessageAndRequestCorrection( $fieldName, $canUseFlexforms, $message ); } }
[ "protected", "function", "checkRegExp", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "explanation", ",", "$", "regExp", ")", "{", "$", "value", "=", "$", "this", "->", "objectToCheck", "->", "getConfValueString", "(", "$...
Checks whether a configuration value matches a regular expression. @param string $fieldName TS setup field name to extract, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @param string $regExp a regular expression (including the delimiting slashes) @return void
[ "Checks", "whether", "a", "configuration", "value", "matches", "a", "regular", "expression", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L1187-L1207
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkRegExpNotEmpty
protected function checkRegExpNotEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, $regExp ) { $this->checkForNonEmptyString( $fieldName, $canUseFlexforms, $sheet, $explanation ); $this->checkRegExp( $fieldName, $canUseFlexforms, $sheet, $explanation, $regExp ); }
php
protected function checkRegExpNotEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, $regExp ) { $this->checkForNonEmptyString( $fieldName, $canUseFlexforms, $sheet, $explanation ); $this->checkRegExp( $fieldName, $canUseFlexforms, $sheet, $explanation, $regExp ); }
[ "protected", "function", "checkRegExpNotEmpty", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "explanation", ",", "$", "regExp", ")", "{", "$", "this", "->", "checkForNonEmptyString", "(", "$", "fieldName", ",", "$", "canUs...
Checks whether a configuration value is non-empty and matches a regular expression. @param string $fieldName TS setup field name to extract, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @param string $regExp a regular expression (including the delimiting slashes) @return void
[ "Checks", "whether", "a", "configuration", "value", "is", "non", "-", "empty", "and", "matches", "a", "regular", "expression", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L1229-L1249
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkIfFePagesNotEmpty
protected function checkIfFePagesNotEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ) { $this->checkForNonEmptyString( $fieldName, $canUseFlexforms, $sheet, $explanation ); $this->checkIfFePagesOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ); }
php
protected function checkIfFePagesNotEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ) { $this->checkForNonEmptyString( $fieldName, $canUseFlexforms, $sheet, $explanation ); $this->checkIfFePagesOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ); }
[ "protected", "function", "checkIfFePagesNotEmpty", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "explanation", ")", "{", "$", "this", "->", "checkForNonEmptyString", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "...
Checks whether a configuration value is non-empty and contains a comma-separated list of front-end PIDs. @param string $fieldName TS setup field name to extract, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @return void
[ "Checks", "whether", "a", "configuration", "value", "is", "non", "-", "empty", "and", "contains", "a", "comma", "-", "separated", "list", "of", "front", "-", "end", "PIDs", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L1340-L1358
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkIfSingleFePageNotEmpty
protected function checkIfSingleFePageNotEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ) { $this->checkIfPositiveInteger( $fieldName, $canUseFlexforms, $sheet, $explanation ); $this->checkIfFePagesOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ); }
php
protected function checkIfSingleFePageNotEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ) { $this->checkIfPositiveInteger( $fieldName, $canUseFlexforms, $sheet, $explanation ); $this->checkIfFePagesOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ); }
[ "protected", "function", "checkIfSingleFePageNotEmpty", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "explanation", ")", "{", "$", "this", "->", "checkIfPositiveInteger", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ","...
Checks whether a configuration value is non-empty and contains a single front-end PID. @param string $fieldName TS setup field name to extract, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @return void
[ "Checks", "whether", "a", "configuration", "value", "is", "non", "-", "empty", "and", "contains", "a", "single", "front", "-", "end", "PID", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L1378-L1396
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkIfSingleFePageOrEmpty
protected function checkIfSingleFePageOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ) { $this->checkIfInteger($fieldName, $canUseFlexforms, $sheet, $explanation); $this->checkIfFePagesOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ); }
php
protected function checkIfSingleFePageOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ) { $this->checkIfInteger($fieldName, $canUseFlexforms, $sheet, $explanation); $this->checkIfFePagesOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ); }
[ "protected", "function", "checkIfSingleFePageOrEmpty", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "explanation", ")", "{", "$", "this", "->", "checkIfInteger", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", ...
Checks whether a configuration value either is empty or contains a single front-end PID. @param string $fieldName TS setup field name to extract, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @return void
[ "Checks", "whether", "a", "configuration", "value", "either", "is", "empty", "or", "contains", "a", "single", "front", "-", "end", "PID", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L1416-L1429
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkIfSysFoldersNotEmpty
protected function checkIfSysFoldersNotEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ) { $this->checkForNonEmptyString( $fieldName, $canUseFlexforms, $sheet, $explanation ); $this->checkIfSysFoldersOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ); }
php
protected function checkIfSysFoldersNotEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ) { $this->checkForNonEmptyString( $fieldName, $canUseFlexforms, $sheet, $explanation ); $this->checkIfSysFoldersOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ); }
[ "protected", "function", "checkIfSysFoldersNotEmpty", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "explanation", ")", "{", "$", "this", "->", "checkForNonEmptyString", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", ...
Checks whether a configuration value is non-empty and contains a comma-separated list of system folder PIDs. @param string $fieldName TS setup field name to extract, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @return void
[ "Checks", "whether", "a", "configuration", "value", "is", "non", "-", "empty", "and", "contains", "a", "comma", "-", "separated", "list", "of", "system", "folder", "PIDs", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L1493-L1511
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkIfSingleSysFolderNotEmpty
protected function checkIfSingleSysFolderNotEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ) { $this->checkIfPositiveInteger( $fieldName, $canUseFlexforms, $sheet, $explanation ); $this->checkIfSysFoldersOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ); }
php
protected function checkIfSingleSysFolderNotEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ) { $this->checkIfPositiveInteger( $fieldName, $canUseFlexforms, $sheet, $explanation ); $this->checkIfSysFoldersOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ); }
[ "protected", "function", "checkIfSingleSysFolderNotEmpty", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "explanation", ")", "{", "$", "this", "->", "checkIfPositiveInteger", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ...
Checks whether a configuration value is non-empty and contains a single system folder PID. @param string $fieldName TS setup field name to extract, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @return void
[ "Checks", "whether", "a", "configuration", "value", "is", "non", "-", "empty", "and", "contains", "a", "single", "system", "folder", "PID", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L1531-L1549
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkIfSingleSysFolderOrEmpty
protected function checkIfSingleSysFolderOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ) { $this->checkIfInteger( $fieldName, $canUseFlexforms, $sheet, $explanation ); $this->checkIfSysFoldersOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ); }
php
protected function checkIfSingleSysFolderOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ) { $this->checkIfInteger( $fieldName, $canUseFlexforms, $sheet, $explanation ); $this->checkIfSysFoldersOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ); }
[ "protected", "function", "checkIfSingleSysFolderOrEmpty", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "explanation", ")", "{", "$", "this", "->", "checkIfInteger", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$...
Checks whether a configuration value either is empty or contains a single system folder PID. @param string $fieldName TS setup field name to extract, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @return void
[ "Checks", "whether", "a", "configuration", "value", "either", "is", "empty", "or", "contains", "a", "single", "system", "folder", "PID", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L1569-L1587
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkIfSysFoldersOrEmpty
protected function checkIfSysFoldersOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ) { $pids = $this->objectToCheck->getConfValueString($fieldName, $sheet); // Uses the plural if the configuration value is empty or contains a // comma. if (($pids === '') || (strrpos($pids, ',') !== false)) { $message = 'All the selected pages need to be system folders so ' . 'that data records are tidily separated from front-end ' . 'content. ' . $explanation; } else { $message = 'The selected page needs to be a system folder so that ' . 'data records are tidily separated from front-end content. ' . $explanation; } $this->checkPageTypeOrEmpty( $fieldName, $canUseFlexforms, $sheet, $message, '=254' ); }
php
protected function checkIfSysFoldersOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ) { $pids = $this->objectToCheck->getConfValueString($fieldName, $sheet); // Uses the plural if the configuration value is empty or contains a // comma. if (($pids === '') || (strrpos($pids, ',') !== false)) { $message = 'All the selected pages need to be system folders so ' . 'that data records are tidily separated from front-end ' . 'content. ' . $explanation; } else { $message = 'The selected page needs to be a system folder so that ' . 'data records are tidily separated from front-end content. ' . $explanation; } $this->checkPageTypeOrEmpty( $fieldName, $canUseFlexforms, $sheet, $message, '=254' ); }
[ "protected", "function", "checkIfSysFoldersOrEmpty", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "explanation", ")", "{", "$", "pids", "=", "$", "this", "->", "objectToCheck", "->", "getConfValueString", "(", "$", "fieldNam...
Checks whether a configuration value either is empty or contains a comma-separated list of system folder PIDs. @param string $fieldName TS setup field name to extract, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @return void
[ "Checks", "whether", "a", "configuration", "value", "either", "is", "empty", "or", "contains", "a", "comma", "-", "separated", "list", "of", "system", "folder", "PIDs", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L1607-L1633
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkPageTypeOrEmpty
protected function checkPageTypeOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, $typeCondition ) { $this->checkIfPidListOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ); if ($this->objectToCheck->hasConfValueString($fieldName, $sheet)) { $pids = $this->objectToCheck->getConfValueString($fieldName, $sheet); $offendingPids = \Tx_Oelib_Db::selectColumnForMultiple( 'uid', 'pages', 'uid IN (' . $pids . ') AND NOT (doktype' . $typeCondition . ')' . \Tx_Oelib_Db::enableFields('pages') ); $dbResultCount = count($offendingPids); if ($dbResultCount > 0) { $pageIdPlural = ($dbResultCount > 1) ? 's' : ''; $bePlural = ($dbResultCount > 1) ? 'are' : 'is'; $message = 'The TS setup variable <strong>' . $this->getTSSetupPath() . $fieldName . '</strong> contains the page ID' . $pageIdPlural . ' <strong>' . implode(',', $offendingPids) . '</strong> ' . 'which ' . $bePlural . ' of an incorrect page type. ' . $explanation . '<br />'; $this->setErrorMessageAndRequestCorrection( $fieldName, $canUseFlexforms, $message ); } } }
php
protected function checkPageTypeOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation, $typeCondition ) { $this->checkIfPidListOrEmpty( $fieldName, $canUseFlexforms, $sheet, $explanation ); if ($this->objectToCheck->hasConfValueString($fieldName, $sheet)) { $pids = $this->objectToCheck->getConfValueString($fieldName, $sheet); $offendingPids = \Tx_Oelib_Db::selectColumnForMultiple( 'uid', 'pages', 'uid IN (' . $pids . ') AND NOT (doktype' . $typeCondition . ')' . \Tx_Oelib_Db::enableFields('pages') ); $dbResultCount = count($offendingPids); if ($dbResultCount > 0) { $pageIdPlural = ($dbResultCount > 1) ? 's' : ''; $bePlural = ($dbResultCount > 1) ? 'are' : 'is'; $message = 'The TS setup variable <strong>' . $this->getTSSetupPath() . $fieldName . '</strong> contains the page ID' . $pageIdPlural . ' <strong>' . implode(',', $offendingPids) . '</strong> ' . 'which ' . $bePlural . ' of an incorrect page type. ' . $explanation . '<br />'; $this->setErrorMessageAndRequestCorrection( $fieldName, $canUseFlexforms, $message ); } } }
[ "protected", "function", "checkPageTypeOrEmpty", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "explanation", ",", "$", "typeCondition", ")", "{", "$", "this", "->", "checkIfPidListOrEmpty", "(", "$", "fieldName", ",", "$", ...
Checks whether a configuration value either is empty or contains a comma-separated list of PIDs that specify pages or a given type. @param string $fieldName TS setup field name to extract, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @param string $typeCondition a comparison operator with a value that will be used in a SQL query to check for the correct page types, for example "<199" or "=254", must not be empty @return void
[ "Checks", "whether", "a", "configuration", "value", "either", "is", "empty", "or", "contains", "a", "comma", "-", "separated", "list", "of", "PIDs", "that", "specify", "pages", "or", "a", "given", "type", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L1657-L1699
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkListViewIfSingleInSetNotEmpty
protected function checkListViewIfSingleInSetNotEmpty( $fieldName, $explanation, array $allowedValues ) { $fieldSubPath = 'listView.' . $fieldName; $value = $this->objectToCheck->getListViewConfValueString($fieldName); $this->checkForNonEmptyStringValue( $value, $fieldSubPath, false, $explanation ); $this->checkIfSingleInSetOrEmptyValue( $value, $fieldSubPath, false, $explanation, $allowedValues ); }
php
protected function checkListViewIfSingleInSetNotEmpty( $fieldName, $explanation, array $allowedValues ) { $fieldSubPath = 'listView.' . $fieldName; $value = $this->objectToCheck->getListViewConfValueString($fieldName); $this->checkForNonEmptyStringValue( $value, $fieldSubPath, false, $explanation ); $this->checkIfSingleInSetOrEmptyValue( $value, $fieldSubPath, false, $explanation, $allowedValues ); }
[ "protected", "function", "checkListViewIfSingleInSetNotEmpty", "(", "$", "fieldName", ",", "$", "explanation", ",", "array", "$", "allowedValues", ")", "{", "$", "fieldSubPath", "=", "'listView.'", ".", "$", "fieldName", ";", "$", "value", "=", "$", "this", "-...
Checks whether a configuration value in listView. is non-empty and lies within a set of allowed values. @param string $fieldName TS setup field name to extract (within listView.), must not be empty @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @param string[] $allowedValues allowed values (must not be empty) @return void
[ "Checks", "whether", "a", "configuration", "value", "in", "listView", ".", "is", "non", "-", "empty", "and", "lies", "within", "a", "set", "of", "allowed", "values", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L1771-L1792
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkIsValidEmailOrEmpty
public function checkIsValidEmailOrEmpty( $fieldName, $canUseFlexforms, $sheet, $unused, $explanation ) { $value = $this->objectToCheck->getConfValueString($fieldName, $sheet); if ($value === '') { return; } if (!GeneralUtility::validEmail($value)) { $message = 'The e-mail address in <strong>' . $this->getTSSetupPath() . $fieldName . '</strong> is set to <strong>' . $value . '</strong> ' . 'which is not valid. E-mails might not be received as long as ' . 'this address is invalid.<br />'; $this->setErrorMessageAndRequestCorrection( $fieldName, $canUseFlexforms, $message . $explanation ); } }
php
public function checkIsValidEmailOrEmpty( $fieldName, $canUseFlexforms, $sheet, $unused, $explanation ) { $value = $this->objectToCheck->getConfValueString($fieldName, $sheet); if ($value === '') { return; } if (!GeneralUtility::validEmail($value)) { $message = 'The e-mail address in <strong>' . $this->getTSSetupPath() . $fieldName . '</strong> is set to <strong>' . $value . '</strong> ' . 'which is not valid. E-mails might not be received as long as ' . 'this address is invalid.<br />'; $this->setErrorMessageAndRequestCorrection( $fieldName, $canUseFlexforms, $message . $explanation ); } }
[ "public", "function", "checkIsValidEmailOrEmpty", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "unused", ",", "$", "explanation", ")", "{", "$", "value", "=", "$", "this", "->", "objectToCheck", "->", "getConfValueString", ...
Checks that an e-mail address is valid or empty. @param string $fieldName TS setup field name to mention in the warning, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param bool $unused unused @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @return void
[ "Checks", "that", "an", "e", "-", "mail", "address", "is", "valid", "or", "empty", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L1837-L1860
train
oliverklee/ext-oelib
Classes/ConfigCheck.php
Tx_Oelib_ConfigCheck.checkIsValidEmailNotEmpty
public function checkIsValidEmailNotEmpty( $fieldName, $canUseFlexforms, $sheet, $allowInternalAddresses, $explanation ) { $this->checkForNonEmptyString( $fieldName, $canUseFlexforms, $sheet, $explanation ); $this->checkIsValidEmailOrEmpty( $fieldName, $canUseFlexforms, $sheet, $allowInternalAddresses, $explanation ); }
php
public function checkIsValidEmailNotEmpty( $fieldName, $canUseFlexforms, $sheet, $allowInternalAddresses, $explanation ) { $this->checkForNonEmptyString( $fieldName, $canUseFlexforms, $sheet, $explanation ); $this->checkIsValidEmailOrEmpty( $fieldName, $canUseFlexforms, $sheet, $allowInternalAddresses, $explanation ); }
[ "public", "function", "checkIsValidEmailNotEmpty", "(", "$", "fieldName", ",", "$", "canUseFlexforms", ",", "$", "sheet", ",", "$", "allowInternalAddresses", ",", "$", "explanation", ")", "{", "$", "this", "->", "checkForNonEmptyString", "(", "$", "fieldName", "...
Checks that an e-mail address is valid and non-empty. @param string $fieldName TS setup field name to mention in the warning, must not be empty @param bool $canUseFlexforms whether the value can also be set via flexforms (this will be mentioned in the error message) @param string $sheet flexforms sheet pointer, eg. "sDEF", will be ignored if $canUseFlexforms is set to FALSE @param bool $allowInternalAddresses whether internal addresses ("user@servername") are considered valid @param string $explanation a sentence explaining what that configuration value is needed for, must not be empty @return void
[ "Checks", "that", "an", "e", "-", "mail", "address", "is", "valid", "and", "non", "-", "empty", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ConfigCheck.php#L1881-L1901
train
oliverklee/ext-oelib
Classes/TranslatorRegistry.php
Tx_Oelib_TranslatorRegistry.setLanguageKeyFromConfiguration
private function setLanguageKeyFromConfiguration(\Tx_Oelib_Configuration $configuration) { if (!$configuration->hasString('language')) { return; } $this->languageKey = $configuration->getAsString('language'); if ($configuration->hasString('language_alt')) { $this->alternativeLanguageKey = $configuration->getAsString('language_alt'); } }
php
private function setLanguageKeyFromConfiguration(\Tx_Oelib_Configuration $configuration) { if (!$configuration->hasString('language')) { return; } $this->languageKey = $configuration->getAsString('language'); if ($configuration->hasString('language_alt')) { $this->alternativeLanguageKey = $configuration->getAsString('language_alt'); } }
[ "private", "function", "setLanguageKeyFromConfiguration", "(", "\\", "Tx_Oelib_Configuration", "$", "configuration", ")", "{", "if", "(", "!", "$", "configuration", "->", "hasString", "(", "'language'", ")", ")", "{", "return", ";", "}", "$", "this", "->", "la...
Reads the language key from a configuration and sets it as current language. Also sets the alternate language if one is configured. The language key is read from the "language" key and the alternate language is read from the language_alt key. @param \Tx_Oelib_Configuration $configuration the configuration to read @return void
[ "Reads", "the", "language", "key", "from", "a", "configuration", "and", "sets", "it", "as", "current", "language", ".", "Also", "sets", "the", "alternate", "language", "if", "one", "is", "configured", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/TranslatorRegistry.php#L81-L91
train
oliverklee/ext-oelib
Classes/TranslatorRegistry.php
Tx_Oelib_TranslatorRegistry.initializeBackEnd
private function initializeBackEnd() { $backEndUser = \Tx_Oelib_BackEndLoginManager::getInstance()->getLoggedInUser(\Tx_Oelib_Mapper_BackEndUser::class); $this->languageKey = $backEndUser->getLanguage(); }
php
private function initializeBackEnd() { $backEndUser = \Tx_Oelib_BackEndLoginManager::getInstance()->getLoggedInUser(\Tx_Oelib_Mapper_BackEndUser::class); $this->languageKey = $backEndUser->getLanguage(); }
[ "private", "function", "initializeBackEnd", "(", ")", "{", "$", "backEndUser", "=", "\\", "Tx_Oelib_BackEndLoginManager", "::", "getInstance", "(", ")", "->", "getLoggedInUser", "(", "\\", "Tx_Oelib_Mapper_BackEndUser", "::", "class", ")", ";", "$", "this", "->", ...
Initializes the TranslatorRegistry for the back end. @return void
[ "Initializes", "the", "TranslatorRegistry", "for", "the", "back", "end", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/TranslatorRegistry.php#L98-L103
train
oliverklee/ext-oelib
Classes/TranslatorRegistry.php
Tx_Oelib_TranslatorRegistry.getByExtensionName
private function getByExtensionName($extensionName) { if ($extensionName === '') { throw new \InvalidArgumentException('The parameter $extensionName must not be empty.', 1331489578); } if (!ExtensionManagementUtility::isLoaded($extensionName)) { throw new \BadMethodCallException( 'The extension with the name "' . $extensionName . '" is not loaded.', 1331489598 ); } if (!isset($this->translators[$extensionName])) { $localizedLabels = $this->getLocalizedLabelsFromFile($extensionName); // Overrides the localized labels with labels from TypoScript only // in the front end. if (($this->getFrontEndController() !== null) && isset($localizedLabels[$this->languageKey]) && is_array($localizedLabels[$this->languageKey]) ) { $labelsFromTyposcript = $this->getLocalizedLabelsFromTypoScript($extensionName); foreach ($labelsFromTyposcript as $labelKey => $labelFromTyposcript) { $localizedLabels[$this->languageKey][$labelKey][0]['target'] = $labelFromTyposcript; } } /** @var \Tx_Oelib_Translator $translator */ $translator = GeneralUtility::makeInstance( \Tx_Oelib_Translator::class, $this->languageKey, $this->alternativeLanguageKey, $localizedLabels ); $this->translators[$extensionName] = $translator; } return $this->translators[$extensionName]; }
php
private function getByExtensionName($extensionName) { if ($extensionName === '') { throw new \InvalidArgumentException('The parameter $extensionName must not be empty.', 1331489578); } if (!ExtensionManagementUtility::isLoaded($extensionName)) { throw new \BadMethodCallException( 'The extension with the name "' . $extensionName . '" is not loaded.', 1331489598 ); } if (!isset($this->translators[$extensionName])) { $localizedLabels = $this->getLocalizedLabelsFromFile($extensionName); // Overrides the localized labels with labels from TypoScript only // in the front end. if (($this->getFrontEndController() !== null) && isset($localizedLabels[$this->languageKey]) && is_array($localizedLabels[$this->languageKey]) ) { $labelsFromTyposcript = $this->getLocalizedLabelsFromTypoScript($extensionName); foreach ($labelsFromTyposcript as $labelKey => $labelFromTyposcript) { $localizedLabels[$this->languageKey][$labelKey][0]['target'] = $labelFromTyposcript; } } /** @var \Tx_Oelib_Translator $translator */ $translator = GeneralUtility::makeInstance( \Tx_Oelib_Translator::class, $this->languageKey, $this->alternativeLanguageKey, $localizedLabels ); $this->translators[$extensionName] = $translator; } return $this->translators[$extensionName]; }
[ "private", "function", "getByExtensionName", "(", "$", "extensionName", ")", "{", "if", "(", "$", "extensionName", "===", "''", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The parameter $extensionName must not be empty.'", ",", "1331489578", ")"...
Gets a Translator by its extension name. @param string $extensionName the extension name to get the Translator for, must not be empty, the corresponding extension must be loaded @return \Tx_Oelib_Translator the Translator for the specified extension name
[ "Gets", "a", "Translator", "by", "its", "extension", "name", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/TranslatorRegistry.php#L157-L197
train
oliverklee/ext-oelib
Classes/TranslatorRegistry.php
Tx_Oelib_TranslatorRegistry.getLocalizedLabelsFromFile
private function getLocalizedLabelsFromFile($extensionKey) { if ($extensionKey === '') { throw new \InvalidArgumentException('$extensionKey must not be empty.', 1331489618); } /** @var LocalizationFactory $languageFactory */ $languageFactory = GeneralUtility::makeInstance(LocalizationFactory::class); $languageFile = 'EXT:' . $extensionKey . '/' . self::LANGUAGE_FILE_PATH; $localizedLabels = $languageFactory->getParsedData($languageFile, $this->languageKey, 'utf-8', 0); if ($this->alternativeLanguageKey !== '') { $alternativeLabels = $languageFactory->getParsedData($languageFile, $this->languageKey, 'utf-8', 0); $localizedLabels = array_merge( $alternativeLabels, is_array($localizedLabels) ? $localizedLabels : [] ); } return $localizedLabels; }
php
private function getLocalizedLabelsFromFile($extensionKey) { if ($extensionKey === '') { throw new \InvalidArgumentException('$extensionKey must not be empty.', 1331489618); } /** @var LocalizationFactory $languageFactory */ $languageFactory = GeneralUtility::makeInstance(LocalizationFactory::class); $languageFile = 'EXT:' . $extensionKey . '/' . self::LANGUAGE_FILE_PATH; $localizedLabels = $languageFactory->getParsedData($languageFile, $this->languageKey, 'utf-8', 0); if ($this->alternativeLanguageKey !== '') { $alternativeLabels = $languageFactory->getParsedData($languageFile, $this->languageKey, 'utf-8', 0); $localizedLabels = array_merge( $alternativeLabels, is_array($localizedLabels) ? $localizedLabels : [] ); } return $localizedLabels; }
[ "private", "function", "getLocalizedLabelsFromFile", "(", "$", "extensionKey", ")", "{", "if", "(", "$", "extensionKey", "===", "''", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'$extensionKey must not be empty.'", ",", "1331489618", ")", ";", ...
Returns the localized labels from an extension's language file. @param string $extensionKey key of the extension to get the localized labels from, must not be empty, and the corresponding extension must be loaded @return string[] the localized labels from an extension's language file, will be empty if there are none
[ "Returns", "the", "localized", "labels", "from", "an", "extension", "s", "language", "file", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/TranslatorRegistry.php#L208-L228
train
oliverklee/ext-oelib
Classes/TranslatorRegistry.php
Tx_Oelib_TranslatorRegistry.getLocalizedLabelsFromTypoScript
private function getLocalizedLabelsFromTypoScript($extensionName) { if ($extensionName === '') { throw new \InvalidArgumentException('The parameter $extensionName must not be empty.', 1331489630); } $result = []; $namespace = 'plugin.tx_' . $extensionName . '._LOCAL_LANG.' . $this->languageKey; $configuration = \Tx_Oelib_ConfigurationRegistry::get($namespace); foreach ($configuration->getArrayKeys() as $key) { $result[$key] = $configuration->getAsString($key); } return $result; }
php
private function getLocalizedLabelsFromTypoScript($extensionName) { if ($extensionName === '') { throw new \InvalidArgumentException('The parameter $extensionName must not be empty.', 1331489630); } $result = []; $namespace = 'plugin.tx_' . $extensionName . '._LOCAL_LANG.' . $this->languageKey; $configuration = \Tx_Oelib_ConfigurationRegistry::get($namespace); foreach ($configuration->getArrayKeys() as $key) { $result[$key] = $configuration->getAsString($key); } return $result; }
[ "private", "function", "getLocalizedLabelsFromTypoScript", "(", "$", "extensionName", ")", "{", "if", "(", "$", "extensionName", "===", "''", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The parameter $extensionName must not be empty.'", ",", "1331...
Returns the localized labels from an extension's TypoScript setup. Returns only the labels set for the language stored in $this->languageKey @param string $extensionName the extension name to get the localized labels from TypoScript setup for, must not be empty, the corresponding extension must be loaded @return string[] the localized labels from the extension's TypoScript setup, will be empty if there are none
[ "Returns", "the", "localized", "labels", "from", "an", "extension", "s", "TypoScript", "setup", "." ]
f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1
https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/TranslatorRegistry.php#L241-L256
train
kenarkose/Tracker
src/Tracker.php
Tracker.getCurrent
public function getCurrent() { if (is_null($this->current)) { $siteView = $this->makeNewViewModel(); $this->current = $siteView; } return $this->current; }
php
public function getCurrent() { if (is_null($this->current)) { $siteView = $this->makeNewViewModel(); $this->current = $siteView; } return $this->current; }
[ "public", "function", "getCurrent", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "current", ")", ")", "{", "$", "siteView", "=", "$", "this", "->", "makeNewViewModel", "(", ")", ";", "$", "this", "->", "current", "=", "$", "siteView",...
Returns the current site view instance creates if it is not created already @return SiteView
[ "Returns", "the", "current", "site", "view", "instance", "creates", "if", "it", "is", "not", "created", "already" ]
8254ed559f9ec92c18a6090e97ad21ade2aeee40
https://github.com/kenarkose/Tracker/blob/8254ed559f9ec92c18a6090e97ad21ade2aeee40/src/Tracker.php#L96-L106
train
kenarkose/Tracker
src/Tracker.php
Tracker.collectVisitData
protected function collectVisitData() { $request = $this->request; $user = $request->user(); $userId = $user ? $user->getKey() : null; return [ 'user_id' => $userId, 'http_referer' => $request->server('HTTP_REFERER'), 'url' => $request->fullUrl(), 'request_method' => $request->method(), 'request_path' => $request->getPathInfo(), 'http_user_agent' => $request->server('HTTP_USER_AGENT'), 'http_accept_language' => $request->server('HTTP_ACCEPT_LANGUAGE'), 'locale' => $this->app->getLocale(), 'request_time' => $request->server('REQUEST_TIME') ]; }
php
protected function collectVisitData() { $request = $this->request; $user = $request->user(); $userId = $user ? $user->getKey() : null; return [ 'user_id' => $userId, 'http_referer' => $request->server('HTTP_REFERER'), 'url' => $request->fullUrl(), 'request_method' => $request->method(), 'request_path' => $request->getPathInfo(), 'http_user_agent' => $request->server('HTTP_USER_AGENT'), 'http_accept_language' => $request->server('HTTP_ACCEPT_LANGUAGE'), 'locale' => $this->app->getLocale(), 'request_time' => $request->server('REQUEST_TIME') ]; }
[ "protected", "function", "collectVisitData", "(", ")", "{", "$", "request", "=", "$", "this", "->", "request", ";", "$", "user", "=", "$", "request", "->", "user", "(", ")", ";", "$", "userId", "=", "$", "user", "?", "$", "user", "->", "getKey", "(...
Collects the data for the site view model @return array
[ "Collects", "the", "data", "for", "the", "site", "view", "model" ]
8254ed559f9ec92c18a6090e97ad21ade2aeee40
https://github.com/kenarkose/Tracker/blob/8254ed559f9ec92c18a6090e97ad21ade2aeee40/src/Tracker.php#L113-L131
train
kenarkose/Tracker
src/Tracker.php
Tracker.saveCurrent
public function saveCurrent() { if ($this->saveEnabled() && $this->isViewValid() && $this->isViewUnique()) { $success = $this->saveCurrentModel(); // Keep on only if the model save has succeeded if ($success) { $this->storeCurrentHash(); $this->saveTrackables( $this->getCurrent(), $success ); } return $success; } return false; }
php
public function saveCurrent() { if ($this->saveEnabled() && $this->isViewValid() && $this->isViewUnique()) { $success = $this->saveCurrentModel(); // Keep on only if the model save has succeeded if ($success) { $this->storeCurrentHash(); $this->saveTrackables( $this->getCurrent(), $success ); } return $success; } return false; }
[ "public", "function", "saveCurrent", "(", ")", "{", "if", "(", "$", "this", "->", "saveEnabled", "(", ")", "&&", "$", "this", "->", "isViewValid", "(", ")", "&&", "$", "this", "->", "isViewUnique", "(", ")", ")", "{", "$", "success", "=", "$", "thi...
Persists the current site view to database @return bool
[ "Persists", "the", "current", "site", "view", "to", "database" ]
8254ed559f9ec92c18a6090e97ad21ade2aeee40
https://github.com/kenarkose/Tracker/blob/8254ed559f9ec92c18a6090e97ad21ade2aeee40/src/Tracker.php#L138-L159
train
kenarkose/Tracker
src/Tracker.php
Tracker.isViewUnique
public function isViewUnique() { $hash = $this->getCurrentHash(); if (in_array($hash, $this->session->get('tracker.views', []))) { return false; } return true; }
php
public function isViewUnique() { $hash = $this->getCurrentHash(); if (in_array($hash, $this->session->get('tracker.views', []))) { return false; } return true; }
[ "public", "function", "isViewUnique", "(", ")", "{", "$", "hash", "=", "$", "this", "->", "getCurrentHash", "(", ")", ";", "if", "(", "in_array", "(", "$", "hash", ",", "$", "this", "->", "session", "->", "get", "(", "'tracker.views'", ",", "[", "]",...
Checks if the current request is unique @return bool
[ "Checks", "if", "the", "current", "request", "is", "unique" ]
8254ed559f9ec92c18a6090e97ad21ade2aeee40
https://github.com/kenarkose/Tracker/blob/8254ed559f9ec92c18a6090e97ad21ade2aeee40/src/Tracker.php#L236-L246
train
kenarkose/Tracker
src/Tracker.php
Tracker.getCurrentHash
protected function getCurrentHash() { if ($this->currentHash === null) { $this->currentHash = md5( $this->request->fullUrl() . $this->request->method() . $this->request->getClientIp() ); } return $this->currentHash; }
php
protected function getCurrentHash() { if ($this->currentHash === null) { $this->currentHash = md5( $this->request->fullUrl() . $this->request->method() . $this->request->getClientIp() ); } return $this->currentHash; }
[ "protected", "function", "getCurrentHash", "(", ")", "{", "if", "(", "$", "this", "->", "currentHash", "===", "null", ")", "{", "$", "this", "->", "currentHash", "=", "md5", "(", "$", "this", "->", "request", "->", "fullUrl", "(", ")", ".", "$", "thi...
Gets the view hash @return string
[ "Gets", "the", "view", "hash" ]
8254ed559f9ec92c18a6090e97ad21ade2aeee40
https://github.com/kenarkose/Tracker/blob/8254ed559f9ec92c18a6090e97ad21ade2aeee40/src/Tracker.php#L253-L265
train
kenarkose/Tracker
src/Tracker.php
Tracker.saveCurrentModel
protected function saveCurrentModel() { $current = $this->getCurrent(); $current->setAttribute('app_time', $this->getCurrentRuntime()); $current->setAttribute('memory', memory_get_peak_usage(true)); return $current->save(); }
php
protected function saveCurrentModel() { $current = $this->getCurrent(); $current->setAttribute('app_time', $this->getCurrentRuntime()); $current->setAttribute('memory', memory_get_peak_usage(true)); return $current->save(); }
[ "protected", "function", "saveCurrentModel", "(", ")", "{", "$", "current", "=", "$", "this", "->", "getCurrent", "(", ")", ";", "$", "current", "->", "setAttribute", "(", "'app_time'", ",", "$", "this", "->", "getCurrentRuntime", "(", ")", ")", ";", "$"...
Saves the current model @return bool
[ "Saves", "the", "current", "model" ]
8254ed559f9ec92c18a6090e97ad21ade2aeee40
https://github.com/kenarkose/Tracker/blob/8254ed559f9ec92c18a6090e97ad21ade2aeee40/src/Tracker.php#L272-L279
train
kenarkose/Tracker
src/Tracker.php
Tracker.saveTrackables
protected function saveTrackables($view, $success) { foreach ($this->trackables as $trackable) { $trackable->attachTrackerView($view); } return $success; }
php
protected function saveTrackables($view, $success) { foreach ($this->trackables as $trackable) { $trackable->attachTrackerView($view); } return $success; }
[ "protected", "function", "saveTrackables", "(", "$", "view", ",", "$", "success", ")", "{", "foreach", "(", "$", "this", "->", "trackables", "as", "$", "trackable", ")", "{", "$", "trackable", "->", "attachTrackerView", "(", "$", "view", ")", ";", "}", ...
Saves the trackables @param $view @param bool $success @return bool
[ "Saves", "the", "trackables" ]
8254ed559f9ec92c18a6090e97ad21ade2aeee40
https://github.com/kenarkose/Tracker/blob/8254ed559f9ec92c18a6090e97ad21ade2aeee40/src/Tracker.php#L306-L314
train
kenarkose/Tracker
src/Tracker.php
Tracker.flushOlderThanOrBetween
public function flushOlderThanOrBetween($until = null, $from = null) { $modelName = $this->getViewModelName(); return $modelName::olderThanOrBetween($until, $from)->delete(); }
php
public function flushOlderThanOrBetween($until = null, $from = null) { $modelName = $this->getViewModelName(); return $modelName::olderThanOrBetween($until, $from)->delete(); }
[ "public", "function", "flushOlderThanOrBetween", "(", "$", "until", "=", "null", ",", "$", "from", "=", "null", ")", "{", "$", "modelName", "=", "$", "this", "->", "getViewModelName", "(", ")", ";", "return", "$", "modelName", "::", "olderThanOrBetween", "...
Flush older than or between SiteViews @param timestamp $until @param timestamp $from @return bool
[ "Flush", "older", "than", "or", "between", "SiteViews" ]
8254ed559f9ec92c18a6090e97ad21ade2aeee40
https://github.com/kenarkose/Tracker/blob/8254ed559f9ec92c18a6090e97ad21ade2aeee40/src/Tracker.php#L354-L359
train