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,600
getgrav/grav
system/src/Grav/Common/Cache.php
Cache.init
public function init(Grav $grav) { /** @var Config $config */ $this->config = $grav['config']; $this->now = time(); if (null === $this->enabled) { $this->enabled = (bool)$this->config->get('system.cache.enabled'); } /** @var Uri $uri */ $uri = $g...
php
public function init(Grav $grav) { /** @var Config $config */ $this->config = $grav['config']; $this->now = time(); if (null === $this->enabled) { $this->enabled = (bool)$this->config->get('system.cache.enabled'); } /** @var Uri $uri */ $uri = $g...
[ "public", "function", "init", "(", "Grav", "$", "grav", ")", "{", "/** @var Config $config */", "$", "this", "->", "config", "=", "$", "grav", "[", "'config'", "]", ";", "$", "this", "->", "now", "=", "time", "(", ")", ";", "if", "(", "null", "===", ...
Initialization that sets a base key and the driver based on configuration settings @param Grav $grav @return void
[ "Initialization", "that", "sets", "a", "base", "key", "and", "the", "driver", "based", "on", "configuration", "settings" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Cache.php#L121-L147
207,601
getgrav/grav
system/src/Grav/Common/Cache.php
Cache.purgeOldCache
public function purgeOldCache() { $cache_dir = dirname($this->cache_dir); $current = basename($this->cache_dir); $count = 0; foreach (new \DirectoryIterator($cache_dir) as $file) { $dir = $file->getBasename(); if ($dir === $current || $file->isDot() || $file-...
php
public function purgeOldCache() { $cache_dir = dirname($this->cache_dir); $current = basename($this->cache_dir); $count = 0; foreach (new \DirectoryIterator($cache_dir) as $file) { $dir = $file->getBasename(); if ($dir === $current || $file->isDot() || $file-...
[ "public", "function", "purgeOldCache", "(", ")", "{", "$", "cache_dir", "=", "dirname", "(", "$", "this", "->", "cache_dir", ")", ";", "$", "current", "=", "basename", "(", "$", "this", "->", "cache_dir", ")", ";", "$", "count", "=", "0", ";", "forea...
Deletes the old out of date file-based caches @return int
[ "Deletes", "the", "old", "out", "of", "date", "file", "-", "based", "caches" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Cache.php#L171-L188
207,602
getgrav/grav
system/src/Grav/Common/Cache.php
Cache.save
public function save($id, $data, $lifetime = null) { if ($this->enabled) { if ($lifetime === null) { $lifetime = $this->getLifetime(); } $this->driver->save($id, $data, $lifetime); } }
php
public function save($id, $data, $lifetime = null) { if ($this->enabled) { if ($lifetime === null) { $lifetime = $this->getLifetime(); } $this->driver->save($id, $data, $lifetime); } }
[ "public", "function", "save", "(", "$", "id", ",", "$", "data", ",", "$", "lifetime", "=", "null", ")", "{", "if", "(", "$", "this", "->", "enabled", ")", "{", "if", "(", "$", "lifetime", "===", "null", ")", "{", "$", "lifetime", "=", "$", "thi...
Stores a new cached entry. @param string $id the id of the cached entry @param array|object $data the data for the cached entry to store @param int $lifetime the lifetime to store the entry in seconds
[ "Stores", "a", "new", "cached", "entry", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Cache.php#L340-L348
207,603
getgrav/grav
system/src/Grav/Common/Cache.php
Cache.clearCache
public static function clearCache($remove = 'standard') { $locator = Grav::instance()['locator']; $output = []; $user_config = USER_DIR . 'config/system.yaml'; switch ($remove) { case 'all': $remove_paths = self::$all_remove; break; ...
php
public static function clearCache($remove = 'standard') { $locator = Grav::instance()['locator']; $output = []; $user_config = USER_DIR . 'config/system.yaml'; switch ($remove) { case 'all': $remove_paths = self::$all_remove; break; ...
[ "public", "static", "function", "clearCache", "(", "$", "remove", "=", "'standard'", ")", "{", "$", "locator", "=", "Grav", "::", "instance", "(", ")", "[", "'locator'", "]", ";", "$", "output", "=", "[", "]", ";", "$", "user_config", "=", "USER_DIR", ...
Helper method to clear all Grav caches @param string $remove standard|all|assets-only|images-only|cache-only @return array
[ "Helper", "method", "to", "clear", "all", "Grav", "caches" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Cache.php#L418-L514
207,604
getgrav/grav
system/src/Grav/Common/Cache.php
Cache.setLifetime
public function setLifetime($future) { if (!$future) { return; } $interval = $future - $this->now; if ($interval > 0 && $interval < $this->getLifetime()) { $this->lifetime = $interval; } }
php
public function setLifetime($future) { if (!$future) { return; } $interval = $future - $this->now; if ($interval > 0 && $interval < $this->getLifetime()) { $this->lifetime = $interval; } }
[ "public", "function", "setLifetime", "(", "$", "future", ")", "{", "if", "(", "!", "$", "future", ")", "{", "return", ";", "}", "$", "interval", "=", "$", "future", "-", "$", "this", "->", "now", ";", "if", "(", "$", "interval", ">", "0", "&&", ...
Set the cache lifetime programmatically @param int $future timestamp
[ "Set", "the", "cache", "lifetime", "programmatically" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Cache.php#L540-L550
207,605
getgrav/grav
system/src/Grav/Common/Helpers/Base32.php
Base32.encode
public static function encode($bytes) { $i = 0; $index = 0; $base32 = ''; $bytesLen = \strlen($bytes); while ($i < $bytesLen) { $currByte = \ord($bytes[$i]); /* Is the current digit going to span a byte boundary? */ if ($index > 3) { ...
php
public static function encode($bytes) { $i = 0; $index = 0; $base32 = ''; $bytesLen = \strlen($bytes); while ($i < $bytesLen) { $currByte = \ord($bytes[$i]); /* Is the current digit going to span a byte boundary? */ if ($index > 3) { ...
[ "public", "static", "function", "encode", "(", "$", "bytes", ")", "{", "$", "i", "=", "0", ";", "$", "index", "=", "0", ";", "$", "base32", "=", "''", ";", "$", "bytesLen", "=", "\\", "strlen", "(", "$", "bytes", ")", ";", "while", "(", "$", ...
Encode in Base32 @param string $bytes @return string
[ "Encode", "in", "Base32" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/Base32.php#L34-L67
207,606
getgrav/grav
system/src/Grav/Common/Helpers/Base32.php
Base32.decode
public static function decode($base32) { $bytes = []; $base32Len = \strlen($base32); $base32LookupLen = \count(self::$base32Lookup); for ($i = $base32Len * 5 / 8 - 1; $i >= 0; --$i) { $bytes[] = 0; } for ($i = 0, $index = 0, $offset = 0; $i < $base32Len;...
php
public static function decode($base32) { $bytes = []; $base32Len = \strlen($base32); $base32LookupLen = \count(self::$base32Lookup); for ($i = $base32Len * 5 / 8 - 1; $i >= 0; --$i) { $bytes[] = 0; } for ($i = 0, $index = 0, $offset = 0; $i < $base32Len;...
[ "public", "static", "function", "decode", "(", "$", "base32", ")", "{", "$", "bytes", "=", "[", "]", ";", "$", "base32Len", "=", "\\", "strlen", "(", "$", "base32", ")", ";", "$", "base32LookupLen", "=", "\\", "count", "(", "self", "::", "$", "base...
Decode in Base32 @param string $base32 @return string
[ "Decode", "in", "Base32" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/Base32.php#L75-L128
207,607
getgrav/grav
system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php
ObjectCollectionTrait.copy
public function copy() { $list = []; foreach ($this->getIterator() as $key => $value) { $list[$key] = \is_object($value) ? clone $value : $value; } return $this->createFrom($list); }
php
public function copy() { $list = []; foreach ($this->getIterator() as $key => $value) { $list[$key] = \is_object($value) ? clone $value : $value; } return $this->createFrom($list); }
[ "public", "function", "copy", "(", ")", "{", "$", "list", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getIterator", "(", ")", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "list", "[", "$", "key", "]", "=", "\\", "is_object",...
Create a copy from this collection by cloning all objects in the collection. @return static
[ "Create", "a", "copy", "from", "this", "collection", "by", "cloning", "all", "objects", "in", "the", "collection", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php#L29-L37
207,608
getgrav/grav
system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php
ObjectCollectionTrait.group
public function group($property) { $list = []; /** @var ObjectInterface $element */ foreach ($this->getIterator() as $element) { $list[(string) $element->getProperty($property)][] = $element; } return $list; }
php
public function group($property) { $list = []; /** @var ObjectInterface $element */ foreach ($this->getIterator() as $element) { $list[(string) $element->getProperty($property)][] = $element; } return $list; }
[ "public", "function", "group", "(", "$", "property", ")", "{", "$", "list", "=", "[", "]", ";", "/** @var ObjectInterface $element */", "foreach", "(", "$", "this", "->", "getIterator", "(", ")", "as", "$", "element", ")", "{", "$", "list", "[", "(", "...
Group items in the collection by a field and return them as associated array. @param string $property @return array
[ "Group", "items", "in", "the", "collection", "by", "a", "field", "and", "return", "them", "as", "associated", "array", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php#L151-L161
207,609
getgrav/grav
system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php
ObjectCollectionTrait.collectionGroup
public function collectionGroup($property) { $collections = []; foreach ($this->group($property) as $id => $elements) { $collection = $this->createFrom($elements); $collections[$id] = $collection; } return $collections; }
php
public function collectionGroup($property) { $collections = []; foreach ($this->group($property) as $id => $elements) { $collection = $this->createFrom($elements); $collections[$id] = $collection; } return $collections; }
[ "public", "function", "collectionGroup", "(", "$", "property", ")", "{", "$", "collections", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "group", "(", "$", "property", ")", "as", "$", "id", "=>", "$", "elements", ")", "{", "$", "collection...
Group items in the collection by a field and return them as associated array of collections. @param string $property @return static[]
[ "Group", "items", "in", "the", "collection", "by", "a", "field", "and", "return", "them", "as", "associated", "array", "of", "collections", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php#L169-L179
207,610
getgrav/grav
system/src/Grav/Framework/Flex/Storage/FolderStorage.php
FolderStorage.getPathFromKey
public function getPathFromKey(string $key): string { return sprintf($this->dataPattern, $this->dataFolder, $key, substr($key, 0, 2)); }
php
public function getPathFromKey(string $key): string { return sprintf($this->dataPattern, $this->dataFolder, $key, substr($key, 0, 2)); }
[ "public", "function", "getPathFromKey", "(", "string", "$", "key", ")", ":", "string", "{", "return", "sprintf", "(", "$", "this", "->", "dataPattern", ",", "$", "this", "->", "dataFolder", ",", "$", "key", ",", "substr", "(", "$", "key", ",", "0", "...
Get filesystem path from the key. @param string $key @return string
[ "Get", "filesystem", "path", "from", "the", "key", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/Storage/FolderStorage.php#L240-L243
207,611
getgrav/grav
system/src/Grav/Common/Page/Collection.php
Collection.addPage
public function addPage(PageInterface $page) { $this->items[$page->path()] = ['slug' => $page->slug()]; return $this; }
php
public function addPage(PageInterface $page) { $this->items[$page->path()] = ['slug' => $page->slug()]; return $this; }
[ "public", "function", "addPage", "(", "PageInterface", "$", "page", ")", "{", "$", "this", "->", "items", "[", "$", "page", "->", "path", "(", ")", "]", "=", "[", "'slug'", "=>", "$", "page", "->", "slug", "(", ")", "]", ";", "return", "$", "this...
Add a single page to a collection @param PageInterface $page @return $this
[ "Add", "a", "single", "page", "to", "a", "collection" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Collection.php#L61-L66
207,612
getgrav/grav
system/src/Grav/Common/Page/Collection.php
Collection.intersect
public function intersect(Collection $collection) { $array1 = $this->items; $array2 = $collection->toArray(); $this->items = array_uintersect($array1, $array2, function($val1, $val2) { return strcmp($val1['slug'], $val2['slug']); }); return $this; }
php
public function intersect(Collection $collection) { $array1 = $this->items; $array2 = $collection->toArray(); $this->items = array_uintersect($array1, $array2, function($val1, $val2) { return strcmp($val1['slug'], $val2['slug']); }); return $this; }
[ "public", "function", "intersect", "(", "Collection", "$", "collection", ")", "{", "$", "array1", "=", "$", "this", "->", "items", ";", "$", "array2", "=", "$", "collection", "->", "toArray", "(", ")", ";", "$", "this", "->", "items", "=", "array_uinte...
Intersect another collection with the current collection @param Collection $collection @return $this
[ "Intersect", "another", "collection", "with", "the", "current", "collection" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Collection.php#L115-L125
207,613
getgrav/grav
system/src/Grav/Common/Page/Collection.php
Collection.batch
public function batch($size) { $chunks = array_chunk($this->items, $size, true); $list = []; foreach ($chunks as $chunk) { $list[] = new static($chunk, $this->params, $this->pages); } return $list; }
php
public function batch($size) { $chunks = array_chunk($this->items, $size, true); $list = []; foreach ($chunks as $chunk) { $list[] = new static($chunk, $this->params, $this->pages); } return $list; }
[ "public", "function", "batch", "(", "$", "size", ")", "{", "$", "chunks", "=", "array_chunk", "(", "$", "this", "->", "items", ",", "$", "size", ",", "true", ")", ";", "$", "list", "=", "[", "]", ";", "foreach", "(", "$", "chunks", "as", "$", "...
Split collection into array of smaller collections. @param int $size @return array|Collection[]
[ "Split", "collection", "into", "array", "of", "smaller", "collections", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Collection.php#L183-L193
207,614
getgrav/grav
system/src/Grav/Common/Page/Collection.php
Collection.remove
public function remove($key = null) { if ($key instanceof PageInterface) { $key = $key->path(); } elseif (null === $key) { $key = (string)key($this->items); } if (!\is_string($key)) { throw new \InvalidArgumentException('Invalid argument $key.'); ...
php
public function remove($key = null) { if ($key instanceof PageInterface) { $key = $key->path(); } elseif (null === $key) { $key = (string)key($this->items); } if (!\is_string($key)) { throw new \InvalidArgumentException('Invalid argument $key.'); ...
[ "public", "function", "remove", "(", "$", "key", "=", "null", ")", "{", "if", "(", "$", "key", "instanceof", "PageInterface", ")", "{", "$", "key", "=", "$", "key", "->", "path", "(", ")", ";", "}", "elseif", "(", "null", "===", "$", "key", ")", ...
Remove item from the list. @param PageInterface|string|null $key @return $this @throws \InvalidArgumentException
[ "Remove", "item", "from", "the", "list", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Collection.php#L203-L217
207,615
getgrav/grav
system/src/Grav/Common/Page/Collection.php
Collection.order
public function order($by, $dir = 'asc', $manual = null, $sort_flags = null) { $this->items = $this->pages->sortCollection($this, $by, $dir, $manual, $sort_flags); return $this; }
php
public function order($by, $dir = 'asc', $manual = null, $sort_flags = null) { $this->items = $this->pages->sortCollection($this, $by, $dir, $manual, $sort_flags); return $this; }
[ "public", "function", "order", "(", "$", "by", ",", "$", "dir", "=", "'asc'", ",", "$", "manual", "=", "null", ",", "$", "sort_flags", "=", "null", ")", "{", "$", "this", "->", "items", "=", "$", "this", "->", "pages", "->", "sortCollection", "(", ...
Reorder collection. @param string $by @param string $dir @param array $manual @param string $sort_flags @return $this
[ "Reorder", "collection", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Collection.php#L229-L234
207,616
getgrav/grav
system/src/Grav/Common/Page/Collection.php
Collection.isLast
public function isLast($path) { return $this->items && $path === array_keys($this->items)[\count($this->items) - 1]; }
php
public function isLast($path) { return $this->items && $path === array_keys($this->items)[\count($this->items) - 1]; }
[ "public", "function", "isLast", "(", "$", "path", ")", "{", "return", "$", "this", "->", "items", "&&", "$", "path", "===", "array_keys", "(", "$", "this", "->", "items", ")", "[", "\\", "count", "(", "$", "this", "->", "items", ")", "-", "1", "]...
Check to see if this item is the last in the collection. @param string $path @return bool True if item is last.
[ "Check", "to", "see", "if", "this", "item", "is", "the", "last", "in", "the", "collection", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Collection.php#L255-L258
207,617
getgrav/grav
system/src/Grav/Common/Page/Collection.php
Collection.visible
public function visible() { $visible = []; foreach ($this->items as $path => $slug) { $page = $this->pages->get($path); if ($page !== null && $page->visible()) { $visible[$path] = $slug; } } $this->items = $visible; return...
php
public function visible() { $visible = []; foreach ($this->items as $path => $slug) { $page = $this->pages->get($path); if ($page !== null && $page->visible()) { $visible[$path] = $slug; } } $this->items = $visible; return...
[ "public", "function", "visible", "(", ")", "{", "$", "visible", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "items", "as", "$", "path", "=>", "$", "slug", ")", "{", "$", "page", "=", "$", "this", "->", "pages", "->", "get", "(", "$",...
Creates new collection with only visible pages @return Collection The collection with only visible pages
[ "Creates", "new", "collection", "with", "only", "visible", "pages" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Collection.php#L359-L372
207,618
getgrav/grav
system/src/Grav/Common/Page/Collection.php
Collection.modular
public function modular() { $modular = []; foreach ($this->items as $path => $slug) { $page = $this->pages->get($path); if ($page !== null && $page->modular()) { $modular[$path] = $slug; } } $this->items = $modular; return...
php
public function modular() { $modular = []; foreach ($this->items as $path => $slug) { $page = $this->pages->get($path); if ($page !== null && $page->modular()) { $modular[$path] = $slug; } } $this->items = $modular; return...
[ "public", "function", "modular", "(", ")", "{", "$", "modular", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "items", "as", "$", "path", "=>", "$", "slug", ")", "{", "$", "page", "=", "$", "this", "->", "pages", "->", "get", "(", "$",...
Creates new collection with only modular pages @return Collection The collection with only modular pages
[ "Creates", "new", "collection", "with", "only", "modular", "pages" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Collection.php#L399-L412
207,619
getgrav/grav
system/src/Grav/Common/Page/Collection.php
Collection.published
public function published() { $published = []; foreach ($this->items as $path => $slug) { $page = $this->pages->get($path); if ($page !== null && $page->published()) { $published[$path] = $slug; } } $this->items = $published; ...
php
public function published() { $published = []; foreach ($this->items as $path => $slug) { $page = $this->pages->get($path); if ($page !== null && $page->published()) { $published[$path] = $slug; } } $this->items = $published; ...
[ "public", "function", "published", "(", ")", "{", "$", "published", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "items", "as", "$", "path", "=>", "$", "slug", ")", "{", "$", "page", "=", "$", "this", "->", "pages", "->", "get", "(", ...
Creates new collection with only published pages @return Collection The collection with only published pages
[ "Creates", "new", "collection", "with", "only", "published", "pages" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Collection.php#L439-L452
207,620
getgrav/grav
system/src/Grav/Common/Page/Collection.php
Collection.routable
public function routable() { $routable = []; foreach ($this->items as $path => $slug) { $page = $this->pages->get($path); if ($page !== null && $page->routable()) { $routable[$path] = $slug; } } $this->items = $routable; ...
php
public function routable() { $routable = []; foreach ($this->items as $path => $slug) { $page = $this->pages->get($path); if ($page !== null && $page->routable()) { $routable[$path] = $slug; } } $this->items = $routable; ...
[ "public", "function", "routable", "(", ")", "{", "$", "routable", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "items", "as", "$", "path", "=>", "$", "slug", ")", "{", "$", "page", "=", "$", "this", "->", "pages", "->", "get", "(", "$...
Creates new collection with only routable pages @return Collection The collection with only routable pages
[ "Creates", "new", "collection", "with", "only", "routable", "pages" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Collection.php#L479-L494
207,621
getgrav/grav
system/src/Grav/Common/Page/Collection.php
Collection.ofType
public function ofType($type) { $items = []; foreach ($this->items as $path => $slug) { $page = $this->pages->get($path); if ($page !== null && $page->template() === $type) { $items[$path] = $slug; } } $this->items = $items; ...
php
public function ofType($type) { $items = []; foreach ($this->items as $path => $slug) { $page = $this->pages->get($path); if ($page !== null && $page->template() === $type) { $items[$path] = $slug; } } $this->items = $items; ...
[ "public", "function", "ofType", "(", "$", "type", ")", "{", "$", "items", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "items", "as", "$", "path", "=>", "$", "slug", ")", "{", "$", "page", "=", "$", "this", "->", "pages", "->", "get",...
Creates new collection with only pages of the specified type @param string $type @return Collection The collection
[ "Creates", "new", "collection", "with", "only", "pages", "of", "the", "specified", "type" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Collection.php#L523-L537
207,622
getgrav/grav
system/src/Grav/Common/Page/Collection.php
Collection.ofOneOfTheseTypes
public function ofOneOfTheseTypes($types) { $items = []; foreach ($this->items as $path => $slug) { $page = $this->pages->get($path); if ($page !== null && \in_array($page->template(), $types, true)) { $items[$path] = $slug; } } $...
php
public function ofOneOfTheseTypes($types) { $items = []; foreach ($this->items as $path => $slug) { $page = $this->pages->get($path); if ($page !== null && \in_array($page->template(), $types, true)) { $items[$path] = $slug; } } $...
[ "public", "function", "ofOneOfTheseTypes", "(", "$", "types", ")", "{", "$", "items", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "items", "as", "$", "path", "=>", "$", "slug", ")", "{", "$", "page", "=", "$", "this", "->", "pages", "-...
Creates new collection with only pages of one of the specified types @param string[] $types @return Collection The collection
[ "Creates", "new", "collection", "with", "only", "pages", "of", "one", "of", "the", "specified", "types" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Collection.php#L546-L560
207,623
getgrav/grav
system/src/Grav/Common/Page/Collection.php
Collection.ofOneOfTheseAccessLevels
public function ofOneOfTheseAccessLevels($accessLevels) { $items = []; foreach ($this->items as $path => $slug) { $page = $this->pages->get($path); if ($page !== null && isset($page->header()->access)) { if (\is_array($page->header()->access)) { ...
php
public function ofOneOfTheseAccessLevels($accessLevels) { $items = []; foreach ($this->items as $path => $slug) { $page = $this->pages->get($path); if ($page !== null && isset($page->header()->access)) { if (\is_array($page->header()->access)) { ...
[ "public", "function", "ofOneOfTheseAccessLevels", "(", "$", "accessLevels", ")", "{", "$", "items", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "items", "as", "$", "path", "=>", "$", "slug", ")", "{", "$", "page", "=", "$", "this", "->", ...
Creates new collection with only pages of one of the specified access levels @param array $accessLevels @return Collection The collection
[ "Creates", "new", "collection", "with", "only", "pages", "of", "one", "of", "the", "specified", "access", "levels" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Collection.php#L569-L610
207,624
getgrav/grav
system/src/Grav/Common/Page/Collection.php
Collection.toExtendedArray
public function toExtendedArray() { $items = []; foreach ($this->items as $path => $slug) { $page = $this->pages->get($path); if ($page !== null) { $items[$page->route()] = $page->toArray(); } } return $items; }
php
public function toExtendedArray() { $items = []; foreach ($this->items as $path => $slug) { $page = $this->pages->get($path); if ($page !== null) { $items[$page->route()] = $page->toArray(); } } return $items; }
[ "public", "function", "toExtendedArray", "(", ")", "{", "$", "items", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "items", "as", "$", "path", "=>", "$", "slug", ")", "{", "$", "page", "=", "$", "this", "->", "pages", "->", "get", "(", ...
Get the extended version of this Collection with each page keyed by route @return array @throws \Exception
[ "Get", "the", "extended", "version", "of", "this", "Collection", "with", "each", "page", "keyed", "by", "route" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Collection.php#L618-L629
207,625
getgrav/grav
system/src/Grav/Framework/Object/Collection/ObjectExpressionVisitor.php
ObjectExpressionVisitor.getObjectFieldValue
public static function getObjectFieldValue($object, $field) { $op = $value = null; $pos = strpos($field, '('); if (false !== $pos) { list ($op, $field) = explode('(', $field, 2); $field = rtrim($field, ')'); } if (isset($object[$field])) { ...
php
public static function getObjectFieldValue($object, $field) { $op = $value = null; $pos = strpos($field, '('); if (false !== $pos) { list ($op, $field) = explode('(', $field, 2); $field = rtrim($field, ')'); } if (isset($object[$field])) { ...
[ "public", "static", "function", "getObjectFieldValue", "(", "$", "object", ",", "$", "field", ")", "{", "$", "op", "=", "$", "value", "=", "null", ";", "$", "pos", "=", "strpos", "(", "$", "field", ",", "'('", ")", ";", "if", "(", "false", "!==", ...
Accesses the field of a given object. @param object $object @param string $field @return mixed
[ "Accesses", "the", "field", "of", "a", "given", "object", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Object/Collection/ObjectExpressionVisitor.php#L25-L60
207,626
getgrav/grav
system/src/Grav/Common/Security.php
Security.detectXss
public static function detectXss($string) { // Skip any null or non string values if (null === $string || !\is_string($string) || empty($string)) { return false; } // Keep a copy of the original string before cleaning up $orig = $string; // URL decode ...
php
public static function detectXss($string) { // Skip any null or non string values if (null === $string || !\is_string($string) || empty($string)) { return false; } // Keep a copy of the original string before cleaning up $orig = $string; // URL decode ...
[ "public", "static", "function", "detectXss", "(", "$", "string", ")", "{", "// Skip any null or non string values", "if", "(", "null", "===", "$", "string", "||", "!", "\\", "is_string", "(", "$", "string", ")", "||", "empty", "(", "$", "string", ")", ")",...
Determine if string potentially has a XSS attack. This simple function does not catch all XSS and it is likely to return false positives because of it tags all potentially dangerous HTML tags and attributes without looking into their content. @param string $string The string to run XSS detection logic on @return bool|...
[ "Determine", "if", "string", "potentially", "has", "a", "XSS", "attack", ".", "This", "simple", "function", "does", "not", "catch", "all", "XSS", "and", "it", "is", "likely", "to", "return", "false", "positives", "because", "of", "it", "tags", "all", "pote...
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Security.php#L100-L164
207,627
getgrav/grav
system/src/Grav/Common/Themes.php
Themes.all
public function all() { $list = []; /** @var UniformResourceLocator $locator */ $locator = $this->grav['locator']; $iterator = $locator->getIterator('themes://'); /** @var \DirectoryIterator $directory */ foreach ($iterator as $directory) { if (!$direct...
php
public function all() { $list = []; /** @var UniformResourceLocator $locator */ $locator = $this->grav['locator']; $iterator = $locator->getIterator('themes://'); /** @var \DirectoryIterator $directory */ foreach ($iterator as $directory) { if (!$direct...
[ "public", "function", "all", "(", ")", "{", "$", "list", "=", "[", "]", ";", "/** @var UniformResourceLocator $locator */", "$", "locator", "=", "$", "this", "->", "grav", "[", "'locator'", "]", ";", "$", "iterator", "=", "$", "locator", "->", "getIterator...
Return list of all theme data with their blueprints. @return array
[ "Return", "list", "of", "all", "theme", "data", "with", "their", "blueprints", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Themes.php#L87-L112
207,628
getgrav/grav
system/src/Grav/Common/Themes.php
Themes.get
public function get($name) { if (!$name) { throw new \RuntimeException('Theme name not provided.'); } $blueprints = new Blueprints('themes://'); $blueprint = $blueprints->get("{$name}/blueprints"); // Load default configuration. $file = CompiledYamlFile:...
php
public function get($name) { if (!$name) { throw new \RuntimeException('Theme name not provided.'); } $blueprints = new Blueprints('themes://'); $blueprint = $blueprints->get("{$name}/blueprints"); // Load default configuration. $file = CompiledYamlFile:...
[ "public", "function", "get", "(", "$", "name", ")", "{", "if", "(", "!", "$", "name", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Theme name not provided.'", ")", ";", "}", "$", "blueprints", "=", "new", "Blueprints", "(", "'themes://'", "...
Get theme configuration or throw exception if it cannot be found. @param string $name @return Data @throws \RuntimeException
[ "Get", "theme", "configuration", "or", "throw", "exception", "if", "it", "cannot", "be", "found", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Themes.php#L122-L157
207,629
getgrav/grav
system/src/Grav/Common/Themes.php
Themes.load
public function load() { // NOTE: ALL THE LOCAL VARIABLES ARE USED INSIDE INCLUDED FILE, DO NOT REMOVE THEM! $grav = $this->grav; $config = $this->config; $name = $this->current(); /** @var UniformResourceLocator $locator */ $locator = $grav['locator']; $file...
php
public function load() { // NOTE: ALL THE LOCAL VARIABLES ARE USED INSIDE INCLUDED FILE, DO NOT REMOVE THEM! $grav = $this->grav; $config = $this->config; $name = $this->current(); /** @var UniformResourceLocator $locator */ $locator = $grav['locator']; $file...
[ "public", "function", "load", "(", ")", "{", "// NOTE: ALL THE LOCAL VARIABLES ARE USED INSIDE INCLUDED FILE, DO NOT REMOVE THEM!", "$", "grav", "=", "$", "this", "->", "grav", ";", "$", "config", "=", "$", "this", "->", "config", ";", "$", "name", "=", "$", "th...
Load current theme. @return Theme
[ "Load", "current", "theme", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Themes.php#L174-L216
207,630
getgrav/grav
system/src/Grav/Common/Themes.php
Themes.configure
public function configure() { $name = $this->current(); $config = $this->config; $this->loadConfiguration($name, $config); /** @var UniformResourceLocator $locator */ $locator = $this->grav['locator']; $registered = stream_get_wrappers(); $schemes = $confi...
php
public function configure() { $name = $this->current(); $config = $this->config; $this->loadConfiguration($name, $config); /** @var UniformResourceLocator $locator */ $locator = $this->grav['locator']; $registered = stream_get_wrappers(); $schemes = $confi...
[ "public", "function", "configure", "(", ")", "{", "$", "name", "=", "$", "this", "->", "current", "(", ")", ";", "$", "config", "=", "$", "this", "->", "config", ";", "$", "this", "->", "loadConfiguration", "(", "$", "name", ",", "$", "config", ")"...
Configure and prepare streams for current template. @throws \InvalidArgumentException
[ "Configure", "and", "prepare", "streams", "for", "current", "template", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Themes.php#L223-L268
207,631
getgrav/grav
system/src/Grav/Common/Themes.php
Themes.loadConfiguration
protected function loadConfiguration($name, Config $config) { $themeConfig = CompiledYamlFile::instance("themes://{$name}/{$name}" . YAML_EXT)->content(); $config->joinDefaults("themes.{$name}", $themeConfig); }
php
protected function loadConfiguration($name, Config $config) { $themeConfig = CompiledYamlFile::instance("themes://{$name}/{$name}" . YAML_EXT)->content(); $config->joinDefaults("themes.{$name}", $themeConfig); }
[ "protected", "function", "loadConfiguration", "(", "$", "name", ",", "Config", "$", "config", ")", "{", "$", "themeConfig", "=", "CompiledYamlFile", "::", "instance", "(", "\"themes://{$name}/{$name}\"", ".", "YAML_EXT", ")", "->", "content", "(", ")", ";", "$...
Load theme configuration. @param string $name Theme name @param Config $config Configuration class
[ "Load", "theme", "configuration", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Themes.php#L276-L280
207,632
getgrav/grav
system/src/Grav/Common/Themes.php
Themes.loadLanguages
protected function loadLanguages(Config $config) { /** @var UniformResourceLocator $locator */ $locator = $this->grav['locator']; if ($config->get('system.languages.translations', true)) { $language_file = $locator->findResource('theme://languages' . YAML_EXT); if ($...
php
protected function loadLanguages(Config $config) { /** @var UniformResourceLocator $locator */ $locator = $this->grav['locator']; if ($config->get('system.languages.translations', true)) { $language_file = $locator->findResource('theme://languages' . YAML_EXT); if ($...
[ "protected", "function", "loadLanguages", "(", "Config", "$", "config", ")", "{", "/** @var UniformResourceLocator $locator */", "$", "locator", "=", "$", "this", "->", "grav", "[", "'locator'", "]", ";", "if", "(", "$", "config", "->", "get", "(", "'system.la...
Load theme languages. @param Config $config Configuration class
[ "Load", "theme", "languages", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Themes.php#L287-L313
207,633
getgrav/grav
system/src/Grav/Common/Themes.php
Themes.autoloadTheme
protected function autoloadTheme($class) { $prefix = 'Grav\\Theme\\'; if (false !== strpos($class, $prefix)) { // Remove prefix from class $class = substr($class, strlen($prefix)); $locator = $this->grav['locator']; // First try lowercase version of t...
php
protected function autoloadTheme($class) { $prefix = 'Grav\\Theme\\'; if (false !== strpos($class, $prefix)) { // Remove prefix from class $class = substr($class, strlen($prefix)); $locator = $this->grav['locator']; // First try lowercase version of t...
[ "protected", "function", "autoloadTheme", "(", "$", "class", ")", "{", "$", "prefix", "=", "'Grav\\\\Theme\\\\'", ";", "if", "(", "false", "!==", "strpos", "(", "$", "class", ",", "$", "prefix", ")", ")", "{", "// Remove prefix from class", "$", "class", "...
Autoload theme classes for inheritance @param string $class Class name @return mixed false FALSE if unable to load $class; Class name if $class is successfully loaded
[ "Autoload", "theme", "classes", "for", "inheritance" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Themes.php#L323-L359
207,634
getgrav/grav
system/src/Grav/Common/GPM/Licenses.php
Licenses.validate
public static function validate($license = null) { if (!is_string($license)) { return false; } return preg_match('#' . self::$regex. '#', $license); }
php
public static function validate($license = null) { if (!is_string($license)) { return false; } return preg_match('#' . self::$regex. '#', $license); }
[ "public", "static", "function", "validate", "(", "$", "license", "=", "null", ")", "{", "if", "(", "!", "is_string", "(", "$", "license", ")", ")", "{", "return", "false", ";", "}", "return", "preg_match", "(", "'#'", ".", "self", "::", "$", "regex",...
Validates the License format @param string $license @return bool
[ "Validates", "the", "License", "format" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/Licenses.php#L96-L103
207,635
getgrav/grav
system/src/Grav/Common/GPM/Licenses.php
Licenses.getLicenseFile
public static function getLicenseFile() { if (!isset(self::$file)) { $path = Grav::instance()['locator']->findResource('user-data://') . '/licenses.yaml'; if (!file_exists($path)) { touch($path); } self::$file = CompiledYamlFile::instance($pat...
php
public static function getLicenseFile() { if (!isset(self::$file)) { $path = Grav::instance()['locator']->findResource('user-data://') . '/licenses.yaml'; if (!file_exists($path)) { touch($path); } self::$file = CompiledYamlFile::instance($pat...
[ "public", "static", "function", "getLicenseFile", "(", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "file", ")", ")", "{", "$", "path", "=", "Grav", "::", "instance", "(", ")", "[", "'locator'", "]", "->", "findResource", "(", "'user-da...
Get's the License File object @return \RocketTheme\Toolbox\File\FileInterface
[ "Get", "s", "the", "License", "File", "object" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/Licenses.php#L110-L122
207,636
getgrav/grav
system/src/Grav/Common/Composer.php
Composer.getComposerLocation
public static function getComposerLocation() { if (!\function_exists('shell_exec') || stripos(PHP_OS, 'win') === 0) { return self::DEFAULT_PATH; } // check for global composer install $path = trim(shell_exec('command -v composer')); // fall back to grav bundled ...
php
public static function getComposerLocation() { if (!\function_exists('shell_exec') || stripos(PHP_OS, 'win') === 0) { return self::DEFAULT_PATH; } // check for global composer install $path = trim(shell_exec('command -v composer')); // fall back to grav bundled ...
[ "public", "static", "function", "getComposerLocation", "(", ")", "{", "if", "(", "!", "\\", "function_exists", "(", "'shell_exec'", ")", "||", "stripos", "(", "PHP_OS", ",", "'win'", ")", "===", "0", ")", "{", "return", "self", "::", "DEFAULT_PATH", ";", ...
Returns the location of composer. @return string
[ "Returns", "the", "location", "of", "composer", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Composer.php#L22-L37
207,637
getgrav/grav
system/src/Grav/Common/Composer.php
Composer.getComposerExecutor
public static function getComposerExecutor() { $executor = PHP_BINARY . ' '; $composer = static::getComposerLocation(); if ($composer !== static::DEFAULT_PATH && is_executable($composer)) { $file = fopen($composer, 'rb'); $firstLine = fgets($file); fclose...
php
public static function getComposerExecutor() { $executor = PHP_BINARY . ' '; $composer = static::getComposerLocation(); if ($composer !== static::DEFAULT_PATH && is_executable($composer)) { $file = fopen($composer, 'rb'); $firstLine = fgets($file); fclose...
[ "public", "static", "function", "getComposerExecutor", "(", ")", "{", "$", "executor", "=", "PHP_BINARY", ".", "' '", ";", "$", "composer", "=", "static", "::", "getComposerLocation", "(", ")", ";", "if", "(", "$", "composer", "!==", "static", "::", "DEFAU...
Return the composer executable file path @return string
[ "Return", "the", "composer", "executable", "file", "path" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Composer.php#L44-L60
207,638
getgrav/grav
system/src/Grav/Common/Grav.php
Grav.instance
public static function instance(array $values = []) { if (!self::$instance) { self::$instance = static::load($values); } elseif ($values) { $instance = self::$instance; foreach ($values as $key => $value) { $instance->offsetSet($key, $value); ...
php
public static function instance(array $values = []) { if (!self::$instance) { self::$instance = static::load($values); } elseif ($values) { $instance = self::$instance; foreach ($values as $key => $value) { $instance->offsetSet($key, $value); ...
[ "public", "static", "function", "instance", "(", "array", "$", "values", "=", "[", "]", ")", "{", "if", "(", "!", "self", "::", "$", "instance", ")", "{", "self", "::", "$", "instance", "=", "static", "::", "load", "(", "$", "values", ")", ";", "...
Return the Grav instance. Create it if it's not already instanced @param array $values @return Grav
[ "Return", "the", "Grav", "instance", ".", "Create", "it", "if", "it", "s", "not", "already", "instanced" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Grav.php#L130-L142
207,639
getgrav/grav
system/src/Grav/Common/Grav.php
Grav.setup
public function setup(string $environment = null) { if (isset($this->initialized['setup'])) { return $this; } $this->initialized['setup'] = true; $this->measureTime('_setup', 'Site Setup', function () use ($environment) { // Force environment if passed to th...
php
public function setup(string $environment = null) { if (isset($this->initialized['setup'])) { return $this; } $this->initialized['setup'] = true; $this->measureTime('_setup', 'Site Setup', function () use ($environment) { // Force environment if passed to th...
[ "public", "function", "setup", "(", "string", "$", "environment", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "initialized", "[", "'setup'", "]", ")", ")", "{", "return", "$", "this", ";", "}", "$", "this", "->", "initialized",...
Setup Grav instance using specific environment. Initializes Grav streams by @param string|null $environment @return $this
[ "Setup", "Grav", "instance", "using", "specific", "environment", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Grav.php#L152-L171
207,640
getgrav/grav
system/src/Grav/Common/Grav.php
Grav.setLocale
public function setLocale() { // Initialize Locale if set and configured. if ($this['language']->enabled() && $this['config']->get('system.languages.override_locale')) { $language = $this['language']->getLanguage(); setlocale(LC_ALL, \strlen($language) < 3 ? ($language . '_' ...
php
public function setLocale() { // Initialize Locale if set and configured. if ($this['language']->enabled() && $this['config']->get('system.languages.override_locale')) { $language = $this['language']->getLanguage(); setlocale(LC_ALL, \strlen($language) < 3 ? ($language . '_' ...
[ "public", "function", "setLocale", "(", ")", "{", "// Initialize Locale if set and configured.", "if", "(", "$", "this", "[", "'language'", "]", "->", "enabled", "(", ")", "&&", "$", "this", "[", "'config'", "]", "->", "get", "(", "'system.languages.override_loc...
Set the system locale based on the language and configuration
[ "Set", "the", "system", "locale", "based", "on", "the", "language", "and", "configuration" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Grav.php#L262-L271
207,641
getgrav/grav
system/src/Grav/Common/Grav.php
Grav.redirect
public function redirect($route, $code = null) { /** @var Uri $uri */ $uri = $this['uri']; //Check for code in route $regex = '/.*(\[(30[1-7])\])$/'; preg_match($regex, $route, $matches); if ($matches) { $route = str_replace($matches[1], '', $matches[0]);...
php
public function redirect($route, $code = null) { /** @var Uri $uri */ $uri = $this['uri']; //Check for code in route $regex = '/.*(\[(30[1-7])\])$/'; preg_match($regex, $route, $matches); if ($matches) { $route = str_replace($matches[1], '', $matches[0]);...
[ "public", "function", "redirect", "(", "$", "route", ",", "$", "code", "=", "null", ")", "{", "/** @var Uri $uri */", "$", "uri", "=", "$", "this", "[", "'uri'", "]", ";", "//Check for code in route", "$", "regex", "=", "'/.*(\\[(30[1-7])\\])$/'", ";", "preg...
Redirect browser to another location. @param string $route Internal route. @param int $code Redirection code (30x)
[ "Redirect", "browser", "to", "another", "location", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Grav.php#L279-L314
207,642
getgrav/grav
system/src/Grav/Common/Grav.php
Grav.fireEvent
public function fireEvent($eventName, Event $event = null) { /** @var EventDispatcher $events */ $events = $this['events']; return $events->dispatch($eventName, $event); }
php
public function fireEvent($eventName, Event $event = null) { /** @var EventDispatcher $events */ $events = $this['events']; return $events->dispatch($eventName, $event); }
[ "public", "function", "fireEvent", "(", "$", "eventName", ",", "Event", "$", "event", "=", "null", ")", "{", "/** @var EventDispatcher $events */", "$", "events", "=", "$", "this", "[", "'events'", "]", ";", "return", "$", "events", "->", "dispatch", "(", ...
Fires an event with optional parameters. @param string $eventName @param Event $event @return Event
[ "Fires", "an", "event", "with", "optional", "parameters", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Grav.php#L360-L366
207,643
getgrav/grav
system/src/Grav/Common/Grav.php
Grav.shutdown
public function shutdown() { // Prevent user abort allowing onShutdown event to run without interruptions. if (\function_exists('ignore_user_abort')) { @ignore_user_abort(true); } // Close the session allowing new requests to be handled. if (isset($this['session'...
php
public function shutdown() { // Prevent user abort allowing onShutdown event to run without interruptions. if (\function_exists('ignore_user_abort')) { @ignore_user_abort(true); } // Close the session allowing new requests to be handled. if (isset($this['session'...
[ "public", "function", "shutdown", "(", ")", "{", "// Prevent user abort allowing onShutdown event to run without interruptions.", "if", "(", "\\", "function_exists", "(", "'ignore_user_abort'", ")", ")", "{", "@", "ignore_user_abort", "(", "true", ")", ";", "}", "// Clo...
Set the final content length for the page and flush the buffer
[ "Set", "the", "final", "content", "length", "for", "the", "page", "and", "flush", "the", "buffer" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Grav.php#L372-L422
207,644
getgrav/grav
system/src/Grav/Common/Grav.php
Grav.measureTime
public function measureTime(string $timerId, string $timerTitle, callable $callback) { $debugger = $this['debugger']; $debugger->startTimer($timerId, $timerTitle); $result = $callback(); $debugger->stopTimer($timerId); return $result; }
php
public function measureTime(string $timerId, string $timerTitle, callable $callback) { $debugger = $this['debugger']; $debugger->startTimer($timerId, $timerTitle); $result = $callback(); $debugger->stopTimer($timerId); return $result; }
[ "public", "function", "measureTime", "(", "string", "$", "timerId", ",", "string", "$", "timerTitle", ",", "callable", "$", "callback", ")", "{", "$", "debugger", "=", "$", "this", "[", "'debugger'", "]", ";", "$", "debugger", "->", "startTimer", "(", "$...
Measure how long it takes to do an action. @param string $timerId @param string $timerTitle @param callable $callback @return mixed Returns value returned by the callable.
[ "Measure", "how", "long", "it", "takes", "to", "do", "an", "action", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Grav.php#L445-L453
207,645
getgrav/grav
system/src/Grav/Common/Grav.php
Grav.load
protected static function load(array $values) { $container = new static($values); $container['debugger'] = new Debugger(); $container['grav'] = function (Container $container) { user_error('Calling $grav[\'grav\'] or {{ grav.grav }} is deprecated since Grav 1.6, just use $grav o...
php
protected static function load(array $values) { $container = new static($values); $container['debugger'] = new Debugger(); $container['grav'] = function (Container $container) { user_error('Calling $grav[\'grav\'] or {{ grav.grav }} is deprecated since Grav 1.6, just use $grav o...
[ "protected", "static", "function", "load", "(", "array", "$", "values", ")", "{", "$", "container", "=", "new", "static", "(", "$", "values", ")", ";", "$", "container", "[", "'debugger'", "]", "=", "new", "Debugger", "(", ")", ";", "$", "container", ...
Initialize and return a Grav instance @param array $values @return static
[ "Initialize", "and", "return", "a", "Grav", "instance" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Grav.php#L462-L478
207,646
getgrav/grav
system/src/Grav/Common/Grav.php
Grav.registerServices
protected function registerServices() { foreach (self::$diMap as $serviceKey => $serviceClass) { if (\is_int($serviceKey)) { $this->register(new $serviceClass); } else { $this[$serviceKey] = function ($c) use ($serviceClass) { retur...
php
protected function registerServices() { foreach (self::$diMap as $serviceKey => $serviceClass) { if (\is_int($serviceKey)) { $this->register(new $serviceClass); } else { $this[$serviceKey] = function ($c) use ($serviceClass) { retur...
[ "protected", "function", "registerServices", "(", ")", "{", "foreach", "(", "self", "::", "$", "diMap", "as", "$", "serviceKey", "=>", "$", "serviceClass", ")", "{", "if", "(", "\\", "is_int", "(", "$", "serviceKey", ")", ")", "{", "$", "this", "->", ...
Register all services Services are defined in the diMap. They can either only the class of a Service Provider or a pair of serviceKey => serviceClass that gets directly mapped into the container. @return void
[ "Register", "all", "services", "Services", "are", "defined", "in", "the", "diMap", ".", "They", "can", "either", "only", "the", "class", "of", "a", "Service", "Provider", "or", "a", "pair", "of", "serviceKey", "=", ">", "serviceClass", "that", "gets", "dir...
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Grav.php#L488-L499
207,647
getgrav/grav
system/src/Grav/Common/Grav.php
Grav.fallbackUrl
public function fallbackUrl($path) { $this->fireEvent('onPageFallBackUrl'); /** @var Uri $uri */ $uri = $this['uri']; /** @var Config $config */ $config = $this['config']; $uri_extension = strtolower($uri->extension()); $fallback_types = $config->get('syste...
php
public function fallbackUrl($path) { $this->fireEvent('onPageFallBackUrl'); /** @var Uri $uri */ $uri = $this['uri']; /** @var Config $config */ $config = $this['config']; $uri_extension = strtolower($uri->extension()); $fallback_types = $config->get('syste...
[ "public", "function", "fallbackUrl", "(", "$", "path", ")", "{", "$", "this", "->", "fireEvent", "(", "'onPageFallBackUrl'", ")", ";", "/** @var Uri $uri */", "$", "uri", "=", "$", "this", "[", "'uri'", "]", ";", "/** @var Config $config */", "$", "config", ...
This attempts to find media, other files, and download them @param string $path
[ "This", "attempts", "to", "find", "media", "other", "files", "and", "download", "them" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Grav.php#L506-L574
207,648
getgrav/grav
system/src/Grav/Common/Config/CompiledConfig.php
CompiledConfig.createObject
protected function createObject(array $data = []) { if ($this->withDefaults && empty($data) && \is_callable($this->callable)) { $blueprints = $this->callable; $data = $blueprints()->getDefaults(); } $this->object = new Config($data, $this->callable); }
php
protected function createObject(array $data = []) { if ($this->withDefaults && empty($data) && \is_callable($this->callable)) { $blueprints = $this->callable; $data = $blueprints()->getDefaults(); } $this->object = new Config($data, $this->callable); }
[ "protected", "function", "createObject", "(", "array", "$", "data", "=", "[", "]", ")", "{", "if", "(", "$", "this", "->", "withDefaults", "&&", "empty", "(", "$", "data", ")", "&&", "\\", "is_callable", "(", "$", "this", "->", "callable", ")", ")", ...
Create configuration object. @param array $data
[ "Create", "configuration", "object", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Config/CompiledConfig.php#L62-L70
207,649
getgrav/grav
system/src/Grav/Common/Config/CompiledConfig.php
CompiledConfig.finalizeObject
protected function finalizeObject() { $this->object->checksum($this->checksum()); $this->object->timestamp($this->timestamp()); }
php
protected function finalizeObject() { $this->object->checksum($this->checksum()); $this->object->timestamp($this->timestamp()); }
[ "protected", "function", "finalizeObject", "(", ")", "{", "$", "this", "->", "object", "->", "checksum", "(", "$", "this", "->", "checksum", "(", ")", ")", ";", "$", "this", "->", "object", "->", "timestamp", "(", "$", "this", "->", "timestamp", "(", ...
Finalize configuration object.
[ "Finalize", "configuration", "object", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Config/CompiledConfig.php#L75-L79
207,650
getgrav/grav
system/src/Grav/Common/Session.php
Session.init
public function init() { if ($this->autoStart && !$this->isStarted()) { $this->start(); $this->autoStart = false; } }
php
public function init() { if ($this->autoStart && !$this->isStarted()) { $this->start(); $this->autoStart = false; } }
[ "public", "function", "init", "(", ")", "{", "if", "(", "$", "this", "->", "autoStart", "&&", "!", "$", "this", "->", "isStarted", "(", ")", ")", "{", "$", "this", "->", "start", "(", ")", ";", "$", "this", "->", "autoStart", "=", "false", ";", ...
Initialize session. Code in this function has been moved into SessionServiceProvider class.
[ "Initialize", "session", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Session.php#L35-L42
207,651
getgrav/grav
system/src/Grav/Common/Session.php
Session.getFlashObject
public function getFlashObject($name) { $serialized = $this->__get($name); $object = \is_string($serialized) ? unserialize($serialized, ['allowed_classes' => true]) : $serialized; $this->__unset($name); if ($name === 'files-upload') { $grav = Grav::instance(); ...
php
public function getFlashObject($name) { $serialized = $this->__get($name); $object = \is_string($serialized) ? unserialize($serialized, ['allowed_classes' => true]) : $serialized; $this->__unset($name); if ($name === 'files-upload') { $grav = Grav::instance(); ...
[ "public", "function", "getFlashObject", "(", "$", "name", ")", "{", "$", "serialized", "=", "$", "this", "->", "__get", "(", "$", "name", ")", ";", "$", "object", "=", "\\", "is_string", "(", "$", "serialized", ")", "?", "unserialize", "(", "$", "ser...
Return object and remove it from session. @param string $name @return mixed
[ "Return", "object", "and", "remove", "it", "from", "session", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Session.php#L101-L133
207,652
getgrav/grav
system/src/Grav/Common/Session.php
Session.setFlashCookieObject
public function setFlashCookieObject($name, $object, $time = 60) { setcookie($name, json_encode($object), time() + $time, '/'); return $this; }
php
public function setFlashCookieObject($name, $object, $time = 60) { setcookie($name, json_encode($object), time() + $time, '/'); return $this; }
[ "public", "function", "setFlashCookieObject", "(", "$", "name", ",", "$", "object", ",", "$", "time", "=", "60", ")", "{", "setcookie", "(", "$", "name", ",", "json_encode", "(", "$", "object", ")", ",", "time", "(", ")", "+", "$", "time", ",", "'/...
Store something in cookie temporarily. @param string $name @param mixed $object @param int $time @return $this
[ "Store", "something", "in", "cookie", "temporarily", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Session.php#L143-L148
207,653
getgrav/grav
system/src/Grav/Common/Session.php
Session.getFlashCookieObject
public function getFlashCookieObject($name) { if (isset($_COOKIE[$name])) { $object = json_decode($_COOKIE[$name]); setcookie($name, '', time() - 3600, '/'); return $object; } return null; }
php
public function getFlashCookieObject($name) { if (isset($_COOKIE[$name])) { $object = json_decode($_COOKIE[$name]); setcookie($name, '', time() - 3600, '/'); return $object; } return null; }
[ "public", "function", "getFlashCookieObject", "(", "$", "name", ")", "{", "if", "(", "isset", "(", "$", "_COOKIE", "[", "$", "name", "]", ")", ")", "{", "$", "object", "=", "json_decode", "(", "$", "_COOKIE", "[", "$", "name", "]", ")", ";", "setco...
Return object and remove it from the cookie. @param string $name @return mixed|null
[ "Return", "object", "and", "remove", "it", "from", "the", "cookie", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Session.php#L156-L165
207,654
getgrav/grav
system/src/Grav/Common/Assets.php
Assets.init
public function init() { $grav = Grav::instance(); /** @var Config $config */ $config = $grav['config']; $asset_config = (array)$config->get('system.assets'); /** @var UniformResourceLocator $locator */ $locator = $grav['locator']; $this->assets_dir = $locat...
php
public function init() { $grav = Grav::instance(); /** @var Config $config */ $config = $grav['config']; $asset_config = (array)$config->get('system.assets'); /** @var UniformResourceLocator $locator */ $locator = $grav['locator']; $this->assets_dir = $locat...
[ "public", "function", "init", "(", ")", "{", "$", "grav", "=", "Grav", "::", "instance", "(", ")", ";", "/** @var Config $config */", "$", "config", "=", "$", "grav", "[", "'config'", "]", ";", "$", "asset_config", "=", "(", "array", ")", "$", "config"...
Initialization called in the Grav lifecycle to initialize the Assets with appropriate configuration
[ "Initialization", "called", "in", "the", "Grav", "lifecycle", "to", "initialize", "the", "Assets", "with", "appropriate", "configuration" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Assets.php#L66-L85
207,655
getgrav/grav
system/src/Grav/Common/Assets.php
Assets.addCss
public function addCss($asset) { return $this->addType(Assets::CSS_COLLECTION,Assets::CSS_TYPE, $asset, $this->unifyLegacyArguments(\func_get_args(), Assets::CSS_TYPE)); }
php
public function addCss($asset) { return $this->addType(Assets::CSS_COLLECTION,Assets::CSS_TYPE, $asset, $this->unifyLegacyArguments(\func_get_args(), Assets::CSS_TYPE)); }
[ "public", "function", "addCss", "(", "$", "asset", ")", "{", "return", "$", "this", "->", "addType", "(", "Assets", "::", "CSS_COLLECTION", ",", "Assets", "::", "CSS_TYPE", ",", "$", "asset", ",", "$", "this", "->", "unifyLegacyArguments", "(", "\\", "fu...
Add a CSS asset or a collection of assets. @return $this
[ "Add", "a", "CSS", "asset", "or", "a", "collection", "of", "assets", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Assets.php#L213-L216
207,656
getgrav/grav
system/src/Grav/Common/Assets.php
Assets.addInlineCss
public function addInlineCss($asset) { return $this->addType(Assets::CSS_COLLECTION, Assets::INLINE_CSS_TYPE, $asset, $this->unifyLegacyArguments(\func_get_args(), Assets::INLINE_CSS_TYPE)); }
php
public function addInlineCss($asset) { return $this->addType(Assets::CSS_COLLECTION, Assets::INLINE_CSS_TYPE, $asset, $this->unifyLegacyArguments(\func_get_args(), Assets::INLINE_CSS_TYPE)); }
[ "public", "function", "addInlineCss", "(", "$", "asset", ")", "{", "return", "$", "this", "->", "addType", "(", "Assets", "::", "CSS_COLLECTION", ",", "Assets", "::", "INLINE_CSS_TYPE", ",", "$", "asset", ",", "$", "this", "->", "unifyLegacyArguments", "(", ...
Add an Inline CSS asset or a collection of assets. @return $this
[ "Add", "an", "Inline", "CSS", "asset", "or", "a", "collection", "of", "assets", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Assets.php#L223-L226
207,657
getgrav/grav
system/src/Grav/Common/Assets.php
Assets.addJs
public function addJs($asset) { return $this->addType(Assets::JS_COLLECTION, Assets::JS_TYPE, $asset, $this->unifyLegacyArguments(\func_get_args(), Assets::JS_TYPE)); }
php
public function addJs($asset) { return $this->addType(Assets::JS_COLLECTION, Assets::JS_TYPE, $asset, $this->unifyLegacyArguments(\func_get_args(), Assets::JS_TYPE)); }
[ "public", "function", "addJs", "(", "$", "asset", ")", "{", "return", "$", "this", "->", "addType", "(", "Assets", "::", "JS_COLLECTION", ",", "Assets", "::", "JS_TYPE", ",", "$", "asset", ",", "$", "this", "->", "unifyLegacyArguments", "(", "\\", "func_...
Add a JS asset or a collection of assets. @return $this
[ "Add", "a", "JS", "asset", "or", "a", "collection", "of", "assets", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Assets.php#L233-L236
207,658
getgrav/grav
system/src/Grav/Common/Assets.php
Assets.addInlineJs
public function addInlineJs($asset) { return $this->addType(Assets::JS_COLLECTION, Assets::INLINE_JS_TYPE, $asset, $this->unifyLegacyArguments(\func_get_args(), Assets::INLINE_JS_TYPE)); }
php
public function addInlineJs($asset) { return $this->addType(Assets::JS_COLLECTION, Assets::INLINE_JS_TYPE, $asset, $this->unifyLegacyArguments(\func_get_args(), Assets::INLINE_JS_TYPE)); }
[ "public", "function", "addInlineJs", "(", "$", "asset", ")", "{", "return", "$", "this", "->", "addType", "(", "Assets", "::", "JS_COLLECTION", ",", "Assets", "::", "INLINE_JS_TYPE", ",", "$", "asset", ",", "$", "this", "->", "unifyLegacyArguments", "(", "...
Add an Inline JS asset or a collection of assets. @return $this
[ "Add", "an", "Inline", "JS", "asset", "or", "a", "collection", "of", "assets", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Assets.php#L243-L246
207,659
getgrav/grav
system/src/Grav/Framework/Form/Traits/FormTrait.php
FormTrait.getFlash
public function getFlash(): FormFlash { if (null === $this->flash) { /** @var Grav $grav */ $grav = Grav::instance(); $id = null; $user = $grav['user'] ?? null; if (isset($user)) { $rememberState = $this->getBlueprint()->get('form/...
php
public function getFlash(): FormFlash { if (null === $this->flash) { /** @var Grav $grav */ $grav = Grav::instance(); $id = null; $user = $grav['user'] ?? null; if (isset($user)) { $rememberState = $this->getBlueprint()->get('form/...
[ "public", "function", "getFlash", "(", ")", ":", "FormFlash", "{", "if", "(", "null", "===", "$", "this", "->", "flash", ")", "{", "/** @var Grav $grav */", "$", "grav", "=", "Grav", "::", "instance", "(", ")", ";", "$", "id", "=", "null", ";", "$", ...
Get form flash object. @return FormFlash
[ "Get", "form", "flash", "object", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Form/Traits/FormTrait.php#L336-L366
207,660
getgrav/grav
system/src/Grav/Framework/Form/Traits/FormTrait.php
FormTrait.parseRequest
protected function parseRequest(ServerRequestInterface $request): array { $method = $request->getMethod(); if (!\in_array($method, ['PUT', 'POST', 'PATCH'])) { throw new \RuntimeException(sprintf('FlexForm: Bad HTTP method %s', $method)); } $body = $request->getParsedBod...
php
protected function parseRequest(ServerRequestInterface $request): array { $method = $request->getMethod(); if (!\in_array($method, ['PUT', 'POST', 'PATCH'])) { throw new \RuntimeException(sprintf('FlexForm: Bad HTTP method %s', $method)); } $body = $request->getParsedBod...
[ "protected", "function", "parseRequest", "(", "ServerRequestInterface", "$", "request", ")", ":", "array", "{", "$", "method", "=", "$", "request", "->", "getMethod", "(", ")", ";", "if", "(", "!", "\\", "in_array", "(", "$", "method", ",", "[", "'PUT'",...
Parse PSR-7 ServerRequest into data and files. @param ServerRequestInterface $request @return array
[ "Parse", "PSR", "-", "7", "ServerRequest", "into", "data", "and", "files", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Form/Traits/FormTrait.php#L446-L474
207,661
getgrav/grav
system/src/Grav/Framework/Form/Traits/FormTrait.php
FormTrait.validateUploads
protected function validateUploads(array $files): void { foreach ($files as $file) { if (null === $file) { continue; } if ($file instanceof UploadedFileInterface) { $this->validateUpload($file); } else { $this->v...
php
protected function validateUploads(array $files): void { foreach ($files as $file) { if (null === $file) { continue; } if ($file instanceof UploadedFileInterface) { $this->validateUpload($file); } else { $this->v...
[ "protected", "function", "validateUploads", "(", "array", "$", "files", ")", ":", "void", "{", "foreach", "(", "$", "files", "as", "$", "file", ")", "{", "if", "(", "null", "===", "$", "file", ")", "{", "continue", ";", "}", "if", "(", "$", "file",...
Validate all uploaded files. @param array $files
[ "Validate", "all", "uploaded", "files", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Form/Traits/FormTrait.php#L516-L528
207,662
getgrav/grav
system/src/Grav/Framework/Form/Traits/FormTrait.php
FormTrait.validateUpload
protected function validateUpload(UploadedFileInterface $file): void { // Handle bad filenames. $filename = $file->getClientFilename(); if (!Utils::checkFilename($filename)) { $grav = Grav::instance(); throw new \RuntimeException( sprintf($grav['langu...
php
protected function validateUpload(UploadedFileInterface $file): void { // Handle bad filenames. $filename = $file->getClientFilename(); if (!Utils::checkFilename($filename)) { $grav = Grav::instance(); throw new \RuntimeException( sprintf($grav['langu...
[ "protected", "function", "validateUpload", "(", "UploadedFileInterface", "$", "file", ")", ":", "void", "{", "// Handle bad filenames.", "$", "filename", "=", "$", "file", "->", "getClientFilename", "(", ")", ";", "if", "(", "!", "Utils", "::", "checkFilename", ...
Validate uploaded file. @param UploadedFileInterface $file
[ "Validate", "uploaded", "file", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Form/Traits/FormTrait.php#L535-L546
207,663
getgrav/grav
system/src/Grav/Framework/Form/Traits/FormTrait.php
FormTrait.decodeData
protected function decodeData($data): array { if (!\is_array($data)) { return []; } // Decode JSON encoded fields and merge them to data. if (isset($data['_json'])) { $data = array_replace_recursive($data, $this->jsonDecode($data['_json'])); unset...
php
protected function decodeData($data): array { if (!\is_array($data)) { return []; } // Decode JSON encoded fields and merge them to data. if (isset($data['_json'])) { $data = array_replace_recursive($data, $this->jsonDecode($data['_json'])); unset...
[ "protected", "function", "decodeData", "(", "$", "data", ")", ":", "array", "{", "if", "(", "!", "\\", "is_array", "(", "$", "data", ")", ")", "{", "return", "[", "]", ";", "}", "// Decode JSON encoded fields and merge them to data.", "if", "(", "isset", "...
Decode POST data @param array $data @return array
[ "Decode", "POST", "data" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Form/Traits/FormTrait.php#L554-L567
207,664
getgrav/grav
system/src/Grav/Framework/Form/Traits/FormTrait.php
FormTrait.jsonDecode
protected function jsonDecode(array $data): array { foreach ($data as $key => &$value) { if (\is_array($value)) { $value = $this->jsonDecode($value); } elseif ($value === '') { unset($data[$key]); } else { $value = json_deco...
php
protected function jsonDecode(array $data): array { foreach ($data as $key => &$value) { if (\is_array($value)) { $value = $this->jsonDecode($value); } elseif ($value === '') { unset($data[$key]); } else { $value = json_deco...
[ "protected", "function", "jsonDecode", "(", "array", "$", "data", ")", ":", "array", "{", "foreach", "(", "$", "data", "as", "$", "key", "=>", "&", "$", "value", ")", "{", "if", "(", "\\", "is_array", "(", "$", "value", ")", ")", "{", "$", "value...
Recursively JSON decode POST data. @param array $data @return array
[ "Recursively", "JSON", "decode", "POST", "data", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Form/Traits/FormTrait.php#L575-L592
207,665
getgrav/grav
system/src/Grav/Common/Theme.php
Theme.saveConfig
public static function saveConfig($theme_name) { if (!$theme_name) { return false; } $grav = Grav::instance(); $locator = $grav['locator']; $filename = 'config://themes/' . $theme_name . '.yaml'; $file = YamlFile::instance($locator->findResource($filename...
php
public static function saveConfig($theme_name) { if (!$theme_name) { return false; } $grav = Grav::instance(); $locator = $grav['locator']; $filename = 'config://themes/' . $theme_name . '.yaml'; $file = YamlFile::instance($locator->findResource($filename...
[ "public", "static", "function", "saveConfig", "(", "$", "theme_name", ")", "{", "if", "(", "!", "$", "theme_name", ")", "{", "return", "false", ";", "}", "$", "grav", "=", "Grav", "::", "instance", "(", ")", ";", "$", "locator", "=", "$", "grav", "...
Persists to disk the theme parameters currently stored in the Grav Config object @param string $theme_name The name of the theme whose config it should store. @return true
[ "Persists", "to", "disk", "the", "theme", "parameters", "currently", "stored", "in", "the", "Grav", "Config", "object" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Theme.php#L47-L62
207,666
getgrav/grav
system/src/Grav/Common/Theme.php
Theme.mergeConfig
protected function mergeConfig(PageInterface $page, $deep = 'merge', $params = [], $type = 'themes') { return parent::mergeConfig($page, $deep, $params, $type); }
php
protected function mergeConfig(PageInterface $page, $deep = 'merge', $params = [], $type = 'themes') { return parent::mergeConfig($page, $deep, $params, $type); }
[ "protected", "function", "mergeConfig", "(", "PageInterface", "$", "page", ",", "$", "deep", "=", "'merge'", ",", "$", "params", "=", "[", "]", ",", "$", "type", "=", "'themes'", ")", "{", "return", "parent", "::", "mergeConfig", "(", "$", "page", ",",...
Override the mergeConfig method to work for themes
[ "Override", "the", "mergeConfig", "method", "to", "work", "for", "themes" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Theme.php#L67-L70
207,667
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.init
public function init(\SplFileInfo $file, $extension = null) { $config = Grav::instance()['config']; // some extension logic if (empty($extension)) { $this->extension('.' . $file->getExtension()); } else { $this->extension($extension); } // ex...
php
public function init(\SplFileInfo $file, $extension = null) { $config = Grav::instance()['config']; // some extension logic if (empty($extension)) { $this->extension('.' . $file->getExtension()); } else { $this->extension($extension); } // ex...
[ "public", "function", "init", "(", "\\", "SplFileInfo", "$", "file", ",", "$", "extension", "=", "null", ")", "{", "$", "config", "=", "Grav", "::", "instance", "(", ")", "[", "'config'", "]", ";", "// some extension logic", "if", "(", "empty", "(", "$...
Initializes the page instance variables based on a file @param \SplFileInfo $file The file information for the .md file that the page represents @param string $extension @return $this
[ "Initializes", "the", "page", "instance", "variables", "based", "on", "a", "file" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L130-L163
207,668
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.translatedLanguages
public function translatedLanguages($onlyPublished = false) { $filename = substr($this->name, 0, -(strlen($this->extension()))); $config = Grav::instance()['config']; $languages = $config->get('system.languages.supported', []); $translatedLanguages = []; foreach ($languages ...
php
public function translatedLanguages($onlyPublished = false) { $filename = substr($this->name, 0, -(strlen($this->extension()))); $config = Grav::instance()['config']; $languages = $config->get('system.languages.supported', []); $translatedLanguages = []; foreach ($languages ...
[ "public", "function", "translatedLanguages", "(", "$", "onlyPublished", "=", "false", ")", "{", "$", "filename", "=", "substr", "(", "$", "this", "->", "name", ",", "0", ",", "-", "(", "strlen", "(", "$", "this", "->", "extension", "(", ")", ")", ")"...
Return an array with the routes of other translated languages @param bool $onlyPublished only return published translations @return array the page translated languages
[ "Return", "an", "array", "with", "the", "routes", "of", "other", "translated", "languages" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L189-L216
207,669
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.untranslatedLanguages
public function untranslatedLanguages($includeUnpublished = false) { $filename = substr($this->name, 0, -strlen($this->extension())); $config = Grav::instance()['config']; $languages = $config->get('system.languages.supported', []); $untranslatedLanguages = []; foreach ($lan...
php
public function untranslatedLanguages($includeUnpublished = false) { $filename = substr($this->name, 0, -strlen($this->extension())); $config = Grav::instance()['config']; $languages = $config->get('system.languages.supported', []); $untranslatedLanguages = []; foreach ($lan...
[ "public", "function", "untranslatedLanguages", "(", "$", "includeUnpublished", "=", "false", ")", "{", "$", "filename", "=", "substr", "(", "$", "this", "->", "name", ",", "0", ",", "-", "strlen", "(", "$", "this", "->", "extension", "(", ")", ")", ")"...
Return an array listing untranslated languages available @param bool $includeUnpublished also list unpublished translations @return array the page untranslated languages
[ "Return", "an", "array", "listing", "untranslated", "languages", "available" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L225-L246
207,670
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.raw
public function raw($var = null) { $file = $this->file(); if ($var) { // First update file object. if ($file) { $file->raw($var); } // Reset header and content. $this->modified = time(); $this->id($this->modifi...
php
public function raw($var = null) { $file = $this->file(); if ($var) { // First update file object. if ($file) { $file->raw($var); } // Reset header and content. $this->modified = time(); $this->id($this->modifi...
[ "public", "function", "raw", "(", "$", "var", "=", "null", ")", "{", "$", "file", "=", "$", "this", "->", "file", "(", ")", ";", "if", "(", "$", "var", ")", "{", "// First update file object.", "if", "(", "$", "file", ")", "{", "$", "file", "->",...
Gets and Sets the raw data @param string $var Raw content string @return string Raw content string
[ "Gets", "and", "Sets", "the", "raw", "data" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L255-L274
207,671
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.frontmatter
public function frontmatter($var = null) { if ($var) { $this->frontmatter = (string)$var; // Update also file object. $file = $this->file(); if ($file) { $file->frontmatter((string)$var); } // Force content re-process...
php
public function frontmatter($var = null) { if ($var) { $this->frontmatter = (string)$var; // Update also file object. $file = $this->file(); if ($file) { $file->frontmatter((string)$var); } // Force content re-process...
[ "public", "function", "frontmatter", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", ")", "{", "$", "this", "->", "frontmatter", "=", "(", "string", ")", "$", "var", ";", "// Update also file object.", "$", "file", "=", "$", "this", "-...
Gets and Sets the page frontmatter @param string|null $var @return string
[ "Gets", "and", "Sets", "the", "page", "frontmatter" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L283-L303
207,672
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.summary
public function summary($size = null, $textOnly = false) { $config = (array)Grav::instance()['config']->get('site.summary'); if (isset($this->header->summary)) { $config = array_merge($config, $this->header->summary); } // Return summary based on settings in site config ...
php
public function summary($size = null, $textOnly = false) { $config = (array)Grav::instance()['config']->get('site.summary'); if (isset($this->header->summary)) { $config = array_merge($config, $this->header->summary); } // Return summary based on settings in site config ...
[ "public", "function", "summary", "(", "$", "size", "=", "null", ",", "$", "textOnly", "=", "false", ")", "{", "$", "config", "=", "(", "array", ")", "Grav", "::", "instance", "(", ")", "[", "'config'", "]", "->", "get", "(", "'site.summary'", ")", ...
Get the summary. @param int $size Max summary size. @param bool $textOnly Only count text size. @return string
[ "Get", "the", "summary", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L554-L617
207,673
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.getContentMeta
public function getContentMeta($name = null) { if ($name) { if (isset($this->content_meta[$name])) { return $this->content_meta[$name]; } return null; } return $this->content_meta; }
php
public function getContentMeta($name = null) { if ($name) { if (isset($this->content_meta[$name])) { return $this->content_meta[$name]; } return null; } return $this->content_meta; }
[ "public", "function", "getContentMeta", "(", "$", "name", "=", "null", ")", "{", "if", "(", "$", "name", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "content_meta", "[", "$", "name", "]", ")", ")", "{", "return", "$", "this", "->", "con...
Return the whole contentMeta array as it currently stands @param string|null $name @return string
[ "Return", "the", "whole", "contentMeta", "array", "as", "it", "currently", "stands" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L789-L800
207,674
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.processMarkdown
protected function processMarkdown() { /** @var Config $config */ $config = Grav::instance()['config']; $defaults = (array)$config->get('system.pages.markdown'); if (isset($this->header()->markdown)) { $defaults = array_merge($defaults, $this->header()->markdown); ...
php
protected function processMarkdown() { /** @var Config $config */ $config = Grav::instance()['config']; $defaults = (array)$config->get('system.pages.markdown'); if (isset($this->header()->markdown)) { $defaults = array_merge($defaults, $this->header()->markdown); ...
[ "protected", "function", "processMarkdown", "(", ")", "{", "/** @var Config $config */", "$", "config", "=", "Grav", "::", "instance", "(", ")", "[", "'config'", "]", ";", "$", "defaults", "=", "(", "array", ")", "$", "config", "->", "get", "(", "'system.p...
Process the Markdown content. Uses Parsedown or Parsedown Extra depending on configuration
[ "Process", "the", "Markdown", "content", ".", "Uses", "Parsedown", "or", "Parsedown", "Extra", "depending", "on", "configuration" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L817-L842
207,675
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.processTwig
private function processTwig() { $twig = Grav::instance()['twig']; $this->content = $twig->processPage($this, $this->content); }
php
private function processTwig() { $twig = Grav::instance()['twig']; $this->content = $twig->processPage($this, $this->content); }
[ "private", "function", "processTwig", "(", ")", "{", "$", "twig", "=", "Grav", "::", "instance", "(", ")", "[", "'twig'", "]", ";", "$", "this", "->", "content", "=", "$", "twig", "->", "processPage", "(", "$", "this", ",", "$", "this", "->", "cont...
Process the Twig page content.
[ "Process", "the", "Twig", "page", "content", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L848-L852
207,676
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.cachePageContent
public function cachePageContent() { $cache = Grav::instance()['cache']; $cache_id = md5('page' . $this->id()); $cache->save($cache_id, ['content' => $this->content, 'content_meta' => $this->content_meta]); }
php
public function cachePageContent() { $cache = Grav::instance()['cache']; $cache_id = md5('page' . $this->id()); $cache->save($cache_id, ['content' => $this->content, 'content_meta' => $this->content_meta]); }
[ "public", "function", "cachePageContent", "(", ")", "{", "$", "cache", "=", "Grav", "::", "instance", "(", ")", "[", "'cache'", "]", ";", "$", "cache_id", "=", "md5", "(", "'page'", ".", "$", "this", "->", "id", "(", ")", ")", ";", "$", "cache", ...
Fires the onPageContentProcessed event, and caches the page content using a unique ID for the page
[ "Fires", "the", "onPageContentProcessed", "event", "and", "caches", "the", "page", "content", "using", "a", "unique", "ID", "for", "the", "page" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L857-L862
207,677
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.save
public function save($reorder = true) { // Perform move, copy [or reordering] if needed. $this->doRelocation(); $file = $this->file(); if ($file) { $file->filename($this->filePath()); $file->header((array)$this->header()); $file->markdown($this->r...
php
public function save($reorder = true) { // Perform move, copy [or reordering] if needed. $this->doRelocation(); $file = $this->file(); if ($file) { $file->filename($this->filePath()); $file->header((array)$this->header()); $file->markdown($this->r...
[ "public", "function", "save", "(", "$", "reorder", "=", "true", ")", "{", "// Perform move, copy [or reordering] if needed.", "$", "this", "->", "doRelocation", "(", ")", ";", "$", "file", "=", "$", "this", "->", "file", "(", ")", ";", "if", "(", "$", "f...
Save page if there's a file assigned to it. @param bool|mixed $reorder Internal use.
[ "Save", "page", "if", "there", "s", "a", "file", "assigned", "to", "it", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1001-L1020
207,678
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.move
public function move(PageInterface $parent) { if (!$this->_original) { $clone = clone $this; $this->_original = $clone; } $this->_action = 'move'; if ($this->route() === $parent->route()) { throw new \RuntimeException('Failed: Cannot set page par...
php
public function move(PageInterface $parent) { if (!$this->_original) { $clone = clone $this; $this->_original = $clone; } $this->_action = 'move'; if ($this->route() === $parent->route()) { throw new \RuntimeException('Failed: Cannot set page par...
[ "public", "function", "move", "(", "PageInterface", "$", "parent", ")", "{", "if", "(", "!", "$", "this", "->", "_original", ")", "{", "$", "clone", "=", "clone", "$", "this", ";", "$", "this", "->", "_original", "=", "$", "clone", ";", "}", "$", ...
Prepare move page to new location. Moves also everything that's under the current page. You need to call $this->save() in order to perform the move. @param PageInterface $parent New parent page. @return $this
[ "Prepare", "move", "page", "to", "new", "location", ".", "Moves", "also", "everything", "that", "s", "under", "the", "current", "page", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1031-L1063
207,679
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.blueprints
public function blueprints() { $grav = Grav::instance(); /** @var Pages $pages */ $pages = $grav['pages']; $blueprint = $pages->blueprints($this->blueprintName()); $fields = $blueprint->fields(); $edit_mode = isset($grav['admin']) ? $grav['config']->get('plugins.adm...
php
public function blueprints() { $grav = Grav::instance(); /** @var Pages $pages */ $pages = $grav['pages']; $blueprint = $pages->blueprints($this->blueprintName()); $fields = $blueprint->fields(); $edit_mode = isset($grav['admin']) ? $grav['config']->get('plugins.adm...
[ "public", "function", "blueprints", "(", ")", "{", "$", "grav", "=", "Grav", "::", "instance", "(", ")", ";", "/** @var Pages $pages */", "$", "pages", "=", "$", "grav", "[", "'pages'", "]", ";", "$", "blueprint", "=", "$", "pages", "->", "blueprints", ...
Get blueprints for the page. @return Blueprint
[ "Get", "blueprints", "for", "the", "page", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1088-L1110
207,680
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.filter
public function filter() { $blueprints = $this->blueprints(); $values = $blueprints->filter($this->toArray()); if ($values && isset($values['header'])) { $this->header($values['header']); } }
php
public function filter() { $blueprints = $this->blueprints(); $values = $blueprints->filter($this->toArray()); if ($values && isset($values['header'])) { $this->header($values['header']); } }
[ "public", "function", "filter", "(", ")", "{", "$", "blueprints", "=", "$", "this", "->", "blueprints", "(", ")", ";", "$", "values", "=", "$", "blueprints", "->", "filter", "(", "$", "this", "->", "toArray", "(", ")", ")", ";", "if", "(", "$", "...
Filter page header from illegal contents.
[ "Filter", "page", "header", "from", "illegal", "contents", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1138-L1145
207,681
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.forms
public function forms() { if (null === $this->forms) { $header = $this->header(); // Call event to allow filling the page header form dynamically (e.g. use case: Comments plugin) $grav = Grav::instance(); $grav->fireEvent('onFormPageHeaderProcessed', new Even...
php
public function forms() { if (null === $this->forms) { $header = $this->header(); // Call event to allow filling the page header form dynamically (e.g. use case: Comments plugin) $grav = Grav::instance(); $grav->fireEvent('onFormPageHeaderProcessed', new Even...
[ "public", "function", "forms", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "forms", ")", "{", "$", "header", "=", "$", "this", "->", "header", "(", ")", ";", "// Call event to allow filling the page header form dynamically (e.g. use case: Comments ...
Returns normalized list of name => form pairs. @return array
[ "Returns", "normalized", "list", "of", "name", "=", ">", "form", "pairs", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1205-L1242
207,682
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.getMediaOrder
public function getMediaOrder() { $header = $this->header(); return isset($header->media_order) ? array_map('trim', explode(',', (string)$header->media_order)) : []; }
php
public function getMediaOrder() { $header = $this->header(); return isset($header->media_order) ? array_map('trim', explode(',', (string)$header->media_order)) : []; }
[ "public", "function", "getMediaOrder", "(", ")", "{", "$", "header", "=", "$", "this", "->", "header", "(", ")", ";", "return", "isset", "(", "$", "header", "->", "media_order", ")", "?", "array_map", "(", "'trim'", ",", "explode", "(", "','", ",", "...
Get display order for the associated media. @return array Empty array means default ordering.
[ "Get", "display", "order", "for", "the", "associated", "media", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1312-L1317
207,683
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.template
public function template($var = null) { if ($var !== null) { $this->template = $var; } if (empty($this->template)) { $this->template = ($this->modular() ? 'modular/' : '') . str_replace($this->extension(), '', $this->name()); } return $this->template;...
php
public function template($var = null) { if ($var !== null) { $this->template = $var; } if (empty($this->template)) { $this->template = ($this->modular() ? 'modular/' : '') . str_replace($this->extension(), '', $this->name()); } return $this->template;...
[ "public", "function", "template", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "template", "=", "$", "var", ";", "}", "if", "(", "empty", "(", "$", "this", "->", "template", ")", ")"...
Gets and sets the template field. This is used to find the correct Twig template file to render. If no field is set, it will return the name without the .md extension @param string $var the template name @return string the template name
[ "Gets", "and", "sets", "the", "template", "field", ".", "This", "is", "used", "to", "find", "the", "correct", "Twig", "template", "file", "to", "render", ".", "If", "no", "field", "is", "set", "it", "will", "return", "the", "name", "without", "the", "....
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1353-L1363
207,684
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.extension
public function extension($var = null) { if ($var !== null) { $this->extension = $var; } if (empty($this->extension)) { $this->extension = '.' . pathinfo($this->name(), PATHINFO_EXTENSION); } return $this->extension; }
php
public function extension($var = null) { if ($var !== null) { $this->extension = $var; } if (empty($this->extension)) { $this->extension = '.' . pathinfo($this->name(), PATHINFO_EXTENSION); } return $this->extension; }
[ "public", "function", "extension", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "extension", "=", "$", "var", ";", "}", "if", "(", "empty", "(", "$", "this", "->", "extension", ")", ...
Gets and sets the extension field. @param null $var @return null|string
[ "Gets", "and", "sets", "the", "extension", "field", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1428-L1438
207,685
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.urlExtension
public function urlExtension() { if ($this->home()) { return ''; } // if not set in the page get the value from system config if (null === $this->url_extension) { $this->url_extension = Grav::instance()['config']->get('system.pages.append_url_extension', '');...
php
public function urlExtension() { if ($this->home()) { return ''; } // if not set in the page get the value from system config if (null === $this->url_extension) { $this->url_extension = Grav::instance()['config']->get('system.pages.append_url_extension', '');...
[ "public", "function", "urlExtension", "(", ")", "{", "if", "(", "$", "this", "->", "home", "(", ")", ")", "{", "return", "''", ";", "}", "// if not set in the page get the value from system config", "if", "(", "null", "===", "$", "this", "->", "url_extension",...
Returns the page extension, got from the page `url_extension` config and falls back to the system config `system.pages.append_url_extension`. @return string The extension of this page. For example `.html`
[ "Returns", "the", "page", "extension", "got", "from", "the", "page", "url_extension", "config", "and", "falls", "back", "to", "the", "system", "config", "system", ".", "pages", ".", "append_url_extension", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1446-L1458
207,686
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.expires
public function expires($var = null) { if ($var !== null) { $this->expires = $var; } return $this->expires ?? Grav::instance()['config']->get('system.pages.expires'); }
php
public function expires($var = null) { if ($var !== null) { $this->expires = $var; } return $this->expires ?? Grav::instance()['config']->get('system.pages.expires'); }
[ "public", "function", "expires", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "expires", "=", "$", "var", ";", "}", "return", "$", "this", "->", "expires", "??", "Grav", "::", "instanc...
Gets and sets the expires field. If not set will return the default @param int $var The new expires value. @return int The expires value
[ "Gets", "and", "sets", "the", "expires", "field", ".", "If", "not", "set", "will", "return", "the", "default" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1467-L1474
207,687
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.visible
public function visible($var = null) { if ($var !== null) { $this->visible = (bool)$var; } if ($this->visible === null) { // Set item visibility in menu if folder is different from slug // eg folder = 01.Home and slug = Home if (preg_match(PAG...
php
public function visible($var = null) { if ($var !== null) { $this->visible = (bool)$var; } if ($this->visible === null) { // Set item visibility in menu if folder is different from slug // eg folder = 01.Home and slug = Home if (preg_match(PAG...
[ "public", "function", "visible", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "visible", "=", "(", "bool", ")", "$", "var", ";", "}", "if", "(", "$", "this", "->", "visible", "===", ...
Gets and Sets whether or not this Page is visible for navigation @param bool $var true if the page is visible @return bool true if the page is visible
[ "Gets", "and", "Sets", "whether", "or", "not", "this", "Page", "is", "visible", "for", "navigation" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1538-L1555
207,688
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.published
public function published($var = null) { if ($var !== null) { $this->published = (bool)$var; } // If not published, should not be visible in menus either if ($this->published === false) { $this->visible = false; } return $this->published; ...
php
public function published($var = null) { if ($var !== null) { $this->published = (bool)$var; } // If not published, should not be visible in menus either if ($this->published === false) { $this->visible = false; } return $this->published; ...
[ "public", "function", "published", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "published", "=", "(", "bool", ")", "$", "var", ";", "}", "// If not published, should not be visible in menus eit...
Gets and Sets whether or not this Page is considered published @param bool $var true if the page is published @return bool true if the page is published
[ "Gets", "and", "Sets", "whether", "or", "not", "this", "Page", "is", "considered", "published" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1564-L1576
207,689
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.publishDate
public function publishDate($var = null) { if ($var !== null) { $this->publish_date = Utils::date2timestamp($var, $this->dateformat); } return $this->publish_date; }
php
public function publishDate($var = null) { if ($var !== null) { $this->publish_date = Utils::date2timestamp($var, $this->dateformat); } return $this->publish_date; }
[ "public", "function", "publishDate", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "publish_date", "=", "Utils", "::", "date2timestamp", "(", "$", "var", ",", "$", "this", "->", "dateformat...
Gets and Sets the Page publish date @param string $var string representation of a date @return int unix timestamp representation of the date
[ "Gets", "and", "Sets", "the", "Page", "publish", "date" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1585-L1592
207,690
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.unpublishDate
public function unpublishDate($var = null) { if ($var !== null) { $this->unpublish_date = Utils::date2timestamp($var, $this->dateformat); } return $this->unpublish_date; }
php
public function unpublishDate($var = null) { if ($var !== null) { $this->unpublish_date = Utils::date2timestamp($var, $this->dateformat); } return $this->unpublish_date; }
[ "public", "function", "unpublishDate", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "unpublish_date", "=", "Utils", "::", "date2timestamp", "(", "$", "var", ",", "$", "this", "->", "datefo...
Gets and Sets the Page unpublish date @param string $var string representation of a date @return int|null unix timestamp representation of the date
[ "Gets", "and", "Sets", "the", "Page", "unpublish", "date" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1601-L1608
207,691
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.metadata
public function metadata($var = null) { if ($var !== null) { $this->metadata = (array)$var; } // if not metadata yet, process it. if (null === $this->metadata) { $header_tag_http_equivs = ['content-type', 'default-style', 'refresh', 'x-ua-compatible']; ...
php
public function metadata($var = null) { if ($var !== null) { $this->metadata = (array)$var; } // if not metadata yet, process it. if (null === $this->metadata) { $header_tag_http_equivs = ['content-type', 'default-style', 'refresh', 'x-ua-compatible']; ...
[ "public", "function", "metadata", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "metadata", "=", "(", "array", ")", "$", "var", ";", "}", "// if not metadata yet, process it.", "if", "(", "...
Function to merge page metadata tags and build an array of Metadata objects that can then be rendered in the page. @param array $var an Array of metadata values to set @return array an Array of metadata values for the page
[ "Function", "to", "merge", "page", "metadata", "tags", "and", "build", "an", "array", "of", "Metadata", "objects", "that", "can", "then", "be", "rendered", "in", "the", "page", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1672-L1743
207,692
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.slug
public function slug($var = null) { if ($var !== null && $var !== '') { $this->slug = $var; } if (empty($this->slug)) { $this->slug = $this->adjustRouteCase(preg_replace(PAGE_ORDER_PREFIX_REGEX, '', $this->folder)) ?: null; } return $this->slug; ...
php
public function slug($var = null) { if ($var !== null && $var !== '') { $this->slug = $var; } if (empty($this->slug)) { $this->slug = $this->adjustRouteCase(preg_replace(PAGE_ORDER_PREFIX_REGEX, '', $this->folder)) ?: null; } return $this->slug; ...
[ "public", "function", "slug", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", "&&", "$", "var", "!==", "''", ")", "{", "$", "this", "->", "slug", "=", "$", "var", ";", "}", "if", "(", "empty", "(", "$", "this", ...
Gets and Sets the slug for the Page. The slug is used in the URL routing. If not set it uses the parent folder from the path @param string $var the slug, e.g. 'my-blog' @return string the slug
[ "Gets", "and", "Sets", "the", "slug", "for", "the", "Page", ".", "The", "slug", "is", "used", "in", "the", "URL", "routing", ".", "If", "not", "set", "it", "uses", "the", "parent", "folder", "from", "the", "path" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1761-L1772
207,693
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.url
public function url($include_host = false, $canonical = false, $include_base = true, $raw_route = false) { // Override any URL when external_url is set if (isset($this->external_url)) { return $this->external_url; } $grav = Grav::instance(); /** @var Pages $page...
php
public function url($include_host = false, $canonical = false, $include_base = true, $raw_route = false) { // Override any URL when external_url is set if (isset($this->external_url)) { return $this->external_url; } $grav = Grav::instance(); /** @var Pages $page...
[ "public", "function", "url", "(", "$", "include_host", "=", "false", ",", "$", "canonical", "=", "false", ",", "$", "include_base", "=", "true", ",", "$", "raw_route", "=", "false", ")", "{", "// Override any URL when external_url is set", "if", "(", "isset", ...
Gets the url for the Page. @param bool $include_host Defaults false, but true would include http://yourhost.com @param bool $canonical True to return the canonical URL @param bool $include_base Include base url on multisite as well as language code @param bool $raw_route @return string The url.
[ "Gets", "the", "url", "for", "the", "Page", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1838-L1879
207,694
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.route
public function route($var = null) { if ($var !== null) { $this->route = $var; } if (empty($this->route)) { $baseRoute = null; // calculate route based on parent slugs $parent = $this->parent(); if (isset($parent)) { ...
php
public function route($var = null) { if ($var !== null) { $this->route = $var; } if (empty($this->route)) { $baseRoute = null; // calculate route based on parent slugs $parent = $this->parent(); if (isset($parent)) { ...
[ "public", "function", "route", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "route", "=", "$", "var", ";", "}", "if", "(", "empty", "(", "$", "this", "->", "route", ")", ")", "{", ...
Gets the route for the page based on the route headers if available, else from the parents route and the current Page's slug. @param string $var Set new default route. @return string The route for the Page.
[ "Gets", "the", "route", "for", "the", "page", "based", "on", "the", "route", "headers", "if", "available", "else", "from", "the", "parents", "route", "and", "the", "current", "Page", "s", "slug", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1889-L1919
207,695
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.rawRoute
public function rawRoute($var = null) { if ($var !== null) { $this->raw_route = $var; } if (empty($this->raw_route)) { $parent = $this->parent(); $baseRoute = $parent ? (string)$parent->rawRoute() : null; $slug = $this->adjustRouteCase(preg_r...
php
public function rawRoute($var = null) { if ($var !== null) { $this->raw_route = $var; } if (empty($this->raw_route)) { $parent = $this->parent(); $baseRoute = $parent ? (string)$parent->rawRoute() : null; $slug = $this->adjustRouteCase(preg_r...
[ "public", "function", "rawRoute", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "raw_route", "=", "$", "var", ";", "}", "if", "(", "empty", "(", "$", "this", "->", "raw_route", ")", "...
Gets and Sets the page raw route @param null $var @return null|string
[ "Gets", "and", "Sets", "the", "page", "raw", "route" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1936-L1952
207,696
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.routeAliases
public function routeAliases($var = null) { if ($var !== null) { $this->routes['aliases'] = (array)$var; } if (!empty($this->routes) && isset($this->routes['aliases'])) { return $this->routes['aliases']; } return []; }
php
public function routeAliases($var = null) { if ($var !== null) { $this->routes['aliases'] = (array)$var; } if (!empty($this->routes) && isset($this->routes['aliases'])) { return $this->routes['aliases']; } return []; }
[ "public", "function", "routeAliases", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "routes", "[", "'aliases'", "]", "=", "(", "array", ")", "$", "var", ";", "}", "if", "(", "!", "emp...
Gets the route aliases for the page based on page headers. @param array $var list of route aliases @return array The route aliases for the Page.
[ "Gets", "the", "route", "aliases", "for", "the", "page", "based", "on", "page", "headers", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1961-L1972
207,697
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.routeCanonical
public function routeCanonical($var = null) { if ($var !== null) { $this->routes['canonical'] = $var; } if (!empty($this->routes) && isset($this->routes['canonical'])) { return $this->routes['canonical']; } return $this->route(); }
php
public function routeCanonical($var = null) { if ($var !== null) { $this->routes['canonical'] = $var; } if (!empty($this->routes) && isset($this->routes['canonical'])) { return $this->routes['canonical']; } return $this->route(); }
[ "public", "function", "routeCanonical", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "routes", "[", "'canonical'", "]", "=", "$", "var", ";", "}", "if", "(", "!", "empty", "(", "$", ...
Gets the canonical route for this page if its set. If provided it will use that value, else if it's `true` it will use the default route. @param null $var @return bool|string
[ "Gets", "the", "canonical", "route", "for", "this", "page", "if", "its", "set", ".", "If", "provided", "it", "will", "use", "that", "value", "else", "if", "it", "s", "true", "it", "will", "use", "the", "default", "route", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1982-L1993
207,698
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.id
public function id($var = null) { if ($var !== null) { // store unique per language $active_lang = Grav::instance()['language']->getLanguage() ?: ''; $id = $active_lang . $var; $this->id = $id; } return $this->id; }
php
public function id($var = null) { if ($var !== null) { // store unique per language $active_lang = Grav::instance()['language']->getLanguage() ?: ''; $id = $active_lang . $var; $this->id = $id; } return $this->id; }
[ "public", "function", "id", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "// store unique per language", "$", "active_lang", "=", "Grav", "::", "instance", "(", ")", "[", "'language'", "]", "->", "getLanguage", ...
Gets and sets the identifier for this Page object. @param string $var the identifier @return string the identifier
[ "Gets", "and", "sets", "the", "identifier", "for", "this", "Page", "object", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2002-L2012
207,699
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.eTag
public function eTag($var = null) { if ($var !== null) { $this->etag = $var; } if (!isset($this->etag)) { $this->etag = (bool)Grav::instance()['config']->get('system.pages.etag'); } return $this->etag; }
php
public function eTag($var = null) { if ($var !== null) { $this->etag = $var; } if (!isset($this->etag)) { $this->etag = (bool)Grav::instance()['config']->get('system.pages.etag'); } return $this->etag; }
[ "public", "function", "eTag", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "etag", "=", "$", "var", ";", "}", "if", "(", "!", "isset", "(", "$", "this", "->", "etag", ")", ")", "...
Gets and sets the option to show the etag header for the page. @param bool $var show etag header @return bool show etag header
[ "Gets", "and", "sets", "the", "option", "to", "show", "the", "etag", "header", "for", "the", "page", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2053-L2063