id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
217,900 | moodle/moodle | lib/portfolio/forms.php | portfolio_instance_select.definition | function definition() {
$this->caller = $this->_customdata['caller'];
$options = $this->_customdata['options'];
$mform =& $this->_form;
$mform->addElement('select', 'instance', get_string('selectplugin', 'portfolio'), $options);
$mform->addElement('hidden', 'id', $this->_customda... | php | function definition() {
$this->caller = $this->_customdata['caller'];
$options = $this->_customdata['options'];
$mform =& $this->_form;
$mform->addElement('select', 'instance', get_string('selectplugin', 'portfolio'), $options);
$mform->addElement('hidden', 'id', $this->_customda... | [
"function",
"definition",
"(",
")",
"{",
"$",
"this",
"->",
"caller",
"=",
"$",
"this",
"->",
"_customdata",
"[",
"'caller'",
"]",
";",
"$",
"options",
"=",
"$",
"this",
"->",
"_customdata",
"[",
"'options'",
"]",
";",
"$",
"mform",
"=",
"&",
"$",
... | The required basic elements to the form. | [
"The",
"required",
"basic",
"elements",
"to",
"the",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/forms.php#L319-L327 |
217,901 | moodle/moodle | backup/util/ui/restore_ui.class.php | restore_ui.process | public function process() {
if ($this->progress >= self::PROGRESS_PROCESSED) {
throw new restore_ui_exception('restoreuialreadyprocessed');
}
$this->progress = self::PROGRESS_PROCESSED;
if (optional_param('previous', false, PARAM_BOOL) && $this->stage->get_stage() > self::ST... | php | public function process() {
if ($this->progress >= self::PROGRESS_PROCESSED) {
throw new restore_ui_exception('restoreuialreadyprocessed');
}
$this->progress = self::PROGRESS_PROCESSED;
if (optional_param('previous', false, PARAM_BOOL) && $this->stage->get_stage() > self::ST... | [
"public",
"function",
"process",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"progress",
">=",
"self",
"::",
"PROGRESS_PROCESSED",
")",
"{",
"throw",
"new",
"restore_ui_exception",
"(",
"'restoreuialreadyprocessed'",
")",
";",
"}",
"$",
"this",
"->",
"progr... | This processes the current stage of the restore
@throws restore_ui_exception if the progress is wrong.
@return bool | [
"This",
"processes",
"the",
"current",
"stage",
"of",
"the",
"restore"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/restore_ui.class.php#L129-L149 |
217,902 | moodle/moodle | backup/util/ui/restore_ui.class.php | restore_ui.execute | public function execute() {
if ($this->progress >= self::PROGRESS_EXECUTED) {
throw new restore_ui_exception('restoreuialreadyexecuted');
}
if ($this->stage->get_stage() < self::STAGE_PROCESS) {
throw new restore_ui_exception('restoreuifinalisedbeforeexecute');
}
... | php | public function execute() {
if ($this->progress >= self::PROGRESS_EXECUTED) {
throw new restore_ui_exception('restoreuialreadyexecuted');
}
if ($this->stage->get_stage() < self::STAGE_PROCESS) {
throw new restore_ui_exception('restoreuifinalisedbeforeexecute');
}
... | [
"public",
"function",
"execute",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"progress",
">=",
"self",
"::",
"PROGRESS_EXECUTED",
")",
"{",
"throw",
"new",
"restore_ui_exception",
"(",
"'restoreuialreadyexecuted'",
")",
";",
"}",
"if",
"(",
"$",
"this",
"... | Executes the restore plan
@throws restore_ui_exception if the progress or stage is wrong.
@return bool | [
"Executes",
"the",
"restore",
"plan"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/restore_ui.class.php#L211-L228 |
217,903 | moodle/moodle | backup/util/ui/restore_ui.class.php | restore_ui.cleanup | public function cleanup() {
global $DB;
$courseid = $this->controller->get_courseid();
if ($this->is_temporary_course_created($courseid) && $course = $DB->get_record('course', array('id' => $courseid))) {
$course->deletesource = 'restore';
delete_course($course, false);
... | php | public function cleanup() {
global $DB;
$courseid = $this->controller->get_courseid();
if ($this->is_temporary_course_created($courseid) && $course = $DB->get_record('course', array('id' => $courseid))) {
$course->deletesource = 'restore';
delete_course($course, false);
... | [
"public",
"function",
"cleanup",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"courseid",
"=",
"$",
"this",
"->",
"controller",
"->",
"get_courseid",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"is_temporary_course_created",
"(",
"$",
"courseid",
")",
... | Delete course which is created by restore process | [
"Delete",
"course",
"which",
"is",
"created",
"by",
"restore",
"process"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/restore_ui.class.php#L233-L240 |
217,904 | moodle/moodle | backup/util/ui/restore_ui.class.php | restore_ui.is_temporary_course_created | protected function is_temporary_course_created($courseid) {
global $DB;
// Check if current controller instance has created new course.
if ($this->controller->get_target() == backup::TARGET_NEW_COURSE) {
$results = $DB->record_exists_sql("SELECT bc.itemid
... | php | protected function is_temporary_course_created($courseid) {
global $DB;
// Check if current controller instance has created new course.
if ($this->controller->get_target() == backup::TARGET_NEW_COURSE) {
$results = $DB->record_exists_sql("SELECT bc.itemid
... | [
"protected",
"function",
"is_temporary_course_created",
"(",
"$",
"courseid",
")",
"{",
"global",
"$",
"DB",
";",
"// Check if current controller instance has created new course.",
"if",
"(",
"$",
"this",
"->",
"controller",
"->",
"get_target",
"(",
")",
"==",
"backup... | Checks if the course is not restored fully and current controller has created it.
@param int $courseid id of the course which needs to be checked
@return bool | [
"Checks",
"if",
"the",
"course",
"is",
"not",
"restored",
"fully",
"and",
"current",
"controller",
"has",
"created",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/restore_ui.class.php#L247-L262 |
217,905 | moodle/moodle | backup/util/ui/restore_ui.class.php | restore_ui.load_controller | final public static function load_controller($restoreid = false) {
// Get the restore id optional param.
if ($restoreid) {
try {
// Try to load the controller with it.
// If it fails at this point it is likely because this is the first load.
$c... | php | final public static function load_controller($restoreid = false) {
// Get the restore id optional param.
if ($restoreid) {
try {
// Try to load the controller with it.
// If it fails at this point it is likely because this is the first load.
$c... | [
"final",
"public",
"static",
"function",
"load_controller",
"(",
"$",
"restoreid",
"=",
"false",
")",
"{",
"// Get the restore id optional param.",
"if",
"(",
"$",
"restoreid",
")",
"{",
"try",
"{",
"// Try to load the controller with it.",
"// If it fails at this point i... | Loads the restore controller if we are tracking one
@param string|bool $restoreid
@return string | [
"Loads",
"the",
"restore",
"controller",
"if",
"we",
"are",
"tracking",
"one"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/restore_ui.class.php#L277-L290 |
217,906 | moodle/moodle | backup/util/ui/restore_ui.class.php | restore_ui.engage_independent_stage | final public static function engage_independent_stage($stage, $contextid) {
if (!($stage & self::STAGE_CONFIRM + self::STAGE_DESTINATION)) {
throw new restore_ui_exception('dependentstagerequested');
}
$class = 'restore_ui_stage_'.self::$stages[$stage];
if (!class_exists($cla... | php | final public static function engage_independent_stage($stage, $contextid) {
if (!($stage & self::STAGE_CONFIRM + self::STAGE_DESTINATION)) {
throw new restore_ui_exception('dependentstagerequested');
}
$class = 'restore_ui_stage_'.self::$stages[$stage];
if (!class_exists($cla... | [
"final",
"public",
"static",
"function",
"engage_independent_stage",
"(",
"$",
"stage",
",",
"$",
"contextid",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"stage",
"&",
"self",
"::",
"STAGE_CONFIRM",
"+",
"self",
"::",
"STAGE_DESTINATION",
")",
")",
"{",
"throw",
... | Initialised the requested independent stage
@throws restore_ui_exception
@param int $stage One of self::STAGE_*
@param int $contextid
@return restore_ui_stage_confirm|restore_ui_stage_destination | [
"Initialised",
"the",
"requested",
"independent",
"stage"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/restore_ui.class.php#L300-L309 |
217,907 | moodle/moodle | backup/util/ui/restore_ui.class.php | restore_ui.cancel_process | public function cancel_process() {
// Delete temporary restore course if exists.
if ($this->controller->get_target() == backup::TARGET_NEW_COURSE) {
$this->cleanup();
}
parent::cancel_process();
} | php | public function cancel_process() {
// Delete temporary restore course if exists.
if ($this->controller->get_target() == backup::TARGET_NEW_COURSE) {
$this->cleanup();
}
parent::cancel_process();
} | [
"public",
"function",
"cancel_process",
"(",
")",
"{",
"// Delete temporary restore course if exists.",
"if",
"(",
"$",
"this",
"->",
"controller",
"->",
"get_target",
"(",
")",
"==",
"backup",
"::",
"TARGET_NEW_COURSE",
")",
"{",
"$",
"this",
"->",
"cleanup",
"... | Cancels the current restore and redirects the user back to the relevant place | [
"Cancels",
"the",
"current",
"restore",
"and",
"redirects",
"the",
"user",
"back",
"to",
"the",
"relevant",
"place"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/restore_ui.class.php#L314-L320 |
217,908 | moodle/moodle | lib/mlbackend/php/phpml/src/Phpml/Classification/Linear/LogisticRegression.php | LogisticRegression.getCostFunction | protected function getCostFunction()
{
$penalty = 0;
if ($this->penalty == 'L2') {
$penalty = $this->lambda;
}
switch ($this->costFunction) {
case 'log':
/*
* Negative of Log-likelihood cost function to be minimized:
... | php | protected function getCostFunction()
{
$penalty = 0;
if ($this->penalty == 'L2') {
$penalty = $this->lambda;
}
switch ($this->costFunction) {
case 'log':
/*
* Negative of Log-likelihood cost function to be minimized:
... | [
"protected",
"function",
"getCostFunction",
"(",
")",
"{",
"$",
"penalty",
"=",
"0",
";",
"if",
"(",
"$",
"this",
"->",
"penalty",
"==",
"'L2'",
")",
"{",
"$",
"penalty",
"=",
"$",
"this",
"->",
"lambda",
";",
"}",
"switch",
"(",
"$",
"this",
"->",... | Returns the appropriate callback function for the selected cost function
@return \Closure
@throws \Exception | [
"Returns",
"the",
"appropriate",
"callback",
"function",
"for",
"the",
"selected",
"cost",
"function"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/phpml/src/Phpml/Classification/Linear/LogisticRegression.php#L174-L239 |
217,909 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.get_config_for_javascript | public function get_config_for_javascript(moodle_page $page, renderer_base $renderer) {
global $CFG;
if (empty($this->M_cfg)) {
$iconsystem = \core\output\icon_system::instance();
// It is possible that the $page->context is null, so we can't use $page->context->id.
... | php | public function get_config_for_javascript(moodle_page $page, renderer_base $renderer) {
global $CFG;
if (empty($this->M_cfg)) {
$iconsystem = \core\output\icon_system::instance();
// It is possible that the $page->context is null, so we can't use $page->context->id.
... | [
"public",
"function",
"get_config_for_javascript",
"(",
"moodle_page",
"$",
"page",
",",
"renderer_base",
"$",
"renderer",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"M_cfg",
")",
")",
"{",
"$",
"iconsystem",
"=",
"\... | Return the safe config values that get set for javascript in "M.cfg".
@since 2.9
@return array List of safe config values that are available to javascript. | [
"Return",
"the",
"safe",
"config",
"values",
"that",
"get",
"set",
"for",
"javascript",
"in",
"M",
".",
"cfg",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L308-L343 |
217,910 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.init_requirements_data | protected function init_requirements_data(moodle_page $page, core_renderer $renderer) {
global $CFG;
// Init the js config.
$this->get_config_for_javascript($page, $renderer);
// Accessibility stuff.
$this->skip_link_to('maincontent', get_string('tocontent', 'access'));
... | php | protected function init_requirements_data(moodle_page $page, core_renderer $renderer) {
global $CFG;
// Init the js config.
$this->get_config_for_javascript($page, $renderer);
// Accessibility stuff.
$this->skip_link_to('maincontent', get_string('tocontent', 'access'));
... | [
"protected",
"function",
"init_requirements_data",
"(",
"moodle_page",
"$",
"page",
",",
"core_renderer",
"$",
"renderer",
")",
"{",
"global",
"$",
"CFG",
";",
"// Init the js config.",
"$",
"this",
"->",
"get_config_for_javascript",
"(",
"$",
"page",
",",
"$",
... | Initialise with the bits of JavaScript that every Moodle page should have.
@param moodle_page $page
@param core_renderer $renderer | [
"Initialise",
"with",
"the",
"bits",
"of",
"JavaScript",
"that",
"every",
"Moodle",
"page",
"should",
"have",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L351-L393 |
217,911 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.get_jsrev | protected function get_jsrev() {
global $CFG;
if (empty($CFG->cachejs)) {
$jsrev = -1;
} else if (empty($CFG->jsrev)) {
$jsrev = 1;
} else {
$jsrev = $CFG->jsrev;
}
return $jsrev;
} | php | protected function get_jsrev() {
global $CFG;
if (empty($CFG->cachejs)) {
$jsrev = -1;
} else if (empty($CFG->jsrev)) {
$jsrev = 1;
} else {
$jsrev = $CFG->jsrev;
}
return $jsrev;
} | [
"protected",
"function",
"get_jsrev",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"empty",
"(",
"$",
"CFG",
"->",
"cachejs",
")",
")",
"{",
"$",
"jsrev",
"=",
"-",
"1",
";",
"}",
"else",
"if",
"(",
"empty",
"(",
"$",
"CFG",
"->",
"jsre... | Determine the correct JS Revision to use for this load.
@return int the jsrev to use. | [
"Determine",
"the",
"correct",
"JS",
"Revision",
"to",
"use",
"for",
"this",
"load",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L400-L412 |
217,912 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.js | public function js($url, $inhead = false) {
$url = $this->js_fix_url($url);
$where = $inhead ? 'head' : 'footer';
$this->jsincludes[$where][$url->out()] = $url;
} | php | public function js($url, $inhead = false) {
$url = $this->js_fix_url($url);
$where = $inhead ? 'head' : 'footer';
$this->jsincludes[$where][$url->out()] = $url;
} | [
"public",
"function",
"js",
"(",
"$",
"url",
",",
"$",
"inhead",
"=",
"false",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"js_fix_url",
"(",
"$",
"url",
")",
";",
"$",
"where",
"=",
"$",
"inhead",
"?",
"'head'",
":",
"'footer'",
";",
"$",
"t... | Ensure that the specified JavaScript file is linked to from this page.
NOTE: This function is to be used in RARE CASES ONLY, please store your JS in module.js file
and use $PAGE->requires->js_init_call() instead or use /yui/ subdirectories for YUI modules.
By default the link is put at the end of the page, since this... | [
"Ensure",
"that",
"the",
"specified",
"JavaScript",
"file",
"is",
"linked",
"to",
"from",
"this",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L429-L433 |
217,913 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.jquery_override_plugin | public function jquery_override_plugin($oldplugin, $newplugin) {
if ($this->headdone) {
debugging('Can not override jQuery plugins after starting page output!');
return;
}
$this->jquerypluginoverrides[$oldplugin] = $newplugin;
} | php | public function jquery_override_plugin($oldplugin, $newplugin) {
if ($this->headdone) {
debugging('Can not override jQuery plugins after starting page output!');
return;
}
$this->jquerypluginoverrides[$oldplugin] = $newplugin;
} | [
"public",
"function",
"jquery_override_plugin",
"(",
"$",
"oldplugin",
",",
"$",
"newplugin",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"headdone",
")",
"{",
"debugging",
"(",
"'Can not override jQuery plugins after starting page output!'",
")",
";",
"return",
";",
... | Request replacement of one jQuery plugin by another.
This is useful when themes want to replace the jQuery UI theme,
the problem is that theme can not prevent others from including the core ui-css plugin.
Example:
1/ generate new jQuery UI theme and place it into theme/yourtheme/jquery/
2/ write theme/yourtheme/jquer... | [
"Request",
"replacement",
"of",
"one",
"jQuery",
"plugin",
"by",
"another",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L604-L610 |
217,914 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.get_jquery_headcode | protected function get_jquery_headcode() {
if (empty($this->jqueryplugins['jquery'])) {
// If nobody requested jQuery then do not bother to load anything.
// This may be useful for themes that want to override 'ui-css' only if requested by something else.
return '';
}... | php | protected function get_jquery_headcode() {
if (empty($this->jqueryplugins['jquery'])) {
// If nobody requested jQuery then do not bother to load anything.
// This may be useful for themes that want to override 'ui-css' only if requested by something else.
return '';
}... | [
"protected",
"function",
"get_jquery_headcode",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"jqueryplugins",
"[",
"'jquery'",
"]",
")",
")",
"{",
"// If nobody requested jQuery then do not bother to load anything.",
"// This may be useful for themes that want... | Return jQuery related markup for page start.
@return string | [
"Return",
"jQuery",
"related",
"markup",
"for",
"page",
"start",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L616-L679 |
217,915 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.js_fix_url | protected function js_fix_url($url) {
global $CFG;
if ($url instanceof moodle_url) {
return $url;
} else if (strpos($url, '/') === 0) {
// Fix the admin links if needed.
if ($CFG->admin !== 'admin') {
if (strpos($url, "/admin/") === 0) {
... | php | protected function js_fix_url($url) {
global $CFG;
if ($url instanceof moodle_url) {
return $url;
} else if (strpos($url, '/') === 0) {
// Fix the admin links if needed.
if ($CFG->admin !== 'admin') {
if (strpos($url, "/admin/") === 0) {
... | [
"protected",
"function",
"js_fix_url",
"(",
"$",
"url",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"$",
"url",
"instanceof",
"moodle_url",
")",
"{",
"return",
"$",
"url",
";",
"}",
"else",
"if",
"(",
"strpos",
"(",
"$",
"url",
",",
"'/'",
")",... | Returns the actual url through which a script is served.
@param moodle_url|string $url full moodle url, or shortened path to script
@return moodle_url | [
"Returns",
"the",
"actual",
"url",
"through",
"which",
"a",
"script",
"is",
"served",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L687-L720 |
217,916 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.js_module_loaded | protected function js_module_loaded($module) {
if (is_string($module)) {
$modulename = $module;
} else {
$modulename = $module['name'];
}
return array_key_exists($modulename, $this->YUI_config->modules) ||
array_key_exists($modulename, $this->extram... | php | protected function js_module_loaded($module) {
if (is_string($module)) {
$modulename = $module;
} else {
$modulename = $module['name'];
}
return array_key_exists($modulename, $this->YUI_config->modules) ||
array_key_exists($modulename, $this->extram... | [
"protected",
"function",
"js_module_loaded",
"(",
"$",
"module",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"module",
")",
")",
"{",
"$",
"modulename",
"=",
"$",
"module",
";",
"}",
"else",
"{",
"$",
"modulename",
"=",
"$",
"module",
"[",
"'name'",
... | Returns true if the module has already been loaded.
@param string|array $module
@return bool True if the module has already been loaded | [
"Returns",
"true",
"if",
"the",
"module",
"has",
"already",
"been",
"loaded",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L875-L883 |
217,917 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.css | public function css($stylesheet) {
global $CFG;
if ($this->headdone) {
throw new coding_exception('Cannot require a CSS file after <head> has been printed.', $stylesheet);
}
if ($stylesheet instanceof moodle_url) {
// ok
} else if (strpos($stylesheet,... | php | public function css($stylesheet) {
global $CFG;
if ($this->headdone) {
throw new coding_exception('Cannot require a CSS file after <head> has been printed.', $stylesheet);
}
if ($stylesheet instanceof moodle_url) {
// ok
} else if (strpos($stylesheet,... | [
"public",
"function",
"css",
"(",
"$",
"stylesheet",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"$",
"this",
"->",
"headdone",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'Cannot require a CSS file after <head> has been printed.'",
",",
"$",
"sty... | Ensure that the specified CSS file is linked to from this page.
Because stylesheet links must go in the <head> part of the HTML, you must call
this function before {@link get_head_code()} is called. That normally means before
the call to print_header. If you call it when it is too late, an exception
will be thrown.
E... | [
"Ensure",
"that",
"the",
"specified",
"CSS",
"file",
"is",
"linked",
"to",
"from",
"this",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L905-L921 |
217,918 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.js_call_amd | public function js_call_amd($fullmodule, $func = null, $params = array()) {
global $CFG;
list($component, $module) = explode('/', $fullmodule, 2);
$component = clean_param($component, PARAM_COMPONENT);
$module = clean_param($module, PARAM_ALPHANUMEXT);
if ($func !== null) {
... | php | public function js_call_amd($fullmodule, $func = null, $params = array()) {
global $CFG;
list($component, $module) = explode('/', $fullmodule, 2);
$component = clean_param($component, PARAM_COMPONENT);
$module = clean_param($module, PARAM_ALPHANUMEXT);
if ($func !== null) {
... | [
"public",
"function",
"js_call_amd",
"(",
"$",
"fullmodule",
",",
"$",
"func",
"=",
"null",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"CFG",
";",
"list",
"(",
"$",
"component",
",",
"$",
"module",
")",
"=",
"explode",
"("... | Load an AMD module and eventually call its method.
This function creates a minimal inline JS snippet that requires an AMD module and eventually calls a single
function from the module with given arguments. If it is called multiple times, it will be create multiple
snippets.
@param string $fullmodule The name of the A... | [
"Load",
"an",
"AMD",
"module",
"and",
"eventually",
"call",
"its",
"method",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1012-L1045 |
217,919 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.yui_module | public function yui_module($modules, $function, array $arguments = null, $galleryversion = null, $ondomready = false) {
if (!is_array($modules)) {
$modules = array($modules);
}
if ($galleryversion != null) {
debugging('The galleryversion parameter to yui_module has been ... | php | public function yui_module($modules, $function, array $arguments = null, $galleryversion = null, $ondomready = false) {
if (!is_array($modules)) {
$modules = array($modules);
}
if ($galleryversion != null) {
debugging('The galleryversion parameter to yui_module has been ... | [
"public",
"function",
"yui_module",
"(",
"$",
"modules",
",",
"$",
"function",
",",
"array",
"$",
"arguments",
"=",
"null",
",",
"$",
"galleryversion",
"=",
"null",
",",
"$",
"ondomready",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
... | Creates a JavaScript function call that requires one or more modules to be loaded.
This function can be used to include all of the standard YUI module types within JavaScript:
- YUI3 modules [node, event, io]
- YUI2 modules [yui2-*]
- Moodle modules [moodle-*]
- Gallery modules [gallery-*]
Before writing new c... | [
"Creates",
"a",
"JavaScript",
"function",
"call",
"that",
"requires",
"one",
"or",
"more",
"modules",
"to",
"be",
"loaded",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1065-L1079 |
217,920 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.js_init_call | public function js_init_call($function, array $extraarguments = null, $ondomready = false, array $module = null) {
$jscode = js_writer::function_call_with_Y($function, $extraarguments);
if (!$module) {
// Detect module automatically.
if (preg_match('/M\.([a-z0-9]+_[^\.]+)/', $fun... | php | public function js_init_call($function, array $extraarguments = null, $ondomready = false, array $module = null) {
$jscode = js_writer::function_call_with_Y($function, $extraarguments);
if (!$module) {
// Detect module automatically.
if (preg_match('/M\.([a-z0-9]+_[^\.]+)/', $fun... | [
"public",
"function",
"js_init_call",
"(",
"$",
"function",
",",
"array",
"$",
"extraarguments",
"=",
"null",
",",
"$",
"ondomready",
"=",
"false",
",",
"array",
"$",
"module",
"=",
"null",
")",
"{",
"$",
"jscode",
"=",
"js_writer",
"::",
"function_call_wi... | Ensure that the specified JavaScript function is called from an inline script
from page footer.
@param string $function the name of the JavaScritp function to with init code,
usually something like 'M.mod_mymodule.init'
@param array $extraarguments and array of arguments to be passed to the function.
The first argumen... | [
"Ensure",
"that",
"the",
"specified",
"JavaScript",
"function",
"is",
"called",
"from",
"an",
"inline",
"script",
"from",
"page",
"footer",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1102-L1112 |
217,921 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.js_init_code | public function js_init_code($jscode, $ondomready = false, array $module = null) {
$jscode = trim($jscode, " ;\n"). ';';
$uniqid = html_writer::random_id();
$startjs = " M.util.js_pending('" . $uniqid . "');";
$endjs = " M.util.js_complete('" . $uniqid . "');";
if ($module) {
... | php | public function js_init_code($jscode, $ondomready = false, array $module = null) {
$jscode = trim($jscode, " ;\n"). ';';
$uniqid = html_writer::random_id();
$startjs = " M.util.js_pending('" . $uniqid . "');";
$endjs = " M.util.js_complete('" . $uniqid . "');";
if ($module) {
... | [
"public",
"function",
"js_init_code",
"(",
"$",
"jscode",
",",
"$",
"ondomready",
"=",
"false",
",",
"array",
"$",
"module",
"=",
"null",
")",
"{",
"$",
"jscode",
"=",
"trim",
"(",
"$",
"jscode",
",",
"\" ;\\n\"",
")",
".",
"';'",
";",
"$",
"uniqid",... | Add short static javascript code fragment to page footer.
This is intended primarily for loading of js modules and initialising page layout.
Ideally the JS code fragment should be stored in plugin renderer so that themes
may override it.
@param string $jscode
@param bool $ondomready wait for dom ready (helps with some... | [
"Add",
"short",
"static",
"javascript",
"code",
"fragment",
"to",
"page",
"footer",
".",
"This",
"is",
"intended",
"primarily",
"for",
"loading",
"of",
"js",
"modules",
"and",
"initialising",
"page",
"layout",
".",
"Ideally",
"the",
"JS",
"code",
"fragment",
... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1124-L1142 |
217,922 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.string_for_js | public function string_for_js($identifier, $component, $a = null) {
if (!$component) {
throw new coding_exception('The $component parameter is required for page_requirements_manager::string_for_js().');
}
if (isset($this->stringsforjs_as[$component][$identifier]) and $this->stringsfo... | php | public function string_for_js($identifier, $component, $a = null) {
if (!$component) {
throw new coding_exception('The $component parameter is required for page_requirements_manager::string_for_js().');
}
if (isset($this->stringsforjs_as[$component][$identifier]) and $this->stringsfo... | [
"public",
"function",
"string_for_js",
"(",
"$",
"identifier",
",",
"$",
"component",
",",
"$",
"a",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"component",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'The $component parameter is required for page_requi... | Make a language string available to JavaScript.
All the strings will be available in a M.str object in the global namespace.
So, for example, after a call to $PAGE->requires->string_for_js('course', 'moodle');
then the JavaScript variable M.str.moodle.course will be 'Course', or the
equivalent in the current language.... | [
"Make",
"a",
"language",
"string",
"available",
"to",
"JavaScript",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1193-L1205 |
217,923 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.strings_for_js | public function strings_for_js($identifiers, $component, $a = null) {
foreach ($identifiers as $key => $identifier) {
if (is_array($a) && array_key_exists($key, $a)) {
$extra = $a[$key];
} else {
$extra = $a;
}
$this->string_for_js(... | php | public function strings_for_js($identifiers, $component, $a = null) {
foreach ($identifiers as $key => $identifier) {
if (is_array($a) && array_key_exists($key, $a)) {
$extra = $a[$key];
} else {
$extra = $a;
}
$this->string_for_js(... | [
"public",
"function",
"strings_for_js",
"(",
"$",
"identifiers",
",",
"$",
"component",
",",
"$",
"a",
"=",
"null",
")",
"{",
"foreach",
"(",
"$",
"identifiers",
"as",
"$",
"key",
"=>",
"$",
"identifier",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"a... | Make an array of language strings available for JS.
This function calls the above function {@link string_for_js()} for each requested
string in the $identifiers array that is passed to the argument for a single module
passed in $module.
<code>
$PAGE->requires->strings_for_js(array('one', 'two', 'three'), 'mymod', arr... | [
"Make",
"an",
"array",
"of",
"language",
"strings",
"available",
"for",
"JS",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1231-L1240 |
217,924 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.event_handler | public function event_handler($selector, $event, $function, array $arguments = null) {
$this->eventhandlers[] = array('selector'=>$selector, 'event'=>$event, 'function'=>$function, 'arguments'=>$arguments);
} | php | public function event_handler($selector, $event, $function, array $arguments = null) {
$this->eventhandlers[] = array('selector'=>$selector, 'event'=>$event, 'function'=>$function, 'arguments'=>$arguments);
} | [
"public",
"function",
"event_handler",
"(",
"$",
"selector",
",",
"$",
"event",
",",
"$",
"function",
",",
"array",
"$",
"arguments",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"eventhandlers",
"[",
"]",
"=",
"array",
"(",
"'selector'",
"=>",
"$",
"sele... | Creates a YUI event handler.
@param mixed $selector standard YUI selector for elements, may be array or string, element id is in the form "#idvalue"
@param string $event A valid DOM event (click, mousedown, change etc.)
@param string $function The name of the function to call
@param array $arguments An optional array... | [
"Creates",
"a",
"YUI",
"event",
"handler",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1275-L1277 |
217,925 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.get_event_handler_code | protected function get_event_handler_code() {
$output = '';
foreach ($this->eventhandlers as $h) {
$output .= js_writer::event_handler($h['selector'], $h['event'], $h['function'], $h['arguments']);
}
return $output;
} | php | protected function get_event_handler_code() {
$output = '';
foreach ($this->eventhandlers as $h) {
$output .= js_writer::event_handler($h['selector'], $h['event'], $h['function'], $h['arguments']);
}
return $output;
} | [
"protected",
"function",
"get_event_handler_code",
"(",
")",
"{",
"$",
"output",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"eventhandlers",
"as",
"$",
"h",
")",
"{",
"$",
"output",
".=",
"js_writer",
"::",
"event_handler",
"(",
"$",
"h",
"[",
... | Returns code needed for registering of event handlers.
@return string JS code | [
"Returns",
"code",
"needed",
"for",
"registering",
"of",
"event",
"handlers",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1283-L1289 |
217,926 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.get_javascript_code | protected function get_javascript_code($ondomready) {
$where = $ondomready ? 'ondomready' : 'normal';
$output = '';
if ($this->jscalls[$where]) {
foreach ($this->jscalls[$where] as $data) {
$output .= js_writer::function_call($data[0], $data[1], $data[2]);
... | php | protected function get_javascript_code($ondomready) {
$where = $ondomready ? 'ondomready' : 'normal';
$output = '';
if ($this->jscalls[$where]) {
foreach ($this->jscalls[$where] as $data) {
$output .= js_writer::function_call($data[0], $data[1], $data[2]);
... | [
"protected",
"function",
"get_javascript_code",
"(",
"$",
"ondomready",
")",
"{",
"$",
"where",
"=",
"$",
"ondomready",
"?",
"'ondomready'",
":",
"'normal'",
";",
"$",
"output",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"jscalls",
"[",
"$",
"where",
... | Get the inline JavaScript code that need to appear in a particular place.
@param bool $ondomready
@return string | [
"Get",
"the",
"inline",
"JavaScript",
"code",
"that",
"need",
"to",
"appear",
"in",
"a",
"particular",
"place",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1296-L1308 |
217,927 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.get_yui3lib_headcss | protected function get_yui3lib_headcss() {
global $CFG;
$yuiformat = '-min';
if ($this->yui3loader->filter === 'RAW') {
$yuiformat = '';
}
$code = '';
if ($this->yui3loader->combine) {
if (!empty($this->yuicssmodules)) {
$modules ... | php | protected function get_yui3lib_headcss() {
global $CFG;
$yuiformat = '-min';
if ($this->yui3loader->filter === 'RAW') {
$yuiformat = '';
}
$code = '';
if ($this->yui3loader->combine) {
if (!empty($this->yuicssmodules)) {
$modules ... | [
"protected",
"function",
"get_yui3lib_headcss",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"yuiformat",
"=",
"'-min'",
";",
"if",
"(",
"$",
"this",
"->",
"yui3loader",
"->",
"filter",
"===",
"'RAW'",
")",
"{",
"$",
"yuiformat",
"=",
"''",
";",
"}",... | Returns basic YUI3 CSS code.
@return string | [
"Returns",
"basic",
"YUI3",
"CSS",
"code",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1376-L1410 |
217,928 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.get_yui3lib_headcode | protected function get_yui3lib_headcode() {
global $CFG;
$jsrev = $this->get_jsrev();
$yuiformat = '-min';
if ($this->yui3loader->filter === 'RAW') {
$yuiformat = '';
}
$format = '-min';
if ($this->YUI_config->groups['moodle']['filter'] === 'DEBUG')... | php | protected function get_yui3lib_headcode() {
global $CFG;
$jsrev = $this->get_jsrev();
$yuiformat = '-min';
if ($this->yui3loader->filter === 'RAW') {
$yuiformat = '';
}
$format = '-min';
if ($this->YUI_config->groups['moodle']['filter'] === 'DEBUG')... | [
"protected",
"function",
"get_yui3lib_headcode",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"jsrev",
"=",
"$",
"this",
"->",
"get_jsrev",
"(",
")",
";",
"$",
"yuiformat",
"=",
"'-min'",
";",
"if",
"(",
"$",
"this",
"->",
"yui3loader",
"->",
"filter... | Returns basic YUI3 JS loading code.
@return string | [
"Returns",
"basic",
"YUI3",
"JS",
"loading",
"code",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1417-L1454 |
217,929 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.get_css_code | protected function get_css_code() {
// First of all the theme CSS, then any custom CSS
// Please note custom CSS is strongly discouraged,
// because it can not be overridden by themes!
// It is suitable only for things like mod/data which accepts CSS from teachers.
$attributes = ... | php | protected function get_css_code() {
// First of all the theme CSS, then any custom CSS
// Please note custom CSS is strongly discouraged,
// because it can not be overridden by themes!
// It is suitable only for things like mod/data which accepts CSS from teachers.
$attributes = ... | [
"protected",
"function",
"get_css_code",
"(",
")",
"{",
"// First of all the theme CSS, then any custom CSS",
"// Please note custom CSS is strongly discouraged,",
"// because it can not be overridden by themes!",
"// It is suitable only for things like mod/data which accepts CSS from teachers.",
... | Returns html tags needed for inclusion of theme CSS.
@return string | [
"Returns",
"html",
"tags",
"needed",
"for",
"inclusion",
"of",
"theme",
"CSS",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1461-L1487 |
217,930 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.get_extra_modules_code | protected function get_extra_modules_code() {
if (empty($this->extramodules)) {
return '';
}
return html_writer::script(js_writer::function_call('M.yui.add_module', array($this->extramodules)));
} | php | protected function get_extra_modules_code() {
if (empty($this->extramodules)) {
return '';
}
return html_writer::script(js_writer::function_call('M.yui.add_module', array($this->extramodules)));
} | [
"protected",
"function",
"get_extra_modules_code",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"extramodules",
")",
")",
"{",
"return",
"''",
";",
"}",
"return",
"html_writer",
"::",
"script",
"(",
"js_writer",
"::",
"function_call",
"(",
"'... | Adds extra modules specified after printing of page header.
@return string | [
"Adds",
"extra",
"modules",
"specified",
"after",
"printing",
"of",
"page",
"header",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1494-L1499 |
217,931 | moodle/moodle | lib/outputrequirementslib.php | page_requirements_manager.get_end_code | public function get_end_code() {
global $CFG;
$output = '';
// Set the log level for the JS logging.
$logconfig = new stdClass();
$logconfig->level = 'warn';
if ($CFG->debugdeveloper) {
$logconfig->level = 'trace';
}
$this->js_call_amd('core/l... | php | public function get_end_code() {
global $CFG;
$output = '';
// Set the log level for the JS logging.
$logconfig = new stdClass();
$logconfig->level = 'warn';
if ($CFG->debugdeveloper) {
$logconfig->level = 'trace';
}
$this->js_call_amd('core/l... | [
"public",
"function",
"get_end_code",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"output",
"=",
"''",
";",
"// Set the log level for the JS logging.",
"$",
"logconfig",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"logconfig",
"->",
"level",
"=",
"'warn'"... | Generate any HTML that needs to go at the end of the page.
Normally, this method is called automatically by the code that prints the
page footer. You should not normally need to call it in your own code.
@return string the HTML code to to at the end of the page. | [
"Generate",
"any",
"HTML",
"that",
"needs",
"to",
"go",
"at",
"the",
"end",
"of",
"the",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1603-L1673 |
217,932 | moodle/moodle | lib/outputrequirementslib.php | YUI_config.add_group | public function add_group($name, $config) {
if (isset($this->groups[$name])) {
throw new coding_exception("A YUI configuration group for '{$name}' already exists. To make changes to this group use YUI_config->update_group().");
}
$this->groups[$name] = $config;
} | php | public function add_group($name, $config) {
if (isset($this->groups[$name])) {
throw new coding_exception("A YUI configuration group for '{$name}' already exists. To make changes to this group use YUI_config->update_group().");
}
$this->groups[$name] = $config;
} | [
"public",
"function",
"add_group",
"(",
"$",
"name",
",",
"$",
"config",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"groups",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"\"A YUI configuration group for '{$name... | Create a new group within the YUI_config system.
@param String $name The name of the group. This must be unique and
not previously used.
@param Array $config The configuration for this group.
@return void | [
"Create",
"a",
"new",
"group",
"within",
"the",
"YUI_config",
"system",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1796-L1801 |
217,933 | moodle/moodle | lib/outputrequirementslib.php | YUI_config.update_group | public function update_group($name, $config) {
if (!isset($this->groups[$name])) {
throw new coding_exception('The Moodle YUI module does not exist. You must define the moodle module config using YUI_config->add_module_config first.');
}
$this->groups[$name] = $config;
} | php | public function update_group($name, $config) {
if (!isset($this->groups[$name])) {
throw new coding_exception('The Moodle YUI module does not exist. You must define the moodle module config using YUI_config->add_module_config first.');
}
$this->groups[$name] = $config;
} | [
"public",
"function",
"update_group",
"(",
"$",
"name",
",",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"groups",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'The Moodle YUI module does n... | Update an existing group configuration
Note, any existing configuration for that group will be wiped out.
This includes module configuration.
@param String $name The name of the group. This must be unique and
not previously used.
@param Array $config The configuration for this group.
@return void | [
"Update",
"an",
"existing",
"group",
"configuration"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1814-L1819 |
217,934 | moodle/moodle | lib/outputrequirementslib.php | YUI_config.set_config_function | public function set_config_function($function) {
$configname = 'yui' . (count($this->jsconfigfunctions) + 1) . 'ConfigFn';
if (isset($this->jsconfigfunctions[$configname])) {
throw new coding_exception("A YUI config function with this name already exists. Config function names must be unique... | php | public function set_config_function($function) {
$configname = 'yui' . (count($this->jsconfigfunctions) + 1) . 'ConfigFn';
if (isset($this->jsconfigfunctions[$configname])) {
throw new coding_exception("A YUI config function with this name already exists. Config function names must be unique... | [
"public",
"function",
"set_config_function",
"(",
"$",
"function",
")",
"{",
"$",
"configname",
"=",
"'yui'",
".",
"(",
"count",
"(",
"$",
"this",
"->",
"jsconfigfunctions",
")",
"+",
"1",
")",
".",
"'ConfigFn'",
";",
"if",
"(",
"isset",
"(",
"$",
"thi... | Set the value of a configuration function used by the YUI Loader's pattern testing.
Only the body of the function should be passed, and not the whole function wrapper.
The JS function your write will be passed a single argument 'name' containing the
name of the module being loaded.
@param $function String the body o... | [
"Set",
"the",
"value",
"of",
"a",
"configuration",
"function",
"used",
"by",
"the",
"YUI",
"Loader",
"s",
"pattern",
"testing",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1832-L1839 |
217,935 | moodle/moodle | lib/outputrequirementslib.php | YUI_config.get_config_functions | public function get_config_functions() {
$configfunctions = '';
foreach ($this->jsconfigfunctions as $functionname => $function) {
$configfunctions .= "var {$functionname} = function(me) {";
$configfunctions .= $function;
$configfunctions .= "};\n";
}
... | php | public function get_config_functions() {
$configfunctions = '';
foreach ($this->jsconfigfunctions as $functionname => $function) {
$configfunctions .= "var {$functionname} = function(me) {";
$configfunctions .= $function;
$configfunctions .= "};\n";
}
... | [
"public",
"function",
"get_config_functions",
"(",
")",
"{",
"$",
"configfunctions",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"jsconfigfunctions",
"as",
"$",
"functionname",
"=>",
"$",
"function",
")",
"{",
"$",
"configfunctions",
".=",
"\"var {$func... | Retrieve the list of JavaScript functions for YUI_config groups.
@return String The complete set of config functions | [
"Retrieve",
"the",
"list",
"of",
"JavaScript",
"functions",
"for",
"YUI_config",
"groups",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1876-L1884 |
217,936 | moodle/moodle | lib/outputrequirementslib.php | YUI_config.update_header_js | public function update_header_js($js) {
// Update the names of the the configFn variables.
// The PHP json_encode function cannot handle literal names so we have to wrap
// them in @ and then replace them with literals of the same function name.
foreach ($this->jsconfigfunctions as $func... | php | public function update_header_js($js) {
// Update the names of the the configFn variables.
// The PHP json_encode function cannot handle literal names so we have to wrap
// them in @ and then replace them with literals of the same function name.
foreach ($this->jsconfigfunctions as $func... | [
"public",
"function",
"update_header_js",
"(",
"$",
"js",
")",
"{",
"// Update the names of the the configFn variables.",
"// The PHP json_encode function cannot handle literal names so we have to wrap",
"// them in @ and then replace them with literals of the same function name.",
"foreach",
... | Update the header JavaScript with any required modification for the YUI Loader.
@param $js String The JavaScript to manipulate.
@return String the modified JS string. | [
"Update",
"the",
"header",
"JavaScript",
"with",
"any",
"required",
"modification",
"for",
"the",
"YUI",
"Loader",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1892-L1900 |
217,937 | moodle/moodle | lib/outputrequirementslib.php | YUI_config.add_module_config | public function add_module_config($name, $config, $group = null) {
if ($group) {
if (!isset($this->groups[$name])) {
throw new coding_exception('The Moodle YUI module does not exist. You must define the moodle module config using YUI_config->add_module_config first.');
}
... | php | public function add_module_config($name, $config, $group = null) {
if ($group) {
if (!isset($this->groups[$name])) {
throw new coding_exception('The Moodle YUI module does not exist. You must define the moodle module config using YUI_config->add_module_config first.');
}
... | [
"public",
"function",
"add_module_config",
"(",
"$",
"name",
",",
"$",
"config",
",",
"$",
"group",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"group",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"groups",
"[",
"$",
"name",
"]",
")",
... | Add configuration for a specific module.
@param String $name The name of the module to add configuration for.
@param Array $config The configuration for the specified module.
@param String $group The name of the group to add configuration for.
If not specified, then this module is added to the global
configuration.
@r... | [
"Add",
"configuration",
"for",
"a",
"specific",
"module",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1912-L1925 |
217,938 | moodle/moodle | lib/outputrequirementslib.php | YUI_config.add_moodle_metadata | public function add_moodle_metadata() {
global $CFG;
if (!isset($this->groups['moodle'])) {
throw new coding_exception('The Moodle YUI module does not exist. You must define the moodle module config using YUI_config->add_module_config first.');
}
if (!isset($this->groups['mo... | php | public function add_moodle_metadata() {
global $CFG;
if (!isset($this->groups['moodle'])) {
throw new coding_exception('The Moodle YUI module does not exist. You must define the moodle module config using YUI_config->add_module_config first.');
}
if (!isset($this->groups['mo... | [
"public",
"function",
"add_moodle_metadata",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"groups",
"[",
"'moodle'",
"]",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'The Moodle YUI module does not e... | Add the moodle YUI module metadata for the moodle group to the YUI_config instance.
If js caching is disabled, metadata will not be served causing YUI to calculate
module dependencies as each module is loaded.
If metadata does not exist it will be created and stored in a MUC entry.
@return void | [
"Add",
"the",
"moodle",
"YUI",
"module",
"metadata",
"for",
"the",
"moodle",
"group",
"to",
"the",
"YUI_config",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1937-L1963 |
217,939 | moodle/moodle | lib/outputrequirementslib.php | YUI_config.get_moodle_metadata | private function get_moodle_metadata() {
$moodlemodules = array();
// Core isn't a plugin type or subsystem - handle it seperately.
if ($module = $this->get_moodle_path_metadata(core_component::get_component_directory('core'))) {
$moodlemodules = array_merge($moodlemodules, $module);... | php | private function get_moodle_metadata() {
$moodlemodules = array();
// Core isn't a plugin type or subsystem - handle it seperately.
if ($module = $this->get_moodle_path_metadata(core_component::get_component_directory('core'))) {
$moodlemodules = array_merge($moodlemodules, $module);... | [
"private",
"function",
"get_moodle_metadata",
"(",
")",
"{",
"$",
"moodlemodules",
"=",
"array",
"(",
")",
";",
"// Core isn't a plugin type or subsystem - handle it seperately.",
"if",
"(",
"$",
"module",
"=",
"$",
"this",
"->",
"get_moodle_path_metadata",
"(",
"core... | Determine the module metadata for all moodle YUI modules.
This works through all modules capable of serving YUI modules, and attempts to get
metadata for each of those modules.
@return Array of module metadata | [
"Determine",
"the",
"module",
"metadata",
"for",
"all",
"moodle",
"YUI",
"modules",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L1973-L2003 |
217,940 | moodle/moodle | lib/outputrequirementslib.php | YUI_config.get_moodle_path_metadata | private function get_moodle_path_metadata($path) {
// Add module metadata is stored in frankenstyle_modname/yui/src/yui_modname/meta/yui_modname.json.
$baseyui = $path . '/yui/src';
$modules = array();
if (is_dir($baseyui)) {
$items = new DirectoryIterator($baseyui);
... | php | private function get_moodle_path_metadata($path) {
// Add module metadata is stored in frankenstyle_modname/yui/src/yui_modname/meta/yui_modname.json.
$baseyui = $path . '/yui/src';
$modules = array();
if (is_dir($baseyui)) {
$items = new DirectoryIterator($baseyui);
... | [
"private",
"function",
"get_moodle_path_metadata",
"(",
"$",
"path",
")",
"{",
"// Add module metadata is stored in frankenstyle_modname/yui/src/yui_modname/meta/yui_modname.json.",
"$",
"baseyui",
"=",
"$",
"path",
".",
"'/yui/src'",
";",
"$",
"modules",
"=",
"array",
"(",... | Helper function process and return the YUI metadata for all of the modules under the specified path.
@param String $path the UNC path to the YUI src directory.
@return Array the complete array for frankenstyle directory. | [
"Helper",
"function",
"process",
"and",
"return",
"the",
"YUI",
"metadata",
"for",
"all",
"of",
"the",
"modules",
"under",
"the",
"specified",
"path",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L2011-L2030 |
217,941 | moodle/moodle | lib/outputrequirementslib.php | YUI_config.define_patched_core_modules | public function define_patched_core_modules($combobase, $yuiversion, $patchlevel, $patchedmodules) {
// The version we use is suffixed with a patchlevel so that we can get additional revisions between YUI releases.
$subversion = $yuiversion . '_' . $patchlevel;
if ($this->comboBase == $combobas... | php | public function define_patched_core_modules($combobase, $yuiversion, $patchlevel, $patchedmodules) {
// The version we use is suffixed with a patchlevel so that we can get additional revisions between YUI releases.
$subversion = $yuiversion . '_' . $patchlevel;
if ($this->comboBase == $combobas... | [
"public",
"function",
"define_patched_core_modules",
"(",
"$",
"combobase",
",",
"$",
"yuiversion",
",",
"$",
"patchlevel",
",",
"$",
"patchedmodules",
")",
"{",
"// The version we use is suffixed with a patchlevel so that we can get additional revisions between YUI releases.",
"... | Define YUI modules which we have been required to patch between releases.
We must do this because we aggressively cache content on the browser, and we must also override use of the
external CDN which will serve the true authoritative copy of the code without our patches.
@param String combobase The local combobase
@p... | [
"Define",
"YUI",
"modules",
"which",
"we",
"have",
"been",
"required",
"to",
"patch",
"between",
"releases",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputrequirementslib.php#L2044-L2083 |
217,942 | moodle/moodle | report/competency/classes/external.php | external.data_for_report | public static function data_for_report($courseid, $userid, $moduleid) {
global $PAGE;
$params = self::validate_parameters(
self::data_for_report_parameters(),
array(
'courseid' => $courseid,
'userid' => $userid,
'moduleid' => $modu... | php | public static function data_for_report($courseid, $userid, $moduleid) {
global $PAGE;
$params = self::validate_parameters(
self::data_for_report_parameters(),
array(
'courseid' => $courseid,
'userid' => $userid,
'moduleid' => $modu... | [
"public",
"static",
"function",
"data_for_report",
"(",
"$",
"courseid",
",",
"$",
"userid",
",",
"$",
"moduleid",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"data_for_report_parameters",
... | Loads the data required to render the report.
@param int $courseid The course id
@param int $userid The user id
@param int $moduleid The module id
@return \stdClass | [
"Loads",
"the",
"data",
"required",
"to",
"render",
"the",
"report",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/competency/classes/external.php#L86-L109 |
217,943 | moodle/moodle | backup/util/plan/restore_step.class.php | restore_step.decrypt | public function decrypt($value) {
// No openssl available, skip this field completely.
if (!function_exists('openssl_encrypt')) {
return null;
}
// No hash available, skip this field completely.
if (!function_exists('hash_hmac')) {
return null;
}... | php | public function decrypt($value) {
// No openssl available, skip this field completely.
if (!function_exists('openssl_encrypt')) {
return null;
}
// No hash available, skip this field completely.
if (!function_exists('hash_hmac')) {
return null;
}... | [
"public",
"function",
"decrypt",
"(",
"$",
"value",
")",
"{",
"// No openssl available, skip this field completely.",
"if",
"(",
"!",
"function_exists",
"(",
"'openssl_encrypt'",
")",
")",
"{",
"return",
"null",
";",
"}",
"// No hash available, skip this field completely.... | Returns symmetric-key AES-256 decryption of base64 encoded contents.
This method is used in restore operations to decrypt contents encrypted with
{@link encrypted_final_element} automatically decoding (base64) and decrypting
contents using the key stored in backup_encryptkey config.
Requires openssl, cipher availabil... | [
"Returns",
"symmetric",
"-",
"key",
"AES",
"-",
"256",
"decryption",
"of",
"base64",
"encoded",
"contents",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/plan/restore_step.class.php#L109-L154 |
217,944 | moodle/moodle | lib/classes/lock/postgres_lock_factory.php | postgres_lock_factory.get_unique_db_instance_id | protected function get_unique_db_instance_id() {
global $CFG;
$strkey = $CFG->dbname . ':' . $CFG->prefix;
$intkey = crc32($strkey);
// Normalize between 64 bit unsigned int and 32 bit signed ints. Php could return either from crc32.
if (PHP_INT_SIZE == 8) {
if ($int... | php | protected function get_unique_db_instance_id() {
global $CFG;
$strkey = $CFG->dbname . ':' . $CFG->prefix;
$intkey = crc32($strkey);
// Normalize between 64 bit unsigned int and 32 bit signed ints. Php could return either from crc32.
if (PHP_INT_SIZE == 8) {
if ($int... | [
"protected",
"function",
"get_unique_db_instance_id",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"strkey",
"=",
"$",
"CFG",
"->",
"dbname",
".",
"':'",
".",
"$",
"CFG",
"->",
"prefix",
";",
"$",
"intkey",
"=",
"crc32",
"(",
"$",
"strkey",
")",
";... | Calculate a unique instance id based on the database name and prefix.
@return int. | [
"Calculate",
"a",
"unique",
"instance",
"id",
"based",
"on",
"the",
"database",
"name",
"and",
"prefix",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/lock/postgres_lock_factory.php#L66-L79 |
217,945 | moodle/moodle | lib/classes/lock/postgres_lock_factory.php | postgres_lock_factory.get_index_from_key | protected function get_index_from_key($key) {
if (isset(self::$lockidcache[$key])) {
return self::$lockidcache[$key];
}
$index = 0;
$record = $this->db->get_record('lock_db', array('resourcekey' => $key));
if ($record) {
$index = $record->id;
}
... | php | protected function get_index_from_key($key) {
if (isset(self::$lockidcache[$key])) {
return self::$lockidcache[$key];
}
$index = 0;
$record = $this->db->get_record('lock_db', array('resourcekey' => $key));
if ($record) {
$index = $record->id;
}
... | [
"protected",
"function",
"get_index_from_key",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"lockidcache",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"self",
"::",
"$",
"lockidcache",
"[",
"$",
"key",
"]",
";",
"}",
"$... | This function generates the unique index for a specific lock key.
Once an index is assigned to a key, it never changes - so this is
statically cached.
@param string $key
@return int
@throws \moodle_exception | [
"This",
"function",
"generates",
"the",
"unique",
"index",
"for",
"a",
"specific",
"lock",
"key",
".",
"Once",
"an",
"index",
"is",
"assigned",
"to",
"a",
"key",
"it",
"never",
"changes",
"-",
"so",
"this",
"is",
"statically",
"cached",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/lock/postgres_lock_factory.php#L138-L169 |
217,946 | moodle/moodle | lib/classes/lock/postgres_lock_factory.php | postgres_lock_factory.auto_release | public function auto_release() {
// Called from the shutdown handler. Must release all open locks.
foreach ($this->openlocks as $key => $unused) {
$lock = new lock($key, $this);
$lock->release();
}
} | php | public function auto_release() {
// Called from the shutdown handler. Must release all open locks.
foreach ($this->openlocks as $key => $unused) {
$lock = new lock($key, $this);
$lock->release();
}
} | [
"public",
"function",
"auto_release",
"(",
")",
"{",
"// Called from the shutdown handler. Must release all open locks.",
"foreach",
"(",
"$",
"this",
"->",
"openlocks",
"as",
"$",
"key",
"=>",
"$",
"unused",
")",
"{",
"$",
"lock",
"=",
"new",
"lock",
"(",
"$",
... | Auto release any open locks on shutdown.
This is required, because we may be using persistent DB connections. | [
"Auto",
"release",
"any",
"open",
"locks",
"on",
"shutdown",
".",
"This",
"is",
"required",
"because",
"we",
"may",
"be",
"using",
"persistent",
"DB",
"connections",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/lock/postgres_lock_factory.php#L235-L241 |
217,947 | moodle/moodle | lib/dml/pgsql_native_moodle_temptables.php | pgsql_native_moodle_temptables.update_stats | public function update_stats() {
$temptables = $this->get_temptables();
foreach ($temptables as $temptablename) {
$this->mdb->execute("ANALYZE {".$temptablename."}");
}
} | php | public function update_stats() {
$temptables = $this->get_temptables();
foreach ($temptables as $temptablename) {
$this->mdb->execute("ANALYZE {".$temptablename."}");
}
} | [
"public",
"function",
"update_stats",
"(",
")",
"{",
"$",
"temptables",
"=",
"$",
"this",
"->",
"get_temptables",
"(",
")",
";",
"foreach",
"(",
"$",
"temptables",
"as",
"$",
"temptablename",
")",
"{",
"$",
"this",
"->",
"mdb",
"->",
"execute",
"(",
"\... | Analyze the data in temporary tables to force statistics collection after bulk data loads.
PostgreSQL does not natively support automatic temporary table stats collection, so we do it.
@return void | [
"Analyze",
"the",
"data",
"in",
"temporary",
"tables",
"to",
"force",
"statistics",
"collection",
"after",
"bulk",
"data",
"loads",
".",
"PostgreSQL",
"does",
"not",
"natively",
"support",
"automatic",
"temporary",
"table",
"stats",
"collection",
"so",
"we",
"do... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/pgsql_native_moodle_temptables.php#L38-L43 |
217,948 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/DoctypeRegistry.php | HTMLPurifier_DoctypeRegistry.register | public function register(
$doctype,
$xml = true,
$modules = array(),
$tidy_modules = array(),
$aliases = array(),
$dtd_public = null,
$dtd_system = null
) {
if (!is_array($modules)) {
$modules = array($modules);
}
if (!is_ar... | php | public function register(
$doctype,
$xml = true,
$modules = array(),
$tidy_modules = array(),
$aliases = array(),
$dtd_public = null,
$dtd_system = null
) {
if (!is_array($modules)) {
$modules = array($modules);
}
if (!is_ar... | [
"public",
"function",
"register",
"(",
"$",
"doctype",
",",
"$",
"xml",
"=",
"true",
",",
"$",
"modules",
"=",
"array",
"(",
")",
",",
"$",
"tidy_modules",
"=",
"array",
"(",
")",
",",
"$",
"aliases",
"=",
"array",
"(",
")",
",",
"$",
"dtd_public",... | Registers a doctype to the registry
@note Accepts a fully-formed doctype object, or the
parameters for constructing a doctype object
@param string $doctype Name of doctype or literal doctype object
@param bool $xml
@param array $modules Modules doctype will load
@param array $tidy_modules Modules doctype will load for ... | [
"Registers",
"a",
"doctype",
"to",
"the",
"registry"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/DoctypeRegistry.php#L31-L74 |
217,949 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/DoctypeRegistry.php | HTMLPurifier_DoctypeRegistry.get | public function get($doctype)
{
if (isset($this->aliases[$doctype])) {
$doctype = $this->aliases[$doctype];
}
if (!isset($this->doctypes[$doctype])) {
trigger_error('Doctype ' . htmlspecialchars($doctype) . ' does not exist', E_USER_ERROR);
$anon = new HTM... | php | public function get($doctype)
{
if (isset($this->aliases[$doctype])) {
$doctype = $this->aliases[$doctype];
}
if (!isset($this->doctypes[$doctype])) {
trigger_error('Doctype ' . htmlspecialchars($doctype) . ' does not exist', E_USER_ERROR);
$anon = new HTM... | [
"public",
"function",
"get",
"(",
"$",
"doctype",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"aliases",
"[",
"$",
"doctype",
"]",
")",
")",
"{",
"$",
"doctype",
"=",
"$",
"this",
"->",
"aliases",
"[",
"$",
"doctype",
"]",
";",
"}",
"... | Retrieves reference to a doctype of a certain name
@note This function resolves aliases
@note When possible, use the more fully-featured make()
@param string $doctype Name of doctype
@return HTMLPurifier_Doctype Editable doctype object | [
"Retrieves",
"reference",
"to",
"a",
"doctype",
"of",
"a",
"certain",
"name"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/DoctypeRegistry.php#L83-L94 |
217,950 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/DoctypeRegistry.php | HTMLPurifier_DoctypeRegistry.getDoctypeFromConfig | public function getDoctypeFromConfig($config)
{
// recommended test
$doctype = $config->get('HTML.Doctype');
if (!empty($doctype)) {
return $doctype;
}
$doctype = $config->get('HTML.CustomDoctype');
if (!empty($doctype)) {
return $doctype;
... | php | public function getDoctypeFromConfig($config)
{
// recommended test
$doctype = $config->get('HTML.Doctype');
if (!empty($doctype)) {
return $doctype;
}
$doctype = $config->get('HTML.CustomDoctype');
if (!empty($doctype)) {
return $doctype;
... | [
"public",
"function",
"getDoctypeFromConfig",
"(",
"$",
"config",
")",
"{",
"// recommended test",
"$",
"doctype",
"=",
"$",
"config",
"->",
"get",
"(",
"'HTML.Doctype'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"doctype",
")",
")",
"{",
"return",
"$... | Retrieves the doctype from the configuration object
@param HTMLPurifier_Config $config
@return string | [
"Retrieves",
"the",
"doctype",
"from",
"the",
"configuration",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/DoctypeRegistry.php#L116-L139 |
217,951 | moodle/moodle | message/renderer.php | core_message_renderer.manage_messageoutput_settings | public function manage_messageoutput_settings($allprocessors, $processors, $providers, $preferences) {
$output = html_writer::start_tag('form', array('id' => 'defaultmessageoutputs', 'method' => 'post'));
$output .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' =... | php | public function manage_messageoutput_settings($allprocessors, $processors, $providers, $preferences) {
$output = html_writer::start_tag('form', array('id' => 'defaultmessageoutputs', 'method' => 'post'));
$output .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' =... | [
"public",
"function",
"manage_messageoutput_settings",
"(",
"$",
"allprocessors",
",",
"$",
"processors",
",",
"$",
"providers",
",",
"$",
"preferences",
")",
"{",
"$",
"output",
"=",
"html_writer",
"::",
"start_tag",
"(",
"'form'",
",",
"array",
"(",
"'id'",
... | Display the interface to manage both message outputs and default message outputs
@param array $allprocessors array of objects containing all message processors
@param array $processors array of objects containing active message processors
@param array $providers array of objects containing message providers
@pa... | [
"Display",
"the",
"interface",
"to",
"manage",
"both",
"message",
"outputs",
"and",
"default",
"message",
"outputs"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/renderer.php#L48-L68 |
217,952 | moodle/moodle | message/renderer.php | core_message_renderer.manage_messageoutputs | public function manage_messageoutputs($processors) {
// Display the current workflows
$table = new html_table();
$table->attributes['class'] = 'admintable generaltable';
$table->data = array();
$table->head = array(
get_string('name'),
get_st... | php | public function manage_messageoutputs($processors) {
// Display the current workflows
$table = new html_table();
$table->attributes['class'] = 'admintable generaltable';
$table->data = array();
$table->head = array(
get_string('name'),
get_st... | [
"public",
"function",
"manage_messageoutputs",
"(",
"$",
"processors",
")",
"{",
"// Display the current workflows",
"$",
"table",
"=",
"new",
"html_table",
"(",
")",
";",
"$",
"table",
"->",
"attributes",
"[",
"'class'",
"]",
"=",
"'admintable generaltable'",
";"... | Display the interface to manage message outputs
@param array $processors array of objects containing message processors
@return string The text to render | [
"Display",
"the",
"interface",
"to",
"manage",
"message",
"outputs"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/renderer.php#L76-L116 |
217,953 | moodle/moodle | message/renderer.php | core_message_renderer.render_user_notification_preferences | public function render_user_notification_preferences($user) {
$processors = get_message_processors();
$providers = message_get_providers_for_user($user->id);
$preferences = \core_message\api::get_all_message_preferences($processors, $providers, $user);
$notificationlistoutput = new \cor... | php | public function render_user_notification_preferences($user) {
$processors = get_message_processors();
$providers = message_get_providers_for_user($user->id);
$preferences = \core_message\api::get_all_message_preferences($processors, $providers, $user);
$notificationlistoutput = new \cor... | [
"public",
"function",
"render_user_notification_preferences",
"(",
"$",
"user",
")",
"{",
"$",
"processors",
"=",
"get_message_processors",
"(",
")",
";",
"$",
"providers",
"=",
"message_get_providers_for_user",
"(",
"$",
"user",
"->",
"id",
")",
";",
"$",
"pref... | Display the interface for notification preferences
@param object $user instance of a user
@return string The text to render | [
"Display",
"the",
"interface",
"for",
"notification",
"preferences"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/renderer.php#L226-L235 |
217,954 | moodle/moodle | message/renderer.php | core_message_renderer.render_user_message_preferences | public function render_user_message_preferences($user) {
global $CFG;
// Filter out enabled, available system_configured and user_configured processors only.
$readyprocessors = array_filter(get_message_processors(), function($processor) {
return $processor->enabled &&
... | php | public function render_user_message_preferences($user) {
global $CFG;
// Filter out enabled, available system_configured and user_configured processors only.
$readyprocessors = array_filter(get_message_processors(), function($processor) {
return $processor->enabled &&
... | [
"public",
"function",
"render_user_message_preferences",
"(",
"$",
"user",
")",
"{",
"global",
"$",
"CFG",
";",
"// Filter out enabled, available system_configured and user_configured processors only.",
"$",
"readyprocessors",
"=",
"array_filter",
"(",
"get_message_processors",
... | Display the interface for message preferences
@param object $user instance of a user
@return string The text to render | [
"Display",
"the",
"interface",
"for",
"message",
"preferences"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/renderer.php#L243-L287 |
217,955 | moodle/moodle | lib/pear/HTML/QuickForm/utils.php | HTML_QuickForm_utils.pathGet | static function pathGet($values, $path, $default = NULL) {
foreach ($path as $key) {
if (!is_array($values) || !isset($values[$key])) {
return $default;
}
$values = $values[$key];
}
return $values;
} | php | static function pathGet($values, $path, $default = NULL) {
foreach ($path as $key) {
if (!is_array($values) || !isset($values[$key])) {
return $default;
}
$values = $values[$key];
}
return $values;
} | [
"static",
"function",
"pathGet",
"(",
"$",
"values",
",",
"$",
"path",
",",
"$",
"default",
"=",
"NULL",
")",
"{",
"foreach",
"(",
"$",
"path",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"values",
")",
"||",
"!",
"isset",
... | Get a single value from an array-tree.
@param array $values Ex: ['foo' => ['bar' => 123]].
@param array $path Ex: ['foo', 'bar'].
@param mixed $default
@return mixed Ex 123.
@access public
@static | [
"Get",
"a",
"single",
"value",
"from",
"an",
"array",
"-",
"tree",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/utils.php#L48-L56 |
217,956 | moodle/moodle | lib/pear/HTML/QuickForm/utils.php | HTML_QuickForm_utils.pathIsset | static function pathIsset($values, $path) {
foreach ($path as $key) {
if (!is_array($values) || !isset($values[$key])) {
return FALSE;
}
$values = $values[$key];
}
return TRUE;
} | php | static function pathIsset($values, $path) {
foreach ($path as $key) {
if (!is_array($values) || !isset($values[$key])) {
return FALSE;
}
$values = $values[$key];
}
return TRUE;
} | [
"static",
"function",
"pathIsset",
"(",
"$",
"values",
",",
"$",
"path",
")",
"{",
"foreach",
"(",
"$",
"path",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"values",
")",
"||",
"!",
"isset",
"(",
"$",
"values",
"[",
"$",
"... | Check if a key isset which may be several layers deep.
This is a helper for when the calling function does not know how many layers deep
the path array is so cannot easily check.
@param array $values
@param array $path
@return bool
@access public
@static | [
"Check",
"if",
"a",
"key",
"isset",
"which",
"may",
"be",
"several",
"layers",
"deep",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/utils.php#L71-L79 |
217,957 | moodle/moodle | lib/pear/HTML/QuickForm/utils.php | HTML_QuickForm_utils.pathSet | static function pathSet(&$values, $pathParts, $value) {
$r = &$values;
$last = array_pop($pathParts);
foreach ($pathParts as $part) {
if (!isset($r[$part])) {
$r[$part] = array();
}
$r = &$r[$part];
}
$r[$last] = $value;
} | php | static function pathSet(&$values, $pathParts, $value) {
$r = &$values;
$last = array_pop($pathParts);
foreach ($pathParts as $part) {
if (!isset($r[$part])) {
$r[$part] = array();
}
$r = &$r[$part];
}
$r[$last] = $value;
} | [
"static",
"function",
"pathSet",
"(",
"&",
"$",
"values",
",",
"$",
"pathParts",
",",
"$",
"value",
")",
"{",
"$",
"r",
"=",
"&",
"$",
"values",
";",
"$",
"last",
"=",
"array_pop",
"(",
"$",
"pathParts",
")",
";",
"foreach",
"(",
"$",
"pathParts",
... | Set a single value in an array tree.
@param array $values Ex: ['foo' => ['bar' => 123]].
@param array $pathParts Ex: ['foo', 'bar'].
@param mixed $value Ex: 456.
@return void
@access public
@static | [
"Set",
"a",
"single",
"value",
"in",
"an",
"array",
"tree",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/utils.php#L92-L102 |
217,958 | moodle/moodle | lib/pear/HTML/QuickForm/utils.php | HTML_QuickForm_utils.recursiveBuild | static function recursiveBuild($path, $value, $source = array()) {
self::pathSet($source, $path, $value);
return $source;
} | php | static function recursiveBuild($path, $value, $source = array()) {
self::pathSet($source, $path, $value);
return $source;
} | [
"static",
"function",
"recursiveBuild",
"(",
"$",
"path",
",",
"$",
"value",
",",
"$",
"source",
"=",
"array",
"(",
")",
")",
"{",
"self",
"::",
"pathSet",
"(",
"$",
"source",
",",
"$",
"path",
",",
"$",
"value",
")",
";",
"return",
"$",
"source",
... | Append the value to the array using the key provided.
e.g if value is 'llama' & path is [0, 'email', 'location'] result will be
[0 => ['email' => ['location' => 'llama']]
@param $path
@param $value
@param array $source
@return array
@access public
@static | [
"Append",
"the",
"value",
"to",
"the",
"array",
"using",
"the",
"key",
"provided",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/utils.php#L154-L157 |
217,959 | moodle/moodle | mod/choice/classes/external.php | mod_choice_external.submit_choice_response | public static function submit_choice_response($choiceid, $responses) {
global $USER;
$warnings = array();
$params = self::validate_parameters(self::submit_choice_response_parameters(),
array(
'choiceid' ... | php | public static function submit_choice_response($choiceid, $responses) {
global $USER;
$warnings = array();
$params = self::validate_parameters(self::submit_choice_response_parameters(),
array(
'choiceid' ... | [
"public",
"static",
"function",
"submit_choice_response",
"(",
"$",
"choiceid",
",",
"$",
"responses",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"warnings",
"=",
"array",
"(",
")",
";",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",... | Submit choice responses
@param int $choiceid the choice instance id
@param array $responses the response ids
@return array answers information and warnings
@since Moodle 3.0 | [
"Submit",
"choice",
"responses"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/choice/classes/external.php#L314-L358 |
217,960 | moodle/moodle | mod/choice/classes/external.php | mod_choice_external.submit_choice_response_returns | public static function submit_choice_response_returns() {
return new external_single_structure(
array(
'answers' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new ... | php | public static function submit_choice_response_returns() {
return new external_single_structure(
array(
'answers' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new ... | [
"public",
"static",
"function",
"submit_choice_response_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'answers'",
"=>",
"new",
"external_multiple_structure",
"(",
"new",
"external_single_structure",
"(",
"array",
"(",
"'id'",... | Describes the submit_choice_response return value.
@return external_multiple_structure
@since Moodle 3.0 | [
"Describes",
"the",
"submit_choice_response",
"return",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/choice/classes/external.php#L366-L383 |
217,961 | moodle/moodle | mod/choice/classes/external.php | mod_choice_external.get_choices_by_courses_returns | public static function get_choices_by_courses_returns() {
return new external_single_structure(
array(
'choices' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new external_valu... | php | public static function get_choices_by_courses_returns() {
return new external_single_structure(
array(
'choices' => new external_multiple_structure(
new external_single_structure(
array(
'id' => new external_valu... | [
"public",
"static",
"function",
"get_choices_by_courses_returns",
"(",
")",
"{",
"return",
"new",
"external_single_structure",
"(",
"array",
"(",
"'choices'",
"=>",
"new",
"external_multiple_structure",
"(",
"new",
"external_single_structure",
"(",
"array",
"(",
"'id'",... | Describes the mod_choice_get_choices_by_courses return value.
@return external_single_structure
@since Moodle 3.0 | [
"Describes",
"the",
"mod_choice_get_choices_by_courses",
"return",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/choice/classes/external.php#L548-L585 |
217,962 | moodle/moodle | mod/choice/classes/external.php | mod_choice_external.delete_choice_responses | public static function delete_choice_responses($choiceid, $responses = array()) {
$status = false;
$warnings = array();
$params = self::validate_parameters(self::delete_choice_responses_parameters(),
array(
... | php | public static function delete_choice_responses($choiceid, $responses = array()) {
$status = false;
$warnings = array();
$params = self::validate_parameters(self::delete_choice_responses_parameters(),
array(
... | [
"public",
"static",
"function",
"delete_choice_responses",
"(",
"$",
"choiceid",
",",
"$",
"responses",
"=",
"array",
"(",
")",
")",
"{",
"$",
"status",
"=",
"false",
";",
"$",
"warnings",
"=",
"array",
"(",
")",
";",
"$",
"params",
"=",
"self",
"::",
... | Delete the given submitted responses in a choice
@param int $choiceid the choice instance id
@param array $responses the response ids, empty for deleting all the current user responses
@return array status information and warnings
@throws moodle_exception
@since Moodle 3.0 | [
"Delete",
"the",
"given",
"submitted",
"responses",
"in",
"a",
"choice"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/choice/classes/external.php#L616-L685 |
217,963 | moodle/moodle | lib/classes/antivirus/manager.php | manager.get_enabled | private static function get_enabled() {
global $CFG;
$active = array();
if (empty($CFG->antiviruses)) {
return $active;
}
foreach (explode(',', $CFG->antiviruses) as $e) {
if ($antivirus = self::get_antivirus($e)) {
if ($antivirus->is_con... | php | private static function get_enabled() {
global $CFG;
$active = array();
if (empty($CFG->antiviruses)) {
return $active;
}
foreach (explode(',', $CFG->antiviruses) as $e) {
if ($antivirus = self::get_antivirus($e)) {
if ($antivirus->is_con... | [
"private",
"static",
"function",
"get_enabled",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"active",
"=",
"array",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"CFG",
"->",
"antiviruses",
")",
")",
"{",
"return",
"$",
"active",
";",
"}",
"forea... | Returns list of enabled antiviruses.
@return array Array ('antivirusname'=>stdClass antivirus object). | [
"Returns",
"list",
"of",
"enabled",
"antiviruses",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/antivirus/manager.php#L42-L58 |
217,964 | moodle/moodle | lib/classes/antivirus/manager.php | manager.scan_file | public static function scan_file($file, $filename, $deleteinfected) {
$antiviruses = self::get_enabled();
foreach ($antiviruses as $antivirus) {
$result = $antivirus->scan_file($file, $filename);
if ($result === $antivirus::SCAN_RESULT_FOUND) {
// Infection found.... | php | public static function scan_file($file, $filename, $deleteinfected) {
$antiviruses = self::get_enabled();
foreach ($antiviruses as $antivirus) {
$result = $antivirus->scan_file($file, $filename);
if ($result === $antivirus::SCAN_RESULT_FOUND) {
// Infection found.... | [
"public",
"static",
"function",
"scan_file",
"(",
"$",
"file",
",",
"$",
"filename",
",",
"$",
"deleteinfected",
")",
"{",
"$",
"antiviruses",
"=",
"self",
"::",
"get_enabled",
"(",
")",
";",
"foreach",
"(",
"$",
"antiviruses",
"as",
"$",
"antivirus",
")... | Scan file using all enabled antiviruses, throws exception in case of infected file.
@param string $file Full path to the file.
@param string $filename Name of the file (could be different from physical file if temp file is used).
@param bool $deleteinfected whether infected file needs to be deleted.
@throws \core\anti... | [
"Scan",
"file",
"using",
"all",
"enabled",
"antiviruses",
"throws",
"exception",
"in",
"case",
"of",
"infected",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/antivirus/manager.php#L69-L81 |
217,965 | moodle/moodle | lib/classes/antivirus/manager.php | manager.scan_data | public static function scan_data($data) {
$antiviruses = self::get_enabled();
foreach ($antiviruses as $antivirus) {
$result = $antivirus->scan_data($data);
if ($result === $antivirus::SCAN_RESULT_FOUND) {
throw new \core\antivirus\scanner_exception('virusfound', ... | php | public static function scan_data($data) {
$antiviruses = self::get_enabled();
foreach ($antiviruses as $antivirus) {
$result = $antivirus->scan_data($data);
if ($result === $antivirus::SCAN_RESULT_FOUND) {
throw new \core\antivirus\scanner_exception('virusfound', ... | [
"public",
"static",
"function",
"scan_data",
"(",
"$",
"data",
")",
"{",
"$",
"antiviruses",
"=",
"self",
"::",
"get_enabled",
"(",
")",
";",
"foreach",
"(",
"$",
"antiviruses",
"as",
"$",
"antivirus",
")",
"{",
"$",
"result",
"=",
"$",
"antivirus",
"-... | Scan data steam using all enabled antiviruses, throws exception in case of infected data.
@param string $data The varaible containing the data to scan.
@throws \core\antivirus\scanner_exception If data is infected.
@return void | [
"Scan",
"data",
"steam",
"using",
"all",
"enabled",
"antiviruses",
"throws",
"exception",
"in",
"case",
"of",
"infected",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/antivirus/manager.php#L90-L98 |
217,966 | moodle/moodle | lib/classes/antivirus/manager.php | manager.get_available | public static function get_available() {
$antiviruses = array();
foreach (\core_component::get_plugin_list('antivirus') as $antivirusname => $dir) {
$antiviruses[$antivirusname] = get_string('pluginname', 'antivirus_'.$antivirusname);
}
return $antiviruses;
} | php | public static function get_available() {
$antiviruses = array();
foreach (\core_component::get_plugin_list('antivirus') as $antivirusname => $dir) {
$antiviruses[$antivirusname] = get_string('pluginname', 'antivirus_'.$antivirusname);
}
return $antiviruses;
} | [
"public",
"static",
"function",
"get_available",
"(",
")",
"{",
"$",
"antiviruses",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"\\",
"core_component",
"::",
"get_plugin_list",
"(",
"'antivirus'",
")",
"as",
"$",
"antivirusname",
"=>",
"$",
"dir",
")",
"{... | Get the list of available antiviruses.
@return array Array ('antivirusname'=>'localised antivirus name'). | [
"Get",
"the",
"list",
"of",
"available",
"antiviruses",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/antivirus/manager.php#L121-L127 |
217,967 | moodle/moodle | course/dnduploadlib.php | dndupload_handler.register_type | protected function register_type($identifier, $datatransfertypes, $addmessage, $namemessage, $handlermessage, $priority=100) {
if ($this->is_known_type($identifier)) {
throw new coding_exception("Type $identifier is already registered");
}
$add = new stdClass;
$add->identifi... | php | protected function register_type($identifier, $datatransfertypes, $addmessage, $namemessage, $handlermessage, $priority=100) {
if ($this->is_known_type($identifier)) {
throw new coding_exception("Type $identifier is already registered");
}
$add = new stdClass;
$add->identifi... | [
"protected",
"function",
"register_type",
"(",
"$",
"identifier",
",",
"$",
"datatransfertypes",
",",
"$",
"addmessage",
",",
"$",
"namemessage",
",",
"$",
"handlermessage",
",",
"$",
"priority",
"=",
"100",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"is_know... | Used to add a new mime type that can be drag and dropped onto a
course displayed in a browser window
@param string $identifier The name that this type will be known as
@param array $datatransfertypes An array of the different types in the browser
'dataTransfer.types' object that will map to this type
@param string $ad... | [
"Used",
"to",
"add",
"a",
"new",
"mime",
"type",
"that",
"can",
"be",
"drag",
"and",
"dropped",
"onto",
"a",
"course",
"displayed",
"in",
"a",
"browser",
"window"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/dnduploadlib.php#L189-L204 |
217,968 | moodle/moodle | course/dnduploadlib.php | dndupload_handler.register_type_handler | protected function register_type_handler($type, $module, $message, $noname) {
if (!$this->is_known_type($type)) {
throw new coding_exception("Trying to add handler for unknown type $type");
}
$add = new stdClass;
$add->type = $type;
$add->module = $module;
$a... | php | protected function register_type_handler($type, $module, $message, $noname) {
if (!$this->is_known_type($type)) {
throw new coding_exception("Trying to add handler for unknown type $type");
}
$add = new stdClass;
$add->type = $type;
$add->module = $module;
$a... | [
"protected",
"function",
"register_type_handler",
"(",
"$",
"type",
",",
"$",
"module",
",",
"$",
"message",
",",
"$",
"noname",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"is_known_type",
"(",
"$",
"type",
")",
")",
"{",
"throw",
"new",
"coding_exce... | Used to declare that a particular module will handle a particular type
of dropped data
@param string $type The name of the type (as declared in register_type)
@param string $module The name of the module to handle this type
@param string $message The message to show the user if more than one handler is registered
for ... | [
"Used",
"to",
"declare",
"that",
"a",
"particular",
"module",
"will",
"handle",
"a",
"particular",
"type",
"of",
"dropped",
"data"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/dnduploadlib.php#L217-L229 |
217,969 | moodle/moodle | course/dnduploadlib.php | dndupload_handler.register_file_handler | protected function register_file_handler($extension, $module, $message) {
$extension = strtolower($extension);
$add = new stdClass;
$add->extension = $extension;
$add->module = $module;
$add->message = $message;
$this->filehandlers[] = $add;
} | php | protected function register_file_handler($extension, $module, $message) {
$extension = strtolower($extension);
$add = new stdClass;
$add->extension = $extension;
$add->module = $module;
$add->message = $message;
$this->filehandlers[] = $add;
} | [
"protected",
"function",
"register_file_handler",
"(",
"$",
"extension",
",",
"$",
"module",
",",
"$",
"message",
")",
"{",
"$",
"extension",
"=",
"strtolower",
"(",
"$",
"extension",
")",
";",
"$",
"add",
"=",
"new",
"stdClass",
";",
"$",
"add",
"->",
... | Used to declare that a particular module will handle a particular type
of dropped file
@param string $extension The file extension to handle ('*' for all types)
@param string $module The name of the module to handle this type
@param string $message The message to show the user if more than one handler is registered
fo... | [
"Used",
"to",
"declare",
"that",
"a",
"particular",
"module",
"will",
"handle",
"a",
"particular",
"type",
"of",
"dropped",
"file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/dnduploadlib.php#L240-L249 |
217,970 | moodle/moodle | course/dnduploadlib.php | dndupload_handler.has_type_handler | public function has_type_handler($module, $type) {
if (!$this->is_known_type($type)) {
throw new coding_exception("Checking for handler for unknown type $type");
}
foreach ($this->types[$type]->handlers as $handler) {
if ($handler->module == $module) {
ret... | php | public function has_type_handler($module, $type) {
if (!$this->is_known_type($type)) {
throw new coding_exception("Checking for handler for unknown type $type");
}
foreach ($this->types[$type]->handlers as $handler) {
if ($handler->module == $module) {
ret... | [
"public",
"function",
"has_type_handler",
"(",
"$",
"module",
",",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"is_known_type",
"(",
"$",
"type",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"\"Checking for handler for unknown type $ty... | Check to see if the module in question has registered to handle the
type given
@param string $module The name of the module
@param string $type The identifier of the type
@return bool True if the module has registered to handle that type | [
"Check",
"to",
"see",
"if",
"the",
"module",
"in",
"question",
"has",
"registered",
"to",
"handle",
"the",
"type",
"given"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/dnduploadlib.php#L269-L279 |
217,971 | moodle/moodle | course/dnduploadlib.php | dndupload_handler.get_handled_file_types | public function get_handled_file_types($module) {
$types = array();
foreach ($this->filehandlers as $handler) {
if ($handler->module == $module) {
if ($handler->extension == '*') {
return '*';
} else {
// Prepending '.' ... | php | public function get_handled_file_types($module) {
$types = array();
foreach ($this->filehandlers as $handler) {
if ($handler->module == $module) {
if ($handler->extension == '*') {
return '*';
} else {
// Prepending '.' ... | [
"public",
"function",
"get_handled_file_types",
"(",
"$",
"module",
")",
"{",
"$",
"types",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"filehandlers",
"as",
"$",
"handler",
")",
"{",
"if",
"(",
"$",
"handler",
"->",
"module",
"==",... | Gets a list of the file types that are handled by a particular module
@param string $module The name of the module to check
@return array of file extensions or string '*' | [
"Gets",
"a",
"list",
"of",
"the",
"file",
"types",
"that",
"are",
"handled",
"by",
"a",
"particular",
"module"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/dnduploadlib.php#L307-L320 |
217,972 | moodle/moodle | course/dnduploadlib.php | dndupload_handler.type_compare | protected function type_compare($type1, $type2) {
if ($type1->priority < $type2->priority) {
return -1;
}
if ($type1->priority > $type2->priority) {
return 1;
}
return 0;
} | php | protected function type_compare($type1, $type2) {
if ($type1->priority < $type2->priority) {
return -1;
}
if ($type1->priority > $type2->priority) {
return 1;
}
return 0;
} | [
"protected",
"function",
"type_compare",
"(",
"$",
"type1",
",",
"$",
"type2",
")",
"{",
"if",
"(",
"$",
"type1",
"->",
"priority",
"<",
"$",
"type2",
"->",
"priority",
")",
"{",
"return",
"-",
"1",
";",
"}",
"if",
"(",
"$",
"type1",
"->",
"priorit... | Comparison function used when sorting types by priority
@param object $type1 first type to compare
@param object $type2 second type to compare
@return integer -1 for $type1 < $type2; 1 for $type1 > $type2; 0 for equal | [
"Comparison",
"function",
"used",
"when",
"sorting",
"types",
"by",
"priority"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/dnduploadlib.php#L361-L369 |
217,973 | moodle/moodle | course/dnduploadlib.php | dndupload_ajax_processor.process | public function process($displayname = null, $content = null) {
require_capability('moodle/course:manageactivities', $this->context);
if ($this->is_file_upload()) {
require_capability('moodle/course:managefiles', $this->context);
if ($content != null) {
throw new... | php | public function process($displayname = null, $content = null) {
require_capability('moodle/course:manageactivities', $this->context);
if ($this->is_file_upload()) {
require_capability('moodle/course:managefiles', $this->context);
if ($content != null) {
throw new... | [
"public",
"function",
"process",
"(",
"$",
"displayname",
"=",
"null",
",",
"$",
"content",
"=",
"null",
")",
"{",
"require_capability",
"(",
"'moodle/course:manageactivities'",
",",
"$",
"this",
"->",
"context",
")",
";",
"if",
"(",
"$",
"this",
"->",
"is... | Process the upload - creating the module in the course and returning the result to the browser
@param string $displayname optional the name (from the browser) to give the course module instance
@param string $content optional the content of the upload (for non-file uploads) | [
"Process",
"the",
"upload",
"-",
"creating",
"the",
"module",
"in",
"the",
"course",
"and",
"returning",
"the",
"result",
"to",
"the",
"browser"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/dnduploadlib.php#L457-L480 |
217,974 | moodle/moodle | course/dnduploadlib.php | dndupload_ajax_processor.handle_file_upload | protected function handle_file_upload() {
global $CFG;
// Add the file to a draft file area.
$draftitemid = file_get_unused_draft_itemid();
$maxbytes = get_user_max_upload_file_size($this->context, $CFG->maxbytes, $this->course->maxbytes);
$types = $this->dnduploadhandler->get_h... | php | protected function handle_file_upload() {
global $CFG;
// Add the file to a draft file area.
$draftitemid = file_get_unused_draft_itemid();
$maxbytes = get_user_max_upload_file_size($this->context, $CFG->maxbytes, $this->course->maxbytes);
$types = $this->dnduploadhandler->get_h... | [
"protected",
"function",
"handle_file_upload",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"// Add the file to a draft file area.",
"$",
"draftitemid",
"=",
"file_get_unused_draft_itemid",
"(",
")",
";",
"$",
"maxbytes",
"=",
"get_user_max_upload_file_size",
"(",
"$",
"... | Handle uploads containing files - create the course module, ask the upload repository
to process the file, ask the mod to set itself up, then return the result to the browser | [
"Handle",
"uploads",
"containing",
"files",
"-",
"create",
"the",
"course",
"module",
"ask",
"the",
"upload",
"repository",
"to",
"process",
"the",
"file",
"ask",
"the",
"mod",
"to",
"set",
"itself",
"up",
"then",
"return",
"the",
"result",
"to",
"the",
"b... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/dnduploadlib.php#L486-L515 |
217,975 | moodle/moodle | course/dnduploadlib.php | dndupload_ajax_processor.handle_other_upload | protected function handle_other_upload($content) {
// Check this plugin is registered to handle this type of upload
if (!$this->dnduploadhandler->has_type_handler($this->module->name, $this->type)) {
$info = (object)array('modname' => $this->module->name, 'type' => $this->type);
... | php | protected function handle_other_upload($content) {
// Check this plugin is registered to handle this type of upload
if (!$this->dnduploadhandler->has_type_handler($this->module->name, $this->type)) {
$info = (object)array('modname' => $this->module->name, 'type' => $this->type);
... | [
"protected",
"function",
"handle_other_upload",
"(",
"$",
"content",
")",
"{",
"// Check this plugin is registered to handle this type of upload",
"if",
"(",
"!",
"$",
"this",
"->",
"dnduploadhandler",
"->",
"has_type_handler",
"(",
"$",
"this",
"->",
"module",
"->",
... | Handle uploads not containing file - create the course module, ask the mod to
set itself up, then return the result to the browser
@param string $content the content uploaded to the browser | [
"Handle",
"uploads",
"not",
"containing",
"file",
"-",
"create",
"the",
"course",
"module",
"ask",
"the",
"mod",
"to",
"set",
"itself",
"up",
"then",
"return",
"the",
"result",
"to",
"the",
"browser"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/dnduploadlib.php#L523-L542 |
217,976 | moodle/moodle | course/dnduploadlib.php | dndupload_ajax_processor.display_name_from_file | protected function display_name_from_file($filename) {
$pos = core_text::strrpos($filename, '.');
if ($pos) { // Want to skip if $pos === 0 OR $pos === false.
$filename = core_text::substr($filename, 0, $pos);
}
return str_replace('_', ' ', $filename);
} | php | protected function display_name_from_file($filename) {
$pos = core_text::strrpos($filename, '.');
if ($pos) { // Want to skip if $pos === 0 OR $pos === false.
$filename = core_text::substr($filename, 0, $pos);
}
return str_replace('_', ' ', $filename);
} | [
"protected",
"function",
"display_name_from_file",
"(",
"$",
"filename",
")",
"{",
"$",
"pos",
"=",
"core_text",
"::",
"strrpos",
"(",
"$",
"filename",
",",
"'.'",
")",
";",
"if",
"(",
"$",
"pos",
")",
"{",
"// Want to skip if $pos === 0 OR $pos === false.",
"... | Generate the name of the mod instance from the name of the file
(remove the extension and convert underscore => space
@param string $filename the filename of the uploaded file
@return string the display name to use | [
"Generate",
"the",
"name",
"of",
"the",
"mod",
"instance",
"from",
"the",
"name",
"of",
"the",
"file",
"(",
"remove",
"the",
"extension",
"and",
"convert",
"underscore",
"=",
">",
"space"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/dnduploadlib.php#L551-L557 |
217,977 | moodle/moodle | course/dnduploadlib.php | dndupload_ajax_processor.prepare_module_data | protected function prepare_module_data($draftitemid = null, $content = null) {
$data = new stdClass();
$data->type = $this->type;
$data->course = $this->course;
if ($draftitemid) {
$data->draftitemid = $draftitemid;
} else if ($content) {
$data->content = ... | php | protected function prepare_module_data($draftitemid = null, $content = null) {
$data = new stdClass();
$data->type = $this->type;
$data->course = $this->course;
if ($draftitemid) {
$data->draftitemid = $draftitemid;
} else if ($content) {
$data->content = ... | [
"protected",
"function",
"prepare_module_data",
"(",
"$",
"draftitemid",
"=",
"null",
",",
"$",
"content",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"data",
"->",
"type",
"=",
"$",
"this",
"->",
"type",
";",
"$",... | Gather together all the details to pass on to the mod, so that it can initialise it's
own database tables
@param int $draftitemid optional the id of the draft area containing the file (for file uploads)
@param string $content optional the content dropped onto the course (for non-file uploads)
@return object data to pa... | [
"Gather",
"together",
"all",
"the",
"details",
"to",
"pass",
"on",
"to",
"the",
"mod",
"so",
"that",
"it",
"can",
"initialise",
"it",
"s",
"own",
"database",
"tables"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/dnduploadlib.php#L584-L596 |
217,978 | moodle/moodle | course/dnduploadlib.php | dndupload_ajax_processor.send_response | protected function send_response($mod) {
global $OUTPUT, $PAGE;
$resp = new stdClass();
$resp->error = self::ERROR_OK;
$resp->elementid = 'module-' . $mod->id;
$courserenderer = $PAGE->get_renderer('core', 'course');
$completioninfo = new completion_info($this->course);... | php | protected function send_response($mod) {
global $OUTPUT, $PAGE;
$resp = new stdClass();
$resp->error = self::ERROR_OK;
$resp->elementid = 'module-' . $mod->id;
$courserenderer = $PAGE->get_renderer('core', 'course');
$completioninfo = new completion_info($this->course);... | [
"protected",
"function",
"send_response",
"(",
"$",
"mod",
")",
"{",
"global",
"$",
"OUTPUT",
",",
"$",
"PAGE",
";",
"$",
"resp",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"resp",
"->",
"error",
"=",
"self",
"::",
"ERROR_OK",
";",
"$",
"resp",
"-... | Send the details of the newly created activity back to the client browser
@param cm_info $mod details of the mod just created | [
"Send",
"the",
"details",
"of",
"the",
"newly",
"created",
"activity",
"back",
"to",
"the",
"client",
"browser"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/dnduploadlib.php#L648-L666 |
217,979 | moodle/moodle | grade/report/singleview/classes/local/ui/bulk_insert.php | bulk_insert.html | public function html() {
global $OUTPUT;
$text = new text_attribute($this->insertname, "0", 'bulk');
$context = (object) [
'label' => get_string('bulklegend', 'gradereport_singleview'),
'applylabel' => get_string('bulkperform', 'gradereport_singleview'),
'app... | php | public function html() {
global $OUTPUT;
$text = new text_attribute($this->insertname, "0", 'bulk');
$context = (object) [
'label' => get_string('bulklegend', 'gradereport_singleview'),
'applylabel' => get_string('bulkperform', 'gradereport_singleview'),
'app... | [
"public",
"function",
"html",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"text",
"=",
"new",
"text_attribute",
"(",
"$",
"this",
"->",
"insertname",
",",
"\"0\"",
",",
"'bulk'",
")",
";",
"$",
"context",
"=",
"(",
"object",
")",
"[",
"'label'"... | Generate the html for this form element.
@return string HTML | [
"Generate",
"the",
"html",
"for",
"this",
"form",
"element",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/ui/bulk_insert.php#L87-L107 |
217,980 | moodle/moodle | lib/environmentlib.php | environment_results.getPluginName | function getPluginName() {
if ($this->plugin) {
$manager = core_plugin_manager::instance();
list($plugintype, $pluginname) = core_component::normalize_component($this->plugin);
return $manager->plugintype_name($plugintype) . ' / ' . $manager->plugin_name($this->plugin);
... | php | function getPluginName() {
if ($this->plugin) {
$manager = core_plugin_manager::instance();
list($plugintype, $pluginname) = core_component::normalize_component($this->plugin);
return $manager->plugintype_name($plugintype) . ' / ' . $manager->plugin_name($this->plugin);
... | [
"function",
"getPluginName",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"plugin",
")",
"{",
"$",
"manager",
"=",
"core_plugin_manager",
"::",
"instance",
"(",
")",
";",
"list",
"(",
"$",
"plugintype",
",",
"$",
"pluginname",
")",
"=",
"core_component",... | Get plugin name.
@return string plugin name | [
"Get",
"plugin",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/environmentlib.php#L1513-L1521 |
217,981 | moodle/moodle | mod/forum/classes/local/renderers/discussion_list.php | discussion_list.render | public function render(stdClass $user, \cm_info $cm, ?int $groupid, ?int $sortorder, ?int $pageno, ?int $pagesize) : string {
global $PAGE;
$forum = $this->forum;
$forumexporter = $this->exporterfactory->get_forum_exporter(
$user,
$this->forum,
$groupid
... | php | public function render(stdClass $user, \cm_info $cm, ?int $groupid, ?int $sortorder, ?int $pageno, ?int $pagesize) : string {
global $PAGE;
$forum = $this->forum;
$forumexporter = $this->exporterfactory->get_forum_exporter(
$user,
$this->forum,
$groupid
... | [
"public",
"function",
"render",
"(",
"stdClass",
"$",
"user",
",",
"\\",
"cm_info",
"$",
"cm",
",",
"?",
"int",
"$",
"groupid",
",",
"?",
"int",
"$",
"sortorder",
",",
"?",
"int",
"$",
"pageno",
",",
"?",
"int",
"$",
"pagesize",
")",
":",
"string",... | Render for the specified user.
@param stdClass $user The user to render for
@param cm_info $cm The course module info for this discussion list
@param int $groupid The group to render
@param int $sortorder The sort order to use when selecting the discussions in the list
@param int ... | [
"Render",
"for",
"the",
"specified",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/renderers/discussion_list.php#L143-L199 |
217,982 | moodle/moodle | mod/forum/classes/local/renderers/discussion_list.php | discussion_list.get_page_size | private function get_page_size(?int $pagesize) : int {
if (null === $pagesize || $pagesize <= 0) {
$pagesize = discussion_list_vault::PAGESIZE_DEFAULT;
}
return $pagesize;
} | php | private function get_page_size(?int $pagesize) : int {
if (null === $pagesize || $pagesize <= 0) {
$pagesize = discussion_list_vault::PAGESIZE_DEFAULT;
}
return $pagesize;
} | [
"private",
"function",
"get_page_size",
"(",
"?",
"int",
"$",
"pagesize",
")",
":",
"int",
"{",
"if",
"(",
"null",
"===",
"$",
"pagesize",
"||",
"$",
"pagesize",
"<=",
"0",
")",
"{",
"$",
"pagesize",
"=",
"discussion_list_vault",
"::",
"PAGESIZE_DEFAULT",
... | Fetch the page size to use when displaying the page.
@param int $pagesize The number of discussions to show on the page
@return int The normalised page size | [
"Fetch",
"the",
"page",
"size",
"to",
"use",
"when",
"displaying",
"the",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/renderers/discussion_list.php#L266-L272 |
217,983 | moodle/moodle | availability/condition/group/classes/frontend.php | frontend.get_all_groups | protected function get_all_groups($courseid) {
global $CFG;
require_once($CFG->libdir . '/grouplib.php');
if ($courseid != $this->allgroupscourseid) {
$this->allgroups = groups_get_all_groups($courseid, 0, 0, 'g.id, g.name');
$this->allgroupscourseid = $courseid;
... | php | protected function get_all_groups($courseid) {
global $CFG;
require_once($CFG->libdir . '/grouplib.php');
if ($courseid != $this->allgroupscourseid) {
$this->allgroups = groups_get_all_groups($courseid, 0, 0, 'g.id, g.name');
$this->allgroupscourseid = $courseid;
... | [
"protected",
"function",
"get_all_groups",
"(",
"$",
"courseid",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/grouplib.php'",
")",
";",
"if",
"(",
"$",
"courseid",
"!=",
"$",
"this",
"->",
"allgroupscourseid... | Gets all groups for the given course.
@param int $courseid Course id
@return array Array of all the group objects | [
"Gets",
"all",
"groups",
"for",
"the",
"given",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/availability/condition/group/classes/frontend.php#L67-L76 |
217,984 | moodle/moodle | analytics/classes/local/analyser/by_course.php | by_course.get_analysables_iterator | public function get_analysables_iterator(?string $action = null) {
global $DB;
list($sql, $params) = $this->get_iterator_sql('course', CONTEXT_COURSE, $action, 'c');
// This will be updated to filter by context as part of MDL-64739.
if (!empty($this->options['filter'])) {
$... | php | public function get_analysables_iterator(?string $action = null) {
global $DB;
list($sql, $params) = $this->get_iterator_sql('course', CONTEXT_COURSE, $action, 'c');
// This will be updated to filter by context as part of MDL-64739.
if (!empty($this->options['filter'])) {
$... | [
"public",
"function",
"get_analysables_iterator",
"(",
"?",
"string",
"$",
"action",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"list",
"(",
"$",
"sql",
",",
"$",
"params",
")",
"=",
"$",
"this",
"->",
"get_iterator_sql",
"(",
"'course'",
",",
"C... | Return the list of courses to analyse.
@param string|null $action 'prediction', 'training' or null if no specific action needed.
@return \Iterator | [
"Return",
"the",
"list",
"of",
"courses",
"to",
"analyse",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/analytics/classes/local/analyser/by_course.php#L44-L79 |
217,985 | moodle/moodle | lib/horde/framework/Horde/Support/Memory.php | Horde_Support_Memory.push | public function push()
{
$start = $this->_start[$this->_idx++] = array(
memory_get_usage(),
memory_get_peak_usage(),
memory_get_usage(true),
memory_get_peak_usage(true)
);
return $start;
} | php | public function push()
{
$start = $this->_start[$this->_idx++] = array(
memory_get_usage(),
memory_get_peak_usage(),
memory_get_usage(true),
memory_get_peak_usage(true)
);
return $start;
} | [
"public",
"function",
"push",
"(",
")",
"{",
"$",
"start",
"=",
"$",
"this",
"->",
"_start",
"[",
"$",
"this",
"->",
"_idx",
"++",
"]",
"=",
"array",
"(",
"memory_get_usage",
"(",
")",
",",
"memory_get_peak_usage",
"(",
")",
",",
"memory_get_usage",
"(... | Push a new tracker on the stack. | [
"Push",
"a",
"new",
"tracker",
"on",
"the",
"stack",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Support/Memory.php#L47-L56 |
217,986 | moodle/moodle | lib/horde/framework/Horde/Support/Memory.php | Horde_Support_Memory.pop | public function pop()
{
if (! ($this->_idx > 0)) {
throw new Exception('No timers have been started');
}
$start = $this->_start[--$this->_idx];
return array(
memory_get_usage() - $start[0],
memory_get_peak_usage() - $start[1],
memory_ge... | php | public function pop()
{
if (! ($this->_idx > 0)) {
throw new Exception('No timers have been started');
}
$start = $this->_start[--$this->_idx];
return array(
memory_get_usage() - $start[0],
memory_get_peak_usage() - $start[1],
memory_ge... | [
"public",
"function",
"pop",
"(",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"_idx",
">",
"0",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'No timers have been started'",
")",
";",
"}",
"$",
"start",
"=",
"$",
"this",
"->",
"_start",
"... | Pop the latest tracker and return the difference with the current
memory situation.
@return array The change in memory allocated via emalloc() in between the
push() and the pop() call. The array holds four values: the
first one indicates the change in current usage of memory
while the second value indicates any change... | [
"Pop",
"the",
"latest",
"tracker",
"and",
"return",
"the",
"difference",
"with",
"the",
"current",
"memory",
"situation",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Support/Memory.php#L70-L82 |
217,987 | moodle/moodle | lib/classes/user.php | core_user.get_user_by_email | public static function get_user_by_email($email, $fields = '*', $mnethostid = null, $strictness = IGNORE_MISSING) {
global $DB, $CFG;
// Because we use the username as the search criteria, we must also restrict our search based on mnet host.
if (empty($mnethostid)) {
// If empty, we... | php | public static function get_user_by_email($email, $fields = '*', $mnethostid = null, $strictness = IGNORE_MISSING) {
global $DB, $CFG;
// Because we use the username as the search criteria, we must also restrict our search based on mnet host.
if (empty($mnethostid)) {
// If empty, we... | [
"public",
"static",
"function",
"get_user_by_email",
"(",
"$",
"email",
",",
"$",
"fields",
"=",
"'*'",
",",
"$",
"mnethostid",
"=",
"null",
",",
"$",
"strictness",
"=",
"IGNORE_MISSING",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"// Because w... | Return user object from db based on their email.
@param string $email The email of the user searched.
@param string $fields A comma separated list of user fields to be returned, support and noreply user.
@param int $mnethostid The id of the remote host.
@param int $strictness IGNORE_MISSING means compatible mode, fals... | [
"Return",
"user",
"object",
"from",
"db",
"based",
"on",
"their",
"email",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/user.php#L146-L156 |
217,988 | moodle/moodle | lib/classes/user.php | core_user.get_user_by_username | public static function get_user_by_username($username, $fields = '*', $mnethostid = null, $strictness = IGNORE_MISSING) {
global $DB, $CFG;
// Because we use the username as the search criteria, we must also restrict our search based on mnet host.
if (empty($mnethostid)) {
// If emp... | php | public static function get_user_by_username($username, $fields = '*', $mnethostid = null, $strictness = IGNORE_MISSING) {
global $DB, $CFG;
// Because we use the username as the search criteria, we must also restrict our search based on mnet host.
if (empty($mnethostid)) {
// If emp... | [
"public",
"static",
"function",
"get_user_by_username",
"(",
"$",
"username",
",",
"$",
"fields",
"=",
"'*'",
",",
"$",
"mnethostid",
"=",
"null",
",",
"$",
"strictness",
"=",
"IGNORE_MISSING",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"// Bec... | Return user object from db based on their username.
@param string $username The username of the user searched.
@param string $fields A comma separated list of user fields to be returned, support and noreply user.
@param int $mnethostid The id of the remote host.
@param int $strictness IGNORE_MISSING means compatible m... | [
"Return",
"user",
"object",
"from",
"db",
"based",
"on",
"their",
"username",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/user.php#L170-L180 |
217,989 | moodle/moodle | lib/classes/user.php | core_user.get_enrolled_sql_on_courses_with_capability | protected static function get_enrolled_sql_on_courses_with_capability($capability) {
// Get all courses where user have the capability.
$courses = get_user_capability_course($capability, null, true,
implode(',', array_values(context_helper::get_preload_record_columns('ctx'))));
i... | php | protected static function get_enrolled_sql_on_courses_with_capability($capability) {
// Get all courses where user have the capability.
$courses = get_user_capability_course($capability, null, true,
implode(',', array_values(context_helper::get_preload_record_columns('ctx'))));
i... | [
"protected",
"static",
"function",
"get_enrolled_sql_on_courses_with_capability",
"(",
"$",
"capability",
")",
"{",
"// Get all courses where user have the capability.",
"$",
"courses",
"=",
"get_user_capability_course",
"(",
"$",
"capability",
",",
"null",
",",
"true",
","... | Gets an SQL query that lists all enrolled user ids on any course where the current
user has the specified capability. Helper function used for searching users.
@param string $capability Required capability
@return array Array containing SQL and params, or two nulls if there are no courses | [
"Gets",
"an",
"SQL",
"query",
"that",
"lists",
"all",
"enrolled",
"user",
"ids",
"on",
"any",
"course",
"where",
"the",
"current",
"user",
"has",
"the",
"specified",
"capability",
".",
"Helper",
"function",
"used",
"for",
"searching",
"users",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/user.php#L382-L409 |
217,990 | moodle/moodle | lib/classes/user.php | core_user.get_dummy_user_record | protected static function get_dummy_user_record() {
global $CFG;
$dummyuser = new stdClass();
$dummyuser->id = self::NOREPLY_USER;
$dummyuser->email = $CFG->noreplyaddress;
$dummyuser->firstname = get_string('noreplyname');
$dummyuser->username = 'noreply';
$dumm... | php | protected static function get_dummy_user_record() {
global $CFG;
$dummyuser = new stdClass();
$dummyuser->id = self::NOREPLY_USER;
$dummyuser->email = $CFG->noreplyaddress;
$dummyuser->firstname = get_string('noreplyname');
$dummyuser->username = 'noreply';
$dumm... | [
"protected",
"static",
"function",
"get_dummy_user_record",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"dummyuser",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"dummyuser",
"->",
"id",
"=",
"self",
"::",
"NOREPLY_USER",
";",
"$",
"dummyuser",
"->",
"... | Helper function to return dummy noreply user record.
@return stdClass | [
"Helper",
"function",
"to",
"return",
"dummy",
"noreply",
"user",
"record",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/user.php#L416-L436 |
217,991 | moodle/moodle | lib/classes/user.php | core_user.is_real_user | public static function is_real_user($userid, $checkdb = false) {
global $DB;
if ($userid <= 0) {
return false;
}
if ($checkdb) {
return $DB->record_exists('user', array('id' => $userid));
} else {
return true;
}
} | php | public static function is_real_user($userid, $checkdb = false) {
global $DB;
if ($userid <= 0) {
return false;
}
if ($checkdb) {
return $DB->record_exists('user', array('id' => $userid));
} else {
return true;
}
} | [
"public",
"static",
"function",
"is_real_user",
"(",
"$",
"userid",
",",
"$",
"checkdb",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"userid",
"<=",
"0",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"checkdb",
")",
... | Return true if user id is greater than 0 and alternatively check db.
@param int $userid user id.
@param bool $checkdb if true userid will be checked in db. By default it's false, and
userid is compared with 0 for performance.
@return bool true is real user else false. | [
"Return",
"true",
"if",
"user",
"id",
"is",
"greater",
"than",
"0",
"and",
"alternatively",
"check",
"db",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/user.php#L534-L545 |
217,992 | moodle/moodle | lib/classes/user.php | core_user.require_active_user | public static function require_active_user($user, $checksuspended = false, $checknologin = false) {
if (!self::is_real_user($user->id)) {
throw new moodle_exception('invaliduser', 'error');
}
if ($user->deleted) {
throw new moodle_exception('userdeleted');
}
... | php | public static function require_active_user($user, $checksuspended = false, $checknologin = false) {
if (!self::is_real_user($user->id)) {
throw new moodle_exception('invaliduser', 'error');
}
if ($user->deleted) {
throw new moodle_exception('userdeleted');
}
... | [
"public",
"static",
"function",
"require_active_user",
"(",
"$",
"user",
",",
"$",
"checksuspended",
"=",
"false",
",",
"$",
"checknologin",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"is_real_user",
"(",
"$",
"user",
"->",
"id",
")",
")",
"... | Check if the given user is an active user in the site.
@param stdClass $user user object
@param boolean $checksuspended whether to check if the user has the account suspended
@param boolean $checknologin whether to check if the user uses the nologin auth method
@throws moodle_exception
@since Moodle 3.0 | [
"Check",
"if",
"the",
"given",
"user",
"is",
"an",
"active",
"user",
"in",
"the",
"site",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/user.php#L556-L581 |
217,993 | moodle/moodle | lib/classes/user.php | core_user.update_picture | public static function update_picture(stdClass $usernew, $filemanageroptions = array()) {
global $CFG, $DB;
require_once("$CFG->libdir/gdlib.php");
$context = context_user::instance($usernew->id, MUST_EXIST);
$user = core_user::get_user($usernew->id, 'id, picture', MUST_EXIST);
... | php | public static function update_picture(stdClass $usernew, $filemanageroptions = array()) {
global $CFG, $DB;
require_once("$CFG->libdir/gdlib.php");
$context = context_user::instance($usernew->id, MUST_EXIST);
$user = core_user::get_user($usernew->id, 'id, picture', MUST_EXIST);
... | [
"public",
"static",
"function",
"update_picture",
"(",
"stdClass",
"$",
"usernew",
",",
"$",
"filemanageroptions",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"require_once",
"(",
"\"$CFG->libdir/gdlib.php\"",
")",
";",
"$",
... | Updates the provided users profile picture based upon the expected fields returned from the edit or edit_advanced forms.
@param stdClass $usernew An object that contains some information about the user being updated
@param array $filemanageroptions
@return bool True if the user was updated, false if it stayed the same... | [
"Updates",
"the",
"provided",
"users",
"profile",
"picture",
"based",
"upon",
"the",
"expected",
"fields",
"returned",
"from",
"the",
"edit",
"or",
"edit_advanced",
"forms",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/user.php#L590-L640 |
217,994 | moodle/moodle | lib/classes/user.php | core_user.get_property_definition | public static function get_property_definition($property) {
self::fill_properties_cache();
if (!array_key_exists($property, self::$propertiescache)) {
throw new coding_exception('Invalid property requested.');
}
return self::$propertiescache[$property];
} | php | public static function get_property_definition($property) {
self::fill_properties_cache();
if (!array_key_exists($property, self::$propertiescache)) {
throw new coding_exception('Invalid property requested.');
}
return self::$propertiescache[$property];
} | [
"public",
"static",
"function",
"get_property_definition",
"(",
"$",
"property",
")",
"{",
"self",
"::",
"fill_properties_cache",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"property",
",",
"self",
"::",
"$",
"propertiescache",
")",
")",
"{... | Get properties of a user field.
@param string $property property name to be retrieved.
@throws coding_exception if the requested property name is invalid.
@return array the property definition. | [
"Get",
"properties",
"of",
"a",
"user",
"field",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/user.php#L744-L753 |
217,995 | moodle/moodle | lib/classes/user.php | core_user.validate | public static function validate($data) {
// Get all user profile fields definition.
self::fill_properties_cache();
foreach ($data as $property => $value) {
try {
if (isset(self::$propertiescache[$property])) {
validate_param($value, self::$propert... | php | public static function validate($data) {
// Get all user profile fields definition.
self::fill_properties_cache();
foreach ($data as $property => $value) {
try {
if (isset(self::$propertiescache[$property])) {
validate_param($value, self::$propert... | [
"public",
"static",
"function",
"validate",
"(",
"$",
"data",
")",
"{",
"// Get all user profile fields definition.",
"self",
"::",
"fill_properties_cache",
"(",
")",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"property",
"=>",
"$",
"value",
")",
"{",
"try",... | Validate user data.
This method just validates each user field and return an array of errors. It doesn't clean the data,
the methods clean() and clean_field() should be used for this purpose.
@param stdClass|array $data user data object or array to be validated.
@return array|true $errors array of errors found on the... | [
"Validate",
"user",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/user.php#L764-L784 |
217,996 | moodle/moodle | lib/classes/user.php | core_user.clean_data | public static function clean_data($user) {
if (empty($user)) {
return $user;
}
foreach ($user as $field => $value) {
// Get the property parameter type and do the cleaning.
try {
$user->$field = core_user::clean_field($value, $field);
... | php | public static function clean_data($user) {
if (empty($user)) {
return $user;
}
foreach ($user as $field => $value) {
// Get the property parameter type and do the cleaning.
try {
$user->$field = core_user::clean_field($value, $field);
... | [
"public",
"static",
"function",
"clean_data",
"(",
"$",
"user",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"user",
")",
")",
"{",
"return",
"$",
"user",
";",
"}",
"foreach",
"(",
"$",
"user",
"as",
"$",
"field",
"=>",
"$",
"value",
")",
"{",
"// Get... | Clean the user data.
@param stdClass|array $user the user data to be validated against properties definition.
@return stdClass $user the cleaned user data. | [
"Clean",
"the",
"user",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/user.php#L802-L817 |
217,997 | moodle/moodle | lib/classes/user.php | core_user.clean_field | public static function clean_field($data, $field) {
if (empty($data) || empty($field)) {
return $data;
}
try {
$type = core_user::get_property_type($field);
if (isset(self::$propertiescache[$field]['choices'])) {
if (!array_key_exists($data, ... | php | public static function clean_field($data, $field) {
if (empty($data) || empty($field)) {
return $data;
}
try {
$type = core_user::get_property_type($field);
if (isset(self::$propertiescache[$field]['choices'])) {
if (!array_key_exists($data, ... | [
"public",
"static",
"function",
"clean_field",
"(",
"$",
"data",
",",
"$",
"field",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
"||",
"empty",
"(",
"$",
"field",
")",
")",
"{",
"return",
"$",
"data",
";",
"}",
"try",
"{",
"$",
"type",
... | Clean a specific user field.
@param string $data the user field data to be cleaned.
@param string $field the user field name on the property definition cache.
@return string the cleaned user data. | [
"Clean",
"a",
"specific",
"user",
"field",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/user.php#L826-L852 |
217,998 | moodle/moodle | lib/classes/user.php | core_user.get_property_type | public static function get_property_type($property) {
self::fill_properties_cache();
if (!array_key_exists($property, self::$propertiescache)) {
throw new coding_exception('Invalid property requested: ' . $property);
}
return self::$propertiescache[$property]['type'];
... | php | public static function get_property_type($property) {
self::fill_properties_cache();
if (!array_key_exists($property, self::$propertiescache)) {
throw new coding_exception('Invalid property requested: ' . $property);
}
return self::$propertiescache[$property]['type'];
... | [
"public",
"static",
"function",
"get_property_type",
"(",
"$",
"property",
")",
"{",
"self",
"::",
"fill_properties_cache",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"property",
",",
"self",
"::",
"$",
"propertiescache",
")",
")",
"{",
"... | Get the parameter type of the property.
@param string $property property name to be retrieved.
@throws coding_exception if the requested property name is invalid.
@return int the property parameter type. | [
"Get",
"the",
"parameter",
"type",
"of",
"the",
"property",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/user.php#L861-L870 |
217,999 | moodle/moodle | lib/classes/user.php | core_user.get_property_null | public static function get_property_null($property) {
self::fill_properties_cache();
if (!array_key_exists($property, self::$propertiescache)) {
throw new coding_exception('Invalid property requested: ' . $property);
}
return self::$propertiescache[$property]['null'];
... | php | public static function get_property_null($property) {
self::fill_properties_cache();
if (!array_key_exists($property, self::$propertiescache)) {
throw new coding_exception('Invalid property requested: ' . $property);
}
return self::$propertiescache[$property]['null'];
... | [
"public",
"static",
"function",
"get_property_null",
"(",
"$",
"property",
")",
"{",
"self",
"::",
"fill_properties_cache",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"property",
",",
"self",
"::",
"$",
"propertiescache",
")",
")",
"{",
"... | Discover if the property is NULL_ALLOWED or NULL_NOT_ALLOWED.
@param string $property property name to be retrieved.
@throws coding_exception if the requested property name is invalid.
@return bool true if the property is NULL_ALLOWED, false otherwise. | [
"Discover",
"if",
"the",
"property",
"is",
"NULL_ALLOWED",
"or",
"NULL_NOT_ALLOWED",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/user.php#L879-L888 |
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.