id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
34,500 | jon48/webtrees-lib | src/Webtrees/Module/Sosa/Model/SosaProvider.php | SosaProvider.getSosaListAtGeneration | public function getSosaListAtGeneration($gen){
if(!$this->is_setup) return array();
if(!$this->sosa_list_by_gen)
$this->sosa_list_by_gen = array();
if($gen){
if(!isset($this->sosa_list_by_gen[$gen])){
$this->sosa_list_by_gen[$gen] = Database::prep... | php | public function getSosaListAtGeneration($gen){
if(!$this->is_setup) return array();
if(!$this->sosa_list_by_gen)
$this->sosa_list_by_gen = array();
if($gen){
if(!isset($this->sosa_list_by_gen[$gen])){
$this->sosa_list_by_gen[$gen] = Database::prep... | [
"public",
"function",
"getSosaListAtGeneration",
"(",
"$",
"gen",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"is_setup",
")",
"return",
"array",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"sosa_list_by_gen",
")",
"$",
"this",
"->",
"sosa_list_... | Get an associative array of Sosa individuals in generation G. Keys are Sosa numbers, values individuals.
@param number $gen Generation
@return array Array of Sosa individuals | [
"Get",
"an",
"associative",
"array",
"of",
"Sosa",
"individuals",
"in",
"generation",
"G",
".",
"Keys",
"are",
"Sosa",
"numbers",
"values",
"individuals",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/Sosa/Model/SosaProvider.php#L283-L306 |
34,501 | jon48/webtrees-lib | src/Webtrees/Module/Sosa/Model/SosaProvider.php | SosaProvider.getFamilySosaListAtGeneration | public function getFamilySosaListAtGeneration($gen){
if(!$this->is_setup) return array();
if(!$this->sosa_fam_list_by_gen)
$this->sosa_fam_list_by_gen = array();
if($gen){
if(!isset($this->sosa_fam_list_by_gen[$gen])){
$this->sosa_fam_list_by_gen[... | php | public function getFamilySosaListAtGeneration($gen){
if(!$this->is_setup) return array();
if(!$this->sosa_fam_list_by_gen)
$this->sosa_fam_list_by_gen = array();
if($gen){
if(!isset($this->sosa_fam_list_by_gen[$gen])){
$this->sosa_fam_list_by_gen[... | [
"public",
"function",
"getFamilySosaListAtGeneration",
"(",
"$",
"gen",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"is_setup",
")",
"return",
"array",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"sosa_fam_list_by_gen",
")",
"$",
"this",
"->",
"... | Get an associative array of Sosa families in generation G. Keys are Sosa numbers for the husband, values families.
@param number $gen Generation
@return array Array of Sosa families | [
"Get",
"an",
"associative",
"array",
"of",
"Sosa",
"families",
"in",
"generation",
"G",
".",
"Keys",
"are",
"Sosa",
"numbers",
"for",
"the",
"husband",
"values",
"families",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/Sosa/Model/SosaProvider.php#L314-L342 |
34,502 | jon48/webtrees-lib | src/Webtrees/Module/Sosa/Model/SosaProvider.php | SosaProvider.getMissingSosaListAtGeneration | public function getMissingSosaListAtGeneration($gen){
if(!$this->is_setup) return array();
if($gen){
return $this->sosa_list_by_gen[$gen] = Database::prepare(
'SELECT schild.majs_sosa sosa, schild.majs_i_id indi, sfat.majs_sosa IS NOT NULL has_father, smot.majs_sosa IS NO... | php | public function getMissingSosaListAtGeneration($gen){
if(!$this->is_setup) return array();
if($gen){
return $this->sosa_list_by_gen[$gen] = Database::prepare(
'SELECT schild.majs_sosa sosa, schild.majs_i_id indi, sfat.majs_sosa IS NOT NULL has_father, smot.majs_sosa IS NO... | [
"public",
"function",
"getMissingSosaListAtGeneration",
"(",
"$",
"gen",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"is_setup",
")",
"return",
"array",
"(",
")",
";",
"if",
"(",
"$",
"gen",
")",
"{",
"return",
"$",
"this",
"->",
"sosa_list_by_gen",
"... | Get an associative array of Sosa individuals in generation G who are missing parents. Keys are Sosa numbers, values individuals.
@param number $gen Generation
@return array Array of Sosa individuals | [
"Get",
"an",
"associative",
"array",
"of",
"Sosa",
"individuals",
"in",
"generation",
"G",
"who",
"are",
"missing",
"parents",
".",
"Keys",
"are",
"Sosa",
"numbers",
"values",
"individuals",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/Sosa/Model/SosaProvider.php#L350-L369 |
34,503 | jon48/webtrees-lib | src/Webtrees/Module/Sosa/Model/SosaProvider.php | SosaProvider.getTotalIndividuals | public function getTotalIndividuals() {
if(!$this->is_setup) return 0;
return Database::prepare(
'SELECT COUNT(*) FROM `##individuals`' .
' WHERE i_file = :tree_id')
->execute(array('tree_id' => $this->tree->getTreeId()))
->fetchOne() ?: 0;
} | php | public function getTotalIndividuals() {
if(!$this->is_setup) return 0;
return Database::prepare(
'SELECT COUNT(*) FROM `##individuals`' .
' WHERE i_file = :tree_id')
->execute(array('tree_id' => $this->tree->getTreeId()))
->fetchOne() ?: 0;
} | [
"public",
"function",
"getTotalIndividuals",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"is_setup",
")",
"return",
"0",
";",
"return",
"Database",
"::",
"prepare",
"(",
"'SELECT COUNT(*) FROM `##individuals`'",
".",
"' WHERE i_file = :tree_id'",
")",
"->",
... | How many individuals exist in the tree.
@return int | [
"How",
"many",
"individuals",
"exist",
"in",
"the",
"tree",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/Sosa/Model/SosaProvider.php#L414-L421 |
34,504 | jon48/webtrees-lib | src/Webtrees/Module/Sosa/Model/SosaProvider.php | SosaProvider.getSosaCount | public function getSosaCount(){
if(!$this->is_setup) return 0;
return Database::prepare(
'SELECT COUNT(majs_sosa) FROM `##maj_sosa`' .
' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id')
->execute(array(
'tree_id' => $this->tree->getTreeId(),
... | php | public function getSosaCount(){
if(!$this->is_setup) return 0;
return Database::prepare(
'SELECT COUNT(majs_sosa) FROM `##maj_sosa`' .
' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id')
->execute(array(
'tree_id' => $this->tree->getTreeId(),
... | [
"public",
"function",
"getSosaCount",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"is_setup",
")",
"return",
"0",
";",
"return",
"Database",
"::",
"prepare",
"(",
"'SELECT COUNT(majs_sosa) FROM `##maj_sosa`'",
".",
"' WHERE majs_gedcom_id=:tree_id AND majs_user_... | Get the total Sosa count for all generations
@return number Number of Sosas | [
"Get",
"the",
"total",
"Sosa",
"count",
"for",
"all",
"generations"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/Sosa/Model/SosaProvider.php#L428-L437 |
34,505 | jon48/webtrees-lib | src/Webtrees/Module/Sosa/Model/SosaProvider.php | SosaProvider.getDifferentSosaCountUpToGeneration | public function getDifferentSosaCountUpToGeneration($gen){
if(!$this->is_setup) return 0;
return Database::prepare(
'SELECT COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`' .
' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'.
' AND majs_gen <= :gen')
->ex... | php | public function getDifferentSosaCountUpToGeneration($gen){
if(!$this->is_setup) return 0;
return Database::prepare(
'SELECT COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`' .
' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'.
' AND majs_gen <= :gen')
->ex... | [
"public",
"function",
"getDifferentSosaCountUpToGeneration",
"(",
"$",
"gen",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"is_setup",
")",
"return",
"0",
";",
"return",
"Database",
"::",
"prepare",
"(",
"'SELECT COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`'",
".",
... | Get the number of distinct Sosa individual up to a specific generation.
@param number $gen Generation
@return number Number of distinct Sosa individuals up to generation | [
"Get",
"the",
"number",
"of",
"distinct",
"Sosa",
"individual",
"up",
"to",
"a",
"specific",
"generation",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/Sosa/Model/SosaProvider.php#L499-L510 |
34,506 | jon48/webtrees-lib | src/Webtrees/Module/Sosa/Model/SosaProvider.php | SosaProvider.getMeanGenerationTime | public function getMeanGenerationTime(){
if(!$this->is_setup) return;
if(!$this->statistics_tab){
$this->getStatisticsByGeneration();
}
//Linear regression on x=generation and y=birthdate
$sum_xy = 0;
$sum_x=0;
$sum_y=0;
$sum_x2=0;
$n=c... | php | public function getMeanGenerationTime(){
if(!$this->is_setup) return;
if(!$this->statistics_tab){
$this->getStatisticsByGeneration();
}
//Linear regression on x=generation and y=birthdate
$sum_xy = 0;
$sum_x=0;
$sum_y=0;
$sum_x2=0;
$n=c... | [
"public",
"function",
"getMeanGenerationTime",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"is_setup",
")",
"return",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"statistics_tab",
")",
"{",
"$",
"this",
"->",
"getStatisticsByGeneration",
"(",
")",
";",... | Get the mean generation time, based on a linear regression of birth years and generations
@return number|NULL Mean generation time | [
"Get",
"the",
"mean",
"generation",
"time",
"based",
"on",
"a",
"linear",
"regression",
"of",
"birth",
"years",
"and",
"generations"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/Sosa/Model/SosaProvider.php#L542-L564 |
34,507 | jon48/webtrees-lib | src/Webtrees/Module/Sosa/Model/SosaProvider.php | SosaProvider.getAncestorDispersionForGen | public function getAncestorDispersionForGen($gen) {
if(!$this->is_setup || $gen > 11) return array(); // Going further than 11 gen will be out of range in the query
return Database::prepare(
'SELECT branches, count(i_id)'.
' FROM ('.
' SELECT i_id,'.
' ... | php | public function getAncestorDispersionForGen($gen) {
if(!$this->is_setup || $gen > 11) return array(); // Going further than 11 gen will be out of range in the query
return Database::prepare(
'SELECT branches, count(i_id)'.
' FROM ('.
' SELECT i_id,'.
' ... | [
"public",
"function",
"getAncestorDispersionForGen",
"(",
"$",
"gen",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"is_setup",
"||",
"$",
"gen",
">",
"11",
")",
"return",
"array",
"(",
")",
";",
"// Going further than 11 gen will be out of range in the query",
"... | Return a computed array of statistics about the dispersion of ancestors across the ancestors
at a specified generation.
This statistics cannot be used for generations above 11, as it would cause a out of range in MySQL
Format:
- key : a base-2 representation of the ancestor at generation G for which exclusive ancestor... | [
"Return",
"a",
"computed",
"array",
"of",
"statistics",
"about",
"the",
"dispersion",
"of",
"ancestors",
"across",
"the",
"ancestors",
"at",
"a",
"specified",
"generation",
".",
"This",
"statistics",
"cannot",
"be",
"used",
"for",
"generations",
"above",
"11",
... | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/Sosa/Model/SosaProvider.php#L588-L613 |
34,508 | voslartomas/WebCMS2 | Entity/Entity.php | Entity.toArray | public function toArray($notEmptyValues = false)
{
$props = $this->getReflection()->getProperties();
if ($this->getReflection()->getParentClass()) {
$temp = $this->getReflection()->getParentClass()->getProperties();
$props = array_merge($props, $temp);
}
if (... | php | public function toArray($notEmptyValues = false)
{
$props = $this->getReflection()->getProperties();
if ($this->getReflection()->getParentClass()) {
$temp = $this->getReflection()->getParentClass()->getProperties();
$props = array_merge($props, $temp);
}
if (... | [
"public",
"function",
"toArray",
"(",
"$",
"notEmptyValues",
"=",
"false",
")",
"{",
"$",
"props",
"=",
"$",
"this",
"->",
"getReflection",
"(",
")",
"->",
"getProperties",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getReflection",
"(",
")",
"->",
... | Converts object into array.
@return Array | [
"Converts",
"object",
"into",
"array",
"."
] | b39ea4b2fd30e87ff5e4fa81441cefa308e51fbf | https://github.com/voslartomas/WebCMS2/blob/b39ea4b2fd30e87ff5e4fa81441cefa308e51fbf/Entity/Entity.php#L35-L77 |
34,509 | GrupaZero/cms | src/Gzero/Cms/Http/Controllers/Api/ContentController.php | ContentController.show | public function show($id)
{
$content = $this->repository->getById($id);
if (!$content) {
return $this->errorNotFound();
}
$this->authorize('read', $content);
return new ContentResource($content);
} | php | public function show($id)
{
$content = $this->repository->getById($id);
if (!$content) {
return $this->errorNotFound();
}
$this->authorize('read', $content);
return new ContentResource($content);
} | [
"public",
"function",
"show",
"(",
"$",
"id",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"repository",
"->",
"getById",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"$",
"content",
")",
"{",
"return",
"$",
"this",
"->",
"errorNotFound",
"(",
... | Display a specified content.
@SWG\Get(
path="/contents/{id}",
tags={"content"},
summary="Returns a specific content by id",
description="Returns a specific content by id",
produces={"application/json"},
security={{"AdminAccess": {}}},
@SWG\Parameter(
name="id",
in="path",
description="Id of content that needs to be re... | [
"Display",
"a",
"specified",
"content",
"."
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Http/Controllers/Api/ContentController.php#L271-L281 |
34,510 | alexislefebvre/AsyncTweetsBundle | src/Entity/TweetRepository.php | TweetRepository.removeOrphanMedias | private function removeOrphanMedias(Media $media)
{
if (count($media->getTweets()) == 0) {
$this->_em->remove($media);
}
} | php | private function removeOrphanMedias(Media $media)
{
if (count($media->getTweets()) == 0) {
$this->_em->remove($media);
}
} | [
"private",
"function",
"removeOrphanMedias",
"(",
"Media",
"$",
"media",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"media",
"->",
"getTweets",
"(",
")",
")",
"==",
"0",
")",
"{",
"$",
"this",
"->",
"_em",
"->",
"remove",
"(",
"$",
"media",
")",
";",
... | Remove Media not associated to any Tweet.
@param Media $media | [
"Remove",
"Media",
"not",
"associated",
"to",
"any",
"Tweet",
"."
] | 76266fae7de978963e05dadb14c81f8398bb00a6 | https://github.com/alexislefebvre/AsyncTweetsBundle/blob/76266fae7de978963e05dadb14c81f8398bb00a6/src/Entity/TweetRepository.php#L181-L186 |
34,511 | alexislefebvre/AsyncTweetsBundle | src/Entity/TweetRepository.php | TweetRepository.removeTweet | protected function removeTweet($tweet)
{
$count = 0;
foreach ($tweet->getMedias() as $media) {
$tweet->removeMedia($media);
$this->removeOrphanMedias($media);
}
// Don't count tweets that were only retweeted
if ($tweet->isInTimeline()) {
... | php | protected function removeTweet($tweet)
{
$count = 0;
foreach ($tweet->getMedias() as $media) {
$tweet->removeMedia($media);
$this->removeOrphanMedias($media);
}
// Don't count tweets that were only retweeted
if ($tweet->isInTimeline()) {
... | [
"protected",
"function",
"removeTweet",
"(",
"$",
"tweet",
")",
"{",
"$",
"count",
"=",
"0",
";",
"foreach",
"(",
"$",
"tweet",
"->",
"getMedias",
"(",
")",
"as",
"$",
"media",
")",
"{",
"$",
"tweet",
"->",
"removeMedia",
"(",
"$",
"media",
")",
";... | Remove the tweet and return 1 is the deleted tweet is not a
retweet.
@param Tweet $tweet
@return int | [
"Remove",
"the",
"tweet",
"and",
"return",
"1",
"is",
"the",
"deleted",
"tweet",
"is",
"not",
"a",
"retweet",
"."
] | 76266fae7de978963e05dadb14c81f8398bb00a6 | https://github.com/alexislefebvre/AsyncTweetsBundle/blob/76266fae7de978963e05dadb14c81f8398bb00a6/src/Entity/TweetRepository.php#L196-L213 |
34,512 | voslartomas/WebCMS2 | AdminModule/presenters/UpdatePresenter.php | UpdatePresenter.renderLog | public function renderLog()
{
$this->reloadContent();
$this->template->installLog = $this->getLog('../log/install.log');
$this->template->installErrorLog = $this->getLog('../log/install-error.log');
$this->template->updateLog = $this->getLog('../log/auto-update.log');
$this-... | php | public function renderLog()
{
$this->reloadContent();
$this->template->installLog = $this->getLog('../log/install.log');
$this->template->installErrorLog = $this->getLog('../log/install-error.log');
$this->template->updateLog = $this->getLog('../log/auto-update.log');
$this-... | [
"public",
"function",
"renderLog",
"(",
")",
"{",
"$",
"this",
"->",
"reloadContent",
"(",
")",
";",
"$",
"this",
"->",
"template",
"->",
"installLog",
"=",
"$",
"this",
"->",
"getLog",
"(",
"'../log/install.log'",
")",
";",
"$",
"this",
"->",
"template"... | render log tab | [
"render",
"log",
"tab"
] | b39ea4b2fd30e87ff5e4fa81441cefa308e51fbf | https://github.com/voslartomas/WebCMS2/blob/b39ea4b2fd30e87ff5e4fa81441cefa308e51fbf/AdminModule/presenters/UpdatePresenter.php#L347-L355 |
34,513 | kadet1090/KeyLighter | Language/Perl.php | Perl.setupRules | public function setupRules()
{
$identifier = '\w+';
$number = '[+-]?(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?';
$this->rules->addMany([
'string' => CommonFeatures::strings(['single' => '\'', 'double' => '"'], [
'context' => ['!keyword', '!comment', '!string', '!la... | php | public function setupRules()
{
$identifier = '\w+';
$number = '[+-]?(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?';
$this->rules->addMany([
'string' => CommonFeatures::strings(['single' => '\'', 'double' => '"'], [
'context' => ['!keyword', '!comment', '!string', '!la... | [
"public",
"function",
"setupRules",
"(",
")",
"{",
"$",
"identifier",
"=",
"'\\w+'",
";",
"$",
"number",
"=",
"'[+-]?(?=\\d|\\.\\d)\\d*(\\.\\d*)?([Ee]([+-]?\\d+))?'",
";",
"$",
"this",
"->",
"rules",
"->",
"addMany",
"(",
"[",
"'string'",
"=>",
"CommonFeatures",
... | Tokenization rules definition | [
"Tokenization",
"rules",
"definition"
] | 6aac402b7fe0170edf3c5afbae652009951068af | https://github.com/kadet1090/KeyLighter/blob/6aac402b7fe0170edf3c5afbae652009951068af/Language/Perl.php#L38-L115 |
34,514 | GrupaZero/cms | src/Gzero/Cms/Http/Controllers/Api/BlockController.php | BlockController.show | public function show($id)
{
$block = $this->repository->getById($id);
if (!$block) {
return $this->errorNotFound();
}
$this->authorize('read', $block);
return new BlockResource($block);
} | php | public function show($id)
{
$block = $this->repository->getById($id);
if (!$block) {
return $this->errorNotFound();
}
$this->authorize('read', $block);
return new BlockResource($block);
} | [
"public",
"function",
"show",
"(",
"$",
"id",
")",
"{",
"$",
"block",
"=",
"$",
"this",
"->",
"repository",
"->",
"getById",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"$",
"block",
")",
"{",
"return",
"$",
"this",
"->",
"errorNotFound",
"(",
")",... | Display a specified block.
@SWG\Get(
path="/blocks/{id}",
tags={"blocks"},
summary="Returns a specific block by id",
description="Returns a specific block by id",
produces={"application/json"},
security={{"AdminAccess": {}}},
@SWG\Parameter(
name="id",
in="path",
description="Id of block that needs to be returned.",
r... | [
"Display",
"a",
"specified",
"block",
"."
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Http/Controllers/Api/BlockController.php#L199-L209 |
34,515 | GrupaZero/cms | database/migrations/2015_11_26_115322_create_block.php | CreateBlock.seedBlockTypes | private function seedBlockTypes()
{
BlockType::firstOrCreate(['name' => 'basic', 'handler' => Gzero\Cms\Handlers\Block\Basic::class]);
BlockType::firstOrCreate(['name' => 'menu', 'handler' => Gzero\Cms\Handlers\Block\Menu::class]);
BlockType::firstOrCreate(['name' => 'slider', 'handler' => G... | php | private function seedBlockTypes()
{
BlockType::firstOrCreate(['name' => 'basic', 'handler' => Gzero\Cms\Handlers\Block\Basic::class]);
BlockType::firstOrCreate(['name' => 'menu', 'handler' => Gzero\Cms\Handlers\Block\Menu::class]);
BlockType::firstOrCreate(['name' => 'slider', 'handler' => G... | [
"private",
"function",
"seedBlockTypes",
"(",
")",
"{",
"BlockType",
"::",
"firstOrCreate",
"(",
"[",
"'name'",
"=>",
"'basic'",
",",
"'handler'",
"=>",
"Gzero",
"\\",
"Cms",
"\\",
"Handlers",
"\\",
"Block",
"\\",
"Basic",
"::",
"class",
"]",
")",
";",
"... | Seed block types
@return void | [
"Seed",
"block",
"types"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/database/migrations/2015_11_26_115322_create_block.php#L86-L91 |
34,516 | voslartomas/WebCMS2 | FrontendModule/presenters/BasePresenter.php | BasePresenter.getStructures | private function getStructures($direct = true, $rootClass = 'nav navbar-nav', $dropDown = false, $rootId = '')
{
$repo = $this->em->getRepository('WebCMS\Entity\Page');
$structs = $repo->findBy(array(
'language' => $this->language,
'parent' => NULL,
));
$str... | php | private function getStructures($direct = true, $rootClass = 'nav navbar-nav', $dropDown = false, $rootId = '')
{
$repo = $this->em->getRepository('WebCMS\Entity\Page');
$structs = $repo->findBy(array(
'language' => $this->language,
'parent' => NULL,
));
$str... | [
"private",
"function",
"getStructures",
"(",
"$",
"direct",
"=",
"true",
",",
"$",
"rootClass",
"=",
"'nav navbar-nav'",
",",
"$",
"dropDown",
"=",
"false",
",",
"$",
"rootId",
"=",
"''",
")",
"{",
"$",
"repo",
"=",
"$",
"this",
"->",
"em",
"->",
"ge... | Load all system structures.
@return type | [
"Load",
"all",
"system",
"structures",
"."
] | b39ea4b2fd30e87ff5e4fa81441cefa308e51fbf | https://github.com/voslartomas/WebCMS2/blob/b39ea4b2fd30e87ff5e4fa81441cefa308e51fbf/FrontendModule/presenters/BasePresenter.php#L435-L450 |
34,517 | voslartomas/WebCMS2 | FrontendModule/presenters/BasePresenter.php | BasePresenter.formatTemplateFiles | public function formatTemplateFiles()
{
$name = $this->getName();
$path = explode(':', $name);
if (isset($path[2])) {
$module = $path[1];
$presenter = $path[2];
} else {
$module = $path[0];
$presenter = $path[1];
}
... | php | public function formatTemplateFiles()
{
$name = $this->getName();
$path = explode(':', $name);
if (isset($path[2])) {
$module = $path[1];
$presenter = $path[2];
} else {
$module = $path[0];
$presenter = $path[1];
}
... | [
"public",
"function",
"formatTemplateFiles",
"(",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"getName",
"(",
")",
";",
"$",
"path",
"=",
"explode",
"(",
"':'",
",",
"$",
"name",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"path",
"[",
"2",
"]",
... | Formats view template file names.
@return array | [
"Formats",
"view",
"template",
"file",
"names",
"."
] | b39ea4b2fd30e87ff5e4fa81441cefa308e51fbf | https://github.com/voslartomas/WebCMS2/blob/b39ea4b2fd30e87ff5e4fa81441cefa308e51fbf/FrontendModule/presenters/BasePresenter.php#L643-L669 |
34,518 | CanalTP/NmmPortalBundle | Services/NavitiaTokenManager.php | NavitiaTokenManager.call | private function call($url, $method = 'GET')
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_NOSIGNAL, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
//Timeout in 5s
curl... | php | private function call($url, $method = 'GET')
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_NOSIGNAL, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
//Timeout in 5s
curl... | [
"private",
"function",
"call",
"(",
"$",
"url",
",",
"$",
"method",
"=",
"'GET'",
")",
"{",
"$",
"ch",
"=",
"curl_init",
"(",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_URL",
",",
"$",
"url",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
"... | Make calls to WS
@param string $url
@param string $method
@return boolean if no result or string if succes
@throws \Exception if navitia call fail | [
"Make",
"calls",
"to",
"WS"
] | b1ad026a33897984206ea1691ad9e25db5854efb | https://github.com/CanalTP/NmmPortalBundle/blob/b1ad026a33897984206ea1691ad9e25db5854efb/Services/NavitiaTokenManager.php#L40-L67 |
34,519 | CanalTP/NmmPortalBundle | Services/NavitiaTokenManager.php | NavitiaTokenManager.getInstancesIdsFromExternalsCoveragesIds | private function getInstancesIdsFromExternalsCoveragesIds(\Traversable $perimeters)
{
$userPerimeterNavitiaIds = array();
$instances = $this->getInstances();
foreach ($perimeters as $perimeter) {
$userPerimeterNavitiaId = array_search($perimeter->getExternalCoverageId(), $instan... | php | private function getInstancesIdsFromExternalsCoveragesIds(\Traversable $perimeters)
{
$userPerimeterNavitiaIds = array();
$instances = $this->getInstances();
foreach ($perimeters as $perimeter) {
$userPerimeterNavitiaId = array_search($perimeter->getExternalCoverageId(), $instan... | [
"private",
"function",
"getInstancesIdsFromExternalsCoveragesIds",
"(",
"\\",
"Traversable",
"$",
"perimeters",
")",
"{",
"$",
"userPerimeterNavitiaIds",
"=",
"array",
"(",
")",
";",
"$",
"instances",
"=",
"$",
"this",
"->",
"getInstances",
"(",
")",
";",
"forea... | From perimeters names, find navitia instances ids for add permissions
@param array $coverages | [
"From",
"perimeters",
"names",
"find",
"navitia",
"instances",
"ids",
"for",
"add",
"permissions"
] | b1ad026a33897984206ea1691ad9e25db5854efb | https://github.com/CanalTP/NmmPortalBundle/blob/b1ad026a33897984206ea1691ad9e25db5854efb/Services/NavitiaTokenManager.php#L211-L225 |
34,520 | CanalTP/NmmPortalBundle | Services/NavitiaTokenManager.php | NavitiaTokenManager.getNavitiaApiAllId | private function getNavitiaApiAllId()
{
$response = $this->call($this->tyrUrl . '/' . $this->version . '/api/');
$apis = json_decode($response);
foreach ($apis as $api) {
if ($api->name == 'ALL') {
return $api;
}
}
} | php | private function getNavitiaApiAllId()
{
$response = $this->call($this->tyrUrl . '/' . $this->version . '/api/');
$apis = json_decode($response);
foreach ($apis as $api) {
if ($api->name == 'ALL') {
return $api;
}
}
} | [
"private",
"function",
"getNavitiaApiAllId",
"(",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"call",
"(",
"$",
"this",
"->",
"tyrUrl",
".",
"'/'",
".",
"$",
"this",
"->",
"version",
".",
"'/api/'",
")",
";",
"$",
"apis",
"=",
"json_decode",
"... | Return meta api 'ALL' id
@return type | [
"Return",
"meta",
"api",
"ALL",
"id"
] | b1ad026a33897984206ea1691ad9e25db5854efb | https://github.com/CanalTP/NmmPortalBundle/blob/b1ad026a33897984206ea1691ad9e25db5854efb/Services/NavitiaTokenManager.php#L232-L242 |
34,521 | CanalTP/NmmPortalBundle | Services/NavitiaTokenManager.php | NavitiaTokenManager.createAuthorization | private function createAuthorization($userId, $instanceId)
{
$apiAll = $this->getNavitiaApiAllId();
$this->call($this->tyrUrl . '/' . $this->version . '/users/' . $userId . '/authorizations/?api_id=' . $apiAll->id . '&instance_id=' . $instanceId, 'POST');
return true;
} | php | private function createAuthorization($userId, $instanceId)
{
$apiAll = $this->getNavitiaApiAllId();
$this->call($this->tyrUrl . '/' . $this->version . '/users/' . $userId . '/authorizations/?api_id=' . $apiAll->id . '&instance_id=' . $instanceId, 'POST');
return true;
} | [
"private",
"function",
"createAuthorization",
"(",
"$",
"userId",
",",
"$",
"instanceId",
")",
"{",
"$",
"apiAll",
"=",
"$",
"this",
"->",
"getNavitiaApiAllId",
"(",
")",
";",
"$",
"this",
"->",
"call",
"(",
"$",
"this",
"->",
"tyrUrl",
".",
"'/'",
"."... | Add permissions to navitia user
@param int $userId
@param int $instanceId
@return boolean | [
"Add",
"permissions",
"to",
"navitia",
"user"
] | b1ad026a33897984206ea1691ad9e25db5854efb | https://github.com/CanalTP/NmmPortalBundle/blob/b1ad026a33897984206ea1691ad9e25db5854efb/Services/NavitiaTokenManager.php#L251-L257 |
34,522 | nails/module-cdn | cdn/controllers/Crop.php | Crop.resize | private function resize(
$filePath,
$phpCropMethod
) {
// Set some PHPThumb options
$_options = [];
$_options['resizeUp'] = true;
$_options['jpegQuality'] = 80;
// --------------------------------------------------------------------------
... | php | private function resize(
$filePath,
$phpCropMethod
) {
// Set some PHPThumb options
$_options = [];
$_options['resizeUp'] = true;
$_options['jpegQuality'] = 80;
// --------------------------------------------------------------------------
... | [
"private",
"function",
"resize",
"(",
"$",
"filePath",
",",
"$",
"phpCropMethod",
")",
"{",
"// Set some PHPThumb options",
"$",
"_options",
"=",
"[",
"]",
";",
"$",
"_options",
"[",
"'resizeUp'",
"]",
"=",
"true",
";",
"$",
"_options",
"[",
"'jpegQuality'"... | Resize a static image
@param string $filePath The file to resize
@param string $phpCropMethod The PHPThumb method to use for resizing
@return void | [
"Resize",
"a",
"static",
"image"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/cdn/controllers/Crop.php#L281-L357 |
34,523 | nails/module-cdn | cdn/controllers/Crop.php | Crop.resizeAnimated | private function resizeAnimated(
$filePath,
$phpCropMethod
) {
$hash = md5(microtime(true) . uniqid()) . uniqid();
$frames = [];
$cacheFiles = [];
$durations = [];
$gfe = new GifFrameExtractor\GifFrameExtractor();
$gc = new Gi... | php | private function resizeAnimated(
$filePath,
$phpCropMethod
) {
$hash = md5(microtime(true) . uniqid()) . uniqid();
$frames = [];
$cacheFiles = [];
$durations = [];
$gfe = new GifFrameExtractor\GifFrameExtractor();
$gc = new Gi... | [
"private",
"function",
"resizeAnimated",
"(",
"$",
"filePath",
",",
"$",
"phpCropMethod",
")",
"{",
"$",
"hash",
"=",
"md5",
"(",
"microtime",
"(",
"true",
")",
".",
"uniqid",
"(",
")",
")",
".",
"uniqid",
"(",
")",
";",
"$",
"frames",
"=",
"[",
"]... | Resize an animated image
@param string $filePath The file to resize
@param string $phpCropMethod The PHPThumb method to use for resizing
@return void | [
"Resize",
"an",
"animated",
"image"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/cdn/controllers/Crop.php#L369-L476 |
34,524 | jon48/webtrees-lib | src/Webtrees/Module/PatronymicLineage/Model/LineageNode.php | LineageNode.addFamily | public function addFamily(Family $fams) {
if($fams && !isset($this->linked_fams[$fams])) {
$this->linked_fams[$fams] = array();
}
} | php | public function addFamily(Family $fams) {
if($fams && !isset($this->linked_fams[$fams])) {
$this->linked_fams[$fams] = array();
}
} | [
"public",
"function",
"addFamily",
"(",
"Family",
"$",
"fams",
")",
"{",
"if",
"(",
"$",
"fams",
"&&",
"!",
"isset",
"(",
"$",
"this",
"->",
"linked_fams",
"[",
"$",
"fams",
"]",
")",
")",
"{",
"$",
"this",
"->",
"linked_fams",
"[",
"$",
"fams",
... | Add a spouse family to the node
@param Fisharebest\Webtrees\Family $fams | [
"Add",
"a",
"spouse",
"family",
"to",
"the",
"node"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/PatronymicLineage/Model/LineageNode.php#L59-L63 |
34,525 | jon48/webtrees-lib | src/Webtrees/Module/PatronymicLineage/Model/LineageNode.php | LineageNode.addChild | public function addChild(Family $fams, LineageNode $child = null) {
if($fams) {
$this->addFamily($fams);
$tmp = $this->linked_fams[$fams];
$tmp[] = $child;
$this->linked_fams[$fams] = $tmp;
}
} | php | public function addChild(Family $fams, LineageNode $child = null) {
if($fams) {
$this->addFamily($fams);
$tmp = $this->linked_fams[$fams];
$tmp[] = $child;
$this->linked_fams[$fams] = $tmp;
}
} | [
"public",
"function",
"addChild",
"(",
"Family",
"$",
"fams",
",",
"LineageNode",
"$",
"child",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"fams",
")",
"{",
"$",
"this",
"->",
"addFamily",
"(",
"$",
"fams",
")",
";",
"$",
"tmp",
"=",
"$",
"this",
"->... | Add a child LineageNode to the node
@param Fisharebest\Webtrees\Family $fams
@param LineageNode $child | [
"Add",
"a",
"child",
"LineageNode",
"to",
"the",
"node"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/PatronymicLineage/Model/LineageNode.php#L71-L78 |
34,526 | GrupaZero/cms | src/Gzero/Cms/ServiceProvider.php | ServiceProvider.registerViewComposers | protected function registerViewComposers()
{
view()->composer(
'gzero-cms::contents._disqus',
function ($view) {
$data = [];
$user = auth()->user();
if ($user && !$user->isGuest()) {
$data = [
... | php | protected function registerViewComposers()
{
view()->composer(
'gzero-cms::contents._disqus',
function ($view) {
$data = [];
$user = auth()->user();
if ($user && !$user->isGuest()) {
$data = [
... | [
"protected",
"function",
"registerViewComposers",
"(",
")",
"{",
"view",
"(",
")",
"->",
"composer",
"(",
"'gzero-cms::contents._disqus'",
",",
"function",
"(",
"$",
"view",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"user",
"=",
"auth",
"(",
")",
... | It registers view composers
@return void | [
"It",
"registers",
"view",
"composers"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/ServiceProvider.php#L183-L205 |
34,527 | GrupaZero/cms | src/Gzero/Cms/ServiceProvider.php | ServiceProvider.registerListeners | protected function registerListeners()
{
Event::listen(RouteMatched::class, BlockLoad::class);
Event::listen(GzeroRouteMatched::class, BlockLoad::class);
Event::listen('block.*', BlockCacheClear::class);
} | php | protected function registerListeners()
{
Event::listen(RouteMatched::class, BlockLoad::class);
Event::listen(GzeroRouteMatched::class, BlockLoad::class);
Event::listen('block.*', BlockCacheClear::class);
} | [
"protected",
"function",
"registerListeners",
"(",
")",
"{",
"Event",
"::",
"listen",
"(",
"RouteMatched",
"::",
"class",
",",
"BlockLoad",
"::",
"class",
")",
";",
"Event",
"::",
"listen",
"(",
"GzeroRouteMatched",
"::",
"class",
",",
"BlockLoad",
"::",
"cl... | It registers event listeners
@return void | [
"It",
"registers",
"event",
"listeners"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/ServiceProvider.php#L270-L275 |
34,528 | voslartomas/WebCMS2 | AdminModule/model/Authenticator.php | Authenticator.authenticate | public function authenticate(array $credentials)
{
list($username, $password) = $credentials;
$user = $this->users->findOneBy(array('username' => $username));
if (!$user) {
throw new NS\AuthenticationException("User not found.", self::IDENTITY_NOT_FOUND);
}
if (... | php | public function authenticate(array $credentials)
{
list($username, $password) = $credentials;
$user = $this->users->findOneBy(array('username' => $username));
if (!$user) {
throw new NS\AuthenticationException("User not found.", self::IDENTITY_NOT_FOUND);
}
if (... | [
"public",
"function",
"authenticate",
"(",
"array",
"$",
"credentials",
")",
"{",
"list",
"(",
"$",
"username",
",",
"$",
"password",
")",
"=",
"$",
"credentials",
";",
"$",
"user",
"=",
"$",
"this",
"->",
"users",
"->",
"findOneBy",
"(",
"array",
"(",... | Performs an authentication
@param array
@return Nette\Security\Identity
@throws Nette\Security\AuthenticationException | [
"Performs",
"an",
"authentication"
] | b39ea4b2fd30e87ff5e4fa81441cefa308e51fbf | https://github.com/voslartomas/WebCMS2/blob/b39ea4b2fd30e87ff5e4fa81441cefa308e51fbf/AdminModule/model/Authenticator.php#L29-L52 |
34,529 | jon48/webtrees-lib | src/Webtrees/Functions/FunctionsPrintLists.php | FunctionsPrintLists.sortableNames | public static function sortableNames(Individual $individual) {
$names = $individual->getAllNames();
$primary = $individual->getPrimaryName();
list($surn, $givn) = explode(',', $names[$primary]['sort']);
$givn = str_replace('@P.N.', 'AAAA', $givn);
$surn = str_replace('@N.N.',... | php | public static function sortableNames(Individual $individual) {
$names = $individual->getAllNames();
$primary = $individual->getPrimaryName();
list($surn, $givn) = explode(',', $names[$primary]['sort']);
$givn = str_replace('@P.N.', 'AAAA', $givn);
$surn = str_replace('@N.N.',... | [
"public",
"static",
"function",
"sortableNames",
"(",
"Individual",
"$",
"individual",
")",
"{",
"$",
"names",
"=",
"$",
"individual",
"->",
"getAllNames",
"(",
")",
";",
"$",
"primary",
"=",
"$",
"individual",
"->",
"getPrimaryName",
"(",
")",
";",
"list"... | Copy of core function, which is not public.
@param Individual $individual
@return string[]
@see \Fisharebest\Webtrees\Functions\FunctionsPrintLists | [
"Copy",
"of",
"core",
"function",
"which",
"is",
"not",
"public",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Functions/FunctionsPrintLists.php#L28-L41 |
34,530 | GrupaZero/cms | src/Gzero/Cms/Jobs/UpdateContent.php | UpdateContent.handleThumb | protected function handleThumb()
{
if ($this->thumbId !== $this->content->thumb_id) {
if ($this->thumbId === null) {
return $this->content->thumb()->dissociate();
}
$thumb = File::find($this->thumbId);
if (empty($thumb)) {
thro... | php | protected function handleThumb()
{
if ($this->thumbId !== $this->content->thumb_id) {
if ($this->thumbId === null) {
return $this->content->thumb()->dissociate();
}
$thumb = File::find($this->thumbId);
if (empty($thumb)) {
thro... | [
"protected",
"function",
"handleThumb",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"thumbId",
"!==",
"$",
"this",
"->",
"content",
"->",
"thumb_id",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"thumbId",
"===",
"null",
")",
"{",
"return",
"$",
"this",
... | It handles thumb relation
@throws InvalidArgumentException
@return \Illuminate\Database\Eloquent\Model | [
"It",
"handles",
"thumb",
"relation"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Jobs/UpdateContent.php#L97-L110 |
34,531 | nails/module-cdn | src/Api/Controller/Manager.php | Manager.getUrl | public function getUrl()
{
if (!userHasPermission('admin:cdn:manager:object:browse')) {
$oHttpCodes = Factory::service('HttpCodes');
throw new ApiException(
'You do not have permission to access this resource',
$oHttpCodes::STATUS_UNAUTHORIZED
... | php | public function getUrl()
{
if (!userHasPermission('admin:cdn:manager:object:browse')) {
$oHttpCodes = Factory::service('HttpCodes');
throw new ApiException(
'You do not have permission to access this resource',
$oHttpCodes::STATUS_UNAUTHORIZED
... | [
"public",
"function",
"getUrl",
"(",
")",
"{",
"if",
"(",
"!",
"userHasPermission",
"(",
"'admin:cdn:manager:object:browse'",
")",
")",
"{",
"$",
"oHttpCodes",
"=",
"Factory",
"::",
"service",
"(",
"'HttpCodes'",
")",
";",
"throw",
"new",
"ApiException",
"(",
... | Returns the URL for a manager
@return array | [
"Returns",
"the",
"URL",
"for",
"a",
"manager"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Api/Controller/Manager.php#L33-L53 |
34,532 | jon48/webtrees-lib | src/Webtrees/Module/Sosa/Model/SosaCalculator.php | SosaCalculator.computeAll | public function computeAll() {
$root_id = $this->tree->getUserPreference($this->user, 'MAJ_SOSA_ROOT_ID');
$indi = Individual::getInstance($root_id, $this->tree);
if($indi){
$this->sosa_provider->deleteAll();
$this->addNode($indi, 1);
$this->flushTmpSo... | php | public function computeAll() {
$root_id = $this->tree->getUserPreference($this->user, 'MAJ_SOSA_ROOT_ID');
$indi = Individual::getInstance($root_id, $this->tree);
if($indi){
$this->sosa_provider->deleteAll();
$this->addNode($indi, 1);
$this->flushTmpSo... | [
"public",
"function",
"computeAll",
"(",
")",
"{",
"$",
"root_id",
"=",
"$",
"this",
"->",
"tree",
"->",
"getUserPreference",
"(",
"$",
"this",
"->",
"user",
",",
"'MAJ_SOSA_ROOT_ID'",
")",
";",
"$",
"indi",
"=",
"Individual",
"::",
"getInstance",
"(",
"... | Compute all Sosa ancestors from the user's root individual.
@return bool Result of the computation | [
"Compute",
"all",
"Sosa",
"ancestors",
"from",
"the",
"user",
"s",
"root",
"individual",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/Sosa/Model/SosaCalculator.php#L68-L78 |
34,533 | jon48/webtrees-lib | src/Webtrees/Module/Sosa/Model/SosaCalculator.php | SosaCalculator.computeFromIndividual | public function computeFromIndividual(Individual $indi) {
$dindi = new \MyArtJaub\Webtrees\Individual($indi);
$current_sosas = $dindi->getSosaNumbers();
foreach($current_sosas as $current_sosa => $gen) {
$this->sosa_provider->deleteAncestors($current_sosa);
$this->addNode... | php | public function computeFromIndividual(Individual $indi) {
$dindi = new \MyArtJaub\Webtrees\Individual($indi);
$current_sosas = $dindi->getSosaNumbers();
foreach($current_sosas as $current_sosa => $gen) {
$this->sosa_provider->deleteAncestors($current_sosa);
$this->addNode... | [
"public",
"function",
"computeFromIndividual",
"(",
"Individual",
"$",
"indi",
")",
"{",
"$",
"dindi",
"=",
"new",
"\\",
"MyArtJaub",
"\\",
"Webtrees",
"\\",
"Individual",
"(",
"$",
"indi",
")",
";",
"$",
"current_sosas",
"=",
"$",
"dindi",
"->",
"getSosaN... | Compute all Sosa Ancestors from a specified Individual
@param Individual $indi
@return bool Result of the computation | [
"Compute",
"all",
"Sosa",
"Ancestors",
"from",
"a",
"specified",
"Individual"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/Sosa/Model/SosaCalculator.php#L85-L94 |
34,534 | jon48/webtrees-lib | src/Webtrees/Module/Sosa/Model/SosaCalculator.php | SosaCalculator.addNode | protected function addNode(Individual $indi, $sosa) {
$birth_year = $indi->getEstimatedBirthDate()->gregorianYear();
$death_year = $indi->getEstimatedDeathDate()->gregorianYear();
$this->tmp_sosa_table[] = array(
'indi' => $indi->getXref(),
'sosa... | php | protected function addNode(Individual $indi, $sosa) {
$birth_year = $indi->getEstimatedBirthDate()->gregorianYear();
$death_year = $indi->getEstimatedDeathDate()->gregorianYear();
$this->tmp_sosa_table[] = array(
'indi' => $indi->getXref(),
'sosa... | [
"protected",
"function",
"addNode",
"(",
"Individual",
"$",
"indi",
",",
"$",
"sosa",
")",
"{",
"$",
"birth_year",
"=",
"$",
"indi",
"->",
"getEstimatedBirthDate",
"(",
")",
"->",
"gregorianYear",
"(",
")",
";",
"$",
"death_year",
"=",
"$",
"indi",
"->",... | Recursive method to add individual to the Sosa table, and flush it regularly
@param Individual $indi Individual to add
@param int $sosa Individual's sosa | [
"Recursive",
"method",
"to",
"add",
"individual",
"to",
"the",
"Sosa",
"table",
"and",
"flush",
"it",
"regularly"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/Sosa/Model/SosaCalculator.php#L101-L118 |
34,535 | jon48/webtrees-lib | src/Webtrees/Module/Sosa/Model/SosaCalculator.php | SosaCalculator.flushTmpSosaTable | protected function flushTmpSosaTable($force = false) {
if( count($this->tmp_sosa_table)> 0 &&
($force || count($this->tmp_sosa_table) >= self::TMP_SOSA_TABLE_LIMIT)){
$this->sosa_provider->insertOrUpdate($this->tmp_sosa_table);
$this->tmp_sosa_table = ar... | php | protected function flushTmpSosaTable($force = false) {
if( count($this->tmp_sosa_table)> 0 &&
($force || count($this->tmp_sosa_table) >= self::TMP_SOSA_TABLE_LIMIT)){
$this->sosa_provider->insertOrUpdate($this->tmp_sosa_table);
$this->tmp_sosa_table = ar... | [
"protected",
"function",
"flushTmpSosaTable",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"tmp_sosa_table",
")",
">",
"0",
"&&",
"(",
"$",
"force",
"||",
"count",
"(",
"$",
"this",
"->",
"tmp_sosa_table",
")",... | Write sosas in the table, if the number of items is superior to the limit, or if forced.
@param bool $force Should the flush be forced | [
"Write",
"sosas",
"in",
"the",
"table",
"if",
"the",
"number",
"of",
"items",
"is",
"superior",
"to",
"the",
"limit",
"or",
"if",
"forced",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/Sosa/Model/SosaCalculator.php#L125-L131 |
34,536 | c4studio/chronos | src/Chronos/Content/app/Console/Kernel.php | Kernel.schedule | protected function schedule(Schedule $schedule)
{
parent::schedule($schedule);
// Activate scheduled posts
$schedule->call(function() {
$content = Content::where('status_scheduled', '<=', Carbon::now())->get();
foreach ($content as $item) {
$item->st... | php | protected function schedule(Schedule $schedule)
{
parent::schedule($schedule);
// Activate scheduled posts
$schedule->call(function() {
$content = Content::where('status_scheduled', '<=', Carbon::now())->get();
foreach ($content as $item) {
$item->st... | [
"protected",
"function",
"schedule",
"(",
"Schedule",
"$",
"schedule",
")",
"{",
"parent",
"::",
"schedule",
"(",
"$",
"schedule",
")",
";",
"// Activate scheduled posts",
"$",
"schedule",
"->",
"call",
"(",
"function",
"(",
")",
"{",
"$",
"content",
"=",
... | Define the package's command schedule.
@param \Illuminate\Console\Scheduling\Schedule $schedule
@return void | [
"Define",
"the",
"package",
"s",
"command",
"schedule",
"."
] | df7f3a9794afaade3bee8f6be1223c98e4936cb2 | https://github.com/c4studio/chronos/blob/df7f3a9794afaade3bee8f6be1223c98e4936cb2/src/Chronos/Content/app/Console/Kernel.php#L18-L32 |
34,537 | jon48/webtrees-lib | src/Webtrees/Module/AdminTasks/Model/TaskProvider.php | TaskProvider.loadTask | protected function loadTask($task_name) {
try {
if (file_exists($this->root_path . $task_name .'.php')) {
$task = include $this->root_path . $task_name .'.php';
if($task instanceof AbstractTask) {
$task->setProvider($this);
return $task;
}
}
}
catch(\Exception $ex) { }
return n... | php | protected function loadTask($task_name) {
try {
if (file_exists($this->root_path . $task_name .'.php')) {
$task = include $this->root_path . $task_name .'.php';
if($task instanceof AbstractTask) {
$task->setProvider($this);
return $task;
}
}
}
catch(\Exception $ex) { }
return n... | [
"protected",
"function",
"loadTask",
"(",
"$",
"task_name",
")",
"{",
"try",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"this",
"->",
"root_path",
".",
"$",
"task_name",
".",
"'.php'",
")",
")",
"{",
"$",
"task",
"=",
"include",
"$",
"this",
"->",
"roo... | Load a task object from a file.
@param string $task_name Name of the task to load. | [
"Load",
"a",
"task",
"object",
"from",
"a",
"file",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Module/AdminTasks/Model/TaskProvider.php#L43-L56 |
34,538 | Rareloop/primer-core | src/Primer/Renderable/RenderList.php | RenderList.add | public function add($pattern)
{
if (is_array($pattern)) {
$this->items += $pattern;
} else {
$this->items[] = $pattern;
}
} | php | public function add($pattern)
{
if (is_array($pattern)) {
$this->items += $pattern;
} else {
$this->items[] = $pattern;
}
} | [
"public",
"function",
"add",
"(",
"$",
"pattern",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"pattern",
")",
")",
"{",
"$",
"this",
"->",
"items",
"+=",
"$",
"pattern",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"items",
"[",
"]",
"=",
"$",
"pat... | Add items to the list of items to render
@param [Pattern|Group] $pattern | [
"Add",
"items",
"to",
"the",
"list",
"of",
"items",
"to",
"render"
] | fe098d6794a4add368f97672397dc93d223a1786 | https://github.com/Rareloop/primer-core/blob/fe098d6794a4add368f97672397dc93d223a1786/src/Primer/Renderable/RenderList.php#L30-L37 |
34,539 | Rareloop/primer-core | src/Primer/Renderable/RenderList.php | RenderList.render | public function render($showChrome = true)
{
$html = "";
foreach ($this->items as $item) {
$html .= $item->render($showChrome);
}
return $html;
} | php | public function render($showChrome = true)
{
$html = "";
foreach ($this->items as $item) {
$html .= $item->render($showChrome);
}
return $html;
} | [
"public",
"function",
"render",
"(",
"$",
"showChrome",
"=",
"true",
")",
"{",
"$",
"html",
"=",
"\"\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as",
"$",
"item",
")",
"{",
"$",
"html",
".=",
"$",
"item",
"->",
"render",
"(",
"$",
"show... | Render the list of items
@param boolean $showChrome [description]
@return [type] [description] | [
"Render",
"the",
"list",
"of",
"items"
] | fe098d6794a4add368f97672397dc93d223a1786 | https://github.com/Rareloop/primer-core/blob/fe098d6794a4add368f97672397dc93d223a1786/src/Primer/Renderable/RenderList.php#L45-L54 |
34,540 | jon48/webtrees-lib | src/Webtrees/GedcomRecord.php | GedcomRecord.formatFirstMajorFact | public function formatFirstMajorFact($facts, $style) {
foreach ($this->gedcomrecord->getFacts($facts) as $fact) {
// Only display if it has a date or place (or both)
if (($fact->getDate() || $fact->getPlace()) && $fact->canShow()) {
switch ($style) {
case 10:
return '<i>'.$fact->getLabel().' '... | php | public function formatFirstMajorFact($facts, $style) {
foreach ($this->gedcomrecord->getFacts($facts) as $fact) {
// Only display if it has a date or place (or both)
if (($fact->getDate() || $fact->getPlace()) && $fact->canShow()) {
switch ($style) {
case 10:
return '<i>'.$fact->getLabel().' '... | [
"public",
"function",
"formatFirstMajorFact",
"(",
"$",
"facts",
",",
"$",
"style",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"gedcomrecord",
"->",
"getFacts",
"(",
"$",
"facts",
")",
"as",
"$",
"fact",
")",
"{",
"// Only display if it has a date or place (... | Add additional options to the core formatFirstMajorFact function.
If no option is suitable, it will try returning the core function.
Option 10 : display <i>factLabel shortFactDate shortFactPlace</i>
@uses \MyArtJaub\Webtrees\Functions\FunctionsPrint
@param string $facts List of facts to find information from
@param i... | [
"Add",
"additional",
"options",
"to",
"the",
"core",
"formatFirstMajorFact",
"function",
".",
"If",
"no",
"option",
"is",
"suitable",
"it",
"will",
"try",
"returning",
"the",
"core",
"function",
"."
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/GedcomRecord.php#L67-L80 |
34,541 | jon48/webtrees-lib | src/Webtrees/GedcomRecord.php | GedcomRecord.canDisplayIsSourced | public function canDisplayIsSourced($access_level = null){
if(!$this->gedcomrecord->canShow($access_level)) return false;
if($access_level === null )
$access_level = \Fisharebest\Webtrees\Auth::accessLevel($this->gedcomrecord->getTree());
$global_facts = Globals::getGlobalFacts();
if (isset($global_facts... | php | public function canDisplayIsSourced($access_level = null){
if(!$this->gedcomrecord->canShow($access_level)) return false;
if($access_level === null )
$access_level = \Fisharebest\Webtrees\Auth::accessLevel($this->gedcomrecord->getTree());
$global_facts = Globals::getGlobalFacts();
if (isset($global_facts... | [
"public",
"function",
"canDisplayIsSourced",
"(",
"$",
"access_level",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"gedcomrecord",
"->",
"canShow",
"(",
"$",
"access_level",
")",
")",
"return",
"false",
";",
"if",
"(",
"$",
"access_level",
... | Check if the IsSourced information can be displayed
@param int $access_level
@return boolean | [
"Check",
"if",
"the",
"IsSourced",
"information",
"can",
"be",
"displayed"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/GedcomRecord.php#L88-L99 |
34,542 | jon48/webtrees-lib | src/Webtrees/GedcomRecord.php | GedcomRecord.isFactSourced | public function isFactSourced($eventslist){
if(empty($eventslist)) return 0;
$isSourced=0;
$facts = $this->gedcomrecord->getFacts($eventslist);
foreach($facts as $fact){
if($isSourced < Fact::MAX_IS_SOURCED_LEVEL){
$dfact = new Fact($fact);
$tmpIsSourced = $dfact->isSourced();
if($tmpIsSourced... | php | public function isFactSourced($eventslist){
if(empty($eventslist)) return 0;
$isSourced=0;
$facts = $this->gedcomrecord->getFacts($eventslist);
foreach($facts as $fact){
if($isSourced < Fact::MAX_IS_SOURCED_LEVEL){
$dfact = new Fact($fact);
$tmpIsSourced = $dfact->isSourced();
if($tmpIsSourced... | [
"public",
"function",
"isFactSourced",
"(",
"$",
"eventslist",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"eventslist",
")",
")",
"return",
"0",
";",
"$",
"isSourced",
"=",
"0",
";",
"$",
"facts",
"=",
"$",
"this",
"->",
"gedcomrecord",
"->",
"getFacts",
... | Check is an event associated to this record is sourced
@param string $eventslist
@return int Level of sources | [
"Check",
"is",
"an",
"event",
"associated",
"to",
"this",
"record",
"is",
"sourced"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/GedcomRecord.php#L129-L148 |
34,543 | CanalTP/NmmPortalBundle | Services/Navitia.php | Navitia.setToken | public function setToken($token)
{
$config = $this->navitia_component->getConfiguration();
$config['token'] = $token;
$this->navitia_component->setConfiguration($config);
} | php | public function setToken($token)
{
$config = $this->navitia_component->getConfiguration();
$config['token'] = $token;
$this->navitia_component->setConfiguration($config);
} | [
"public",
"function",
"setToken",
"(",
"$",
"token",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"navitia_component",
"->",
"getConfiguration",
"(",
")",
";",
"$",
"config",
"[",
"'token'",
"]",
"=",
"$",
"token",
";",
"$",
"this",
"->",
"navitia_... | Set token.
@param string $token | [
"Set",
"token",
"."
] | b1ad026a33897984206ea1691ad9e25db5854efb | https://github.com/CanalTP/NmmPortalBundle/blob/b1ad026a33897984206ea1691ad9e25db5854efb/Services/Navitia.php#L19-L24 |
34,544 | CanalTP/NmmPortalBundle | Services/Navitia.php | Navitia.getStopPoints | public function getStopPoints($coverageId, $networkId, $lineId, $routeId)
{
$pathFilter = 'networks/'.$networkId.'/lines/'.$lineId.'/routes/'.$routeId;
$query = array(
'api' => 'coverage',
'parameters' => array(
'region' => $coverageId,
'actio... | php | public function getStopPoints($coverageId, $networkId, $lineId, $routeId)
{
$pathFilter = 'networks/'.$networkId.'/lines/'.$lineId.'/routes/'.$routeId;
$query = array(
'api' => 'coverage',
'parameters' => array(
'region' => $coverageId,
'actio... | [
"public",
"function",
"getStopPoints",
"(",
"$",
"coverageId",
",",
"$",
"networkId",
",",
"$",
"lineId",
",",
"$",
"routeId",
")",
"{",
"$",
"pathFilter",
"=",
"'networks/'",
".",
"$",
"networkId",
".",
"'/lines/'",
".",
"$",
"lineId",
".",
"'/routes/'",
... | Retourne les stop points.
@param string $coverageId
@param string $networkId
@param string $lineId
@param string $routeId
@return array | [
"Retourne",
"les",
"stop",
"points",
"."
] | b1ad026a33897984206ea1691ad9e25db5854efb | https://github.com/CanalTP/NmmPortalBundle/blob/b1ad026a33897984206ea1691ad9e25db5854efb/Services/Navitia.php#L161-L176 |
34,545 | CanalTP/NmmPortalBundle | Services/Navitia.php | Navitia.getRoute | public function getRoute($coverageId, $routeId, $depth = 1)
{
$query = array(
'api' => 'coverage',
'parameters' => array(
'region' => $coverageId,
'path_filter' => 'routes/'.$routeId,
'parameters' => '?depth='.$depth
)... | php | public function getRoute($coverageId, $routeId, $depth = 1)
{
$query = array(
'api' => 'coverage',
'parameters' => array(
'region' => $coverageId,
'path_filter' => 'routes/'.$routeId,
'parameters' => '?depth='.$depth
)... | [
"public",
"function",
"getRoute",
"(",
"$",
"coverageId",
",",
"$",
"routeId",
",",
"$",
"depth",
"=",
"1",
")",
"{",
"$",
"query",
"=",
"array",
"(",
"'api'",
"=>",
"'coverage'",
",",
"'parameters'",
"=>",
"array",
"(",
"'region'",
"=>",
"$",
"coverag... | Returns Basic Route data with corresponding line data.
@param string $coverageId
@param string $routeId
@param int $depth
@return stdClass | [
"Returns",
"Basic",
"Route",
"data",
"with",
"corresponding",
"line",
"data",
"."
] | b1ad026a33897984206ea1691ad9e25db5854efb | https://github.com/CanalTP/NmmPortalBundle/blob/b1ad026a33897984206ea1691ad9e25db5854efb/Services/Navitia.php#L234-L246 |
34,546 | GrupaZero/cms | src/Gzero/Cms/Models/Content.php | Content.getPath | public function getPath($languageCode)
{
$route = $this->routes()->newQuery()
->where('language_code', $languageCode)
->first();
if (empty($route->path)) {
throw new DomainException("There is no route in '$languageCode' language for content: $this->id");
}... | php | public function getPath($languageCode)
{
$route = $this->routes()->newQuery()
->where('language_code', $languageCode)
->first();
if (empty($route->path)) {
throw new DomainException("There is no route in '$languageCode' language for content: $this->id");
}... | [
"public",
"function",
"getPath",
"(",
"$",
"languageCode",
")",
"{",
"$",
"route",
"=",
"$",
"this",
"->",
"routes",
"(",
")",
"->",
"newQuery",
"(",
")",
"->",
"where",
"(",
"'language_code'",
",",
"$",
"languageCode",
")",
"->",
"first",
"(",
")",
... | Get Content url in specified language.
@param string $languageCode Lang code
@throws DomainException
@return string | [
"Get",
"Content",
"url",
"in",
"specified",
"language",
"."
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Models/Content.php#L174-L183 |
34,547 | GrupaZero/cms | src/Gzero/Cms/Models/Content.php | Content.canBeShown | public function canBeShown()
{
if ($this->published_at === null) {
return false;
}
return Carbon::parse($this->published_at)->lte(Carbon::now());
} | php | public function canBeShown()
{
if ($this->published_at === null) {
return false;
}
return Carbon::parse($this->published_at)->lte(Carbon::now());
} | [
"public",
"function",
"canBeShown",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"published_at",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"Carbon",
"::",
"parse",
"(",
"$",
"this",
"->",
"published_at",
")",
"->",
"lte",
"(",
"... | Return true if content can be shown on frontend
@TODO What about active url?
@return bool | [
"Return",
"true",
"if",
"content",
"can",
"be",
"shown",
"on",
"frontend"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Models/Content.php#L216-L223 |
34,548 | GrupaZero/cms | src/Gzero/Cms/Models/Content.php | Content.findDescendantsWithTrashed | public function findDescendantsWithTrashed()
{
return static::withTrashed()->where($this->getTreeColumn('path'), 'LIKE', $this->{$this->getTreeColumn('path')} . '%')
->orderBy($this->getTreeColumn('level'), 'ASC');
} | php | public function findDescendantsWithTrashed()
{
return static::withTrashed()->where($this->getTreeColumn('path'), 'LIKE', $this->{$this->getTreeColumn('path')} . '%')
->orderBy($this->getTreeColumn('level'), 'ASC');
} | [
"public",
"function",
"findDescendantsWithTrashed",
"(",
")",
"{",
"return",
"static",
"::",
"withTrashed",
"(",
")",
"->",
"where",
"(",
"$",
"this",
"->",
"getTreeColumn",
"(",
"'path'",
")",
",",
"'LIKE'",
",",
"$",
"this",
"->",
"{",
"$",
"this",
"->... | Find all trashed descendants for specific node with this node as root
@return \Illuminate\Database\Eloquent\Builder | [
"Find",
"all",
"trashed",
"descendants",
"for",
"specific",
"node",
"with",
"this",
"node",
"as",
"root"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Models/Content.php#L242-L246 |
34,549 | GrupaZero/cms | src/Gzero/Cms/Models/Content.php | Content.handle | public function handle(Language $language): Response
{
// We need to unify response with repository format
$this->load(ContentReadRepository::$loadRelations);
return $this->getHandler()->handle($this, $language);
} | php | public function handle(Language $language): Response
{
// We need to unify response with repository format
$this->load(ContentReadRepository::$loadRelations);
return $this->getHandler()->handle($this, $language);
} | [
"public",
"function",
"handle",
"(",
"Language",
"$",
"language",
")",
":",
"Response",
"{",
"// We need to unify response with repository format",
"$",
"this",
"->",
"load",
"(",
"ContentReadRepository",
"::",
"$",
"loadRelations",
")",
";",
"return",
"$",
"this",
... | Handle content rendering by type
@param Language $language Language
@return Response | [
"Handle",
"content",
"rendering",
"by",
"type"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Models/Content.php#L255-L260 |
34,550 | GrupaZero/cms | src/Gzero/Cms/Models/Content.php | Content.createRoute | public function createRoute(ContentTranslation $translation, bool $isActive = false)
{
$path = Route::buildUniquePath($this->getSlug($translation), $translation->language_code);
$route = Route::firstOrNew(
[
'language_code' => $translation->language_code,
... | php | public function createRoute(ContentTranslation $translation, bool $isActive = false)
{
$path = Route::buildUniquePath($this->getSlug($translation), $translation->language_code);
$route = Route::firstOrNew(
[
'language_code' => $translation->language_code,
... | [
"public",
"function",
"createRoute",
"(",
"ContentTranslation",
"$",
"translation",
",",
"bool",
"$",
"isActive",
"=",
"false",
")",
"{",
"$",
"path",
"=",
"Route",
"::",
"buildUniquePath",
"(",
"$",
"this",
"->",
"getSlug",
"(",
"$",
"translation",
")",
"... | Creates route with unique path based on content translation title, and tree hierarchy
@param ContentTranslation $translation Translation
@param bool $isActive Is active trigger
@return $this | [
"Creates",
"route",
"with",
"unique",
"path",
"based",
"on",
"content",
"translation",
"title",
"and",
"tree",
"hierarchy"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Models/Content.php#L280-L295 |
34,551 | GrupaZero/cms | src/Gzero/Cms/Models/Content.php | Content.disableActiveTranslations | public function disableActiveTranslations($languageCode)
{
return $this->translations()
->where('content_id', $this->id)
->where('language_code', $languageCode)
->update(['is_active' => false]);
} | php | public function disableActiveTranslations($languageCode)
{
return $this->translations()
->where('content_id', $this->id)
->where('language_code', $languageCode)
->update(['is_active' => false]);
} | [
"public",
"function",
"disableActiveTranslations",
"(",
"$",
"languageCode",
")",
"{",
"return",
"$",
"this",
"->",
"translations",
"(",
")",
"->",
"where",
"(",
"'content_id'",
",",
"$",
"this",
"->",
"id",
")",
"->",
"where",
"(",
"'language_code'",
",",
... | Function sets all content translations in provided language code as inactive
@param string $languageCode language code
@return mixed | [
"Function",
"sets",
"all",
"content",
"translations",
"in",
"provided",
"language",
"code",
"as",
"inactive"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Models/Content.php#L304-L310 |
34,552 | GrupaZero/cms | src/Gzero/Cms/Models/Content.php | Content.getSlug | protected function getSlug(ContentTranslation $translation)
{
$path = str_slug($translation->title);
if ($this->parent_id) {
$path = $this->parent->getPath($translation->language_code) . '/' . $path;
}
return $path;
} | php | protected function getSlug(ContentTranslation $translation)
{
$path = str_slug($translation->title);
if ($this->parent_id) {
$path = $this->parent->getPath($translation->language_code) . '/' . $path;
}
return $path;
} | [
"protected",
"function",
"getSlug",
"(",
"ContentTranslation",
"$",
"translation",
")",
"{",
"$",
"path",
"=",
"str_slug",
"(",
"$",
"translation",
"->",
"title",
")",
";",
"if",
"(",
"$",
"this",
"->",
"parent_id",
")",
"{",
"$",
"path",
"=",
"$",
"th... | Returns content slug from translation title with parent slug
@param ContentTranslation $translation Content translation
@return string an unique route path address in specified language | [
"Returns",
"content",
"slug",
"from",
"translation",
"title",
"with",
"parent",
"slug"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Models/Content.php#L337-L346 |
34,553 | GrupaZero/cms | src/Gzero/Cms/Models/Content.php | Content.getHandler | protected function getHandler()
{
$handler = resolve($this->type->handler);
if (!$handler instanceof ContentTypeHandler) {
throw new DomainException("Type: $this->type can't be handled");
}
return $handler;
} | php | protected function getHandler()
{
$handler = resolve($this->type->handler);
if (!$handler instanceof ContentTypeHandler) {
throw new DomainException("Type: $this->type can't be handled");
}
return $handler;
} | [
"protected",
"function",
"getHandler",
"(",
")",
"{",
"$",
"handler",
"=",
"resolve",
"(",
"$",
"this",
"->",
"type",
"->",
"handler",
")",
";",
"if",
"(",
"!",
"$",
"handler",
"instanceof",
"ContentTypeHandler",
")",
"{",
"throw",
"new",
"DomainException"... | Dynamically resolve content handler
@throws DomainException
@return ContentTypeHandler | [
"Dynamically",
"resolve",
"content",
"handler"
] | a7956966d2edec54fc99ebb61eeb2f01704aa2c2 | https://github.com/GrupaZero/cms/blob/a7956966d2edec54fc99ebb61eeb2f01704aa2c2/src/Gzero/Cms/Models/Content.php#L355-L362 |
34,554 | nails/module-cdn | cdn/controllers/Placeholder.php | Placeholder.index | public function index()
{
/**
* Check the request headers; avoid hitting the disk at all if possible.
* If the Etag matches then send a Not-Modified header and terminate
* execution.
*/
if ($this->serveNotModified($this->cdnCacheFile)) {
return;
... | php | public function index()
{
/**
* Check the request headers; avoid hitting the disk at all if possible.
* If the Etag matches then send a Not-Modified header and terminate
* execution.
*/
if ($this->serveNotModified($this->cdnCacheFile)) {
return;
... | [
"public",
"function",
"index",
"(",
")",
"{",
"/**\n * Check the request headers; avoid hitting the disk at all if possible.\n * If the Etag matches then send a Not-Modified header and terminate\n * execution.\n */",
"if",
"(",
"$",
"this",
"->",
"serveNotModi... | Render a placeholder
@return void | [
"Render",
"a",
"placeholder"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/cdn/controllers/Placeholder.php#L97-L194 |
34,555 | c4studio/chronos | src/Chronos/Content/app/Models/Content.php | Content.__isset | public function __isset($key)
{
if (isset($this->custom_attributes[$key]))
return true;
return ! is_null($this->getAttribute($key));
} | php | public function __isset($key)
{
if (isset($this->custom_attributes[$key]))
return true;
return ! is_null($this->getAttribute($key));
} | [
"public",
"function",
"__isset",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"custom_attributes",
"[",
"$",
"key",
"]",
")",
")",
"return",
"true",
";",
"return",
"!",
"is_null",
"(",
"$",
"this",
"->",
"getAttribute",
"(",... | Determine if a dynamic attribute or relation exists on the model.
@param string $key
@return bool | [
"Determine",
"if",
"a",
"dynamic",
"attribute",
"or",
"relation",
"exists",
"on",
"the",
"model",
"."
] | df7f3a9794afaade3bee8f6be1223c98e4936cb2 | https://github.com/c4studio/chronos/blob/df7f3a9794afaade3bee8f6be1223c98e4936cb2/src/Chronos/Content/app/Models/Content.php#L73-L79 |
34,556 | c4studio/chronos | src/Chronos/Content/app/Models/Content.php | Content.getAllFieldsetsAttribute | public function getAllFieldsetsAttribute()
{
$fieldsets = [];
$all_fieldsets = [];
if ($this->type->fieldsets)
$all_fieldsets = $this->type->fieldsets;
if ($this->fieldsets)
$all_fieldsets = $all_fieldsets->merge($this->fieldsets);
if ($all_fieldsets... | php | public function getAllFieldsetsAttribute()
{
$fieldsets = [];
$all_fieldsets = [];
if ($this->type->fieldsets)
$all_fieldsets = $this->type->fieldsets;
if ($this->fieldsets)
$all_fieldsets = $all_fieldsets->merge($this->fieldsets);
if ($all_fieldsets... | [
"public",
"function",
"getAllFieldsetsAttribute",
"(",
")",
"{",
"$",
"fieldsets",
"=",
"[",
"]",
";",
"$",
"all_fieldsets",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"type",
"->",
"fieldsets",
")",
"$",
"all_fieldsets",
"=",
"$",
"this",
"->",... | Add fieldsets to model.
This is where the magic happens. Basically this function iterates over each fieldset and field,
and if there is a value saved it adds it to the field's JSON object. If there are multiple values, repetitions
are added, which can be read on the frontend. | [
"Add",
"fieldsets",
"to",
"model",
"."
] | df7f3a9794afaade3bee8f6be1223c98e4936cb2 | https://github.com/c4studio/chronos/blob/df7f3a9794afaade3bee8f6be1223c98e4936cb2/src/Chronos/Content/app/Models/Content.php#L178-L224 |
34,557 | c4studio/chronos | src/Chronos/Content/app/Models/Content.php | Content.getEndpointsAttribute | public function getEndpointsAttribute()
{
$id = $this->attributes['id'];
$type = $this->attributes['type_id'];
$endpoints['index'] = route('api.content', ['type' => $type]);
$endpoints['destroy'] = route('api.content.destroy', ['type' => $type, 'content' => $id]);
if (settin... | php | public function getEndpointsAttribute()
{
$id = $this->attributes['id'];
$type = $this->attributes['type_id'];
$endpoints['index'] = route('api.content', ['type' => $type]);
$endpoints['destroy'] = route('api.content.destroy', ['type' => $type, 'content' => $id]);
if (settin... | [
"public",
"function",
"getEndpointsAttribute",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"attributes",
"[",
"'id'",
"]",
";",
"$",
"type",
"=",
"$",
"this",
"->",
"attributes",
"[",
"'type_id'",
"]",
";",
"$",
"endpoints",
"[",
"'index'",
"]",
... | Add endpoints to model. | [
"Add",
"endpoints",
"to",
"model",
"."
] | df7f3a9794afaade3bee8f6be1223c98e4936cb2 | https://github.com/c4studio/chronos/blob/df7f3a9794afaade3bee8f6be1223c98e4936cb2/src/Chronos/Content/app/Models/Content.php#L229-L240 |
34,558 | c4studio/chronos | src/Chronos/Content/app/Models/Content.php | Content.getPathAttribute | public function getPathAttribute()
{
// add type
$path = $this->type->path;
// add parents
$crumbs = $this->crumbs;
$crumbs_path = '';
while ($crumbs) {
$crumbs_path = '/' . $crumbs->slug . $crumbs_path;
$crumbs = $crumbs->crumbs;
}
... | php | public function getPathAttribute()
{
// add type
$path = $this->type->path;
// add parents
$crumbs = $this->crumbs;
$crumbs_path = '';
while ($crumbs) {
$crumbs_path = '/' . $crumbs->slug . $crumbs_path;
$crumbs = $crumbs->crumbs;
}
... | [
"public",
"function",
"getPathAttribute",
"(",
")",
"{",
"// add type",
"$",
"path",
"=",
"$",
"this",
"->",
"type",
"->",
"path",
";",
"// add parents",
"$",
"crumbs",
"=",
"$",
"this",
"->",
"crumbs",
";",
"$",
"crumbs_path",
"=",
"''",
";",
"while",
... | Get path for item. | [
"Get",
"path",
"for",
"item",
"."
] | df7f3a9794afaade3bee8f6be1223c98e4936cb2 | https://github.com/c4studio/chronos/blob/df7f3a9794afaade3bee8f6be1223c98e4936cb2/src/Chronos/Content/app/Models/Content.php#L253-L271 |
34,559 | c4studio/chronos | src/Chronos/Content/app/Models/Content.php | Content.setTitleAttribute | public function setTitleAttribute($value) {
$this->attributes['title'] = $value;
if (!$this->slug) {
$slug = str_transliterate($value);
$slugCount = self::whereRaw('slug REGEXP "^' . $slug . '(-[0-9]*)?$"')->count();
if ($slugCount > 0)
$slug = $slug ... | php | public function setTitleAttribute($value) {
$this->attributes['title'] = $value;
if (!$this->slug) {
$slug = str_transliterate($value);
$slugCount = self::whereRaw('slug REGEXP "^' . $slug . '(-[0-9]*)?$"')->count();
if ($slugCount > 0)
$slug = $slug ... | [
"public",
"function",
"setTitleAttribute",
"(",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"attributes",
"[",
"'title'",
"]",
"=",
"$",
"value",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"slug",
")",
"{",
"$",
"slug",
"=",
"str_transliterate",
"(",
"$"... | Set slug by transliterating.
@param $value | [
"Set",
"slug",
"by",
"transliterating",
"."
] | df7f3a9794afaade3bee8f6be1223c98e4936cb2 | https://github.com/c4studio/chronos/blob/df7f3a9794afaade3bee8f6be1223c98e4936cb2/src/Chronos/Content/app/Models/Content.php#L307-L318 |
34,560 | pckg/database | src/Pckg/Database/Entity.php | Entity.cache | public function cache($time, $type = 'app', $key = null)
{
return new Cached($this, $time, $type, $key);
} | php | public function cache($time, $type = 'app', $key = null)
{
return new Cached($this, $time, $type, $key);
} | [
"public",
"function",
"cache",
"(",
"$",
"time",
",",
"$",
"type",
"=",
"'app'",
",",
"$",
"key",
"=",
"null",
")",
"{",
"return",
"new",
"Cached",
"(",
"$",
"this",
",",
"$",
"time",
",",
"$",
"type",
",",
"$",
"key",
")",
";",
"}"
] | Wraps entity into proxy instance which takes care of handling cached requests.
@param $time
@param string $type
@return Cached|Entity | [
"Wraps",
"entity",
"into",
"proxy",
"instance",
"which",
"takes",
"care",
"of",
"handling",
"cached",
"requests",
"."
] | 99b26b4cb2bacc2bbbb83b7341a209c1cf0100d3 | https://github.com/pckg/database/blob/99b26b4cb2bacc2bbbb83b7341a209c1cf0100d3/src/Pckg/Database/Entity.php#L526-L529 |
34,561 | CESNET/perun-simplesamlphp-module | lib/Auth/Process/PerunGroups.php | PerunGroups.mapGroupName | protected function mapGroupName($request, $groupName)
{
if (isset($request["SPMetadata"]["groupMapping"]) &&
isset($request["SPMetadata"]["groupMapping"][$groupName])) {
Logger::debug(
"Mapping $groupName to " . $request["SPMetadata"]["groupMapping"][$groupName] .
... | php | protected function mapGroupName($request, $groupName)
{
if (isset($request["SPMetadata"]["groupMapping"]) &&
isset($request["SPMetadata"]["groupMapping"][$groupName])) {
Logger::debug(
"Mapping $groupName to " . $request["SPMetadata"]["groupMapping"][$groupName] .
... | [
"protected",
"function",
"mapGroupName",
"(",
"$",
"request",
",",
"$",
"groupName",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"request",
"[",
"\"SPMetadata\"",
"]",
"[",
"\"groupMapping\"",
"]",
")",
"&&",
"isset",
"(",
"$",
"request",
"[",
"\"SPMetadata\""... | This method translates given name of group based on associative array 'groupMapping' in SP metadata.
@param $request
@param string $groupName
@return string translated group name | [
"This",
"method",
"translates",
"given",
"name",
"of",
"group",
"based",
"on",
"associative",
"array",
"groupMapping",
"in",
"SP",
"metadata",
"."
] | f1d686f06472053a7cdb31f2b2776f9714779ee1 | https://github.com/CESNET/perun-simplesamlphp-module/blob/f1d686f06472053a7cdb31f2b2776f9714779ee1/lib/Auth/Process/PerunGroups.php#L113-L135 |
34,562 | jon48/webtrees-lib | src/Webtrees/Controller/IndividualController.php | IndividualController.printHeaderExtensions | public function printHeaderExtensions(){
$hook_extend_indi_header_left = new mw\Hook\Hook('hExtendIndiHeaderLeft');
$hook_extend_indi_header_right = new mw\Hook\Hook('hExtendIndiHeaderRight');
$hook_extend_indi_header_left = $hook_extend_indi_header_left->execute($this->ctrl_individual);
$hook_extend_indi_heade... | php | public function printHeaderExtensions(){
$hook_extend_indi_header_left = new mw\Hook\Hook('hExtendIndiHeaderLeft');
$hook_extend_indi_header_right = new mw\Hook\Hook('hExtendIndiHeaderRight');
$hook_extend_indi_header_left = $hook_extend_indi_header_left->execute($this->ctrl_individual);
$hook_extend_indi_heade... | [
"public",
"function",
"printHeaderExtensions",
"(",
")",
"{",
"$",
"hook_extend_indi_header_left",
"=",
"new",
"mw",
"\\",
"Hook",
"\\",
"Hook",
"(",
"'hExtendIndiHeaderLeft'",
")",
";",
"$",
"hook_extend_indi_header_right",
"=",
"new",
"mw",
"\\",
"Hook",
"\\",
... | Print individual header extensions.
Use hooks hExtendIndiHeaderLeft and hExtendIndiHeaderRight
@uses \MyArtJaub\Webtrees\Hook\Hook | [
"Print",
"individual",
"header",
"extensions",
".",
"Use",
"hooks",
"hExtendIndiHeaderLeft",
"and",
"hExtendIndiHeaderRight"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Controller/IndividualController.php#L46-L70 |
34,563 | jon48/webtrees-lib | src/Webtrees/Controller/IndividualController.php | IndividualController.printHeaderExtraIcons | public function printHeaderExtraIcons(){
$hook_extend_indi_header_icons = new Hook('hExtendIndiHeaderIcons');
$hook_extend_indi_header_icons = $hook_extend_indi_header_icons->execute($this->ctrl_individual);
echo '<span id="indi_perso_icons"> ',
implode(' ', $hook_extend_indi_header_icons),
'</... | php | public function printHeaderExtraIcons(){
$hook_extend_indi_header_icons = new Hook('hExtendIndiHeaderIcons');
$hook_extend_indi_header_icons = $hook_extend_indi_header_icons->execute($this->ctrl_individual);
echo '<span id="indi_perso_icons"> ',
implode(' ', $hook_extend_indi_header_icons),
'</... | [
"public",
"function",
"printHeaderExtraIcons",
"(",
")",
"{",
"$",
"hook_extend_indi_header_icons",
"=",
"new",
"Hook",
"(",
"'hExtendIndiHeaderIcons'",
")",
";",
"$",
"hook_extend_indi_header_icons",
"=",
"$",
"hook_extend_indi_header_icons",
"->",
"execute",
"(",
"$",... | Print individual header extra icons.
Use hook hExtendIndiHeaderIcons
@uses \MyArtJaub\Webtrees\Hook\Hook | [
"Print",
"individual",
"header",
"extra",
"icons",
".",
"Use",
"hook",
"hExtendIndiHeaderIcons"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Controller/IndividualController.php#L78-L85 |
34,564 | jon48/webtrees-lib | src/Webtrees/Cache.php | Cache.init | protected function init() {
if(Apc::isAvailable()) {
$driver = new Apc();
} else {
if (!is_dir(WT_DATA_DIR.DIRECTORY_SEPARATOR.'cache')) {
// We may not have permission - especially during setup, before we instruct
// the user to "chmod 777 /data"
@mkdir(WT_DATA_DIR.DIRECTORY_SEPARATOR.'ca... | php | protected function init() {
if(Apc::isAvailable()) {
$driver = new Apc();
} else {
if (!is_dir(WT_DATA_DIR.DIRECTORY_SEPARATOR.'cache')) {
// We may not have permission - especially during setup, before we instruct
// the user to "chmod 777 /data"
@mkdir(WT_DATA_DIR.DIRECTORY_SEPARATOR.'ca... | [
"protected",
"function",
"init",
"(",
")",
"{",
"if",
"(",
"Apc",
"::",
"isAvailable",
"(",
")",
")",
"{",
"$",
"driver",
"=",
"new",
"Apc",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"WT_DATA_DIR",
".",
"DIRECTORY_SEPARATOR",
... | Initialise the Cache class | [
"Initialise",
"the",
"Cache",
"class"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Cache.php#L61-L80 |
34,565 | jon48/webtrees-lib | src/Webtrees/Cache.php | Cache.getKeyName | protected function getKeyName($value, AbstractModule $mod = null){
$this->checkInit();
$mod_name = 'myartjaub';
if($mod !== null) $mod_name = $mod->getName();
return $mod_name.'_'.$value;
} | php | protected function getKeyName($value, AbstractModule $mod = null){
$this->checkInit();
$mod_name = 'myartjaub';
if($mod !== null) $mod_name = $mod->getName();
return $mod_name.'_'.$value;
} | [
"protected",
"function",
"getKeyName",
"(",
"$",
"value",
",",
"AbstractModule",
"$",
"mod",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"checkInit",
"(",
")",
";",
"$",
"mod_name",
"=",
"'myartjaub'",
";",
"if",
"(",
"$",
"mod",
"!==",
"null",
")",
"$... | Returns the name of the cached key, based on the value name and the calling module
@param string $value Value name
@param AbstractModule $mod Calling module
@return string Cached key name | [
"Returns",
"the",
"name",
"of",
"the",
"cached",
"key",
"based",
"on",
"the",
"value",
"name",
"and",
"the",
"calling",
"module"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Cache.php#L97-L102 |
34,566 | jon48/webtrees-lib | src/Webtrees/Cache.php | Cache.getI | public function getI($value, AbstractModule $mod = null){
$this->checkInit();
return $this->cache->getItem($this->getKeyName($value, $mod));
} | php | public function getI($value, AbstractModule $mod = null){
$this->checkInit();
return $this->cache->getItem($this->getKeyName($value, $mod));
} | [
"public",
"function",
"getI",
"(",
"$",
"value",
",",
"AbstractModule",
"$",
"mod",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"checkInit",
"(",
")",
";",
"return",
"$",
"this",
"->",
"cache",
"->",
"getItem",
"(",
"$",
"this",
"->",
"getKeyName",
"("... | Returns the cached value, if exists
@param string $value Value name
@param AbstractModule $mod Calling module
@return \Psr\Cache\CacheItemInterface | [
"Returns",
"the",
"cached",
"value",
"if",
"exists"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Cache.php#L111-L114 |
34,567 | jon48/webtrees-lib | src/Webtrees/Cache.php | Cache.saveI | public function saveI($value, $data, AbstractModule $mod = null){
$this->checkInit();
$item = $value;
if(!($value instanceof CacheItemInterface)) {
$item = new \Stash\Item();
$item->setKey($this->getKeyName($value, $mod));
}
$item->set($data);
$this->cache->save($item);
} | php | public function saveI($value, $data, AbstractModule $mod = null){
$this->checkInit();
$item = $value;
if(!($value instanceof CacheItemInterface)) {
$item = new \Stash\Item();
$item->setKey($this->getKeyName($value, $mod));
}
$item->set($data);
$this->cache->save($item);
} | [
"public",
"function",
"saveI",
"(",
"$",
"value",
",",
"$",
"data",
",",
"AbstractModule",
"$",
"mod",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"checkInit",
"(",
")",
";",
"$",
"item",
"=",
"$",
"value",
";",
"if",
"(",
"!",
"(",
"$",
"value",
... | Cache a value to the specified key
@param string|\Psr\Cache\CacheItemInterface $value Value name
@param mixed $data Value
@param AbstractModule $mod Calling module | [
"Cache",
"a",
"value",
"to",
"the",
"specified",
"key"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Cache.php#L134-L144 |
34,568 | jon48/webtrees-lib | src/Webtrees/Cache.php | Cache.deleteI | public function deleteI($value, AbstractModule $mod = null){
$this->checkInit();
return $this->cache->deleteItem($this->getKeyName($value, $mod));
} | php | public function deleteI($value, AbstractModule $mod = null){
$this->checkInit();
return $this->cache->deleteItem($this->getKeyName($value, $mod));
} | [
"public",
"function",
"deleteI",
"(",
"$",
"value",
",",
"AbstractModule",
"$",
"mod",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"checkInit",
"(",
")",
";",
"return",
"$",
"this",
"->",
"cache",
"->",
"deleteItem",
"(",
"$",
"this",
"->",
"getKeyName",... | Delete the value associated to the specified key
@param string $value Value name
@param AbstractModule $mod Calling module
@return bool Deletion successful? | [
"Delete",
"the",
"value",
"associated",
"to",
"the",
"specified",
"key"
] | e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7 | https://github.com/jon48/webtrees-lib/blob/e8097cdfcdbb3c9e885e7e06fe7683ed39267bb7/src/Webtrees/Cache.php#L164-L167 |
34,569 | c4studio/chronos | src/Chronos/Content/ContentServiceProvider.php | ContentServiceProvider.registerKernels | public function registerKernels()
{
if (class_exists('Chronos\Content\Console\Kernel')) {
$this->app->singleton('chronos.content.console.kernel', function($app) {
$dispatcher = $app->make(Dispatcher::class);
return new Kernel($app, $dispatcher);
});
... | php | public function registerKernels()
{
if (class_exists('Chronos\Content\Console\Kernel')) {
$this->app->singleton('chronos.content.console.kernel', function($app) {
$dispatcher = $app->make(Dispatcher::class);
return new Kernel($app, $dispatcher);
});
... | [
"public",
"function",
"registerKernels",
"(",
")",
"{",
"if",
"(",
"class_exists",
"(",
"'Chronos\\Content\\Console\\Kernel'",
")",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'chronos.content.console.kernel'",
",",
"function",
"(",
"$",
"app",
... | Registers package kernels | [
"Registers",
"package",
"kernels"
] | df7f3a9794afaade3bee8f6be1223c98e4936cb2 | https://github.com/c4studio/chronos/blob/df7f3a9794afaade3bee8f6be1223c98e4936cb2/src/Chronos/Content/ContentServiceProvider.php#L83-L93 |
34,570 | c4studio/chronos | src/Chronos/Content/ContentServiceProvider.php | ContentServiceProvider.updateMenu | protected function updateMenu()
{
$menu = \Menu::get('ChronosMenu');
// Content tab
$content_menu = $menu->add(trans('chronos.content::menu.Content'), null)
->prepend('<span class="icon c4icon-pencil-3"></span>')
->data('order', 100)->data('permissions', ['view_conte... | php | protected function updateMenu()
{
$menu = \Menu::get('ChronosMenu');
// Content tab
$content_menu = $menu->add(trans('chronos.content::menu.Content'), null)
->prepend('<span class="icon c4icon-pencil-3"></span>')
->data('order', 100)->data('permissions', ['view_conte... | [
"protected",
"function",
"updateMenu",
"(",
")",
"{",
"$",
"menu",
"=",
"\\",
"Menu",
"::",
"get",
"(",
"'ChronosMenu'",
")",
";",
"// Content tab",
"$",
"content_menu",
"=",
"$",
"menu",
"->",
"add",
"(",
"trans",
"(",
"'chronos.content::menu.Content'",
")"... | Updates menu. | [
"Updates",
"menu",
"."
] | df7f3a9794afaade3bee8f6be1223c98e4936cb2 | https://github.com/c4studio/chronos/blob/df7f3a9794afaade3bee8f6be1223c98e4936cb2/src/Chronos/Content/ContentServiceProvider.php#L99-L131 |
34,571 | voslartomas/WebCMS2 | AdminModule/presenters/FilesystemPresenter.php | FilesystemPresenter.getMaxUploadFileSize | public function getMaxUploadFileSize()
{
static $max_size = -1;
if ($max_size < 0) {
// Start with post_max_size.
$max_size = $this->parseFileSize(ini_get('post_max_size'));
// If upload_max_size is less, then reduce. Except if upload_max_size is
// ... | php | public function getMaxUploadFileSize()
{
static $max_size = -1;
if ($max_size < 0) {
// Start with post_max_size.
$max_size = $this->parseFileSize(ini_get('post_max_size'));
// If upload_max_size is less, then reduce. Except if upload_max_size is
// ... | [
"public",
"function",
"getMaxUploadFileSize",
"(",
")",
"{",
"static",
"$",
"max_size",
"=",
"-",
"1",
";",
"if",
"(",
"$",
"max_size",
"<",
"0",
")",
"{",
"// Start with post_max_size.",
"$",
"max_size",
"=",
"$",
"this",
"->",
"parseFileSize",
"(",
"ini_... | Get the maximal file upload size from the environment variables.
@author Taken from the Drupal.org project
@license GPL 2
@return int | [
"Get",
"the",
"maximal",
"file",
"upload",
"size",
"from",
"the",
"environment",
"variables",
"."
] | b39ea4b2fd30e87ff5e4fa81441cefa308e51fbf | https://github.com/voslartomas/WebCMS2/blob/b39ea4b2fd30e87ff5e4fa81441cefa308e51fbf/AdminModule/presenters/FilesystemPresenter.php#L226-L243 |
34,572 | voslartomas/WebCMS2 | AdminModule/presenters/FilesystemPresenter.php | FilesystemPresenter.parseFileSize | public function parseFileSize($size)
{
$unit = preg_replace('/[^bkmgtpezy]/i', '', $size); // Remove the non-unit characters from the size.
$size = preg_replace('/[^0-9\.]/', '', $size); // Remove the non-numeric characters from the size.
if ($unit) {
// Find the position of the ... | php | public function parseFileSize($size)
{
$unit = preg_replace('/[^bkmgtpezy]/i', '', $size); // Remove the non-unit characters from the size.
$size = preg_replace('/[^0-9\.]/', '', $size); // Remove the non-numeric characters from the size.
if ($unit) {
// Find the position of the ... | [
"public",
"function",
"parseFileSize",
"(",
"$",
"size",
")",
"{",
"$",
"unit",
"=",
"preg_replace",
"(",
"'/[^bkmgtpezy]/i'",
",",
"''",
",",
"$",
"size",
")",
";",
"// Remove the non-unit characters from the size.",
"$",
"size",
"=",
"preg_replace",
"(",
"'/[^... | Parse file size.
@author Taken from the Drupal.org project
@license GPL 2
@return int | [
"Parse",
"file",
"size",
"."
] | b39ea4b2fd30e87ff5e4fa81441cefa308e51fbf | https://github.com/voslartomas/WebCMS2/blob/b39ea4b2fd30e87ff5e4fa81441cefa308e51fbf/AdminModule/presenters/FilesystemPresenter.php#L252-L262 |
34,573 | nails/module-cdn | src/Api/Controller/Bucket.php | Bucket.getList | public function getList()
{
if (!userHasPermission('admin:cdn:manager:object:browse')) {
throw new ApiException(
'You do not have permission to access this resource',
$oHttpCodes::STATUS_UNAUTHORIZED
);
}
$oInput = Factory::servi... | php | public function getList()
{
if (!userHasPermission('admin:cdn:manager:object:browse')) {
throw new ApiException(
'You do not have permission to access this resource',
$oHttpCodes::STATUS_UNAUTHORIZED
);
}
$oInput = Factory::servi... | [
"public",
"function",
"getList",
"(",
")",
"{",
"if",
"(",
"!",
"userHasPermission",
"(",
"'admin:cdn:manager:object:browse'",
")",
")",
"{",
"throw",
"new",
"ApiException",
"(",
"'You do not have permission to access this resource'",
",",
"$",
"oHttpCodes",
"::",
"ST... | Returns a paginated list of a bucket's contents
@return array | [
"Returns",
"a",
"paginated",
"list",
"of",
"a",
"bucket",
"s",
"contents"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Api/Controller/Bucket.php#L38-L77 |
34,574 | nails/module-cdn | src/Api/Controller/Bucket.php | Bucket.postIndex | public function postIndex()
{
$oInput = Factory::service('Input');
$oHttpCodes = Factory::service('HttpCodes');
if (!userHasPermission('admin:cdn:manager:bucket:create')) {
throw new ApiException(
'You do not have permission to create this resource',
... | php | public function postIndex()
{
$oInput = Factory::service('Input');
$oHttpCodes = Factory::service('HttpCodes');
if (!userHasPermission('admin:cdn:manager:bucket:create')) {
throw new ApiException(
'You do not have permission to create this resource',
... | [
"public",
"function",
"postIndex",
"(",
")",
"{",
"$",
"oInput",
"=",
"Factory",
"::",
"service",
"(",
"'Input'",
")",
";",
"$",
"oHttpCodes",
"=",
"Factory",
"::",
"service",
"(",
"'HttpCodes'",
")",
";",
"if",
"(",
"!",
"userHasPermission",
"(",
"'admi... | Overridden to check user permissions before creating buckets
@return array | [
"Overridden",
"to",
"check",
"user",
"permissions",
"before",
"creating",
"buckets"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Api/Controller/Bucket.php#L86-L107 |
34,575 | c4studio/chronos | src/Chronos/Content/app/Models/Media.php | Media.getAltAttribute | public function getAltAttribute()
{
$data = unserialize($this->attributes['data']);
return $data === false ? null : (isset($data['alt']) ? $data['alt'] : null);
} | php | public function getAltAttribute()
{
$data = unserialize($this->attributes['data']);
return $data === false ? null : (isset($data['alt']) ? $data['alt'] : null);
} | [
"public",
"function",
"getAltAttribute",
"(",
")",
"{",
"$",
"data",
"=",
"unserialize",
"(",
"$",
"this",
"->",
"attributes",
"[",
"'data'",
"]",
")",
";",
"return",
"$",
"data",
"===",
"false",
"?",
"null",
":",
"(",
"isset",
"(",
"$",
"data",
"[",... | Add alt tag to model. | [
"Add",
"alt",
"tag",
"to",
"model",
"."
] | df7f3a9794afaade3bee8f6be1223c98e4936cb2 | https://github.com/c4studio/chronos/blob/df7f3a9794afaade3bee8f6be1223c98e4936cb2/src/Chronos/Content/app/Models/Media.php#L45-L50 |
34,576 | c4studio/chronos | src/Chronos/Content/app/Models/Media.php | Media.getStylesAttribute | public function getStylesAttribute()
{
if (!$this->isImage)
return null;
$styles = [];
foreach ($this->image_styles as $style)
$styles[$style->style->name] = $style->file;
return $styles;
} | php | public function getStylesAttribute()
{
if (!$this->isImage)
return null;
$styles = [];
foreach ($this->image_styles as $style)
$styles[$style->style->name] = $style->file;
return $styles;
} | [
"public",
"function",
"getStylesAttribute",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isImage",
")",
"return",
"null",
";",
"$",
"styles",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"image_styles",
"as",
"$",
"style",
")",
"$",
... | Add styles to model. | [
"Add",
"styles",
"to",
"model",
"."
] | df7f3a9794afaade3bee8f6be1223c98e4936cb2 | https://github.com/c4studio/chronos/blob/df7f3a9794afaade3bee8f6be1223c98e4936cb2/src/Chronos/Content/app/Models/Media.php#L90-L100 |
34,577 | c4studio/chronos | src/Chronos/Content/app/Models/Media.php | Media.getTitleAttribute | public function getTitleAttribute()
{
$data = unserialize($this->attributes['data']);
return $data === false ? null : (isset($data['title']) ? $data['title'] : null);
} | php | public function getTitleAttribute()
{
$data = unserialize($this->attributes['data']);
return $data === false ? null : (isset($data['title']) ? $data['title'] : null);
} | [
"public",
"function",
"getTitleAttribute",
"(",
")",
"{",
"$",
"data",
"=",
"unserialize",
"(",
"$",
"this",
"->",
"attributes",
"[",
"'data'",
"]",
")",
";",
"return",
"$",
"data",
"===",
"false",
"?",
"null",
":",
"(",
"isset",
"(",
"$",
"data",
"[... | Add title tag to model. | [
"Add",
"title",
"tag",
"to",
"model",
"."
] | df7f3a9794afaade3bee8f6be1223c98e4936cb2 | https://github.com/c4studio/chronos/blob/df7f3a9794afaade3bee8f6be1223c98e4936cb2/src/Chronos/Content/app/Models/Media.php#L122-L127 |
34,578 | nails/module-cdn | src/Controller/Base.php | Base.serveFromCache | protected function serveFromCache($file, $hit = true, $setCacheHeaders = true)
{
/**
* Cache object exists, set the appropriate headers and return the
* contents of the file.
**/
$aStats = stat($this->cdnCacheDir . $file);
// Set cache headers
if ($setCa... | php | protected function serveFromCache($file, $hit = true, $setCacheHeaders = true)
{
/**
* Cache object exists, set the appropriate headers and return the
* contents of the file.
**/
$aStats = stat($this->cdnCacheDir . $file);
// Set cache headers
if ($setCa... | [
"protected",
"function",
"serveFromCache",
"(",
"$",
"file",
",",
"$",
"hit",
"=",
"true",
",",
"$",
"setCacheHeaders",
"=",
"true",
")",
"{",
"/**\n * Cache object exists, set the appropriate headers and return the\n * contents of the file.\n **/",
"$",... | Serve a file from the app's cache
@param string $file The file to serve
@param boolean $hit Whether or not the request was a cache hit or not
@param boolean $setCacheHeaders Whether tos et the cache headers or not
@return void | [
"Serve",
"a",
"file",
"from",
"the",
"app",
"s",
"cache"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Controller/Base.php#L94-L128 |
34,579 | nails/module-cdn | src/Controller/Base.php | Base.setCacheHeaders | protected function setCacheHeaders($lastModified, $file, $hit)
{
// Set some flags
$this->cdnCacheHeadersSet = true;
$this->cdnCacheHeadersLastModified = $lastModified;
$this->cdnCacheHeadersExpires = time() + $this->cdnCacheHeadersMaxAge;
$this->cdnCacheHeader... | php | protected function setCacheHeaders($lastModified, $file, $hit)
{
// Set some flags
$this->cdnCacheHeadersSet = true;
$this->cdnCacheHeadersLastModified = $lastModified;
$this->cdnCacheHeadersExpires = time() + $this->cdnCacheHeadersMaxAge;
$this->cdnCacheHeader... | [
"protected",
"function",
"setCacheHeaders",
"(",
"$",
"lastModified",
",",
"$",
"file",
",",
"$",
"hit",
")",
"{",
"// Set some flags",
"$",
"this",
"->",
"cdnCacheHeadersSet",
"=",
"true",
";",
"$",
"this",
"->",
"cdnCacheHeadersLastModified",
"=",
"$",
"las... | Set the cache headers of an object
@param string $lastModified The last modified date of the file
@param string $file The file we're serving
@param boolean $hit Whether or not the request was a cache hit or not | [
"Set",
"the",
"cache",
"headers",
"of",
"an",
"object"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Controller/Base.php#L139-L155 |
34,580 | nails/module-cdn | src/Controller/Base.php | Base.unsetCacheHeaders | protected function unsetCacheHeaders()
{
if (empty($this->cdnCacheHeadersSet)) {
return false;
}
// --------------------------------------------------------------------------
// Remove previously set headers
header_remove('Cache-Control');
header_remove... | php | protected function unsetCacheHeaders()
{
if (empty($this->cdnCacheHeadersSet)) {
return false;
}
// --------------------------------------------------------------------------
// Remove previously set headers
header_remove('Cache-Control');
header_remove... | [
"protected",
"function",
"unsetCacheHeaders",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"cdnCacheHeadersSet",
")",
")",
"{",
"return",
"false",
";",
"}",
"// --------------------------------------------------------------------------",
"// Remove previous... | Unset the cache headers of an object
@return boolean | [
"Unset",
"the",
"cache",
"headers",
"of",
"an",
"object"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Controller/Base.php#L163-L189 |
34,581 | nails/module-cdn | src/Controller/Base.php | Base.serveNotModified | protected function serveNotModified($file)
{
$oInput = Factory::service('Input');
if (function_exists('apache_request_headers')) {
$headers = apache_request_headers();
} elseif ($oInput->server('HTTP_IF_NONE_MATCH')) {
$headers = [];
$h... | php | protected function serveNotModified($file)
{
$oInput = Factory::service('Input');
if (function_exists('apache_request_headers')) {
$headers = apache_request_headers();
} elseif ($oInput->server('HTTP_IF_NONE_MATCH')) {
$headers = [];
$h... | [
"protected",
"function",
"serveNotModified",
"(",
"$",
"file",
")",
"{",
"$",
"oInput",
"=",
"Factory",
"::",
"service",
"(",
"'Input'",
")",
";",
"if",
"(",
"function_exists",
"(",
"'apache_request_headers'",
")",
")",
"{",
"$",
"headers",
"=",
"apache_requ... | Serve the "304 Not Modified" headers for an object
@param string $file The file we're sending the headers for
@return boolean | [
"Serve",
"the",
"304",
"Not",
"Modified",
"headers",
"for",
"an",
"object"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Controller/Base.php#L200-L258 |
34,582 | nails/module-cdn | src/Controller/Base.php | Base.serveBadSrc | protected function serveBadSrc(array $params)
{
$width = isset($params['width']) ? $params['width'] : 100;
$height = isset($params['height']) ? $params['height'] : 100;
$sError = isset($params['error']) ? $params['error'] : '';
// Make sure this doesn't get cached
$this->u... | php | protected function serveBadSrc(array $params)
{
$width = isset($params['width']) ? $params['width'] : 100;
$height = isset($params['height']) ? $params['height'] : 100;
$sError = isset($params['error']) ? $params['error'] : '';
// Make sure this doesn't get cached
$this->u... | [
"protected",
"function",
"serveBadSrc",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"width",
"=",
"isset",
"(",
"$",
"params",
"[",
"'width'",
"]",
")",
"?",
"$",
"params",
"[",
"'width'",
"]",
":",
"100",
";",
"$",
"height",
"=",
"isset",
"(",
"$"... | Serve up the "fail whale" graphic
@return void | [
"Serve",
"up",
"the",
"fail",
"whale",
"graphic"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Controller/Base.php#L266-L331 |
34,583 | nails/module-cdn | src/Controller/Base.php | Base.checkDimensions | protected function checkDimensions($iWidth, $iHeight)
{
$oCdn = Factory::service('Cdn', 'nails/module-cdn');
if (!$oCdn->isPermittedDimension($iWidth, $iHeight)) {
if (Environment::not(Environment::ENV_PROD)) {
throw new PermittedDimensionException(
'T... | php | protected function checkDimensions($iWidth, $iHeight)
{
$oCdn = Factory::service('Cdn', 'nails/module-cdn');
if (!$oCdn->isPermittedDimension($iWidth, $iHeight)) {
if (Environment::not(Environment::ENV_PROD)) {
throw new PermittedDimensionException(
'T... | [
"protected",
"function",
"checkDimensions",
"(",
"$",
"iWidth",
",",
"$",
"iHeight",
")",
"{",
"$",
"oCdn",
"=",
"Factory",
"::",
"service",
"(",
"'Cdn'",
",",
"'nails/module-cdn'",
")",
";",
"if",
"(",
"!",
"$",
"oCdn",
"->",
"isPermittedDimension",
"(",
... | Determines if the requested dimensions can be satisfied, throws an exception
on non-production environments
@param $iWidth
@param $iHeight
@throws PermittedDimensionException | [
"Determines",
"if",
"the",
"requested",
"dimensions",
"can",
"be",
"satisfied",
"throws",
"an",
"exception",
"on",
"non",
"-",
"production",
"environments"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Controller/Base.php#L344-L356 |
34,584 | nails/module-cdn | src/Service/Cdn.php | Cdn.callDriver | protected function callDriver($sMethod, $aArguments = [], $sDriver = null)
{
// Work out which driver we need to use
if (empty($sDriver)) {
$oDriver = $this->oEnabledDriver;
} elseif (array_key_exists($sDriver, $this->aDrivers)) {
$oDriver = $this->aDrivers[$sDriver]... | php | protected function callDriver($sMethod, $aArguments = [], $sDriver = null)
{
// Work out which driver we need to use
if (empty($sDriver)) {
$oDriver = $this->oEnabledDriver;
} elseif (array_key_exists($sDriver, $this->aDrivers)) {
$oDriver = $this->aDrivers[$sDriver]... | [
"protected",
"function",
"callDriver",
"(",
"$",
"sMethod",
",",
"$",
"aArguments",
"=",
"[",
"]",
",",
"$",
"sDriver",
"=",
"null",
")",
"{",
"// Work out which driver we need to use",
"if",
"(",
"empty",
"(",
"$",
"sDriver",
")",
")",
"{",
"$",
"oDriver... | Routes calls to the driver
@param string $sMethod The method to call
@param array $aArguments an array of arguments to pass to the driver
@param string $sDriver If specified, which driver to call
@return mixed
@throws DriverException | [
"Routes",
"calls",
"to",
"the",
"driver"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Service/Cdn.php#L228-L247 |
34,585 | nails/module-cdn | src/Service/Cdn.php | Cdn.unsetCacheObject | protected function unsetCacheObject($object, $clearCacheDir = true)
{
$objectId = isset($object->id) ? $object->id : '';
$objectFilename = isset($object->file->name->disk) ? $object->file->name->disk : '';
$bucketId = isset($object->bucket->id) ? $object->bucket->id : '';
... | php | protected function unsetCacheObject($object, $clearCacheDir = true)
{
$objectId = isset($object->id) ? $object->id : '';
$objectFilename = isset($object->file->name->disk) ? $object->file->name->disk : '';
$bucketId = isset($object->bucket->id) ? $object->bucket->id : '';
... | [
"protected",
"function",
"unsetCacheObject",
"(",
"$",
"object",
",",
"$",
"clearCacheDir",
"=",
"true",
")",
"{",
"$",
"objectId",
"=",
"isset",
"(",
"$",
"object",
"->",
"id",
")",
"?",
"$",
"object",
"->",
"id",
":",
"''",
";",
"$",
"objectFilename"... | Unset an object from the cache in one fell swoop
@param \stdClass $object The object to remove from the cache
@param bool $clearCacheDir Whether to clear the cache directory or not | [
"Unset",
"an",
"object",
"from",
"the",
"cache",
"in",
"one",
"fell",
"swoop"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Service/Cdn.php#L257-L296 |
34,586 | nails/module-cdn | src/Service/Cdn.php | Cdn.getObjects | public function getObjects($page = null, $perPage = null, $data = [])
{
$oDb = Factory::service('Database');
$oDb->select('o.id, o.filename, o.filename_display, o.serves, o.downloads, o.thumbs, o.scales, o.driver, o.md5_hash');
$oDb->Select('o.created, o.created_by, o.modified, o.modified_by... | php | public function getObjects($page = null, $perPage = null, $data = [])
{
$oDb = Factory::service('Database');
$oDb->select('o.id, o.filename, o.filename_display, o.serves, o.downloads, o.thumbs, o.scales, o.driver, o.md5_hash');
$oDb->Select('o.created, o.created_by, o.modified, o.modified_by... | [
"public",
"function",
"getObjects",
"(",
"$",
"page",
"=",
"null",
",",
"$",
"perPage",
"=",
"null",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"oDb",
"=",
"Factory",
"::",
"service",
"(",
"'Database'",
")",
";",
"$",
"oDb",
"->",
"select",
... | Returns an array of objects
@param integer $page The page to return
@param integer $perPage The number of items to return per page
@param array $data An array of data to pass to getCountCommonBuckets()
@return array | [
"Returns",
"an",
"array",
"of",
"objects"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Service/Cdn.php#L337-L382 |
34,587 | nails/module-cdn | src/Service/Cdn.php | Cdn.getCountCommonObjects | public function getCountCommonObjects($aData = [])
{
if (!empty($aData['keywords'])) {
if (empty($aData['or_like'])) {
$aData['or_like'] = [];
}
$aData['or_like'][] = [
'column' => 'o.filename_display',
'value' => $aData['k... | php | public function getCountCommonObjects($aData = [])
{
if (!empty($aData['keywords'])) {
if (empty($aData['or_like'])) {
$aData['or_like'] = [];
}
$aData['or_like'][] = [
'column' => 'o.filename_display',
'value' => $aData['k... | [
"public",
"function",
"getCountCommonObjects",
"(",
"$",
"aData",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"aData",
"[",
"'keywords'",
"]",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"aData",
"[",
"'or_like'",
"]",
")",
")",
... | Adds the ability to search by keyword
@param array $aData Data to pass to parent::getCountCommon | [
"Adds",
"the",
"ability",
"to",
"search",
"by",
"keyword"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Service/Cdn.php#L391-L404 |
34,588 | nails/module-cdn | src/Service/Cdn.php | Cdn.getObject | public function getObject($objectIdSlug, $bucketIdSlug = '', $data = [])
{
// Check the cache
$cacheKey = 'object-' . $objectIdSlug;
$cacheKey .= $bucketIdSlug ? '-' . $bucketIdSlug : '';
$cache = $this->getCache($cacheKey);
if ($cache) {
return $cache;
... | php | public function getObject($objectIdSlug, $bucketIdSlug = '', $data = [])
{
// Check the cache
$cacheKey = 'object-' . $objectIdSlug;
$cacheKey .= $bucketIdSlug ? '-' . $bucketIdSlug : '';
$cache = $this->getCache($cacheKey);
if ($cache) {
return $cache;
... | [
"public",
"function",
"getObject",
"(",
"$",
"objectIdSlug",
",",
"$",
"bucketIdSlug",
"=",
"''",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"// Check the cache",
"$",
"cacheKey",
"=",
"'object-'",
".",
"$",
"objectIdSlug",
";",
"$",
"cacheKey",
".=",
"... | Returns a single object
@param mixed $objectIdSlug The object's ID or filename
@param string $bucketIdSlug The bucket's ID or slug
@param array $data Data to pass to getCountCommon()()
@return mixed stdClass on success, false on failure | [
"Returns",
"a",
"single",
"object"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Service/Cdn.php#L497-L541 |
34,589 | nails/module-cdn | src/Service/Cdn.php | Cdn.getObjectFromTrash | public function getObjectFromTrash($object, $bucket = '', $data = [])
{
$oDb = Factory::service('Database');
if (is_numeric($object)) {
// Check the cache
$cacheKey = 'object-trash-' . $object;
$cache = $this->getCache($cacheKey);
if ($cache) {
... | php | public function getObjectFromTrash($object, $bucket = '', $data = [])
{
$oDb = Factory::service('Database');
if (is_numeric($object)) {
// Check the cache
$cacheKey = 'object-trash-' . $object;
$cache = $this->getCache($cacheKey);
if ($cache) {
... | [
"public",
"function",
"getObjectFromTrash",
"(",
"$",
"object",
",",
"$",
"bucket",
"=",
"''",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"oDb",
"=",
"Factory",
"::",
"service",
"(",
"'Database'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"... | Returns a single object from the trash
@param mixed $object The object's ID or filename
@param string $bucket The bucket's ID or slug
@param array $data Data to pass to getCountCommon()
@return mixed stdClass on success, false on failure | [
"Returns",
"a",
"single",
"object",
"from",
"the",
"trash"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Service/Cdn.php#L554-L610 |
34,590 | nails/module-cdn | src/Service/Cdn.php | Cdn.getObjectsForUser | public function getObjectsForUser($userId, $page = null, $perPage = null, $data = [])
{
$oDb = Factory::service('Database');
$oDb->where('o.created_by', $userId);
return $this->getObjects($page, $perPage, $data);
} | php | public function getObjectsForUser($userId, $page = null, $perPage = null, $data = [])
{
$oDb = Factory::service('Database');
$oDb->where('o.created_by', $userId);
return $this->getObjects($page, $perPage, $data);
} | [
"public",
"function",
"getObjectsForUser",
"(",
"$",
"userId",
",",
"$",
"page",
"=",
"null",
",",
"$",
"perPage",
"=",
"null",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"oDb",
"=",
"Factory",
"::",
"service",
"(",
"'Database'",
")",
";",
"$"... | Returns objects created by a user
@param int $userId The user's ID
@param int $page The page of results to return
@param int $perPage The number of results per page
@param array $data Data to pass to getCountCommon()
@return array | [
"Returns",
"objects",
"created",
"by",
"a",
"user"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Service/Cdn.php#L656-L661 |
34,591 | nails/module-cdn | src/Service/Cdn.php | Cdn.getUploadError | static function getUploadError($iErrorNumber)
{
// Upload was aborted, I wonder why?
switch ($iErrorNumber) {
case UPLOAD_ERR_INI_SIZE:
$iMaxFileSize = function_exists('ini_get') ? ini_get('upload_max_filesize') : null;
if (!is_null($iMaxFileSize)) {
... | php | static function getUploadError($iErrorNumber)
{
// Upload was aborted, I wonder why?
switch ($iErrorNumber) {
case UPLOAD_ERR_INI_SIZE:
$iMaxFileSize = function_exists('ini_get') ? ini_get('upload_max_filesize') : null;
if (!is_null($iMaxFileSize)) {
... | [
"static",
"function",
"getUploadError",
"(",
"$",
"iErrorNumber",
")",
"{",
"// Upload was aborted, I wonder why?",
"switch",
"(",
"$",
"iErrorNumber",
")",
"{",
"case",
"UPLOAD_ERR_INI_SIZE",
":",
"$",
"iMaxFileSize",
"=",
"function_exists",
"(",
"'ini_get'",
")",
... | Returns a string representation of an upload error number
@param integer $iErrorNumber The error number
@return string | [
"Returns",
"a",
"string",
"representation",
"of",
"an",
"upload",
"error",
"number"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Service/Cdn.php#L1105-L1158 |
34,592 | nails/module-cdn | src/Service/Cdn.php | Cdn.objectDelete | public function objectDelete($iObjectId)
{
$oDb = Factory::service('Database');
try {
$object = $this->getObject($iObjectId);
if (empty($object)) {
throw new CdnException('Not a valid object');
}
// ----------------------------------... | php | public function objectDelete($iObjectId)
{
$oDb = Factory::service('Database');
try {
$object = $this->getObject($iObjectId);
if (empty($object)) {
throw new CdnException('Not a valid object');
}
// ----------------------------------... | [
"public",
"function",
"objectDelete",
"(",
"$",
"iObjectId",
")",
"{",
"$",
"oDb",
"=",
"Factory",
"::",
"service",
"(",
"'Database'",
")",
";",
"try",
"{",
"$",
"object",
"=",
"$",
"this",
"->",
"getObject",
"(",
"$",
"iObjectId",
")",
";",
"if",
"(... | Deletes an object
@param int $iObjectId The object's ID or filename
@return boolean | [
"Deletes",
"an",
"object"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Service/Cdn.php#L1169-L1239 |
34,593 | nails/module-cdn | src/Service/Cdn.php | Cdn.objectRestore | public function objectRestore($iObjectId)
{
$oDb = Factory::service('Database');
try {
$oObject = $this->getObjectFromTrash($iObjectId);
if (empty($oObject)) {
throw new CdnException('Not a valid object');
}
// ----------------------... | php | public function objectRestore($iObjectId)
{
$oDb = Factory::service('Database');
try {
$oObject = $this->getObjectFromTrash($iObjectId);
if (empty($oObject)) {
throw new CdnException('Not a valid object');
}
// ----------------------... | [
"public",
"function",
"objectRestore",
"(",
"$",
"iObjectId",
")",
"{",
"$",
"oDb",
"=",
"Factory",
"::",
"service",
"(",
"'Database'",
")",
";",
"try",
"{",
"$",
"oObject",
"=",
"$",
"this",
"->",
"getObjectFromTrash",
"(",
"$",
"iObjectId",
")",
";",
... | Restore an object from the trash
@param mixed $iObjectId The object's ID or filename
@return boolean | [
"Restore",
"an",
"object",
"from",
"the",
"trash"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Service/Cdn.php#L1250-L1313 |
34,594 | nails/module-cdn | src/Service/Cdn.php | Cdn.objectReplace | public function objectReplace($object, $bucket, $replaceWith, $options = [], $bIsStream = false)
{
// Firstly, attempt the upload
$upload = $this->objectCreate($replaceWith, $bucket, $options, $bIsStream);
if ($upload) {
$oObj = $this->getObject($object);
if ($oOb... | php | public function objectReplace($object, $bucket, $replaceWith, $options = [], $bIsStream = false)
{
// Firstly, attempt the upload
$upload = $this->objectCreate($replaceWith, $bucket, $options, $bIsStream);
if ($upload) {
$oObj = $this->getObject($object);
if ($oOb... | [
"public",
"function",
"objectReplace",
"(",
"$",
"object",
",",
"$",
"bucket",
",",
"$",
"replaceWith",
",",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"bIsStream",
"=",
"false",
")",
"{",
"// Firstly, attempt the upload",
"$",
"upload",
"=",
"$",
"this",
... | Uploads an object and, if successful, removes the old object. Note that a new Object ID is created.
@param mixed $object The existing object's ID or filename
@param mixed $bucket The bucket's ID or slug
@param mixed $replaceWith The replacement: $_FILE key, path or data stream
@param array $options ... | [
"Uploads",
"an",
"object",
"and",
"if",
"successful",
"removes",
"the",
"old",
"object",
".",
"Note",
"that",
"a",
"new",
"Object",
"ID",
"is",
"created",
"."
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Service/Cdn.php#L1428-L1446 |
34,595 | nails/module-cdn | src/Service/Cdn.php | Cdn.objectIncrementCount | public function objectIncrementCount($action, $object, $bucket = null)
{
/** @var \CI_Db $oDb */
$oDb = Factory::service('Database');
switch (strtoupper($action)) {
case 'SERVE':
$oDb->set('o.serves', 'o.serves+1', false);
break;
case... | php | public function objectIncrementCount($action, $object, $bucket = null)
{
/** @var \CI_Db $oDb */
$oDb = Factory::service('Database');
switch (strtoupper($action)) {
case 'SERVE':
$oDb->set('o.serves', 'o.serves+1', false);
break;
case... | [
"public",
"function",
"objectIncrementCount",
"(",
"$",
"action",
",",
"$",
"object",
",",
"$",
"bucket",
"=",
"null",
")",
"{",
"/** @var \\CI_Db $oDb */",
"$",
"oDb",
"=",
"Factory",
"::",
"service",
"(",
"'Database'",
")",
";",
"switch",
"(",
"strtoupper"... | Increments the stats of on object
@param string $action The stat to increment
@param mixed $object The object's ID or filename
@param mixed $bucket The bucket's ID or slug
@return boolean | [
"Increments",
"the",
"stats",
"of",
"on",
"object"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Service/Cdn.php#L1459-L1499 |
34,596 | nails/module-cdn | src/Service/Cdn.php | Cdn.objectLocalPath | public function objectLocalPath($iId, $bIsTrash = false)
{
try {
$oObj = $bIsTrash ? $this->getObjectFromTrash($iId) : $this->getObject($iId);
if (!$oObj) {
throw new CdnException('Invalid Object ID');
}
$sLocalPath = $this->callDriver(
... | php | public function objectLocalPath($iId, $bIsTrash = false)
{
try {
$oObj = $bIsTrash ? $this->getObjectFromTrash($iId) : $this->getObject($iId);
if (!$oObj) {
throw new CdnException('Invalid Object ID');
}
$sLocalPath = $this->callDriver(
... | [
"public",
"function",
"objectLocalPath",
"(",
"$",
"iId",
",",
"$",
"bIsTrash",
"=",
"false",
")",
"{",
"try",
"{",
"$",
"oObj",
"=",
"$",
"bIsTrash",
"?",
"$",
"this",
"->",
"getObjectFromTrash",
"(",
"$",
"iId",
")",
":",
"$",
"this",
"->",
"getObj... | Returns a local path for an object ID
@param int $iId The object's ID
@param boolean $bIsTrash Whether to look in the trash or not
@return mixed | [
"Returns",
"a",
"local",
"path",
"for",
"an",
"object",
"ID"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Service/Cdn.php#L1511-L1539 |
34,597 | nails/module-cdn | src/Service/Cdn.php | Cdn.createObject | protected function createObject($oData, $bReturnObject = false)
{
$aData = [
'bucket_id' => $oData->bucket->id,
'filename' => $oData->filename,
'filename_display' => $oData->name,
'mime' => $oData->mime,
'filesize' ... | php | protected function createObject($oData, $bReturnObject = false)
{
$aData = [
'bucket_id' => $oData->bucket->id,
'filename' => $oData->filename,
'filename_display' => $oData->name,
'mime' => $oData->mime,
'filesize' ... | [
"protected",
"function",
"createObject",
"(",
"$",
"oData",
",",
"$",
"bReturnObject",
"=",
"false",
")",
"{",
"$",
"aData",
"=",
"[",
"'bucket_id'",
"=>",
"$",
"oData",
"->",
"bucket",
"->",
"id",
",",
"'filename'",
"=>",
"$",
"oData",
"->",
"filename",... | Creates a new object record in the DB; called from various other methods
@param \stdClass $oData The data to create the object with
@param boolean $bReturnObject Whether to return the object, or just it's ID
@return mixed | [
"Creates",
"a",
"new",
"object",
"record",
"in",
"the",
"DB",
";",
"called",
"from",
"various",
"other",
"methods"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Service/Cdn.php#L1551-L1592 |
34,598 | nails/module-cdn | src/Service/Cdn.php | Cdn.formatObject | protected function formatObject(&$oObj)
{
$oObj->id = (int) $oObj->id;
$oObj->img_width = (int) $oObj->img_width;
$oObj->img_height = (int) $oObj->img_height;
$oObj->is_animated = (bool) $oObj->is_animated;
$oObj->serves = (int) $oObj->serves;
$oObj->... | php | protected function formatObject(&$oObj)
{
$oObj->id = (int) $oObj->id;
$oObj->img_width = (int) $oObj->img_width;
$oObj->img_height = (int) $oObj->img_height;
$oObj->is_animated = (bool) $oObj->is_animated;
$oObj->serves = (int) $oObj->serves;
$oObj->... | [
"protected",
"function",
"formatObject",
"(",
"&",
"$",
"oObj",
")",
"{",
"$",
"oObj",
"->",
"id",
"=",
"(",
"int",
")",
"$",
"oObj",
"->",
"id",
";",
"$",
"oObj",
"->",
"img_width",
"=",
"(",
"int",
")",
"$",
"oObj",
"->",
"img_width",
";",
"$",... | Formats an object object
@param object $oObj The object to format
@return void | [
"Formats",
"an",
"object",
"object"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Service/Cdn.php#L1603-L1670 |
34,599 | nails/module-cdn | src/Service/Cdn.php | Cdn.getBuckets | public function getBuckets($page = null, $perPage = null, $data = [])
{
$oDb = Factory::service('Database');
$oDb->select('b.id,b.slug,b.label,b.allowed_types,b.max_size,b.created,b.created_by');
$oDb->select('b.modified,b.modified_by');
// Apply common items; pass $data
$t... | php | public function getBuckets($page = null, $perPage = null, $data = [])
{
$oDb = Factory::service('Database');
$oDb->select('b.id,b.slug,b.label,b.allowed_types,b.max_size,b.created,b.created_by');
$oDb->select('b.modified,b.modified_by');
// Apply common items; pass $data
$t... | [
"public",
"function",
"getBuckets",
"(",
"$",
"page",
"=",
"null",
",",
"$",
"perPage",
"=",
"null",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"oDb",
"=",
"Factory",
"::",
"service",
"(",
"'Database'",
")",
";",
"$",
"oDb",
"->",
"select",
... | Returns an array of buckets
@param integer $page The page to return
@param integer $perPage The number of items to return per page
@param array $data An array of data to pass to getCountCommonBuckets()
@return array | [
"Returns",
"an",
"array",
"of",
"buckets"
] | 1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef | https://github.com/nails/module-cdn/blob/1c2ff1cbdf2aa6a7162f92c8fdbcde87c506e1ef/src/Service/Cdn.php#L1685-L1726 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.