id
int32
0
241k
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
43,700
lovata/oc-toolbox-plugin
models/CommonProperty.php
CommonProperty.getDefaultConfigSettings
protected function getDefaultConfigSettings() : array { $arResult = [ 'tab' => 'lovata.toolbox::lang.tab.properties', 'span' => 'left', 'label' => $this->name, 'comment' => $this->description, ]; //Get property tab $sTabName = $this->getSettingValue('tab'); if (!empty($sTabName)) { $arResult['tab'] = $sTabName; } return $arResult; }
php
protected function getDefaultConfigSettings() : array { $arResult = [ 'tab' => 'lovata.toolbox::lang.tab.properties', 'span' => 'left', 'label' => $this->name, 'comment' => $this->description, ]; //Get property tab $sTabName = $this->getSettingValue('tab'); if (!empty($sTabName)) { $arResult['tab'] = $sTabName; } return $arResult; }
[ "protected", "function", "getDefaultConfigSettings", "(", ")", ":", "array", "{", "$", "arResult", "=", "[", "'tab'", "=>", "'lovata.toolbox::lang.tab.properties'", ",", "'span'", "=>", "'left'", ",", "'label'", "=>", "$", "this", "->", "name", ",", "'comment'",...
Get default config field settings @return array
[ "Get", "default", "config", "field", "settings" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/models/CommonProperty.php#L466-L482
43,701
lovata/oc-toolbox-plugin
models/CommonProperty.php
CommonProperty.getSettingValue
protected function getSettingValue($sKey) { $arSettings = $this->settings; if (empty($sKey) || empty($arSettings) || !isset($arSettings[$sKey])) { return null; } return $arSettings[$sKey]; }
php
protected function getSettingValue($sKey) { $arSettings = $this->settings; if (empty($sKey) || empty($arSettings) || !isset($arSettings[$sKey])) { return null; } return $arSettings[$sKey]; }
[ "protected", "function", "getSettingValue", "(", "$", "sKey", ")", "{", "$", "arSettings", "=", "$", "this", "->", "settings", ";", "if", "(", "empty", "(", "$", "sKey", ")", "||", "empty", "(", "$", "arSettings", ")", "||", "!", "isset", "(", "$", ...
Get property settings value @param string $sKey @return mixed|null
[ "Get", "property", "settings", "value" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/models/CommonProperty.php#L488-L496
43,702
lovata/oc-toolbox-plugin
classes/store/AbstractListStore.php
AbstractListStore.addToStoreList
protected function addToStoreList($sFieldName, $sClassName) { if (empty($sFieldName) || empty($sClassName) || !class_exists($sClassName)) { return; } $this->arStoreList[$sFieldName] = $sClassName::instance(); }
php
protected function addToStoreList($sFieldName, $sClassName) { if (empty($sFieldName) || empty($sClassName) || !class_exists($sClassName)) { return; } $this->arStoreList[$sFieldName] = $sClassName::instance(); }
[ "protected", "function", "addToStoreList", "(", "$", "sFieldName", ",", "$", "sClassName", ")", "{", "if", "(", "empty", "(", "$", "sFieldName", ")", "||", "empty", "(", "$", "sClassName", ")", "||", "!", "class_exists", "(", "$", "sClassName", ")", ")",...
Add store class to list and get store object @param string $sFieldName @param string $sClassName
[ "Add", "store", "class", "to", "list", "and", "get", "store", "object" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/store/AbstractListStore.php#L35-L42
43,703
lovata/oc-toolbox-plugin
classes/helper/AbstractImportModel.php
AbstractImportModel.deactivateElements
public function deactivateElements() { if (!$this->bDeactivate) { return; } $arDeactivateIDList = array_diff((array) $this->arExistIDList, (array) $this->arProcessedIDList); if (empty($arDeactivateIDList)) { return; } //Get element list $sModelClass = $this->getModelClass(); $obElementList = $sModelClass::whereIn('external_id', $arDeactivateIDList)->get(); foreach ($obElementList as $obElement) { $obElement->active = false; $obElement->save(); } }
php
public function deactivateElements() { if (!$this->bDeactivate) { return; } $arDeactivateIDList = array_diff((array) $this->arExistIDList, (array) $this->arProcessedIDList); if (empty($arDeactivateIDList)) { return; } //Get element list $sModelClass = $this->getModelClass(); $obElementList = $sModelClass::whereIn('external_id', $arDeactivateIDList)->get(); foreach ($obElementList as $obElement) { $obElement->active = false; $obElement->save(); } }
[ "public", "function", "deactivateElements", "(", ")", "{", "if", "(", "!", "$", "this", "->", "bDeactivate", ")", "{", "return", ";", "}", "$", "arDeactivateIDList", "=", "array_diff", "(", "(", "array", ")", "$", "this", "->", "arExistIDList", ",", "(",...
Deactivate active elements
[ "Deactivate", "active", "elements" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/helper/AbstractImportModel.php#L99-L117
43,704
lovata/oc-toolbox-plugin
classes/helper/AbstractImportModel.php
AbstractImportModel.run
protected function run() { $this->prepareImportData(); $this->fireBeforeImportEvent(); $this->findByExternalID(); if (!empty($this->obModel)) { $this->updateItem(); } else { $this->createItem(); } if (empty($this->obModel)) { return; } $this->processModelObject(); Event::fire(self::EVENT_AFTER_IMPORT, [$this->obModel, $this->arImportData]); }
php
protected function run() { $this->prepareImportData(); $this->fireBeforeImportEvent(); $this->findByExternalID(); if (!empty($this->obModel)) { $this->updateItem(); } else { $this->createItem(); } if (empty($this->obModel)) { return; } $this->processModelObject(); Event::fire(self::EVENT_AFTER_IMPORT, [$this->obModel, $this->arImportData]); }
[ "protected", "function", "run", "(", ")", "{", "$", "this", "->", "prepareImportData", "(", ")", ";", "$", "this", "->", "fireBeforeImportEvent", "(", ")", ";", "$", "this", "->", "findByExternalID", "(", ")", ";", "if", "(", "!", "empty", "(", "$", ...
Run import item
[ "Run", "import", "item" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/helper/AbstractImportModel.php#L146-L164
43,705
lovata/oc-toolbox-plugin
classes/helper/AbstractImportModel.php
AbstractImportModel.findByExternalID
protected function findByExternalID() { $sModelClass = $this->getModelClass(); if ($this->bWithTrashed) { $this->obModel = $sModelClass::withTrashed()->getByExternalID($this->sExternalID)->first(); } else { $this->obModel = $sModelClass::getByExternalID($this->sExternalID)->first(); } }
php
protected function findByExternalID() { $sModelClass = $this->getModelClass(); if ($this->bWithTrashed) { $this->obModel = $sModelClass::withTrashed()->getByExternalID($this->sExternalID)->first(); } else { $this->obModel = $sModelClass::getByExternalID($this->sExternalID)->first(); } }
[ "protected", "function", "findByExternalID", "(", ")", "{", "$", "sModelClass", "=", "$", "this", "->", "getModelClass", "(", ")", ";", "if", "(", "$", "this", "->", "bWithTrashed", ")", "{", "$", "this", "->", "obModel", "=", "$", "sModelClass", "::", ...
Find item by external ID
[ "Find", "item", "by", "external", "ID" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/helper/AbstractImportModel.php#L208-L216
43,706
lovata/oc-toolbox-plugin
classes/helper/AbstractImportModel.php
AbstractImportModel.fireBeforeImportEvent
protected function fireBeforeImportEvent() { $arEventData = [$this->getModelClass(), $this->arImportData]; $arEventData = Event::fire(self::EVENT_BEFORE_IMPORT, $arEventData); if (empty($arEventData)) { return; } foreach ($arEventData as $arModelData) { if (empty($arModelData)) { continue; } foreach ($arModelData as $sKey => $sValue) { $this->arImportData[$sKey] = $sValue; } } }
php
protected function fireBeforeImportEvent() { $arEventData = [$this->getModelClass(), $this->arImportData]; $arEventData = Event::fire(self::EVENT_BEFORE_IMPORT, $arEventData); if (empty($arEventData)) { return; } foreach ($arEventData as $arModelData) { if (empty($arModelData)) { continue; } foreach ($arModelData as $sKey => $sValue) { $this->arImportData[$sKey] = $sValue; } } }
[ "protected", "function", "fireBeforeImportEvent", "(", ")", "{", "$", "arEventData", "=", "[", "$", "this", "->", "getModelClass", "(", ")", ",", "$", "this", "->", "arImportData", "]", ";", "$", "arEventData", "=", "Event", "::", "fire", "(", "self", ":...
Fire beforeImport event and update import data array
[ "Fire", "beforeImport", "event", "and", "update", "import", "data", "array" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/helper/AbstractImportModel.php#L246-L264
43,707
lovata/oc-toolbox-plugin
classes/helper/AbstractImportModel.php
AbstractImportModel.initImageList
protected function initImageList() { if (!array_key_exists('images', $this->arImportData)) { $this->bNeedUpdateImageList = false; return; } $this->bNeedUpdateImageList = true; $this->arImageList = explode(',', array_get($this->arImportData, 'images')); array_forget($this->arImportData, 'images'); if (empty($this->arImageList)) { return; } foreach ($this->arImageList as $iKey => $sPath) { $sPath = trim($sPath); if (empty($sPath)) { unset($this->arImageList[$iKey]); continue; } $sFilePath = storage_path($sPath); if (!file_exists($sFilePath)) { unset($this->arImageList[$iKey]); } else { $this->arImageList[$iKey] = $sFilePath; } } }
php
protected function initImageList() { if (!array_key_exists('images', $this->arImportData)) { $this->bNeedUpdateImageList = false; return; } $this->bNeedUpdateImageList = true; $this->arImageList = explode(',', array_get($this->arImportData, 'images')); array_forget($this->arImportData, 'images'); if (empty($this->arImageList)) { return; } foreach ($this->arImageList as $iKey => $sPath) { $sPath = trim($sPath); if (empty($sPath)) { unset($this->arImageList[$iKey]); continue; } $sFilePath = storage_path($sPath); if (!file_exists($sFilePath)) { unset($this->arImageList[$iKey]); } else { $this->arImageList[$iKey] = $sFilePath; } } }
[ "protected", "function", "initImageList", "(", ")", "{", "if", "(", "!", "array_key_exists", "(", "'images'", ",", "$", "this", "->", "arImportData", ")", ")", "{", "$", "this", "->", "bNeedUpdateImageList", "=", "false", ";", "return", ";", "}", "$", "t...
Init image list
[ "Init", "image", "list" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/helper/AbstractImportModel.php#L269-L298
43,708
lovata/oc-toolbox-plugin
classes/helper/AbstractImportModel.php
AbstractImportModel.importImageList
protected function importImageList() { if (!$this->bNeedUpdateImageList) { return; } if (empty($this->arImageList)) { $this->removeAllImages(); return; } //Update old images $obImageList = $this->obModel->images; if (!$obImageList->isEmpty()) { /** @var File $obImage */ foreach ($obImageList as $obImage) { $sFilePath = array_shift($this->arImageList); //Check image if (!empty($sFilePath) && (!file_exists($obImage->getLocalPath()) || md5_file($sFilePath) != md5_file($obImage->getLocalPath()))) { $obImage->deleteThumbs(); $obImage->fromFile($sFilePath); $obImage->save(); } elseif (empty($sFilePath)) { $obImage->deleteThumbs(); $obImage->delete(); } } } //Create new images if (!empty($this->arImageList)) { foreach ($this->arImageList as $sFilePath) { $obImage = new File(); $obImage->fromFile($sFilePath); $this->obModel->images()->add($obImage); } } }
php
protected function importImageList() { if (!$this->bNeedUpdateImageList) { return; } if (empty($this->arImageList)) { $this->removeAllImages(); return; } //Update old images $obImageList = $this->obModel->images; if (!$obImageList->isEmpty()) { /** @var File $obImage */ foreach ($obImageList as $obImage) { $sFilePath = array_shift($this->arImageList); //Check image if (!empty($sFilePath) && (!file_exists($obImage->getLocalPath()) || md5_file($sFilePath) != md5_file($obImage->getLocalPath()))) { $obImage->deleteThumbs(); $obImage->fromFile($sFilePath); $obImage->save(); } elseif (empty($sFilePath)) { $obImage->deleteThumbs(); $obImage->delete(); } } } //Create new images if (!empty($this->arImageList)) { foreach ($this->arImageList as $sFilePath) { $obImage = new File(); $obImage->fromFile($sFilePath); $this->obModel->images()->add($obImage); } } }
[ "protected", "function", "importImageList", "(", ")", "{", "if", "(", "!", "$", "this", "->", "bNeedUpdateImageList", ")", "{", "return", ";", "}", "if", "(", "empty", "(", "$", "this", "->", "arImageList", ")", ")", "{", "$", "this", "->", "removeAllI...
Import obProductModel images
[ "Import", "obProductModel", "images" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/helper/AbstractImportModel.php#L303-L343
43,709
lovata/oc-toolbox-plugin
classes/helper/AbstractImportModel.php
AbstractImportModel.initPreviewImage
protected function initPreviewImage() { if (!array_key_exists('preview_image', $this->arImportData)) { $this->bNeedUpdatePreviewImage = false; return; } $this->bNeedUpdatePreviewImage = true; $this->sPreviewImage = trim(array_get($this->arImportData, 'preview_image')); if (empty($this->sPreviewImage)) { return; } $this->sPreviewImage = storage_path($this->sPreviewImage); if (!file_exists($this->sPreviewImage)) { $this->sPreviewImage = null; } }
php
protected function initPreviewImage() { if (!array_key_exists('preview_image', $this->arImportData)) { $this->bNeedUpdatePreviewImage = false; return; } $this->bNeedUpdatePreviewImage = true; $this->sPreviewImage = trim(array_get($this->arImportData, 'preview_image')); if (empty($this->sPreviewImage)) { return; } $this->sPreviewImage = storage_path($this->sPreviewImage); if (!file_exists($this->sPreviewImage)) { $this->sPreviewImage = null; } }
[ "protected", "function", "initPreviewImage", "(", ")", "{", "if", "(", "!", "array_key_exists", "(", "'preview_image'", ",", "$", "this", "->", "arImportData", ")", ")", "{", "$", "this", "->", "bNeedUpdatePreviewImage", "=", "false", ";", "return", ";", "}"...
Init preview image path
[ "Init", "preview", "image", "path" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/helper/AbstractImportModel.php#L348-L366
43,710
lovata/oc-toolbox-plugin
classes/helper/AbstractImportModel.php
AbstractImportModel.importPreviewImage
protected function importPreviewImage() { if (!$this->bNeedUpdatePreviewImage) { return; } $obPreviewImage = $this->obModel->preview_image; if (empty($obPreviewImage) && empty($this->sPreviewImage)) { return; } if (empty($obPreviewImage) && !empty($this->sPreviewImage)) { //Create new preview $obPreviewImage = new File(); $obPreviewImage->fromFile($this->sPreviewImage); $this->obModel->preview_image()->add($obPreviewImage); return; } if (!file_exists($obPreviewImage->getLocalPath())) { $obPreviewImage->fromFile($this->sPreviewImage); $obPreviewImage->save(); } elseif (!empty($this->sPreviewImage) && file_exists($obPreviewImage->getLocalPath()) && md5_file($this->sPreviewImage) != md5_file($obPreviewImage->getLocalPath())) { //Update preview image $obPreviewImage->deleteThumbs(); $obPreviewImage->fromFile($this->sPreviewImage); $obPreviewImage->save(); } elseif (!empty($obPreviewImage) && empty($this->sPreviewImage)) { $obPreviewImage->deleteThumbs(); $obPreviewImage->delete(); } }
php
protected function importPreviewImage() { if (!$this->bNeedUpdatePreviewImage) { return; } $obPreviewImage = $this->obModel->preview_image; if (empty($obPreviewImage) && empty($this->sPreviewImage)) { return; } if (empty($obPreviewImage) && !empty($this->sPreviewImage)) { //Create new preview $obPreviewImage = new File(); $obPreviewImage->fromFile($this->sPreviewImage); $this->obModel->preview_image()->add($obPreviewImage); return; } if (!file_exists($obPreviewImage->getLocalPath())) { $obPreviewImage->fromFile($this->sPreviewImage); $obPreviewImage->save(); } elseif (!empty($this->sPreviewImage) && file_exists($obPreviewImage->getLocalPath()) && md5_file($this->sPreviewImage) != md5_file($obPreviewImage->getLocalPath())) { //Update preview image $obPreviewImage->deleteThumbs(); $obPreviewImage->fromFile($this->sPreviewImage); $obPreviewImage->save(); } elseif (!empty($obPreviewImage) && empty($this->sPreviewImage)) { $obPreviewImage->deleteThumbs(); $obPreviewImage->delete(); } }
[ "protected", "function", "importPreviewImage", "(", ")", "{", "if", "(", "!", "$", "this", "->", "bNeedUpdatePreviewImage", ")", "{", "return", ";", "}", "$", "obPreviewImage", "=", "$", "this", "->", "obModel", "->", "preview_image", ";", "if", "(", "empt...
Import preview image
[ "Import", "preview", "image" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/helper/AbstractImportModel.php#L371-L403
43,711
lovata/oc-toolbox-plugin
classes/helper/AbstractImportModel.php
AbstractImportModel.removeAllImages
protected function removeAllImages() { //Delete old images $obImageList = $this->obModel->images; if ($obImageList->isEmpty()) { return; } /** @var \System\Models\File $obFile */ foreach ($obImageList as $obFile) { $obFile->deleteThumbs(); $obFile->delete(); } }
php
protected function removeAllImages() { //Delete old images $obImageList = $this->obModel->images; if ($obImageList->isEmpty()) { return; } /** @var \System\Models\File $obFile */ foreach ($obImageList as $obFile) { $obFile->deleteThumbs(); $obFile->delete(); } }
[ "protected", "function", "removeAllImages", "(", ")", "{", "//Delete old images", "$", "obImageList", "=", "$", "this", "->", "obModel", "->", "images", ";", "if", "(", "$", "obImageList", "->", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "/** @var ...
Remove all images
[ "Remove", "all", "images" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/helper/AbstractImportModel.php#L408-L421
43,712
lovata/oc-toolbox-plugin
classes/helper/AbstractImportModel.php
AbstractImportModel.setActiveField
protected function setActiveField() { $bActive = array_get($this->arImportData, 'active'); if ($bActive === null) { $this->arImportData['active'] = true; } else { $this->arImportData['active'] = (bool) $bActive; } }
php
protected function setActiveField() { $bActive = array_get($this->arImportData, 'active'); if ($bActive === null) { $this->arImportData['active'] = true; } else { $this->arImportData['active'] = (bool) $bActive; } }
[ "protected", "function", "setActiveField", "(", ")", "{", "$", "bActive", "=", "array_get", "(", "$", "this", "->", "arImportData", ",", "'active'", ")", ";", "if", "(", "$", "bActive", "===", "null", ")", "{", "$", "this", "->", "arImportData", "[", "...
Set active filed value, if active value is not null
[ "Set", "active", "filed", "value", "if", "active", "value", "is", "not", "null" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/helper/AbstractImportModel.php#L426-L434
43,713
lovata/oc-toolbox-plugin
classes/helper/AbstractImportModel.php
AbstractImportModel.createJob
protected function createJob() { $sQueueName = Settings::getValue('import_queue_name'); $arQueueData = [ 'class' => static::class, 'data' => $this->arImportData, ]; if (empty($sQueueName)) { Queue::push(ImportItemQueue::class, $arQueueData); } else { Queue::pushOn($sQueueName, ImportItemQueue::class, $arQueueData); } $this->setResultMethod(); }
php
protected function createJob() { $sQueueName = Settings::getValue('import_queue_name'); $arQueueData = [ 'class' => static::class, 'data' => $this->arImportData, ]; if (empty($sQueueName)) { Queue::push(ImportItemQueue::class, $arQueueData); } else { Queue::pushOn($sQueueName, ImportItemQueue::class, $arQueueData); } $this->setResultMethod(); }
[ "protected", "function", "createJob", "(", ")", "{", "$", "sQueueName", "=", "Settings", "::", "getValue", "(", "'import_queue_name'", ")", ";", "$", "arQueueData", "=", "[", "'class'", "=>", "static", "::", "class", ",", "'data'", "=>", "$", "this", "->",...
Create queue job with import single item @throws \Throwable
[ "Create", "queue", "job", "with", "import", "single", "item" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/helper/AbstractImportModel.php#L440-L456
43,714
lovata/oc-toolbox-plugin
traits/helpers/TraitValidationHelper.php
TraitValidationHelper.processValidationError
protected function processValidationError(&$obException) { $arFiledList = array_keys($obException->getFields()); Result::setFalse(['field' => array_shift($arFiledList)]) ->setMessage($obException->getMessage()) ->setCode($obException->getCode()); }
php
protected function processValidationError(&$obException) { $arFiledList = array_keys($obException->getFields()); Result::setFalse(['field' => array_shift($arFiledList)]) ->setMessage($obException->getMessage()) ->setCode($obException->getCode()); }
[ "protected", "function", "processValidationError", "(", "&", "$", "obException", ")", "{", "$", "arFiledList", "=", "array_keys", "(", "$", "obException", "->", "getFields", "(", ")", ")", ";", "Result", "::", "setFalse", "(", "[", "'field'", "=>", "array_sh...
Process validation error data @param \October\Rain\Database\ModelException $obException
[ "Process", "validation", "error", "data" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/traits/helpers/TraitValidationHelper.php#L16-L23
43,715
lovata/oc-toolbox-plugin
traits/helpers/TraitInitActiveLang.php
TraitInitActiveLang.getActiveLangList
protected function getActiveLangList() { if (self::$arActiveLangList !== null || !PluginManager::instance()->hasPlugin('RainLab.Translate')) { return self::$arActiveLangList; } self::$arActiveLangList = \RainLab\Translate\Models\Locale::isEnabled()->lists('code'); if (empty(self::$arActiveLangList)) { return self::$arActiveLangList; } //Remove default lang from list foreach (self::$arActiveLangList as $iKey => $sLangCode) { if ($sLangCode == self::$sDefaultLang) { unset(self::$arActiveLangList[$iKey]); break; } } return self::$arActiveLangList; }
php
protected function getActiveLangList() { if (self::$arActiveLangList !== null || !PluginManager::instance()->hasPlugin('RainLab.Translate')) { return self::$arActiveLangList; } self::$arActiveLangList = \RainLab\Translate\Models\Locale::isEnabled()->lists('code'); if (empty(self::$arActiveLangList)) { return self::$arActiveLangList; } //Remove default lang from list foreach (self::$arActiveLangList as $iKey => $sLangCode) { if ($sLangCode == self::$sDefaultLang) { unset(self::$arActiveLangList[$iKey]); break; } } return self::$arActiveLangList; }
[ "protected", "function", "getActiveLangList", "(", ")", "{", "if", "(", "self", "::", "$", "arActiveLangList", "!==", "null", "||", "!", "PluginManager", "::", "instance", "(", ")", "->", "hasPlugin", "(", "'RainLab.Translate'", ")", ")", "{", "return", "sel...
Get and save active lang list
[ "Get", "and", "save", "active", "lang", "list" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/traits/helpers/TraitInitActiveLang.php#L27-L47
43,716
lovata/oc-toolbox-plugin
traits/helpers/TraitInitActiveLang.php
TraitInitActiveLang.initActiveLang
protected function initActiveLang() { if (self::$bLangInit || !PluginManager::instance()->hasPlugin('RainLab.Translate')) { return; } self::$bLangInit = true; $obTranslate = \RainLab\Translate\Classes\Translator::instance(); self::$sDefaultLang = $obTranslate->getDefaultLocale(); $sActiveLangCode = $obTranslate->getLocale(); if (empty($sActiveLangCode) || $obTranslate->getDefaultLocale() == $sActiveLangCode) { return; } self::$sActiveLang = $sActiveLangCode; }
php
protected function initActiveLang() { if (self::$bLangInit || !PluginManager::instance()->hasPlugin('RainLab.Translate')) { return; } self::$bLangInit = true; $obTranslate = \RainLab\Translate\Classes\Translator::instance(); self::$sDefaultLang = $obTranslate->getDefaultLocale(); $sActiveLangCode = $obTranslate->getLocale(); if (empty($sActiveLangCode) || $obTranslate->getDefaultLocale() == $sActiveLangCode) { return; } self::$sActiveLang = $sActiveLangCode; }
[ "protected", "function", "initActiveLang", "(", ")", "{", "if", "(", "self", "::", "$", "bLangInit", "||", "!", "PluginManager", "::", "instance", "(", ")", "->", "hasPlugin", "(", "'RainLab.Translate'", ")", ")", "{", "return", ";", "}", "self", "::", "...
Get and save active lang from Translate plugin
[ "Get", "and", "save", "active", "lang", "from", "Translate", "plugin" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/traits/helpers/TraitInitActiveLang.php#L52-L69
43,717
lovata/oc-toolbox-plugin
traits/models/SetPropertyAttributeTrait.php
SetPropertyAttributeTrait.setPropertyAttribute
protected function setPropertyAttribute($arValue) { if (is_string($arValue)) { $arValue = $this->fromJson($arValue); } if (empty($arValue) || !is_array($arValue)) { return; } $arPropertyList = $this->property; if (empty($arPropertyList)) { $arPropertyList = []; } foreach ($arValue as $sKey => $sValue) { $arPropertyList[$sKey] = $sValue; } $this->attributes['property'] = $this->asJson($arPropertyList); }
php
protected function setPropertyAttribute($arValue) { if (is_string($arValue)) { $arValue = $this->fromJson($arValue); } if (empty($arValue) || !is_array($arValue)) { return; } $arPropertyList = $this->property; if (empty($arPropertyList)) { $arPropertyList = []; } foreach ($arValue as $sKey => $sValue) { $arPropertyList[$sKey] = $sValue; } $this->attributes['property'] = $this->asJson($arPropertyList); }
[ "protected", "function", "setPropertyAttribute", "(", "$", "arValue", ")", "{", "if", "(", "is_string", "(", "$", "arValue", ")", ")", "{", "$", "arValue", "=", "$", "this", "->", "fromJson", "(", "$", "arValue", ")", ";", "}", "if", "(", "empty", "(...
Set property attribute, nerge new values with old values @param array $arValue
[ "Set", "property", "attribute", "nerge", "new", "values", "with", "old", "values" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/traits/models/SetPropertyAttributeTrait.php#L15-L35
43,718
lovata/oc-toolbox-plugin
classes/component/SortingElementList.php
SortingElementList.setActiveSorting
protected function setActiveSorting() { $this->sSorting = Input::get('sort'); if (empty($this->sSorting)) { $this->sSorting = $this->property('sorting'); } }
php
protected function setActiveSorting() { $this->sSorting = Input::get('sort'); if (empty($this->sSorting)) { $this->sSorting = $this->property('sorting'); } }
[ "protected", "function", "setActiveSorting", "(", ")", "{", "$", "this", "->", "sSorting", "=", "Input", "::", "get", "(", "'sort'", ")", ";", "if", "(", "empty", "(", "$", "this", "->", "sSorting", ")", ")", "{", "$", "this", "->", "sSorting", "=", ...
Set active sorting
[ "Set", "active", "sorting" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/component/SortingElementList.php#L37-L43
43,719
lovata/oc-toolbox-plugin
classes/collection/ElementCollection.php
ElementCollection.make
public static function make($arElementIDList = []) { /** @var ElementCollection $obCollection */ $obCollection = app()->make(static::class); if (!empty($arElementIDList) && is_array($arElementIDList)) { $obCollection->arElementIDList = $arElementIDList; } return $obCollection->returnThis(); }
php
public static function make($arElementIDList = []) { /** @var ElementCollection $obCollection */ $obCollection = app()->make(static::class); if (!empty($arElementIDList) && is_array($arElementIDList)) { $obCollection->arElementIDList = $arElementIDList; } return $obCollection->returnThis(); }
[ "public", "static", "function", "make", "(", "$", "arElementIDList", "=", "[", "]", ")", "{", "/** @var ElementCollection $obCollection */", "$", "obCollection", "=", "app", "(", ")", "->", "make", "(", "static", "::", "class", ")", ";", "if", "(", "!", "e...
Make new list store @see \Lovata\Toolbox\Tests\Unit\CollectionTest::testMakeMethod() @link https://github.com/lovata/oc-toolbox-plugin/wiki/ElementCollection#makearelementidlist-- @param array $arElementIDList - element ID list @return $this
[ "Make", "new", "list", "store" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/collection/ElementCollection.php#L41-L51
43,720
lovata/oc-toolbox-plugin
classes/collection/ElementCollection.php
ElementCollection.has
public function has($iElementID) { if (empty($iElementID) || $this->isEmpty()) { return false; } return in_array($iElementID, (array) $this->arElementIDList); }
php
public function has($iElementID) { if (empty($iElementID) || $this->isEmpty()) { return false; } return in_array($iElementID, (array) $this->arElementIDList); }
[ "public", "function", "has", "(", "$", "iElementID", ")", "{", "if", "(", "empty", "(", "$", "iElementID", ")", "||", "$", "this", "->", "isEmpty", "(", ")", ")", "{", "return", "false", ";", "}", "return", "in_array", "(", "$", "iElementID", ",", ...
Checking, has collection ID @see \Lovata\Toolbox\Tests\Unit\CollectionTest::testHasMethod() @link https://github.com/lovata/oc-toolbox-plugin/wiki/ElementCollection#hasielementid @param int $iElementID @return bool
[ "Checking", "has", "collection", "ID" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/collection/ElementCollection.php#L124-L131
43,721
lovata/oc-toolbox-plugin
classes/collection/ElementCollection.php
ElementCollection.find
public function find($iElementID) { if (!$this->has($iElementID)) { return $this->makeItem(null); } return $this->makeItem($iElementID); }
php
public function find($iElementID) { if (!$this->has($iElementID)) { return $this->makeItem(null); } return $this->makeItem($iElementID); }
[ "public", "function", "find", "(", "$", "iElementID", ")", "{", "if", "(", "!", "$", "this", "->", "has", "(", "$", "iElementID", ")", ")", "{", "return", "$", "this", "->", "makeItem", "(", "null", ")", ";", "}", "return", "$", "this", "->", "ma...
Get element item with ID @see \Lovata\Toolbox\Tests\Unit\CollectionTest::testFindMethod() @link https://github.com/lovata/oc-toolbox-plugin/wiki/ElementCollection#findielementid @param int $iElementID @return \Lovata\Toolbox\Classes\Item\ElementItem
[ "Get", "element", "item", "with", "ID" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/collection/ElementCollection.php#L140-L147
43,722
lovata/oc-toolbox-plugin
classes/collection/ElementCollection.php
ElementCollection.intersect
public function intersect($arElementIDList) { if (empty($arElementIDList)) { return $this->clear(); } if ($this->isClear()) { $this->arElementIDList = $arElementIDList; return $this->returnThis(); } $this->arElementIDList = array_combine($this->arElementIDList, $this->arElementIDList); $arElementIDList = array_combine($arElementIDList, $arElementIDList); $this->arElementIDList = array_intersect_key($this->arElementIDList, $arElementIDList); return $this->returnThis(); }
php
public function intersect($arElementIDList) { if (empty($arElementIDList)) { return $this->clear(); } if ($this->isClear()) { $this->arElementIDList = $arElementIDList; return $this->returnThis(); } $this->arElementIDList = array_combine($this->arElementIDList, $this->arElementIDList); $arElementIDList = array_combine($arElementIDList, $arElementIDList); $this->arElementIDList = array_intersect_key($this->arElementIDList, $arElementIDList); return $this->returnThis(); }
[ "public", "function", "intersect", "(", "$", "arElementIDList", ")", "{", "if", "(", "empty", "(", "$", "arElementIDList", ")", ")", "{", "return", "$", "this", "->", "clear", "(", ")", ";", "}", "if", "(", "$", "this", "->", "isClear", "(", ")", "...
Apply array_intersect for element array list @see \Lovata\Toolbox\Tests\Unit\CollectionTest::testIntersectMethod() @link https://github.com/lovata/oc-toolbox-plugin/wiki/ElementCollection#intersectarelementidlist @param array $arElementIDList @return $this
[ "Apply", "array_intersect", "for", "element", "array", "list" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/collection/ElementCollection.php#L184-L202
43,723
lovata/oc-toolbox-plugin
classes/collection/ElementCollection.php
ElementCollection.merge
public function merge($arElementIDList) { if (empty($arElementIDList)) { return $this->returnThis(); } if ($this->isClear()) { $this->arElementIDList = $arElementIDList; return $this->returnThis(); } $this->arElementIDList = array_merge($this->arElementIDList, $arElementIDList); $this->arElementIDList = array_unique($this->arElementIDList); return $this->returnThis(); }
php
public function merge($arElementIDList) { if (empty($arElementIDList)) { return $this->returnThis(); } if ($this->isClear()) { $this->arElementIDList = $arElementIDList; return $this->returnThis(); } $this->arElementIDList = array_merge($this->arElementIDList, $arElementIDList); $this->arElementIDList = array_unique($this->arElementIDList); return $this->returnThis(); }
[ "public", "function", "merge", "(", "$", "arElementIDList", ")", "{", "if", "(", "empty", "(", "$", "arElementIDList", ")", ")", "{", "return", "$", "this", "->", "returnThis", "(", ")", ";", "}", "if", "(", "$", "this", "->", "isClear", "(", ")", ...
Apply array_merge for element array list @see \Lovata\Toolbox\Tests\Unit\CollectionTest::testMergeMethod() @link https://github.com/lovata/oc-toolbox-plugin/wiki/ElementCollection#mergearelementidlist @param array $arElementIDList @return $this
[ "Apply", "array_merge", "for", "element", "array", "list" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/collection/ElementCollection.php#L240-L256
43,724
lovata/oc-toolbox-plugin
classes/collection/ElementCollection.php
ElementCollection.diff
public function diff($arExcludeIDList = []) { if (empty($arExcludeIDList) || $this->isEmpty()) { return $this->returnThis(); } $this->arElementIDList = array_diff($this->arElementIDList, $arExcludeIDList); return $this->returnThis(); }
php
public function diff($arExcludeIDList = []) { if (empty($arExcludeIDList) || $this->isEmpty()) { return $this->returnThis(); } $this->arElementIDList = array_diff($this->arElementIDList, $arExcludeIDList); return $this->returnThis(); }
[ "public", "function", "diff", "(", "$", "arExcludeIDList", "=", "[", "]", ")", "{", "if", "(", "empty", "(", "$", "arExcludeIDList", ")", "||", "$", "this", "->", "isEmpty", "(", ")", ")", "{", "return", "$", "this", "->", "returnThis", "(", ")", "...
Apply array_diff for element array list @see \Lovata\Toolbox\Tests\Unit\CollectionTest::testDiffMethod() @link https://github.com/lovata/oc-toolbox-plugin/wiki/ElementCollection#diffarelementidlist @param array $arExcludeIDList @return $this
[ "Apply", "array_diff", "for", "element", "array", "list" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/collection/ElementCollection.php#L265-L274
43,725
lovata/oc-toolbox-plugin
classes/collection/ElementCollection.php
ElementCollection.all
public function all() { if ($this->isEmpty()) { return []; } $arResult = []; foreach ($this->arElementIDList as $iElementID) { $obElementItem = $this->makeItem($iElementID, null); if ($obElementItem->isEmpty()) { continue; } $arResult[$iElementID] = $obElementItem; } return $arResult; }
php
public function all() { if ($this->isEmpty()) { return []; } $arResult = []; foreach ($this->arElementIDList as $iElementID) { $obElementItem = $this->makeItem($iElementID, null); if ($obElementItem->isEmpty()) { continue; } $arResult[$iElementID] = $obElementItem; } return $arResult; }
[ "public", "function", "all", "(", ")", "{", "if", "(", "$", "this", "->", "isEmpty", "(", ")", ")", "{", "return", "[", "]", ";", "}", "$", "arResult", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "arElementIDList", "as", "$", "iElement...
Get element item list @see \Lovata\Toolbox\Tests\Unit\CollectionTest::testAllMethod() @link https://github.com/lovata/oc-toolbox-plugin/wiki/ElementCollection#all @return array|\Lovata\Toolbox\Classes\Item\ElementItem[]
[ "Get", "element", "item", "list" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/collection/ElementCollection.php#L282-L299
43,726
lovata/oc-toolbox-plugin
classes/collection/ElementCollection.php
ElementCollection.take
public function take($iCount = 0) { $iCount = (int) trim($iCount); if ($this->isEmpty()) { return []; } if (empty($iCount)) { $iCount = null; } $arResultIDList = array_slice($this->arElementIDList, $this->iSkip, $iCount); if (empty($arResultIDList)) { return []; } $arResult = []; foreach ($arResultIDList as $iElementID) { $obElementItem = $this->makeItem($iElementID, null); if ($obElementItem->isEmpty()) { continue; } $arResult[$iElementID] = $obElementItem; } return $arResult; }
php
public function take($iCount = 0) { $iCount = (int) trim($iCount); if ($this->isEmpty()) { return []; } if (empty($iCount)) { $iCount = null; } $arResultIDList = array_slice($this->arElementIDList, $this->iSkip, $iCount); if (empty($arResultIDList)) { return []; } $arResult = []; foreach ($arResultIDList as $iElementID) { $obElementItem = $this->makeItem($iElementID, null); if ($obElementItem->isEmpty()) { continue; } $arResult[$iElementID] = $obElementItem; } return $arResult; }
[ "public", "function", "take", "(", "$", "iCount", "=", "0", ")", "{", "$", "iCount", "=", "(", "int", ")", "trim", "(", "$", "iCount", ")", ";", "if", "(", "$", "this", "->", "isEmpty", "(", ")", ")", "{", "return", "[", "]", ";", "}", "if", ...
Take array with element items @see \Lovata\Toolbox\Tests\Unit\CollectionTest::testTakeMethod() @link https://github.com/lovata/oc-toolbox-plugin/wiki/ElementCollection#takeicount--0 @param int $iCount @return array|\Lovata\Toolbox\Classes\Item\ElementItem[]
[ "Take", "array", "with", "element", "items" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/collection/ElementCollection.php#L323-L350
43,727
lovata/oc-toolbox-plugin
classes/collection/ElementCollection.php
ElementCollection.exclude
public function exclude($iElementID = null) { if (empty($iElementID) || $this->isEmpty()) { return $this->returnThis(); } $iElementIDKey = array_search($iElementID, $this->arElementIDList); if ($iElementIDKey === false) { return $this->returnThis(); } unset($this->arElementIDList[$iElementIDKey]); return $this->returnThis(); }
php
public function exclude($iElementID = null) { if (empty($iElementID) || $this->isEmpty()) { return $this->returnThis(); } $iElementIDKey = array_search($iElementID, $this->arElementIDList); if ($iElementIDKey === false) { return $this->returnThis(); } unset($this->arElementIDList[$iElementIDKey]); return $this->returnThis(); }
[ "public", "function", "exclude", "(", "$", "iElementID", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "iElementID", ")", "||", "$", "this", "->", "isEmpty", "(", ")", ")", "{", "return", "$", "this", "->", "returnThis", "(", ")", ";", "}", ...
Exclude element id from collection @see \Lovata\Toolbox\Tests\Unit\CollectionTest::testExcludeMethod() @link https://github.com/lovata/oc-toolbox-plugin/wiki/ElementCollection#excludeielementid @param int $iElementID @return $this
[ "Exclude", "element", "id", "from", "collection" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/collection/ElementCollection.php#L359-L373
43,728
lovata/oc-toolbox-plugin
classes/collection/ElementCollection.php
ElementCollection.random
public function random($iCount = 1) { if ($this->isEmpty()) { return []; } $iCount = (int) trim($iCount); if ($iCount < 1) { $iCount = 1; } if (count($this->arElementIDList) < $iCount) { $iCount = count($this->arElementIDList); } $obThis = $this->copy(); shuffle($obThis->arElementIDList); return $obThis->take($iCount); }
php
public function random($iCount = 1) { if ($this->isEmpty()) { return []; } $iCount = (int) trim($iCount); if ($iCount < 1) { $iCount = 1; } if (count($this->arElementIDList) < $iCount) { $iCount = count($this->arElementIDList); } $obThis = $this->copy(); shuffle($obThis->arElementIDList); return $obThis->take($iCount); }
[ "public", "function", "random", "(", "$", "iCount", "=", "1", ")", "{", "if", "(", "$", "this", "->", "isEmpty", "(", ")", ")", "{", "return", "[", "]", ";", "}", "$", "iCount", "=", "(", "int", ")", "trim", "(", "$", "iCount", ")", ";", "if"...
Take array with random element items @link https://github.com/lovata/oc-toolbox-plugin/wiki/ElementCollection#randomicount @param int $iCount @return array|\Lovata\Toolbox\Classes\Item\ElementItem[]
[ "Take", "array", "with", "random", "element", "items" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/collection/ElementCollection.php#L381-L400
43,729
lovata/oc-toolbox-plugin
classes/collection/ElementCollection.php
ElementCollection.first
public function first() { if ($this->isEmpty()) { return $this->makeItem(null); } $arResultIDList = $this->arElementIDList; $iElementID = array_shift($arResultIDList); return $this->makeItem($iElementID); }
php
public function first() { if ($this->isEmpty()) { return $this->makeItem(null); } $arResultIDList = $this->arElementIDList; $iElementID = array_shift($arResultIDList); return $this->makeItem($iElementID); }
[ "public", "function", "first", "(", ")", "{", "if", "(", "$", "this", "->", "isEmpty", "(", ")", ")", "{", "return", "$", "this", "->", "makeItem", "(", "null", ")", ";", "}", "$", "arResultIDList", "=", "$", "this", "->", "arElementIDList", ";", "...
Get first element item @see \Lovata\Toolbox\Tests\Unit\CollectionTest::testFirstMethod() @link https://github.com/lovata/oc-toolbox-plugin/wiki/ElementCollection#first @return \Lovata\Toolbox\Classes\Item\ElementItem|null
[ "Get", "first", "element", "item" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/collection/ElementCollection.php#L433-L444
43,730
lovata/oc-toolbox-plugin
classes/collection/ElementCollection.php
ElementCollection.last
public function last() { if ($this->isEmpty()) { return $this->makeItem(null); } $arResultIDList = $this->arElementIDList; $iElementID = array_pop($arResultIDList); return $this->makeItem($iElementID); }
php
public function last() { if ($this->isEmpty()) { return $this->makeItem(null); } $arResultIDList = $this->arElementIDList; $iElementID = array_pop($arResultIDList); return $this->makeItem($iElementID); }
[ "public", "function", "last", "(", ")", "{", "if", "(", "$", "this", "->", "isEmpty", "(", ")", ")", "{", "return", "$", "this", "->", "makeItem", "(", "null", ")", ";", "}", "$", "arResultIDList", "=", "$", "this", "->", "arElementIDList", ";", "$...
Get last element item @see \Lovata\Toolbox\Tests\Unit\CollectionTest::testLastMethod() @link https://github.com/lovata/oc-toolbox-plugin/wiki/ElementCollection#last @return \Lovata\Toolbox\Classes\Item\ElementItem|null
[ "Get", "last", "element", "item" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/collection/ElementCollection.php#L452-L463
43,731
lovata/oc-toolbox-plugin
classes/collection/ElementCollection.php
ElementCollection.shift
public function shift() { if (empty($this->arElementIDList)) { return $this->makeItem(null); } $iElementID = array_shift($this->arElementIDList); return $this->makeItem($iElementID); }
php
public function shift() { if (empty($this->arElementIDList)) { return $this->makeItem(null); } $iElementID = array_shift($this->arElementIDList); return $this->makeItem($iElementID); }
[ "public", "function", "shift", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "arElementIDList", ")", ")", "{", "return", "$", "this", "->", "makeItem", "(", "null", ")", ";", "}", "$", "iElementID", "=", "array_shift", "(", "$", "this", ...
Apply array_shift to element ID list and get first element item @see \Lovata\Toolbox\Tests\Unit\CollectionTest::testShiftMethod() @link https://github.com/lovata/oc-toolbox-plugin/wiki/ElementCollection#shift @return \Lovata\Toolbox\Classes\Item\ElementItem|null
[ "Apply", "array_shift", "to", "element", "ID", "list", "and", "get", "first", "element", "item" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/collection/ElementCollection.php#L471-L480
43,732
lovata/oc-toolbox-plugin
classes/collection/ElementCollection.php
ElementCollection.unshift
public function unshift($iElementID) { if (empty($iElementID)) { return $this->returnThis(); } if ($this->isEmpty()) { $this->arElementIDList = [$iElementID]; return $this->returnThis(); } array_unshift($this->arElementIDList, $iElementID); return $this->returnThis(); }
php
public function unshift($iElementID) { if (empty($iElementID)) { return $this->returnThis(); } if ($this->isEmpty()) { $this->arElementIDList = [$iElementID]; return $this->returnThis(); } array_unshift($this->arElementIDList, $iElementID); return $this->returnThis(); }
[ "public", "function", "unshift", "(", "$", "iElementID", ")", "{", "if", "(", "empty", "(", "$", "iElementID", ")", ")", "{", "return", "$", "this", "->", "returnThis", "(", ")", ";", "}", "if", "(", "$", "this", "->", "isEmpty", "(", ")", ")", "...
Apply array_unshift to element ID @param int $iElementID @see \Lovata\Toolbox\Tests\Unit\CollectionTest::testUnshiftMethod() @link https://github.com/lovata/oc-toolbox-plugin/wiki/ElementCollection#unshiftielementid @return $this
[ "Apply", "array_unshift", "to", "element", "ID" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/collection/ElementCollection.php#L489-L504
43,733
lovata/oc-toolbox-plugin
classes/collection/ElementCollection.php
ElementCollection.pop
public function pop() { if ($this->isEmpty()) { return $this->makeItem(null); } $iElementID = array_pop($this->arElementIDList); return $this->makeItem($iElementID); }
php
public function pop() { if ($this->isEmpty()) { return $this->makeItem(null); } $iElementID = array_pop($this->arElementIDList); return $this->makeItem($iElementID); }
[ "public", "function", "pop", "(", ")", "{", "if", "(", "$", "this", "->", "isEmpty", "(", ")", ")", "{", "return", "$", "this", "->", "makeItem", "(", "null", ")", ";", "}", "$", "iElementID", "=", "array_pop", "(", "$", "this", "->", "arElementIDL...
Apply array_pop to element ID list and get first element item @see \Lovata\Toolbox\Tests\Unit\CollectionTest::testPopMethod() @link https://github.com/lovata/oc-toolbox-plugin/wiki/ElementCollection#pop @return \Lovata\Toolbox\Classes\Item\ElementItem|null
[ "Apply", "array_pop", "to", "element", "ID", "list", "and", "get", "first", "element", "item" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/collection/ElementCollection.php#L512-L521
43,734
lovata/oc-toolbox-plugin
classes/collection/ElementCollection.php
ElementCollection.push
public function push($iElementID) { if (empty($iElementID)) { return $this->returnThis(); } if ($this->isEmpty()) { $this->arElementIDList = [$iElementID]; return $this->returnThis(); } $this->arElementIDList[] = $iElementID; return $this->returnThis(); }
php
public function push($iElementID) { if (empty($iElementID)) { return $this->returnThis(); } if ($this->isEmpty()) { $this->arElementIDList = [$iElementID]; return $this->returnThis(); } $this->arElementIDList[] = $iElementID; return $this->returnThis(); }
[ "public", "function", "push", "(", "$", "iElementID", ")", "{", "if", "(", "empty", "(", "$", "iElementID", ")", ")", "{", "return", "$", "this", "->", "returnThis", "(", ")", ";", "}", "if", "(", "$", "this", "->", "isEmpty", "(", ")", ")", "{",...
Push element ID to end of list @param int $iElementID @see \Lovata\Toolbox\Tests\Unit\CollectionTest::testUnshiftMethod() @link https://github.com/lovata/oc-toolbox-plugin/wiki/ElementCollection#pushielementid @return $this
[ "Push", "element", "ID", "to", "end", "of", "list" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/collection/ElementCollection.php#L530-L545
43,735
lovata/oc-toolbox-plugin
classes/helper/PriceHelper.php
PriceHelper.format
public static function format($fPrice) { $fPrice = (float) $fPrice; $obThis = self::instance(); return number_format($fPrice, $obThis->iDecimal, $obThis->sDecPoint, $obThis->sThousandsSep); }
php
public static function format($fPrice) { $fPrice = (float) $fPrice; $obThis = self::instance(); return number_format($fPrice, $obThis->iDecimal, $obThis->sDecPoint, $obThis->sThousandsSep); }
[ "public", "static", "function", "format", "(", "$", "fPrice", ")", "{", "$", "fPrice", "=", "(", "float", ")", "$", "fPrice", ";", "$", "obThis", "=", "self", "::", "instance", "(", ")", ";", "return", "number_format", "(", "$", "fPrice", ",", "$", ...
Apply custom format for price float value @param float $fPrice @return string
[ "Apply", "custom", "format", "for", "price", "float", "value" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/helper/PriceHelper.php#L29-L36
43,736
lovata/oc-toolbox-plugin
classes/helper/PriceHelper.php
PriceHelper.toFloat
public static function toFloat($sValue) { $sValue = str_replace(',', '.', $sValue); $fPrice = (float) preg_replace("/[^0-9\.]/", "", $sValue); return $fPrice; }
php
public static function toFloat($sValue) { $sValue = str_replace(',', '.', $sValue); $fPrice = (float) preg_replace("/[^0-9\.]/", "", $sValue); return $fPrice; }
[ "public", "static", "function", "toFloat", "(", "$", "sValue", ")", "{", "$", "sValue", "=", "str_replace", "(", "','", ",", "'.'", ",", "$", "sValue", ")", ";", "$", "fPrice", "=", "(", "float", ")", "preg_replace", "(", "\"/[^0-9\\.]/\"", ",", "\"\""...
Convert price string to float value @param string $sValue @return float
[ "Convert", "price", "string", "to", "float", "value" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/helper/PriceHelper.php#L43-L49
43,737
lovata/oc-toolbox-plugin
classes/helper/PriceHelper.php
PriceHelper.init
protected function init() { //Get options from settings $iDecimalValue = (int) Settings::getValue('decimals'); if ($iDecimalValue >= 0) { $this->iDecimal = $iDecimalValue; } $sDecPointValue = Settings::getValue('dec_point'); switch ($sDecPointValue) { case 'comma': $this->sDecPoint = ','; break; default: $this->sDecPoint = '.'; } $sThousandsSepValue = Settings::getValue('thousands_sep'); switch ($sThousandsSepValue) { case 'space': $this->sThousandsSep = ' '; break; default: $this->sThousandsSep = ''; } }
php
protected function init() { //Get options from settings $iDecimalValue = (int) Settings::getValue('decimals'); if ($iDecimalValue >= 0) { $this->iDecimal = $iDecimalValue; } $sDecPointValue = Settings::getValue('dec_point'); switch ($sDecPointValue) { case 'comma': $this->sDecPoint = ','; break; default: $this->sDecPoint = '.'; } $sThousandsSepValue = Settings::getValue('thousands_sep'); switch ($sThousandsSepValue) { case 'space': $this->sThousandsSep = ' '; break; default: $this->sThousandsSep = ''; } }
[ "protected", "function", "init", "(", ")", "{", "//Get options from settings", "$", "iDecimalValue", "=", "(", "int", ")", "Settings", "::", "getValue", "(", "'decimals'", ")", ";", "if", "(", "$", "iDecimalValue", ">=", "0", ")", "{", "$", "this", "->", ...
PriceHelper constructor.
[ "PriceHelper", "constructor", "." ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/helper/PriceHelper.php#L65-L90
43,738
lovata/oc-toolbox-plugin
classes/component/ElementPage.php
ElementPage.checkTransSlug
protected function checkTransSlug($obElement, $sElementSlug) { if (empty($obElement) || empty($sElementSlug)) { return false; } $bResult = $obElement->slug == $sElementSlug; return $bResult; }
php
protected function checkTransSlug($obElement, $sElementSlug) { if (empty($obElement) || empty($sElementSlug)) { return false; } $bResult = $obElement->slug == $sElementSlug; return $bResult; }
[ "protected", "function", "checkTransSlug", "(", "$", "obElement", ",", "$", "sElementSlug", ")", "{", "if", "(", "empty", "(", "$", "obElement", ")", "||", "empty", "(", "$", "sElementSlug", ")", ")", "{", "return", "false", ";", "}", "$", "bResult", "...
Checks trans value, if value is not form active lang, then return false @param \Model $obElement @param string $sElementSlug @return bool
[ "Checks", "trans", "value", "if", "value", "is", "not", "form", "active", "lang", "then", "return", "false" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/component/ElementPage.php#L115-L124
43,739
lovata/oc-toolbox-plugin
classes/component/ElementPage.php
ElementPage.smartUrlCheck
protected function smartUrlCheck() { if (empty($this->obElementItem)) { return false; } $sCurrentURL = $this->currentPageUrl(); $sValidURL = $this->obElementItem->getPageUrl($this->page->id); $bResult = $sCurrentURL == $sValidURL; return $bResult; }
php
protected function smartUrlCheck() { if (empty($this->obElementItem)) { return false; } $sCurrentURL = $this->currentPageUrl(); $sValidURL = $this->obElementItem->getPageUrl($this->page->id); $bResult = $sCurrentURL == $sValidURL; return $bResult; }
[ "protected", "function", "smartUrlCheck", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "obElementItem", ")", ")", "{", "return", "false", ";", "}", "$", "sCurrentURL", "=", "$", "this", "->", "currentPageUrl", "(", ")", ";", "$", "sValidU...
Smart check URL with additional checking @return bool
[ "Smart", "check", "URL", "with", "additional", "checking" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/component/ElementPage.php#L130-L141
43,740
lovata/oc-toolbox-plugin
classes/store/AbstractStore.php
AbstractStore.getIDListFromCache
protected function getIDListFromCache() : array { $arCacheTags = $this->getCacheTagList(); $sCacheKey = $this->getCacheKey(); $arElementIDList = (array) CCache::get($arCacheTags, $sCacheKey); return $arElementIDList; }
php
protected function getIDListFromCache() : array { $arCacheTags = $this->getCacheTagList(); $sCacheKey = $this->getCacheKey(); $arElementIDList = (array) CCache::get($arCacheTags, $sCacheKey); return $arElementIDList; }
[ "protected", "function", "getIDListFromCache", "(", ")", ":", "array", "{", "$", "arCacheTags", "=", "$", "this", "->", "getCacheTagList", "(", ")", ";", "$", "sCacheKey", "=", "$", "this", "->", "getCacheKey", "(", ")", ";", "$", "arElementIDList", "=", ...
Get element ID list from array @return array|null
[ "Get", "element", "ID", "list", "from", "array" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/store/AbstractStore.php#L50-L58
43,741
lovata/oc-toolbox-plugin
classes/store/AbstractStore.php
AbstractStore.saveIDList
protected function saveIDList($arElementIDList) { $arCacheTags = $this->getCacheTagList(); $sCacheKey = $this->getCacheKey(); //Set cache data CCache::forever($arCacheTags, $sCacheKey, $arElementIDList); }
php
protected function saveIDList($arElementIDList) { $arCacheTags = $this->getCacheTagList(); $sCacheKey = $this->getCacheKey(); //Set cache data CCache::forever($arCacheTags, $sCacheKey, $arElementIDList); }
[ "protected", "function", "saveIDList", "(", "$", "arElementIDList", ")", "{", "$", "arCacheTags", "=", "$", "this", "->", "getCacheTagList", "(", ")", ";", "$", "sCacheKey", "=", "$", "this", "->", "getCacheKey", "(", ")", ";", "//Set cache data", "CCache", ...
Save element ID list in cache @param array $arElementIDList
[ "Save", "element", "ID", "list", "in", "cache" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/store/AbstractStore.php#L64-L71
43,742
lovata/oc-toolbox-plugin
classes/store/AbstractStore.php
AbstractStore.clearIDList
protected function clearIDList() { $arCacheTags = $this->getCacheTagList(); $sCacheKey = $this->getCacheKey(); CCache::clear($arCacheTags, $sCacheKey); }
php
protected function clearIDList() { $arCacheTags = $this->getCacheTagList(); $sCacheKey = $this->getCacheKey(); CCache::clear($arCacheTags, $sCacheKey); }
[ "protected", "function", "clearIDList", "(", ")", "{", "$", "arCacheTags", "=", "$", "this", "->", "getCacheTagList", "(", ")", ";", "$", "sCacheKey", "=", "$", "this", "->", "getCacheKey", "(", ")", ";", "CCache", "::", "clear", "(", "$", "arCacheTags",...
Clear element ID list in cache
[ "Clear", "element", "ID", "list", "in", "cache" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/store/AbstractStore.php#L76-L82
43,743
lovata/oc-toolbox-plugin
components/Pagination.php
Pagination.init
public function init() { $arAvailableValue = []; $sAvailableValue = $this->property('available_count_per_page'); if (!empty($sAvailableValue)) { $arAvailableValue = explode(',', $sAvailableValue); } //Get limit from request $iLimit = (int) Input::get('limit'); if ($iLimit > 0 && (empty($arAvailableValue) || in_array($iLimit, $arAvailableValue))) { $this->iElementOnPage = $iLimit; return; } $iRequestElementOnPage = (int) $this->property('count_per_page'); if ($iRequestElementOnPage > 0) { $this->iElementOnPage = $iRequestElementOnPage; } }
php
public function init() { $arAvailableValue = []; $sAvailableValue = $this->property('available_count_per_page'); if (!empty($sAvailableValue)) { $arAvailableValue = explode(',', $sAvailableValue); } //Get limit from request $iLimit = (int) Input::get('limit'); if ($iLimit > 0 && (empty($arAvailableValue) || in_array($iLimit, $arAvailableValue))) { $this->iElementOnPage = $iLimit; return; } $iRequestElementOnPage = (int) $this->property('count_per_page'); if ($iRequestElementOnPage > 0) { $this->iElementOnPage = $iRequestElementOnPage; } }
[ "public", "function", "init", "(", ")", "{", "$", "arAvailableValue", "=", "[", "]", ";", "$", "sAvailableValue", "=", "$", "this", "->", "property", "(", "'available_count_per_page'", ")", ";", "if", "(", "!", "empty", "(", "$", "sAvailableValue", ")", ...
Init start data
[ "Init", "start", "data" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/components/Pagination.php#L50-L70
43,744
lovata/oc-toolbox-plugin
components/Pagination.php
Pagination.get
public function get($iPage, $iCount) { if ($iCount < 1) { return null; } $iPage = (int) trim($iPage); //Check page value if ($iPage < 1) { $iPage = 1; } $this->properties['count_per_page'] = $this->iElementOnPage; return PaginationHelper::get($iPage, $iCount, $this->properties); }
php
public function get($iPage, $iCount) { if ($iCount < 1) { return null; } $iPage = (int) trim($iPage); //Check page value if ($iPage < 1) { $iPage = 1; } $this->properties['count_per_page'] = $this->iElementOnPage; return PaginationHelper::get($iPage, $iCount, $this->properties); }
[ "public", "function", "get", "(", "$", "iPage", ",", "$", "iCount", ")", "{", "if", "(", "$", "iCount", "<", "1", ")", "{", "return", "null", ";", "}", "$", "iPage", "=", "(", "int", ")", "trim", "(", "$", "iPage", ")", ";", "//Check page value",...
Get pagination data @param int $iPage @param int $iCount @return array|null
[ "Get", "pagination", "data" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/components/Pagination.php#L151-L167
43,745
lovata/oc-toolbox-plugin
classes/item/ItemStorage.php
ItemStorage.get
public static function get($sClassName, $iElementID) { $sKey = self::getKey($sClassName, $iElementID); if (isset(self::$arItemStore[$sKey]) && self::$arItemStore[$sKey] instanceof ElementItem) { return clone self::$arItemStore[$sKey]; } return null; }
php
public static function get($sClassName, $iElementID) { $sKey = self::getKey($sClassName, $iElementID); if (isset(self::$arItemStore[$sKey]) && self::$arItemStore[$sKey] instanceof ElementItem) { return clone self::$arItemStore[$sKey]; } return null; }
[ "public", "static", "function", "get", "(", "$", "sClassName", ",", "$", "iElementID", ")", "{", "$", "sKey", "=", "self", "::", "getKey", "(", "$", "sClassName", ",", "$", "iElementID", ")", ";", "if", "(", "isset", "(", "self", "::", "$", "arItemSt...
Get item object from storage @param string $sClassName @param int $iElementID @return ElementItem|null
[ "Get", "item", "object", "from", "storage" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/item/ItemStorage.php#L19-L27
43,746
lovata/oc-toolbox-plugin
classes/item/ItemStorage.php
ItemStorage.set
public static function set($sClassName, $iElementID, $obItem) { if (empty($obItem) || $obItem->isEmpty()) { return; } $sKey = self::getKey($sClassName, $iElementID); self::$arItemStore[$sKey] = clone $obItem; }
php
public static function set($sClassName, $iElementID, $obItem) { if (empty($obItem) || $obItem->isEmpty()) { return; } $sKey = self::getKey($sClassName, $iElementID); self::$arItemStore[$sKey] = clone $obItem; }
[ "public", "static", "function", "set", "(", "$", "sClassName", ",", "$", "iElementID", ",", "$", "obItem", ")", "{", "if", "(", "empty", "(", "$", "obItem", ")", "||", "$", "obItem", "->", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "$", "...
Set item object in storage @param string $sClassName @param int $iElementID @param ElementItem $obItem
[ "Set", "item", "object", "in", "storage" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/item/ItemStorage.php#L35-L43
43,747
lovata/oc-toolbox-plugin
classes/item/ItemStorage.php
ItemStorage.clear
public static function clear($sClassName, $iElementID) { $sKey = self::getKey($sClassName, $iElementID); if (!isset(self::$arItemStore[$sKey])) { return; } unset(self::$arItemStore[$sKey]); }
php
public static function clear($sClassName, $iElementID) { $sKey = self::getKey($sClassName, $iElementID); if (!isset(self::$arItemStore[$sKey])) { return; } unset(self::$arItemStore[$sKey]); }
[ "public", "static", "function", "clear", "(", "$", "sClassName", ",", "$", "iElementID", ")", "{", "$", "sKey", "=", "self", "::", "getKey", "(", "$", "sClassName", ",", "$", "iElementID", ")", ";", "if", "(", "!", "isset", "(", "self", "::", "$", ...
Clear item object in storage @param string $sClassName @param int $iElementID
[ "Clear", "item", "object", "in", "storage" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/item/ItemStorage.php#L50-L58
43,748
lovata/oc-toolbox-plugin
classes/helper/UserHelper.php
UserHelper.getUser
public function getUser() { if (empty($this->obHelper)) { return null; } $sAuthFacadeClass = $this->obHelper->getAuthFacade(); return $sAuthFacadeClass::getUser(); }
php
public function getUser() { if (empty($this->obHelper)) { return null; } $sAuthFacadeClass = $this->obHelper->getAuthFacade(); return $sAuthFacadeClass::getUser(); }
[ "public", "function", "getUser", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "obHelper", ")", ")", "{", "return", "null", ";", "}", "$", "sAuthFacadeClass", "=", "$", "this", "->", "obHelper", "->", "getAuthFacade", "(", ")", ";", "ret...
Get auth user object @return \Lovata\Buddies\Models\User|\RainLab\User\Models\User|null
[ "Get", "auth", "user", "object" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/helper/UserHelper.php#L28-L37
43,749
lovata/oc-toolbox-plugin
classes/event/ModelHandler.php
ModelHandler.clearItemCache
protected function clearItemCache() { $sItemClass = $this->getItemClass(); $sField = $this->sIdentifierField; $sItemClass::clearCache($this->obElement->$sField); }
php
protected function clearItemCache() { $sItemClass = $this->getItemClass(); $sField = $this->sIdentifierField; $sItemClass::clearCache($this->obElement->$sField); }
[ "protected", "function", "clearItemCache", "(", ")", "{", "$", "sItemClass", "=", "$", "this", "->", "getItemClass", "(", ")", ";", "$", "sField", "=", "$", "this", "->", "sIdentifierField", ";", "$", "sItemClass", "::", "clearCache", "(", "$", "this", "...
Clear item cache
[ "Clear", "item", "cache" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/event/ModelHandler.php#L116-L122
43,750
lovata/oc-toolbox-plugin
classes/event/ModelHandler.php
ModelHandler.clearCacheNotEmptyValue
protected function clearCacheNotEmptyValue($sField, $obListStore) { if (empty($sField) || empty($obListStore) || empty($this->obElement->$sField)) { return; } if ($obListStore instanceof AbstractStoreWithoutParam) { $obListStore->clear(); } elseif ($obListStore instanceof AbstractStoreWithParam) { $obListStore->clear($this->obElement->$sField); } }
php
protected function clearCacheNotEmptyValue($sField, $obListStore) { if (empty($sField) || empty($obListStore) || empty($this->obElement->$sField)) { return; } if ($obListStore instanceof AbstractStoreWithoutParam) { $obListStore->clear(); } elseif ($obListStore instanceof AbstractStoreWithParam) { $obListStore->clear($this->obElement->$sField); } }
[ "protected", "function", "clearCacheNotEmptyValue", "(", "$", "sField", ",", "$", "obListStore", ")", "{", "if", "(", "empty", "(", "$", "sField", ")", "||", "empty", "(", "$", "obListStore", ")", "||", "empty", "(", "$", "this", "->", "obElement", "->",...
If field has not empty value, then cache clear by value @param string $sField @param AbstractStoreWithParam|AbstractStoreWithoutParam $obListStore
[ "If", "field", "has", "not", "empty", "value", "then", "cache", "clear", "by", "value" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/event/ModelHandler.php#L148-L159
43,751
lovata/oc-toolbox-plugin
classes/event/ModelHandler.php
ModelHandler.clearCacheEmptyValue
protected function clearCacheEmptyValue($sField, $obListStore) { if (empty($sField) || empty($obListStore) || !empty($this->obElement->$sField) || ! $obListStore instanceof AbstractStoreWithoutParam) { return; } $obListStore->clear(); }
php
protected function clearCacheEmptyValue($sField, $obListStore) { if (empty($sField) || empty($obListStore) || !empty($this->obElement->$sField) || ! $obListStore instanceof AbstractStoreWithoutParam) { return; } $obListStore->clear(); }
[ "protected", "function", "clearCacheEmptyValue", "(", "$", "sField", ",", "$", "obListStore", ")", "{", "if", "(", "empty", "(", "$", "sField", ")", "||", "empty", "(", "$", "obListStore", ")", "||", "!", "empty", "(", "$", "this", "->", "obElement", "...
If field has empty value, then cache clear by value @param string $sField @param AbstractStoreWithoutParam $obListStore
[ "If", "field", "has", "empty", "value", "then", "cache", "clear", "by", "value" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/event/ModelHandler.php#L166-L173
43,752
lovata/oc-toolbox-plugin
classes/storage/UserStorage.php
UserStorage.setDefaultStorage
public function setDefaultStorage($obUserStorage, $iMinutePeriod = 1440) { if (empty($obUserStorage)) { return; } $this->obDefaultStorage = app($obUserStorage); if (!empty($this->obDefaultStorage) && $this->obDefaultStorage instanceof CookieUserStorage) { $this->obDefaultStorage->setMinutePeriod($iMinutePeriod); } }
php
public function setDefaultStorage($obUserStorage, $iMinutePeriod = 1440) { if (empty($obUserStorage)) { return; } $this->obDefaultStorage = app($obUserStorage); if (!empty($this->obDefaultStorage) && $this->obDefaultStorage instanceof CookieUserStorage) { $this->obDefaultStorage->setMinutePeriod($iMinutePeriod); } }
[ "public", "function", "setDefaultStorage", "(", "$", "obUserStorage", ",", "$", "iMinutePeriod", "=", "1440", ")", "{", "if", "(", "empty", "(", "$", "obUserStorage", ")", ")", "{", "return", ";", "}", "$", "this", "->", "obDefaultStorage", "=", "app", "...
Set default user storage @param string $obUserStorage @param int $iMinutePeriod
[ "Set", "default", "user", "storage" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/storage/UserStorage.php#L20-L30
43,753
lovata/oc-toolbox-plugin
classes/storage/UserStorage.php
UserStorage.clear
public function clear($sKey) { if (empty($sKey)) { return; } $this->clearDefaultStorageValue($sKey); //Get auth user object $obUser = UserHelper::instance()->getUser(); if (empty($obUser)) { return; } $obUser->$sKey = null; $obUser->save(); }
php
public function clear($sKey) { if (empty($sKey)) { return; } $this->clearDefaultStorageValue($sKey); //Get auth user object $obUser = UserHelper::instance()->getUser(); if (empty($obUser)) { return; } $obUser->$sKey = null; $obUser->save(); }
[ "public", "function", "clear", "(", "$", "sKey", ")", "{", "if", "(", "empty", "(", "$", "sKey", ")", ")", "{", "return", ";", "}", "$", "this", "->", "clearDefaultStorageValue", "(", "$", "sKey", ")", ";", "//Get auth user object", "$", "obUser", "=",...
Clear value in storage @param string $sKey
[ "Clear", "value", "in", "storage" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/storage/UserStorage.php#L87-L103
43,754
lovata/oc-toolbox-plugin
classes/storage/UserStorage.php
UserStorage.getList
public function getList($sKey) { if (empty($sKey)) { return []; } $arDefaultStorageValue = $this->getListDefaultStorageValue($sKey); //Get auth user object $obUser = UserHelper::instance()->getUser(); if (empty($obUser)) { return $arDefaultStorageValue; } //Get value from user object $arValueList = $obUser->$sKey; if (empty($arValueList) || !is_array($arValueList)) { $arValueList = []; } if (!empty($arDefaultStorageValue)) { $arValueList = array_merge($arDefaultStorageValue, $arValueList); $arValueList = array_unique($arValueList); $this->put($sKey, $arValueList); $this->clearDefaultStorageValue($sKey); } return $arValueList; }
php
public function getList($sKey) { if (empty($sKey)) { return []; } $arDefaultStorageValue = $this->getListDefaultStorageValue($sKey); //Get auth user object $obUser = UserHelper::instance()->getUser(); if (empty($obUser)) { return $arDefaultStorageValue; } //Get value from user object $arValueList = $obUser->$sKey; if (empty($arValueList) || !is_array($arValueList)) { $arValueList = []; } if (!empty($arDefaultStorageValue)) { $arValueList = array_merge($arDefaultStorageValue, $arValueList); $arValueList = array_unique($arValueList); $this->put($sKey, $arValueList); $this->clearDefaultStorageValue($sKey); } return $arValueList; }
[ "public", "function", "getList", "(", "$", "sKey", ")", "{", "if", "(", "empty", "(", "$", "sKey", ")", ")", "{", "return", "[", "]", ";", "}", "$", "arDefaultStorageValue", "=", "$", "this", "->", "getListDefaultStorageValue", "(", "$", "sKey", ")", ...
Get list value from storage @param string $sKey @return array
[ "Get", "list", "value", "from", "storage" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/storage/UserStorage.php#L110-L139
43,755
lovata/oc-toolbox-plugin
classes/component/ComponentSubmitForm.php
ComponentSubmitForm.getModeProperty
protected function getModeProperty() { $arResult = [ self::PROPERTY_MODE => [ 'title' => 'lovata.toolbox::lang.component.property_mode', 'type' => 'dropdown', 'options' => [ self::MODE_SUBMIT => Lang::get('lovata.toolbox::lang.component.mode_'.self::MODE_SUBMIT), self::MODE_AJAX => Lang::get('lovata.toolbox::lang.component.mode_'.self::MODE_AJAX), ], ], self::PROPERTY_FLASH_ON => [ 'title' => 'lovata.toolbox::lang.component.property_flash_on', 'type' => 'checkbox', ], self::PROPERTY_REDIRECT_ON => [ 'title' => 'lovata.toolbox::lang.component.property_redirect_on', 'type' => 'checkbox', ], ]; try { $arPageList = Page::getNameList(); } catch (\Exception $obException) { $arPageList = []; } if (!empty($arPageList)) { $arResult[self::PROPERTY_REDIRECT_PAGE] = [ 'title' => 'lovata.toolbox::lang.component.property_redirect_page', 'type' => 'dropdown', 'options' => $arPageList, ]; } return $arResult; }
php
protected function getModeProperty() { $arResult = [ self::PROPERTY_MODE => [ 'title' => 'lovata.toolbox::lang.component.property_mode', 'type' => 'dropdown', 'options' => [ self::MODE_SUBMIT => Lang::get('lovata.toolbox::lang.component.mode_'.self::MODE_SUBMIT), self::MODE_AJAX => Lang::get('lovata.toolbox::lang.component.mode_'.self::MODE_AJAX), ], ], self::PROPERTY_FLASH_ON => [ 'title' => 'lovata.toolbox::lang.component.property_flash_on', 'type' => 'checkbox', ], self::PROPERTY_REDIRECT_ON => [ 'title' => 'lovata.toolbox::lang.component.property_redirect_on', 'type' => 'checkbox', ], ]; try { $arPageList = Page::getNameList(); } catch (\Exception $obException) { $arPageList = []; } if (!empty($arPageList)) { $arResult[self::PROPERTY_REDIRECT_PAGE] = [ 'title' => 'lovata.toolbox::lang.component.property_redirect_page', 'type' => 'dropdown', 'options' => $arPageList, ]; } return $arResult; }
[ "protected", "function", "getModeProperty", "(", ")", "{", "$", "arResult", "=", "[", "self", "::", "PROPERTY_MODE", "=>", "[", "'title'", "=>", "'lovata.toolbox::lang.component.property_mode'", ",", "'type'", "=>", "'dropdown'", ",", "'options'", "=>", "[", "self...
Get component property "mode" @return array
[ "Get", "component", "property", "mode" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/component/ComponentSubmitForm.php#L87-L123
43,756
lovata/oc-toolbox-plugin
classes/component/ComponentSubmitForm.php
ComponentSubmitForm.sendFlashMessage
protected function sendFlashMessage() { $bFlashOn = $this->property(self::PROPERTY_FLASH_ON); if (!$bFlashOn) { return; } $sMessage = Result::message(); if (empty($sMessage)) { return; } if (Result::status()) { Flash::success($sMessage); } else { Flash::error($sMessage); } }
php
protected function sendFlashMessage() { $bFlashOn = $this->property(self::PROPERTY_FLASH_ON); if (!$bFlashOn) { return; } $sMessage = Result::message(); if (empty($sMessage)) { return; } if (Result::status()) { Flash::success($sMessage); } else { Flash::error($sMessage); } }
[ "protected", "function", "sendFlashMessage", "(", ")", "{", "$", "bFlashOn", "=", "$", "this", "->", "property", "(", "self", "::", "PROPERTY_FLASH_ON", ")", ";", "if", "(", "!", "$", "bFlashOn", ")", "{", "return", ";", "}", "$", "sMessage", "=", "Res...
Send flash message
[ "Send", "flash", "message" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/component/ComponentSubmitForm.php#L190-L207
43,757
lovata/oc-toolbox-plugin
classes/storage/AbstractUserStorage.php
AbstractUserStorage.getList
public function getList($sKey) { if (empty($sKey)) { return []; } //Get value from storage $arValueList = $this->get($sKey); if (empty($arValueList) || !is_array($arValueList)) { $arValueList = []; } return $arValueList; }
php
public function getList($sKey) { if (empty($sKey)) { return []; } //Get value from storage $arValueList = $this->get($sKey); if (empty($arValueList) || !is_array($arValueList)) { $arValueList = []; } return $arValueList; }
[ "public", "function", "getList", "(", "$", "sKey", ")", "{", "if", "(", "empty", "(", "$", "sKey", ")", ")", "{", "return", "[", "]", ";", "}", "//Get value from storage", "$", "arValueList", "=", "$", "this", "->", "get", "(", "$", "sKey", ")", ";...
Get list value @param string $sKey @return array
[ "Get", "list", "value" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/storage/AbstractUserStorage.php#L37-L50
43,758
lovata/oc-toolbox-plugin
classes/storage/AbstractUserStorage.php
AbstractUserStorage.addToList
public function addToList($sKey, $sValue) { if (empty($sKey) || empty($sValue)) { return; } //Get value from storage $arValueList = $this->getList($sKey); array_unshift($arValueList, $sValue); $arValueList = array_unique($arValueList); $this->put($sKey, $arValueList); }
php
public function addToList($sKey, $sValue) { if (empty($sKey) || empty($sValue)) { return; } //Get value from storage $arValueList = $this->getList($sKey); array_unshift($arValueList, $sValue); $arValueList = array_unique($arValueList); $this->put($sKey, $arValueList); }
[ "public", "function", "addToList", "(", "$", "sKey", ",", "$", "sValue", ")", "{", "if", "(", "empty", "(", "$", "sKey", ")", "||", "empty", "(", "$", "sValue", ")", ")", "{", "return", ";", "}", "//Get value from storage", "$", "arValueList", "=", "...
Add value to list @param string $sKey @param string $sValue
[ "Add", "value", "to", "list" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/storage/AbstractUserStorage.php#L57-L70
43,759
lovata/oc-toolbox-plugin
classes/storage/AbstractUserStorage.php
AbstractUserStorage.removeFromList
public function removeFromList($sKey, $sValue) { if (empty($sKey) || empty($sValue)) { return; } //Get value from storage $arValueList = $this->getList($sKey); $iPosition = array_search($sValue, $arValueList); if ($iPosition === false) { return; } unset($arValueList[$iPosition]); $arValueList = array_values($arValueList); $this->put($sKey, $arValueList); }
php
public function removeFromList($sKey, $sValue) { if (empty($sKey) || empty($sValue)) { return; } //Get value from storage $arValueList = $this->getList($sKey); $iPosition = array_search($sValue, $arValueList); if ($iPosition === false) { return; } unset($arValueList[$iPosition]); $arValueList = array_values($arValueList); $this->put($sKey, $arValueList); }
[ "public", "function", "removeFromList", "(", "$", "sKey", ",", "$", "sValue", ")", "{", "if", "(", "empty", "(", "$", "sKey", ")", "||", "empty", "(", "$", "sValue", ")", ")", "{", "return", ";", "}", "//Get value from storage", "$", "arValueList", "="...
Remove value from list @param string $sKey @param string $sValue
[ "Remove", "value", "from", "list" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/storage/AbstractUserStorage.php#L77-L95
43,760
lovata/oc-toolbox-plugin
classes/collection/CollectionStore.php
CollectionStore.save
public function save($sKey, $obCollection) { if (empty($sKey)) { return; } $this->arStore[$sKey] = $obCollection->copy(); }
php
public function save($sKey, $obCollection) { if (empty($sKey)) { return; } $this->arStore[$sKey] = $obCollection->copy(); }
[ "public", "function", "save", "(", "$", "sKey", ",", "$", "obCollection", ")", "{", "if", "(", "empty", "(", "$", "sKey", ")", ")", "{", "return", ";", "}", "$", "this", "->", "arStore", "[", "$", "sKey", "]", "=", "$", "obCollection", "->", "cop...
Save item collection @see \Lovata\Toolbox\Tests\Unit\CollectionTest::testSaveMethod() @param string $sKey @param ElementCollection $obCollection
[ "Save", "item", "collection" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/collection/CollectionStore.php#L23-L30
43,761
lovata/oc-toolbox-plugin
classes/collection/CollectionStore.php
CollectionStore.saved
public function saved($sKey) { if (empty($sKey) || empty($this->arStore) || !isset($this->arStore[$sKey])) { return null; } return $this->arStore[$sKey]->copy(); }
php
public function saved($sKey) { if (empty($sKey) || empty($this->arStore) || !isset($this->arStore[$sKey])) { return null; } return $this->arStore[$sKey]->copy(); }
[ "public", "function", "saved", "(", "$", "sKey", ")", "{", "if", "(", "empty", "(", "$", "sKey", ")", "||", "empty", "(", "$", "this", "->", "arStore", ")", "||", "!", "isset", "(", "$", "this", "->", "arStore", "[", "$", "sKey", "]", ")", ")",...
Get saved element collection @see \Lovata\Toolbox\Tests\Unit\CollectionTest::testSaveMethod() @param string $sKey @return ElementCollection
[ "Get", "saved", "element", "collection" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/collection/CollectionStore.php#L38-L45
43,762
lovata/oc-toolbox-plugin
classes/collection/CollectionStore.php
CollectionStore.clear
public function clear($sKey) { if (empty($sKey) || empty($this->arStore) || !isset($this->arStore[$sKey])) { return; } unset($this->arStore[$sKey]); }
php
public function clear($sKey) { if (empty($sKey) || empty($this->arStore) || !isset($this->arStore[$sKey])) { return; } unset($this->arStore[$sKey]); }
[ "public", "function", "clear", "(", "$", "sKey", ")", "{", "if", "(", "empty", "(", "$", "sKey", ")", "||", "empty", "(", "$", "this", "->", "arStore", ")", "||", "!", "isset", "(", "$", "this", "->", "arStore", "[", "$", "sKey", "]", ")", ")",...
Remove stored collection from store @param string $sKey
[ "Remove", "stored", "collection", "from", "store" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/collection/CollectionStore.php#L51-L58
43,763
lovata/oc-toolbox-plugin
classes/item/MainItem.php
MainItem.getLangAttribute
public function getLangAttribute($sName, $sLangCode = null) { if (empty($sName)) { return null; } if (empty($sLangCode)) { $sLangCode = self::$sActiveLang; } if (empty($sLangCode)) { return $this->getAttribute($sName); } $sLangName = $sName.'|'.$sLangCode; if (!empty($this->arModelData) && isset($this->arModelData[$sLangName])) { return $this->arModelData[$sLangName]; } return $this->getAttribute($sName); }
php
public function getLangAttribute($sName, $sLangCode = null) { if (empty($sName)) { return null; } if (empty($sLangCode)) { $sLangCode = self::$sActiveLang; } if (empty($sLangCode)) { return $this->getAttribute($sName); } $sLangName = $sName.'|'.$sLangCode; if (!empty($this->arModelData) && isset($this->arModelData[$sLangName])) { return $this->arModelData[$sLangName]; } return $this->getAttribute($sName); }
[ "public", "function", "getLangAttribute", "(", "$", "sName", ",", "$", "sLangCode", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "sName", ")", ")", "{", "return", "null", ";", "}", "if", "(", "empty", "(", "$", "sLangCode", ")", ")", "{", ...
Get lang attribute value @param string $sName @param string $sLangCode @return mixed|null
[ "Get", "lang", "attribute", "value" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/item/MainItem.php#L83-L103
43,764
lovata/oc-toolbox-plugin
classes/item/MainItem.php
MainItem.getUploadFileListField
protected function getUploadFileListField($sField, $sFakeField) { $arFileList = $this->getAttribute($sField); if (!empty($arFileList)) { return $arFileList; } $arFileList = []; $arCachedFileList = (array) $this->getAttribute($sFakeField); foreach ($arCachedFileList as $arFileData) { $obFile = $this->initUploadFileObject($arFileData); if (empty($obFile)) { continue; } $arFileList[] = $obFile; } $this->setAttribute($sField, $arFileList); return $arFileList; }
php
protected function getUploadFileListField($sField, $sFakeField) { $arFileList = $this->getAttribute($sField); if (!empty($arFileList)) { return $arFileList; } $arFileList = []; $arCachedFileList = (array) $this->getAttribute($sFakeField); foreach ($arCachedFileList as $arFileData) { $obFile = $this->initUploadFileObject($arFileData); if (empty($obFile)) { continue; } $arFileList[] = $obFile; } $this->setAttribute($sField, $arFileList); return $arFileList; }
[ "protected", "function", "getUploadFileListField", "(", "$", "sField", ",", "$", "sFakeField", ")", "{", "$", "arFileList", "=", "$", "this", "->", "getAttribute", "(", "$", "sField", ")", ";", "if", "(", "!", "empty", "(", "$", "arFileList", ")", ")", ...
Get image object form field with image array @param string $sField @param string $sFakeField @return File[]|null
[ "Get", "image", "object", "form", "field", "with", "image", "array" ]
e28f6cfd63f9091d5a215171568648ca5a0e4716
https://github.com/lovata/oc-toolbox-plugin/blob/e28f6cfd63f9091d5a215171568648ca5a0e4716/classes/item/MainItem.php#L218-L240
43,765
beardcoder/sitemap_generator
Classes/Service/LimitService.php
LimitService.getLimitString
public static function getLimitString($limit) { if (isset($limit) && !empty($limit)) { $limitParts = GeneralUtility::trimExplode(',', $limit); if (count($limitParts) === 1) { return intval($limitParts[0]); } if (count($limitParts) === 2) { return intval($limitParts[0]) . ',' . intval($limitParts[1]); } } return ''; }
php
public static function getLimitString($limit) { if (isset($limit) && !empty($limit)) { $limitParts = GeneralUtility::trimExplode(',', $limit); if (count($limitParts) === 1) { return intval($limitParts[0]); } if (count($limitParts) === 2) { return intval($limitParts[0]) . ',' . intval($limitParts[1]); } } return ''; }
[ "public", "static", "function", "getLimitString", "(", "$", "limit", ")", "{", "if", "(", "isset", "(", "$", "limit", ")", "&&", "!", "empty", "(", "$", "limit", ")", ")", "{", "$", "limitParts", "=", "GeneralUtility", "::", "trimExplode", "(", "','", ...
Returns the limit statement for database connection @param string $limit @return string
[ "Returns", "the", "limit", "statement", "for", "database", "connection" ]
022d60915ac72d21f31ef34e23ec049a2763578e
https://github.com/beardcoder/sitemap_generator/blob/022d60915ac72d21f31ef34e23ec049a2763578e/Classes/Service/LimitService.php#L30-L43
43,766
beardcoder/sitemap_generator
Classes/Domain/Repository/SitemapRepository.php
SitemapRepository.makeClassInstance
protected function makeClassInstance() { $objectManager = GeneralUtility::makeInstance(ObjectManager::class); $this->entryStorage = $objectManager->get(ObjectStorage::class); $this->pageRepository = $objectManager->get(PageRepository::class); $this->fieldValueService = $objectManager->get(FieldValueService::class); }
php
protected function makeClassInstance() { $objectManager = GeneralUtility::makeInstance(ObjectManager::class); $this->entryStorage = $objectManager->get(ObjectStorage::class); $this->pageRepository = $objectManager->get(PageRepository::class); $this->fieldValueService = $objectManager->get(FieldValueService::class); }
[ "protected", "function", "makeClassInstance", "(", ")", "{", "$", "objectManager", "=", "GeneralUtility", "::", "makeInstance", "(", "ObjectManager", "::", "class", ")", ";", "$", "this", "->", "entryStorage", "=", "$", "objectManager", "->", "get", "(", "Obje...
Make instance of needed classes
[ "Make", "instance", "of", "needed", "classes" ]
022d60915ac72d21f31ef34e23ec049a2763578e
https://github.com/beardcoder/sitemap_generator/blob/022d60915ac72d21f31ef34e23ec049a2763578e/Classes/Domain/Repository/SitemapRepository.php#L90-L96
43,767
beardcoder/sitemap_generator
Classes/Domain/Repository/SitemapRepository.php
SitemapRepository.generateSitemap
public function generateSitemap() { if ($this->findAllEntries()) { $sitemap = GeneralUtility::makeInstance(Sitemap::class); $sitemap->setUrlEntries($this->entryStorage); return $sitemap; } return null; }
php
public function generateSitemap() { if ($this->findAllEntries()) { $sitemap = GeneralUtility::makeInstance(Sitemap::class); $sitemap->setUrlEntries($this->entryStorage); return $sitemap; } return null; }
[ "public", "function", "generateSitemap", "(", ")", "{", "if", "(", "$", "this", "->", "findAllEntries", "(", ")", ")", "{", "$", "sitemap", "=", "GeneralUtility", "::", "makeInstance", "(", "Sitemap", "::", "class", ")", ";", "$", "sitemap", "->", "setUr...
Generate a sitemap @return Sitemap|null
[ "Generate", "a", "sitemap" ]
022d60915ac72d21f31ef34e23ec049a2763578e
https://github.com/beardcoder/sitemap_generator/blob/022d60915ac72d21f31ef34e23ec049a2763578e/Classes/Domain/Repository/SitemapRepository.php#L103-L113
43,768
beardcoder/sitemap_generator
Classes/Domain/Repository/SitemapRepository.php
SitemapRepository.findAllPages
public function findAllPages() { if (empty($this->pluginConfig['urlEntries']['pages'])) { return; } $pages = $this->hidePagesIfNotTranslated($this->getPages()); $pages = $this->hidePagesIfHiddenInDefaultTranslation($pages); $this->getEntriesFromPages($pages); }
php
public function findAllPages() { if (empty($this->pluginConfig['urlEntries']['pages'])) { return; } $pages = $this->hidePagesIfNotTranslated($this->getPages()); $pages = $this->hidePagesIfHiddenInDefaultTranslation($pages); $this->getEntriesFromPages($pages); }
[ "public", "function", "findAllPages", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "pluginConfig", "[", "'urlEntries'", "]", "[", "'pages'", "]", ")", ")", "{", "return", ";", "}", "$", "pages", "=", "$", "this", "->", "hidePagesIfNotTran...
Find all pages
[ "Find", "all", "pages" ]
022d60915ac72d21f31ef34e23ec049a2763578e
https://github.com/beardcoder/sitemap_generator/blob/022d60915ac72d21f31ef34e23ec049a2763578e/Classes/Domain/Repository/SitemapRepository.php#L131-L140
43,769
beardcoder/sitemap_generator
Classes/Domain/Repository/SitemapRepository.php
SitemapRepository.hidePagesIfNotTranslated
private function hidePagesIfNotTranslated($pages) { $language = GeneralUtility::_GET('L'); if ($this->isPageNotTranslated($language)) { foreach ($pages as $key => $page) { $pageOverlay = $this->pageRepository->getPageOverlay($page, $language); if (empty($pageOverlay['_PAGES_OVERLAY'])) { unset($pages[$key]); } } } return $pages; }
php
private function hidePagesIfNotTranslated($pages) { $language = GeneralUtility::_GET('L'); if ($this->isPageNotTranslated($language)) { foreach ($pages as $key => $page) { $pageOverlay = $this->pageRepository->getPageOverlay($page, $language); if (empty($pageOverlay['_PAGES_OVERLAY'])) { unset($pages[$key]); } } } return $pages; }
[ "private", "function", "hidePagesIfNotTranslated", "(", "$", "pages", ")", "{", "$", "language", "=", "GeneralUtility", "::", "_GET", "(", "'L'", ")", ";", "if", "(", "$", "this", "->", "isPageNotTranslated", "(", "$", "language", ")", ")", "{", "foreach",...
Remove page if not translated @param array $pages @return array
[ "Remove", "page", "if", "not", "translated" ]
022d60915ac72d21f31ef34e23ec049a2763578e
https://github.com/beardcoder/sitemap_generator/blob/022d60915ac72d21f31ef34e23ec049a2763578e/Classes/Domain/Repository/SitemapRepository.php#L149-L162
43,770
beardcoder/sitemap_generator
Classes/Domain/Repository/SitemapRepository.php
SitemapRepository.hidePagesIfHiddenInDefaultTranslation
private function hidePagesIfHiddenInDefaultTranslation($pages) { $language = GeneralUtility::_GET('L'); if ($language != 0) { return $pages; } foreach ($pages as $key => $page) { if ($page['l18n_cfg'] === 1) { unset($pages[$key]); } } return $pages; }
php
private function hidePagesIfHiddenInDefaultTranslation($pages) { $language = GeneralUtility::_GET('L'); if ($language != 0) { return $pages; } foreach ($pages as $key => $page) { if ($page['l18n_cfg'] === 1) { unset($pages[$key]); } } return $pages; }
[ "private", "function", "hidePagesIfHiddenInDefaultTranslation", "(", "$", "pages", ")", "{", "$", "language", "=", "GeneralUtility", "::", "_GET", "(", "'L'", ")", ";", "if", "(", "$", "language", "!=", "0", ")", "{", "return", "$", "pages", ";", "}", "f...
Remove page if hidden in default translation @param array $pages @return array
[ "Remove", "page", "if", "hidden", "in", "default", "translation" ]
022d60915ac72d21f31ef34e23ec049a2763578e
https://github.com/beardcoder/sitemap_generator/blob/022d60915ac72d21f31ef34e23ec049a2763578e/Classes/Domain/Repository/SitemapRepository.php#L183-L198
43,771
beardcoder/sitemap_generator
Classes/Domain/Repository/SitemapRepository.php
SitemapRepository.getPages
private function getPages() { $rootPageId = $this->pluginConfig['urlEntries']['pages']['rootPageId']; $rootPage = $this->pageRepository->getPage($rootPageId); $cacheIdentifier = md5($rootPageId . '-pagesForSitemap'); if ($this->cacheInstance->has($cacheIdentifier)) { $pages = $this->cacheInstance->get($cacheIdentifier); } else { $pages = $this->getSubPagesRecursive($rootPageId); $this->cacheInstance->set($cacheIdentifier, $pages, ['pagesForSitemap']); } return array_merge([$rootPage], $pages); }
php
private function getPages() { $rootPageId = $this->pluginConfig['urlEntries']['pages']['rootPageId']; $rootPage = $this->pageRepository->getPage($rootPageId); $cacheIdentifier = md5($rootPageId . '-pagesForSitemap'); if ($this->cacheInstance->has($cacheIdentifier)) { $pages = $this->cacheInstance->get($cacheIdentifier); } else { $pages = $this->getSubPagesRecursive($rootPageId); $this->cacheInstance->set($cacheIdentifier, $pages, ['pagesForSitemap']); } return array_merge([$rootPage], $pages); }
[ "private", "function", "getPages", "(", ")", "{", "$", "rootPageId", "=", "$", "this", "->", "pluginConfig", "[", "'urlEntries'", "]", "[", "'pages'", "]", "[", "'rootPageId'", "]", ";", "$", "rootPage", "=", "$", "this", "->", "pageRepository", "->", "g...
Get pages from Database @return array
[ "Get", "pages", "from", "Database" ]
022d60915ac72d21f31ef34e23ec049a2763578e
https://github.com/beardcoder/sitemap_generator/blob/022d60915ac72d21f31ef34e23ec049a2763578e/Classes/Domain/Repository/SitemapRepository.php#L205-L219
43,772
beardcoder/sitemap_generator
Classes/Domain/Repository/SitemapRepository.php
SitemapRepository.getSubPagesRecursive
private function getSubPagesRecursive($rootPageId) { $pages = $this->getSubPages($rootPageId); foreach ($pages as $page) { if (false === $this->isPageTreeLeaf($page)) { ArrayUtility::mergeRecursiveWithOverrule( $pages, $this->getSubPagesRecursive($page['uid']) ); } } return $pages; }
php
private function getSubPagesRecursive($rootPageId) { $pages = $this->getSubPages($rootPageId); foreach ($pages as $page) { if (false === $this->isPageTreeLeaf($page)) { ArrayUtility::mergeRecursiveWithOverrule( $pages, $this->getSubPagesRecursive($page['uid']) ); } } return $pages; }
[ "private", "function", "getSubPagesRecursive", "(", "$", "rootPageId", ")", "{", "$", "pages", "=", "$", "this", "->", "getSubPages", "(", "$", "rootPageId", ")", ";", "foreach", "(", "$", "pages", "as", "$", "page", ")", "{", "if", "(", "false", "==="...
Get sub pages recursive @param $rootPageId @return array
[ "Get", "sub", "pages", "recursive" ]
022d60915ac72d21f31ef34e23ec049a2763578e
https://github.com/beardcoder/sitemap_generator/blob/022d60915ac72d21f31ef34e23ec049a2763578e/Classes/Domain/Repository/SitemapRepository.php#L228-L241
43,773
beardcoder/sitemap_generator
Classes/Domain/Repository/SitemapRepository.php
SitemapRepository.getSubPages
private function getSubPages($startPageId) { $where = $this->pageRepository->enableFields('pages') . ' AND ' . UrlEntry::EXCLUDE_FROM_SITEMAP . '!=1' . $this->pageAdditionalWhere; try { return $this->pageRepository->getMenu($startPageId, '*', 'sorting', $where); } catch (\Exception $exception) { return []; } }
php
private function getSubPages($startPageId) { $where = $this->pageRepository->enableFields('pages') . ' AND ' . UrlEntry::EXCLUDE_FROM_SITEMAP . '!=1' . $this->pageAdditionalWhere; try { return $this->pageRepository->getMenu($startPageId, '*', 'sorting', $where); } catch (\Exception $exception) { return []; } }
[ "private", "function", "getSubPages", "(", "$", "startPageId", ")", "{", "$", "where", "=", "$", "this", "->", "pageRepository", "->", "enableFields", "(", "'pages'", ")", ".", "' AND '", ".", "UrlEntry", "::", "EXCLUDE_FROM_SITEMAP", ".", "'!=1'", ".", "$",...
Get sub pages @param int $startPageId @return array
[ "Get", "sub", "pages" ]
022d60915ac72d21f31ef34e23ec049a2763578e
https://github.com/beardcoder/sitemap_generator/blob/022d60915ac72d21f31ef34e23ec049a2763578e/Classes/Domain/Repository/SitemapRepository.php#L249-L258
43,774
beardcoder/sitemap_generator
Classes/Domain/Repository/SitemapRepository.php
SitemapRepository.generateEntriesFromTypoScript
public function generateEntriesFromTypoScript() { $urlEntries = $this->pluginConfig['urlEntries']; foreach ($urlEntries as $urlEntry) { if (!empty($urlEntry['active'])) { $this->mapToEntries($urlEntry); } } }
php
public function generateEntriesFromTypoScript() { $urlEntries = $this->pluginConfig['urlEntries']; foreach ($urlEntries as $urlEntry) { if (!empty($urlEntry['active'])) { $this->mapToEntries($urlEntry); } } }
[ "public", "function", "generateEntriesFromTypoScript", "(", ")", "{", "$", "urlEntries", "=", "$", "this", "->", "pluginConfig", "[", "'urlEntries'", "]", ";", "foreach", "(", "$", "urlEntries", "as", "$", "urlEntry", ")", "{", "if", "(", "!", "empty", "("...
Generate entries from TypoScript
[ "Generate", "entries", "from", "TypoScript" ]
022d60915ac72d21f31ef34e23ec049a2763578e
https://github.com/beardcoder/sitemap_generator/blob/022d60915ac72d21f31ef34e23ec049a2763578e/Classes/Domain/Repository/SitemapRepository.php#L321-L329
43,775
beardcoder/sitemap_generator
Classes/Domain/Repository/SitemapRepository.php
SitemapRepository.getRecordsFromDatabase
private function getRecordsFromDatabase($typoScriptUrlEntry) { if (!isset($GLOBALS['TCA'][$typoScriptUrlEntry['table']]) || !is_array($GLOBALS['TCA'][$typoScriptUrlEntry['table']]['ctrl']) ) { return false; } $language = ''; if ((int)$typoScriptUrlEntry['hideIfNotTranslated'] === 1) { $language = 'AND (sys_language_uid=\'-1\' OR sys_language_uid="' . (int)GeneralUtility::_GET('L') . '") '; } return $this->getDatabaseConnection()->exec_SELECTquery( '*', $typoScriptUrlEntry['table'], 'pid!=0 ' . $language . ' ' . AdditionalWhereService::getWhereString( $typoScriptUrlEntry['additionalWhere'] ) . $this->pageRepository->enableFields( $typoScriptUrlEntry['table'] ), '', OrderByService::getOrderByString( $typoScriptUrlEntry['orderBy'], $typoScriptUrlEntry['table'] ), LimitService::getLimitString( $typoScriptUrlEntry['limit'] ) ); }
php
private function getRecordsFromDatabase($typoScriptUrlEntry) { if (!isset($GLOBALS['TCA'][$typoScriptUrlEntry['table']]) || !is_array($GLOBALS['TCA'][$typoScriptUrlEntry['table']]['ctrl']) ) { return false; } $language = ''; if ((int)$typoScriptUrlEntry['hideIfNotTranslated'] === 1) { $language = 'AND (sys_language_uid=\'-1\' OR sys_language_uid="' . (int)GeneralUtility::_GET('L') . '") '; } return $this->getDatabaseConnection()->exec_SELECTquery( '*', $typoScriptUrlEntry['table'], 'pid!=0 ' . $language . ' ' . AdditionalWhereService::getWhereString( $typoScriptUrlEntry['additionalWhere'] ) . $this->pageRepository->enableFields( $typoScriptUrlEntry['table'] ), '', OrderByService::getOrderByString( $typoScriptUrlEntry['orderBy'], $typoScriptUrlEntry['table'] ), LimitService::getLimitString( $typoScriptUrlEntry['limit'] ) ); }
[ "private", "function", "getRecordsFromDatabase", "(", "$", "typoScriptUrlEntry", ")", "{", "if", "(", "!", "isset", "(", "$", "GLOBALS", "[", "'TCA'", "]", "[", "$", "typoScriptUrlEntry", "[", "'table'", "]", "]", ")", "||", "!", "is_array", "(", "$", "G...
Get records from database @param $typoScriptUrlEntry @SuppressWarnings(superglobals) @return bool|\mysqli_result|object
[ "Get", "records", "from", "database" ]
022d60915ac72d21f31ef34e23ec049a2763578e
https://github.com/beardcoder/sitemap_generator/blob/022d60915ac72d21f31ef34e23ec049a2763578e/Classes/Domain/Repository/SitemapRepository.php#L388-L418
43,776
beardcoder/sitemap_generator
Classes/Service/FieldValueService.php
FieldValueService.getFieldValue
public function getFieldValue( $fieldName, $typoScriptUrlEntry, $row ) { // support for cObject if the value is a configuration if (!empty($typoScriptUrlEntry[$fieldName . '.'])) { $this->contentObject->start($row, $typoScriptUrlEntry['table']); return $this->contentObject->cObjGetSingle( $typoScriptUrlEntry[$fieldName], $typoScriptUrlEntry[$fieldName . '.'] ); } return $row[$typoScriptUrlEntry[$fieldName]]; }
php
public function getFieldValue( $fieldName, $typoScriptUrlEntry, $row ) { // support for cObject if the value is a configuration if (!empty($typoScriptUrlEntry[$fieldName . '.'])) { $this->contentObject->start($row, $typoScriptUrlEntry['table']); return $this->contentObject->cObjGetSingle( $typoScriptUrlEntry[$fieldName], $typoScriptUrlEntry[$fieldName . '.'] ); } return $row[$typoScriptUrlEntry[$fieldName]]; }
[ "public", "function", "getFieldValue", "(", "$", "fieldName", ",", "$", "typoScriptUrlEntry", ",", "$", "row", ")", "{", "// support for cObject if the value is a configuration", "if", "(", "!", "empty", "(", "$", "typoScriptUrlEntry", "[", "$", "fieldName", ".", ...
Uses the page's cObj instance to resolve the field's value. @param string $fieldName The name of the field to get. @param array $typoScriptUrlEntry The entry who is defined via typoscript @param array $row @SuppressWarnings(superglobals) @return string The field's value.
[ "Uses", "the", "page", "s", "cObj", "instance", "to", "resolve", "the", "field", "s", "value", "." ]
022d60915ac72d21f31ef34e23ec049a2763578e
https://github.com/beardcoder/sitemap_generator/blob/022d60915ac72d21f31ef34e23ec049a2763578e/Classes/Service/FieldValueService.php#L49-L65
43,777
beardcoder/sitemap_generator
Classes/Service/GoogleSitemapService.php
GoogleSitemapService.sendRequest
public function sendRequest() { $curlInit = curl_init(); curl_setopt($curlInit, CURLOPT_URL, $this->getGoogleSitemapToolUrl()); curl_setopt($curlInit, CURLOPT_HEADER, true); curl_setopt($curlInit, CURLOPT_NOBODY, true); curl_setopt($curlInit, CURLOPT_RETURNTRANSFER, true); curl_exec($curlInit); $httpCode = curl_getinfo($curlInit, CURLINFO_HTTP_CODE); curl_close($curlInit); return $httpCode; }
php
public function sendRequest() { $curlInit = curl_init(); curl_setopt($curlInit, CURLOPT_URL, $this->getGoogleSitemapToolUrl()); curl_setopt($curlInit, CURLOPT_HEADER, true); curl_setopt($curlInit, CURLOPT_NOBODY, true); curl_setopt($curlInit, CURLOPT_RETURNTRANSFER, true); curl_exec($curlInit); $httpCode = curl_getinfo($curlInit, CURLINFO_HTTP_CODE); curl_close($curlInit); return $httpCode; }
[ "public", "function", "sendRequest", "(", ")", "{", "$", "curlInit", "=", "curl_init", "(", ")", ";", "curl_setopt", "(", "$", "curlInit", ",", "CURLOPT_URL", ",", "$", "this", "->", "getGoogleSitemapToolUrl", "(", ")", ")", ";", "curl_setopt", "(", "$", ...
Send the request to google @return int
[ "Send", "the", "request", "to", "google" ]
022d60915ac72d21f31ef34e23ec049a2763578e
https://github.com/beardcoder/sitemap_generator/blob/022d60915ac72d21f31ef34e23ec049a2763578e/Classes/Service/GoogleSitemapService.php#L52-L64
43,778
beardcoder/sitemap_generator
Classes/Service/GoogleSitemapService.php
GoogleSitemapService.getGoogleSitemapToolUrl
protected function getGoogleSitemapToolUrl() { $url = $this->toolUrl . urlencode($this->xmlSiteUrl); if (!GeneralUtility::isValidUrl($url)) { return null; } return $url; }
php
protected function getGoogleSitemapToolUrl() { $url = $this->toolUrl . urlencode($this->xmlSiteUrl); if (!GeneralUtility::isValidUrl($url)) { return null; } return $url; }
[ "protected", "function", "getGoogleSitemapToolUrl", "(", ")", "{", "$", "url", "=", "$", "this", "->", "toolUrl", ".", "urlencode", "(", "$", "this", "->", "xmlSiteUrl", ")", ";", "if", "(", "!", "GeneralUtility", "::", "isValidUrl", "(", "$", "url", ")"...
Generate Google tool url for sitemap submit
[ "Generate", "Google", "tool", "url", "for", "sitemap", "submit" ]
022d60915ac72d21f31ef34e23ec049a2763578e
https://github.com/beardcoder/sitemap_generator/blob/022d60915ac72d21f31ef34e23ec049a2763578e/Classes/Service/GoogleSitemapService.php#L69-L77
43,779
beardcoder/sitemap_generator
Classes/Service/OrderByService.php
OrderByService.getOrderByString
public static function getOrderByString($orderBy, $tablename) { if (isset($orderBy) && !empty($orderBy)) { $cleanOrderByParts = []; $tableColumns = $GLOBALS['TCA'][$tablename]['columns']; $orderByParts = GeneralUtility::trimExplode(',', $orderBy); foreach ($orderByParts as $part) { $subparts = GeneralUtility::trimExplode(' ', $part); if (count($subparts) === 1) { if (is_array($tableColumns[$subparts[0]])) { $cleanOrderByParts[] = $subparts[0]; } } elseif (count($subparts) === 2) { if (is_array($tableColumns[$subparts[0]]) && ($subparts[1] === 'ASC' || $subparts[1] === 'DESC')) { $cleanOrderByParts[] = $subparts[0] . ' ' . $subparts[1]; } } } return implode(',', $cleanOrderByParts); } return ''; }
php
public static function getOrderByString($orderBy, $tablename) { if (isset($orderBy) && !empty($orderBy)) { $cleanOrderByParts = []; $tableColumns = $GLOBALS['TCA'][$tablename]['columns']; $orderByParts = GeneralUtility::trimExplode(',', $orderBy); foreach ($orderByParts as $part) { $subparts = GeneralUtility::trimExplode(' ', $part); if (count($subparts) === 1) { if (is_array($tableColumns[$subparts[0]])) { $cleanOrderByParts[] = $subparts[0]; } } elseif (count($subparts) === 2) { if (is_array($tableColumns[$subparts[0]]) && ($subparts[1] === 'ASC' || $subparts[1] === 'DESC')) { $cleanOrderByParts[] = $subparts[0] . ' ' . $subparts[1]; } } } return implode(',', $cleanOrderByParts); } return ''; }
[ "public", "static", "function", "getOrderByString", "(", "$", "orderBy", ",", "$", "tablename", ")", "{", "if", "(", "isset", "(", "$", "orderBy", ")", "&&", "!", "empty", "(", "$", "orderBy", ")", ")", "{", "$", "cleanOrderByParts", "=", "[", "]", "...
Returns the orderBy statement for database connection @param string $orderBy @param string $tablename @return string
[ "Returns", "the", "orderBy", "statement", "for", "database", "connection" ]
022d60915ac72d21f31ef34e23ec049a2763578e
https://github.com/beardcoder/sitemap_generator/blob/022d60915ac72d21f31ef34e23ec049a2763578e/Classes/Service/OrderByService.php#L31-L54
43,780
beardcoder/sitemap_generator
Classes/Command/TaskCommandController.php
TaskCommandController.googleSitemapToolCommand
public function googleSitemapToolCommand($xmlSiteUrl) { $googleSitemapPing = GeneralUtility::makeInstance(GoogleSitemapService::class, $xmlSiteUrl); $httpCode = $googleSitemapPing->sendRequest(); if ($httpCode === 200) { $this->outputLine('success'); } $this->outputLine('error'); }
php
public function googleSitemapToolCommand($xmlSiteUrl) { $googleSitemapPing = GeneralUtility::makeInstance(GoogleSitemapService::class, $xmlSiteUrl); $httpCode = $googleSitemapPing->sendRequest(); if ($httpCode === 200) { $this->outputLine('success'); } $this->outputLine('error'); }
[ "public", "function", "googleSitemapToolCommand", "(", "$", "xmlSiteUrl", ")", "{", "$", "googleSitemapPing", "=", "GeneralUtility", "::", "makeInstance", "(", "GoogleSitemapService", "::", "class", ",", "$", "xmlSiteUrl", ")", ";", "$", "httpCode", "=", "$", "g...
Send a request to google tools api for the sitemap crawling. @param string $xmlSiteUrl http://www.example.com/sitemap.xml
[ "Send", "a", "request", "to", "google", "tools", "api", "for", "the", "sitemap", "crawling", "." ]
022d60915ac72d21f31ef34e23ec049a2763578e
https://github.com/beardcoder/sitemap_generator/blob/022d60915ac72d21f31ef34e23ec049a2763578e/Classes/Command/TaskCommandController.php#L30-L40
43,781
samuelbednarcik/elastic-apm-php-agent
src/Builder/AbstractEventBuilder.php
AbstractEventBuilder.prepareHeaders
private static function prepareHeaders(HeaderBag $headerBag) { $headers = $headerBag->all(); $result = []; foreach ($headers as $header => $values) { $result[$header] = $values[0]; } return $result; }
php
private static function prepareHeaders(HeaderBag $headerBag) { $headers = $headerBag->all(); $result = []; foreach ($headers as $header => $values) { $result[$header] = $values[0]; } return $result; }
[ "private", "static", "function", "prepareHeaders", "(", "HeaderBag", "$", "headerBag", ")", "{", "$", "headers", "=", "$", "headerBag", "->", "all", "(", ")", ";", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "headers", "as", "$", "header", ...
Get array of headers from header bag @param HeaderBag $headerBag @return array
[ "Get", "array", "of", "headers", "from", "header", "bag" ]
3e6cb56513905b20c707ccb78ae7cfe7a0175648
https://github.com/samuelbednarcik/elastic-apm-php-agent/blob/3e6cb56513905b20c707ccb78ae7cfe7a0175648/src/Builder/AbstractEventBuilder.php#L60-L70
43,782
mcaskill/composer-plugin-exclude-files
src/ExcludeFilePlugin.php
ExcludeFilePlugin.parseAutoloads
public function parseAutoloads() { /** @var Composer $composer */ $composer = $this->composer; /** @var Package $package */ $package = $composer->getPackage(); if (!$package) { return; } $exclude = $this->getExcludedFiles($package); if (!$exclude) { return; } $filesystem = new Filesystem(); $config = $composer->getConfig(); $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir')))); $exclude = $this->parseExcludedFiles($exclude, $vendorPath); $generator = $composer->getAutoloadGenerator(); $packages = $composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages(); $packageMap = $generator->buildPackageMap($composer->getInstallationManager(), $package, $packages); $this->filterAutoloads($packageMap, $package, $exclude); }
php
public function parseAutoloads() { /** @var Composer $composer */ $composer = $this->composer; /** @var Package $package */ $package = $composer->getPackage(); if (!$package) { return; } $exclude = $this->getExcludedFiles($package); if (!$exclude) { return; } $filesystem = new Filesystem(); $config = $composer->getConfig(); $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir')))); $exclude = $this->parseExcludedFiles($exclude, $vendorPath); $generator = $composer->getAutoloadGenerator(); $packages = $composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages(); $packageMap = $generator->buildPackageMap($composer->getInstallationManager(), $package, $packages); $this->filterAutoloads($packageMap, $package, $exclude); }
[ "public", "function", "parseAutoloads", "(", ")", "{", "/** @var Composer $composer */", "$", "composer", "=", "$", "this", "->", "composer", ";", "/** @var Package $package */", "$", "package", "=", "$", "composer", "->", "getPackage", "(", ")", ";", "if", "(",...
Parse the vendor 'files' to be included before the autoloader is dumped. @return void
[ "Parse", "the", "vendor", "files", "to", "be", "included", "before", "the", "autoloader", "is", "dumped", "." ]
81fdd0def4d3aa9c26715f1108706ae92ab0a98c
https://github.com/mcaskill/composer-plugin-exclude-files/blob/81fdd0def4d3aa9c26715f1108706ae92ab0a98c/src/ExcludeFilePlugin.php#L63-L90
43,783
mcaskill/composer-plugin-exclude-files
src/ExcludeFilePlugin.php
ExcludeFilePlugin.filterAutoloads
private function filterAutoloads(array $packageMap, PackageInterface $mainPackage, array $blacklist = null) { $type = self::INCLUDE_FILES_PROPERTY; $blacklist = array_flip($blacklist); foreach ($packageMap as $item) { list($package, $installPath) = $item; // Skip root package if ($package === $mainPackage) { continue; } $autoload = $package->getAutoload(); // Skip misconfigured packages if (!isset($autoload[$type]) || !is_array($autoload[$type])) { continue; } if (null !== $package->getTargetDir()) { $installPath = substr($installPath, 0, -strlen('/' . $package->getTargetDir())); } foreach ($autoload[$type] as $key => $path) { if ($package->getTargetDir() && !is_readable($installPath.'/'.$path)) { // add target-dir from file paths that don't have it $path = $package->getTargetDir() . '/' . $path; } $resolvedPath = $installPath . '/' . $path; $resolvedPath = strtr($resolvedPath, '\\', '/'); if (isset($blacklist[$resolvedPath])) { unset($autoload[$type][$key]); } } $package->setAutoload($autoload); } }
php
private function filterAutoloads(array $packageMap, PackageInterface $mainPackage, array $blacklist = null) { $type = self::INCLUDE_FILES_PROPERTY; $blacklist = array_flip($blacklist); foreach ($packageMap as $item) { list($package, $installPath) = $item; // Skip root package if ($package === $mainPackage) { continue; } $autoload = $package->getAutoload(); // Skip misconfigured packages if (!isset($autoload[$type]) || !is_array($autoload[$type])) { continue; } if (null !== $package->getTargetDir()) { $installPath = substr($installPath, 0, -strlen('/' . $package->getTargetDir())); } foreach ($autoload[$type] as $key => $path) { if ($package->getTargetDir() && !is_readable($installPath.'/'.$path)) { // add target-dir from file paths that don't have it $path = $package->getTargetDir() . '/' . $path; } $resolvedPath = $installPath . '/' . $path; $resolvedPath = strtr($resolvedPath, '\\', '/'); if (isset($blacklist[$resolvedPath])) { unset($autoload[$type][$key]); } } $package->setAutoload($autoload); } }
[ "private", "function", "filterAutoloads", "(", "array", "$", "packageMap", ",", "PackageInterface", "$", "mainPackage", ",", "array", "$", "blacklist", "=", "null", ")", "{", "$", "type", "=", "self", "::", "INCLUDE_FILES_PROPERTY", ";", "$", "blacklist", "=",...
Alters packages to exclude files required in "autoload.files" by "extra.exclude-from-files". @param array $packageMap Array of `[ package, installDir-relative-to-composer.json) ]`. @param PackageInterface $mainPackage Root package instance. @param string[] $blacklist The files to exclude from the "files" autoload mechanism. @return void
[ "Alters", "packages", "to", "exclude", "files", "required", "in", "autoload", ".", "files", "by", "extra", ".", "exclude", "-", "from", "-", "files", "." ]
81fdd0def4d3aa9c26715f1108706ae92ab0a98c
https://github.com/mcaskill/composer-plugin-exclude-files/blob/81fdd0def4d3aa9c26715f1108706ae92ab0a98c/src/ExcludeFilePlugin.php#L100-L141
43,784
mcaskill/composer-plugin-exclude-files
src/ExcludeFilePlugin.php
ExcludeFilePlugin.getExcludedFiles
private function getExcludedFiles(PackageInterface $package) { $type = self::EXCLUDE_FILES_PROPERTY; $autoload = $package->getAutoload(); // Skip misconfigured or empty packages if (isset($autoload[$type]) && is_array($autoload[$type])) { return $autoload[$type]; } $extra = $package->getExtra(); // Skip misconfigured or empty packages if (isset($extra[$type]) && is_array($extra[$type])) { return $extra[$type]; } return null; }
php
private function getExcludedFiles(PackageInterface $package) { $type = self::EXCLUDE_FILES_PROPERTY; $autoload = $package->getAutoload(); // Skip misconfigured or empty packages if (isset($autoload[$type]) && is_array($autoload[$type])) { return $autoload[$type]; } $extra = $package->getExtra(); // Skip misconfigured or empty packages if (isset($extra[$type]) && is_array($extra[$type])) { return $extra[$type]; } return null; }
[ "private", "function", "getExcludedFiles", "(", "PackageInterface", "$", "package", ")", "{", "$", "type", "=", "self", "::", "EXCLUDE_FILES_PROPERTY", ";", "$", "autoload", "=", "$", "package", "->", "getAutoload", "(", ")", ";", "// Skip misconfigured or empty p...
Gets a list files the root package wants to exclude. @param PackageInterface $package Root package instance. @return array|null Retuns the list of excluded files otherwise NULL if misconfigured or undefined.
[ "Gets", "a", "list", "files", "the", "root", "package", "wants", "to", "exclude", "." ]
81fdd0def4d3aa9c26715f1108706ae92ab0a98c
https://github.com/mcaskill/composer-plugin-exclude-files/blob/81fdd0def4d3aa9c26715f1108706ae92ab0a98c/src/ExcludeFilePlugin.php#L149-L168
43,785
mcaskill/composer-plugin-exclude-files
src/ExcludeFilePlugin.php
ExcludeFilePlugin.parseExcludedFiles
private function parseExcludedFiles(array $paths, $vendorPath) { foreach ($paths as &$path) { $path = preg_replace('{/+}', '/', trim(strtr($path, '\\', '/'), '/')); $path = $vendorPath . '/' . $path; } return $paths; }
php
private function parseExcludedFiles(array $paths, $vendorPath) { foreach ($paths as &$path) { $path = preg_replace('{/+}', '/', trim(strtr($path, '\\', '/'), '/')); $path = $vendorPath . '/' . $path; } return $paths; }
[ "private", "function", "parseExcludedFiles", "(", "array", "$", "paths", ",", "$", "vendorPath", ")", "{", "foreach", "(", "$", "paths", "as", "&", "$", "path", ")", "{", "$", "path", "=", "preg_replace", "(", "'{/+}'", ",", "'/'", ",", "trim", "(", ...
Prepends the vendor directory to each path in "extra.exclude-from-files". @param string[] $paths Array of paths absolute from the vendor directory. @param string $vendorPath The directory for installed dependencies. @return array Retuns the list of excluded files, prepended with the vendor directory.
[ "Prepends", "the", "vendor", "directory", "to", "each", "path", "in", "extra", ".", "exclude", "-", "from", "-", "files", "." ]
81fdd0def4d3aa9c26715f1108706ae92ab0a98c
https://github.com/mcaskill/composer-plugin-exclude-files/blob/81fdd0def4d3aa9c26715f1108706ae92ab0a98c/src/ExcludeFilePlugin.php#L177-L185
43,786
schulzefelix/laravel-data-transfer-object
src/DataTransferObject.php
DataTransferObject.getAttribute
public function getAttribute($key) { if (! $key) { return; } if (array_key_exists($key, $this->attributes) || $this->hasGetMutator($key)) { return $this->getAttributeValue($key); } if (method_exists(self::class, $key)) { return; } }
php
public function getAttribute($key) { if (! $key) { return; } if (array_key_exists($key, $this->attributes) || $this->hasGetMutator($key)) { return $this->getAttributeValue($key); } if (method_exists(self::class, $key)) { return; } }
[ "public", "function", "getAttribute", "(", "$", "key", ")", "{", "if", "(", "!", "$", "key", ")", "{", "return", ";", "}", "if", "(", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "attributes", ")", "||", "$", "this", "->", "hasGetMu...
Get an attribute from the object. @param string $key @return mixed
[ "Get", "an", "attribute", "from", "the", "object", "." ]
932134ca8542d903e5e9d5dbb5b9e23fa24ecd95
https://github.com/schulzefelix/laravel-data-transfer-object/blob/932134ca8542d903e5e9d5dbb5b9e23fa24ecd95/src/DataTransferObject.php#L137-L150
43,787
schulzefelix/laravel-data-transfer-object
src/DataTransferObject.php
DataTransferObject.fillJsonAttribute
public function fillJsonAttribute($key, $value) { list($key, $path) = explode('->', $key, 2); $arrayValue = isset($this->attributes[$key]) ? $this->fromJson($this->attributes[$key]) : []; Arr::set($arrayValue, str_replace('->', '.', $path), $value); $this->attributes[$key] = $this->asJson($arrayValue); return $this; }
php
public function fillJsonAttribute($key, $value) { list($key, $path) = explode('->', $key, 2); $arrayValue = isset($this->attributes[$key]) ? $this->fromJson($this->attributes[$key]) : []; Arr::set($arrayValue, str_replace('->', '.', $path), $value); $this->attributes[$key] = $this->asJson($arrayValue); return $this; }
[ "public", "function", "fillJsonAttribute", "(", "$", "key", ",", "$", "value", ")", "{", "list", "(", "$", "key", ",", "$", "path", ")", "=", "explode", "(", "'->'", ",", "$", "key", ",", "2", ")", ";", "$", "arrayValue", "=", "isset", "(", "$", ...
Set a given JSON attribute on the object. @param string $key @param mixed $value @return $this
[ "Set", "a", "given", "JSON", "attribute", "on", "the", "object", "." ]
932134ca8542d903e5e9d5dbb5b9e23fa24ecd95
https://github.com/schulzefelix/laravel-data-transfer-object/blob/932134ca8542d903e5e9d5dbb5b9e23fa24ecd95/src/DataTransferObject.php#L545-L556
43,788
schulzefelix/laravel-data-transfer-object
src/DataTransferObject.php
DataTransferObject.nestedObjectsToArray
public function nestedObjectsToArray() { $attributes = []; foreach ($this->getAttributes() as $key => $value) { // If the values implements the Arrayable interface we can just call this // toArray method on the instances which will convert both objects and // collections to their proper array form and we'll set the values. if ($value instanceof Arrayable) { $attributes[$key] = $value->toArray(); } if (is_array($value)) { $attributes[$key] = collect($value)->toArray(); } } return $attributes; }
php
public function nestedObjectsToArray() { $attributes = []; foreach ($this->getAttributes() as $key => $value) { // If the values implements the Arrayable interface we can just call this // toArray method on the instances which will convert both objects and // collections to their proper array form and we'll set the values. if ($value instanceof Arrayable) { $attributes[$key] = $value->toArray(); } if (is_array($value)) { $attributes[$key] = collect($value)->toArray(); } } return $attributes; }
[ "public", "function", "nestedObjectsToArray", "(", ")", "{", "$", "attributes", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getAttributes", "(", ")", "as", "$", "key", "=>", "$", "value", ")", "{", "// If the values implements the Arrayable interfa...
Get the object's nested objects in array form. @return array
[ "Get", "the", "object", "s", "nested", "objects", "in", "array", "form", "." ]
932134ca8542d903e5e9d5dbb5b9e23fa24ecd95
https://github.com/schulzefelix/laravel-data-transfer-object/blob/932134ca8542d903e5e9d5dbb5b9e23fa24ecd95/src/DataTransferObject.php#L601-L618
43,789
schulzefelix/laravel-data-transfer-object
src/DataTransferObject.php
DataTransferObject.attributesToArray
public function attributesToArray() { $attributes = $this->attributes; // If an attribute is a date, we will cast it to a string after converting it // to a DateTime / Carbon instance. This is so we will get some consistent // formatting while accessing attributes vs. arraying / JSONing a object. foreach ($this->getDates() as $key) { if (! isset($attributes[$key])) { continue; } $attributes[$key] = $this->serializeDate( $this->asDateTime($attributes[$key]) ); } $mutatedAttributes = $this->getMutatedAttributes(); // We want to spin through all the mutated attributes for this object and call // the mutator for the attribute. We cache off every mutated attributes so // we don't have to constantly check on attributes that actually change. foreach ($mutatedAttributes as $key) { if (! array_key_exists($key, $attributes)) { continue; } $attributes[$key] = $this->mutateAttributeForArray( $key, $attributes[$key] ); } // Next we will handle any casts that have been setup for this object and cast // the values to their appropriate type. If the attribute has a mutator we // will not perform the cast on those attributes to avoid any confusion. foreach ($this->getCasts() as $key => $value) { if (! array_key_exists($key, $attributes) || in_array($key, $mutatedAttributes)) { continue; } $attributes[$key] = $this->castAttribute( $key, $attributes[$key] ); if ($attributes[$key] && ($value === 'date' || $value === 'datetime')) { $attributes[$key] = $this->serializeDate($attributes[$key]); } } return $attributes; }
php
public function attributesToArray() { $attributes = $this->attributes; // If an attribute is a date, we will cast it to a string after converting it // to a DateTime / Carbon instance. This is so we will get some consistent // formatting while accessing attributes vs. arraying / JSONing a object. foreach ($this->getDates() as $key) { if (! isset($attributes[$key])) { continue; } $attributes[$key] = $this->serializeDate( $this->asDateTime($attributes[$key]) ); } $mutatedAttributes = $this->getMutatedAttributes(); // We want to spin through all the mutated attributes for this object and call // the mutator for the attribute. We cache off every mutated attributes so // we don't have to constantly check on attributes that actually change. foreach ($mutatedAttributes as $key) { if (! array_key_exists($key, $attributes)) { continue; } $attributes[$key] = $this->mutateAttributeForArray( $key, $attributes[$key] ); } // Next we will handle any casts that have been setup for this object and cast // the values to their appropriate type. If the attribute has a mutator we // will not perform the cast on those attributes to avoid any confusion. foreach ($this->getCasts() as $key => $value) { if (! array_key_exists($key, $attributes) || in_array($key, $mutatedAttributes)) { continue; } $attributes[$key] = $this->castAttribute( $key, $attributes[$key] ); if ($attributes[$key] && ($value === 'date' || $value === 'datetime')) { $attributes[$key] = $this->serializeDate($attributes[$key]); } } return $attributes; }
[ "public", "function", "attributesToArray", "(", ")", "{", "$", "attributes", "=", "$", "this", "->", "attributes", ";", "// If an attribute is a date, we will cast it to a string after converting it", "// to a DateTime / Carbon instance. This is so we will get some consistent", "// f...
Convert the object's attributes to an array. @return array
[ "Convert", "the", "object", "s", "attributes", "to", "an", "array", "." ]
932134ca8542d903e5e9d5dbb5b9e23fa24ecd95
https://github.com/schulzefelix/laravel-data-transfer-object/blob/932134ca8542d903e5e9d5dbb5b9e23fa24ecd95/src/DataTransferObject.php#L625-L676
43,790
samuelbednarcik/elastic-apm-php-agent
src/EventIntakeRequest.php
EventIntakeRequest.getRequestBody
public function getRequestBody(): string { if ($this->metadata === null) { throw new BadEventRequestException('Metadata must be defined!'); } $json = $this->serializer->encode( ['metadata' => $this->serializer->normalize($this->metadata)], JsonEncoder::FORMAT ); $json .= "\n"; foreach ($this->transactions as $transaction) { $json .= "\n"; $json .= $this->serializer->encode( ['transaction' => $this->serializer->normalize($transaction)], JsonEncoder::FORMAT ); } $json .= "\n"; foreach ($this->spans as $span) { $json .= "\n"; $json .= $this->serializer->encode( ['span' => $this->serializer->normalize($span)], JsonEncoder::FORMAT ); } $json .= "\n"; foreach ($this->errors as $error) { $json .= "\n"; $json .= $this->serializer->encode( ['error' => $this->serializer->normalize($error)], JsonEncoder::FORMAT ); } return $json; }
php
public function getRequestBody(): string { if ($this->metadata === null) { throw new BadEventRequestException('Metadata must be defined!'); } $json = $this->serializer->encode( ['metadata' => $this->serializer->normalize($this->metadata)], JsonEncoder::FORMAT ); $json .= "\n"; foreach ($this->transactions as $transaction) { $json .= "\n"; $json .= $this->serializer->encode( ['transaction' => $this->serializer->normalize($transaction)], JsonEncoder::FORMAT ); } $json .= "\n"; foreach ($this->spans as $span) { $json .= "\n"; $json .= $this->serializer->encode( ['span' => $this->serializer->normalize($span)], JsonEncoder::FORMAT ); } $json .= "\n"; foreach ($this->errors as $error) { $json .= "\n"; $json .= $this->serializer->encode( ['error' => $this->serializer->normalize($error)], JsonEncoder::FORMAT ); } return $json; }
[ "public", "function", "getRequestBody", "(", ")", ":", "string", "{", "if", "(", "$", "this", "->", "metadata", "===", "null", ")", "{", "throw", "new", "BadEventRequestException", "(", "'Metadata must be defined!'", ")", ";", "}", "$", "json", "=", "$", "...
Returns NDJSON request body @throws BadEventRequestException
[ "Returns", "NDJSON", "request", "body" ]
3e6cb56513905b20c707ccb78ae7cfe7a0175648
https://github.com/samuelbednarcik/elastic-apm-php-agent/blob/3e6cb56513905b20c707ccb78ae7cfe7a0175648/src/EventIntakeRequest.php#L143-L185
43,791
samuelbednarcik/elastic-apm-php-agent
src/Agent.php
Agent.collect
private function collect(): array { $spans = []; foreach ($this->collectors as $collector) { foreach ($collector->getSpans() as $span) { $spans[] = $this->prepareSpan($span); } } return $spans; }
php
private function collect(): array { $spans = []; foreach ($this->collectors as $collector) { foreach ($collector->getSpans() as $span) { $spans[] = $this->prepareSpan($span); } } return $spans; }
[ "private", "function", "collect", "(", ")", ":", "array", "{", "$", "spans", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "collectors", "as", "$", "collector", ")", "{", "foreach", "(", "$", "collector", "->", "getSpans", "(", ")", "as", ...
Collect spans from registered collectors @return Span[] @throws \Exception
[ "Collect", "spans", "from", "registered", "collectors" ]
3e6cb56513905b20c707ccb78ae7cfe7a0175648
https://github.com/samuelbednarcik/elastic-apm-php-agent/blob/3e6cb56513905b20c707ccb78ae7cfe7a0175648/src/Agent.php#L150-L161
43,792
samuelbednarcik/elastic-apm-php-agent
src/Agent.php
Agent.prepareTransaction
private function prepareTransaction() { $this->transaction->setSpanCount([ 'started' => count($this->spans) ]); if (empty($this->transaction->getContext()) || empty($this->spans)) { $this->transaction->setSampled(false); } }
php
private function prepareTransaction() { $this->transaction->setSpanCount([ 'started' => count($this->spans) ]); if (empty($this->transaction->getContext()) || empty($this->spans)) { $this->transaction->setSampled(false); } }
[ "private", "function", "prepareTransaction", "(", ")", "{", "$", "this", "->", "transaction", "->", "setSpanCount", "(", "[", "'started'", "=>", "count", "(", "$", "this", "->", "spans", ")", "]", ")", ";", "if", "(", "empty", "(", "$", "this", "->", ...
Prepare transaction for sending to APM.
[ "Prepare", "transaction", "for", "sending", "to", "APM", "." ]
3e6cb56513905b20c707ccb78ae7cfe7a0175648
https://github.com/samuelbednarcik/elastic-apm-php-agent/blob/3e6cb56513905b20c707ccb78ae7cfe7a0175648/src/Agent.php#L199-L208
43,793
samuelbednarcik/elastic-apm-php-agent
src/Agent.php
Agent.prepareSpan
private function prepareSpan(Span $span): Span { $span->setTransactionId($this->transaction->getId()); $span->setTraceId($this->transaction->getTraceId()); if ($span->getId() === null) { $span->setId(AbstractEventBuilder::generateRandomBitsInHex(64)); } if ($span->getParentId() === null) { $span->setParentId($this->transaction->getId()); } if ($span->getStart() === null) { $span->setStart( intval(round(($span->getTimestamp() - $this->transaction->getTimestamp()) / 1000)) ); } return $span; }
php
private function prepareSpan(Span $span): Span { $span->setTransactionId($this->transaction->getId()); $span->setTraceId($this->transaction->getTraceId()); if ($span->getId() === null) { $span->setId(AbstractEventBuilder::generateRandomBitsInHex(64)); } if ($span->getParentId() === null) { $span->setParentId($this->transaction->getId()); } if ($span->getStart() === null) { $span->setStart( intval(round(($span->getTimestamp() - $this->transaction->getTimestamp()) / 1000)) ); } return $span; }
[ "private", "function", "prepareSpan", "(", "Span", "$", "span", ")", ":", "Span", "{", "$", "span", "->", "setTransactionId", "(", "$", "this", "->", "transaction", "->", "getId", "(", ")", ")", ";", "$", "span", "->", "setTraceId", "(", "$", "this", ...
Prepare span for for sending to APM. @param Span $span @return Span @throws \Exception
[ "Prepare", "span", "for", "for", "sending", "to", "APM", "." ]
3e6cb56513905b20c707ccb78ae7cfe7a0175648
https://github.com/samuelbednarcik/elastic-apm-php-agent/blob/3e6cb56513905b20c707ccb78ae7cfe7a0175648/src/Agent.php#L216-L236
43,794
yii2mod/yii2-ftp
FtpClient.php
FtpClient.connect
public function connect($host, $ssl = false, $port = 21, $timeout = 90) { if ($ssl) { $this->conn = @$this->ftp->ssl_connect($host, $port, $timeout); } else { $this->conn = @$this->ftp->connect($host, $port, $timeout); } if (!$this->conn) { throw new FtpException('Unable to connect'); } return $this; }
php
public function connect($host, $ssl = false, $port = 21, $timeout = 90) { if ($ssl) { $this->conn = @$this->ftp->ssl_connect($host, $port, $timeout); } else { $this->conn = @$this->ftp->connect($host, $port, $timeout); } if (!$this->conn) { throw new FtpException('Unable to connect'); } return $this; }
[ "public", "function", "connect", "(", "$", "host", ",", "$", "ssl", "=", "false", ",", "$", "port", "=", "21", ",", "$", "timeout", "=", "90", ")", "{", "if", "(", "$", "ssl", ")", "{", "$", "this", "->", "conn", "=", "@", "$", "this", "->", ...
Open a FTP connection @param string $host @param bool $ssl @param int $port @param int $timeout @return FTPClient @throws FtpException If unable to connect
[ "Open", "a", "FTP", "connection" ]
7ff81d63d80a7bc6ff4f24668d82ac9b77fe79a2
https://github.com/yii2mod/yii2-ftp/blob/7ff81d63d80a7bc6ff4f24668d82ac9b77fe79a2/FtpClient.php#L153-L165
43,795
yii2mod/yii2-ftp
FtpClient.php
FtpClient.rawlist
public function rawlist($directory = '.', $recursive = false, $includeHidden = false) { if (!$this->isDir($directory)) { throw new FtpException('"' . $directory . '" is not a directory.'); } if ($includeHidden) { $directory = "-la $directory"; } $list = $this->ftp->rawlist($directory); if (false === $list) { // $list can be false, convert to empty array $list = []; } $items = []; if (false == $recursive) { foreach ($list as $path => $item) { $chunks = preg_split("/\s+/", $item); // if not "name" if (empty($chunks[8]) || $chunks[8] == '.' || $chunks[8] == '..') { continue; } $path = $directory . '/' . $chunks[8]; if (substr($path, 0, 2) == './') { $path = substr($path, 2); } $items[$this->rawToType($item) . '#' . $path] = $item; } return $items; } foreach ($list as $item) { $len = strlen($item); if (!$len // "." || ($item[$len - 1] == '.' && $item[$len - 2] == ' ' // ".." or $item[$len - 1] == '.' && $item[$len - 2] == '.' && $item[$len - 3] == ' ') ) { continue; } $chunks = preg_split("/\s+/", $item); // if not "name" if (empty($chunks[8]) || $chunks[8] == '.' || $chunks[8] == '..') { continue; } $path = $directory . '/' . $chunks[8]; if (substr($path, 0, 2) == './') { $path = substr($path, 2); } $items[$this->rawToType($item) . '#' . $path] = $item; if ($item[0] == 'd') { $sublist = $this->rawlist($path, true); foreach ($sublist as $subpath => $subitem) { $items[$subpath] = $subitem; } } } return $items; }
php
public function rawlist($directory = '.', $recursive = false, $includeHidden = false) { if (!$this->isDir($directory)) { throw new FtpException('"' . $directory . '" is not a directory.'); } if ($includeHidden) { $directory = "-la $directory"; } $list = $this->ftp->rawlist($directory); if (false === $list) { // $list can be false, convert to empty array $list = []; } $items = []; if (false == $recursive) { foreach ($list as $path => $item) { $chunks = preg_split("/\s+/", $item); // if not "name" if (empty($chunks[8]) || $chunks[8] == '.' || $chunks[8] == '..') { continue; } $path = $directory . '/' . $chunks[8]; if (substr($path, 0, 2) == './') { $path = substr($path, 2); } $items[$this->rawToType($item) . '#' . $path] = $item; } return $items; } foreach ($list as $item) { $len = strlen($item); if (!$len // "." || ($item[$len - 1] == '.' && $item[$len - 2] == ' ' // ".." or $item[$len - 1] == '.' && $item[$len - 2] == '.' && $item[$len - 3] == ' ') ) { continue; } $chunks = preg_split("/\s+/", $item); // if not "name" if (empty($chunks[8]) || $chunks[8] == '.' || $chunks[8] == '..') { continue; } $path = $directory . '/' . $chunks[8]; if (substr($path, 0, 2) == './') { $path = substr($path, 2); } $items[$this->rawToType($item) . '#' . $path] = $item; if ($item[0] == 'd') { $sublist = $this->rawlist($path, true); foreach ($sublist as $subpath => $subitem) { $items[$subpath] = $subitem; } } } return $items; }
[ "public", "function", "rawlist", "(", "$", "directory", "=", "'.'", ",", "$", "recursive", "=", "false", ",", "$", "includeHidden", "=", "false", ")", "{", "if", "(", "!", "$", "this", "->", "isDir", "(", "$", "directory", ")", ")", "{", "throw", "...
Returns a detailed list of files in the given directory. @see FtpClient::nlist() @see FtpClient::scanDir() @see FtpClient::dirSize() @param string $directory The directory, by default is the current directory @param bool $recursive @param bool $includeHidden @return array @throws FtpException
[ "Returns", "a", "detailed", "list", "of", "files", "in", "the", "given", "directory", "." ]
7ff81d63d80a7bc6ff4f24668d82ac9b77fe79a2
https://github.com/yii2mod/yii2-ftp/blob/7ff81d63d80a7bc6ff4f24668d82ac9b77fe79a2/FtpClient.php#L661-L724
43,796
yii2mod/yii2-ftp
FtpClient.php
FtpClient.parseRawList
public function parseRawList(array $rawlist) { $items = []; $path = ''; foreach ($rawlist as $key => $child) { $chunks = preg_split("/\s+/", $child); if (isset($chunks[8]) && ($chunks[8] == '.' or $chunks[8] == '..')) { continue; } if (count($chunks) === 1) { $len = strlen($chunks[0]); if ($len && $chunks[0][$len - 1] == ':') { $path = substr($chunks[0], 0, -1); } continue; } // $chunks[8] and up contains filename (multiple elements if filename contains spaces) // up to last element or element containing '->' (if type is 'link') $target = ''; $linkArrowElement = array_search('->', $chunks); if ($linkArrowElement !== false) { $filenameChunks = array_slice($chunks, 8, count($chunks) - $linkArrowElement - 1); $filename = implode(' ', $filenameChunks); $targetChunks = array_slice($chunks, $linkArrowElement + 1); $target = implode(' ', $targetChunks); } else { $filenameChunks = array_slice($chunks, 8); $filename = implode(' ', $filenameChunks); } $item = [ 'permissions' => $chunks[0], 'number' => $chunks[1], 'owner' => $chunks[2], 'group' => $chunks[3], 'size' => $chunks[4], 'month' => $chunks[5], 'day' => $chunks[6], 'time' => $chunks[7], 'name' => $filename, 'type' => $this->rawToType($chunks[0]), ]; if ($item['type'] == 'link') { $item['target'] = $target; } // if the key is not the path, behavior of ftp_rawlist() PHP function if (is_int($key) || false === strpos($key, $item['name'])) { array_splice($chunks, 0, 8); $key = $item['type'] . '#' . ($path ? $path . '/' : '') . implode(' ', $chunks); if ($item['type'] == 'link') { // get the first part of 'link#the-link.ext -> /path/of/the/source.ext' $exp = explode(' ->', $key); $key = rtrim($exp[0]); } $items[$key] = $item; } else { // the key is the path, behavior of FtpClient::rawlist() method() $items[$key] = $item; } } return $items; }
php
public function parseRawList(array $rawlist) { $items = []; $path = ''; foreach ($rawlist as $key => $child) { $chunks = preg_split("/\s+/", $child); if (isset($chunks[8]) && ($chunks[8] == '.' or $chunks[8] == '..')) { continue; } if (count($chunks) === 1) { $len = strlen($chunks[0]); if ($len && $chunks[0][$len - 1] == ':') { $path = substr($chunks[0], 0, -1); } continue; } // $chunks[8] and up contains filename (multiple elements if filename contains spaces) // up to last element or element containing '->' (if type is 'link') $target = ''; $linkArrowElement = array_search('->', $chunks); if ($linkArrowElement !== false) { $filenameChunks = array_slice($chunks, 8, count($chunks) - $linkArrowElement - 1); $filename = implode(' ', $filenameChunks); $targetChunks = array_slice($chunks, $linkArrowElement + 1); $target = implode(' ', $targetChunks); } else { $filenameChunks = array_slice($chunks, 8); $filename = implode(' ', $filenameChunks); } $item = [ 'permissions' => $chunks[0], 'number' => $chunks[1], 'owner' => $chunks[2], 'group' => $chunks[3], 'size' => $chunks[4], 'month' => $chunks[5], 'day' => $chunks[6], 'time' => $chunks[7], 'name' => $filename, 'type' => $this->rawToType($chunks[0]), ]; if ($item['type'] == 'link') { $item['target'] = $target; } // if the key is not the path, behavior of ftp_rawlist() PHP function if (is_int($key) || false === strpos($key, $item['name'])) { array_splice($chunks, 0, 8); $key = $item['type'] . '#' . ($path ? $path . '/' : '') . implode(' ', $chunks); if ($item['type'] == 'link') { // get the first part of 'link#the-link.ext -> /path/of/the/source.ext' $exp = explode(' ->', $key); $key = rtrim($exp[0]); } $items[$key] = $item; } else { // the key is the path, behavior of FtpClient::rawlist() method() $items[$key] = $item; } } return $items; }
[ "public", "function", "parseRawList", "(", "array", "$", "rawlist", ")", "{", "$", "items", "=", "[", "]", ";", "$", "path", "=", "''", ";", "foreach", "(", "$", "rawlist", "as", "$", "key", "=>", "$", "child", ")", "{", "$", "chunks", "=", "preg...
Parse raw list @see FtpClient::rawlist() @see FtpClient::scanDir() @see FtpClient::dirSize() @param array $rawlist @return array
[ "Parse", "raw", "list" ]
7ff81d63d80a7bc6ff4f24668d82ac9b77fe79a2
https://github.com/yii2mod/yii2-ftp/blob/7ff81d63d80a7bc6ff4f24668d82ac9b77fe79a2/FtpClient.php#L737-L800
43,797
keenlabs/KeenClient-PHP
src/Client/KeenIOClient.php
KeenIOClient.factory
public static function factory($config = array()) { $default = array( 'masterKey' => null, 'writeKey' => null, 'readKey' => null, 'projectId' => null, 'organizationKey' => null, 'organizationId' => null, 'version' => '3.0', 'headers' => array( 'Keen-Sdk' => 'php-' . self::VERSION ) ); // Create client configuration $config = self::parseConfig($config, $default); $file = 'keen-io-' . str_replace('.', '_', $config['version']) . '.php'; // Create the new Keen IO Client with our Configuration return new self( new Client($config), new Description(include __DIR__ . "/Resources/{$file}"), null, function ($arg) { return json_decode($arg->getBody(), true); }, null, $config ); }
php
public static function factory($config = array()) { $default = array( 'masterKey' => null, 'writeKey' => null, 'readKey' => null, 'projectId' => null, 'organizationKey' => null, 'organizationId' => null, 'version' => '3.0', 'headers' => array( 'Keen-Sdk' => 'php-' . self::VERSION ) ); // Create client configuration $config = self::parseConfig($config, $default); $file = 'keen-io-' . str_replace('.', '_', $config['version']) . '.php'; // Create the new Keen IO Client with our Configuration return new self( new Client($config), new Description(include __DIR__ . "/Resources/{$file}"), null, function ($arg) { return json_decode($arg->getBody(), true); }, null, $config ); }
[ "public", "static", "function", "factory", "(", "$", "config", "=", "array", "(", ")", ")", "{", "$", "default", "=", "array", "(", "'masterKey'", "=>", "null", ",", "'writeKey'", "=>", "null", ",", "'readKey'", "=>", "null", ",", "'projectId'", "=>", ...
Factory to create new KeenIOClient instance. @param array $config @returns \KeenIO\Client\KeenIOClient
[ "Factory", "to", "create", "new", "KeenIOClient", "instance", "." ]
883b75cb64327211d83d5756caa3fd7a17eabdbc
https://github.com/keenlabs/KeenClient-PHP/blob/883b75cb64327211d83d5756caa3fd7a17eabdbc/src/Client/KeenIOClient.php#L54-L85
43,798
keenlabs/KeenClient-PHP
src/Client/KeenIOClient.php
KeenIOClient.createScopedKey
public function createScopedKey($filters, $allowedOperations) { if (!$masterKey = $this->getMasterKey()) { throw new RuntimeException('A master key is needed to create a scoped key'); } $options = array('filters' => $filters); if (!empty($allowedOperations)) { $options['allowed_operations'] = $allowedOperations; } $apiKey = pack('H*', $masterKey); $opensslOptions = \OPENSSL_RAW_DATA; $optionsJson = json_encode($options); /** * Use the old block size and hex string input if using a legacy master key. * Old block size was 32 bytes and old master key was 32 hex characters in length. */ if (strlen($masterKey) == 32) { $apiKey = $masterKey; // Openssl's built-in PKCS7 padding won't use the 32 bytes block size, so apply it in userland // and use OPENSSL zero padding (no-op as already padded) $opensslOptions |= \OPENSSL_ZERO_PADDING; $optionsJson = $this->padString($optionsJson, 32); } $cipher = 'AES-256-CBC'; $ivLength = openssl_cipher_iv_length($cipher); $iv = random_bytes($ivLength); $encrypted = openssl_encrypt($optionsJson, $cipher, $apiKey, $opensslOptions, $iv); $ivHex = bin2hex($iv); $encryptedHex = bin2hex($encrypted); $scopedKey = $ivHex . $encryptedHex; return $scopedKey; }
php
public function createScopedKey($filters, $allowedOperations) { if (!$masterKey = $this->getMasterKey()) { throw new RuntimeException('A master key is needed to create a scoped key'); } $options = array('filters' => $filters); if (!empty($allowedOperations)) { $options['allowed_operations'] = $allowedOperations; } $apiKey = pack('H*', $masterKey); $opensslOptions = \OPENSSL_RAW_DATA; $optionsJson = json_encode($options); /** * Use the old block size and hex string input if using a legacy master key. * Old block size was 32 bytes and old master key was 32 hex characters in length. */ if (strlen($masterKey) == 32) { $apiKey = $masterKey; // Openssl's built-in PKCS7 padding won't use the 32 bytes block size, so apply it in userland // and use OPENSSL zero padding (no-op as already padded) $opensslOptions |= \OPENSSL_ZERO_PADDING; $optionsJson = $this->padString($optionsJson, 32); } $cipher = 'AES-256-CBC'; $ivLength = openssl_cipher_iv_length($cipher); $iv = random_bytes($ivLength); $encrypted = openssl_encrypt($optionsJson, $cipher, $apiKey, $opensslOptions, $iv); $ivHex = bin2hex($iv); $encryptedHex = bin2hex($encrypted); $scopedKey = $ivHex . $encryptedHex; return $scopedKey; }
[ "public", "function", "createScopedKey", "(", "$", "filters", ",", "$", "allowedOperations", ")", "{", "if", "(", "!", "$", "masterKey", "=", "$", "this", "->", "getMasterKey", "(", ")", ")", "{", "throw", "new", "RuntimeException", "(", "'A master key is ne...
Get a scoped key for an array of filters @param array $filters What filters to encode into a scoped key @param array $allowedOperations What operations the generated scoped key will allow @return string @throws RuntimeException If no master key is set
[ "Get", "a", "scoped", "key", "for", "an", "array", "of", "filters" ]
883b75cb64327211d83d5756caa3fd7a17eabdbc
https://github.com/keenlabs/KeenClient-PHP/blob/883b75cb64327211d83d5756caa3fd7a17eabdbc/src/Client/KeenIOClient.php#L304-L349
43,799
keenlabs/KeenClient-PHP
src/Client/KeenIOClient.php
KeenIOClient.padString
protected function padString($string, $blockSize = 32) { $paddingSize = $blockSize - (strlen($string) % $blockSize); $string .= str_repeat(chr($paddingSize), $paddingSize); return $string; }
php
protected function padString($string, $blockSize = 32) { $paddingSize = $blockSize - (strlen($string) % $blockSize); $string .= str_repeat(chr($paddingSize), $paddingSize); return $string; }
[ "protected", "function", "padString", "(", "$", "string", ",", "$", "blockSize", "=", "32", ")", "{", "$", "paddingSize", "=", "$", "blockSize", "-", "(", "strlen", "(", "$", "string", ")", "%", "$", "blockSize", ")", ";", "$", "string", ".=", "str_r...
Implement PKCS7 padding @param string $string @param int $blockSize @return string
[ "Implement", "PKCS7", "padding" ]
883b75cb64327211d83d5756caa3fd7a17eabdbc
https://github.com/keenlabs/KeenClient-PHP/blob/883b75cb64327211d83d5756caa3fd7a17eabdbc/src/Client/KeenIOClient.php#L359-L365