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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
218,400 | moodle/moodle | cache/classes/helper.php | cache_helper.purge_by_definition | public static function purge_by_definition($component, $area, array $identifiers = array()) {
// Create the cache.
$cache = cache::make($component, $area, $identifiers);
// Initialise, in case of a store.
if ($cache instanceof cache_store) {
$factory = cache_factory::instance... | php | public static function purge_by_definition($component, $area, array $identifiers = array()) {
// Create the cache.
$cache = cache::make($component, $area, $identifiers);
// Initialise, in case of a store.
if ($cache instanceof cache_store) {
$factory = cache_factory::instance... | [
"public",
"static",
"function",
"purge_by_definition",
"(",
"$",
"component",
",",
"$",
"area",
",",
"array",
"$",
"identifiers",
"=",
"array",
"(",
")",
")",
"{",
"// Create the cache.",
"$",
"cache",
"=",
"cache",
"::",
"make",
"(",
"$",
"component",
","... | Purges the cache for a specific definition.
@param string $component
@param string $area
@param array $identifiers
@return bool | [
"Purges",
"the",
"cache",
"for",
"a",
"specific",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L293-L307 |
218,401 | moodle/moodle | cache/classes/helper.php | cache_helper.ensure_ready_for_stats | protected static function ensure_ready_for_stats($store, $definition, $mode = cache_store::MODE_APPLICATION) {
// This function is performance-sensitive, so exit as quickly as possible
// if we do not need to do anything.
if (isset(self::$stats[$definition]['stores'][$store])) {
retu... | php | protected static function ensure_ready_for_stats($store, $definition, $mode = cache_store::MODE_APPLICATION) {
// This function is performance-sensitive, so exit as quickly as possible
// if we do not need to do anything.
if (isset(self::$stats[$definition]['stores'][$store])) {
retu... | [
"protected",
"static",
"function",
"ensure_ready_for_stats",
"(",
"$",
"store",
",",
"$",
"definition",
",",
"$",
"mode",
"=",
"cache_store",
"::",
"MODE_APPLICATION",
")",
"{",
"// This function is performance-sensitive, so exit as quickly as possible",
"// if we do not need... | Ensure that the stats array is ready to collect information for the given store and definition.
@param string $store
@param string $definition A string that identifies the definition.
@param int $mode One of cache_store::MODE_*. Since 2.9. | [
"Ensure",
"that",
"the",
"stats",
"array",
"is",
"ready",
"to",
"collect",
"information",
"for",
"the",
"given",
"store",
"and",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L367-L391 |
218,402 | moodle/moodle | cache/classes/helper.php | cache_helper.get_definition_stat_id_and_mode | protected static function get_definition_stat_id_and_mode($definition) {
if (!($definition instanceof cache_definition)) {
// All core calls to this method have been updated, this is the legacy state.
// We'll use application as the default as that is the most common, really this is not ... | php | protected static function get_definition_stat_id_and_mode($definition) {
if (!($definition instanceof cache_definition)) {
// All core calls to this method have been updated, this is the legacy state.
// We'll use application as the default as that is the most common, really this is not ... | [
"protected",
"static",
"function",
"get_definition_stat_id_and_mode",
"(",
"$",
"definition",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"definition",
"instanceof",
"cache_definition",
")",
")",
"{",
"// All core calls to this method have been updated, this is the legacy state.",
... | Returns a string to describe the definition.
This method supports the definition as a string due to legacy requirements.
It is backwards compatible when a string is passed but is not accurate.
@since 2.9
@param cache_definition|string $definition
@return string | [
"Returns",
"a",
"string",
"to",
"describe",
"the",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L403-L413 |
218,403 | moodle/moodle | cache/classes/helper.php | cache_helper.record_cache_hit | public static function record_cache_hit($store, $definition, $hits = 1) {
list($definitionstr, $mode) = self::get_definition_stat_id_and_mode($definition);
self::ensure_ready_for_stats($store, $definitionstr, $mode);
self::$stats[$definitionstr]['stores'][$store]['hits'] += $hits;
} | php | public static function record_cache_hit($store, $definition, $hits = 1) {
list($definitionstr, $mode) = self::get_definition_stat_id_and_mode($definition);
self::ensure_ready_for_stats($store, $definitionstr, $mode);
self::$stats[$definitionstr]['stores'][$store]['hits'] += $hits;
} | [
"public",
"static",
"function",
"record_cache_hit",
"(",
"$",
"store",
",",
"$",
"definition",
",",
"$",
"hits",
"=",
"1",
")",
"{",
"list",
"(",
"$",
"definitionstr",
",",
"$",
"mode",
")",
"=",
"self",
"::",
"get_definition_stat_id_and_mode",
"(",
"$",
... | Record a cache hit in the stats for the given store and definition.
In Moodle 2.9 the $definition argument changed from accepting only a string to accepting a string or a
cache_definition instance. It is preferable to pass a cache definition instance.
@internal
@param cache_definition $store
@param cache_definition $... | [
"Record",
"a",
"cache",
"hit",
"in",
"the",
"stats",
"for",
"the",
"given",
"store",
"and",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L427-L431 |
218,404 | moodle/moodle | cache/classes/helper.php | cache_helper.record_cache_miss | public static function record_cache_miss($store, $definition, $misses = 1) {
list($definitionstr, $mode) = self::get_definition_stat_id_and_mode($definition);
self::ensure_ready_for_stats($store, $definitionstr, $mode);
self::$stats[$definitionstr]['stores'][$store]['misses'] += $misses;
} | php | public static function record_cache_miss($store, $definition, $misses = 1) {
list($definitionstr, $mode) = self::get_definition_stat_id_and_mode($definition);
self::ensure_ready_for_stats($store, $definitionstr, $mode);
self::$stats[$definitionstr]['stores'][$store]['misses'] += $misses;
} | [
"public",
"static",
"function",
"record_cache_miss",
"(",
"$",
"store",
",",
"$",
"definition",
",",
"$",
"misses",
"=",
"1",
")",
"{",
"list",
"(",
"$",
"definitionstr",
",",
"$",
"mode",
")",
"=",
"self",
"::",
"get_definition_stat_id_and_mode",
"(",
"$"... | Record a cache miss in the stats for the given store and definition.
In Moodle 2.9 the $definition argument changed from accepting only a string to accepting a string or a
cache_definition instance. It is preferable to pass a cache definition instance.
@internal
@param string $store
@param cache_definition $definitio... | [
"Record",
"a",
"cache",
"miss",
"in",
"the",
"stats",
"for",
"the",
"given",
"store",
"and",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L445-L449 |
218,405 | moodle/moodle | cache/classes/helper.php | cache_helper.record_cache_set | public static function record_cache_set($store, $definition, $sets = 1) {
list($definitionstr, $mode) = self::get_definition_stat_id_and_mode($definition);
self::ensure_ready_for_stats($store, $definitionstr, $mode);
self::$stats[$definitionstr]['stores'][$store]['sets'] += $sets;
} | php | public static function record_cache_set($store, $definition, $sets = 1) {
list($definitionstr, $mode) = self::get_definition_stat_id_and_mode($definition);
self::ensure_ready_for_stats($store, $definitionstr, $mode);
self::$stats[$definitionstr]['stores'][$store]['sets'] += $sets;
} | [
"public",
"static",
"function",
"record_cache_set",
"(",
"$",
"store",
",",
"$",
"definition",
",",
"$",
"sets",
"=",
"1",
")",
"{",
"list",
"(",
"$",
"definitionstr",
",",
"$",
"mode",
")",
"=",
"self",
"::",
"get_definition_stat_id_and_mode",
"(",
"$",
... | Record a cache set in the stats for the given store and definition.
In Moodle 2.9 the $definition argument changed from accepting only a string to accepting a string or a
cache_definition instance. It is preferable to pass a cache definition instance.
@internal
@param string $store
@param cache_definition $definition... | [
"Record",
"a",
"cache",
"set",
"in",
"the",
"stats",
"for",
"the",
"given",
"store",
"and",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L463-L467 |
218,406 | moodle/moodle | cache/classes/helper.php | cache_helper.purge_all | public static function purge_all($usewriter = false) {
$factory = cache_factory::instance();
$config = $factory->create_config_instance($usewriter);
foreach ($config->get_all_stores() as $store) {
self::purge_store($store['name'], $config);
}
foreach ($factory->get_ad... | php | public static function purge_all($usewriter = false) {
$factory = cache_factory::instance();
$config = $factory->create_config_instance($usewriter);
foreach ($config->get_all_stores() as $store) {
self::purge_store($store['name'], $config);
}
foreach ($factory->get_ad... | [
"public",
"static",
"function",
"purge_all",
"(",
"$",
"usewriter",
"=",
"false",
")",
"{",
"$",
"factory",
"=",
"cache_factory",
"::",
"instance",
"(",
")",
";",
"$",
"config",
"=",
"$",
"factory",
"->",
"create_config_instance",
"(",
"$",
"usewriter",
")... | Purge all of the cache stores of all of their data.
Think twice before calling this method. It will purge **ALL** caches regardless of whether they have been used recently or
anything. This will involve full setup of the cache + the purge operation. On a site using caching heavily this WILL be
painful.
@param bool $u... | [
"Purge",
"all",
"of",
"the",
"cache",
"stores",
"of",
"all",
"of",
"their",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L489-L498 |
218,407 | moodle/moodle | cache/classes/helper.php | cache_helper.purge_store | public static function purge_store($storename, cache_config $config = null) {
if ($config === null) {
$config = cache_config::instance();
}
$stores = $config->get_all_stores();
if (!array_key_exists($storename, $stores)) {
// The store does not exist.
... | php | public static function purge_store($storename, cache_config $config = null) {
if ($config === null) {
$config = cache_config::instance();
}
$stores = $config->get_all_stores();
if (!array_key_exists($storename, $stores)) {
// The store does not exist.
... | [
"public",
"static",
"function",
"purge_store",
"(",
"$",
"storename",
",",
"cache_config",
"$",
"config",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"config",
"===",
"null",
")",
"{",
"$",
"config",
"=",
"cache_config",
"::",
"instance",
"(",
")",
";",
"}"... | Purges a store given its name.
@param string $storename
@param cache_config $config
@return bool | [
"Purges",
"a",
"store",
"given",
"its",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L507-L542 |
218,408 | moodle/moodle | cache/classes/helper.php | cache_helper.purge_stores_used_by_definition | public static function purge_stores_used_by_definition($component, $area) {
$factory = cache_factory::instance();
$config = $factory->create_config_instance();
$definition = $factory->create_definition($component, $area);
$stores = $config->get_stores_for_definition($definition);
... | php | public static function purge_stores_used_by_definition($component, $area) {
$factory = cache_factory::instance();
$config = $factory->create_config_instance();
$definition = $factory->create_definition($component, $area);
$stores = $config->get_stores_for_definition($definition);
... | [
"public",
"static",
"function",
"purge_stores_used_by_definition",
"(",
"$",
"component",
",",
"$",
"area",
")",
"{",
"$",
"factory",
"=",
"cache_factory",
"::",
"instance",
"(",
")",
";",
"$",
"config",
"=",
"$",
"factory",
"->",
"create_config_instance",
"("... | Purges all of the stores used by a definition.
Unlike cache_helper::purge_by_definition this purges all of the data from the stores not
just the data relating to the definition.
This function is useful when you must purge a definition that requires setup but you don't
want to set it up.
@param string $component
@para... | [
"Purges",
"all",
"of",
"the",
"stores",
"used",
"by",
"a",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L555-L563 |
218,409 | moodle/moodle | cache/classes/helper.php | cache_helper.get_definition_name | public static function get_definition_name($definition) {
if ($definition instanceof cache_definition) {
return $definition->get_name();
}
$identifier = 'cachedef_'.clean_param($definition['area'], PARAM_STRINGID);
$component = $definition['component'];
if ($component... | php | public static function get_definition_name($definition) {
if ($definition instanceof cache_definition) {
return $definition->get_name();
}
$identifier = 'cachedef_'.clean_param($definition['area'], PARAM_STRINGID);
$component = $definition['component'];
if ($component... | [
"public",
"static",
"function",
"get_definition_name",
"(",
"$",
"definition",
")",
"{",
"if",
"(",
"$",
"definition",
"instanceof",
"cache_definition",
")",
"{",
"return",
"$",
"definition",
"->",
"get_name",
"(",
")",
";",
"}",
"$",
"identifier",
"=",
"'ca... | Returns the translated name of the definition.
@param cache_definition $definition
@return lang_string | [
"Returns",
"the",
"translated",
"name",
"of",
"the",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L571-L581 |
218,410 | moodle/moodle | cache/classes/helper.php | cache_helper.hash_key | public static function hash_key($key, cache_definition $definition) {
if ($definition->uses_simple_keys()) {
if (debugging() && preg_match('#[^a-zA-Z0-9_]#', $key)) {
throw new coding_exception('Cache definition '.$definition->get_id().' requires simple keys. Invalid key provided.', ... | php | public static function hash_key($key, cache_definition $definition) {
if ($definition->uses_simple_keys()) {
if (debugging() && preg_match('#[^a-zA-Z0-9_]#', $key)) {
throw new coding_exception('Cache definition '.$definition->get_id().' requires simple keys. Invalid key provided.', ... | [
"public",
"static",
"function",
"hash_key",
"(",
"$",
"key",
",",
"cache_definition",
"$",
"definition",
")",
"{",
"if",
"(",
"$",
"definition",
"->",
"uses_simple_keys",
"(",
")",
")",
"{",
"if",
"(",
"debugging",
"(",
")",
"&&",
"preg_match",
"(",
"'#[... | Hashes a descriptive key to make it shorter and still unique.
@param string|int $key
@param cache_definition $definition
@return string | [
"Hashes",
"a",
"descriptive",
"key",
"to",
"make",
"it",
"shorter",
"and",
"still",
"unique",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L589-L599 |
218,411 | moodle/moodle | cache/classes/helper.php | cache_helper.update_definitions | public static function update_definitions($coreonly = false) {
global $CFG;
// Include locallib.
require_once($CFG->dirroot.'/cache/locallib.php');
// First update definitions
cache_config_writer::update_definitions($coreonly);
// Second reset anything we have already ini... | php | public static function update_definitions($coreonly = false) {
global $CFG;
// Include locallib.
require_once($CFG->dirroot.'/cache/locallib.php');
// First update definitions
cache_config_writer::update_definitions($coreonly);
// Second reset anything we have already ini... | [
"public",
"static",
"function",
"update_definitions",
"(",
"$",
"coreonly",
"=",
"false",
")",
"{",
"global",
"$",
"CFG",
";",
"// Include locallib.",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/cache/locallib.php'",
")",
";",
"// First update defini... | Finds all definitions and updates them within the cache config file.
@param bool $coreonly If set to true only core definitions will be updated. | [
"Finds",
"all",
"definitions",
"and",
"updates",
"them",
"within",
"the",
"cache",
"config",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L606-L614 |
218,412 | moodle/moodle | cache/classes/helper.php | cache_helper.get_site_identifier | public static function get_site_identifier() {
global $CFG;
if (!is_null(self::$siteidentifier)) {
return self::$siteidentifier;
}
// If site identifier hasn't been collected yet attempt to get it from the cache config.
$factory = cache_factory::instance();
//... | php | public static function get_site_identifier() {
global $CFG;
if (!is_null(self::$siteidentifier)) {
return self::$siteidentifier;
}
// If site identifier hasn't been collected yet attempt to get it from the cache config.
$factory = cache_factory::instance();
//... | [
"public",
"static",
"function",
"get_site_identifier",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"is_null",
"(",
"self",
"::",
"$",
"siteidentifier",
")",
")",
"{",
"return",
"self",
"::",
"$",
"siteidentifier",
";",
"}",
"// If site identi... | Returns the site identifier.
@return string | [
"Returns",
"the",
"site",
"identifier",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L640-L666 |
218,413 | moodle/moodle | cache/classes/helper.php | cache_helper.clean_old_session_data | public static function clean_old_session_data($output = false) {
global $CFG;
if ($output) {
mtrace('Cleaning up stale session data from cache stores.');
}
$factory = cache_factory::instance();
$config = $factory->create_config_instance();
$definitions = $conf... | php | public static function clean_old_session_data($output = false) {
global $CFG;
if ($output) {
mtrace('Cleaning up stale session data from cache stores.');
}
$factory = cache_factory::instance();
$config = $factory->create_config_instance();
$definitions = $conf... | [
"public",
"static",
"function",
"clean_old_session_data",
"(",
"$",
"output",
"=",
"false",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"$",
"output",
")",
"{",
"mtrace",
"(",
"'Cleaning up stale session data from cache stores.'",
")",
";",
"}",
"$",
"fact... | Cleans old session data from cache stores used for session based definitions.
@param bool $output If set to true output will be given. | [
"Cleans",
"old",
"session",
"data",
"from",
"cache",
"stores",
"used",
"for",
"session",
"based",
"definitions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L690-L736 |
218,414 | moodle/moodle | cache/classes/helper.php | cache_helper.get_stores_suitable_for_mode_default | public static function get_stores_suitable_for_mode_default() {
$factory = cache_factory::instance();
$config = $factory->create_config_instance();
$requirements = 0;
foreach ($config->get_definitions() as $definition) {
$definition = cache_definition::load($definition['compo... | php | public static function get_stores_suitable_for_mode_default() {
$factory = cache_factory::instance();
$config = $factory->create_config_instance();
$requirements = 0;
foreach ($config->get_definitions() as $definition) {
$definition = cache_definition::load($definition['compo... | [
"public",
"static",
"function",
"get_stores_suitable_for_mode_default",
"(",
")",
"{",
"$",
"factory",
"=",
"cache_factory",
"::",
"instance",
"(",
")",
";",
"$",
"config",
"=",
"$",
"factory",
"->",
"create_config_instance",
"(",
")",
";",
"$",
"requirements",
... | Returns an array of stores that would meet the requirements for every definition.
These stores would be 100% suitable to map as defaults for cache modes.
@return array[] An array of stores, keys are the store names. | [
"Returns",
"an",
"array",
"of",
"stores",
"that",
"would",
"meet",
"the",
"requirements",
"for",
"every",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L745-L760 |
218,415 | moodle/moodle | cache/classes/helper.php | cache_helper.get_stores_suitable_for_definition | public static function get_stores_suitable_for_definition(cache_definition $definition) {
$factory = cache_factory::instance();
$stores = array();
if ($factory->is_initialising() || $factory->stores_disabled()) {
// No suitable stores here.
return $stores;
} else ... | php | public static function get_stores_suitable_for_definition(cache_definition $definition) {
$factory = cache_factory::instance();
$stores = array();
if ($factory->is_initialising() || $factory->stores_disabled()) {
// No suitable stores here.
return $stores;
} else ... | [
"public",
"static",
"function",
"get_stores_suitable_for_definition",
"(",
"cache_definition",
"$",
"definition",
")",
"{",
"$",
"factory",
"=",
"cache_factory",
"::",
"instance",
"(",
")",
";",
"$",
"stores",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"fa... | Returns stores suitable for use with a given definition.
@param cache_definition $definition
@return cache_store[] | [
"Returns",
"stores",
"suitable",
"for",
"use",
"with",
"a",
"given",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L768-L792 |
218,416 | moodle/moodle | cache/classes/helper.php | cache_helper.warnings | public static function warnings(array $stores = null) {
global $CFG;
if ($stores === null) {
require_once($CFG->dirroot.'/cache/locallib.php');
$stores = cache_administration_helper::get_store_instance_summaries();
}
$warnings = array();
foreach ($stores a... | php | public static function warnings(array $stores = null) {
global $CFG;
if ($stores === null) {
require_once($CFG->dirroot.'/cache/locallib.php');
$stores = cache_administration_helper::get_store_instance_summaries();
}
$warnings = array();
foreach ($stores a... | [
"public",
"static",
"function",
"warnings",
"(",
"array",
"$",
"stores",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"$",
"stores",
"===",
"null",
")",
"{",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/cache/locallib.php'",
... | Returns an array of warnings from the cache API.
The warning returned here are for things like conflicting store instance configurations etc.
These get shown on the admin notifications page for example.
@param array|null $stores An array of stores to get warnings for, or null for all.
@return string[] | [
"Returns",
"an",
"array",
"of",
"warnings",
"from",
"the",
"cache",
"API",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L803-L816 |
218,417 | moodle/moodle | enrol/lti/classes/data_connector.php | data_connector.deleteToolConsumer | public function deleteToolConsumer($consumer) {
global $DB;
$consumerpk = $consumer->getRecordId();
$deletecondition = ['consumerid' => $consumerpk];
// Delete any nonce values for this consumer.
$DB->delete_records($this->noncetable, $deletecondition);
// Delete any o... | php | public function deleteToolConsumer($consumer) {
global $DB;
$consumerpk = $consumer->getRecordId();
$deletecondition = ['consumerid' => $consumerpk];
// Delete any nonce values for this consumer.
$DB->delete_records($this->noncetable, $deletecondition);
// Delete any o... | [
"public",
"function",
"deleteToolConsumer",
"(",
"$",
"consumer",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"consumerpk",
"=",
"$",
"consumer",
"->",
"getRecordId",
"(",
")",
";",
"$",
"deletecondition",
"=",
"[",
"'consumerid'",
"=>",
"$",
"consumerpk",
"]... | Delete tool consumer object and related records.
@param ToolConsumer $consumer Consumer object
@return boolean True if the tool consumer object was successfully deleted | [
"Delete",
"tool",
"consumer",
"object",
"and",
"related",
"records",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/classes/data_connector.php#L173-L266 |
218,418 | moodle/moodle | enrol/lti/classes/data_connector.php | data_connector.getToolConsumers | public function getToolConsumers() {
global $DB;
$consumers = [];
$rsconsumers = $DB->get_recordset($this->consumertable, null, 'name');
foreach ($rsconsumers as $row) {
$consumer = new ToolProvider\ToolConsumer($row->consumerkey, $this);
$this->build_tool_consum... | php | public function getToolConsumers() {
global $DB;
$consumers = [];
$rsconsumers = $DB->get_recordset($this->consumertable, null, 'name');
foreach ($rsconsumers as $row) {
$consumer = new ToolProvider\ToolConsumer($row->consumerkey, $this);
$this->build_tool_consum... | [
"public",
"function",
"getToolConsumers",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"consumers",
"=",
"[",
"]",
";",
"$",
"rsconsumers",
"=",
"$",
"DB",
"->",
"get_recordset",
"(",
"$",
"this",
"->",
"consumertable",
",",
"null",
",",
"'name'",
")"... | Load all tool consumers from the database.
@return array | [
"Load",
"all",
"tool",
"consumers",
"from",
"the",
"database",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/classes/data_connector.php#L272-L285 |
218,419 | moodle/moodle | enrol/lti/classes/data_connector.php | data_connector.get_contexts_from_consumer | public function get_contexts_from_consumer(ToolConsumer $consumer) {
global $DB;
$contexts = [];
$contextrecords = $DB->get_records($this->contexttable, ['consumerid' => $consumer->getRecordId()], '', 'lticontextkey');
foreach ($contextrecords as $record) {
$context = Contex... | php | public function get_contexts_from_consumer(ToolConsumer $consumer) {
global $DB;
$contexts = [];
$contextrecords = $DB->get_records($this->contexttable, ['consumerid' => $consumer->getRecordId()], '', 'lticontextkey');
foreach ($contextrecords as $record) {
$context = Contex... | [
"public",
"function",
"get_contexts_from_consumer",
"(",
"ToolConsumer",
"$",
"consumer",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"contexts",
"=",
"[",
"]",
";",
"$",
"contextrecords",
"=",
"$",
"DB",
"->",
"get_records",
"(",
"$",
"this",
"->",
"contextt... | Fetches the list of Context objects that are linked to a ToolConsumer.
@param ToolConsumer $consumer
@return Context[] | [
"Fetches",
"the",
"list",
"of",
"Context",
"objects",
"that",
"are",
"linked",
"to",
"a",
"ToolConsumer",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/classes/data_connector.php#L917-L928 |
218,420 | moodle/moodle | enrol/lti/classes/data_connector.php | data_connector.get_resourcelink_from_consumer | public function get_resourcelink_from_consumer(ToolConsumer $consumer) {
global $DB;
$resourcelink = null;
if ($resourcelinkrecord = $DB->get_record($this->resourcelinktable, ['consumerid' => $consumer->getRecordId()],
'ltiresourcelinkkey')) {
$resourcelink = ResourceLin... | php | public function get_resourcelink_from_consumer(ToolConsumer $consumer) {
global $DB;
$resourcelink = null;
if ($resourcelinkrecord = $DB->get_record($this->resourcelinktable, ['consumerid' => $consumer->getRecordId()],
'ltiresourcelinkkey')) {
$resourcelink = ResourceLin... | [
"public",
"function",
"get_resourcelink_from_consumer",
"(",
"ToolConsumer",
"$",
"consumer",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"resourcelink",
"=",
"null",
";",
"if",
"(",
"$",
"resourcelinkrecord",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"$",
"this... | Fetches a resource link record that is associated with a ToolConsumer.
@param ToolConsumer $consumer
@return ResourceLink | [
"Fetches",
"a",
"resource",
"link",
"record",
"that",
"is",
"associated",
"with",
"a",
"ToolConsumer",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/classes/data_connector.php#L936-L946 |
218,421 | moodle/moodle | enrol/lti/classes/data_connector.php | data_connector.get_resourcelink_from_context | public function get_resourcelink_from_context(Context $context) {
global $DB;
$resourcelink = null;
if ($resourcelinkrecord = $DB->get_record($this->resourcelinktable, ['contextid' => $context->getRecordId()],
'ltiresourcelinkkey')) {
$resourcelink = ResourceLink::fromCo... | php | public function get_resourcelink_from_context(Context $context) {
global $DB;
$resourcelink = null;
if ($resourcelinkrecord = $DB->get_record($this->resourcelinktable, ['contextid' => $context->getRecordId()],
'ltiresourcelinkkey')) {
$resourcelink = ResourceLink::fromCo... | [
"public",
"function",
"get_resourcelink_from_context",
"(",
"Context",
"$",
"context",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"resourcelink",
"=",
"null",
";",
"if",
"(",
"$",
"resourcelinkrecord",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"$",
"this",
"-... | Fetches a resource link record that is associated with a Context object.
@param Context $context
@return ResourceLink | [
"Fetches",
"a",
"resource",
"link",
"record",
"that",
"is",
"associated",
"with",
"a",
"Context",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/classes/data_connector.php#L954-L964 |
218,422 | moodle/moodle | enrol/lti/classes/data_connector.php | data_connector.get_consumers_mapped_to_tool | public function get_consumers_mapped_to_tool($toolid) {
global $DB;
$consumers = [];
$consumerrecords = $DB->get_records('enrol_lti_tool_consumer_map', ['toolid' => $toolid], '', 'consumerid');
foreach ($consumerrecords as $record) {
$consumers[] = ToolConsumer::fromRecordId... | php | public function get_consumers_mapped_to_tool($toolid) {
global $DB;
$consumers = [];
$consumerrecords = $DB->get_records('enrol_lti_tool_consumer_map', ['toolid' => $toolid], '', 'consumerid');
foreach ($consumerrecords as $record) {
$consumers[] = ToolConsumer::fromRecordId... | [
"public",
"function",
"get_consumers_mapped_to_tool",
"(",
"$",
"toolid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"consumers",
"=",
"[",
"]",
";",
"$",
"consumerrecords",
"=",
"$",
"DB",
"->",
"get_records",
"(",
"'enrol_lti_tool_consumer_map'",
",",
"[",
"... | Fetches the list of ToolConsumer objects that are linked to a tool.
@param int $toolid
@return ToolConsumer[] | [
"Fetches",
"the",
"list",
"of",
"ToolConsumer",
"objects",
"that",
"are",
"linked",
"to",
"a",
"tool",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/classes/data_connector.php#L973-L982 |
218,423 | moodle/moodle | enrol/lti/classes/data_connector.php | data_connector.build_tool_consumer_object | protected function build_tool_consumer_object($record, ToolConsumer $consumer) {
$consumer->setRecordId($record->id);
$consumer->name = $record->name;
$key = empty($record->consumerkey) ? $record->consumerkey256 : $record->consumerkey;
$consumer->setKey($key);
$consumer->secret =... | php | protected function build_tool_consumer_object($record, ToolConsumer $consumer) {
$consumer->setRecordId($record->id);
$consumer->name = $record->name;
$key = empty($record->consumerkey) ? $record->consumerkey256 : $record->consumerkey;
$consumer->setKey($key);
$consumer->secret =... | [
"protected",
"function",
"build_tool_consumer_object",
"(",
"$",
"record",
",",
"ToolConsumer",
"$",
"consumer",
")",
"{",
"$",
"consumer",
"->",
"setRecordId",
"(",
"$",
"record",
"->",
"id",
")",
";",
"$",
"consumer",
"->",
"name",
"=",
"$",
"record",
"-... | Builds a ToolConsumer object from a record object from the DB.
@param stdClass $record The DB record object.
@param ToolConsumer $consumer | [
"Builds",
"a",
"ToolConsumer",
"object",
"from",
"a",
"record",
"object",
"from",
"the",
"DB",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/lti/classes/data_connector.php#L990-L1023 |
218,424 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/URI.php | HTMLPurifier_URI.isLocal | public function isLocal($config, $context)
{
if ($this->host === null) {
return true;
}
$uri_def = $config->getDefinition('URI');
if ($uri_def->host === $this->host) {
return true;
}
return false;
} | php | public function isLocal($config, $context)
{
if ($this->host === null) {
return true;
}
$uri_def = $config->getDefinition('URI');
if ($uri_def->host === $this->host) {
return true;
}
return false;
} | [
"public",
"function",
"isLocal",
"(",
"$",
"config",
",",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"host",
"===",
"null",
")",
"{",
"return",
"true",
";",
"}",
"$",
"uri_def",
"=",
"$",
"config",
"->",
"getDefinition",
"(",
"'URI'",
... | Returns true if this URL might be considered a 'local' URL given
the current context. This is true when the host is null, or
when it matches the host supplied to the configuration.
Note that this does not do any scheme checking, so it is mostly
only appropriate for metadata that doesn't care about protocol
security. ... | [
"Returns",
"true",
"if",
"this",
"URL",
"might",
"be",
"considered",
"a",
"local",
"URL",
"given",
"the",
"current",
"context",
".",
"This",
"is",
"true",
"when",
"the",
"host",
"is",
"null",
"or",
"when",
"it",
"matches",
"the",
"host",
"supplied",
"to"... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/URI.php#L273-L283 |
218,425 | moodle/moodle | mod/feedback/classes/responses_table.php | mod_feedback_responses_table.other_cols | public function other_cols($column, $row) {
if (preg_match('/^val(\d+)$/', $column, $matches)) {
$items = $this->feedbackstructure->get_items();
$itemobj = feedback_get_item_class($items[$matches[1]]->typ);
return trim($itemobj->get_printval($items[$matches[1]], (object) ['va... | php | public function other_cols($column, $row) {
if (preg_match('/^val(\d+)$/', $column, $matches)) {
$items = $this->feedbackstructure->get_items();
$itemobj = feedback_get_item_class($items[$matches[1]]->typ);
return trim($itemobj->get_printval($items[$matches[1]], (object) ['va... | [
"public",
"function",
"other_cols",
"(",
"$",
"column",
",",
"$",
"row",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^val(\\d+)$/'",
",",
"$",
"column",
",",
"$",
"matches",
")",
")",
"{",
"$",
"items",
"=",
"$",
"this",
"->",
"feedbackstructure",
"->",... | Allows to set the display column value for all columns without "col_xxxxx" method.
@param string $column column name
@param stdClass $row current record result of SQL query | [
"Allows",
"to",
"set",
"the",
"display",
"column",
"value",
"for",
"all",
"columns",
"without",
"col_xxxxx",
"method",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/responses_table.php#L192-L199 |
218,426 | moodle/moodle | mod/feedback/classes/responses_table.php | mod_feedback_responses_table.col_userpic | public function col_userpic($row) {
global $OUTPUT;
$user = user_picture::unalias($row, [], $this->useridfield);
return $OUTPUT->user_picture($user, array('courseid' => $this->feedbackstructure->get_cm()->course));
} | php | public function col_userpic($row) {
global $OUTPUT;
$user = user_picture::unalias($row, [], $this->useridfield);
return $OUTPUT->user_picture($user, array('courseid' => $this->feedbackstructure->get_cm()->course));
} | [
"public",
"function",
"col_userpic",
"(",
"$",
"row",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"user",
"=",
"user_picture",
"::",
"unalias",
"(",
"$",
"row",
",",
"[",
"]",
",",
"$",
"this",
"->",
"useridfield",
")",
";",
"return",
"$",
"OUTPUT",... | Prepares column userpic for display
@param stdClass $row
@return string | [
"Prepares",
"column",
"userpic",
"for",
"display"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/responses_table.php#L206-L210 |
218,427 | moodle/moodle | mod/feedback/classes/responses_table.php | mod_feedback_responses_table.col_deleteentry | public function col_deleteentry($row) {
global $OUTPUT;
$deleteentryurl = new moodle_url($this->baseurl, ['delete' => $row->id, 'sesskey' => sesskey()]);
$deleteaction = new confirm_action(get_string('confirmdeleteentry', 'feedback'));
return $OUTPUT->action_icon($deleteentryurl,
... | php | public function col_deleteentry($row) {
global $OUTPUT;
$deleteentryurl = new moodle_url($this->baseurl, ['delete' => $row->id, 'sesskey' => sesskey()]);
$deleteaction = new confirm_action(get_string('confirmdeleteentry', 'feedback'));
return $OUTPUT->action_icon($deleteentryurl,
... | [
"public",
"function",
"col_deleteentry",
"(",
"$",
"row",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"deleteentryurl",
"=",
"new",
"moodle_url",
"(",
"$",
"this",
"->",
"baseurl",
",",
"[",
"'delete'",
"=>",
"$",
"row",
"->",
"id",
",",
"'sesskey'",
... | Prepares column deleteentry for display
@param stdClass $row
@return string | [
"Prepares",
"column",
"deleteentry",
"for",
"display"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/responses_table.php#L217-L223 |
218,428 | moodle/moodle | mod/feedback/classes/responses_table.php | mod_feedback_responses_table.get_link_single_entry | protected function get_link_single_entry($row) {
return new moodle_url($this->baseurl, ['userid' => $row->{$this->useridfield}, 'showcompleted' => $row->id]);
} | php | protected function get_link_single_entry($row) {
return new moodle_url($this->baseurl, ['userid' => $row->{$this->useridfield}, 'showcompleted' => $row->id]);
} | [
"protected",
"function",
"get_link_single_entry",
"(",
"$",
"row",
")",
"{",
"return",
"new",
"moodle_url",
"(",
"$",
"this",
"->",
"baseurl",
",",
"[",
"'userid'",
"=>",
"$",
"row",
"->",
"{",
"$",
"this",
"->",
"useridfield",
"}",
",",
"'showcompleted'",... | Returns a link for viewing a single response
@param stdClass $row
@return \moodle_url | [
"Returns",
"a",
"link",
"for",
"viewing",
"a",
"single",
"response"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/responses_table.php#L230-L232 |
218,429 | moodle/moodle | mod/feedback/classes/responses_table.php | mod_feedback_responses_table.col_completed_timemodified | public function col_completed_timemodified($student) {
if ($this->is_downloading()) {
return userdate($student->completed_timemodified);
} else {
return html_writer::link($this->get_link_single_entry($student),
userdate($student->completed_timemodified));
... | php | public function col_completed_timemodified($student) {
if ($this->is_downloading()) {
return userdate($student->completed_timemodified);
} else {
return html_writer::link($this->get_link_single_entry($student),
userdate($student->completed_timemodified));
... | [
"public",
"function",
"col_completed_timemodified",
"(",
"$",
"student",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"is_downloading",
"(",
")",
")",
"{",
"return",
"userdate",
"(",
"$",
"student",
"->",
"completed_timemodified",
")",
";",
"}",
"else",
"{",
"r... | Prepares column completed_timemodified for display
@param stdClass $student
@return string | [
"Prepares",
"column",
"completed_timemodified",
"for",
"display"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/responses_table.php#L239-L246 |
218,430 | moodle/moodle | mod/feedback/classes/responses_table.php | mod_feedback_responses_table.col_courseid | public function col_courseid($row) {
$courses = $this->feedbackstructure->get_completed_courses();
$name = '';
if (isset($courses[$row->courseid])) {
$name = $courses[$row->courseid];
if (!$this->is_downloading()) {
$name = html_writer::link(course_get_url... | php | public function col_courseid($row) {
$courses = $this->feedbackstructure->get_completed_courses();
$name = '';
if (isset($courses[$row->courseid])) {
$name = $courses[$row->courseid];
if (!$this->is_downloading()) {
$name = html_writer::link(course_get_url... | [
"public",
"function",
"col_courseid",
"(",
"$",
"row",
")",
"{",
"$",
"courses",
"=",
"$",
"this",
"->",
"feedbackstructure",
"->",
"get_completed_courses",
"(",
")",
";",
"$",
"name",
"=",
"''",
";",
"if",
"(",
"isset",
"(",
"$",
"courses",
"[",
"$",
... | Prepares column courseid for display
@param array $row
@return string | [
"Prepares",
"column",
"courseid",
"for",
"display"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/responses_table.php#L253-L263 |
218,431 | moodle/moodle | mod/feedback/classes/responses_table.php | mod_feedback_responses_table.col_groups | public function col_groups($row) {
$groups = '';
if ($usergrps = groups_get_all_groups($this->feedbackstructure->get_cm()->course, $row->userid, 0, 'name')) {
foreach ($usergrps as $group) {
$groups .= format_string($group->name). ' ';
}
}
return t... | php | public function col_groups($row) {
$groups = '';
if ($usergrps = groups_get_all_groups($this->feedbackstructure->get_cm()->course, $row->userid, 0, 'name')) {
foreach ($usergrps as $group) {
$groups .= format_string($group->name). ' ';
}
}
return t... | [
"public",
"function",
"col_groups",
"(",
"$",
"row",
")",
"{",
"$",
"groups",
"=",
"''",
";",
"if",
"(",
"$",
"usergrps",
"=",
"groups_get_all_groups",
"(",
"$",
"this",
"->",
"feedbackstructure",
"->",
"get_cm",
"(",
")",
"->",
"course",
",",
"$",
"ro... | Prepares column groups for display
@param array $row
@return string | [
"Prepares",
"column",
"groups",
"for",
"display"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/responses_table.php#L270-L278 |
218,432 | moodle/moodle | mod/feedback/classes/responses_table.php | mod_feedback_responses_table.add_all_values_to_output | protected function add_all_values_to_output() {
$tablecolumns = array_keys($this->columns);
$tableheaders = $this->headers;
$items = $this->feedbackstructure->get_items(true);
if (!$this->is_downloading() && !$this->buildforexternal) {
// In preview mode do not show all colu... | php | protected function add_all_values_to_output() {
$tablecolumns = array_keys($this->columns);
$tableheaders = $this->headers;
$items = $this->feedbackstructure->get_items(true);
if (!$this->is_downloading() && !$this->buildforexternal) {
// In preview mode do not show all colu... | [
"protected",
"function",
"add_all_values_to_output",
"(",
")",
"{",
"$",
"tablecolumns",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"columns",
")",
";",
"$",
"tableheaders",
"=",
"$",
"this",
"->",
"headers",
";",
"$",
"items",
"=",
"$",
"this",
"->",
"f... | Adds common values to the table that do not change the number or order of entries and
are only needed when outputting or downloading data. | [
"Adds",
"common",
"values",
"to",
"the",
"table",
"that",
"do",
"not",
"change",
"the",
"number",
"or",
"order",
"of",
"entries",
"and",
"are",
"only",
"needed",
"when",
"outputting",
"or",
"downloading",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/responses_table.php#L284-L322 |
218,433 | moodle/moodle | mod/feedback/classes/responses_table.php | mod_feedback_responses_table.display | public function display() {
global $OUTPUT;
groups_print_activity_menu($this->feedbackstructure->get_cm(), $this->baseurl->out());
$grandtotal = $this->get_total_responses_count();
if (!$grandtotal) {
echo $OUTPUT->box(get_string('nothingtodisplay'), 'generalbox nothingtodisp... | php | public function display() {
global $OUTPUT;
groups_print_activity_menu($this->feedbackstructure->get_cm(), $this->baseurl->out());
$grandtotal = $this->get_total_responses_count();
if (!$grandtotal) {
echo $OUTPUT->box(get_string('nothingtodisplay'), 'generalbox nothingtodisp... | [
"public",
"function",
"display",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"groups_print_activity_menu",
"(",
"$",
"this",
"->",
"feedbackstructure",
"->",
"get_cm",
"(",
")",
",",
"$",
"this",
"->",
"baseurl",
"->",
"out",
"(",
")",
")",
";",
"$",
... | Displays the table | [
"Displays",
"the",
"table"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/responses_table.php#L409-L435 |
218,434 | moodle/moodle | mod/feedback/classes/responses_table.php | mod_feedback_responses_table.download | public function download() {
\core\session\manager::write_close();
$this->out($this->get_total_responses_count(), false);
exit;
} | php | public function download() {
\core\session\manager::write_close();
$this->out($this->get_total_responses_count(), false);
exit;
} | [
"public",
"function",
"download",
"(",
")",
"{",
"\\",
"core",
"\\",
"session",
"\\",
"manager",
"::",
"write_close",
"(",
")",
";",
"$",
"this",
"->",
"out",
"(",
"$",
"this",
"->",
"get_total_responses_count",
"(",
")",
",",
"false",
")",
";",
"exit"... | Download the data. | [
"Download",
"the",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/responses_table.php#L476-L480 |
218,435 | moodle/moodle | mod/feedback/classes/responses_table.php | mod_feedback_responses_table.build_table_chunk | protected function build_table_chunk(&$rows, &$columnsgroups) {
global $DB;
if (!$rows) {
return;
}
foreach ($columnsgroups as $columnsgroup) {
$fields = 'c.id';
$from = '{feedback_completed} c';
$params = [];
foreach ($columns... | php | protected function build_table_chunk(&$rows, &$columnsgroups) {
global $DB;
if (!$rows) {
return;
}
foreach ($columnsgroups as $columnsgroup) {
$fields = 'c.id';
$from = '{feedback_completed} c';
$params = [];
foreach ($columns... | [
"protected",
"function",
"build_table_chunk",
"(",
"&",
"$",
"rows",
",",
"&",
"$",
"columnsgroups",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"$",
"rows",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"columnsgroups",
"as",
"$",
"colu... | Retrieve additional columns. Database engine may have a limit on number of joins.
@param array $rows Array of rows with already retrieved data, new values will be added to this array
@param array $columnsgroups array of arrays of columns. Each element has up to self::TABLEJOINLIMIT items. This
is easy to calculate but... | [
"Retrieve",
"additional",
"columns",
".",
"Database",
"engine",
"may",
"have",
"a",
"limit",
"on",
"number",
"of",
"joins",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/responses_table.php#L536-L569 |
218,436 | moodle/moodle | mod/feedback/classes/responses_table.php | mod_feedback_responses_table.get_responses_for_external | protected function get_responses_for_external($row) {
$responses = [];
foreach ($row as $el => $val) {
// Get id from column name.
if (preg_match('/^val(\d+)$/', $el, $matches)) {
$id = $matches[1];
$responses[] = [
'id' => $id... | php | protected function get_responses_for_external($row) {
$responses = [];
foreach ($row as $el => $val) {
// Get id from column name.
if (preg_match('/^val(\d+)$/', $el, $matches)) {
$id = $matches[1];
$responses[] = [
'id' => $id... | [
"protected",
"function",
"get_responses_for_external",
"(",
"$",
"row",
")",
"{",
"$",
"responses",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"row",
"as",
"$",
"el",
"=>",
"$",
"val",
")",
"{",
"// Get id from column name.",
"if",
"(",
"preg_match",
"(",
... | Return user responses data ready for the external function.
@param stdClass $row the table row containing the responses
@return array returns the responses ready to be used by an external function
@since Moodle 3.3 | [
"Return",
"user",
"responses",
"data",
"ready",
"for",
"the",
"external",
"function",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/responses_table.php#L592-L608 |
218,437 | moodle/moodle | mod/feedback/classes/responses_table.php | mod_feedback_responses_table.export_external_structure | public function export_external_structure($page = 0, $perpage = 0) {
$this->buildforexternal = true;
$this->add_all_values_to_output();
// Set-up.
$this->setup();
// Override values, if needed.
if ($perpage > 0) {
$this->pageable = true;
$this->cu... | php | public function export_external_structure($page = 0, $perpage = 0) {
$this->buildforexternal = true;
$this->add_all_values_to_output();
// Set-up.
$this->setup();
// Override values, if needed.
if ($perpage > 0) {
$this->pageable = true;
$this->cu... | [
"public",
"function",
"export_external_structure",
"(",
"$",
"page",
"=",
"0",
",",
"$",
"perpage",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"buildforexternal",
"=",
"true",
";",
"$",
"this",
"->",
"add_all_values_to_output",
"(",
")",
";",
"// Set-up.",
"$"... | Exports the table as an external structure handling pagination.
@param int $page page number (for pagination)
@param int $perpage elements per page
@since Moodle 3.3
@return array returns the table ready to be used by an external function | [
"Exports",
"the",
"table",
"as",
"an",
"external",
"structure",
"handling",
"pagination",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/responses_table.php#L635-L653 |
218,438 | moodle/moodle | course/moodleform_mod.php | moodleform_mod.plugin_extend_coursemodule_validation | protected function plugin_extend_coursemodule_validation($data) {
$errors = array();
$callbacks = get_plugins_with_function('coursemodule_validation', 'lib.php');
foreach ($callbacks as $type => $plugins) {
foreach ($plugins as $plugin => $pluginfunction) {
// We hav... | php | protected function plugin_extend_coursemodule_validation($data) {
$errors = array();
$callbacks = get_plugins_with_function('coursemodule_validation', 'lib.php');
foreach ($callbacks as $type => $plugins) {
foreach ($plugins as $plugin => $pluginfunction) {
// We hav... | [
"protected",
"function",
"plugin_extend_coursemodule_validation",
"(",
"$",
"data",
")",
"{",
"$",
"errors",
"=",
"array",
"(",
")",
";",
"$",
"callbacks",
"=",
"get_plugins_with_function",
"(",
"'coursemodule_validation'",
",",
"'lib.php'",
")",
";",
"foreach",
"... | Extend the validation function from any other plugin.
@param stdClass $data The form data.
@return array $errors The list of errors keyed by element name. | [
"Extend",
"the",
"validation",
"function",
"from",
"any",
"other",
"plugin",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/moodleform_mod.php#L453-L467 |
218,439 | moodle/moodle | course/moodleform_mod.php | moodleform_mod.plugin_extend_coursemodule_standard_elements | protected function plugin_extend_coursemodule_standard_elements() {
$callbacks = get_plugins_with_function('coursemodule_standard_elements', 'lib.php');
foreach ($callbacks as $type => $plugins) {
foreach ($plugins as $plugin => $pluginfunction) {
// We have exposed all the i... | php | protected function plugin_extend_coursemodule_standard_elements() {
$callbacks = get_plugins_with_function('coursemodule_standard_elements', 'lib.php');
foreach ($callbacks as $type => $plugins) {
foreach ($plugins as $plugin => $pluginfunction) {
// We have exposed all the i... | [
"protected",
"function",
"plugin_extend_coursemodule_standard_elements",
"(",
")",
"{",
"$",
"callbacks",
"=",
"get_plugins_with_function",
"(",
"'coursemodule_standard_elements'",
",",
"'lib.php'",
")",
";",
"foreach",
"(",
"$",
"callbacks",
"as",
"$",
"type",
"=>",
... | Plugins can extend the coursemodule settings form. | [
"Plugins",
"can",
"extend",
"the",
"coursemodule",
"settings",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/moodleform_mod.php#L743-L752 |
218,440 | moodle/moodle | course/moodleform_mod.php | moodleform_mod.apply_admin_locked_flags | protected function apply_admin_locked_flags() {
global $OUTPUT;
if (!$this->applyadminlockedflags) {
return;
}
$settings = get_config($this->_modname);
$mform = $this->_form;
$lockedicon = html_writer::tag('span',
$OUTP... | php | protected function apply_admin_locked_flags() {
global $OUTPUT;
if (!$this->applyadminlockedflags) {
return;
}
$settings = get_config($this->_modname);
$mform = $this->_form;
$lockedicon = html_writer::tag('span',
$OUTP... | [
"protected",
"function",
"apply_admin_locked_flags",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"applyadminlockedflags",
")",
"{",
"return",
";",
"}",
"$",
"settings",
"=",
"get_config",
"(",
"$",
"this",
"->",
"_modnam... | Get the list of admin settings for this module and apply any locked settings.
This cannot happen in apply_admin_defaults because we do not the current values of the settings
in that function because set_data has not been called yet.
@return void | [
"Get",
"the",
"list",
"of",
"admin",
"settings",
"for",
"this",
"module",
"and",
"apply",
"any",
"locked",
"settings",
".",
"This",
"cannot",
"happen",
"in",
"apply_admin_defaults",
"because",
"we",
"do",
"not",
"the",
"current",
"values",
"of",
"the",
"sett... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/moodleform_mod.php#L994-L1031 |
218,441 | moodle/moodle | rating/classes/privacy/provider.php | provider.export_area_ratings | public static function export_area_ratings(
int $userid,
\context $context,
array $subcontext,
string $component,
string $ratingarea,
int $itemid,
bool $onlyuser = true
) {
global $DB;
$rm = new \rating_manager();
$ratings = $rm->get_a... | php | public static function export_area_ratings(
int $userid,
\context $context,
array $subcontext,
string $component,
string $ratingarea,
int $itemid,
bool $onlyuser = true
) {
global $DB;
$rm = new \rating_manager();
$ratings = $rm->get_a... | [
"public",
"static",
"function",
"export_area_ratings",
"(",
"int",
"$",
"userid",
",",
"\\",
"context",
"$",
"context",
",",
"array",
"$",
"subcontext",
",",
"string",
"$",
"component",
",",
"string",
"$",
"ratingarea",
",",
"int",
"$",
"itemid",
",",
"boo... | Export all ratings which match the specified component, areaid, and itemid.
If requesting ratings for a users own content, and you wish to include all ratings of that content, specify
$onlyuser as false.
When requesting ratings for another users content, you should only export the ratings that the specified user
made... | [
"Export",
"all",
"ratings",
"which",
"match",
"the",
"specified",
"component",
"areaid",
"and",
"itemid",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/classes/privacy/provider.php#L89-L127 |
218,442 | moodle/moodle | rating/classes/privacy/provider.php | provider.get_sql_join | public static function get_sql_join($alias, $component, $ratingarea, $itemidjoin, $userid, $innerjoin = false) {
static $count = 0;
$count++;
$userwhere = '';
if ($innerjoin) {
// Join the rating table with the specified alias and the relevant join params.
$join... | php | public static function get_sql_join($alias, $component, $ratingarea, $itemidjoin, $userid, $innerjoin = false) {
static $count = 0;
$count++;
$userwhere = '';
if ($innerjoin) {
// Join the rating table with the specified alias and the relevant join params.
$join... | [
"public",
"static",
"function",
"get_sql_join",
"(",
"$",
"alias",
",",
"$",
"component",
",",
"$",
"ratingarea",
",",
"$",
"itemidjoin",
",",
"$",
"userid",
",",
"$",
"innerjoin",
"=",
"false",
")",
"{",
"static",
"$",
"count",
"=",
"0",
";",
"$",
"... | Get the SQL required to find all submission items where this user has had any involvements.
If possible an inner join should be used.
@param string $alias The name of the table alias to use.
@param string $component The na eof the component to fetch ratings for.
@param string $r... | [
"Get",
"the",
"SQL",
"required",
"to",
"find",
"all",
"submission",
"items",
"where",
"this",
"user",
"has",
"had",
"any",
"involvements",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/classes/privacy/provider.php#L142-L180 |
218,443 | moodle/moodle | rating/classes/privacy/provider.php | provider.delete_ratings | public static function delete_ratings(\context $context, string $component = null,
string $ratingarea = null, int $itemid = null) {
global $DB;
$options = ['contextid' => $context->id];
if ($component) {
$options['component'] = $component;
}
if ($ratingar... | php | public static function delete_ratings(\context $context, string $component = null,
string $ratingarea = null, int $itemid = null) {
global $DB;
$options = ['contextid' => $context->id];
if ($component) {
$options['component'] = $component;
}
if ($ratingar... | [
"public",
"static",
"function",
"delete_ratings",
"(",
"\\",
"context",
"$",
"context",
",",
"string",
"$",
"component",
"=",
"null",
",",
"string",
"$",
"ratingarea",
"=",
"null",
",",
"int",
"$",
"itemid",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
... | Deletes all ratings for a specified context, component, ratingarea and itemid.
Only delete ratings when the item itself was deleted.
We never delete ratings for one user but not others - this may affect grades, therefore ratings
made by particular user are not considered personal information.
@param \context $conte... | [
"Deletes",
"all",
"ratings",
"for",
"a",
"specified",
"context",
"component",
"ratingarea",
"and",
"itemid",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/rating/classes/privacy/provider.php#L195-L211 |
218,444 | moodle/moodle | lib/adodb/drivers/adodb-mssqlnative.inc.php | ADODB_mssqlnative.CreateSequence2012 | function CreateSequence2012($seq='adodbseq',$start=1){
if (!$this->sequences){
$sql = "SELECT name FROM sys.sequences";
$this->sequences = $this->GetCol($sql);
}
$ok = $this->Execute("CREATE SEQUENCE $seq START WITH $start INCREMENT BY 1");
if (!$ok)
die("CANNOT CREATE SEQUENCE" . print_r(sqlsrv_errors... | php | function CreateSequence2012($seq='adodbseq',$start=1){
if (!$this->sequences){
$sql = "SELECT name FROM sys.sequences";
$this->sequences = $this->GetCol($sql);
}
$ok = $this->Execute("CREATE SEQUENCE $seq START WITH $start INCREMENT BY 1");
if (!$ok)
die("CANNOT CREATE SEQUENCE" . print_r(sqlsrv_errors... | [
"function",
"CreateSequence2012",
"(",
"$",
"seq",
"=",
"'adodbseq'",
",",
"$",
"start",
"=",
"1",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"sequences",
")",
"{",
"$",
"sql",
"=",
"\"SELECT name FROM sys.sequences\"",
";",
"$",
"this",
"->",
"sequenc... | Proper Sequences Only available to Server 2012 and up | [
"Proper",
"Sequences",
"Only",
"available",
"to",
"Server",
"2012",
"and",
"up"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-mssqlnative.inc.php#L259-L268 |
218,445 | moodle/moodle | lib/adodb/drivers/adodb-mssqlnative.inc.php | ADODB_mssqlnative.GenID2012 | function GenID2012($seq='adodbseq',$start=1)
{
/*
* First time in create an array of sequence names that we
* can use in later requests to see if the sequence exists
* the overhead is creating a list of sequences every time
* we need access to at least 1. If we really care about
* performance, we cou... | php | function GenID2012($seq='adodbseq',$start=1)
{
/*
* First time in create an array of sequence names that we
* can use in later requests to see if the sequence exists
* the overhead is creating a list of sequences every time
* we need access to at least 1. If we really care about
* performance, we cou... | [
"function",
"GenID2012",
"(",
"$",
"seq",
"=",
"'adodbseq'",
",",
"$",
"start",
"=",
"1",
")",
"{",
"/*\n\t\t * First time in create an array of sequence names that we\n\t\t * can use in later requests to see if the sequence exists\n\t\t * the overhead is creating a list of sequences eve... | Only available to Server 2012 and up
Cannot do this the normal adodb way by trapping an error if the
sequence does not exist because sql server will auto create a
sequence with the starting number of -9223372036854775808 | [
"Only",
"available",
"to",
"Server",
"2012",
"and",
"up",
"Cannot",
"do",
"this",
"the",
"normal",
"adodb",
"way",
"by",
"trapping",
"an",
"error",
"if",
"the",
"sequence",
"does",
"not",
"exist",
"because",
"sql",
"server",
"will",
"auto",
"create",
"a",
... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-mssqlnative.inc.php#L298-L319 |
218,446 | moodle/moodle | lib/adodb/drivers/adodb-mssqlnative.inc.php | ADORecordset_mssqlnative.NextRecordSet | function NextRecordSet()
{
if (!sqlsrv_next_result($this->_queryID)) return false;
$this->_inited = false;
$this->bind = false;
$this->_currentRow = -1;
$this->Init();
return true;
} | php | function NextRecordSet()
{
if (!sqlsrv_next_result($this->_queryID)) return false;
$this->_inited = false;
$this->bind = false;
$this->_currentRow = -1;
$this->Init();
return true;
} | [
"function",
"NextRecordSet",
"(",
")",
"{",
"if",
"(",
"!",
"sqlsrv_next_result",
"(",
"$",
"this",
"->",
"_queryID",
")",
")",
"return",
"false",
";",
"$",
"this",
"->",
"_inited",
"=",
"false",
";",
"$",
"this",
"->",
"bind",
"=",
"false",
";",
"$"... | get next resultset - requires PHP 4.0.5 or later | [
"get",
"next",
"resultset",
"-",
"requires",
"PHP",
"4",
".",
"0",
".",
"5",
"or",
"later"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-mssqlnative.inc.php#L881-L889 |
218,447 | moodle/moodle | auth/db/auth.php | auth_plugin_db.db_init | function db_init() {
if ($this->is_configured() === false) {
throw new moodle_exception('auth_dbcantconnect', 'auth_db');
}
// Connect to the external database (forcing new connection).
$authdb = ADONewConnection($this->config->type);
if (!empty($this->config->debuga... | php | function db_init() {
if ($this->is_configured() === false) {
throw new moodle_exception('auth_dbcantconnect', 'auth_db');
}
// Connect to the external database (forcing new connection).
$authdb = ADONewConnection($this->config->type);
if (!empty($this->config->debuga... | [
"function",
"db_init",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"is_configured",
"(",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"moodle_exception",
"(",
"'auth_dbcantconnect'",
",",
"'auth_db'",
")",
";",
"}",
"// Connect to the external database (forci... | Connect to external database.
@return ADOConnection
@throws moodle_exception | [
"Connect",
"to",
"external",
"database",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/db/auth.php#L154-L172 |
218,448 | moodle/moodle | auth/db/auth.php | auth_plugin_db.db_attributes | function db_attributes() {
$moodleattributes = array();
// If we have custom fields then merge them with user fields.
$customfields = $this->get_custom_user_profile_fields();
if (!empty($customfields) && !empty($this->userfields)) {
$userfields = array_merge($this->userfields... | php | function db_attributes() {
$moodleattributes = array();
// If we have custom fields then merge them with user fields.
$customfields = $this->get_custom_user_profile_fields();
if (!empty($customfields) && !empty($this->userfields)) {
$userfields = array_merge($this->userfields... | [
"function",
"db_attributes",
"(",
")",
"{",
"$",
"moodleattributes",
"=",
"array",
"(",
")",
";",
"// If we have custom fields then merge them with user fields.",
"$",
"customfields",
"=",
"$",
"this",
"->",
"get_custom_user_profile_fields",
"(",
")",
";",
"if",
"(",
... | Returns user attribute mappings between moodle and the external database.
@return array | [
"Returns",
"user",
"attribute",
"mappings",
"between",
"moodle",
"and",
"the",
"external",
"database",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/db/auth.php#L179-L196 |
218,449 | moodle/moodle | auth/db/auth.php | auth_plugin_db.get_userinfo | function get_userinfo($username) {
global $CFG;
$extusername = core_text::convert($username, 'utf-8', $this->config->extencoding);
$authdb = $this->db_init();
// Array to map local fieldnames we want, to external fieldnames.
$selectfields = $this->db_attributes();
$re... | php | function get_userinfo($username) {
global $CFG;
$extusername = core_text::convert($username, 'utf-8', $this->config->extencoding);
$authdb = $this->db_init();
// Array to map local fieldnames we want, to external fieldnames.
$selectfields = $this->db_attributes();
$re... | [
"function",
"get_userinfo",
"(",
"$",
"username",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"extusername",
"=",
"core_text",
"::",
"convert",
"(",
"$",
"username",
",",
"'utf-8'",
",",
"$",
"this",
"->",
"config",
"->",
"extencoding",
")",
";",
"$",
"a... | Reads any other information for a user from external database,
then returns it in an array.
@param string $username
@return array | [
"Reads",
"any",
"other",
"information",
"for",
"a",
"user",
"from",
"external",
"database",
"then",
"returns",
"it",
"in",
"an",
"array",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/db/auth.php#L205-L246 |
218,450 | moodle/moodle | auth/db/auth.php | auth_plugin_db.user_update_password | function user_update_password($user, $newpassword) {
global $DB;
if ($this->is_internal()) {
$puser = $DB->get_record('user', array('id'=>$user->id), '*', MUST_EXIST);
// This will also update the stored hash to the latest algorithm
// if the existing hash is using a... | php | function user_update_password($user, $newpassword) {
global $DB;
if ($this->is_internal()) {
$puser = $DB->get_record('user', array('id'=>$user->id), '*', MUST_EXIST);
// This will also update the stored hash to the latest algorithm
// if the existing hash is using a... | [
"function",
"user_update_password",
"(",
"$",
"user",
",",
"$",
"newpassword",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"this",
"->",
"is_internal",
"(",
")",
")",
"{",
"$",
"puser",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'user'",
",",
... | Change a user's password.
@param stdClass $user User table object
@param string $newpassword Plaintext password
@return bool True on success | [
"Change",
"a",
"user",
"s",
"password",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/db/auth.php#L255-L273 |
218,451 | moodle/moodle | auth/db/auth.php | auth_plugin_db.get_userinfo_asobj | function get_userinfo_asobj($username) {
$user_array = truncate_userinfo($this->get_userinfo($username));
$user = new stdClass();
foreach($user_array as $key=>$value) {
$user->{$key} = $value;
}
return $user;
} | php | function get_userinfo_asobj($username) {
$user_array = truncate_userinfo($this->get_userinfo($username));
$user = new stdClass();
foreach($user_array as $key=>$value) {
$user->{$key} = $value;
}
return $user;
} | [
"function",
"get_userinfo_asobj",
"(",
"$",
"username",
")",
"{",
"$",
"user_array",
"=",
"truncate_userinfo",
"(",
"$",
"this",
"->",
"get_userinfo",
"(",
"$",
"username",
")",
")",
";",
"$",
"user",
"=",
"new",
"stdClass",
"(",
")",
";",
"foreach",
"("... | Reads user information from DB and return it in an object.
@param string $username username
@return array | [
"Reads",
"user",
"information",
"from",
"DB",
"and",
"return",
"it",
"in",
"an",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/db/auth.php#L546-L553 |
218,452 | moodle/moodle | auth/db/auth.php | auth_plugin_db.change_password_url | function change_password_url() {
if ($this->is_internal() || empty($this->config->changepasswordurl)) {
// Standard form.
return null;
} else {
// Use admin defined custom url.
return new moodle_url($this->config->changepasswordurl);
}
} | php | function change_password_url() {
if ($this->is_internal() || empty($this->config->changepasswordurl)) {
// Standard form.
return null;
} else {
// Use admin defined custom url.
return new moodle_url($this->config->changepasswordurl);
}
} | [
"function",
"change_password_url",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"is_internal",
"(",
")",
"||",
"empty",
"(",
"$",
"this",
"->",
"config",
"->",
"changepasswordurl",
")",
")",
"{",
"// Standard form.",
"return",
"null",
";",
"}",
"else",
"... | Returns the URL for changing the user's pw, or empty if the default can
be used.
@return moodle_url | [
"Returns",
"the",
"URL",
"for",
"changing",
"the",
"user",
"s",
"pw",
"or",
"empty",
"if",
"the",
"default",
"can",
"be",
"used",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/db/auth.php#L671-L679 |
218,453 | moodle/moodle | auth/db/auth.php | auth_plugin_db.ext_addslashes | function ext_addslashes($text) {
if (empty($this->config->sybasequoting)) {
$text = str_replace('\\', '\\\\', $text);
$text = str_replace(array('\'', '"', "\0"), array('\\\'', '\\"', '\\0'), $text);
} else {
$text = str_replace("'", "''", $text);
}
ret... | php | function ext_addslashes($text) {
if (empty($this->config->sybasequoting)) {
$text = str_replace('\\', '\\\\', $text);
$text = str_replace(array('\'', '"', "\0"), array('\\\'', '\\"', '\\0'), $text);
} else {
$text = str_replace("'", "''", $text);
}
ret... | [
"function",
"ext_addslashes",
"(",
"$",
"text",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"config",
"->",
"sybasequoting",
")",
")",
"{",
"$",
"text",
"=",
"str_replace",
"(",
"'\\\\'",
",",
"'\\\\\\\\'",
",",
"$",
"text",
")",
";",
"$",
... | Add slashes, we can not use placeholders or system functions.
@param string $text
@return string | [
"Add",
"slashes",
"we",
"can",
"not",
"use",
"placeholders",
"or",
"system",
"functions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/db/auth.php#L696-L704 |
218,454 | moodle/moodle | lib/upgradelib.php | core_upgrade_time.record_savepoint | public static function record_savepoint($version) {
global $CFG, $OUTPUT;
// In developer debug mode we show a notification after each individual save point.
if ($CFG->debugdeveloper && self::$isrecording) {
$time = microtime(true);
$notification = new \core\output\noti... | php | public static function record_savepoint($version) {
global $CFG, $OUTPUT;
// In developer debug mode we show a notification after each individual save point.
if ($CFG->debugdeveloper && self::$isrecording) {
$time = microtime(true);
$notification = new \core\output\noti... | [
"public",
"static",
"function",
"record_savepoint",
"(",
"$",
"version",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"OUTPUT",
";",
"// In developer debug mode we show a notification after each individual save point.",
"if",
"(",
"$",
"CFG",
"->",
"debugdeveloper",
"&&",
... | Records current time at the end of a given numbered step.
@param float $version Version number (may have decimals, or not) | [
"Records",
"current",
"time",
"at",
"the",
"end",
"of",
"a",
"given",
"numbered",
"step",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/upgradelib.php#L165-L179 |
218,455 | moodle/moodle | lib/markdown/Markdown.php | Markdown.setup | protected function setup() {
// Clear global hashes.
$this->urls = $this->predef_urls;
$this->titles = $this->predef_titles;
$this->html_hashes = array();
$this->in_anchor = false;
} | php | protected function setup() {
// Clear global hashes.
$this->urls = $this->predef_urls;
$this->titles = $this->predef_titles;
$this->html_hashes = array();
$this->in_anchor = false;
} | [
"protected",
"function",
"setup",
"(",
")",
"{",
"// Clear global hashes.",
"$",
"this",
"->",
"urls",
"=",
"$",
"this",
"->",
"predef_urls",
";",
"$",
"this",
"->",
"titles",
"=",
"$",
"this",
"->",
"predef_titles",
";",
"$",
"this",
"->",
"html_hashes",
... | Called before the transformation process starts to setup parser states.
@return void | [
"Called",
"before",
"the",
"transformation",
"process",
"starts",
"to",
"setup",
"parser",
"states",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/markdown/Markdown.php#L194-L200 |
218,456 | moodle/moodle | lib/markdown/Markdown.php | Markdown.runSpanGamut | protected function runSpanGamut($text) {
foreach ($this->span_gamut as $method => $priority) {
$text = $this->$method($text);
}
return $text;
} | php | protected function runSpanGamut($text) {
foreach ($this->span_gamut as $method => $priority) {
$text = $this->$method($text);
}
return $text;
} | [
"protected",
"function",
"runSpanGamut",
"(",
"$",
"text",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"span_gamut",
"as",
"$",
"method",
"=>",
"$",
"priority",
")",
"{",
"$",
"text",
"=",
"$",
"this",
"->",
"$",
"method",
"(",
"$",
"text",
")",
"... | Run span gamut transformations
@param string $text
@return string | [
"Run",
"span",
"gamut",
"transformations"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/markdown/Markdown.php#L617-L623 |
218,457 | moodle/moodle | lib/markdown/Markdown.php | Markdown.doHardBreaks | protected function doHardBreaks($text) {
if ($this->hard_wrap) {
return preg_replace_callback('/ *\n/',
array($this, '_doHardBreaks_callback'), $text);
} else {
return preg_replace_callback('/ {2,}\n/',
array($this, '_doHardBreaks_callback'), $text);
}
} | php | protected function doHardBreaks($text) {
if ($this->hard_wrap) {
return preg_replace_callback('/ *\n/',
array($this, '_doHardBreaks_callback'), $text);
} else {
return preg_replace_callback('/ {2,}\n/',
array($this, '_doHardBreaks_callback'), $text);
}
} | [
"protected",
"function",
"doHardBreaks",
"(",
"$",
"text",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hard_wrap",
")",
"{",
"return",
"preg_replace_callback",
"(",
"'/ *\\n/'",
",",
"array",
"(",
"$",
"this",
",",
"'_doHardBreaks_callback'",
")",
",",
"$",
"... | Do hard breaks
@param string $text
@return string | [
"Do",
"hard",
"breaks"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/markdown/Markdown.php#L630-L638 |
218,458 | moodle/moodle | lib/markdown/Markdown.php | Markdown._generateIdFromHeaderValue | protected function _generateIdFromHeaderValue($headerValue) {
if (!is_callable($this->header_id_func)) {
return "";
}
$idValue = call_user_func($this->header_id_func, $headerValue);
if (!$idValue) {
return "";
}
return ' id="' . $this->encodeAttribute($idValue) . '"';
} | php | protected function _generateIdFromHeaderValue($headerValue) {
if (!is_callable($this->header_id_func)) {
return "";
}
$idValue = call_user_func($this->header_id_func, $headerValue);
if (!$idValue) {
return "";
}
return ' id="' . $this->encodeAttribute($idValue) . '"';
} | [
"protected",
"function",
"_generateIdFromHeaderValue",
"(",
"$",
"headerValue",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"this",
"->",
"header_id_func",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"$",
"idValue",
"=",
"call_user_func",
"(",
"$",
"... | If a header_id_func property is set, we can use it to automatically
generate an id attribute.
This method returns a string in the form id="foo", or an empty string
otherwise.
@param string $headerValue
@return string | [
"If",
"a",
"header_id_func",
"property",
"is",
"set",
"we",
"can",
"use",
"it",
"to",
"automatically",
"generate",
"an",
"id",
"attribute",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/markdown/Markdown.php#L980-L991 |
218,459 | moodle/moodle | lib/markdown/Markdown.php | Markdown._doLists_callback | protected function _doLists_callback($matches) {
// Re-usable patterns to match list item bullets and number markers:
$marker_ul_re = '[*+-]';
$marker_ol_re = '\d+[\.]';
$marker_any_re = "(?:$marker_ul_re|$marker_ol_re)";
$marker_ol_start_re = '[0-9]+';
$list = $matches[1];
$list_type = preg_match("/$m... | php | protected function _doLists_callback($matches) {
// Re-usable patterns to match list item bullets and number markers:
$marker_ul_re = '[*+-]';
$marker_ol_re = '\d+[\.]';
$marker_any_re = "(?:$marker_ul_re|$marker_ol_re)";
$marker_ol_start_re = '[0-9]+';
$list = $matches[1];
$list_type = preg_match("/$m... | [
"protected",
"function",
"_doLists_callback",
"(",
"$",
"matches",
")",
"{",
"// Re-usable patterns to match list item bullets and number markers:",
"$",
"marker_ul_re",
"=",
"'[*+-]'",
";",
"$",
"marker_ol_re",
"=",
"'\\d+[\\.]'",
";",
"$",
"marker_any_re",
"=",
"\"(?:$m... | List parsing callback
@param array $matches
@return string | [
"List",
"parsing",
"callback"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/markdown/Markdown.php#L1065-L1098 |
218,460 | moodle/moodle | lib/markdown/Markdown.php | Markdown._processListItems_callback | protected function _processListItems_callback($matches) {
$item = $matches[4];
$leading_line =& $matches[1];
$leading_space =& $matches[2];
$marker_space = $matches[3];
$tailing_blank_line =& $matches[5];
if ($leading_line || $tailing_blank_line ||
preg_match('/\n{2,}/', $item))
{
// Replace marke... | php | protected function _processListItems_callback($matches) {
$item = $matches[4];
$leading_line =& $matches[1];
$leading_space =& $matches[2];
$marker_space = $matches[3];
$tailing_blank_line =& $matches[5];
if ($leading_line || $tailing_blank_line ||
preg_match('/\n{2,}/', $item))
{
// Replace marke... | [
"protected",
"function",
"_processListItems_callback",
"(",
"$",
"matches",
")",
"{",
"$",
"item",
"=",
"$",
"matches",
"[",
"4",
"]",
";",
"$",
"leading_line",
"=",
"&",
"$",
"matches",
"[",
"1",
"]",
";",
"$",
"leading_space",
"=",
"&",
"$",
"matches... | List item parsing callback
@param array $matches
@return string | [
"List",
"item",
"parsing",
"callback"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/markdown/Markdown.php#L1162-L1182 |
218,461 | moodle/moodle | lib/markdown/Markdown.php | Markdown._doCodeBlocks_callback | protected function _doCodeBlocks_callback($matches) {
$codeblock = $matches[1];
$codeblock = $this->outdent($codeblock);
if ($this->code_block_content_func) {
$codeblock = call_user_func($this->code_block_content_func, $codeblock, "");
} else {
$codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
}... | php | protected function _doCodeBlocks_callback($matches) {
$codeblock = $matches[1];
$codeblock = $this->outdent($codeblock);
if ($this->code_block_content_func) {
$codeblock = call_user_func($this->code_block_content_func, $codeblock, "");
} else {
$codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
}... | [
"protected",
"function",
"_doCodeBlocks_callback",
"(",
"$",
"matches",
")",
"{",
"$",
"codeblock",
"=",
"$",
"matches",
"[",
"1",
"]",
";",
"$",
"codeblock",
"=",
"$",
"this",
"->",
"outdent",
"(",
"$",
"codeblock",
")",
";",
"if",
"(",
"$",
"this",
... | Code block parsing callback
@param array $matches
@return string | [
"Code",
"block",
"parsing",
"callback"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/markdown/Markdown.php#L1210-L1225 |
218,462 | moodle/moodle | lib/markdown/Markdown.php | Markdown._doAutoLinks_url_callback | protected function _doAutoLinks_url_callback($matches) {
$url = $this->encodeURLAttribute($matches[1], $text);
$link = "<a href=\"$url\">$text</a>";
return $this->hashPart($link);
} | php | protected function _doAutoLinks_url_callback($matches) {
$url = $this->encodeURLAttribute($matches[1], $text);
$link = "<a href=\"$url\">$text</a>";
return $this->hashPart($link);
} | [
"protected",
"function",
"_doAutoLinks_url_callback",
"(",
"$",
"matches",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"encodeURLAttribute",
"(",
"$",
"matches",
"[",
"1",
"]",
",",
"$",
"text",
")",
";",
"$",
"link",
"=",
"\"<a href=\\\"$url\\\">$text</a>... | Parse URL callback
@param array $matches
@return string | [
"Parse",
"URL",
"callback"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/markdown/Markdown.php#L1646-L1650 |
218,463 | moodle/moodle | lib/markdown/Markdown.php | Markdown._doAutoLinks_email_callback | protected function _doAutoLinks_email_callback($matches) {
$addr = $matches[1];
$url = $this->encodeURLAttribute("mailto:$addr", $text);
$link = "<a href=\"$url\">$text</a>";
return $this->hashPart($link);
} | php | protected function _doAutoLinks_email_callback($matches) {
$addr = $matches[1];
$url = $this->encodeURLAttribute("mailto:$addr", $text);
$link = "<a href=\"$url\">$text</a>";
return $this->hashPart($link);
} | [
"protected",
"function",
"_doAutoLinks_email_callback",
"(",
"$",
"matches",
")",
"{",
"$",
"addr",
"=",
"$",
"matches",
"[",
"1",
"]",
";",
"$",
"url",
"=",
"$",
"this",
"->",
"encodeURLAttribute",
"(",
"\"mailto:$addr\"",
",",
"$",
"text",
")",
";",
"$... | Parse email address callback
@param array $matches
@return string | [
"Parse",
"email",
"address",
"callback"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/markdown/Markdown.php#L1657-L1662 |
218,464 | moodle/moodle | filter/tex/latex.php | latex.construct_latex_document | function construct_latex_document( $formula, $fontsize=12 ) {
global $CFG;
$formula = filter_tex_sanitize_formula($formula);
// $fontsize don't affects to formula's size. $density can change size
$doc = "\\documentclass[{$fontsize}pt]{article}\n";
$doc .= g... | php | function construct_latex_document( $formula, $fontsize=12 ) {
global $CFG;
$formula = filter_tex_sanitize_formula($formula);
// $fontsize don't affects to formula's size. $density can change size
$doc = "\\documentclass[{$fontsize}pt]{article}\n";
$doc .= g... | [
"function",
"construct_latex_document",
"(",
"$",
"formula",
",",
"$",
"fontsize",
"=",
"12",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"formula",
"=",
"filter_tex_sanitize_formula",
"(",
"$",
"formula",
")",
";",
"// $fontsize don't affects to formula's size. $dens... | Turn the bit of TeX into a valid latex document
@param string $forumula the TeX formula
@param int $fontsize the font size
@return string the latex document | [
"Turn",
"the",
"bit",
"of",
"TeX",
"into",
"a",
"valid",
"latex",
"document"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/filter/tex/latex.php#L50-L68 |
218,465 | moodle/moodle | filter/tex/latex.php | latex.execute | function execute( $command, $log=null ) {
$output = array();
exec( $command, $output, $return_code );
if ($log) {
fwrite( $log, "COMMAND: $command \n" );
$outputs = implode( "\n", $output );
fwrite( $log, "OUTPUT: $outputs \n" );
... | php | function execute( $command, $log=null ) {
$output = array();
exec( $command, $output, $return_code );
if ($log) {
fwrite( $log, "COMMAND: $command \n" );
$outputs = implode( "\n", $output );
fwrite( $log, "OUTPUT: $outputs \n" );
... | [
"function",
"execute",
"(",
"$",
"command",
",",
"$",
"log",
"=",
"null",
")",
"{",
"$",
"output",
"=",
"array",
"(",
")",
";",
"exec",
"(",
"$",
"command",
",",
"$",
"output",
",",
"$",
"return_code",
")",
";",
"if",
"(",
"$",
"log",
")",
"{",... | execute an external command, with optional logging
@param string $command command to execute
@param file $log valid open file handle - log info will be written to this file
@return return code from execution of command | [
"execute",
"an",
"external",
"command",
"with",
"optional",
"logging"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/filter/tex/latex.php#L76-L86 |
218,466 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client._getServerBaseURL | private function _getServerBaseURL()
{
// the URL is build only when needed
if ( empty($this->_server['base_url']) ) {
$this->_server['base_url'] = 'https://' . $this->_getServerHostname();
if ($this->_getServerPort()!=443) {
$this->_server['base_url'] .= ':'
... | php | private function _getServerBaseURL()
{
// the URL is build only when needed
if ( empty($this->_server['base_url']) ) {
$this->_server['base_url'] = 'https://' . $this->_getServerHostname();
if ($this->_getServerPort()!=443) {
$this->_server['base_url'] .= ':'
... | [
"private",
"function",
"_getServerBaseURL",
"(",
")",
"{",
"// the URL is build only when needed",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_server",
"[",
"'base_url'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"_server",
"[",
"'base_url'",
"]",
"=",
"'http... | This method is used to retrieve the base URL of the CAS server.
@return string a URL. | [
"This",
"method",
"is",
"used",
"to",
"retrieve",
"the",
"base",
"URL",
"of",
"the",
"CAS",
"server",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L313-L325 |
218,467 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client.getServerLoginURL | public function getServerLoginURL($gateway=false,$renew=false)
{
phpCAS::traceBegin();
// the URL is build only when needed
if ( empty($this->_server['login_url']) ) {
$this->_server['login_url'] = $this->_buildQueryUrl($this->_getServerBaseURL().'login','service='.urlencode($thi... | php | public function getServerLoginURL($gateway=false,$renew=false)
{
phpCAS::traceBegin();
// the URL is build only when needed
if ( empty($this->_server['login_url']) ) {
$this->_server['login_url'] = $this->_buildQueryUrl($this->_getServerBaseURL().'login','service='.urlencode($thi... | [
"public",
"function",
"getServerLoginURL",
"(",
"$",
"gateway",
"=",
"false",
",",
"$",
"renew",
"=",
"false",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"// the URL is build only when needed",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_server... | This method is used to retrieve the login URL of the CAS server.
@param bool $gateway true to check authentication, false to force it
@param bool $renew true to force the authentication with the CAS server
@return a URL.
@note It is recommended that CAS implementations ignore the "gateway"
parameter if "renew" is s... | [
"This",
"method",
"is",
"used",
"to",
"retrieve",
"the",
"login",
"URL",
"of",
"the",
"CAS",
"server",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L337-L356 |
218,468 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client.getServerSamlValidateURL | public function getServerSamlValidateURL()
{
phpCAS::traceBegin();
// the URL is build only when needed
if ( empty($this->_server['saml_validate_url']) ) {
switch ($this->getServerVersion()) {
case SAML_VERSION_1_1:
$this->_server['saml_validate_url'] ... | php | public function getServerSamlValidateURL()
{
phpCAS::traceBegin();
// the URL is build only when needed
if ( empty($this->_server['saml_validate_url']) ) {
switch ($this->getServerVersion()) {
case SAML_VERSION_1_1:
$this->_server['saml_validate_url'] ... | [
"public",
"function",
"getServerSamlValidateURL",
"(",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"// the URL is build only when needed",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_server",
"[",
"'saml_validate_url'",
"]",
")",
")",
"{",
"switch",... | This method is used to retrieve the SAML validating URL of the CAS server.
@return string samlValidate URL. | [
"This",
"method",
"is",
"used",
"to",
"retrieve",
"the",
"SAML",
"validating",
"URL",
"of",
"the",
"CAS",
"server",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L463-L481 |
218,469 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client.getServerProxyValidateURL | public function getServerProxyValidateURL()
{
phpCAS::traceBegin();
// the URL is build only when needed
if ( empty($this->_server['proxy_validate_url']) ) {
switch ($this->getServerVersion()) {
case CAS_VERSION_1_0:
$this->_server['proxy_validate_url'... | php | public function getServerProxyValidateURL()
{
phpCAS::traceBegin();
// the URL is build only when needed
if ( empty($this->_server['proxy_validate_url']) ) {
switch ($this->getServerVersion()) {
case CAS_VERSION_1_0:
$this->_server['proxy_validate_url'... | [
"public",
"function",
"getServerProxyValidateURL",
"(",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"// the URL is build only when needed",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_server",
"[",
"'proxy_validate_url'",
"]",
")",
")",
"{",
"switch... | This method is used to retrieve the proxy validating URL of the CAS server.
@return string proxyValidate URL. | [
"This",
"method",
"is",
"used",
"to",
"retrieve",
"the",
"proxy",
"validating",
"URL",
"of",
"the",
"CAS",
"server",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L488-L511 |
218,470 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client.getServerProxyURL | public function getServerProxyURL()
{
// the URL is build only when needed
if ( empty($this->_server['proxy_url']) ) {
switch ($this->getServerVersion()) {
case CAS_VERSION_1_0:
$this->_server['proxy_url'] = '';
break;
case CAS_VERS... | php | public function getServerProxyURL()
{
// the URL is build only when needed
if ( empty($this->_server['proxy_url']) ) {
switch ($this->getServerVersion()) {
case CAS_VERSION_1_0:
$this->_server['proxy_url'] = '';
break;
case CAS_VERS... | [
"public",
"function",
"getServerProxyURL",
"(",
")",
"{",
"// the URL is build only when needed",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_server",
"[",
"'proxy_url'",
"]",
")",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getServerVersion",
"(",
")",
"... | This method is used to retrieve the proxy URL of the CAS server.
@return string proxy URL. | [
"This",
"method",
"is",
"used",
"to",
"retrieve",
"the",
"proxy",
"URL",
"of",
"the",
"CAS",
"server",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L519-L534 |
218,471 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client.getServerLogoutURL | public function getServerLogoutURL()
{
// the URL is build only when needed
if ( empty($this->_server['logout_url']) ) {
$this->_server['logout_url'] = $this->_getServerBaseURL().'logout';
}
return $this->_server['logout_url'];
} | php | public function getServerLogoutURL()
{
// the URL is build only when needed
if ( empty($this->_server['logout_url']) ) {
$this->_server['logout_url'] = $this->_getServerBaseURL().'logout';
}
return $this->_server['logout_url'];
} | [
"public",
"function",
"getServerLogoutURL",
"(",
")",
"{",
"// the URL is build only when needed",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_server",
"[",
"'logout_url'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"_server",
"[",
"'logout_url'",
"]",
"=",
"$... | This method is used to retrieve the logout URL of the CAS server.
@return string logout URL. | [
"This",
"method",
"is",
"used",
"to",
"retrieve",
"the",
"logout",
"URL",
"of",
"the",
"CAS",
"server",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L541-L548 |
218,472 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client.ensureAuthenticationCallSuccessful | public function ensureAuthenticationCallSuccessful()
{
$this->_ensureAuthenticationCalled();
if (!$this->_authentication_caller['result']) {
throw new CAS_OutOfSequenceException(
'authentication was checked (by '
. $this->getAuthenticationCallerMethod()
... | php | public function ensureAuthenticationCallSuccessful()
{
$this->_ensureAuthenticationCalled();
if (!$this->_authentication_caller['result']) {
throw new CAS_OutOfSequenceException(
'authentication was checked (by '
. $this->getAuthenticationCallerMethod()
... | [
"public",
"function",
"ensureAuthenticationCallSuccessful",
"(",
")",
"{",
"$",
"this",
"->",
"_ensureAuthenticationCalled",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"_authentication_caller",
"[",
"'result'",
"]",
")",
"{",
"throw",
"new",
"CAS_OutOfSeq... | Ensure that authentication was checked. Terminate with exception if no
authentication was performed
@throws CAS_OutOfSequenceBeforeAuthenticationCallException
@return void | [
"Ensure",
"that",
"authentication",
"was",
"checked",
".",
"Terminate",
"with",
"exception",
"if",
"no",
"authentication",
"was",
"performed"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L822-L834 |
218,473 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client.getAttributes | public function getAttributes()
{
// Sequence validation
$this->ensureAuthenticationCallSuccessful();
// This is likely a duplicate check that could be removed....
if ( empty($this->_user) ) {
// if no user is set, there shouldn't be any attributes also...
phpCAS::erro... | php | public function getAttributes()
{
// Sequence validation
$this->ensureAuthenticationCallSuccessful();
// This is likely a duplicate check that could be removed....
if ( empty($this->_user) ) {
// if no user is set, there shouldn't be any attributes also...
phpCAS::erro... | [
"public",
"function",
"getAttributes",
"(",
")",
"{",
"// Sequence validation",
"$",
"this",
"->",
"ensureAuthenticationCallSuccessful",
"(",
")",
";",
"// This is likely a duplicate check that could be removed....",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_user",
... | Get an key values arry of attributes
@return arry of attributes | [
"Get",
"an",
"key",
"values",
"arry",
"of",
"attributes"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L1172-L1185 |
218,474 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client.getAttribute | public function getAttribute($key)
{
// Sequence validation
$this->ensureAuthenticationCallSuccessful();
if ($this->_hasAttribute($key)) {
return $this->_attributes[$key];
}
} | php | public function getAttribute($key)
{
// Sequence validation
$this->ensureAuthenticationCallSuccessful();
if ($this->_hasAttribute($key)) {
return $this->_attributes[$key];
}
} | [
"public",
"function",
"getAttribute",
"(",
"$",
"key",
")",
"{",
"// Sequence validation",
"$",
"this",
"->",
"ensureAuthenticationCallSuccessful",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_hasAttribute",
"(",
"$",
"key",
")",
")",
"{",
"return",
"$",
... | Get a specific attribute by name
@param string $key name of attribute
@return string attribute values | [
"Get",
"a",
"specific",
"attribute",
"by",
"name"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L1234-L1242 |
218,475 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client.forceAuthentication | public function forceAuthentication()
{
phpCAS::traceBegin();
if ( $this->isAuthenticated() ) {
// the user is authenticated, nothing to be done.
phpCAS::trace('no need to authenticate');
$res = true;
} else {
// the user is not authenticated,... | php | public function forceAuthentication()
{
phpCAS::traceBegin();
if ( $this->isAuthenticated() ) {
// the user is authenticated, nothing to be done.
phpCAS::trace('no need to authenticate');
$res = true;
} else {
// the user is not authenticated,... | [
"public",
"function",
"forceAuthentication",
"(",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isAuthenticated",
"(",
")",
")",
"{",
"// the user is authenticated, nothing to be done.",
"phpCAS",
"::",
"trace",
"(",
"'no ... | This method is called to be sure that the user is authenticated. When not
authenticated, halt by redirecting to the CAS server; otherwise return true.
@return true when the user is authenticated; otherwise halt. | [
"This",
"method",
"is",
"called",
"to",
"be",
"sure",
"that",
"the",
"user",
"is",
"authenticated",
".",
"When",
"not",
"authenticated",
"halt",
"by",
"redirecting",
"to",
"the",
"CAS",
"server",
";",
"otherwise",
"return",
"true",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L1276-L1295 |
218,476 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client.checkAuthentication | public function checkAuthentication()
{
phpCAS::traceBegin();
$res = false;
if ( $this->isAuthenticated() ) {
phpCAS::trace('user is authenticated');
/* The 'auth_checked' variable is removed just in case it's set. */
unset($_SESSION['phpCAS']['auth_checke... | php | public function checkAuthentication()
{
phpCAS::traceBegin();
$res = false;
if ( $this->isAuthenticated() ) {
phpCAS::trace('user is authenticated');
/* The 'auth_checked' variable is removed just in case it's set. */
unset($_SESSION['phpCAS']['auth_checke... | [
"public",
"function",
"checkAuthentication",
"(",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"$",
"res",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"isAuthenticated",
"(",
")",
")",
"{",
"phpCAS",
"::",
"trace",
"(",
"'user is authentic... | This method is called to check whether the user is authenticated or not.
@return true when the user is authenticated, false when a previous
gateway login failed or the function will not return if the user is
redirected to the cas server for a gateway login attempt | [
"This",
"method",
"is",
"called",
"to",
"check",
"whether",
"the",
"user",
"is",
"authenticated",
"or",
"not",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L1327-L1377 |
218,477 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client.setCasServerCACert | public function setCasServerCACert($cert, $validate_cn)
{
// Argument validation
if (gettype($cert) != 'string') {
throw new CAS_TypeMismatchException($cert, '$cert', 'string');
}
if (gettype($validate_cn) != 'boolean') {
throw new CAS_TypeMismatchException($valid... | php | public function setCasServerCACert($cert, $validate_cn)
{
// Argument validation
if (gettype($cert) != 'string') {
throw new CAS_TypeMismatchException($cert, '$cert', 'string');
}
if (gettype($validate_cn) != 'boolean') {
throw new CAS_TypeMismatchException($valid... | [
"public",
"function",
"setCasServerCACert",
"(",
"$",
"cert",
",",
"$",
"validate_cn",
")",
"{",
"// Argument validation",
"if",
"(",
"gettype",
"(",
"$",
"cert",
")",
"!=",
"'string'",
")",
"{",
"throw",
"new",
"CAS_TypeMismatchException",
"(",
"$",
"cert",
... | Set the CA certificate of the CAS server.
@param string $cert the PEM certificate file name of the CA that emited
the cert of the server
@param bool $validate_cn valiate CN of the CAS server certificate
@return void | [
"Set",
"the",
"CA",
"certificate",
"of",
"the",
"CAS",
"server",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L1944-L1958 |
218,478 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client._setSessionAttributes | private function _setSessionAttributes($text_response)
{
phpCAS::traceBegin();
$result = false;
$attr_array = array();
// create new DOMDocument Object
$dom = new DOMDocument();
// Fix possible whitspace problems
$dom->preserveWhiteSpace = false;
if... | php | private function _setSessionAttributes($text_response)
{
phpCAS::traceBegin();
$result = false;
$attr_array = array();
// create new DOMDocument Object
$dom = new DOMDocument();
// Fix possible whitspace problems
$dom->preserveWhiteSpace = false;
if... | [
"private",
"function",
"_setSessionAttributes",
"(",
"$",
"text_response",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"$",
"result",
"=",
"false",
";",
"$",
"attr_array",
"=",
"array",
"(",
")",
";",
"// create new DOMDocument Object",
"$",
"dom",
... | This method will parse the DOM and pull out the attributes from the SAML
payload and put them into an array, then put the array into the session.
@param string $text_response the SAML payload.
@return bool true when successfull and false if no attributes a found | [
"This",
"method",
"will",
"parse",
"the",
"DOM",
"and",
"pull",
"out",
"the",
"attributes",
"from",
"the",
"SAML",
"payload",
"and",
"put",
"them",
"into",
"an",
"array",
"then",
"put",
"the",
"array",
"into",
"the",
"session",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L2162-L2208 |
218,479 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client.setCallbackURL | public function setCallbackURL($url)
{
// Sequence validation
$this->ensureIsProxy();
// Argument Validation
if (gettype($url) != 'string')
throw new CAS_TypeMismatchException($url, '$url', 'string');
return $this->_callback_url = $url;
} | php | public function setCallbackURL($url)
{
// Sequence validation
$this->ensureIsProxy();
// Argument Validation
if (gettype($url) != 'string')
throw new CAS_TypeMismatchException($url, '$url', 'string');
return $this->_callback_url = $url;
} | [
"public",
"function",
"setCallbackURL",
"(",
"$",
"url",
")",
"{",
"// Sequence validation",
"$",
"this",
"->",
"ensureIsProxy",
"(",
")",
";",
"// Argument Validation",
"if",
"(",
"gettype",
"(",
"$",
"url",
")",
"!=",
"'string'",
")",
"throw",
"new",
"CAS_... | This method sets the callback url.
@param string $url url to set callback
@return void | [
"This",
"method",
"sets",
"the",
"callback",
"url",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L2383-L2392 |
218,480 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client._storePGT | private function _storePGT($pgt,$pgt_iou)
{
// ensure that storage is initialized
$this->_initPGTStorage();
// writes the PGT
$this->_pgt_storage->write($pgt, $pgt_iou);
} | php | private function _storePGT($pgt,$pgt_iou)
{
// ensure that storage is initialized
$this->_initPGTStorage();
// writes the PGT
$this->_pgt_storage->write($pgt, $pgt_iou);
} | [
"private",
"function",
"_storePGT",
"(",
"$",
"pgt",
",",
"$",
"pgt_iou",
")",
"{",
"// ensure that storage is initialized",
"$",
"this",
"->",
"_initPGTStorage",
"(",
")",
";",
"// writes the PGT",
"$",
"this",
"->",
"_pgt_storage",
"->",
"write",
"(",
"$",
"... | This method stores a PGT. Halts on error.
@param string $pgt the PGT to store
@param string $pgt_iou its corresponding Iou
@return void | [
"This",
"method",
"stores",
"a",
"PGT",
".",
"Halts",
"on",
"error",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L2474-L2480 |
218,481 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client._validatePGT | private function _validatePGT(&$validate_url,$text_response,$tree_response)
{
phpCAS::traceBegin();
if ( $tree_response->getElementsByTagName("proxyGrantingTicket")->length == 0) {
phpCAS::trace('<proxyGrantingTicket> not found');
// authentication succeded, but no PGT Iou wa... | php | private function _validatePGT(&$validate_url,$text_response,$tree_response)
{
phpCAS::traceBegin();
if ( $tree_response->getElementsByTagName("proxyGrantingTicket")->length == 0) {
phpCAS::trace('<proxyGrantingTicket> not found');
// authentication succeded, but no PGT Iou wa... | [
"private",
"function",
"_validatePGT",
"(",
"&",
"$",
"validate_url",
",",
"$",
"text_response",
",",
"$",
"tree_response",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"if",
"(",
"$",
"tree_response",
"->",
"getElementsByTagName",
"(",
"\"proxyGrant... | This method is used to validate a PGT; halt on failure.
@param string &$validate_url the URL of the request to the CAS server.
@param string $text_response the response of the CAS server, as is
(XML text); result of
CAS_Client::validateCAS10() or
CAS_Client::validateCAS20().
@param string $tree_response the response o... | [
"This",
"method",
"is",
"used",
"to",
"validate",
"a",
"PGT",
";",
"halt",
"on",
"failure",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L2604-L2643 |
218,482 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client._readURL | private function _readURL($url, &$headers, &$body, &$err_msg)
{
phpCAS::traceBegin();
$className = $this->_requestImplementation;
$request = new $className();
if (count($this->_curl_options)) {
$request->setCurlOptions($this->_curl_options);
}
$request->... | php | private function _readURL($url, &$headers, &$body, &$err_msg)
{
phpCAS::traceBegin();
$className = $this->_requestImplementation;
$request = new $className();
if (count($this->_curl_options)) {
$request->setCurlOptions($this->_curl_options);
}
$request->... | [
"private",
"function",
"_readURL",
"(",
"$",
"url",
",",
"&",
"$",
"headers",
",",
"&",
"$",
"body",
",",
"&",
"$",
"err_msg",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"$",
"className",
"=",
"$",
"this",
"->",
"_requestImplementation",
... | This method is used to acces a remote URL.
@param string $url the URL to access.
@param string &$headers an array containing the HTTP header lines of the
response (an empty array on failure).
@param string &$body the body of the response, as a string (empty on
failure).
@param string &$err_msg an error message... | [
"This",
"method",
"is",
"used",
"to",
"acces",
"a",
"remote",
"URL",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L2790-L2838 |
218,483 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client._addAttributeToArray | private function _addAttributeToArray(array &$attributeArray, $name, $value)
{
// If multiple attributes exist, add as an array value
if (isset($attributeArray[$name])) {
// Initialize the array with the existing value
if (!is_array($attributeArray[$name])) {
... | php | private function _addAttributeToArray(array &$attributeArray, $name, $value)
{
// If multiple attributes exist, add as an array value
if (isset($attributeArray[$name])) {
// Initialize the array with the existing value
if (!is_array($attributeArray[$name])) {
... | [
"private",
"function",
"_addAttributeToArray",
"(",
"array",
"&",
"$",
"attributeArray",
",",
"$",
"name",
",",
"$",
"value",
")",
"{",
"// If multiple attributes exist, add as an array value",
"if",
"(",
"isset",
"(",
"$",
"attributeArray",
"[",
"$",
"name",
"]",... | Add an attribute value to an array of attributes.
@param array &$attributeArray reference to array
@param string $name name of attribute
@param string $value value of attribute
@return void | [
"Add",
"an",
"attribute",
"value",
"to",
"an",
"array",
"of",
"attributes",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L3461-L3475 |
218,484 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client._isHttps | private function _isHttps()
{
if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
return ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https');
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTOCOL'])) {
return ($_SERVER['HTTP_X_FORWARDED_PROTOCOL'] === 'https');
} elseif ( i... | php | private function _isHttps()
{
if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
return ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https');
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTOCOL'])) {
return ($_SERVER['HTTP_X_FORWARDED_PROTOCOL'] === 'https');
} elseif ( i... | [
"private",
"function",
"_isHttps",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"_SERVER",
"[",
"'HTTP_X_FORWARDED_PROTO'",
"]",
")",
")",
"{",
"return",
"(",
"$",
"_SERVER",
"[",
"'HTTP_X_FORWARDED_PROTO'",
"]",
"===",
"'https'",
")",
";",
"}",
"el... | This method checks to see if the request is secured via HTTPS
@return bool true if https, false otherwise | [
"This",
"method",
"checks",
"to",
"see",
"if",
"the",
"request",
"is",
"secured",
"via",
"HTTPS"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L3617-L3631 |
218,485 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client._buildQueryUrl | private function _buildQueryUrl($url, $query)
{
$url .= (strstr($url, '?') === false) ? '?' : '&';
$url .= $query;
return $url;
} | php | private function _buildQueryUrl($url, $query)
{
$url .= (strstr($url, '?') === false) ? '?' : '&';
$url .= $query;
return $url;
} | [
"private",
"function",
"_buildQueryUrl",
"(",
"$",
"url",
",",
"$",
"query",
")",
"{",
"$",
"url",
".=",
"(",
"strstr",
"(",
"$",
"url",
",",
"'?'",
")",
"===",
"false",
")",
"?",
"'?'",
":",
"'&'",
";",
"$",
"url",
".=",
"$",
"query",
";",
"re... | This method is used to append query parameters to an url. Since the url
might already contain parameter it has to be detected and to build a proper
URL
@param string $url base url to add the query params to
@param string $query params in query form with & separated
@return url with query params | [
"This",
"method",
"is",
"used",
"to",
"append",
"query",
"parameters",
"to",
"an",
"url",
".",
"Since",
"the",
"url",
"might",
"already",
"contain",
"parameter",
"it",
"has",
"to",
"be",
"detected",
"and",
"to",
"build",
"a",
"proper",
"URL"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L3662-L3667 |
218,486 | moodle/moodle | auth/cas/CAS/CAS/Client.php | CAS_Client._getNodeType | private function _getNodeType($nodeURL)
{
phpCAS::traceBegin();
if (preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $nodeURL)) {
phpCAS::traceEnd(self::IP);
return self::IP;
} else {
phpCAS::traceEnd(self::HOSTNAME);
return self::H... | php | private function _getNodeType($nodeURL)
{
phpCAS::traceBegin();
if (preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $nodeURL)) {
phpCAS::traceEnd(self::IP);
return self::IP;
} else {
phpCAS::traceEnd(self::HOSTNAME);
return self::H... | [
"private",
"function",
"_getNodeType",
"(",
"$",
"nodeURL",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"if",
"(",
"preg_match",
"(",
"\"/^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$/\"",
",",
"$",
"nodeURL",
")",
")",
"{",
"phpCAS",
"::",
"tra... | Determine the node type from the URL.
@param String $nodeURL The node URL.
@return string hostname | [
"Determine",
"the",
"node",
"type",
"from",
"the",
"URL",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/Client.php#L3796-L3806 |
218,487 | moodle/moodle | mod/forum/classes/local/data_mappers/legacy/post.php | post.to_legacy_objects | public function to_legacy_objects(array $posts) : array {
return array_map(function(post_entity $post) {
return (object) [
'id' => $post->get_id(),
'discussion' => $post->get_discussion_id(),
'parent' => $post->get_parent_id(),
'userid'... | php | public function to_legacy_objects(array $posts) : array {
return array_map(function(post_entity $post) {
return (object) [
'id' => $post->get_id(),
'discussion' => $post->get_discussion_id(),
'parent' => $post->get_parent_id(),
'userid'... | [
"public",
"function",
"to_legacy_objects",
"(",
"array",
"$",
"posts",
")",
":",
"array",
"{",
"return",
"array_map",
"(",
"function",
"(",
"post_entity",
"$",
"post",
")",
"{",
"return",
"(",
"object",
")",
"[",
"'id'",
"=>",
"$",
"post",
"->",
"get_id"... | Convert a list of post entities into stdClasses.
@param post_entity[] $posts The posts to convert.
@return stdClass[] | [
"Convert",
"a",
"list",
"of",
"post",
"entities",
"into",
"stdClasses",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/data_mappers/legacy/post.php#L45-L66 |
218,488 | moodle/moodle | mod/chat/classes/event/message_sent.php | message_sent.get_legacy_logdata | protected function get_legacy_logdata() {
$message = $this->get_record_snapshot('chat_messages', $this->objectid);
return array($this->courseid, 'chat', 'talk', 'view.php?id=' . $this->contextinstanceid,
$message->chatid, $this->contextinstanceid, $this->relateduserid);
} | php | protected function get_legacy_logdata() {
$message = $this->get_record_snapshot('chat_messages', $this->objectid);
return array($this->courseid, 'chat', 'talk', 'view.php?id=' . $this->contextinstanceid,
$message->chatid, $this->contextinstanceid, $this->relateduserid);
} | [
"protected",
"function",
"get_legacy_logdata",
"(",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"get_record_snapshot",
"(",
"'chat_messages'",
",",
"$",
"this",
"->",
"objectid",
")",
";",
"return",
"array",
"(",
"$",
"this",
"->",
"courseid",
",",
"... | Return legacy log data.
@return array | [
"Return",
"legacy",
"log",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/chat/classes/event/message_sent.php#L53-L57 |
218,489 | moodle/moodle | grade/report/singleview/classes/local/screen/screen.php | screen.setup_structure | public function setup_structure() {
$this->structure = new grade_structure();
$this->structure->modinfo = get_fast_modinfo($this->course);
} | php | public function setup_structure() {
$this->structure = new grade_structure();
$this->structure->modinfo = get_fast_modinfo($this->course);
} | [
"public",
"function",
"setup_structure",
"(",
")",
"{",
"$",
"this",
"->",
"structure",
"=",
"new",
"grade_structure",
"(",
")",
";",
"$",
"this",
"->",
"structure",
"->",
"modinfo",
"=",
"get_fast_modinfo",
"(",
"$",
"this",
"->",
"course",
")",
";",
"}... | Cache the grade_structure class | [
"Cache",
"the",
"grade_structure",
"class"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/screen/screen.php#L110-L113 |
218,490 | moodle/moodle | grade/report/singleview/classes/local/screen/screen.php | screen.fetch_grade_or_default | public function fetch_grade_or_default($item, $userid) {
$grade = grade_grade::fetch(array(
'itemid' => $item->id, 'userid' => $userid
));
if (!$grade) {
$default = new stdClass;
$default->userid = $userid;
$default->itemid = $item->id;
... | php | public function fetch_grade_or_default($item, $userid) {
$grade = grade_grade::fetch(array(
'itemid' => $item->id, 'userid' => $userid
));
if (!$grade) {
$default = new stdClass;
$default->userid = $userid;
$default->itemid = $item->id;
... | [
"public",
"function",
"fetch_grade_or_default",
"(",
"$",
"item",
",",
"$",
"userid",
")",
"{",
"$",
"grade",
"=",
"grade_grade",
"::",
"fetch",
"(",
"array",
"(",
"'itemid'",
"=>",
"$",
"item",
"->",
"id",
",",
"'userid'",
"=>",
"$",
"userid",
")",
")... | Get the grade_grade
@param grade_item $item The grade_item
@param int $userid The user id
@return grade_grade | [
"Get",
"the",
"grade_grade"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/screen/screen.php#L145-L163 |
218,491 | moodle/moodle | grade/report/singleview/classes/local/screen/screen.php | screen.make_toggle | public function make_toggle($key) {
$attrs = array('href' => '#');
// Do proper lang strings for title attributes exist for the given key?
$strmanager = \get_string_manager();
$titleall = get_string('all');
$titlenone = get_string('none');
if ($strmanager->string_exists(... | php | public function make_toggle($key) {
$attrs = array('href' => '#');
// Do proper lang strings for title attributes exist for the given key?
$strmanager = \get_string_manager();
$titleall = get_string('all');
$titlenone = get_string('none');
if ($strmanager->string_exists(... | [
"public",
"function",
"make_toggle",
"(",
"$",
"key",
")",
"{",
"$",
"attrs",
"=",
"array",
"(",
"'href'",
"=>",
"'#'",
")",
";",
"// Do proper lang strings for title attributes exist for the given key?",
"$",
"strmanager",
"=",
"\\",
"get_string_manager",
"(",
")",... | Make the HTML element that toggles all the checkboxes on or off.
@param string $key A unique key for this control - inserted in the classes.
@return string | [
"Make",
"the",
"HTML",
"element",
"that",
"toggles",
"all",
"the",
"checkboxes",
"on",
"or",
"off",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/screen/screen.php#L171-L198 |
218,492 | moodle/moodle | grade/report/singleview/classes/local/screen/screen.php | screen.load_users | protected function load_users() {
global $CFG;
// Create a graded_users_iterator because it will properly check the groups etc.
$defaultgradeshowactiveenrol = !empty($CFG->grade_report_showonlyactiveenrol);
$showonlyactiveenrol = get_user_preferences('grade_report_showonlyactiveenrol', ... | php | protected function load_users() {
global $CFG;
// Create a graded_users_iterator because it will properly check the groups etc.
$defaultgradeshowactiveenrol = !empty($CFG->grade_report_showonlyactiveenrol);
$showonlyactiveenrol = get_user_preferences('grade_report_showonlyactiveenrol', ... | [
"protected",
"function",
"load_users",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"// Create a graded_users_iterator because it will properly check the groups etc.",
"$",
"defaultgradeshowactiveenrol",
"=",
"!",
"empty",
"(",
"$",
"CFG",
"->",
"grade_report_showonlyactiveenrol... | Load a valid list of users for this gradebook as the screen "items".
@return array $users A list of enroled users. | [
"Load",
"a",
"valid",
"list",
"of",
"users",
"for",
"this",
"gradebook",
"as",
"the",
"screen",
"items",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/screen/screen.php#L418-L438 |
218,493 | moodle/moodle | grade/report/singleview/classes/local/screen/screen.php | screen.perpage_select | public function perpage_select() {
global $PAGE, $OUTPUT;
$options = array_combine(self::$validperpage, self::$validperpage);
$url = new moodle_url($PAGE->url);
$url->remove_params(['page', 'perpage']);
$out = '';
$select = new \single_select($url, 'perpage', $options,... | php | public function perpage_select() {
global $PAGE, $OUTPUT;
$options = array_combine(self::$validperpage, self::$validperpage);
$url = new moodle_url($PAGE->url);
$url->remove_params(['page', 'perpage']);
$out = '';
$select = new \single_select($url, 'perpage', $options,... | [
"public",
"function",
"perpage_select",
"(",
")",
"{",
"global",
"$",
"PAGE",
",",
"$",
"OUTPUT",
";",
"$",
"options",
"=",
"array_combine",
"(",
"self",
"::",
"$",
"validperpage",
",",
"self",
"::",
"$",
"validperpage",
")",
";",
"$",
"url",
"=",
"new... | Allow selection of number of items to display per page.
@return string | [
"Allow",
"selection",
"of",
"number",
"of",
"items",
"to",
"display",
"per",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/screen/screen.php#L444-L458 |
218,494 | moodle/moodle | lib/classes/task/scheduled_task.php | scheduled_task.eval_cron_field | public function eval_cron_field($field, $min, $max) {
// Cleanse the input.
$field = trim($field);
// Format for a field is:
// <fieldlist> := <range>(/<step>)(,<fieldlist>)
// <step> := int
// <range> := <any>|<int>|<min-max>
// <any> := *
// <min-max... | php | public function eval_cron_field($field, $min, $max) {
// Cleanse the input.
$field = trim($field);
// Format for a field is:
// <fieldlist> := <range>(/<step>)(,<fieldlist>)
// <step> := int
// <range> := <any>|<int>|<min-max>
// <any> := *
// <min-max... | [
"public",
"function",
"eval_cron_field",
"(",
"$",
"field",
",",
"$",
"min",
",",
"$",
"max",
")",
"{",
"// Cleanse the input.",
"$",
"field",
"=",
"trim",
"(",
"$",
"field",
")",
";",
"// Format for a field is:",
"// <fieldlist> := <range>(/<step>)(,<fieldlist>)",
... | Take a cron field definition and return an array of valid numbers with the range min-max.
@param string $field - The field definition.
@param int $min - The minimum allowable value.
@param int $max - The maximum allowable value.
@return array(int) | [
"Take",
"a",
"cron",
"field",
"definition",
"and",
"return",
"an",
"array",
"of",
"valid",
"numbers",
"with",
"the",
"range",
"min",
"-",
"max",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/task/scheduled_task.php#L229-L299 |
218,495 | moodle/moodle | lib/classes/task/scheduled_task.php | scheduled_task.get_next_scheduled_time | public function get_next_scheduled_time() {
global $CFG;
$validminutes = $this->eval_cron_field($this->minute, self::MINUTEMIN, self::MINUTEMAX);
$validhours = $this->eval_cron_field($this->hour, self::HOURMIN, self::HOURMAX);
// We need to change to the server timezone before using ph... | php | public function get_next_scheduled_time() {
global $CFG;
$validminutes = $this->eval_cron_field($this->minute, self::MINUTEMIN, self::MINUTEMAX);
$validhours = $this->eval_cron_field($this->hour, self::HOURMIN, self::HOURMAX);
// We need to change to the server timezone before using ph... | [
"public",
"function",
"get_next_scheduled_time",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"validminutes",
"=",
"$",
"this",
"->",
"eval_cron_field",
"(",
"$",
"this",
"->",
"minute",
",",
"self",
"::",
"MINUTEMIN",
",",
"self",
"::",
"MINUTEMAX",
")"... | Calculate when this task should next be run based on the schedule.
@return int $nextruntime. | [
"Calculate",
"when",
"this",
"task",
"should",
"next",
"be",
"run",
"based",
"on",
"the",
"schedule",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/task/scheduled_task.php#L328-L405 |
218,496 | moodle/moodle | competency/classes/external/competency_framework_exporter.php | competency_framework_exporter.get_other_values | protected function get_other_values(renderer_base $output) {
$filters = array('competencyframeworkid' => $this->persistent->get('id'));
$context = $this->persistent->get_context();
$competenciescount = 0;
try {
api::count_competencies($filters);
} catch (\required_cap... | php | protected function get_other_values(renderer_base $output) {
$filters = array('competencyframeworkid' => $this->persistent->get('id'));
$context = $this->persistent->get_context();
$competenciescount = 0;
try {
api::count_competencies($filters);
} catch (\required_cap... | [
"protected",
"function",
"get_other_values",
"(",
"renderer_base",
"$",
"output",
")",
"{",
"$",
"filters",
"=",
"array",
"(",
"'competencyframeworkid'",
"=>",
"$",
"this",
"->",
"persistent",
"->",
"get",
"(",
"'id'",
")",
")",
";",
"$",
"context",
"=",
"... | Get other values that do not belong to the basic persisent.
@param renderer_base $output
@return Array | [
"Get",
"other",
"values",
"that",
"do",
"not",
"belong",
"to",
"the",
"basic",
"persisent",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/external/competency_framework_exporter.php#L53-L68 |
218,497 | moodle/moodle | lib/spout/src/Spout/Reader/Wrapper/XMLInternalErrorsHelper.php | XMLInternalErrorsHelper.resetXMLInternalErrorsSettingAndThrowIfXMLErrorOccured | protected function resetXMLInternalErrorsSettingAndThrowIfXMLErrorOccured()
{
if ($this->hasXMLErrorOccured()) {
$this->resetXMLInternalErrorsSetting();
throw new XMLProcessingException($this->getLastXMLErrorMessage());
}
$this->resetXMLInternalErrorsSetting();
} | php | protected function resetXMLInternalErrorsSettingAndThrowIfXMLErrorOccured()
{
if ($this->hasXMLErrorOccured()) {
$this->resetXMLInternalErrorsSetting();
throw new XMLProcessingException($this->getLastXMLErrorMessage());
}
$this->resetXMLInternalErrorsSetting();
} | [
"protected",
"function",
"resetXMLInternalErrorsSettingAndThrowIfXMLErrorOccured",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasXMLErrorOccured",
"(",
")",
")",
"{",
"$",
"this",
"->",
"resetXMLInternalErrorsSetting",
"(",
")",
";",
"throw",
"new",
"XMLProcessin... | Throws an XMLProcessingException if an error occured.
It also always resets the "libxml_use_internal_errors" setting back to its initial value.
@return void
@throws \Box\Spout\Reader\Exception\XMLProcessingException | [
"Throws",
"an",
"XMLProcessingException",
"if",
"an",
"error",
"occured",
".",
"It",
"also",
"always",
"resets",
"the",
"libxml_use_internal_errors",
"setting",
"back",
"to",
"its",
"initial",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/Wrapper/XMLInternalErrorsHelper.php#L36-L44 |
218,498 | moodle/moodle | question/type/calculatedmulti/edit_calculatedmulti_form.php | qtype_calculatedmulti_edit_form.validate_text | protected function validate_text($errors, $field, $text) {
$problems = qtype_calculated_find_formula_errors_in_text($text);
if ($problems) {
$errors[$field] = $problems;
}
return $errors;
} | php | protected function validate_text($errors, $field, $text) {
$problems = qtype_calculated_find_formula_errors_in_text($text);
if ($problems) {
$errors[$field] = $problems;
}
return $errors;
} | [
"protected",
"function",
"validate_text",
"(",
"$",
"errors",
",",
"$",
"field",
",",
"$",
"text",
")",
"{",
"$",
"problems",
"=",
"qtype_calculated_find_formula_errors_in_text",
"(",
"$",
"text",
")",
";",
"if",
"(",
"$",
"problems",
")",
"{",
"$",
"error... | Validate the equations in the some question content.
@param array $errors where errors are being accumulated.
@param string $field the field being validated.
@param string $text the content of that field.
@return array the updated $errors array. | [
"Validate",
"the",
"equations",
"in",
"the",
"some",
"question",
"content",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/calculatedmulti/edit_calculatedmulti_form.php#L240-L246 |
218,499 | moodle/moodle | lib/adodb/drivers/adodb-oci8.inc.php | ADODB_oci8.MetaForeignKeys | function MetaForeignKeys($table, $owner=false, $upper=false)
{
global $ADODB_FETCH_MODE;
$save = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$table = $this->qstr(strtoupper($table));
if (!$owner) {
$owner = $this->user;
$tabp = 'user_';
} else
$tabp = 'all_';
$owner = ' and owner='... | php | function MetaForeignKeys($table, $owner=false, $upper=false)
{
global $ADODB_FETCH_MODE;
$save = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$table = $this->qstr(strtoupper($table));
if (!$owner) {
$owner = $this->user;
$tabp = 'user_';
} else
$tabp = 'all_';
$owner = ' and owner='... | [
"function",
"MetaForeignKeys",
"(",
"$",
"table",
",",
"$",
"owner",
"=",
"false",
",",
"$",
"upper",
"=",
"false",
")",
"{",
"global",
"$",
"ADODB_FETCH_MODE",
";",
"$",
"save",
"=",
"$",
"ADODB_FETCH_MODE",
";",
"$",
"ADODB_FETCH_MODE",
"=",
"ADODB_FETCH... | returns assoc array where keys are tables, and values are foreign keys
@param str $table
@param str $owner [optional][default=NULL]
@param bool $upper [optional][discarded]
@return mixed[] Array of foreign key information
@link http://gis.mit.edu/classes/11.521/sqlnotes/referential_integrity.html | [
"returns",
"assoc",
"array",
"where",
"keys",
"are",
"tables",
"and",
"values",
"are",
"foreign",
"keys"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-oci8.inc.php#L1447-L1484 |
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.