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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
217,500 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Interaction/Pipeline.php | Horde_Imap_Client_Interaction_Pipeline.complete | public function complete(Horde_Imap_Client_Interaction_Server_Tagged $resp)
{
if (isset($this->_commands[$resp->tag])) {
$cmd = $this->_commands[$resp->tag];
$cmd->response = $resp;
unset($this->_todo[$resp->tag]);
} else {
/* This can be reached if a ... | php | public function complete(Horde_Imap_Client_Interaction_Server_Tagged $resp)
{
if (isset($this->_commands[$resp->tag])) {
$cmd = $this->_commands[$resp->tag];
$cmd->response = $resp;
unset($this->_todo[$resp->tag]);
} else {
/* This can be reached if a ... | [
"public",
"function",
"complete",
"(",
"Horde_Imap_Client_Interaction_Server_Tagged",
"$",
"resp",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_commands",
"[",
"$",
"resp",
"->",
"tag",
"]",
")",
")",
"{",
"$",
"cmd",
"=",
"$",
"this",
"->",
... | Mark a command as completed.
@param Horde_Imap_Client_Interaction_Server_Tagged $resp Tagged server
response.
@return Horde_Imap_Client_Interaction_Command Command that was
completed. Returns null
if tagged response
is not contained in this
pipeline object. | [
"Mark",
"a",
"command",
"as",
"completed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Interaction/Pipeline.php#L111-L124 |
217,501 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Interaction/Pipeline.php | Horde_Imap_Client_Interaction_Pipeline.getCmd | public function getCmd($tag)
{
return isset($this->_commands[$tag])
? $this->_commands[$tag]
: null;
} | php | public function getCmd($tag)
{
return isset($this->_commands[$tag])
? $this->_commands[$tag]
: null;
} | [
"public",
"function",
"getCmd",
"(",
"$",
"tag",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_commands",
"[",
"$",
"tag",
"]",
")",
"?",
"$",
"this",
"->",
"_commands",
"[",
"$",
"tag",
"]",
":",
"null",
";",
"}"
] | Return the command for a given tag.
@param string $tag The command tag.
@return Horde_Imap_Client_Interaction_Command A command object (or
null if the tag does
not exist). | [
"Return",
"the",
"command",
"for",
"a",
"given",
"tag",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Interaction/Pipeline.php#L135-L140 |
217,502 | moodle/moodle | mod/forum/classes/local/factories/entity.php | entity.get_author_from_stdclass | public function get_author_from_stdclass(stdClass $record) : author_entity {
return new author_entity(
$record->id,
$record->picture,
$record->firstname,
$record->lastname,
fullname($record),
$record->email,
$record->middlename,... | php | public function get_author_from_stdclass(stdClass $record) : author_entity {
return new author_entity(
$record->id,
$record->picture,
$record->firstname,
$record->lastname,
fullname($record),
$record->email,
$record->middlename,... | [
"public",
"function",
"get_author_from_stdclass",
"(",
"stdClass",
"$",
"record",
")",
":",
"author_entity",
"{",
"return",
"new",
"author_entity",
"(",
"$",
"record",
"->",
"id",
",",
"$",
"record",
"->",
"picture",
",",
"$",
"record",
"->",
"firstname",
",... | Create an author entity from a user record.
@param stdClass $record The user record
@return author_entity | [
"Create",
"an",
"author",
"entity",
"from",
"a",
"user",
"record",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/entity.php#L167-L181 |
217,503 | moodle/moodle | mod/forum/classes/local/factories/entity.php | entity.get_discussion_summary_from_stdclass | public function get_discussion_summary_from_stdclass(
stdClass $discussion,
stdClass $firstpost,
stdClass $firstpostauthor,
stdClass $latestpostauthor
) : discussion_summary_entity {
$firstpostauthorentity = $this->get_author_from_stdclass($firstpostauthor);
return n... | php | public function get_discussion_summary_from_stdclass(
stdClass $discussion,
stdClass $firstpost,
stdClass $firstpostauthor,
stdClass $latestpostauthor
) : discussion_summary_entity {
$firstpostauthorentity = $this->get_author_from_stdclass($firstpostauthor);
return n... | [
"public",
"function",
"get_discussion_summary_from_stdclass",
"(",
"stdClass",
"$",
"discussion",
",",
"stdClass",
"$",
"firstpost",
",",
"stdClass",
"$",
"firstpostauthor",
",",
"stdClass",
"$",
"latestpostauthor",
")",
":",
"discussion_summary_entity",
"{",
"$",
"fi... | Create a discussion summary enttiy from stdClasses.
@param stdClass $discussion The discussion record
@param stdClass $firstpost A post record for the first post in the discussion
@param stdClass $firstpostauthor A user record for the author of the first post
@param stdClass $latestpostauthor A user record for the aut... | [
"Create",
"a",
"discussion",
"summary",
"enttiy",
"from",
"stdClasses",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/entity.php#L192-L206 |
217,504 | moodle/moodle | mod/forum/classes/local/factories/entity.php | entity.get_posts_sorter | public function get_posts_sorter() : sorter_entity {
return new sorter_entity(
// Get id function for a post_entity.
function(post_entity $post) {
return $post->get_id();
},
// Get parent id function for a post_entity.
function(post_ent... | php | public function get_posts_sorter() : sorter_entity {
return new sorter_entity(
// Get id function for a post_entity.
function(post_entity $post) {
return $post->get_id();
},
// Get parent id function for a post_entity.
function(post_ent... | [
"public",
"function",
"get_posts_sorter",
"(",
")",
":",
"sorter_entity",
"{",
"return",
"new",
"sorter_entity",
"(",
"// Get id function for a post_entity.",
"function",
"(",
"post_entity",
"$",
"post",
")",
"{",
"return",
"$",
"post",
"->",
"get_id",
"(",
")",
... | Create a sorter entity to sort post entities.
@return sorter_entity | [
"Create",
"a",
"sorter",
"entity",
"to",
"sort",
"post",
"entities",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/entity.php#L223-L234 |
217,505 | moodle/moodle | mod/forum/classes/local/factories/entity.php | entity.get_exported_posts_sorter | public function get_exported_posts_sorter() : sorter_entity {
return new sorter_entity(
// Get id function for an exported post.
function(stdClass $post) {
return $post->id;
},
// Get parent id function for an exported post.
function(st... | php | public function get_exported_posts_sorter() : sorter_entity {
return new sorter_entity(
// Get id function for an exported post.
function(stdClass $post) {
return $post->id;
},
// Get parent id function for an exported post.
function(st... | [
"public",
"function",
"get_exported_posts_sorter",
"(",
")",
":",
"sorter_entity",
"{",
"return",
"new",
"sorter_entity",
"(",
"// Get id function for an exported post.",
"function",
"(",
"stdClass",
"$",
"post",
")",
"{",
"return",
"$",
"post",
"->",
"id",
";",
"... | Create a sorter entity to sort exported posts.
@return sorter_entity | [
"Create",
"a",
"sorter",
"entity",
"to",
"sort",
"exported",
"posts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/entity.php#L241-L252 |
217,506 | moodle/moodle | lib/form/classes/filetypes_util.php | filetypes_util.is_filetype_group | public function is_filetype_group($type) {
$info = $this->get_groups_info();
if (isset($info[$type])) {
return $info[$type];
} else {
return false;
}
} | php | public function is_filetype_group($type) {
$info = $this->get_groups_info();
if (isset($info[$type])) {
return $info[$type];
} else {
return false;
}
} | [
"public",
"function",
"is_filetype_group",
"(",
"$",
"type",
")",
"{",
"$",
"info",
"=",
"$",
"this",
"->",
"get_groups_info",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"info",
"[",
"$",
"type",
"]",
")",
")",
"{",
"return",
"$",
"info",
"[",
... | Is the given string a known filetype group?
@param string $type
@return bool|object false or the group info | [
"Is",
"the",
"given",
"string",
"a",
"known",
"filetype",
"group?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/classes/filetypes_util.php#L136-L146 |
217,507 | moodle/moodle | lib/form/classes/filetypes_util.php | filetypes_util.get_groups_info | public function get_groups_info() {
if ($this->cachegroups !== null) {
return $this->cachegroups;
}
$groups = [];
foreach (core_filetypes::get_types() as $ext => $info) {
if (isset($info['groups']) && is_array($info['groups'])) {
foreach ($info[... | php | public function get_groups_info() {
if ($this->cachegroups !== null) {
return $this->cachegroups;
}
$groups = [];
foreach (core_filetypes::get_types() as $ext => $info) {
if (isset($info['groups']) && is_array($info['groups'])) {
foreach ($info[... | [
"public",
"function",
"get_groups_info",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cachegroups",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"cachegroups",
";",
"}",
"$",
"groups",
"=",
"[",
"]",
";",
"foreach",
"(",
"core_filetypes",
"::... | Provides a list of all known file type groups and their properties.
@return array | [
"Provides",
"a",
"list",
"of",
"all",
"known",
"file",
"type",
"groups",
"and",
"their",
"properties",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/classes/filetypes_util.php#L153-L185 |
217,508 | moodle/moodle | lib/form/classes/filetypes_util.php | filetypes_util.describe_file_types | public function describe_file_types($types) {
$descriptions = [];
$types = $this->normalize_file_types($types);
foreach ($types as $type) {
if ($type === '*') {
$desc = get_string('filetypesany', 'core_form');
$descriptions[$desc] = [];
}... | php | public function describe_file_types($types) {
$descriptions = [];
$types = $this->normalize_file_types($types);
foreach ($types as $type) {
if ($type === '*') {
$desc = get_string('filetypesany', 'core_form');
$descriptions[$desc] = [];
}... | [
"public",
"function",
"describe_file_types",
"(",
"$",
"types",
")",
"{",
"$",
"descriptions",
"=",
"[",
"]",
";",
"$",
"types",
"=",
"$",
"this",
"->",
"normalize_file_types",
"(",
"$",
"types",
")",
";",
"foreach",
"(",
"$",
"types",
"as",
"$",
"type... | Describe the list of file types for human user.
Given the list of file types, return a list of human readable
descriptive names of relevant groups, types or file formats.
@param string|array $types
@return object | [
"Describe",
"the",
"list",
"of",
"file",
"types",
"for",
"human",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/classes/filetypes_util.php#L211-L254 |
217,509 | moodle/moodle | lib/form/classes/filetypes_util.php | filetypes_util.expand | public function expand($types, $keepgroups=false, $keepmimetypes=false) {
$expanded = [];
foreach ($this->normalize_file_types($types) as $type) {
if ($group = $this->is_filetype_group($type)) {
foreach ($group->extensions as $ext) {
$expanded[$ext] = tr... | php | public function expand($types, $keepgroups=false, $keepmimetypes=false) {
$expanded = [];
foreach ($this->normalize_file_types($types) as $type) {
if ($group = $this->is_filetype_group($type)) {
foreach ($group->extensions as $ext) {
$expanded[$ext] = tr... | [
"public",
"function",
"expand",
"(",
"$",
"types",
",",
"$",
"keepgroups",
"=",
"false",
",",
"$",
"keepmimetypes",
"=",
"false",
")",
"{",
"$",
"expanded",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"normalize_file_types",
"(",
"$",
"types... | Expands the file types into the list of file extensions.
The groups and mimetypes are expanded into the list of their associated file
extensions. Depending on the $keepgroups and $keepmimetypes, the groups
and mimetypes themselves are either kept in the list or removed.
@param string|array $types
@param bool $keepgro... | [
"Expands",
"the",
"file",
"types",
"into",
"the",
"list",
"of",
"file",
"extensions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/classes/filetypes_util.php#L387-L416 |
217,510 | moodle/moodle | lib/form/classes/filetypes_util.php | filetypes_util.get_not_whitelisted | public function get_not_whitelisted($types, $whitelist) {
$whitelistedtypes = $this->expand($whitelist, true, true);
if (empty($whitelistedtypes) || $whitelistedtypes == ['*']) {
return [];
}
$giventypes = $this->normalize_file_types($types);
if (empty($giventypes... | php | public function get_not_whitelisted($types, $whitelist) {
$whitelistedtypes = $this->expand($whitelist, true, true);
if (empty($whitelistedtypes) || $whitelistedtypes == ['*']) {
return [];
}
$giventypes = $this->normalize_file_types($types);
if (empty($giventypes... | [
"public",
"function",
"get_not_whitelisted",
"(",
"$",
"types",
",",
"$",
"whitelist",
")",
"{",
"$",
"whitelistedtypes",
"=",
"$",
"this",
"->",
"expand",
"(",
"$",
"whitelist",
",",
"true",
",",
"true",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"whitel... | Returns all types that are not part of the give whitelist.
This is similar check to the {@link self::is_whitelisted()} but this one
actually returns the extra types.
@param string|array $types File types to be checked
@param string|array $whitelist An array or string of whitelisted types
@return array Types not prese... | [
"Returns",
"all",
"types",
"that",
"are",
"not",
"part",
"of",
"the",
"give",
"whitelist",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/classes/filetypes_util.php#L443-L458 |
217,511 | moodle/moodle | lib/form/classes/filetypes_util.php | filetypes_util.is_allowed_file_type | public function is_allowed_file_type($filename, $whitelist) {
$allowedextensions = $this->expand($whitelist);
if (empty($allowedextensions) || $allowedextensions == ['*']) {
return true;
}
$haystack = strrev(trim(core_text::strtolower($filename)));
foreach ($allow... | php | public function is_allowed_file_type($filename, $whitelist) {
$allowedextensions = $this->expand($whitelist);
if (empty($allowedextensions) || $allowedextensions == ['*']) {
return true;
}
$haystack = strrev(trim(core_text::strtolower($filename)));
foreach ($allow... | [
"public",
"function",
"is_allowed_file_type",
"(",
"$",
"filename",
",",
"$",
"whitelist",
")",
"{",
"$",
"allowedextensions",
"=",
"$",
"this",
"->",
"expand",
"(",
"$",
"whitelist",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"allowedextensions",
")",
"||",
... | Is the given filename of an allowed file type?
Empty whitelist is interpretted as "any file type is allowed" rather
than "no file can be uploaded".
@param string $filename the file name
@param string|array $whitelist list of allowed file extensions
@return boolean True if the file type is allowed, false if not | [
"Is",
"the",
"given",
"filename",
"of",
"an",
"allowed",
"file",
"type?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/classes/filetypes_util.php#L470-L488 |
217,512 | moodle/moodle | lib/form/classes/filetypes_util.php | filetypes_util.get_unknown_file_types | public function get_unknown_file_types($types) {
$unknown = [];
foreach ($this->normalize_file_types($types) as $type) {
if ($type === '*') {
// Any file is considered as a known type.
continue;
} else if ($type === '.xxx') {
$unkn... | php | public function get_unknown_file_types($types) {
$unknown = [];
foreach ($this->normalize_file_types($types) as $type) {
if ($type === '*') {
// Any file is considered as a known type.
continue;
} else if ($type === '.xxx') {
$unkn... | [
"public",
"function",
"get_unknown_file_types",
"(",
"$",
"types",
")",
"{",
"$",
"unknown",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"normalize_file_types",
"(",
"$",
"types",
")",
"as",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"type",
"... | Returns file types from the list that are not recognized
@param string|array $types list of user-defined file types
@return array A list of unknown file types. | [
"Returns",
"file",
"types",
"from",
"the",
"list",
"that",
"are",
"not",
"recognized"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/classes/filetypes_util.php#L496-L524 |
217,513 | moodle/moodle | lib/lessphp/Tree/Import.php | Less_Tree_Import.ParseImport | public function ParseImport( $full_path, $uri, $env ){
$import_env = clone $env;
if( (isset($this->options['reference']) && $this->options['reference']) || isset($this->currentFileInfo['reference']) ){
$import_env->currentFileInfo['reference'] = true;
}
if( (isset($this->options['multiple']) && $this->opti... | php | public function ParseImport( $full_path, $uri, $env ){
$import_env = clone $env;
if( (isset($this->options['reference']) && $this->options['reference']) || isset($this->currentFileInfo['reference']) ){
$import_env->currentFileInfo['reference'] = true;
}
if( (isset($this->options['multiple']) && $this->opti... | [
"public",
"function",
"ParseImport",
"(",
"$",
"full_path",
",",
"$",
"uri",
",",
"$",
"env",
")",
"{",
"$",
"import_env",
"=",
"clone",
"$",
"env",
";",
"if",
"(",
"(",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'reference'",
"]",
")",
"&&"... | Parse the import url and return the rules
@return Less_Tree_Media|array | [
"Parse",
"the",
"import",
"url",
"and",
"return",
"the",
"rules"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Tree/Import.php#L270-L289 |
217,514 | moodle/moodle | favourites/classes/local/repository/favourite_repository.php | favourite_repository.get_favourite_from_record | protected function get_favourite_from_record(\stdClass $record) : favourite {
$favourite = new favourite(
$record->component,
$record->itemtype,
$record->itemid,
$record->contextid,
$record->userid
);
$favourite->id = $record->id;
... | php | protected function get_favourite_from_record(\stdClass $record) : favourite {
$favourite = new favourite(
$record->component,
$record->itemtype,
$record->itemid,
$record->contextid,
$record->userid
);
$favourite->id = $record->id;
... | [
"protected",
"function",
"get_favourite_from_record",
"(",
"\\",
"stdClass",
"$",
"record",
")",
":",
"favourite",
"{",
"$",
"favourite",
"=",
"new",
"favourite",
"(",
"$",
"record",
"->",
"component",
",",
"$",
"record",
"->",
"itemtype",
",",
"$",
"record"... | Get a favourite object, based on a full record.
@param \stdClass $record the record we wish to hydrate.
@return favourite the favourite record. | [
"Get",
"a",
"favourite",
"object",
"based",
"on",
"a",
"full",
"record",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/favourites/classes/local/repository/favourite_repository.php#L48-L62 |
217,515 | moodle/moodle | favourites/classes/local/repository/favourite_repository.php | favourite_repository.get_list_of_favourites_from_records | protected function get_list_of_favourites_from_records(array $records) {
$list = [];
foreach ($records as $index => $record) {
$list[$index] = $this->get_favourite_from_record($record);
}
return $list;
} | php | protected function get_list_of_favourites_from_records(array $records) {
$list = [];
foreach ($records as $index => $record) {
$list[$index] = $this->get_favourite_from_record($record);
}
return $list;
} | [
"protected",
"function",
"get_list_of_favourites_from_records",
"(",
"array",
"$",
"records",
")",
"{",
"$",
"list",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"records",
"as",
"$",
"index",
"=>",
"$",
"record",
")",
"{",
"$",
"list",
"[",
"$",
"index",
... | Get a list of favourite objects, based on a list of records.
@param array $records the record we wish to hydrate.
@return array the list of favourites. | [
"Get",
"a",
"list",
"of",
"favourite",
"objects",
"based",
"on",
"a",
"list",
"of",
"records",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/favourites/classes/local/repository/favourite_repository.php#L69-L75 |
217,516 | moodle/moodle | favourites/classes/local/repository/favourite_repository.php | favourite_repository.validate | protected function validate(favourite $favourite) {
$favourite = (array)$favourite;
// The allowed fields, and whether or not each is required to create a record.
// The timecreated, timemodified and id fields are generated during create/update.
$allowedfields = [
'userid' ... | php | protected function validate(favourite $favourite) {
$favourite = (array)$favourite;
// The allowed fields, and whether or not each is required to create a record.
// The timecreated, timemodified and id fields are generated during create/update.
$allowedfields = [
'userid' ... | [
"protected",
"function",
"validate",
"(",
"favourite",
"$",
"favourite",
")",
"{",
"$",
"favourite",
"=",
"(",
"array",
")",
"$",
"favourite",
";",
"// The allowed fields, and whether or not each is required to create a record.",
"// The timecreated, timemodified and id fields ... | Basic validation, confirming we have the minimum field set needed to save a record to the store.
@param favourite $favourite the favourite record to validate.
@throws \moodle_exception if the supplied favourite has missing or unsupported fields. | [
"Basic",
"validation",
"confirming",
"we",
"have",
"the",
"minimum",
"field",
"set",
"needed",
"to",
"save",
"a",
"record",
"to",
"the",
"store",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/favourites/classes/local/repository/favourite_repository.php#L83-L113 |
217,517 | moodle/moodle | favourites/classes/local/repository/favourite_repository.php | favourite_repository.add | public function add(favourite $favourite) : favourite {
global $DB;
$this->validate($favourite);
$favourite = (array)$favourite;
$time = time();
$favourite['timecreated'] = $time;
$favourite['timemodified'] = $time;
$id = $DB->insert_record($this->favouritetable, ... | php | public function add(favourite $favourite) : favourite {
global $DB;
$this->validate($favourite);
$favourite = (array)$favourite;
$time = time();
$favourite['timecreated'] = $time;
$favourite['timemodified'] = $time;
$id = $DB->insert_record($this->favouritetable, ... | [
"public",
"function",
"add",
"(",
"favourite",
"$",
"favourite",
")",
":",
"favourite",
"{",
"global",
"$",
"DB",
";",
"$",
"this",
"->",
"validate",
"(",
"$",
"favourite",
")",
";",
"$",
"favourite",
"=",
"(",
"array",
")",
"$",
"favourite",
";",
"$... | Add a favourite to the repository.
@param favourite $favourite the favourite to add.
@return favourite the favourite which has been stored.
@throws \dml_exception if any database errors are encountered.
@throws \moodle_exception if the favourite has missing or invalid properties. | [
"Add",
"a",
"favourite",
"to",
"the",
"repository",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/favourites/classes/local/repository/favourite_repository.php#L123-L132 |
217,518 | moodle/moodle | favourites/classes/local/repository/favourite_repository.php | favourite_repository.add_all | public function add_all(array $items) : array {
global $DB;
$time = time();
foreach ($items as $item) {
$this->validate($item);
$favourite = (array)$item;
$favourite['timecreated'] = $time;
$favourite['timemodified'] = $time;
$ids[] = $... | php | public function add_all(array $items) : array {
global $DB;
$time = time();
foreach ($items as $item) {
$this->validate($item);
$favourite = (array)$item;
$favourite['timecreated'] = $time;
$favourite['timemodified'] = $time;
$ids[] = $... | [
"public",
"function",
"add_all",
"(",
"array",
"$",
"items",
")",
":",
"array",
"{",
"global",
"$",
"DB",
";",
"$",
"time",
"=",
"time",
"(",
")",
";",
"foreach",
"(",
"$",
"items",
"as",
"$",
"item",
")",
"{",
"$",
"this",
"->",
"validate",
"(",... | Add a collection of favourites to the repository.
@param array $items the list of favourites to add.
@return array the list of favourites which have been stored.
@throws \dml_exception if any database errors are encountered.
@throws \moodle_exception if any of the favourites have missing or invalid properties. | [
"Add",
"a",
"collection",
"of",
"favourites",
"to",
"the",
"repository",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/favourites/classes/local/repository/favourite_repository.php#L142-L155 |
217,519 | moodle/moodle | favourites/classes/local/repository/favourite_repository.php | favourite_repository.find | public function find(int $id) : favourite {
global $DB;
$record = $DB->get_record($this->favouritetable, ['id' => $id], '*', MUST_EXIST);
return $this->get_favourite_from_record($record);
} | php | public function find(int $id) : favourite {
global $DB;
$record = $DB->get_record($this->favouritetable, ['id' => $id], '*', MUST_EXIST);
return $this->get_favourite_from_record($record);
} | [
"public",
"function",
"find",
"(",
"int",
"$",
"id",
")",
":",
"favourite",
"{",
"global",
"$",
"DB",
";",
"$",
"record",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"$",
"this",
"->",
"favouritetable",
",",
"[",
"'id'",
"=>",
"$",
"id",
"]",
",",
"... | Find a favourite by id.
@param int $id the id of the favourite.
@return favourite the favourite.
@throws \dml_exception if any database errors are encountered. | [
"Find",
"a",
"favourite",
"by",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/favourites/classes/local/repository/favourite_repository.php#L164-L168 |
217,520 | moodle/moodle | favourites/classes/local/repository/favourite_repository.php | favourite_repository.find_all | public function find_all(int $limitfrom = 0, int $limitnum = 0) : array {
global $DB;
$records = $DB->get_records($this->favouritetable, null, '', '*', $limitfrom, $limitnum);
return $this->get_list_of_favourites_from_records($records);
} | php | public function find_all(int $limitfrom = 0, int $limitnum = 0) : array {
global $DB;
$records = $DB->get_records($this->favouritetable, null, '', '*', $limitfrom, $limitnum);
return $this->get_list_of_favourites_from_records($records);
} | [
"public",
"function",
"find_all",
"(",
"int",
"$",
"limitfrom",
"=",
"0",
",",
"int",
"$",
"limitnum",
"=",
"0",
")",
":",
"array",
"{",
"global",
"$",
"DB",
";",
"$",
"records",
"=",
"$",
"DB",
"->",
"get_records",
"(",
"$",
"this",
"->",
"favouri... | Return all items in this repository, as an array, indexed by id.
@param int $limitfrom optional pagination control for returning a subset of records, starting at this point.
@param int $limitnum optional pagination control for returning a subset comprising this many records.
@return array the list of all favourites st... | [
"Return",
"all",
"items",
"in",
"this",
"repository",
"as",
"an",
"array",
"indexed",
"by",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/favourites/classes/local/repository/favourite_repository.php#L178-L182 |
217,521 | moodle/moodle | favourites/classes/local/repository/favourite_repository.php | favourite_repository.find_favourite | public function find_favourite(int $userid, string $component, string $itemtype, int $itemid, int $contextid) : favourite {
global $DB;
// Favourites model: We know that only one favourite can exist based on these properties.
$record = $DB->get_record($this->favouritetable, [
'userid... | php | public function find_favourite(int $userid, string $component, string $itemtype, int $itemid, int $contextid) : favourite {
global $DB;
// Favourites model: We know that only one favourite can exist based on these properties.
$record = $DB->get_record($this->favouritetable, [
'userid... | [
"public",
"function",
"find_favourite",
"(",
"int",
"$",
"userid",
",",
"string",
"$",
"component",
",",
"string",
"$",
"itemtype",
",",
"int",
"$",
"itemid",
",",
"int",
"$",
"contextid",
")",
":",
"favourite",
"{",
"global",
"$",
"DB",
";",
"// Favouri... | Find a specific favourite, based on the properties known to identify it.
Used if we don't know its id.
@param int $userid the id of the user to which the favourite belongs.
@param string $component the frankenstyle component name.
@param string $itemtype the type of the favourited item.
@param int $itemid the id of t... | [
"Find",
"a",
"specific",
"favourite",
"based",
"on",
"the",
"properties",
"known",
"to",
"identify",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/favourites/classes/local/repository/favourite_repository.php#L212-L223 |
217,522 | moodle/moodle | favourites/classes/local/repository/favourite_repository.php | favourite_repository.exists | public function exists(int $id) : bool {
global $DB;
return $DB->record_exists($this->favouritetable, ['id' => $id]);
} | php | public function exists(int $id) : bool {
global $DB;
return $DB->record_exists($this->favouritetable, ['id' => $id]);
} | [
"public",
"function",
"exists",
"(",
"int",
"$",
"id",
")",
":",
"bool",
"{",
"global",
"$",
"DB",
";",
"return",
"$",
"DB",
"->",
"record_exists",
"(",
"$",
"this",
"->",
"favouritetable",
",",
"[",
"'id'",
"=>",
"$",
"id",
"]",
")",
";",
"}"
] | Check whether a favourite exists in this repository, based on its id.
@param int $id the id to search for.
@return bool true if the favourite exists, false otherwise.
@throws \dml_exception if any database errors are encountered. | [
"Check",
"whether",
"a",
"favourite",
"exists",
"in",
"this",
"repository",
"based",
"on",
"its",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/favourites/classes/local/repository/favourite_repository.php#L232-L235 |
217,523 | moodle/moodle | favourites/classes/local/repository/favourite_repository.php | favourite_repository.update | public function update(favourite $favourite) : favourite {
global $DB;
$time = time();
$favourite->timemodified = $time;
$DB->update_record($this->favouritetable, $favourite);
return $this->find($favourite->id);
} | php | public function update(favourite $favourite) : favourite {
global $DB;
$time = time();
$favourite->timemodified = $time;
$DB->update_record($this->favouritetable, $favourite);
return $this->find($favourite->id);
} | [
"public",
"function",
"update",
"(",
"favourite",
"$",
"favourite",
")",
":",
"favourite",
"{",
"global",
"$",
"DB",
";",
"$",
"time",
"=",
"time",
"(",
")",
";",
"$",
"favourite",
"->",
"timemodified",
"=",
"$",
"time",
";",
"$",
"DB",
"->",
"update... | Update a favourite.
@param favourite $favourite the favourite to update.
@return favourite the updated favourite.
@throws \dml_exception if any database errors are encountered. | [
"Update",
"a",
"favourite",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/favourites/classes/local/repository/favourite_repository.php#L256-L262 |
217,524 | moodle/moodle | admin/tool/recyclebin/classes/course_bin.php | course_bin.store_item | public function store_item($cm) {
global $CFG, $DB;
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
// Get more information.
$modinfo = get_fast_modinfo($cm->course);
if (!isset($modinfo->cms[$cm->id])) {
return; // Can't continue without... | php | public function store_item($cm) {
global $CFG, $DB;
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
// Get more information.
$modinfo = get_fast_modinfo($cm->course);
if (!isset($modinfo->cms[$cm->id])) {
return; // Can't continue without... | [
"public",
"function",
"store_item",
"(",
"$",
"cm",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/backup/util/includes/backup_includes.php'",
")",
";",
"// Get more information.",
"$",
"modinfo",
... | Store a course module in the recycle bin.
@param \stdClass $cm Course module
@throws \moodle_exception | [
"Store",
"a",
"course",
"module",
"in",
"the",
"recycle",
"bin",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/recyclebin/classes/course_bin.php#L96-L194 |
217,525 | moodle/moodle | lib/filestorage/zip_packer.php | zip_packer.archive_to_storage | public function archive_to_storage(array $files, $contextid,
$component, $filearea, $itemid, $filepath, $filename,
$userid = NULL, $ignoreinvalidfiles=true, file_progress $progress = null) {
global $CFG;
$fs = get_file_storage();
check_dir_exists($CFG->tempdir.'/zip');
... | php | public function archive_to_storage(array $files, $contextid,
$component, $filearea, $itemid, $filepath, $filename,
$userid = NULL, $ignoreinvalidfiles=true, file_progress $progress = null) {
global $CFG;
$fs = get_file_storage();
check_dir_exists($CFG->tempdir.'/zip');
... | [
"public",
"function",
"archive_to_storage",
"(",
"array",
"$",
"files",
",",
"$",
"contextid",
",",
"$",
"component",
",",
"$",
"filearea",
",",
"$",
"itemid",
",",
"$",
"filepath",
",",
"$",
"filename",
",",
"$",
"userid",
"=",
"NULL",
",",
"$",
"igno... | Zip files and store the result in file storage.
@param array $files array with full zip paths (including directory information)
as keys (archivepath=>ospathname or archivepath/subdir=>stored_file or archivepath=>array('content_as_string'))
@param int $contextid context ID
@param string $component component
@param stri... | [
"Zip",
"files",
"and",
"store",
"the",
"result",
"in",
"file",
"storage",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/zip_packer.php#L56-L87 |
217,526 | moodle/moodle | lib/filestorage/zip_packer.php | zip_packer.archive_to_pathname | public function archive_to_pathname(array $files, $archivefile,
$ignoreinvalidfiles=true, file_progress $progress = null) {
$ziparch = new zip_archive();
if (!$ziparch->open($archivefile, file_archive::OVERWRITE)) {
return false;
}
$abort = false;
foreach... | php | public function archive_to_pathname(array $files, $archivefile,
$ignoreinvalidfiles=true, file_progress $progress = null) {
$ziparch = new zip_archive();
if (!$ziparch->open($archivefile, file_archive::OVERWRITE)) {
return false;
}
$abort = false;
foreach... | [
"public",
"function",
"archive_to_pathname",
"(",
"array",
"$",
"files",
",",
"$",
"archivefile",
",",
"$",
"ignoreinvalidfiles",
"=",
"true",
",",
"file_progress",
"$",
"progress",
"=",
"null",
")",
"{",
"$",
"ziparch",
"=",
"new",
"zip_archive",
"(",
")",
... | Zip files and store the result in os file.
@param array $files array with zip paths as keys (archivepath=>ospathname or archivepath=>stored_file or archivepath=>array('content_as_string'))
@param string $archivefile path to target zip file
@param bool $ignoreinvalidfiles true means ignore missing or invalid files, fal... | [
"Zip",
"files",
"and",
"store",
"the",
"result",
"in",
"os",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/zip_packer.php#L98-L165 |
217,527 | moodle/moodle | lib/filestorage/zip_packer.php | zip_packer.archive_stored | private function archive_stored($ziparch, $archivepath, $file, file_progress $progress = null) {
$result = $file->archive_file($ziparch, $archivepath);
if (!$result) {
return false;
}
if (!$file->is_directory()) {
return true;
}
$baselength = str... | php | private function archive_stored($ziparch, $archivepath, $file, file_progress $progress = null) {
$result = $file->archive_file($ziparch, $archivepath);
if (!$result) {
return false;
}
if (!$file->is_directory()) {
return true;
}
$baselength = str... | [
"private",
"function",
"archive_stored",
"(",
"$",
"ziparch",
",",
"$",
"archivepath",
",",
"$",
"file",
",",
"file_progress",
"$",
"progress",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"$",
"file",
"->",
"archive_file",
"(",
"$",
"ziparch",
",",
"$",
... | Perform archiving file from stored file.
@param zip_archive $ziparch zip archive instance
@param string $archivepath file path to archive
@param stored_file $file stored_file object
@param file_progress $progress Progress indicator callback or null if not required
@return bool success | [
"Perform",
"archiving",
"file",
"from",
"stored",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/zip_packer.php#L176-L207 |
217,528 | moodle/moodle | lib/filestorage/zip_packer.php | zip_packer.archive_pathname | private function archive_pathname($ziparch, $archivepath, $file,
file_progress $progress = null) {
// Record progress each time this function is called.
if ($progress) {
$progress->progress();
}
if (!file_exists($file)) {
return false;
}
... | php | private function archive_pathname($ziparch, $archivepath, $file,
file_progress $progress = null) {
// Record progress each time this function is called.
if ($progress) {
$progress->progress();
}
if (!file_exists($file)) {
return false;
}
... | [
"private",
"function",
"archive_pathname",
"(",
"$",
"ziparch",
",",
"$",
"archivepath",
",",
"$",
"file",
",",
"file_progress",
"$",
"progress",
"=",
"null",
")",
"{",
"// Record progress each time this function is called.",
"if",
"(",
"$",
"progress",
")",
"{",
... | Perform archiving file from file path.
@param zip_archive $ziparch zip archive instance
@param string $archivepath file path to archive
@param string $file path name of the file
@param file_progress $progress Progress indicator callback or null if not required
@return bool success | [
"Perform",
"archiving",
"file",
"from",
"file",
"path",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/zip_packer.php#L218-L250 |
217,529 | moodle/moodle | lib/phpexcel/PHPExcel/Calculation/Engineering.php | PHPExcel_Calculation_Engineering.nbrConversionFormat | private static function nbrConversionFormat($xVal, $places)
{
if (!is_null($places)) {
if (strlen($xVal) <= $places) {
return substr(str_pad($xVal, $places, '0', STR_PAD_LEFT), -10);
} else {
return PHPExcel_Calculation_Functions::NaN();
}
... | php | private static function nbrConversionFormat($xVal, $places)
{
if (!is_null($places)) {
if (strlen($xVal) <= $places) {
return substr(str_pad($xVal, $places, '0', STR_PAD_LEFT), -10);
} else {
return PHPExcel_Calculation_Functions::NaN();
}
... | [
"private",
"static",
"function",
"nbrConversionFormat",
"(",
"$",
"xVal",
",",
"$",
"places",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"places",
")",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"xVal",
")",
"<=",
"$",
"places",
")",
"{",
"return... | Formats a number base string value with leading zeroes
@param string $xVal The "number" to pad
@param integer $places The length that we want to pad this value
@return string The padded "number" | [
"Formats",
"a",
"number",
"base",
"string",
"value",
"with",
"leading",
"zeroes"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Calculation/Engineering.php#L834-L845 |
217,530 | moodle/moodle | question/type/essay/backup/moodle2/restore_qtype_essay_plugin.class.php | restore_qtype_essay_plugin.after_execute_question | protected function after_execute_question() {
global $DB;
$essayswithoutoptions = $DB->get_records_sql("
SELECT q.*
FROM {question} q
JOIN {backup_ids_temp} bi ON bi.newitemid = q.id
LEFT JOIN {qtype_essay_options} qeo ON ... | php | protected function after_execute_question() {
global $DB;
$essayswithoutoptions = $DB->get_records_sql("
SELECT q.*
FROM {question} q
JOIN {backup_ids_temp} bi ON bi.newitemid = q.id
LEFT JOIN {qtype_essay_options} qeo ON ... | [
"protected",
"function",
"after_execute_question",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"essayswithoutoptions",
"=",
"$",
"DB",
"->",
"get_records_sql",
"(",
"\"\n SELECT q.*\n FROM {question} q\n JOIN {backup_... | When restoring old data, that does not have the essay options information
in the XML, supply defaults. | [
"When",
"restoring",
"old",
"data",
"that",
"does",
"not",
"have",
"the",
"essay",
"options",
"information",
"in",
"the",
"XML",
"supply",
"defaults",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/essay/backup/moodle2/restore_qtype_essay_plugin.class.php#L94-L122 |
217,531 | moodle/moodle | lib/spout/src/Spout/Writer/Common/Sheet.php | Sheet.doesStartOrEndWithSingleQuote | protected function doesStartOrEndWithSingleQuote($name)
{
$startsWithSingleQuote = ($this->stringHelper->getCharFirstOccurrencePosition('\'', $name) === 0);
$endsWithSingleQuote = ($this->stringHelper->getCharLastOccurrencePosition('\'', $name) === ($this->stringHelper->getStringLength($name) - 1));... | php | protected function doesStartOrEndWithSingleQuote($name)
{
$startsWithSingleQuote = ($this->stringHelper->getCharFirstOccurrencePosition('\'', $name) === 0);
$endsWithSingleQuote = ($this->stringHelper->getCharLastOccurrencePosition('\'', $name) === ($this->stringHelper->getStringLength($name) - 1));... | [
"protected",
"function",
"doesStartOrEndWithSingleQuote",
"(",
"$",
"name",
")",
"{",
"$",
"startsWithSingleQuote",
"=",
"(",
"$",
"this",
"->",
"stringHelper",
"->",
"getCharFirstOccurrencePosition",
"(",
"'\\''",
",",
"$",
"name",
")",
"===",
"0",
")",
";",
... | Returns whether the given name starts or ends with a single quote
@param string $name
@return bool TRUE if the name starts or ends with a single quote, FALSE otherwise. | [
"Returns",
"whether",
"the",
"given",
"name",
"starts",
"or",
"ends",
"with",
"a",
"single",
"quote"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/Common/Sheet.php#L159-L165 |
217,532 | moodle/moodle | lib/spout/src/Spout/Writer/Common/Sheet.php | Sheet.isNameUnique | protected function isNameUnique($name)
{
foreach (self::$SHEETS_NAME_USED[$this->associatedWorkbookId] as $sheetIndex => $sheetName) {
if ($sheetIndex !== $this->index && $sheetName === $name) {
return false;
}
}
return true;
} | php | protected function isNameUnique($name)
{
foreach (self::$SHEETS_NAME_USED[$this->associatedWorkbookId] as $sheetIndex => $sheetName) {
if ($sheetIndex !== $this->index && $sheetName === $name) {
return false;
}
}
return true;
} | [
"protected",
"function",
"isNameUnique",
"(",
"$",
"name",
")",
"{",
"foreach",
"(",
"self",
"::",
"$",
"SHEETS_NAME_USED",
"[",
"$",
"this",
"->",
"associatedWorkbookId",
"]",
"as",
"$",
"sheetIndex",
"=>",
"$",
"sheetName",
")",
"{",
"if",
"(",
"$",
"s... | Returns whether the given name is unique.
@param string $name
@return bool TRUE if the name is unique, FALSE otherwise. | [
"Returns",
"whether",
"the",
"given",
"name",
"is",
"unique",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/Common/Sheet.php#L173-L182 |
217,533 | moodle/moodle | report/eventlist/classes/renderer.php | report_eventlist_renderer.render_event_list | public function render_event_list($form, $tabledata) {
global $PAGE;
$title = get_string('pluginname', 'report_eventlist');
// Header.
$html = $this->output->header();
$html .= $this->output->heading($title);
// Form.
ob_start();
$form->display();
... | php | public function render_event_list($form, $tabledata) {
global $PAGE;
$title = get_string('pluginname', 'report_eventlist');
// Header.
$html = $this->output->header();
$html .= $this->output->heading($title);
// Form.
ob_start();
$form->display();
... | [
"public",
"function",
"render_event_list",
"(",
"$",
"form",
",",
"$",
"tabledata",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"title",
"=",
"get_string",
"(",
"'pluginname'",
",",
"'report_eventlist'",
")",
";",
"// Header.",
"$",
"html",
"=",
"$",
"this"... | Renders the event list page with filter form and datatable.
@param eventfilter_form $form Event filter form.
@param array $tabledata An array of event data to be used by the datatable.
@return string HTML to be displayed. | [
"Renders",
"the",
"event",
"list",
"page",
"with",
"filter",
"form",
"and",
"datatable",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/eventlist/classes/renderer.php#L43-L76 |
217,534 | moodle/moodle | lib/ddl/oracle_sql_generator.php | oracle_sql_generator.getTableName | public function getTableName(xmldb_table $xmldb_table, $quoted=true) {
// Get the name, supporting special oci names for temp tables
if ($this->temptables->is_temptable($xmldb_table->getName())) {
$tablename = $this->temptables->get_correct_name($xmldb_table->getName());
} else {
... | php | public function getTableName(xmldb_table $xmldb_table, $quoted=true) {
// Get the name, supporting special oci names for temp tables
if ($this->temptables->is_temptable($xmldb_table->getName())) {
$tablename = $this->temptables->get_correct_name($xmldb_table->getName());
} else {
... | [
"public",
"function",
"getTableName",
"(",
"xmldb_table",
"$",
"xmldb_table",
",",
"$",
"quoted",
"=",
"true",
")",
"{",
"// Get the name, supporting special oci names for temp tables",
"if",
"(",
"$",
"this",
"->",
"temptables",
"->",
"is_temptable",
"(",
"$",
"xml... | Given one xmldb_table, returns it's correct name, depending of all the parametrization
Overridden to allow change of names in temp tables
@param xmldb_table table whose name we want
@param boolean to specify if the name must be quoted (if reserved word, only!)
@return string the correct name of the table | [
"Given",
"one",
"xmldb_table",
"returns",
"it",
"s",
"correct",
"name",
"depending",
"of",
"all",
"the",
"parametrization",
"Overridden",
"to",
"allow",
"change",
"of",
"names",
"in",
"temp",
"tables"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ddl/oracle_sql_generator.php#L118-L132 |
217,535 | moodle/moodle | lib/ddl/oracle_sql_generator.php | oracle_sql_generator.getCreateTriggerSQL | public function getCreateTriggerSQL($xmldb_table, $xmldb_field, $sequence_name) {
$trigger_name = $this->getNameForObject($xmldb_table->getName(), $xmldb_field->getName(), 'trg');
$trigger = "CREATE TRIGGER " . $trigger_name;
$trigger.= "\n BEFORE INSERT";
$trigger.= "\nON " . $this... | php | public function getCreateTriggerSQL($xmldb_table, $xmldb_field, $sequence_name) {
$trigger_name = $this->getNameForObject($xmldb_table->getName(), $xmldb_field->getName(), 'trg');
$trigger = "CREATE TRIGGER " . $trigger_name;
$trigger.= "\n BEFORE INSERT";
$trigger.= "\nON " . $this... | [
"public",
"function",
"getCreateTriggerSQL",
"(",
"$",
"xmldb_table",
",",
"$",
"xmldb_field",
",",
"$",
"sequence_name",
")",
"{",
"$",
"trigger_name",
"=",
"$",
"this",
"->",
"getNameForObject",
"(",
"$",
"xmldb_table",
"->",
"getName",
"(",
")",
",",
"$",... | Returns the code needed to create one trigger for the xmldb_table and xmldb_field passed
@param xmldb_table $xmldb_table The xmldb_table object instance.
@param xmldb_field $xmldb_field The xmldb_field object instance.
@param string $sequence_name
@return array Array of SQL statements to create the sequence. | [
"Returns",
"the",
"code",
"needed",
"to",
"create",
"one",
"trigger",
"for",
"the",
"xmldb_table",
"and",
"xmldb_field",
"passed"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ddl/oracle_sql_generator.php#L301-L316 |
217,536 | moodle/moodle | lib/ddl/oracle_sql_generator.php | oracle_sql_generator.getDropSequenceSQL | public function getDropSequenceSQL($xmldb_table, $xmldb_field, $include_trigger=false) {
$result = array();
if ($sequence_name = $this->getSequenceFromDB($xmldb_table)) {
$result[] = "DROP SEQUENCE " . $sequence_name;
}
if ($trigger_name = $this->getTriggerFromDB($xmldb_ta... | php | public function getDropSequenceSQL($xmldb_table, $xmldb_field, $include_trigger=false) {
$result = array();
if ($sequence_name = $this->getSequenceFromDB($xmldb_table)) {
$result[] = "DROP SEQUENCE " . $sequence_name;
}
if ($trigger_name = $this->getTriggerFromDB($xmldb_ta... | [
"public",
"function",
"getDropSequenceSQL",
"(",
"$",
"xmldb_table",
",",
"$",
"xmldb_field",
",",
"$",
"include_trigger",
"=",
"false",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"sequence_name",
"=",
"$",
"this",
"->",
"getSe... | Returns the code needed to drop one sequence for the xmldb_table and xmldb_field passed
Can, optionally, specify if the underlying trigger will be also dropped
@param xmldb_table $xmldb_table The xmldb_table object instance.
@param xmldb_field $xmldb_field The xmldb_field object instance.
@param bool $include_trigger
... | [
"Returns",
"the",
"code",
"needed",
"to",
"drop",
"one",
"sequence",
"for",
"the",
"xmldb_table",
"and",
"xmldb_field",
"passed",
"Can",
"optionally",
"specify",
"if",
"the",
"underlying",
"trigger",
"will",
"be",
"also",
"dropped"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/ddl/oracle_sql_generator.php#L327-L340 |
217,537 | moodle/moodle | question/type/calculated/backup/moodle1/lib.php | moodle1_qtype_calculated_handler.process_question | public function process_question(array $data, array $raw) {
// Convert and write the answers first.
if (isset($data['answers'])) {
$this->write_answers($data['answers'], $this->pluginname);
}
// Convert and write the numerical units and numerical options.
if (isset(... | php | public function process_question(array $data, array $raw) {
// Convert and write the answers first.
if (isset($data['answers'])) {
$this->write_answers($data['answers'], $this->pluginname);
}
// Convert and write the numerical units and numerical options.
if (isset(... | [
"public",
"function",
"process_question",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"raw",
")",
"{",
"// Convert and write the answers first.",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'answers'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"write_answers"... | Appends the calculated specific information to the question | [
"Appends",
"the",
"calculated",
"specific",
"information",
"to",
"the",
"question"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/calculated/backup/moodle1/lib.php#L47-L106 |
217,538 | moodle/moodle | backup/cc/cc_lib/cc_utils.php | cc_helpers.uuidgen | public static function uuidgen($prefix = '', $suffix = '', $uppercase = true) {
$uuid = trim(sprintf('%s%04x%04x%s', $prefix, mt_rand(0, 65535), mt_rand(0, 65535), $suffix));
$result = $uppercase ? strtoupper($uuid) : strtolower($uuid);
return $result;
} | php | public static function uuidgen($prefix = '', $suffix = '', $uppercase = true) {
$uuid = trim(sprintf('%s%04x%04x%s', $prefix, mt_rand(0, 65535), mt_rand(0, 65535), $suffix));
$result = $uppercase ? strtoupper($uuid) : strtolower($uuid);
return $result;
} | [
"public",
"static",
"function",
"uuidgen",
"(",
"$",
"prefix",
"=",
"''",
",",
"$",
"suffix",
"=",
"''",
",",
"$",
"uppercase",
"=",
"true",
")",
"{",
"$",
"uuid",
"=",
"trim",
"(",
"sprintf",
"(",
"'%s%04x%04x%s'",
",",
"$",
"prefix",
",",
"mt_rand"... | Generates unique identifier
@param string $prefix
@param string $suffix
@return string | [
"Generates",
"unique",
"identifier"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/cc/cc_lib/cc_utils.php#L50-L54 |
217,539 | moodle/moodle | backup/cc/cc_lib/cc_utils.php | cc_helpers.randomdir | public static function randomdir($where, $prefix = '', $suffix = '') {
global $CFG;
$dirname = false;
$randomname = self::uuidgen($prefix, $suffix, false);
$newdirname = $where.DIRECTORY_SEPARATOR.$randomname;
if (mkdir($newdirname)) {
chmod($newdirname, $CFG->dir... | php | public static function randomdir($where, $prefix = '', $suffix = '') {
global $CFG;
$dirname = false;
$randomname = self::uuidgen($prefix, $suffix, false);
$newdirname = $where.DIRECTORY_SEPARATOR.$randomname;
if (mkdir($newdirname)) {
chmod($newdirname, $CFG->dir... | [
"public",
"static",
"function",
"randomdir",
"(",
"$",
"where",
",",
"$",
"prefix",
"=",
"''",
",",
"$",
"suffix",
"=",
"''",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"dirname",
"=",
"false",
";",
"$",
"randomname",
"=",
"self",
"::",
"uuidgen",
"... | Creates new folder with random name
@param string $where
@param string $prefix
@param string $suffix
@return mixed - directory short name or false in case of failure | [
"Creates",
"new",
"folder",
"with",
"random",
"name"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/cc/cc_lib/cc_utils.php#L63-L74 |
217,540 | moodle/moodle | lib/mustache/src/Mustache/Tokenizer.php | Mustache_Tokenizer.reset | private function reset()
{
$this->state = self::IN_TEXT;
$this->tagType = null;
$this->buffer = '';
$this->tokens = array();
$this->seenTag = false;
$this->line = 0;
$this->otag = '{{';
$this->ctag = '}}';
$this->otagLen = 2;
... | php | private function reset()
{
$this->state = self::IN_TEXT;
$this->tagType = null;
$this->buffer = '';
$this->tokens = array();
$this->seenTag = false;
$this->line = 0;
$this->otag = '{{';
$this->ctag = '}}';
$this->otagLen = 2;
... | [
"private",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"state",
"=",
"self",
"::",
"IN_TEXT",
";",
"$",
"this",
"->",
"tagType",
"=",
"null",
";",
"$",
"this",
"->",
"buffer",
"=",
"''",
";",
"$",
"this",
"->",
"tokens",
"=",
"array",
... | Helper function to reset tokenizer internal state. | [
"Helper",
"function",
"to",
"reset",
"tokenizer",
"internal",
"state",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Tokenizer.php#L220-L232 |
217,541 | moodle/moodle | lib/mustache/src/Mustache/Tokenizer.php | Mustache_Tokenizer.flushBuffer | private function flushBuffer()
{
if (strlen($this->buffer) > 0) {
$this->tokens[] = array(
self::TYPE => self::T_TEXT,
self::LINE => $this->line,
self::VALUE => $this->buffer,
);
$this->buffer = '';
}
} | php | private function flushBuffer()
{
if (strlen($this->buffer) > 0) {
$this->tokens[] = array(
self::TYPE => self::T_TEXT,
self::LINE => $this->line,
self::VALUE => $this->buffer,
);
$this->buffer = '';
}
} | [
"private",
"function",
"flushBuffer",
"(",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"this",
"->",
"buffer",
")",
">",
"0",
")",
"{",
"$",
"this",
"->",
"tokens",
"[",
"]",
"=",
"array",
"(",
"self",
"::",
"TYPE",
"=>",
"self",
"::",
"T_TEXT",
","... | Flush the current buffer to a token. | [
"Flush",
"the",
"current",
"buffer",
"to",
"a",
"token",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Tokenizer.php#L237-L247 |
217,542 | moodle/moodle | lib/mustache/src/Mustache/Tokenizer.php | Mustache_Tokenizer.changeDelimiters | private function changeDelimiters($text, $index)
{
$startIndex = strpos($text, '=', $index) + 1;
$close = '=' . $this->ctag;
$closeIndex = strpos($text, $close, $index);
$this->setDelimiters(trim(substr($text, $startIndex, $closeIndex - $startIndex)));
$this->tokens[] ... | php | private function changeDelimiters($text, $index)
{
$startIndex = strpos($text, '=', $index) + 1;
$close = '=' . $this->ctag;
$closeIndex = strpos($text, $close, $index);
$this->setDelimiters(trim(substr($text, $startIndex, $closeIndex - $startIndex)));
$this->tokens[] ... | [
"private",
"function",
"changeDelimiters",
"(",
"$",
"text",
",",
"$",
"index",
")",
"{",
"$",
"startIndex",
"=",
"strpos",
"(",
"$",
"text",
",",
"'='",
",",
"$",
"index",
")",
"+",
"1",
";",
"$",
"close",
"=",
"'='",
".",
"$",
"this",
"->",
"ct... | Change the current Mustache delimiters. Set new `otag` and `ctag` values.
@param string $text Mustache template source
@param int $index Current tokenizer index
@return int New index value | [
"Change",
"the",
"current",
"Mustache",
"delimiters",
".",
"Set",
"new",
"otag",
"and",
"ctag",
"values",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Tokenizer.php#L257-L271 |
217,543 | moodle/moodle | lib/mustache/src/Mustache/Tokenizer.php | Mustache_Tokenizer.setDelimiters | private function setDelimiters($delimiters)
{
list($otag, $ctag) = explode(' ', $delimiters);
$this->otag = $otag;
$this->ctag = $ctag;
$this->otagLen = strlen($otag);
$this->ctagLen = strlen($ctag);
} | php | private function setDelimiters($delimiters)
{
list($otag, $ctag) = explode(' ', $delimiters);
$this->otag = $otag;
$this->ctag = $ctag;
$this->otagLen = strlen($otag);
$this->ctagLen = strlen($ctag);
} | [
"private",
"function",
"setDelimiters",
"(",
"$",
"delimiters",
")",
"{",
"list",
"(",
"$",
"otag",
",",
"$",
"ctag",
")",
"=",
"explode",
"(",
"' '",
",",
"$",
"delimiters",
")",
";",
"$",
"this",
"->",
"otag",
"=",
"$",
"otag",
";",
"$",
"this",
... | Set the current Mustache `otag` and `ctag` delimiters.
@param string $delimiters | [
"Set",
"the",
"current",
"Mustache",
"otag",
"and",
"ctag",
"delimiters",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Tokenizer.php#L278-L285 |
217,544 | moodle/moodle | lib/mustache/src/Mustache/Tokenizer.php | Mustache_Tokenizer.addPragma | private function addPragma($text, $index)
{
$end = strpos($text, $this->ctag, $index);
$pragma = trim(substr($text, $index + 2, $end - $index - 2));
// Pragmas are hoisted to the front of the template.
array_unshift($this->tokens, array(
self::TYPE => self::T_PRAGMA,
... | php | private function addPragma($text, $index)
{
$end = strpos($text, $this->ctag, $index);
$pragma = trim(substr($text, $index + 2, $end - $index - 2));
// Pragmas are hoisted to the front of the template.
array_unshift($this->tokens, array(
self::TYPE => self::T_PRAGMA,
... | [
"private",
"function",
"addPragma",
"(",
"$",
"text",
",",
"$",
"index",
")",
"{",
"$",
"end",
"=",
"strpos",
"(",
"$",
"text",
",",
"$",
"this",
"->",
"ctag",
",",
"$",
"index",
")",
";",
"$",
"pragma",
"=",
"trim",
"(",
"substr",
"(",
"$",
"t... | Add pragma token.
Pragmas are hoisted to the front of the template, so all pragma tokens
will appear at the front of the token list.
@param string $text
@param int $index
@return int New index value | [
"Add",
"pragma",
"token",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Tokenizer.php#L298-L311 |
217,545 | moodle/moodle | lib/mustache/src/Mustache/Tokenizer.php | Mustache_Tokenizer.tagChange | private function tagChange($tag, $tagLen, $text, $index)
{
return substr($text, $index, $tagLen) === $tag;
} | php | private function tagChange($tag, $tagLen, $text, $index)
{
return substr($text, $index, $tagLen) === $tag;
} | [
"private",
"function",
"tagChange",
"(",
"$",
"tag",
",",
"$",
"tagLen",
",",
"$",
"text",
",",
"$",
"index",
")",
"{",
"return",
"substr",
"(",
"$",
"text",
",",
"$",
"index",
",",
"$",
"tagLen",
")",
"===",
"$",
"tag",
";",
"}"
] | Test whether it's time to change tags.
@param string $tag Current tag name
@param int $tagLen Current tag name length
@param string $text Mustache template source
@param int $index Current tokenizer index
@return bool True if this is a closing section tag | [
"Test",
"whether",
"it",
"s",
"time",
"to",
"change",
"tags",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Tokenizer.php#L323-L326 |
217,546 | moodle/moodle | lib/google/src/Google/Config.php | Google_Config.setAuthClass | public function setAuthClass($class)
{
$prev = $this->configuration['auth_class'];
if (!isset($this->configuration['classes'][$class]) &&
isset($this->configuration['classes'][$prev])) {
$this->configuration['classes'][$class] =
$this->configuration['classes'][$prev];
}
$this->... | php | public function setAuthClass($class)
{
$prev = $this->configuration['auth_class'];
if (!isset($this->configuration['classes'][$class]) &&
isset($this->configuration['classes'][$prev])) {
$this->configuration['classes'][$class] =
$this->configuration['classes'][$prev];
}
$this->... | [
"public",
"function",
"setAuthClass",
"(",
"$",
"class",
")",
"{",
"$",
"prev",
"=",
"$",
"this",
"->",
"configuration",
"[",
"'auth_class'",
"]",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"configuration",
"[",
"'classes'",
"]",
"[",
"$",
... | Set the auth class.
@param $class string the class name to set | [
"Set",
"the",
"auth",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/google/src/Google/Config.php#L223-L232 |
217,547 | moodle/moodle | lib/google/src/Google/Config.php | Google_Config.setIoClass | public function setIoClass($class)
{
$prev = $this->configuration['io_class'];
if (!isset($this->configuration['classes'][$class]) &&
isset($this->configuration['classes'][$prev])) {
$this->configuration['classes'][$class] =
$this->configuration['classes'][$prev];
}
$this->conf... | php | public function setIoClass($class)
{
$prev = $this->configuration['io_class'];
if (!isset($this->configuration['classes'][$class]) &&
isset($this->configuration['classes'][$prev])) {
$this->configuration['classes'][$class] =
$this->configuration['classes'][$prev];
}
$this->conf... | [
"public",
"function",
"setIoClass",
"(",
"$",
"class",
")",
"{",
"$",
"prev",
"=",
"$",
"this",
"->",
"configuration",
"[",
"'io_class'",
"]",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"configuration",
"[",
"'classes'",
"]",
"[",
"$",
"cl... | Set the IO class.
@param $class string the class name to set | [
"Set",
"the",
"IO",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/google/src/Google/Config.php#L239-L248 |
217,548 | moodle/moodle | lib/google/src/Google/Config.php | Google_Config.setCacheClass | public function setCacheClass($class)
{
$prev = $this->configuration['cache_class'];
if (!isset($this->configuration['classes'][$class]) &&
isset($this->configuration['classes'][$prev])) {
$this->configuration['classes'][$class] =
$this->configuration['classes'][$prev];
}
$this... | php | public function setCacheClass($class)
{
$prev = $this->configuration['cache_class'];
if (!isset($this->configuration['classes'][$class]) &&
isset($this->configuration['classes'][$prev])) {
$this->configuration['classes'][$class] =
$this->configuration['classes'][$prev];
}
$this... | [
"public",
"function",
"setCacheClass",
"(",
"$",
"class",
")",
"{",
"$",
"prev",
"=",
"$",
"this",
"->",
"configuration",
"[",
"'cache_class'",
"]",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"configuration",
"[",
"'classes'",
"]",
"[",
"$",... | Set the cache class.
@param $class string the class name to set | [
"Set",
"the",
"cache",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/google/src/Google/Config.php#L255-L264 |
217,549 | moodle/moodle | lib/google/src/Google/Config.php | Google_Config.setLoggerClass | public function setLoggerClass($class)
{
$prev = $this->configuration['logger_class'];
if (!isset($this->configuration['classes'][$class]) &&
isset($this->configuration['classes'][$prev])) {
$this->configuration['classes'][$class] =
$this->configuration['classes'][$prev];
}
$th... | php | public function setLoggerClass($class)
{
$prev = $this->configuration['logger_class'];
if (!isset($this->configuration['classes'][$class]) &&
isset($this->configuration['classes'][$prev])) {
$this->configuration['classes'][$class] =
$this->configuration['classes'][$prev];
}
$th... | [
"public",
"function",
"setLoggerClass",
"(",
"$",
"class",
")",
"{",
"$",
"prev",
"=",
"$",
"this",
"->",
"configuration",
"[",
"'logger_class'",
"]",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"configuration",
"[",
"'classes'",
"]",
"[",
"$... | Set the logger class.
@param $class string the class name to set | [
"Set",
"the",
"logger",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/google/src/Google/Config.php#L271-L280 |
217,550 | moodle/moodle | lib/google/src/Google/Config.php | Google_Config.setAuthConfig | private function setAuthConfig($key, $value)
{
if (!isset($this->configuration['classes'][$this->getAuthClass()])) {
$this->configuration['classes'][$this->getAuthClass()] = array();
}
$this->configuration['classes'][$this->getAuthClass()][$key] = $value;
} | php | private function setAuthConfig($key, $value)
{
if (!isset($this->configuration['classes'][$this->getAuthClass()])) {
$this->configuration['classes'][$this->getAuthClass()] = array();
}
$this->configuration['classes'][$this->getAuthClass()][$key] = $value;
} | [
"private",
"function",
"setAuthConfig",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"configuration",
"[",
"'classes'",
"]",
"[",
"$",
"this",
"->",
"getAuthClass",
"(",
")",
"]",
")",
")",
"{",
"$"... | Set the auth configuration for the current auth class.
@param $key - the key to set
@param $value - the parameter value | [
"Set",
"the",
"auth",
"configuration",
"for",
"the",
"current",
"auth",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/google/src/Google/Config.php#L449-L455 |
217,551 | moodle/moodle | notes/externallib.php | core_notes_external.get_notes | public static function get_notes($notes) {
global $CFG;
$params = self::validate_parameters(self::get_notes_parameters(), array('notes' => $notes));
// Check if note system is enabled.
if (!$CFG->enablenotes) {
throw new moodle_exception('notesdisabled', 'notes');
}
... | php | public static function get_notes($notes) {
global $CFG;
$params = self::validate_parameters(self::get_notes_parameters(), array('notes' => $notes));
// Check if note system is enabled.
if (!$CFG->enablenotes) {
throw new moodle_exception('notesdisabled', 'notes');
}
... | [
"public",
"static",
"function",
"get_notes",
"(",
"$",
"notes",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_notes_parameters",
"(",
")",
",",
"array",
"(",
"'notes'",
"=>",
"$",
"n... | Get notes about users.
@param array $notes An array of ids for the notes to retrieve.
@return null
@since Moodle 2.5 | [
"Get",
"notes",
"about",
"users",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/notes/externallib.php#L290-L327 |
217,552 | moodle/moodle | notes/externallib.php | core_notes_external.get_notes_returns | public static function get_notes_returns() {
return new external_single_structure(
array(
'notes' => new external_multiple_structure(
new external_single_structure(
array(
'noteid' => new external_value(PARAM_INT... | php | public static function get_notes_returns() {
return new external_single_structure(
array(
'notes' => new external_multiple_structure(
new external_single_structure(
array(
'noteid' => new external_value(PARAM_INT... | [
"public",
"static",
"function",
"get_notes_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'notes'",
"=>",
"new",
"external_multiple_structure",
"(",
"new",
"external_single_structure",
"(",
"array",
"(",
"'noteid'",
"=>",
... | Returns description of get_notes result value.
@return external_description
@since Moodle 2.5 | [
"Returns",
"description",
"of",
"get_notes",
"result",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/notes/externallib.php#L335-L357 |
217,553 | moodle/moodle | notes/externallib.php | core_notes_external.update_notes_parameters | public static function update_notes_parameters() {
return new external_function_parameters(
array(
'notes' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new external_value(PARA... | php | public static function update_notes_parameters() {
return new external_function_parameters(
array(
'notes' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new external_value(PARA... | [
"public",
"static",
"function",
"update_notes_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"array",
"(",
"'notes'",
"=>",
"new",
"external_multiple_structure",
"(",
"new",
"external_single_structure",
"(",
"array",
"(",
"'id'",
"=>... | Returns description of update_notes parameters.
@return external_function_parameters
@since Moodle 2.5 | [
"Returns",
"description",
"of",
"update_notes",
"parameters",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/notes/externallib.php#L365-L380 |
217,554 | moodle/moodle | notes/externallib.php | core_notes_external.update_notes | public static function update_notes($notes = array()) {
global $CFG, $DB;
$params = self::validate_parameters(self::update_notes_parameters(), array('notes' => $notes));
// Check if note system is enabled.
if (!$CFG->enablenotes) {
throw new moodle_exception('notesdisabled'... | php | public static function update_notes($notes = array()) {
global $CFG, $DB;
$params = self::validate_parameters(self::update_notes_parameters(), array('notes' => $notes));
// Check if note system is enabled.
if (!$CFG->enablenotes) {
throw new moodle_exception('notesdisabled'... | [
"public",
"static",
"function",
"update_notes",
"(",
"$",
"notes",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"update_notes_parameters",
"(",
")... | Update notes about users.
@param array $notes An array of ids for the notes to update.
@return array fail infos.
@since Moodle 2.2 | [
"Update",
"notes",
"about",
"users",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/notes/externallib.php#L389-L445 |
217,555 | moodle/moodle | notes/externallib.php | core_notes_external.create_note_list | protected static function create_note_list($courseid, $context, $userid, $state, $author = 0) {
$results = array();
$notes = note_list($courseid, $userid, $state, $author);
foreach ($notes as $key => $note) {
$note = (array)$note;
list($note['content'], $note['format']) =... | php | protected static function create_note_list($courseid, $context, $userid, $state, $author = 0) {
$results = array();
$notes = note_list($courseid, $userid, $state, $author);
foreach ($notes as $key => $note) {
$note = (array)$note;
list($note['content'], $note['format']) =... | [
"protected",
"static",
"function",
"create_note_list",
"(",
"$",
"courseid",
",",
"$",
"context",
",",
"$",
"userid",
",",
"$",
"state",
",",
"$",
"author",
"=",
"0",
")",
"{",
"$",
"results",
"=",
"array",
"(",
")",
";",
"$",
"notes",
"=",
"note_lis... | Create a notes list
@param int $courseid ID of the Course
@param stdClass $context context object
@param int $userid ID of the User
@param int $state
@param int $author
@return array of notes
@since Moodle 2.9 | [
"Create",
"a",
"notes",
"list"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/notes/externallib.php#L487-L501 |
217,556 | moodle/moodle | notes/externallib.php | core_notes_external.get_course_notes | public static function get_course_notes($courseid, $userid = 0) {
global $CFG, $USER;
if (empty($CFG->enablenotes)) {
throw new moodle_exception('notesdisabled', 'notes');
}
$warnings = array();
$arrayparams = array(
'courseid' => $courseid,
... | php | public static function get_course_notes($courseid, $userid = 0) {
global $CFG, $USER;
if (empty($CFG->enablenotes)) {
throw new moodle_exception('notesdisabled', 'notes');
}
$warnings = array();
$arrayparams = array(
'courseid' => $courseid,
... | [
"public",
"static",
"function",
"get_course_notes",
"(",
"$",
"courseid",
",",
"$",
"userid",
"=",
"0",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"USER",
";",
"if",
"(",
"empty",
"(",
"$",
"CFG",
"->",
"enablenotes",
")",
")",
"{",
"throw",
"new",
... | Get a list of course notes
@param int $courseid ID of the Course
@param int $userid ID of the User
@return array of site, course and personal notes and warnings
@since Moodle 2.9
@throws moodle_exception | [
"Get",
"a",
"list",
"of",
"course",
"notes"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/notes/externallib.php#L512-L586 |
217,557 | moodle/moodle | notes/externallib.php | core_notes_external.get_note_structure | protected static function get_note_structure() {
return array(
'id' => new external_value(PARAM_INT, 'id of this note'),
'courseid' => new external_value(PARAM_INT, 'id of the course'),
'userid' => new external_value(PARAM_INT, '... | php | protected static function get_note_structure() {
return array(
'id' => new external_value(PARAM_INT, 'id of this note'),
'courseid' => new external_value(PARAM_INT, 'id of the course'),
'userid' => new external_value(PARAM_INT, '... | [
"protected",
"static",
"function",
"get_note_structure",
"(",
")",
"{",
"return",
"array",
"(",
"'id'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'id of this note'",
")",
",",
"'courseid'",
"=>",
"new",
"external_value",
"(",
"PARAM_INT",
",",
"'id ... | Returns array of note structure
@return external_description
@since Moodle 2.9 | [
"Returns",
"array",
"of",
"note",
"structure"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/notes/externallib.php#L594-L606 |
217,558 | moodle/moodle | lib/classes/plugininfo/base.php | base.make_plugin_instance | protected static function make_plugin_instance($type, $typerootdir, $name, $namerootdir, $typeclass, $pluginman) {
$plugin = new $typeclass();
$plugin->type = $type;
$plugin->typerootdir = $typerootdir;
$plugin->name = $name;
$plugin->rootdir = $nam... | php | protected static function make_plugin_instance($type, $typerootdir, $name, $namerootdir, $typeclass, $pluginman) {
$plugin = new $typeclass();
$plugin->type = $type;
$plugin->typerootdir = $typerootdir;
$plugin->name = $name;
$plugin->rootdir = $nam... | [
"protected",
"static",
"function",
"make_plugin_instance",
"(",
"$",
"type",
",",
"$",
"typerootdir",
",",
"$",
"name",
",",
"$",
"namerootdir",
",",
"$",
"typeclass",
",",
"$",
"pluginman",
")",
"{",
"$",
"plugin",
"=",
"new",
"$",
"typeclass",
"(",
")"... | Makes a new instance of the plugininfo class
@param string $type the plugin type, eg. 'mod'
@param string $typerootdir full path to the location of all the plugins of this type
@param string $name the plugin name, eg. 'workshop'
@param string $namerootdir full path to the location of the plugin
@param string $typeclas... | [
"Makes",
"a",
"new",
"instance",
"of",
"the",
"plugininfo",
"class"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/plugininfo/base.php#L134-L148 |
217,559 | moodle/moodle | lib/classes/plugininfo/base.php | base.is_installed_and_upgraded | public function is_installed_and_upgraded() {
if (!$this->rootdir) {
return false;
}
if ($this->versiondb === null and $this->versiondisk === null) {
// There is no version.php or version info inside it.
return false;
}
return ((float)$this->v... | php | public function is_installed_and_upgraded() {
if (!$this->rootdir) {
return false;
}
if ($this->versiondb === null and $this->versiondisk === null) {
// There is no version.php or version info inside it.
return false;
}
return ((float)$this->v... | [
"public",
"function",
"is_installed_and_upgraded",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"rootdir",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"versiondb",
"===",
"null",
"and",
"$",
"this",
"->",
"versiondisk",
"=... | Is this plugin already installed and updated?
@return bool true if plugin installed and upgraded. | [
"Is",
"this",
"plugin",
"already",
"installed",
"and",
"updated?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/plugininfo/base.php#L154-L164 |
217,560 | moodle/moodle | lib/classes/plugininfo/base.php | base.is_core_dependency_satisfied | public function is_core_dependency_satisfied($moodleversion) {
if (empty($this->versionrequires)) {
return true;
} else {
return (double)$this->versionrequires <= (double)$moodleversion;
}
} | php | public function is_core_dependency_satisfied($moodleversion) {
if (empty($this->versionrequires)) {
return true;
} else {
return (double)$this->versionrequires <= (double)$moodleversion;
}
} | [
"public",
"function",
"is_core_dependency_satisfied",
"(",
"$",
"moodleversion",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"versionrequires",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"(",
"double",
")",
"$",
"this",
"... | Returns true if the the given Moodle version is enough to run this plugin
@param string|int|double $moodleversion
@return bool | [
"Returns",
"true",
"if",
"the",
"the",
"given",
"Moodle",
"version",
"is",
"enough",
"to",
"run",
"this",
"plugin"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/plugininfo/base.php#L334-L342 |
217,561 | moodle/moodle | lib/classes/plugininfo/base.php | base.get_status | public function get_status() {
$pluginman = $this->pluginman;
if (is_null($this->versiondb) and is_null($this->versiondisk)) {
return core_plugin_manager::PLUGIN_STATUS_NODB;
} else if (is_null($this->versiondb) and !is_null($this->versiondisk)) {
return core_plugin_ma... | php | public function get_status() {
$pluginman = $this->pluginman;
if (is_null($this->versiondb) and is_null($this->versiondisk)) {
return core_plugin_manager::PLUGIN_STATUS_NODB;
} else if (is_null($this->versiondb) and !is_null($this->versiondisk)) {
return core_plugin_ma... | [
"public",
"function",
"get_status",
"(",
")",
"{",
"$",
"pluginman",
"=",
"$",
"this",
"->",
"pluginman",
";",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"versiondb",
")",
"and",
"is_null",
"(",
"$",
"this",
"->",
"versiondisk",
")",
")",
"{",
"re... | Returns the status of the plugin
@return string one of core_plugin_manager::PLUGIN_STATUS_xxx constants | [
"Returns",
"the",
"status",
"of",
"the",
"plugin"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/plugininfo/base.php#L349-L381 |
217,562 | moodle/moodle | lib/classes/plugininfo/base.php | base.is_enabled | public function is_enabled() {
if (!$this->rootdir) {
// Plugin missing.
return false;
}
$enabled = $this->pluginman->get_enabled_plugins($this->type);
if (!is_array($enabled)) {
return null;
}
return isset($enabled[$this->name]);
... | php | public function is_enabled() {
if (!$this->rootdir) {
// Plugin missing.
return false;
}
$enabled = $this->pluginman->get_enabled_plugins($this->type);
if (!is_array($enabled)) {
return null;
}
return isset($enabled[$this->name]);
... | [
"public",
"function",
"is_enabled",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"rootdir",
")",
"{",
"// Plugin missing.",
"return",
"false",
";",
"}",
"$",
"enabled",
"=",
"$",
"this",
"->",
"pluginman",
"->",
"get_enabled_plugins",
"(",
"$",
"thi... | Returns the information about plugin availability
True means that the plugin is enabled. False means that the plugin is
disabled. Null means that the information is not available, or the
plugin does not support configurable availability or the availability
can not be changed.
@return null|bool | [
"Returns",
"the",
"information",
"about",
"plugin",
"availability"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/plugininfo/base.php#L393-L406 |
217,563 | moodle/moodle | lib/classes/plugininfo/base.php | base.available_updates | public function available_updates() {
if ($this->availableupdates === null) {
// Lazy load the information about available updates.
$this->availableupdates = $this->pluginman->load_available_updates_for_plugin($this->component);
}
if (empty($this->availableupdates) or !... | php | public function available_updates() {
if ($this->availableupdates === null) {
// Lazy load the information about available updates.
$this->availableupdates = $this->pluginman->load_available_updates_for_plugin($this->component);
}
if (empty($this->availableupdates) or !... | [
"public",
"function",
"available_updates",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"availableupdates",
"===",
"null",
")",
"{",
"// Lazy load the information about available updates.",
"$",
"this",
"->",
"availableupdates",
"=",
"$",
"this",
"->",
"pluginman",
... | If there are updates for this plugin available, returns them.
Returns array of {@link \core\update\info} objects, if some update
is available. Returns null if there is no update available or if the update
availability is unknown.
Populates the property {@link $availableupdates} on first call (lazy
loading).
@return ... | [
"If",
"there",
"are",
"updates",
"for",
"this",
"plugin",
"available",
"returns",
"them",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/plugininfo/base.php#L420-L445 |
217,564 | moodle/moodle | lib/classes/plugininfo/base.php | base.get_settings_url | public function get_settings_url() {
$section = $this->get_settings_section_name();
if ($section === null) {
return null;
}
$settings = admin_get_root()->locate($section);
if ($settings && $settings instanceof \admin_settingpage) {
return new moodle_url('/... | php | public function get_settings_url() {
$section = $this->get_settings_section_name();
if ($section === null) {
return null;
}
$settings = admin_get_root()->locate($section);
if ($settings && $settings instanceof \admin_settingpage) {
return new moodle_url('/... | [
"public",
"function",
"get_settings_url",
"(",
")",
"{",
"$",
"section",
"=",
"$",
"this",
"->",
"get_settings_section_name",
"(",
")",
";",
"if",
"(",
"$",
"section",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"$",
"settings",
"=",
"admin_get_... | Returns the URL of the plugin settings screen
Null value means that the plugin either does not have the settings screen
or its location is not available via this library.
@return null|moodle_url | [
"Returns",
"the",
"URL",
"of",
"the",
"plugin",
"settings",
"screen"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/plugininfo/base.php#L464-L477 |
217,565 | moodle/moodle | lib/horde/framework/Horde/Array/Sort/Helper.php | Horde_Array_Sort_Helper.compareKeys | public function compareKeys($a, $b)
{
return strcoll(Horde_String::lower($a, true, 'UTF-8'), Horde_String::lower($b, true, 'UTF-8'));
} | php | public function compareKeys($a, $b)
{
return strcoll(Horde_String::lower($a, true, 'UTF-8'), Horde_String::lower($b, true, 'UTF-8'));
} | [
"public",
"function",
"compareKeys",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
"return",
"strcoll",
"(",
"Horde_String",
"::",
"lower",
"(",
"$",
"a",
",",
"true",
",",
"'UTF-8'",
")",
",",
"Horde_String",
"::",
"lower",
"(",
"$",
"b",
",",
"true",
"... | Compare array keys case insensitively for uksort.
@param scalar $a TODO
@param scalar $b TODO
@return TODO | [
"Compare",
"array",
"keys",
"case",
"insensitively",
"for",
"uksort",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Array/Sort/Helper.php#L59-L62 |
217,566 | moodle/moodle | lib/horde/framework/Horde/Array/Sort/Helper.php | Horde_Array_Sort_Helper.reverseCompareKeys | public function reverseCompareKeys($a, $b)
{
return strcoll(Horde_String::lower($b, true, 'UTF-8'), Horde_String::lower($a, true, 'UTF-8'));
} | php | public function reverseCompareKeys($a, $b)
{
return strcoll(Horde_String::lower($b, true, 'UTF-8'), Horde_String::lower($a, true, 'UTF-8'));
} | [
"public",
"function",
"reverseCompareKeys",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
"return",
"strcoll",
"(",
"Horde_String",
"::",
"lower",
"(",
"$",
"b",
",",
"true",
",",
"'UTF-8'",
")",
",",
"Horde_String",
"::",
"lower",
"(",
"$",
"a",
",",
"tru... | Compare, in reverse order, array keys case insensitively for uksort.
@param scalar $a TODO
@param scalar $b TODO
@return TODO | [
"Compare",
"in",
"reverse",
"order",
"array",
"keys",
"case",
"insensitively",
"for",
"uksort",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Array/Sort/Helper.php#L72-L75 |
217,567 | moodle/moodle | auth/oauth2/classes/api.php | api.get_linked_logins | public static function get_linked_logins($userid = false) {
global $USER;
if ($userid === false) {
$userid = $USER->id;
}
if (\core\session\manager::is_loggedinas()) {
throw new moodle_exception('notwhileloggedinas', 'auth_oauth2');
}
$context =... | php | public static function get_linked_logins($userid = false) {
global $USER;
if ($userid === false) {
$userid = $USER->id;
}
if (\core\session\manager::is_loggedinas()) {
throw new moodle_exception('notwhileloggedinas', 'auth_oauth2');
}
$context =... | [
"public",
"static",
"function",
"get_linked_logins",
"(",
"$",
"userid",
"=",
"false",
")",
"{",
"global",
"$",
"USER",
";",
"if",
"(",
"$",
"userid",
"===",
"false",
")",
"{",
"$",
"userid",
"=",
"$",
"USER",
"->",
"id",
";",
"}",
"if",
"(",
"\\",... | List linked logins
Requires auth/oauth2:managelinkedlogins capability at the user context.
@param int $userid (defaults to $USER->id)
@return boolean | [
"List",
"linked",
"logins"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/oauth2/classes/api.php#L60-L75 |
217,568 | moodle/moodle | auth/oauth2/classes/api.php | api.match_username_to_user | public static function match_username_to_user($username, $issuer) {
$params = [
'issuerid' => $issuer->get('id'),
'username' => $username
];
$result = linked_login::get_record($params);
if ($result) {
$user = \core_user::get_user($result->get('userid'... | php | public static function match_username_to_user($username, $issuer) {
$params = [
'issuerid' => $issuer->get('id'),
'username' => $username
];
$result = linked_login::get_record($params);
if ($result) {
$user = \core_user::get_user($result->get('userid'... | [
"public",
"static",
"function",
"match_username_to_user",
"(",
"$",
"username",
",",
"$",
"issuer",
")",
"{",
"$",
"params",
"=",
"[",
"'issuerid'",
"=>",
"$",
"issuer",
"->",
"get",
"(",
"'id'",
")",
",",
"'username'",
"=>",
"$",
"username",
"]",
";",
... | See if there is a match for this username and issuer in the linked_login table.
@param string $username as returned from an oauth client.
@param \core\oauth2\issuer $issuer
@return stdClass User record if found. | [
"See",
"if",
"there",
"is",
"a",
"match",
"for",
"this",
"username",
"and",
"issuer",
"in",
"the",
"linked_login",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/oauth2/classes/api.php#L84-L98 |
217,569 | moodle/moodle | auth/oauth2/classes/api.php | api.link_login | public static function link_login($userinfo, $issuer, $userid = false, $skippermissions = false) {
global $USER;
if ($userid === false) {
$userid = $USER->id;
}
if (linked_login::has_existing_issuer_match($issuer, $userinfo['username'])) {
throw new moodle_excep... | php | public static function link_login($userinfo, $issuer, $userid = false, $skippermissions = false) {
global $USER;
if ($userid === false) {
$userid = $USER->id;
}
if (linked_login::has_existing_issuer_match($issuer, $userinfo['username'])) {
throw new moodle_excep... | [
"public",
"static",
"function",
"link_login",
"(",
"$",
"userinfo",
",",
"$",
"issuer",
",",
"$",
"userid",
"=",
"false",
",",
"$",
"skippermissions",
"=",
"false",
")",
"{",
"global",
"$",
"USER",
";",
"if",
"(",
"$",
"userid",
"===",
"false",
")",
... | Link a login to this account.
Requires auth/oauth2:managelinkedlogins capability at the user context.
@param array $userinfo as returned from an oauth client.
@param \core\oauth2\issuer $issuer
@param int $userid (defaults to $USER->id)
@param bool $skippermissions During signup we need to set this before the user is... | [
"Link",
"a",
"login",
"to",
"this",
"account",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/oauth2/classes/api.php#L111-L146 |
217,570 | moodle/moodle | auth/oauth2/classes/api.php | api.send_confirm_link_login_email | public static function send_confirm_link_login_email($userinfo, $issuer, $userid) {
$record = new stdClass();
$record->issuerid = $issuer->get('id');
$record->username = $userinfo['username'];
$record->userid = $userid;
if (linked_login::has_existing_issuer_match($issuer, $userin... | php | public static function send_confirm_link_login_email($userinfo, $issuer, $userid) {
$record = new stdClass();
$record->issuerid = $issuer->get('id');
$record->username = $userinfo['username'];
$record->userid = $userid;
if (linked_login::has_existing_issuer_match($issuer, $userin... | [
"public",
"static",
"function",
"send_confirm_link_login_email",
"(",
"$",
"userinfo",
",",
"$",
"issuer",
",",
"$",
"userid",
")",
"{",
"$",
"record",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"record",
"->",
"issuerid",
"=",
"$",
"issuer",
"->",
"get... | Send an email with a link to confirm linking this account.
@param array $userinfo as returned from an oauth client.
@param \core\oauth2\issuer $issuer
@param int $userid (defaults to $USER->id)
@return bool | [
"Send",
"an",
"email",
"with",
"a",
"link",
"to",
"confirm",
"linking",
"this",
"account",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/oauth2/classes/api.php#L156-L205 |
217,571 | moodle/moodle | auth/oauth2/classes/api.php | api.confirm_link_login | public static function confirm_link_login($userid, $username, $issuerid, $token) {
if (empty($token) || empty($userid) || empty($issuerid) || empty($username)) {
return false;
}
$params = [
'userid' => $userid,
'username' => $username,
'issuerid' =... | php | public static function confirm_link_login($userid, $username, $issuerid, $token) {
if (empty($token) || empty($userid) || empty($issuerid) || empty($username)) {
return false;
}
$params = [
'userid' => $userid,
'username' => $username,
'issuerid' =... | [
"public",
"static",
"function",
"confirm_link_login",
"(",
"$",
"userid",
",",
"$",
"username",
",",
"$",
"issuerid",
",",
"$",
"token",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"token",
")",
"||",
"empty",
"(",
"$",
"userid",
")",
"||",
"empty",
"(",... | Look for a waiting confirmation token, and if we find a match - confirm it.
@param int $userid
@param string $username
@param int $issuerid
@param string $token
@return boolean True if we linked. | [
"Look",
"for",
"a",
"waiting",
"confirmation",
"token",
"and",
"if",
"we",
"find",
"a",
"match",
"-",
"confirm",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/oauth2/classes/api.php#L216-L240 |
217,572 | moodle/moodle | auth/oauth2/classes/api.php | api.create_new_confirmed_account | public static function create_new_confirmed_account($userinfo, $issuer) {
global $CFG, $DB;
require_once($CFG->dirroot.'/user/profile/lib.php');
require_once($CFG->dirroot.'/user/lib.php');
$user = new stdClass();
$user->username = $userinfo['username'];
$user->email = $... | php | public static function create_new_confirmed_account($userinfo, $issuer) {
global $CFG, $DB;
require_once($CFG->dirroot.'/user/profile/lib.php');
require_once($CFG->dirroot.'/user/lib.php');
$user = new stdClass();
$user->username = $userinfo['username'];
$user->email = $... | [
"public",
"static",
"function",
"create_new_confirmed_account",
"(",
"$",
"userinfo",
",",
"$",
"issuer",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/user/profile/lib.php'",
")",
";",
"requir... | Create an account with a linked login that is already confirmed.
@param array $userinfo as returned from an oauth client.
@param \core\oauth2\issuer $issuer
@return bool | [
"Create",
"an",
"account",
"with",
"a",
"linked",
"login",
"that",
"is",
"already",
"confirmed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/oauth2/classes/api.php#L249-L284 |
217,573 | moodle/moodle | auth/oauth2/classes/api.php | api.delete_linked_login | public static function delete_linked_login($linkedloginid) {
$login = new linked_login($linkedloginid);
$userid = $login->get('userid');
if (\core\session\manager::is_loggedinas()) {
throw new moodle_exception('notwhileloggedinas', 'auth_oauth2');
}
$context = conte... | php | public static function delete_linked_login($linkedloginid) {
$login = new linked_login($linkedloginid);
$userid = $login->get('userid');
if (\core\session\manager::is_loggedinas()) {
throw new moodle_exception('notwhileloggedinas', 'auth_oauth2');
}
$context = conte... | [
"public",
"static",
"function",
"delete_linked_login",
"(",
"$",
"linkedloginid",
")",
"{",
"$",
"login",
"=",
"new",
"linked_login",
"(",
"$",
"linkedloginid",
")",
";",
"$",
"userid",
"=",
"$",
"login",
"->",
"get",
"(",
"'userid'",
")",
";",
"if",
"("... | Delete linked login
Requires auth/oauth2:managelinkedlogins capability at the user context.
@param int $linkedloginid
@return boolean | [
"Delete",
"linked",
"login"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/oauth2/classes/api.php#L371-L383 |
217,574 | moodle/moodle | auth/oauth2/classes/api.php | api.user_deleted | public static function user_deleted(\core\event\user_deleted $event) {
global $DB;
$userid = $event->objectid;
return $DB->delete_records(linked_login::TABLE, ['userid' => $userid]);
} | php | public static function user_deleted(\core\event\user_deleted $event) {
global $DB;
$userid = $event->objectid;
return $DB->delete_records(linked_login::TABLE, ['userid' => $userid]);
} | [
"public",
"static",
"function",
"user_deleted",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"user_deleted",
"$",
"event",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"userid",
"=",
"$",
"event",
"->",
"objectid",
";",
"return",
"$",
"DB",
"->",
"delete_records"... | Delete linked logins for a user.
@param \core\event\user_deleted $event
@return boolean | [
"Delete",
"linked",
"logins",
"for",
"a",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/oauth2/classes/api.php#L391-L397 |
217,575 | moodle/moodle | lib/googleapi.php | google_docs.send_file | public function send_file($file) {
// First we create the 'resumable upload request'.
$this->googleoauth->setHeader("Content-Length: 0");
$this->googleoauth->setHeader("X-Upload-Content-Length: ". $file->get_filesize());
$this->googleoauth->setHeader("X-Upload-Content-Type: ". $file->get... | php | public function send_file($file) {
// First we create the 'resumable upload request'.
$this->googleoauth->setHeader("Content-Length: 0");
$this->googleoauth->setHeader("X-Upload-Content-Length: ". $file->get_filesize());
$this->googleoauth->setHeader("X-Upload-Content-Type: ". $file->get... | [
"public",
"function",
"send_file",
"(",
"$",
"file",
")",
"{",
"// First we create the 'resumable upload request'.",
"$",
"this",
"->",
"googleoauth",
"->",
"setHeader",
"(",
"\"Content-Length: 0\"",
")",
";",
"$",
"this",
"->",
"googleoauth",
"->",
"setHeader",
"("... | Sends a file object to google documents
@param object $file File object
@return boolean True on success | [
"Sends",
"a",
"file",
"object",
"to",
"google",
"documents"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/googleapi.php#L148-L189 |
217,576 | moodle/moodle | lib/googleapi.php | google_docs.download_file | public function download_file($url, $path, $timeout = 0) {
$result = $this->googleoauth->download_one($url, null, array('filepath' => $path, 'timeout' => $timeout));
if ($result === true) {
$info = $this->googleoauth->get_info();
if (isset($info['http_code']) && $info['http_code'... | php | public function download_file($url, $path, $timeout = 0) {
$result = $this->googleoauth->download_one($url, null, array('filepath' => $path, 'timeout' => $timeout));
if ($result === true) {
$info = $this->googleoauth->get_info();
if (isset($info['http_code']) && $info['http_code'... | [
"public",
"function",
"download_file",
"(",
"$",
"url",
",",
"$",
"path",
",",
"$",
"timeout",
"=",
"0",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"googleoauth",
"->",
"download_one",
"(",
"$",
"url",
",",
"null",
",",
"array",
"(",
"'filepath... | Downloads a file using authentication
@param string $url url of file
@param string $path path to save file to
@param int $timeout request timeout, default 0 which means no timeout
@return array stucture for repository download_file | [
"Downloads",
"a",
"file",
"using",
"authentication"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/googleapi.php#L199-L211 |
217,577 | moodle/moodle | lib/googleapi.php | google_picasa.send_file | public function send_file($file) {
$this->googleoauth->setHeader("Content-Length: ". $file->get_filesize());
$this->googleoauth->setHeader("Content-Type: ". $file->get_mimetype());
$this->googleoauth->setHeader("Slug: ". $file->get_filename());
$this->googleoauth->post(self::UPLOAD_LOCA... | php | public function send_file($file) {
$this->googleoauth->setHeader("Content-Length: ". $file->get_filesize());
$this->googleoauth->setHeader("Content-Type: ". $file->get_mimetype());
$this->googleoauth->setHeader("Slug: ". $file->get_filename());
$this->googleoauth->post(self::UPLOAD_LOCA... | [
"public",
"function",
"send_file",
"(",
"$",
"file",
")",
"{",
"$",
"this",
"->",
"googleoauth",
"->",
"setHeader",
"(",
"\"Content-Length: \"",
".",
"$",
"file",
"->",
"get_filesize",
"(",
")",
")",
";",
"$",
"this",
"->",
"googleoauth",
"->",
"setHeader"... | Sends a file object to picasaweb
@param object $file File object
@return boolean True on success | [
"Sends",
"a",
"file",
"object",
"to",
"picasaweb"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/googleapi.php#L259-L271 |
217,578 | moodle/moodle | lib/googleapi.php | google_picasa.get_album_photos | public function get_album_photos($albumid) {
$albumcontent = $this->googleoauth->get(self::ALBUM_PHOTO_LIST.$albumid);
return $this->get_photo_details($albumcontent);
} | php | public function get_album_photos($albumid) {
$albumcontent = $this->googleoauth->get(self::ALBUM_PHOTO_LIST.$albumid);
return $this->get_photo_details($albumcontent);
} | [
"public",
"function",
"get_album_photos",
"(",
"$",
"albumid",
")",
"{",
"$",
"albumcontent",
"=",
"$",
"this",
"->",
"googleoauth",
"->",
"get",
"(",
"self",
"::",
"ALBUM_PHOTO_LIST",
".",
"$",
"albumid",
")",
";",
"return",
"$",
"this",
"->",
"get_photo_... | Returns list of photos in album specified
@param int $albumid Photo album to list photos from
@return mixed $files A list of files for the file picker | [
"Returns",
"list",
"of",
"photos",
"in",
"album",
"specified"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/googleapi.php#L295-L299 |
217,579 | moodle/moodle | lib/googleapi.php | google_picasa.do_photo_search | public function do_photo_search($query) {
$content = $this->googleoauth->get(self::PHOTO_SEARCH_URL.htmlentities($query));
return $this->get_photo_details($content);
} | php | public function do_photo_search($query) {
$content = $this->googleoauth->get(self::PHOTO_SEARCH_URL.htmlentities($query));
return $this->get_photo_details($content);
} | [
"public",
"function",
"do_photo_search",
"(",
"$",
"query",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"googleoauth",
"->",
"get",
"(",
"self",
"::",
"PHOTO_SEARCH_URL",
".",
"htmlentities",
"(",
"$",
"query",
")",
")",
";",
"return",
"$",
"this",... | Does text search on the users photos and returns
matches in format for picasa api
@param string $query Search terms
@return mixed $files A list of files for the file picker | [
"Does",
"text",
"search",
"on",
"the",
"users",
"photos",
"and",
"returns",
"matches",
"in",
"format",
"for",
"picasa",
"api"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/googleapi.php#L317-L321 |
217,580 | moodle/moodle | lib/googleapi.php | google_picasa.get_albums | public function get_albums() {
$files = array();
$content = $this->googleoauth->get(self::LIST_ALBUMS_URL);
try {
if (strpos($content, '<?xml') !== 0) {
throw new moodle_exception('invalidxmlresponse');
}
$xml = new SimpleXMLElement($content);... | php | public function get_albums() {
$files = array();
$content = $this->googleoauth->get(self::LIST_ALBUMS_URL);
try {
if (strpos($content, '<?xml') !== 0) {
throw new moodle_exception('invalidxmlresponse');
}
$xml = new SimpleXMLElement($content);... | [
"public",
"function",
"get_albums",
"(",
")",
"{",
"$",
"files",
"=",
"array",
"(",
")",
";",
"$",
"content",
"=",
"$",
"this",
"->",
"googleoauth",
"->",
"get",
"(",
"self",
"::",
"LIST_ALBUMS_URL",
")",
";",
"try",
"{",
"if",
"(",
"strpos",
"(",
... | Gets all the users albums and returns them as a list of folders
for the file picker
@return mixes $files Array in the format get_listing uses for folders | [
"Gets",
"all",
"the",
"users",
"albums",
"and",
"returns",
"them",
"as",
"a",
"list",
"of",
"folders",
"for",
"the",
"file",
"picker"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/googleapi.php#L329-L363 |
217,581 | moodle/moodle | lib/googleapi.php | google_picasa.get_photo_details | public function get_photo_details($rawxml) {
$files = array();
try {
if (strpos($rawxml, '<?xml') !== 0) {
throw new moodle_exception('invalidxmlresponse');
}
$xml = new SimpleXMLElement($rawxml);
} catch (Exception $e) {
// An err... | php | public function get_photo_details($rawxml) {
$files = array();
try {
if (strpos($rawxml, '<?xml') !== 0) {
throw new moodle_exception('invalidxmlresponse');
}
$xml = new SimpleXMLElement($rawxml);
} catch (Exception $e) {
// An err... | [
"public",
"function",
"get_photo_details",
"(",
"$",
"rawxml",
")",
"{",
"$",
"files",
"=",
"array",
"(",
")",
";",
"try",
"{",
"if",
"(",
"strpos",
"(",
"$",
"rawxml",
",",
"'<?xml'",
")",
"!==",
"0",
")",
"{",
"throw",
"new",
"moodle_exception",
"(... | Recieves XML from a picasa list of photos and returns
array in format for file picker.
@param string $rawxml XML from picasa api
@return mixed $files A list of files for the file picker | [
"Recieves",
"XML",
"from",
"a",
"picasa",
"list",
"of",
"photos",
"and",
"returns",
"array",
"in",
"format",
"for",
"file",
"picker",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/googleapi.php#L372-L417 |
217,582 | moodle/moodle | lib/mustache/src/Mustache/Cache/FilesystemCache.php | Mustache_Cache_FilesystemCache.load | public function load($key)
{
$fileName = $this->getCacheFilename($key);
if (!is_file($fileName)) {
return false;
}
require_once $fileName;
return true;
} | php | public function load($key)
{
$fileName = $this->getCacheFilename($key);
if (!is_file($fileName)) {
return false;
}
require_once $fileName;
return true;
} | [
"public",
"function",
"load",
"(",
"$",
"key",
")",
"{",
"$",
"fileName",
"=",
"$",
"this",
"->",
"getCacheFilename",
"(",
"$",
"key",
")",
";",
"if",
"(",
"!",
"is_file",
"(",
"$",
"fileName",
")",
")",
"{",
"return",
"false",
";",
"}",
"require_o... | Load the class from cache using `require_once`.
@param string $key
@return bool | [
"Load",
"the",
"class",
"from",
"cache",
"using",
"require_once",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Cache/FilesystemCache.php#L46-L56 |
217,583 | moodle/moodle | lib/mustache/src/Mustache/Cache/FilesystemCache.php | Mustache_Cache_FilesystemCache.cache | public function cache($key, $value)
{
$fileName = $this->getCacheFilename($key);
$this->log(
Mustache_Logger::DEBUG,
'Writing to template cache: "{fileName}"',
array('fileName' => $fileName)
);
$this->writeFile($fileName, $value);
$this->... | php | public function cache($key, $value)
{
$fileName = $this->getCacheFilename($key);
$this->log(
Mustache_Logger::DEBUG,
'Writing to template cache: "{fileName}"',
array('fileName' => $fileName)
);
$this->writeFile($fileName, $value);
$this->... | [
"public",
"function",
"cache",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"fileName",
"=",
"$",
"this",
"->",
"getCacheFilename",
"(",
"$",
"key",
")",
";",
"$",
"this",
"->",
"log",
"(",
"Mustache_Logger",
"::",
"DEBUG",
",",
"'Writing to temp... | Cache and load the compiled class.
@param string $key
@param string $value | [
"Cache",
"and",
"load",
"the",
"compiled",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Cache/FilesystemCache.php#L64-L76 |
217,584 | moodle/moodle | lib/mustache/src/Mustache/Cache/FilesystemCache.php | Mustache_Cache_FilesystemCache.buildDirectoryForFilename | private function buildDirectoryForFilename($fileName)
{
$dirName = dirname($fileName);
if (!is_dir($dirName)) {
$this->log(
Mustache_Logger::INFO,
'Creating Mustache template cache directory: "{dirName}"',
array('dirName' => $dirName)
... | php | private function buildDirectoryForFilename($fileName)
{
$dirName = dirname($fileName);
if (!is_dir($dirName)) {
$this->log(
Mustache_Logger::INFO,
'Creating Mustache template cache directory: "{dirName}"',
array('dirName' => $dirName)
... | [
"private",
"function",
"buildDirectoryForFilename",
"(",
"$",
"fileName",
")",
"{",
"$",
"dirName",
"=",
"dirname",
"(",
"$",
"fileName",
")",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"dirName",
")",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"Mustache_L... | Create cache directory.
@throws Mustache_Exception_RuntimeException If unable to create directory
@param string $fileName
@return string | [
"Create",
"cache",
"directory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Cache/FilesystemCache.php#L100-L119 |
217,585 | moodle/moodle | lib/mustache/src/Mustache/Cache/FilesystemCache.php | Mustache_Cache_FilesystemCache.writeFile | private function writeFile($fileName, $value)
{
$dirName = $this->buildDirectoryForFilename($fileName);
$this->log(
Mustache_Logger::DEBUG,
'Caching compiled template to "{fileName}"',
array('fileName' => $fileName)
);
$tempFile = tempnam($dirNam... | php | private function writeFile($fileName, $value)
{
$dirName = $this->buildDirectoryForFilename($fileName);
$this->log(
Mustache_Logger::DEBUG,
'Caching compiled template to "{fileName}"',
array('fileName' => $fileName)
);
$tempFile = tempnam($dirNam... | [
"private",
"function",
"writeFile",
"(",
"$",
"fileName",
",",
"$",
"value",
")",
"{",
"$",
"dirName",
"=",
"$",
"this",
"->",
"buildDirectoryForFilename",
"(",
"$",
"fileName",
")",
";",
"$",
"this",
"->",
"log",
"(",
"Mustache_Logger",
"::",
"DEBUG",
"... | Write cache file.
@throws Mustache_Exception_RuntimeException If unable to write file
@param string $fileName
@param string $value | [
"Write",
"cache",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Cache/FilesystemCache.php#L129-L160 |
217,586 | moodle/moodle | backup/util/dbops/restore_dbops.class.php | restore_dbops.load_inforef_to_tempids | public static function load_inforef_to_tempids($restoreid, $inforeffile,
\core\progress\base $progress = null) {
if (!file_exists($inforeffile)) { // Shouldn't happen ever, but...
throw new backup_helper_exception('missing_inforef_xml_file', $inforeffile);
}
// Set up p... | php | public static function load_inforef_to_tempids($restoreid, $inforeffile,
\core\progress\base $progress = null) {
if (!file_exists($inforeffile)) { // Shouldn't happen ever, but...
throw new backup_helper_exception('missing_inforef_xml_file', $inforeffile);
}
// Set up p... | [
"public",
"static",
"function",
"load_inforef_to_tempids",
"(",
"$",
"restoreid",
",",
"$",
"inforeffile",
",",
"\\",
"core",
"\\",
"progress",
"\\",
"base",
"$",
"progress",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"inforeffile",
")... | Load one inforef.xml file to backup_ids table for future reference
@param string $restoreid Restore id
@param string $inforeffile File path
@param \core\progress\base $progress Progress tracker | [
"Load",
"one",
"inforef",
".",
"xml",
"file",
"to",
"backup_ids",
"table",
"for",
"future",
"reference"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/dbops/restore_dbops.class.php#L119-L142 |
217,587 | moodle/moodle | backup/util/dbops/restore_dbops.class.php | restore_dbops.load_roles_to_tempids | public static function load_roles_to_tempids($restoreid, $rolesfile) {
if (!file_exists($rolesfile)) { // Shouldn't happen ever, but...
throw new backup_helper_exception('missing_roles_xml_file', $rolesfile);
}
// Let's parse, custom processor will do its work, sending info to DB
... | php | public static function load_roles_to_tempids($restoreid, $rolesfile) {
if (!file_exists($rolesfile)) { // Shouldn't happen ever, but...
throw new backup_helper_exception('missing_roles_xml_file', $rolesfile);
}
// Let's parse, custom processor will do its work, sending info to DB
... | [
"public",
"static",
"function",
"load_roles_to_tempids",
"(",
"$",
"restoreid",
",",
"$",
"rolesfile",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"rolesfile",
")",
")",
"{",
"// Shouldn't happen ever, but...",
"throw",
"new",
"backup_helper_exception",
"("... | Load the needed role.xml file to backup_ids table for future reference | [
"Load",
"the",
"needed",
"role",
".",
"xml",
"file",
"to",
"backup_ids",
"table",
"for",
"future",
"reference"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/dbops/restore_dbops.class.php#L147-L158 |
217,588 | moodle/moodle | backup/util/dbops/restore_dbops.class.php | restore_dbops.get_backup_ids_cached | protected static function get_backup_ids_cached($restoreid, $itemname, $itemid) {
global $DB;
$key = "$itemid $itemname $restoreid";
// If record exists in cache then return.
if (isset(self::$backupidsexist[$key]) && isset(self::$backupidscache[$key])) {
// Return a copy of... | php | protected static function get_backup_ids_cached($restoreid, $itemname, $itemid) {
global $DB;
$key = "$itemid $itemname $restoreid";
// If record exists in cache then return.
if (isset(self::$backupidsexist[$key]) && isset(self::$backupidscache[$key])) {
// Return a copy of... | [
"protected",
"static",
"function",
"get_backup_ids_cached",
"(",
"$",
"restoreid",
",",
"$",
"itemname",
",",
"$",
"itemid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"key",
"=",
"\"$itemid $itemname $restoreid\"",
";",
"// If record exists in cache then return.",
"i... | Return cached backup id's
@param int $restoreid id of backup
@param string $itemname name of the item
@param int $itemid id of item
@return array backup id's
@todo MDL-25290 replace static backupids* with MUC code | [
"Return",
"cached",
"backup",
"id",
"s"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/dbops/restore_dbops.class.php#L212-L249 |
217,589 | moodle/moodle | backup/util/dbops/restore_dbops.class.php | restore_dbops.set_backup_ids_cached | protected static function set_backup_ids_cached($restoreid, $itemname, $itemid, $extrarecord) {
global $DB;
$key = "$itemid $itemname $restoreid";
$record = array(
'backupid' => $restoreid,
'itemname' => $itemname,
'itemid' => $itemid,
);
... | php | protected static function set_backup_ids_cached($restoreid, $itemname, $itemid, $extrarecord) {
global $DB;
$key = "$itemid $itemname $restoreid";
$record = array(
'backupid' => $restoreid,
'itemname' => $itemname,
'itemid' => $itemid,
);
... | [
"protected",
"static",
"function",
"set_backup_ids_cached",
"(",
"$",
"restoreid",
",",
"$",
"itemname",
",",
"$",
"itemid",
",",
"$",
"extrarecord",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"key",
"=",
"\"$itemid $itemname $restoreid\"",
";",
"$",
"record",
... | Cache backup ids'
@param int $restoreid id of backup
@param string $itemname name of the item
@param int $itemid id of item
@param array $extrarecord extra record which needs to be updated
@return void
@todo MDL-25290 replace static BACKUP_IDS_* with MUC code | [
"Cache",
"backup",
"ids"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/dbops/restore_dbops.class.php#L261-L298 |
217,590 | moodle/moodle | backup/util/dbops/restore_dbops.class.php | restore_dbops.update_backup_cached_record | protected static function update_backup_cached_record($record, $extrarecord, $key, $existingrecord = null) {
global $DB;
// Update only if extrarecord is not empty.
if (!empty($extrarecord)) {
$extrarecord['id'] = self::$backupidsexist[$key];
$DB->update_record('backup_id... | php | protected static function update_backup_cached_record($record, $extrarecord, $key, $existingrecord = null) {
global $DB;
// Update only if extrarecord is not empty.
if (!empty($extrarecord)) {
$extrarecord['id'] = self::$backupidsexist[$key];
$DB->update_record('backup_id... | [
"protected",
"static",
"function",
"update_backup_cached_record",
"(",
"$",
"record",
",",
"$",
"extrarecord",
",",
"$",
"key",
",",
"$",
"existingrecord",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"// Update only if extrarecord is not empty.",
"if",
"(",
... | Updates existing backup record
@param array $record record which needs to be updated
@param array $extrarecord extra record which needs to be updated
@param string $key unique key which is used to identify cached record
@param stdClass $existingrecord (optional) existing record | [
"Updates",
"existing",
"backup",
"record"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/dbops/restore_dbops.class.php#L308-L330 |
217,591 | moodle/moodle | backup/util/dbops/restore_dbops.class.php | restore_dbops.reset_backup_ids_cached | public static function reset_backup_ids_cached() {
// Reset the ids cache.
$cachetoadd = count(self::$backupidscache);
self::$backupidscache = array();
self::$backupidscachesize = self::$backupidscachesize + $cachetoadd;
// Reset the exists cache.
$existstoadd = count(sel... | php | public static function reset_backup_ids_cached() {
// Reset the ids cache.
$cachetoadd = count(self::$backupidscache);
self::$backupidscache = array();
self::$backupidscachesize = self::$backupidscachesize + $cachetoadd;
// Reset the exists cache.
$existstoadd = count(sel... | [
"public",
"static",
"function",
"reset_backup_ids_cached",
"(",
")",
"{",
"// Reset the ids cache.",
"$",
"cachetoadd",
"=",
"count",
"(",
"self",
"::",
"$",
"backupidscache",
")",
";",
"self",
"::",
"$",
"backupidscache",
"=",
"array",
"(",
")",
";",
"self",
... | Reset the ids caches completely
Any destructive operation (partial delete, truncate, drop or recreate) performed
with the backup_ids table must cause the backup_ids caches to be
invalidated by calling this method. See MDL-33630.
Note that right now, the only operation of that type is the recreation
(drop & restore) o... | [
"Reset",
"the",
"ids",
"caches",
"completely"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/dbops/restore_dbops.class.php#L346-L355 |
217,592 | moodle/moodle | backup/util/dbops/restore_dbops.class.php | restore_dbops.load_users_to_tempids | public static function load_users_to_tempids($restoreid, $usersfile,
\core\progress\base $progress = null) {
if (!file_exists($usersfile)) { // Shouldn't happen ever, but...
throw new backup_helper_exception('missing_users_xml_file', $usersfile);
}
// Set up progress tr... | php | public static function load_users_to_tempids($restoreid, $usersfile,
\core\progress\base $progress = null) {
if (!file_exists($usersfile)) { // Shouldn't happen ever, but...
throw new backup_helper_exception('missing_users_xml_file', $usersfile);
}
// Set up progress tr... | [
"public",
"static",
"function",
"load_users_to_tempids",
"(",
"$",
"restoreid",
",",
"$",
"usersfile",
",",
"\\",
"core",
"\\",
"progress",
"\\",
"base",
"$",
"progress",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"usersfile",
")",
"... | Load the needed users.xml file to backup_ids table for future reference
@param string $restoreid Restore id
@param string $usersfile File path
@param \core\progress\base $progress Progress tracker | [
"Load",
"the",
"needed",
"users",
".",
"xml",
"file",
"to",
"backup_ids",
"table",
"for",
"future",
"reference"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/dbops/restore_dbops.class.php#L426-L449 |
217,593 | moodle/moodle | backup/util/dbops/restore_dbops.class.php | restore_dbops.load_categories_and_questions_to_tempids | public static function load_categories_and_questions_to_tempids($restoreid, $questionsfile) {
if (!file_exists($questionsfile)) { // Shouldn't happen ever, but...
throw new backup_helper_exception('missing_questions_xml_file', $questionsfile);
}
// Let's parse, custom processor will... | php | public static function load_categories_and_questions_to_tempids($restoreid, $questionsfile) {
if (!file_exists($questionsfile)) { // Shouldn't happen ever, but...
throw new backup_helper_exception('missing_questions_xml_file', $questionsfile);
}
// Let's parse, custom processor will... | [
"public",
"static",
"function",
"load_categories_and_questions_to_tempids",
"(",
"$",
"restoreid",
",",
"$",
"questionsfile",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"questionsfile",
")",
")",
"{",
"// Shouldn't happen ever, but...",
"throw",
"new",
"back... | Load the needed questions.xml file to backup_ids table for future reference | [
"Load",
"the",
"needed",
"questions",
".",
"xml",
"file",
"to",
"backup_ids",
"table",
"for",
"future",
"reference"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/dbops/restore_dbops.class.php#L454-L465 |
217,594 | moodle/moodle | backup/util/dbops/restore_dbops.class.php | restore_dbops.restore_get_question_banks | public static function restore_get_question_banks($restoreid, $contextlevel = null) {
global $DB;
$results = array();
$qcats = $DB->get_recordset_sql("SELECT itemid, parentitemid AS contextid, info
FROM {backup_ids_temp}
... | php | public static function restore_get_question_banks($restoreid, $contextlevel = null) {
global $DB;
$results = array();
$qcats = $DB->get_recordset_sql("SELECT itemid, parentitemid AS contextid, info
FROM {backup_ids_temp}
... | [
"public",
"static",
"function",
"restore_get_question_banks",
"(",
"$",
"restoreid",
",",
"$",
"contextlevel",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"results",
"=",
"array",
"(",
")",
";",
"$",
"qcats",
"=",
"$",
"DB",
"->",
"get_recordse... | Return one array of contextid => contextlevel pairs
of question banks to be checked for one given restore operation
ordered from CONTEXT_SYSTEM downto CONTEXT_MODULE
If contextlevel is specified, then only banks corresponding to
that level are returned | [
"Return",
"one",
"array",
"of",
"contextid",
"=",
">",
"contextlevel",
"pairs",
"of",
"question",
"banks",
"to",
"be",
"checked",
"for",
"one",
"given",
"restore",
"operation",
"ordered",
"from",
"CONTEXT_SYSTEM",
"downto",
"CONTEXT_MODULE",
"If",
"contextlevel",
... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/dbops/restore_dbops.class.php#L741-L763 |
217,595 | moodle/moodle | backup/util/dbops/restore_dbops.class.php | restore_dbops.restore_get_questions | public static function restore_get_questions($restoreid, $qcatid) {
global $DB;
$results = array();
$qs = $DB->get_recordset_sql("SELECT itemid, info
FROM {backup_ids_temp}
WHERE backupid = ?
... | php | public static function restore_get_questions($restoreid, $qcatid) {
global $DB;
$results = array();
$qs = $DB->get_recordset_sql("SELECT itemid, info
FROM {backup_ids_temp}
WHERE backupid = ?
... | [
"public",
"static",
"function",
"restore_get_questions",
"(",
"$",
"restoreid",
",",
"$",
"qcatid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"results",
"=",
"array",
"(",
")",
";",
"$",
"qs",
"=",
"$",
"DB",
"->",
"get_recordset_sql",
"(",
"\"SELECT item... | Return one array of question records for
a given restore operation and one question category | [
"Return",
"one",
"array",
"of",
"question",
"records",
"for",
"a",
"given",
"restore",
"operation",
"and",
"one",
"question",
"category"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/dbops/restore_dbops.class.php#L868-L882 |
217,596 | moodle/moodle | backup/util/dbops/restore_dbops.class.php | restore_dbops.get_missing_file_result | protected static function get_missing_file_result($file) {
$result = new stdClass();
$result->code = 'file_missing_in_backup';
$result->message = 'Missing file in backup: ' . $file->filepath . $file->filename .
' (old context ' . $file->contextid . ', component ' . $file->compon... | php | protected static function get_missing_file_result($file) {
$result = new stdClass();
$result->code = 'file_missing_in_backup';
$result->message = 'Missing file in backup: ' . $file->filepath . $file->filename .
' (old context ' . $file->contextid . ', component ' . $file->compon... | [
"protected",
"static",
"function",
"get_missing_file_result",
"(",
"$",
"file",
")",
"{",
"$",
"result",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"result",
"->",
"code",
"=",
"'file_missing_in_backup'",
";",
"$",
"result",
"->",
"message",
"=",
"'Missing ... | Returns suitable entry to include in log when there is a missing file.
@param stdClass $file File definition
@return stdClass Log entry | [
"Returns",
"suitable",
"entry",
"to",
"include",
"in",
"log",
"when",
"there",
"is",
"a",
"missing",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/dbops/restore_dbops.class.php#L1103-L1111 |
217,597 | moodle/moodle | backup/util/dbops/restore_dbops.class.php | restore_dbops.set_course_role_names | public static function set_course_role_names($restoreid, $courseid) {
global $DB;
// Get the course context
$coursectx = context_course::instance($courseid);
// Get all the mapped roles we have
$rs = $DB->get_recordset('backup_ids_temp', array('backupid' => $restoreid, 'itemname... | php | public static function set_course_role_names($restoreid, $courseid) {
global $DB;
// Get the course context
$coursectx = context_course::instance($courseid);
// Get all the mapped roles we have
$rs = $DB->get_recordset('backup_ids_temp', array('backupid' => $restoreid, 'itemname... | [
"public",
"static",
"function",
"set_course_role_names",
"(",
"$",
"restoreid",
",",
"$",
"courseid",
")",
"{",
"global",
"$",
"DB",
";",
"// Get the course context",
"$",
"coursectx",
"=",
"context_course",
"::",
"instance",
"(",
"$",
"courseid",
")",
";",
"/... | For the target course context, put as many custom role names as possible | [
"For",
"the",
"target",
"course",
"context",
"put",
"as",
"many",
"custom",
"role",
"names",
"as",
"possible"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/dbops/restore_dbops.class.php#L1752-L1774 |
217,598 | moodle/moodle | backup/util/dbops/restore_dbops.class.php | restore_dbops.create_new_course | public static function create_new_course($fullname, $shortname, $categoryid) {
global $DB;
$category = $DB->get_record('course_categories', array('id'=>$categoryid), '*', MUST_EXIST);
$course = new stdClass;
$course->fullname = $fullname;
$course->shortname = $shortname;
... | php | public static function create_new_course($fullname, $shortname, $categoryid) {
global $DB;
$category = $DB->get_record('course_categories', array('id'=>$categoryid), '*', MUST_EXIST);
$course = new stdClass;
$course->fullname = $fullname;
$course->shortname = $shortname;
... | [
"public",
"static",
"function",
"create_new_course",
"(",
"$",
"fullname",
",",
"$",
"shortname",
",",
"$",
"categoryid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"category",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'course_categories'",
",",
"array",
"("... | Creates a skeleton record within the database using the passed parameters
and returns the new course id.
@global moodle_database $DB
@param string $fullname
@param string $shortname
@param int $categoryid
@return int The new course id | [
"Creates",
"a",
"skeleton",
"record",
"within",
"the",
"database",
"using",
"the",
"passed",
"parameters",
"and",
"returns",
"the",
"new",
"course",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/dbops/restore_dbops.class.php#L1786-L1806 |
217,599 | moodle/moodle | lib/behat/behat_field_manager.php | behat_field_manager.get_form_field_from_label | public static function get_form_field_from_label($label, RawMinkContext $context) {
// There are moodle form elements that are not directly related with
// a basic HTML form field, we should also take care of them.
// The DOM node.
$fieldnode = $context->find_field($label);
// ... | php | public static function get_form_field_from_label($label, RawMinkContext $context) {
// There are moodle form elements that are not directly related with
// a basic HTML form field, we should also take care of them.
// The DOM node.
$fieldnode = $context->find_field($label);
// ... | [
"public",
"static",
"function",
"get_form_field_from_label",
"(",
"$",
"label",
",",
"RawMinkContext",
"$",
"context",
")",
"{",
"// There are moodle form elements that are not directly related with",
"// a basic HTML form field, we should also take care of them.",
"// The DOM node.",
... | Gets an instance of the form field from it's label
@param string $label
@param RawMinkContext $context
@return behat_form_field | [
"Gets",
"an",
"instance",
"of",
"the",
"form",
"field",
"from",
"it",
"s",
"label"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/behat_field_manager.php#L50-L59 |
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.