repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
luyadev/luya-module-cms | src/base/InternalBaseBlock.php | InternalBaseBlock.injectorSetup | protected function injectorSetup()
{
if ($this->_injectorObjects === null) {
foreach ($this->injectors() as $varName => $injector) {
$injector->setContext($this);
$injector->varName = $varName;
$injector->setup();
$this->_injectorOb... | php | protected function injectorSetup()
{
if ($this->_injectorObjects === null) {
foreach ($this->injectors() as $varName => $injector) {
$injector->setContext($this);
$injector->varName = $varName;
$injector->setup();
$this->_injectorOb... | [
"protected",
"function",
"injectorSetup",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_injectorObjects",
"===",
"null",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"injectors",
"(",
")",
"as",
"$",
"varName",
"=>",
"$",
"injector",
")",
"{",
"$",
... | Setup injectors. | [
"Setup",
"injectors",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/base/InternalBaseBlock.php#L49-L59 |
luyadev/luya-module-cms | src/base/InternalBaseBlock.php | InternalBaseBlock.createAjaxLink | public function createAjaxLink($callbackName, array $params = [])
{
$params['callback'] = Inflector::camel2id($callbackName);
$params['id'] = $this->getEnvOption('id', 0);
return Url::toAjax('cms/block/index', $params);
} | php | public function createAjaxLink($callbackName, array $params = [])
{
$params['callback'] = Inflector::camel2id($callbackName);
$params['id'] = $this->getEnvOption('id', 0);
return Url::toAjax('cms/block/index', $params);
} | [
"public",
"function",
"createAjaxLink",
"(",
"$",
"callbackName",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"params",
"[",
"'callback'",
"]",
"=",
"Inflector",
"::",
"camel2id",
"(",
"$",
"callbackName",
")",
";",
"$",
"params",
"[",
"... | Return link for usage in ajax request, the link will call the defined callback inside
this block. All callback methods must start with `callback`. An example for a callback method:.
```php
public function callbackTestAjax($arg1)
{
return 'hello callback test ajax with argument: arg1 ' . $arg1;
}
```
The above defined... | [
"Return",
"link",
"for",
"usage",
"in",
"ajax",
"request",
"the",
"link",
"will",
"call",
"the",
"defined",
"callback",
"inside",
"this",
"block",
".",
"All",
"callback",
"methods",
"must",
"start",
"with",
"callback",
".",
"An",
"example",
"for",
"a",
"ca... | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/base/InternalBaseBlock.php#L215-L220 |
luyadev/luya-module-cms | src/base/InternalBaseBlock.php | InternalBaseBlock.getEnvOption | public function getEnvOption($key, $default = false)
{
return (array_key_exists($key, $this->_envOptions)) ? $this->_envOptions[$key] : $default;
} | php | public function getEnvOption($key, $default = false)
{
return (array_key_exists($key, $this->_envOptions)) ? $this->_envOptions[$key] : $default;
} | [
"public",
"function",
"getEnvOption",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"false",
")",
"{",
"return",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"_envOptions",
")",
")",
"?",
"$",
"this",
"->",
"_envOptions",
"[",
"$",
... | Get a env option by $key. If $key does not exist it will return given $default or false.
@param $key
@param mixed $default
@return mixed | [
"Get",
"a",
"env",
"option",
"by",
"$key",
".",
"If",
"$key",
"does",
"not",
"exist",
"it",
"will",
"return",
"given",
"$default",
"or",
"false",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/base/InternalBaseBlock.php#L286-L289 |
luyadev/luya-module-cms | src/base/InternalBaseBlock.php | InternalBaseBlock.getVarValue | public function getVarValue($key, $default = false)
{
return (isset($this->_varValues[$key]) && $this->_varValues[$key] != '') ? $this->_varValues[$key] : $default;
} | php | public function getVarValue($key, $default = false)
{
return (isset($this->_varValues[$key]) && $this->_varValues[$key] != '') ? $this->_varValues[$key] : $default;
} | [
"public",
"function",
"getVarValue",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"false",
")",
"{",
"return",
"(",
"isset",
"(",
"$",
"this",
"->",
"_varValues",
"[",
"$",
"key",
"]",
")",
"&&",
"$",
"this",
"->",
"_varValues",
"[",
"$",
"key",
"]",... | Get var value.
If the key does not exist in the array, is an empty string or null the default value will be returned.
@param string $key The name of the key you want to retrieve
@param mixed $default A default value that will be returned if the key isn't found or empty.
@return mixed | [
"Get",
"var",
"value",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/base/InternalBaseBlock.php#L349-L352 |
luyadev/luya-module-cms | src/base/InternalBaseBlock.php | InternalBaseBlock.getCfgValue | public function getCfgValue($key, $default = false)
{
return (isset($this->_cfgValues[$key]) && $this->_cfgValues[$key] != '') ? $this->_cfgValues[$key] : $default;
} | php | public function getCfgValue($key, $default = false)
{
return (isset($this->_cfgValues[$key]) && $this->_cfgValues[$key] != '') ? $this->_cfgValues[$key] : $default;
} | [
"public",
"function",
"getCfgValue",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"false",
")",
"{",
"return",
"(",
"isset",
"(",
"$",
"this",
"->",
"_cfgValues",
"[",
"$",
"key",
"]",
")",
"&&",
"$",
"this",
"->",
"_cfgValues",
"[",
"$",
"key",
"]",... | Get cfg value.
If the key does not exist in the array, is an empty string or null the default value will be returned.
@param string $key The name of the key you want to retrieve
@param mixed $default A default value that will be returned if the key isn't found or empty.
@return mixed | [
"Get",
"cfg",
"value",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/base/InternalBaseBlock.php#L384-L387 |
luyadev/luya-module-cms | src/base/InternalBaseBlock.php | InternalBaseBlock.addVar | public function addVar(array $varConfig, $append = false)
{
$count = count($this->_vars);
$iteration = $append ? $count + 1000 : $count;
$this->_vars[$iteration] = (new BlockVar($varConfig))->toArray();
} | php | public function addVar(array $varConfig, $append = false)
{
$count = count($this->_vars);
$iteration = $append ? $count + 1000 : $count;
$this->_vars[$iteration] = (new BlockVar($varConfig))->toArray();
} | [
"public",
"function",
"addVar",
"(",
"array",
"$",
"varConfig",
",",
"$",
"append",
"=",
"false",
")",
"{",
"$",
"count",
"=",
"count",
"(",
"$",
"this",
"->",
"_vars",
")",
";",
"$",
"iteration",
"=",
"$",
"append",
"?",
"$",
"count",
"+",
"1000",... | Add a var variable to the config.
@param array $varConfig
@param boolean Whether the variable should be append to the end instead of prepanding. | [
"Add",
"a",
"var",
"variable",
"to",
"the",
"config",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/base/InternalBaseBlock.php#L474-L479 |
luyadev/luya-module-cms | src/base/InternalBaseBlock.php | InternalBaseBlock.addCfg | public function addCfg(array $cfgConfig, $append = false)
{
$count = count($this->_cfgs);
$iteration = $append ? $count + 1000 : $count;
$this->_cfgs[$iteration] = (new BlockCfg($cfgConfig))->toArray();
} | php | public function addCfg(array $cfgConfig, $append = false)
{
$count = count($this->_cfgs);
$iteration = $append ? $count + 1000 : $count;
$this->_cfgs[$iteration] = (new BlockCfg($cfgConfig))->toArray();
} | [
"public",
"function",
"addCfg",
"(",
"array",
"$",
"cfgConfig",
",",
"$",
"append",
"=",
"false",
")",
"{",
"$",
"count",
"=",
"count",
"(",
"$",
"this",
"->",
"_cfgs",
")",
";",
"$",
"iteration",
"=",
"$",
"append",
"?",
"$",
"count",
"+",
"1000",... | Add a cfg variable to the config.
@param array $cfgConfig
@param boolean Whether the variable should be append to the end instead of prepanding. | [
"Add",
"a",
"cfg",
"variable",
"to",
"the",
"config",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/base/InternalBaseBlock.php#L549-L554 |
luyadev/luya-module-cms | src/base/InternalBaseBlock.php | InternalBaseBlock.getViewFileName | public function getViewFileName($extension)
{
$className = get_class($this);
if (preg_match('/\\\\([\w]+)$/', $className, $matches)) {
$className = $matches[1];
}
return $className.'.'.$extension;
} | php | public function getViewFileName($extension)
{
$className = get_class($this);
if (preg_match('/\\\\([\w]+)$/', $className, $matches)) {
$className = $matches[1];
}
return $className.'.'.$extension;
} | [
"public",
"function",
"getViewFileName",
"(",
"$",
"extension",
")",
"{",
"$",
"className",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"if",
"(",
"preg_match",
"(",
"'/\\\\\\\\([\\w]+)$/'",
",",
"$",
"className",
",",
"$",
"matches",
")",
")",
"{",
"$... | Returns the name of the php file to be rendered.
@return string The name of the php file (example.php) | [
"Returns",
"the",
"name",
"of",
"the",
"php",
"file",
"to",
"be",
"rendered",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/base/InternalBaseBlock.php#L561-L570 |
luyadev/luya-module-cms | src/base/InternalBaseBlock.php | InternalBaseBlock.getPreviewImageSource | protected function getPreviewImageSource()
{
$imageName = $this->getViewFileName('jpg');
$reflector = new \ReflectionClass($this);
$dirPath = dirname($reflector->getFileName(), 2);
$imagePath = $dirPath . '/images/blocks/' . $imageName;
// file get content resolved Yii a... | php | protected function getPreviewImageSource()
{
$imageName = $this->getViewFileName('jpg');
$reflector = new \ReflectionClass($this);
$dirPath = dirname($reflector->getFileName(), 2);
$imagePath = $dirPath . '/images/blocks/' . $imageName;
// file get content resolved Yii a... | [
"protected",
"function",
"getPreviewImageSource",
"(",
")",
"{",
"$",
"imageName",
"=",
"$",
"this",
"->",
"getViewFileName",
"(",
"'jpg'",
")",
";",
"$",
"reflector",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"this",
")",
";",
"$",
"dirPath",
"=",
... | Path to the preview image.
@since 1.0.8 | [
"Path",
"to",
"the",
"preview",
"image",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/base/InternalBaseBlock.php#L637-L651 |
luyadev/luya-module-cms | src/helpers/BlockHelper.php | BlockHelper.selectArrayOption | public static function selectArrayOption(array $options, $prompt = null)
{
$transform = [];
if ($prompt) {
$transform[] = ['value' => 0, 'label' => $prompt];
}
foreach ($options as $key => $value) {
$transform[] = ['value' => $key, 'label' => $value];
... | php | public static function selectArrayOption(array $options, $prompt = null)
{
$transform = [];
if ($prompt) {
$transform[] = ['value' => 0, 'label' => $prompt];
}
foreach ($options as $key => $value) {
$transform[] = ['value' => $key, 'label' => $value];
... | [
"public",
"static",
"function",
"selectArrayOption",
"(",
"array",
"$",
"options",
",",
"$",
"prompt",
"=",
"null",
")",
"{",
"$",
"transform",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"prompt",
")",
"{",
"$",
"transform",
"[",
"]",
"=",
"[",
"'value'",
... | Create the options array for a zaa-select field based on an key value pairing
array.
In order to provide a prompt message which displayes when nothing is selected us the $prompt param.
In order to get a key value pairing directly from an ActiveRecord Model use:
```php
return Tag::find()->select(['name'])->indexBy('i... | [
"Create",
"the",
"options",
"array",
"for",
"a",
"zaa",
"-",
"select",
"field",
"based",
"on",
"an",
"key",
"value",
"pairing",
"array",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/helpers/BlockHelper.php#L52-L63 |
luyadev/luya-module-cms | src/helpers/BlockHelper.php | BlockHelper.checkboxArrayOption | public static function checkboxArrayOption(array $options)
{
$transform = [];
foreach ($options as $key => $value) {
$transform[] = ['value' => $key, 'label' => $value];
}
return ['items' => $transform];
} | php | public static function checkboxArrayOption(array $options)
{
$transform = [];
foreach ($options as $key => $value) {
$transform[] = ['value' => $key, 'label' => $value];
}
return ['items' => $transform];
} | [
"public",
"static",
"function",
"checkboxArrayOption",
"(",
"array",
"$",
"options",
")",
"{",
"$",
"transform",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"options",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"transform",
"[",
"]",
"=",
"[",... | Create the Options list in the config for a zaa-checkbox-array based on an
key => value pairing array.
In order to get a key value pairing directly from an ActiveRecord Model use:
```php
return Tag::find()->select(['name'])->indexBy('id')->column();
```
Where name is the value and id the key for the array.
@param a... | [
"Create",
"the",
"Options",
"list",
"in",
"the",
"config",
"for",
"a",
"zaa",
"-",
"checkbox",
"-",
"array",
"based",
"on",
"an",
"key",
"=",
">",
"value",
"pairing",
"array",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/helpers/BlockHelper.php#L81-L89 |
luyadev/luya-module-cms | src/helpers/BlockHelper.php | BlockHelper.imageUpload | public static function imageUpload($value, $applyFilter = false, $returnObject = false)
{
if (empty($value)) {
return false;
}
$image = Yii::$app->storage->getImage($value);
if (!$image) {
return false;
}
if ($applyFilter && is_s... | php | public static function imageUpload($value, $applyFilter = false, $returnObject = false)
{
if (empty($value)) {
return false;
}
$image = Yii::$app->storage->getImage($value);
if (!$image) {
return false;
}
if ($applyFilter && is_s... | [
"public",
"static",
"function",
"imageUpload",
"(",
"$",
"value",
",",
"$",
"applyFilter",
"=",
"false",
",",
"$",
"returnObject",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"image"... | Get all informations from an zaa-image-upload type:
```php
'image' => BlockHelper::ImageUpload($this->getVarValue('myImage')),
```
apply a filter for the image
```php
'imageFiltered' => BlockHelper::ImageUpload($this->getVarValue('myImage'), 'small-thumbnail'),
```
@param string|int $value Provided the value
@param... | [
"Get",
"all",
"informations",
"from",
"an",
"zaa",
"-",
"image",
"-",
"upload",
"type",
":"
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/helpers/BlockHelper.php#L109-L136 |
luyadev/luya-module-cms | src/helpers/BlockHelper.php | BlockHelper.imageArrayUpload | public static function imageArrayUpload($value, $applyFilter = false, $returnObject = false)
{
if (!empty($value) && is_array($value)) {
$data = [];
foreach ($value as $key => $item) {
$image = static::imageUpload($item['imageId'], $applyFilter, true);
... | php | public static function imageArrayUpload($value, $applyFilter = false, $returnObject = false)
{
if (!empty($value) && is_array($value)) {
$data = [];
foreach ($value as $key => $item) {
$image = static::imageUpload($item['imageId'], $applyFilter, true);
... | [
"public",
"static",
"function",
"imageArrayUpload",
"(",
"$",
"value",
",",
"$",
"applyFilter",
"=",
"false",
",",
"$",
"returnObject",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"value",
")",
"&&",
"is_array",
"(",
"$",
"value",
")",
... | Get the full array for the specific zaa-file-image-upload type
```php
'imageList' => BlockHelper::ImageArrayUpload($this->getVarValue('images')),
```
Each array item will have all file query item data and a caption key.
@param string|int $value The specific var or cfg fieldvalue.
@param boolean|string $applyFilter T... | [
"Get",
"the",
"full",
"array",
"for",
"the",
"specific",
"zaa",
"-",
"file",
"-",
"image",
"-",
"upload",
"type"
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/helpers/BlockHelper.php#L152-L172 |
luyadev/luya-module-cms | src/helpers/BlockHelper.php | BlockHelper.fileUpload | public static function fileUpload($fileId, $returnObject = false)
{
if (!empty($fileId)) {
$file = Yii::$app->storage->getFile($fileId);
/* @var \luya\admin\file\Item $file */
if ($file) {
if ($returnObject) {
return $file;
... | php | public static function fileUpload($fileId, $returnObject = false)
{
if (!empty($fileId)) {
$file = Yii::$app->storage->getFile($fileId);
/* @var \luya\admin\file\Item $file */
if ($file) {
if ($returnObject) {
return $file;
... | [
"public",
"static",
"function",
"fileUpload",
"(",
"$",
"fileId",
",",
"$",
"returnObject",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"fileId",
")",
")",
"{",
"$",
"file",
"=",
"Yii",
"::",
"$",
"app",
"->",
"storage",
"->",
"getFi... | Get file information based on input fileId.
In order to use the FileUpload helper, define an extraVar based on the fileId from the cfg or
var configurations.
```php
public function extraVars()
{
return [
'file' => BlockHelper::FileUpload($this->getVarValue('myFile'), true)
];
}
```
Attention: Always use if statement... | [
"Get",
"file",
"information",
"based",
"on",
"input",
"fileId",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/helpers/BlockHelper.php#L204-L218 |
luyadev/luya-module-cms | src/helpers/BlockHelper.php | BlockHelper.fileArrayUpload | public static function fileArrayUpload($value, $returnObject = false)
{
if (!empty($value) && is_array($value)) {
$data = [];
foreach ($value as $key => $item) {
$file = static::fileUpload($item['fileId'], true);
if ($file) {
if (!e... | php | public static function fileArrayUpload($value, $returnObject = false)
{
if (!empty($value) && is_array($value)) {
$data = [];
foreach ($value as $key => $item) {
$file = static::fileUpload($item['fileId'], true);
if ($file) {
if (!e... | [
"public",
"static",
"function",
"fileArrayUpload",
"(",
"$",
"value",
",",
"$",
"returnObject",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"value",
")",
"&&",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"data",
"=",
"[",
"]",... | Get the full array for the specific zaa-file-array-upload type
```php
'fileList' => BlockHelper::FileArrayUpload($this->getVarValue('files')),
```
Each array item will have all file query item data and a caption key.
@param string|int $value The specific var or cfg fieldvalue.
@param boolean $returnObject Whether th... | [
"Get",
"the",
"full",
"array",
"for",
"the",
"specific",
"zaa",
"-",
"file",
"-",
"array",
"-",
"upload",
"type"
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/helpers/BlockHelper.php#L233-L253 |
luyadev/luya-module-cms | src/helpers/BlockHelper.php | BlockHelper.linkObject | public static function linkObject($config)
{
if (empty($config) || !is_array($config)) {
return false;
}
$converter = LinkConverter::fromArray($config);
if (!$converter) {
return false;
}
return $converter->getLink();... | php | public static function linkObject($config)
{
if (empty($config) || !is_array($config)) {
return false;
}
$converter = LinkConverter::fromArray($config);
if (!$converter) {
return false;
}
return $converter->getLink();... | [
"public",
"static",
"function",
"linkObject",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"config",
")",
"||",
"!",
"is_array",
"(",
"$",
"config",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"converter",
"=",
"LinkConverter",
":... | Generate a link object based on the configuration (array).
@param array $config The configuration array to build the object the config array requires the following keys
+ type: The type of redirect (1 = internal, 2 = external, 3 = file, etc.)
+ value: The value assoiated to the type (link to a file can be an integer, ... | [
"Generate",
"a",
"link",
"object",
"based",
"on",
"the",
"configuration",
"(",
"array",
")",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/helpers/BlockHelper.php#L265-L278 |
luyadev/luya-module-cms | src/frontend/controllers/PreviewController.php | PreviewController.actionIndex | public function actionIndex($itemId, $version = false, $date = false)
{
if (Yii::$app->adminuser->isGuest) {
throw new ForbiddenHttpException('Unable to see the preview page, session expired or not logged in.');
}
$navItem = NavItem::findOne($itemId);
if (!$navI... | php | public function actionIndex($itemId, $version = false, $date = false)
{
if (Yii::$app->adminuser->isGuest) {
throw new ForbiddenHttpException('Unable to see the preview page, session expired or not logged in.');
}
$navItem = NavItem::findOne($itemId);
if (!$navI... | [
"public",
"function",
"actionIndex",
"(",
"$",
"itemId",
",",
"$",
"version",
"=",
"false",
",",
"$",
"date",
"=",
"false",
")",
"{",
"if",
"(",
"Yii",
"::",
"$",
"app",
"->",
"adminuser",
"->",
"isGuest",
")",
"{",
"throw",
"new",
"ForbiddenHttpExcept... | Renders the preview action.
@param integer $itemId The nav item to render.
@param integer $version The version to display.
@param integer $date The date from the preview frame, is false when not using the preview frame from the cms.
@throws ForbiddenHttpException
@throws NotFoundHttpException
@return \yii\web\Response... | [
"Renders",
"the",
"preview",
"action",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/frontend/controllers/PreviewController.php#L30-L77 |
luyadev/luya-module-cms | src/menu/QueryIteratorFilter.php | QueryIteratorFilter.accept | public function accept()
{
$event = new MenuItemEvent();
$event->item = $this->current();
if (isset($this->getInnerIterator()->with['hidden'])) {
$event->visible = true;
}
Yii::$app->menu->trigger(Menu::EVENT_ON_ITEM_FIND, $event);
return $event->visible;
... | php | public function accept()
{
$event = new MenuItemEvent();
$event->item = $this->current();
if (isset($this->getInnerIterator()->with['hidden'])) {
$event->visible = true;
}
Yii::$app->menu->trigger(Menu::EVENT_ON_ITEM_FIND, $event);
return $event->visible;
... | [
"public",
"function",
"accept",
"(",
")",
"{",
"$",
"event",
"=",
"new",
"MenuItemEvent",
"(",
")",
";",
"$",
"event",
"->",
"item",
"=",
"$",
"this",
"->",
"current",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"getInnerIterator",
"... | Verifys if an menu item does have valid event response.
{@inheritDoc}
@see FilterIterator::accept() | [
"Verifys",
"if",
"an",
"menu",
"item",
"does",
"have",
"valid",
"event",
"response",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/menu/QueryIteratorFilter.php#L25-L34 |
luyadev/luya-module-cms | src/models/Redirect.php | Redirect.matchRequestPath | public function matchRequestPath($requestPath)
{
foreach ([$requestPath, urlencode($requestPath), urldecode($requestPath)] as $path) {
foreach ([$this->catch_path, urlencode($this->catch_path), urldecode($this->catch_path)] as $catch) {
if ($this->pathMatcher($path, $catch)) {
... | php | public function matchRequestPath($requestPath)
{
foreach ([$requestPath, urlencode($requestPath), urldecode($requestPath)] as $path) {
foreach ([$this->catch_path, urlencode($this->catch_path), urldecode($this->catch_path)] as $catch) {
if ($this->pathMatcher($path, $catch)) {
... | [
"public",
"function",
"matchRequestPath",
"(",
"$",
"requestPath",
")",
"{",
"foreach",
"(",
"[",
"$",
"requestPath",
",",
"urlencode",
"(",
"$",
"requestPath",
")",
",",
"urldecode",
"(",
"$",
"requestPath",
")",
"]",
"as",
"$",
"path",
")",
"{",
"forea... | Match Request Path against catch_path.
Several version of the request path will be checked in order to ensure different siutations can be handled.
@param string $requestPath
@return boolean | [
"Match",
"Request",
"Path",
"against",
"catch_path",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/models/Redirect.php#L137-L148 |
luyadev/luya-module-cms | src/models/Redirect.php | Redirect.pathMatcher | private function pathMatcher($input, $catchPath)
{
// ensure request path is prefix with slash
$requestPath = '/'.ltrim($input, '/');
// see if wildcard string matches
if (StringHelper::startsWithWildcard($requestPath, $catchPath)) {
return true;
}
// comp... | php | private function pathMatcher($input, $catchPath)
{
// ensure request path is prefix with slash
$requestPath = '/'.ltrim($input, '/');
// see if wildcard string matches
if (StringHelper::startsWithWildcard($requestPath, $catchPath)) {
return true;
}
// comp... | [
"private",
"function",
"pathMatcher",
"(",
"$",
"input",
",",
"$",
"catchPath",
")",
"{",
"// ensure request path is prefix with slash",
"$",
"requestPath",
"=",
"'/'",
".",
"ltrim",
"(",
"$",
"input",
",",
"'/'",
")",
";",
"// see if wildcard string matches",
"if... | Internal path matcher
@param string $input The input request path
@param string $catchPath The path to catch
@return boolean
@since 1.0.8 | [
"Internal",
"path",
"matcher"
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/models/Redirect.php#L158-L168 |
luyadev/luya-module-cms | src/base/PhpBlockView.php | PhpBlockView.wrapTemplate | public function wrapTemplate($key, $value, $template)
{
if (!$template || empty($value)) {
return $value;
}
return str_replace(['{{' . $key . '}}'], $value, $template);
} | php | public function wrapTemplate($key, $value, $template)
{
if (!$template || empty($value)) {
return $value;
}
return str_replace(['{{' . $key . '}}'], $value, $template);
} | [
"public",
"function",
"wrapTemplate",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"template",
")",
"{",
"if",
"(",
"!",
"$",
"template",
"||",
"empty",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"value",
";",
"}",
"return",
"str_replace",
"... | Wrap a very basic template arounte the value if value is not `empty()`.
Assuming to have variable `title` with the value `Hello World` and a template `<p>{{title}}</p>` renders:
```
<p>Hello World</p>
```
If a template is provided and $value is not empty return the wrapped template, otherwise the original $value inp... | [
"Wrap",
"a",
"very",
"basic",
"template",
"arounte",
"the",
"value",
"if",
"value",
"is",
"not",
"empty",
"()",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/base/PhpBlockView.php#L210-L217 |
luyadev/luya-module-cms | src/base/PhpBlockView.php | PhpBlockView.varValue | public function varValue($key, $defaultValue = null, $template = false)
{
return $this->wrapTemplate($key, $this->context->getVarValue($key, $defaultValue), $template);
} | php | public function varValue($key, $defaultValue = null, $template = false)
{
return $this->wrapTemplate($key, $this->context->getVarValue($key, $defaultValue), $template);
} | [
"public",
"function",
"varValue",
"(",
"$",
"key",
",",
"$",
"defaultValue",
"=",
"null",
",",
"$",
"template",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"wrapTemplate",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"context",
"->",
"getVarValue"... | The the content value of a var.
@param string $key The name of the var value to return, defined as `varName` inside the `config()` method of the vars section.
@param string $defaultValue Env value is not found this value will be returned.
@param string $template Provde a template which replaces the current variable if... | [
"The",
"the",
"content",
"value",
"of",
"a",
"var",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/base/PhpBlockView.php#L227-L230 |
luyadev/luya-module-cms | src/base/PhpBlockView.php | PhpBlockView.cfgValue | public function cfgValue($key, $defaultValue = null, $template = false)
{
return $this->wrapTemplate($key, $this->context->getCfgValue($key, $defaultValue), $template);
} | php | public function cfgValue($key, $defaultValue = null, $template = false)
{
return $this->wrapTemplate($key, $this->context->getCfgValue($key, $defaultValue), $template);
} | [
"public",
"function",
"cfgValue",
"(",
"$",
"key",
",",
"$",
"defaultValue",
"=",
"null",
",",
"$",
"template",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"wrapTemplate",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"context",
"->",
"getCfgValue"... | Get the content of a cfg.
@param string $key The name of the cfg value to return, defined as `varName` inside the `config()` method of the cfgs section.
@param string $defaultValue Env value is not found this value will be returned.
@param string $template Provde a template which replaces the current variable if value... | [
"Get",
"the",
"content",
"of",
"a",
"cfg",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/base/PhpBlockView.php#L240-L243 |
luyadev/luya-module-cms | src/base/PhpBlockView.php | PhpBlockView.extraValue | public function extraValue($key, $defaultValue = null, $template = false)
{
return $this->wrapTemplate($key, $this->context->getExtraValue($key, $defaultValue), $template);
} | php | public function extraValue($key, $defaultValue = null, $template = false)
{
return $this->wrapTemplate($key, $this->context->getExtraValue($key, $defaultValue), $template);
} | [
"public",
"function",
"extraValue",
"(",
"$",
"key",
",",
"$",
"defaultValue",
"=",
"null",
",",
"$",
"template",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"wrapTemplate",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"context",
"->",
"getExtraVa... | Get the value of an extra var.
@param string $key The name of the extra var to return, defined as key inside the `extraVars()` method return array.
@param string $defaultValue Env value is not found this value will be returned.
@param string $template Provde a template which replaces the current variable if value is n... | [
"Get",
"the",
"value",
"of",
"an",
"extra",
"var",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/base/PhpBlockView.php#L253-L256 |
luyadev/luya-module-cms | src/menu/QueryIterator.php | QueryIterator.loadModels | public function loadModels()
{
if ($this->_loadModels === null) {
$this->_loadModels = Nav::find()->indexBy('id')->where(['in', 'id', ArrayHelper::getColumn($this->data, 'nav_id')])->with(['properties.adminProperty'])->all();
}
return $this->_loadModels;
} | php | public function loadModels()
{
if ($this->_loadModels === null) {
$this->_loadModels = Nav::find()->indexBy('id')->where(['in', 'id', ArrayHelper::getColumn($this->data, 'nav_id')])->with(['properties.adminProperty'])->all();
}
return $this->_loadModels;
} | [
"public",
"function",
"loadModels",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_loadModels",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_loadModels",
"=",
"Nav",
"::",
"find",
"(",
")",
"->",
"indexBy",
"(",
"'id'",
")",
"->",
"where",
"(",
"[... | Load all models for ghe given Menu Query.
@return array An array where the key is the id of the nav model and value the {{luya\cms\models\Nav}} object. | [
"Load",
"all",
"models",
"for",
"ghe",
"given",
"Menu",
"Query",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/menu/QueryIterator.php#L62-L69 |
luyadev/luya-module-cms | src/menu/QueryIterator.php | QueryIterator.getLoadedModel | public function getLoadedModel($id)
{
return isset($this->_loadModels[$id]) ? $this->_loadModels[$id] : null;
} | php | public function getLoadedModel($id)
{
return isset($this->_loadModels[$id]) ? $this->_loadModels[$id] : null;
} | [
"public",
"function",
"getLoadedModel",
"(",
"$",
"id",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_loadModels",
"[",
"$",
"id",
"]",
")",
"?",
"$",
"this",
"->",
"_loadModels",
"[",
"$",
"id",
"]",
":",
"null",
";",
"}"
] | Get the model for a given id.
If the model was not preloaded by {{loadModels}} null is returned.
@param integer $id
@return null|\luya\cms\models\Nav | [
"Get",
"the",
"model",
"for",
"a",
"given",
"id",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/menu/QueryIterator.php#L79-L82 |
luyadev/luya-module-cms | src/menu/QueryIterator.php | QueryIterator.current | public function current()
{
$data = current($this->data);
return Query::createItemObject($data, $this->lang, $this->getLoadedModel($data['id']));
} | php | public function current()
{
$data = current($this->data);
return Query::createItemObject($data, $this->lang, $this->getLoadedModel($data['id']));
} | [
"public",
"function",
"current",
"(",
")",
"{",
"$",
"data",
"=",
"current",
"(",
"$",
"this",
"->",
"data",
")",
";",
"return",
"Query",
"::",
"createItemObject",
"(",
"$",
"data",
",",
"$",
"this",
"->",
"lang",
",",
"$",
"this",
"->",
"getLoadedMo... | Iterator get current element, generates a new object for the current item on accessing.s.
@return \luya\cms\menu\Item | [
"Iterator",
"get",
"current",
"element",
"generates",
"a",
"new",
"object",
"for",
"the",
"current",
"item",
"on",
"accessing",
".",
"s",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/menu/QueryIterator.php#L89-L93 |
luyadev/luya-module-cms | src/models/NavItem.php | NavItem.eventLogger | protected function eventLogger($event)
{
switch ($event->name) {
case 'afterInsert':
return Log::add(1, ['tableName' => 'cms_nav_item', 'action' => 'insert', 'row' => $this->id], 'cms_nav_item', $this->id, $this->toArray());
case 'afterUpdate':
return ... | php | protected function eventLogger($event)
{
switch ($event->name) {
case 'afterInsert':
return Log::add(1, ['tableName' => 'cms_nav_item', 'action' => 'insert', 'row' => $this->id], 'cms_nav_item', $this->id, $this->toArray());
case 'afterUpdate':
return ... | [
"protected",
"function",
"eventLogger",
"(",
"$",
"event",
")",
"{",
"switch",
"(",
"$",
"event",
"->",
"name",
")",
"{",
"case",
"'afterInsert'",
":",
"return",
"Log",
"::",
"add",
"(",
"1",
",",
"[",
"'tableName'",
"=>",
"'cms_nav_item'",
",",
"'action... | Log the current event in a database to retrieve data in case of emergency. This method will be trigger
on: EVENT_BEFORE_DELETE, EVENT_AFTER_INSERT & EVENT_AFTER_UPDATE
@param \yii\base\Event $event
@return boolean | [
"Log",
"the",
"current",
"event",
"in",
"a",
"database",
"to",
"retrieve",
"data",
"in",
"case",
"of",
"emergency",
".",
"This",
"method",
"will",
"be",
"trigger",
"on",
":",
"EVENT_BEFORE_DELETE",
"EVENT_AFTER_INSERT",
"&",
"EVENT_AFTER_UPDATE"
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/models/NavItem.php#L86-L96 |
luyadev/luya-module-cms | src/models/NavItem.php | NavItem.getType | public function getType()
{
if ($this->_type === null) {
// what kind of item type are we looking for
if ($this->nav_item_type == self::TYPE_PAGE) {
$this->_type = NavItemPage::findOne($this->nav_item_type_id);
} elseif ($this->nav_item_type =... | php | public function getType()
{
if ($this->_type === null) {
// what kind of item type are we looking for
if ($this->nav_item_type == self::TYPE_PAGE) {
$this->_type = NavItemPage::findOne($this->nav_item_type_id);
} elseif ($this->nav_item_type =... | [
"public",
"function",
"getType",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_type",
"===",
"null",
")",
"{",
"// what kind of item type are we looking for",
"if",
"(",
"$",
"this",
"->",
"nav_item_type",
"==",
"self",
"::",
"TYPE_PAGE",
")",
"{",
"$",
"... | GET the type object based on the nav_item_type defintion and the nav_item_type_id which is the
primary key for the corresponding type table (page, module, redirect). This approach has been choosen
do dynamically extend type of pages whithout any limitation.
@return \luya\cms\models\NavItemPage|\luya\cms\models\NavItem... | [
"GET",
"the",
"type",
"object",
"based",
"on",
"the",
"nav_item_type",
"defintion",
"and",
"the",
"nav_item_type_id",
"which",
"is",
"the",
"primary",
"key",
"for",
"the",
"corresponding",
"type",
"table",
"(",
"page",
"module",
"redirect",
")",
".",
"This",
... | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/models/NavItem.php#L160-L183 |
luyadev/luya-module-cms | src/models/NavItem.php | NavItem.updateType | public function updateType(array $postData)
{
$model = $this->getType();
$model->setAttributes($postData);
return $model->update();
} | php | public function updateType(array $postData)
{
$model = $this->getType();
$model->setAttributes($postData);
return $model->update();
} | [
"public",
"function",
"updateType",
"(",
"array",
"$",
"postData",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"getType",
"(",
")",
";",
"$",
"model",
"->",
"setAttributes",
"(",
"$",
"postData",
")",
";",
"return",
"$",
"model",
"->",
"update",
... | Update attributes of the current nav item type relation.
@param array $postData
@return boolean Whether the update has been successfull or not | [
"Update",
"attributes",
"of",
"the",
"current",
"nav",
"item",
"type",
"relation",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/models/NavItem.php#L211-L216 |
luyadev/luya-module-cms | src/models/NavItem.php | NavItem.verifyAlias | public function verifyAlias($alias, $langId)
{
if (Yii::$app->hasModule($alias) && $this->parent_nav_id == 0) {
$this->addError('alias', Module::t('nav_item_model_error_modulenameexists', ['alias' => $alias]));
return false;
}
if ($this->parent_nav_id === null) {
... | php | public function verifyAlias($alias, $langId)
{
if (Yii::$app->hasModule($alias) && $this->parent_nav_id == 0) {
$this->addError('alias', Module::t('nav_item_model_error_modulenameexists', ['alias' => $alias]));
return false;
}
if ($this->parent_nav_id === null) {
... | [
"public",
"function",
"verifyAlias",
"(",
"$",
"alias",
",",
"$",
"langId",
")",
"{",
"if",
"(",
"Yii",
"::",
"$",
"app",
"->",
"hasModule",
"(",
"$",
"alias",
")",
"&&",
"$",
"this",
"->",
"parent_nav_id",
"==",
"0",
")",
"{",
"$",
"this",
"->",
... | Alias verification.
@param string $alias
@param integer $langId
@return boolean | [
"Alias",
"verification",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/models/NavItem.php#L234-L253 |
luyadev/luya-module-cms | src/models/NavItem.php | NavItem.validateAlias | public function validateAlias()
{
$dirty = $this->getDirtyAttributes(['alias']);
if (!isset($dirty['alias'])) {
return true;
}
if (!$this->verifyAlias($this->alias, $this->lang_id)) {
return false;
}
} | php | public function validateAlias()
{
$dirty = $this->getDirtyAttributes(['alias']);
if (!isset($dirty['alias'])) {
return true;
}
if (!$this->verifyAlias($this->alias, $this->lang_id)) {
return false;
}
} | [
"public",
"function",
"validateAlias",
"(",
")",
"{",
"$",
"dirty",
"=",
"$",
"this",
"->",
"getDirtyAttributes",
"(",
"[",
"'alias'",
"]",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"dirty",
"[",
"'alias'",
"]",
")",
")",
"{",
"return",
"true",
... | Alias Validator.
@return boolean | [
"Alias",
"Validator",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/models/NavItem.php#L260-L270 |
luyadev/luya-module-cms | src/models/NavItem.php | NavItem.beforeCreate | public function beforeCreate()
{
$this->timestamp_create = time();
$this->timestamp_update = 0;
$this->create_user_id = Module::getAuthorUserId();
$this->update_user_id = Module::getAuthorUserId();
$this->slugifyAlias();
} | php | public function beforeCreate()
{
$this->timestamp_create = time();
$this->timestamp_update = 0;
$this->create_user_id = Module::getAuthorUserId();
$this->update_user_id = Module::getAuthorUserId();
$this->slugifyAlias();
} | [
"public",
"function",
"beforeCreate",
"(",
")",
"{",
"$",
"this",
"->",
"timestamp_create",
"=",
"time",
"(",
")",
";",
"$",
"this",
"->",
"timestamp_update",
"=",
"0",
";",
"$",
"this",
"->",
"create_user_id",
"=",
"Module",
"::",
"getAuthorUserId",
"(",
... | Before create event. | [
"Before",
"create",
"event",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/models/NavItem.php#L275-L282 |
luyadev/luya-module-cms | src/models/NavItem.php | NavItem.eventBeforeUpdate | public function eventBeforeUpdate()
{
$this->timestamp_update = time();
$this->update_user_id = Module::getAuthorUserId();
$this->slugifyAlias();
} | php | public function eventBeforeUpdate()
{
$this->timestamp_update = time();
$this->update_user_id = Module::getAuthorUserId();
$this->slugifyAlias();
} | [
"public",
"function",
"eventBeforeUpdate",
"(",
")",
"{",
"$",
"this",
"->",
"timestamp_update",
"=",
"time",
"(",
")",
";",
"$",
"this",
"->",
"update_user_id",
"=",
"Module",
"::",
"getAuthorUserId",
"(",
")",
";",
"$",
"this",
"->",
"slugifyAlias",
"(",... | Before update event. | [
"Before",
"update",
"event",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/models/NavItem.php#L287-L292 |
luyadev/luya-module-cms | src/admin/apis/NavItemBlockController.php | NavItemBlockController.copySubBlocksTo | private function copySubBlocksTo($sourceId, $targetPrevId, $targetNavItemPageId)
{
if ($sourceId) {
$subBlocks = NavItemPageBlockItem::findAll(['prev_id' => $sourceId]);
foreach ($subBlocks as $block) {
$newBlock = new NavItemPageBlockItem();
$newBlock... | php | private function copySubBlocksTo($sourceId, $targetPrevId, $targetNavItemPageId)
{
if ($sourceId) {
$subBlocks = NavItemPageBlockItem::findAll(['prev_id' => $sourceId]);
foreach ($subBlocks as $block) {
$newBlock = new NavItemPageBlockItem();
$newBlock... | [
"private",
"function",
"copySubBlocksTo",
"(",
"$",
"sourceId",
",",
"$",
"targetPrevId",
",",
"$",
"targetNavItemPageId",
")",
"{",
"if",
"(",
"$",
"sourceId",
")",
"{",
"$",
"subBlocks",
"=",
"NavItemPageBlockItem",
"::",
"findAll",
"(",
"[",
"'prev_id'",
... | Copy all attached sub blocks (referencing sourceId) into new context and update prevId to sourceId
@param $sourceId
@param $targetPrevId
@param $targetNavItemPageId | [
"Copy",
"all",
"attached",
"sub",
"blocks",
"(",
"referencing",
"sourceId",
")",
"into",
"new",
"context",
"and",
"update",
"prevId",
"to",
"sourceId"
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/admin/apis/NavItemBlockController.php#L23-L41 |
luyadev/luya-module-cms | src/models/Property.php | Property.getObject | public function getObject()
{
if ($this->_object === null) {
$this->_object = $this->adminProperty->createObject($this->value);
}
return $this->_object;
} | php | public function getObject()
{
if ($this->_object === null) {
$this->_object = $this->adminProperty->createObject($this->value);
}
return $this->_object;
} | [
"public",
"function",
"getObject",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_object",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_object",
"=",
"$",
"this",
"->",
"adminProperty",
"->",
"createObject",
"(",
"$",
"this",
"->",
"value",
")",
";"... | Create the Property object with the given value.
@return \luya\admin\base\Property | [
"Create",
"the",
"Property",
"object",
"with",
"the",
"given",
"value",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/models/Property.php#L54-L61 |
luyadev/luya-module-cms | src/admin/aws/BlockPagesActiveWindow.php | BlockPagesActiveWindow.index | public function index()
{
return $this->render('index', [
'pages' => $this->model->getNavItemPageBlockItems()->select(['nav_item_page_id'])->distinct()->orderBy([])->all(),
]);
} | php | public function index()
{
return $this->render('index', [
'pages' => $this->model->getNavItemPageBlockItems()->select(['nav_item_page_id'])->distinct()->orderBy([])->all(),
]);
} | [
"public",
"function",
"index",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"render",
"(",
"'index'",
",",
"[",
"'pages'",
"=>",
"$",
"this",
"->",
"model",
"->",
"getNavItemPageBlockItems",
"(",
")",
"->",
"select",
"(",
"[",
"'nav_item_page_id'",
"]",
"... | The default action which is going to be requested when clicking the ActiveWindow.
@return string The response string, render and displayed trough the angular ajax request. | [
"The",
"default",
"action",
"which",
"is",
"going",
"to",
"be",
"requested",
"when",
"clicking",
"the",
"ActiveWindow",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/admin/aws/BlockPagesActiveWindow.php#L44-L49 |
luyadev/luya-module-cms | src/frontend/blocks/ModuleBlock.php | ModuleBlock.getControllerClasses | public function getControllerClasses()
{
$moduleName = $this->getVarValue('moduleName', false);
return (empty($moduleName) || !Yii::$app->hasModule($moduleName)) ? [] : Yii::$app->getModule($moduleName)->getControllerFiles();
} | php | public function getControllerClasses()
{
$moduleName = $this->getVarValue('moduleName', false);
return (empty($moduleName) || !Yii::$app->hasModule($moduleName)) ? [] : Yii::$app->getModule($moduleName)->getControllerFiles();
} | [
"public",
"function",
"getControllerClasses",
"(",
")",
"{",
"$",
"moduleName",
"=",
"$",
"this",
"->",
"getVarValue",
"(",
"'moduleName'",
",",
"false",
")",
";",
"return",
"(",
"empty",
"(",
"$",
"moduleName",
")",
"||",
"!",
"Yii",
"::",
"$",
"app",
... | Get all module related controllers.
@return array | [
"Get",
"all",
"module",
"related",
"controllers",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/frontend/blocks/ModuleBlock.php#L110-L115 |
luyadev/luya-module-cms | src/frontend/blocks/ModuleBlock.php | ModuleBlock.getModuleNames | public function getModuleNames()
{
$data = [];
foreach (Yii::$app->getFrontendModules() as $k => $f) {
$data[] = ['value' => $k, 'label' => $k];
}
return $data;
} | php | public function getModuleNames()
{
$data = [];
foreach (Yii::$app->getFrontendModules() as $k => $f) {
$data[] = ['value' => $k, 'label' => $k];
}
return $data;
} | [
"public",
"function",
"getModuleNames",
"(",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"Yii",
"::",
"$",
"app",
"->",
"getFrontendModules",
"(",
")",
"as",
"$",
"k",
"=>",
"$",
"f",
")",
"{",
"$",
"data",
"[",
"]",
"=",
"[",
"'... | Get all available frontend modules to make module selection in block.
@return array | [
"Get",
"all",
"available",
"frontend",
"modules",
"to",
"make",
"module",
"selection",
"in",
"block",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/frontend/blocks/ModuleBlock.php#L122-L129 |
luyadev/luya-module-cms | src/frontend/blocks/ModuleBlock.php | ModuleBlock.moduleContent | public function moduleContent($moduleName)
{
if ($this->isAdminContext() || empty($moduleName) || count($this->getEnvOptions()) === 0 || !Yii::$app->hasModule($moduleName)) {
return;
}
// get module
$module = Yii::$app->getModule($moduleName);
$module->co... | php | public function moduleContent($moduleName)
{
if ($this->isAdminContext() || empty($moduleName) || count($this->getEnvOptions()) === 0 || !Yii::$app->hasModule($moduleName)) {
return;
}
// get module
$module = Yii::$app->getModule($moduleName);
$module->co... | [
"public",
"function",
"moduleContent",
"(",
"$",
"moduleName",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isAdminContext",
"(",
")",
"||",
"empty",
"(",
"$",
"moduleName",
")",
"||",
"count",
"(",
"$",
"this",
"->",
"getEnvOptions",
"(",
")",
")",
"===",... | Return the Module output based on the module name.
@param string $moduleName
@return string|null|\yii\web\Response | [
"Return",
"the",
"Module",
"output",
"based",
"on",
"the",
"module",
"name",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/frontend/blocks/ModuleBlock.php#L137-L173 |
luyadev/luya-module-cms | src/admin/apis/RedirectController.php | RedirectController.actionCatch | public function actionCatch($path)
{
$compositePath = Yii::$app->composition->prependTo($path);
foreach (Redirect::find()->all() as $redirect) {
if ($redirect->matchRequestPath($path)) {
return $redirect;
}
// if its a multi linguage website and t... | php | public function actionCatch($path)
{
$compositePath = Yii::$app->composition->prependTo($path);
foreach (Redirect::find()->all() as $redirect) {
if ($redirect->matchRequestPath($path)) {
return $redirect;
}
// if its a multi linguage website and t... | [
"public",
"function",
"actionCatch",
"(",
"$",
"path",
")",
"{",
"$",
"compositePath",
"=",
"Yii",
"::",
"$",
"app",
"->",
"composition",
"->",
"prependTo",
"(",
"$",
"path",
")",
";",
"foreach",
"(",
"Redirect",
"::",
"find",
"(",
")",
"->",
"all",
... | Find a redirect object for a given path info.
An example using path would be: Yii::$app->request->pathInfo
url: https://example.com/hello/world
path: hello/world
@param string $path The path to check inside the redirect list.
@return array|false
@since 1.0.9 | [
"Find",
"a",
"redirect",
"object",
"for",
"a",
"given",
"path",
"info",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/admin/apis/RedirectController.php#L32-L50 |
luyadev/luya-module-cms | src/models/Layout.php | Layout.getJsonConfig | public function getJsonConfig($node = null)
{
$json = Json::decode($this->json_config);
if (!$node) {
return $json;
}
if (isset($json[$node])) {
return $json[$node];
}
return [];
} | php | public function getJsonConfig($node = null)
{
$json = Json::decode($this->json_config);
if (!$node) {
return $json;
}
if (isset($json[$node])) {
return $json[$node];
}
return [];
} | [
"public",
"function",
"getJsonConfig",
"(",
"$",
"node",
"=",
"null",
")",
"{",
"$",
"json",
"=",
"Json",
"::",
"decode",
"(",
"$",
"this",
"->",
"json_config",
")",
";",
"if",
"(",
"!",
"$",
"node",
")",
"{",
"return",
"$",
"json",
";",
"}",
"if... | Get the json config as array.
@param string $node Get a given key from the config array.
@return array If the given node is not found an empty array will be returned. | [
"Get",
"the",
"json",
"config",
"as",
"array",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/models/Layout.php#L78-L91 |
luyadev/luya-module-cms | src/menu/Item.php | Item.getLink | public function getLink()
{
// take care of redirect
if ($this->getType() === 3 && !empty($this->redirectMapData('value'))) {
// generate convert object to determine correctn usage.
$converter = new LinkConverter([
'type' => $this->redirectMapData... | php | public function getLink()
{
// take care of redirect
if ($this->getType() === 3 && !empty($this->redirectMapData('value'))) {
// generate convert object to determine correctn usage.
$converter = new LinkConverter([
'type' => $this->redirectMapData... | [
"public",
"function",
"getLink",
"(",
")",
"{",
"// take care of redirect",
"if",
"(",
"$",
"this",
"->",
"getType",
"(",
")",
"===",
"3",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"redirectMapData",
"(",
"'value'",
")",
")",
")",
"{",
"// generate con... | Returns the current item link relative path with composition (language). The
path is always relativ to the host.
Hidden links will be returned from getLink. So if you make a link
from a page to a hidden page, the link of the hidden page will be returned and the link
will be successfully displayed
@return string The l... | [
"Returns",
"the",
"current",
"item",
"link",
"relative",
"path",
"with",
"composition",
"(",
"language",
")",
".",
"The",
"path",
"is",
"always",
"relativ",
"to",
"the",
"host",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/menu/Item.php#L418-L459 |
luyadev/luya-module-cms | src/menu/Item.php | Item.getParent | public function getParent()
{
return (new Query())->where(['nav_id' => $this->parentNavId, 'container' => $this->getContainer()])->with($this->_with)->lang($this->lang)->one();
} | php | public function getParent()
{
return (new Query())->where(['nav_id' => $this->parentNavId, 'container' => $this->getContainer()])->with($this->_with)->lang($this->lang)->one();
} | [
"public",
"function",
"getParent",
"(",
")",
"{",
"return",
"(",
"new",
"Query",
"(",
")",
")",
"->",
"where",
"(",
"[",
"'nav_id'",
"=>",
"$",
"this",
"->",
"parentNavId",
",",
"'container'",
"=>",
"$",
"this",
"->",
"getContainer",
"(",
")",
"]",
"... | Returns a Item-Object of the parent element, if no parent element exists returns false.
@return \luya\cms\menu\Item|boolean Returns the parent item-object or false if not exists. | [
"Returns",
"a",
"Item",
"-",
"Object",
"of",
"the",
"parent",
"element",
"if",
"no",
"parent",
"element",
"exists",
"returns",
"false",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/menu/Item.php#L511-L514 |
luyadev/luya-module-cms | src/menu/Item.php | Item.getParents | public function getParents()
{
$parent = $this->with($this->_with)->getParent();
$data = [];
while ($parent) {
$data[] = $parent;
$parent = $parent->with($this->_with)->getParent();
}
return array_reverse($data);
} | php | public function getParents()
{
$parent = $this->with($this->_with)->getParent();
$data = [];
while ($parent) {
$data[] = $parent;
$parent = $parent->with($this->_with)->getParent();
}
return array_reverse($data);
} | [
"public",
"function",
"getParents",
"(",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"with",
"(",
"$",
"this",
"->",
"_with",
")",
"->",
"getParent",
"(",
")",
";",
"$",
"data",
"=",
"[",
"]",
";",
"while",
"(",
"$",
"parent",
")",
"{",
"$... | Return all parent elements **without** the current item.
@return array An array with Item-Objects. | [
"Return",
"all",
"parent",
"elements",
"**",
"without",
"**",
"the",
"current",
"item",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/menu/Item.php#L521-L531 |
luyadev/luya-module-cms | src/menu/Item.php | Item.down | public function down(callable $fn)
{
$parent = $this->with($this->_with)->getParent();
while ($parent) {
$response = call_user_func_array($fn, [$parent]);
if ($response) {
return $response;
}
$parent = $parent->with($this->_with)->getPa... | php | public function down(callable $fn)
{
$parent = $this->with($this->_with)->getParent();
while ($parent) {
$response = call_user_func_array($fn, [$parent]);
if ($response) {
return $response;
}
$parent = $parent->with($this->_with)->getPa... | [
"public",
"function",
"down",
"(",
"callable",
"$",
"fn",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"with",
"(",
"$",
"this",
"->",
"_with",
")",
"->",
"getParent",
"(",
")",
";",
"while",
"(",
"$",
"parent",
")",
"{",
"$",
"response",
"="... | Go down to a given element which is evalutaed trough a callable.
Iterate trough parent elements until the last.
```php
$item = Yii::$app->menu->current->down(function(Item $item) {
if ($item->depth == 1) {
return $item;
}
});
```
@param callable $fn A function which holds the current iterated item.
@return static|bo... | [
"Go",
"down",
"to",
"a",
"given",
"element",
"which",
"is",
"evalutaed",
"trough",
"a",
"callable",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/menu/Item.php#L550-L562 |
luyadev/luya-module-cms | src/menu/Item.php | Item.getSiblings | public function getSiblings()
{
return (new Query())->where(['parent_nav_id' => $this->parentNavId, 'container' => $this->container])->with($this->_with)->lang($this->lang)->all();
} | php | public function getSiblings()
{
return (new Query())->where(['parent_nav_id' => $this->parentNavId, 'container' => $this->container])->with($this->_with)->lang($this->lang)->all();
} | [
"public",
"function",
"getSiblings",
"(",
")",
"{",
"return",
"(",
"new",
"Query",
"(",
")",
")",
"->",
"where",
"(",
"[",
"'parent_nav_id'",
"=>",
"$",
"this",
"->",
"parentNavId",
",",
"'container'",
"=>",
"$",
"this",
"->",
"container",
"]",
")",
"-... | Get all sibilings for the current item, this also includes the current item iteself.
@return array An array with all item-object siblings | [
"Get",
"all",
"sibilings",
"for",
"the",
"current",
"item",
"this",
"also",
"includes",
"the",
"current",
"item",
"iteself",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/menu/Item.php#L569-L572 |
luyadev/luya-module-cms | src/menu/Item.php | Item.getNextSibling | public function getNextSibling()
{
return (new Query())
->where(['parent_nav_id' => $this->parentNavId, 'container' => $this->container])
->andWhere(['>', 'sort_index', $this->sortIndex])
->with($this->_with)
->lang($this->lang)
->orderBy(['sort_in... | php | public function getNextSibling()
{
return (new Query())
->where(['parent_nav_id' => $this->parentNavId, 'container' => $this->container])
->andWhere(['>', 'sort_index', $this->sortIndex])
->with($this->_with)
->lang($this->lang)
->orderBy(['sort_in... | [
"public",
"function",
"getNextSibling",
"(",
")",
"{",
"return",
"(",
"new",
"Query",
"(",
")",
")",
"->",
"where",
"(",
"[",
"'parent_nav_id'",
"=>",
"$",
"this",
"->",
"parentNavId",
",",
"'container'",
"=>",
"$",
"this",
"->",
"container",
"]",
")",
... | Get the next sibling in the current siblings list.
If there is no next sibling (assuming its the last sibling item in the list) false is returned, otherwise the {{luya\cms\menu\Item}} is returned.
@return \luya\cms\menu\Item|boolean Returns the next sibling based on the current sibling, if not found false is returned... | [
"Get",
"the",
"next",
"sibling",
"in",
"the",
"current",
"siblings",
"list",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/menu/Item.php#L581-L590 |
luyadev/luya-module-cms | src/menu/Item.php | Item.getPrevSibling | public function getPrevSibling()
{
return (new Query())
->where(['parent_nav_id' => $this->parentNavId, 'container' => $this->container])
->andWhere(['<', 'sort_index', $this->sortIndex])
->with($this->_with)
->lang($this->lang)
->orderBy(['sort_in... | php | public function getPrevSibling()
{
return (new Query())
->where(['parent_nav_id' => $this->parentNavId, 'container' => $this->container])
->andWhere(['<', 'sort_index', $this->sortIndex])
->with($this->_with)
->lang($this->lang)
->orderBy(['sort_in... | [
"public",
"function",
"getPrevSibling",
"(",
")",
"{",
"return",
"(",
"new",
"Query",
"(",
")",
")",
"->",
"where",
"(",
"[",
"'parent_nav_id'",
"=>",
"$",
"this",
"->",
"parentNavId",
",",
"'container'",
"=>",
"$",
"this",
"->",
"container",
"]",
")",
... | Get the previous sibling in the current siblings list.
If there is no previous sibling (assuming its the first sibling item in the list) false is returned, otherwise the {{luya\cms\menu\Item}} is returned.
@return \luya\cms\menu\Item|boolean Returns the previous sibling based on the current sibling, if not found fals... | [
"Get",
"the",
"previous",
"sibling",
"in",
"the",
"current",
"siblings",
"list",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/menu/Item.php#L599-L608 |
luyadev/luya-module-cms | src/menu/Item.php | Item.getTeardown | public function getTeardown()
{
$parent = $this->with($this->_with)->getParent();
$current = $this;
$data[$current->id] = $current;
while ($parent) {
$data[$parent->id] = $parent;
$parent = $parent->with($this->_with)->getParent();
}
return ar... | php | public function getTeardown()
{
$parent = $this->with($this->_with)->getParent();
$current = $this;
$data[$current->id] = $current;
while ($parent) {
$data[$parent->id] = $parent;
$parent = $parent->with($this->_with)->getParent();
}
return ar... | [
"public",
"function",
"getTeardown",
"(",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"with",
"(",
"$",
"this",
"->",
"_with",
")",
"->",
"getParent",
"(",
")",
";",
"$",
"current",
"=",
"$",
"this",
";",
"$",
"data",
"[",
"$",
"current",
"-... | Return all parent elements **with** the current item.
@return array An array with Item-Objects. | [
"Return",
"all",
"parent",
"elements",
"**",
"with",
"**",
"the",
"current",
"item",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/menu/Item.php#L615-L626 |
luyadev/luya-module-cms | src/menu/Item.php | Item.getChildren | public function getChildren()
{
return (new Query())->where(['parent_nav_id' => $this->navId, 'container' => $this->getContainer()])->with($this->_with)->lang($this->lang)->all();
} | php | public function getChildren()
{
return (new Query())->where(['parent_nav_id' => $this->navId, 'container' => $this->getContainer()])->with($this->_with)->lang($this->lang)->all();
} | [
"public",
"function",
"getChildren",
"(",
")",
"{",
"return",
"(",
"new",
"Query",
"(",
")",
")",
"->",
"where",
"(",
"[",
"'parent_nav_id'",
"=>",
"$",
"this",
"->",
"navId",
",",
"'container'",
"=>",
"$",
"this",
"->",
"getContainer",
"(",
")",
"]",
... | Get all children of the current item. Children means going the depth/menulevel down e.g. from 1 to 2.
@return \luya\cms\menu\QueryIterator Returns all children | [
"Get",
"all",
"children",
"of",
"the",
"current",
"item",
".",
"Children",
"means",
"going",
"the",
"depth",
"/",
"menulevel",
"down",
"e",
".",
"g",
".",
"from",
"1",
"to",
"2",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/menu/Item.php#L633-L636 |
luyadev/luya-module-cms | src/menu/Item.php | Item.getModel | public function getModel()
{
if ($this->_model === null) {
$this->_model = Nav::findOne($this->navId);
if (empty($this->_model)) {
throw new Exception('The model active record could not be found for the corresponding nav item. Maybe you have inconsistent ... | php | public function getModel()
{
if ($this->_model === null) {
$this->_model = Nav::findOne($this->navId);
if (empty($this->_model)) {
throw new Exception('The model active record could not be found for the corresponding nav item. Maybe you have inconsistent ... | [
"public",
"function",
"getModel",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_model",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_model",
"=",
"Nav",
"::",
"findOne",
"(",
"$",
"this",
"->",
"navId",
")",
";",
"if",
"(",
"empty",
"(",
"$",
... | Get the ActiveRecord Model for the current Nav Model.
@throws \luya\cms\Exception
@return \luya\cms\models\Nav Returns the {{\luya\cms\models\Nav}} object for the current navigation item. | [
"Get",
"the",
"ActiveRecord",
"Model",
"for",
"the",
"current",
"Nav",
"Model",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/menu/Item.php#L656-L667 |
luyadev/luya-module-cms | src/menu/Item.php | Item.getPropertyValue | public function getPropertyValue($varName, $defaultValue = null)
{
return $this->getProperty($varName) ? $this->getProperty($varName)->getValue() : $defaultValue;
} | php | public function getPropertyValue($varName, $defaultValue = null)
{
return $this->getProperty($varName) ? $this->getProperty($varName)->getValue() : $defaultValue;
} | [
"public",
"function",
"getPropertyValue",
"(",
"$",
"varName",
",",
"$",
"defaultValue",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getProperty",
"(",
"$",
"varName",
")",
"?",
"$",
"this",
"->",
"getProperty",
"(",
"$",
"varName",
")",
"->",
... | Get the value of a Property Object.
Compared to {{luya\cms\menu\Item::getProperty}} this method returns only the value for a given property. If the
property is not assigned for the current Menu Item the $defaultValue will be returned, which is null by default.
@param string $varName The variable name of the property ... | [
"Get",
"the",
"value",
"of",
"a",
"Property",
"Object",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/menu/Item.php#L706-L709 |
luyadev/luya-module-cms | src/menu/Item.php | Item.without | public function without($without)
{
$without = (array) $without;
foreach ($without as $expression) {
$key = array_search($expression, $this->_with);
if ($key !== false) {
unset($this->_with[$key]);
}
}
return $this... | php | public function without($without)
{
$without = (array) $without;
foreach ($without as $expression) {
$key = array_search($expression, $this->_with);
if ($key !== false) {
unset($this->_with[$key]);
}
}
return $this... | [
"public",
"function",
"without",
"(",
"$",
"without",
")",
"{",
"$",
"without",
"=",
"(",
"array",
")",
"$",
"without",
";",
"foreach",
"(",
"$",
"without",
"as",
"$",
"expression",
")",
"{",
"$",
"key",
"=",
"array_search",
"(",
"$",
"expression",
"... | Unset a value from the `with()` method. Lets assume you want to to get the children with hidden
```php
foreach ($item->with('hidden')->children as $child) {
// but get the sibilings without the hidden state
$siblings = $child->without('hidden')->siblings;
}
```
@param string|array $without Can be a string `hidden` or... | [
"Unset",
"a",
"value",
"from",
"the",
"with",
"()",
"method",
".",
"Lets",
"assume",
"you",
"want",
"to",
"to",
"get",
"the",
"children",
"with",
"hidden"
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/menu/Item.php#L753-L765 |
luyadev/luya-module-cms | src/Menu.php | Menu.getLanguageContainer | public function getLanguageContainer($langShortCode)
{
if (!array_key_exists($langShortCode, $this->_languageContainer)) {
$this->_languageContainer[$langShortCode] = $this->loadLanguageContainer($langShortCode);
$this->trigger(self::EVENT_AFTER_LOAD);
}
return $this... | php | public function getLanguageContainer($langShortCode)
{
if (!array_key_exists($langShortCode, $this->_languageContainer)) {
$this->_languageContainer[$langShortCode] = $this->loadLanguageContainer($langShortCode);
$this->trigger(self::EVENT_AFTER_LOAD);
}
return $this... | [
"public",
"function",
"getLanguageContainer",
"(",
"$",
"langShortCode",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"langShortCode",
",",
"$",
"this",
"->",
"_languageContainer",
")",
")",
"{",
"$",
"this",
"->",
"_languageContainer",
"[",
"$",
... | Load and return the language container for the specific langShortCode, this method is used
when using the ArrayAccess offsetGet() method.
@param string $langShortCode A language short code which have to access in $this->getLanguages().
@return array An array containing all items in theyr keys for the provided language... | [
"Load",
"and",
"return",
"the",
"language",
"container",
"for",
"the",
"specific",
"langShortCode",
"this",
"method",
"is",
"used",
"when",
"using",
"the",
"ArrayAccess",
"offsetGet",
"()",
"method",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/Menu.php#L319-L327 |
luyadev/luya-module-cms | src/Menu.php | Menu.getLanguage | public function getLanguage($shortCode)
{
return (array_key_exists($shortCode, $this->getLanguages())) ? $this->getLanguages()[$shortCode] : false;
} | php | public function getLanguage($shortCode)
{
return (array_key_exists($shortCode, $this->getLanguages())) ? $this->getLanguages()[$shortCode] : false;
} | [
"public",
"function",
"getLanguage",
"(",
"$",
"shortCode",
")",
"{",
"return",
"(",
"array_key_exists",
"(",
"$",
"shortCode",
",",
"$",
"this",
"->",
"getLanguages",
"(",
")",
")",
")",
"?",
"$",
"this",
"->",
"getLanguages",
"(",
")",
"[",
"$",
"sho... | Get languag information for a specific language short code.
@param string $shortCode E.g. de or en
@return array|boolean If the shortCode exists an array with informations as returned, otherwise false. | [
"Get",
"languag",
"information",
"for",
"a",
"specific",
"language",
"short",
"code",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/Menu.php#L335-L338 |
luyadev/luya-module-cms | src/Menu.php | Menu.getLanguages | public function getLanguages()
{
if ($this->_languages === null) {
$this->_languages = (new DbQuery())->select(['short_code', 'id'])->indexBy('short_code')->from('admin_lang')->all();
}
return $this->_languages;
} | php | public function getLanguages()
{
if ($this->_languages === null) {
$this->_languages = (new DbQuery())->select(['short_code', 'id'])->indexBy('short_code')->from('admin_lang')->all();
}
return $this->_languages;
} | [
"public",
"function",
"getLanguages",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_languages",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_languages",
"=",
"(",
"new",
"DbQuery",
"(",
")",
")",
"->",
"select",
"(",
"[",
"'short_code'",
",",
"'id'... | Get an array with all available system languages based on the admin_lang table.
@return array An array where the key is the short_code and the value an array containing shortcode and id. | [
"Get",
"an",
"array",
"with",
"all",
"available",
"system",
"languages",
"based",
"on",
"the",
"admin_lang",
"table",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/Menu.php#L345-L352 |
luyadev/luya-module-cms | src/Menu.php | Menu.getRedirectMap | public function getRedirectMap()
{
if ($this->_redirectMap === null) {
$this->_redirectMap = (new DbQuery())->select(['id', 'type', 'value', 'target'])->from('cms_nav_item_redirect')->indexBy('id')->all();
}
return $this->_redirectMap;
} | php | public function getRedirectMap()
{
if ($this->_redirectMap === null) {
$this->_redirectMap = (new DbQuery())->select(['id', 'type', 'value', 'target'])->from('cms_nav_item_redirect')->indexBy('id')->all();
}
return $this->_redirectMap;
} | [
"public",
"function",
"getRedirectMap",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_redirectMap",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_redirectMap",
"=",
"(",
"new",
"DbQuery",
"(",
")",
")",
"->",
"select",
"(",
"[",
"'id'",
",",
"'type'... | Get an array containing all redirect items from the database table cms_nav_item_redirect.
@return array An array where the key is the id and the value an array containing id, type and value. | [
"Get",
"an",
"array",
"containing",
"all",
"redirect",
"items",
"from",
"the",
"database",
"table",
"cms_nav_item_redirect",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/Menu.php#L359-L366 |
luyadev/luya-module-cms | src/Menu.php | Menu.getCurrentAppendix | public function getCurrentAppendix()
{
if ($this->_current === null) {
$this->_current = $this->resolveCurrent();
}
return $this->_currentAppendix;
} | php | public function getCurrentAppendix()
{
if ($this->_current === null) {
$this->_current = $this->resolveCurrent();
}
return $this->_currentAppendix;
} | [
"public",
"function",
"getCurrentAppendix",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_current",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_current",
"=",
"$",
"this",
"->",
"resolveCurrent",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"_... | Returns the parts of the rules who do not belong to the current active menu item link.
For instance the current menu link is `/de/company/news` where this
page is declared as a module with urlRules, controllers and actions. If the url path is `/de/company/news/detail/my-first-news` the
appendix would be `detail/my-fir... | [
"Returns",
"the",
"parts",
"of",
"the",
"rules",
"who",
"do",
"not",
"belong",
"to",
"the",
"current",
"active",
"menu",
"item",
"link",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/Menu.php#L377-L384 |
luyadev/luya-module-cms | src/Menu.php | Menu.getCurrent | public function getCurrent()
{
if ($this->_current === null) {
$this->_current = $this->resolveCurrent();
$this->trigger(self::EVENT_AFTER_RESOLVE_CURRENT);
}
return $this->_current;
} | php | public function getCurrent()
{
if ($this->_current === null) {
$this->_current = $this->resolveCurrent();
$this->trigger(self::EVENT_AFTER_RESOLVE_CURRENT);
}
return $this->_current;
} | [
"public",
"function",
"getCurrent",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_current",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_current",
"=",
"$",
"this",
"->",
"resolveCurrent",
"(",
")",
";",
"$",
"this",
"->",
"trigger",
"(",
"self",
... | Get the current menu item resolved by active language (from composition).
@return \luya\cms\menu\Item An item-object for the current active item. | [
"Get",
"the",
"current",
"menu",
"item",
"resolved",
"by",
"active",
"language",
"(",
"from",
"composition",
")",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/Menu.php#L403-L411 |
luyadev/luya-module-cms | src/Menu.php | Menu.getLevelContainer | public function getLevelContainer($level, Item $baseItem = null)
{
// define if the requested level is the root line (level 1) or not
$rootLine = ($level === 1) ? true : false;
// countdown the level (as we need the parent of the element to get the children
$level--;
// forea... | php | public function getLevelContainer($level, Item $baseItem = null)
{
// define if the requested level is the root line (level 1) or not
$rootLine = ($level === 1) ? true : false;
// countdown the level (as we need the parent of the element to get the children
$level--;
// forea... | [
"public",
"function",
"getLevelContainer",
"(",
"$",
"level",
",",
"Item",
"$",
"baseItem",
"=",
"null",
")",
"{",
"// define if the requested level is the root line (level 1) or not",
"$",
"rootLine",
"=",
"(",
"$",
"level",
"===",
"1",
")",
"?",
"true",
":",
"... | Get all items for a specific level.
@param integer $level Define the level you like to get the items from, the hirarchy starts by the level 1, which is the root line.
@param \luya\cms\menu\Item $baseItem Provide an optional element which represents the base calculation item for Theme
siblings/children calculation, thi... | [
"Get",
"all",
"items",
"for",
"a",
"specific",
"level",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/Menu.php#L423-L448 |
luyadev/luya-module-cms | src/Menu.php | Menu.getLevelCurrent | public function getLevelCurrent($level)
{
$i = 1;
foreach ($this->getCurrent()->with('hidden')->getTeardown() as $item) {
if ($i == $level) {
return $item;
}
++$i;
}
return false;
} | php | public function getLevelCurrent($level)
{
$i = 1;
foreach ($this->getCurrent()->with('hidden')->getTeardown() as $item) {
if ($i == $level) {
return $item;
}
++$i;
}
return false;
} | [
"public",
"function",
"getLevelCurrent",
"(",
"$",
"level",
")",
"{",
"$",
"i",
"=",
"1",
";",
"foreach",
"(",
"$",
"this",
"->",
"getCurrent",
"(",
")",
"->",
"with",
"(",
"'hidden'",
")",
"->",
"getTeardown",
"(",
")",
"as",
"$",
"item",
")",
"{"... | Get the current item for specified level/depth. Menus always start on level/depth 1. This works
only in reversed order, to get the parent level from a child!
@param integer $level Level menu starts with 1
@return \luya\cms\menu\Item|boolean An item-object for the specific level current, false otherwise. | [
"Get",
"the",
"current",
"item",
"for",
"specified",
"level",
"/",
"depth",
".",
"Menus",
"always",
"start",
"on",
"level",
"/",
"depth",
"1",
".",
"This",
"works",
"only",
"in",
"reversed",
"order",
"to",
"get",
"the",
"parent",
"level",
"from",
"a",
... | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/Menu.php#L457-L468 |
luyadev/luya-module-cms | src/Menu.php | Menu.findAll | public function findAll(array $where, $preloadModels = false)
{
return (new MenuQuery())->where($where)->preloadModels($preloadModels)->all();
} | php | public function findAll(array $where, $preloadModels = false)
{
return (new MenuQuery())->where($where)->preloadModels($preloadModels)->all();
} | [
"public",
"function",
"findAll",
"(",
"array",
"$",
"where",
",",
"$",
"preloadModels",
"=",
"false",
")",
"{",
"return",
"(",
"new",
"MenuQuery",
"(",
")",
")",
"->",
"where",
"(",
"$",
"where",
")",
"->",
"preloadModels",
"(",
"$",
"preloadModels",
"... | Wrapper method to get all menu items for the current language without hidden items for
the specific where statement.
@param array $where See {{\luya\cms\menu\Query::where()}}
@param boolean $preloadModels Whether to preload all models for the given menu Query. See {{luya\cms\menu\Query::preloadModels()}}
@see \luya\cm... | [
"Wrapper",
"method",
"to",
"get",
"all",
"menu",
"items",
"for",
"the",
"current",
"language",
"without",
"hidden",
"items",
"for",
"the",
"specific",
"where",
"statement",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/Menu.php#L499-L502 |
luyadev/luya-module-cms | src/Menu.php | Menu.resolveCurrent | private function resolveCurrent()
{
$requestPath = $this->request->get('path', null);
if (empty($requestPath)) {
$home = $this->getHome();
if (!$home) {
throw new NotFoundHttpException('Home item could not be found, have you forget to set a default page?');
... | php | private function resolveCurrent()
{
$requestPath = $this->request->get('path', null);
if (empty($requestPath)) {
$home = $this->getHome();
if (!$home) {
throw new NotFoundHttpException('Home item could not be found, have you forget to set a default page?');
... | [
"private",
"function",
"resolveCurrent",
"(",
")",
"{",
"$",
"requestPath",
"=",
"$",
"this",
"->",
"request",
"->",
"get",
"(",
"'path'",
",",
"null",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"requestPath",
")",
")",
"{",
"$",
"home",
"=",
"$",
"th... | Find the current element based on the request get property 'path'.
1. if request path is empty us the getHome() to return alias.
2. find menu item based on the end of the current path (via array_pop)
3. if no item could be found the home item will be returned
4. otherwise return the alias match from step 2.
@return It... | [
"Find",
"the",
"current",
"element",
"based",
"on",
"the",
"request",
"get",
"property",
"path",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/Menu.php#L529-L575 |
luyadev/luya-module-cms | src/Menu.php | Menu.buildItemLink | public function buildItemLink($alias, $langShortCode)
{
return Yii::$app->getUrlManager()->prependBaseUrl($this->composition->prependTo($alias, $this->composition->createRouteEnsure(['langShortCode' => $langShortCode])));
} | php | public function buildItemLink($alias, $langShortCode)
{
return Yii::$app->getUrlManager()->prependBaseUrl($this->composition->prependTo($alias, $this->composition->createRouteEnsure(['langShortCode' => $langShortCode])));
} | [
"public",
"function",
"buildItemLink",
"(",
"$",
"alias",
",",
"$",
"langShortCode",
")",
"{",
"return",
"Yii",
"::",
"$",
"app",
"->",
"getUrlManager",
"(",
")",
"->",
"prependBaseUrl",
"(",
"$",
"this",
"->",
"composition",
"->",
"prependTo",
"(",
"$",
... | prepand the base url for the provided alias.
@param string $alias
@return string | [
"prepand",
"the",
"base",
"url",
"for",
"the",
"provided",
"alias",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/Menu.php#L583-L586 |
luyadev/luya-module-cms | src/Menu.php | Menu.getModulesMap | public function getModulesMap()
{
if ($this->_modulesMap === null) {
$this->_modulesMap = NavItemModule::find()->select(['module_name', 'id'])->indexBy('id')->asArray()->all();
}
return $this->_modulesMap;
} | php | public function getModulesMap()
{
if ($this->_modulesMap === null) {
$this->_modulesMap = NavItemModule::find()->select(['module_name', 'id'])->indexBy('id')->asArray()->all();
}
return $this->_modulesMap;
} | [
"public",
"function",
"getModulesMap",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_modulesMap",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_modulesMap",
"=",
"NavItemModule",
"::",
"find",
"(",
")",
"->",
"select",
"(",
"[",
"'module_name'",
",",
... | Return all nav item modules to request data later in items
@return array An array with all modules index by the id | [
"Return",
"all",
"nav",
"item",
"modules",
"to",
"request",
"data",
"later",
"in",
"items"
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/Menu.php#L593-L600 |
luyadev/luya-module-cms | src/Menu.php | Menu.getNavData | private function getNavData($langId)
{
return (new DbQuery())
->from(['cms_nav_item item'])
->select(['item.id', 'item.nav_id', 'item.title', 'item.description', 'item.keywords', 'item.image_id', 'item.is_url_strict_parsing_disabled', 'item.alias', 'item.title_tag', 'item.timestamp_c... | php | private function getNavData($langId)
{
return (new DbQuery())
->from(['cms_nav_item item'])
->select(['item.id', 'item.nav_id', 'item.title', 'item.description', 'item.keywords', 'item.image_id', 'item.is_url_strict_parsing_disabled', 'item.alias', 'item.title_tag', 'item.timestamp_c... | [
"private",
"function",
"getNavData",
"(",
"$",
"langId",
")",
"{",
"return",
"(",
"new",
"DbQuery",
"(",
")",
")",
"->",
"from",
"(",
"[",
"'cms_nav_item item'",
"]",
")",
"->",
"select",
"(",
"[",
"'item.id'",
",",
"'item.nav_id'",
",",
"'item.title'",
... | load all navigation items for a specific language id.
@param integer $langId
@return array | [
"load",
"all",
"navigation",
"items",
"for",
"a",
"specific",
"language",
"id",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/Menu.php#L608-L621 |
luyadev/luya-module-cms | src/Menu.php | Menu.buildIndexForContainer | private function buildIndexForContainer($data)
{
$this->_paths = [];
$this->_nodes = [];
foreach ($data as $item) {
$this->_nodes[$item['nav_id']] = ['parent_nav_id' => $item['parent_nav_id'], 'alias' => $item['alias'], 'nav_id' => $item['nav_id']];
}
... | php | private function buildIndexForContainer($data)
{
$this->_paths = [];
$this->_nodes = [];
foreach ($data as $item) {
$this->_nodes[$item['nav_id']] = ['parent_nav_id' => $item['parent_nav_id'], 'alias' => $item['alias'], 'nav_id' => $item['nav_id']];
}
... | [
"private",
"function",
"buildIndexForContainer",
"(",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"_paths",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"_nodes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"item",
")",
"{",
"$",
"this",
... | Helper method to build an index with all the alias paths to build the correct links.
@param array $data
@return array An array with the index where the key is the nav_id | [
"Helper",
"method",
"to",
"build",
"an",
"index",
"with",
"all",
"the",
"alias",
"paths",
"to",
"build",
"the",
"correct",
"links",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/Menu.php#L633-L647 |
luyadev/luya-module-cms | src/Menu.php | Menu.aliasMatch | private function aliasMatch(array $urlParts, $strictParsing = false)
{
if ($strictParsing) {
$query = (new MenuQuery())
->where([self::FIELD_ALIAS => implode('/', $urlParts)])
->with('hidden')
->andWhere([self::FIELD_TYPE => self::ITEM_TYPE_MODULE]... | php | private function aliasMatch(array $urlParts, $strictParsing = false)
{
if ($strictParsing) {
$query = (new MenuQuery())
->where([self::FIELD_ALIAS => implode('/', $urlParts)])
->with('hidden')
->andWhere([self::FIELD_TYPE => self::ITEM_TYPE_MODULE]... | [
"private",
"function",
"aliasMatch",
"(",
"array",
"$",
"urlParts",
",",
"$",
"strictParsing",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"strictParsing",
")",
"{",
"$",
"query",
"=",
"(",
"new",
"MenuQuery",
"(",
")",
")",
"->",
"where",
"(",
"[",
"sel... | helper method to see if the request url can be found in the active container.
@param array $urlParts
@return bool|Item | [
"helper",
"method",
"to",
"see",
"if",
"the",
"request",
"url",
"can",
"be",
"found",
"in",
"the",
"active",
"container",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/Menu.php#L667-L690 |
luyadev/luya-module-cms | src/Menu.php | Menu.loadLanguageContainer | private function loadLanguageContainer($langShortCode)
{
$cacheKey = $this->_cachePrefix.$langShortCode;
$languageContainer = $this->getHasCache($cacheKey);
if ($languageContainer === false) {
$lang = $this->getLanguage($langShortCode);
if (!$la... | php | private function loadLanguageContainer($langShortCode)
{
$cacheKey = $this->_cachePrefix.$langShortCode;
$languageContainer = $this->getHasCache($cacheKey);
if ($languageContainer === false) {
$lang = $this->getLanguage($langShortCode);
if (!$la... | [
"private",
"function",
"loadLanguageContainer",
"(",
"$",
"langShortCode",
")",
"{",
"$",
"cacheKey",
"=",
"$",
"this",
"->",
"_cachePrefix",
".",
"$",
"langShortCode",
";",
"$",
"languageContainer",
"=",
"$",
"this",
"->",
"getHasCache",
"(",
"$",
"cacheKey",... | Helper method to load all contaienr data for a specific langauge.
@param string $langShortCode e.g. de
@return array
@throws NotFoundHttpException | [
"Helper",
"method",
"to",
"load",
"all",
"contaienr",
"data",
"for",
"a",
"specific",
"langauge",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/Menu.php#L699-L758 |
luyadev/luya-module-cms | src/Menu.php | Menu.flushCache | public function flushCache()
{
foreach ($this->getLanguages() as $lang) {
$this->deleteHasCache($this->_cachePrefix . $lang['short_code']);
}
} | php | public function flushCache()
{
foreach ($this->getLanguages() as $lang) {
$this->deleteHasCache($this->_cachePrefix . $lang['short_code']);
}
} | [
"public",
"function",
"flushCache",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getLanguages",
"(",
")",
"as",
"$",
"lang",
")",
"{",
"$",
"this",
"->",
"deleteHasCache",
"(",
"$",
"this",
"->",
"_cachePrefix",
".",
"$",
"lang",
"[",
"'short_cod... | Flush all caching data for the menu for each language | [
"Flush",
"all",
"caching",
"data",
"for",
"the",
"menu",
"for",
"each",
"language"
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/Menu.php#L772-L777 |
luyadev/luya-module-cms | src/helpers/Url.php | Url.toModule | public static function toModule($moduleName)
{
$item = Yii::$app->menu->find()->where(['module_name' => $moduleName])->with(['hidden'])->one();
if ($item) {
return $item->link;
}
return $moduleName;
} | php | public static function toModule($moduleName)
{
$item = Yii::$app->menu->find()->where(['module_name' => $moduleName])->with(['hidden'])->one();
if ($item) {
return $item->link;
}
return $moduleName;
} | [
"public",
"static",
"function",
"toModule",
"(",
"$",
"moduleName",
")",
"{",
"$",
"item",
"=",
"Yii",
"::",
"$",
"app",
"->",
"menu",
"->",
"find",
"(",
")",
"->",
"where",
"(",
"[",
"'module_name'",
"=>",
"$",
"moduleName",
"]",
")",
"->",
"with",
... | if the module could not be found (not registered in the cms) the method returns the provided module name.
returns only ONE even if there are more! not good structure inside the cms?
@param string $moduleName
@return string The full_url from links component. | [
"if",
"the",
"module",
"could",
"not",
"be",
"found",
"(",
"not",
"registered",
"in",
"the",
"cms",
")",
"the",
"method",
"returns",
"the",
"provided",
"module",
"name",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/helpers/Url.php#L30-L39 |
luyadev/luya-module-cms | src/helpers/Url.php | Url.toModuleRoute | public static function toModuleRoute($moduleName, array $route)
{
$item = Yii::$app->menu->find()->where(['module_name' => $moduleName])->with(['hidden'])->one();
if ($item) {
return static::toMenuItem($item->id, $route);
}
throw new Exception("The module route ... | php | public static function toModuleRoute($moduleName, array $route)
{
$item = Yii::$app->menu->find()->where(['module_name' => $moduleName])->with(['hidden'])->one();
if ($item) {
return static::toMenuItem($item->id, $route);
}
throw new Exception("The module route ... | [
"public",
"static",
"function",
"toModuleRoute",
"(",
"$",
"moduleName",
",",
"array",
"$",
"route",
")",
"{",
"$",
"item",
"=",
"Yii",
"::",
"$",
"app",
"->",
"menu",
"->",
"find",
"(",
")",
"->",
"where",
"(",
"[",
"'module_name'",
"=>",
"$",
"modu... | Helper method to create a route based on the module name and the route and params.
Use the route as defined in the modules' $urlRules array in order to generate the URL according
to the rules' pattern. Example:
```php
Url::toModuleRoute('blog', ['/blog/default/index', 'year' => 2016, 'month' => '07]);
```
generates ... | [
"Helper",
"method",
"to",
"create",
"a",
"route",
"based",
"on",
"the",
"module",
"name",
"and",
"the",
"route",
"and",
"params",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/helpers/Url.php#L70-L79 |
luyadev/luya-module-cms | src/helpers/Url.php | Url.toMenuNav | public static function toMenuNav($navId, array $route)
{
$menu = Yii::$app->menu->find()->where([Menu::FIELD_NAVID => $navId])->with(['hidden'])->one();
return static::toMenuNavItem($menu->id, $route);
} | php | public static function toMenuNav($navId, array $route)
{
$menu = Yii::$app->menu->find()->where([Menu::FIELD_NAVID => $navId])->with(['hidden'])->one();
return static::toMenuNavItem($menu->id, $route);
} | [
"public",
"static",
"function",
"toMenuNav",
"(",
"$",
"navId",
",",
"array",
"$",
"route",
")",
"{",
"$",
"menu",
"=",
"Yii",
"::",
"$",
"app",
"->",
"menu",
"->",
"find",
"(",
")",
"->",
"where",
"(",
"[",
"Menu",
"::",
"FIELD_NAVID",
"=>",
"$",
... | Create an url to a cms page based on the nav id.
This method uses the language independent navId which is displayed in the cms page tree.
@param integer $navId The nav id of the given page which is the base path for the generated url.
@param array $route An array with a route and optional params `['/module/controller... | [
"Create",
"an",
"url",
"to",
"a",
"cms",
"page",
"based",
"on",
"the",
"nav",
"id",
"."
] | train | https://github.com/luyadev/luya-module-cms/blob/9a74bc5869c365e50bc455c4860e3af8c6145d34/src/helpers/Url.php#L123-L128 |
Spomky-Labs/base64url | src/Base64Url.php | Base64Url.decode | public static function decode(string $data): string
{
$decoded = base64_decode(strtr($data, '-_', '+/'), true);
if (false === $decoded) {
throw new InvalidArgumentException('Invalid data provided');
}
return $decoded;
} | php | public static function decode(string $data): string
{
$decoded = base64_decode(strtr($data, '-_', '+/'), true);
if (false === $decoded) {
throw new InvalidArgumentException('Invalid data provided');
}
return $decoded;
} | [
"public",
"static",
"function",
"decode",
"(",
"string",
"$",
"data",
")",
":",
"string",
"{",
"$",
"decoded",
"=",
"base64_decode",
"(",
"strtr",
"(",
"$",
"data",
",",
"'-_'",
",",
"'+/'",
")",
",",
"true",
")",
";",
"if",
"(",
"false",
"===",
"$... | @param string $data The data to decode
@throws InvalidArgumentException
@return string The data decoded | [
"@param",
"string",
"$data",
"The",
"data",
"to",
"decode"
] | train | https://github.com/Spomky-Labs/base64url/blob/a5eaf0352b89abdd93f7fb4668dd4dbfe8831f6d/src/Base64Url.php#L47-L55 |
johnpbloch/wordpress-core-installer | src/johnpbloch/Composer/WordPressCoreInstaller.php | WordPressCoreInstaller.getInstallPath | public function getInstallPath( PackageInterface $package ) {
$installationDir = false;
$prettyName = $package->getPrettyName();
if ( $this->composer->getPackage() ) {
$topExtra = $this->composer->getPackage()->getExtra();
if ( ! empty( $topExtra['wordpress-install-dir'] ) ) {
$installationDir = $t... | php | public function getInstallPath( PackageInterface $package ) {
$installationDir = false;
$prettyName = $package->getPrettyName();
if ( $this->composer->getPackage() ) {
$topExtra = $this->composer->getPackage()->getExtra();
if ( ! empty( $topExtra['wordpress-install-dir'] ) ) {
$installationDir = $t... | [
"public",
"function",
"getInstallPath",
"(",
"PackageInterface",
"$",
"package",
")",
"{",
"$",
"installationDir",
"=",
"false",
";",
"$",
"prettyName",
"=",
"$",
"package",
"->",
"getPrettyName",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"composer",
"-... | {@inheritDoc} | [
"{"
] | train | https://github.com/johnpbloch/wordpress-core-installer/blob/ec541ae6666c1994c5944a3a5797dd455b6b8ff2/src/johnpbloch/Composer/WordPressCoreInstaller.php#L42-L78 |
dflydev/dflydev-dot-access-data | src/Data.php | Data.append | public function append($key, $value = null)
{
if (0 == strlen($key)) {
throw new RuntimeException("Key cannot be an empty string");
}
$currentValue =& $this->data;
$keyPath = explode('.', $key);
if (1 == count($keyPath)) {
if (!isset($currentValue[$k... | php | public function append($key, $value = null)
{
if (0 == strlen($key)) {
throw new RuntimeException("Key cannot be an empty string");
}
$currentValue =& $this->data;
$keyPath = explode('.', $key);
if (1 == count($keyPath)) {
if (!isset($currentValue[$k... | [
"public",
"function",
"append",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"0",
"==",
"strlen",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Key cannot be an empty string\"",
")",
";",
"}",
"$",... | {@inheritdoc} | [
"{"
] | train | https://github.com/dflydev/dflydev-dot-access-data/blob/b5899e067a8eb6fa4e4c64318a0bd71bad8c272c/src/Data.php#L38-L79 |
dflydev/dflydev-dot-access-data | src/Data.php | Data.set | public function set($key, $value = null)
{
if (0 == strlen($key)) {
throw new RuntimeException("Key cannot be an empty string");
}
$currentValue =& $this->data;
$keyPath = explode('.', $key);
if (1 == count($keyPath)) {
$currentValue[$key] = $value;
... | php | public function set($key, $value = null)
{
if (0 == strlen($key)) {
throw new RuntimeException("Key cannot be an empty string");
}
$currentValue =& $this->data;
$keyPath = explode('.', $key);
if (1 == count($keyPath)) {
$currentValue[$key] = $value;
... | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"0",
"==",
"strlen",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Key cannot be an empty string\"",
")",
";",
"}",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/dflydev/dflydev-dot-access-data/blob/b5899e067a8eb6fa4e4c64318a0bd71bad8c272c/src/Data.php#L84-L111 |
dflydev/dflydev-dot-access-data | src/Data.php | Data.remove | public function remove($key)
{
if (0 == strlen($key)) {
throw new RuntimeException("Key cannot be an empty string");
}
$currentValue =& $this->data;
$keyPath = explode('.', $key);
if (1 == count($keyPath)) {
unset($currentValue[$key]);
r... | php | public function remove($key)
{
if (0 == strlen($key)) {
throw new RuntimeException("Key cannot be an empty string");
}
$currentValue =& $this->data;
$keyPath = explode('.', $key);
if (1 == count($keyPath)) {
unset($currentValue[$key]);
r... | [
"public",
"function",
"remove",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"0",
"==",
"strlen",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Key cannot be an empty string\"",
")",
";",
"}",
"$",
"currentValue",
"=",
"&",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/dflydev/dflydev-dot-access-data/blob/b5899e067a8eb6fa4e4c64318a0bd71bad8c272c/src/Data.php#L116-L140 |
dflydev/dflydev-dot-access-data | src/Data.php | Data.get | public function get($key, $default = null)
{
$currentValue = $this->data;
$keyPath = explode('.', $key);
for ( $i = 0; $i < count($keyPath); $i++ ) {
$currentKey = $keyPath[$i];
if (!isset($currentValue[$currentKey]) ) {
return $default;
}... | php | public function get($key, $default = null)
{
$currentValue = $this->data;
$keyPath = explode('.', $key);
for ( $i = 0; $i < count($keyPath); $i++ ) {
$currentKey = $keyPath[$i];
if (!isset($currentValue[$currentKey]) ) {
return $default;
}... | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"currentValue",
"=",
"$",
"this",
"->",
"data",
";",
"$",
"keyPath",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"for",
"(",
"$",
"i",
"="... | {@inheritdoc} | [
"{"
] | train | https://github.com/dflydev/dflydev-dot-access-data/blob/b5899e067a8eb6fa4e4c64318a0bd71bad8c272c/src/Data.php#L145-L162 |
dflydev/dflydev-dot-access-data | src/Data.php | Data.has | public function has($key)
{
$currentValue = &$this->data;
$keyPath = explode('.', $key);
for ( $i = 0; $i < count($keyPath); $i++ ) {
$currentKey = $keyPath[$i];
if (
!is_array($currentValue) ||
!array_key_exists($currentKey, $currentV... | php | public function has($key)
{
$currentValue = &$this->data;
$keyPath = explode('.', $key);
for ( $i = 0; $i < count($keyPath); $i++ ) {
$currentKey = $keyPath[$i];
if (
!is_array($currentValue) ||
!array_key_exists($currentKey, $currentV... | [
"public",
"function",
"has",
"(",
"$",
"key",
")",
"{",
"$",
"currentValue",
"=",
"&",
"$",
"this",
"->",
"data",
";",
"$",
"keyPath",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/dflydev/dflydev-dot-access-data/blob/b5899e067a8eb6fa4e4c64318a0bd71bad8c272c/src/Data.php#L167-L184 |
dflydev/dflydev-dot-access-data | src/Data.php | Data.getData | public function getData($key)
{
$value = $this->get($key);
if (is_array($value) && Util::isAssoc($value)) {
return new Data($value);
}
throw new RuntimeException("Value at '$key' could not be represented as a DataInterface");
} | php | public function getData($key)
{
$value = $this->get($key);
if (is_array($value) && Util::isAssoc($value)) {
return new Data($value);
}
throw new RuntimeException("Value at '$key' could not be represented as a DataInterface");
} | [
"public",
"function",
"getData",
"(",
"$",
"key",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"key",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
"&&",
"Util",
"::",
"isAssoc",
"(",
"$",
"value",
")",
")",
"{",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/dflydev/dflydev-dot-access-data/blob/b5899e067a8eb6fa4e4c64318a0bd71bad8c272c/src/Data.php#L189-L197 |
dflydev/dflydev-dot-access-data | src/Data.php | Data.import | public function import(array $data, $clobber = true)
{
$this->data = Util::mergeAssocArray($this->data, $data, $clobber);
} | php | public function import(array $data, $clobber = true)
{
$this->data = Util::mergeAssocArray($this->data, $data, $clobber);
} | [
"public",
"function",
"import",
"(",
"array",
"$",
"data",
",",
"$",
"clobber",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"Util",
"::",
"mergeAssocArray",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"data",
",",
"$",
"clobber",
")",
";",... | {@inheritdoc} | [
"{"
] | train | https://github.com/dflydev/dflydev-dot-access-data/blob/b5899e067a8eb6fa4e4c64318a0bd71bad8c272c/src/Data.php#L202-L205 |
dflydev/dflydev-dot-access-data | src/Data.php | Data.importData | public function importData(DataInterface $data, $clobber = true)
{
$this->import($data->export(), $clobber);
} | php | public function importData(DataInterface $data, $clobber = true)
{
$this->import($data->export(), $clobber);
} | [
"public",
"function",
"importData",
"(",
"DataInterface",
"$",
"data",
",",
"$",
"clobber",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"import",
"(",
"$",
"data",
"->",
"export",
"(",
")",
",",
"$",
"clobber",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/dflydev/dflydev-dot-access-data/blob/b5899e067a8eb6fa4e4c64318a0bd71bad8c272c/src/Data.php#L210-L213 |
dflydev/dflydev-dot-access-data | src/Util.php | Util.isAssoc | public static function isAssoc(array $arr)
{
return (is_array($arr) && (!count($arr) || count(array_filter(array_keys($arr),'is_string')) == count($arr)));
} | php | public static function isAssoc(array $arr)
{
return (is_array($arr) && (!count($arr) || count(array_filter(array_keys($arr),'is_string')) == count($arr)));
} | [
"public",
"static",
"function",
"isAssoc",
"(",
"array",
"$",
"arr",
")",
"{",
"return",
"(",
"is_array",
"(",
"$",
"arr",
")",
"&&",
"(",
"!",
"count",
"(",
"$",
"arr",
")",
"||",
"count",
"(",
"array_filter",
"(",
"array_keys",
"(",
"$",
"arr",
"... | Test if array is an associative array
Note that this function will return true if an array is empty. Meaning
empty arrays will be treated as if they are associative arrays.
@param array $arr
@return boolean | [
"Test",
"if",
"array",
"is",
"an",
"associative",
"array"
] | train | https://github.com/dflydev/dflydev-dot-access-data/blob/b5899e067a8eb6fa4e4c64318a0bd71bad8c272c/src/Util.php#L26-L29 |
dflydev/dflydev-dot-access-data | src/Util.php | Util.mergeAssocArray | public static function mergeAssocArray($to, $from, $clobber = true)
{
if ( is_array($from) ) {
foreach ($from as $k => $v) {
if (!isset($to[$k])) {
$to[$k] = $v;
} else {
$to[$k] = self::mergeAssocArray($to[$k], $v, $clobber... | php | public static function mergeAssocArray($to, $from, $clobber = true)
{
if ( is_array($from) ) {
foreach ($from as $k => $v) {
if (!isset($to[$k])) {
$to[$k] = $v;
} else {
$to[$k] = self::mergeAssocArray($to[$k], $v, $clobber... | [
"public",
"static",
"function",
"mergeAssocArray",
"(",
"$",
"to",
",",
"$",
"from",
",",
"$",
"clobber",
"=",
"true",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"from",
")",
")",
"{",
"foreach",
"(",
"$",
"from",
"as",
"$",
"k",
"=>",
"$",
"v",
... | Merge contents from one associtative array to another
@param array $to
@param array $from
@param bool $clobber | [
"Merge",
"contents",
"from",
"one",
"associtative",
"array",
"to",
"another"
] | train | https://github.com/dflydev/dflydev-dot-access-data/blob/b5899e067a8eb6fa4e4c64318a0bd71bad8c272c/src/Util.php#L38-L53 |
clue/reactphp-redis | src/Factory.php | Factory.createClient | public function createClient($target)
{
try {
$parts = $this->parseUrl($target);
} catch (InvalidArgumentException $e) {
return \React\Promise\reject($e);
}
$connecting = $this->connector->connect($parts['authority']);
$deferred = new Deferred(functio... | php | public function createClient($target)
{
try {
$parts = $this->parseUrl($target);
} catch (InvalidArgumentException $e) {
return \React\Promise\reject($e);
}
$connecting = $this->connector->connect($parts['authority']);
$deferred = new Deferred(functio... | [
"public",
"function",
"createClient",
"(",
"$",
"target",
")",
"{",
"try",
"{",
"$",
"parts",
"=",
"$",
"this",
"->",
"parseUrl",
"(",
"$",
"target",
")",
";",
"}",
"catch",
"(",
"InvalidArgumentException",
"$",
"e",
")",
"{",
"return",
"\\",
"React",
... | Create Redis client connected to address of given redis instance
@param string $target Redis server URI to connect to
@return \React\Promise\PromiseInterface<Client> resolves with Client or rejects with \Exception | [
"Create",
"Redis",
"client",
"connected",
"to",
"address",
"of",
"given",
"redis",
"instance"
] | train | https://github.com/clue/reactphp-redis/blob/426e9dfd71e7ffa20de080a725589ff9b42762ca/src/Factory.php#L47-L132 |
Indatus/dispatcher | src/Indatus/Dispatcher/Services/CommandService.php | CommandService.runDue | public function runDue(Debugger $debugger)
{
$debugger->log('Running commands...');
/** @var \Indatus\Dispatcher\BackgroundProcessRunner $backgroundProcessRunner */
$backgroundProcessRunner = App::make('Indatus\Dispatcher\BackgroundProcessRunner');
/** @var \Indatus\Dispatcher\Queu... | php | public function runDue(Debugger $debugger)
{
$debugger->log('Running commands...');
/** @var \Indatus\Dispatcher\BackgroundProcessRunner $backgroundProcessRunner */
$backgroundProcessRunner = App::make('Indatus\Dispatcher\BackgroundProcessRunner');
/** @var \Indatus\Dispatcher\Queu... | [
"public",
"function",
"runDue",
"(",
"Debugger",
"$",
"debugger",
")",
"{",
"$",
"debugger",
"->",
"log",
"(",
"'Running commands...'",
")",
";",
"/** @var \\Indatus\\Dispatcher\\BackgroundProcessRunner $backgroundProcessRunner */",
"$",
"backgroundProcessRunner",
"=",
"App... | Run all commands that are due to be run | [
"Run",
"all",
"commands",
"that",
"are",
"due",
"to",
"be",
"run"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Services/CommandService.php#L32-L74 |
Indatus/dispatcher | src/Indatus/Dispatcher/Services/CommandService.php | CommandService.runnableInEnvironment | public function runnableInEnvironment(ScheduledCommandInterface $command)
{
$environment = $command->environment();
//if any
if ($environment == '*' || $environment == App::environment()) {
return true;
}
if (is_array($environment) && in_array(App::environment()... | php | public function runnableInEnvironment(ScheduledCommandInterface $command)
{
$environment = $command->environment();
//if any
if ($environment == '*' || $environment == App::environment()) {
return true;
}
if (is_array($environment) && in_array(App::environment()... | [
"public",
"function",
"runnableInEnvironment",
"(",
"ScheduledCommandInterface",
"$",
"command",
")",
"{",
"$",
"environment",
"=",
"$",
"command",
"->",
"environment",
"(",
")",
";",
"//if any",
"if",
"(",
"$",
"environment",
"==",
"'*'",
"||",
"$",
"environm... | Determine if a scheduled command is in the correct environment
@param \Indatus\Dispatcher\Scheduling\ScheduledCommandInterface $command
@return bool | [
"Determine",
"if",
"a",
"scheduled",
"command",
"is",
"in",
"the",
"correct",
"environment"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Services/CommandService.php#L83-L97 |
Indatus/dispatcher | src/Indatus/Dispatcher/Services/CommandService.php | CommandService.prepareOptions | public function prepareOptions(array $options)
{
$optionPieces = [];
foreach ($options as $opt => $value) {
//if it's an array of options, throw them in there as well
if (is_array($value)) {
foreach ($value as $optArrayValue) {
$optionPiece... | php | public function prepareOptions(array $options)
{
$optionPieces = [];
foreach ($options as $opt => $value) {
//if it's an array of options, throw them in there as well
if (is_array($value)) {
foreach ($value as $optArrayValue) {
$optionPiece... | [
"public",
"function",
"prepareOptions",
"(",
"array",
"$",
"options",
")",
"{",
"$",
"optionPieces",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"options",
"as",
"$",
"opt",
"=>",
"$",
"value",
")",
"{",
"//if it's an array of options, throw them in there as well",... | Prepare a command's options for command line usage
@param array $options
@return string | [
"Prepare",
"a",
"command",
"s",
"options",
"for",
"command",
"line",
"usage"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Services/CommandService.php#L134-L160 |
Indatus/dispatcher | src/Indatus/Dispatcher/Services/CommandService.php | CommandService.getRunCommand | public function getRunCommand(
ScheduledCommandInterface $scheduledCommand,
array $arguments = [],
array $options = []
) {
/** @var \Indatus\Dispatcher\Platform $platform */
$platform = App::make('Indatus\Dispatcher\Platform');
$commandPieces = [];
if ($platf... | php | public function getRunCommand(
ScheduledCommandInterface $scheduledCommand,
array $arguments = [],
array $options = []
) {
/** @var \Indatus\Dispatcher\Platform $platform */
$platform = App::make('Indatus\Dispatcher\Platform');
$commandPieces = [];
if ($platf... | [
"public",
"function",
"getRunCommand",
"(",
"ScheduledCommandInterface",
"$",
"scheduledCommand",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"/** @var \\Indatus\\Dispatcher\\Platform $platform */",
"$",
"pla... | Get a command to run this application
@param \Indatus\Dispatcher\Scheduling\ScheduledCommandInterface $scheduledCommand
@param array $arguments
@param array $options
@return string | [
"Get",
"a",
"command",
"to",
"run",
"this",
"application"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Services/CommandService.php#L171-L217 |
Indatus/dispatcher | src/Indatus/Dispatcher/Services/ScheduleService.php | ScheduleService.getScheduledCommands | public function getScheduledCommands()
{
$scheduledCommands = [];
foreach ($this->console->all() as $command) {
if ($command instanceof ScheduledCommandInterface) {
$scheduledCommands[] = $command;
}
}
return $scheduledCommands;
} | php | public function getScheduledCommands()
{
$scheduledCommands = [];
foreach ($this->console->all() as $command) {
if ($command instanceof ScheduledCommandInterface) {
$scheduledCommands[] = $command;
}
}
return $scheduledCommands;
} | [
"public",
"function",
"getScheduledCommands",
"(",
")",
"{",
"$",
"scheduledCommands",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"console",
"->",
"all",
"(",
")",
"as",
"$",
"command",
")",
"{",
"if",
"(",
"$",
"command",
"instanceof",
"Sc... | Get all commands that are scheduled
@return \Indatus\Dispatcher\Scheduling\ScheduledCommandInterface[] | [
"Get",
"all",
"commands",
"that",
"are",
"scheduled"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Services/ScheduleService.php#L42-L52 |
Indatus/dispatcher | src/Indatus/Dispatcher/Services/ScheduleService.php | ScheduleService.getQueue | public function getQueue(Debugger $debugger)
{
/** @var \Indatus\Dispatcher\Queue $queue */
$queue = App::make('Indatus\Dispatcher\Queue');
/** @var \Indatus\Dispatcher\Scheduling\ScheduledCommandInterface $command */
foreach ($this->getScheduledCommands() as $command) {
... | php | public function getQueue(Debugger $debugger)
{
/** @var \Indatus\Dispatcher\Queue $queue */
$queue = App::make('Indatus\Dispatcher\Queue');
/** @var \Indatus\Dispatcher\Scheduling\ScheduledCommandInterface $command */
foreach ($this->getScheduledCommands() as $command) {
... | [
"public",
"function",
"getQueue",
"(",
"Debugger",
"$",
"debugger",
")",
"{",
"/** @var \\Indatus\\Dispatcher\\Queue $queue */",
"$",
"queue",
"=",
"App",
"::",
"make",
"(",
"'Indatus\\Dispatcher\\Queue'",
")",
";",
"/** @var \\Indatus\\Dispatcher\\Scheduling\\ScheduledComman... | Get all commands that are due to be run
@param Debugger $debugger
@throws \InvalidArgumentException
@return \Indatus\Dispatcher\Queue | [
"Get",
"all",
"commands",
"that",
"are",
"due",
"to",
"be",
"run"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Services/ScheduleService.php#L62-L105 |
Indatus/dispatcher | src/Indatus/Dispatcher/Drivers/DateTime/Scheduler.php | Scheduler.getSchedule | public function getSchedule()
{
return implode(' ', [
$this->getScheduleMonth(),
$this->getScheduleWeek(),
$this->getScheduleDayOfMonth(),
$this->getScheduleDayOfWeek(),
$this->getScheduleHour(),
$this->getSchedu... | php | public function getSchedule()
{
return implode(' ', [
$this->getScheduleMonth(),
$this->getScheduleWeek(),
$this->getScheduleDayOfMonth(),
$this->getScheduleDayOfWeek(),
$this->getScheduleHour(),
$this->getSchedu... | [
"public",
"function",
"getSchedule",
"(",
")",
"{",
"return",
"implode",
"(",
"' '",
",",
"[",
"$",
"this",
"->",
"getScheduleMonth",
"(",
")",
",",
"$",
"this",
"->",
"getScheduleWeek",
"(",
")",
",",
"$",
"this",
"->",
"getScheduleDayOfMonth",
"(",
")"... | Get the scheduling definition in a readable way
@return string | [
"Get",
"the",
"scheduling",
"definition",
"in",
"a",
"readable",
"way"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Drivers/DateTime/Scheduler.php#L35-L45 |
Indatus/dispatcher | src/Indatus/Dispatcher/Drivers/DateTime/Scheduler.php | Scheduler.setSchedule | public function setSchedule($minute, $hour, $dayOfMonth, $month, $dayOfWeek, $week = self::NONE)
{
$month = $this->parseTimeParameter($month);
$week = $this->parseTimeParameter($week);
$dayOfMonth = $this->parseTimeParameter($dayOfMonth);
$dayOfWeek = $this->parseTimeParameter($dayOf... | php | public function setSchedule($minute, $hour, $dayOfMonth, $month, $dayOfWeek, $week = self::NONE)
{
$month = $this->parseTimeParameter($month);
$week = $this->parseTimeParameter($week);
$dayOfMonth = $this->parseTimeParameter($dayOfMonth);
$dayOfWeek = $this->parseTimeParameter($dayOf... | [
"public",
"function",
"setSchedule",
"(",
"$",
"minute",
",",
"$",
"hour",
",",
"$",
"dayOfMonth",
",",
"$",
"month",
",",
"$",
"dayOfWeek",
",",
"$",
"week",
"=",
"self",
"::",
"NONE",
")",
"{",
"$",
"month",
"=",
"$",
"this",
"->",
"parseTimeParame... | Manually set a command's execution schedule. Parameter
order follows standard cron syntax
@param int|array $minute
@param int|array $hour
@param int|array $dayOfMonth
@param int|array $month
@param int|array $dayOfWeek
@param string|int|array $week
@return $this | [
"Manually",
"set",
"a",
"command",
"s",
"execution",
"schedule",
".",
"Parameter",
"order",
"follows",
"standard",
"cron",
"syntax"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Drivers/DateTime/Scheduler.php#L75-L92 |
Indatus/dispatcher | src/Indatus/Dispatcher/Drivers/DateTime/Scheduler.php | Scheduler.quarterly | public function quarterly()
{
$months = [Month::JANUARY, Month::APRIL, Month::JULY, Month::OCTOBER];
$this->setScheduleMonth($this->parseTimeParameter($months));
$this->setScheduleWeek(self::NONE);
$this->setScheduleDayOfMonth(1);
$this->setScheduleDayOfWeek(self::ANY);
... | php | public function quarterly()
{
$months = [Month::JANUARY, Month::APRIL, Month::JULY, Month::OCTOBER];
$this->setScheduleMonth($this->parseTimeParameter($months));
$this->setScheduleWeek(self::NONE);
$this->setScheduleDayOfMonth(1);
$this->setScheduleDayOfWeek(self::ANY);
... | [
"public",
"function",
"quarterly",
"(",
")",
"{",
"$",
"months",
"=",
"[",
"Month",
"::",
"JANUARY",
",",
"Month",
"::",
"APRIL",
",",
"Month",
"::",
"JULY",
",",
"Month",
"::",
"OCTOBER",
"]",
";",
"$",
"this",
"->",
"setScheduleMonth",
"(",
"$",
"t... | Run once a quarter at the beginning of the quarter
@return $this | [
"Run",
"once",
"a",
"quarter",
"at",
"the",
"beginning",
"of",
"the",
"quarter"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Drivers/DateTime/Scheduler.php#L116-L127 |
Indatus/dispatcher | src/Indatus/Dispatcher/Drivers/DateTime/Scheduler.php | Scheduler.monthly | public function monthly()
{
$this->setScheduleMonth(self::ANY);
$this->setScheduleWeek(self::NONE);
$this->setScheduleDayOfMonth(1);
$this->setScheduleDayOfWeek(self::ANY);
$this->setScheduleHour(0);
$this->setScheduleMinute(0);
return $this;
} | php | public function monthly()
{
$this->setScheduleMonth(self::ANY);
$this->setScheduleWeek(self::NONE);
$this->setScheduleDayOfMonth(1);
$this->setScheduleDayOfWeek(self::ANY);
$this->setScheduleHour(0);
$this->setScheduleMinute(0);
return $this;
} | [
"public",
"function",
"monthly",
"(",
")",
"{",
"$",
"this",
"->",
"setScheduleMonth",
"(",
"self",
"::",
"ANY",
")",
";",
"$",
"this",
"->",
"setScheduleWeek",
"(",
"self",
"::",
"NONE",
")",
";",
"$",
"this",
"->",
"setScheduleDayOfMonth",
"(",
"1",
... | Run once a month at midnight in the morning of the first day of the month
@return $this | [
"Run",
"once",
"a",
"month",
"at",
"midnight",
"in",
"the",
"morning",
"of",
"the",
"first",
"day",
"of",
"the",
"month"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Drivers/DateTime/Scheduler.php#L146-L156 |
Indatus/dispatcher | src/Indatus/Dispatcher/Drivers/DateTime/Scheduler.php | Scheduler.everyOddWeek | public function everyOddWeek()
{
$this->setScheduleMonth(self::ANY);
$this->setScheduleWeek('odd');
$this->setScheduleDayOfMonth(self::ANY);
$this->setScheduleDayOfWeek(self::ANY);
$this->setScheduleHour(0);
$this->setScheduleMinute(0);
return $this;
} | php | public function everyOddWeek()
{
$this->setScheduleMonth(self::ANY);
$this->setScheduleWeek('odd');
$this->setScheduleDayOfMonth(self::ANY);
$this->setScheduleDayOfWeek(self::ANY);
$this->setScheduleHour(0);
$this->setScheduleMinute(0);
return $this;
} | [
"public",
"function",
"everyOddWeek",
"(",
")",
"{",
"$",
"this",
"->",
"setScheduleMonth",
"(",
"self",
"::",
"ANY",
")",
";",
"$",
"this",
"->",
"setScheduleWeek",
"(",
"'odd'",
")",
";",
"$",
"this",
"->",
"setScheduleDayOfMonth",
"(",
"self",
"::",
"... | Run once every odd week at midnight on Sunday morning
@return $this | [
"Run",
"once",
"every",
"odd",
"week",
"at",
"midnight",
"on",
"Sunday",
"morning"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Drivers/DateTime/Scheduler.php#L187-L197 |
Indatus/dispatcher | src/Indatus/Dispatcher/Drivers/DateTime/Scheduler.php | Scheduler.weekly | public function weekly()
{
$this->setScheduleMonth(self::ANY);
$this->setScheduleWeek(self::ANY);
$this->setScheduleDayOfMonth(self::ANY);
$this->setScheduleDayOfWeek(Day::SUNDAY);
$this->setScheduleHour(0);
$this->setScheduleMinute(0);
return $this;
} | php | public function weekly()
{
$this->setScheduleMonth(self::ANY);
$this->setScheduleWeek(self::ANY);
$this->setScheduleDayOfMonth(self::ANY);
$this->setScheduleDayOfWeek(Day::SUNDAY);
$this->setScheduleHour(0);
$this->setScheduleMinute(0);
return $this;
} | [
"public",
"function",
"weekly",
"(",
")",
"{",
"$",
"this",
"->",
"setScheduleMonth",
"(",
"self",
"::",
"ANY",
")",
";",
"$",
"this",
"->",
"setScheduleWeek",
"(",
"self",
"::",
"ANY",
")",
";",
"$",
"this",
"->",
"setScheduleDayOfMonth",
"(",
"self",
... | Run once a week at midnight on Sunday morning
@return $this | [
"Run",
"once",
"a",
"week",
"at",
"midnight",
"on",
"Sunday",
"morning"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Drivers/DateTime/Scheduler.php#L221-L231 |
Indatus/dispatcher | src/Indatus/Dispatcher/Drivers/DateTime/Scheduler.php | Scheduler.weekOfYear | public function weekOfYear($week)
{
$this->setScheduleMonth(self::NONE);
$this->setScheduleWeek($this->parseTimeParameter($week));
$this->setScheduleDayOfMonth(self::ANY);
$this->setScheduleDayOfWeek(Day::SUNDAY);
$this->setScheduleHour(0);
$this->setScheduleMinute(0)... | php | public function weekOfYear($week)
{
$this->setScheduleMonth(self::NONE);
$this->setScheduleWeek($this->parseTimeParameter($week));
$this->setScheduleDayOfMonth(self::ANY);
$this->setScheduleDayOfWeek(Day::SUNDAY);
$this->setScheduleHour(0);
$this->setScheduleMinute(0)... | [
"public",
"function",
"weekOfYear",
"(",
"$",
"week",
")",
"{",
"$",
"this",
"->",
"setScheduleMonth",
"(",
"self",
"::",
"NONE",
")",
";",
"$",
"this",
"->",
"setScheduleWeek",
"(",
"$",
"this",
"->",
"parseTimeParameter",
"(",
"$",
"week",
")",
")",
... | Run on the given week of each month
@param int|array $week
@throws BadScheduleException
@return $this | [
"Run",
"on",
"the",
"given",
"week",
"of",
"each",
"month"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Drivers/DateTime/Scheduler.php#L257-L267 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.