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/Asset/Injector.php | Injector.getMap | public function getMap()
{
return [
Target::END_OF_HEAD => 'headTagEnd',
Target::AFTER_HEAD_JS => 'headTagEnd', // same as end of head because we cheat a little
Target::AFTER_HEAD_CSS => 'headTagEnd', // same as end of head because we cheat a little
... | php | public function getMap()
{
return [
Target::END_OF_HEAD => 'headTagEnd',
Target::AFTER_HEAD_JS => 'headTagEnd', // same as end of head because we cheat a little
Target::AFTER_HEAD_CSS => 'headTagEnd', // same as end of head because we cheat a little
... | [
"public",
"function",
"getMap",
"(",
")",
"{",
"return",
"[",
"Target",
"::",
"END_OF_HEAD",
"=>",
"'headTagEnd'",
",",
"Target",
"::",
"AFTER_HEAD_JS",
"=>",
"'headTagEnd'",
",",
"// same as end of head because we cheat a little",
"Target",
"::",
"AFTER_HEAD_CSS",
"=... | Get a map of function names to locations.
@return array | [
"Get",
"a",
"map",
"of",
"function",
"names",
"to",
"locations",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/Injector.php#L21-L51 |
bolt/bolt | src/Asset/Injector.php | Injector.headTagStart | protected function headTagStart(AssetInterface $asset, $rawHtml)
{
if ($matches = $this->getMatches($rawHtml, '<head', true, false)) {
$replacement = sprintf("%s\n%s\t%s", $matches[0], $matches[1], (string) $asset);
return Str::replaceFirst($rawHtml, $matches[0], $replacement);
... | php | protected function headTagStart(AssetInterface $asset, $rawHtml)
{
if ($matches = $this->getMatches($rawHtml, '<head', true, false)) {
$replacement = sprintf("%s\n%s\t%s", $matches[0], $matches[1], (string) $asset);
return Str::replaceFirst($rawHtml, $matches[0], $replacement);
... | [
"protected",
"function",
"headTagStart",
"(",
"AssetInterface",
"$",
"asset",
",",
"$",
"rawHtml",
")",
"{",
"if",
"(",
"$",
"matches",
"=",
"$",
"this",
"->",
"getMatches",
"(",
"$",
"rawHtml",
",",
"'<head'",
",",
"true",
",",
"false",
")",
")",
"{",... | Helper function to insert some HTML into the start of the head section of
an HTML page, right after the <head> tag.
@param AssetInterface $asset
@param string $rawHtml
@return string | [
"Helper",
"function",
"to",
"insert",
"some",
"HTML",
"into",
"the",
"start",
"of",
"the",
"head",
"section",
"of",
"an",
"HTML",
"page",
"right",
"after",
"the",
"<head",
">",
"tag",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/Injector.php#L80-L89 |
bolt/bolt | src/Asset/Injector.php | Injector.metaTagsAfter | protected function metaTagsAfter(AssetInterface $asset, $rawHtml)
{
if ($matches = $this->getMatches($rawHtml, '<meta', true, true)) {
$last = count($matches[0]) - 1;
$replacement = sprintf("%s\n%s%s", $matches[0][$last], $matches[1][$last], (string) $asset);
return Str:... | php | protected function metaTagsAfter(AssetInterface $asset, $rawHtml)
{
if ($matches = $this->getMatches($rawHtml, '<meta', true, true)) {
$last = count($matches[0]) - 1;
$replacement = sprintf("%s\n%s%s", $matches[0][$last], $matches[1][$last], (string) $asset);
return Str:... | [
"protected",
"function",
"metaTagsAfter",
"(",
"AssetInterface",
"$",
"asset",
",",
"$",
"rawHtml",
")",
"{",
"if",
"(",
"$",
"matches",
"=",
"$",
"this",
"->",
"getMatches",
"(",
"$",
"rawHtml",
",",
"'<meta'",
",",
"true",
",",
"true",
")",
")",
"{",... | Helper function to insert some HTML into the head section of an HTML page.
@param AssetInterface $asset
@param string $rawHtml
@return string | [
"Helper",
"function",
"to",
"insert",
"some",
"HTML",
"into",
"the",
"head",
"section",
"of",
"an",
"HTML",
"page",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/Injector.php#L179-L189 |
bolt/bolt | src/Asset/Injector.php | Injector.jsTagsAfter | protected function jsTagsAfter($asset, $rawHtml, $insidehead = false)
{
if ($insidehead) {
$pos = strpos($rawHtml, '</head>');
$context = substr($rawHtml, 0, $pos);
} else {
$context = $rawHtml;
}
// This match tag is a unique case
if ($ma... | php | protected function jsTagsAfter($asset, $rawHtml, $insidehead = false)
{
if ($insidehead) {
$pos = strpos($rawHtml, '</head>');
$context = substr($rawHtml, 0, $pos);
} else {
$context = $rawHtml;
}
// This match tag is a unique case
if ($ma... | [
"protected",
"function",
"jsTagsAfter",
"(",
"$",
"asset",
",",
"$",
"rawHtml",
",",
"$",
"insidehead",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"insidehead",
")",
"{",
"$",
"pos",
"=",
"strpos",
"(",
"$",
"rawHtml",
",",
"'</head>'",
")",
";",
"$",
... | Helper function to insert some HTML after the last javascript include.
First in the head section, but if there is no script in the head, place
it anywhere.
@param AssetInterface $asset
@param string $rawHtml
@param bool $insidehead
@return string | [
"Helper",
"function",
"to",
"insert",
"some",
"HTML",
"after",
"the",
"last",
"javascript",
"include",
".",
"First",
"in",
"the",
"head",
"section",
"but",
"if",
"there",
"is",
"no",
"script",
"in",
"the",
"head",
"place",
"it",
"anywhere",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/Injector.php#L260-L282 |
bolt/bolt | src/Asset/Injector.php | Injector.getMatches | private function getMatches($rawHtml, $htmlTag, $matchRemainder, $matchAll)
{
$matches = null;
$matchRemainder = $matchRemainder ? '(.*)' : '';
$regex = sprintf("~^([ \t]*)%s%s~mi", $htmlTag, $matchRemainder);
if ($matchAll && preg_match_all($regex, $rawHtml, $matches)) {
... | php | private function getMatches($rawHtml, $htmlTag, $matchRemainder, $matchAll)
{
$matches = null;
$matchRemainder = $matchRemainder ? '(.*)' : '';
$regex = sprintf("~^([ \t]*)%s%s~mi", $htmlTag, $matchRemainder);
if ($matchAll && preg_match_all($regex, $rawHtml, $matches)) {
... | [
"private",
"function",
"getMatches",
"(",
"$",
"rawHtml",
",",
"$",
"htmlTag",
",",
"$",
"matchRemainder",
",",
"$",
"matchAll",
")",
"{",
"$",
"matches",
"=",
"null",
";",
"$",
"matchRemainder",
"=",
"$",
"matchRemainder",
"?",
"'(.*)'",
":",
"''",
";",... | Get a set of matches.
@param string $rawHtml The original HTML
@param string $htmlTag HTML tag fragment we're matching, e.g. '<head' or '</head'
@param bool $matchRemainder TRUE matches the remainder of the line, not just the tag - (.*)
@param bool $matchAll TRUE returns all matched instances -... | [
"Get",
"a",
"set",
"of",
"matches",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/Injector.php#L294-L307 |
bolt/bolt | src/Storage/Database/Connection.php | Connection.connect | public function connect()
{
try {
return parent::connect();
} catch (DBALException $e) {
if ($this->_eventManager->hasListeners('failConnect')) {
$eventArgs = new FailedConnectionEvent($this, $e);
$this->_eventManager->dispatchEvent('failConnec... | php | public function connect()
{
try {
return parent::connect();
} catch (DBALException $e) {
if ($this->_eventManager->hasListeners('failConnect')) {
$eventArgs = new FailedConnectionEvent($this, $e);
$this->_eventManager->dispatchEvent('failConnec... | [
"public",
"function",
"connect",
"(",
")",
"{",
"try",
"{",
"return",
"parent",
"::",
"connect",
"(",
")",
";",
"}",
"catch",
"(",
"DBALException",
"$",
"e",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_eventManager",
"->",
"hasListeners",
"(",
"'failConn... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Connection.php#L24-L36 |
bolt/bolt | src/Storage/Database/Connection.php | Connection.fetchAll | public function fetchAll($sql, array $params = [], $types = [])
{
$stmt = $this->executeQuery($sql, $params, $types, $this->_queryCacheProfile);
$result = $stmt->fetchAll();
$stmt->closeCursor();
return $result;
} | php | public function fetchAll($sql, array $params = [], $types = [])
{
$stmt = $this->executeQuery($sql, $params, $types, $this->_queryCacheProfile);
$result = $stmt->fetchAll();
$stmt->closeCursor();
return $result;
} | [
"public",
"function",
"fetchAll",
"(",
"$",
"sql",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"types",
"=",
"[",
"]",
")",
"{",
"$",
"stmt",
"=",
"$",
"this",
"->",
"executeQuery",
"(",
"$",
"sql",
",",
"$",
"params",
",",
"$",
"type... | This method wraps the native fetchAll method to pass in the configured QueryCacheProfile.
If the profile is set to null then operation will continue identically to the standard, otherwise
the existence of a cache profile will result in the executeQueryCache() method being called.
@param string $sql the SQL query
@... | [
"This",
"method",
"wraps",
"the",
"native",
"fetchAll",
"method",
"to",
"pass",
"in",
"the",
"configured",
"QueryCacheProfile",
".",
"If",
"the",
"profile",
"is",
"set",
"to",
"null",
"then",
"operation",
"will",
"continue",
"identically",
"to",
"the",
"standa... | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Connection.php#L50-L57 |
bolt/bolt | src/Storage/Database/Connection.php | Connection.executeUpdate | public function executeUpdate($query, array $params = [], array $types = [])
{
$result = parent::executeUpdate($query, $params, $types);
$this->_queryCacheProfile->getResultCacheDriver()->flushAll();
return $result;
} | php | public function executeUpdate($query, array $params = [], array $types = [])
{
$result = parent::executeUpdate($query, $params, $types);
$this->_queryCacheProfile->getResultCacheDriver()->flushAll();
return $result;
} | [
"public",
"function",
"executeUpdate",
"(",
"$",
"query",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"array",
"$",
"types",
"=",
"[",
"]",
")",
"{",
"$",
"result",
"=",
"parent",
"::",
"executeUpdate",
"(",
"$",
"query",
",",
"$",
"params",
"... | Executes an SQL INSERT/UPDATE/DELETE query with the given parameters
and returns the number of affected rows.
This method supports PDO binding types as well as DBAL mapping types.
@param string $query the SQL query
@param array $params the query parameters
@param array $types the parameter types
@throws \Doctrin... | [
"Executes",
"an",
"SQL",
"INSERT",
"/",
"UPDATE",
"/",
"DELETE",
"query",
"with",
"the",
"given",
"parameters",
"and",
"returns",
"the",
"number",
"of",
"affected",
"rows",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Connection.php#L73-L79 |
bolt/bolt | src/Storage/Field/Type/TaxonomyType.php | TaxonomyType.load | public function load(QueryBuilder $query, ClassMetadata $metadata)
{
$field = $this->mapping['fieldname'];
$target = $this->mapping['target'];
$boltname = $metadata->getBoltName();
if ($this->mapping['data']['has_sortorder']) {
$order = "$field.sortorder";
$q... | php | public function load(QueryBuilder $query, ClassMetadata $metadata)
{
$field = $this->mapping['fieldname'];
$target = $this->mapping['target'];
$boltname = $metadata->getBoltName();
if ($this->mapping['data']['has_sortorder']) {
$order = "$field.sortorder";
$q... | [
"public",
"function",
"load",
"(",
"QueryBuilder",
"$",
"query",
",",
"ClassMetadata",
"$",
"metadata",
")",
"{",
"$",
"field",
"=",
"$",
"this",
"->",
"mapping",
"[",
"'fieldname'",
"]",
";",
"$",
"target",
"=",
"$",
"this",
"->",
"mapping",
"[",
"'ta... | For the taxonomy field the load event modifies the query to fetch taxonomies related
to a content record from the join table.
It does this via an additional ->addSelect() and ->leftJoin() call on the QueryBuilder
which includes then includes the taxonomies in the same query as the content fetch.
@param QueryBuilder ... | [
"For",
"the",
"taxonomy",
"field",
"the",
"load",
"event",
"modifies",
"the",
"query",
"to",
"fetch",
"taxonomies",
"related",
"to",
"a",
"content",
"record",
"from",
"the",
"join",
"table",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/TaxonomyType.php#L63-L99 |
bolt/bolt | src/Storage/Field/Type/TaxonomyType.php | TaxonomyType.hydrate | public function hydrate($data, $entity)
{
$taxName = $this->mapping['fieldname'];
$data = $this->normalizeData($data, $taxName, '|');
/** @var Entity\Content $entity */
if (!count($entity->getTaxonomy())) {
$entity->setTaxonomy($this->em->createCollection(Entity\Taxonomy... | php | public function hydrate($data, $entity)
{
$taxName = $this->mapping['fieldname'];
$data = $this->normalizeData($data, $taxName, '|');
/** @var Entity\Content $entity */
if (!count($entity->getTaxonomy())) {
$entity->setTaxonomy($this->em->createCollection(Entity\Taxonomy... | [
"public",
"function",
"hydrate",
"(",
"$",
"data",
",",
"$",
"entity",
")",
"{",
"$",
"taxName",
"=",
"$",
"this",
"->",
"mapping",
"[",
"'fieldname'",
"]",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"normalizeData",
"(",
"$",
"data",
",",
"$",
"tax... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/TaxonomyType.php#L104-L130 |
bolt/bolt | src/Storage/Field/Type/TaxonomyType.php | TaxonomyType.persist | public function persist(QuerySet $queries, $entity)
{
$this->normalize($entity);
$field = $this->mapping['fieldname'];
$taxonomy = $entity->getTaxonomy()
->getField($field);
// Fetch existing taxonomies
$existingDB = $this->getExistingTaxonomies($entity) ?: [];
... | php | public function persist(QuerySet $queries, $entity)
{
$this->normalize($entity);
$field = $this->mapping['fieldname'];
$taxonomy = $entity->getTaxonomy()
->getField($field);
// Fetch existing taxonomies
$existingDB = $this->getExistingTaxonomies($entity) ?: [];
... | [
"public",
"function",
"persist",
"(",
"QuerySet",
"$",
"queries",
",",
"$",
"entity",
")",
"{",
"$",
"this",
"->",
"normalize",
"(",
"$",
"entity",
")",
";",
"$",
"field",
"=",
"$",
"this",
"->",
"mapping",
"[",
"'fieldname'",
"]",
";",
"$",
"taxonom... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/TaxonomyType.php#L135-L163 |
bolt/bolt | src/Storage/Field/Type/TaxonomyType.php | TaxonomyType.getGroup | protected function getGroup(Collection\Taxonomy $taxonomy)
{
$group = null;
$taxData = $this->mapping['data'];
foreach ($taxonomy as $tax) {
if ($taxData['behaves_like'] === 'grouping') {
// Previously we only cared about the last one… so yeah
$nee... | php | protected function getGroup(Collection\Taxonomy $taxonomy)
{
$group = null;
$taxData = $this->mapping['data'];
foreach ($taxonomy as $tax) {
if ($taxData['behaves_like'] === 'grouping') {
// Previously we only cared about the last one… so yeah
$nee... | [
"protected",
"function",
"getGroup",
"(",
"Collection",
"\\",
"Taxonomy",
"$",
"taxonomy",
")",
"{",
"$",
"group",
"=",
"null",
";",
"$",
"taxData",
"=",
"$",
"this",
"->",
"mapping",
"[",
"'data'",
"]",
";",
"foreach",
"(",
"$",
"taxonomy",
"as",
"$",... | @param Collection\Taxonomy $taxonomy
@return array|null | [
"@param",
"Collection",
"\\",
"Taxonomy",
"$taxonomy"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/TaxonomyType.php#L208-L227 |
bolt/bolt | src/Storage/Field/Type/TaxonomyType.php | TaxonomyType.getSortorder | protected function getSortorder(Collection\Taxonomy $taxonomy)
{
$taxData = $this->mapping['data'];
$sortorder = 0;
foreach ($taxonomy as $tax) {
if ($taxData['has_sortorder']) {
$sortorder = $tax->getSortorder();
}
}
return $sortorder... | php | protected function getSortorder(Collection\Taxonomy $taxonomy)
{
$taxData = $this->mapping['data'];
$sortorder = 0;
foreach ($taxonomy as $tax) {
if ($taxData['has_sortorder']) {
$sortorder = $tax->getSortorder();
}
}
return $sortorder... | [
"protected",
"function",
"getSortorder",
"(",
"Collection",
"\\",
"Taxonomy",
"$",
"taxonomy",
")",
"{",
"$",
"taxData",
"=",
"$",
"this",
"->",
"mapping",
"[",
"'data'",
"]",
";",
"$",
"sortorder",
"=",
"0",
";",
"foreach",
"(",
"$",
"taxonomy",
"as",
... | @param Collection\Taxonomy $taxonomy
@return int | [
"@param",
"Collection",
"\\",
"Taxonomy",
"$taxonomy"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/TaxonomyType.php#L234-L245 |
bolt/bolt | src/Storage/Field/Type/TaxonomyType.php | TaxonomyType.getExistingTaxonomies | protected function getExistingTaxonomies($entity)
{
// Fetch existing taxonomies
$query = $this->em->createQueryBuilder()
->select('*')
->from($this->mapping['target'])
->where('content_id = :content_id')
->andWhere('contenttype = :contenttype')
... | php | protected function getExistingTaxonomies($entity)
{
// Fetch existing taxonomies
$query = $this->em->createQueryBuilder()
->select('*')
->from($this->mapping['target'])
->where('content_id = :content_id')
->andWhere('contenttype = :contenttype')
... | [
"protected",
"function",
"getExistingTaxonomies",
"(",
"$",
"entity",
")",
"{",
"// Fetch existing taxonomies",
"$",
"query",
"=",
"$",
"this",
"->",
"em",
"->",
"createQueryBuilder",
"(",
")",
"->",
"select",
"(",
"'*'",
")",
"->",
"from",
"(",
"$",
"this",... | Direct query to get existing taxonomy records.
@param mixed $entity
@return array | [
"Direct",
"query",
"to",
"get",
"existing",
"taxonomy",
"records",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/TaxonomyType.php#L254-L272 |
bolt/bolt | src/Storage/Field/Type/TaxonomyType.php | TaxonomyType.normalize | public function normalize($entity)
{
/** @var Collection\Taxonomy $collection */
$collection = $this->normalizeFromPost($entity, Entity\Taxonomy::class);
if ($collection) {
$entity->setTaxonomy($collection);
}
} | php | public function normalize($entity)
{
/** @var Collection\Taxonomy $collection */
$collection = $this->normalizeFromPost($entity, Entity\Taxonomy::class);
if ($collection) {
$entity->setTaxonomy($collection);
}
} | [
"public",
"function",
"normalize",
"(",
"$",
"entity",
")",
"{",
"/** @var Collection\\Taxonomy $collection */",
"$",
"collection",
"=",
"$",
"this",
"->",
"normalizeFromPost",
"(",
"$",
"entity",
",",
"Entity",
"\\",
"Taxonomy",
"::",
"class",
")",
";",
"if",
... | The normalize method takes care of any pre-persist cleaning up.
For taxonomies that allows us to support non standard data formats such
as arrays that allow this style data setting to work...
`$entity->setCategories(['news', 'events']);`
or
`$entity->setCategories('news');`
@param Entity\Content $entity | [
"The",
"normalize",
"method",
"takes",
"care",
"of",
"any",
"pre",
"-",
"persist",
"cleaning",
"up",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/TaxonomyType.php#L288-L295 |
bolt/bolt | src/Composer/Action/RequirePackage.php | RequirePackage.execute | public function execute(array $package)
{
$this->getComposer();
$io = $this->getIO();
/** @var \Bolt\Filesystem\Handler\JsonFile $jsonFile */
$jsonFile = $this->getOptions()->composerJson();
$newlyCreated = !$jsonFile->exists();
if ($newlyCreated) {
$thi... | php | public function execute(array $package)
{
$this->getComposer();
$io = $this->getIO();
/** @var \Bolt\Filesystem\Handler\JsonFile $jsonFile */
$jsonFile = $this->getOptions()->composerJson();
$newlyCreated = !$jsonFile->exists();
if ($newlyCreated) {
$thi... | [
"public",
"function",
"execute",
"(",
"array",
"$",
"package",
")",
"{",
"$",
"this",
"->",
"getComposer",
"(",
")",
";",
"$",
"io",
"=",
"$",
"this",
"->",
"getIO",
"(",
")",
";",
"/** @var \\Bolt\\Filesystem\\Handler\\JsonFile $jsonFile */",
"$",
"jsonFile",... | Require (install) a package.
@param array $package Package names and version to require
- Format: ['name' => '', 'version' => '']
@throws \Bolt\Exception\PackageManagerException
@return int 0 on success or a positive error code on failure | [
"Require",
"(",
"install",
")",
"a",
"package",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Action/RequirePackage.php#L28-L104 |
bolt/bolt | src/Composer/Action/RequirePackage.php | RequirePackage.updateComposerJson | private function updateComposerJson(JsonFile $jsonFile, array $package, $isPostInstall)
{
$composerJson = $jsonFile->parse();
$sortPackages = $this->getOptions()->sortPackages();
$requireKey = $this->getOptions()->dev() ? 'require-dev' : 'require';
$removeKey = $this->getOptions()->... | php | private function updateComposerJson(JsonFile $jsonFile, array $package, $isPostInstall)
{
$composerJson = $jsonFile->parse();
$sortPackages = $this->getOptions()->sortPackages();
$requireKey = $this->getOptions()->dev() ? 'require-dev' : 'require';
$removeKey = $this->getOptions()->... | [
"private",
"function",
"updateComposerJson",
"(",
"JsonFile",
"$",
"jsonFile",
",",
"array",
"$",
"package",
",",
"$",
"isPostInstall",
")",
"{",
"$",
"composerJson",
"=",
"$",
"jsonFile",
"->",
"parse",
"(",
")",
";",
"$",
"sortPackages",
"=",
"$",
"this"... | Update the JSON file.
@param JsonFile $jsonFile
@param array $package
@param bool $isPostInstall | [
"Update",
"the",
"JSON",
"file",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Action/RequirePackage.php#L113-L134 |
bolt/bolt | src/Composer/Action/RequirePackage.php | RequirePackage.updateFileCleanly | private function updateFileCleanly(JsonFile $jsonFile, array $new, $requireKey, $removeKey, $sortPackages, $isPostInstall)
{
$composerJson = $jsonFile->read();
$manipulator = new JsonManipulator($composerJson);
foreach ($new as $package => $constraint) {
$constraint = $isPostIns... | php | private function updateFileCleanly(JsonFile $jsonFile, array $new, $requireKey, $removeKey, $sortPackages, $isPostInstall)
{
$composerJson = $jsonFile->read();
$manipulator = new JsonManipulator($composerJson);
foreach ($new as $package => $constraint) {
$constraint = $isPostIns... | [
"private",
"function",
"updateFileCleanly",
"(",
"JsonFile",
"$",
"jsonFile",
",",
"array",
"$",
"new",
",",
"$",
"requireKey",
",",
"$",
"removeKey",
",",
"$",
"sortPackages",
",",
"$",
"isPostInstall",
")",
"{",
"$",
"composerJson",
"=",
"$",
"jsonFile",
... | Cleanly update a Composer JSON file.
@param JsonFile $jsonFile
@param array $new
@param string $requireKey
@param string $removeKey
@param bool $sortPackages
@param bool $isPostInstall
@return bool | [
"Cleanly",
"update",
"a",
"Composer",
"JSON",
"file",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Action/RequirePackage.php#L148-L165 |
bolt/bolt | src/Helpers/Image/Thumbnail.php | Thumbnail.setFileName | public function setFileName($fileName)
{
// After v1.5.1 we store image data as an array
if (is_array($fileName)) {
$rawFileName = isset($fileName['filename']) ? $fileName['filename'] : (isset($fileName['file']) ? $fileName['file'] : null);
$this->title = isset($fileName['tit... | php | public function setFileName($fileName)
{
// After v1.5.1 we store image data as an array
if (is_array($fileName)) {
$rawFileName = isset($fileName['filename']) ? $fileName['filename'] : (isset($fileName['file']) ? $fileName['file'] : null);
$this->title = isset($fileName['tit... | [
"public",
"function",
"setFileName",
"(",
"$",
"fileName",
")",
"{",
"// After v1.5.1 we store image data as an array",
"if",
"(",
"is_array",
"(",
"$",
"fileName",
")",
")",
"{",
"$",
"rawFileName",
"=",
"isset",
"(",
"$",
"fileName",
"[",
"'filename'",
"]",
... | Set the file name.
@param array|string $fileName
@return Thumbnail | [
"Set",
"the",
"file",
"name",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Image/Thumbnail.php#L54-L66 |
bolt/bolt | src/Helpers/Image/Thumbnail.php | Thumbnail.setWidth | public function setWidth($width, $default = 100)
{
if (!is_numeric($width)) {
$width = empty($this->thumbConf['default_thumbnail'][0])
? $default
: $this->thumbConf['default_thumbnail'][0];
}
$this->width = $width;
return $this;
} | php | public function setWidth($width, $default = 100)
{
if (!is_numeric($width)) {
$width = empty($this->thumbConf['default_thumbnail'][0])
? $default
: $this->thumbConf['default_thumbnail'][0];
}
$this->width = $width;
return $this;
} | [
"public",
"function",
"setWidth",
"(",
"$",
"width",
",",
"$",
"default",
"=",
"100",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"width",
")",
")",
"{",
"$",
"width",
"=",
"empty",
"(",
"$",
"this",
"->",
"thumbConf",
"[",
"'default_thumbnail'... | Set the thumbnail width.
@param int $width
@param int $default
@return Thumbnail | [
"Set",
"the",
"thumbnail",
"width",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Image/Thumbnail.php#L148-L158 |
bolt/bolt | src/Helpers/Image/Thumbnail.php | Thumbnail.setHeight | public function setHeight($height, $default = 100)
{
if (!is_numeric($height)) {
$height = empty($this->thumbConf['default_thumbnail'][1])
? $default
: $this->thumbConf['default_thumbnail'][1];
}
$this->height = $height;
return $this;
... | php | public function setHeight($height, $default = 100)
{
if (!is_numeric($height)) {
$height = empty($this->thumbConf['default_thumbnail'][1])
? $default
: $this->thumbConf['default_thumbnail'][1];
}
$this->height = $height;
return $this;
... | [
"public",
"function",
"setHeight",
"(",
"$",
"height",
",",
"$",
"default",
"=",
"100",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"height",
")",
")",
"{",
"$",
"height",
"=",
"empty",
"(",
"$",
"this",
"->",
"thumbConf",
"[",
"'default_thumbn... | Set the thumbnail height.
@param int $height
@param int $default
@return Thumbnail | [
"Set",
"the",
"thumbnail",
"height",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Image/Thumbnail.php#L184-L194 |
bolt/bolt | src/Helpers/Image/Thumbnail.php | Thumbnail.setScale | public function setScale($scale)
{
$valid = ['b', 'c', 'f', 'r'];
$scale = substr((string) $scale, 0, 1);
$scale = in_array($scale, $valid)
? $scale
: (!empty($this->thumbConf['cropping']) ? substr($this->thumbConf['cropping'], 0, 1) : 'c');
$this->scale = $s... | php | public function setScale($scale)
{
$valid = ['b', 'c', 'f', 'r'];
$scale = substr((string) $scale, 0, 1);
$scale = in_array($scale, $valid)
? $scale
: (!empty($this->thumbConf['cropping']) ? substr($this->thumbConf['cropping'], 0, 1) : 'c');
$this->scale = $s... | [
"public",
"function",
"setScale",
"(",
"$",
"scale",
")",
"{",
"$",
"valid",
"=",
"[",
"'b'",
",",
"'c'",
",",
"'f'",
",",
"'r'",
"]",
";",
"$",
"scale",
"=",
"substr",
"(",
"(",
"string",
")",
"$",
"scale",
",",
"0",
",",
"1",
")",
";",
"$",... | Set the thumbnail scaling method.
@param string $scale
@return Thumbnail | [
"Set",
"the",
"thumbnail",
"scaling",
"method",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Image/Thumbnail.php#L213-L224 |
bolt/bolt | src/Twig/Extension/ImageExtension.php | ImageExtension.getFunctions | public function getFunctions()
{
$safe = ['is_safe' => ['html']];
$env = ['needs_environment' => true];
$deprecated = ['deprecated' => true];
return [
// @codingStandardsIgnoreStart
new TwigFunction('fancybox', [Runtime\ImageRuntime::class, 'popup'], $safe +... | php | public function getFunctions()
{
$safe = ['is_safe' => ['html']];
$env = ['needs_environment' => true];
$deprecated = ['deprecated' => true];
return [
// @codingStandardsIgnoreStart
new TwigFunction('fancybox', [Runtime\ImageRuntime::class, 'popup'], $safe +... | [
"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/ImageExtension.php#L22-L38 |
bolt/bolt | src/Twig/Extension/ImageExtension.php | ImageExtension.getFilters | public function getFilters()
{
$safe = ['is_safe' => ['html']];
$env = ['needs_environment' => true];
$deprecated = ['deprecated' => true];
return [
// @codingStandardsIgnoreStart
new TwigFilter('fancybox', [Runtime\ImageRuntime::class, 'popup'], $safe + $de... | php | public function getFilters()
{
$safe = ['is_safe' => ['html']];
$env = ['needs_environment' => true];
$deprecated = ['deprecated' => true];
return [
// @codingStandardsIgnoreStart
new TwigFilter('fancybox', [Runtime\ImageRuntime::class, 'popup'], $safe + $de... | [
"public",
"function",
"getFilters",
"(",
")",
"{",
"$",
"safe",
"=",
"[",
"'is_safe'",
"=>",
"[",
"'html'",
"]",
"]",
";",
"$",
"env",
"=",
"[",
"'needs_environment'",
"=>",
"true",
"]",
";",
"$",
"deprecated",
"=",
"[",
"'deprecated'",
"=>",
"true",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Extension/ImageExtension.php#L43-L59 |
bolt/bolt | src/Legacy/PasswordLib/PasswordLibFactory.php | PasswordLibFactory.createHash | public function createHash($password, $prefix = '$2a$', array $options = [])
{
if ($prefix === false) {
throw new \DomainException('Unsupported Prefix Supplied');
}
foreach ($this->implementations as $impl) {
if ($impl::getPrefix() == $prefix) {
/** @v... | php | public function createHash($password, $prefix = '$2a$', array $options = [])
{
if ($prefix === false) {
throw new \DomainException('Unsupported Prefix Supplied');
}
foreach ($this->implementations as $impl) {
if ($impl::getPrefix() == $prefix) {
/** @v... | [
"public",
"function",
"createHash",
"(",
"$",
"password",
",",
"$",
"prefix",
"=",
"'$2a$'",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"prefix",
"===",
"false",
")",
"{",
"throw",
"new",
"\\",
"DomainException",
"(",
"'Un... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/PasswordLib/PasswordLibFactory.php#L25-L40 |
bolt/bolt | src/Legacy/PasswordLib/PasswordLibFactory.php | PasswordLibFactory.verifyHash | public function verifyHash($password, $hash)
{
foreach ($this->implementations as $impl) {
if ($impl::detect($hash)) {
/** @var AbstractPassword $instance */
$instance = $impl::loadFromHash($hash);
$instance->setGenerator($this->getGenerator());
... | php | public function verifyHash($password, $hash)
{
foreach ($this->implementations as $impl) {
if ($impl::detect($hash)) {
/** @var AbstractPassword $instance */
$instance = $impl::loadFromHash($hash);
$instance->setGenerator($this->getGenerator());
... | [
"public",
"function",
"verifyHash",
"(",
"$",
"password",
",",
"$",
"hash",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"implementations",
"as",
"$",
"impl",
")",
"{",
"if",
"(",
"$",
"impl",
"::",
"detect",
"(",
"$",
"hash",
")",
")",
"{",
"/** @... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/PasswordLib/PasswordLibFactory.php#L45-L57 |
bolt/bolt | src/Storage/Repository/BaseLogRepository.php | BaseLogRepository.queryTrimLog | public function queryTrimLog($period)
{
$qb = $this->createQueryBuilder();
$qb->delete($this->getTableName())
->where('date < :date')
->setParameter('date', $period, Type::DATETIME);
return $qb;
} | php | public function queryTrimLog($period)
{
$qb = $this->createQueryBuilder();
$qb->delete($this->getTableName())
->where('date < :date')
->setParameter('date', $period, Type::DATETIME);
return $qb;
} | [
"public",
"function",
"queryTrimLog",
"(",
"$",
"period",
")",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"createQueryBuilder",
"(",
")",
";",
"$",
"qb",
"->",
"delete",
"(",
"$",
"this",
"->",
"getTableName",
"(",
")",
")",
"->",
"where",
"(",
"'date <... | Build the query for a log trim.
@param \DateTime $period
@return QueryBuilder | [
"Build",
"the",
"query",
"for",
"a",
"log",
"trim",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/BaseLogRepository.php#L38-L46 |
bolt/bolt | src/Storage/Repository/BaseLogRepository.php | BaseLogRepository.clearLog | public function clearLog()
{
$qb = $this->createQueryBuilder();
$query = $qb->getConnection()
->getDatabasePlatform()
->getTruncateTableSQL($this->getTableName());
return $qb->getConnection()->executeQuery($query)->execute();
} | php | public function clearLog()
{
$qb = $this->createQueryBuilder();
$query = $qb->getConnection()
->getDatabasePlatform()
->getTruncateTableSQL($this->getTableName());
return $qb->getConnection()->executeQuery($query)->execute();
} | [
"public",
"function",
"clearLog",
"(",
")",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"createQueryBuilder",
"(",
")",
";",
"$",
"query",
"=",
"$",
"qb",
"->",
"getConnection",
"(",
")",
"->",
"getDatabasePlatform",
"(",
")",
"->",
"getTruncateTableSQL",
"(... | Clear the log table.
@return bool | [
"Clear",
"the",
"log",
"table",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/BaseLogRepository.php#L53-L61 |
bolt/bolt | src/Storage/Repository/BaseLogRepository.php | BaseLogRepository.getActivity | public function getActivity($page = 1, $amount = 10, array $options = [])
{
$query = $this->getActivityQuery($page, $amount, $options);
return $this->findWith($query);
} | php | public function getActivity($page = 1, $amount = 10, array $options = [])
{
$query = $this->getActivityQuery($page, $amount, $options);
return $this->findWith($query);
} | [
"public",
"function",
"getActivity",
"(",
"$",
"page",
"=",
"1",
",",
"$",
"amount",
"=",
"10",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"getActivityQuery",
"(",
"$",
"page",
",",
"$",
"amount",
... | Get content log's activity entries.
@param int $page
@param int $amount
@param array $options
@return Entity\LogChange[] | [
"Get",
"content",
"log",
"s",
"activity",
"entries",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/BaseLogRepository.php#L72-L77 |
bolt/bolt | src/Storage/Repository/BaseLogRepository.php | BaseLogRepository.getActivityQuery | public function getActivityQuery($page, $amount, array $options)
{
$qb = $this->createQueryBuilder();
$qb->select('*')
->orderBy('id', 'DESC')
->setMaxResults((int) $amount)
->setFirstResult((int) (($page - 1) * $amount));
$this->addWhereActivity($qb, $op... | php | public function getActivityQuery($page, $amount, array $options)
{
$qb = $this->createQueryBuilder();
$qb->select('*')
->orderBy('id', 'DESC')
->setMaxResults((int) $amount)
->setFirstResult((int) (($page - 1) * $amount));
$this->addWhereActivity($qb, $op... | [
"public",
"function",
"getActivityQuery",
"(",
"$",
"page",
",",
"$",
"amount",
",",
"array",
"$",
"options",
")",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"createQueryBuilder",
"(",
")",
";",
"$",
"qb",
"->",
"select",
"(",
"'*'",
")",
"->",
"orderBy... | Build the query to get the log entries.
@param int $page
@param int $amount
@param array $options
@return QueryBuilder | [
"Build",
"the",
"query",
"to",
"get",
"the",
"log",
"entries",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/BaseLogRepository.php#L88-L99 |
bolt/bolt | src/Storage/Repository/BaseLogRepository.php | BaseLogRepository.getActivityCount | public function getActivityCount(array $options = [])
{
$query = $this->getActivityCountQuery($options);
return $this->getCount($query->execute()->fetch());
} | php | public function getActivityCount(array $options = [])
{
$query = $this->getActivityCountQuery($options);
return $this->getCount($query->execute()->fetch());
} | [
"public",
"function",
"getActivityCount",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"getActivityCountQuery",
"(",
"$",
"options",
")",
";",
"return",
"$",
"this",
"->",
"getCount",
"(",
"$",
"query",
"... | Get the total amount of log entries, optionally limited to a given level
and/or context.
@param array $options
@return int|false | [
"Get",
"the",
"total",
"amount",
"of",
"log",
"entries",
"optionally",
"limited",
"to",
"a",
"given",
"level",
"and",
"/",
"or",
"context",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/BaseLogRepository.php#L109-L114 |
bolt/bolt | src/Storage/Repository/BaseLogRepository.php | BaseLogRepository.getActivityCountQuery | public function getActivityCountQuery(array $options)
{
// Find out how many entries we're paging form
$qb = $this->createQueryBuilder();
$qb->select('COUNT(id) as count');
$this->addWhereActivity($qb, $options);
return $qb;
} | php | public function getActivityCountQuery(array $options)
{
// Find out how many entries we're paging form
$qb = $this->createQueryBuilder();
$qb->select('COUNT(id) as count');
$this->addWhereActivity($qb, $options);
return $qb;
} | [
"public",
"function",
"getActivityCountQuery",
"(",
"array",
"$",
"options",
")",
"{",
"// Find out how many entries we're paging form",
"$",
"qb",
"=",
"$",
"this",
"->",
"createQueryBuilder",
"(",
")",
";",
"$",
"qb",
"->",
"select",
"(",
"'COUNT(id) as count'",
... | Build the query for the entry count.
@param array $options
@return QueryBuilder | [
"Build",
"the",
"query",
"for",
"the",
"entry",
"count",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/BaseLogRepository.php#L123-L132 |
bolt/bolt | src/Storage/Repository/BaseLogRepository.php | BaseLogRepository.addWhereActivity | protected function addWhereActivity(QueryBuilder $qb, $options)
{
if (empty($options)) {
return;
}
foreach ($options as $columnName => $option) {
if (is_array($options[$columnName])) {
$qb->andWhere($this->buildWhereOr($qb, $columnName, $option));
... | php | protected function addWhereActivity(QueryBuilder $qb, $options)
{
if (empty($options)) {
return;
}
foreach ($options as $columnName => $option) {
if (is_array($options[$columnName])) {
$qb->andWhere($this->buildWhereOr($qb, $columnName, $option));
... | [
"protected",
"function",
"addWhereActivity",
"(",
"QueryBuilder",
"$",
"qb",
",",
"$",
"options",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"options",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"options",
"as",
"$",
"columnName",
"=>",
"$",
... | Add required WHERE parameters.
@param QueryBuilder $qb
@param array $options | [
"Add",
"required",
"WHERE",
"parameters",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/BaseLogRepository.php#L140-L154 |
bolt/bolt | src/Storage/Repository/BaseLogRepository.php | BaseLogRepository.buildWhereOr | protected function buildWhereOr(QueryBuilder $qb, $parentColumnName, array $options)
{
$orX = $qb->expr()->orX();
foreach ($options as $columnName => $option) {
if (empty($options[$columnName])) {
continue;
} elseif (Arr::isIndexed($options)) {
... | php | protected function buildWhereOr(QueryBuilder $qb, $parentColumnName, array $options)
{
$orX = $qb->expr()->orX();
foreach ($options as $columnName => $option) {
if (empty($options[$columnName])) {
continue;
} elseif (Arr::isIndexed($options)) {
... | [
"protected",
"function",
"buildWhereOr",
"(",
"QueryBuilder",
"$",
"qb",
",",
"$",
"parentColumnName",
",",
"array",
"$",
"options",
")",
"{",
"$",
"orX",
"=",
"$",
"qb",
"->",
"expr",
"(",
")",
"->",
"orX",
"(",
")",
";",
"foreach",
"(",
"$",
"optio... | Build an OR group that is added to the AND.
@param QueryBuilder $qb
@param string $parentColumnName
@param array $options
@return CompositeExpression | [
"Build",
"an",
"OR",
"group",
"that",
"is",
"added",
"to",
"the",
"AND",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/BaseLogRepository.php#L165-L182 |
bolt/bolt | src/Composer/Script/BootstrapYamlUpdater.php | BootstrapYamlUpdater.update | public function update()
{
if (!file_exists(static::FILENAME)) {
return;
}
$contents = Yaml::parse(file_get_contents(static::FILENAME)) ?: [];
if (!isset($contents['paths'])) {
return;
}
$originalPaths = $contents['paths'];
$contents... | php | public function update()
{
if (!file_exists(static::FILENAME)) {
return;
}
$contents = Yaml::parse(file_get_contents(static::FILENAME)) ?: [];
if (!isset($contents['paths'])) {
return;
}
$originalPaths = $contents['paths'];
$contents... | [
"public",
"function",
"update",
"(",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"static",
"::",
"FILENAME",
")",
")",
"{",
"return",
";",
"}",
"$",
"contents",
"=",
"Yaml",
"::",
"parse",
"(",
"file_get_contents",
"(",
"static",
"::",
"FILENAME",
")... | Update .bolt.yml file if needed. | [
"Update",
".",
"bolt",
".",
"yml",
"file",
"if",
"needed",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/BootstrapYamlUpdater.php#L65-L85 |
bolt/bolt | src/Composer/Script/BootstrapYamlUpdater.php | BootstrapYamlUpdater.save | public function save(array $contents)
{
// Custom paths
if (count($contents['paths']) > 0) {
$str = Yaml::dump($contents);
try {
$this->filesystem->dumpFile(static::FILENAME, $str);
$version = \Bolt\Version::VERSION;
$this->io->... | php | public function save(array $contents)
{
// Custom paths
if (count($contents['paths']) > 0) {
$str = Yaml::dump($contents);
try {
$this->filesystem->dumpFile(static::FILENAME, $str);
$version = \Bolt\Version::VERSION;
$this->io->... | [
"public",
"function",
"save",
"(",
"array",
"$",
"contents",
")",
"{",
"// Custom paths",
"if",
"(",
"count",
"(",
"$",
"contents",
"[",
"'paths'",
"]",
")",
">",
"0",
")",
"{",
"$",
"str",
"=",
"Yaml",
"::",
"dump",
"(",
"$",
"contents",
")",
";",... | Save updated data .bolt.yml file, or remove if it matches defaults.
@param array $contents | [
"Save",
"updated",
"data",
".",
"bolt",
".",
"yml",
"file",
"or",
"remove",
"if",
"it",
"matches",
"defaults",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/BootstrapYamlUpdater.php#L92-L138 |
bolt/bolt | src/Composer/Script/BootstrapYamlUpdater.php | BootstrapYamlUpdater.updatePaths | public function updatePaths(MutableBag $paths)
{
if ($paths->isEmpty()) {
return $paths;
}
if ($web = $paths['web']) {
if ($web === 'public') {
$paths->remove('web');
} elseif (strpos($web, '%site%') !== 0) {
$paths['web'] ... | php | public function updatePaths(MutableBag $paths)
{
if ($paths->isEmpty()) {
return $paths;
}
if ($web = $paths['web']) {
if ($web === 'public') {
$paths->remove('web');
} elseif (strpos($web, '%site%') !== 0) {
$paths['web'] ... | [
"public",
"function",
"updatePaths",
"(",
"MutableBag",
"$",
"paths",
")",
"{",
"if",
"(",
"$",
"paths",
"->",
"isEmpty",
"(",
")",
")",
"{",
"return",
"$",
"paths",
";",
"}",
"if",
"(",
"$",
"web",
"=",
"$",
"paths",
"[",
"'web'",
"]",
")",
"{",... | Update paths.
@param MutableBag $paths
@return MutableBag | [
"Update",
"paths",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/BootstrapYamlUpdater.php#L147-L250 |
bolt/bolt | src/Composer/Script/BootstrapYamlUpdater.php | BootstrapYamlUpdater.determineMostCommonBaseAppPath | private function determineMostCommonBaseAppPath($paths)
{
$paths = array_values($paths);
$options = [];
$options[] = Path::getLongestCommonBasePath($paths);
if (isset($paths[1])) {
$options[] = Path::getLongestCommonBasePath([$paths[0], $paths[1]]);
}
if ... | php | private function determineMostCommonBaseAppPath($paths)
{
$paths = array_values($paths);
$options = [];
$options[] = Path::getLongestCommonBasePath($paths);
if (isset($paths[1])) {
$options[] = Path::getLongestCommonBasePath([$paths[0], $paths[1]]);
}
if ... | [
"private",
"function",
"determineMostCommonBaseAppPath",
"(",
"$",
"paths",
")",
"{",
"$",
"paths",
"=",
"array_values",
"(",
"$",
"paths",
")",
";",
"$",
"options",
"=",
"[",
"]",
";",
"$",
"options",
"[",
"]",
"=",
"Path",
"::",
"getLongestCommonBasePath... | Determine the most common app path.
@param string[] $paths
@return string | [
"Determine",
"the",
"most",
"common",
"app",
"path",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/BootstrapYamlUpdater.php#L259-L275 |
bolt/bolt | src/Composer/Package.php | Package.createFromComposerPackage | public static function createFromComposerPackage(CompletePackageInterface $package)
{
$class = new self();
$class->type = $package->getType();
$class->name = $package->getPrettyName();
$class->description = $package->getDescription();
$class->authors = $package->getAuthors();... | php | public static function createFromComposerPackage(CompletePackageInterface $package)
{
$class = new self();
$class->type = $package->getType();
$class->name = $package->getPrettyName();
$class->description = $package->getDescription();
$class->authors = $package->getAuthors();... | [
"public",
"static",
"function",
"createFromComposerPackage",
"(",
"CompletePackageInterface",
"$",
"package",
")",
"{",
"$",
"class",
"=",
"new",
"self",
"(",
")",
";",
"$",
"class",
"->",
"type",
"=",
"$",
"package",
"->",
"getType",
"(",
")",
";",
"$",
... | @param CompletePackageInterface $package
@return Package | [
"@param",
"CompletePackageInterface",
"$package"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Package.php#L35-L50 |
bolt/bolt | src/Composer/Package.php | Package.createFromComposerJson | public static function createFromComposerJson(array $composerJson)
{
$class = new self();
$class->type = $composerJson['type'];
$class->name = $composerJson['name'];
$class->description = isset($composerJson['description']) ? $composerJson['description'] : '';
$class->version... | php | public static function createFromComposerJson(array $composerJson)
{
$class = new self();
$class->type = $composerJson['type'];
$class->name = $composerJson['name'];
$class->description = isset($composerJson['description']) ? $composerJson['description'] : '';
$class->version... | [
"public",
"static",
"function",
"createFromComposerJson",
"(",
"array",
"$",
"composerJson",
")",
"{",
"$",
"class",
"=",
"new",
"self",
"(",
")",
";",
"$",
"class",
"->",
"type",
"=",
"$",
"composerJson",
"[",
"'type'",
"]",
";",
"$",
"class",
"->",
"... | @param array $composerJson
@return Package | [
"@param",
"array",
"$composerJson"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Package.php#L57-L69 |
bolt/bolt | src/Helpers/RequestSanitiser.php | RequestSanitiser.filter | public static function filter(Request $request)
{
$bags = MutableBag::from(array_fill_keys(['attributes', 'query', 'files', 'cookies', 'headers', 'server'], null));
foreach ($bags->keys() as $key) {
$bags[$key] = static::getValues($request->$key->all());
}
if ($request->h... | php | public static function filter(Request $request)
{
$bags = MutableBag::from(array_fill_keys(['attributes', 'query', 'files', 'cookies', 'headers', 'server'], null));
foreach ($bags->keys() as $key) {
$bags[$key] = static::getValues($request->$key->all());
}
if ($request->h... | [
"public",
"static",
"function",
"filter",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"bags",
"=",
"MutableBag",
"::",
"from",
"(",
"array_fill_keys",
"(",
"[",
"'attributes'",
",",
"'query'",
",",
"'files'",
",",
"'cookies'",
",",
"'headers'",
",",
"'s... | Filter a request object to be safe to pass to Twig.
@param Request $request
@return Bag | [
"Filter",
"a",
"request",
"object",
"to",
"be",
"safe",
"to",
"pass",
"to",
"Twig",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/RequestSanitiser.php#L26-L37 |
bolt/bolt | src/Helpers/RequestSanitiser.php | RequestSanitiser.getValues | private static function getValues(array $values)
{
$bag = MutableBag::from($values);
foreach ($bag as $k => $v) {
/** @var Bag $v */
if (is_array($v) && !is_callable($v)) {
$bag[$k] = Bag::from($v)
->call(function (array $a) {
... | php | private static function getValues(array $values)
{
$bag = MutableBag::from($values);
foreach ($bag as $k => $v) {
/** @var Bag $v */
if (is_array($v) && !is_callable($v)) {
$bag[$k] = Bag::from($v)
->call(function (array $a) {
... | [
"private",
"static",
"function",
"getValues",
"(",
"array",
"$",
"values",
")",
"{",
"$",
"bag",
"=",
"MutableBag",
"::",
"from",
"(",
"$",
"values",
")",
";",
"foreach",
"(",
"$",
"bag",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"/** @var Bag $v */"... | @param array $values
@return Bag | [
"@param",
"array",
"$values"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/RequestSanitiser.php#L44-L64 |
bolt/bolt | src/Legacy/Storage.php | Storage.getContentObject | public function getContentObject($contenttype, $values = [], $isRootType = true)
{
// Make sure $contenttype is an array, and not just the slug.
if (!is_array($contenttype)) {
$contenttype = $this->getContentType($contenttype);
}
// If the contenttype has a 'class' speci... | php | public function getContentObject($contenttype, $values = [], $isRootType = true)
{
// Make sure $contenttype is an array, and not just the slug.
if (!is_array($contenttype)) {
$contenttype = $this->getContentType($contenttype);
}
// If the contenttype has a 'class' speci... | [
"public",
"function",
"getContentObject",
"(",
"$",
"contenttype",
",",
"$",
"values",
"=",
"[",
"]",
",",
"$",
"isRootType",
"=",
"true",
")",
"{",
"// Make sure $contenttype is an array, and not just the slug.",
"if",
"(",
"!",
"is_array",
"(",
"$",
"contenttype... | Get an object for the content of a specific contenttype. This will be
\Bolt\Legacy\Content, unless the contenttype defined another class to be
used.
@param array|string $contenttype
@param array $values
@param bool $isRootType
@throws \Exception
@return \Bolt\Legacy\Content | [
"Get",
"an",
"object",
"for",
"the",
"content",
"of",
"a",
"specific",
"contenttype",
".",
"This",
"will",
"be",
"\\",
"Bolt",
"\\",
"Legacy",
"\\",
"Content",
"unless",
"the",
"contenttype",
"defined",
"another",
"class",
"to",
"be",
"used",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L65-L86 |
bolt/bolt | src/Legacy/Storage.php | Storage.preFill | public function preFill($contentTypes = [])
{
if (empty($contentTypes)) {
$contentTypes = $this->app['config']->get('contenttypes');
$contentTypeNames = array_keys($contentTypes);
} else {
$contentTypeNames = (array) $contentTypes;
}
/** @var \Bol... | php | public function preFill($contentTypes = [])
{
if (empty($contentTypes)) {
$contentTypes = $this->app['config']->get('contenttypes');
$contentTypeNames = array_keys($contentTypes);
} else {
$contentTypeNames = (array) $contentTypes;
}
/** @var \Bol... | [
"public",
"function",
"preFill",
"(",
"$",
"contentTypes",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"contentTypes",
")",
")",
"{",
"$",
"contentTypes",
"=",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'contenttype... | Add some records with dummy content.
Only fill the contenttypes passed as parameters
If the parameters is empty, only fill empty tables
@see \Bolt\Storage\Database\\Prefill
@param array $contentTypes
@return string | [
"Add",
"some",
"records",
"with",
"dummy",
"content",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L100-L131 |
bolt/bolt | src/Legacy/Storage.php | Storage.logInsert | private function logInsert($contenttype, $contentid, $content, $comment = null)
{
$this->app['logger.change']->info(
'Insert record',
[
'action' => 'INSERT',
'contenttype' => $contenttype,
'id' => $contentid,
... | php | private function logInsert($contenttype, $contentid, $content, $comment = null)
{
$this->app['logger.change']->info(
'Insert record',
[
'action' => 'INSERT',
'contenttype' => $contenttype,
'id' => $contentid,
... | [
"private",
"function",
"logInsert",
"(",
"$",
"contenttype",
",",
"$",
"contentid",
",",
"$",
"content",
",",
"$",
"comment",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"app",
"[",
"'logger.change'",
"]",
"->",
"info",
"(",
"'Insert record'",
",",
"[",
... | Writes a content-changelog entry for a newly-created entry.
@param string $contenttype Slug of the record contenttype
@param integer $contentid ID of the record
@param array $content Record values
@param string $comment Editor's comment | [
"Writes",
"a",
"content",
"-",
"changelog",
"entry",
"for",
"a",
"newly",
"-",
"created",
"entry",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L141-L154 |
bolt/bolt | src/Legacy/Storage.php | Storage.logUpdate | private function logUpdate($contenttype, $contentid, $newContent, $oldContent = null, $comment = null)
{
$this->app['logger.change']->info(
'Update record',
[
'action' => 'UPDATE',
'contenttype' => $contenttype,
'id' => $c... | php | private function logUpdate($contenttype, $contentid, $newContent, $oldContent = null, $comment = null)
{
$this->app['logger.change']->info(
'Update record',
[
'action' => 'UPDATE',
'contenttype' => $contenttype,
'id' => $c... | [
"private",
"function",
"logUpdate",
"(",
"$",
"contenttype",
",",
"$",
"contentid",
",",
"$",
"newContent",
",",
"$",
"oldContent",
"=",
"null",
",",
"$",
"comment",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"app",
"[",
"'logger.change'",
"]",
"->",
"i... | Writes a content-changelog entry for an updated entry.
This function must be called *before* the actual update, because it
fetches the old content from the database.
@param string $contenttype Slug of the record contenttype
@param integer $contentid ID of the record
@param array $newContent New record values
@pa... | [
"Writes",
"a",
"content",
"-",
"changelog",
"entry",
"for",
"an",
"updated",
"entry",
".",
"This",
"function",
"must",
"be",
"called",
"*",
"before",
"*",
"the",
"actual",
"update",
"because",
"it",
"fetches",
"the",
"old",
"content",
"from",
"the",
"datab... | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L167-L180 |
bolt/bolt | src/Legacy/Storage.php | Storage.saveContent | public function saveContent(Content $content, $comment = null)
{
$contenttype = $content->contenttype;
$fieldvalues = $content->values;
if (empty($contenttype)) {
$this->app['logger.system']->error('Contenttype is required for ' . __FUNCTION__, ['event' => 'exception']);
... | php | public function saveContent(Content $content, $comment = null)
{
$contenttype = $content->contenttype;
$fieldvalues = $content->values;
if (empty($contenttype)) {
$this->app['logger.system']->error('Contenttype is required for ' . __FUNCTION__, ['event' => 'exception']);
... | [
"public",
"function",
"saveContent",
"(",
"Content",
"$",
"content",
",",
"$",
"comment",
"=",
"null",
")",
"{",
"$",
"contenttype",
"=",
"$",
"content",
"->",
"contenttype",
";",
"$",
"fieldvalues",
"=",
"$",
"content",
"->",
"values",
";",
"if",
"(",
... | Save a record.
@param Content $content
@param string $comment
@throws \Bolt\Exception\StorageException
@return int | [
"Save",
"a",
"record",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L216-L270 |
bolt/bolt | src/Legacy/Storage.php | Storage.deleteContent | public function deleteContent($contenttype, $id)
{
if (empty($contenttype)) {
$this->app['logger.system']->error('Contenttype is required for' . __FUNCTION__, ['event' => 'exception']);
throw new StorageException('Contenttype is required for ' . __FUNCTION__);
}
// M... | php | public function deleteContent($contenttype, $id)
{
if (empty($contenttype)) {
$this->app['logger.system']->error('Contenttype is required for' . __FUNCTION__, ['event' => 'exception']);
throw new StorageException('Contenttype is required for ' . __FUNCTION__);
}
// M... | [
"public",
"function",
"deleteContent",
"(",
"$",
"contenttype",
",",
"$",
"id",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"contenttype",
")",
")",
"{",
"$",
"this",
"->",
"app",
"[",
"'logger.system'",
"]",
"->",
"error",
"(",
"'Contenttype is required for'"... | Delete a record.
@param string $contenttype
@param integer $id
@throws \Bolt\Exception\StorageException
@return integer The number of affected rows. | [
"Delete",
"a",
"record",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L282-L322 |
bolt/bolt | src/Legacy/Storage.php | Storage.insertContent | protected function insertContent(Content $content, $comment = null)
{
$tablename = $this->getContenttypeTablename($content->contenttype);
// Set creation and update dates
$content->setValue('datecreated', date('Y-m-d H:i:s'));
$content->setValue('datechanged', date('Y-m-d H:i:s'));
... | php | protected function insertContent(Content $content, $comment = null)
{
$tablename = $this->getContenttypeTablename($content->contenttype);
// Set creation and update dates
$content->setValue('datecreated', date('Y-m-d H:i:s'));
$content->setValue('datechanged', date('Y-m-d H:i:s'));
... | [
"protected",
"function",
"insertContent",
"(",
"Content",
"$",
"content",
",",
"$",
"comment",
"=",
"null",
")",
"{",
"$",
"tablename",
"=",
"$",
"this",
"->",
"getContenttypeTablename",
"(",
"$",
"content",
"->",
"contenttype",
")",
";",
"// Set creation and ... | Insert a new contenttype record in the database.
@param \Bolt\Legacy\Content $content Record content to insert
@param string $comment Editor's comment
@return boolean | [
"Insert",
"a",
"new",
"contenttype",
"record",
"in",
"the",
"database",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L332-L361 |
bolt/bolt | src/Legacy/Storage.php | Storage.updateContent | private function updateContent(Content $content, $comment = null)
{
$tablename = $this->getContenttypeTablename($content->contenttype);
// Set the date the record was changed
$content->setValue('datechanged', date('Y-m-d H:i:s'));
// Test that the record exists in the database
... | php | private function updateContent(Content $content, $comment = null)
{
$tablename = $this->getContenttypeTablename($content->contenttype);
// Set the date the record was changed
$content->setValue('datechanged', date('Y-m-d H:i:s'));
// Test that the record exists in the database
... | [
"private",
"function",
"updateContent",
"(",
"Content",
"$",
"content",
",",
"$",
"comment",
"=",
"null",
")",
"{",
"$",
"tablename",
"=",
"$",
"this",
"->",
"getContenttypeTablename",
"(",
"$",
"content",
"->",
"contenttype",
")",
";",
"// Set the date the re... | Update a Bolt contenttype record.
@param \Bolt\Legacy\Content $content The content object to be updated
@param string $comment Add a comment to save with change.
@throws \Bolt\Exception\StorageException
@return bool | [
"Update",
"a",
"Bolt",
"contenttype",
"record",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L373-L396 |
bolt/bolt | src/Legacy/Storage.php | Storage.getValidSaveData | private function getValidSaveData(array $fieldvalues, array $contenttype)
{
// Clean up fields, check unneeded columns.
foreach (array_keys($fieldvalues) as $key) {
if ($this->isValidColumn($key, $contenttype)) {
if (is_string($fieldvalues[$key])) {
//... | php | private function getValidSaveData(array $fieldvalues, array $contenttype)
{
// Clean up fields, check unneeded columns.
foreach (array_keys($fieldvalues) as $key) {
if ($this->isValidColumn($key, $contenttype)) {
if (is_string($fieldvalues[$key])) {
//... | [
"private",
"function",
"getValidSaveData",
"(",
"array",
"$",
"fieldvalues",
",",
"array",
"$",
"contenttype",
")",
"{",
"// Clean up fields, check unneeded columns.",
"foreach",
"(",
"array_keys",
"(",
"$",
"fieldvalues",
")",
"as",
"$",
"key",
")",
"{",
"if",
... | Get a valid array to commit.
@param array $fieldvalues
@param array $contenttype
@return array | [
"Get",
"a",
"valid",
"array",
"to",
"commit",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L406-L425 |
bolt/bolt | src/Legacy/Storage.php | Storage.updateSingleValue | public function updateSingleValue($contenttype, $id, $field, $value)
{
$id = intval($id);
if (!$this->isValidColumn($field, $contenttype)) {
$error = Trans::__('contenttypes.generic.invalid-field', ['%field%' => $field, '%contenttype%' => $contenttype]);
$this->app['logger.f... | php | public function updateSingleValue($contenttype, $id, $field, $value)
{
$id = intval($id);
if (!$this->isValidColumn($field, $contenttype)) {
$error = Trans::__('contenttypes.generic.invalid-field', ['%field%' => $field, '%contenttype%' => $contenttype]);
$this->app['logger.f... | [
"public",
"function",
"updateSingleValue",
"(",
"$",
"contenttype",
",",
"$",
"id",
",",
"$",
"field",
",",
"$",
"value",
")",
"{",
"$",
"id",
"=",
"intval",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isValidColumn",
"(",
"$",
... | Update a single value from content.
It is called in list of contents.
@param string $contenttype Content Type to be edited.
@param int $id Id of content to be updated.
@param string $field Field name of content to be changed.
@param mixed $value New value to be defined on field.
@return bool... | [
"Update",
"a",
"single",
"value",
"from",
"content",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L439-L465 |
bolt/bolt | src/Legacy/Storage.php | Storage.decodeSearchQuery | private function decodeSearchQuery($q)
{
$words = preg_split('|[\r\n\t ]+|', trim($q));
$words = array_map(
function ($word) {
return mb_strtolower($word);
},
$words
);
$words = array_filter(
$words,
functio... | php | private function decodeSearchQuery($q)
{
$words = preg_split('|[\r\n\t ]+|', trim($q));
$words = array_map(
function ($word) {
return mb_strtolower($word);
},
$words
);
$words = array_filter(
$words,
functio... | [
"private",
"function",
"decodeSearchQuery",
"(",
"$",
"q",
")",
"{",
"$",
"words",
"=",
"preg_split",
"(",
"'|[\\r\\n\\t ]+|'",
",",
"trim",
"(",
"$",
"q",
")",
")",
";",
"$",
"words",
"=",
"array_map",
"(",
"function",
"(",
"$",
"word",
")",
"{",
"r... | Decode search query into searchable parts.
@param string $q
@return array | [
"Decode",
"search",
"query",
"into",
"searchable",
"parts",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L484-L508 |
bolt/bolt | src/Legacy/Storage.php | Storage.searchSingleContentType | private function searchSingleContentType($query, $contenttype, $fields, array $filter = null, $implode = false)
{
// This could be even more configurable
// (see also Content->getFieldWeights)
$searchableTypes = ['text', 'textarea', 'html', 'markdown'];
$table = $this->getContenttype... | php | private function searchSingleContentType($query, $contenttype, $fields, array $filter = null, $implode = false)
{
// This could be even more configurable
// (see also Content->getFieldWeights)
$searchableTypes = ['text', 'textarea', 'html', 'markdown'];
$table = $this->getContenttype... | [
"private",
"function",
"searchSingleContentType",
"(",
"$",
"query",
",",
"$",
"contenttype",
",",
"$",
"fields",
",",
"array",
"$",
"filter",
"=",
"null",
",",
"$",
"implode",
"=",
"false",
")",
"{",
"// This could be even more configurable",
"// (see also Conten... | Search through a single contenttype.
Search, weigh and return the results.
@param $query
@param $contenttype
@param $fields
@param array $filter
@param bool $implode
@return Content | [
"Search",
"through",
"a",
"single",
"contenttype",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L523-L608 |
bolt/bolt | src/Legacy/Storage.php | Storage.compareSearchWeights | private function compareSearchWeights(Content $a, Content $b)
{
if ($a->getSearchResultWeight() > $b->getSearchResultWeight()) {
return -1;
}
if ($a->getSearchResultWeight() < $b->getSearchResultWeight()) {
return 1;
}
if ($a['datepublish'] > $b['datep... | php | private function compareSearchWeights(Content $a, Content $b)
{
if ($a->getSearchResultWeight() > $b->getSearchResultWeight()) {
return -1;
}
if ($a->getSearchResultWeight() < $b->getSearchResultWeight()) {
return 1;
}
if ($a['datepublish'] > $b['datep... | [
"private",
"function",
"compareSearchWeights",
"(",
"Content",
"$",
"a",
",",
"Content",
"$",
"b",
")",
"{",
"if",
"(",
"$",
"a",
"->",
"getSearchResultWeight",
"(",
")",
">",
"$",
"b",
"->",
"getSearchResultWeight",
"(",
")",
")",
"{",
"return",
"-",
... | Compare by search weights.
Or fallback to dates or title
@param \Bolt\Legacy\Content $a
@param \Bolt\Legacy\Content $b
@return int | [
"Compare",
"by",
"search",
"weights",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L620-L638 |
bolt/bolt | src/Legacy/Storage.php | Storage.searchContent | public function searchContent($q, array $contenttypes = null, array $filters = null, $limit = 9999, $offset = 0)
{
$query = $this->decodeSearchQuery($q);
if (!$query['valid']) {
return false;
}
$appCt = $this->app['config']->get('contenttypes');
// By default we... | php | public function searchContent($q, array $contenttypes = null, array $filters = null, $limit = 9999, $offset = 0)
{
$query = $this->decodeSearchQuery($q);
if (!$query['valid']) {
return false;
}
$appCt = $this->app['config']->get('contenttypes');
// By default we... | [
"public",
"function",
"searchContent",
"(",
"$",
"q",
",",
"array",
"$",
"contenttypes",
"=",
"null",
",",
"array",
"$",
"filters",
"=",
"null",
",",
"$",
"limit",
"=",
"9999",
",",
"$",
"offset",
"=",
"0",
")",
"{",
"$",
"query",
"=",
"$",
"this",... | Search through actual content.
Unless the query is invalid it will always return a 'result array'. It may
complain in the log but it won't abort.
@param string $q Search string
@param array $contenttypes Contenttype names to search for:
- string: Specific contenttype
- null: Every searchable contentty... | [
"Search",
"through",
"actual",
"content",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L658-L742 |
bolt/bolt | src/Legacy/Storage.php | Storage.getContentByTaxonomy | public function getContentByTaxonomy($taxonomyslug, $name, $parameters = [])
{
$tablename = $this->getTablename('taxonomy');
$slug = $this->app['slugify']->slugify($name);
$limit = isset($parameters['limit']) && $parameters['limit'] ? $parameters['limit'] : 9999;
$page = isset($par... | php | public function getContentByTaxonomy($taxonomyslug, $name, $parameters = [])
{
$tablename = $this->getTablename('taxonomy');
$slug = $this->app['slugify']->slugify($name);
$limit = isset($parameters['limit']) && $parameters['limit'] ? $parameters['limit'] : 9999;
$page = isset($par... | [
"public",
"function",
"getContentByTaxonomy",
"(",
"$",
"taxonomyslug",
",",
"$",
"name",
",",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"tablename",
"=",
"$",
"this",
"->",
"getTablename",
"(",
"'taxonomy'",
")",
";",
"$",
"slug",
"=",
"$",
"th... | Retrieve content from the database, filtered on taxonomy.
Note: we can NOT sort on anything meaningful. Records are fetched from multiple
content-types, so we can not do joins. Neither can we sort after fetching,
because it would mean fetching _all_ records and _then_ doing the sorting.
Instead, we do not sort here. I... | [
"Retrieve",
"content",
"from",
"the",
"database",
"filtered",
"on",
"taxonomy",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L886-L960 |
bolt/bolt | src/Legacy/Storage.php | Storage.organizeQueryParameters | private function organizeQueryParameters($inParameters = null)
{
$ctypeParameters = [];
$metaParameters = [];
if (is_array($inParameters)) {
foreach ($inParameters as $key => $value) {
if (in_array($key, ['page', 'limit', 'offset', 'returnsingle', 'printquery', 'p... | php | private function organizeQueryParameters($inParameters = null)
{
$ctypeParameters = [];
$metaParameters = [];
if (is_array($inParameters)) {
foreach ($inParameters as $key => $value) {
if (in_array($key, ['page', 'limit', 'offset', 'returnsingle', 'printquery', 'p... | [
"private",
"function",
"organizeQueryParameters",
"(",
"$",
"inParameters",
"=",
"null",
")",
"{",
"$",
"ctypeParameters",
"=",
"[",
"]",
";",
"$",
"metaParameters",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"inParameters",
")",
")",
"{",
"for... | Split into meta-parameters and contenttype parameters.
This is tightly coupled to $this->getContent()
@param array|string|null $inParameters
@see $this->decodeContentQuery()
@return array | [
"Split",
"into",
"meta",
"-",
"parameters",
"and",
"contenttype",
"parameters",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L989-L1004 |
bolt/bolt | src/Legacy/Storage.php | Storage.decodeContentTypesFromText | private function decodeContentTypesFromText($text)
{
$contenttypes = [];
if ((substr($text, 0, 1) == '(') &&
(substr($text, -1) == ')')
) {
$contenttypes = explode(',', substr($text, 1, -1));
} else {
$contenttypes[] = $text;
}
$i... | php | private function decodeContentTypesFromText($text)
{
$contenttypes = [];
if ((substr($text, 0, 1) == '(') &&
(substr($text, -1) == ')')
) {
$contenttypes = explode(',', substr($text, 1, -1));
} else {
$contenttypes[] = $text;
}
$i... | [
"private",
"function",
"decodeContentTypesFromText",
"(",
"$",
"text",
")",
"{",
"$",
"contenttypes",
"=",
"[",
"]",
";",
"if",
"(",
"(",
"substr",
"(",
"$",
"text",
",",
"0",
",",
"1",
")",
"==",
"'('",
")",
"&&",
"(",
"substr",
"(",
"$",
"text",
... | Decode a contenttypes argument from text.
(entry,page) -> ['entry', 'page']
event -> ['event']
@param string $text text with contenttypes
@return array array with contenttype(slug)s | [
"Decode",
"a",
"contenttypes",
"argument",
"from",
"text",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L1016-L1039 |
bolt/bolt | src/Legacy/Storage.php | Storage.parseTextQuery | private function parseTextQuery($textquery, array &$decoded, array &$metaParameters, array &$ctypeParameters)
{
// Our default callback
$decoded['queries_callback'] = [$this, 'executeGetContentQueries'];
// Some special cases, like 'entry/1' or 'page/about' need to be caught before further ... | php | private function parseTextQuery($textquery, array &$decoded, array &$metaParameters, array &$ctypeParameters)
{
// Our default callback
$decoded['queries_callback'] = [$this, 'executeGetContentQueries'];
// Some special cases, like 'entry/1' or 'page/about' need to be caught before further ... | [
"private",
"function",
"parseTextQuery",
"(",
"$",
"textquery",
",",
"array",
"&",
"$",
"decoded",
",",
"array",
"&",
"$",
"metaParameters",
",",
"array",
"&",
"$",
"ctypeParameters",
")",
"{",
"// Our default callback",
"$",
"decoded",
"[",
"'queries_callback'"... | Parse textquery into useable arguments.
This is tightly coupled to $this->getContent()
@see $this->decodeContentQuery()
@param $textquery
@param array $decoded a pre-set decoded array to fill
@param array $metaParameters meta parameters
@param array $ctypeParameters contenttype parameters | [
"Parse",
"textquery",
"into",
"useable",
"arguments",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L1053-L1118 |
bolt/bolt | src/Legacy/Storage.php | Storage.prepareDecodedQueryForUse | private function prepareDecodedQueryForUse(&$decoded, &$metaParameters, &$ctypeParameters)
{
// If there is only 1 contenttype we assume the where is NOT nested
if (count($decoded['contenttypes']) == 1) {
// So we need to add this nesting
$ctypeParameters = [$decoded['content... | php | private function prepareDecodedQueryForUse(&$decoded, &$metaParameters, &$ctypeParameters)
{
// If there is only 1 contenttype we assume the where is NOT nested
if (count($decoded['contenttypes']) == 1) {
// So we need to add this nesting
$ctypeParameters = [$decoded['content... | [
"private",
"function",
"prepareDecodedQueryForUse",
"(",
"&",
"$",
"decoded",
",",
"&",
"$",
"metaParameters",
",",
"&",
"$",
"ctypeParameters",
")",
"{",
"// If there is only 1 contenttype we assume the where is NOT nested",
"if",
"(",
"count",
"(",
"$",
"decoded",
"... | Prepare decoded for actual use.
This is tightly coupled to $this->getContent()
@see $this->decodeContentQuery()
@param $decoded
@param $metaParameters
@param $ctypeParameters | [
"Prepare",
"decoded",
"for",
"actual",
"use",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L1131-L1179 |
bolt/bolt | src/Legacy/Storage.php | Storage.decodeQueryOrder | private function decodeQueryOrder($contenttype, $orderValue)
{
$order = false;
if (($orderValue === false) || ($orderValue === '')) {
if ($this->isValidColumn($contenttype['sort'], $contenttype, true)) {
$order = $this->getEscapedSortorder($contenttype['sort'], false);
... | php | private function decodeQueryOrder($contenttype, $orderValue)
{
$order = false;
if (($orderValue === false) || ($orderValue === '')) {
if ($this->isValidColumn($contenttype['sort'], $contenttype, true)) {
$order = $this->getEscapedSortorder($contenttype['sort'], false);
... | [
"private",
"function",
"decodeQueryOrder",
"(",
"$",
"contenttype",
",",
"$",
"orderValue",
")",
"{",
"$",
"order",
"=",
"false",
";",
"if",
"(",
"(",
"$",
"orderValue",
"===",
"false",
")",
"||",
"(",
"$",
"orderValue",
"===",
"''",
")",
")",
"{",
"... | Get the parameter for the 'order by' part of a query.
This is tightly coupled to $this->getContent()
@param array $contenttype
@param string $orderValue
@return string | [
"Get",
"the",
"parameter",
"for",
"the",
"order",
"by",
"part",
"of",
"a",
"query",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L1191-L1210 |
bolt/bolt | src/Legacy/Storage.php | Storage.decodeContentQuery | private function decodeContentQuery($textquery, $inParameters = null)
{
$decoded = [
'contenttypes' => [],
'return_single' => false,
'self_paginated' => true,
'order_callback' => false,
'queries' => [],
'parameters' => [],... | php | private function decodeContentQuery($textquery, $inParameters = null)
{
$decoded = [
'contenttypes' => [],
'return_single' => false,
'self_paginated' => true,
'order_callback' => false,
'queries' => [],
'parameters' => [],... | [
"private",
"function",
"decodeContentQuery",
"(",
"$",
"textquery",
",",
"$",
"inParameters",
"=",
"null",
")",
"{",
"$",
"decoded",
"=",
"[",
"'contenttypes'",
"=>",
"[",
"]",
",",
"'return_single'",
"=>",
"false",
",",
"'self_paginated'",
"=>",
"true",
","... | Decode a content textquery
This is tightly coupled to $this->getContent()
@param string $textquery
@param array $inParameters
@internal param string $query the query (eg. page/about, entries/latest/5)
@internal param array $parameters parameters to the query
@return array decoded query, keys:
contenttypes - arr... | [
"Decode",
"a",
"content",
"textquery"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L1237-L1401 |
bolt/bolt | src/Legacy/Storage.php | Storage.decodePageParameter | protected function decodePageParameter($context = '', $inParameters = null)
{
if (isset($inParameters['page']) && $inParameters['page'] !== null) {
return $inParameters['page'];
} else {
$param = Pager::makeParameterId($context);
/* @var $query \Symfony\Component\... | php | protected function decodePageParameter($context = '', $inParameters = null)
{
if (isset($inParameters['page']) && $inParameters['page'] !== null) {
return $inParameters['page'];
} else {
$param = Pager::makeParameterId($context);
/* @var $query \Symfony\Component\... | [
"protected",
"function",
"decodePageParameter",
"(",
"$",
"context",
"=",
"''",
",",
"$",
"inParameters",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"inParameters",
"[",
"'page'",
"]",
")",
"&&",
"$",
"inParameters",
"[",
"'page'",
"]",
"!==",
... | Decodes contextual page number from current request url if found.
@param string $context Pager id/name in url which value we find
@param array $inParameters
@return mixed Page number in context
@deprecated Not used in core anymore | [
"Decodes",
"contextual",
"page",
"number",
"from",
"current",
"request",
"url",
"if",
"found",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L1412-L1424 |
bolt/bolt | src/Legacy/Storage.php | Storage.hydrateRows | private function hydrateRows($contenttype, $rows, $getTaxoAndRel = true)
{
// Make sure content is set, and all content has information about its contenttype
$objects = [];
foreach ($rows as $row) {
$objects[$row['id']] = $this->getContentObject($contenttype, $row);
}
... | php | private function hydrateRows($contenttype, $rows, $getTaxoAndRel = true)
{
// Make sure content is set, and all content has information about its contenttype
$objects = [];
foreach ($rows as $row) {
$objects[$row['id']] = $this->getContentObject($contenttype, $row);
}
... | [
"private",
"function",
"hydrateRows",
"(",
"$",
"contenttype",
",",
"$",
"rows",
",",
"$",
"getTaxoAndRel",
"=",
"true",
")",
"{",
"// Make sure content is set, and all content has information about its contenttype",
"$",
"objects",
"=",
"[",
"]",
";",
"foreach",
"(",... | Hydrate database rows into objects.
@param array|string $contenttype
@param array $rows
@param boolean $getTaxoAndRel
@throws \Exception
@return array | [
"Hydrate",
"database",
"rows",
"into",
"objects",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L1437-L1453 |
bolt/bolt | src/Legacy/Storage.php | Storage.executeGetContentSearch | protected function executeGetContentSearch($decoded, $parameters)
{
$limit = 2000;
$offset = 0;
// set correct limit and offset if these are set.
if (isset($decoded['parameters']['limit'])) {
$limit = $decoded['parameters']['limit'];
}
if (isset($decoded... | php | protected function executeGetContentSearch($decoded, $parameters)
{
$limit = 2000;
$offset = 0;
// set correct limit and offset if these are set.
if (isset($decoded['parameters']['limit'])) {
$limit = $decoded['parameters']['limit'];
}
if (isset($decoded... | [
"protected",
"function",
"executeGetContentSearch",
"(",
"$",
"decoded",
",",
"$",
"parameters",
")",
"{",
"$",
"limit",
"=",
"2000",
";",
"$",
"offset",
"=",
"0",
";",
"// set correct limit and offset if these are set.",
"if",
"(",
"isset",
"(",
"$",
"decoded",... | Execute the content queries.
This is tightly coupled to $this->getContent()
@see $this->getContent()
@param array $decoded
@param array $parameters
@return array | [
"Execute",
"the",
"content",
"queries",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L1467-L1494 |
bolt/bolt | src/Legacy/Storage.php | Storage.executeGetContentQueries | protected function executeGetContentQueries($decoded)
{
// Perform actual queries and hydrate
$totalResults = false;
$results = false;
foreach ($decoded['queries'] as $query) {
$statement = sprintf(
'SELECT %s.* %s %s %s',
$query['tablename... | php | protected function executeGetContentQueries($decoded)
{
// Perform actual queries and hydrate
$totalResults = false;
$results = false;
foreach ($decoded['queries'] as $query) {
$statement = sprintf(
'SELECT %s.* %s %s %s',
$query['tablename... | [
"protected",
"function",
"executeGetContentQueries",
"(",
"$",
"decoded",
")",
"{",
"// Perform actual queries and hydrate",
"$",
"totalResults",
"=",
"false",
";",
"$",
"results",
"=",
"false",
";",
"foreach",
"(",
"$",
"decoded",
"[",
"'queries'",
"]",
"as",
"... | Execute the content queries.
This is tightly coupled to $this->getContent()
@see $this->getContent()
@param array $decoded
@return array | [
"Execute",
"the",
"content",
"queries",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L1507-L1572 |
bolt/bolt | src/Legacy/Storage.php | Storage.getContent | public function getContent($textquery, $parameters = '', &$pager = [], $whereparameters = [])
{
// Start the 'stopwatch' for the profiler.
$this->app['stopwatch']->start('bolt.getcontent', 'doctrine');
// $whereparameters is passed if called from a compiled template. If present, merge it wi... | php | public function getContent($textquery, $parameters = '', &$pager = [], $whereparameters = [])
{
// Start the 'stopwatch' for the profiler.
$this->app['stopwatch']->start('bolt.getcontent', 'doctrine');
// $whereparameters is passed if called from a compiled template. If present, merge it wi... | [
"public",
"function",
"getContent",
"(",
"$",
"textquery",
",",
"$",
"parameters",
"=",
"''",
",",
"&",
"$",
"pager",
"=",
"[",
"]",
",",
"$",
"whereparameters",
"=",
"[",
"]",
")",
"{",
"// Start the 'stopwatch' for the profiler.",
"$",
"this",
"->",
"app... | getContent based on a 'human readable query'.
Used directly by {% setcontent %} but also in other parts.
This code has been split into multiple methods in the spirit of
separation of concerns, but the situation is still far from ideal.
Where applicable each 'concern' notes the coupling in the local
documentation.
@... | [
"getContent",
"based",
"on",
"a",
"human",
"readable",
"query",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L1592-L1691 |
bolt/bolt | src/Legacy/Storage.php | Storage.runContentTypeTableChecks | private function runContentTypeTableChecks(array $contenttypes)
{
$checkedcontenttype = [];
foreach ($contenttypes as $contenttypeslug) {
// Make sure we do this only once per contenttype
if (isset($checkedcontenttype[$contenttypeslug])) {
continue;
... | php | private function runContentTypeTableChecks(array $contenttypes)
{
$checkedcontenttype = [];
foreach ($contenttypes as $contenttypeslug) {
// Make sure we do this only once per contenttype
if (isset($checkedcontenttype[$contenttypeslug])) {
continue;
... | [
"private",
"function",
"runContentTypeTableChecks",
"(",
"array",
"$",
"contenttypes",
")",
"{",
"$",
"checkedcontenttype",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"contenttypes",
"as",
"$",
"contenttypeslug",
")",
"{",
"// Make sure we do this only once per contentt... | Check for the existence of ContentType tables.
@param array $contenttypes ContentType slugs to check
@return boolean | [
"Check",
"for",
"the",
"existence",
"of",
"ContentType",
"tables",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L1700-L1719 |
bolt/bolt | src/Legacy/Storage.php | Storage.isValidColumn | private function isValidColumn($name, $contenttype, $allowVariants = false)
{
$isValidColumn = false;
if ($this->isMultiOrderQuery($name)) {
$separatedOrders = $this->getOrderBys($name);
} else {
$separatedOrders = [$name];
}
//Loop through each term... | php | private function isValidColumn($name, $contenttype, $allowVariants = false)
{
$isValidColumn = false;
if ($this->isMultiOrderQuery($name)) {
$separatedOrders = $this->getOrderBys($name);
} else {
$separatedOrders = [$name];
}
//Loop through each term... | [
"private",
"function",
"isValidColumn",
"(",
"$",
"name",
",",
"$",
"contenttype",
",",
"$",
"allowVariants",
"=",
"false",
")",
"{",
"$",
"isValidColumn",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"isMultiOrderQuery",
"(",
"$",
"name",
")",
")",
... | Check if a given name is a valid column, and if it can be used in queries.
@param string $name
@param array $contenttype
@param boolean $allowVariants
@return boolean | [
"Check",
"if",
"a",
"given",
"name",
"is",
"a",
"valid",
"column",
"and",
"if",
"it",
"can",
"be",
"used",
"in",
"queries",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L1730-L1772 |
bolt/bolt | src/Legacy/Storage.php | Storage.getEscapedSortorder | private function getEscapedSortorder($name, $prefix = 'r')
{
$order = '';
$separatedOrders = $this->getOrderBys($name);
$totalOrderByElements = count($separatedOrders);
foreach ($separatedOrders as $index => $name) {
list($name, $asc) = $this->getSortOrder($name);
... | php | private function getEscapedSortorder($name, $prefix = 'r')
{
$order = '';
$separatedOrders = $this->getOrderBys($name);
$totalOrderByElements = count($separatedOrders);
foreach ($separatedOrders as $index => $name) {
list($name, $asc) = $this->getSortOrder($name);
... | [
"private",
"function",
"getEscapedSortorder",
"(",
"$",
"name",
",",
"$",
"prefix",
"=",
"'r'",
")",
"{",
"$",
"order",
"=",
"''",
";",
"$",
"separatedOrders",
"=",
"$",
"this",
"->",
"getOrderBys",
"(",
"$",
"name",
")",
";",
"$",
"totalOrderByElements"... | Get an escaped sortorder for use in SQL, from a fieldname like 'title' or '-id'.
for example, -id returns `r`.`id` DESC
@param string $name
@param string $prefix
@return string | [
"Get",
"an",
"escaped",
"sortorder",
"for",
"use",
"in",
"SQL",
"from",
"a",
"fieldname",
"like",
"title",
"or",
"-",
"id",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L1796-L1829 |
bolt/bolt | src/Legacy/Storage.php | Storage.getOrderBys | protected function getOrderBys($order)
{
$separatedOrders = [$order];
if ($this->isMultiOrderQuery($order)) {
$separatedOrders = explode(',', $order);
}
return $separatedOrders;
} | php | protected function getOrderBys($order)
{
$separatedOrders = [$order];
if ($this->isMultiOrderQuery($order)) {
$separatedOrders = explode(',', $order);
}
return $separatedOrders;
} | [
"protected",
"function",
"getOrderBys",
"(",
"$",
"order",
")",
"{",
"$",
"separatedOrders",
"=",
"[",
"$",
"order",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"isMultiOrderQuery",
"(",
"$",
"order",
")",
")",
"{",
"$",
"separatedOrders",
"=",
"explode",
... | Get the ORDER BY parameters for the query.
@param $order
@return array | [
"Get",
"the",
"ORDER",
"BY",
"parameters",
"for",
"the",
"query",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L1851-L1860 |
bolt/bolt | src/Legacy/Storage.php | Storage.getSortOrder | public function getSortOrder($name = '-datepublish')
{
// If we don't get a string, we can't determine a sortorder.
if (!is_string($name)) {
return false;
}
$parts = explode(' ', trim($name));
$fieldname = $parts[0];
$sort = 'ASC';
if (isset($part... | php | public function getSortOrder($name = '-datepublish')
{
// If we don't get a string, we can't determine a sortorder.
if (!is_string($name)) {
return false;
}
$parts = explode(' ', trim($name));
$fieldname = $parts[0];
$sort = 'ASC';
if (isset($part... | [
"public",
"function",
"getSortOrder",
"(",
"$",
"name",
"=",
"'-datepublish'",
")",
"{",
"// If we don't get a string, we can't determine a sortorder.",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"parts",
"=",... | Get sorting order of name, stripping possible " DESC" " ASC" etc., and
also return the sorting order.
@param string $name
@return string | [
"Get",
"sorting",
"order",
"of",
"name",
"stripping",
"possible",
"DESC",
"ASC",
"etc",
".",
"and",
"also",
"return",
"the",
"sorting",
"order",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L1882-L1902 |
bolt/bolt | src/Legacy/Storage.php | Storage.groupingSort | private function groupingSort(Content $a, Content $b)
{
// Same group, sort within group.
if ($a->group['slug'] == $b->group['slug']) {
if (!empty($a->sortorder) || !empty($b->sortorder)) {
if (!isset($a->sortorder)) {
return 1;
} elsei... | php | private function groupingSort(Content $a, Content $b)
{
// Same group, sort within group.
if ($a->group['slug'] == $b->group['slug']) {
if (!empty($a->sortorder) || !empty($b->sortorder)) {
if (!isset($a->sortorder)) {
return 1;
} elsei... | [
"private",
"function",
"groupingSort",
"(",
"Content",
"$",
"a",
",",
"Content",
"$",
"b",
")",
"{",
"// Same group, sort within group.",
"if",
"(",
"$",
"a",
"->",
"group",
"[",
"'slug'",
"]",
"==",
"$",
"b",
"->",
"group",
"[",
"'slug'",
"]",
")",
"{... | Helper function for sorting Records of content that have a Grouping.
@param Content $a
@param Content $b
@return int | [
"Helper",
"function",
"for",
"sorting",
"Records",
"of",
"content",
"that",
"have",
"a",
"Grouping",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L1912-L1946 |
bolt/bolt | src/Legacy/Storage.php | Storage.parseWhereParameter | private function parseWhereParameter($key, $value, $fieldtype = false)
{
$value = trim($value);
// check if we need to split.
if (strpos($value, " || ") !== false) {
$values = explode(" || ", $value);
foreach ($values as $index => $value) {
$values[$i... | php | private function parseWhereParameter($key, $value, $fieldtype = false)
{
$value = trim($value);
// check if we need to split.
if (strpos($value, " || ") !== false) {
$values = explode(" || ", $value);
foreach ($values as $index => $value) {
$values[$i... | [
"private",
"function",
"parseWhereParameter",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"fieldtype",
"=",
"false",
")",
"{",
"$",
"value",
"=",
"trim",
"(",
"$",
"value",
")",
";",
"// check if we need to split.",
"if",
"(",
"strpos",
"(",
"$",
"valu... | Helper function to set the proper 'where' parameter,
when getting values like '<2012' or '!bob'.
@param string $key
@param string $value
@param mixed $fieldtype
@return string | [
"Helper",
"function",
"to",
"set",
"the",
"proper",
"where",
"parameter",
"when",
"getting",
"values",
"like",
"<2012",
"or",
"!bob",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L1958-L2011 |
bolt/bolt | src/Legacy/Storage.php | Storage.getContentType | public function getContentType($contenttypeslug)
{
// Return false if empty, can't find it.
if (empty($contenttypeslug)) {
return false;
}
$contenttype = $this->app['config']->get('contenttypes/' . $contenttypeslug);
// See if we've either given the correct cont... | php | public function getContentType($contenttypeslug)
{
// Return false if empty, can't find it.
if (empty($contenttypeslug)) {
return false;
}
$contenttype = $this->app['config']->get('contenttypes/' . $contenttypeslug);
// See if we've either given the correct cont... | [
"public",
"function",
"getContentType",
"(",
"$",
"contenttypeslug",
")",
"{",
"// Return false if empty, can't find it.",
"if",
"(",
"empty",
"(",
"$",
"contenttypeslug",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"contenttype",
"=",
"$",
"this",
"->",
... | Get the contenttype as an array, based on the given $contenttypeslug.
@param string $contenttypeslug
@return boolean|array | [
"Get",
"the",
"contenttype",
"as",
"an",
"array",
"based",
"on",
"the",
"given",
"$contenttypeslug",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L2020-L2060 |
bolt/bolt | src/Legacy/Storage.php | Storage.getTaxonomyType | public function getTaxonomyType($taxonomyslug)
{
$taxonomyslug = $this->app['slugify']->slugify($taxonomyslug);
// Return false if empty, can't find it.
if (empty($taxonomyslug)) {
return false;
}
// See if we've either given the correct contenttype, or try to f... | php | public function getTaxonomyType($taxonomyslug)
{
$taxonomyslug = $this->app['slugify']->slugify($taxonomyslug);
// Return false if empty, can't find it.
if (empty($taxonomyslug)) {
return false;
}
// See if we've either given the correct contenttype, or try to f... | [
"public",
"function",
"getTaxonomyType",
"(",
"$",
"taxonomyslug",
")",
"{",
"$",
"taxonomyslug",
"=",
"$",
"this",
"->",
"app",
"[",
"'slugify'",
"]",
"->",
"slugify",
"(",
"$",
"taxonomyslug",
")",
";",
"// Return false if empty, can't find it.",
"if",
"(",
... | Get the taxonomy as an array, based on the given $taxonomyslug.
@param string $taxonomyslug
@return boolean|array | [
"Get",
"the",
"taxonomy",
"as",
"an",
"array",
"based",
"on",
"the",
"given",
"$taxonomyslug",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L2069-L2095 |
bolt/bolt | src/Legacy/Storage.php | Storage.getContentTypeFields | public function getContentTypeFields($contenttypeslug)
{
$contenttype = $this->getContentType($contenttypeslug);
if (empty($contenttype['fields'])) {
return [];
} else {
return array_keys($contenttype['fields']);
}
} | php | public function getContentTypeFields($contenttypeslug)
{
$contenttype = $this->getContentType($contenttypeslug);
if (empty($contenttype['fields'])) {
return [];
} else {
return array_keys($contenttype['fields']);
}
} | [
"public",
"function",
"getContentTypeFields",
"(",
"$",
"contenttypeslug",
")",
"{",
"$",
"contenttype",
"=",
"$",
"this",
"->",
"getContentType",
"(",
"$",
"contenttypeslug",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"contenttype",
"[",
"'fields'",
"]",
")",
... | Get an array of the available fields for a given contenttype.
@param string $contenttypeslug
@return array $fields | [
"Get",
"an",
"array",
"of",
"the",
"available",
"fields",
"for",
"a",
"given",
"contenttype",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L2114-L2123 |
bolt/bolt | src/Legacy/Storage.php | Storage.getContentTypeFieldType | public function getContentTypeFieldType($contenttypeslug, $fieldname)
{
$contenttype = $this->getContentType($contenttypeslug);
if (in_array($fieldname, ['datecreated', 'datechanged', 'datepublish', 'datedepublish'])) {
return "datetime";
} elseif (isset($contenttype['fields'][$... | php | public function getContentTypeFieldType($contenttypeslug, $fieldname)
{
$contenttype = $this->getContentType($contenttypeslug);
if (in_array($fieldname, ['datecreated', 'datechanged', 'datepublish', 'datedepublish'])) {
return "datetime";
} elseif (isset($contenttype['fields'][$... | [
"public",
"function",
"getContentTypeFieldType",
"(",
"$",
"contenttypeslug",
",",
"$",
"fieldname",
")",
"{",
"$",
"contenttype",
"=",
"$",
"this",
"->",
"getContentType",
"(",
"$",
"contenttypeslug",
")",
";",
"if",
"(",
"in_array",
"(",
"$",
"fieldname",
... | Get the fieldtype for a given contenttype and fieldname.
@param string $contenttypeslug
@param string $fieldname
@return array $fields | [
"Get",
"the",
"fieldtype",
"for",
"a",
"given",
"contenttype",
"and",
"fieldname",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L2133-L2144 |
bolt/bolt | src/Legacy/Storage.php | Storage.getContentTypeGrouping | public function getContentTypeGrouping($contenttypeslug)
{
$grouping = false;
$taxonomy = $this->getContentTypeTaxonomy($contenttypeslug);
foreach ($taxonomy as $tax) {
if ($tax['behaves_like'] === 'grouping') {
$grouping = $tax['slug'];
break;
... | php | public function getContentTypeGrouping($contenttypeslug)
{
$grouping = false;
$taxonomy = $this->getContentTypeTaxonomy($contenttypeslug);
foreach ($taxonomy as $tax) {
if ($tax['behaves_like'] === 'grouping') {
$grouping = $tax['slug'];
break;
... | [
"public",
"function",
"getContentTypeGrouping",
"(",
"$",
"contenttypeslug",
")",
"{",
"$",
"grouping",
"=",
"false",
";",
"$",
"taxonomy",
"=",
"$",
"this",
"->",
"getContentTypeTaxonomy",
"(",
"$",
"contenttypeslug",
")",
";",
"foreach",
"(",
"$",
"taxonomy"... | Check if a given contenttype has a grouping, and if it does, return it.
@param string $contenttypeslug
@return mixed $grouping | [
"Check",
"if",
"a",
"given",
"contenttype",
"has",
"a",
"grouping",
"and",
"if",
"it",
"does",
"return",
"it",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L2153-L2165 |
bolt/bolt | src/Legacy/Storage.php | Storage.getContentTypeTaxonomy | public function getContentTypeTaxonomy($contenttypeslug)
{
$contenttype = $this->getContentType($contenttypeslug);
if (empty($contenttype['taxonomy'])) {
return [];
} else {
$taxokeys = $contenttype['taxonomy'];
$taxonomy = [];
foreach ($tax... | php | public function getContentTypeTaxonomy($contenttypeslug)
{
$contenttype = $this->getContentType($contenttypeslug);
if (empty($contenttype['taxonomy'])) {
return [];
} else {
$taxokeys = $contenttype['taxonomy'];
$taxonomy = [];
foreach ($tax... | [
"public",
"function",
"getContentTypeTaxonomy",
"(",
"$",
"contenttypeslug",
")",
"{",
"$",
"contenttype",
"=",
"$",
"this",
"->",
"getContentType",
"(",
"$",
"contenttypeslug",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"contenttype",
"[",
"'taxonomy'",
"]",
"... | Get an array of the available taxonomytypes for a given contenttype.
@param string $contenttypeslug
@return array $taxonomy | [
"Get",
"an",
"array",
"of",
"the",
"available",
"taxonomytypes",
"for",
"a",
"given",
"contenttype",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L2174-L2193 |
bolt/bolt | src/Legacy/Storage.php | Storage.getTaxonomy | protected function getTaxonomy($content)
{
$tablename = $this->getTablename("taxonomy");
$ids = Arr::column($content, 'id');
if (empty($ids)) {
return;
}
// Get the contenttype from first $content
$first = reset($content);
$config = $first->cont... | php | protected function getTaxonomy($content)
{
$tablename = $this->getTablename("taxonomy");
$ids = Arr::column($content, 'id');
if (empty($ids)) {
return;
}
// Get the contenttype from first $content
$first = reset($content);
$config = $first->cont... | [
"protected",
"function",
"getTaxonomy",
"(",
"$",
"content",
")",
"{",
"$",
"tablename",
"=",
"$",
"this",
"->",
"getTablename",
"(",
"\"taxonomy\"",
")",
";",
"$",
"ids",
"=",
"Arr",
"::",
"column",
"(",
"$",
"content",
",",
"'id'",
")",
";",
"if",
... | Get the taxonomy for one or more units of content, return the array with the taxonomy attached.
@param \Bolt\Legacy\Content[] $content
@return array $content | [
"Get",
"the",
"taxonomy",
"for",
"one",
"or",
"more",
"units",
"of",
"content",
"return",
"the",
"array",
"with",
"the",
"taxonomy",
"attached",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L2202-L2241 |
bolt/bolt | src/Legacy/Storage.php | Storage.updateTaxonomy | protected function updateTaxonomy($contenttype, $contentId, $taxonomy)
{
$tablename = $this->getTablename("taxonomy");
$configTaxonomies = $this->app['config']->get('taxonomy');
// Make sure $contenttypeslug is a 'slug'
if (is_array($contenttype)) {
$contenttypeslug = $c... | php | protected function updateTaxonomy($contenttype, $contentId, $taxonomy)
{
$tablename = $this->getTablename("taxonomy");
$configTaxonomies = $this->app['config']->get('taxonomy');
// Make sure $contenttypeslug is a 'slug'
if (is_array($contenttype)) {
$contenttypeslug = $c... | [
"protected",
"function",
"updateTaxonomy",
"(",
"$",
"contenttype",
",",
"$",
"contentId",
",",
"$",
"taxonomy",
")",
"{",
"$",
"tablename",
"=",
"$",
"this",
"->",
"getTablename",
"(",
"\"taxonomy\"",
")",
";",
"$",
"configTaxonomies",
"=",
"$",
"this",
"... | Update / insert taxonomy for a given content-unit.
@param string $contenttype
@param integer $contentId
@param array $taxonomy | [
"Update",
"/",
"insert",
"taxonomy",
"for",
"a",
"given",
"content",
"-",
"unit",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L2250-L2371 |
bolt/bolt | src/Legacy/Storage.php | Storage.getRelation | protected function getRelation($content)
{
$tablename = $this->getTablename("relations");
$ids = Arr::column($content, 'id');
if (empty($ids)) {
return;
}
// Get the contenttype from first $content
$first = reset($content);
$contenttype = isset(... | php | protected function getRelation($content)
{
$tablename = $this->getTablename("relations");
$ids = Arr::column($content, 'id');
if (empty($ids)) {
return;
}
// Get the contenttype from first $content
$first = reset($content);
$contenttype = isset(... | [
"protected",
"function",
"getRelation",
"(",
"$",
"content",
")",
"{",
"$",
"tablename",
"=",
"$",
"this",
"->",
"getTablename",
"(",
"\"relations\"",
")",
";",
"$",
"ids",
"=",
"Arr",
"::",
"column",
"(",
"$",
"content",
",",
"'id'",
")",
";",
"if",
... | Get the relations for one or more units of content, return the array with the taxonomy attached.
@param array $content
@return array $content | [
"Get",
"the",
"relations",
"for",
"one",
"or",
"more",
"units",
"of",
"content",
"return",
"the",
"array",
"with",
"the",
"taxonomy",
"attached",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L2380-L2418 |
bolt/bolt | src/Legacy/Storage.php | Storage.updateRelation | protected function updateRelation($contenttype, $contentId, $relation)
{
$tablename = $this->getTablename("relations");
// Get the current values from the DB.
$query = sprintf(
"SELECT id, to_contenttype, to_id FROM %s WHERE from_id=? AND from_contenttype=?",
$tablen... | php | protected function updateRelation($contenttype, $contentId, $relation)
{
$tablename = $this->getTablename("relations");
// Get the current values from the DB.
$query = sprintf(
"SELECT id, to_contenttype, to_id FROM %s WHERE from_id=? AND from_contenttype=?",
$tablen... | [
"protected",
"function",
"updateRelation",
"(",
"$",
"contenttype",
",",
"$",
"contentId",
",",
"$",
"relation",
")",
"{",
"$",
"tablename",
"=",
"$",
"this",
"->",
"getTablename",
"(",
"\"relations\"",
")",
";",
"// Get the current values from the DB.",
"$",
"q... | Update / insert relation for a given content-unit.
$relation looks like:
arr(2)
[
"pages" => arr(1)
[
0 => str(2) "22"
]
"showcases" => arr(3)
[
0 => str(2) "15"
1 => str(1) "9"
2 => str(2) "13"
]
]
$currentvalues looks like
arr(2)
[
0 => arr(3)
[
"id" => str(1) "5"
"to_contenttype" => str(12) "sho... | [
"Update",
"/",
"insert",
"relation",
"for",
"a",
"given",
"content",
"-",
"unit",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L2495-L2559 |
bolt/bolt | src/Legacy/Storage.php | Storage.getUri | public function getUri($title, $id = 0, $contenttypeslug = "", $fulluri = true, $allowempty = true, $slugfield = 'slug')
{
$contenttype = $this->getContentType($contenttypeslug);
$tablename = $this->getContenttypeTablename($contenttype);
$id = intval($id);
$slug = $this->app['slugify... | php | public function getUri($title, $id = 0, $contenttypeslug = "", $fulluri = true, $allowempty = true, $slugfield = 'slug')
{
$contenttype = $this->getContentType($contenttypeslug);
$tablename = $this->getContenttypeTablename($contenttype);
$id = intval($id);
$slug = $this->app['slugify... | [
"public",
"function",
"getUri",
"(",
"$",
"title",
",",
"$",
"id",
"=",
"0",
",",
"$",
"contenttypeslug",
"=",
"\"\"",
",",
"$",
"fulluri",
"=",
"true",
",",
"$",
"allowempty",
"=",
"true",
",",
"$",
"slugfield",
"=",
"'slug'",
")",
"{",
"$",
"cont... | Get a unique URL for a record
@param string $title
@param integer $id
@param string $contenttypeslug
@param boolean $fulluri
@param boolean $allowempty
@param string $slugfield
@return string | [
"Get",
"a",
"unique",
"URL",
"for",
"a",
"record"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L2591-L2658 |
bolt/bolt | src/Legacy/Storage.php | Storage.tableExists | protected function tableExists($name)
{
// We only should check each table once.
if (isset($this->tables[$name])) {
return true;
}
if ($this->app['db']->getSchemaManager()->tablesExist([$name]) === true) {
return $this->tables[$name] = true;
}
... | php | protected function tableExists($name)
{
// We only should check each table once.
if (isset($this->tables[$name])) {
return true;
}
if ($this->app['db']->getSchemaManager()->tablesExist([$name]) === true) {
return $this->tables[$name] = true;
}
... | [
"protected",
"function",
"tableExists",
"(",
"$",
"name",
")",
"{",
"// We only should check each table once.",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"tables",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"this"... | Check if the table $name exists. We use our own queries here, because it's _much_
faster than Doctrine's getSchemaManager().
@param $name
@return bool | [
"Check",
"if",
"the",
"table",
"$name",
"exists",
".",
"We",
"use",
"our",
"own",
"queries",
"here",
"because",
"it",
"s",
"_much_",
"faster",
"than",
"Doctrine",
"s",
"getSchemaManager",
"()",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L2668-L2680 |
bolt/bolt | src/Legacy/Storage.php | Storage.getTablename | public function getTablename($name)
{
if ($this->prefix === null) {
$this->prefix = $this->app['config']->get('general/database/prefix', 'bolt_');
}
$name = str_replace('-', '_', $this->app['slugify']->slugify($name));
$tablename = sprintf('%s%s', $this->prefix, $name);
... | php | public function getTablename($name)
{
if ($this->prefix === null) {
$this->prefix = $this->app['config']->get('general/database/prefix', 'bolt_');
}
$name = str_replace('-', '_', $this->app['slugify']->slugify($name));
$tablename = sprintf('%s%s', $this->prefix, $name);
... | [
"public",
"function",
"getTablename",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"prefix",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"prefix",
"=",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'general/database/... | Get the table name with prefix from a given $name.
@param string $name
@return string | [
"Get",
"the",
"table",
"name",
"with",
"prefix",
"from",
"a",
"given",
"$name",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L2689-L2699 |
bolt/bolt | src/Legacy/Storage.php | Storage.getContenttypeTablename | public function getContenttypeTablename($contenttype)
{
if (is_string($contenttype)) {
$contenttype = $this->getContentType($contenttype);
}
return $this->getTablename($contenttype['tablename']);
} | php | public function getContenttypeTablename($contenttype)
{
if (is_string($contenttype)) {
$contenttype = $this->getContentType($contenttype);
}
return $this->getTablename($contenttype['tablename']);
} | [
"public",
"function",
"getContenttypeTablename",
"(",
"$",
"contenttype",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"contenttype",
")",
")",
"{",
"$",
"contenttype",
"=",
"$",
"this",
"->",
"getContentType",
"(",
"$",
"contenttype",
")",
";",
"}",
"retur... | Get the tablename with prefix from a given Contenttype.
@param string|array $contenttype
@return string | [
"Get",
"the",
"tablename",
"with",
"prefix",
"from",
"a",
"given",
"Contenttype",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L2708-L2715 |
bolt/bolt | src/Legacy/Storage.php | Storage.setPager | public function setPager($name, $pager)
{
$pg = $this->app['pager']->createPager($name);
foreach ($pager as $prop => $value) {
$pg->$prop = $value;
}
return $this;
} | php | public function setPager($name, $pager)
{
$pg = $this->app['pager']->createPager($name);
foreach ($pager as $prop => $value) {
$pg->$prop = $value;
}
return $this;
} | [
"public",
"function",
"setPager",
"(",
"$",
"name",
",",
"$",
"pager",
")",
"{",
"$",
"pg",
"=",
"$",
"this",
"->",
"app",
"[",
"'pager'",
"]",
"->",
"createPager",
"(",
"$",
"name",
")",
";",
"foreach",
"(",
"$",
"pager",
"as",
"$",
"prop",
"=>"... | Setter for pager storage element.
@deprecated Just for keep BC
@param string $name
@param array|Pager $pager
@return Storage | [
"Setter",
"for",
"pager",
"storage",
"element",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Storage.php#L2749-L2758 |
bolt/bolt | src/Form/FieldType/UserRoleType.php | UserRoleType.configureOptions | public function configureOptions(OptionsResolver $resolver)
{
Deprecated::cls(3.4);
$roles = array_flip(array_map(
function ($role) {
return $role['label'];
},
$this->permissions->getDefinedRoles()
));
$resolver->setDefaults(
... | php | public function configureOptions(OptionsResolver $resolver)
{
Deprecated::cls(3.4);
$roles = array_flip(array_map(
function ($role) {
return $role['label'];
},
$this->permissions->getDefinedRoles()
));
$resolver->setDefaults(
... | [
"public",
"function",
"configureOptions",
"(",
"OptionsResolver",
"$",
"resolver",
")",
"{",
"Deprecated",
"::",
"cls",
"(",
"3.4",
")",
";",
"$",
"roles",
"=",
"array_flip",
"(",
"array_map",
"(",
"function",
"(",
"$",
"role",
")",
"{",
"return",
"$",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/FieldType/UserRoleType.php#L51-L74 |
bolt/bolt | src/Form/FieldType/UserRoleType.php | UserRoleType.getRoleAccessCallback | protected function getRoleAccessCallback()
{
return function ($key, $val, $index) {
/** @var Token $sessionAuth */
if (!$this->session->isStarted()) {
return ['disabled' => 'disabled'];
}
$sessionAuth = $this->session->get('authentication');
... | php | protected function getRoleAccessCallback()
{
return function ($key, $val, $index) {
/** @var Token $sessionAuth */
if (!$this->session->isStarted()) {
return ['disabled' => 'disabled'];
}
$sessionAuth = $this->session->get('authentication');
... | [
"protected",
"function",
"getRoleAccessCallback",
"(",
")",
"{",
"return",
"function",
"(",
"$",
"key",
",",
"$",
"val",
",",
"$",
"index",
")",
"{",
"/** @var Token $sessionAuth */",
"if",
"(",
"!",
"$",
"this",
"->",
"session",
"->",
"isStarted",
"(",
")... | Callback to disable role choices that a user doesn't have access to
manipulate.
@return callable | [
"Callback",
"to",
"disable",
"role",
"choices",
"that",
"a",
"user",
"doesn",
"t",
"have",
"access",
"to",
"manipulate",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/FieldType/UserRoleType.php#L82-L95 |
bolt/bolt | src/Composer/Script/PathCustomizer.php | PathCustomizer.run | public function run()
{
if (!$this->io->isInteractive()) {
return;
}
$cwd = getcwd();
$info = <<<OUT
All paths are currently relative to the current working directory (`$cwd`)
Paths can have aliases to other paths. These are specified with a word surrounded by percents... | php | public function run()
{
if (!$this->io->isInteractive()) {
return;
}
$cwd = getcwd();
$info = <<<OUT
All paths are currently relative to the current working directory (`$cwd`)
Paths can have aliases to other paths. These are specified with a word surrounded by percents... | [
"public",
"function",
"run",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"io",
"->",
"isInteractive",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"cwd",
"=",
"getcwd",
"(",
")",
";",
"$",
"info",
"=",
" <<<OUT\n\nAll paths are currently relative... | Run the customizer. | [
"Run",
"the",
"customizer",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/PathCustomizer.php#L42-L73 |
bolt/bolt | src/Composer/Script/PathCustomizer.php | PathCustomizer.renderPaths | private function renderPaths()
{
if (!$this->pathsTable) {
$this->pathsTable = new Table($this->io);
$style = clone Table::getStyleDefinition('symfony-style-guide');
$this->pathsTable->setStyle($style);
$this->pathsTable->setHeaders(['#', 'Name', 'Path']);
... | php | private function renderPaths()
{
if (!$this->pathsTable) {
$this->pathsTable = new Table($this->io);
$style = clone Table::getStyleDefinition('symfony-style-guide');
$this->pathsTable->setStyle($style);
$this->pathsTable->setHeaders(['#', 'Name', 'Path']);
... | [
"private",
"function",
"renderPaths",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"pathsTable",
")",
"{",
"$",
"this",
"->",
"pathsTable",
"=",
"new",
"Table",
"(",
"$",
"this",
"->",
"io",
")",
";",
"$",
"style",
"=",
"clone",
"Table",
"::",... | Render paths table. | [
"Render",
"paths",
"table",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/PathCustomizer.php#L78-L111 |
bolt/bolt | src/Composer/Script/PathCustomizer.php | PathCustomizer.askPathToModify | private function askPathToModify()
{
$names = $this->resolver->names();
$count = count($names);
$question = new Question('Enter # or name to modify or empty to continue');
$question->setValidator(function ($value) use ($names, $count) {
if ($value === null) {
... | php | private function askPathToModify()
{
$names = $this->resolver->names();
$count = count($names);
$question = new Question('Enter # or name to modify or empty to continue');
$question->setValidator(function ($value) use ($names, $count) {
if ($value === null) {
... | [
"private",
"function",
"askPathToModify",
"(",
")",
"{",
"$",
"names",
"=",
"$",
"this",
"->",
"resolver",
"->",
"names",
"(",
")",
";",
"$",
"count",
"=",
"count",
"(",
"$",
"names",
")",
";",
"$",
"question",
"=",
"new",
"Question",
"(",
"'Enter # ... | Ask which path to modify.
@return string|null the path name to modify or null to finish | [
"Ask",
"which",
"path",
"to",
"modify",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/PathCustomizer.php#L118-L140 |
bolt/bolt | src/Composer/Script/PathCustomizer.php | PathCustomizer.askAndSetNewPathValue | private function askAndSetNewPathValue($name)
{
$previous = $this->resolver->raw($name);
$question = new Question('Enter new value for ' . $name, $previous);
$question->setValidator(function ($value) use ($name, $previous) {
$this->resolver->define($name, $value);
// ... | php | private function askAndSetNewPathValue($name)
{
$previous = $this->resolver->raw($name);
$question = new Question('Enter new value for ' . $name, $previous);
$question->setValidator(function ($value) use ($name, $previous) {
$this->resolver->define($name, $value);
// ... | [
"private",
"function",
"askAndSetNewPathValue",
"(",
"$",
"name",
")",
"{",
"$",
"previous",
"=",
"$",
"this",
"->",
"resolver",
"->",
"raw",
"(",
"$",
"name",
")",
";",
"$",
"question",
"=",
"new",
"Question",
"(",
"'Enter new value for '",
".",
"$",
"n... | Ask for the new value for the given path name and set it.
@param string $name | [
"Ask",
"for",
"the",
"new",
"value",
"for",
"the",
"given",
"path",
"name",
"and",
"set",
"it",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/PathCustomizer.php#L147-L162 |
bolt/bolt | src/Nut/UserRoleRemove.php | UserRoleRemove.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$username = $input->getArgument('username');
$role = $input->getArgument('role');
$users = $this->app['users'];
if (!$users->hasRole($username, $role)) {
$msg = sprintf("User '%s' doesn't alread... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$username = $input->getArgument('username');
$role = $input->getArgument('role');
$users = $this->app['users'];
if (!$users->hasRole($username, $role)) {
$msg = sprintf("User '%s' doesn't alread... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"username",
"=",
"$",
"input",
"->",
"getArgument",
"(",
"'username'",
")",
";",
"$",
"role",
"=",
"$",
"input",
"->",
"getArgume... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/UserRoleRemove.php#L30-L55 |
bolt/bolt | src/Storage/ContentLegacyService.php | ContentLegacyService.initialize | public function initialize(Entity\Entity $entity)
{
$this->setupContenttype($entity);
$this->setupContainer($entity);
} | php | public function initialize(Entity\Entity $entity)
{
$this->setupContenttype($entity);
$this->setupContainer($entity);
} | [
"public",
"function",
"initialize",
"(",
"Entity",
"\\",
"Entity",
"$",
"entity",
")",
"{",
"$",
"this",
"->",
"setupContenttype",
"(",
"$",
"entity",
")",
";",
"$",
"this",
"->",
"setupContainer",
"(",
"$",
"entity",
")",
";",
"}"
] | Initialise.
@param Entity\Entity $entity | [
"Initialise",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentLegacyService.php#L38-L42 |
bolt/bolt | src/Storage/ContentLegacyService.php | ContentLegacyService.setupContenttype | public function setupContenttype(Entity\Entity $entity)
{
$contentType = $entity->getContenttype();
if (is_string($contentType)) {
$contentTypeData = $this->app['storage']->getContenttype($contentType);
if ($contentTypeData instanceof ContentType) {
$contentTy... | php | public function setupContenttype(Entity\Entity $entity)
{
$contentType = $entity->getContenttype();
if (is_string($contentType)) {
$contentTypeData = $this->app['storage']->getContenttype($contentType);
if ($contentTypeData instanceof ContentType) {
$contentTy... | [
"public",
"function",
"setupContenttype",
"(",
"Entity",
"\\",
"Entity",
"$",
"entity",
")",
"{",
"$",
"contentType",
"=",
"$",
"entity",
"->",
"getContenttype",
"(",
")",
";",
"if",
"(",
"is_string",
"(",
"$",
"contentType",
")",
")",
"{",
"$",
"content... | Set the legacy ContentType object on the Entity.
@param Entity\Entity $entity | [
"Set",
"the",
"legacy",
"ContentType",
"object",
"on",
"the",
"Entity",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentLegacyService.php#L49-L61 |
bolt/bolt | src/Storage/Field/Type/DateTimeType.php | DateTimeType.persist | public function persist(QuerySet $queries, $entity)
{
$key = $this->mapping['fieldname'];
$value = $entity->get($key);
if (!$value instanceof \DateTime && $value !== null) {
$value = new Carbon($value);
$entity->set($key, $value);
}
parent::persist($... | php | public function persist(QuerySet $queries, $entity)
{
$key = $this->mapping['fieldname'];
$value = $entity->get($key);
if (!$value instanceof \DateTime && $value !== null) {
$value = new Carbon($value);
$entity->set($key, $value);
}
parent::persist($... | [
"public",
"function",
"persist",
"(",
"QuerySet",
"$",
"queries",
",",
"$",
"entity",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"mapping",
"[",
"'fieldname'",
"]",
";",
"$",
"value",
"=",
"$",
"entity",
"->",
"get",
"(",
"$",
"key",
")",
";",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/DateTimeType.php#L29-L40 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.