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,800
getgrav/grav
system/src/Grav/Common/Config/CompiledBase.php
CompiledBase.saveCompiledFile
protected function saveCompiledFile($filename) { $file = PhpFile::instance($filename); // Attempt to lock the file for writing. try { $file->lock(false); } catch (\Exception $e) { // Another process has locked the file; we will check this in a bit. } ...
php
protected function saveCompiledFile($filename) { $file = PhpFile::instance($filename); // Attempt to lock the file for writing. try { $file->lock(false); } catch (\Exception $e) { // Another process has locked the file; we will check this in a bit. } ...
[ "protected", "function", "saveCompiledFile", "(", "$", "filename", ")", "{", "$", "file", "=", "PhpFile", "::", "instance", "(", "$", "filename", ")", ";", "// Attempt to lock the file for writing.", "try", "{", "$", "file", "->", "lock", "(", "false", ")", ...
Save compiled file. @param string $filename @throws \RuntimeException @internal
[ "Save", "compiled", "file", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Config/CompiledBase.php#L228-L257
207,801
getgrav/grav
system/src/Grav/Common/Service/ConfigServiceProvider.php
ConfigServiceProvider.pluginFolderPaths
private static function pluginFolderPaths($plugins, $folder_path) { $paths = []; foreach ($plugins as $path) { $iterator = new \DirectoryIterator($path); /** @var \DirectoryIterator $directory */ foreach ($iterator as $directory) { if (!$director...
php
private static function pluginFolderPaths($plugins, $folder_path) { $paths = []; foreach ($plugins as $path) { $iterator = new \DirectoryIterator($path); /** @var \DirectoryIterator $directory */ foreach ($iterator as $directory) { if (!$director...
[ "private", "static", "function", "pluginFolderPaths", "(", "$", "plugins", ",", "$", "folder_path", ")", "{", "$", "paths", "=", "[", "]", ";", "foreach", "(", "$", "plugins", "as", "$", "path", ")", "{", "$", "iterator", "=", "new", "\\", "DirectoryIt...
Find specific paths in plugins @param array $plugins @param string $folder_path @return array
[ "Find", "specific", "paths", "in", "plugins" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Service/ConfigServiceProvider.php#L147-L170
207,802
getgrav/grav
system/src/Grav/Common/Assets/Traits/AssetUtilsTrait.php
AssetUtilsTrait.gatherLinks
protected function gatherLinks(array $assets, $css = true) { $buffer = ''; foreach ($assets as $id => $asset) { $local = true; $link = $asset->getAsset(); $relative_path = $link; if (static::isRemoteLink($link)) { $local = false; ...
php
protected function gatherLinks(array $assets, $css = true) { $buffer = ''; foreach ($assets as $id => $asset) { $local = true; $link = $asset->getAsset(); $relative_path = $link; if (static::isRemoteLink($link)) { $local = false; ...
[ "protected", "function", "gatherLinks", "(", "array", "$", "assets", ",", "$", "css", "=", "true", ")", "{", "$", "buffer", "=", "''", ";", "foreach", "(", "$", "assets", "as", "$", "id", "=>", "$", "asset", ")", "{", "$", "local", "=", "true", "...
Download and concatenate the content of several links. @param array $assets @param bool $css @return string
[ "Download", "and", "concatenate", "the", "content", "of", "several", "links", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Assets/Traits/AssetUtilsTrait.php#L44-L99
207,803
getgrav/grav
system/src/Grav/Framework/Flex/FlexForm.php
FlexForm.getValue
public function getValue(string $name) { // Attempt to get value from the form data. $value = $this->data ? $this->data[$name] : null; // Return the form data or fall back to the object property. return $value ?? $this->getObject()->value($name); }
php
public function getValue(string $name) { // Attempt to get value from the form data. $value = $this->data ? $this->data[$name] : null; // Return the form data or fall back to the object property. return $value ?? $this->getObject()->value($name); }
[ "public", "function", "getValue", "(", "string", "$", "name", ")", "{", "// Attempt to get value from the form data.", "$", "value", "=", "$", "this", "->", "data", "?", "$", "this", "->", "data", "[", "$", "name", "]", ":", "null", ";", "// Return the form ...
Get a value from the form. Note: Used in form fields. @param string $name @return mixed
[ "Get", "a", "value", "from", "the", "form", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/FlexForm.php#L100-L107
207,804
getgrav/grav
system/src/Grav/Framework/Flex/FlexForm.php
FlexForm.filterData
protected function filterData(\ArrayAccess $data): void { if ($data instanceof Data) { $data->filter(true, true); } }
php
protected function filterData(\ArrayAccess $data): void { if ($data instanceof Data) { $data->filter(true, true); } }
[ "protected", "function", "filterData", "(", "\\", "ArrayAccess", "$", "data", ")", ":", "void", "{", "if", "(", "$", "data", "instanceof", "Data", ")", "{", "$", "data", "->", "filter", "(", "true", ",", "true", ")", ";", "}", "}" ]
Filter validated data. @param \ArrayAccess $data
[ "Filter", "validated", "data", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/FlexForm.php#L337-L342
207,805
getgrav/grav
system/src/Grav/Common/Twig/WriteCacheFileTrait.php
WriteCacheFileTrait.writeCacheFile
protected function writeCacheFile($file, $content) { if (empty($file)) { return; } if (!isset(self::$umask)) { self::$umask = Grav::instance()['config']->get('system.twig.umask_fix', false); } if (self::$umask) { $dir = dirname($file); ...
php
protected function writeCacheFile($file, $content) { if (empty($file)) { return; } if (!isset(self::$umask)) { self::$umask = Grav::instance()['config']->get('system.twig.umask_fix', false); } if (self::$umask) { $dir = dirname($file); ...
[ "protected", "function", "writeCacheFile", "(", "$", "file", ",", "$", "content", ")", "{", "if", "(", "empty", "(", "$", "file", ")", ")", "{", "return", ";", "}", "if", "(", "!", "isset", "(", "self", "::", "$", "umask", ")", ")", "{", "self", ...
This exists so template cache files use the same group between apache and cli @param string $file @param string $content
[ "This", "exists", "so", "template", "cache", "files", "use", "the", "same", "group", "between", "apache", "and", "cli" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/WriteCacheFileTrait.php#L26-L48
207,806
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.url
public static function url($input, $domain = false) { if (!trim((string)$input)) { $input = '/'; } if (Grav::instance()['config']->get('system.absolute_urls', false)) { $domain = true; } if (Grav::instance()['uri']->isExternal($input)) { ...
php
public static function url($input, $domain = false) { if (!trim((string)$input)) { $input = '/'; } if (Grav::instance()['config']->get('system.absolute_urls', false)) { $domain = true; } if (Grav::instance()['uri']->isExternal($input)) { ...
[ "public", "static", "function", "url", "(", "$", "input", ",", "$", "domain", "=", "false", ")", "{", "if", "(", "!", "trim", "(", "(", "string", ")", "$", "input", ")", ")", "{", "$", "input", "=", "'/'", ";", "}", "if", "(", "Grav", "::", "...
Simple helper method to make getting a Grav URL easier @param string $input @param bool $domain @return bool|null|string
[ "Simple", "helper", "method", "to", "make", "getting", "a", "Grav", "URL", "easier" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L34-L81
207,807
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.substrToString
public static function substrToString($haystack, $needle, $case_sensitive = true) { $compare_func = $case_sensitive ? 'mb_strpos' : 'mb_stripos'; if (static::contains($haystack, $needle, $case_sensitive)) { return mb_substr($haystack, 0, $compare_func($haystack, $needle, $case_sensitive...
php
public static function substrToString($haystack, $needle, $case_sensitive = true) { $compare_func = $case_sensitive ? 'mb_strpos' : 'mb_stripos'; if (static::contains($haystack, $needle, $case_sensitive)) { return mb_substr($haystack, 0, $compare_func($haystack, $needle, $case_sensitive...
[ "public", "static", "function", "substrToString", "(", "$", "haystack", ",", "$", "needle", ",", "$", "case_sensitive", "=", "true", ")", "{", "$", "compare_func", "=", "$", "case_sensitive", "?", "'mb_strpos'", ":", "'mb_stripos'", ";", "if", "(", "static",...
Returns the substring of a string up to a specified needle. if not found, return the whole haystack @param string $haystack @param string $needle @param bool $case_sensitive @return string
[ "Returns", "the", "substring", "of", "a", "string", "up", "to", "a", "specified", "needle", ".", "if", "not", "found", "return", "the", "whole", "haystack" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L192-L201
207,808
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.replaceFirstOccurrence
public static function replaceFirstOccurrence($search, $replace, $subject) { if (!$search) { return $subject; } $pos = mb_strpos($subject, $search); if ($pos !== false) { $subject = static::mb_substr_replace($subject, $replace, $pos, mb_strlen($search)); ...
php
public static function replaceFirstOccurrence($search, $replace, $subject) { if (!$search) { return $subject; } $pos = mb_strpos($subject, $search); if ($pos !== false) { $subject = static::mb_substr_replace($subject, $replace, $pos, mb_strlen($search)); ...
[ "public", "static", "function", "replaceFirstOccurrence", "(", "$", "search", ",", "$", "replace", ",", "$", "subject", ")", "{", "if", "(", "!", "$", "search", ")", "{", "return", "$", "subject", ";", "}", "$", "pos", "=", "mb_strpos", "(", "$", "su...
Utility method to replace only the first occurrence in a string @param string $search @param string $replace @param string $subject @return string
[ "Utility", "method", "to", "replace", "only", "the", "first", "occurrence", "in", "a", "string" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L212-L225
207,809
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.replaceLastOccurrence
public static function replaceLastOccurrence($search, $replace, $subject) { $pos = strrpos($subject, $search); if($pos !== false) { $subject = static::mb_substr_replace($subject, $replace, $pos, mb_strlen($search)); } return $subject; }
php
public static function replaceLastOccurrence($search, $replace, $subject) { $pos = strrpos($subject, $search); if($pos !== false) { $subject = static::mb_substr_replace($subject, $replace, $pos, mb_strlen($search)); } return $subject; }
[ "public", "static", "function", "replaceLastOccurrence", "(", "$", "search", ",", "$", "replace", ",", "$", "subject", ")", "{", "$", "pos", "=", "strrpos", "(", "$", "subject", ",", "$", "search", ")", ";", "if", "(", "$", "pos", "!==", "false", ")"...
Utility method to replace only the last occurrence in a string @param string $search @param string $replace @param string $subject @return string
[ "Utility", "method", "to", "replace", "only", "the", "last", "occurrence", "in", "a", "string" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L235-L245
207,810
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.mb_substr_replace
public static function mb_substr_replace($original, $replacement, $position, $length) { $startString = mb_substr($original, 0, $position, "UTF-8"); $endString = mb_substr($original, $position + $length, mb_strlen($original), "UTF-8"); return $startString . $replacement . $endString; }
php
public static function mb_substr_replace($original, $replacement, $position, $length) { $startString = mb_substr($original, 0, $position, "UTF-8"); $endString = mb_substr($original, $position + $length, mb_strlen($original), "UTF-8"); return $startString . $replacement . $endString; }
[ "public", "static", "function", "mb_substr_replace", "(", "$", "original", ",", "$", "replacement", ",", "$", "position", ",", "$", "length", ")", "{", "$", "startString", "=", "mb_substr", "(", "$", "original", ",", "0", ",", "$", "position", ",", "\"UT...
Multibyte compatible substr_replace @param string $original @param string $replacement @param int $position @param int $length @return string
[ "Multibyte", "compatible", "substr_replace" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L256-L262
207,811
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.arrayMergeRecursiveUnique
public static function arrayMergeRecursiveUnique($array1, $array2) { if (empty($array1)) { // Optimize the base case return $array2; } foreach ($array2 as $key => $value) { if (is_array($value) && isset($array1[$key]) && is_array($array1[$key])) { ...
php
public static function arrayMergeRecursiveUnique($array1, $array2) { if (empty($array1)) { // Optimize the base case return $array2; } foreach ($array2 as $key => $value) { if (is_array($value) && isset($array1[$key]) && is_array($array1[$key])) { ...
[ "public", "static", "function", "arrayMergeRecursiveUnique", "(", "$", "array1", ",", "$", "array2", ")", "{", "if", "(", "empty", "(", "$", "array1", ")", ")", "{", "// Optimize the base case", "return", "$", "array2", ";", "}", "foreach", "(", "$", "arra...
Recursive Merge with uniqueness @param array $array1 @param array $array2 @return array
[ "Recursive", "Merge", "with", "uniqueness" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L284-L299
207,812
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.arrayCombine
public static function arrayCombine($arr1, $arr2) { $count = min(count($arr1), count($arr2)); return array_combine(array_slice($arr1, 0, $count), array_slice($arr2, 0, $count)); }
php
public static function arrayCombine($arr1, $arr2) { $count = min(count($arr1), count($arr2)); return array_combine(array_slice($arr1, 0, $count), array_slice($arr2, 0, $count)); }
[ "public", "static", "function", "arrayCombine", "(", "$", "arr1", ",", "$", "arr2", ")", "{", "$", "count", "=", "min", "(", "count", "(", "$", "arr1", ")", ",", "count", "(", "$", "arr2", ")", ")", ";", "return", "array_combine", "(", "array_slice",...
Array combine but supports different array lengths @param array $arr1 @param array $arr2 @return array|false
[ "Array", "combine", "but", "supports", "different", "array", "lengths" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L338-L343
207,813
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.dateFormats
public static function dateFormats() { $now = new \DateTime(); $date_formats = [ 'd-m-Y H:i' => 'd-m-Y H:i (e.g. '.$now->format('d-m-Y H:i').')', 'Y-m-d H:i' => 'Y-m-d H:i (e.g. '.$now->format('Y-m-d H:i').')', 'm/d/Y h:i a' => 'm/d/Y h:i a (e.g. '.$now->format('...
php
public static function dateFormats() { $now = new \DateTime(); $date_formats = [ 'd-m-Y H:i' => 'd-m-Y H:i (e.g. '.$now->format('d-m-Y H:i').')', 'Y-m-d H:i' => 'Y-m-d H:i (e.g. '.$now->format('Y-m-d H:i').')', 'm/d/Y h:i a' => 'm/d/Y h:i a (e.g. '.$now->format('...
[ "public", "static", "function", "dateFormats", "(", ")", "{", "$", "now", "=", "new", "\\", "DateTime", "(", ")", ";", "$", "date_formats", "=", "[", "'d-m-Y H:i'", "=>", "'d-m-Y H:i (e.g. '", ".", "$", "now", "->", "format", "(", "'d-m-Y H:i'", ")", "."...
Return the Grav date formats allowed @return array
[ "Return", "the", "Grav", "date", "formats", "allowed" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L365-L382
207,814
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.truncate
public static function truncate($string, $limit = 150, $up_to_break = false, $break = ' ', $pad = '&hellip;') { // return with no change if string is shorter than $limit if (mb_strlen($string) <= $limit) { return $string; } // is $break present between $limit and the end...
php
public static function truncate($string, $limit = 150, $up_to_break = false, $break = ' ', $pad = '&hellip;') { // return with no change if string is shorter than $limit if (mb_strlen($string) <= $limit) { return $string; } // is $break present between $limit and the end...
[ "public", "static", "function", "truncate", "(", "$", "string", ",", "$", "limit", "=", "150", ",", "$", "up_to_break", "=", "false", ",", "$", "break", "=", "' '", ",", "$", "pad", "=", "'&hellip;'", ")", "{", "// return with no change if string is shorter ...
Truncate text by number of characters but can cut off words. @param string $string @param int $limit Max number of characters. @param bool $up_to_break truncate up to breakpoint after char count @param string $break Break point. @param string $pad Appended padding to the end of the string...
[ "Truncate", "text", "by", "number", "of", "characters", "but", "can", "cut", "off", "words", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L413-L430
207,815
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.getMimeTypes
public static function getMimeTypes(array $extensions) { $mimetypes = []; foreach ($extensions as $extension) { $mimetype = static::getMimeByExtension($extension, false); if ($mimetype && !in_array($mimetype, $mimetypes)) { $mimetypes[] = $mimetype; ...
php
public static function getMimeTypes(array $extensions) { $mimetypes = []; foreach ($extensions as $extension) { $mimetype = static::getMimeByExtension($extension, false); if ($mimetype && !in_array($mimetype, $mimetypes)) { $mimetypes[] = $mimetype; ...
[ "public", "static", "function", "getMimeTypes", "(", "array", "$", "extensions", ")", "{", "$", "mimetypes", "=", "[", "]", ";", "foreach", "(", "$", "extensions", "as", "$", "extension", ")", "{", "$", "mimetype", "=", "static", "::", "getMimeByExtension"...
Get all the mimetypes for an array of extensions @param array $extensions @return array
[ "Get", "all", "the", "mimetypes", "for", "an", "array", "of", "extensions" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L633-L643
207,816
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.getExtensions
public static function getExtensions(array $mimetypes) { $extensions = []; foreach ($mimetypes as $mimetype) { $extension = static::getExtensionByMime($mimetype, false); if ($extension && !\in_array($extension, $extensions, true)) { $extensions[] = $extension;...
php
public static function getExtensions(array $mimetypes) { $extensions = []; foreach ($mimetypes as $mimetype) { $extension = static::getExtensionByMime($mimetype, false); if ($extension && !\in_array($extension, $extensions, true)) { $extensions[] = $extension;...
[ "public", "static", "function", "getExtensions", "(", "array", "$", "mimetypes", ")", "{", "$", "extensions", "=", "[", "]", ";", "foreach", "(", "$", "mimetypes", "as", "$", "mimetype", ")", "{", "$", "extension", "=", "static", "::", "getExtensionByMime"...
Get all the extensions for an array of mimetypes @param array $mimetypes @return array
[ "Get", "all", "the", "extensions", "for", "an", "array", "of", "mimetypes" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L694-L705
207,817
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.getMimeByLocalFile
public static function getMimeByLocalFile($filename, $default = 'application/octet-stream') { $type = false; // For local files we can detect type by the file content. if (!stream_is_local($filename) || !file_exists($filename)) { return false; } // Prefer using ...
php
public static function getMimeByLocalFile($filename, $default = 'application/octet-stream') { $type = false; // For local files we can detect type by the file content. if (!stream_is_local($filename) || !file_exists($filename)) { return false; } // Prefer using ...
[ "public", "static", "function", "getMimeByLocalFile", "(", "$", "filename", ",", "$", "default", "=", "'application/octet-stream'", ")", "{", "$", "type", "=", "false", ";", "// For local files we can detect type by the file content.", "if", "(", "!", "stream_is_local",...
Return the mimetype based on existing local file @param string $filename Path to the file @return string|bool
[ "Return", "the", "mimetype", "based", "on", "existing", "local", "file" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L727-L750
207,818
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.normalizePath
public static function normalizePath($path) { // Resolve any streams /** @var UniformResourceLocator $locator */ $locator = Grav::instance()['locator']; if ($locator->isStream($path)) { $path = $locator->findResource($path); } // Set root properly for any...
php
public static function normalizePath($path) { // Resolve any streams /** @var UniformResourceLocator $locator */ $locator = Grav::instance()['locator']; if ($locator->isStream($path)) { $path = $locator->findResource($path); } // Set root properly for any...
[ "public", "static", "function", "normalizePath", "(", "$", "path", ")", "{", "// Resolve any streams", "/** @var UniformResourceLocator $locator */", "$", "locator", "=", "Grav", "::", "instance", "(", ")", "[", "'locator'", "]", ";", "if", "(", "$", "locator", ...
Normalize path by processing relative `.` and `..` syntax and merging path @param string $path @return string
[ "Normalize", "path", "by", "processing", "relative", ".", "and", "..", "syntax", "and", "merging", "path" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L787-L830
207,819
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.timezones
public static function timezones() { $timezones = \DateTimeZone::listIdentifiers(\DateTimeZone::ALL); $offsets = []; $testDate = new \DateTime(); foreach ($timezones as $zone) { $tz = new \DateTimeZone($zone); $offsets[$zone] = $tz->getOffset($testDate); ...
php
public static function timezones() { $timezones = \DateTimeZone::listIdentifiers(\DateTimeZone::ALL); $offsets = []; $testDate = new \DateTime(); foreach ($timezones as $zone) { $tz = new \DateTimeZone($zone); $offsets[$zone] = $tz->getOffset($testDate); ...
[ "public", "static", "function", "timezones", "(", ")", "{", "$", "timezones", "=", "\\", "DateTimeZone", "::", "listIdentifiers", "(", "\\", "DateTimeZone", "::", "ALL", ")", ";", "$", "offsets", "=", "[", "]", ";", "$", "testDate", "=", "new", "\\", "...
Get the formatted timezones list @return array
[ "Get", "the", "formatted", "timezones", "list" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L849-L873
207,820
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.arrayFlattenDotNotation
public static function arrayFlattenDotNotation($array, $prepend = '') { $results = array(); foreach ($array as $key => $value) { if (is_array($value)) { $results = array_merge($results, static::arrayFlattenDotNotation($value, $prepend.$key.'.')); } else { ...
php
public static function arrayFlattenDotNotation($array, $prepend = '') { $results = array(); foreach ($array as $key => $value) { if (is_array($value)) { $results = array_merge($results, static::arrayFlattenDotNotation($value, $prepend.$key.'.')); } else { ...
[ "public", "static", "function", "arrayFlattenDotNotation", "(", "$", "array", ",", "$", "prepend", "=", "''", ")", "{", "$", "results", "=", "array", "(", ")", ";", "foreach", "(", "$", "array", "as", "$", "key", "=>", "$", "value", ")", "{", "if", ...
Flatten a multi-dimensional associative array into dot notation @param array $array @param string $prepend @return array
[ "Flatten", "a", "multi", "-", "dimensional", "associative", "array", "into", "dot", "notation" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L929-L941
207,821
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.arrayUnflattenDotNotation
public static function arrayUnflattenDotNotation($array, $separator = '.') { $newArray = []; foreach ($array as $key => $value) { $dots = explode($separator, $key); if (\count($dots) > 1) { $last = &$newArray[$dots[0]]; foreach ($dots as $k => ...
php
public static function arrayUnflattenDotNotation($array, $separator = '.') { $newArray = []; foreach ($array as $key => $value) { $dots = explode($separator, $key); if (\count($dots) > 1) { $last = &$newArray[$dots[0]]; foreach ($dots as $k => ...
[ "public", "static", "function", "arrayUnflattenDotNotation", "(", "$", "array", ",", "$", "separator", "=", "'.'", ")", "{", "$", "newArray", "=", "[", "]", ";", "foreach", "(", "$", "array", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "dots...
Opposite of flatten, convert flat dot notation array to multi dimensional array @param array $array @param string $separator @return array
[ "Opposite", "of", "flatten", "convert", "flat", "dot", "notation", "array", "to", "multi", "dimensional", "array" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L950-L970
207,822
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.pathPrefixedByLangCode
public static function pathPrefixedByLangCode($string) { if (strlen($string) <= 3) { return false; } $languages_enabled = Grav::instance()['config']->get('system.languages.supported', []); $parts = explode('/', trim($string, '/')); if (count($parts) > 0 && in_ar...
php
public static function pathPrefixedByLangCode($string) { if (strlen($string) <= 3) { return false; } $languages_enabled = Grav::instance()['config']->get('system.languages.supported', []); $parts = explode('/', trim($string, '/')); if (count($parts) > 0 && in_ar...
[ "public", "static", "function", "pathPrefixedByLangCode", "(", "$", "string", ")", "{", "if", "(", "strlen", "(", "$", "string", ")", "<=", "3", ")", "{", "return", "false", ";", "}", "$", "languages_enabled", "=", "Grav", "::", "instance", "(", ")", "...
Checks if the passed path contains the language code prefix @param string $string The path @return bool
[ "Checks", "if", "the", "passed", "path", "contains", "the", "language", "code", "prefix" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L980-L994
207,823
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.date2timestamp
public static function date2timestamp($date, $format = null) { $config = Grav::instance()['config']; $dateformat = $format ?: $config->get('system.pages.dateformat.default'); // try to use DateTime and default format if ($dateformat) { $datetime = \DateTime::createFromFo...
php
public static function date2timestamp($date, $format = null) { $config = Grav::instance()['config']; $dateformat = $format ?: $config->get('system.pages.dateformat.default'); // try to use DateTime and default format if ($dateformat) { $datetime = \DateTime::createFromFo...
[ "public", "static", "function", "date2timestamp", "(", "$", "date", ",", "$", "format", "=", "null", ")", "{", "$", "config", "=", "Grav", "::", "instance", "(", ")", "[", "'config'", "]", ";", "$", "dateformat", "=", "$", "format", "?", ":", "$", ...
Get the timestamp of a date @param string $date a String expressed in the system.pages.dateformat.default format, with fallback to a strtotime argument @param string $format a date format to use if possible @return int the timestamp
[ "Get", "the", "timestamp", "of", "a", "date" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L1004-L1022
207,824
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.getNonce
public static function getNonce($action, $previousTick = false) { // Don't regenerate this again if not needed if (isset(static::$nonces[$action][$previousTick])) { return static::$nonces[$action][$previousTick]; } $nonce = md5(self::generateNonceString($action, $previous...
php
public static function getNonce($action, $previousTick = false) { // Don't regenerate this again if not needed if (isset(static::$nonces[$action][$previousTick])) { return static::$nonces[$action][$previousTick]; } $nonce = md5(self::generateNonceString($action, $previous...
[ "public", "static", "function", "getNonce", "(", "$", "action", ",", "$", "previousTick", "=", "false", ")", "{", "// Don't regenerate this again if not needed", "if", "(", "isset", "(", "static", "::", "$", "nonces", "[", "$", "action", "]", "[", "$", "prev...
Creates a hashed nonce tied to the passed action. Tied to the current user and time. The nonce for a given action is the same for 12 hours. @param string $action the action the nonce is tied to (e.g. save-user-admin or move-page-homepage) @param bool $previousTick if true, generates the token for the previous t...
[ "Creates", "a", "hashed", "nonce", "tied", "to", "the", "passed", "action", ".", "Tied", "to", "the", "current", "user", "and", "time", ".", "The", "nonce", "for", "a", "given", "action", "is", "the", "same", "for", "12", "hours", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L1103-L1113
207,825
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.verifyNonce
public static function verifyNonce($nonce, $action) { //Safety check for multiple nonces if (is_array($nonce)) { $nonce = array_shift($nonce); } //Nonce generated 0-12 hours ago if ($nonce === self::getNonce($action)) { return true; } ...
php
public static function verifyNonce($nonce, $action) { //Safety check for multiple nonces if (is_array($nonce)) { $nonce = array_shift($nonce); } //Nonce generated 0-12 hours ago if ($nonce === self::getNonce($action)) { return true; } ...
[ "public", "static", "function", "verifyNonce", "(", "$", "nonce", ",", "$", "action", ")", "{", "//Safety check for multiple nonces", "if", "(", "is_array", "(", "$", "nonce", ")", ")", "{", "$", "nonce", "=", "array_shift", "(", "$", "nonce", ")", ";", ...
Verify the passed nonce for the give action @param string|string[] $nonce the nonce to verify @param string $action the action to verify the nonce to @return boolean verified or not
[ "Verify", "the", "passed", "nonce", "for", "the", "give", "action" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L1123-L1139
207,826
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.sortArrayByArray
public static function sortArrayByArray(array $array, array $orderArray) { $ordered = array(); foreach ($orderArray as $key) { if (array_key_exists($key, $array)) { $ordered[$key] = $array[$key]; unset($array[$key]); } } return ...
php
public static function sortArrayByArray(array $array, array $orderArray) { $ordered = array(); foreach ($orderArray as $key) { if (array_key_exists($key, $array)) { $ordered[$key] = $array[$key]; unset($array[$key]); } } return ...
[ "public", "static", "function", "sortArrayByArray", "(", "array", "$", "array", ",", "array", "$", "orderArray", ")", "{", "$", "ordered", "=", "array", "(", ")", ";", "foreach", "(", "$", "orderArray", "as", "$", "key", ")", "{", "if", "(", "array_key...
Sort a multidimensional array by another array of ordered keys @param array $array @param array $orderArray @return array
[ "Sort", "a", "multidimensional", "array", "by", "another", "array", "of", "ordered", "keys" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L1251-L1261
207,827
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.sortArrayByKey
public static function sortArrayByKey($array, $array_key, $direction = SORT_DESC, $sort_flags = SORT_REGULAR) { $output = []; if (!is_array($array) || !$array) { return $output; } foreach ($array as $key => $row) { $output[$key] = $row[$array_key]; }...
php
public static function sortArrayByKey($array, $array_key, $direction = SORT_DESC, $sort_flags = SORT_REGULAR) { $output = []; if (!is_array($array) || !$array) { return $output; } foreach ($array as $key => $row) { $output[$key] = $row[$array_key]; }...
[ "public", "static", "function", "sortArrayByKey", "(", "$", "array", ",", "$", "array_key", ",", "$", "direction", "=", "SORT_DESC", ",", "$", "sort_flags", "=", "SORT_REGULAR", ")", "{", "$", "output", "=", "[", "]", ";", "if", "(", "!", "is_array", "...
Sort an array by a key value in the array @param mixed $array @param string|int $array_key @param int $direction @param int $sort_flags @return array
[ "Sort", "an", "array", "by", "a", "key", "value", "in", "the", "array" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L1272-L1287
207,828
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.getPagePathFromToken
public static function getPagePathFromToken($path, PageInterface $page = null) { $path_parts = pathinfo($path); $grav = Grav::instance(); $basename = ''; if (isset($path_parts['extension'])) { $basename = '/' . $path_parts['basename']; $path = rtrim...
php
public static function getPagePathFromToken($path, PageInterface $page = null) { $path_parts = pathinfo($path); $grav = Grav::instance(); $basename = ''; if (isset($path_parts['extension'])) { $basename = '/' . $path_parts['basename']; $path = rtrim...
[ "public", "static", "function", "getPagePathFromToken", "(", "$", "path", ",", "PageInterface", "$", "page", "=", "null", ")", "{", "$", "path_parts", "=", "pathinfo", "(", "$", "path", ")", ";", "$", "grav", "=", "Grav", "::", "instance", "(", ")", ";...
Get's path based on a token @param string $path @param PageInterface|null $page @return string @throws \RuntimeException
[ "Get", "s", "path", "based", "on", "a", "token" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L1297-L1340
207,829
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.parseSize
public static function parseSize($size) { $unit = preg_replace('/[^bkmgtpezy]/i', '', $size); $size = preg_replace('/[^0-9\.]/', '', $size); if ($unit) { $size = $size * pow(1024, stripos('bkmgtpezy', $unit[0])); } return (int) abs(round($size)); }
php
public static function parseSize($size) { $unit = preg_replace('/[^bkmgtpezy]/i', '', $size); $size = preg_replace('/[^0-9\.]/', '', $size); if ($unit) { $size = $size * pow(1024, stripos('bkmgtpezy', $unit[0])); } return (int) abs(round($size)); }
[ "public", "static", "function", "parseSize", "(", "$", "size", ")", "{", "$", "unit", "=", "preg_replace", "(", "'/[^bkmgtpezy]/i'", ",", "''", ",", "$", "size", ")", ";", "$", "size", "=", "preg_replace", "(", "'/[^0-9\\.]/'", ",", "''", ",", "$", "si...
Parse a readable file size and return a value in bytes @param string|int $size @return int
[ "Parse", "a", "readable", "file", "size", "and", "return", "a", "value", "in", "bytes" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L1411-L1421
207,830
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.multibyteParseUrl
public static function multibyteParseUrl($url) { $enc_url = preg_replace_callback( '%[^:/@?&=#]+%usD', function ($matches) { return urlencode($matches[0]); }, $url ); $parts = parse_url($enc_url); if($parts === false) ...
php
public static function multibyteParseUrl($url) { $enc_url = preg_replace_callback( '%[^:/@?&=#]+%usD', function ($matches) { return urlencode($matches[0]); }, $url ); $parts = parse_url($enc_url); if($parts === false) ...
[ "public", "static", "function", "multibyteParseUrl", "(", "$", "url", ")", "{", "$", "enc_url", "=", "preg_replace_callback", "(", "'%[^:/@?&=#]+%usD'", ",", "function", "(", "$", "matches", ")", "{", "return", "urlencode", "(", "$", "matches", "[", "0", "]"...
Multibyte-safe Parse URL function @param string $url @return array @throws \InvalidArgumentException
[ "Multibyte", "-", "safe", "Parse", "URL", "function" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L1430-L1451
207,831
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.processMarkdown
public static function processMarkdown($string, $block = true) { $page = Grav::instance()['page'] ?? null; $defaults = Grav::instance()['config']->get('system.pages.markdown'); // Initialize the preferred variant of Parsedown if ($defaults['extra']) { $parsedown = ne...
php
public static function processMarkdown($string, $block = true) { $page = Grav::instance()['page'] ?? null; $defaults = Grav::instance()['config']->get('system.pages.markdown'); // Initialize the preferred variant of Parsedown if ($defaults['extra']) { $parsedown = ne...
[ "public", "static", "function", "processMarkdown", "(", "$", "string", ",", "$", "block", "=", "true", ")", "{", "$", "page", "=", "Grav", "::", "instance", "(", ")", "[", "'page'", "]", "??", "null", ";", "$", "defaults", "=", "Grav", "::", "instanc...
Process a string as markdown @param string $string @param bool $block Block or Line processing @return string
[ "Process", "a", "string", "as", "markdown" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L1461-L1480
207,832
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.getSubnet
public static function getSubnet($ip, $prefix = 64) { if (!filter_var($ip, FILTER_VALIDATE_IP)) { throw new \InvalidArgumentException('Invalid IP: ' . $ip); } // Packed representation of IP $ip = inet_pton($ip); // Maximum netmask length = same as packed address...
php
public static function getSubnet($ip, $prefix = 64) { if (!filter_var($ip, FILTER_VALIDATE_IP)) { throw new \InvalidArgumentException('Invalid IP: ' . $ip); } // Packed representation of IP $ip = inet_pton($ip); // Maximum netmask length = same as packed address...
[ "public", "static", "function", "getSubnet", "(", "$", "ip", ",", "$", "prefix", "=", "64", ")", "{", "if", "(", "!", "filter_var", "(", "$", "ip", ",", "FILTER_VALIDATE_IP", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Invalid...
Find the subnet of an ip with CIDR prefix size @param string $ip @param int $prefix @return string @throws \InvalidArgumentException if provided an invalid IP
[ "Find", "the", "subnet", "of", "an", "ip", "with", "CIDR", "prefix", "size" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L1491-L1520
207,833
getgrav/grav
system/src/Grav/Common/Data/Data.php
Data.blueprints
public function blueprints() { if (!$this->blueprints){ $this->blueprints = new Blueprint; } elseif (\is_callable($this->blueprints)) { // Lazy load blueprints. $blueprints = $this->blueprints; $this->blueprints = $blueprints(); } retur...
php
public function blueprints() { if (!$this->blueprints){ $this->blueprints = new Blueprint; } elseif (\is_callable($this->blueprints)) { // Lazy load blueprints. $blueprints = $this->blueprints; $this->blueprints = $blueprints(); } retur...
[ "public", "function", "blueprints", "(", ")", "{", "if", "(", "!", "$", "this", "->", "blueprints", ")", "{", "$", "this", "->", "blueprints", "=", "new", "Blueprint", ";", "}", "elseif", "(", "\\", "is_callable", "(", "$", "this", "->", "blueprints", ...
Return blueprints. @return Blueprint
[ "Return", "blueprints", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Data.php#L228-L238
207,834
getgrav/grav
system/src/Grav/Common/Debugger.php
Debugger.init
public function init() { if ($this->initialized) { return $this; } $this->grav = Grav::instance(); $this->config = $this->grav['config']; // Enable/disable debugger based on configuration. $this->enabled = (bool)$this->config->get('system.debugger.enable...
php
public function init() { if ($this->initialized) { return $this; } $this->grav = Grav::instance(); $this->config = $this->grav['config']; // Enable/disable debugger based on configuration. $this->enabled = (bool)$this->config->get('system.debugger.enable...
[ "public", "function", "init", "(", ")", "{", "if", "(", "$", "this", "->", "initialized", ")", "{", "return", "$", "this", ";", "}", "$", "this", "->", "grav", "=", "Grav", "::", "instance", "(", ")", ";", "$", "this", "->", "config", "=", "$", ...
Initialize the debugger @return $this @throws \DebugBar\DebugBarException
[ "Initialize", "the", "debugger" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Debugger.php#L92-L120
207,835
getgrav/grav
system/src/Grav/Common/Debugger.php
Debugger.addAssets
public function addAssets() { if ($this->enabled()) { // Only add assets if Page is HTML $page = $this->grav['page']; if ($page->templateFormat() !== 'html') { return $this; } /** @var Assets $assets */ $assets = $this...
php
public function addAssets() { if ($this->enabled()) { // Only add assets if Page is HTML $page = $this->grav['page']; if ($page->templateFormat() !== 'html') { return $this; } /** @var Assets $assets */ $assets = $this...
[ "public", "function", "addAssets", "(", ")", "{", "if", "(", "$", "this", "->", "enabled", "(", ")", ")", "{", "// Only add assets if Page is HTML", "$", "page", "=", "$", "this", "->", "grav", "[", "'page'", "]", ";", "if", "(", "$", "page", "->", "...
Add the debugger assets to the Grav Assets @return $this
[ "Add", "the", "debugger", "assets", "to", "the", "Grav", "Assets" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Debugger.php#L143-L176
207,836
getgrav/grav
system/src/Grav/Common/Debugger.php
Debugger.render
public function render() { if ($this->enabled()) { // Only add assets if Page is HTML $page = $this->grav['page']; if (!$this->renderer || $page->templateFormat() !== 'html') { return $this; } $this->addDeprecations(); ...
php
public function render() { if ($this->enabled()) { // Only add assets if Page is HTML $page = $this->grav['page']; if (!$this->renderer || $page->templateFormat() !== 'html') { return $this; } $this->addDeprecations(); ...
[ "public", "function", "render", "(", ")", "{", "if", "(", "$", "this", "->", "enabled", "(", ")", ")", "{", "// Only add assets if Page is HTML", "$", "page", "=", "$", "this", "->", "grav", "[", "'page'", "]", ";", "if", "(", "!", "$", "this", "->",...
Displays the debug bar @return $this
[ "Displays", "the", "debug", "bar" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Debugger.php#L218-L233
207,837
getgrav/grav
system/src/Grav/Common/Debugger.php
Debugger.getData
public function getData() { if (!$this->enabled()) { return null; } $this->addDeprecations(); $this->timers = []; return $this->debugbar->getData(); }
php
public function getData() { if (!$this->enabled()) { return null; } $this->addDeprecations(); $this->timers = []; return $this->debugbar->getData(); }
[ "public", "function", "getData", "(", ")", "{", "if", "(", "!", "$", "this", "->", "enabled", "(", ")", ")", "{", "return", "null", ";", "}", "$", "this", "->", "addDeprecations", "(", ")", ";", "$", "this", "->", "timers", "=", "[", "]", ";", ...
Returns collected debugger data. @return array
[ "Returns", "collected", "debugger", "data", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Debugger.php#L255-L265
207,838
getgrav/grav
system/src/Grav/Common/Debugger.php
Debugger.startTimer
public function startTimer($name, $description = null) { if (strpos($name, '_') === 0 || $this->enabled()) { $this->debugbar['time']->startMeasure($name, $description); $this->timers[] = $name; } return $this; }
php
public function startTimer($name, $description = null) { if (strpos($name, '_') === 0 || $this->enabled()) { $this->debugbar['time']->startMeasure($name, $description); $this->timers[] = $name; } return $this; }
[ "public", "function", "startTimer", "(", "$", "name", ",", "$", "description", "=", "null", ")", "{", "if", "(", "strpos", "(", "$", "name", ",", "'_'", ")", "===", "0", "||", "$", "this", "->", "enabled", "(", ")", ")", "{", "$", "this", "->", ...
Start a timer with an associated name and description @param string $name @param string|null $description @return $this
[ "Start", "a", "timer", "with", "an", "associated", "name", "and", "description" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Debugger.php#L275-L283
207,839
getgrav/grav
system/src/Grav/Common/Debugger.php
Debugger.stopTimer
public function stopTimer($name) { if (\in_array($name, $this->timers, true) && (strpos($name, '_') === 0 || $this->enabled())) { $this->debugbar['time']->stopMeasure($name); } return $this; }
php
public function stopTimer($name) { if (\in_array($name, $this->timers, true) && (strpos($name, '_') === 0 || $this->enabled())) { $this->debugbar['time']->stopMeasure($name); } return $this; }
[ "public", "function", "stopTimer", "(", "$", "name", ")", "{", "if", "(", "\\", "in_array", "(", "$", "name", ",", "$", "this", "->", "timers", ",", "true", ")", "&&", "(", "strpos", "(", "$", "name", ",", "'_'", ")", "===", "0", "||", "$", "th...
Stop the named timer @param string $name @return $this
[ "Stop", "the", "named", "timer" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Debugger.php#L292-L299
207,840
getgrav/grav
system/src/Grav/Common/Debugger.php
Debugger.addMessage
public function addMessage($message, $label = 'info', $isString = true) { if ($this->enabled()) { $this->debugbar['messages']->addMessage($message, $label, $isString); } return $this; }
php
public function addMessage($message, $label = 'info', $isString = true) { if ($this->enabled()) { $this->debugbar['messages']->addMessage($message, $label, $isString); } return $this; }
[ "public", "function", "addMessage", "(", "$", "message", ",", "$", "label", "=", "'info'", ",", "$", "isString", "=", "true", ")", "{", "if", "(", "$", "this", "->", "enabled", "(", ")", ")", "{", "$", "this", "->", "debugbar", "[", "'messages'", "...
Dump variables into the Messages tab of the Debug Bar @param mixed $message @param string $label @param bool $isString @return $this
[ "Dump", "variables", "into", "the", "Messages", "tab", "of", "the", "Debug", "Bar" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Debugger.php#L310-L317
207,841
getgrav/grav
system/src/Grav/Common/Debugger.php
Debugger.addException
public function addException(\Exception $e) { if ($this->initialized && $this->enabled()) { $this->debugbar['exceptions']->addException($e); } return $this; }
php
public function addException(\Exception $e) { if ($this->initialized && $this->enabled()) { $this->debugbar['exceptions']->addException($e); } return $this; }
[ "public", "function", "addException", "(", "\\", "Exception", "$", "e", ")", "{", "if", "(", "$", "this", "->", "initialized", "&&", "$", "this", "->", "enabled", "(", ")", ")", "{", "$", "this", "->", "debugbar", "[", "'exceptions'", "]", "->", "add...
Dump exception into the Messages tab of the Debug Bar @param \Exception $e @return Debugger
[ "Dump", "exception", "into", "the", "Messages", "tab", "of", "the", "Debug", "Bar" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Debugger.php#L325-L332
207,842
getgrav/grav
system/src/Grav/Common/User/FlexUser/UserCollection.php
UserCollection.delete
public function delete($username): bool { $user = $this->load($username); $exists = $user->exists(); if ($exists) { $user->delete(); } return $exists; }
php
public function delete($username): bool { $user = $this->load($username); $exists = $user->exists(); if ($exists) { $user->delete(); } return $exists; }
[ "public", "function", "delete", "(", "$", "username", ")", ":", "bool", "{", "$", "user", "=", "$", "this", "->", "load", "(", "$", "username", ")", ";", "$", "exists", "=", "$", "user", "->", "exists", "(", ")", ";", "if", "(", "$", "exists", ...
Delete user account. @param string $username @return bool True if user account was found and was deleted.
[ "Delete", "user", "account", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/FlexUser/UserCollection.php#L89-L99
207,843
getgrav/grav
system/src/Grav/Common/User/Group.php
Group.groupNames
public static function groupNames() { $groups = []; foreach(static::groups() as $groupname => $group) { $groups[$groupname] = $group['readableName'] ?? $groupname; } return $groups; }
php
public static function groupNames() { $groups = []; foreach(static::groups() as $groupname => $group) { $groups[$groupname] = $group['readableName'] ?? $groupname; } return $groups; }
[ "public", "static", "function", "groupNames", "(", ")", "{", "$", "groups", "=", "[", "]", ";", "foreach", "(", "static", "::", "groups", "(", ")", "as", "$", "groupname", "=>", "$", "group", ")", "{", "$", "groups", "[", "$", "groupname", "]", "="...
Get the groups list @return array
[ "Get", "the", "groups", "list" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/Group.php#L36-L45
207,844
getgrav/grav
system/src/Grav/Common/User/Group.php
Group.load
public static function load($groupname) { $groups = self::groups(); $content = $groups[$groupname] ?? []; $content += ['groupname' => $groupname]; $blueprints = new Blueprints(); $blueprint = $blueprints->get('user/group'); return new Group($content, $blueprint); ...
php
public static function load($groupname) { $groups = self::groups(); $content = $groups[$groupname] ?? []; $content += ['groupname' => $groupname]; $blueprints = new Blueprints(); $blueprint = $blueprints->get('user/group'); return new Group($content, $blueprint); ...
[ "public", "static", "function", "load", "(", "$", "groupname", ")", "{", "$", "groups", "=", "self", "::", "groups", "(", ")", ";", "$", "content", "=", "$", "groups", "[", "$", "groupname", "]", "??", "[", "]", ";", "$", "content", "+=", "[", "'...
Get a group by name @param string $groupname @return object
[ "Get", "a", "group", "by", "name" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/Group.php#L66-L77
207,845
getgrav/grav
system/src/Grav/Common/User/Group.php
Group.save
public function save() { $grav = Grav::instance(); /** @var Config $config */ $config = $grav['config']; $blueprints = new Blueprints(); $blueprint = $blueprints->get('user/group'); $config->set("groups.{$this->get('groupname')}", []); $fields = $blueprint...
php
public function save() { $grav = Grav::instance(); /** @var Config $config */ $config = $grav['config']; $blueprints = new Blueprints(); $blueprint = $blueprints->get('user/group'); $config->set("groups.{$this->get('groupname')}", []); $fields = $blueprint...
[ "public", "function", "save", "(", ")", "{", "$", "grav", "=", "Grav", "::", "instance", "(", ")", ";", "/** @var Config $config */", "$", "config", "=", "$", "grav", "[", "'config'", "]", ";", "$", "blueprints", "=", "new", "Blueprints", "(", ")", ";"...
Save a group
[ "Save", "a", "group" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/Group.php#L82-L122
207,846
getgrav/grav
system/src/Grav/Common/User/Group.php
Group.remove
public static function remove($groupname) { $grav = Grav::instance(); /** @var Config $config */ $config = $grav['config']; $blueprints = new Blueprints(); $blueprint = $blueprints->get('user/group'); $type = 'groups'; $groups = $config->get($type); ...
php
public static function remove($groupname) { $grav = Grav::instance(); /** @var Config $config */ $config = $grav['config']; $blueprints = new Blueprints(); $blueprint = $blueprints->get('user/group'); $type = 'groups'; $groups = $config->get($type); ...
[ "public", "static", "function", "remove", "(", "$", "groupname", ")", "{", "$", "grav", "=", "Grav", "::", "instance", "(", ")", ";", "/** @var Config $config */", "$", "config", "=", "$", "grav", "[", "'config'", "]", ";", "$", "blueprints", "=", "new",...
Remove a group @param string $groupname @return bool True if the action was performed
[ "Remove", "a", "group" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/Group.php#L131-L154
207,847
getgrav/grav
system/src/Grav/Common/Assets/Pipeline.php
Pipeline.renderCss
public function renderCss($assets, $group, $attributes = []) { // temporary list of assets to pipeline $inline_group = false; if (array_key_exists('loading', $attributes) && $attributes['loading'] === 'inline') { $inline_group = true; unset($attributes['loading']); ...
php
public function renderCss($assets, $group, $attributes = []) { // temporary list of assets to pipeline $inline_group = false; if (array_key_exists('loading', $attributes) && $attributes['loading'] === 'inline') { $inline_group = true; unset($attributes['loading']); ...
[ "public", "function", "renderCss", "(", "$", "assets", ",", "$", "group", ",", "$", "attributes", "=", "[", "]", ")", "{", "// temporary list of assets to pipeline", "$", "inline_group", "=", "false", ";", "if", "(", "array_key_exists", "(", "'loading'", ",", ...
Minify and concatenate CSS @param array $assets @param string $group @param array $attributes @return bool|string URL or generated content if available, else false
[ "Minify", "and", "concatenate", "CSS" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Assets/Pipeline.php#L94-L147
207,848
getgrav/grav
system/src/Grav/Common/Assets/Pipeline.php
Pipeline.renderJs
public function renderJs($assets, $group, $attributes = []) { // temporary list of assets to pipeline $inline_group = false; if (array_key_exists('loading', $attributes) && $attributes['loading'] === 'inline') { $inline_group = true; unset($attributes['loading']); ...
php
public function renderJs($assets, $group, $attributes = []) { // temporary list of assets to pipeline $inline_group = false; if (array_key_exists('loading', $attributes) && $attributes['loading'] === 'inline') { $inline_group = true; unset($attributes['loading']); ...
[ "public", "function", "renderJs", "(", "$", "assets", ",", "$", "group", ",", "$", "attributes", "=", "[", "]", ")", "{", "// temporary list of assets to pipeline", "$", "inline_group", "=", "false", ";", "if", "(", "array_key_exists", "(", "'loading'", ",", ...
Minify and concatenate JS files. @param array $assets @param string $group @param array $attributes @return bool|string URL or generated content if available, else false
[ "Minify", "and", "concatenate", "JS", "files", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Assets/Pipeline.php#L158-L211
207,849
getgrav/grav
system/src/Grav/Common/Media/Traits/MediaTrait.php
MediaTrait.getMediaUri
public function getMediaUri() { $folder = $this->getMediaFolder(); if (strpos($folder, '://')) { return $folder; } /** @var UniformResourceLocator $locator */ $locator = Grav::instance()['locator']; $user = $locator->findResource('user://'); if (strpos($...
php
public function getMediaUri() { $folder = $this->getMediaFolder(); if (strpos($folder, '://')) { return $folder; } /** @var UniformResourceLocator $locator */ $locator = Grav::instance()['locator']; $user = $locator->findResource('user://'); if (strpos($...
[ "public", "function", "getMediaUri", "(", ")", "{", "$", "folder", "=", "$", "this", "->", "getMediaFolder", "(", ")", ";", "if", "(", "strpos", "(", "$", "folder", ",", "'://'", ")", ")", "{", "return", "$", "folder", ";", "}", "/** @var UniformResour...
Get URI ot the associated media. Method will return null if path isn't URI. @return null|string
[ "Get", "URI", "ot", "the", "associated", "media", ".", "Method", "will", "return", "null", "if", "path", "isn", "t", "URI", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Media/Traits/MediaTrait.php#L45-L61
207,850
getgrav/grav
system/src/Grav/Common/Media/Traits/MediaTrait.php
MediaTrait.getMedia
public function getMedia() { if ($this->media === null) { $cache = $this->getMediaCache(); // Use cached media if possible. $cacheKey = md5('media' . $this->getCacheKey()); if (!$media = $cache->get($cacheKey)) { $media = new Media($this->getM...
php
public function getMedia() { if ($this->media === null) { $cache = $this->getMediaCache(); // Use cached media if possible. $cacheKey = md5('media' . $this->getCacheKey()); if (!$media = $cache->get($cacheKey)) { $media = new Media($this->getM...
[ "public", "function", "getMedia", "(", ")", "{", "if", "(", "$", "this", "->", "media", "===", "null", ")", "{", "$", "cache", "=", "$", "this", "->", "getMediaCache", "(", ")", ";", "// Use cached media if possible.", "$", "cacheKey", "=", "md5", "(", ...
Gets the associated media collection. @return MediaCollectionInterface Representation of associated media.
[ "Gets", "the", "associated", "media", "collection", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Media/Traits/MediaTrait.php#L68-L83
207,851
getgrav/grav
system/src/Grav/Common/Media/Traits/MediaTrait.php
MediaTrait.setMedia
protected function setMedia(MediaCollectionInterface $media) { $cache = $this->getMediaCache(); $cacheKey = md5('media' . $this->getCacheKey()); $cache->set($cacheKey, $media); $this->media = $media; return $this; }
php
protected function setMedia(MediaCollectionInterface $media) { $cache = $this->getMediaCache(); $cacheKey = md5('media' . $this->getCacheKey()); $cache->set($cacheKey, $media); $this->media = $media; return $this; }
[ "protected", "function", "setMedia", "(", "MediaCollectionInterface", "$", "media", ")", "{", "$", "cache", "=", "$", "this", "->", "getMediaCache", "(", ")", ";", "$", "cacheKey", "=", "md5", "(", "'media'", ".", "$", "this", "->", "getCacheKey", "(", "...
Sets the associated media collection. @param MediaCollectionInterface $media Representation of associated media. @return $this
[ "Sets", "the", "associated", "media", "collection", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Media/Traits/MediaTrait.php#L91-L100
207,852
getgrav/grav
system/src/Grav/Common/Media/Traits/MediaTrait.php
MediaTrait.clearMediaCache
protected function clearMediaCache() { $cache = $this->getMediaCache(); $cacheKey = md5('media' . $this->getCacheKey()); $cache->delete($cacheKey); $this->media = null; }
php
protected function clearMediaCache() { $cache = $this->getMediaCache(); $cacheKey = md5('media' . $this->getCacheKey()); $cache->delete($cacheKey); $this->media = null; }
[ "protected", "function", "clearMediaCache", "(", ")", "{", "$", "cache", "=", "$", "this", "->", "getMediaCache", "(", ")", ";", "$", "cacheKey", "=", "md5", "(", "'media'", ".", "$", "this", "->", "getCacheKey", "(", ")", ")", ";", "$", "cache", "->...
Clear media cache.
[ "Clear", "media", "cache", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Media/Traits/MediaTrait.php#L105-L112
207,853
getgrav/grav
system/src/Grav/Common/Page/Medium/Medium.php
Medium.modified
public function modified() { $path = $this->get('filepath'); if (!file_exists($path)) { return null; } return filemtime($path) ?: null; }
php
public function modified() { $path = $this->get('filepath'); if (!file_exists($path)) { return null; } return filemtime($path) ?: null; }
[ "public", "function", "modified", "(", ")", "{", "$", "path", "=", "$", "this", "->", "get", "(", "'filepath'", ")", ";", "if", "(", "!", "file_exists", "(", "$", "path", ")", ")", "{", "return", "null", ";", "}", "return", "filemtime", "(", "$", ...
Get file modification time for the medium. @return int|null
[ "Get", "file", "modification", "time", "for", "the", "medium", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/Medium.php#L135-L144
207,854
getgrav/grav
system/src/Grav/Common/Page/Medium/Medium.php
Medium.addMetaFile
public function addMetaFile($filepath) { $this->metadata = (array)CompiledYamlFile::instance($filepath)->content(); $this->merge($this->metadata); }
php
public function addMetaFile($filepath) { $this->metadata = (array)CompiledYamlFile::instance($filepath)->content(); $this->merge($this->metadata); }
[ "public", "function", "addMetaFile", "(", "$", "filepath", ")", "{", "$", "this", "->", "metadata", "=", "(", "array", ")", "CompiledYamlFile", "::", "instance", "(", "$", "filepath", ")", "->", "content", "(", ")", ";", "$", "this", "->", "merge", "("...
Add meta file for the medium. @param string $filepath
[ "Add", "meta", "file", "for", "the", "medium", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/Medium.php#L188-L192
207,855
getgrav/grav
system/src/Grav/Common/Page/Medium/Medium.php
Medium.addAlternative
public function addAlternative($ratio, Medium $alternative) { if (!is_numeric($ratio) || $ratio === 0) { return; } $alternative->set('ratio', $ratio); $width = $alternative->get('width'); $this->alternatives[$width] = $alternative; }
php
public function addAlternative($ratio, Medium $alternative) { if (!is_numeric($ratio) || $ratio === 0) { return; } $alternative->set('ratio', $ratio); $width = $alternative->get('width'); $this->alternatives[$width] = $alternative; }
[ "public", "function", "addAlternative", "(", "$", "ratio", ",", "Medium", "$", "alternative", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "ratio", ")", "||", "$", "ratio", "===", "0", ")", "{", "return", ";", "}", "$", "alternative", "->", "set...
Add alternative Medium to this Medium. @param int|float $ratio @param Medium $alternative
[ "Add", "alternative", "Medium", "to", "this", "Medium", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/Medium.php#L200-L210
207,856
getgrav/grav
system/src/Grav/Common/Page/Medium/Medium.php
Medium.relativePath
public function relativePath($reset = true) { $output = preg_replace('|^' . preg_quote(GRAV_ROOT, '|') . '|', '', $this->get('filepath')); $locator = Grav::instance()['locator']; if ($locator->isStream($output)) { $output = $locator->findResource($output, false); } ...
php
public function relativePath($reset = true) { $output = preg_replace('|^' . preg_quote(GRAV_ROOT, '|') . '|', '', $this->get('filepath')); $locator = Grav::instance()['locator']; if ($locator->isStream($output)) { $output = $locator->findResource($output, false); } ...
[ "public", "function", "relativePath", "(", "$", "reset", "=", "true", ")", "{", "$", "output", "=", "preg_replace", "(", "'|^'", ".", "preg_quote", "(", "GRAV_ROOT", ",", "'|'", ")", ".", "'|'", ",", "''", ",", "$", "this", "->", "get", "(", "'filepa...
Return the relative path to file @param bool $reset @return mixed
[ "Return", "the", "relative", "path", "to", "file" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/Medium.php#L243-L257
207,857
getgrav/grav
system/src/Grav/Common/Page/Medium/Medium.php
Medium.url
public function url($reset = true) { $output = preg_replace('|^' . preg_quote(GRAV_ROOT, '|') . '|', '', $this->get('filepath')); $locator = Grav::instance()['locator']; if ($locator->isStream($output)) { $output = $locator->findResource($output, false); } if ($...
php
public function url($reset = true) { $output = preg_replace('|^' . preg_quote(GRAV_ROOT, '|') . '|', '', $this->get('filepath')); $locator = Grav::instance()['locator']; if ($locator->isStream($output)) { $output = $locator->findResource($output, false); } if ($...
[ "public", "function", "url", "(", "$", "reset", "=", "true", ")", "{", "$", "output", "=", "preg_replace", "(", "'|^'", ".", "preg_quote", "(", "GRAV_ROOT", ",", "'|'", ")", ".", "'|'", ",", "''", ",", "$", "this", "->", "get", "(", "'filepath'", "...
Return URL to file. @param bool $reset @return string
[ "Return", "URL", "to", "file", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/Medium.php#L265-L279
207,858
getgrav/grav
system/src/Grav/Common/Page/Medium/Medium.php
Medium.urlQuerystring
public function urlQuerystring($url) { $querystring = $this->querystring(); if (isset($this->timestamp) && !Utils::contains($querystring, $this->timestamp)) { $querystring = empty($querystring) ? ('?' . $this->timestamp) : ($querystring . '&' . $this->timestamp); } retur...
php
public function urlQuerystring($url) { $querystring = $this->querystring(); if (isset($this->timestamp) && !Utils::contains($querystring, $this->timestamp)) { $querystring = empty($querystring) ? ('?' . $this->timestamp) : ($querystring . '&' . $this->timestamp); } retur...
[ "public", "function", "urlQuerystring", "(", "$", "url", ")", "{", "$", "querystring", "=", "$", "this", "->", "querystring", "(", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "timestamp", ")", "&&", "!", "Utils", "::", "contains", "(", "$",...
Get the URL with full querystring @param string $url @return string
[ "Get", "the", "URL", "with", "full", "querystring" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/Medium.php#L317-L325
207,859
getgrav/grav
system/src/Grav/Common/Page/Medium/Medium.php
Medium.textParsedownElement
protected function textParsedownElement(array $attributes, $reset = true) { $text = empty($attributes['title']) ? empty($attributes['alt']) ? $this->get('filename') : $attributes['alt'] : $attributes['title']; $element = [ 'name' => 'p', 'attributes' => $attributes, ...
php
protected function textParsedownElement(array $attributes, $reset = true) { $text = empty($attributes['title']) ? empty($attributes['alt']) ? $this->get('filename') : $attributes['alt'] : $attributes['title']; $element = [ 'name' => 'p', 'attributes' => $attributes, ...
[ "protected", "function", "textParsedownElement", "(", "array", "$", "attributes", ",", "$", "reset", "=", "true", ")", "{", "$", "text", "=", "empty", "(", "$", "attributes", "[", "'title'", "]", ")", "?", "empty", "(", "$", "attributes", "[", "'alt'", ...
Parsedown element for text display mode @param array $attributes @param bool $reset @return array
[ "Parsedown", "element", "for", "text", "display", "mode" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/Medium.php#L448-L463
207,860
getgrav/grav
system/src/Grav/Common/Page/Medium/Medium.php
Medium.display
public function display($mode = 'source') { if ($this->mode === $mode) { return $this; } $this->mode = $mode; return $mode === 'thumbnail' ? ($this->getThumbnail() ? $this->getThumbnail()->reset() : null) : $this->reset(); }
php
public function display($mode = 'source') { if ($this->mode === $mode) { return $this; } $this->mode = $mode; return $mode === 'thumbnail' ? ($this->getThumbnail() ? $this->getThumbnail()->reset() : null) : $this->reset(); }
[ "public", "function", "display", "(", "$", "mode", "=", "'source'", ")", "{", "if", "(", "$", "this", "->", "mode", "===", "$", "mode", ")", "{", "return", "$", "this", ";", "}", "$", "this", "->", "mode", "=", "$", "mode", ";", "return", "$", ...
Switch display mode. @param string $mode @return $this
[ "Switch", "display", "mode", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/Medium.php#L483-L493
207,861
getgrav/grav
system/src/Grav/Common/Page/Medium/Medium.php
Medium.thumbnailExists
public function thumbnailExists($type = 'page') { $thumbs = $this->get('thumbnails'); if (isset($thumbs[$type])) { return true; } return false; }
php
public function thumbnailExists($type = 'page') { $thumbs = $this->get('thumbnails'); if (isset($thumbs[$type])) { return true; } return false; }
[ "public", "function", "thumbnailExists", "(", "$", "type", "=", "'page'", ")", "{", "$", "thumbs", "=", "$", "this", "->", "get", "(", "'thumbnails'", ")", ";", "if", "(", "isset", "(", "$", "thumbs", "[", "$", "type", "]", ")", ")", "{", "return",...
Helper method to determine if this media item has a thumbnail or not @param string $type; @return bool
[ "Helper", "method", "to", "determine", "if", "this", "media", "item", "has", "a", "thumbnail", "or", "not" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/Medium.php#L502-L509
207,862
getgrav/grav
system/src/Grav/Common/Page/Medium/Medium.php
Medium.thumbnail
public function thumbnail($type = 'auto') { if ($type !== 'auto' && !\in_array($type, $this->thumbnailTypes, true)) { return $this; } if ($this->thumbnailType !== $type) { $this->_thumbnail = null; } $this->thumbnailType = $type; return $thi...
php
public function thumbnail($type = 'auto') { if ($type !== 'auto' && !\in_array($type, $this->thumbnailTypes, true)) { return $this; } if ($this->thumbnailType !== $type) { $this->_thumbnail = null; } $this->thumbnailType = $type; return $thi...
[ "public", "function", "thumbnail", "(", "$", "type", "=", "'auto'", ")", "{", "if", "(", "$", "type", "!==", "'auto'", "&&", "!", "\\", "in_array", "(", "$", "type", ",", "$", "this", "->", "thumbnailTypes", ",", "true", ")", ")", "{", "return", "$...
Switch thumbnail. @param string $type @return $this
[ "Switch", "thumbnail", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/Medium.php#L518-L531
207,863
getgrav/grav
system/src/Grav/Common/Page/Medium/Medium.php
Medium.getThumbnail
protected function getThumbnail() { if (!$this->_thumbnail) { $types = $this->thumbnailTypes; if ($this->thumbnailType !== 'auto') { array_unshift($types, $this->thumbnailType); } foreach ($types as $type) { $thumb = $this->ge...
php
protected function getThumbnail() { if (!$this->_thumbnail) { $types = $this->thumbnailTypes; if ($this->thumbnailType !== 'auto') { array_unshift($types, $this->thumbnailType); } foreach ($types as $type) { $thumb = $this->ge...
[ "protected", "function", "getThumbnail", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_thumbnail", ")", "{", "$", "types", "=", "$", "this", "->", "thumbnailTypes", ";", "if", "(", "$", "this", "->", "thumbnailType", "!==", "'auto'", ")", "{", ...
Get the thumbnail Medium object @return ThumbnailImageMedium
[ "Get", "the", "thumbnail", "Medium", "object" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/Medium.php#L652-L677
207,864
getgrav/grav
system/src/Grav/Common/Config/ConfigFileFinder.php
ConfigFileFinder.listFiles
public function listFiles(array $paths, $pattern = '|\.yaml$|', $levels = -1) { $list = []; foreach ($paths as $folder) { $list = array_merge_recursive($list, $this->detectAll($folder, $pattern, $levels)); } return $list; }
php
public function listFiles(array $paths, $pattern = '|\.yaml$|', $levels = -1) { $list = []; foreach ($paths as $folder) { $list = array_merge_recursive($list, $this->detectAll($folder, $pattern, $levels)); } return $list; }
[ "public", "function", "listFiles", "(", "array", "$", "paths", ",", "$", "pattern", "=", "'|\\.yaml$|'", ",", "$", "levels", "=", "-", "1", ")", "{", "$", "list", "=", "[", "]", ";", "foreach", "(", "$", "paths", "as", "$", "folder", ")", "{", "$...
Return all paths for all the files with a timestamp. @param array $paths List of folders to look from. @param string $pattern Pattern to match the file. Pattern will also be removed from the key. @param int $levels Maximum number of recursive directories. @return array
[ "Return", "all", "paths", "for", "all", "the", "files", "with", "a", "timestamp", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Config/ConfigFileFinder.php#L75-L82
207,865
getgrav/grav
system/src/Grav/Common/Config/ConfigFileFinder.php
ConfigFileFinder.locateFile
public function locateFile(array $paths, $name, $ext = '.yaml') { $filename = preg_replace('|[.\/]+|', '/', $name) . $ext; $list = []; foreach ($paths as $folder) { $path = trim(Folder::getRelativePath($folder), '/'); if (is_file("{$folder}/{$filename}")) { ...
php
public function locateFile(array $paths, $name, $ext = '.yaml') { $filename = preg_replace('|[.\/]+|', '/', $name) . $ext; $list = []; foreach ($paths as $folder) { $path = trim(Folder::getRelativePath($folder), '/'); if (is_file("{$folder}/{$filename}")) { ...
[ "public", "function", "locateFile", "(", "array", "$", "paths", ",", "$", "name", ",", "$", "ext", "=", "'.yaml'", ")", "{", "$", "filename", "=", "preg_replace", "(", "'|[.\\/]+|'", ",", "'/'", ",", "$", "name", ")", ".", "$", "ext", ";", "$", "li...
Return all existing locations for a single file with a timestamp. @param array $paths Filesystem paths to look up from. @param string $name Configuration file to be located. @param string $ext File extension (optional, defaults to .yaml). @return array
[ "Return", "all", "existing", "locations", "for", "a", "single", "file", "with", "a", "timestamp", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Config/ConfigFileFinder.php#L127-L145
207,866
getgrav/grav
system/src/Grav/Common/Config/ConfigFileFinder.php
ConfigFileFinder.detectRecursive
protected function detectRecursive($folder, $pattern, $levels) { $path = trim(Folder::getRelativePath($folder), '/'); if (is_dir($folder)) { // Find all system and user configuration files. $options = [ 'levels' => $levels, 'compare' => 'File...
php
protected function detectRecursive($folder, $pattern, $levels) { $path = trim(Folder::getRelativePath($folder), '/'); if (is_dir($folder)) { // Find all system and user configuration files. $options = [ 'levels' => $levels, 'compare' => 'File...
[ "protected", "function", "detectRecursive", "(", "$", "folder", ",", "$", "pattern", ",", "$", "levels", ")", "{", "$", "path", "=", "trim", "(", "Folder", "::", "getRelativePath", "(", "$", "folder", ")", ",", "'/'", ")", ";", "if", "(", "is_dir", "...
Detects all directories with a configuration file and returns them with last modification time. @param string $folder Location to look up from. @param string $pattern Pattern to match the file. Pattern will also be removed from the key. @param int $levels Maximum number of recursive directories. @return arr...
[ "Detects", "all", "directories", "with", "a", "configuration", "file", "and", "returns", "them", "with", "last", "modification", "time", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Config/ConfigFileFinder.php#L156-L184
207,867
getgrav/grav
system/src/Grav/Common/Config/ConfigFileFinder.php
ConfigFileFinder.detectInFolder
protected function detectInFolder($folder, $lookup = null) { $folder = rtrim($folder, '/'); $path = trim(Folder::getRelativePath($folder), '/'); $base = $path === $folder ? '' : ($path ? substr($folder, 0, -strlen($path)) : $folder . '/'); $list = []; if (is_dir($folder)) {...
php
protected function detectInFolder($folder, $lookup = null) { $folder = rtrim($folder, '/'); $path = trim(Folder::getRelativePath($folder), '/'); $base = $path === $folder ? '' : ($path ? substr($folder, 0, -strlen($path)) : $folder . '/'); $list = []; if (is_dir($folder)) {...
[ "protected", "function", "detectInFolder", "(", "$", "folder", ",", "$", "lookup", "=", "null", ")", "{", "$", "folder", "=", "rtrim", "(", "$", "folder", ",", "'/'", ")", ";", "$", "path", "=", "trim", "(", "Folder", "::", "getRelativePath", "(", "$...
Detects all directories with the lookup file and returns them with last modification time. @param string $folder Location to look up from. @param string $lookup Filename to be located (defaults to directory name). @return array @internal
[ "Detects", "all", "directories", "with", "the", "lookup", "file", "and", "returns", "them", "with", "last", "modification", "time", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Config/ConfigFileFinder.php#L194-L223
207,868
getgrav/grav
system/src/Grav/Common/Page/Medium/StaticResizeTrait.php
StaticResizeTrait.resize
public function resize($width = null, $height = null) { $this->styleAttributes['width'] = $width . 'px'; $this->styleAttributes['height'] = $height . 'px'; return $this; }
php
public function resize($width = null, $height = null) { $this->styleAttributes['width'] = $width . 'px'; $this->styleAttributes['height'] = $height . 'px'; return $this; }
[ "public", "function", "resize", "(", "$", "width", "=", "null", ",", "$", "height", "=", "null", ")", "{", "$", "this", "->", "styleAttributes", "[", "'width'", "]", "=", "$", "width", ".", "'px'", ";", "$", "this", "->", "styleAttributes", "[", "'he...
Resize media by setting attributes @param int $width @param int $height @return $this
[ "Resize", "media", "by", "setting", "attributes" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/StaticResizeTrait.php#L21-L27
207,869
getgrav/grav
system/src/Grav/Framework/RequestHandler/RequestHandler.php
RequestHandler.addCallable
public function addCallable(string $name, callable $callable): self { $this->container[$name] = $callable; array_unshift($this->middleware, $name); return $this; }
php
public function addCallable(string $name, callable $callable): self { $this->container[$name] = $callable; array_unshift($this->middleware, $name); return $this; }
[ "public", "function", "addCallable", "(", "string", "$", "name", ",", "callable", "$", "callable", ")", ":", "self", "{", "$", "this", "->", "container", "[", "$", "name", "]", "=", "$", "callable", ";", "array_unshift", "(", "$", "this", "->", "middle...
Add callable initializing Middleware that will be executed as soon as possible. @param string $name @param callable $callable @return $this
[ "Add", "callable", "initializing", "Middleware", "that", "will", "be", "executed", "as", "soon", "as", "possible", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/RequestHandler/RequestHandler.php#L44-L50
207,870
getgrav/grav
system/src/Grav/Framework/RequestHandler/RequestHandler.php
RequestHandler.addMiddleware
public function addMiddleware(string $name, MiddlewareInterface $middleware): self { $this->container[$name] = $middleware; array_unshift($this->middleware, $name); return $this; }
php
public function addMiddleware(string $name, MiddlewareInterface $middleware): self { $this->container[$name] = $middleware; array_unshift($this->middleware, $name); return $this; }
[ "public", "function", "addMiddleware", "(", "string", "$", "name", ",", "MiddlewareInterface", "$", "middleware", ")", ":", "self", "{", "$", "this", "->", "container", "[", "$", "name", "]", "=", "$", "middleware", ";", "array_unshift", "(", "$", "this", ...
Add Middleware that will be executed as soon as possible. @param string $name @param MiddlewareInterface $middleware @return $this
[ "Add", "Middleware", "that", "will", "be", "executed", "as", "soon", "as", "possible", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/RequestHandler/RequestHandler.php#L59-L65
207,871
getgrav/grav
system/src/Grav/Common/Markdown/ParsedownGravTrait.php
ParsedownGravTrait.init
protected function init($page, $defaults) { $grav = Grav::instance(); $this->page = $page; $this->BlockTypes['{'] [] = 'TwigTag'; $this->special_chars = ['>' => 'gt', '<' => 'lt', '"' => 'quot']; if ($defaults === null) { $defaults = (array)Grav::instance()['con...
php
protected function init($page, $defaults) { $grav = Grav::instance(); $this->page = $page; $this->BlockTypes['{'] [] = 'TwigTag'; $this->special_chars = ['>' => 'gt', '<' => 'lt', '"' => 'quot']; if ($defaults === null) { $defaults = (array)Grav::instance()['con...
[ "protected", "function", "init", "(", "$", "page", ",", "$", "defaults", ")", "{", "$", "grav", "=", "Grav", "::", "instance", "(", ")", ";", "$", "this", "->", "page", "=", "$", "page", ";", "$", "this", "->", "BlockTypes", "[", "'{'", "]", "[",...
Initialization function to setup key variables needed by the MarkdownGravLinkTrait @param PageInterface $page @param array|null $defaults
[ "Initialization", "function", "to", "setup", "key", "variables", "needed", "by", "the", "MarkdownGravLinkTrait" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Markdown/ParsedownGravTrait.php#L34-L53
207,872
getgrav/grav
system/src/Grav/Common/Markdown/ParsedownGravTrait.php
ParsedownGravTrait.addBlockType
public function addBlockType($type, $tag, $continuable = false, $completable = false, $index = null) { $block = &$this->unmarkedBlockTypes; if ($type) { if (!isset($this->BlockTypes[$type])) { $this->BlockTypes[$type] = []; } $block = &$this->Block...
php
public function addBlockType($type, $tag, $continuable = false, $completable = false, $index = null) { $block = &$this->unmarkedBlockTypes; if ($type) { if (!isset($this->BlockTypes[$type])) { $this->BlockTypes[$type] = []; } $block = &$this->Block...
[ "public", "function", "addBlockType", "(", "$", "type", ",", "$", "tag", ",", "$", "continuable", "=", "false", ",", "$", "completable", "=", "false", ",", "$", "index", "=", "null", ")", "{", "$", "block", "=", "&", "$", "this", "->", "unmarkedBlock...
Be able to define a new Block type or override an existing one @param string $type @param string $tag @param bool $continuable @param bool $completable @param int|null $index
[ "Be", "able", "to", "define", "a", "new", "Block", "type", "or", "override", "an", "existing", "one" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Markdown/ParsedownGravTrait.php#L64-L86
207,873
getgrav/grav
system/src/Grav/Common/Markdown/ParsedownGravTrait.php
ParsedownGravTrait.addInlineType
public function addInlineType($type, $tag, $index = null) { if (null === $index || !isset($this->InlineTypes[$type])) { $this->InlineTypes[$type] [] = $tag; } else { array_splice($this->InlineTypes[$type], $index, 0, [$tag]); } if (strpos($this->inlineMarkerL...
php
public function addInlineType($type, $tag, $index = null) { if (null === $index || !isset($this->InlineTypes[$type])) { $this->InlineTypes[$type] [] = $tag; } else { array_splice($this->InlineTypes[$type], $index, 0, [$tag]); } if (strpos($this->inlineMarkerL...
[ "public", "function", "addInlineType", "(", "$", "type", ",", "$", "tag", ",", "$", "index", "=", "null", ")", "{", "if", "(", "null", "===", "$", "index", "||", "!", "isset", "(", "$", "this", "->", "InlineTypes", "[", "$", "type", "]", ")", ")"...
Be able to define a new Inline type or override an existing one @param string $type @param string $tag @param int|null $index
[ "Be", "able", "to", "define", "a", "new", "Inline", "type", "or", "override", "an", "existing", "one" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Markdown/ParsedownGravTrait.php#L95-L106
207,874
getgrav/grav
system/src/Grav/Common/Markdown/ParsedownGravTrait.php
ParsedownGravTrait.isBlockContinuable
protected function isBlockContinuable($Type) { $continuable = \in_array($Type, $this->continuable_blocks) || method_exists($this, 'block' . $Type . 'Continue'); return $continuable; }
php
protected function isBlockContinuable($Type) { $continuable = \in_array($Type, $this->continuable_blocks) || method_exists($this, 'block' . $Type . 'Continue'); return $continuable; }
[ "protected", "function", "isBlockContinuable", "(", "$", "Type", ")", "{", "$", "continuable", "=", "\\", "in_array", "(", "$", "Type", ",", "$", "this", "->", "continuable_blocks", ")", "||", "method_exists", "(", "$", "this", ",", "'block'", ".", "$", ...
Overrides the default behavior to allow for plugin-provided blocks to be continuable @param string $Type @return bool
[ "Overrides", "the", "default", "behavior", "to", "allow", "for", "plugin", "-", "provided", "blocks", "to", "be", "continuable" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Markdown/ParsedownGravTrait.php#L115-L120
207,875
getgrav/grav
system/src/Grav/Common/Markdown/ParsedownGravTrait.php
ParsedownGravTrait.isBlockCompletable
protected function isBlockCompletable($Type) { $completable = \in_array($Type, $this->completable_blocks) || method_exists($this, 'block' . $Type . 'Complete'); return $completable; }
php
protected function isBlockCompletable($Type) { $completable = \in_array($Type, $this->completable_blocks) || method_exists($this, 'block' . $Type . 'Complete'); return $completable; }
[ "protected", "function", "isBlockCompletable", "(", "$", "Type", ")", "{", "$", "completable", "=", "\\", "in_array", "(", "$", "Type", ",", "$", "this", "->", "completable_blocks", ")", "||", "method_exists", "(", "$", "this", ",", "'block'", ".", "$", ...
Overrides the default behavior to allow for plugin-provided blocks to be completable @param string $Type @return bool
[ "Overrides", "the", "default", "behavior", "to", "allow", "for", "plugin", "-", "provided", "blocks", "to", "be", "completable" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Markdown/ParsedownGravTrait.php#L129-L134
207,876
getgrav/grav
system/src/Grav/Console/Gpm/InstallCommand.php
InstallCommand.askConfirmationIfMajorVersionUpdated
public function askConfirmationIfMajorVersionUpdated($package) { $helper = $this->getHelper('question'); $package_name = $package->name; $new_version = $package->available ?: $this->gpm->getLatestVersionOfPackage($package->slug); $old_version = $package->version; $major_vers...
php
public function askConfirmationIfMajorVersionUpdated($package) { $helper = $this->getHelper('question'); $package_name = $package->name; $new_version = $package->available ?: $this->gpm->getLatestVersionOfPackage($package->slug); $old_version = $package->version; $major_vers...
[ "public", "function", "askConfirmationIfMajorVersionUpdated", "(", "$", "package", ")", "{", "$", "helper", "=", "$", "this", "->", "getHelper", "(", "'question'", ")", ";", "$", "package_name", "=", "$", "package", "->", "name", ";", "$", "new_version", "="...
If the package is updated from an older major release, show warning and ask confirmation @param Package $package
[ "If", "the", "package", "is", "updated", "from", "an", "older", "major", "release", "show", "warning", "and", "ask", "confirmation" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Console/Gpm/InstallCommand.php#L235-L257
207,877
getgrav/grav
system/src/Grav/Console/Gpm/InstallCommand.php
InstallCommand.processDemo
private function processDemo($package) { $demo_dir = $this->destination . DS . $package->install_path . DS . '_demo'; if (file_exists($demo_dir)) { $this->demo_processing[] = $package; } }
php
private function processDemo($package) { $demo_dir = $this->destination . DS . $package->install_path . DS . '_demo'; if (file_exists($demo_dir)) { $this->demo_processing[] = $package; } }
[ "private", "function", "processDemo", "(", "$", "package", ")", "{", "$", "demo_dir", "=", "$", "this", "->", "destination", ".", "DS", ".", "$", "package", "->", "install_path", ".", "DS", ".", "'_demo'", ";", "if", "(", "file_exists", "(", "$", "demo...
Add package to the queue to process the demo content, if demo content exists @param Package $package
[ "Add", "package", "to", "the", "queue", "to", "process", "the", "demo", "content", "if", "demo", "content", "exists" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Console/Gpm/InstallCommand.php#L349-L355
207,878
getgrav/grav
system/src/Grav/Console/Gpm/InstallCommand.php
InstallCommand.installDemoContent
private function installDemoContent($package) { $demo_dir = $this->destination . DS . $package->install_path . DS . '_demo'; if (file_exists($demo_dir)) { $dest_dir = $this->destination . DS . 'user'; $pages_dir = $dest_dir . DS . 'pages'; // Demo content exists...
php
private function installDemoContent($package) { $demo_dir = $this->destination . DS . $package->install_path . DS . '_demo'; if (file_exists($demo_dir)) { $dest_dir = $this->destination . DS . 'user'; $pages_dir = $dest_dir . DS . 'pages'; // Demo content exists...
[ "private", "function", "installDemoContent", "(", "$", "package", ")", "{", "$", "demo_dir", "=", "$", "this", "->", "destination", ".", "DS", ".", "$", "package", "->", "install_path", ".", "DS", ".", "'_demo'", ";", "if", "(", "file_exists", "(", "$", ...
Prompt to install the demo content of a package @param Package $package
[ "Prompt", "to", "install", "the", "demo", "content", "of", "a", "package" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Console/Gpm/InstallCommand.php#L362-L413
207,879
getgrav/grav
system/src/Grav/Common/Page/Medium/ImageMedium.php
ImageMedium.path
public function path($reset = true) { $output = $this->saveImage(); if ($reset) { $this->reset(); } return $output; }
php
public function path($reset = true) { $output = $this->saveImage(); if ($reset) { $this->reset(); } return $output; }
[ "public", "function", "path", "(", "$", "reset", "=", "true", ")", "{", "$", "output", "=", "$", "this", "->", "saveImage", "(", ")", ";", "if", "(", "$", "reset", ")", "{", "$", "this", "->", "reset", "(", ")", ";", "}", "return", "$", "output...
Return PATH to image. @param bool $reset @return string path to image
[ "Return", "PATH", "to", "image", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageMedium.php#L152-L161
207,880
getgrav/grav
system/src/Grav/Common/Page/Medium/ImageMedium.php
ImageMedium.url
public function url($reset = true) { /** @var UniformResourceLocator $locator */ $locator = Grav::instance()['locator']; $image_path = $locator->findResource('cache://images', true); $image_dir = $locator->findResource('cache://images', false); $saved_image_path = $this->save...
php
public function url($reset = true) { /** @var UniformResourceLocator $locator */ $locator = Grav::instance()['locator']; $image_path = $locator->findResource('cache://images', true); $image_dir = $locator->findResource('cache://images', false); $saved_image_path = $this->save...
[ "public", "function", "url", "(", "$", "reset", "=", "true", ")", "{", "/** @var UniformResourceLocator $locator */", "$", "locator", "=", "Grav", "::", "instance", "(", ")", "[", "'locator'", "]", ";", "$", "image_path", "=", "$", "locator", "->", "findReso...
Return URL to image. @param bool $reset @return string
[ "Return", "URL", "to", "image", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageMedium.php#L169-L192
207,881
getgrav/grav
system/src/Grav/Common/Page/Medium/ImageMedium.php
ImageMedium.srcset
public function srcset($reset = true) { if (empty($this->alternatives)) { if ($reset) { $this->reset(); } return ''; } $srcset = []; foreach ($this->alternatives as $ratio => $medium) { $srcset[] = $medium->url($reset)...
php
public function srcset($reset = true) { if (empty($this->alternatives)) { if ($reset) { $this->reset(); } return ''; } $srcset = []; foreach ($this->alternatives as $ratio => $medium) { $srcset[] = $medium->url($reset)...
[ "public", "function", "srcset", "(", "$", "reset", "=", "true", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "alternatives", ")", ")", "{", "if", "(", "$", "reset", ")", "{", "$", "this", "->", "reset", "(", ")", ";", "}", "return", "'...
Return srcset string for this Medium and its alternatives. @param bool $reset @return string
[ "Return", "srcset", "string", "for", "this", "Medium", "and", "its", "alternatives", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageMedium.php#L215-L232
207,882
getgrav/grav
system/src/Grav/Common/Page/Medium/ImageMedium.php
ImageMedium.setImagePrettyName
public function setImagePrettyName($name) { $this->set('prettyname', $name); if ($this->image) { $this->image->setPrettyName($name); } }
php
public function setImagePrettyName($name) { $this->set('prettyname', $name); if ($this->image) { $this->image->setPrettyName($name); } }
[ "public", "function", "setImagePrettyName", "(", "$", "name", ")", "{", "$", "this", "->", "set", "(", "'prettyname'", ",", "$", "name", ")", ";", "if", "(", "$", "this", "->", "image", ")", "{", "$", "this", "->", "image", "->", "setPrettyName", "("...
Allows the ability to override the Inmage's Pretty name stored in cache @param string $name
[ "Allows", "the", "ability", "to", "override", "the", "Inmage", "s", "Pretty", "name", "stored", "in", "cache" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageMedium.php#L239-L245
207,883
getgrav/grav
system/src/Grav/Common/Page/Medium/ImageMedium.php
ImageMedium.derivatives
public function derivatives($min_width, $max_width = 2500, $step = 200) { if (!empty($this->alternatives)) { $max = max(array_keys($this->alternatives)); $base = $this->alternatives[$max]; } else { $base = $this; } $widths = []; if (func_...
php
public function derivatives($min_width, $max_width = 2500, $step = 200) { if (!empty($this->alternatives)) { $max = max(array_keys($this->alternatives)); $base = $this->alternatives[$max]; } else { $base = $this; } $widths = []; if (func_...
[ "public", "function", "derivatives", "(", "$", "min_width", ",", "$", "max_width", "=", "2500", ",", "$", "step", "=", "200", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "alternatives", ")", ")", "{", "$", "max", "=", "max", "(", "...
Generate alternative image widths, using either an array of integers, or a min width, a max width, and a step parameter to fill out the necessary widths. Existing image alternatives won't be overwritten. @param int|int[] $min_width @param int $max_width @param int $step @return $this
[ "Generate", "alternative", "image", "widths", "using", "either", "an", "array", "of", "integers", "or", "a", "min", "width", "a", "max", "width", "and", "a", "step", "parameter", "to", "fill", "out", "the", "necessary", "widths", ".", "Existing", "image", ...
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageMedium.php#L270-L332
207,884
getgrav/grav
system/src/Grav/Common/Page/Medium/ImageMedium.php
ImageMedium.reset
public function reset() { parent::reset(); if ($this->image) { $this->image(); $this->medium_querystring = []; $this->filter(); $this->clearAlternatives(); } $this->format = 'guess'; $this->quality = $this->default_quality; ...
php
public function reset() { parent::reset(); if ($this->image) { $this->image(); $this->medium_querystring = []; $this->filter(); $this->clearAlternatives(); } $this->format = 'guess'; $this->quality = $this->default_quality; ...
[ "public", "function", "reset", "(", ")", "{", "parent", "::", "reset", "(", ")", ";", "if", "(", "$", "this", "->", "image", ")", "{", "$", "this", "->", "image", "(", ")", ";", "$", "this", "->", "medium_querystring", "=", "[", "]", ";", "$", ...
Reset image. @return $this
[ "Reset", "image", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageMedium.php#L359-L376
207,885
getgrav/grav
system/src/Grav/Common/Page/Medium/ImageMedium.php
ImageMedium.quality
public function quality($quality = null) { if ($quality) { if (!$this->image) { $this->image(); } $this->quality = $quality; return $this; } return $this->quality; }
php
public function quality($quality = null) { if ($quality) { if (!$this->image) { $this->image(); } $this->quality = $quality; return $this; } return $this->quality; }
[ "public", "function", "quality", "(", "$", "quality", "=", "null", ")", "{", "if", "(", "$", "quality", ")", "{", "if", "(", "!", "$", "this", "->", "image", ")", "{", "$", "this", "->", "image", "(", ")", ";", "}", "$", "this", "->", "quality"...
Sets or gets the quality of the image @param int $quality 0-100 quality @return int|$this
[ "Sets", "or", "gets", "the", "quality", "of", "the", "image" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageMedium.php#L423-L436
207,886
getgrav/grav
system/src/Grav/Common/Page/Medium/ImageMedium.php
ImageMedium.format
public function format($format) { if (!$this->image) { $this->image(); } $this->format = $format; return $this; }
php
public function format($format) { if (!$this->image) { $this->image(); } $this->format = $format; return $this; }
[ "public", "function", "format", "(", "$", "format", ")", "{", "if", "(", "!", "$", "this", "->", "image", ")", "{", "$", "this", "->", "image", "(", ")", ";", "}", "$", "this", "->", "format", "=", "$", "format", ";", "return", "$", "this", ";"...
Sets image output format. @param string $format @return $this
[ "Sets", "image", "output", "format", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageMedium.php#L444-L453
207,887
getgrav/grav
system/src/Grav/Common/Page/Medium/ImageMedium.php
ImageMedium.sizes
public function sizes($sizes = null) { if ($sizes) { $this->sizes = $sizes; return $this; } return empty($this->sizes) ? '100vw' : $this->sizes; }
php
public function sizes($sizes = null) { if ($sizes) { $this->sizes = $sizes; return $this; } return empty($this->sizes) ? '100vw' : $this->sizes; }
[ "public", "function", "sizes", "(", "$", "sizes", "=", "null", ")", "{", "if", "(", "$", "sizes", ")", "{", "$", "this", "->", "sizes", "=", "$", "sizes", ";", "return", "$", "this", ";", "}", "return", "empty", "(", "$", "this", "->", "sizes", ...
Set or get sizes parameter for srcset media action @param string $sizes @return string
[ "Set", "or", "get", "sizes", "parameter", "for", "srcset", "media", "action" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageMedium.php#L461-L471
207,888
getgrav/grav
system/src/Grav/Common/Page/Medium/ImageMedium.php
ImageMedium.image
protected function image() { $locator = Grav::instance()['locator']; $file = $this->get('filepath'); // Use existing cache folder or if it doesn't exist, create it. $cacheDir = $locator->findResource('cache://images', true) ?: $locator->findResource('cache://images', true, true); ...
php
protected function image() { $locator = Grav::instance()['locator']; $file = $this->get('filepath'); // Use existing cache folder or if it doesn't exist, create it. $cacheDir = $locator->findResource('cache://images', true) ?: $locator->findResource('cache://images', true, true); ...
[ "protected", "function", "image", "(", ")", "{", "$", "locator", "=", "Grav", "::", "instance", "(", ")", "[", "'locator'", "]", ";", "$", "file", "=", "$", "this", "->", "get", "(", "'filepath'", ")", ";", "// Use existing cache folder or if it doesn't exis...
Gets medium image, resets image manipulation operations. @return $this
[ "Gets", "medium", "image", "resets", "image", "manipulation", "operations", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageMedium.php#L574-L592
207,889
getgrav/grav
system/src/Grav/Common/Page/Medium/ImageMedium.php
ImageMedium.saveImage
protected function saveImage() { if (!$this->image) { return parent::path(false); } $this->filter(); if (isset($this->result)) { return $this->result; } if (!$this->debug_watermarked && $this->get('debug')) { $ratio = $this->get(...
php
protected function saveImage() { if (!$this->image) { return parent::path(false); } $this->filter(); if (isset($this->result)) { return $this->result; } if (!$this->debug_watermarked && $this->get('debug')) { $ratio = $this->get(...
[ "protected", "function", "saveImage", "(", ")", "{", "if", "(", "!", "$", "this", "->", "image", ")", "{", "return", "parent", "::", "path", "(", "false", ")", ";", "}", "$", "this", "->", "filter", "(", ")", ";", "if", "(", "isset", "(", "$", ...
Save the image with cache. @return string
[ "Save", "the", "image", "with", "cache", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageMedium.php#L599-L623
207,890
getgrav/grav
system/src/Grav/Common/Page/Medium/ImageMedium.php
ImageMedium.filter
public function filter($filter = 'image.filters.default') { $filters = (array) $this->get($filter, []); foreach ($filters as $params) { $params = (array) $params; $method = array_shift($params); $this->__call($method, $params); } }
php
public function filter($filter = 'image.filters.default') { $filters = (array) $this->get($filter, []); foreach ($filters as $params) { $params = (array) $params; $method = array_shift($params); $this->__call($method, $params); } }
[ "public", "function", "filter", "(", "$", "filter", "=", "'image.filters.default'", ")", "{", "$", "filters", "=", "(", "array", ")", "$", "this", "->", "get", "(", "$", "filter", ",", "[", "]", ")", ";", "foreach", "(", "$", "filters", "as", "$", ...
Filter image by using user defined filter parameters. @param string $filter Filter to be used.
[ "Filter", "image", "by", "using", "user", "defined", "filter", "parameters", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageMedium.php#L630-L638
207,891
getgrav/grav
system/src/Grav/Common/Page/Medium/ImageMedium.php
ImageMedium.higherQualityAlternative
public function higherQualityAlternative() { if ($this->alternatives) { $max = reset($this->alternatives); foreach($this->alternatives as $alternative) { if($alternative->quality() > $max->quality()) { $max = $alternativ...
php
public function higherQualityAlternative() { if ($this->alternatives) { $max = reset($this->alternatives); foreach($this->alternatives as $alternative) { if($alternative->quality() > $max->quality()) { $max = $alternativ...
[ "public", "function", "higherQualityAlternative", "(", ")", "{", "if", "(", "$", "this", "->", "alternatives", ")", "{", "$", "max", "=", "reset", "(", "$", "this", "->", "alternatives", ")", ";", "foreach", "(", "$", "this", "->", "alternatives", "as", ...
Return the image higher quality version @return ImageMedium the alternative version with higher quality
[ "Return", "the", "image", "higher", "quality", "version" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageMedium.php#L645-L661
207,892
getgrav/grav
system/src/Grav/Console/ConsoleTrait.php
ConsoleTrait.loadLocalConfig
public function loadLocalConfig() { $home_folder = getenv('HOME') ?: getenv('HOMEDRIVE') . getenv('HOMEPATH'); $local_config_file = $home_folder . '/.grav/config'; if (file_exists($local_config_file)) { $file = YamlFile::instance($local_config_file); $this->local_con...
php
public function loadLocalConfig() { $home_folder = getenv('HOME') ?: getenv('HOMEDRIVE') . getenv('HOMEPATH'); $local_config_file = $home_folder . '/.grav/config'; if (file_exists($local_config_file)) { $file = YamlFile::instance($local_config_file); $this->local_con...
[ "public", "function", "loadLocalConfig", "(", ")", "{", "$", "home_folder", "=", "getenv", "(", "'HOME'", ")", "?", ":", "getenv", "(", "'HOMEDRIVE'", ")", ".", "getenv", "(", "'HOMEPATH'", ")", ";", "$", "local_config_file", "=", "$", "home_folder", ".", ...
Load the local config file @return mixed string the local config file name. false if local config does not exist
[ "Load", "the", "local", "config", "file" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Console/ConsoleTrait.php#L125-L138
207,893
getgrav/grav
system/src/Grav/Common/Data/Validation.php
Validation.validate
public static function validate($value, array $field) { if (!isset($field['type'])) { $field['type'] = 'text'; } $type = $validate['type'] ?? $field['type']; $validate = (array)($field['validate'] ?? null); $required = $validate['required'] ?? false; // I...
php
public static function validate($value, array $field) { if (!isset($field['type'])) { $field['type'] = 'text'; } $type = $validate['type'] ?? $field['type']; $validate = (array)($field['validate'] ?? null); $required = $validate['required'] ?? false; // I...
[ "public", "static", "function", "validate", "(", "$", "value", ",", "array", "$", "field", ")", "{", "if", "(", "!", "isset", "(", "$", "field", "[", "'type'", "]", ")", ")", "{", "$", "field", "[", "'type'", "]", "=", "'text'", ";", "}", "$", ...
Validate value against a blueprint field definition. @param mixed $value @param array $field @return array
[ "Validate", "value", "against", "a", "blueprint", "field", "definition", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Validation.php#L25-L78
207,894
getgrav/grav
system/src/Grav/Common/Data/Validation.php
Validation.filter
public static function filter($value, array $field) { $validate = (array)($field['filter'] ?? $field['validate'] ?? null); // If value isn't required, we will return null if empty value is given. if (($value === null || $value === '') && empty($validate['required'])) { return nu...
php
public static function filter($value, array $field) { $validate = (array)($field['filter'] ?? $field['validate'] ?? null); // If value isn't required, we will return null if empty value is given. if (($value === null || $value === '') && empty($validate['required'])) { return nu...
[ "public", "static", "function", "filter", "(", "$", "value", ",", "array", "$", "field", ")", "{", "$", "validate", "=", "(", "array", ")", "(", "$", "field", "[", "'filter'", "]", "??", "$", "field", "[", "'validate'", "]", "??", "null", ")", ";",...
Filter value against a blueprint field definition. @param mixed $value @param array $field @return mixed Filtered value.
[ "Filter", "value", "against", "a", "blueprint", "field", "definition", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Validation.php#L87-L113
207,895
getgrav/grav
system/src/Grav/Console/Gpm/UninstallCommand.php
UninstallCommand.packageExists
private function packageExists($slug, $package) { $path = Grav::instance()['locator']->findResource($package->package_type . '://' . $slug); Installer::isValidDestination($path); return Installer::lastErrorCode(); }
php
private function packageExists($slug, $package) { $path = Grav::instance()['locator']->findResource($package->package_type . '://' . $slug); Installer::isValidDestination($path); return Installer::lastErrorCode(); }
[ "private", "function", "packageExists", "(", "$", "slug", ",", "$", "package", ")", "{", "$", "path", "=", "Grav", "::", "instance", "(", ")", "[", "'locator'", "]", "->", "findResource", "(", "$", "package", "->", "package_type", ".", "'://'", ".", "$...
Check if package exists @param string $slug @param Package $package @return int
[ "Check", "if", "package", "exists" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Console/Gpm/UninstallCommand.php#L289-L294
207,896
getgrav/grav
system/src/Grav/Common/Helpers/LogViewer.php
LogViewer.objectTail
public function objectTail($filepath, $lines = 1, $desc = true) { $data = $this->tail($filepath, $lines); $tailed_log = explode(PHP_EOL, $data); $line_objects = []; foreach ($tailed_log as $line) { $line_objects[] = $this->parse($line); } return $desc ? ...
php
public function objectTail($filepath, $lines = 1, $desc = true) { $data = $this->tail($filepath, $lines); $tailed_log = explode(PHP_EOL, $data); $line_objects = []; foreach ($tailed_log as $line) { $line_objects[] = $this->parse($line); } return $desc ? ...
[ "public", "function", "objectTail", "(", "$", "filepath", ",", "$", "lines", "=", "1", ",", "$", "desc", "=", "true", ")", "{", "$", "data", "=", "$", "this", "->", "tail", "(", "$", "filepath", ",", "$", "lines", ")", ";", "$", "tailed_log", "="...
Get the objects of a tailed file @param string $filepath @param int $lines @param bool $desc @return array
[ "Get", "the", "objects", "of", "a", "tailed", "file" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/LogViewer.php#L24-L35
207,897
getgrav/grav
system/src/Grav/Common/Helpers/LogViewer.php
LogViewer.tail
public function tail($filepath, $lines = 1) { $f = @fopen($filepath, "rb"); if ($f === false) return false; else $buffer = ($lines < 2 ? 64 : ($lines < 10 ? 512 : 4096)); fseek($f, -1, SEEK_END); if (fread($f, 1) != "\n") $lines -= 1; // Start reading $output ...
php
public function tail($filepath, $lines = 1) { $f = @fopen($filepath, "rb"); if ($f === false) return false; else $buffer = ($lines < 2 ? 64 : ($lines < 10 ? 512 : 4096)); fseek($f, -1, SEEK_END); if (fread($f, 1) != "\n") $lines -= 1; // Start reading $output ...
[ "public", "function", "tail", "(", "$", "filepath", ",", "$", "lines", "=", "1", ")", "{", "$", "f", "=", "@", "fopen", "(", "$", "filepath", ",", "\"rb\"", ")", ";", "if", "(", "$", "f", "===", "false", ")", "return", "false", ";", "else", "$"...
Optimized way to get just the last few entries of a log file @param string $filepath @param int $lines @return bool|string
[ "Optimized", "way", "to", "get", "just", "the", "last", "few", "entries", "of", "a", "log", "file" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/LogViewer.php#L44-L80
207,898
getgrav/grav
system/src/Grav/Common/Helpers/LogViewer.php
LogViewer.parse
public function parse($line) { if( !is_string($line) || strlen($line) === 0) { return array(); } preg_match($this->pattern, $line, $data); if (!isset($data['date'])) { return array(); } preg_match('/(.*)- Trace:(.*)/', $data['message'], $match...
php
public function parse($line) { if( !is_string($line) || strlen($line) === 0) { return array(); } preg_match($this->pattern, $line, $data); if (!isset($data['date'])) { return array(); } preg_match('/(.*)- Trace:(.*)/', $data['message'], $match...
[ "public", "function", "parse", "(", "$", "line", ")", "{", "if", "(", "!", "is_string", "(", "$", "line", ")", "||", "strlen", "(", "$", "line", ")", "===", "0", ")", "{", "return", "array", "(", ")", ";", "}", "preg_match", "(", "$", "this", "...
Parse a monolog row into array bits @param string $line @return array
[ "Parse", "a", "monolog", "row", "into", "array", "bits" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/LogViewer.php#L109-L134
207,899
getgrav/grav
system/src/Grav/Common/Helpers/LogViewer.php
LogViewer.parseTrace
public static function parseTrace($trace, $rows = 10) { $lines = array_filter(preg_split('/#\d*/m', $trace)); return array_slice($lines, 0, $rows); }
php
public static function parseTrace($trace, $rows = 10) { $lines = array_filter(preg_split('/#\d*/m', $trace)); return array_slice($lines, 0, $rows); }
[ "public", "static", "function", "parseTrace", "(", "$", "trace", ",", "$", "rows", "=", "10", ")", "{", "$", "lines", "=", "array_filter", "(", "preg_split", "(", "'/#\\d*/m'", ",", "$", "trace", ")", ")", ";", "return", "array_slice", "(", "$", "lines...
Parse text of trace into an array of lines @param string $trace @param int $rows @return array
[ "Parse", "text", "of", "trace", "into", "an", "array", "of", "lines" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/LogViewer.php#L143-L147