id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
207,700
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.lastModified
public function lastModified($var = null) { if ($var !== null) { $this->last_modified = $var; } if (!isset($this->last_modified)) { $this->last_modified = (bool)Grav::instance()['config']->get('system.pages.last_modified'); } return $this->last_modifi...
php
public function lastModified($var = null) { if ($var !== null) { $this->last_modified = $var; } if (!isset($this->last_modified)) { $this->last_modified = (bool)Grav::instance()['config']->get('system.pages.last_modified'); } return $this->last_modifi...
[ "public", "function", "lastModified", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "last_modified", "=", "$", "var", ";", "}", "if", "(", "!", "isset", "(", "$", "this", "->", "last_mo...
Gets and sets the option to show the last_modified header for the page. @param bool $var show last_modified header @return bool show last_modified header
[ "Gets", "and", "sets", "the", "option", "to", "show", "the", "last_modified", "header", "for", "the", "page", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2072-L2082
207,701
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.filePath
public function filePath($var = null) { if ($var !== null) { // Filename of the page. $this->name = basename($var); // Folder of the page. $this->folder = basename(dirname($var)); // Path to the page. $this->path = dirname($var, 2); ...
php
public function filePath($var = null) { if ($var !== null) { // Filename of the page. $this->name = basename($var); // Folder of the page. $this->folder = basename(dirname($var)); // Path to the page. $this->path = dirname($var, 2); ...
[ "public", "function", "filePath", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "// Filename of the page.", "$", "this", "->", "name", "=", "basename", "(", "$", "var", ")", ";", "// Folder of the page.", "$", ...
Gets and sets the path to the .md file for this Page object. @param string $var the file path @return string|null the file path
[ "Gets", "and", "sets", "the", "path", "to", "the", ".", "md", "file", "for", "this", "Page", "object", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2091-L2103
207,702
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.path
public function path($var = null) { if ($var !== null) { // Folder of the page. $this->folder = basename($var); // Path to the page. $this->path = dirname($var); } return $this->path ? $this->path . '/' . $this->folder : null; }
php
public function path($var = null) { if ($var !== null) { // Folder of the page. $this->folder = basename($var); // Path to the page. $this->path = dirname($var); } return $this->path ? $this->path . '/' . $this->folder : null; }
[ "public", "function", "path", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "// Folder of the page.", "$", "this", "->", "folder", "=", "basename", "(", "$", "var", ")", ";", "// Path to the page.", "$", "this"...
Gets and sets the path to the folder where the .md for this Page object resides. This is equivalent to the filePath but without the filename. @param string $var the path @return string|null the path
[ "Gets", "and", "sets", "the", "path", "to", "the", "folder", "where", "the", ".", "md", "for", "this", "Page", "object", "resides", ".", "This", "is", "equivalent", "to", "the", "filePath", "but", "without", "the", "filename", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2131-L2141
207,703
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.date
public function date($var = null) { if ($var !== null) { $this->date = Utils::date2timestamp($var, $this->dateformat); } if (!$this->date) { $this->date = $this->modified; } return $this->date; }
php
public function date($var = null) { if ($var !== null) { $this->date = Utils::date2timestamp($var, $this->dateformat); } if (!$this->date) { $this->date = $this->modified; } return $this->date; }
[ "public", "function", "date", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "date", "=", "Utils", "::", "date2timestamp", "(", "$", "var", ",", "$", "this", "->", "dateformat", ")", ";"...
Gets and sets the date for this Page object. This is typically passed in via the page headers @param string $var string representation of a date @return int unix timestamp representation of the date
[ "Gets", "and", "sets", "the", "date", "for", "this", "Page", "object", ".", "This", "is", "typically", "passed", "in", "via", "the", "page", "headers" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2166-L2177
207,704
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.orderDir
public function orderDir($var = null) { //user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6', E_USER_DEPRECATED); if ($var !== null) { $this->order_dir = $var; } if (empty($this->order_dir)) { $this->order_dir = 'asc'; } ...
php
public function orderDir($var = null) { //user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6', E_USER_DEPRECATED); if ($var !== null) { $this->order_dir = $var; } if (empty($this->order_dir)) { $this->order_dir = 'asc'; } ...
[ "public", "function", "orderDir", "(", "$", "var", "=", "null", ")", "{", "//user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6', E_USER_DEPRECATED);", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "order_dir", "=", "$",...
Gets and sets the order by which any sub-pages should be sorted. @param string $var the order, either "asc" or "desc" @return string the order, either "asc" or "desc" @deprecated 1.6
[ "Gets", "and", "sets", "the", "order", "by", "which", "any", "sub", "-", "pages", "should", "be", "sorted", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2204-L2217
207,705
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.maxCount
public function maxCount($var = null) { //user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6', E_USER_DEPRECATED); if ($var !== null) { $this->max_count = (int)$var; } if (empty($this->max_count)) { /** @var Config $config */ ...
php
public function maxCount($var = null) { //user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6', E_USER_DEPRECATED); if ($var !== null) { $this->max_count = (int)$var; } if (empty($this->max_count)) { /** @var Config $config */ ...
[ "public", "function", "maxCount", "(", "$", "var", "=", "null", ")", "{", "//user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6', E_USER_DEPRECATED);", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "max_count", "=", "(",...
Gets and sets the maxCount field which describes how many sub-pages should be displayed if the sub_pages header property is set for this page object. @param int $var the maximum number of sub-pages @return int the maximum number of sub-pages @deprecated 1.6
[ "Gets", "and", "sets", "the", "maxCount", "field", "which", "describes", "how", "many", "sub", "-", "pages", "should", "be", "displayed", "if", "the", "sub_pages", "header", "property", "is", "set", "for", "this", "page", "object", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2271-L2285
207,706
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.taxonomy
public function taxonomy($var = null) { if ($var !== null) { // make sure first level are arrays array_walk($var, function(&$value) { $value = (array) $value; }); // make sure all values are strings array_walk_recursive($var, functi...
php
public function taxonomy($var = null) { if ($var !== null) { // make sure first level are arrays array_walk($var, function(&$value) { $value = (array) $value; }); // make sure all values are strings array_walk_recursive($var, functi...
[ "public", "function", "taxonomy", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "// make sure first level are arrays", "array_walk", "(", "$", "var", ",", "function", "(", "&", "$", "value", ")", "{", "$", "val...
Gets and sets the taxonomy array which defines which taxonomies this page identifies itself with. @param array $var an array of taxonomies @return array an array of taxonomies
[ "Gets", "and", "sets", "the", "taxonomy", "array", "which", "defines", "which", "taxonomies", "this", "page", "identifies", "itself", "with", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2294-L2309
207,707
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.modularTwig
public function modularTwig($var = null) { if ($var !== null) { $this->modular_twig = (bool)$var; if ($var) { $this->visible(false); // some routable logic if (empty($this->header->routable)) { $this->routable = fals...
php
public function modularTwig($var = null) { if ($var !== null) { $this->modular_twig = (bool)$var; if ($var) { $this->visible(false); // some routable logic if (empty($this->header->routable)) { $this->routable = fals...
[ "public", "function", "modularTwig", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "modular_twig", "=", "(", "bool", ")", "$", "var", ";", "if", "(", "$", "var", ")", "{", "$", "this"...
Gets and sets the modular_twig var that helps identify this page as a modular child page that will need twig processing handled differently from a regular page. @param bool $var true if modular_twig @return bool true if modular_twig
[ "Gets", "and", "sets", "the", "modular_twig", "var", "that", "helps", "identify", "this", "page", "as", "a", "modular", "child", "page", "that", "will", "need", "twig", "processing", "handled", "differently", "from", "a", "regular", "page", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2331-L2345
207,708
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.parent
public function parent(PageInterface $var = null) { if ($var) { $this->parent = $var->path(); return $var; } /** @var Pages $pages */ $pages = Grav::instance()['pages']; return $pages->get($this->parent); }
php
public function parent(PageInterface $var = null) { if ($var) { $this->parent = $var->path(); return $var; } /** @var Pages $pages */ $pages = Grav::instance()['pages']; return $pages->get($this->parent); }
[ "public", "function", "parent", "(", "PageInterface", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", ")", "{", "$", "this", "->", "parent", "=", "$", "var", "->", "path", "(", ")", ";", "return", "$", "var", ";", "}", "/** @var Pages $pa...
Gets and Sets the parent object for this page @param PageInterface $var the parent page object @return PageInterface|null the parent page object if it exists.
[ "Gets", "and", "Sets", "the", "parent", "object", "for", "this", "page" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2366-L2378
207,709
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.topParent
public function topParent() { $topParent = $this->parent(); if (!$topParent) { return null; } while (true) { $theParent = $topParent->parent(); if ($theParent !== null && $theParent->parent() !== null) { $topParent = $theParent; ...
php
public function topParent() { $topParent = $this->parent(); if (!$topParent) { return null; } while (true) { $theParent = $topParent->parent(); if ($theParent !== null && $theParent->parent() !== null) { $topParent = $theParent; ...
[ "public", "function", "topParent", "(", ")", "{", "$", "topParent", "=", "$", "this", "->", "parent", "(", ")", ";", "if", "(", "!", "$", "topParent", ")", "{", "return", "null", ";", "}", "while", "(", "true", ")", "{", "$", "theParent", "=", "$...
Gets the top parent object for this page @return PageInterface|null the top parent page object if it exists.
[ "Gets", "the", "top", "parent", "object", "for", "this", "page" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2385-L2403
207,710
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.isFirst
public function isFirst() { $parent = $this->parent(); $collection = $parent ? $parent->collection('content', false) : null; if ($collection instanceof Collection) { return $collection->isFirst($this->path()); } return true; }
php
public function isFirst() { $parent = $this->parent(); $collection = $parent ? $parent->collection('content', false) : null; if ($collection instanceof Collection) { return $collection->isFirst($this->path()); } return true; }
[ "public", "function", "isFirst", "(", ")", "{", "$", "parent", "=", "$", "this", "->", "parent", "(", ")", ";", "$", "collection", "=", "$", "parent", "?", "$", "parent", "->", "collection", "(", "'content'", ",", "false", ")", ":", "null", ";", "i...
Check to see if this item is the first in an array of sub-pages. @return bool True if item is first.
[ "Check", "to", "see", "if", "this", "item", "is", "the", "first", "in", "an", "array", "of", "sub", "-", "pages", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2424-L2433
207,711
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.currentPosition
public function currentPosition() { $parent = $this->parent(); $collection = $parent ? $parent->collection('content', false) : null; if ($collection instanceof Collection) { return $collection->currentPosition($this->path()); } return 1; }
php
public function currentPosition() { $parent = $this->parent(); $collection = $parent ? $parent->collection('content', false) : null; if ($collection instanceof Collection) { return $collection->currentPosition($this->path()); } return 1; }
[ "public", "function", "currentPosition", "(", ")", "{", "$", "parent", "=", "$", "this", "->", "parent", "(", ")", ";", "$", "collection", "=", "$", "parent", "?", "$", "parent", "->", "collection", "(", "'content'", ",", "false", ")", ":", "null", "...
Returns the item in the current position. @return int the index of the current page.
[ "Returns", "the", "item", "in", "the", "current", "position", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2494-L2503
207,712
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.active
public function active() { $uri_path = rtrim(urldecode(Grav::instance()['uri']->path()), '/') ?: '/'; $routes = Grav::instance()['pages']->routes(); return isset($routes[$uri_path]) && $routes[$uri_path] === $this->path(); }
php
public function active() { $uri_path = rtrim(urldecode(Grav::instance()['uri']->path()), '/') ?: '/'; $routes = Grav::instance()['pages']->routes(); return isset($routes[$uri_path]) && $routes[$uri_path] === $this->path(); }
[ "public", "function", "active", "(", ")", "{", "$", "uri_path", "=", "rtrim", "(", "urldecode", "(", "Grav", "::", "instance", "(", ")", "[", "'uri'", "]", "->", "path", "(", ")", ")", ",", "'/'", ")", "?", ":", "'/'", ";", "$", "routes", "=", ...
Returns whether or not this page is the currently active page requested via the URL. @return bool True if it is active
[ "Returns", "whether", "or", "not", "this", "page", "is", "the", "currently", "active", "page", "requested", "via", "the", "URL", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2510-L2516
207,713
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.activeChild
public function activeChild() { $uri = Grav::instance()['uri']; $pages = Grav::instance()['pages']; $uri_path = rtrim(urldecode($uri->path()), '/'); $routes = Grav::instance()['pages']->routes(); if (isset($routes[$uri_path])) { /** @var PageInterface $child_page...
php
public function activeChild() { $uri = Grav::instance()['uri']; $pages = Grav::instance()['pages']; $uri_path = rtrim(urldecode($uri->path()), '/'); $routes = Grav::instance()['pages']->routes(); if (isset($routes[$uri_path])) { /** @var PageInterface $child_page...
[ "public", "function", "activeChild", "(", ")", "{", "$", "uri", "=", "Grav", "::", "instance", "(", ")", "[", "'uri'", "]", ";", "$", "pages", "=", "Grav", "::", "instance", "(", ")", "[", "'pages'", "]", ";", "$", "uri_path", "=", "rtrim", "(", ...
Returns whether or not this URI's URL contains the URL of the active page. Or in other words, is this page's URL in the current URL @return bool True if active child exists
[ "Returns", "whether", "or", "not", "this", "URI", "s", "URL", "contains", "the", "URL", "of", "the", "active", "page", ".", "Or", "in", "other", "words", "is", "this", "page", "s", "URL", "in", "the", "current", "URL" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2524-L2545
207,714
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.home
public function home() { $home = Grav::instance()['config']->get('system.home.alias'); return $this->route() === $home || $this->rawRoute() === $home; }
php
public function home() { $home = Grav::instance()['config']->get('system.home.alias'); return $this->route() === $home || $this->rawRoute() === $home; }
[ "public", "function", "home", "(", ")", "{", "$", "home", "=", "Grav", "::", "instance", "(", ")", "[", "'config'", "]", "->", "get", "(", "'system.home.alias'", ")", ";", "return", "$", "this", "->", "route", "(", ")", "===", "$", "home", "||", "$...
Returns whether or not this page is the currently configured home page. @return bool True if it is the homepage
[ "Returns", "whether", "or", "not", "this", "page", "is", "the", "currently", "configured", "home", "page", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2552-L2557
207,715
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.ancestor
public function ancestor($lookup = null) { /** @var Pages $pages */ $pages = Grav::instance()['pages']; return $pages->ancestor($this->route, $lookup); }
php
public function ancestor($lookup = null) { /** @var Pages $pages */ $pages = Grav::instance()['pages']; return $pages->ancestor($this->route, $lookup); }
[ "public", "function", "ancestor", "(", "$", "lookup", "=", "null", ")", "{", "/** @var Pages $pages */", "$", "pages", "=", "Grav", "::", "instance", "(", ")", "[", "'pages'", "]", ";", "return", "$", "pages", "->", "ancestor", "(", "$", "this", "->", ...
Helper method to return an ancestor page. @param bool $lookup Name of the parent folder @return PageInterface page you were looking for if it exists
[ "Helper", "method", "to", "return", "an", "ancestor", "page", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2576-L2582
207,716
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.inherited
public function inherited($field) { list($inherited, $currentParams) = $this->getInheritedParams($field); $this->modifyHeader($field, $currentParams); return $inherited; }
php
public function inherited($field) { list($inherited, $currentParams) = $this->getInheritedParams($field); $this->modifyHeader($field, $currentParams); return $inherited; }
[ "public", "function", "inherited", "(", "$", "field", ")", "{", "list", "(", "$", "inherited", ",", "$", "currentParams", ")", "=", "$", "this", "->", "getInheritedParams", "(", "$", "field", ")", ";", "$", "this", "->", "modifyHeader", "(", "$", "fiel...
Helper method to return an ancestor page to inherit from. The current page object is returned. @param string $field Name of the parent folder @return PageInterface
[ "Helper", "method", "to", "return", "an", "ancestor", "page", "to", "inherit", "from", ".", "The", "current", "page", "object", "is", "returned", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2592-L2599
207,717
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.find
public function find($url, $all = false) { /** @var Pages $pages */ $pages = Grav::instance()['pages']; return $pages->find($url, $all); }
php
public function find($url, $all = false) { /** @var Pages $pages */ $pages = Grav::instance()['pages']; return $pages->find($url, $all); }
[ "public", "function", "find", "(", "$", "url", ",", "$", "all", "=", "false", ")", "{", "/** @var Pages $pages */", "$", "pages", "=", "Grav", "::", "instance", "(", ")", "[", "'pages'", "]", ";", "return", "$", "pages", "->", "find", "(", "$", "url"...
Helper method to return a page. @param string $url the url of the page @param bool $all @return PageInterface page you were looking for if it exists
[ "Helper", "method", "to", "return", "a", "page", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2646-L2652
207,718
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.cleanPath
protected function cleanPath($path) { $lastchunk = strrchr($path, DS); if (strpos($lastchunk, ':') !== false) { $path = str_replace($lastchunk, '', $path); } return $path; }
php
protected function cleanPath($path) { $lastchunk = strrchr($path, DS); if (strpos($lastchunk, ':') !== false) { $path = str_replace($lastchunk, '', $path); } return $path; }
[ "protected", "function", "cleanPath", "(", "$", "path", ")", "{", "$", "lastchunk", "=", "strrchr", "(", "$", "path", ",", "DS", ")", ";", "if", "(", "strpos", "(", "$", "lastchunk", ",", "':'", ")", "!==", "false", ")", "{", "$", "path", "=", "s...
Cleans the path. @param string $path the path @return string the path
[ "Cleans", "the", "path", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L3036-L3044
207,719
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.doReorder
protected function doReorder($new_order) { if (!$this->_original) { return; } $pages = Grav::instance()['pages']; $pages->init(); $this->_original->path($this->path()); $parent = $this->parent(); $siblings = $parent ? $parent->children() : null;...
php
protected function doReorder($new_order) { if (!$this->_original) { return; } $pages = Grav::instance()['pages']; $pages->init(); $this->_original->path($this->path()); $parent = $this->parent(); $siblings = $parent ? $parent->children() : null;...
[ "protected", "function", "doReorder", "(", "$", "new_order", ")", "{", "if", "(", "!", "$", "this", "->", "_original", ")", "{", "return", ";", "}", "$", "pages", "=", "Grav", "::", "instance", "(", ")", "[", "'pages'", "]", ";", "$", "pages", "->"...
Reorders all siblings according to a defined order @param array|null $new_order
[ "Reorders", "all", "siblings", "according", "to", "a", "defined", "order" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L3051-L3092
207,720
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.doRelocation
protected function doRelocation() { if (!$this->_original) { return; } if (is_dir($this->_original->path())) { if ($this->_action === 'move') { Folder::move($this->_original->path(), $this->path()); } elseif ($this->_action === 'copy') { ...
php
protected function doRelocation() { if (!$this->_original) { return; } if (is_dir($this->_original->path())) { if ($this->_action === 'move') { Folder::move($this->_original->path(), $this->path()); } elseif ($this->_action === 'copy') { ...
[ "protected", "function", "doRelocation", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_original", ")", "{", "return", ";", "}", "if", "(", "is_dir", "(", "$", "this", "->", "_original", "->", "path", "(", ")", ")", ")", "{", "if", "(", "$",...
Moves or copies the page in filesystem. @internal @throws \Exception
[ "Moves", "or", "copies", "the", "page", "in", "filesystem", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L3101-L3122
207,721
getgrav/grav
system/src/Grav/Common/Data/BlueprintSchema.php
BlueprintSchema.validate
public function validate(array $data) { try { $messages = $this->validateArray($data, $this->nested); } catch (\RuntimeException $e) { throw (new ValidationException($e->getMessage(), $e->getCode(), $e))->setMessages(); } if (!empty($messages)) { ...
php
public function validate(array $data) { try { $messages = $this->validateArray($data, $this->nested); } catch (\RuntimeException $e) { throw (new ValidationException($e->getMessage(), $e->getCode(), $e))->setMessages(); } if (!empty($messages)) { ...
[ "public", "function", "validate", "(", "array", "$", "data", ")", "{", "try", "{", "$", "messages", "=", "$", "this", "->", "validateArray", "(", "$", "data", ",", "$", "this", "->", "nested", ")", ";", "}", "catch", "(", "\\", "RuntimeException", "$...
Validate data against blueprints. @param array $data @throws \RuntimeException
[ "Validate", "data", "against", "blueprints", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/BlueprintSchema.php#L53-L65
207,722
getgrav/grav
system/src/Grav/Framework/Cache/CacheTrait.php
CacheTrait.init
protected function init($namespace = '', $defaultLifetime = null) { $this->namespace = (string) $namespace; $this->defaultLifetime = $this->convertTtl($defaultLifetime); $this->miss = new \stdClass; }
php
protected function init($namespace = '', $defaultLifetime = null) { $this->namespace = (string) $namespace; $this->defaultLifetime = $this->convertTtl($defaultLifetime); $this->miss = new \stdClass; }
[ "protected", "function", "init", "(", "$", "namespace", "=", "''", ",", "$", "defaultLifetime", "=", "null", ")", "{", "$", "this", "->", "namespace", "=", "(", "string", ")", "$", "namespace", ";", "$", "this", "->", "defaultLifetime", "=", "$", "this...
Always call from constructor. @param string $namespace @param null|int|\DateInterval $defaultLifetime @throws \Psr\SimpleCache\InvalidArgumentException|InvalidArgumentException
[ "Always", "call", "from", "constructor", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Cache/CacheTrait.php#L39-L44
207,723
getgrav/grav
system/src/Grav/Common/Data/Blueprints.php
Blueprints.get
public function get($type) { if (!isset($this->instances[$type])) { $this->instances[$type] = $this->loadFile($type); } return $this->instances[$type]; }
php
public function get($type) { if (!isset($this->instances[$type])) { $this->instances[$type] = $this->loadFile($type); } return $this->instances[$type]; }
[ "public", "function", "get", "(", "$", "type", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "instances", "[", "$", "type", "]", ")", ")", "{", "$", "this", "->", "instances", "[", "$", "type", "]", "=", "$", "this", "->", "loadFil...
Get blueprint. @param string $type Blueprint type. @return Blueprint @throws \RuntimeException
[ "Get", "blueprint", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Blueprints.php#L39-L46
207,724
getgrav/grav
system/src/Grav/Common/Data/Blueprints.php
Blueprints.types
public function types() { if ($this->types === null) { $this->types = []; $grav = Grav::instance(); /** @var UniformResourceLocator $locator */ $locator = $grav['locator']; // Get stream / directory iterator. if ($locator->isStream($...
php
public function types() { if ($this->types === null) { $this->types = []; $grav = Grav::instance(); /** @var UniformResourceLocator $locator */ $locator = $grav['locator']; // Get stream / directory iterator. if ($locator->isStream($...
[ "public", "function", "types", "(", ")", "{", "if", "(", "$", "this", "->", "types", "===", "null", ")", "{", "$", "this", "->", "types", "=", "[", "]", ";", "$", "grav", "=", "Grav", "::", "instance", "(", ")", ";", "/** @var UniformResourceLocator ...
Get all available blueprint types. @return array List of type=>name
[ "Get", "all", "available", "blueprint", "types", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Blueprints.php#L53-L81
207,725
getgrav/grav
system/src/Grav/Common/Data/Blueprints.php
Blueprints.loadFile
protected function loadFile($name) { $blueprint = new Blueprint($name); if (\is_array($this->search) || \is_object($this->search)) { // Page types. $blueprint->setOverrides($this->search); $blueprint->setContext('blueprints://pages'); } else { ...
php
protected function loadFile($name) { $blueprint = new Blueprint($name); if (\is_array($this->search) || \is_object($this->search)) { // Page types. $blueprint->setOverrides($this->search); $blueprint->setContext('blueprints://pages'); } else { ...
[ "protected", "function", "loadFile", "(", "$", "name", ")", "{", "$", "blueprint", "=", "new", "Blueprint", "(", "$", "name", ")", ";", "if", "(", "\\", "is_array", "(", "$", "this", "->", "search", ")", "||", "\\", "is_object", "(", "$", "this", "...
Load blueprint file. @param string $name Name of the blueprint. @return Blueprint
[ "Load", "blueprint", "file", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Blueprints.php#L90-L103
207,726
getgrav/grav
system/src/Grav/Framework/Object/Access/NestedPropertyCollectionTrait.php
NestedPropertyCollectionTrait.group
public function group($property, $separator = null) { $list = []; /** @var NestedObjectInterface $element */ foreach ($this->getIterator() as $element) { $list[(string) $element->getNestedProperty($property, null, $separator)][] = $element; } return $list; }
php
public function group($property, $separator = null) { $list = []; /** @var NestedObjectInterface $element */ foreach ($this->getIterator() as $element) { $list[(string) $element->getNestedProperty($property, null, $separator)][] = $element; } return $list; }
[ "public", "function", "group", "(", "$", "property", ",", "$", "separator", "=", "null", ")", "{", "$", "list", "=", "[", "]", ";", "/** @var NestedObjectInterface $element */", "foreach", "(", "$", "this", "->", "getIterator", "(", ")", "as", "$", "elemen...
Group items in the collection by a field. @param string $property Object property to be used to make groups. @param string $separator Separator, defaults to '.' @return array
[ "Group", "items", "in", "the", "collection", "by", "a", "field", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Object/Access/NestedPropertyCollectionTrait.php#L109-L119
207,727
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.getInstallable
public function getInstallable($list_type_installed = ['plugins' => true, 'themes' => true]) { $items = ['total' => 0]; foreach ($list_type_installed as $type => $type_installed) { if ($type_installed === false) { continue; } $methodInstallableType...
php
public function getInstallable($list_type_installed = ['plugins' => true, 'themes' => true]) { $items = ['total' => 0]; foreach ($list_type_installed as $type => $type_installed) { if ($type_installed === false) { continue; } $methodInstallableType...
[ "public", "function", "getInstallable", "(", "$", "list_type_installed", "=", "[", "'plugins'", "=>", "true", ",", "'themes'", "=>", "true", "]", ")", "{", "$", "items", "=", "[", "'total'", "=>", "0", "]", ";", "foreach", "(", "$", "list_type_installed", ...
Returns the Locally installable packages @param array $list_type_installed @return array The installed packages
[ "Returns", "the", "Locally", "installable", "packages" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L83-L96
207,728
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.getInstalledPackage
public function getInstalledPackage($slug) { if (isset($this->installed['plugins'][$slug])) { return $this->installed['plugins'][$slug]; } if (isset($this->installed['themes'][$slug])) { return $this->installed['themes'][$slug]; } return null; }
php
public function getInstalledPackage($slug) { if (isset($this->installed['plugins'][$slug])) { return $this->installed['plugins'][$slug]; } if (isset($this->installed['themes'][$slug])) { return $this->installed['themes'][$slug]; } return null; }
[ "public", "function", "getInstalledPackage", "(", "$", "slug", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "installed", "[", "'plugins'", "]", "[", "$", "slug", "]", ")", ")", "{", "return", "$", "this", "->", "installed", "[", "'plugins'", ...
Return the instance of a specific Package @param string $slug The slug of the Package @return Local\Package The instance of the Package
[ "Return", "the", "instance", "of", "a", "specific", "Package" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L115-L126
207,729
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.countUpdates
public function countUpdates() { $count = 0; $count += count($this->getUpdatablePlugins()); $count += count($this->getUpdatableThemes()); return $count; }
php
public function countUpdates() { $count = 0; $count += count($this->getUpdatablePlugins()); $count += count($this->getUpdatableThemes()); return $count; }
[ "public", "function", "countUpdates", "(", ")", "{", "$", "count", "=", "0", ";", "$", "count", "+=", "count", "(", "$", "this", "->", "getUpdatablePlugins", "(", ")", ")", ";", "$", "count", "+=", "count", "(", "$", "this", "->", "getUpdatableThemes",...
Returns the amount of updates available @return int Amount of available updates
[ "Returns", "the", "amount", "of", "updates", "available" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L195-L203
207,730
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.getUpdatable
public function getUpdatable($list_type_update = ['plugins' => true, 'themes' => true]) { $items = ['total' => 0]; foreach ($list_type_update as $type => $type_updatable) { if ($type_updatable === false) { continue; } $methodUpdatableType = 'getUp...
php
public function getUpdatable($list_type_update = ['plugins' => true, 'themes' => true]) { $items = ['total' => 0]; foreach ($list_type_update as $type => $type_updatable) { if ($type_updatable === false) { continue; } $methodUpdatableType = 'getUp...
[ "public", "function", "getUpdatable", "(", "$", "list_type_update", "=", "[", "'plugins'", "=>", "true", ",", "'themes'", "=>", "true", "]", ")", "{", "$", "items", "=", "[", "'total'", "=>", "0", "]", ";", "foreach", "(", "$", "list_type_update", "as", ...
Returns an array of Plugins and Themes that can be updated. Plugins and Themes are extended with the `available` property that relies to the remote version @param array $list_type_update specifies what type of package to update @return array Array of updatable Plugins and Themes. Format: ['total' => int, 'plugins' => a...
[ "Returns", "an", "array", "of", "Plugins", "and", "Themes", "that", "can", "be", "updated", ".", "Plugins", "and", "Themes", "are", "extended", "with", "the", "available", "property", "that", "relies", "to", "the", "remote", "version" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L212-L226
207,731
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.getUpdatableThemes
public function getUpdatableThemes() { $items = []; $repository = $this->repository['themes']; // local cache to speed things up if (isset($this->cache[__METHOD__])) { return $this->cache[__METHOD__]; } foreach ($this->installed['themes'] as $slug => $pl...
php
public function getUpdatableThemes() { $items = []; $repository = $this->repository['themes']; // local cache to speed things up if (isset($this->cache[__METHOD__])) { return $this->cache[__METHOD__]; } foreach ($this->installed['themes'] as $slug => $pl...
[ "public", "function", "getUpdatableThemes", "(", ")", "{", "$", "items", "=", "[", "]", ";", "$", "repository", "=", "$", "this", "->", "repository", "[", "'themes'", "]", ";", "// local cache to speed things up", "if", "(", "isset", "(", "$", "this", "->"...
Returns an array of Themes that can be updated. The Themes are extended with the `available` property that relies to the remote version @return array Array of updatable Themes
[ "Returns", "an", "array", "of", "Themes", "that", "can", "be", "updated", ".", "The", "Themes", "are", "extended", "with", "the", "available", "property", "that", "relies", "to", "the", "remote", "version" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L312-L341
207,732
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.findPackage
public function findPackage($search, $ignore_exception = false) { $search = strtolower($search); $found = $this->getRepositoryTheme($search); if ($found) { return $found; } $found = $this->getRepositoryPlugin($search); if ($found) { return $f...
php
public function findPackage($search, $ignore_exception = false) { $search = strtolower($search); $found = $this->getRepositoryTheme($search); if ($found) { return $found; } $found = $this->getRepositoryPlugin($search); if ($found) { return $f...
[ "public", "function", "findPackage", "(", "$", "search", ",", "$", "ignore_exception", "=", "false", ")", "{", "$", "search", "=", "strtolower", "(", "$", "search", ")", ";", "$", "found", "=", "$", "this", "->", "getRepositoryTheme", "(", "$", "search",...
Searches for a Package in the repository @param string $search Can be either the slug or the name @param bool $ignore_exception True if should not fire an exception (for use in Twig) @return Remote\Package|bool Package if found, FALSE if not
[ "Searches", "for", "a", "Package", "in", "the", "repository" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L457-L503
207,733
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.downloadPackage
public static function downloadPackage($package_file, $tmp) { $package = parse_url($package_file); $filename = basename($package['path']); if (Grav::instance()['config']->get('system.gpm.official_gpm_only') && $package['host'] !== 'getgrav.org') { throw new \RuntimeException("On...
php
public static function downloadPackage($package_file, $tmp) { $package = parse_url($package_file); $filename = basename($package['path']); if (Grav::instance()['config']->get('system.gpm.official_gpm_only') && $package['host'] !== 'getgrav.org') { throw new \RuntimeException("On...
[ "public", "static", "function", "downloadPackage", "(", "$", "package_file", ",", "$", "tmp", ")", "{", "$", "package", "=", "parse_url", "(", "$", "package_file", ")", ";", "$", "filename", "=", "basename", "(", "$", "package", "[", "'path'", "]", ")", ...
Download the zip package via the URL @param string $package_file @param string $tmp @return null|string
[ "Download", "the", "zip", "package", "via", "the", "URL" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L512-L530
207,734
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.copyPackage
public static function copyPackage($package_file, $tmp) { $package_file = realpath($package_file); if (file_exists($package_file)) { $filename = basename($package_file); Folder::create($tmp); copy(realpath($package_file), $tmp . DS . $filename); retur...
php
public static function copyPackage($package_file, $tmp) { $package_file = realpath($package_file); if (file_exists($package_file)) { $filename = basename($package_file); Folder::create($tmp); copy(realpath($package_file), $tmp . DS . $filename); retur...
[ "public", "static", "function", "copyPackage", "(", "$", "package_file", ",", "$", "tmp", ")", "{", "$", "package_file", "=", "realpath", "(", "$", "package_file", ")", ";", "if", "(", "file_exists", "(", "$", "package_file", ")", ")", "{", "$", "filenam...
Copy the local zip package to tmp @param string $package_file @param string $tmp @return null|string
[ "Copy", "the", "local", "zip", "package", "to", "tmp" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L539-L551
207,735
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.getPackageType
public static function getPackageType($source) { $plugin_regex = '/^class\\s{1,}[a-zA-Z0-9]{1,}\\s{1,}extends.+Plugin/m'; $theme_regex = '/^class\\s{1,}[a-zA-Z0-9]{1,}\\s{1,}extends.+Theme/m'; if ( file_exists($source . 'system/defines.php') && file_exists($source . ...
php
public static function getPackageType($source) { $plugin_regex = '/^class\\s{1,}[a-zA-Z0-9]{1,}\\s{1,}extends.+Plugin/m'; $theme_regex = '/^class\\s{1,}[a-zA-Z0-9]{1,}\\s{1,}extends.+Theme/m'; if ( file_exists($source . 'system/defines.php') && file_exists($source . ...
[ "public", "static", "function", "getPackageType", "(", "$", "source", ")", "{", "$", "plugin_regex", "=", "'/^class\\\\s{1,}[a-zA-Z0-9]{1,}\\\\s{1,}extends.+Plugin/m'", ";", "$", "theme_regex", "=", "'/^class\\\\s{1,}[a-zA-Z0-9]{1,}\\\\s{1,}extends.+Theme/m'", ";", "if", "(",...
Try to guess the package type from the source files @param string $source @return bool|string
[ "Try", "to", "guess", "the", "package", "type", "from", "the", "source", "files" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L559-L596
207,736
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.getPackageName
public static function getPackageName($source) { $ignore_yaml_files = ['blueprints', 'languages']; foreach (glob($source . '*.yaml') as $filename) { $name = strtolower(basename($filename, '.yaml')); if (in_array($name, $ignore_yaml_files)) { continue; ...
php
public static function getPackageName($source) { $ignore_yaml_files = ['blueprints', 'languages']; foreach (glob($source . '*.yaml') as $filename) { $name = strtolower(basename($filename, '.yaml')); if (in_array($name, $ignore_yaml_files)) { continue; ...
[ "public", "static", "function", "getPackageName", "(", "$", "source", ")", "{", "$", "ignore_yaml_files", "=", "[", "'blueprints'", ",", "'languages'", "]", ";", "foreach", "(", "glob", "(", "$", "source", ".", "'*.yaml'", ")", "as", "$", "filename", ")", ...
Try to guess the package name from the source files @param string $source @return bool|string
[ "Try", "to", "guess", "the", "package", "name", "from", "the", "source", "files" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L604-L616
207,737
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.getInstallPath
public static function getInstallPath($type, $name) { $locator = Grav::instance()['locator']; if ($type === 'theme') { $install_path = $locator->findResource('themes://', false) . DS . $name; } else { $install_path = $locator->findResource('plugins://', false) . DS ....
php
public static function getInstallPath($type, $name) { $locator = Grav::instance()['locator']; if ($type === 'theme') { $install_path = $locator->findResource('themes://', false) . DS . $name; } else { $install_path = $locator->findResource('plugins://', false) . DS ....
[ "public", "static", "function", "getInstallPath", "(", "$", "type", ",", "$", "name", ")", "{", "$", "locator", "=", "Grav", "::", "instance", "(", ")", "[", "'locator'", "]", ";", "if", "(", "$", "type", "===", "'theme'", ")", "{", "$", "install_pat...
Get the install path for a name and a particular type of package @param string $type @param string $name @return string
[ "Get", "the", "install", "path", "for", "a", "name", "and", "a", "particular", "type", "of", "package" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L645-L655
207,738
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.findPackages
public function findPackages($searches = []) { $packages = ['total' => 0, 'not_found' => []]; $inflector = new Inflector(); foreach ($searches as $search) { $repository = ''; // if this is an object, get the search data from the key if (is_object($search)...
php
public function findPackages($searches = []) { $packages = ['total' => 0, 'not_found' => []]; $inflector = new Inflector(); foreach ($searches as $search) { $repository = ''; // if this is an object, get the search data from the key if (is_object($search)...
[ "public", "function", "findPackages", "(", "$", "searches", "=", "[", "]", ")", "{", "$", "packages", "=", "[", "'total'", "=>", "0", ",", "'not_found'", "=>", "[", "]", "]", ";", "$", "inflector", "=", "new", "Inflector", "(", ")", ";", "foreach", ...
Searches for a list of Packages in the repository @param array $searches An array of either slugs or names @return array Array of found Packages Format: ['total' => int, 'not_found' => array, <found-slugs>]
[ "Searches", "for", "a", "list", "of", "Packages", "in", "the", "repository" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L663-L709
207,739
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.getPackagesThatDependOnPackage
public function getPackagesThatDependOnPackage($slug) { $plugins = $this->getInstalledPlugins(); $themes = $this->getInstalledThemes(); $packages = array_merge($plugins->toArray(), $themes->toArray()); $dependent_packages = []; foreach ($packages as $package_name => $packag...
php
public function getPackagesThatDependOnPackage($slug) { $plugins = $this->getInstalledPlugins(); $themes = $this->getInstalledThemes(); $packages = array_merge($plugins->toArray(), $themes->toArray()); $dependent_packages = []; foreach ($packages as $package_name => $packag...
[ "public", "function", "getPackagesThatDependOnPackage", "(", "$", "slug", ")", "{", "$", "plugins", "=", "$", "this", "->", "getInstalledPlugins", "(", ")", ";", "$", "themes", "=", "$", "this", "->", "getInstalledThemes", "(", ")", ";", "$", "packages", "...
Return the list of packages that have the passed one as dependency @param string $slug The slug name of the package @return array
[ "Return", "the", "list", "of", "packages", "that", "have", "the", "passed", "one", "as", "dependency" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L718-L741
207,740
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.getVersionOfDependencyRequiredByPackage
public function getVersionOfDependencyRequiredByPackage($package_slug, $dependency_slug) { $dependencies = $this->getInstalledPackage($package_slug)->dependencies; foreach ($dependencies as $dependency) { if (isset($dependency[$dependency_slug])) { return $dependency[$dep...
php
public function getVersionOfDependencyRequiredByPackage($package_slug, $dependency_slug) { $dependencies = $this->getInstalledPackage($package_slug)->dependencies; foreach ($dependencies as $dependency) { if (isset($dependency[$dependency_slug])) { return $dependency[$dep...
[ "public", "function", "getVersionOfDependencyRequiredByPackage", "(", "$", "package_slug", ",", "$", "dependency_slug", ")", "{", "$", "dependencies", "=", "$", "this", "->", "getInstalledPackage", "(", "$", "package_slug", ")", "->", "dependencies", ";", "foreach",...
Get the required version of a dependency of a package @param string $package_slug @param string $dependency_slug @return mixed
[ "Get", "the", "required", "version", "of", "a", "dependency", "of", "a", "package" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L752-L762
207,741
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.checkPackagesCanBeInstalled
public function checkPackagesCanBeInstalled($packages_names_list) { foreach ($packages_names_list as $package_name) { $this->checkNoOtherPackageNeedsThisDependencyInALowerVersion($package_name, $this->getLatestVersionOfPackage($package_name), $packages_names_list); } ...
php
public function checkPackagesCanBeInstalled($packages_names_list) { foreach ($packages_names_list as $package_name) { $this->checkNoOtherPackageNeedsThisDependencyInALowerVersion($package_name, $this->getLatestVersionOfPackage($package_name), $packages_names_list); } ...
[ "public", "function", "checkPackagesCanBeInstalled", "(", "$", "packages_names_list", ")", "{", "foreach", "(", "$", "packages_names_list", "as", "$", "package_name", ")", "{", "$", "this", "->", "checkNoOtherPackageNeedsThisDependencyInALowerVersion", "(", "$", "packag...
Check the passed packages list can be updated @param array $packages_names_list @throws \Exception
[ "Check", "the", "passed", "packages", "list", "can", "be", "updated" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L815-L821
207,742
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.calculateMergedDependenciesOfPackage
private function calculateMergedDependenciesOfPackage($packageName, $dependencies) { $packageData = $this->findPackage($packageName); //Check for dependencies if (isset($packageData->dependencies)) { foreach ($packageData->dependencies as $dependency) { $current_...
php
private function calculateMergedDependenciesOfPackage($packageName, $dependencies) { $packageData = $this->findPackage($packageName); //Check for dependencies if (isset($packageData->dependencies)) { foreach ($packageData->dependencies as $dependency) { $current_...
[ "private", "function", "calculateMergedDependenciesOfPackage", "(", "$", "packageName", ",", "$", "dependencies", ")", "{", "$", "packageData", "=", "$", "this", "->", "findPackage", "(", "$", "packageName", ")", ";", "//Check for dependencies", "if", "(", "isset"...
Calculates and merges the dependencies of a package @param string $packageName The package information @param array $dependencies The dependencies array @return array @throws \Exception
[ "Calculates", "and", "merges", "the", "dependencies", "of", "a", "package" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L970-L1047
207,743
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.calculateMergedDependenciesOfPackages
public function calculateMergedDependenciesOfPackages($packages) { $dependencies = []; foreach ($packages as $package) { $dependencies = $this->calculateMergedDependenciesOfPackage($package, $dependencies); } return $dependencies; }
php
public function calculateMergedDependenciesOfPackages($packages) { $dependencies = []; foreach ($packages as $package) { $dependencies = $this->calculateMergedDependenciesOfPackage($package, $dependencies); } return $dependencies; }
[ "public", "function", "calculateMergedDependenciesOfPackages", "(", "$", "packages", ")", "{", "$", "dependencies", "=", "[", "]", ";", "foreach", "(", "$", "packages", "as", "$", "package", ")", "{", "$", "dependencies", "=", "$", "this", "->", "calculateMe...
Calculates and merges the dependencies of the passed packages @param array $packages @return mixed @throws \Exception
[ "Calculates", "and", "merges", "the", "dependencies", "of", "the", "passed", "packages" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L1057-L1066
207,744
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.checkNextSignificantReleasesAreCompatible
public function checkNextSignificantReleasesAreCompatible($version1, $version2) { $version1array = explode('.', $version1); $version2array = explode('.', $version2); if (\count($version1array) > \count($version2array)) { list($version1array, $version2array) = [$version2array, $v...
php
public function checkNextSignificantReleasesAreCompatible($version1, $version2) { $version1array = explode('.', $version1); $version2array = explode('.', $version2); if (\count($version1array) > \count($version2array)) { list($version1array, $version2array) = [$version2array, $v...
[ "public", "function", "checkNextSignificantReleasesAreCompatible", "(", "$", "version1", ",", "$", "version2", ")", "{", "$", "version1array", "=", "explode", "(", "'.'", ",", "$", "version1", ")", ";", "$", "version2array", "=", "explode", "(", "'.'", ",", ...
Check if two releases are compatible by next significant release ~1.2 is equivalent to >=1.2 <2.0.0 ~1.2.3 is equivalent to >=1.2.3 <1.3.0 In short, allows the last digit specified to go up @param string $version1 the version string (e.g. '2.0.0' or '1.0') @param string $version2 the version string (e.g. '2.0.0' or ...
[ "Check", "if", "two", "releases", "are", "compatible", "by", "next", "significant", "release" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L1139-L1157
207,745
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.fieldNameFilter
public function fieldNameFilter($str) { $path = explode('.', rtrim($str, '.')); return array_shift($path) . ($path ? '[' . implode('][', $path) . ']' : ''); }
php
public function fieldNameFilter($str) { $path = explode('.', rtrim($str, '.')); return array_shift($path) . ($path ? '[' . implode('][', $path) . ']' : ''); }
[ "public", "function", "fieldNameFilter", "(", "$", "str", ")", "{", "$", "path", "=", "explode", "(", "'.'", ",", "rtrim", "(", "$", "str", ",", "'.'", ")", ")", ";", "return", "array_shift", "(", "$", "path", ")", ".", "(", "$", "path", "?", "'[...
Filters field name by changing dot notation into array notation. @param string $str @return string
[ "Filters", "field", "name", "by", "changing", "dot", "notation", "into", "array", "notation", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L214-L219
207,746
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.safeEmailFilter
public function safeEmailFilter($str) { $email = ''; for ($i = 0, $len = strlen($str); $i < $len; $i++) { $j = random_int(0, 1); $email .= $j === 0 ? '&#' . ord($str[$i]) . ';' : $str[$i]; } return str_replace('@', '&#64;', $email); }
php
public function safeEmailFilter($str) { $email = ''; for ($i = 0, $len = strlen($str); $i < $len; $i++) { $j = random_int(0, 1); $email .= $j === 0 ? '&#' . ord($str[$i]) . ';' : $str[$i]; } return str_replace('@', '&#64;', $email); }
[ "public", "function", "safeEmailFilter", "(", "$", "str", ")", "{", "$", "email", "=", "''", ";", "for", "(", "$", "i", "=", "0", ",", "$", "len", "=", "strlen", "(", "$", "str", ")", ";", "$", "i", "<", "$", "len", ";", "$", "i", "++", ")"...
Protects email address. @param string $str @return string
[ "Protects", "email", "address", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L228-L238
207,747
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.randomizeFilter
public function randomizeFilter($original, $offset = 0) { if (!\is_array($original)) { return $original; } if ($original instanceof \Traversable) { $original = iterator_to_array($original, false); } $sorted = []; $random = array_slice($origin...
php
public function randomizeFilter($original, $offset = 0) { if (!\is_array($original)) { return $original; } if ($original instanceof \Traversable) { $original = iterator_to_array($original, false); } $sorted = []; $random = array_slice($origin...
[ "public", "function", "randomizeFilter", "(", "$", "original", ",", "$", "offset", "=", "0", ")", "{", "if", "(", "!", "\\", "is_array", "(", "$", "original", ")", ")", "{", "return", "$", "original", ";", "}", "if", "(", "$", "original", "instanceof...
Returns array in a random order. @param array $original @param int $offset Can be used to return only slice of the array. @return array
[ "Returns", "array", "in", "a", "random", "order", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L248-L272
207,748
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.modulusFilter
public function modulusFilter($number, $divider, $items = null) { if (\is_string($number)) { $number = strlen($number); } $remainder = $number % $divider; if (\is_array($items)) { return $items[$remainder] ?? $items[0]; } return $remainder; ...
php
public function modulusFilter($number, $divider, $items = null) { if (\is_string($number)) { $number = strlen($number); } $remainder = $number % $divider; if (\is_array($items)) { return $items[$remainder] ?? $items[0]; } return $remainder; ...
[ "public", "function", "modulusFilter", "(", "$", "number", ",", "$", "divider", ",", "$", "items", "=", "null", ")", "{", "if", "(", "\\", "is_string", "(", "$", "number", ")", ")", "{", "$", "number", "=", "strlen", "(", "$", "number", ")", ";", ...
Returns the modulus of an integer @param string|int $number @param int $divider @param array $items array of items to select from to return @return int
[ "Returns", "the", "modulus", "of", "an", "integer" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L283-L296
207,749
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.sortByKeyFilter
public function sortByKeyFilter($input, $filter, $direction = SORT_ASC, $sort_flags = SORT_REGULAR) { return Utils::sortArrayByKey($input, $filter, $direction, $sort_flags); }
php
public function sortByKeyFilter($input, $filter, $direction = SORT_ASC, $sort_flags = SORT_REGULAR) { return Utils::sortArrayByKey($input, $filter, $direction, $sort_flags); }
[ "public", "function", "sortByKeyFilter", "(", "$", "input", ",", "$", "filter", ",", "$", "direction", "=", "SORT_ASC", ",", "$", "sort_flags", "=", "SORT_REGULAR", ")", "{", "return", "Utils", "::", "sortArrayByKey", "(", "$", "input", ",", "$", "filter",...
Sorts a collection by key @param array $input @param string $filter @param int $direction @param int $sort_flags @return array
[ "Sorts", "a", "collection", "by", "key" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L405-L408
207,750
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.containsFilter
public function containsFilter($haystack, $needle) { if (empty($needle)) { return $haystack; } return (strpos($haystack, (string) $needle) !== false); }
php
public function containsFilter($haystack, $needle) { if (empty($needle)) { return $haystack; } return (strpos($haystack, (string) $needle) !== false); }
[ "public", "function", "containsFilter", "(", "$", "haystack", ",", "$", "needle", ")", "{", "if", "(", "empty", "(", "$", "needle", ")", ")", "{", "return", "$", "haystack", ";", "}", "return", "(", "strpos", "(", "$", "haystack", ",", "(", "string",...
determine if a string contains another @param string $haystack @param string $needle @return bool
[ "determine", "if", "a", "string", "contains", "another" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L448-L455
207,751
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.xssFunc
public function xssFunc($data) { if (!\is_array($data)) { return Security::detectXss($data); } $results = Security::detectXssFromArray($data); $results_parts = array_map(function($value, $key) { return $key.': \''.$value . '\''; }, array_values($resul...
php
public function xssFunc($data) { if (!\is_array($data)) { return Security::detectXss($data); } $results = Security::detectXssFromArray($data); $results_parts = array_map(function($value, $key) { return $key.': \''.$value . '\''; }, array_values($resul...
[ "public", "function", "xssFunc", "(", "$", "data", ")", "{", "if", "(", "!", "\\", "is_array", "(", "$", "data", ")", ")", "{", "return", "Security", "::", "detectXss", "(", "$", "data", ")", ";", "}", "$", "results", "=", "Security", "::", "detect...
Allow quick check of a string for XSS Vulnerabilities @param string|array $data @return bool|string|array
[ "Allow", "quick", "check", "of", "a", "string", "for", "XSS", "Vulnerabilities" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L585-L597
207,752
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.gistFunc
public function gistFunc($id, $file = false) { $url = 'https://gist.github.com/' . $id . '.js'; if ($file) { $url .= '?file=' . $file; } return '<script src="' . $url . '"></script>'; }
php
public function gistFunc($id, $file = false) { $url = 'https://gist.github.com/' . $id . '.js'; if ($file) { $url .= '?file=' . $file; } return '<script src="' . $url . '"></script>'; }
[ "public", "function", "gistFunc", "(", "$", "id", ",", "$", "file", "=", "false", ")", "{", "$", "url", "=", "'https://gist.github.com/'", ".", "$", "id", ".", "'.js'", ";", "if", "(", "$", "file", ")", "{", "$", "url", ".=", "'?file='", ".", "$", ...
Output a Gist @param string $id @param string|bool $file @return string
[ "Output", "a", "Gist" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L895-L902
207,753
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.arrayKeyValueFunc
public function arrayKeyValueFunc($key, $val, $current_array = null) { if (empty($current_array)) { return array($key => $val); } $current_array[$key] = $val; return $current_array; }
php
public function arrayKeyValueFunc($key, $val, $current_array = null) { if (empty($current_array)) { return array($key => $val); } $current_array[$key] = $val; return $current_array; }
[ "public", "function", "arrayKeyValueFunc", "(", "$", "key", ",", "$", "val", ",", "$", "current_array", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "current_array", ")", ")", "{", "return", "array", "(", "$", "key", "=>", "$", "val", ")", ...
Workaround for twig associative array initialization Returns a key => val array @param string $key key of item @param string $val value of item @param array $current_array optional array to add to @return array
[ "Workaround", "for", "twig", "associative", "array", "initialization", "Returns", "a", "key", "=", ">", "val", "array" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L941-L950
207,754
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.jsonDecodeFilter
public function jsonDecodeFilter($str, $assoc = false, $depth = 512, $options = 0) { return json_decode(html_entity_decode($str), $assoc, $depth, $options); }
php
public function jsonDecodeFilter($str, $assoc = false, $depth = 512, $options = 0) { return json_decode(html_entity_decode($str), $assoc, $depth, $options); }
[ "public", "function", "jsonDecodeFilter", "(", "$", "str", ",", "$", "assoc", "=", "false", ",", "$", "depth", "=", "512", ",", "$", "options", "=", "0", ")", "{", "return", "json_decode", "(", "html_entity_decode", "(", "$", "str", ")", ",", "$", "a...
Decodes string from JSON. @param string $str @param bool $assoc @param int $depth @param int $options @return array
[ "Decodes", "string", "from", "JSON", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L1054-L1057
207,755
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.regexReplace
public function regexReplace($subject, $pattern, $replace, $limit = -1) { return preg_replace($pattern, $replace, $subject, $limit); }
php
public function regexReplace($subject, $pattern, $replace, $limit = -1) { return preg_replace($pattern, $replace, $subject, $limit); }
[ "public", "function", "regexReplace", "(", "$", "subject", ",", "$", "pattern", ",", "$", "replace", ",", "$", "limit", "=", "-", "1", ")", "{", "return", "preg_replace", "(", "$", "pattern", ",", "$", "replace", ",", "$", "subject", ",", "$", "limit...
Twig wrapper for PHP's preg_replace method @param mixed $subject the content to perform the replacement on @param mixed $pattern the regex pattern to use for matches @param mixed $replace the replacement value either as a string or an array of replacements @param int $limit the maximum possible replacements for ea...
[ "Twig", "wrapper", "for", "PHP", "s", "preg_replace", "method" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L1081-L1084
207,756
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.exifFunc
public function exifFunc($image, $raw = false) { if (isset($this->grav['exif'])) { /** @var UniformResourceLocator $locator */ $locator = $this->grav['locator']; if ($locator->isStream($image)) { $image = $locator->findResource($image); } ...
php
public function exifFunc($image, $raw = false) { if (isset($this->grav['exif'])) { /** @var UniformResourceLocator $locator */ $locator = $this->grav['locator']; if ($locator->isStream($image)) { $image = $locator->findResource($image); } ...
[ "public", "function", "exifFunc", "(", "$", "image", ",", "$", "raw", "=", "false", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "grav", "[", "'exif'", "]", ")", ")", "{", "/** @var UniformResourceLocator $locator */", "$", "locator", "=", "$", ...
Get's the Exif data for a file @param string $image @param bool $raw @return mixed
[ "Get", "s", "the", "Exif", "data", "for", "a", "file" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L1145-L1172
207,757
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.readFileFunc
public function readFileFunc($filepath) { /** @var UniformResourceLocator $locator */ $locator = $this->grav['locator']; if ($locator->isStream($filepath)) { $filepath = $locator->findResource($filepath); } if ($filepath && file_exists($filepath)) { ...
php
public function readFileFunc($filepath) { /** @var UniformResourceLocator $locator */ $locator = $this->grav['locator']; if ($locator->isStream($filepath)) { $filepath = $locator->findResource($filepath); } if ($filepath && file_exists($filepath)) { ...
[ "public", "function", "readFileFunc", "(", "$", "filepath", ")", "{", "/** @var UniformResourceLocator $locator */", "$", "locator", "=", "$", "this", "->", "grav", "[", "'locator'", "]", ";", "if", "(", "$", "locator", "->", "isStream", "(", "$", "filepath", ...
Simple function to read a file based on a filepath and output it @param string $filepath @return bool|string
[ "Simple", "function", "to", "read", "a", "file", "based", "on", "a", "filepath", "and", "output", "it" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L1180-L1194
207,758
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.mediaDirFunc
public function mediaDirFunc($media_dir) { /** @var UniformResourceLocator $locator */ $locator = $this->grav['locator']; if ($locator->isStream($media_dir)) { $media_dir = $locator->findResource($media_dir); } if ($media_dir && file_exists($media_dir)) { ...
php
public function mediaDirFunc($media_dir) { /** @var UniformResourceLocator $locator */ $locator = $this->grav['locator']; if ($locator->isStream($media_dir)) { $media_dir = $locator->findResource($media_dir); } if ($media_dir && file_exists($media_dir)) { ...
[ "public", "function", "mediaDirFunc", "(", "$", "media_dir", ")", "{", "/** @var UniformResourceLocator $locator */", "$", "locator", "=", "$", "this", "->", "grav", "[", "'locator'", "]", ";", "if", "(", "$", "locator", "->", "isStream", "(", "$", "media_dir"...
Process a folder as Media and return a media object @param string $media_dir @return Media|null
[ "Process", "a", "folder", "as", "Media", "and", "return", "a", "media", "object" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L1202-L1216
207,759
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.niceNumberFunc
public function niceNumberFunc($n) { if (!\is_float($n) && !\is_int($n)) { if (!\is_string($n) || $n === '') { return false; } // Strip any thousand formatting and find the first number. $list = array_filter(preg_split("/\D+/", str_replace(','...
php
public function niceNumberFunc($n) { if (!\is_float($n) && !\is_int($n)) { if (!\is_string($n) || $n === '') { return false; } // Strip any thousand formatting and find the first number. $list = array_filter(preg_split("/\D+/", str_replace(','...
[ "public", "function", "niceNumberFunc", "(", "$", "n", ")", "{", "if", "(", "!", "\\", "is_float", "(", "$", "n", ")", "&&", "!", "\\", "is_int", "(", "$", "n", ")", ")", "{", "if", "(", "!", "\\", "is_string", "(", "$", "n", ")", "||", "$", ...
Returns a nicer more readable number @param int|float|string $n @return string|bool
[ "Returns", "a", "nicer", "more", "readable", "number" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L1245-L1278
207,760
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.themeVarFunc
public function themeVarFunc($var, $default = null) { $header = $this->grav['page']->header(); $header_classes = $header->{$var} ?? null; return $header_classes ?: $this->config->get('theme.' . $var, $default); }
php
public function themeVarFunc($var, $default = null) { $header = $this->grav['page']->header(); $header_classes = $header->{$var} ?? null; return $header_classes ?: $this->config->get('theme.' . $var, $default); }
[ "public", "function", "themeVarFunc", "(", "$", "var", ",", "$", "default", "=", "null", ")", "{", "$", "header", "=", "$", "this", "->", "grav", "[", "'page'", "]", "->", "header", "(", ")", ";", "$", "header_classes", "=", "$", "header", "->", "{...
Get a theme variable @param string $var @param bool $default @return string
[ "Get", "a", "theme", "variable" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L1287-L1293
207,761
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.bodyClassFunc
public function bodyClassFunc($classes) { $header = $this->grav['page']->header(); $body_classes = $header->body_classes ?? ''; foreach ((array)$classes as $class) { if (!empty($body_classes) && Utils::contains($body_classes, $class)) { continue; } ...
php
public function bodyClassFunc($classes) { $header = $this->grav['page']->header(); $body_classes = $header->body_classes ?? ''; foreach ((array)$classes as $class) { if (!empty($body_classes) && Utils::contains($body_classes, $class)) { continue; } ...
[ "public", "function", "bodyClassFunc", "(", "$", "classes", ")", "{", "$", "header", "=", "$", "this", "->", "grav", "[", "'page'", "]", "->", "header", "(", ")", ";", "$", "body_classes", "=", "$", "header", "->", "body_classes", "??", "''", ";", "f...
takes an array of classes, and if they are not set on body_classes look to see if they are set in theme config @param string|string[] $classes @return string
[ "takes", "an", "array", "of", "classes", "and", "if", "they", "are", "not", "set", "on", "body_classes", "look", "to", "see", "if", "they", "are", "set", "in", "theme", "config" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L1302-L1318
207,762
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.pageHeaderVarFunc
public function pageHeaderVarFunc($var, $pages = null) { if ($pages === null) { $pages = $this->grav['page']; } // Make sure pages are an array if (!\is_array($pages)) { $pages = [$pages]; } // Loop over pages and look for header vars ...
php
public function pageHeaderVarFunc($var, $pages = null) { if ($pages === null) { $pages = $this->grav['page']; } // Make sure pages are an array if (!\is_array($pages)) { $pages = [$pages]; } // Loop over pages and look for header vars ...
[ "public", "function", "pageHeaderVarFunc", "(", "$", "var", ",", "$", "pages", "=", "null", ")", "{", "if", "(", "$", "pages", "===", "null", ")", "{", "$", "pages", "=", "$", "this", "->", "grav", "[", "'page'", "]", ";", "}", "// Make sure pages ar...
Look for a page header variable in an array of pages working its way through until a value is found @param string $var @param string|string[]|null $pages @return mixed
[ "Look", "for", "a", "page", "header", "variable", "in", "an", "array", "of", "pages", "working", "its", "way", "through", "until", "a", "value", "is", "found" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L1327-L1353
207,763
getgrav/grav
system/src/Grav/Common/GPM/Remote/GravCore.php
GravCore.getChangelog
public function getChangelog($diff = null) { if (!$diff) { return $this->data['changelog']; } $diffLog = []; foreach ((array)$this->data['changelog'] as $version => $changelog) { preg_match("/[\w\-\.]+/", $version, $cleanVersion); if (!$cleanVers...
php
public function getChangelog($diff = null) { if (!$diff) { return $this->data['changelog']; } $diffLog = []; foreach ((array)$this->data['changelog'] as $version => $changelog) { preg_match("/[\w\-\.]+/", $version, $cleanVersion); if (!$cleanVers...
[ "public", "function", "getChangelog", "(", "$", "diff", "=", "null", ")", "{", "if", "(", "!", "$", "diff", ")", "{", "return", "$", "this", "->", "data", "[", "'changelog'", "]", ";", "}", "$", "diffLog", "=", "[", "]", ";", "foreach", "(", "(",...
Returns the changelog list for each version of Grav @param string $diff the version number to start the diff from @return array changelog list for each version
[ "Returns", "the", "changelog", "list", "for", "each", "version", "of", "Grav" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/Remote/GravCore.php#L68-L86
207,764
getgrav/grav
system/src/Grav/Common/Scheduler/Job.php
Job.isDue
public function isDue(\DateTime $date = null) { // The execution time is being defaulted if not defined if (!$this->executionTime) { $this->at('* * * * *'); } $date = $date ?? $this->creationTime; return $this->executionTime->isDue($date); }
php
public function isDue(\DateTime $date = null) { // The execution time is being defaulted if not defined if (!$this->executionTime) { $this->at('* * * * *'); } $date = $date ?? $this->creationTime; return $this->executionTime->isDue($date); }
[ "public", "function", "isDue", "(", "\\", "DateTime", "$", "date", "=", "null", ")", "{", "// The execution time is being defaulted if not defined", "if", "(", "!", "$", "this", "->", "executionTime", ")", "{", "$", "this", "->", "at", "(", "'* * * * *'", ")",...
Check if the Job is due to run. It accepts as input a DateTime used to check if the job is due. Defaults to job creation time. It also default the execution time if not previously defined. @param \DateTime $date @return bool
[ "Check", "if", "the", "Job", "is", "due", "to", "run", ".", "It", "accepts", "as", "input", "a", "DateTime", "used", "to", "check", "if", "the", "job", "is", "due", ".", "Defaults", "to", "job", "creation", "time", ".", "It", "also", "default", "the"...
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/Job.php#L151-L161
207,765
getgrav/grav
system/src/Grav/Common/Scheduler/Job.php
Job.isOverlapping
public function isOverlapping() { return $this->lockFile && file_exists($this->lockFile) && call_user_func($this->whenOverlapping, filemtime($this->lockFile)) === false; }
php
public function isOverlapping() { return $this->lockFile && file_exists($this->lockFile) && call_user_func($this->whenOverlapping, filemtime($this->lockFile)) === false; }
[ "public", "function", "isOverlapping", "(", ")", "{", "return", "$", "this", "->", "lockFile", "&&", "file_exists", "(", "$", "this", "->", "lockFile", ")", "&&", "call_user_func", "(", "$", "this", "->", "whenOverlapping", ",", "filemtime", "(", "$", "thi...
Check if the Job is overlapping. @return bool
[ "Check", "if", "the", "Job", "is", "overlapping", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/Job.php#L168-L173
207,766
getgrav/grav
system/src/Grav/Common/Scheduler/Job.php
Job.onlyOne
public function onlyOne($tempDir = null, callable $whenOverlapping = null) { if ($tempDir === null || !is_dir($tempDir)) { $tempDir = $this->tempDir; } $this->lockFile = implode('/', [ trim($tempDir), trim($this->id) . '.lock', ]); if ($whe...
php
public function onlyOne($tempDir = null, callable $whenOverlapping = null) { if ($tempDir === null || !is_dir($tempDir)) { $tempDir = $this->tempDir; } $this->lockFile = implode('/', [ trim($tempDir), trim($this->id) . '.lock', ]); if ($whe...
[ "public", "function", "onlyOne", "(", "$", "tempDir", "=", "null", ",", "callable", "$", "whenOverlapping", "=", "null", ")", "{", "if", "(", "$", "tempDir", "===", "null", "||", "!", "is_dir", "(", "$", "tempDir", ")", ")", "{", "$", "tempDir", "=",...
This will prevent the Job from overlapping. It prevents another instance of the same Job of being executed if the previous is still running. The job id is used as a filename for the lock file. @param string $tempDir The directory path for the lock files @param callable $whenOverlapping A callback to ignore job overl...
[ "This", "will", "prevent", "the", "Job", "from", "overlapping", ".", "It", "prevents", "another", "instance", "of", "the", "same", "Job", "of", "being", "executed", "if", "the", "previous", "is", "still", "running", ".", "The", "job", "id", "is", "used", ...
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/Job.php#L223-L241
207,767
getgrav/grav
system/src/Grav/Common/Scheduler/Job.php
Job.finalize
public function finalize() { /** @var Process $process */ $process = $this->process; if ($process) { $process->wait(); if ($process->isSuccessful()) { $this->successful = true; $this->output = $process->getOutput(); } els...
php
public function finalize() { /** @var Process $process */ $process = $this->process; if ($process) { $process->wait(); if ($process->isSuccessful()) { $this->successful = true; $this->output = $process->getOutput(); } els...
[ "public", "function", "finalize", "(", ")", "{", "/** @var Process $process */", "$", "process", "=", "$", "this", "->", "process", ";", "if", "(", "$", "process", ")", "{", "$", "process", "->", "wait", "(", ")", ";", "if", "(", "$", "process", "->", ...
Finish up processing the job @return void
[ "Finish", "up", "processing", "the", "job" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/Job.php#L323-L343
207,768
getgrav/grav
system/src/Grav/Common/Scheduler/Job.php
Job.postRun
private function postRun() { if (count($this->outputTo) > 0) { foreach ($this->outputTo as $file) { $output_mode = $this->outputMode === 'append' ? FILE_APPEND | LOCK_EX : LOCK_EX; file_put_contents($file, $this->output, $output_mode); } } ...
php
private function postRun() { if (count($this->outputTo) > 0) { foreach ($this->outputTo as $file) { $output_mode = $this->outputMode === 'append' ? FILE_APPEND | LOCK_EX : LOCK_EX; file_put_contents($file, $this->output, $output_mode); } } ...
[ "private", "function", "postRun", "(", ")", "{", "if", "(", "count", "(", "$", "this", "->", "outputTo", ")", ">", "0", ")", "{", "foreach", "(", "$", "this", "->", "outputTo", "as", "$", "file", ")", "{", "$", "output_mode", "=", "$", "this", "-...
Things to run after job has run
[ "Things", "to", "run", "after", "job", "has", "run" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/Job.php#L348-L366
207,769
getgrav/grav
system/src/Grav/Common/Scheduler/Job.php
Job.then
public function then(callable $fn, $runInBackground = false) { $this->after = $fn; // Force the job to run in foreground if ($runInBackground === false) { $this->inForeground(); } return $this; }
php
public function then(callable $fn, $runInBackground = false) { $this->after = $fn; // Force the job to run in foreground if ($runInBackground === false) { $this->inForeground(); } return $this; }
[ "public", "function", "then", "(", "callable", "$", "fn", ",", "$", "runInBackground", "=", "false", ")", "{", "$", "this", "->", "after", "=", "$", "fn", ";", "// Force the job to run in foreground", "if", "(", "$", "runInBackground", "===", "false", ")", ...
Set a function to be called after job execution. By default this will force the job to run in foreground because the output is injected as a parameter of this function, but it could be avoided by passing true as a second parameter. The job will run in background if it meets all the other criteria. @param callable $fn...
[ "Set", "a", "function", "to", "be", "called", "after", "job", "execution", ".", "By", "default", "this", "will", "force", "the", "job", "to", "run", "in", "foreground", "because", "the", "output", "is", "injected", "as", "a", "parameter", "of", "this", "...
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/Job.php#L511-L520
207,770
getgrav/grav
system/src/Grav/Common/User/FlexUser/User.php
User.join
public function join($name, $value, $separator = null) { $separator = $separator ?? '.'; $old = $this->get($name, null, $separator); if ($old !== null) { if (!\is_array($old)) { throw new \RuntimeException('Value ' . $old); } if (\is_objec...
php
public function join($name, $value, $separator = null) { $separator = $separator ?? '.'; $old = $this->get($name, null, $separator); if ($old !== null) { if (!\is_array($old)) { throw new \RuntimeException('Value ' . $old); } if (\is_objec...
[ "public", "function", "join", "(", "$", "name", ",", "$", "value", ",", "$", "separator", "=", "null", ")", "{", "$", "separator", "=", "$", "separator", "??", "'.'", ";", "$", "old", "=", "$", "this", "->", "get", "(", "$", "name", ",", "null", ...
Join nested values together by using blueprints. @param string $name Dot separated path to the requested value. @param mixed $value Value to be joined. @param string $separator Separator, defaults to '.' @return $this @throws \RuntimeException
[ "Join", "nested", "values", "together", "by", "using", "blueprints", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/FlexUser/User.php#L246-L267
207,771
getgrav/grav
system/src/Grav/Common/Scheduler/IntervalTrait.php
IntervalTrait.monthly
public function monthly($month = '*', $day = 1, $hour = 0, $minute = 0) { if (\is_string($hour)) { $parts = explode(':', $hour); $hour = $parts[0]; $minute = $parts[1] ?? '0'; } $c = $this->validateCronSequence($minute, $hour, $day, $month); retur...
php
public function monthly($month = '*', $day = 1, $hour = 0, $minute = 0) { if (\is_string($hour)) { $parts = explode(':', $hour); $hour = $parts[0]; $minute = $parts[1] ?? '0'; } $c = $this->validateCronSequence($minute, $hour, $day, $month); retur...
[ "public", "function", "monthly", "(", "$", "month", "=", "'*'", ",", "$", "day", "=", "1", ",", "$", "hour", "=", "0", ",", "$", "minute", "=", "0", ")", "{", "if", "(", "\\", "is_string", "(", "$", "hour", ")", ")", "{", "$", "parts", "=", ...
Set the execution time to once a month. @param int|string $month @param int|string $day @param int|string $hour @param int|string $minute @return self
[ "Set", "the", "execution", "time", "to", "once", "a", "month", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/IntervalTrait.php#L101-L111
207,772
getgrav/grav
system/src/Grav/Framework/Flex/FlexDirectory.php
FlexDirectory.getIndex
public function getIndex(array $keys = null, string $keyField = null): FlexIndexInterface { $index = clone $this->loadIndex(); $index = $index->withKeyField($keyField); if (null !== $keys) { $index = $index->select($keys); } return $index->getIndex(); }
php
public function getIndex(array $keys = null, string $keyField = null): FlexIndexInterface { $index = clone $this->loadIndex(); $index = $index->withKeyField($keyField); if (null !== $keys) { $index = $index->select($keys); } return $index->getIndex(); }
[ "public", "function", "getIndex", "(", "array", "$", "keys", "=", "null", ",", "string", "$", "keyField", "=", "null", ")", ":", "FlexIndexInterface", "{", "$", "index", "=", "clone", "$", "this", "->", "loadIndex", "(", ")", ";", "$", "index", "=", ...
Get the full collection of all stored objects. Use $directory->getCollection() if you want a filtered collection. @param array|null $keys Array of keys. @param string|null $keyField Field to be used as the key. @return FlexIndexInterface
[ "Get", "the", "full", "collection", "of", "all", "stored", "objects", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/FlexDirectory.php#L212-L222
207,773
getgrav/grav
system/src/Grav/Framework/Flex/FlexDirectory.php
FlexDirectory.getObject
public function getObject($key, string $keyField = null): ?FlexObjectInterface { return $this->getIndex(null, $keyField)->get($key); }
php
public function getObject($key, string $keyField = null): ?FlexObjectInterface { return $this->getIndex(null, $keyField)->get($key); }
[ "public", "function", "getObject", "(", "$", "key", ",", "string", "$", "keyField", "=", "null", ")", ":", "?", "FlexObjectInterface", "{", "return", "$", "this", "->", "getIndex", "(", "null", ",", "$", "keyField", ")", "->", "get", "(", "$", "key", ...
Returns an object if it exists. Note: It is not safe to use the object without checking if the user can access it. @param string $key @param string|null $keyField Field to be used as the key. @return FlexObjectInterface|null
[ "Returns", "an", "object", "if", "it", "exists", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/FlexDirectory.php#L233-L236
207,774
getgrav/grav
system/src/Grav/Common/Helpers/Excerpts.php
Excerpts.processImageHtml
public static function processImageHtml($html, PageInterface $page) { $excerpt = static::getExcerptFromHtml($html, 'img'); $original_src = $excerpt['element']['attributes']['src']; $excerpt['element']['attributes']['href'] = $original_src; $excerpt = static::processLinkExcerpt($exc...
php
public static function processImageHtml($html, PageInterface $page) { $excerpt = static::getExcerptFromHtml($html, 'img'); $original_src = $excerpt['element']['attributes']['src']; $excerpt['element']['attributes']['href'] = $original_src; $excerpt = static::processLinkExcerpt($exc...
[ "public", "static", "function", "processImageHtml", "(", "$", "html", ",", "PageInterface", "$", "page", ")", "{", "$", "excerpt", "=", "static", "::", "getExcerptFromHtml", "(", "$", "html", ",", "'img'", ")", ";", "$", "original_src", "=", "$", "excerpt"...
Process Grav image media URL from HTML tag @param string $html HTML tag e.g. `<img src="image.jpg" />` @param PageInterface $page The current page object @return string Returns final HTML string
[ "Process", "Grav", "image", "media", "URL", "from", "HTML", "tag" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/Excerpts.php#L29-L48
207,775
getgrav/grav
system/src/Grav/Common/Helpers/Excerpts.php
Excerpts.getExcerptFromHtml
public static function getExcerptFromHtml($html, $tag) { $doc = new \DOMDocument(); $doc->loadHTML($html); $images = $doc->getElementsByTagName($tag); $excerpt = null; foreach ($images as $image) { $attributes = []; foreach ($image->attributes as $nam...
php
public static function getExcerptFromHtml($html, $tag) { $doc = new \DOMDocument(); $doc->loadHTML($html); $images = $doc->getElementsByTagName($tag); $excerpt = null; foreach ($images as $image) { $attributes = []; foreach ($image->attributes as $nam...
[ "public", "static", "function", "getExcerptFromHtml", "(", "$", "html", ",", "$", "tag", ")", "{", "$", "doc", "=", "new", "\\", "DOMDocument", "(", ")", ";", "$", "doc", "->", "loadHTML", "(", "$", "html", ")", ";", "$", "images", "=", "$", "doc",...
Get an Excerpt array from a chunk of HTML @param string $html Chunk of HTML @param string $tag A tag, for example `img` @return array|null returns nested array excerpt
[ "Get", "an", "Excerpt", "array", "from", "a", "chunk", "of", "HTML" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/Excerpts.php#L57-L78
207,776
getgrav/grav
system/src/Grav/Common/Helpers/Excerpts.php
Excerpts.getHtmlFromExcerpt
public static function getHtmlFromExcerpt($excerpt) { $element = $excerpt['element']; $html = '<'.$element['name']; if (isset($element['attributes'])) { foreach ($element['attributes'] as $name => $value) { if ($value === null) { continue; ...
php
public static function getHtmlFromExcerpt($excerpt) { $element = $excerpt['element']; $html = '<'.$element['name']; if (isset($element['attributes'])) { foreach ($element['attributes'] as $name => $value) { if ($value === null) { continue; ...
[ "public", "static", "function", "getHtmlFromExcerpt", "(", "$", "excerpt", ")", "{", "$", "element", "=", "$", "excerpt", "[", "'element'", "]", ";", "$", "html", "=", "'<'", ".", "$", "element", "[", "'name'", "]", ";", "if", "(", "isset", "(", "$",...
Rebuild HTML tag from an excerpt array @param array $excerpt @return string
[ "Rebuild", "HTML", "tag", "from", "an", "excerpt", "array" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/Excerpts.php#L86-L109
207,777
getgrav/grav
system/src/Grav/Common/Helpers/Excerpts.php
Excerpts.processLinkExcerpt
public static function processLinkExcerpt($excerpt, PageInterface $page, $type = 'link') { $url = htmlspecialchars_decode(rawurldecode($excerpt['element']['attributes']['href'])); $url_parts = static::parseUrl($url); // If there is a query, then parse it and build action calls. if ...
php
public static function processLinkExcerpt($excerpt, PageInterface $page, $type = 'link') { $url = htmlspecialchars_decode(rawurldecode($excerpt['element']['attributes']['href'])); $url_parts = static::parseUrl($url); // If there is a query, then parse it and build action calls. if ...
[ "public", "static", "function", "processLinkExcerpt", "(", "$", "excerpt", ",", "PageInterface", "$", "page", ",", "$", "type", "=", "'link'", ")", "{", "$", "url", "=", "htmlspecialchars_decode", "(", "rawurldecode", "(", "$", "excerpt", "[", "'element'", "...
Process a Link excerpt @param array $excerpt @param PageInterface $page @param string $type @return mixed
[ "Process", "a", "Link", "excerpt" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/Excerpts.php#L119-L189
207,778
getgrav/grav
system/src/Grav/Common/Helpers/Excerpts.php
Excerpts.processImageExcerpt
public static function processImageExcerpt(array $excerpt, PageInterface $page) { $url = htmlspecialchars_decode(urldecode($excerpt['element']['attributes']['src'])); $url_parts = static::parseUrl($url); $media = null; $filename = null; if (!empty($url_parts['stream'])) { ...
php
public static function processImageExcerpt(array $excerpt, PageInterface $page) { $url = htmlspecialchars_decode(urldecode($excerpt['element']['attributes']['src'])); $url_parts = static::parseUrl($url); $media = null; $filename = null; if (!empty($url_parts['stream'])) { ...
[ "public", "static", "function", "processImageExcerpt", "(", "array", "$", "excerpt", ",", "PageInterface", "$", "page", ")", "{", "$", "url", "=", "htmlspecialchars_decode", "(", "urldecode", "(", "$", "excerpt", "[", "'element'", "]", "[", "'attributes'", "]"...
Process an image excerpt @param array $excerpt @param PageInterface $page @return array
[ "Process", "an", "image", "excerpt" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/Excerpts.php#L198-L266
207,779
getgrav/grav
system/src/Grav/Common/Helpers/Excerpts.php
Excerpts.processMediaActions
public static function processMediaActions($medium, $url) { if (!is_array($url)) { $url_parts = parse_url($url); } else { $url_parts = $url; } $actions = []; // if there is a query, then parse it and build action calls if (isset($url_parts['q...
php
public static function processMediaActions($medium, $url) { if (!is_array($url)) { $url_parts = parse_url($url); } else { $url_parts = $url; } $actions = []; // if there is a query, then parse it and build action calls if (isset($url_parts['q...
[ "public", "static", "function", "processMediaActions", "(", "$", "medium", ",", "$", "url", ")", "{", "if", "(", "!", "is_array", "(", "$", "url", ")", ")", "{", "$", "url_parts", "=", "parse_url", "(", "$", "url", ")", ";", "}", "else", "{", "$", ...
Process media actions @param Medium $medium @param string|array $url @return Medium
[ "Process", "media", "actions" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/Excerpts.php#L275-L327
207,780
getgrav/grav
system/src/Grav/Common/Plugin.php
Plugin.getSubscribedEvents
public static function getSubscribedEvents() { $methods = get_class_methods(get_called_class()); $list = []; foreach ($methods as $method) { if (strpos($method, 'on') === 0) { $list[$method] = [$method, 0]; } } return $list; }
php
public static function getSubscribedEvents() { $methods = get_class_methods(get_called_class()); $list = []; foreach ($methods as $method) { if (strpos($method, 'on') === 0) { $list[$method] = [$method, 0]; } } return $list; }
[ "public", "static", "function", "getSubscribedEvents", "(", ")", "{", "$", "methods", "=", "get_class_methods", "(", "get_called_class", "(", ")", ")", ";", "$", "list", "=", "[", "]", ";", "foreach", "(", "$", "methods", "as", "$", "method", ")", "{", ...
By default assign all methods as listeners using the default priority. @return array
[ "By", "default", "assign", "all", "methods", "as", "listeners", "using", "the", "default", "priority", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Plugin.php#L50-L62
207,781
getgrav/grav
system/src/Grav/Common/Plugin.php
Plugin.isPluginActiveAdmin
protected function isPluginActiveAdmin($plugin_route) { $should_run = false; $uri = $this->grav['uri']; if (strpos($uri->path(), $this->config->get('plugins.admin.route') . '/' . $plugin_route) === false) { $should_run = false; } elseif (isset($uri->paths()[1]) && $uri-...
php
protected function isPluginActiveAdmin($plugin_route) { $should_run = false; $uri = $this->grav['uri']; if (strpos($uri->path(), $this->config->get('plugins.admin.route') . '/' . $plugin_route) === false) { $should_run = false; } elseif (isset($uri->paths()[1]) && $uri-...
[ "protected", "function", "isPluginActiveAdmin", "(", "$", "plugin_route", ")", "{", "$", "should_run", "=", "false", ";", "$", "uri", "=", "$", "this", "->", "grav", "[", "'uri'", "]", ";", "if", "(", "strpos", "(", "$", "uri", "->", "path", "(", ")"...
Determine if this route is in Admin and active for the plugin @param string $plugin_route @return bool
[ "Determine", "if", "this", "route", "is", "in", "Admin", "and", "active", "for", "the", "plugin" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Plugin.php#L127-L140
207,782
getgrav/grav
system/src/Grav/Common/Plugin.php
Plugin.mergeConfig
protected function mergeConfig(PageInterface $page, $deep = false, $params = [], $type = 'plugins') { $class_name = $this->name; $class_name_merged = $class_name . '.merged'; $defaults = $this->config->get($type . '.' . $class_name, []); $page_header = $page->header(); $heade...
php
protected function mergeConfig(PageInterface $page, $deep = false, $params = [], $type = 'plugins') { $class_name = $this->name; $class_name_merged = $class_name . '.merged'; $defaults = $this->config->get($type . '.' . $class_name, []); $page_header = $page->header(); $heade...
[ "protected", "function", "mergeConfig", "(", "PageInterface", "$", "page", ",", "$", "deep", "=", "false", ",", "$", "params", "=", "[", "]", ",", "$", "type", "=", "'plugins'", ")", "{", "$", "class_name", "=", "$", "this", "->", "name", ";", "$", ...
Merge global and page configurations. @param PageInterface $page The page to merge the configurations with the plugin settings. @param mixed $deep false = shallow|true = recursive|merge = recursive+unique @param array $params Array of additional configuration options to merge with the plugin settings. @param string $t...
[ "Merge", "global", "and", "page", "configurations", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Plugin.php#L271-L303
207,783
getgrav/grav
system/src/Grav/Common/Plugin.php
Plugin.mergeArrays
private function mergeArrays($deep, $array1, $array2) { if ($deep === 'merge') { return Utils::arrayMergeRecursiveUnique($array1, $array2); } if ($deep === true) { return array_replace_recursive($array1, $array2); } return array_merge($array1, $array2...
php
private function mergeArrays($deep, $array1, $array2) { if ($deep === 'merge') { return Utils::arrayMergeRecursiveUnique($array1, $array2); } if ($deep === true) { return array_replace_recursive($array1, $array2); } return array_merge($array1, $array2...
[ "private", "function", "mergeArrays", "(", "$", "deep", ",", "$", "array1", ",", "$", "array2", ")", "{", "if", "(", "$", "deep", "===", "'merge'", ")", "{", "return", "Utils", "::", "arrayMergeRecursiveUnique", "(", "$", "array1", ",", "$", "array2", ...
Merge arrays based on deepness @param string|bool $deep @param array $array1 @param array $array2 @return array
[ "Merge", "arrays", "based", "on", "deepness" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Plugin.php#L313-L323
207,784
getgrav/grav
system/src/Grav/Common/Plugin.php
Plugin.loadBlueprint
protected function loadBlueprint() { if (!$this->blueprint) { $grav = Grav::instance(); $plugins = $grav['plugins']; $this->blueprint = $plugins->get($this->name)->blueprints(); } }
php
protected function loadBlueprint() { if (!$this->blueprint) { $grav = Grav::instance(); $plugins = $grav['plugins']; $this->blueprint = $plugins->get($this->name)->blueprints(); } }
[ "protected", "function", "loadBlueprint", "(", ")", "{", "if", "(", "!", "$", "this", "->", "blueprint", ")", "{", "$", "grav", "=", "Grav", "::", "instance", "(", ")", ";", "$", "plugins", "=", "$", "grav", "[", "'plugins'", "]", ";", "$", "this",...
Load blueprints.
[ "Load", "blueprints", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Plugin.php#L365-L372
207,785
getgrav/grav
system/src/Grav/Framework/Uri/UriPartsFilter.php
UriPartsFilter.filterUserInfo
public static function filterUserInfo($info) { if (!\is_string($info)) { throw new \InvalidArgumentException('Uri user info must be a string'); } return preg_replace_callback( '/(?:[^a-zA-Z0-9_\-\.~!\$&\'\(\)\*\+,;=]+|%(?![A-Fa-f0-9]{2}))/u', function ($m...
php
public static function filterUserInfo($info) { if (!\is_string($info)) { throw new \InvalidArgumentException('Uri user info must be a string'); } return preg_replace_callback( '/(?:[^a-zA-Z0-9_\-\.~!\$&\'\(\)\*\+,;=]+|%(?![A-Fa-f0-9]{2}))/u', function ($m...
[ "public", "static", "function", "filterUserInfo", "(", "$", "info", ")", "{", "if", "(", "!", "\\", "is_string", "(", "$", "info", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Uri user info must be a string'", ")", ";", "}", "retur...
Filters the user info string. @param string $info The raw user or password. @return string The percent-encoded user or password string. @throws \InvalidArgumentException
[ "Filters", "the", "user", "info", "string", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Uri/UriPartsFilter.php#L41-L54
207,786
getgrav/grav
system/src/Grav/Common/Page/Medium/ParsedownHtmlTrait.php
ParsedownHtmlTrait.html
public function html($title = null, $alt = null, $class = null, $id = null, $reset = true) { $element = $this->parsedownElement($title, $alt, $class, $id, $reset); if (!$this->parsedown) { $this->parsedown = new Parsedown(null, null); } return $this->parsedown->elementT...
php
public function html($title = null, $alt = null, $class = null, $id = null, $reset = true) { $element = $this->parsedownElement($title, $alt, $class, $id, $reset); if (!$this->parsedown) { $this->parsedown = new Parsedown(null, null); } return $this->parsedown->elementT...
[ "public", "function", "html", "(", "$", "title", "=", "null", ",", "$", "alt", "=", "null", ",", "$", "class", "=", "null", ",", "$", "id", "=", "null", ",", "$", "reset", "=", "true", ")", "{", "$", "element", "=", "$", "this", "->", "parsedow...
Return HTML markup from the medium. @param string $title @param string $alt @param string $class @param string $id @param bool $reset @return string
[ "Return", "HTML", "markup", "from", "the", "medium", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ParsedownHtmlTrait.php#L31-L40
207,787
getgrav/grav
system/src/Grav/Common/Page/Medium/VideoMedium.php
VideoMedium.preload
public function preload($status = null) { if ($status) { $this->attributes['preload'] = $status; } else { unset($this->attributes['preload']); } return $this; }
php
public function preload($status = null) { if ($status) { $this->attributes['preload'] = $status; } else { unset($this->attributes['preload']); } return $this; }
[ "public", "function", "preload", "(", "$", "status", "=", "null", ")", "{", "if", "(", "$", "status", ")", "{", "$", "this", "->", "attributes", "[", "'preload'", "]", "=", "$", "status", ";", "}", "else", "{", "unset", "(", "$", "this", "->", "a...
Allows ability to set the preload option @param null $status @return $this
[ "Allows", "ability", "to", "set", "the", "preload", "option" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/VideoMedium.php#L104-L113
207,788
getgrav/grav
system/src/Grav/Common/Page/Medium/VideoMedium.php
VideoMedium.playsinline
public function playsinline($status = false) { if($status) { $this->attributes['playsinline'] = true; } else { unset($this->attributes['playsinline']); } return $this; }
php
public function playsinline($status = false) { if($status) { $this->attributes['playsinline'] = true; } else { unset($this->attributes['playsinline']); } return $this; }
[ "public", "function", "playsinline", "(", "$", "status", "=", "false", ")", "{", "if", "(", "$", "status", ")", "{", "$", "this", "->", "attributes", "[", "'playsinline'", "]", "=", "true", ";", "}", "else", "{", "unset", "(", "$", "this", "->", "a...
Allows to set the playsinline attribute @param bool $status @return $this
[ "Allows", "to", "set", "the", "playsinline", "attribute" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/VideoMedium.php#L121-L130
207,789
getgrav/grav
system/src/Grav/Common/Data/Blueprint.php
Blueprint.getDefaults
public function getDefaults() { $this->initInternals(); if (null === $this->defaults) { $this->defaults = $this->blueprintSchema->getDefaults(); } return $this->defaults; }
php
public function getDefaults() { $this->initInternals(); if (null === $this->defaults) { $this->defaults = $this->blueprintSchema->getDefaults(); } return $this->defaults; }
[ "public", "function", "getDefaults", "(", ")", "{", "$", "this", "->", "initInternals", "(", ")", ";", "if", "(", "null", "===", "$", "this", "->", "defaults", ")", "{", "$", "this", "->", "defaults", "=", "$", "this", "->", "blueprintSchema", "->", ...
Get nested structure containing default values defined in the blueprints. Fields without default value are ignored in the list. @return array
[ "Get", "nested", "structure", "containing", "default", "values", "defined", "in", "the", "blueprints", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Blueprint.php#L67-L76
207,790
getgrav/grav
system/src/Grav/Common/Data/Blueprint.php
Blueprint.processForm
public function processForm(array $data, array $toggles = []) { $this->initInternals(); return $this->blueprintSchema->processForm($data, $toggles); }
php
public function processForm(array $data, array $toggles = []) { $this->initInternals(); return $this->blueprintSchema->processForm($data, $toggles); }
[ "public", "function", "processForm", "(", "array", "$", "data", ",", "array", "$", "toggles", "=", "[", "]", ")", "{", "$", "this", "->", "initInternals", "(", ")", ";", "return", "$", "this", "->", "blueprintSchema", "->", "processForm", "(", "$", "da...
Process data coming from a form. @param array $data @param array $toggles @return array
[ "Process", "data", "coming", "from", "a", "form", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Blueprint.php#L150-L155
207,791
getgrav/grav
system/src/Grav/Common/Data/Blueprint.php
Blueprint.initInternals
protected function initInternals() { if (null === $this->blueprintSchema) { $types = Grav::instance()['plugins']->formFieldTypes; $this->blueprintSchema = new BlueprintSchema; if ($types) { $this->blueprintSchema->setTypes($types); } ...
php
protected function initInternals() { if (null === $this->blueprintSchema) { $types = Grav::instance()['plugins']->formFieldTypes; $this->blueprintSchema = new BlueprintSchema; if ($types) { $this->blueprintSchema->setTypes($types); } ...
[ "protected", "function", "initInternals", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "blueprintSchema", ")", "{", "$", "types", "=", "Grav", "::", "instance", "(", ")", "[", "'plugins'", "]", "->", "formFieldTypes", ";", "$", "this", "...
Initialize validator.
[ "Initialize", "validator", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Blueprint.php#L234-L249
207,792
getgrav/grav
system/src/Grav/Common/User/Authentication.php
Authentication.create
public static function create($password): string { if (!$password) { throw new \RuntimeException('Password hashing failed: no password provided.'); } $hash = password_hash($password, PASSWORD_DEFAULT); if (!$hash) { throw new \RuntimeException('Password hash...
php
public static function create($password): string { if (!$password) { throw new \RuntimeException('Password hashing failed: no password provided.'); } $hash = password_hash($password, PASSWORD_DEFAULT); if (!$hash) { throw new \RuntimeException('Password hash...
[ "public", "static", "function", "create", "(", "$", "password", ")", ":", "string", "{", "if", "(", "!", "$", "password", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Password hashing failed: no password provided.'", ")", ";", "}", "$", "hash", ...
Create password hash from plaintext password. @param string $password Plaintext password. @throws \RuntimeException @return string
[ "Create", "password", "hash", "from", "plaintext", "password", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/Authentication.php#L22-L35
207,793
getgrav/grav
system/src/Grav/Common/User/Authentication.php
Authentication.verify
public static function verify($password, $hash): int { // Fail if hash doesn't match if (!$password || !$hash || !password_verify($password, $hash)) { return 0; } // Otherwise check if hash needs an update. return password_needs_rehash($hash, PASSWORD_DEFAULT) ? ...
php
public static function verify($password, $hash): int { // Fail if hash doesn't match if (!$password || !$hash || !password_verify($password, $hash)) { return 0; } // Otherwise check if hash needs an update. return password_needs_rehash($hash, PASSWORD_DEFAULT) ? ...
[ "public", "static", "function", "verify", "(", "$", "password", ",", "$", "hash", ")", ":", "int", "{", "// Fail if hash doesn't match", "if", "(", "!", "$", "password", "||", "!", "$", "hash", "||", "!", "password_verify", "(", "$", "password", ",", "$"...
Verifies that a password matches a hash. @param string $password Plaintext password. @param string $hash Hash to verify against. @return int Returns 0 if the check fails, 1 if password matches, 2 if hash needs to be updated.
[ "Verifies", "that", "a", "password", "matches", "a", "hash", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/Authentication.php#L45-L54
207,794
getgrav/grav
system/src/Grav/Common/Page/Medium/AbstractMedia.php
AbstractMedia.orderMedia
protected function orderMedia($media) { if (null === $this->media_order) { /** @var Page $page */ $page = Grav::instance()['pages']->get($this->getPath()); if ($page && isset($page->header()->media_order)) { $this->media_order = array_map('trim', explode(...
php
protected function orderMedia($media) { if (null === $this->media_order) { /** @var Page $page */ $page = Grav::instance()['pages']->get($this->getPath()); if ($page && isset($page->header()->media_order)) { $this->media_order = array_map('trim', explode(...
[ "protected", "function", "orderMedia", "(", "$", "media", ")", "{", "if", "(", "null", "===", "$", "this", "->", "media_order", ")", "{", "/** @var Page $page */", "$", "page", "=", "Grav", "::", "instance", "(", ")", "[", "'pages'", "]", "->", "get", ...
Order the media based on the page's media_order @param array $media @return array
[ "Order", "the", "media", "based", "on", "the", "page", "s", "media_order" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/AbstractMedia.php#L179-L197
207,795
getgrav/grav
system/src/Grav/Common/Page/Medium/AbstractMedia.php
AbstractMedia.getFileParts
protected function getFileParts($filename) { if (preg_match('/(.*)@(\d+)x\.(.*)$/', $filename, $matches)) { $name = $matches[1]; $extension = $matches[3]; $extra = (int) $matches[2]; $type = 'alternative'; if ($extra === 1) { $type...
php
protected function getFileParts($filename) { if (preg_match('/(.*)@(\d+)x\.(.*)$/', $filename, $matches)) { $name = $matches[1]; $extension = $matches[3]; $extra = (int) $matches[2]; $type = 'alternative'; if ($extra === 1) { $type...
[ "protected", "function", "getFileParts", "(", "$", "filename", ")", "{", "if", "(", "preg_match", "(", "'/(.*)@(\\d+)x\\.(.*)$/'", ",", "$", "filename", ",", "$", "matches", ")", ")", "{", "$", "name", "=", "$", "matches", "[", "1", "]", ";", "$", "ext...
Get filename, extension and meta part. @param string $filename @return array
[ "Get", "filename", "extension", "and", "meta", "part", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/AbstractMedia.php#L205-L240
207,796
getgrav/grav
system/src/Grav/Common/Config/CompiledBase.php
CompiledBase.name
public function name($name = null) { if (!$this->name) { $this->name = $name ?: md5(json_encode(array_keys($this->files))); } return $this; }
php
public function name($name = null) { if (!$this->name) { $this->name = $name ?: md5(json_encode(array_keys($this->files))); } return $this; }
[ "public", "function", "name", "(", "$", "name", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "name", ")", "{", "$", "this", "->", "name", "=", "$", "name", "?", ":", "md5", "(", "json_encode", "(", "array_keys", "(", "$", "this", "...
Get filename for the compiled PHP file. @param string $name @return $this
[ "Get", "filename", "for", "the", "compiled", "PHP", "file", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Config/CompiledBase.php#L80-L87
207,797
getgrav/grav
system/src/Grav/Common/Config/CompiledBase.php
CompiledBase.checksum
public function checksum() { if (null === $this->checksum) { $this->checksum = md5(json_encode($this->files) . $this->version); } return $this->checksum; }
php
public function checksum() { if (null === $this->checksum) { $this->checksum = md5(json_encode($this->files) . $this->version); } return $this->checksum; }
[ "public", "function", "checksum", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "checksum", ")", "{", "$", "this", "->", "checksum", "=", "md5", "(", "json_encode", "(", "$", "this", "->", "files", ")", ".", "$", "this", "->", "versio...
Returns checksum from the configuration files. You can set $this->checksum = false to disable this check. @return bool|string
[ "Returns", "checksum", "from", "the", "configuration", "files", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Config/CompiledBase.php#L130-L137
207,798
getgrav/grav
system/src/Grav/Common/Config/CompiledBase.php
CompiledBase.loadFiles
protected function loadFiles() { $this->createObject(); $list = array_reverse($this->files); foreach ($list as $files) { foreach ($files as $name => $item) { $this->loadFile($name, $this->path . $item['file']); } } $this->finalizeObje...
php
protected function loadFiles() { $this->createObject(); $list = array_reverse($this->files); foreach ($list as $files) { foreach ($files as $name => $item) { $this->loadFile($name, $this->path . $item['file']); } } $this->finalizeObje...
[ "protected", "function", "loadFiles", "(", ")", "{", "$", "this", "->", "createObject", "(", ")", ";", "$", "list", "=", "array_reverse", "(", "$", "this", "->", "files", ")", ";", "foreach", "(", "$", "list", "as", "$", "files", ")", "{", "foreach",...
Load and join all configuration files. @return bool @internal
[ "Load", "and", "join", "all", "configuration", "files", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Config/CompiledBase.php#L170-L184
207,799
getgrav/grav
system/src/Grav/Common/Config/CompiledBase.php
CompiledBase.loadCompiledFile
protected function loadCompiledFile($filename) { if (!file_exists($filename)) { return false; } $cache = include $filename; if ( !\is_array($cache) || !isset($cache['checksum'], $cache['data'], $cache['@class']) || $cache['@class'] !==...
php
protected function loadCompiledFile($filename) { if (!file_exists($filename)) { return false; } $cache = include $filename; if ( !\is_array($cache) || !isset($cache['checksum'], $cache['data'], $cache['@class']) || $cache['@class'] !==...
[ "protected", "function", "loadCompiledFile", "(", "$", "filename", ")", "{", "if", "(", "!", "file_exists", "(", "$", "filename", ")", ")", "{", "return", "false", ";", "}", "$", "cache", "=", "include", "$", "filename", ";", "if", "(", "!", "\\", "i...
Load compiled file. @param string $filename @return bool @internal
[ "Load", "compiled", "file", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Config/CompiledBase.php#L193-L219