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,000 | moodle/moodle | lib/jabber/XMPP/XMLStream.php | XMPPHP_XMLStream.processTime | public function processTime($timeout=NULL) {
if (is_null($timeout)) {
return $this->__process(NULL);
} else {
return $this->__process($timeout * 1000000);
}
} | php | public function processTime($timeout=NULL) {
if (is_null($timeout)) {
return $this->__process(NULL);
} else {
return $this->__process($timeout * 1000000);
}
} | [
"public",
"function",
"processTime",
"(",
"$",
"timeout",
"=",
"NULL",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"timeout",
")",
")",
"{",
"return",
"$",
"this",
"->",
"__process",
"(",
"NULL",
")",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->... | Process until a timeout occurs
@param integer $timeout
@return string | [
"Process",
"until",
"a",
"timeout",
"occurs"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/jabber/XMPP/XMLStream.php#L446-L452 |
217,001 | moodle/moodle | lib/jabber/XMPP/XMLStream.php | XMPPHP_XMLStream.processUntil | public function processUntil($event, $timeout=-1) {
$start = time();
if(!is_array($event)) $event = array($event);
$this->until[] = $event;
end($this->until);
$event_key = key($this->until);
reset($this->until);
$this->until_count[$event_key] = 0;
$updated = '';
while(!$this->disconnected and $this->u... | php | public function processUntil($event, $timeout=-1) {
$start = time();
if(!is_array($event)) $event = array($event);
$this->until[] = $event;
end($this->until);
$event_key = key($this->until);
reset($this->until);
$this->until_count[$event_key] = 0;
$updated = '';
while(!$this->disconnected and $this->u... | [
"public",
"function",
"processUntil",
"(",
"$",
"event",
",",
"$",
"timeout",
"=",
"-",
"1",
")",
"{",
"$",
"start",
"=",
"time",
"(",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"event",
")",
")",
"$",
"event",
"=",
"array",
"(",
"$",
"eve... | Process until a specified event or a timeout occurs
@param string|array $event
@param integer $timeout
@return string | [
"Process",
"until",
"a",
"specified",
"event",
"or",
"a",
"timeout",
"occurs"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/jabber/XMPP/XMLStream.php#L461-L482 |
217,002 | moodle/moodle | lib/jabber/XMPP/XMLStream.php | XMPPHP_XMLStream.setupParser | public function setupParser() {
$this->parser = xml_parser_create('UTF-8');
xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, 1);
xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
xml_set_object($this->parser, $this);
xml_set_element_handler($this->parser, 'startXML', 'endXM... | php | public function setupParser() {
$this->parser = xml_parser_create('UTF-8');
xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, 1);
xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
xml_set_object($this->parser, $this);
xml_set_element_handler($this->parser, 'startXML', 'endXM... | [
"public",
"function",
"setupParser",
"(",
")",
"{",
"$",
"this",
"->",
"parser",
"=",
"xml_parser_create",
"(",
"'UTF-8'",
")",
";",
"xml_parser_set_option",
"(",
"$",
"this",
"->",
"parser",
",",
"XML_OPTION_SKIP_WHITE",
",",
"1",
")",
";",
"xml_parser_set_op... | Setup the XML parser | [
"Setup",
"the",
"XML",
"parser"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/jabber/XMPP/XMLStream.php#L747-L754 |
217,003 | moodle/moodle | message/output/airnotifier/classes/manager.php | message_airnotifier_manager.include_device_ajax | public function include_device_ajax() {
global $PAGE, $CFG;
$config = new stdClass();
$config->resturl = '/message/output/airnotifier/rest.php';
$config->pageparams = array();
// Include toolboxes.
$PAGE->requires->yui_module('moodle-message_airnotifier-toolboxes', 'M.m... | php | public function include_device_ajax() {
global $PAGE, $CFG;
$config = new stdClass();
$config->resturl = '/message/output/airnotifier/rest.php';
$config->pageparams = array();
// Include toolboxes.
$PAGE->requires->yui_module('moodle-message_airnotifier-toolboxes', 'M.m... | [
"public",
"function",
"include_device_ajax",
"(",
")",
"{",
"global",
"$",
"PAGE",
",",
"$",
"CFG",
";",
"$",
"config",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"config",
"->",
"resturl",
"=",
"'/message/output/airnotifier/rest.php'",
";",
"$",
"config",
... | Include the relevant javascript and language strings for the device
toolbox YUI module
@return bool | [
"Include",
"the",
"relevant",
"javascript",
"and",
"language",
"strings",
"for",
"the",
"device",
"toolbox",
"YUI",
"module"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/output/airnotifier/classes/manager.php#L43-L62 |
217,004 | moodle/moodle | message/output/airnotifier/classes/manager.php | message_airnotifier_manager.get_user_devices | public function get_user_devices($appname, $userid = null) {
global $USER, $DB;
if (empty($userid)) {
$userid = $USER->id;
}
$devices = array();
$params = array('appid' => $appname, 'userid' => $userid);
// First, we look all the devices registered for thi... | php | public function get_user_devices($appname, $userid = null) {
global $USER, $DB;
if (empty($userid)) {
$userid = $USER->id;
}
$devices = array();
$params = array('appid' => $appname, 'userid' => $userid);
// First, we look all the devices registered for thi... | [
"public",
"function",
"get_user_devices",
"(",
"$",
"appname",
",",
"$",
"userid",
"=",
"null",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"userid",
")",
")",
"{",
"$",
"userid",
"=",
"$",
"USER",
"->",
"i... | Return the user devices for a specific app.
@param string $appname the app name .
@param int $userid if empty take the current user.
@return array all the devices | [
"Return",
"the",
"user",
"devices",
"for",
"a",
"specific",
"app",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/output/airnotifier/classes/manager.php#L71-L108 |
217,005 | moodle/moodle | message/output/airnotifier/classes/manager.php | message_airnotifier_manager.request_accesskey | public function request_accesskey() {
global $CFG, $USER;
require_once($CFG->libdir . '/filelib.php');
// Sending the request access key request to Airnotifier.
$serverurl = $CFG->airnotifierurl . ':' . $CFG->airnotifierport . '/accesskeys/';
// We use an APP Key "none", it can... | php | public function request_accesskey() {
global $CFG, $USER;
require_once($CFG->libdir . '/filelib.php');
// Sending the request access key request to Airnotifier.
$serverurl = $CFG->airnotifierurl . ':' . $CFG->airnotifierport . '/accesskeys/';
// We use an APP Key "none", it can... | [
"public",
"function",
"request_accesskey",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"USER",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/filelib.php'",
")",
";",
"// Sending the request access key request to Airnotifier.",
"$",
"serverurl",
... | Request and access key to Airnotifier
@return mixed The access key or false in case of error | [
"Request",
"and",
"access",
"key",
"to",
"Airnotifier"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/output/airnotifier/classes/manager.php#L115-L144 |
217,006 | moodle/moodle | message/output/airnotifier/classes/manager.php | message_airnotifier_manager.create_token | private function create_token($token) {
global $CFG;
if (!$this->is_system_configured()) {
return false;
}
require_once($CFG->libdir . '/filelib.php');
$serverurl = $CFG->airnotifierurl . ':' . $CFG->airnotifierport . '/tokens/' . $token;
$header = array('A... | php | private function create_token($token) {
global $CFG;
if (!$this->is_system_configured()) {
return false;
}
require_once($CFG->libdir . '/filelib.php');
$serverurl = $CFG->airnotifierurl . ':' . $CFG->airnotifierport . '/tokens/' . $token;
$header = array('A... | [
"private",
"function",
"create_token",
"(",
"$",
"token",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"is_system_configured",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
... | Create a device token in the Airnotifier instance
@param string $token The token to be created
@return bool True if all was right | [
"Create",
"a",
"device",
"token",
"in",
"the",
"Airnotifier",
"instance"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/output/airnotifier/classes/manager.php#L151-L175 |
217,007 | moodle/moodle | backup/util/ui/backup_moodleform.class.php | backup_confirmation_form.definition_after_data | public function definition_after_data() {
parent::definition_after_data();
$this->_form->addRule('setting_root_filename', get_string('errorfilenamerequired', 'backup'), 'required');
$this->_form->setType('setting_root_filename', PARAM_FILE);
} | php | public function definition_after_data() {
parent::definition_after_data();
$this->_form->addRule('setting_root_filename', get_string('errorfilenamerequired', 'backup'), 'required');
$this->_form->setType('setting_root_filename', PARAM_FILE);
} | [
"public",
"function",
"definition_after_data",
"(",
")",
"{",
"parent",
"::",
"definition_after_data",
"(",
")",
";",
"$",
"this",
"->",
"_form",
"->",
"addRule",
"(",
"'setting_root_filename'",
",",
"get_string",
"(",
"'errorfilenamerequired'",
",",
"'backup'",
"... | Adds the last elements, rules, settings etc to the form after data has been set.
We override this to add a rule and type to the filename setting.
@throws coding_exception | [
"Adds",
"the",
"last",
"elements",
"rules",
"settings",
"etc",
"to",
"the",
"form",
"after",
"data",
"has",
"been",
"set",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/backup_moodleform.class.php#L103-L107 |
217,008 | moodle/moodle | backup/util/ui/backup_moodleform.class.php | backup_confirmation_form.validation | public function validation($data, $files) {
$errors = parent::validation($data, $files);
if (!array_key_exists('setting_root_filename', $errors)) {
if (trim($data['setting_root_filename']) == '') {
$errors['setting_root_filename'] = get_string('errorfilenamerequired', 'backu... | php | public function validation($data, $files) {
$errors = parent::validation($data, $files);
if (!array_key_exists('setting_root_filename', $errors)) {
if (trim($data['setting_root_filename']) == '') {
$errors['setting_root_filename'] = get_string('errorfilenamerequired', 'backu... | [
"public",
"function",
"validation",
"(",
"$",
"data",
",",
"$",
"files",
")",
"{",
"$",
"errors",
"=",
"parent",
"::",
"validation",
"(",
"$",
"data",
",",
"$",
"files",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"'setting_root_filename'",
",",
... | Validates the form.
Relies on the parent::validation for the bulk of the work.
@param array $data
@param array $files
@return array
@throws coding_exception | [
"Validates",
"the",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/backup_moodleform.class.php#L119-L133 |
217,009 | moodle/moodle | question/classes/bank/search/category_condition.php | category_condition.display_options | public function display_options() {
$this->display_category_form($this->contexts, $this->baseurl, $this->cat);
$this->print_category_info($this->category);
} | php | public function display_options() {
$this->display_category_form($this->contexts, $this->baseurl, $this->cat);
$this->print_category_info($this->category);
} | [
"public",
"function",
"display_options",
"(",
")",
"{",
"$",
"this",
"->",
"display_category_form",
"(",
"$",
"this",
"->",
"contexts",
",",
"$",
"this",
"->",
"baseurl",
",",
"$",
"this",
"->",
"cat",
")",
";",
"$",
"this",
"->",
"print_category_info",
... | Called by question_bank_view to display the GUI for selecting a category | [
"Called",
"by",
"question_bank_view",
"to",
"display",
"the",
"GUI",
"for",
"selecting",
"a",
"category"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/search/category_condition.php#L107-L110 |
217,010 | moodle/moodle | question/classes/bank/search/category_condition.php | category_condition.display_options_adv | public function display_options_adv() {
echo \html_writer::start_div();
echo \html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'recurse',
'value' => 0, 'id' => 'recurse_off'));
echo \html_writer::checkbox('recurse', '1', $this->re... | php | public function display_options_adv() {
echo \html_writer::start_div();
echo \html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'recurse',
'value' => 0, 'id' => 'recurse_off'));
echo \html_writer::checkbox('recurse', '1', $this->re... | [
"public",
"function",
"display_options_adv",
"(",
")",
"{",
"echo",
"\\",
"html_writer",
"::",
"start_div",
"(",
")",
";",
"echo",
"\\",
"html_writer",
"::",
"empty_tag",
"(",
"'input'",
",",
"array",
"(",
"'type'",
"=>",
"'hidden'",
",",
"'name'",
"=>",
"... | Displays the recursion checkbox GUI.
question_bank_view places this within the section that is hidden by default | [
"Displays",
"the",
"recursion",
"checkbox",
"GUI",
".",
"question_bank_view",
"places",
"this",
"within",
"the",
"section",
"that",
"is",
"hidden",
"by",
"default"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/search/category_condition.php#L116-L123 |
217,011 | moodle/moodle | question/classes/bank/search/category_condition.php | category_condition.display_category_form | protected function display_category_form($contexts, $pageurl, $current) {
echo \html_writer::start_div('choosecategory');
$catmenu = question_category_options($contexts, true, 0, true);
echo \html_writer::label(get_string('selectacategory', 'question'), 'id_selectacategory');
echo \html_... | php | protected function display_category_form($contexts, $pageurl, $current) {
echo \html_writer::start_div('choosecategory');
$catmenu = question_category_options($contexts, true, 0, true);
echo \html_writer::label(get_string('selectacategory', 'question'), 'id_selectacategory');
echo \html_... | [
"protected",
"function",
"display_category_form",
"(",
"$",
"contexts",
",",
"$",
"pageurl",
",",
"$",
"current",
")",
"{",
"echo",
"\\",
"html_writer",
"::",
"start_div",
"(",
"'choosecategory'",
")",
";",
"$",
"catmenu",
"=",
"question_category_options",
"(",
... | Display the drop down to select the category.
@param array $contexts of contexts that can be accessed from here.
@param \moodle_url $pageurl the URL of this page.
@param string $current 'categoryID,contextID'. | [
"Display",
"the",
"drop",
"down",
"to",
"select",
"the",
"category",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/search/category_condition.php#L132-L139 |
217,012 | moodle/moodle | question/classes/bank/search/category_condition.php | category_condition.get_current_category | protected function get_current_category($categoryandcontext) {
global $DB, $OUTPUT;
list($categoryid, $contextid) = explode(',', $categoryandcontext);
if (!$categoryid) {
$this->print_choose_category_message($categoryandcontext);
return false;
}
if (!$cat... | php | protected function get_current_category($categoryandcontext) {
global $DB, $OUTPUT;
list($categoryid, $contextid) = explode(',', $categoryandcontext);
if (!$categoryid) {
$this->print_choose_category_message($categoryandcontext);
return false;
}
if (!$cat... | [
"protected",
"function",
"get_current_category",
"(",
"$",
"categoryandcontext",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"OUTPUT",
";",
"list",
"(",
"$",
"categoryid",
",",
"$",
"contextid",
")",
"=",
"explode",
"(",
"','",
",",
"$",
"categoryandcontext",
... | Look up the category record based on cateogry ID and context
@param string $categoryandcontext categoryID,contextID as used with question_bank_view->display()
@return \stdClass The category record | [
"Look",
"up",
"the",
"category",
"record",
"based",
"on",
"cateogry",
"ID",
"and",
"context"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/search/category_condition.php#L146-L163 |
217,013 | moodle/moodle | question/classes/bank/search/category_condition.php | category_condition.print_category_info | protected function print_category_info($category) {
$formatoptions = new \stdClass();
$formatoptions->noclean = true;
$formatoptions->overflowdiv = true;
echo \html_writer::start_div('boxaligncenter categoryinfo');
if (isset($this->maxinfolength)) {
echo shorten_text(... | php | protected function print_category_info($category) {
$formatoptions = new \stdClass();
$formatoptions->noclean = true;
$formatoptions->overflowdiv = true;
echo \html_writer::start_div('boxaligncenter categoryinfo');
if (isset($this->maxinfolength)) {
echo shorten_text(... | [
"protected",
"function",
"print_category_info",
"(",
"$",
"category",
")",
"{",
"$",
"formatoptions",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"formatoptions",
"->",
"noclean",
"=",
"true",
";",
"$",
"formatoptions",
"->",
"overflowdiv",
"=",
"true"... | Print the category description
@param stdClass $category the category information form the database. | [
"Print",
"the",
"category",
"description"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/search/category_condition.php#L169-L181 |
217,014 | moodle/moodle | mod/feedback/classes/templates_table.php | mod_feedback_templates_table.display | public function display($templates) {
global $OUTPUT;
if (empty($templates)) {
echo $OUTPUT->box(get_string('no_templates_available_yet', 'feedback'),
'generalbox boxaligncenter');
return;
}
$this->setup();
$strdeletefeedback ... | php | public function display($templates) {
global $OUTPUT;
if (empty($templates)) {
echo $OUTPUT->box(get_string('no_templates_available_yet', 'feedback'),
'generalbox boxaligncenter');
return;
}
$this->setup();
$strdeletefeedback ... | [
"public",
"function",
"display",
"(",
"$",
"templates",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"if",
"(",
"empty",
"(",
"$",
"templates",
")",
")",
"{",
"echo",
"$",
"OUTPUT",
"->",
"box",
"(",
"get_string",
"(",
"'no_templates_available_yet'",
",",
"'f... | Displays the table with the given set of templates
@param array $templates | [
"Displays",
"the",
"table",
"with",
"the",
"given",
"set",
"of",
"templates"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/templates_table.php#L66-L87 |
217,015 | moodle/moodle | lib/classes/minify.php | core_minify.js | public static function js($content) {
try {
$minifier = new MatthiasMullie\Minify\JS($content);
return $minifier->minify();
} catch (Exception $e) {
ob_end_clean();
$error = $e->getMessage();
}
$return = <<<EOD
try {console.log('Error: Mi... | php | public static function js($content) {
try {
$minifier = new MatthiasMullie\Minify\JS($content);
return $minifier->minify();
} catch (Exception $e) {
ob_end_clean();
$error = $e->getMessage();
}
$return = <<<EOD
try {console.log('Error: Mi... | [
"public",
"static",
"function",
"js",
"(",
"$",
"content",
")",
"{",
"try",
"{",
"$",
"minifier",
"=",
"new",
"MatthiasMullie",
"\\",
"Minify",
"\\",
"JS",
"(",
"$",
"content",
")",
";",
"return",
"$",
"minifier",
"->",
"minify",
"(",
")",
";",
"}",
... | Minify JS code.
@param string $content
@return string minified JS code | [
"Minify",
"JS",
"code",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/minify.php#L37-L58 |
217,016 | moodle/moodle | lib/classes/minify.php | core_minify.js_files | public static function js_files(array $files) {
if (empty($files)) {
return '';
}
$compressed = array();
foreach ($files as $file) {
$content = file_get_contents($file);
if ($content === false) {
$compressed[] = "\n\n// Cannot read JS ... | php | public static function js_files(array $files) {
if (empty($files)) {
return '';
}
$compressed = array();
foreach ($files as $file) {
$content = file_get_contents($file);
if ($content === false) {
$compressed[] = "\n\n// Cannot read JS ... | [
"public",
"static",
"function",
"js_files",
"(",
"array",
"$",
"files",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"files",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"compressed",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"files",
"as",
... | Minify JS files.
@param array $files
@return string minified JS code | [
"Minify",
"JS",
"files",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/minify.php#L66-L82 |
217,017 | moodle/moodle | lib/classes/minify.php | core_minify.css | public static function css($content) {
$error = 'unknown';
try {
$minifier = new MatthiasMullie\Minify\CSS($content);
return $minifier->minify();
} catch (Exception $e) {
$error = $e->getMessage();
}
$return = <<<EOD
/* Error: $error */
/* Pr... | php | public static function css($content) {
$error = 'unknown';
try {
$minifier = new MatthiasMullie\Minify\CSS($content);
return $minifier->minify();
} catch (Exception $e) {
$error = $e->getMessage();
}
$return = <<<EOD
/* Error: $error */
/* Pr... | [
"public",
"static",
"function",
"css",
"(",
"$",
"content",
")",
"{",
"$",
"error",
"=",
"'unknown'",
";",
"try",
"{",
"$",
"minifier",
"=",
"new",
"MatthiasMullie",
"\\",
"Minify",
"\\",
"CSS",
"(",
"$",
"content",
")",
";",
"return",
"$",
"minifier",... | Minify CSS code.
@param string $content
@return string minified CSS | [
"Minify",
"CSS",
"code",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/minify.php#L90-L109 |
217,018 | moodle/moodle | lib/classes/minify.php | core_minify.css_files | public static function css_files(array $files) {
if (empty($files)) {
return '';
}
$compressed = array();
foreach ($files as $file) {
$content = file_get_contents($file);
if ($content === false) {
$compressed[] = "\n\n/* Cannot read CS... | php | public static function css_files(array $files) {
if (empty($files)) {
return '';
}
$compressed = array();
foreach ($files as $file) {
$content = file_get_contents($file);
if ($content === false) {
$compressed[] = "\n\n/* Cannot read CS... | [
"public",
"static",
"function",
"css_files",
"(",
"array",
"$",
"files",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"files",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"compressed",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"files",
"as",
... | Minify CSS files.
@param array $files
@return string minified CSS code | [
"Minify",
"CSS",
"files",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/minify.php#L117-L133 |
217,019 | moodle/moodle | user/profile/field/text/field.class.php | profile_field_text.display_data | public function display_data() {
// Default formatting.
$data = parent::display_data();
// Are we creating a link?
if (!empty($this->field->param4) and !empty($data)) {
// Define the target.
if (! empty($this->field->param5)) {
$target = 'target=... | php | public function display_data() {
// Default formatting.
$data = parent::display_data();
// Are we creating a link?
if (!empty($this->field->param4) and !empty($data)) {
// Define the target.
if (! empty($this->field->param5)) {
$target = 'target=... | [
"public",
"function",
"display_data",
"(",
")",
"{",
"// Default formatting.",
"$",
"data",
"=",
"parent",
"::",
"display_data",
"(",
")",
";",
"// Are we creating a link?",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"field",
"->",
"param4",
")",
"and"... | Overwrite the base class to display the data for this field | [
"Overwrite",
"the",
"base",
"class",
"to",
"display",
"the",
"data",
"for",
"this",
"field"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/field/text/field.class.php#L36-L55 |
217,020 | moodle/moodle | user/profile/field/text/field.class.php | profile_field_text.edit_field_add | public function edit_field_add($mform) {
$size = $this->field->param1;
$maxlength = $this->field->param2;
$fieldtype = ($this->field->param3 == 1 ? 'password' : 'text');
// Create the form field.
$mform->addElement($fieldtype, $this->inputname, format_string($this->field->name),... | php | public function edit_field_add($mform) {
$size = $this->field->param1;
$maxlength = $this->field->param2;
$fieldtype = ($this->field->param3 == 1 ? 'password' : 'text');
// Create the form field.
$mform->addElement($fieldtype, $this->inputname, format_string($this->field->name),... | [
"public",
"function",
"edit_field_add",
"(",
"$",
"mform",
")",
"{",
"$",
"size",
"=",
"$",
"this",
"->",
"field",
"->",
"param1",
";",
"$",
"maxlength",
"=",
"$",
"this",
"->",
"field",
"->",
"param2",
";",
"$",
"fieldtype",
"=",
"(",
"$",
"this",
... | Add fields for editing a text profile field.
@param moodleform $mform | [
"Add",
"fields",
"for",
"editing",
"a",
"text",
"profile",
"field",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/field/text/field.class.php#L61-L69 |
217,021 | moodle/moodle | lib/horde/framework/Horde/Variables.php | Horde_Variables.sanitize | public function sanitize()
{
if (!$this->_sanitized) {
foreach (array_keys($this->_vars) as $key) {
$this->$key = $this->filter($key);
}
$this->_sanitized = true;
}
} | php | public function sanitize()
{
if (!$this->_sanitized) {
foreach (array_keys($this->_vars) as $key) {
$this->$key = $this->filter($key);
}
$this->_sanitized = true;
}
} | [
"public",
"function",
"sanitize",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_sanitized",
")",
"{",
"foreach",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"_vars",
")",
"as",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"$",
"key",
"=",
"$",
... | Sanitize the form input. | [
"Sanitize",
"the",
"form",
"input",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Variables.php#L98-L106 |
217,022 | moodle/moodle | lib/horde/framework/Horde/Variables.php | Horde_Variables.get | public function get($varname, $default = null)
{
return $this->_getExists($this->_vars, $varname, $value)
? $value
: $default;
} | php | public function get($varname, $default = null)
{
return $this->_getExists($this->_vars, $varname, $value)
? $value
: $default;
} | [
"public",
"function",
"get",
"(",
"$",
"varname",
",",
"$",
"default",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"_getExists",
"(",
"$",
"this",
"->",
"_vars",
",",
"$",
"varname",
",",
"$",
"value",
")",
"?",
"$",
"value",
":",
"$",
"d... | Returns the value of a given form variable.
@param string $varname The form variable name.
@param string $default The default form variable value.
@return mixed The form variable, or $default if it doesn't exist. | [
"Returns",
"the",
"value",
"of",
"a",
"given",
"form",
"variable",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Variables.php#L150-L155 |
217,023 | moodle/moodle | lib/horde/framework/Horde/Variables.php | Horde_Variables.getExists | public function getExists($varname, &$exists)
{
$exists = $this->_getExists($this->_vars, $varname, $value);
return $value;
} | php | public function getExists($varname, &$exists)
{
$exists = $this->_getExists($this->_vars, $varname, $value);
return $value;
} | [
"public",
"function",
"getExists",
"(",
"$",
"varname",
",",
"&",
"$",
"exists",
")",
"{",
"$",
"exists",
"=",
"$",
"this",
"->",
"_getExists",
"(",
"$",
"this",
"->",
"_vars",
",",
"$",
"varname",
",",
"$",
"value",
")",
";",
"return",
"$",
"value... | Given a variable name, returns the value and sets a variable indicating
whether the value exists in the form data.
@param string $varname The form variable name.
@param boolean &$exists Reference to variable that will indicate
whether $varname existed in form data.
@return mixed The form variable, or null if it d... | [
"Given",
"a",
"variable",
"name",
"returns",
"the",
"value",
"and",
"sets",
"a",
"variable",
"indicating",
"whether",
"the",
"value",
"exists",
"in",
"the",
"form",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Variables.php#L190-L194 |
217,024 | moodle/moodle | lib/horde/framework/Horde/Variables.php | Horde_Variables.filter | public function filter($varname)
{
$val = $this->$varname;
if (is_null($val) || $this->_sanitized) {
return $val;
}
return is_array($val)
? filter_var_array($val, FILTER_SANITIZE_STRING)
: filter_var($val, FILTER_SANITIZE_STRING);
} | php | public function filter($varname)
{
$val = $this->$varname;
if (is_null($val) || $this->_sanitized) {
return $val;
}
return is_array($val)
? filter_var_array($val, FILTER_SANITIZE_STRING)
: filter_var($val, FILTER_SANITIZE_STRING);
} | [
"public",
"function",
"filter",
"(",
"$",
"varname",
")",
"{",
"$",
"val",
"=",
"$",
"this",
"->",
"$",
"varname",
";",
"if",
"(",
"is_null",
"(",
"$",
"val",
")",
"||",
"$",
"this",
"->",
"_sanitized",
")",
"{",
"return",
"$",
"val",
";",
"}",
... | Filters a form value so that it can be used in HTML output.
@param string $varname The form variable name.
@return mixed The filtered variable, or null if it doesn't exist. | [
"Filters",
"a",
"form",
"value",
"so",
"that",
"it",
"can",
"be",
"used",
"in",
"HTML",
"output",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Variables.php#L329-L340 |
217,025 | moodle/moodle | mod/forum/classes/task/cron_task.php | cron_task.execute | public function execute() {
global $CFG, $DB;
$timenow = time();
// Delete any really old posts in the digest queue.
$weekago = $timenow - (7 * 24 * 3600);
$this->log_start("Removing old digest records from 7 days ago.");
$DB->delete_records_select('forum_queue', "timem... | php | public function execute() {
global $CFG, $DB;
$timenow = time();
// Delete any really old posts in the digest queue.
$weekago = $timenow - (7 * 24 * 3600);
$this->log_start("Removing old digest records from 7 days ago.");
$DB->delete_records_select('forum_queue', "timem... | [
"public",
"function",
"execute",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"$",
"timenow",
"=",
"time",
"(",
")",
";",
"// Delete any really old posts in the digest queue.",
"$",
"weekago",
"=",
"$",
"timenow",
"-",
"(",
"7",
"*",
"24",
"... | Execute the scheduled task. | [
"Execute",
"the",
"scheduled",
"task",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/cron_task.php#L94-L120 |
217,026 | moodle/moodle | mod/forum/classes/task/cron_task.php | cron_task.process_post_data | protected function process_post_data($posts) {
$discussionids = [];
$forumids = [];
$courseids = [];
$this->log_start("Processing post information");
$start = microtime(true);
foreach ($posts as $id => $post) {
$discussionids[$post->discussion] = true;
... | php | protected function process_post_data($posts) {
$discussionids = [];
$forumids = [];
$courseids = [];
$this->log_start("Processing post information");
$start = microtime(true);
foreach ($posts as $id => $post) {
$discussionids[$post->discussion] = true;
... | [
"protected",
"function",
"process_post_data",
"(",
"$",
"posts",
")",
"{",
"$",
"discussionids",
"=",
"[",
"]",
";",
"$",
"forumids",
"=",
"[",
"]",
";",
"$",
"courseids",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"log_start",
"(",
"\"Processing post inform... | Process all posts and convert to appropriated hoc tasks.
@param \stdClass[] $posts | [
"Process",
"all",
"posts",
"and",
"convert",
"to",
"appropriated",
"hoc",
"tasks",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/cron_task.php#L127-L179 |
217,027 | moodle/moodle | mod/forum/classes/task/cron_task.php | cron_task.fill_course_cache | protected function fill_course_cache($courseids) {
global $DB;
list($in, $params) = $DB->get_in_or_equal($courseids);
$this->courses = $DB->get_records_select('course', "id $in", $params);
} | php | protected function fill_course_cache($courseids) {
global $DB;
list($in, $params) = $DB->get_in_or_equal($courseids);
$this->courses = $DB->get_records_select('course', "id $in", $params);
} | [
"protected",
"function",
"fill_course_cache",
"(",
"$",
"courseids",
")",
"{",
"global",
"$",
"DB",
";",
"list",
"(",
"$",
"in",
",",
"$",
"params",
")",
"=",
"$",
"DB",
"->",
"get_in_or_equal",
"(",
"$",
"courseids",
")",
";",
"$",
"this",
"->",
"co... | Fill the course cache.
@param int[] $courseids | [
"Fill",
"the",
"course",
"cache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/cron_task.php#L186-L191 |
217,028 | moodle/moodle | mod/forum/classes/task/cron_task.php | cron_task.fill_forum_cache | protected function fill_forum_cache($forumids) {
global $DB;
$requiredfields = [
'id',
'course',
'forcesubscribe',
'type',
];
list($in, $params) = $DB->get_in_or_equal($forumids);
$this->forums = $DB->get_record... | php | protected function fill_forum_cache($forumids) {
global $DB;
$requiredfields = [
'id',
'course',
'forcesubscribe',
'type',
];
list($in, $params) = $DB->get_in_or_equal($forumids);
$this->forums = $DB->get_record... | [
"protected",
"function",
"fill_forum_cache",
"(",
"$",
"forumids",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"requiredfields",
"=",
"[",
"'id'",
",",
"'course'",
",",
"'forcesubscribe'",
",",
"'type'",
",",
"]",
";",
"list",
"(",
"$",
"in",
",",
"$",
"p... | Fill the forum cache.
@param int[] $forumids | [
"Fill",
"the",
"forum",
"cache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/cron_task.php#L198-L213 |
217,029 | moodle/moodle | mod/forum/classes/task/cron_task.php | cron_task.fill_discussion_cache | protected function fill_discussion_cache($discussionids) {
global $DB;
if (empty($discussionids)) {
$this->discussion = [];
} else {
$requiredfields = [
'id',
'groupid',
'firstpost',
'timest... | php | protected function fill_discussion_cache($discussionids) {
global $DB;
if (empty($discussionids)) {
$this->discussion = [];
} else {
$requiredfields = [
'id',
'groupid',
'firstpost',
'timest... | [
"protected",
"function",
"fill_discussion_cache",
"(",
"$",
"discussionids",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"discussionids",
")",
")",
"{",
"$",
"this",
"->",
"discussion",
"=",
"[",
"]",
";",
"}",
"else",
"{",
"$",
... | Fill the discussion cache.
@param int[] $discussionids | [
"Fill",
"the",
"discussion",
"cache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/cron_task.php#L220-L239 |
217,030 | moodle/moodle | mod/forum/classes/task/cron_task.php | cron_task.fill_digest_cache | protected function fill_digest_cache() {
global $DB;
if (empty($this->users)) {
return;
}
// Get the list of forum subscriptions for per-user per-forum maildigest settings.
list($in, $params) = $DB->get_in_or_equal(array_keys($this->users));
$digestspreferenc... | php | protected function fill_digest_cache() {
global $DB;
if (empty($this->users)) {
return;
}
// Get the list of forum subscriptions for per-user per-forum maildigest settings.
list($in, $params) = $DB->get_in_or_equal(array_keys($this->users));
$digestspreferenc... | [
"protected",
"function",
"fill_digest_cache",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"users",
")",
")",
"{",
"return",
";",
"}",
"// Get the list of forum subscriptions for per-user per-forum maildigest settings.",
"list... | Fill the cache of user digest preferences. | [
"Fill",
"the",
"cache",
"of",
"user",
"digest",
"preferences",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/cron_task.php#L244-L261 |
217,031 | moodle/moodle | mod/forum/classes/task/cron_task.php | cron_task.add_data_for_post | protected function add_data_for_post($post) {
if (!isset($this->adhocdata[$post->course])) {
$this->adhocdata[$post->course] = [];
}
if (!isset($this->adhocdata[$post->course][$post->forum])) {
$this->adhocdata[$post->course][$post->forum] = [];
}
if (!i... | php | protected function add_data_for_post($post) {
if (!isset($this->adhocdata[$post->course])) {
$this->adhocdata[$post->course] = [];
}
if (!isset($this->adhocdata[$post->course][$post->forum])) {
$this->adhocdata[$post->course][$post->forum] = [];
}
if (!i... | [
"protected",
"function",
"add_data_for_post",
"(",
"$",
"post",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"adhocdata",
"[",
"$",
"post",
"->",
"course",
"]",
")",
")",
"{",
"$",
"this",
"->",
"adhocdata",
"[",
"$",
"post",
"->",
"c... | Add dsta for the current forum post to the structure of adhoc data.
@param \stdClass $post | [
"Add",
"dsta",
"for",
"the",
"current",
"forum",
"post",
"to",
"the",
"structure",
"of",
"adhoc",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/cron_task.php#L268-L282 |
217,032 | moodle/moodle | mod/forum/classes/task/cron_task.php | cron_task.fill_user_subscription_cache | protected function fill_user_subscription_cache() {
foreach ($this->forums as $forum) {
$cm = get_fast_modinfo($this->courses[$forum->course])->instances['forum'][$forum->id];
$modcontext = \context_module::instance($cm->id);
$this->subscribedusers[$forum->id] = [];
... | php | protected function fill_user_subscription_cache() {
foreach ($this->forums as $forum) {
$cm = get_fast_modinfo($this->courses[$forum->course])->instances['forum'][$forum->id];
$modcontext = \context_module::instance($cm->id);
$this->subscribedusers[$forum->id] = [];
... | [
"protected",
"function",
"fill_user_subscription_cache",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"forums",
"as",
"$",
"forum",
")",
"{",
"$",
"cm",
"=",
"get_fast_modinfo",
"(",
"$",
"this",
"->",
"courses",
"[",
"$",
"forum",
"->",
"course",
"... | Fill the cache of user subscriptions. | [
"Fill",
"the",
"cache",
"of",
"user",
"subscriptions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/cron_task.php#L287-L306 |
217,033 | moodle/moodle | mod/forum/classes/task/cron_task.php | cron_task.queue_user_tasks | protected function queue_user_tasks() {
global $CFG, $DB;
$timenow = time();
$sitetimezone = \core_date::get_server_timezone();
$counts = [
'digests' => 0,
'individuals' => 0,
'users' => 0,
'ignored' => 0,
'messages' => 0,
... | php | protected function queue_user_tasks() {
global $CFG, $DB;
$timenow = time();
$sitetimezone = \core_date::get_server_timezone();
$counts = [
'digests' => 0,
'individuals' => 0,
'users' => 0,
'ignored' => 0,
'messages' => 0,
... | [
"protected",
"function",
"queue_user_tasks",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"$",
"timenow",
"=",
"time",
"(",
")",
";",
"$",
"sitetimezone",
"=",
"\\",
"core_date",
"::",
"get_server_timezone",
"(",
")",
";",
"$",
"counts",
"... | Queue the user tasks. | [
"Queue",
"the",
"user",
"tasks",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/cron_task.php#L311-L386 |
217,034 | moodle/moodle | mod/forum/classes/task/cron_task.php | cron_task.get_unmailed_posts | protected function get_unmailed_posts($starttime, $endtime, $now = null) {
global $CFG, $DB;
$params = array();
$params['mailed'] = FORUM_MAILED_PENDING;
$params['ptimestart'] = $starttime;
$params['ptimeend'] = $endtime;
$params['mailnow'] = 1;
if (!empty($CFG-... | php | protected function get_unmailed_posts($starttime, $endtime, $now = null) {
global $CFG, $DB;
$params = array();
$params['mailed'] = FORUM_MAILED_PENDING;
$params['ptimestart'] = $starttime;
$params['ptimeend'] = $endtime;
$params['mailnow'] = 1;
if (!empty($CFG-... | [
"protected",
"function",
"get_unmailed_posts",
"(",
"$",
"starttime",
",",
"$",
"endtime",
",",
"$",
"now",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"$",
"params",
"=",
"array",
"(",
")",
";",
"$",
"params",
"[",
"'mailed'",
... | Returns a list of all new posts that have not been mailed yet
@param int $starttime posts created after this time
@param int $endtime posts created before this
@param int $now used for timed discussions only
@return array | [
"Returns",
"a",
"list",
"of",
"all",
"new",
"posts",
"that",
"have",
"not",
"been",
"mailed",
"yet"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/cron_task.php#L497-L537 |
217,035 | moodle/moodle | mod/data/backup/moodle2/restore_data_stepslib.php | restore_data_activity_structure_step.process_data_record_tag | protected function process_data_record_tag($data) {
$data = (object)$data;
if (!core_tag_tag::is_enabled('mod_data', 'data_records')) { // Tags disabled in server, nothing to process.
return;
}
if (!$itemid = $this->get_mappingid('data_record', $data->itemid)) {
... | php | protected function process_data_record_tag($data) {
$data = (object)$data;
if (!core_tag_tag::is_enabled('mod_data', 'data_records')) { // Tags disabled in server, nothing to process.
return;
}
if (!$itemid = $this->get_mappingid('data_record', $data->itemid)) {
... | [
"protected",
"function",
"process_data_record_tag",
"(",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"(",
"object",
")",
"$",
"data",
";",
"if",
"(",
"!",
"core_tag_tag",
"::",
"is_enabled",
"(",
"'mod_data'",
",",
"'data_records'",
")",
")",
"{",
"// Tags di... | Add tags to restored records.
@param stdClass $data Tag | [
"Add",
"tags",
"to",
"restored",
"records",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/backup/moodle2/restore_data_stepslib.php#L130-L145 |
217,036 | moodle/moodle | lib/dml/moodle_temptables.php | moodle_temptables.dispose | public function dispose() {
// We shouldn't have any temp table registered at the end of the script.
// So we error_log that and, at the same time, drop all the pending temptables
if ($temptables = $this->get_temptables()) {
error_log('Potential coding error - existing temptables fou... | php | public function dispose() {
// We shouldn't have any temp table registered at the end of the script.
// So we error_log that and, at the same time, drop all the pending temptables
if ($temptables = $this->get_temptables()) {
error_log('Potential coding error - existing temptables fou... | [
"public",
"function",
"dispose",
"(",
")",
"{",
"// We shouldn't have any temp table registered at the end of the script.",
"// So we error_log that and, at the same time, drop all the pending temptables",
"if",
"(",
"$",
"temptables",
"=",
"$",
"this",
"->",
"get_temptables",
"(",... | Dispose the temptables stuff, checking for wrong situations, informing and recovering from them | [
"Dispose",
"the",
"temptables",
"stuff",
"checking",
"for",
"wrong",
"situations",
"informing",
"and",
"recovering",
"from",
"them"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_temptables.php#L134-L144 |
217,037 | moodle/moodle | lib/classes/analytics/analyser/users.php | users.get_analysables_iterator | public function get_analysables_iterator(?string $action = null) {
global $DB, $CFG;
$siteadmins = explode(',', $CFG->siteadmins);
list($sql, $params) = $this->get_iterator_sql('user', CONTEXT_USER, $action, 'u');
$sql .= " AND u.deleted = :deleted AND u.confirmed = :confirmed AND u.s... | php | public function get_analysables_iterator(?string $action = null) {
global $DB, $CFG;
$siteadmins = explode(',', $CFG->siteadmins);
list($sql, $params) = $this->get_iterator_sql('user', CONTEXT_USER, $action, 'u');
$sql .= " AND u.deleted = :deleted AND u.confirmed = :confirmed AND u.s... | [
"public",
"function",
"get_analysables_iterator",
"(",
"?",
"string",
"$",
"action",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"$",
"siteadmins",
"=",
"explode",
"(",
"','",
",",
"$",
"CFG",
"->",
"siteadmins",
")",
";",
"list",... | The site users are the analysable elements returned by this analyser.
@param string|null $action 'prediction', 'training' or null if no specific action needed.
@return \Iterator | [
"The",
"site",
"users",
"are",
"the",
"analysable",
"elements",
"returned",
"by",
"this",
"analyser",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/analytics/analyser/users.php#L44-L71 |
217,038 | moodle/moodle | lib/classes/analytics/analyser/users.php | users.get_all_samples | public function get_all_samples(\core_analytics\analysable $user) {
$context = \context_user::instance($user->get_id());
// Just 1 sample per analysable.
return [
[$user->get_id() => $user->get_id()],
[$user->get_id() => ['user' => $user->get_user_data(), 'context' => $... | php | public function get_all_samples(\core_analytics\analysable $user) {
$context = \context_user::instance($user->get_id());
// Just 1 sample per analysable.
return [
[$user->get_id() => $user->get_id()],
[$user->get_id() => ['user' => $user->get_user_data(), 'context' => $... | [
"public",
"function",
"get_all_samples",
"(",
"\\",
"core_analytics",
"\\",
"analysable",
"$",
"user",
")",
"{",
"$",
"context",
"=",
"\\",
"context_user",
"::",
"instance",
"(",
"$",
"user",
"->",
"get_id",
"(",
")",
")",
";",
"// Just 1 sample per analysable... | This will return just one user as we analyse users separately.
@param \core_analytics\analysable $user
@return array | [
"This",
"will",
"return",
"just",
"one",
"user",
"as",
"we",
"analyse",
"users",
"separately",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/analytics/analyser/users.php#L126-L135 |
217,039 | moodle/moodle | lib/classes/analytics/analyser/users.php | users.get_samples | public function get_samples($sampleids) {
global $DB;
list($sql, $params) = $DB->get_in_or_equal($sampleids, SQL_PARAMS_NAMED);
$users = $DB->get_records_select('user', "id $sql", $params);
$userids = array_keys($users);
$sampleids = array_combine($userids, $userids);
... | php | public function get_samples($sampleids) {
global $DB;
list($sql, $params) = $DB->get_in_or_equal($sampleids, SQL_PARAMS_NAMED);
$users = $DB->get_records_select('user', "id $sql", $params);
$userids = array_keys($users);
$sampleids = array_combine($userids, $userids);
... | [
"public",
"function",
"get_samples",
"(",
"$",
"sampleids",
")",
"{",
"global",
"$",
"DB",
";",
"list",
"(",
"$",
"sql",
",",
"$",
"params",
")",
"=",
"$",
"DB",
"->",
"get_in_or_equal",
"(",
"$",
"sampleids",
",",
"SQL_PARAMS_NAMED",
")",
";",
"$",
... | Returns samples data from sample ids.
@param int[] $sampleids
@return array | [
"Returns",
"samples",
"data",
"from",
"sample",
"ids",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/analytics/analyser/users.php#L143-L158 |
217,040 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Data/Capability.php | Horde_Imap_Client_Data_Capability.remove | public function remove($capability, $params = null)
{
$capability = Horde_String::upper($capability);
if (is_null($params)) {
unset($this->_data[$capability]);
} elseif (isset($this->_data[$capability])) {
if (!is_array($params)) {
$params = array($pa... | php | public function remove($capability, $params = null)
{
$capability = Horde_String::upper($capability);
if (is_null($params)) {
unset($this->_data[$capability]);
} elseif (isset($this->_data[$capability])) {
if (!is_array($params)) {
$params = array($pa... | [
"public",
"function",
"remove",
"(",
"$",
"capability",
",",
"$",
"params",
"=",
"null",
")",
"{",
"$",
"capability",
"=",
"Horde_String",
"::",
"upper",
"(",
"$",
"capability",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"params",
")",
")",
"{",
"unse... | Remove a capability.
@param string $capability The capability to remove.
@param string $params A parameter (or array of parameters) to
remove from the capability. | [
"Remove",
"a",
"capability",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Data/Capability.php#L79-L101 |
217,041 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Data/Capability.php | Horde_Imap_Client_Data_Capability.query | public function query($capability, $parameter = null)
{
$capability = Horde_String::upper($capability);
if (!isset($this->_data[$capability])) {
return false;
}
return is_null($parameter) ?:
(is_array($this->_data[$capability]) &&
in_array... | php | public function query($capability, $parameter = null)
{
$capability = Horde_String::upper($capability);
if (!isset($this->_data[$capability])) {
return false;
}
return is_null($parameter) ?:
(is_array($this->_data[$capability]) &&
in_array... | [
"public",
"function",
"query",
"(",
"$",
"capability",
",",
"$",
"parameter",
"=",
"null",
")",
"{",
"$",
"capability",
"=",
"Horde_String",
"::",
"upper",
"(",
"$",
"capability",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_data",
"[... | Returns whether the server supports the given capability.
@param string $capability The capability string to query.
@param string $parameter If set, require the parameter to exist.
@return boolean True if the capability (and parameter) exist. | [
"Returns",
"whether",
"the",
"server",
"supports",
"the",
"given",
"capability",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Data/Capability.php#L111-L122 |
217,042 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Data/Capability.php | Horde_Imap_Client_Data_Capability.getParams | public function getParams($capability)
{
return ($this->query($capability) && is_array($out = $this->_data[Horde_String::upper($capability)]))
? $out
: array();
} | php | public function getParams($capability)
{
return ($this->query($capability) && is_array($out = $this->_data[Horde_String::upper($capability)]))
? $out
: array();
} | [
"public",
"function",
"getParams",
"(",
"$",
"capability",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"query",
"(",
"$",
"capability",
")",
"&&",
"is_array",
"(",
"$",
"out",
"=",
"$",
"this",
"->",
"_data",
"[",
"Horde_String",
"::",
"upper",
"(",
... | Return the list of parameters for an extension.
@param string $capability The capability string to query.
@return array An array of parameters if the extension exists and
supports parameters. Otherwise, an empty array. | [
"Return",
"the",
"list",
"of",
"parameters",
"for",
"an",
"extension",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Data/Capability.php#L132-L137 |
217,043 | moodle/moodle | lib/horde/framework/Horde/Stream.php | Horde_Stream.add | public function add($data, $reset = false)
{
if ($reset) {
$pos = $this->pos();
}
if (is_resource($data)) {
$dpos = ftell($data);
while (!feof($data)) {
$this->add(fread($data, 8192));
}
fseek($data, $dpos);
... | php | public function add($data, $reset = false)
{
if ($reset) {
$pos = $this->pos();
}
if (is_resource($data)) {
$dpos = ftell($data);
while (!feof($data)) {
$this->add(fread($data, 8192));
}
fseek($data, $dpos);
... | [
"public",
"function",
"add",
"(",
"$",
"data",
",",
"$",
"reset",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"reset",
")",
"{",
"$",
"pos",
"=",
"$",
"this",
"->",
"pos",
"(",
")",
";",
"}",
"if",
"(",
"is_resource",
"(",
"$",
"data",
")",
")",
... | Adds data to the stream.
@param mixed $data Data to add to the stream. Can be a resource,
Horde_Stream object, or a string(-ish) value.
@param boolean $reset Reset stream pointer to initial position after
adding? | [
"Adds",
"data",
"to",
"the",
"stream",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Stream.php#L124-L149 |
217,044 | moodle/moodle | lib/horde/framework/Horde/Stream.php | Horde_Stream.length | public function length($utf8 = false)
{
$pos = $this->pos();
if ($utf8 && $this->_utf8_char) {
$this->rewind();
$len = 0;
while ($this->getChar() !== false) {
++$len;
}
} elseif (!$this->end()) {
throw new Horde_Str... | php | public function length($utf8 = false)
{
$pos = $this->pos();
if ($utf8 && $this->_utf8_char) {
$this->rewind();
$len = 0;
while ($this->getChar() !== false) {
++$len;
}
} elseif (!$this->end()) {
throw new Horde_Str... | [
"public",
"function",
"length",
"(",
"$",
"utf8",
"=",
"false",
")",
"{",
"$",
"pos",
"=",
"$",
"this",
"->",
"pos",
"(",
")",
";",
"if",
"(",
"$",
"utf8",
"&&",
"$",
"this",
"->",
"_utf8_char",
")",
"{",
"$",
"this",
"->",
"rewind",
"(",
")",
... | Returns the length of the data. Does not change the stream position.
@param boolean $utf8 If true, determines the UTF-8 length of the
stream (as of 1.4.0). If false, determines the
byte length of the stream.
@return integer Stream size.
@throws Horde_Stream_Exception | [
"Returns",
"the",
"length",
"of",
"the",
"data",
".",
"Does",
"not",
"change",
"the",
"stream",
"position",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Stream.php#L162-L183 |
217,045 | moodle/moodle | lib/horde/framework/Horde/Stream.php | Horde_Stream.substring | public function substring($start = 0, $length = null, $char = false)
{
if ($start !== 0) {
$this->seek($start, true, $char);
}
$out = '';
$to_end = is_null($length);
/* If length is greater than remaining stream, use more efficient
* algorithm below. Al... | php | public function substring($start = 0, $length = null, $char = false)
{
if ($start !== 0) {
$this->seek($start, true, $char);
}
$out = '';
$to_end = is_null($length);
/* If length is greater than remaining stream, use more efficient
* algorithm below. Al... | [
"public",
"function",
"substring",
"(",
"$",
"start",
"=",
"0",
",",
"$",
"length",
"=",
"null",
",",
"$",
"char",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"start",
"!==",
"0",
")",
"{",
"$",
"this",
"->",
"seek",
"(",
"$",
"start",
",",
"true",... | Return part of the stream as a string.
@since 1.4.0
@param integer $start Start, as an offset from the current postion.
@param integer $length Length of string to return. If null, returns
rest of the stream. If negative, this many
characters will be omitted from the end of the
stream.
@param boolean $char If tr... | [
"Return",
"part",
"of",
"the",
"stream",
"as",
"a",
"string",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Stream.php#L367-L410 |
217,046 | moodle/moodle | lib/horde/framework/Horde/Stream.php | Horde_Stream.getEOL | public function getEOL()
{
$pos = $this->pos();
$this->rewind();
$pos2 = $this->search("\n", false, false);
if ($pos2) {
$this->seek(-1);
$eol = ($this->getChar() == "\r")
? "\r\n"
: "\n";
} else {
$eol = is... | php | public function getEOL()
{
$pos = $this->pos();
$this->rewind();
$pos2 = $this->search("\n", false, false);
if ($pos2) {
$this->seek(-1);
$eol = ($this->getChar() == "\r")
? "\r\n"
: "\n";
} else {
$eol = is... | [
"public",
"function",
"getEOL",
"(",
")",
"{",
"$",
"pos",
"=",
"$",
"this",
"->",
"pos",
"(",
")",
";",
"$",
"this",
"->",
"rewind",
"(",
")",
";",
"$",
"pos2",
"=",
"$",
"this",
"->",
"search",
"(",
"\"\\n\"",
",",
"false",
",",
"false",
")",... | Auto-determine the EOL string.
@since 1.3.0
@return string The EOL string, or null if no EOL found. | [
"Auto",
"-",
"determine",
"the",
"EOL",
"string",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Stream.php#L419-L439 |
217,047 | moodle/moodle | lib/horde/framework/Horde/Stream.php | Horde_Stream.getChar | public function getChar()
{
$char = fgetc($this->stream);
if (!$this->_utf8_char) {
return $char;
}
$c = ord($char);
if ($c < 0x80) {
return $char;
}
if ($c < 0xe0) {
$n = 1;
} elseif ($c < 0xf0) {
$n =... | php | public function getChar()
{
$char = fgetc($this->stream);
if (!$this->_utf8_char) {
return $char;
}
$c = ord($char);
if ($c < 0x80) {
return $char;
}
if ($c < 0xe0) {
$n = 1;
} elseif ($c < 0xf0) {
$n =... | [
"public",
"function",
"getChar",
"(",
")",
"{",
"$",
"char",
"=",
"fgetc",
"(",
"$",
"this",
"->",
"stream",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"_utf8_char",
")",
"{",
"return",
"$",
"char",
";",
"}",
"$",
"c",
"=",
"ord",
"(",
"$",
... | Return a character from the string.
@since 1.4.0
@return string Character (single byte, or UTF-8 character if
$utf8_char is true). | [
"Return",
"a",
"character",
"from",
"the",
"string",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Stream.php#L449-L479 |
217,048 | moodle/moodle | lib/horde/framework/Horde/Stream.php | Horde_Stream.seek | public function seek($offset = 0, $curr = true, $char = false)
{
if (!$offset) {
return (bool)$curr ?: $this->rewind();
}
if ($offset < 0) {
if (!$curr) {
return true;
} elseif (abs($offset) > $this->pos()) {
return $this->... | php | public function seek($offset = 0, $curr = true, $char = false)
{
if (!$offset) {
return (bool)$curr ?: $this->rewind();
}
if ($offset < 0) {
if (!$curr) {
return true;
} elseif (abs($offset) > $this->pos()) {
return $this->... | [
"public",
"function",
"seek",
"(",
"$",
"offset",
"=",
"0",
",",
"$",
"curr",
"=",
"true",
",",
"$",
"char",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"offset",
")",
"{",
"return",
"(",
"bool",
")",
"$",
"curr",
"?",
":",
"$",
"this",
"->"... | Move internal pointer.
@since 1.4.0
@param integer $offset The offset.
@param boolean $curr If true, offset is from current position. If
false, offset is from beginning of stream.
@param boolean $char If true, $offset is the length in characters.
If false, $offset is the length in bytes.
@return boolean True... | [
"Move",
"internal",
"pointer",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Stream.php#L518-L557 |
217,049 | moodle/moodle | question/classes/bank/random_question_loader.php | random_question_loader.get_next_question_id | public function get_next_question_id($categoryid, $includesubcategories, $tagids = []) {
$this->ensure_questions_for_category_loaded($categoryid, $includesubcategories, $tagids);
$categorykey = $this->get_category_key($categoryid, $includesubcategories, $tagids);
if (empty($this->availablequest... | php | public function get_next_question_id($categoryid, $includesubcategories, $tagids = []) {
$this->ensure_questions_for_category_loaded($categoryid, $includesubcategories, $tagids);
$categorykey = $this->get_category_key($categoryid, $includesubcategories, $tagids);
if (empty($this->availablequest... | [
"public",
"function",
"get_next_question_id",
"(",
"$",
"categoryid",
",",
"$",
"includesubcategories",
",",
"$",
"tagids",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"ensure_questions_for_category_loaded",
"(",
"$",
"categoryid",
",",
"$",
"includesubcategories"... | Pick a question at random from the given category, from among those with the fewest uses.
If an array of tag ids are specified, then only the questions that are tagged with ALL those tags will be selected.
It is up the the caller to verify that the cateogry exists. An unknown category
behaves like an empty one.
@para... | [
"Pick",
"a",
"question",
"at",
"random",
"from",
"the",
"given",
"category",
"from",
"among",
"those",
"with",
"the",
"fewest",
"uses",
".",
"If",
"an",
"array",
"of",
"tag",
"ids",
"are",
"specified",
"then",
"only",
"the",
"questions",
"that",
"are",
"... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/random_question_loader.php#L92-L106 |
217,050 | moodle/moodle | question/classes/bank/random_question_loader.php | random_question_loader.use_question | protected function use_question($questionid) {
if (isset($this->recentlyusedquestions[$questionid])) {
$this->recentlyusedquestions[$questionid] += 1;
} else {
$this->recentlyusedquestions[$questionid] = 1;
}
foreach ($this->availablequestionscache as $categoryke... | php | protected function use_question($questionid) {
if (isset($this->recentlyusedquestions[$questionid])) {
$this->recentlyusedquestions[$questionid] += 1;
} else {
$this->recentlyusedquestions[$questionid] = 1;
}
foreach ($this->availablequestionscache as $categoryke... | [
"protected",
"function",
"use_question",
"(",
"$",
"questionid",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"recentlyusedquestions",
"[",
"$",
"questionid",
"]",
")",
")",
"{",
"$",
"this",
"->",
"recentlyusedquestions",
"[",
"$",
"questionid",
... | Update the internal data structures to indicate that a given question has
been used one more time.
@param int $questionid the question that is being used. | [
"Update",
"the",
"internal",
"data",
"structures",
"to",
"indicate",
"that",
"a",
"given",
"question",
"has",
"been",
"used",
"one",
"more",
"time",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/random_question_loader.php#L193-L211 |
217,051 | moodle/moodle | question/classes/bank/random_question_loader.php | random_question_loader.get_question_ids | protected function get_question_ids($categoryid, $includesubcategories, $tagids = []) {
$this->ensure_questions_for_category_loaded($categoryid, $includesubcategories, $tagids);
$categorykey = $this->get_category_key($categoryid, $includesubcategories, $tagids);
$cachedvalues = $this->availableq... | php | protected function get_question_ids($categoryid, $includesubcategories, $tagids = []) {
$this->ensure_questions_for_category_loaded($categoryid, $includesubcategories, $tagids);
$categorykey = $this->get_category_key($categoryid, $includesubcategories, $tagids);
$cachedvalues = $this->availableq... | [
"protected",
"function",
"get_question_ids",
"(",
"$",
"categoryid",
",",
"$",
"includesubcategories",
",",
"$",
"tagids",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"ensure_questions_for_category_loaded",
"(",
"$",
"categoryid",
",",
"$",
"includesubcategories",... | Get the list of available question ids for the given criteria.
@param int $categoryid The id of a category in the question bank.
@param bool $includesubcategories Whether to pick a question from exactly
that category, or that category and subcategories.
@param array $tagids An array of tag ids. If an array is provided... | [
"Get",
"the",
"list",
"of",
"available",
"question",
"ids",
"for",
"the",
"given",
"criteria",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/random_question_loader.php#L223-L234 |
217,052 | moodle/moodle | question/classes/bank/random_question_loader.php | random_question_loader.is_question_available | public function is_question_available($categoryid, $includesubcategories, $questionid, $tagids = []) {
$this->ensure_questions_for_category_loaded($categoryid, $includesubcategories, $tagids);
$categorykey = $this->get_category_key($categoryid, $includesubcategories, $tagids);
foreach ($this->a... | php | public function is_question_available($categoryid, $includesubcategories, $questionid, $tagids = []) {
$this->ensure_questions_for_category_loaded($categoryid, $includesubcategories, $tagids);
$categorykey = $this->get_category_key($categoryid, $includesubcategories, $tagids);
foreach ($this->a... | [
"public",
"function",
"is_question_available",
"(",
"$",
"categoryid",
",",
"$",
"includesubcategories",
",",
"$",
"questionid",
",",
"$",
"tagids",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"ensure_questions_for_category_loaded",
"(",
"$",
"categoryid",
",",
... | Check whether a given question is available in a given category. If so, mark it used.
If an optional list of tag ids are provided, then the question must be tagged with
ALL of the provided tags to be considered as available.
@param int $categoryid the id of a category in the question bank.
@param bool $includesubcateg... | [
"Check",
"whether",
"a",
"given",
"question",
"is",
"available",
"in",
"a",
"given",
"category",
".",
"If",
"so",
"mark",
"it",
"used",
".",
"If",
"an",
"optional",
"list",
"of",
"tag",
"ids",
"are",
"provided",
"then",
"the",
"question",
"must",
"be",
... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/random_question_loader.php#L248-L260 |
217,053 | moodle/moodle | question/classes/bank/random_question_loader.php | random_question_loader.get_questions | public function get_questions(
$categoryid,
$includesubcategories,
$tagids = [],
$limit = 100,
$offset = 0,
$fields = []
) {
global $DB;
$questionids = $this->get_question_ids($categoryid, $includesubcategories, $tagids);
if (empty($questionid... | php | public function get_questions(
$categoryid,
$includesubcategories,
$tagids = [],
$limit = 100,
$offset = 0,
$fields = []
) {
global $DB;
$questionids = $this->get_question_ids($categoryid, $includesubcategories, $tagids);
if (empty($questionid... | [
"public",
"function",
"get_questions",
"(",
"$",
"categoryid",
",",
"$",
"includesubcategories",
",",
"$",
"tagids",
"=",
"[",
"]",
",",
"$",
"limit",
"=",
"100",
",",
"$",
"offset",
"=",
"0",
",",
"$",
"fields",
"=",
"[",
"]",
")",
"{",
"global",
... | Get the list of available questions for the given criteria.
@param int $categoryid The id of a category in the question bank.
@param bool $includesubcategories Whether to pick a question from exactly
that category, or that category and subcategories.
@param array $tagids An array of tag ids. If an array is provided, t... | [
"Get",
"the",
"list",
"of",
"available",
"questions",
"for",
"the",
"given",
"criteria",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/random_question_loader.php#L275-L306 |
217,054 | moodle/moodle | question/classes/bank/random_question_loader.php | random_question_loader.count_questions | public function count_questions($categoryid, $includesubcategories, $tagids = []) {
$questionids = $this->get_question_ids($categoryid, $includesubcategories, $tagids);
return count($questionids);
} | php | public function count_questions($categoryid, $includesubcategories, $tagids = []) {
$questionids = $this->get_question_ids($categoryid, $includesubcategories, $tagids);
return count($questionids);
} | [
"public",
"function",
"count_questions",
"(",
"$",
"categoryid",
",",
"$",
"includesubcategories",
",",
"$",
"tagids",
"=",
"[",
"]",
")",
"{",
"$",
"questionids",
"=",
"$",
"this",
"->",
"get_question_ids",
"(",
"$",
"categoryid",
",",
"$",
"includesubcateg... | Count the number of available questions for the given criteria.
@param int $categoryid The id of a category in the question bank.
@param bool $includesubcategories Whether to pick a question from exactly
that category, or that category and subcategories.
@param array $tagids An array of tag ids. If an array is provide... | [
"Count",
"the",
"number",
"of",
"available",
"questions",
"for",
"the",
"given",
"criteria",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/bank/random_question_loader.php#L318-L321 |
217,055 | moodle/moodle | auth/cas/CAS/CAS/ProxyChain/AllowedList.php | CAS_ProxyChain_AllowedList.isProxyListAllowed | public function isProxyListAllowed(array $proxies)
{
phpCAS::traceBegin();
if (empty($proxies)) {
phpCAS::trace("No proxies were found in the response");
phpCAS::traceEnd(true);
return true;
} elseif (!$this->isProxyingAllowed()) {
phpCAS::trac... | php | public function isProxyListAllowed(array $proxies)
{
phpCAS::traceBegin();
if (empty($proxies)) {
phpCAS::trace("No proxies were found in the response");
phpCAS::traceEnd(true);
return true;
} elseif (!$this->isProxyingAllowed()) {
phpCAS::trac... | [
"public",
"function",
"isProxyListAllowed",
"(",
"array",
"$",
"proxies",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"proxies",
")",
")",
"{",
"phpCAS",
"::",
"trace",
"(",
"\"No proxies were found in the response\"",
... | Check if the proxies found in the response match the allowed proxies
@param array $proxies list of proxies to check
@return bool whether the proxies match the allowed proxies | [
"Check",
"if",
"the",
"proxies",
"found",
"in",
"the",
"response",
"match",
"the",
"allowed",
"proxies"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/ProxyChain/AllowedList.php#L77-L93 |
217,056 | moodle/moodle | auth/cas/CAS/CAS/ProxyChain/AllowedList.php | CAS_ProxyChain_AllowedList.contains | public function contains(array $list)
{
phpCAS::traceBegin();
$count = 0;
foreach ($this->_chains as $chain) {
phpCAS::trace("Checking chain ". $count++);
if ($chain->matches($list)) {
phpCAS::traceEnd(true);
return true;
}
... | php | public function contains(array $list)
{
phpCAS::traceBegin();
$count = 0;
foreach ($this->_chains as $chain) {
phpCAS::trace("Checking chain ". $count++);
if ($chain->matches($list)) {
phpCAS::traceEnd(true);
return true;
}
... | [
"public",
"function",
"contains",
"(",
"array",
"$",
"list",
")",
"{",
"phpCAS",
"::",
"traceBegin",
"(",
")",
";",
"$",
"count",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"_chains",
"as",
"$",
"chain",
")",
"{",
"phpCAS",
"::",
"trace",
"(... | Validate the proxies from the proxy ticket validation against the
chains that were definded.
@param array $list List of proxies from the proxy ticket validation.
@return if any chain fully matches the supplied list | [
"Validate",
"the",
"proxies",
"from",
"the",
"proxy",
"ticket",
"validation",
"against",
"the",
"chains",
"that",
"were",
"definded",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/ProxyChain/AllowedList.php#L103-L117 |
217,057 | moodle/moodle | lib/csvlib.class.php | csv_import_reader.get_columns | public function get_columns() {
if (isset($this->_columns)) {
return $this->_columns;
}
global $USER, $CFG;
$filename = $CFG->tempdir.'/csvimport/'.$this->_type.'/'.$USER->id.'/'.$this->_iid;
if (!file_exists($filename)) {
return false;
}
... | php | public function get_columns() {
if (isset($this->_columns)) {
return $this->_columns;
}
global $USER, $CFG;
$filename = $CFG->tempdir.'/csvimport/'.$this->_type.'/'.$USER->id.'/'.$this->_iid;
if (!file_exists($filename)) {
return false;
}
... | [
"public",
"function",
"get_columns",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_columns",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_columns",
";",
"}",
"global",
"$",
"USER",
",",
"$",
"CFG",
";",
"$",
"filename",
"=",
"$",
... | Returns list of columns
@return array | [
"Returns",
"list",
"of",
"columns"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/csvlib.class.php#L195-L214 |
217,058 | moodle/moodle | lib/csvlib.class.php | csv_import_reader.init | public function init() {
global $CFG, $USER;
if (!empty($this->_fp)) {
$this->close();
}
$filename = $CFG->tempdir.'/csvimport/'.$this->_type.'/'.$USER->id.'/'.$this->_iid;
if (!file_exists($filename)) {
return false;
}
if (!$this->_fp = f... | php | public function init() {
global $CFG, $USER;
if (!empty($this->_fp)) {
$this->close();
}
$filename = $CFG->tempdir.'/csvimport/'.$this->_type.'/'.$USER->id.'/'.$this->_iid;
if (!file_exists($filename)) {
return false;
}
if (!$this->_fp = f... | [
"public",
"function",
"init",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"USER",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_fp",
")",
")",
"{",
"$",
"this",
"->",
"close",
"(",
")",
";",
"}",
"$",
"filename",
"=",
"$",
"CFG",... | Init iterator.
@global object
@global object
@return bool Success | [
"Init",
"iterator",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/csvlib.class.php#L223-L238 |
217,059 | moodle/moodle | lib/csvlib.class.php | csv_import_reader.next | public function next() {
if (empty($this->_fp) or feof($this->_fp)) {
return false;
}
if ($ser = fgetcsv($this->_fp)) {
return $ser;
} else {
return false;
}
} | php | public function next() {
if (empty($this->_fp) or feof($this->_fp)) {
return false;
}
if ($ser = fgetcsv($this->_fp)) {
return $ser;
} else {
return false;
}
} | [
"public",
"function",
"next",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_fp",
")",
"or",
"feof",
"(",
"$",
"this",
"->",
"_fp",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"ser",
"=",
"fgetcsv",
"(",
"$",
"th... | Get next line
@return mixed false, or an array of values | [
"Get",
"next",
"line"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/csvlib.class.php#L245-L254 |
217,060 | moodle/moodle | lib/csvlib.class.php | csv_import_reader.close | public function close() {
if (!empty($this->_fp)) {
fclose($this->_fp);
$this->_fp = null;
}
} | php | public function close() {
if (!empty($this->_fp)) {
fclose($this->_fp);
$this->_fp = null;
}
} | [
"public",
"function",
"close",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_fp",
")",
")",
"{",
"fclose",
"(",
"$",
"this",
"->",
"_fp",
")",
";",
"$",
"this",
"->",
"_fp",
"=",
"null",
";",
"}",
"}"
] | Release iteration related resources
@return void | [
"Release",
"iteration",
"related",
"resources"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/csvlib.class.php#L261-L266 |
217,061 | moodle/moodle | lib/csvlib.class.php | csv_import_reader.cleanup | public function cleanup($full=false) {
global $USER, $CFG;
if ($full) {
@remove_dir($CFG->tempdir.'/csvimport/'.$this->_type.'/'.$USER->id);
} else {
@unlink($CFG->tempdir.'/csvimport/'.$this->_type.'/'.$USER->id.'/'.$this->_iid);
}
} | php | public function cleanup($full=false) {
global $USER, $CFG;
if ($full) {
@remove_dir($CFG->tempdir.'/csvimport/'.$this->_type.'/'.$USER->id);
} else {
@unlink($CFG->tempdir.'/csvimport/'.$this->_type.'/'.$USER->id.'/'.$this->_iid);
}
} | [
"public",
"function",
"cleanup",
"(",
"$",
"full",
"=",
"false",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"CFG",
";",
"if",
"(",
"$",
"full",
")",
"{",
"@",
"remove_dir",
"(",
"$",
"CFG",
"->",
"tempdir",
".",
"'/csvimport/'",
".",
"$",
"this",
... | Cleanup temporary data
@global object
@global object
@param boolean $full true means do a full cleanup - all sessions for current user, false only the active iid | [
"Cleanup",
"temporary",
"data"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/csvlib.class.php#L284-L292 |
217,062 | moodle/moodle | lib/csvlib.class.php | csv_import_reader.get_delimiter_list | public static function get_delimiter_list() {
global $CFG;
$delimiters = array('comma'=>',', 'semicolon'=>';', 'colon'=>':', 'tab'=>'\\t');
if (isset($CFG->CSV_DELIMITER) and strlen($CFG->CSV_DELIMITER) === 1 and !in_array($CFG->CSV_DELIMITER, $delimiters)) {
$delimiters['cfg'] = $CF... | php | public static function get_delimiter_list() {
global $CFG;
$delimiters = array('comma'=>',', 'semicolon'=>';', 'colon'=>':', 'tab'=>'\\t');
if (isset($CFG->CSV_DELIMITER) and strlen($CFG->CSV_DELIMITER) === 1 and !in_array($CFG->CSV_DELIMITER, $delimiters)) {
$delimiters['cfg'] = $CF... | [
"public",
"static",
"function",
"get_delimiter_list",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"delimiters",
"=",
"array",
"(",
"'comma'",
"=>",
"','",
",",
"'semicolon'",
"=>",
"';'",
",",
"'colon'",
"=>",
"':'",
",",
"'tab'",
"=>",
"'\\\\t'",
")"... | Get list of cvs delimiters
@return array suitable for selection box | [
"Get",
"list",
"of",
"cvs",
"delimiters"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/csvlib.class.php#L299-L306 |
217,063 | moodle/moodle | lib/csvlib.class.php | csv_import_reader.get_encoded_delimiter | public static function get_encoded_delimiter($delimiter_name) {
global $CFG;
if ($delimiter_name == 'cfg' and isset($CFG->CSV_ENCODE)) {
return $CFG->CSV_ENCODE;
}
$delimiter = csv_import_reader::get_delimiter($delimiter_name);
return '&#'.ord($delimiter);
} | php | public static function get_encoded_delimiter($delimiter_name) {
global $CFG;
if ($delimiter_name == 'cfg' and isset($CFG->CSV_ENCODE)) {
return $CFG->CSV_ENCODE;
}
$delimiter = csv_import_reader::get_delimiter($delimiter_name);
return '&#'.ord($delimiter);
} | [
"public",
"static",
"function",
"get_encoded_delimiter",
"(",
"$",
"delimiter_name",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"$",
"delimiter_name",
"==",
"'cfg'",
"and",
"isset",
"(",
"$",
"CFG",
"->",
"CSV_ENCODE",
")",
")",
"{",
"return",
"$",
... | Get encoded delimiter character
@global object
@param string separator name
@return string encoded delimiter char | [
"Get",
"encoded",
"delimiter",
"character"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/csvlib.class.php#L333-L340 |
217,064 | moodle/moodle | lib/csvlib.class.php | csv_import_reader.get_new_iid | public static function get_new_iid($type) {
global $USER;
$filename = make_temp_directory('csvimport/'.$type.'/'.$USER->id);
// use current (non-conflicting) time stamp
$iiid = time();
while (file_exists($filename.'/'.$iiid)) {
$iiid--;
}
return $ii... | php | public static function get_new_iid($type) {
global $USER;
$filename = make_temp_directory('csvimport/'.$type.'/'.$USER->id);
// use current (non-conflicting) time stamp
$iiid = time();
while (file_exists($filename.'/'.$iiid)) {
$iiid--;
}
return $ii... | [
"public",
"static",
"function",
"get_new_iid",
"(",
"$",
"type",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"filename",
"=",
"make_temp_directory",
"(",
"'csvimport/'",
".",
"$",
"type",
".",
"'/'",
".",
"$",
"USER",
"->",
"id",
")",
";",
"// use current... | Create new import id
@global object
@param string who imports?
@return int iid | [
"Create",
"new",
"import",
"id"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/csvlib.class.php#L349-L361 |
217,065 | moodle/moodle | lib/csvlib.class.php | csv_export_writer.set_temp_file_path | protected function set_temp_file_path() {
global $USER, $CFG;
make_temp_directory('csvimport/' . $USER->id);
$path = $CFG->tempdir . '/csvimport/' . $USER->id. '/' . $this->filename;
// Check to see if the file exists, if so delete it.
if (file_exists($path)) {
unlink... | php | protected function set_temp_file_path() {
global $USER, $CFG;
make_temp_directory('csvimport/' . $USER->id);
$path = $CFG->tempdir . '/csvimport/' . $USER->id. '/' . $this->filename;
// Check to see if the file exists, if so delete it.
if (file_exists($path)) {
unlink... | [
"protected",
"function",
"set_temp_file_path",
"(",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"CFG",
";",
"make_temp_directory",
"(",
"'csvimport/'",
".",
"$",
"USER",
"->",
"id",
")",
";",
"$",
"path",
"=",
"$",
"CFG",
"->",
"tempdir",
".",
"'/csvimpor... | Set the file path to the temporary file. | [
"Set",
"the",
"file",
"path",
"to",
"the",
"temporary",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/csvlib.class.php#L420-L429 |
217,066 | moodle/moodle | lib/csvlib.class.php | csv_export_writer.add_data | public function add_data($row) {
if(!isset($this->path)) {
$this->set_temp_file_path();
$this->fp = fopen($this->path, 'w+');
}
$delimiter = csv_import_reader::get_delimiter($this->delimiter);
fputcsv($this->fp, $row, $delimiter, $this->csvenclosure);
} | php | public function add_data($row) {
if(!isset($this->path)) {
$this->set_temp_file_path();
$this->fp = fopen($this->path, 'w+');
}
$delimiter = csv_import_reader::get_delimiter($this->delimiter);
fputcsv($this->fp, $row, $delimiter, $this->csvenclosure);
} | [
"public",
"function",
"add_data",
"(",
"$",
"row",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"path",
")",
")",
"{",
"$",
"this",
"->",
"set_temp_file_path",
"(",
")",
";",
"$",
"this",
"->",
"fp",
"=",
"fopen",
"(",
"$",
"this",
... | Add data to the temporary file in csv format
@param array $row An array of values. | [
"Add",
"data",
"to",
"the",
"temporary",
"file",
"in",
"csv",
"format"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/csvlib.class.php#L436-L443 |
217,067 | moodle/moodle | lib/csvlib.class.php | csv_export_writer.print_csv_data | public function print_csv_data($return = false) {
fseek($this->fp, 0);
$returnstring = '';
while (($content = fgets($this->fp)) !== false) {
if (!$return){
echo $content;
} else {
$returnstring .= $content;
}
}
i... | php | public function print_csv_data($return = false) {
fseek($this->fp, 0);
$returnstring = '';
while (($content = fgets($this->fp)) !== false) {
if (!$return){
echo $content;
} else {
$returnstring .= $content;
}
}
i... | [
"public",
"function",
"print_csv_data",
"(",
"$",
"return",
"=",
"false",
")",
"{",
"fseek",
"(",
"$",
"this",
"->",
"fp",
",",
"0",
")",
";",
"$",
"returnstring",
"=",
"''",
";",
"while",
"(",
"(",
"$",
"content",
"=",
"fgets",
"(",
"$",
"this",
... | Echos or returns a csv data line by line for displaying.
@param bool $return Set to true to return a string with the csv data.
@return string csv data. | [
"Echos",
"or",
"returns",
"a",
"csv",
"data",
"line",
"by",
"line",
"for",
"displaying",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/csvlib.class.php#L451-L464 |
217,068 | moodle/moodle | lib/csvlib.class.php | csv_export_writer.set_filename | public function set_filename($dataname, $extension = '.csv') {
$filename = clean_filename($dataname);
$filename .= clean_filename('-' . gmdate("Ymd_Hi"));
$filename .= clean_filename("-{$this->delimiter}_separated");
$filename .= $extension;
$this->filename = $filename;
} | php | public function set_filename($dataname, $extension = '.csv') {
$filename = clean_filename($dataname);
$filename .= clean_filename('-' . gmdate("Ymd_Hi"));
$filename .= clean_filename("-{$this->delimiter}_separated");
$filename .= $extension;
$this->filename = $filename;
} | [
"public",
"function",
"set_filename",
"(",
"$",
"dataname",
",",
"$",
"extension",
"=",
"'.csv'",
")",
"{",
"$",
"filename",
"=",
"clean_filename",
"(",
"$",
"dataname",
")",
";",
"$",
"filename",
".=",
"clean_filename",
"(",
"'-'",
".",
"gmdate",
"(",
"... | Set the filename for the uploaded csv file
@param string $dataname The name of the module.
@param string $extenstion File extension for the file. | [
"Set",
"the",
"filename",
"for",
"the",
"uploaded",
"csv",
"file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/csvlib.class.php#L472-L478 |
217,069 | moodle/moodle | lib/csvlib.class.php | csv_export_writer.download_array | public static function download_array($filename, array &$records, $delimiter = 'comma', $enclosure='"') {
$csvdata = new csv_export_writer($delimiter, $enclosure);
$csvdata->set_filename($filename);
foreach ($records as $row) {
$csvdata->add_data($row);
}
$csvdata->do... | php | public static function download_array($filename, array &$records, $delimiter = 'comma', $enclosure='"') {
$csvdata = new csv_export_writer($delimiter, $enclosure);
$csvdata->set_filename($filename);
foreach ($records as $row) {
$csvdata->add_data($row);
}
$csvdata->do... | [
"public",
"static",
"function",
"download_array",
"(",
"$",
"filename",
",",
"array",
"&",
"$",
"records",
",",
"$",
"delimiter",
"=",
"'comma'",
",",
"$",
"enclosure",
"=",
"'\"'",
")",
"{",
"$",
"csvdata",
"=",
"new",
"csv_export_writer",
"(",
"$",
"de... | Creates a file for downloading an array into a deliminated format.
This function is useful if you are happy with the defaults and all of your
information is in one array.
@param string $filename The filename of the file being created.
@param array $records An array of information to be converted.
@param string... | [
"Creates",
"a",
"file",
"for",
"downloading",
"an",
"array",
"into",
"a",
"deliminated",
"format",
".",
"This",
"function",
"is",
"useful",
"if",
"you",
"are",
"happy",
"with",
"the",
"defaults",
"and",
"all",
"of",
"your",
"information",
"is",
"in",
"one"... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/csvlib.class.php#L521-L528 |
217,070 | moodle/moodle | lib/csvlib.class.php | csv_export_writer.print_array | public static function print_array(array &$records, $delimiter = 'comma', $enclosure = '"', $return = false) {
$csvdata = new csv_export_writer($delimiter, $enclosure);
foreach ($records as $row) {
$csvdata->add_data($row);
}
$data = $csvdata->print_csv_data($return);
... | php | public static function print_array(array &$records, $delimiter = 'comma', $enclosure = '"', $return = false) {
$csvdata = new csv_export_writer($delimiter, $enclosure);
foreach ($records as $row) {
$csvdata->add_data($row);
}
$data = $csvdata->print_csv_data($return);
... | [
"public",
"static",
"function",
"print_array",
"(",
"array",
"&",
"$",
"records",
",",
"$",
"delimiter",
"=",
"'comma'",
",",
"$",
"enclosure",
"=",
"'\"'",
",",
"$",
"return",
"=",
"false",
")",
"{",
"$",
"csvdata",
"=",
"new",
"csv_export_writer",
"(",... | This will convert an array of values into a deliminated string.
Like the above function, this is for convenience.
@param array $records An array of information to be converted.
@param string $delimiter The name of the delimiter. Supported types(comma, tab, semicolon, colon, cfg)
@param string $enclosure How spei... | [
"This",
"will",
"convert",
"an",
"array",
"of",
"values",
"into",
"a",
"deliminated",
"string",
".",
"Like",
"the",
"above",
"function",
"this",
"is",
"for",
"convenience",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/csvlib.class.php#L540-L549 |
217,071 | moodle/moodle | question/classes/statistics/responses/analyser.php | analyser.calculate | public function calculate($qubaids, $whichtries = \question_attempt::LAST_TRY) {
// Load data.
$dm = new \question_engine_data_mapper();
$questionattempts = $dm->load_attempts_at_question($this->questiondata->id, $qubaids);
// Analyse it.
foreach ($questionattempts as $qa) {
... | php | public function calculate($qubaids, $whichtries = \question_attempt::LAST_TRY) {
// Load data.
$dm = new \question_engine_data_mapper();
$questionattempts = $dm->load_attempts_at_question($this->questiondata->id, $qubaids);
// Analyse it.
foreach ($questionattempts as $qa) {
... | [
"public",
"function",
"calculate",
"(",
"$",
"qubaids",
",",
"$",
"whichtries",
"=",
"\\",
"question_attempt",
"::",
"LAST_TRY",
")",
"{",
"// Load data.",
"$",
"dm",
"=",
"new",
"\\",
"question_engine_data_mapper",
"(",
")",
";",
"$",
"questionattempts",
"=",... | Analyse all the response data for for all the specified attempts at this question.
@param \qubaid_condition $qubaids which attempts to consider.
@param string $whichtries which tries to analyse. Will be one of
\question_attempt::FIRST_TRY, LAST_TRY or ALL_TRIES.
@return analysis_for_question | [
"Analyse",
"all",
"the",
"response",
"data",
"for",
"for",
"all",
"the",
"specified",
"attempts",
"at",
"this",
"question",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/responses/analyser.php#L119-L136 |
217,072 | moodle/moodle | question/classes/statistics/responses/analyser.php | analyser.load_cached | public function load_cached($qubaids, $whichtries) {
global $DB;
$timemodified = time() - self::TIME_TO_CACHE;
// Variable name 'analyses' is the plural of 'analysis'.
$responseanalyses = $DB->get_records_select('question_response_analysis',
'... | php | public function load_cached($qubaids, $whichtries) {
global $DB;
$timemodified = time() - self::TIME_TO_CACHE;
// Variable name 'analyses' is the plural of 'analysis'.
$responseanalyses = $DB->get_records_select('question_response_analysis',
'... | [
"public",
"function",
"load_cached",
"(",
"$",
"qubaids",
",",
"$",
"whichtries",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"timemodified",
"=",
"time",
"(",
")",
"-",
"self",
"::",
"TIME_TO_CACHE",
";",
"// Variable name 'analyses' is the plural of 'analysis'.",
... | Retrieve the computed response analysis from the question_response_analysis table.
@param \qubaid_condition $qubaids load the analysis of which question usages?
@param string $whichtries load the analysis of which tries?
@return analysis_for_question|boolean analysis or false if no cached analysis found. | [
"Retrieve",
"the",
"computed",
"response",
"analysis",
"from",
"the",
"question_response_analysis",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/responses/analyser.php#L145-L174 |
217,073 | moodle/moodle | question/classes/statistics/responses/analyser.php | analyser.get_last_analysed_time | public function get_last_analysed_time($qubaids, $whichtries) {
global $DB;
$timemodified = time() - self::TIME_TO_CACHE;
return $DB->get_field_select('question_response_analysis', 'timemodified',
'hashcode = ? AND whichtries = ? AND questionid = ? AND timem... | php | public function get_last_analysed_time($qubaids, $whichtries) {
global $DB;
$timemodified = time() - self::TIME_TO_CACHE;
return $DB->get_field_select('question_response_analysis', 'timemodified',
'hashcode = ? AND whichtries = ? AND questionid = ? AND timem... | [
"public",
"function",
"get_last_analysed_time",
"(",
"$",
"qubaids",
",",
"$",
"whichtries",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"timemodified",
"=",
"time",
"(",
")",
"-",
"self",
"::",
"TIME_TO_CACHE",
";",
"return",
"$",
"DB",
"->",
"get_field_sele... | Find time of non-expired analysis in the database.
@param \qubaid_condition $qubaids check for the analysis of which question usages?
@param string $whichtries check for the analysis of which tries?
@return integer|boolean Time of cached record that matches this qubaid_condition or false if none found. | [
"Find",
"time",
"of",
"non",
"-",
"expired",
"analysis",
"in",
"the",
"database",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/responses/analyser.php#L184-L192 |
217,074 | moodle/moodle | lib/simplepie/library/SimplePie/Category.php | SimplePie_Category.get_label | public function get_label($strict = false)
{
if ($this->label === null && $strict !== true)
{
return $this->get_term();
}
return $this->label;
} | php | public function get_label($strict = false)
{
if ($this->label === null && $strict !== true)
{
return $this->get_term();
}
return $this->label;
} | [
"public",
"function",
"get_label",
"(",
"$",
"strict",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"label",
"===",
"null",
"&&",
"$",
"strict",
"!==",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"get_term",
"(",
")",
";",
"}",
"return"... | Get the human readable label
@param bool $strict
@return string|null | [
"Get",
"the",
"human",
"readable",
"label"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Category.php#L144-L151 |
217,075 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/URIScheme.php | HTMLPurifier_URIScheme.validate | public function validate(&$uri, $config, $context)
{
if ($this->default_port == $uri->port) {
$uri->port = null;
}
// kludge: browsers do funny things when the scheme but not the
// authority is set
if (!$this->may_omit_host &&
// if the scheme is pres... | php | public function validate(&$uri, $config, $context)
{
if ($this->default_port == $uri->port) {
$uri->port = null;
}
// kludge: browsers do funny things when the scheme but not the
// authority is set
if (!$this->may_omit_host &&
// if the scheme is pres... | [
"public",
"function",
"validate",
"(",
"&",
"$",
"uri",
",",
"$",
"config",
",",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"default_port",
"==",
"$",
"uri",
"->",
"port",
")",
"{",
"$",
"uri",
"->",
"port",
"=",
"null",
";",
"}",
... | Public interface for validating components of a URI. Performs a
bunch of default actions. Don't overload this method.
@param HTMLPurifier_URI $uri Reference to a HTMLPurifier_URI object
@param HTMLPurifier_Config $config
@param HTMLPurifier_Context $context
@return bool success or failure | [
"Public",
"interface",
"for",
"validating",
"components",
"of",
"a",
"URI",
".",
"Performs",
"a",
"bunch",
"of",
"default",
"actions",
".",
"Don",
"t",
"overload",
"this",
"method",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/URIScheme.php#L63-L99 |
217,076 | moodle/moodle | grade/classes/privacy/provider.php | provider.delete_orphan_historical_grades | protected static function delete_orphan_historical_grades($userid) {
global $DB;
$sql = "
SELECT ggh.id
FROM {grade_grades_history} ggh
LEFT JOIN {grade_items} gi
ON ggh.itemid = gi.id
WHERE gi.id IS NULL
AND ggh.userid = :us... | php | protected static function delete_orphan_historical_grades($userid) {
global $DB;
$sql = "
SELECT ggh.id
FROM {grade_grades_history} ggh
LEFT JOIN {grade_items} gi
ON ggh.itemid = gi.id
WHERE gi.id IS NULL
AND ggh.userid = :us... | [
"protected",
"static",
"function",
"delete_orphan_historical_grades",
"(",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"\"\n SELECT ggh.id\n FROM {grade_grades_history} ggh\n LEFT JOIN {grade_items} gi\n ON ggh.it... | Delete orphan historical grades.
@param int $userid The user ID.
@return void | [
"Delete",
"orphan",
"historical",
"grades",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/classes/privacy/provider.php#L809-L839 |
217,077 | moodle/moodle | grade/classes/privacy/provider.php | provider.extract_grade_grade_from_record | protected static function extract_grade_grade_from_record(stdClass $record, $ishistory = false) {
$prefix = $ishistory ? 'ggh_' : 'gg_';
$ggrecord = static::extract_record($record, $prefix);
if ($ishistory) {
// The grade history is not a real grade_grade so we remove the ID.
... | php | protected static function extract_grade_grade_from_record(stdClass $record, $ishistory = false) {
$prefix = $ishistory ? 'ggh_' : 'gg_';
$ggrecord = static::extract_record($record, $prefix);
if ($ishistory) {
// The grade history is not a real grade_grade so we remove the ID.
... | [
"protected",
"static",
"function",
"extract_grade_grade_from_record",
"(",
"stdClass",
"$",
"record",
",",
"$",
"ishistory",
"=",
"false",
")",
"{",
"$",
"prefix",
"=",
"$",
"ishistory",
"?",
"'ggh_'",
":",
"'gg_'",
";",
"$",
"ggrecord",
"=",
"static",
"::",... | Extract grade_grade from a record.
@param stdClass $record The record.
@param bool $ishistory Whether we're extracting a historical grade.
@return grade_grade | [
"Extract",
"grade_grade",
"from",
"a",
"record",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/classes/privacy/provider.php#L1036-L1064 |
217,078 | moodle/moodle | grade/classes/privacy/provider.php | provider.extract_record | protected static function extract_record($record, $prefix) {
$result = [];
$prefixlength = strlen($prefix);
foreach ($record as $key => $value) {
if (strpos($key, $prefix) === 0) {
$result[substr($key, $prefixlength)] = $value;
}
}
return (... | php | protected static function extract_record($record, $prefix) {
$result = [];
$prefixlength = strlen($prefix);
foreach ($record as $key => $value) {
if (strpos($key, $prefix) === 0) {
$result[substr($key, $prefixlength)] = $value;
}
}
return (... | [
"protected",
"static",
"function",
"extract_record",
"(",
"$",
"record",
",",
"$",
"prefix",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"prefixlength",
"=",
"strlen",
"(",
"$",
"prefix",
")",
";",
"foreach",
"(",
"$",
"record",
"as",
"$",
"key... | Extract a record from another one.
@param object $record The record to extract from.
@param string $prefix The prefix used.
@return object | [
"Extract",
"a",
"record",
"from",
"another",
"one",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/classes/privacy/provider.php#L1073-L1082 |
217,079 | moodle/moodle | grade/classes/privacy/provider.php | provider.get_fields_sql | protected static function get_fields_sql($target, $alias, $prefix) {
switch ($target) {
case 'grade_category':
case 'grade_grade':
case 'grade_item':
case 'grade_outcome':
case 'grade_scale':
$obj = new $target([], false);
... | php | protected static function get_fields_sql($target, $alias, $prefix) {
switch ($target) {
case 'grade_category':
case 'grade_grade':
case 'grade_item':
case 'grade_outcome':
case 'grade_scale':
$obj = new $target([], false);
... | [
"protected",
"static",
"function",
"get_fields_sql",
"(",
"$",
"target",
",",
"$",
"alias",
",",
"$",
"prefix",
")",
"{",
"switch",
"(",
"$",
"target",
")",
"{",
"case",
"'grade_category'",
":",
"case",
"'grade_grade'",
":",
"case",
"'grade_item'",
":",
"c... | Get fields SQL for a grade related object.
@param string $target The related object.
@param string $alias The table alias.
@param string $prefix A prefix.
@return string | [
"Get",
"fields",
"SQL",
"for",
"a",
"grade",
"related",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/classes/privacy/provider.php#L1092-L1117 |
217,080 | moodle/moodle | grade/classes/privacy/provider.php | provider.get_item_ids_from_course_ids | protected static function get_item_ids_from_course_ids($courseids) {
global $DB;
if (empty($courseids)) {
return [];
}
list($insql, $inparams) = $DB->get_in_or_equal($courseids, SQL_PARAMS_NAMED);
return $DB->get_fieldset_select('grade_items', 'id', "courseid $insql",... | php | protected static function get_item_ids_from_course_ids($courseids) {
global $DB;
if (empty($courseids)) {
return [];
}
list($insql, $inparams) = $DB->get_in_or_equal($courseids, SQL_PARAMS_NAMED);
return $DB->get_fieldset_select('grade_items', 'id', "courseid $insql",... | [
"protected",
"static",
"function",
"get_item_ids_from_course_ids",
"(",
"$",
"courseids",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"courseids",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"list",
"(",
"$",
"insql",
",",
"$",
... | Get all the items IDs from course IDs.
@param array $courseids The course IDs.
@return array | [
"Get",
"all",
"the",
"items",
"IDs",
"from",
"course",
"IDs",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/classes/privacy/provider.php#L1125-L1132 |
217,081 | moodle/moodle | grade/classes/privacy/provider.php | provider.transform_grade | protected static function transform_grade(grade_grade $gg, context $context, bool $ishistory) {
$gi = $gg->load_grade_item();
$timemodified = $gg->timemodified ? transform::datetime($gg->timemodified) : null;
$timecreated = $gg->timecreated ? transform::datetime($gg->timecreated) : $timemodified... | php | protected static function transform_grade(grade_grade $gg, context $context, bool $ishistory) {
$gi = $gg->load_grade_item();
$timemodified = $gg->timemodified ? transform::datetime($gg->timemodified) : null;
$timecreated = $gg->timecreated ? transform::datetime($gg->timecreated) : $timemodified... | [
"protected",
"static",
"function",
"transform_grade",
"(",
"grade_grade",
"$",
"gg",
",",
"context",
"$",
"context",
",",
"bool",
"$",
"ishistory",
")",
"{",
"$",
"gi",
"=",
"$",
"gg",
"->",
"load_grade_item",
"(",
")",
";",
"$",
"timemodified",
"=",
"$"... | Transform a grade.
@param grade_grade $gg The grade object.
@param context $context The context.
@param bool $ishistory Whether we're extracting a historical grade.
@return array | [
"Transform",
"a",
"grade",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/classes/privacy/provider.php#L1195-L1226 |
217,082 | moodle/moodle | grade/classes/privacy/provider.php | provider.delete_files | protected static function delete_files(array $itemids, bool $ishistory, array $userids = null) {
global $DB;
list($iteminnsql, $params) = $DB->get_in_or_equal($itemids, SQL_PARAMS_NAMED);
if (!is_null($userids)) {
list($userinnsql, $userparams) = $DB->get_in_or_equal($userids, SQL_P... | php | protected static function delete_files(array $itemids, bool $ishistory, array $userids = null) {
global $DB;
list($iteminnsql, $params) = $DB->get_in_or_equal($itemids, SQL_PARAMS_NAMED);
if (!is_null($userids)) {
list($userinnsql, $userparams) = $DB->get_in_or_equal($userids, SQL_P... | [
"protected",
"static",
"function",
"delete_files",
"(",
"array",
"$",
"itemids",
",",
"bool",
"$",
"ishistory",
",",
"array",
"$",
"userids",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"list",
"(",
"$",
"iteminnsql",
",",
"$",
"params",
")",
"=",... | Handles deleting files for a given list of grade items.
If an array of userids if given then it handles deleting files for those users.
@param array $itemids
@param bool $ishistory
@param array|null $userids
@throws \coding_exception
@throws \dml_exception | [
"Handles",
"deleting",
"files",
"for",
"a",
"given",
"list",
"of",
"grade",
"items",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/classes/privacy/provider.php#L1239-L1279 |
217,083 | moodle/moodle | backup/moodle2/restore_plugin.class.php | restore_plugin.launch_after_restore_methods | public function launch_after_restore_methods() {
// Check if the after_restore method exists and launch it
$afterrestore = 'after_restore_' . basename($this->connectionpoint->get_path());
if (method_exists($this, $afterrestore)) {
$this->$afterrestore();
}
} | php | public function launch_after_restore_methods() {
// Check if the after_restore method exists and launch it
$afterrestore = 'after_restore_' . basename($this->connectionpoint->get_path());
if (method_exists($this, $afterrestore)) {
$this->$afterrestore();
}
} | [
"public",
"function",
"launch_after_restore_methods",
"(",
")",
"{",
"// Check if the after_restore method exists and launch it",
"$",
"afterrestore",
"=",
"'after_restore_'",
".",
"basename",
"(",
"$",
"this",
"->",
"connectionpoint",
"->",
"get_path",
"(",
")",
")",
"... | after_restore dispatcher for any restore_plugin class
This method will dispatch execution to the corresponding
after_restore_xxx() method when available, with xxx
being the connection point of the instance, so plugin
classes with multiple connection points will support
multiple after_restore methods, one for each conn... | [
"after_restore",
"dispatcher",
"for",
"any",
"restore_plugin",
"class"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/restore_plugin.class.php#L97-L103 |
217,084 | moodle/moodle | backup/moodle2/restore_plugin.class.php | restore_plugin.get_restore_decode_contents | static public function get_restore_decode_contents($plugintype) {
$decodecontents = array();
// Check the requested plugintype is a valid one
if (!array_key_exists($plugintype, core_component::get_plugin_types($plugintype))) {
throw new backup_step_exception('incorrect_plugin_type',... | php | static public function get_restore_decode_contents($plugintype) {
$decodecontents = array();
// Check the requested plugintype is a valid one
if (!array_key_exists($plugintype, core_component::get_plugin_types($plugintype))) {
throw new backup_step_exception('incorrect_plugin_type',... | [
"static",
"public",
"function",
"get_restore_decode_contents",
"(",
"$",
"plugintype",
")",
"{",
"$",
"decodecontents",
"=",
"array",
"(",
")",
";",
"// Check the requested plugintype is a valid one",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"plugintype",
",",
... | Returns one array with all the decode contents
to be processed by the links decoder
This method, given one plugin type, returns one
array of {@link restore_decode_content} objects
that will be added to the restore decoder in order
to perform modifications under the plugin contents.
The objects are retrieved by callin... | [
"Returns",
"one",
"array",
"with",
"all",
"the",
"decode",
"contents",
"to",
"be",
"processed",
"by",
"the",
"links",
"decoder"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/restore_plugin.class.php#L118-L148 |
217,085 | moodle/moodle | lib/mlbackend/php/phpml/src/Phpml/Helper/Optimizer/StochasticGD.php | StochasticGD.earlyStop | protected function earlyStop($oldTheta)
{
// Check for early stop: No change larger than threshold (default 1e-5)
$diff = array_map(
function ($w1, $w2) {
return abs($w1 - $w2) > $this->threshold ? 1 : 0;
},
$oldTheta, $this->theta);
if (a... | php | protected function earlyStop($oldTheta)
{
// Check for early stop: No change larger than threshold (default 1e-5)
$diff = array_map(
function ($w1, $w2) {
return abs($w1 - $w2) > $this->threshold ? 1 : 0;
},
$oldTheta, $this->theta);
if (a... | [
"protected",
"function",
"earlyStop",
"(",
"$",
"oldTheta",
")",
"{",
"// Check for early stop: No change larger than threshold (default 1e-5)",
"$",
"diff",
"=",
"array_map",
"(",
"function",
"(",
"$",
"w1",
",",
"$",
"w2",
")",
"{",
"return",
"abs",
"(",
"$",
... | Checks if the optimization is not effective enough and can be stopped
in case large enough changes in the solution do not happen
@param array $oldTheta
@return boolean | [
"Checks",
"if",
"the",
"optimization",
"is",
"not",
"effective",
"enough",
"and",
"can",
"be",
"stopped",
"in",
"case",
"large",
"enough",
"changes",
"in",
"the",
"solution",
"do",
"not",
"happen"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/phpml/src/Phpml/Helper/Optimizer/StochasticGD.php#L239-L259 |
217,086 | moodle/moodle | lib/form/select.php | MoodleQuickForm_select.removeOption | function removeOption($value)
{
$key=array_search($value, $this->_values);
if ($key!==FALSE and $key!==null) {
unset($this->_values[$key]);
}
foreach ($this->_options as $key=>$option){
if ($option['attr']['value']==$value){
unset($this->_optio... | php | function removeOption($value)
{
$key=array_search($value, $this->_values);
if ($key!==FALSE and $key!==null) {
unset($this->_values[$key]);
}
foreach ($this->_options as $key=>$option){
if ($option['attr']['value']==$value){
unset($this->_optio... | [
"function",
"removeOption",
"(",
"$",
"value",
")",
"{",
"$",
"key",
"=",
"array_search",
"(",
"$",
"value",
",",
"$",
"this",
"->",
"_values",
")",
";",
"if",
"(",
"$",
"key",
"!==",
"FALSE",
"and",
"$",
"key",
"!==",
"null",
")",
"{",
"unset",
... | Removes an OPTION from the SELECT
@param string $value Value for the OPTION to remove
@return void | [
"Removes",
"an",
"OPTION",
"from",
"the",
"SELECT"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/select.php#L120-L134 |
217,087 | moodle/moodle | question/type/match/backup/moodle1/lib.php | moodle1_qtype_match_handler.process_question | public function process_question(array $data, array $raw) {
global $CFG;
// Populate the list of matches first to get their ids.
// Note that the field is re-populated on restore anyway but let us
// do our best to produce valid backup files.
$matchids = array();
if (iss... | php | public function process_question(array $data, array $raw) {
global $CFG;
// Populate the list of matches first to get their ids.
// Note that the field is re-populated on restore anyway but let us
// do our best to produce valid backup files.
$matchids = array();
if (iss... | [
"public",
"function",
"process_question",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"raw",
")",
"{",
"global",
"$",
"CFG",
";",
"// Populate the list of matches first to get their ids.",
"// Note that the field is re-populated on restore anyway but let us",
"// do our best ... | Appends the match specific information to the question. | [
"Appends",
"the",
"match",
"specific",
"information",
"to",
"the",
"question",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/match/backup/moodle1/lib.php#L43-L85 |
217,088 | moodle/moodle | completion/completion_aggregation.php | completion_aggregation.setMethod | public function setMethod($method) {
$methods = array(
COMPLETION_AGGREGATION_ALL,
COMPLETION_AGGREGATION_ANY,
);
if (in_array($method, $methods)) {
$this->method = $method;
} else {
$this->method = COMPLETION_AGGREGATION_ALL;
}
... | php | public function setMethod($method) {
$methods = array(
COMPLETION_AGGREGATION_ALL,
COMPLETION_AGGREGATION_ANY,
);
if (in_array($method, $methods)) {
$this->method = $method;
} else {
$this->method = COMPLETION_AGGREGATION_ALL;
}
... | [
"public",
"function",
"setMethod",
"(",
"$",
"method",
")",
"{",
"$",
"methods",
"=",
"array",
"(",
"COMPLETION_AGGREGATION_ALL",
",",
"COMPLETION_AGGREGATION_ANY",
",",
")",
";",
"if",
"(",
"in_array",
"(",
"$",
"method",
",",
"$",
"methods",
")",
")",
"{... | Set the aggregation method
@param int $method One of COMPLETION_AGGREGATION_ALL or COMPLETION_AGGREGATION_ANY | [
"Set",
"the",
"aggregation",
"method"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/completion_aggregation.php#L92-L103 |
217,089 | moodle/moodle | lib/classes/progress/display_if_slow.php | display_if_slow.start_html | public function start_html() {
global $OUTPUT;
$this->id = 'core_progress_display_if_slow' . self::$nextid;
self::$nextid++;
// Containing div includes a CSS class so that it can be themed if required,
// and an id so it can be automatically hidden at end.
echo \html_wri... | php | public function start_html() {
global $OUTPUT;
$this->id = 'core_progress_display_if_slow' . self::$nextid;
self::$nextid++;
// Containing div includes a CSS class so that it can be themed if required,
// and an id so it can be automatically hidden at end.
echo \html_wri... | [
"public",
"function",
"start_html",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"this",
"->",
"id",
"=",
"'core_progress_display_if_slow'",
".",
"self",
"::",
"$",
"nextid",
";",
"self",
"::",
"$",
"nextid",
"++",
";",
"// Containing div includes a CSS c... | Starts displaying the progress bar, with optional heading and a special
div so it can be hidden later.
@see \core\progress\display::start_html() | [
"Starts",
"displaying",
"the",
"progress",
"bar",
"with",
"optional",
"heading",
"and",
"a",
"special",
"div",
"so",
"it",
"can",
"be",
"hidden",
"later",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/progress/display_if_slow.php#L80-L97 |
217,090 | moodle/moodle | lib/classes/progress/display_if_slow.php | display_if_slow.update_progress | public function update_progress() {
// If we haven't started yet, consider starting.
if ($this->starttime) {
if (time() > $this->starttime) {
$this->starttime = 0;
} else {
// Do nothing until start time.
return;
}
... | php | public function update_progress() {
// If we haven't started yet, consider starting.
if ($this->starttime) {
if (time() > $this->starttime) {
$this->starttime = 0;
} else {
// Do nothing until start time.
return;
}
... | [
"public",
"function",
"update_progress",
"(",
")",
"{",
"// If we haven't started yet, consider starting.",
"if",
"(",
"$",
"this",
"->",
"starttime",
")",
"{",
"if",
"(",
"time",
"(",
")",
">",
"$",
"this",
"->",
"starttime",
")",
"{",
"$",
"this",
"->",
... | When progress is updated, after a certain time, starts actually displaying
the progress bar.
@see \core\progress\base::update_progress() | [
"When",
"progress",
"is",
"updated",
"after",
"a",
"certain",
"time",
"starts",
"actually",
"displaying",
"the",
"progress",
"bar",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/progress/display_if_slow.php#L105-L118 |
217,091 | moodle/moodle | completion/classes/api.php | api.update_completion_date_event | public static function update_completion_date_event($cmid, $modulename, $instanceorid, $completionexpectedtime) {
global $CFG, $DB;
// Required for calendar constant CALENDAR_EVENT_TYPE_ACTION.
require_once($CFG->dirroot . '/calendar/lib.php');
$instance = null;
if (is_object($... | php | public static function update_completion_date_event($cmid, $modulename, $instanceorid, $completionexpectedtime) {
global $CFG, $DB;
// Required for calendar constant CALENDAR_EVENT_TYPE_ACTION.
require_once($CFG->dirroot . '/calendar/lib.php');
$instance = null;
if (is_object($... | [
"public",
"static",
"function",
"update_completion_date_event",
"(",
"$",
"cmid",
",",
"$",
"modulename",
",",
"$",
"instanceorid",
",",
"$",
"completionexpectedtime",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"// Required for calendar constant CALENDAR_E... | Creates, updates or deletes an event for the expected completion date.
@param int $cmid The course module id
@param string $modulename The name of the module (eg. assign, quiz)
@param \stdClass|int $instanceorid The instance object or ID.
@param int|null $completionexpectedtime The time completion is expected, null if... | [
"Creates",
"updates",
"or",
"deletes",
"an",
"event",
"for",
"the",
"expected",
"completion",
"date",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/classes/api.php#L52-L123 |
217,092 | moodle/moodle | lib/outputlib.php | theme_config.renderer_prefixes | public function renderer_prefixes() {
global $CFG; // just in case the included files need it
$prefixes = array('theme_'.$this->name);
foreach ($this->parent_configs as $parent) {
$prefixes[] = 'theme_'.$parent->name;
}
return $prefixes;
} | php | public function renderer_prefixes() {
global $CFG; // just in case the included files need it
$prefixes = array('theme_'.$this->name);
foreach ($this->parent_configs as $parent) {
$prefixes[] = 'theme_'.$parent->name;
}
return $prefixes;
} | [
"public",
"function",
"renderer_prefixes",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"// just in case the included files need it",
"$",
"prefixes",
"=",
"array",
"(",
"'theme_'",
".",
"$",
"this",
"->",
"name",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"p... | Returns output renderer prefixes, these are used when looking
for the overridden renderers in themes.
@return array | [
"Returns",
"output",
"renderer",
"prefixes",
"these",
"are",
"used",
"when",
"looking",
"for",
"the",
"overridden",
"renderers",
"in",
"themes",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L888-L898 |
217,093 | moodle/moodle | lib/outputlib.php | theme_config.editor_css_url | public function editor_css_url($encoded=true) {
global $CFG;
$rev = theme_get_revision();
if ($rev > -1) {
$themesubrevision = theme_get_sub_revision_for_theme($this->name);
// Provide the sub revision to allow us to invalidate cached theme CSS
// on a per th... | php | public function editor_css_url($encoded=true) {
global $CFG;
$rev = theme_get_revision();
if ($rev > -1) {
$themesubrevision = theme_get_sub_revision_for_theme($this->name);
// Provide the sub revision to allow us to invalidate cached theme CSS
// on a per th... | [
"public",
"function",
"editor_css_url",
"(",
"$",
"encoded",
"=",
"true",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"rev",
"=",
"theme_get_revision",
"(",
")",
";",
"if",
"(",
"$",
"rev",
">",
"-",
"1",
")",
"{",
"$",
"themesubrevision",
"=",
"theme_... | Returns the stylesheet URL of this editor content
@param bool $encoded false means use & and true use & in URLs
@return moodle_url | [
"Returns",
"the",
"stylesheet",
"URL",
"of",
"this",
"editor",
"content"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L906-L929 |
217,094 | moodle/moodle | lib/outputlib.php | theme_config.editor_css_files | public function editor_css_files() {
$files = array();
// First editor plugins.
$plugins = core_component::get_plugin_list('editor');
foreach ($plugins as $plugin=>$fulldir) {
$sheetfile = "$fulldir/editor_styles.css";
if (is_readable($sheetfile)) {
... | php | public function editor_css_files() {
$files = array();
// First editor plugins.
$plugins = core_component::get_plugin_list('editor');
foreach ($plugins as $plugin=>$fulldir) {
$sheetfile = "$fulldir/editor_styles.css";
if (is_readable($sheetfile)) {
... | [
"public",
"function",
"editor_css_files",
"(",
")",
"{",
"$",
"files",
"=",
"array",
"(",
")",
";",
"// First editor plugins.",
"$",
"plugins",
"=",
"core_component",
"::",
"get_plugin_list",
"(",
"'editor'",
")",
";",
"foreach",
"(",
"$",
"plugins",
"as",
"... | Returns the content of the CSS to be used in editor content
@return array | [
"Returns",
"the",
"content",
"of",
"the",
"CSS",
"to",
"be",
"used",
"in",
"editor",
"content"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L936-L970 |
217,095 | moodle/moodle | lib/outputlib.php | theme_config.editor_scss_to_css | public function editor_scss_to_css() {
$css = '';
if (!empty($this->editor_scss)) {
$compiler = new core_scss();
foreach ($this->editor_scss as $filename) {
$compiler->set_file("{$this->dir}/scss/{$filename}.scss");
try {
$cs... | php | public function editor_scss_to_css() {
$css = '';
if (!empty($this->editor_scss)) {
$compiler = new core_scss();
foreach ($this->editor_scss as $filename) {
$compiler->set_file("{$this->dir}/scss/{$filename}.scss");
try {
$cs... | [
"public",
"function",
"editor_scss_to_css",
"(",
")",
"{",
"$",
"css",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"editor_scss",
")",
")",
"{",
"$",
"compiler",
"=",
"new",
"core_scss",
"(",
")",
";",
"foreach",
"(",
"$",
"thi... | Compiles and returns the content of the SCSS to be used in editor content
@return string Compiled CSS from the editor SCSS | [
"Compiles",
"and",
"returns",
"the",
"content",
"of",
"the",
"SCSS",
"to",
"be",
"used",
"in",
"editor",
"content"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L977-L995 |
217,096 | moodle/moodle | lib/outputlib.php | theme_config.get_css_content | public function get_css_content() {
$csscontent = '';
foreach ($this->get_css_files(false) as $type => $value) {
foreach ($value as $identifier => $val) {
if (is_array($val)) {
foreach ($val as $v) {
$csscontent .= file_get_content... | php | public function get_css_content() {
$csscontent = '';
foreach ($this->get_css_files(false) as $type => $value) {
foreach ($value as $identifier => $val) {
if (is_array($val)) {
foreach ($val as $v) {
$csscontent .= file_get_content... | [
"public",
"function",
"get_css_content",
"(",
")",
"{",
"$",
"csscontent",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"get_css_files",
"(",
"false",
")",
"as",
"$",
"type",
"=>",
"$",
"value",
")",
"{",
"foreach",
"(",
"$",
"value",
"as",
"$"... | Get the whole css stylesheet for production mode.
NOTE: this method is not expected to be used from any addons.
@return string CSS markup compressed | [
"Get",
"the",
"whole",
"css",
"stylesheet",
"for",
"production",
"mode",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L1116-L1148 |
217,097 | moodle/moodle | lib/outputlib.php | theme_config.set_css_content_cache | public function set_css_content_cache($csscontent) {
$cache = cache::make('core', 'postprocessedcss');
$key = $this->get_css_cache_key();
return $cache->set($key, $csscontent);
} | php | public function set_css_content_cache($csscontent) {
$cache = cache::make('core', 'postprocessedcss');
$key = $this->get_css_cache_key();
return $cache->set($key, $csscontent);
} | [
"public",
"function",
"set_css_content_cache",
"(",
"$",
"csscontent",
")",
"{",
"$",
"cache",
"=",
"cache",
"::",
"make",
"(",
"'core'",
",",
"'postprocessedcss'",
")",
";",
"$",
"key",
"=",
"$",
"this",
"->",
"get_css_cache_key",
"(",
")",
";",
"return",... | Set post processed CSS content cache.
@param string $csscontent The post processed CSS content.
@return bool True if the content was successfully cached. | [
"Set",
"post",
"processed",
"CSS",
"content",
"cache",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L1155-L1161 |
217,098 | moodle/moodle | lib/outputlib.php | theme_config.has_css_cached_content | public function has_css_cached_content() {
$key = $this->get_css_cache_key();
$cache = cache::make('core', 'postprocessedcss');
return $cache->has($key);
} | php | public function has_css_cached_content() {
$key = $this->get_css_cache_key();
$cache = cache::make('core', 'postprocessedcss');
return $cache->has($key);
} | [
"public",
"function",
"has_css_cached_content",
"(",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"get_css_cache_key",
"(",
")",
";",
"$",
"cache",
"=",
"cache",
"::",
"make",
"(",
"'core'",
",",
"'postprocessedcss'",
")",
";",
"return",
"$",
"cache",
"... | Return whether the post processed CSS content has been cached.
@return bool Whether the post-processed CSS is available in the cache. | [
"Return",
"whether",
"the",
"post",
"processed",
"CSS",
"content",
"has",
"been",
"cached",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L1168-L1174 |
217,099 | moodle/moodle | lib/outputlib.php | theme_config.get_css_cached_content | public function get_css_cached_content() {
$key = $this->get_css_cache_key();
$cache = cache::make('core', 'postprocessedcss');
return $cache->get($key);
} | php | public function get_css_cached_content() {
$key = $this->get_css_cache_key();
$cache = cache::make('core', 'postprocessedcss');
return $cache->get($key);
} | [
"public",
"function",
"get_css_cached_content",
"(",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"get_css_cache_key",
"(",
")",
";",
"$",
"cache",
"=",
"cache",
"::",
"make",
"(",
"'core'",
",",
"'postprocessedcss'",
")",
";",
"return",
"$",
"cache",
"... | Return cached post processed CSS content.
@return bool|string The cached css content or false if not found. | [
"Return",
"cached",
"post",
"processed",
"CSS",
"content",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/outputlib.php#L1181-L1187 |
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.