repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
bolt/bolt | src/Storage/ContentRequest/Save.php | Save.setPostedValues | private function setPostedValues(Entity\Content $content, $formValues, $contentType)
{
// Ensure all fields have valid values
$formValues = $this->setSuccessfulControlValues($formValues, $contentType['fields']);
$formValues = Input::cleanPostedData($formValues);
unset($formValues['co... | php | private function setPostedValues(Entity\Content $content, $formValues, $contentType)
{
// Ensure all fields have valid values
$formValues = $this->setSuccessfulControlValues($formValues, $contentType['fields']);
$formValues = Input::cleanPostedData($formValues);
unset($formValues['co... | [
"private",
"function",
"setPostedValues",
"(",
"Entity",
"\\",
"Content",
"$",
"content",
",",
"$",
"formValues",
",",
"$",
"contentType",
")",
"{",
"// Ensure all fields have valid values",
"$",
"formValues",
"=",
"$",
"this",
"->",
"setSuccessfulControlValues",
"(... | Set a ContentType record values from a HTTP POST.
@param Entity\Content $content
@param array $formValues
@param array $contentType
@throws AccessControlException | [
"Set",
"a",
"ContentType",
"record",
"values",
"from",
"a",
"HTTP",
"POST",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Save.php#L164-L217 |
bolt/bolt | src/Storage/ContentRequest/Save.php | Save.setPostedRelations | private function setPostedRelations(Entity\Content $content, $formValues)
{
/** @var Collection\Relations $related */
$related = $this->em->createCollection(Entity\Relations::class);
$related->setFromPost($formValues, $content);
$content->setRelation($related);
} | php | private function setPostedRelations(Entity\Content $content, $formValues)
{
/** @var Collection\Relations $related */
$related = $this->em->createCollection(Entity\Relations::class);
$related->setFromPost($formValues, $content);
$content->setRelation($related);
} | [
"private",
"function",
"setPostedRelations",
"(",
"Entity",
"\\",
"Content",
"$",
"content",
",",
"$",
"formValues",
")",
"{",
"/** @var Collection\\Relations $related */",
"$",
"related",
"=",
"$",
"this",
"->",
"em",
"->",
"createCollection",
"(",
"Entity",
"\\"... | Convert POST relationship values to an array of Entity objects keyed by
ContentType.
@param Entity\Content $content
@param array|null $formValues | [
"Convert",
"POST",
"relationship",
"values",
"to",
"an",
"array",
"of",
"Entity",
"objects",
"keyed",
"by",
"ContentType",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Save.php#L226-L232 |
bolt/bolt | src/Storage/ContentRequest/Save.php | Save.setPostedTaxonomies | private function setPostedTaxonomies(Entity\Content $content, $formValues)
{
/** @var Collection\Taxonomy $taxonomies */
$taxonomies = $this->em->createCollection(Entity\Taxonomy::class);
$taxonomies->setFromPost($formValues, $content);
$content->setTaxonomy($taxonomies);
} | php | private function setPostedTaxonomies(Entity\Content $content, $formValues)
{
/** @var Collection\Taxonomy $taxonomies */
$taxonomies = $this->em->createCollection(Entity\Taxonomy::class);
$taxonomies->setFromPost($formValues, $content);
$content->setTaxonomy($taxonomies);
} | [
"private",
"function",
"setPostedTaxonomies",
"(",
"Entity",
"\\",
"Content",
"$",
"content",
",",
"$",
"formValues",
")",
"{",
"/** @var Collection\\Taxonomy $taxonomies */",
"$",
"taxonomies",
"=",
"$",
"this",
"->",
"em",
"->",
"createCollection",
"(",
"Entity",
... | Set valid POST taxonomies.
@param Entity\Content $content
@param array|null $formValues | [
"Set",
"valid",
"POST",
"taxonomies",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Save.php#L240-L246 |
bolt/bolt | src/Storage/ContentRequest/Save.php | Save.saveContentRecord | private function saveContentRecord(Entity\Content $content, $oldContent, $contentType, $new, $comment, $returnTo, $editReferrer)
{
// Save the record
$repo = $this->em->getRepository($contentType['slug']);
// Update the date modified timestamp
$content->setDatechanged('now');
... | php | private function saveContentRecord(Entity\Content $content, $oldContent, $contentType, $new, $comment, $returnTo, $editReferrer)
{
// Save the record
$repo = $this->em->getRepository($contentType['slug']);
// Update the date modified timestamp
$content->setDatechanged('now');
... | [
"private",
"function",
"saveContentRecord",
"(",
"Entity",
"\\",
"Content",
"$",
"content",
",",
"$",
"oldContent",
",",
"$",
"contentType",
",",
"$",
"new",
",",
"$",
"comment",
",",
"$",
"returnTo",
",",
"$",
"editReferrer",
")",
"{",
"// Save the record",... | Commit the record to the database.
@param Entity\Content $content
@param Entity\Content|null $oldContent
@param array|ContentType $contentType
@param bool $new
@param string $comment
@param string $returnTo
@param string $editReferrer
@return Response|null
@throws InvalidRepositoryException | [
"Commit",
"the",
"record",
"to",
"the",
"database",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Save.php#L262-L327 |
bolt/bolt | src/Storage/ContentRequest/Save.php | Save.setSuccessfulControlValues | private function setSuccessfulControlValues(array $formValues, $fields)
{
foreach ($fields as $key => $values) {
if (isset($formValues[$key])) {
if ($values['type'] === 'float') {
// We allow ',' and '.' as decimal point and need '.' internally
... | php | private function setSuccessfulControlValues(array $formValues, $fields)
{
foreach ($fields as $key => $values) {
if (isset($formValues[$key])) {
if ($values['type'] === 'float') {
// We allow ',' and '.' as decimal point and need '.' internally
... | [
"private",
"function",
"setSuccessfulControlValues",
"(",
"array",
"$",
"formValues",
",",
"$",
"fields",
")",
"{",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"key",
"=>",
"$",
"values",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"formValues",
"[",
"$",
"k... | Add successful control values to request values, and do needed corrections.
@see http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2
@param array $formValues
@param array $fields
@return array | [
"Add",
"successful",
"control",
"values",
"to",
"request",
"values",
"and",
"do",
"needed",
"corrections",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Save.php#L339-L359 |
bolt/bolt | src/Storage/ContentRequest/Save.php | Save.createJsonUpdate | private function createJsonUpdate(Entity\Content $content, $flush)
{
/*
* Flush any buffers from saveConent() dispatcher hooks
* and make sure our JSON output is clean.
*
* Currently occurs due to exceptions being generated in the dispatchers
* in \Bolt\Storage::... | php | private function createJsonUpdate(Entity\Content $content, $flush)
{
/*
* Flush any buffers from saveConent() dispatcher hooks
* and make sure our JSON output is clean.
*
* Currently occurs due to exceptions being generated in the dispatchers
* in \Bolt\Storage::... | [
"private",
"function",
"createJsonUpdate",
"(",
"Entity",
"\\",
"Content",
"$",
"content",
",",
"$",
"flush",
")",
"{",
"/*\n * Flush any buffers from saveConent() dispatcher hooks\n * and make sure our JSON output is clean.\n *\n * Currently occurs due to... | Build a valid AJAX response for in-place saves that account for pre/post
save events.
@param Entity\Content $content
@param bool $flush
@return JsonResponse | [
"Build",
"a",
"valid",
"AJAX",
"response",
"for",
"in",
"-",
"place",
"saves",
"that",
"account",
"for",
"pre",
"/",
"post",
"save",
"events",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Save.php#L370-L406 |
bolt/bolt | src/Storage/ContentRequest/Save.php | Save.logChange | private function logChange($contentType, $contentId, $newContent = null, $oldContent = null, $comment = null)
{
$type = $oldContent ? 'Update' : 'Insert';
$this->loggerChange->info(
$type . ' record',
[
'action' => strtoupper($type),
'con... | php | private function logChange($contentType, $contentId, $newContent = null, $oldContent = null, $comment = null)
{
$type = $oldContent ? 'Update' : 'Insert';
$this->loggerChange->info(
$type . ' record',
[
'action' => strtoupper($type),
'con... | [
"private",
"function",
"logChange",
"(",
"$",
"contentType",
",",
"$",
"contentId",
",",
"$",
"newContent",
"=",
"null",
",",
"$",
"oldContent",
"=",
"null",
",",
"$",
"comment",
"=",
"null",
")",
"{",
"$",
"type",
"=",
"$",
"oldContent",
"?",
"'Update... | Add a change log entry to track the change.
@param string $contentType
@param int $contentId
@param Entity\Content $newContent
@param Entity\Content|null $oldContent
@param string|null $comment | [
"Add",
"a",
"change",
"log",
"entry",
"to",
"track",
"the",
"change",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Save.php#L417-L432 |
bolt/bolt | src/Storage/ContentRequest/Save.php | Save.generateUrl | private function generateUrl($name, $params = [], $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
{
/** @var UrlGeneratorInterface $generator */
$generator = $this->urlGenerator;
return $generator->generate($name, $params, $referenceType);
} | php | private function generateUrl($name, $params = [], $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
{
/** @var UrlGeneratorInterface $generator */
$generator = $this->urlGenerator;
return $generator->generate($name, $params, $referenceType);
} | [
"private",
"function",
"generateUrl",
"(",
"$",
"name",
",",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"referenceType",
"=",
"UrlGeneratorInterface",
"::",
"ABSOLUTE_PATH",
")",
"{",
"/** @var UrlGeneratorInterface $generator */",
"$",
"generator",
"=",
"$",
"this",... | Shortcut for {@see UrlGeneratorInterface::generate}.
@param string $name The name of the route
@param array $params An array of parameters
@param int $referenceType The type of reference to be generated (one of the constants)
@return string | [
"Shortcut",
"for",
"{",
"@see",
"UrlGeneratorInterface",
"::",
"generate",
"}",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Save.php#L443-L449 |
bolt/bolt | src/Storage/ContentRequest/Save.php | Save.isEmptyArray | private function isEmptyArray($input)
{
if (!is_array($input)) {
return false;
}
$empty = true;
foreach (new RecursiveIteratorIterator(new RecursiveArrayIterator($input), RecursiveIteratorIterator::LEAVES_ONLY) as $key => $value) {
$empty = (empty($value) && $... | php | private function isEmptyArray($input)
{
if (!is_array($input)) {
return false;
}
$empty = true;
foreach (new RecursiveIteratorIterator(new RecursiveArrayIterator($input), RecursiveIteratorIterator::LEAVES_ONLY) as $key => $value) {
$empty = (empty($value) && $... | [
"private",
"function",
"isEmptyArray",
"(",
"$",
"input",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"input",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"empty",
"=",
"true",
";",
"foreach",
"(",
"new",
"RecursiveIteratorIterator",
"(",
"new... | Check wether an array is empty and if it is the value of the repeater is set to null.
@param array $input
@return bool | [
"Check",
"wether",
"an",
"array",
"is",
"empty",
"and",
"if",
"it",
"is",
"the",
"value",
"of",
"the",
"repeater",
"is",
"set",
"to",
"null",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Save.php#L458-L472 |
bolt/bolt | src/Menu/MenuEntry.php | MenuEntry.createRoot | public static function createRoot(UrlGeneratorInterface $urlGenerator, $basePath)
{
$root = new static('root', $basePath);
$root->urlGenerator = $urlGenerator;
return $root;
} | php | public static function createRoot(UrlGeneratorInterface $urlGenerator, $basePath)
{
$root = new static('root', $basePath);
$root->urlGenerator = $urlGenerator;
return $root;
} | [
"public",
"static",
"function",
"createRoot",
"(",
"UrlGeneratorInterface",
"$",
"urlGenerator",
",",
"$",
"basePath",
")",
"{",
"$",
"root",
"=",
"new",
"static",
"(",
"'root'",
",",
"$",
"basePath",
")",
";",
"$",
"root",
"->",
"urlGenerator",
"=",
"$",
... | Create the root menu entry.
@param UrlGeneratorInterface $urlGenerator
@param string $basePath
@return MenuEntry | [
"Create",
"the",
"root",
"menu",
"entry",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/MenuEntry.php#L56-L62 |
bolt/bolt | src/Menu/MenuEntry.php | MenuEntry.setRoute | public function setRoute($routeName, $routeParams = [])
{
$this->routeName = $routeName;
$this->routeParams = $routeParams;
$this->routeGenerated = null;
return $this;
} | php | public function setRoute($routeName, $routeParams = [])
{
$this->routeName = $routeName;
$this->routeParams = $routeParams;
$this->routeGenerated = null;
return $this;
} | [
"public",
"function",
"setRoute",
"(",
"$",
"routeName",
",",
"$",
"routeParams",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"routeName",
"=",
"$",
"routeName",
";",
"$",
"this",
"->",
"routeParams",
"=",
"$",
"routeParams",
";",
"$",
"this",
"->",
... | Set the uri to be generated with given route name and params.
@param string $routeName
@param array $routeParams
@return MenuEntry | [
"Set",
"the",
"uri",
"to",
"be",
"generated",
"with",
"given",
"route",
"name",
"and",
"params",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/MenuEntry.php#L95-L102 |
bolt/bolt | src/Menu/MenuEntry.php | MenuEntry.getUri | public function getUri()
{
if ($this->routeGenerated) {
return $this->routeGenerated;
}
if ($this->routeName !== null) {
return $this->routeGenerated = $this->urlGenerator->generate($this->routeName, $this->routeParams);
}
if (strpos($this->uri, '/')... | php | public function getUri()
{
if ($this->routeGenerated) {
return $this->routeGenerated;
}
if ($this->routeName !== null) {
return $this->routeGenerated = $this->urlGenerator->generate($this->routeName, $this->routeParams);
}
if (strpos($this->uri, '/')... | [
"public",
"function",
"getUri",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"routeGenerated",
")",
"{",
"return",
"$",
"this",
"->",
"routeGenerated",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"routeName",
"!==",
"null",
")",
"{",
"return",
"$",
"this... | Return the menu entry's URI relative to Bolt admin's.
@return string | [
"Return",
"the",
"menu",
"entry",
"s",
"URI",
"relative",
"to",
"Bolt",
"admin",
"s",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/MenuEntry.php#L119-L142 |
bolt/bolt | src/Menu/MenuEntry.php | MenuEntry.add | public function add(MenuEntry $menu)
{
$menu->parent = $this;
$menu->urlGenerator = $this->urlGenerator;
$this->children[$menu->getName()] = $menu;
return $menu;
} | php | public function add(MenuEntry $menu)
{
$menu->parent = $this;
$menu->urlGenerator = $this->urlGenerator;
$this->children[$menu->getName()] = $menu;
return $menu;
} | [
"public",
"function",
"add",
"(",
"MenuEntry",
"$",
"menu",
")",
"{",
"$",
"menu",
"->",
"parent",
"=",
"$",
"this",
";",
"$",
"menu",
"->",
"urlGenerator",
"=",
"$",
"this",
"->",
"urlGenerator",
";",
"$",
"this",
"->",
"children",
"[",
"$",
"menu",... | Add child menu entry.
@param MenuEntry $menu
@return MenuEntry | [
"Add",
"child",
"menu",
"entry",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/MenuEntry.php#L247-L254 |
bolt/bolt | src/Menu/MenuEntry.php | MenuEntry.get | public function get($name)
{
if (isset($this->children[$name])) {
return $this->children[$name];
}
throw new \InvalidArgumentException(sprintf('Menu entry %s does not have a child named "%s"', $this->name, $name));
} | php | public function get($name)
{
if (isset($this->children[$name])) {
return $this->children[$name];
}
throw new \InvalidArgumentException(sprintf('Menu entry %s does not have a child named "%s"', $this->name, $name));
} | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"children",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"children",
"[",
"$",
"name",
"]",
";",
"}",
"throw",
"new",
"\\... | Return a menu entry's named child.
@param string $name
@return MenuEntry | [
"Return",
"a",
"menu",
"entry",
"s",
"named",
"child",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/MenuEntry.php#L263-L270 |
bolt/bolt | src/Menu/MenuEntry.php | MenuEntry.serialize | public function serialize()
{
return Serialization::dump([
'parent' => $this->parent,
'children' => $this->children,
'name' => $this->name,
'label' => $this->label,
'icon' => $this->icon,
'permission' => $this->ge... | php | public function serialize()
{
return Serialization::dump([
'parent' => $this->parent,
'children' => $this->children,
'name' => $this->name,
'label' => $this->label,
'icon' => $this->icon,
'permission' => $this->ge... | [
"public",
"function",
"serialize",
"(",
")",
"{",
"return",
"Serialization",
"::",
"dump",
"(",
"[",
"'parent'",
"=>",
"$",
"this",
"->",
"parent",
",",
"'children'",
"=>",
"$",
"this",
"->",
"children",
",",
"'name'",
"=>",
"$",
"this",
"->",
"name",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/MenuEntry.php#L317-L328 |
bolt/bolt | src/Menu/MenuEntry.php | MenuEntry.unserialize | public function unserialize($serialized)
{
$data = Serialization::parse($serialized);
$this->parent = $data['parent'];
$this->children = $data['children'];
$this->name = $data['name'];
$this->label = $data['label'];
$this->icon = $data['icon'];
$this->permiss... | php | public function unserialize($serialized)
{
$data = Serialization::parse($serialized);
$this->parent = $data['parent'];
$this->children = $data['children'];
$this->name = $data['name'];
$this->label = $data['label'];
$this->icon = $data['icon'];
$this->permiss... | [
"public",
"function",
"unserialize",
"(",
"$",
"serialized",
")",
"{",
"$",
"data",
"=",
"Serialization",
"::",
"parse",
"(",
"$",
"serialized",
")",
";",
"$",
"this",
"->",
"parent",
"=",
"$",
"data",
"[",
"'parent'",
"]",
";",
"$",
"this",
"->",
"c... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/MenuEntry.php#L333-L344 |
bolt/bolt | src/Twig/FilesystemLoader.php | FilesystemLoader.addPath | public function addPath($path, $namespace = self::MAIN_NAMESPACE)
{
$this->addDir($this->filesystem->getDir($path), $namespace);
} | php | public function addPath($path, $namespace = self::MAIN_NAMESPACE)
{
$this->addDir($this->filesystem->getDir($path), $namespace);
} | [
"public",
"function",
"addPath",
"(",
"$",
"path",
",",
"$",
"namespace",
"=",
"self",
"::",
"MAIN_NAMESPACE",
")",
"{",
"$",
"this",
"->",
"addDir",
"(",
"$",
"this",
"->",
"filesystem",
"->",
"getDir",
"(",
"$",
"path",
")",
",",
"$",
"namespace",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/FilesystemLoader.php#L38-L41 |
bolt/bolt | src/Twig/FilesystemLoader.php | FilesystemLoader.prependPath | public function prependPath($path, $namespace = self::MAIN_NAMESPACE)
{
$this->prependDir($this->filesystem->getDir($path), $namespace);
} | php | public function prependPath($path, $namespace = self::MAIN_NAMESPACE)
{
$this->prependDir($this->filesystem->getDir($path), $namespace);
} | [
"public",
"function",
"prependPath",
"(",
"$",
"path",
",",
"$",
"namespace",
"=",
"self",
"::",
"MAIN_NAMESPACE",
")",
"{",
"$",
"this",
"->",
"prependDir",
"(",
"$",
"this",
"->",
"filesystem",
"->",
"getDir",
"(",
"$",
"path",
")",
",",
"$",
"namesp... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/FilesystemLoader.php#L46-L49 |
bolt/bolt | src/Twig/FilesystemLoader.php | FilesystemLoader.getSourceContext | public function getSourceContext($name)
{
$file = $this->findTemplate($name);
return new Source($file->read(), $name);
} | php | public function getSourceContext($name)
{
$file = $this->findTemplate($name);
return new Source($file->read(), $name);
} | [
"public",
"function",
"getSourceContext",
"(",
"$",
"name",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"findTemplate",
"(",
"$",
"name",
")",
";",
"return",
"new",
"Source",
"(",
"$",
"file",
"->",
"read",
"(",
")",
",",
"$",
"name",
")",
";",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/FilesystemLoader.php#L54-L59 |
bolt/bolt | src/Twig/FilesystemLoader.php | FilesystemLoader.addDir | public function addDir(DirectoryInterface $dir, $namespace = self::MAIN_NAMESPACE)
{
// invalidate the cache
$this->cache = $this->errorCache = [];
if (!$dir->exists()) {
throw new LoaderError(sprintf('The "%s" directory does not exist.', $dir->getFullPath()));
}
... | php | public function addDir(DirectoryInterface $dir, $namespace = self::MAIN_NAMESPACE)
{
// invalidate the cache
$this->cache = $this->errorCache = [];
if (!$dir->exists()) {
throw new LoaderError(sprintf('The "%s" directory does not exist.', $dir->getFullPath()));
}
... | [
"public",
"function",
"addDir",
"(",
"DirectoryInterface",
"$",
"dir",
",",
"$",
"namespace",
"=",
"self",
"::",
"MAIN_NAMESPACE",
")",
"{",
"// invalidate the cache",
"$",
"this",
"->",
"cache",
"=",
"$",
"this",
"->",
"errorCache",
"=",
"[",
"]",
";",
"i... | Adds a directory where templates are stored.
@param DirectoryInterface $dir
@param string $namespace
@throws LoaderError | [
"Adds",
"a",
"directory",
"where",
"templates",
"are",
"stored",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/FilesystemLoader.php#L69-L82 |
bolt/bolt | src/Twig/FilesystemLoader.php | FilesystemLoader.prependDir | public function prependDir(DirectoryInterface $dir, $namespace = self::MAIN_NAMESPACE)
{
// invalidate the cache
$this->cache = $this->errorCache = [];
if (!$dir->exists()) {
throw new LoaderError(sprintf('The "%s" directory does not exist.', $dir->getFullPath()));
}
... | php | public function prependDir(DirectoryInterface $dir, $namespace = self::MAIN_NAMESPACE)
{
// invalidate the cache
$this->cache = $this->errorCache = [];
if (!$dir->exists()) {
throw new LoaderError(sprintf('The "%s" directory does not exist.', $dir->getFullPath()));
}
... | [
"public",
"function",
"prependDir",
"(",
"DirectoryInterface",
"$",
"dir",
",",
"$",
"namespace",
"=",
"self",
"::",
"MAIN_NAMESPACE",
")",
"{",
"// invalidate the cache",
"$",
"this",
"->",
"cache",
"=",
"$",
"this",
"->",
"errorCache",
"=",
"[",
"]",
";",
... | Prepends a directory where templates are stored.
@param DirectoryInterface $dir
@param string $namespace
@throws LoaderError | [
"Prepends",
"a",
"directory",
"where",
"templates",
"are",
"stored",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/FilesystemLoader.php#L92-L109 |
bolt/bolt | src/Twig/FilesystemLoader.php | FilesystemLoader.isFresh | public function isFresh($name, $time)
{
try {
$timestamp = $this->findTemplate($name)->getTimestamp();
return $timestamp <= $time;
} catch (ExceptionInterface $e) {
return false;
}
} | php | public function isFresh($name, $time)
{
try {
$timestamp = $this->findTemplate($name)->getTimestamp();
return $timestamp <= $time;
} catch (ExceptionInterface $e) {
return false;
}
} | [
"public",
"function",
"isFresh",
"(",
"$",
"name",
",",
"$",
"time",
")",
"{",
"try",
"{",
"$",
"timestamp",
"=",
"$",
"this",
"->",
"findTemplate",
"(",
"$",
"name",
")",
"->",
"getTimestamp",
"(",
")",
";",
"return",
"$",
"timestamp",
"<=",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/FilesystemLoader.php#L130-L139 |
bolt/bolt | src/Twig/FilesystemLoader.php | FilesystemLoader.findTemplate | protected function findTemplate($name, $throw = true)
{
$name = $this->normalizeName($name);
if (isset($this->cache[$name])) {
return $this->cache[$name];
}
if (isset($this->errorCache[$name])) {
if (!$throw) {
return false;
}
... | php | protected function findTemplate($name, $throw = true)
{
$name = $this->normalizeName($name);
if (isset($this->cache[$name])) {
return $this->cache[$name];
}
if (isset($this->errorCache[$name])) {
if (!$throw) {
return false;
}
... | [
"protected",
"function",
"findTemplate",
"(",
"$",
"name",
",",
"$",
"throw",
"=",
"true",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"normalizeName",
"(",
"$",
"name",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"cache",
"[",
"$",
... | Finds a file given the template name.
@param string $name the template name
@param bool $throw whether to throw exceptions or return false
@throws LoaderError
@return FileInterface|false | [
"Finds",
"a",
"file",
"given",
"the",
"template",
"name",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/FilesystemLoader.php#L151-L207 |
bolt/bolt | src/Controller/Async/SystemChecks.php | SystemChecks.directoriesCheck | public function directoriesCheck(Request $request)
{
$options = [];
$results = $this->getCheck('DirectoryAccess')
->setOptions($options)
->runCheck()
;
return $this->json($results);
} | php | public function directoriesCheck(Request $request)
{
$options = [];
$results = $this->getCheck('DirectoryAccess')
->setOptions($options)
->runCheck()
;
return $this->json($results);
} | [
"public",
"function",
"directoriesCheck",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"options",
"=",
"[",
"]",
";",
"$",
"results",
"=",
"$",
"this",
"->",
"getCheck",
"(",
"'DirectoryAccess'",
")",
"->",
"setOptions",
"(",
"$",
"options",
")",
"->",... | Check the needed directories are writeable.
@param Request $request
@return Response | [
"Check",
"the",
"needed",
"directories",
"are",
"writeable",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/SystemChecks.php#L33-L43 |
bolt/bolt | src/Controller/Async/SystemChecks.php | SystemChecks.emailCheck | public function emailCheck(Request $request)
{
$options = [
'user' => $this->app['users']->getCurrentUser(),
'host' => $request->getHost(),
'ip' => $request->getClientIp(),
];
$results = $this->getCheck('EmailSetup')
->setOptions($options)
... | php | public function emailCheck(Request $request)
{
$options = [
'user' => $this->app['users']->getCurrentUser(),
'host' => $request->getHost(),
'ip' => $request->getClientIp(),
];
$results = $this->getCheck('EmailSetup')
->setOptions($options)
... | [
"public",
"function",
"emailCheck",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"options",
"=",
"[",
"'user'",
"=>",
"$",
"this",
"->",
"app",
"[",
"'users'",
"]",
"->",
"getCurrentUser",
"(",
")",
",",
"'host'",
"=>",
"$",
"request",
"->",
"getHost... | Send an e-mail ping test.
@param Request $request
@return Response | [
"Send",
"an",
"e",
"-",
"mail",
"ping",
"test",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/SystemChecks.php#L52-L66 |
bolt/bolt | src/Twig/Extension/HtmlExtension.php | HtmlExtension.getFunctions | public function getFunctions()
{
$safe = ['is_safe' => ['html']];
$env = ['needs_environment' => true];
$deprecated = ['deprecated' => true];
return [
// @codingStandardsIgnoreStart
new TwigFunction('link', [Runtime\HtmlRuntime::class, 'link'], $safe + $d... | php | public function getFunctions()
{
$safe = ['is_safe' => ['html']];
$env = ['needs_environment' => true];
$deprecated = ['deprecated' => true];
return [
// @codingStandardsIgnoreStart
new TwigFunction('link', [Runtime\HtmlRuntime::class, 'link'], $safe + $d... | [
"public",
"function",
"getFunctions",
"(",
")",
"{",
"$",
"safe",
"=",
"[",
"'is_safe'",
"=>",
"[",
"'html'",
"]",
"]",
";",
"$",
"env",
"=",
"[",
"'needs_environment'",
"=>",
"true",
"]",
";",
"$",
"deprecated",
"=",
"[",
"'deprecated'",
"=>",
"true",... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Extension/HtmlExtension.php#L22-L35 |
bolt/bolt | src/Twig/Extension/HtmlExtension.php | HtmlExtension.getFilters | public function getFilters()
{
$safe = ['is_safe' => ['html']];
return [
// @codingStandardsIgnoreStart
new TwigFilter('editable', [Runtime\HtmlRuntime::class, 'editable'], $safe),
new TwigFilter('markdown', [Runtime\HtmlRuntime::class, 'markdown'], $safe),
... | php | public function getFilters()
{
$safe = ['is_safe' => ['html']];
return [
// @codingStandardsIgnoreStart
new TwigFilter('editable', [Runtime\HtmlRuntime::class, 'editable'], $safe),
new TwigFilter('markdown', [Runtime\HtmlRuntime::class, 'markdown'], $safe),
... | [
"public",
"function",
"getFilters",
"(",
")",
"{",
"$",
"safe",
"=",
"[",
"'is_safe'",
"=>",
"[",
"'html'",
"]",
"]",
";",
"return",
"[",
"// @codingStandardsIgnoreStart",
"new",
"TwigFilter",
"(",
"'editable'",
",",
"[",
"Runtime",
"\\",
"HtmlRuntime",
"::"... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Extension/HtmlExtension.php#L40-L53 |
bolt/bolt | src/Asset/BoltVersionStrategy.php | BoltVersionStrategy.getVersion | public function getVersion($path)
{
$file = $this->directory->getFile($path);
try {
return substr(md5($this->baseSalt . $file->getFullPath() . $file->getTimestamp()), 0, 10);
} catch (IOException $e) {
return '';
}
} | php | public function getVersion($path)
{
$file = $this->directory->getFile($path);
try {
return substr(md5($this->baseSalt . $file->getFullPath() . $file->getTimestamp()), 0, 10);
} catch (IOException $e) {
return '';
}
} | [
"public",
"function",
"getVersion",
"(",
"$",
"path",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"directory",
"->",
"getFile",
"(",
"$",
"path",
")",
";",
"try",
"{",
"return",
"substr",
"(",
"md5",
"(",
"$",
"this",
"->",
"baseSalt",
".",
"$",... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/BoltVersionStrategy.php#L36-L45 |
bolt/bolt | src/Asset/BoltVersionStrategy.php | BoltVersionStrategy.applyVersion | public function applyVersion($path)
{
$version = $this->getVersion($path);
if (!$version) {
return $path;
}
return sprintf('%s?%s', $path, $version);
} | php | public function applyVersion($path)
{
$version = $this->getVersion($path);
if (!$version) {
return $path;
}
return sprintf('%s?%s', $path, $version);
} | [
"public",
"function",
"applyVersion",
"(",
"$",
"path",
")",
"{",
"$",
"version",
"=",
"$",
"this",
"->",
"getVersion",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"$",
"version",
")",
"{",
"return",
"$",
"path",
";",
"}",
"return",
"sprintf",
"(",... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/BoltVersionStrategy.php#L50-L59 |
bolt/bolt | src/Nut/PimpleDump.php | PimpleDump.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->io->title('Dumping Pimple application container');
$app = $this->app;
$app['debug'] = true;
$dumper = new PimpleDumpProvider();
$app->register($dumper);
$dumper->boot($app);
... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->io->title('Dumping Pimple application container');
$app = $this->app;
$app['debug'] = true;
$dumper = new PimpleDumpProvider();
$app->register($dumper);
$dumper->boot($app);
... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"this",
"->",
"io",
"->",
"title",
"(",
"'Dumping Pimple application container'",
")",
";",
"$",
"app",
"=",
"$",
"this",
"->",
"ap... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/PimpleDump.php#L40-L58 |
bolt/bolt | src/Extension/MenuTrait.php | MenuTrait.extendMenuService | final protected function extendMenuService()
{
$app = $this->getContainer();
$app['menu.admin_builder'] = $app->share(
$app->extend(
'menu.admin_builder',
function (MenuEntry $menus) {
if (!$menus->has('custom')) {
... | php | final protected function extendMenuService()
{
$app = $this->getContainer();
$app['menu.admin_builder'] = $app->share(
$app->extend(
'menu.admin_builder',
function (MenuEntry $menus) {
if (!$menus->has('custom')) {
... | [
"final",
"protected",
"function",
"extendMenuService",
"(",
")",
"{",
"$",
"app",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
";",
"$",
"app",
"[",
"'menu.admin_builder'",
"]",
"=",
"$",
"app",
"->",
"share",
"(",
"$",
"app",
"->",
"extend",
"(",... | Call this in register method.
@internal
@throws \InvalidArgumentException | [
"Call",
"this",
"in",
"register",
"method",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/MenuTrait.php#L37-L71 |
bolt/bolt | src/Extension/MenuTrait.php | MenuTrait.addMenuEntry | final protected function addMenuEntry($label, $path, $icon = null, $permission = null)
{
Deprecated::method(null, 'registerMenuEntries');
$this->menuEntries[] = (new MenuEntry($label, $path))
->setLabel($label)
->setIcon($icon)
->setPermission($permission)
... | php | final protected function addMenuEntry($label, $path, $icon = null, $permission = null)
{
Deprecated::method(null, 'registerMenuEntries');
$this->menuEntries[] = (new MenuEntry($label, $path))
->setLabel($label)
->setIcon($icon)
->setPermission($permission)
... | [
"final",
"protected",
"function",
"addMenuEntry",
"(",
"$",
"label",
",",
"$",
"path",
",",
"$",
"icon",
"=",
"null",
",",
"$",
"permission",
"=",
"null",
")",
"{",
"Deprecated",
"::",
"method",
"(",
"null",
",",
"'registerMenuEntries'",
")",
";",
"$",
... | Add a menu option to backend menu.
@deprecated Deprecated since 3.0, to be removed in 4.0. Use registerMenuEntries() instead.
@param string $label
@param string $path
@param string $icon
@param string $permission | [
"Add",
"a",
"menu",
"option",
"to",
"backend",
"menu",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/MenuTrait.php#L83-L92 |
bolt/bolt | src/Nut/CronRunner.php | CronRunner.configure | protected function configure()
{
$interims = [' - cron.Minute', ' - cron.Hourly', ' - cron.Daily', ' - cron.Weekly', ' - cron.Monthly', ' - cron.Yearly'];
$this
->setName('cron')
->setDescription('Cron virtual daemon')
->addOption('run', null, InputOption::V... | php | protected function configure()
{
$interims = [' - cron.Minute', ' - cron.Hourly', ' - cron.Daily', ' - cron.Weekly', ' - cron.Monthly', ' - cron.Yearly'];
$this
->setName('cron')
->setDescription('Cron virtual daemon')
->addOption('run', null, InputOption::V... | [
"protected",
"function",
"configure",
"(",
")",
"{",
"$",
"interims",
"=",
"[",
"' - cron.Minute'",
",",
"' - cron.Hourly'",
",",
"' - cron.Daily'",
",",
"' - cron.Weekly'",
",",
"' - cron.Monthly'",
",",
"' - cron.Yearly'",
"]",
";",
"$",
"this",
"->",
"set... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/CronRunner.php#L20-L28 |
bolt/bolt | src/Nut/CronRunner.php | CronRunner.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('run')) {
$event = $input->getOption('run');
$param = [
'run' => true,
'event' => $event,
];
} else {
$event = false;
... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('run')) {
$event = $input->getOption('run');
$param = [
'run' => true,
'event' => $event,
];
} else {
$event = false;
... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"if",
"(",
"$",
"input",
"->",
"getOption",
"(",
"'run'",
")",
")",
"{",
"$",
"event",
"=",
"$",
"input",
"->",
"getOption",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/CronRunner.php#L33-L63 |
bolt/bolt | src/Bootstrap.php | Bootstrap.run | public static function run($rootPath)
{
/*
* Load initialization config needed to bootstrap application.
*
* In order for paths to be customized and still have the standard
* index.php (web) and nut (CLI) work, there needs to be a standard
* place these are defin... | php | public static function run($rootPath)
{
/*
* Load initialization config needed to bootstrap application.
*
* In order for paths to be customized and still have the standard
* index.php (web) and nut (CLI) work, there needs to be a standard
* place these are defin... | [
"public",
"static",
"function",
"run",
"(",
"$",
"rootPath",
")",
"{",
"/*\n * Load initialization config needed to bootstrap application.\n *\n * In order for paths to be customized and still have the standard\n * index.php (web) and nut (CLI) work, there needs to ... | Create the application.
@param string $rootPath
@return Silex\Application | [
"Create",
"the",
"application",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Bootstrap.php#L31-L188 |
bolt/bolt | src/Configuration/ConfigurationValueProxy.php | ConfigurationValueProxy.initialize | public function initialize()
{
if (!$this->checked) {
$this->config->checkConfig();
$this->checked = true;
$this->data = $this->config->get($this->path, $this->default);
}
} | php | public function initialize()
{
if (!$this->checked) {
$this->config->checkConfig();
$this->checked = true;
$this->data = $this->config->get($this->path, $this->default);
}
} | [
"public",
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"checked",
")",
"{",
"$",
"this",
"->",
"config",
"->",
"checkConfig",
"(",
")",
";",
"$",
"this",
"->",
"checked",
"=",
"true",
";",
"$",
"this",
"->",
"data",
... | Initialize the configuration value. | [
"Initialize",
"the",
"configuration",
"value",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/ConfigurationValueProxy.php#L80-L87 |
bolt/bolt | src/Controller/ConfigurableBase.php | ConfigurableBase.resolveBefore | protected function resolveBefore($before)
{
$getBefore = $this->resolveMiddleware($before);
return function (Request $request, Application $app) use ($getBefore) {
$callback = $getBefore($request);
if (!is_callable($callback)) {
return null;
}
... | php | protected function resolveBefore($before)
{
$getBefore = $this->resolveMiddleware($before);
return function (Request $request, Application $app) use ($getBefore) {
$callback = $getBefore($request);
if (!is_callable($callback)) {
return null;
}
... | [
"protected",
"function",
"resolveBefore",
"(",
"$",
"before",
")",
"{",
"$",
"getBefore",
"=",
"$",
"this",
"->",
"resolveMiddleware",
"(",
"$",
"before",
")",
";",
"return",
"function",
"(",
"Request",
"$",
"request",
",",
"Application",
"$",
"app",
")",
... | Returns a closure that will resolve the middleware callback
to call on kernel request and call it.
@param array|string|null $before
@return \Closure | [
"Returns",
"a",
"closure",
"that",
"will",
"resolve",
"the",
"middleware",
"callback",
"to",
"call",
"on",
"kernel",
"request",
"and",
"call",
"it",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/ConfigurableBase.php#L115-L127 |
bolt/bolt | src/Controller/ConfigurableBase.php | ConfigurableBase.resolveAfter | protected function resolveAfter($after)
{
$getAfter = $this->resolveMiddleware($after);
return function (Request $request, Response $response, Application $app) use ($getAfter) {
$callback = $getAfter($request);
if (!is_callable($callback)) {
return null;
... | php | protected function resolveAfter($after)
{
$getAfter = $this->resolveMiddleware($after);
return function (Request $request, Response $response, Application $app) use ($getAfter) {
$callback = $getAfter($request);
if (!is_callable($callback)) {
return null;
... | [
"protected",
"function",
"resolveAfter",
"(",
"$",
"after",
")",
"{",
"$",
"getAfter",
"=",
"$",
"this",
"->",
"resolveMiddleware",
"(",
"$",
"after",
")",
";",
"return",
"function",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
",",
... | Returns a closure that will resolve the middleware callback
to call on kernel response and call it.
@param array|string|null $after
@return \Closure | [
"Returns",
"a",
"closure",
"that",
"will",
"resolve",
"the",
"middleware",
"callback",
"to",
"call",
"on",
"kernel",
"response",
"and",
"call",
"it",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/ConfigurableBase.php#L137-L149 |
bolt/bolt | src/Controller/ConfigurableBase.php | ConfigurableBase.resolveMiddleware | protected function resolveMiddleware($callback)
{
$callbackResolver = $this->callbackResolver;
return function (Request $request) use ($callback, $callbackResolver) {
if (!is_string($callback) || substr($callback, 0, 2) !== '::') {
return $callbackResolver->resolveCallba... | php | protected function resolveMiddleware($callback)
{
$callbackResolver = $this->callbackResolver;
return function (Request $request) use ($callback, $callbackResolver) {
if (!is_string($callback) || substr($callback, 0, 2) !== '::') {
return $callbackResolver->resolveCallba... | [
"protected",
"function",
"resolveMiddleware",
"(",
"$",
"callback",
")",
"{",
"$",
"callbackResolver",
"=",
"$",
"this",
"->",
"callbackResolver",
";",
"return",
"function",
"(",
"Request",
"$",
"request",
")",
"use",
"(",
"$",
"callback",
",",
"$",
"callbac... | Returns a closure that will resolve the class to use
in middleware callback if one isn't specified.
@param array|string|null $callback
@return \Closure Invoke to get middleware callback | [
"Returns",
"a",
"closure",
"that",
"will",
"resolve",
"the",
"class",
"to",
"use",
"in",
"middleware",
"callback",
"if",
"one",
"isn",
"t",
"specified",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/ConfigurableBase.php#L159-L184 |
bolt/bolt | src/Twig/TwigRecordsView.php | TwigRecordsView.setupDefaults | protected function setupDefaults()
{
$this->addTransformer('html', function ($value) {
return new Markup($value, 'UTF-8');
});
$this->addTransformer('text', function ($value) {
return new Markup($value, 'UTF-8');
});
$this->addTransformer('textarea', f... | php | protected function setupDefaults()
{
$this->addTransformer('html', function ($value) {
return new Markup($value, 'UTF-8');
});
$this->addTransformer('text', function ($value) {
return new Markup($value, 'UTF-8');
});
$this->addTransformer('textarea', f... | [
"protected",
"function",
"setupDefaults",
"(",
")",
"{",
"$",
"this",
"->",
"addTransformer",
"(",
"'html'",
",",
"function",
"(",
"$",
"value",
")",
"{",
"return",
"new",
"Markup",
"(",
"$",
"value",
",",
"'UTF-8'",
")",
";",
"}",
")",
";",
"$",
"th... | Here we register some transformers that prepare the fields to be passed to
twig. For repeaters and blocks this is recursive. | [
"Here",
"we",
"register",
"some",
"transformers",
"that",
"prepare",
"the",
"fields",
"to",
"be",
"passed",
"to",
"twig",
".",
"For",
"repeaters",
"and",
"blocks",
"this",
"is",
"recursive",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/TwigRecordsView.php#L40-L72 |
bolt/bolt | src/Twig/TwigRecordsView.php | TwigRecordsView.createView | public function createView($records)
{
if ($records instanceof Content) {
$this->processSingleRecord($records);
} elseif ($records instanceof QueryResultset) {
$this->processRecords($records);
}
return $records;
} | php | public function createView($records)
{
if ($records instanceof Content) {
$this->processSingleRecord($records);
} elseif ($records instanceof QueryResultset) {
$this->processRecords($records);
}
return $records;
} | [
"public",
"function",
"createView",
"(",
"$",
"records",
")",
"{",
"if",
"(",
"$",
"records",
"instanceof",
"Content",
")",
"{",
"$",
"this",
"->",
"processSingleRecord",
"(",
"$",
"records",
")",
";",
"}",
"elseif",
"(",
"$",
"records",
"instanceof",
"Q... | This loads the relevant record or records and activates the class.
@param Content|QueryResultset $records
@return Content|QueryResultset | [
"This",
"loads",
"the",
"relevant",
"record",
"or",
"records",
"and",
"activates",
"the",
"class",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/TwigRecordsView.php#L81-L90 |
bolt/bolt | src/Twig/TwigRecordsView.php | TwigRecordsView.transform | protected function transform($value, $label, array $fieldData = [])
{
if ($this->hasTransformer($label)) {
return $this->transformers[$label]($value, $fieldData);
}
return $value;
} | php | protected function transform($value, $label, array $fieldData = [])
{
if ($this->hasTransformer($label)) {
return $this->transformers[$label]($value, $fieldData);
}
return $value;
} | [
"protected",
"function",
"transform",
"(",
"$",
"value",
",",
"$",
"label",
",",
"array",
"$",
"fieldData",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasTransformer",
"(",
"$",
"label",
")",
")",
"{",
"return",
"$",
"this",
"->",
"tra... | @param $value
@param $label
@param array $fieldData
@return mixed | [
"@param",
"$value",
"@param",
"$label",
"@param",
"array",
"$fieldData"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/TwigRecordsView.php#L159-L166 |
bolt/bolt | src/EventListener/AccessControlListener.php | AccessControlListener.onStorageEventPostSave | public function onStorageEventPostSave(StorageEvent $event)
{
/** @var Entity\Users $userEntity */
$userEntity = $event->getContent();
if (!$userEntity instanceof Entity\Users) {
return;
}
if (!$userEntity->isEnabled()) {
$this->deleteAuthtokens($user... | php | public function onStorageEventPostSave(StorageEvent $event)
{
/** @var Entity\Users $userEntity */
$userEntity = $event->getContent();
if (!$userEntity instanceof Entity\Users) {
return;
}
if (!$userEntity->isEnabled()) {
$this->deleteAuthtokens($user... | [
"public",
"function",
"onStorageEventPostSave",
"(",
"StorageEvent",
"$",
"event",
")",
"{",
"/** @var Entity\\Users $userEntity */",
"$",
"userEntity",
"=",
"$",
"event",
"->",
"getContent",
"(",
")",
";",
"if",
"(",
"!",
"$",
"userEntity",
"instanceof",
"Entity"... | Remove sessions & authtokens when a user is disabled.
@param StorageEvent $event | [
"Remove",
"sessions",
"&",
"authtokens",
"when",
"a",
"user",
"is",
"disabled",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/AccessControlListener.php#L53-L65 |
bolt/bolt | src/EventListener/AccessControlListener.php | AccessControlListener.onStorageEventPreDelete | public function onStorageEventPreDelete(StorageEvent $event)
{
/** @var Entity\Users $userEntity */
$userEntity = $event->getContent();
if (!$userEntity instanceof Entity\Users) {
return;
}
$this->deleteAuthtokens($userEntity);
$this->deleteSessions($user... | php | public function onStorageEventPreDelete(StorageEvent $event)
{
/** @var Entity\Users $userEntity */
$userEntity = $event->getContent();
if (!$userEntity instanceof Entity\Users) {
return;
}
$this->deleteAuthtokens($userEntity);
$this->deleteSessions($user... | [
"public",
"function",
"onStorageEventPreDelete",
"(",
"StorageEvent",
"$",
"event",
")",
"{",
"/** @var Entity\\Users $userEntity */",
"$",
"userEntity",
"=",
"$",
"event",
"->",
"getContent",
"(",
")",
";",
"if",
"(",
"!",
"$",
"userEntity",
"instanceof",
"Entity... | Remove sessions & authtokens when a user is deleted.
@param StorageEvent $event | [
"Remove",
"sessions",
"&",
"authtokens",
"when",
"a",
"user",
"is",
"deleted",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/AccessControlListener.php#L72-L82 |
bolt/bolt | src/EventListener/AccessControlListener.php | AccessControlListener.deleteAuthtokens | private function deleteAuthtokens(Entity\Users $user)
{
/** @var Repository\AuthtokenRepository $repo */
$repo = $this->em->getRepository(Entity\Authtoken::class);
$repo->deleteTokens($user->getId());
} | php | private function deleteAuthtokens(Entity\Users $user)
{
/** @var Repository\AuthtokenRepository $repo */
$repo = $this->em->getRepository(Entity\Authtoken::class);
$repo->deleteTokens($user->getId());
} | [
"private",
"function",
"deleteAuthtokens",
"(",
"Entity",
"\\",
"Users",
"$",
"user",
")",
"{",
"/** @var Repository\\AuthtokenRepository $repo */",
"$",
"repo",
"=",
"$",
"this",
"->",
"em",
"->",
"getRepository",
"(",
"Entity",
"\\",
"Authtoken",
"::",
"class",
... | Delete any save authtokens for a user.
@param Entity\Users $user | [
"Delete",
"any",
"save",
"authtokens",
"for",
"a",
"user",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/AccessControlListener.php#L89-L94 |
bolt/bolt | src/EventListener/AccessControlListener.php | AccessControlListener.deleteSessions | private function deleteSessions(Entity\Users $user)
{
$savePath = $this->sessionStorage->getOptions()->get('save_path');
try {
$sessionFiles = $this->filesystem->find()->files()->in($savePath);
} catch (FileNotFoundException $e) {
return;
}
/** @var \... | php | private function deleteSessions(Entity\Users $user)
{
$savePath = $this->sessionStorage->getOptions()->get('save_path');
try {
$sessionFiles = $this->filesystem->find()->files()->in($savePath);
} catch (FileNotFoundException $e) {
return;
}
/** @var \... | [
"private",
"function",
"deleteSessions",
"(",
"Entity",
"\\",
"Users",
"$",
"user",
")",
"{",
"$",
"savePath",
"=",
"$",
"this",
"->",
"sessionStorage",
"->",
"getOptions",
"(",
")",
"->",
"get",
"(",
"'save_path'",
")",
";",
"try",
"{",
"$",
"sessionFil... | Delete active session files for a user.
@param Entity\Users $user | [
"Delete",
"active",
"session",
"files",
"for",
"a",
"user",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/AccessControlListener.php#L101-L125 |
bolt/bolt | src/Controller/Backend/Authentication.php | Authentication.getLogin | public function getLogin(Request $request)
{
$user = $this->getUser();
if ($user && $user->getEnabled() == 1) {
$response = $this->redirectToRoute('dashboard');
$token = $this->session()->get('authentication');
$this->setAuthenticationCookie($request, $response, ... | php | public function getLogin(Request $request)
{
$user = $this->getUser();
if ($user && $user->getEnabled() == 1) {
$response = $this->redirectToRoute('dashboard');
$token = $this->session()->get('authentication');
$this->setAuthenticationCookie($request, $response, ... | [
"public",
"function",
"getLogin",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getUser",
"(",
")",
";",
"if",
"(",
"$",
"user",
"&&",
"$",
"user",
"->",
"getEnabled",
"(",
")",
"==",
"1",
")",
"{",
"$",
"respons... | Login page and "Forgotten password" page.
@param Request $request
@return TemplateResponse|RedirectResponse|Response | [
"Login",
"page",
"and",
"Forgotten",
"password",
"page",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Authentication.php#L55-L98 |
bolt/bolt | src/Controller/Backend/Authentication.php | Authentication.logout | public function logout(Request $request)
{
$event = new AccessControlEvent($request);
/** @var Token $sessionAuth */
$sessionAuth = $this->session()->get('authentication');
$userId = $sessionAuth ? $sessionAuth->getToken()->getUserId() : false;
if ($userId && $sessionAuth->ge... | php | public function logout(Request $request)
{
$event = new AccessControlEvent($request);
/** @var Token $sessionAuth */
$sessionAuth = $this->session()->get('authentication');
$userId = $sessionAuth ? $sessionAuth->getToken()->getUserId() : false;
if ($userId && $sessionAuth->ge... | [
"public",
"function",
"logout",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"event",
"=",
"new",
"AccessControlEvent",
"(",
"$",
"request",
")",
";",
"/** @var Token $sessionAuth */",
"$",
"sessionAuth",
"=",
"$",
"this",
"->",
"session",
"(",
")",
"->",
... | Logout page.
@param Request $request
@return RedirectResponse | [
"Logout",
"page",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Authentication.php#L121-L148 |
bolt/bolt | src/Controller/Backend/Authentication.php | Authentication.resetPassword | public function resetPassword(Request $request)
{
$event = new AccessControlEvent($request);
$this->password()->resetPasswordConfirm($request->get('token'), $request->getClientIp(), $event);
return $this->redirectToRoute('login', ['action' => 'login']);
} | php | public function resetPassword(Request $request)
{
$event = new AccessControlEvent($request);
$this->password()->resetPasswordConfirm($request->get('token'), $request->getClientIp(), $event);
return $this->redirectToRoute('login', ['action' => 'login']);
} | [
"public",
"function",
"resetPassword",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"event",
"=",
"new",
"AccessControlEvent",
"(",
"$",
"request",
")",
";",
"$",
"this",
"->",
"password",
"(",
")",
"->",
"resetPasswordConfirm",
"(",
"$",
"request",
"->"... | Reset the password. This route is normally only reached when the user
clicks a "password reset" link in the email.
@param Request $request
@return \Symfony\Component\HttpFoundation\RedirectResponse | [
"Reset",
"the",
"password",
".",
"This",
"route",
"is",
"normally",
"only",
"reached",
"when",
"the",
"user",
"clicks",
"a",
"password",
"reset",
"link",
"in",
"the",
"email",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Authentication.php#L158-L164 |
bolt/bolt | src/Controller/Backend/Authentication.php | Authentication.handlePostLogin | private function handlePostLogin(Request $request, FormInterface $form)
{
$event = new AccessControlEvent($request);
$username = $form->get('username')->getData();
$password = $form->get('password')->getData();
if (!$this->login()->login($username, $password, $event)) {
... | php | private function handlePostLogin(Request $request, FormInterface $form)
{
$event = new AccessControlEvent($request);
$username = $form->get('username')->getData();
$password = $form->get('password')->getData();
if (!$this->login()->login($username, $password, $event)) {
... | [
"private",
"function",
"handlePostLogin",
"(",
"Request",
"$",
"request",
",",
"FormInterface",
"$",
"form",
")",
"{",
"$",
"event",
"=",
"new",
"AccessControlEvent",
"(",
"$",
"request",
")",
";",
"$",
"username",
"=",
"$",
"form",
"->",
"get",
"(",
"'u... | Handle a login POST.
@param Request $request
@param FormInterface $form
@return Response | [
"Handle",
"a",
"login",
"POST",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Authentication.php#L174-L199 |
bolt/bolt | src/Controller/Backend/Authentication.php | Authentication.handlePostReset | private function handlePostReset(Request $request, FormInterface $form)
{
$event = new AccessControlEvent($request);
$username = $form->get('username')->getData();
// Send a password request mail, if username exists.
if ($username === null || $username === '') {
$this->f... | php | private function handlePostReset(Request $request, FormInterface $form)
{
$event = new AccessControlEvent($request);
$username = $form->get('username')->getData();
// Send a password request mail, if username exists.
if ($username === null || $username === '') {
$this->f... | [
"private",
"function",
"handlePostReset",
"(",
"Request",
"$",
"request",
",",
"FormInterface",
"$",
"form",
")",
"{",
"$",
"event",
"=",
"new",
"AccessControlEvent",
"(",
"$",
"request",
")",
";",
"$",
"username",
"=",
"$",
"form",
"->",
"get",
"(",
"'u... | Handle a password reset POST.
@param Request $request
@param FormInterface $form
@return RedirectResponse | [
"Handle",
"a",
"password",
"reset",
"POST",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Authentication.php#L209-L226 |
bolt/bolt | src/Nut/UserAdd.php | UserAdd.configure | protected function configure()
{
$this
->setName('user:add')
->setDescription('Add a new user.')
->addArgument('username', InputArgument::REQUIRED, 'User (login) name for the new user')
->addArgument('displayname', InputArgument::REQUIRED, 'Display name for th... | php | protected function configure()
{
$this
->setName('user:add')
->setDescription('Add a new user.')
->addArgument('username', InputArgument::REQUIRED, 'User (login) name for the new user')
->addArgument('displayname', InputArgument::REQUIRED, 'Display name for th... | [
"protected",
"function",
"configure",
"(",
")",
"{",
"$",
"this",
"->",
"setName",
"(",
"'user:add'",
")",
"->",
"setDescription",
"(",
"'Add a new user.'",
")",
"->",
"addArgument",
"(",
"'username'",
",",
"InputArgument",
"::",
"REQUIRED",
",",
"'User (login) ... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/UserAdd.php#L23-L35 |
bolt/bolt | src/Nut/UserAdd.php | UserAdd.interact | protected function interact(InputInterface $input, OutputInterface $output)
{
try {
$input->validate();
} catch (RuntimeException $e) {
$this->askUserName($input);
$this->askDisplayName($input);
$this->askEmail($input);
$this->askPassword($... | php | protected function interact(InputInterface $input, OutputInterface $output)
{
try {
$input->validate();
} catch (RuntimeException $e) {
$this->askUserName($input);
$this->askDisplayName($input);
$this->askEmail($input);
$this->askPassword($... | [
"protected",
"function",
"interact",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"try",
"{",
"$",
"input",
"->",
"validate",
"(",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"$",
"e",
")",
"{",
"$",
"this",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/UserAdd.php#L40-L51 |
bolt/bolt | src/Nut/UserAdd.php | UserAdd.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
/** @var \Bolt\Storage\Repository\UsersRepository $repo */
$repo = $this->app['storage']->getRepository(Entity\Users::class);
$userEntity = new Entity\Users([
'username' => $input->getArgument('userna... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
/** @var \Bolt\Storage\Repository\UsersRepository $repo */
$repo = $this->app['storage']->getRepository(Entity\Users::class);
$userEntity = new Entity\Users([
'username' => $input->getArgument('userna... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"/** @var \\Bolt\\Storage\\Repository\\UsersRepository $repo */",
"$",
"repo",
"=",
"$",
"this",
"->",
"app",
"[",
"'storage'",
"]",
"->",
"getR... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/UserAdd.php#L56-L90 |
bolt/bolt | src/Nut/UserAdd.php | UserAdd.validate | private function validate(Entity\Users $userEntity)
{
$options = [
'allow_extra_fields' => true,
'csrf_protection' => false,
];
/** @var FormInterface $form */
$form = $this->app['form.factory']->createBuilder(FormType\UserNewType::class, $userEntity, $opt... | php | private function validate(Entity\Users $userEntity)
{
$options = [
'allow_extra_fields' => true,
'csrf_protection' => false,
];
/** @var FormInterface $form */
$form = $this->app['form.factory']->createBuilder(FormType\UserNewType::class, $userEntity, $opt... | [
"private",
"function",
"validate",
"(",
"Entity",
"\\",
"Users",
"$",
"userEntity",
")",
"{",
"$",
"options",
"=",
"[",
"'allow_extra_fields'",
"=>",
"true",
",",
"'csrf_protection'",
"=>",
"false",
",",
"]",
";",
"/** @var FormInterface $form */",
"$",
"form",
... | @param Entity\Users $userEntity
@return array|null | [
"@param",
"Entity",
"\\",
"Users",
"$userEntity"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/UserAdd.php#L97-L120 |
bolt/bolt | src/Translation/TranslationFile.php | TranslationFile.buildPath | private function buildPath($domain, $locale)
{
$path = '/resources/translations/' . $locale . '/' . $domain . '.' . $locale . '.yml';
// If long locale dir doesn't exists try short locale and return it if that exists
if (strlen($locale) == 5 && !is_dir($this->app['path_resolver']->resolve('... | php | private function buildPath($domain, $locale)
{
$path = '/resources/translations/' . $locale . '/' . $domain . '.' . $locale . '.yml';
// If long locale dir doesn't exists try short locale and return it if that exists
if (strlen($locale) == 5 && !is_dir($this->app['path_resolver']->resolve('... | [
"private",
"function",
"buildPath",
"(",
"$",
"domain",
",",
"$",
"locale",
")",
"{",
"$",
"path",
"=",
"'/resources/translations/'",
".",
"$",
"locale",
".",
"'/'",
".",
"$",
"domain",
".",
"'.'",
".",
"$",
"locale",
".",
"'.yml'",
";",
"// If long loca... | Get the path to a tranlsation resource.
@param string $domain Requested resource
@param string $locale Requested locale
@return array [absolute path, relative path] | [
"Get",
"the",
"path",
"to",
"a",
"tranlsation",
"resource",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Translation/TranslationFile.php#L54-L71 |
bolt/bolt | src/Translation/TranslationFile.php | TranslationFile.addTranslatable | private function addTranslatable($text)
{
if (strlen($text) > 1 && !isset($this->translatables[$text])) {
$this->translatables[$text] = '';
}
} | php | private function addTranslatable($text)
{
if (strlen($text) > 1 && !isset($this->translatables[$text])) {
$this->translatables[$text] = '';
}
} | [
"private",
"function",
"addTranslatable",
"(",
"$",
"text",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"text",
")",
">",
"1",
"&&",
"!",
"isset",
"(",
"$",
"this",
"->",
"translatables",
"[",
"$",
"text",
"]",
")",
")",
"{",
"$",
"this",
"->",
"tra... | Adds a string to the internal list of translatable strings.
@param string $text | [
"Adds",
"a",
"string",
"to",
"the",
"internal",
"list",
"of",
"translatable",
"strings",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Translation/TranslationFile.php#L88-L93 |
bolt/bolt | src/Translation/TranslationFile.php | TranslationFile.scanTwigFiles | private function scanTwigFiles()
{
$finder = new Finder();
$finder->files()
->ignoreVCS(true)
->name('*.twig')
->notName('*~')
->exclude(['cache', 'config', 'database', 'resources', 'tests', 'bower_components', 'node_modules'])
->in($this->... | php | private function scanTwigFiles()
{
$finder = new Finder();
$finder->files()
->ignoreVCS(true)
->name('*.twig')
->notName('*~')
->exclude(['cache', 'config', 'database', 'resources', 'tests', 'bower_components', 'node_modules'])
->in($this->... | [
"private",
"function",
"scanTwigFiles",
"(",
")",
"{",
"$",
"finder",
"=",
"new",
"Finder",
"(",
")",
";",
"$",
"finder",
"->",
"files",
"(",
")",
"->",
"ignoreVCS",
"(",
"true",
")",
"->",
"name",
"(",
"'*.twig'",
")",
"->",
"notName",
"(",
"'*~'",
... | Scan twig templates for __('...' and __("..." and add the strings found to the list of translatable strings. | [
"Scan",
"twig",
"templates",
"for",
"__",
"(",
"...",
"and",
"__",
"(",
"...",
"and",
"add",
"the",
"strings",
"found",
"to",
"the",
"list",
"of",
"translatable",
"strings",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Translation/TranslationFile.php#L98-L125 |
bolt/bolt | src/Translation/TranslationFile.php | TranslationFile.scanPhpFiles | private function scanPhpFiles()
{
$finder = new Finder();
$finder->files()
->ignoreVCS(true)
->name('*.php')
->notName('*~')
->exclude(['cache', 'config', 'database', 'resources', 'tests', 'vendor'])
->in(__DIR__ . DIRECTORY_SEPARATOR . '..... | php | private function scanPhpFiles()
{
$finder = new Finder();
$finder->files()
->ignoreVCS(true)
->name('*.php')
->notName('*~')
->exclude(['cache', 'config', 'database', 'resources', 'tests', 'vendor'])
->in(__DIR__ . DIRECTORY_SEPARATOR . '..... | [
"private",
"function",
"scanPhpFiles",
"(",
")",
"{",
"$",
"finder",
"=",
"new",
"Finder",
"(",
")",
";",
"$",
"finder",
"->",
"files",
"(",
")",
"->",
"ignoreVCS",
"(",
"true",
")",
"->",
"name",
"(",
"'*.php'",
")",
"->",
"notName",
"(",
"'*~'",
... | Scan php files for __('...' and __("..." and add the strings found to the list of translatable strings.
All translatable strings have to be called with:
__("text", params=[], domain='messages', locale=null) // $app['translator']->trans()
__("text", count, params=[], domain='messages', locale=null) // $app['translator... | [
"Scan",
"php",
"files",
"for",
"__",
"(",
"...",
"and",
"__",
"(",
"...",
"and",
"add",
"the",
"strings",
"found",
"to",
"the",
"list",
"of",
"translatable",
"strings",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Translation/TranslationFile.php#L134-L208 |
bolt/bolt | src/Translation/TranslationFile.php | TranslationFile.gatherTranslatableStrings | private function gatherTranslatableStrings()
{
$this->translatables = [];
$this->scanTwigFiles();
$this->scanPhpFiles();
ksort($this->translatables);
} | php | private function gatherTranslatableStrings()
{
$this->translatables = [];
$this->scanTwigFiles();
$this->scanPhpFiles();
ksort($this->translatables);
} | [
"private",
"function",
"gatherTranslatableStrings",
"(",
")",
"{",
"$",
"this",
"->",
"translatables",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"scanTwigFiles",
"(",
")",
";",
"$",
"this",
"->",
"scanPhpFiles",
"(",
")",
";",
"ksort",
"(",
"$",
"this",
"... | Find all twig templates and bolt php code, extract translatables strings, merge with existing translations. | [
"Find",
"all",
"twig",
"templates",
"and",
"bolt",
"php",
"code",
"extract",
"translatables",
"strings",
"merge",
"with",
"existing",
"translations",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Translation/TranslationFile.php#L213-L221 |
bolt/bolt | src/Translation/TranslationFile.php | TranslationFile.buildNewContent | private function buildNewContent($newTranslations, $savedTranslations, $hinting = [])
{
// Presort
$unusedTranslations = $savedTranslations;
$transByType = [
'Unused' => [' Unused messages', []],
'TodoReal' => [' Legacy untranslated messages', []],
'Todo... | php | private function buildNewContent($newTranslations, $savedTranslations, $hinting = [])
{
// Presort
$unusedTranslations = $savedTranslations;
$transByType = [
'Unused' => [' Unused messages', []],
'TodoReal' => [' Legacy untranslated messages', []],
'Todo... | [
"private",
"function",
"buildNewContent",
"(",
"$",
"newTranslations",
",",
"$",
"savedTranslations",
",",
"$",
"hinting",
"=",
"[",
"]",
")",
"{",
"// Presort",
"$",
"unusedTranslations",
"=",
"$",
"savedTranslations",
";",
"$",
"transByType",
"=",
"[",
"'Unu... | Builds the translations file data with added translations.
@param array $newTranslations New translation data to write
@param array $savedTranslations Translation data read from file
@param array $hinting Translation data that can be used as hinting
@return string | [
"Builds",
"the",
"translations",
"file",
"data",
"with",
"added",
"translations",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Translation/TranslationFile.php#L232-L329 |
bolt/bolt | src/Translation/TranslationFile.php | TranslationFile.readSavedTranslations | private function readSavedTranslations()
{
if (!is_file($this->absPath) || !is_readable($this->absPath)) {
return null;
}
try {
$savedTranslations = Yaml::parse(file_get_contents($this->absPath), true);
} catch (ParseException $e) {
$this->app['lo... | php | private function readSavedTranslations()
{
if (!is_file($this->absPath) || !is_readable($this->absPath)) {
return null;
}
try {
$savedTranslations = Yaml::parse(file_get_contents($this->absPath), true);
} catch (ParseException $e) {
$this->app['lo... | [
"private",
"function",
"readSavedTranslations",
"(",
")",
"{",
"if",
"(",
"!",
"is_file",
"(",
"$",
"this",
"->",
"absPath",
")",
"||",
"!",
"is_readable",
"(",
"$",
"this",
"->",
"absPath",
")",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"$",... | Parses translations file and returns translations.
@return array|null Translations found | [
"Parses",
"translations",
"file",
"and",
"returns",
"translations",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Translation/TranslationFile.php#L336-L372 |
bolt/bolt | src/Translation/TranslationFile.php | TranslationFile.contentInfo | private function contentInfo()
{
$path = $this->absPath;
// if the file doesn't exist yet, point to the fallback one
if (!file_exists($path) || filesize($path) < 10) {
// fallback
$localeFallbacks = $this->app['locale_fallbacks'];
list($path) = $this->bui... | php | private function contentInfo()
{
$path = $this->absPath;
// if the file doesn't exist yet, point to the fallback one
if (!file_exists($path) || filesize($path) < 10) {
// fallback
$localeFallbacks = $this->app['locale_fallbacks'];
list($path) = $this->bui... | [
"private",
"function",
"contentInfo",
"(",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"absPath",
";",
"// if the file doesn't exist yet, point to the fallback one",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"path",
")",
"||",
"filesize",
"(",
"$",
"path",
"... | Get the content of the info translation file or the fallback file.
@return string | [
"Get",
"the",
"content",
"of",
"the",
"info",
"translation",
"file",
"or",
"the",
"fallback",
"file",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Translation/TranslationFile.php#L379-L400 |
bolt/bolt | src/Translation/TranslationFile.php | TranslationFile.contentMessages | private function contentMessages()
{
$savedTranslations = $this->readSavedTranslations();
// An exception occurred when reading the file
if ($savedTranslations === null) {
return '';
}
$this->gatherTranslatableStrings();
// Find already translated string... | php | private function contentMessages()
{
$savedTranslations = $this->readSavedTranslations();
// An exception occurred when reading the file
if ($savedTranslations === null) {
return '';
}
$this->gatherTranslatableStrings();
// Find already translated string... | [
"private",
"function",
"contentMessages",
"(",
")",
"{",
"$",
"savedTranslations",
"=",
"$",
"this",
"->",
"readSavedTranslations",
"(",
")",
";",
"// An exception occurred when reading the file",
"if",
"(",
"$",
"savedTranslations",
"===",
"null",
")",
"{",
"return... | Gets all translatable strings and returns a translationsfile for messages or contenttypes.
@return string | [
"Gets",
"all",
"translatable",
"strings",
"and",
"returns",
"a",
"translationsfile",
"for",
"messages",
"or",
"contenttypes",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Translation/TranslationFile.php#L407-L430 |
bolt/bolt | src/Translation/TranslationFile.php | TranslationFile.isWriteAllowed | public function isWriteAllowed()
{
$msgRepl = ['%s' => $this->relPath];
// No file, directory not writable
if (!file_exists($this->absPath) && (!is_writable(dirname($this->absPath)) && !is_writable(dirname(dirname($this->absPath))))) {
$msg = Trans::__(
"The tran... | php | public function isWriteAllowed()
{
$msgRepl = ['%s' => $this->relPath];
// No file, directory not writable
if (!file_exists($this->absPath) && (!is_writable(dirname($this->absPath)) && !is_writable(dirname(dirname($this->absPath))))) {
$msg = Trans::__(
"The tran... | [
"public",
"function",
"isWriteAllowed",
"(",
")",
"{",
"$",
"msgRepl",
"=",
"[",
"'%s'",
"=>",
"$",
"this",
"->",
"relPath",
"]",
";",
"// No file, directory not writable",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"absPath",
")",
"&&",
"(",
... | Checks if translations file is allowed to write to.
@return bool | [
"Checks",
"if",
"translations",
"file",
"is",
"allowed",
"to",
"write",
"to",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Translation/TranslationFile.php#L452-L483 |
bolt/bolt | src/AccessControl/Login.php | Login.login | public function login($userName, $password, AccessControlEvent $event)
{
$authCookie = $this->requestStack->getCurrentRequest()->cookies->get($this->authTokenName);
// Remove expired tokens
$this->getRepositoryAuthtoken()->deleteExpiredTokens();
if ($userName !== null && $password ... | php | public function login($userName, $password, AccessControlEvent $event)
{
$authCookie = $this->requestStack->getCurrentRequest()->cookies->get($this->authTokenName);
// Remove expired tokens
$this->getRepositoryAuthtoken()->deleteExpiredTokens();
if ($userName !== null && $password ... | [
"public",
"function",
"login",
"(",
"$",
"userName",
",",
"$",
"password",
",",
"AccessControlEvent",
"$",
"event",
")",
"{",
"$",
"authCookie",
"=",
"$",
"this",
"->",
"requestStack",
"->",
"getCurrentRequest",
"(",
")",
"->",
"cookies",
"->",
"get",
"(",... | Attempt to login a user with the given password. Accepts username or
email.
@param string $userName
@param string $password
@param AccessControlEvent $event
@throws AccessControlException
@return bool | [
"Attempt",
"to",
"login",
"a",
"user",
"with",
"the",
"given",
"password",
".",
"Accepts",
"username",
"or",
"email",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Login.php#L68-L83 |
bolt/bolt | src/AccessControl/Login.php | Login.loginCheckUser | protected function loginCheckUser($userName, $password, AccessControlEvent $event, $ignorePassword = false)
{
if (!$userEntity = $this->getUserEntity($userName)) {
$this->dispatcher->dispatch(AccessControlEvents::LOGIN_FAILURE, $event->setReason(AccessControlEvents::FAILURE_INVALID));
... | php | protected function loginCheckUser($userName, $password, AccessControlEvent $event, $ignorePassword = false)
{
if (!$userEntity = $this->getUserEntity($userName)) {
$this->dispatcher->dispatch(AccessControlEvents::LOGIN_FAILURE, $event->setReason(AccessControlEvents::FAILURE_INVALID));
... | [
"protected",
"function",
"loginCheckUser",
"(",
"$",
"userName",
",",
"$",
"password",
",",
"AccessControlEvent",
"$",
"event",
",",
"$",
"ignorePassword",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"userEntity",
"=",
"$",
"this",
"->",
"getUserEntity",
... | Check a user login request for username/password combinations.
@param string $userName
@param string|null $password
@param AccessControlEvent $event
@param bool $ignorePassword
@return bool | [
"Check",
"a",
"user",
"login",
"request",
"for",
"username",
"/",
"password",
"combinations",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Login.php#L123-L175 |
bolt/bolt | src/AccessControl/Login.php | Login.loginCheckAuthtoken | protected function loginCheckAuthtoken($authCookie, AccessControlEvent $event)
{
if (!$userTokenEntity = $this->getRepositoryAuthtoken()->getToken($authCookie, $this->getClientIp(), $this->getClientUserAgent())) {
$this->flashLogger->error(Trans::__('general.phrase.error-login-invalid-parameters... | php | protected function loginCheckAuthtoken($authCookie, AccessControlEvent $event)
{
if (!$userTokenEntity = $this->getRepositoryAuthtoken()->getToken($authCookie, $this->getClientIp(), $this->getClientUserAgent())) {
$this->flashLogger->error(Trans::__('general.phrase.error-login-invalid-parameters... | [
"protected",
"function",
"loginCheckAuthtoken",
"(",
"$",
"authCookie",
",",
"AccessControlEvent",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"userTokenEntity",
"=",
"$",
"this",
"->",
"getRepositoryAuthtoken",
"(",
")",
"->",
"getToken",
"(",
"$",
"authCook... | Attempt to login a user via the bolt_authtoken cookie.
@param string $authCookie
@param AccessControlEvent $event
@return bool | [
"Attempt",
"to",
"login",
"a",
"user",
"via",
"the",
"bolt_authtoken",
"cookie",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Login.php#L185-L220 |
bolt/bolt | src/AccessControl/Login.php | Login.getUserEntity | protected function getUserEntity($userName)
{
if (!$userEntity = $this->getRepositoryUsers()->getUser($userName)) {
$this->flashLogger->error(Trans::__('general.phrase.error-user-name-password-incorrect'));
return null;
}
if (!$userEntity->getEnabled()) {
... | php | protected function getUserEntity($userName)
{
if (!$userEntity = $this->getRepositoryUsers()->getUser($userName)) {
$this->flashLogger->error(Trans::__('general.phrase.error-user-name-password-incorrect'));
return null;
}
if (!$userEntity->getEnabled()) {
... | [
"protected",
"function",
"getUserEntity",
"(",
"$",
"userName",
")",
"{",
"if",
"(",
"!",
"$",
"userEntity",
"=",
"$",
"this",
"->",
"getRepositoryUsers",
"(",
")",
"->",
"getUser",
"(",
"$",
"userName",
")",
")",
"{",
"$",
"this",
"->",
"flashLogger",
... | Get the user record entity if it exists.
@param string $userName
@return Entity\Users|null | [
"Get",
"the",
"user",
"record",
"entity",
"if",
"it",
"exists",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Login.php#L229-L245 |
bolt/bolt | src/AccessControl/Login.php | Login.loginFinish | protected function loginFinish(Entity\Users $userEntity)
{
if (!$this->updateUserLogin($userEntity)) {
return false;
}
$tokenEntity = $this->updateAuthToken($userEntity);
$token = new Token($userEntity, $tokenEntity);
$this->session->migrate(false, 0);
$... | php | protected function loginFinish(Entity\Users $userEntity)
{
if (!$this->updateUserLogin($userEntity)) {
return false;
}
$tokenEntity = $this->updateAuthToken($userEntity);
$token = new Token($userEntity, $tokenEntity);
$this->session->migrate(false, 0);
$... | [
"protected",
"function",
"loginFinish",
"(",
"Entity",
"\\",
"Users",
"$",
"userEntity",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"updateUserLogin",
"(",
"$",
"userEntity",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"tokenEntity",
"=",
"$",
"... | Finish user login process(es).
@param Entity\Users $userEntity
@return bool | [
"Finish",
"user",
"login",
"process",
"(",
"es",
")",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Login.php#L254-L268 |
bolt/bolt | src/AccessControl/Login.php | Login.loginFailed | protected function loginFailed(Entity\Users $userEntity)
{
$this->flashLogger->error(Trans::__('general.phrase.error-user-name-password-incorrect'));
$this->systemLogger->info("Failed login attempt for '" . $userEntity->getDisplayname() . "'.", ['event' => 'authentication']);
// Update the ... | php | protected function loginFailed(Entity\Users $userEntity)
{
$this->flashLogger->error(Trans::__('general.phrase.error-user-name-password-incorrect'));
$this->systemLogger->info("Failed login attempt for '" . $userEntity->getDisplayname() . "'.", ['event' => 'authentication']);
// Update the ... | [
"protected",
"function",
"loginFailed",
"(",
"Entity",
"\\",
"Users",
"$",
"userEntity",
")",
"{",
"$",
"this",
"->",
"flashLogger",
"->",
"error",
"(",
"Trans",
"::",
"__",
"(",
"'general.phrase.error-user-name-password-incorrect'",
")",
")",
";",
"$",
"this",
... | Add error messages to logs and update the user.
@param Entity\Users $userEntity
@return false | [
"Add",
"error",
"messages",
"to",
"logs",
"and",
"update",
"the",
"user",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Login.php#L277-L289 |
bolt/bolt | src/AccessControl/Login.php | Login.updateUserLogin | protected function updateUserLogin(Entity\Users $userEntity)
{
$userEntity->setLastseen(Carbon::now());
$userEntity->setLastip($this->getClientIp());
$userEntity->setFailedlogins(0);
$userEntity->setThrottleduntil($this->throttleUntil(0));
$userEntity = $this->updateUserShado... | php | protected function updateUserLogin(Entity\Users $userEntity)
{
$userEntity->setLastseen(Carbon::now());
$userEntity->setLastip($this->getClientIp());
$userEntity->setFailedlogins(0);
$userEntity->setThrottleduntil($this->throttleUntil(0));
$userEntity = $this->updateUserShado... | [
"protected",
"function",
"updateUserLogin",
"(",
"Entity",
"\\",
"Users",
"$",
"userEntity",
")",
"{",
"$",
"userEntity",
"->",
"setLastseen",
"(",
"Carbon",
"::",
"now",
"(",
")",
")",
";",
"$",
"userEntity",
"->",
"setLastip",
"(",
"$",
"this",
"->",
"... | Update the user record with latest login information.
@param Entity\Users $userEntity
@return bool | [
"Update",
"the",
"user",
"record",
"with",
"latest",
"login",
"information",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Login.php#L298-L321 |
bolt/bolt | src/AccessControl/Login.php | Login.updateUserShadowLogin | protected function updateUserShadowLogin(Entity\Users $userEntity)
{
if (Carbon::now() > $userEntity->getShadowvalidity()) {
$userEntity->setShadowpassword(null);
$userEntity->setShadowtoken(null);
$userEntity->setShadowvalidity(null);
}
return $userEntit... | php | protected function updateUserShadowLogin(Entity\Users $userEntity)
{
if (Carbon::now() > $userEntity->getShadowvalidity()) {
$userEntity->setShadowpassword(null);
$userEntity->setShadowtoken(null);
$userEntity->setShadowvalidity(null);
}
return $userEntit... | [
"protected",
"function",
"updateUserShadowLogin",
"(",
"Entity",
"\\",
"Users",
"$",
"userEntity",
")",
"{",
"if",
"(",
"Carbon",
"::",
"now",
"(",
")",
">",
"$",
"userEntity",
"->",
"getShadowvalidity",
"(",
")",
")",
"{",
"$",
"userEntity",
"->",
"setSha... | Remove expired shadow login data.
@param Entity\Users $userEntity
@return Entity\Users | [
"Remove",
"expired",
"shadow",
"login",
"data",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Login.php#L330-L339 |
bolt/bolt | src/AccessControl/Login.php | Login.updateAuthToken | protected function updateAuthToken(Entity\Users $userEntity)
{
$userName = $userEntity->getUsername();
$cookieLifetime = (int) $this->cookieOptions['lifetime'];
$repo = $this->getRepositoryAuthtoken();
try {
$tokenEntity = $repo->getUserToken($userEntity->getId(), $this->... | php | protected function updateAuthToken(Entity\Users $userEntity)
{
$userName = $userEntity->getUsername();
$cookieLifetime = (int) $this->cookieOptions['lifetime'];
$repo = $this->getRepositoryAuthtoken();
try {
$tokenEntity = $repo->getUserToken($userEntity->getId(), $this->... | [
"protected",
"function",
"updateAuthToken",
"(",
"Entity",
"\\",
"Users",
"$",
"userEntity",
")",
"{",
"$",
"userName",
"=",
"$",
"userEntity",
"->",
"getUsername",
"(",
")",
";",
"$",
"cookieLifetime",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"cookieOptio... | Set the Authtoken cookie and DB-entry. If it's already present, update it.
@param Entity\Users $userEntity
@throws DriverException
@return Entity\Authtoken | [
"Set",
"the",
"Authtoken",
"cookie",
"and",
"DB",
"-",
"entry",
".",
"If",
"it",
"s",
"already",
"present",
"update",
"it",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Login.php#L350-L394 |
bolt/bolt | src/AccessControl/Login.php | Login.throttleUntil | private function throttleUntil($attempts)
{
if ($attempts < 5) {
return null;
}
$wait = pow(($attempts - 4), 2);
return Carbon::create()->addSeconds($wait);
} | php | private function throttleUntil($attempts)
{
if ($attempts < 5) {
return null;
}
$wait = pow(($attempts - 4), 2);
return Carbon::create()->addSeconds($wait);
} | [
"private",
"function",
"throttleUntil",
"(",
"$",
"attempts",
")",
"{",
"if",
"(",
"$",
"attempts",
"<",
"5",
")",
"{",
"return",
"null",
";",
"}",
"$",
"wait",
"=",
"pow",
"(",
"(",
"$",
"attempts",
"-",
"4",
")",
",",
"2",
")",
";",
"return",
... | Calculate the amount of time until we should throttle login attempts for
a user.
The amount is increased exponentially with each attempt: 1, 4, 9, 16, 25,
36… seconds.
Note: I just realized this is conceptually wrong: we should throttle
based on remote_addr, not username. So, this isn't used, yet.
@param int $attemp... | [
"Calculate",
"the",
"amount",
"of",
"time",
"until",
"we",
"should",
"throttle",
"login",
"attempts",
"for",
"a",
"user",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Login.php#L410-L418 |
bolt/bolt | src/Configuration/Check/Result.php | Result.jsonSerialize | public function jsonSerialize()
{
$arr = [];
foreach (array_keys(get_class_vars(__CLASS__)) as $property) {
if ($this->$property instanceof \Exception) {
$arr[$property] = (string) $this->$property;
} else {
$arr[$property] = $this->$property;
... | php | public function jsonSerialize()
{
$arr = [];
foreach (array_keys(get_class_vars(__CLASS__)) as $property) {
if ($this->$property instanceof \Exception) {
$arr[$property] = (string) $this->$property;
} else {
$arr[$property] = $this->$property;
... | [
"public",
"function",
"jsonSerialize",
"(",
")",
"{",
"$",
"arr",
"=",
"[",
"]",
";",
"foreach",
"(",
"array_keys",
"(",
"get_class_vars",
"(",
"__CLASS__",
")",
")",
"as",
"$",
"property",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"$",
"property",
"in... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/Check/Result.php#L127-L139 |
bolt/bolt | src/Form/FormType/UserLoginType.php | UserLoginType.buildForm | public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add(
'username',
TextType::class,
[
'constraints' => [
new Assert\NotBlank(),
new Assert\Lengt... | php | public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add(
'username',
TextType::class,
[
'constraints' => [
new Assert\NotBlank(),
new Assert\Lengt... | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"'username'",
",",
"TextType",
"::",
"class",
",",
"[",
"'constraints'",
"=>",
"[",
"new",
"Assert",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/FormType/UserLoginType.php#L25-L61 |
bolt/bolt | src/Storage/Query/QueryParameterParser.php | QueryParameterParser.getFilter | public function getFilter($key, $value = null)
{
if (!$this->expr instanceof ExpressionBuilder) {
throw new QueryParseException('Cannot call method without an Expression Builder parameter set', 1);
}
/** @var callable $callback */
foreach ($this->filterHandlers as $callb... | php | public function getFilter($key, $value = null)
{
if (!$this->expr instanceof ExpressionBuilder) {
throw new QueryParseException('Cannot call method without an Expression Builder parameter set', 1);
}
/** @var callable $callback */
foreach ($this->filterHandlers as $callb... | [
"public",
"function",
"getFilter",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"expr",
"instanceof",
"ExpressionBuilder",
")",
"{",
"throw",
"new",
"QueryParseException",
"(",
"'Cannot call method without an Ex... | Runs the keys/values through the relevant parsers.
@param string $key
@param mixed $value
@throws QueryParseException
@throws QueryParseException
@return Filter|null | [
"Runs",
"the",
"keys",
"/",
"values",
"through",
"the",
"relevant",
"parsers",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/QueryParameterParser.php#L85-L100 |
bolt/bolt | src/Storage/Query/QueryParameterParser.php | QueryParameterParser.incorrectQueryHandler | public function incorrectQueryHandler($key, $value, $expr)
{
if (!is_string($value)) {
return null;
}
if (strpos($value, '&&') && strpos($value, '||')) {
throw new QueryParseException('Mixed && and || operators are not supported', 1);
}
} | php | public function incorrectQueryHandler($key, $value, $expr)
{
if (!is_string($value)) {
return null;
}
if (strpos($value, '&&') && strpos($value, '||')) {
throw new QueryParseException('Mixed && and || operators are not supported', 1);
}
} | [
"public",
"function",
"incorrectQueryHandler",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"expr",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"strpos",
"(",
"$",
"value",
",",
... | Handles some errors in key/value string formatting.
@param string $key
@param string $value
@param ExpressionBuilder $expr
@throws QueryParseException
@return null | [
"Handles",
"some",
"errors",
"in",
"key",
"/",
"value",
"string",
"formatting",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/QueryParameterParser.php#L113-L121 |
bolt/bolt | src/Storage/Query/QueryParameterParser.php | QueryParameterParser.multipleKeyAndValueHandler | public function multipleKeyAndValueHandler($key, $value, $expr)
{
if (!strpos($key, '|||')) {
return null;
}
$keys = preg_split('/ *(\|\|\|) */', $key);
$inputKeys = $keys;
$values = preg_split('/ *(\|\|\|) */', $value);
$values = array_pad($values, count... | php | public function multipleKeyAndValueHandler($key, $value, $expr)
{
if (!strpos($key, '|||')) {
return null;
}
$keys = preg_split('/ *(\|\|\|) */', $key);
$inputKeys = $keys;
$values = preg_split('/ *(\|\|\|) */', $value);
$values = array_pad($values, count... | [
"public",
"function",
"multipleKeyAndValueHandler",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"expr",
")",
"{",
"if",
"(",
"!",
"strpos",
"(",
"$",
"key",
",",
"'|||'",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"keys",
"=",
"preg_split",
... | This handler processes 'triple pipe' queries as implemented in Bolt
It looks for three pipes in the key and value and creates an OR composite
expression for example: 'username|||email':'fred|||pete'.
@param string $key
@param string $value
@param ExpressionBuilder $expr
@throws QueryParseExcepti... | [
"This",
"handler",
"processes",
"triple",
"pipe",
"queries",
"as",
"implemented",
"in",
"Bolt",
"It",
"looks",
"for",
"three",
"pipes",
"in",
"the",
"key",
"and",
"value",
"and",
"creates",
"an",
"OR",
"composite",
"expression",
"for",
"example",
":",
"usern... | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/QueryParameterParser.php#L136-L174 |
bolt/bolt | src/Storage/Query/QueryParameterParser.php | QueryParameterParser.multipleValueHandler | public function multipleValueHandler($key, $value, $expr)
{
if (!is_string($value)) {
return null;
}
if (strpos($value, '&&') === false && strpos($value, '||') === false) {
return null;
}
$values = preg_split('/ *(&&|\|\|) */', $value, -1, PREG_SPLIT_... | php | public function multipleValueHandler($key, $value, $expr)
{
if (!is_string($value)) {
return null;
}
if (strpos($value, '&&') === false && strpos($value, '||') === false) {
return null;
}
$values = preg_split('/ *(&&|\|\|) */', $value, -1, PREG_SPLIT_... | [
"public",
"function",
"multipleValueHandler",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"expr",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"strpos",
"(",
"$",
"value",
",",
... | This handler processes multiple value queries as defined in the Bolt 'Fetching Content'
documentation. It allows a value to be parsed to and AND/OR expression.
For example, this handler will correctly parse values like:
'username': 'fred||bob'
'id': '<5 && !1'
@param string $key
@param string $v... | [
"This",
"handler",
"processes",
"multiple",
"value",
"queries",
"as",
"defined",
"in",
"the",
"Bolt",
"Fetching",
"Content",
"documentation",
".",
"It",
"allows",
"a",
"value",
"to",
"be",
"parsed",
"to",
"and",
"AND",
"/",
"OR",
"expression",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/QueryParameterParser.php#L192-L231 |
bolt/bolt | src/Storage/Query/QueryParameterParser.php | QueryParameterParser.defaultFilterHandler | public function defaultFilterHandler($key, $value, $expr)
{
$filter = new Filter();
$filter->setKey($key);
if (is_array($value)) {
$count = 1;
$composite = $expr->andX();
foreach ($value as $paramName => $valueItem) {
$val = $this->parse... | php | public function defaultFilterHandler($key, $value, $expr)
{
$filter = new Filter();
$filter->setKey($key);
if (is_array($value)) {
$count = 1;
$composite = $expr->andX();
foreach ($value as $paramName => $valueItem) {
$val = $this->parse... | [
"public",
"function",
"defaultFilterHandler",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"expr",
")",
"{",
"$",
"filter",
"=",
"new",
"Filter",
"(",
")",
";",
"$",
"filter",
"->",
"setKey",
"(",
"$",
"key",
")",
";",
"if",
"(",
"is_array",
"(",
... | The default handler is the last to be run and handler simple value parsing.
@param string $key
@param string|array $value
@param ExpressionBuilder $expr
@throws QueryParseException
@return Filter | [
"The",
"default",
"handler",
"is",
"the",
"last",
"to",
"be",
"run",
"and",
"handler",
"simple",
"value",
"parsing",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/QueryParameterParser.php#L244-L276 |
bolt/bolt | src/Storage/Query/QueryParameterParser.php | QueryParameterParser.parseValue | public function parseValue($value)
{
foreach ($this->valueMatchers as $matcher) {
$regex = sprintf('/%s/u', $matcher['token']);
$values = $matcher['params'];
if (preg_match($regex, $value)) {
if (is_callable($values['value'])) {
preg_ma... | php | public function parseValue($value)
{
foreach ($this->valueMatchers as $matcher) {
$regex = sprintf('/%s/u', $matcher['token']);
$values = $matcher['params'];
if (preg_match($regex, $value)) {
if (is_callable($values['value'])) {
preg_ma... | [
"public",
"function",
"parseValue",
"(",
"$",
"value",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"valueMatchers",
"as",
"$",
"matcher",
")",
"{",
"$",
"regex",
"=",
"sprintf",
"(",
"'/%s/u'",
",",
"$",
"matcher",
"[",
"'token'",
"]",
")",
";",
"$"... | This method uses the defined value matchers to parse a passed in value.
The following component parts will be returned in the array:
[
'value' => <the value remaining after the parse>
'operator' => <the operator that should be used>
'matched' => <the pattern that the value matched>
]
@param string $value Value to... | [
"This",
"method",
"uses",
"the",
"defined",
"value",
"matchers",
"to",
"parse",
"a",
"passed",
"in",
"value",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/QueryParameterParser.php#L294-L313 |
bolt/bolt | src/Storage/Query/QueryParameterParser.php | QueryParameterParser.addValueMatcher | public function addValueMatcher($token, array $params = [], $priority = null)
{
if ($priority) {
array_unshift($this->valueMatchers, ['token' => $token, 'params' => $params]);
} else {
$this->valueMatchers[] = ['token' => $token, 'params' => $params];
}
} | php | public function addValueMatcher($token, array $params = [], $priority = null)
{
if ($priority) {
array_unshift($this->valueMatchers, ['token' => $token, 'params' => $params]);
} else {
$this->valueMatchers[] = ['token' => $token, 'params' => $params];
}
} | [
"public",
"function",
"addValueMatcher",
"(",
"$",
"token",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"priority",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"priority",
")",
"{",
"array_unshift",
"(",
"$",
"this",
"->",
"valueMatchers",
",",
... | Adds an additional token to parse for value parameters.
This gives the ability to define additional value -> operator matches
@param string $token Regex pattern to match against
@param array $params Options to provide to the matched param
@param bool $priority If set item will be prepended to start of list | [
"Adds",
"an",
"additional",
"token",
"to",
"parse",
"for",
"value",
"parameters",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/QueryParameterParser.php#L339-L346 |
bolt/bolt | src/Storage/Database/Prefill/ImageClient.php | ImageClient.get | public function get($url)
{
$url = str_replace('__random__', rand(100000, 999999), $url);
return $this->client->get($url, ['timeout' => 10])->getBody();
} | php | public function get($url)
{
$url = str_replace('__random__', rand(100000, 999999), $url);
return $this->client->get($url, ['timeout' => 10])->getBody();
} | [
"public",
"function",
"get",
"(",
"$",
"url",
")",
"{",
"$",
"url",
"=",
"str_replace",
"(",
"'__random__'",
",",
"rand",
"(",
"100000",
",",
"999999",
")",
",",
"$",
"url",
")",
";",
"return",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"$",
... | Fetches an image from a remote source.
@param string $url URL of the remote image to fetch
@return StreamInterface | [
"Fetches",
"an",
"image",
"from",
"a",
"remote",
"source",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Prefill/ImageClient.php#L33-L38 |
bolt/bolt | src/Twig/Extension/WidgetExtension.php | WidgetExtension.getFunctions | public function getFunctions()
{
$safe = ['is_safe' => ['html']];
$env = ['needs_environment' => true];
return [
// @codingStandardsIgnoreStart
new TwigFunction('countwidgets', [Runtime\WidgetRuntime::class, 'countWidgets'], $safe + $env),
new TwigFunctio... | php | public function getFunctions()
{
$safe = ['is_safe' => ['html']];
$env = ['needs_environment' => true];
return [
// @codingStandardsIgnoreStart
new TwigFunction('countwidgets', [Runtime\WidgetRuntime::class, 'countWidgets'], $safe + $env),
new TwigFunctio... | [
"public",
"function",
"getFunctions",
"(",
")",
"{",
"$",
"safe",
"=",
"[",
"'is_safe'",
"=>",
"[",
"'html'",
"]",
"]",
";",
"$",
"env",
"=",
"[",
"'needs_environment'",
"=>",
"true",
"]",
";",
"return",
"[",
"// @codingStandardsIgnoreStart",
"new",
"TwigF... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Extension/WidgetExtension.php#L21-L34 |
bolt/bolt | src/Filesystem/Handler/NullableImage.php | NullableImage.getInfo | public function getInfo($cache = true)
{
if (!$cache) {
$this->info = null;
}
if (!$this->info) {
try {
$this->info = $this->filesystem->getImageInfo($this->path);
} catch (IOException $e) {
$this->info = Image\Info::createE... | php | public function getInfo($cache = true)
{
if (!$cache) {
$this->info = null;
}
if (!$this->info) {
try {
$this->info = $this->filesystem->getImageInfo($this->path);
} catch (IOException $e) {
$this->info = Image\Info::createE... | [
"public",
"function",
"getInfo",
"(",
"$",
"cache",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"cache",
")",
"{",
"$",
"this",
"->",
"info",
"=",
"null",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"info",
")",
"{",
"try",
"{",
"$",
"this",... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Filesystem/Handler/NullableImage.php#L17-L31 |
bolt/bolt | src/Twig/Runtime/BoltRuntime.php | BoltRuntime.fieldType | public function fieldType($content, $column, $subField = null)
{
if ($content instanceof Content) {
$name = (string) $content->getContenttype();
} elseif ($content instanceof LegacyContent) {
$name = $content->contenttype['slug'];
} elseif (is_string($content)) {
... | php | public function fieldType($content, $column, $subField = null)
{
if ($content instanceof Content) {
$name = (string) $content->getContenttype();
} elseif ($content instanceof LegacyContent) {
$name = $content->contenttype['slug'];
} elseif (is_string($content)) {
... | [
"public",
"function",
"fieldType",
"(",
"$",
"content",
",",
"$",
"column",
",",
"$",
"subField",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"content",
"instanceof",
"Content",
")",
"{",
"$",
"name",
"=",
"(",
"string",
")",
"$",
"content",
"->",
"getCon... | @param Content|LegacyContent|string $content
@param Column|string $column
@param string $subField
@return string | [
"@param",
"Content|LegacyContent|string",
"$content",
"@param",
"Column|string",
"$column",
"@param",
"string",
"$subField"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/BoltRuntime.php#L51-L64 |
bolt/bolt | src/Storage/Entity/ContentUriTrait.php | ContentUriTrait.getUri | protected function getUri($id = 0, $fulluri = true, $slugfield = 'slug')
{
$title = $this->getTitle();
$contenttype = $this->getContenttype();
$repo = $this->app['storage']->getRepository($contenttype);
$tablename = $repo->getTableName();
$id = intval($id);
$slug = $t... | php | protected function getUri($id = 0, $fulluri = true, $slugfield = 'slug')
{
$title = $this->getTitle();
$contenttype = $this->getContenttype();
$repo = $this->app['storage']->getRepository($contenttype);
$tablename = $repo->getTableName();
$id = intval($id);
$slug = $t... | [
"protected",
"function",
"getUri",
"(",
"$",
"id",
"=",
"0",
",",
"$",
"fulluri",
"=",
"true",
",",
"$",
"slugfield",
"=",
"'slug'",
")",
"{",
"$",
"title",
"=",
"$",
"this",
"->",
"getTitle",
"(",
")",
";",
"$",
"contenttype",
"=",
"$",
"this",
... | Get a unique URL for a record
@param integer $id
@param boolean $fulluri
@param string $slugfield
@return string | [
"Get",
"a",
"unique",
"URL",
"for",
"a",
"record"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentUriTrait.php#L18-L81 |
bolt/bolt | src/Extension/ConfigTrait.php | ConfigTrait.extendConfigService | protected function extendConfigService()
{
$app = $this->getContainer();
$extFields = (array) $this->registerFields();
if ($extFields === []) {
return;
}
$newFields = [];
foreach ($extFields as $fieldClass) {
if (!$fieldClass instanceof Field... | php | protected function extendConfigService()
{
$app = $this->getContainer();
$extFields = (array) $this->registerFields();
if ($extFields === []) {
return;
}
$newFields = [];
foreach ($extFields as $fieldClass) {
if (!$fieldClass instanceof Field... | [
"protected",
"function",
"extendConfigService",
"(",
")",
"{",
"$",
"app",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
";",
"$",
"extFields",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"registerFields",
"(",
")",
";",
"if",
"(",
"$",
"extFields",... | Call this in register method. | [
"Call",
"this",
"in",
"register",
"method",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/ConfigTrait.php#L44-L75 |
bolt/bolt | src/Extension/ConfigTrait.php | ConfigTrait.getConfig | protected function getConfig()
{
if ($this->config !== null) {
return $this->config;
}
$this->config = $this->getDefaultConfig();
$app = $this->getContainer();
$file = $app['filesystem']->getFile(strtolower("extensions_config://{$this->getName()}.{$this->getVen... | php | protected function getConfig()
{
if ($this->config !== null) {
return $this->config;
}
$this->config = $this->getDefaultConfig();
$app = $this->getContainer();
$file = $app['filesystem']->getFile(strtolower("extensions_config://{$this->getName()}.{$this->getVen... | [
"protected",
"function",
"getConfig",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"config",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"config",
";",
"}",
"$",
"this",
"->",
"config",
"=",
"$",
"this",
"->",
"getDefaultConfig",
"(",
")",
... | Returns the config for the extension.
@return array | [
"Returns",
"the",
"config",
"for",
"the",
"extension",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/ConfigTrait.php#L93-L121 |
bolt/bolt | src/Extension/ConfigTrait.php | ConfigTrait.addConfig | private function addConfig(ParsableInterface $file)
{
$app = $this->getContainer();
try {
$newConfig = $file->parse();
} catch (RuntimeException $e) {
$app['logger.flash']->danger($e->getMessage());
$app['logger.system']->error($e->getMessage(), ['event' ... | php | private function addConfig(ParsableInterface $file)
{
$app = $this->getContainer();
try {
$newConfig = $file->parse();
} catch (RuntimeException $e) {
$app['logger.flash']->danger($e->getMessage());
$app['logger.system']->error($e->getMessage(), ['event' ... | [
"private",
"function",
"addConfig",
"(",
"ParsableInterface",
"$",
"file",
")",
"{",
"$",
"app",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
";",
"try",
"{",
"$",
"newConfig",
"=",
"$",
"file",
"->",
"parse",
"(",
")",
";",
"}",
"catch",
"(",
... | Merge in a yaml file to the config.
@param ParsableInterface $file | [
"Merge",
"in",
"a",
"yaml",
"file",
"to",
"the",
"config",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/ConfigTrait.php#L128-L143 |
bolt/bolt | src/Extension/ConfigTrait.php | ConfigTrait.copyDistFile | private function copyDistFile(FileInterface $file)
{
$distFile = $this->getBaseDirectory()->getFile('config/config.yml.dist');
$file->write($distFile->read());
$app = $this->getContainer();
$app['logger.system']->info(
sprintf('Copied %s to %s', $distFile->getFullPath(),... | php | private function copyDistFile(FileInterface $file)
{
$distFile = $this->getBaseDirectory()->getFile('config/config.yml.dist');
$file->write($distFile->read());
$app = $this->getContainer();
$app['logger.system']->info(
sprintf('Copied %s to %s', $distFile->getFullPath(),... | [
"private",
"function",
"copyDistFile",
"(",
"FileInterface",
"$",
"file",
")",
"{",
"$",
"distFile",
"=",
"$",
"this",
"->",
"getBaseDirectory",
"(",
")",
"->",
"getFile",
"(",
"'config/config.yml.dist'",
")",
";",
"$",
"file",
"->",
"write",
"(",
"$",
"di... | Copy config.yml.dist to extension config dir.
@param FileInterface $file | [
"Copy",
"config",
".",
"yml",
".",
"dist",
"to",
"extension",
"config",
"dir",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/ConfigTrait.php#L150-L160 |
bolt/bolt | src/Logger/Manager.php | Manager.trim | public function trim($log)
{
$period = new \DateTime('-7 day');
if ($log === 'change') {
$this->changeRepository->trimLog($period);
} elseif ($log === 'system') {
$this->systemRepository->trimLog($period);
} else {
throw new \UnexpectedValueExcepti... | php | public function trim($log)
{
$period = new \DateTime('-7 day');
if ($log === 'change') {
$this->changeRepository->trimLog($period);
} elseif ($log === 'system') {
$this->systemRepository->trimLog($period);
} else {
throw new \UnexpectedValueExcepti... | [
"public",
"function",
"trim",
"(",
"$",
"log",
")",
"{",
"$",
"period",
"=",
"new",
"\\",
"DateTime",
"(",
"'-7 day'",
")",
";",
"if",
"(",
"$",
"log",
"===",
"'change'",
")",
"{",
"$",
"this",
"->",
"changeRepository",
"->",
"trimLog",
"(",
"$",
"... | Trim the log.
@param string $log
@throws \UnexpectedValueException | [
"Trim",
"the",
"log",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Logger/Manager.php#L44-L54 |
bolt/bolt | src/Logger/Manager.php | Manager.clear | public function clear($log)
{
if ($log === 'change') {
$this->changeRepository->clearLog();
} elseif ($log === 'system') {
$this->systemRepository->clearLog();
} else {
throw new \UnexpectedValueException("Invalid log type requested: $log");
}
... | php | public function clear($log)
{
if ($log === 'change') {
$this->changeRepository->clearLog();
} elseif ($log === 'system') {
$this->systemRepository->clearLog();
} else {
throw new \UnexpectedValueException("Invalid log type requested: $log");
}
... | [
"public",
"function",
"clear",
"(",
"$",
"log",
")",
"{",
"if",
"(",
"$",
"log",
"===",
"'change'",
")",
"{",
"$",
"this",
"->",
"changeRepository",
"->",
"clearLog",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"log",
"===",
"'system'",
")",
"{",
"$",
... | Clear a log.
@param string $log
@throws \UnexpectedValueException | [
"Clear",
"a",
"log",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Logger/Manager.php#L63-L74 |
bolt/bolt | src/Logger/Manager.php | Manager.getActivity | public function getActivity($log, $page = 1, $amount = 10, $options = [])
{
if ($log == 'change') {
$repo = $this->changeRepository;
} elseif ($log == 'system') {
$repo = $this->systemRepository;
} else {
throw new \UnexpectedValueException("Invalid log ty... | php | public function getActivity($log, $page = 1, $amount = 10, $options = [])
{
if ($log == 'change') {
$repo = $this->changeRepository;
} elseif ($log == 'system') {
$repo = $this->systemRepository;
} else {
throw new \UnexpectedValueException("Invalid log ty... | [
"public",
"function",
"getActivity",
"(",
"$",
"log",
",",
"$",
"page",
"=",
"1",
",",
"$",
"amount",
"=",
"10",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"log",
"==",
"'change'",
")",
"{",
"$",
"repo",
"=",
"$",
"this",
"... | Get a specific activity log.
@param string $log The log to query. Either 'change' or 'system'
@param int $page
@param int $amount Number of results to return
@param array $options
@throws \UnexpectedValueException
@return array | [
"Get",
"a",
"specific",
"activity",
"log",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Logger/Manager.php#L88-L117 |
bolt/bolt | src/Logger/Manager.php | Manager.getListingData | public function getListingData(array $contenttype, $contentId, array $queryOptions)
{
// We have a content type, and possibly a content ID.
$content = null;
if ($contentId) {
$content = $this->app['storage']->getContent($contenttype['slug'], ['id' => $contentId, 'hydrate' => fal... | php | public function getListingData(array $contenttype, $contentId, array $queryOptions)
{
// We have a content type, and possibly a content ID.
$content = null;
if ($contentId) {
$content = $this->app['storage']->getContent($contenttype['slug'], ['id' => $contentId, 'hydrate' => fal... | [
"public",
"function",
"getListingData",
"(",
"array",
"$",
"contenttype",
",",
"$",
"contentId",
",",
"array",
"$",
"queryOptions",
")",
"{",
"// We have a content type, and possibly a content ID.",
"$",
"content",
"=",
"null",
";",
"if",
"(",
"$",
"contentId",
")... | Get the listing data such as title and count.
@param array $contenttype The ContentType
@param int $contentId The content ID
@param array $queryOptions
@return array | [
"Get",
"the",
"listing",
"data",
"such",
"as",
"title",
"and",
"count",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Logger/Manager.php#L128-L168 |
bolt/bolt | src/Twig/Extension/BoltExtension.php | BoltExtension.getFunctions | public function getFunctions()
{
$env = ['needs_environment' => true];
$deprecated = ['deprecated' => true];
return [
// @codingStandardsIgnoreStart
new TwigFunction('first', 'twig_first', $env + $deprecated),
new TwigFunction('last', 'twig_l... | php | public function getFunctions()
{
$env = ['needs_environment' => true];
$deprecated = ['deprecated' => true];
return [
// @codingStandardsIgnoreStart
new TwigFunction('first', 'twig_first', $env + $deprecated),
new TwigFunction('last', 'twig_l... | [
"public",
"function",
"getFunctions",
"(",
")",
"{",
"$",
"env",
"=",
"[",
"'needs_environment'",
"=>",
"true",
"]",
";",
"$",
"deprecated",
"=",
"[",
"'deprecated'",
"=>",
"true",
"]",
";",
"return",
"[",
"// @codingStandardsIgnoreStart",
"new",
"TwigFunction... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Extension/BoltExtension.php#L64-L76 |
bolt/bolt | src/Twig/Extension/BoltExtension.php | BoltExtension.getFilters | public function getFilters()
{
$env = ['needs_environment' => true];
$deprecated = ['deprecated' => true];
return [
new TwigFilter('ucfirst', 'twig_capitalize_string_filter', $env + $deprecated + ['alternative' => 'capitalize']),
new TwigFilter('fieldtype', [BoltRu... | php | public function getFilters()
{
$env = ['needs_environment' => true];
$deprecated = ['deprecated' => true];
return [
new TwigFilter('ucfirst', 'twig_capitalize_string_filter', $env + $deprecated + ['alternative' => 'capitalize']),
new TwigFilter('fieldtype', [BoltRu... | [
"public",
"function",
"getFilters",
"(",
")",
"{",
"$",
"env",
"=",
"[",
"'needs_environment'",
"=>",
"true",
"]",
";",
"$",
"deprecated",
"=",
"[",
"'deprecated'",
"=>",
"true",
"]",
";",
"return",
"[",
"new",
"TwigFilter",
"(",
"'ucfirst'",
",",
"'twig... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Extension/BoltExtension.php#L81-L90 |
bolt/bolt | src/Twig/Extension/BoltExtension.php | BoltExtension.getGlobals | public function getGlobals()
{
return [
'bolt_name' => Bolt\Version::name(),
'bolt_version' => Bolt\Version::VERSION,
'frontend' => null,
'backend' => null,
'async' => null,
'paths' => $this->paths,
... | php | public function getGlobals()
{
return [
'bolt_name' => Bolt\Version::name(),
'bolt_version' => Bolt\Version::VERSION,
'frontend' => null,
'backend' => null,
'async' => null,
'paths' => $this->paths,
... | [
"public",
"function",
"getGlobals",
"(",
")",
"{",
"return",
"[",
"'bolt_name'",
"=>",
"Bolt",
"\\",
"Version",
"::",
"name",
"(",
")",
",",
"'bolt_version'",
"=>",
"Bolt",
"\\",
"Version",
"::",
"VERSION",
",",
"'frontend'",
"=>",
"null",
",",
"'backend'"... | {@inheritdoc}
As of Twig 2.x, the ability to register a global variable after runtime
or the extensions have been initialized will not be possible any longer,
but changing the value of an already registered global is possible. | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Extension/BoltExtension.php#L99-L113 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.