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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
220,300 | moodle/moodle | admin/tool/usertours/classes/output/step.php | step.export_for_template | public function export_for_template(\renderer_base $output) {
global $PAGE;
$step = $this->step;
$result = (object) [
'stepid' => $step->get_id(),
'title' => external_format_text(
stepsource::get_string_from_input($step->get_title()),
... | php | public function export_for_template(\renderer_base $output) {
global $PAGE;
$step = $this->step;
$result = (object) [
'stepid' => $step->get_id(),
'title' => external_format_text(
stepsource::get_string_from_input($step->get_title()),
... | [
"public",
"function",
"export_for_template",
"(",
"\\",
"renderer_base",
"$",
"output",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"step",
"=",
"$",
"this",
"->",
"step",
";",
"$",
"result",
"=",
"(",
"object",
")",
"[",
"'stepid'",
"=>",
"$",
"step",
... | Export the step configuration.
@param renderer_base $output The renderer.
@return object | [
"Export",
"the",
"step",
"configuration",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/output/step.php#L59-L87 |
220,301 | moodle/moodle | grade/report/singleview/classes/local/screen/grade.php | grade.options | public function options() {
$options = array();
foreach ($this->items as $userid => $user) {
$options[$userid] = fullname($user);
}
return $options;
} | php | public function options() {
$options = array();
foreach ($this->items as $userid => $user) {
$options[$userid] = fullname($user);
}
return $options;
} | [
"public",
"function",
"options",
"(",
")",
"{",
"$",
"options",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as",
"$",
"userid",
"=>",
"$",
"user",
")",
"{",
"$",
"options",
"[",
"$",
"userid",
"]",
"=",
"fullname",
"... | Convert this list of items into an options list
@return array | [
"Convert",
"this",
"list",
"of",
"items",
"into",
"an",
"options",
"list"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/screen/grade.php#L95-L102 |
220,302 | moodle/moodle | grade/report/singleview/classes/local/screen/grade.php | grade.init | public function init($selfitemisempty = false) {
$this->items = $this->load_users();
$this->totalitemcount = count($this->items);
if ($selfitemisempty) {
return;
}
$params = array(
'id' => $this->itemid,
'courseid' => $this->courseid
... | php | public function init($selfitemisempty = false) {
$this->items = $this->load_users();
$this->totalitemcount = count($this->items);
if ($selfitemisempty) {
return;
}
$params = array(
'id' => $this->itemid,
'courseid' => $this->courseid
... | [
"public",
"function",
"init",
"(",
"$",
"selfitemisempty",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"items",
"=",
"$",
"this",
"->",
"load_users",
"(",
")",
";",
"$",
"this",
"->",
"totalitemcount",
"=",
"count",
"(",
"$",
"this",
"->",
"items",
")... | Init this page
@param bool $selfitemisempty True if we have not selected a user. | [
"Init",
"this",
"page"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/screen/grade.php#L131-L157 |
220,303 | moodle/moodle | grade/report/singleview/classes/local/screen/grade.php | grade.format_line | public function format_line($item) {
global $OUTPUT;
$grade = $this->fetch_grade_or_default($this->item, $item->id);
$lockicon = '';
$lockedgrade = $lockedgradeitem = 0;
if (!empty($grade->locked)) {
$lockedgrade = 1;
}
if (!empty($grade->grade_item... | php | public function format_line($item) {
global $OUTPUT;
$grade = $this->fetch_grade_or_default($this->item, $item->id);
$lockicon = '';
$lockedgrade = $lockedgradeitem = 0;
if (!empty($grade->locked)) {
$lockedgrade = 1;
}
if (!empty($grade->grade_item... | [
"public",
"function",
"format_line",
"(",
"$",
"item",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"grade",
"=",
"$",
"this",
"->",
"fetch_grade_or_default",
"(",
"$",
"this",
"->",
"item",
",",
"$",
"item",
"->",
"id",
")",
";",
"$",
"lockicon",
"=... | Format a row in the table
@param user $item
@return string | [
"Format",
"a",
"row",
"in",
"the",
"table"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/screen/grade.php#L182-L239 |
220,304 | moodle/moodle | grade/report/singleview/classes/local/screen/grade.php | grade.item_range | public function item_range() {
if (empty($this->range)) {
$this->range = new range($this->item);
}
return $this->range;
} | php | public function item_range() {
if (empty($this->range)) {
$this->range = new range($this->item);
}
return $this->range;
} | [
"public",
"function",
"item_range",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"range",
")",
")",
"{",
"$",
"this",
"->",
"range",
"=",
"new",
"range",
"(",
"$",
"this",
"->",
"item",
")",
";",
"}",
"return",
"$",
"this",
"->",
... | Get the range ui element for this grade_item
@return element; | [
"Get",
"the",
"range",
"ui",
"element",
"for",
"this",
"grade_item"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/screen/grade.php#L246-L252 |
220,305 | moodle/moodle | grade/report/singleview/classes/local/screen/grade.php | grade.pager | public function pager() {
global $OUTPUT;
return $OUTPUT->paging_bar(
$this->totalitemcount, $this->page, $this->perpage,
new moodle_url('/grade/report/singleview/index.php', array(
'perpage' => $this->perpage,
'id' => $this->courseid,
... | php | public function pager() {
global $OUTPUT;
return $OUTPUT->paging_bar(
$this->totalitemcount, $this->page, $this->perpage,
new moodle_url('/grade/report/singleview/index.php', array(
'perpage' => $this->perpage,
'id' => $this->courseid,
... | [
"public",
"function",
"pager",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"return",
"$",
"OUTPUT",
"->",
"paging_bar",
"(",
"$",
"this",
"->",
"totalitemcount",
",",
"$",
"this",
"->",
"page",
",",
"$",
"this",
"->",
"perpage",
",",
"new",
"moodle_ur... | Get the pager for this page.
@return string | [
"Get",
"the",
"pager",
"for",
"this",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/screen/grade.php#L268-L281 |
220,306 | moodle/moodle | mod/lti/service/gradebookservices/classes/local/resources/lineitem.php | lineitem.get_request | private function get_request($response, $item, $typeid) {
$response->set_content_type($this->formats[0]);
$lineitem = gradebookservices::item_for_json($item, substr(parent::get_endpoint(),
0, strrpos(parent::get_endpoint(), "/", -10)), $typeid);
$response->set_body(json_encode($... | php | private function get_request($response, $item, $typeid) {
$response->set_content_type($this->formats[0]);
$lineitem = gradebookservices::item_for_json($item, substr(parent::get_endpoint(),
0, strrpos(parent::get_endpoint(), "/", -10)), $typeid);
$response->set_body(json_encode($... | [
"private",
"function",
"get_request",
"(",
"$",
"response",
",",
"$",
"item",
",",
"$",
"typeid",
")",
"{",
"$",
"response",
"->",
"set_content_type",
"(",
"$",
"this",
"->",
"formats",
"[",
"0",
"]",
")",
";",
"$",
"lineitem",
"=",
"gradebookservices",
... | Process a GET request.
@param \mod_lti\local\ltiservice\response $response Response object for this request.
@param object $item Grade item instance.
@param string $typeid Tool Type Id | [
"Process",
"a",
"GET",
"request",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/service/gradebookservices/classes/local/resources/lineitem.php#L161-L168 |
220,307 | moodle/moodle | mod/lti/service/gradebookservices/classes/local/resources/lineitem.php | lineitem.process_delete_request | private function process_delete_request($item) {
global $DB;
$gradeitem = \grade_item::fetch(array('id' => $item->id));
if (($gbs = gradebookservices::find_ltiservice_gradebookservice_for_lineitem($item->id)) == false) {
throw new \Exception(null, 403);
}
if (!$grade... | php | private function process_delete_request($item) {
global $DB;
$gradeitem = \grade_item::fetch(array('id' => $item->id));
if (($gbs = gradebookservices::find_ltiservice_gradebookservice_for_lineitem($item->id)) == false) {
throw new \Exception(null, 403);
}
if (!$grade... | [
"private",
"function",
"process_delete_request",
"(",
"$",
"item",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"gradeitem",
"=",
"\\",
"grade_item",
"::",
"fetch",
"(",
"array",
"(",
"'id'",
"=>",
"$",
"item",
"->",
"id",
")",
")",
";",
"if",
"(",
"(",
... | Process a DELETE request.
@param \ltiservice_gradebookservices\local\resources\lineitem $item Grade item instance
@throws \Exception | [
"Process",
"a",
"DELETE",
"request",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lti/service/gradebookservices/classes/local/resources/lineitem.php#L301-L317 |
220,308 | moodle/moodle | enrol/self/lib.php | enrol_self_plugin.enrol_self | public function enrol_self(stdClass $instance, $data = null) {
global $DB, $USER, $CFG;
// Don't enrol user if password is not passed when required.
if ($instance->password && !isset($data->enrolpassword)) {
return;
}
$timestart = time();
if ($instance->enro... | php | public function enrol_self(stdClass $instance, $data = null) {
global $DB, $USER, $CFG;
// Don't enrol user if password is not passed when required.
if ($instance->password && !isset($data->enrolpassword)) {
return;
}
$timestart = time();
if ($instance->enro... | [
"public",
"function",
"enrol_self",
"(",
"stdClass",
"$",
"instance",
",",
"$",
"data",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
",",
"$",
"CFG",
";",
"// Don't enrol user if password is not passed when required.",
"if",
"(",
"$",
"instanc... | Self enrol user to course
@param stdClass $instance enrolment instance
@param stdClass $data data needed for enrolment.
@return bool|array true if enroled else eddor code and messege | [
"Self",
"enrol",
"user",
"to",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/self/lib.php#L143-L179 |
220,309 | moodle/moodle | enrol/self/lib.php | enrol_self_plugin.can_self_enrol | public function can_self_enrol(stdClass $instance, $checkuserenrolment = true) {
global $CFG, $DB, $OUTPUT, $USER;
if ($checkuserenrolment) {
if (isguestuser()) {
// Can not enrol guest.
return get_string('noguestaccess', 'enrol') . $OUTPUT->continue_button(g... | php | public function can_self_enrol(stdClass $instance, $checkuserenrolment = true) {
global $CFG, $DB, $OUTPUT, $USER;
if ($checkuserenrolment) {
if (isguestuser()) {
// Can not enrol guest.
return get_string('noguestaccess', 'enrol') . $OUTPUT->continue_button(g... | [
"public",
"function",
"can_self_enrol",
"(",
"stdClass",
"$",
"instance",
",",
"$",
"checkuserenrolment",
"=",
"true",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
",",
"$",
"OUTPUT",
",",
"$",
"USER",
";",
"if",
"(",
"$",
"checkuserenrolment",
")",
... | Checks if user can self enrol.
@param stdClass $instance enrolment instance
@param bool $checkuserenrolment if true will check if user enrolment is inactive.
used by navigation to improve performance.
@return bool|string true if successful, else error message or false. | [
"Checks",
"if",
"user",
"can",
"self",
"enrol",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/self/lib.php#L231-L288 |
220,310 | moodle/moodle | enrol/self/lib.php | enrol_self_plugin.get_instance_defaults | public function get_instance_defaults() {
$expirynotify = $this->get_config('expirynotify');
if ($expirynotify == 2) {
$expirynotify = 1;
$notifyall = 1;
} else {
$notifyall = 0;
}
$fields = array();
$fields['status'] = $this-... | php | public function get_instance_defaults() {
$expirynotify = $this->get_config('expirynotify');
if ($expirynotify == 2) {
$expirynotify = 1;
$notifyall = 1;
} else {
$notifyall = 0;
}
$fields = array();
$fields['status'] = $this-... | [
"public",
"function",
"get_instance_defaults",
"(",
")",
"{",
"$",
"expirynotify",
"=",
"$",
"this",
"->",
"get_config",
"(",
"'expirynotify'",
")",
";",
"if",
"(",
"$",
"expirynotify",
"==",
"2",
")",
"{",
"$",
"expirynotify",
"=",
"1",
";",
"$",
"notif... | Returns defaults for new instances.
@return array | [
"Returns",
"defaults",
"for",
"new",
"instances",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/self/lib.php#L337-L361 |
220,311 | moodle/moodle | enrol/self/lib.php | enrol_self_plugin.email_welcome_message | protected function email_welcome_message($instance, $user) {
global $CFG, $DB;
$course = $DB->get_record('course', array('id'=>$instance->courseid), '*', MUST_EXIST);
$context = context_course::instance($course->id);
$a = new stdClass();
$a->coursename = format_string($course->... | php | protected function email_welcome_message($instance, $user) {
global $CFG, $DB;
$course = $DB->get_record('course', array('id'=>$instance->courseid), '*', MUST_EXIST);
$context = context_course::instance($course->id);
$a = new stdClass();
$a->coursename = format_string($course->... | [
"protected",
"function",
"email_welcome_message",
"(",
"$",
"instance",
",",
"$",
"user",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"$",
"course",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'course'",
",",
"array",
"(",
"'id'",
"=>",
"$",
"... | Send welcome email to specified user.
@param stdClass $instance
@param stdClass $user user record
@return void | [
"Send",
"welcome",
"email",
"to",
"specified",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/self/lib.php#L370-L406 |
220,312 | moodle/moodle | enrol/self/lib.php | enrol_self_plugin.get_enroller | protected function get_enroller($instanceid) {
global $DB;
if ($this->lasternollerinstanceid == $instanceid and $this->lasternoller) {
return $this->lasternoller;
}
$instance = $DB->get_record('enrol', array('id'=>$instanceid, 'enrol'=>$this->get_name()), '*', MUST_EXIST);
... | php | protected function get_enroller($instanceid) {
global $DB;
if ($this->lasternollerinstanceid == $instanceid and $this->lasternoller) {
return $this->lasternoller;
}
$instance = $DB->get_record('enrol', array('id'=>$instanceid, 'enrol'=>$this->get_name()), '*', MUST_EXIST);
... | [
"protected",
"function",
"get_enroller",
"(",
"$",
"instanceid",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"this",
"->",
"lasternollerinstanceid",
"==",
"$",
"instanceid",
"and",
"$",
"this",
"->",
"lasternoller",
")",
"{",
"return",
"$",
"this",... | Returns the user who is responsible for self enrolments in given instance.
Usually it is the first editing teacher - the person with "highest authority"
as defined by sort_by_roleassignment_authority() having 'enrol/self:manage'
capability.
@param int $instanceid enrolment instance id
@return stdClass user record | [
"Returns",
"the",
"user",
"who",
"is",
"responsible",
"for",
"self",
"enrolments",
"in",
"given",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/self/lib.php#L491-L512 |
220,313 | moodle/moodle | enrol/self/lib.php | enrol_self_plugin.get_longtimenosee_options | protected function get_longtimenosee_options() {
$options = array(0 => get_string('never'),
1800 * 3600 * 24 => get_string('numdays', '', 1800),
1000 * 3600 * 24 => get_string('numdays', '', 1000),
365 * 3600 * 24 => get_string('numdays'... | php | protected function get_longtimenosee_options() {
$options = array(0 => get_string('never'),
1800 * 3600 * 24 => get_string('numdays', '', 1800),
1000 * 3600 * 24 => get_string('numdays', '', 1000),
365 * 3600 * 24 => get_string('numdays'... | [
"protected",
"function",
"get_longtimenosee_options",
"(",
")",
"{",
"$",
"options",
"=",
"array",
"(",
"0",
"=>",
"get_string",
"(",
"'never'",
")",
",",
"1800",
"*",
"3600",
"*",
"24",
"=>",
"get_string",
"(",
"'numdays'",
",",
"''",
",",
"1800",
")",
... | Return an array of valid options for the longtimenosee property.
@return array | [
"Return",
"an",
"array",
"of",
"valid",
"options",
"for",
"the",
"longtimenosee",
"property",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/self/lib.php#L670-L685 |
220,314 | moodle/moodle | enrol/self/lib.php | enrol_self_plugin.get_bulk_operations | public function get_bulk_operations(course_enrolment_manager $manager) {
global $CFG;
require_once($CFG->dirroot.'/enrol/self/locallib.php');
$context = $manager->get_context();
$bulkoperations = array();
if (has_capability("enrol/self:manage", $context)) {
$bulkopera... | php | public function get_bulk_operations(course_enrolment_manager $manager) {
global $CFG;
require_once($CFG->dirroot.'/enrol/self/locallib.php');
$context = $manager->get_context();
$bulkoperations = array();
if (has_capability("enrol/self:manage", $context)) {
$bulkopera... | [
"public",
"function",
"get_bulk_operations",
"(",
"course_enrolment_manager",
"$",
"manager",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/enrol/self/locallib.php'",
")",
";",
"$",
"context",
"=",
"$",
"manager",... | The self enrollment plugin has several bulk operations that can be performed.
@param course_enrolment_manager $manager
@return array | [
"The",
"self",
"enrollment",
"plugin",
"has",
"several",
"bulk",
"operations",
"that",
"can",
"be",
"performed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/self/lib.php#L692-L704 |
220,315 | moodle/moodle | enrol/self/lib.php | enrol_self_plugin.extend_assignable_roles | public function extend_assignable_roles($context, $defaultrole) {
global $DB;
$roles = get_assignable_roles($context, ROLENAME_BOTH);
if (!isset($roles[$defaultrole])) {
if ($role = $DB->get_record('role', array('id' => $defaultrole))) {
$roles[$defaultrole] = role_g... | php | public function extend_assignable_roles($context, $defaultrole) {
global $DB;
$roles = get_assignable_roles($context, ROLENAME_BOTH);
if (!isset($roles[$defaultrole])) {
if ($role = $DB->get_record('role', array('id' => $defaultrole))) {
$roles[$defaultrole] = role_g... | [
"public",
"function",
"extend_assignable_roles",
"(",
"$",
"context",
",",
"$",
"defaultrole",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"roles",
"=",
"get_assignable_roles",
"(",
"$",
"context",
",",
"ROLENAME_BOTH",
")",
";",
"if",
"(",
"!",
"isset",
"(",... | Gets a list of roles that this user can assign for the course as the default for self-enrolment.
@param context $context the context.
@param integer $defaultrole the id of the role that is set as the default for self-enrolment
@return array index is the role id, value is the role name | [
"Gets",
"a",
"list",
"of",
"roles",
"that",
"this",
"user",
"can",
"assign",
"for",
"the",
"course",
"as",
"the",
"default",
"for",
"self",
"-",
"enrolment",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/self/lib.php#L983-L993 |
220,316 | moodle/moodle | enrol/self/lib.php | enrol_self_plugin.get_welcome_email_contact | public function get_welcome_email_contact($sendoption, $context) {
global $CFG;
$contact = null;
// Send as the first user assigned as the course contact.
if ($sendoption == ENROL_SEND_EMAIL_FROM_COURSE_CONTACT) {
$rusers = array();
if (!empty($CFG->coursecontact... | php | public function get_welcome_email_contact($sendoption, $context) {
global $CFG;
$contact = null;
// Send as the first user assigned as the course contact.
if ($sendoption == ENROL_SEND_EMAIL_FROM_COURSE_CONTACT) {
$rusers = array();
if (!empty($CFG->coursecontact... | [
"public",
"function",
"get_welcome_email_contact",
"(",
"$",
"sendoption",
",",
"$",
"context",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"contact",
"=",
"null",
";",
"// Send as the first user assigned as the course contact.",
"if",
"(",
"$",
"sendoption",
"==",
... | Get the "from" contact which the email will be sent from.
@param int $sendoption send email from constant ENROL_SEND_EMAIL_FROM_*
@param $context context where the user will be fetched
@return mixed|stdClass the contact user object. | [
"Get",
"the",
"from",
"contact",
"which",
"the",
"email",
"will",
"be",
"sent",
"from",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/self/lib.php#L1002-L1040 |
220,317 | moodle/moodle | auth/manual/auth.php | auth_plugin_manual.password_expire | public function password_expire($username) {
$result = 0;
if (!empty($this->config->expirationtime)) {
$user = core_user::get_user_by_username($username, 'id,timecreated');
$lastpasswordupdatetime = get_user_preferences('auth_manual_passwordupdatetime', $user->timecreated, $user... | php | public function password_expire($username) {
$result = 0;
if (!empty($this->config->expirationtime)) {
$user = core_user::get_user_by_username($username, 'id,timecreated');
$lastpasswordupdatetime = get_user_preferences('auth_manual_passwordupdatetime', $user->timecreated, $user... | [
"public",
"function",
"password_expire",
"(",
"$",
"username",
")",
"{",
"$",
"result",
"=",
"0",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"config",
"->",
"expirationtime",
")",
")",
"{",
"$",
"user",
"=",
"core_user",
"::",
"get_user_by_u... | Return number of days to user password expires.
If user password does not expire, it should return 0 or a positive value.
If user password is already expired, it should return negative value.
@param mixed $username username (with system magic quotes)
@return integer | [
"Return",
"number",
"of",
"days",
"to",
"user",
"password",
"expires",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/manual/auth.php#L169-L186 |
220,318 | moodle/moodle | auth/manual/auth.php | auth_plugin_manual.user_confirm | function user_confirm($username, $confirmsecret = null) {
global $DB;
$user = get_complete_user_data('username', $username);
if (!empty($user)) {
if ($user->confirmed) {
return AUTH_CONFIRM_ALREADY;
} else {
$DB->set_field("user", "confir... | php | function user_confirm($username, $confirmsecret = null) {
global $DB;
$user = get_complete_user_data('username', $username);
if (!empty($user)) {
if ($user->confirmed) {
return AUTH_CONFIRM_ALREADY;
} else {
$DB->set_field("user", "confir... | [
"function",
"user_confirm",
"(",
"$",
"username",
",",
"$",
"confirmsecret",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"user",
"=",
"get_complete_user_data",
"(",
"'username'",
",",
"$",
"username",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"... | Confirm the new user as registered. This should normally not be used,
but it may be necessary if the user auth_method is changed to manual
before the user is confirmed.
@param string $username
@param string $confirmsecret | [
"Confirm",
"the",
"new",
"user",
"as",
"registered",
".",
"This",
"should",
"normally",
"not",
"be",
"used",
"but",
"it",
"may",
"be",
"necessary",
"if",
"the",
"user",
"auth_method",
"is",
"changed",
"to",
"manual",
"before",
"the",
"user",
"is",
"confirm... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/manual/auth.php#L196-L211 |
220,319 | moodle/moodle | mod/quiz/report/attemptsreport.php | quiz_attempts_report.init | protected function init($mode, $formclass, $quiz, $cm, $course) {
$this->mode = $mode;
$this->context = context_module::instance($cm->id);
list($currentgroup, $studentsjoins, $groupstudentsjoins, $allowedjoins) = $this->get_students_joins(
$cm, $course);
$this->qmsubse... | php | protected function init($mode, $formclass, $quiz, $cm, $course) {
$this->mode = $mode;
$this->context = context_module::instance($cm->id);
list($currentgroup, $studentsjoins, $groupstudentsjoins, $allowedjoins) = $this->get_students_joins(
$cm, $course);
$this->qmsubse... | [
"protected",
"function",
"init",
"(",
"$",
"mode",
",",
"$",
"formclass",
",",
"$",
"quiz",
",",
"$",
"cm",
",",
"$",
"course",
")",
"{",
"$",
"this",
"->",
"mode",
"=",
"$",
"mode",
";",
"$",
"this",
"->",
"context",
"=",
"context_module",
"::",
... | Initialise various aspects of this report.
@param string $mode
@param string $formclass
@param object $quiz
@param object $cm
@param object $course
@return array with four elements:
0 => integer the current group id (0 for none).
1 => \core\dml\sql_join Contains joins, wheres, params for all the students in this cours... | [
"Initialise",
"various",
"aspects",
"of",
"this",
"report",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/attemptsreport.php#L82-L96 |
220,320 | moodle/moodle | mod/quiz/report/attemptsreport.php | quiz_attempts_report.print_standard_header_and_messages | protected function print_standard_header_and_messages($cm, $course, $quiz,
$options, $currentgroup, $hasquestions, $hasstudents) {
global $OUTPUT;
$this->print_header_and_tabs($cm, $course, $quiz, $this->mode);
if (groups_get_activity_groupmode($cm)) {
// Groups are bei... | php | protected function print_standard_header_and_messages($cm, $course, $quiz,
$options, $currentgroup, $hasquestions, $hasstudents) {
global $OUTPUT;
$this->print_header_and_tabs($cm, $course, $quiz, $this->mode);
if (groups_get_activity_groupmode($cm)) {
// Groups are bei... | [
"protected",
"function",
"print_standard_header_and_messages",
"(",
"$",
"cm",
",",
"$",
"course",
",",
"$",
"quiz",
",",
"$",
"options",
",",
"$",
"currentgroup",
",",
"$",
"hasquestions",
",",
"$",
"hasstudents",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"... | Outputs the things you commonly want at the top of a quiz report.
Calls through to {@link print_header_and_tabs()} and then
outputs the standard group selector, number of attempts summary,
and messages to cover common cases when the report can't be shown.
@param stdClass $cm the course_module information.
@param stdC... | [
"Outputs",
"the",
"things",
"you",
"commonly",
"want",
"at",
"the",
"top",
"of",
"a",
"quiz",
"report",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/attemptsreport.php#L156-L181 |
220,321 | moodle/moodle | mod/quiz/report/attemptsreport.php | quiz_attempts_report.configure_user_columns | protected function configure_user_columns($table) {
$table->column_suppress('picture');
$table->column_suppress('fullname');
$extrafields = get_extra_user_fields($this->context);
foreach ($extrafields as $field) {
$table->column_suppress($field);
}
$table->co... | php | protected function configure_user_columns($table) {
$table->column_suppress('picture');
$table->column_suppress('fullname');
$extrafields = get_extra_user_fields($this->context);
foreach ($extrafields as $field) {
$table->column_suppress($field);
}
$table->co... | [
"protected",
"function",
"configure_user_columns",
"(",
"$",
"table",
")",
"{",
"$",
"table",
"->",
"column_suppress",
"(",
"'picture'",
")",
";",
"$",
"table",
"->",
"column_suppress",
"(",
"'fullname'",
")",
";",
"$",
"extrafields",
"=",
"get_extra_user_fields... | Set the display options for the user-related columns in the table.
@param table_sql $table the table being constructed. | [
"Set",
"the",
"display",
"options",
"for",
"the",
"user",
"-",
"related",
"columns",
"in",
"the",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/attemptsreport.php#L216-L228 |
220,322 | moodle/moodle | mod/quiz/report/attemptsreport.php | quiz_attempts_report.set_up_table_columns | protected function set_up_table_columns($table, $columns, $headers, $reporturl,
mod_quiz_attempts_report_options $options, $collapsible) {
$table->define_columns($columns);
$table->define_headers($headers);
$table->sortable(true, 'uniqueid');
$table->define_baseurl($options-... | php | protected function set_up_table_columns($table, $columns, $headers, $reporturl,
mod_quiz_attempts_report_options $options, $collapsible) {
$table->define_columns($columns);
$table->define_headers($headers);
$table->sortable(true, 'uniqueid');
$table->define_baseurl($options-... | [
"protected",
"function",
"set_up_table_columns",
"(",
"$",
"table",
",",
"$",
"columns",
",",
"$",
"headers",
",",
"$",
"reporturl",
",",
"mod_quiz_attempts_report_options",
"$",
"options",
",",
"$",
"collapsible",
")",
"{",
"$",
"table",
"->",
"define_columns",... | Set up the table.
@param table_sql $table the table being constructed.
@param array $columns the list of columns.
@param array $headers the columns headings.
@param moodle_url $reporturl the URL of this report.
@param mod_quiz_attempts_report_options $options the display options.
@param bool $collapsible whether to all... | [
"Set",
"up",
"the",
"table",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/attemptsreport.php#L287-L303 |
220,323 | moodle/moodle | mod/quiz/report/attemptsreport.php | quiz_attempts_report.process_actions | protected function process_actions($quiz, $cm, $currentgroup, \core\dml\sql_join $groupstudentsjoins,
\core\dml\sql_join $allowedjoins, $redirecturl) {
if (empty($currentgroup) || $this->hasgroupstudents) {
if (optional_param('delete', 0, PARAM_BOOL) && confirm_sesskey()) {
... | php | protected function process_actions($quiz, $cm, $currentgroup, \core\dml\sql_join $groupstudentsjoins,
\core\dml\sql_join $allowedjoins, $redirecturl) {
if (empty($currentgroup) || $this->hasgroupstudents) {
if (optional_param('delete', 0, PARAM_BOOL) && confirm_sesskey()) {
... | [
"protected",
"function",
"process_actions",
"(",
"$",
"quiz",
",",
"$",
"cm",
",",
"$",
"currentgroup",
",",
"\\",
"core",
"\\",
"dml",
"\\",
"sql_join",
"$",
"groupstudentsjoins",
",",
"\\",
"core",
"\\",
"dml",
"\\",
"sql_join",
"$",
"allowedjoins",
",",... | Process any submitted actions.
@param object $quiz the quiz settings.
@param object $cm the cm object for the quiz.
@param int $currentgroup the currently selected group.
@param \core\dml\sql_join $groupstudentsjoins (joins, wheres, params) the students in the current group.
@param \core\dml\sql_join $allowedjoins (joi... | [
"Process",
"any",
"submitted",
"actions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/attemptsreport.php#L314-L325 |
220,324 | moodle/moodle | mod/quiz/report/attemptsreport.php | quiz_attempts_report.delete_selected_attempts | protected function delete_selected_attempts($quiz, $cm, $attemptids, \core\dml\sql_join $allowedjoins) {
global $DB;
foreach ($attemptids as $attemptid) {
if (empty($allowedjoins->joins)) {
$sql = "SELECT quiza.*
FROM {quiz_attempts} quiza
... | php | protected function delete_selected_attempts($quiz, $cm, $attemptids, \core\dml\sql_join $allowedjoins) {
global $DB;
foreach ($attemptids as $attemptid) {
if (empty($allowedjoins->joins)) {
$sql = "SELECT quiza.*
FROM {quiz_attempts} quiza
... | [
"protected",
"function",
"delete_selected_attempts",
"(",
"$",
"quiz",
",",
"$",
"cm",
",",
"$",
"attemptids",
",",
"\\",
"core",
"\\",
"dml",
"\\",
"sql_join",
"$",
"allowedjoins",
")",
"{",
"global",
"$",
"DB",
";",
"foreach",
"(",
"$",
"attemptids",
"... | Delete the quiz attempts
@param object $quiz the quiz settings. Attempts that don't belong to
this quiz are not deleted.
@param object $cm the course_module object.
@param array $attemptids the list of attempt ids to delete.
@param \core\dml\sql_join $allowedjoins (joins, wheres, params) This list of userids that are v... | [
"Delete",
"the",
"quiz",
"attempts"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/report/attemptsreport.php#L337-L365 |
220,325 | moodle/moodle | admin/classes/task_log_table.php | task_log_table.col_classname | public function col_classname($row) : string {
$output = '';
if (class_exists($row->classname)) {
$task = new $row->classname;
if ($task instanceof \core\task\scheduled_task) {
$output = $task->get_name();
}
}
$output .= \html_writer::... | php | public function col_classname($row) : string {
$output = '';
if (class_exists($row->classname)) {
$task = new $row->classname;
if ($task instanceof \core\task\scheduled_task) {
$output = $task->get_name();
}
}
$output .= \html_writer::... | [
"public",
"function",
"col_classname",
"(",
"$",
"row",
")",
":",
"string",
"{",
"$",
"output",
"=",
"''",
";",
"if",
"(",
"class_exists",
"(",
"$",
"row",
"->",
"classname",
")",
")",
"{",
"$",
"task",
"=",
"new",
"$",
"row",
"->",
"classname",
";... | Format the name cell.
@param \stdClass $row
@return string | [
"Format",
"the",
"name",
"cell",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/classes/task_log_table.php#L157-L170 |
220,326 | moodle/moodle | admin/classes/task_log_table.php | task_log_table.col_type | public function col_type($row) : string {
if (\core\task\database_logger::TYPE_SCHEDULED == $row->type) {
return get_string('task_type:scheduled', 'admin');
} else {
return get_string('task_type:adhoc', 'admin');
}
} | php | public function col_type($row) : string {
if (\core\task\database_logger::TYPE_SCHEDULED == $row->type) {
return get_string('task_type:scheduled', 'admin');
} else {
return get_string('task_type:adhoc', 'admin');
}
} | [
"public",
"function",
"col_type",
"(",
"$",
"row",
")",
":",
"string",
"{",
"if",
"(",
"\\",
"core",
"\\",
"task",
"\\",
"database_logger",
"::",
"TYPE_SCHEDULED",
"==",
"$",
"row",
"->",
"type",
")",
"{",
"return",
"get_string",
"(",
"'task_type:scheduled... | Format the type cell.
@param \stdClass $row
@return string | [
"Format",
"the",
"type",
"cell",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/classes/task_log_table.php#L178-L184 |
220,327 | moodle/moodle | admin/classes/task_log_table.php | task_log_table.col_duration | public function col_duration($row) : string {
$duration = round($row->timeend - $row->timestart, 2);
if (empty($duration)) {
// The format_time function returns 'now' when the difference is exactly 0.
// Note: format_time performs concatenation in exactly this fashion so we shou... | php | public function col_duration($row) : string {
$duration = round($row->timeend - $row->timestart, 2);
if (empty($duration)) {
// The format_time function returns 'now' when the difference is exactly 0.
// Note: format_time performs concatenation in exactly this fashion so we shou... | [
"public",
"function",
"col_duration",
"(",
"$",
"row",
")",
":",
"string",
"{",
"$",
"duration",
"=",
"round",
"(",
"$",
"row",
"->",
"timeend",
"-",
"$",
"row",
"->",
"timestart",
",",
"2",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"duration",
")",
... | Format the duration cell.
@param \stdClass $row
@return string | [
"Format",
"the",
"duration",
"cell",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/classes/task_log_table.php#L216-L226 |
220,328 | moodle/moodle | admin/classes/task_log_table.php | task_log_table.col_db | public function col_db($row) : string {
$output = '';
$output .= \html_writer::div(get_string('task_stats:dbreads', 'admin', $row->dbreads));
$output .= \html_writer::div(get_string('task_stats:dbwrites', 'admin', $row->dbwrites));
return $output;
} | php | public function col_db($row) : string {
$output = '';
$output .= \html_writer::div(get_string('task_stats:dbreads', 'admin', $row->dbreads));
$output .= \html_writer::div(get_string('task_stats:dbwrites', 'admin', $row->dbwrites));
return $output;
} | [
"public",
"function",
"col_db",
"(",
"$",
"row",
")",
":",
"string",
"{",
"$",
"output",
"=",
"''",
";",
"$",
"output",
".=",
"\\",
"html_writer",
"::",
"div",
"(",
"get_string",
"(",
"'task_stats:dbreads'",
",",
"'admin'",
",",
"$",
"row",
"->",
"dbre... | Format the DB details cell.
@param \stdClass $row
@return string | [
"Format",
"the",
"DB",
"details",
"cell",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/classes/task_log_table.php#L234-L241 |
220,329 | moodle/moodle | admin/classes/task_log_table.php | task_log_table.col_actions | public function col_actions($row) : string {
global $OUTPUT;
$actions = [];
$url = new \moodle_url('/admin/tasklogs.php', ['logid' => $row->id]);
// Quick view.
$actions[] = $OUTPUT->action_icon(
$url,
new \pix_icon('e/search', get_string('view')),
... | php | public function col_actions($row) : string {
global $OUTPUT;
$actions = [];
$url = new \moodle_url('/admin/tasklogs.php', ['logid' => $row->id]);
// Quick view.
$actions[] = $OUTPUT->action_icon(
$url,
new \pix_icon('e/search', get_string('view')),
... | [
"public",
"function",
"col_actions",
"(",
"$",
"row",
")",
":",
"string",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"actions",
"=",
"[",
"]",
";",
"$",
"url",
"=",
"new",
"\\",
"moodle_url",
"(",
"'/admin/tasklogs.php'",
",",
"[",
"'logid'",
"=>",
"$",
... | Format the actions cell.
@param \stdClass $row
@return string | [
"Format",
"the",
"actions",
"cell",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/classes/task_log_table.php#L249-L270 |
220,330 | moodle/moodle | admin/classes/task_log_table.php | task_log_table.col_userid | public function col_userid($row) : string {
if (empty($row->userid)) {
return '';
}
$user = (object) [];
username_load_fields_from_object($user, $row, 'user');
return fullname($user);
} | php | public function col_userid($row) : string {
if (empty($row->userid)) {
return '';
}
$user = (object) [];
username_load_fields_from_object($user, $row, 'user');
return fullname($user);
} | [
"public",
"function",
"col_userid",
"(",
"$",
"row",
")",
":",
"string",
"{",
"if",
"(",
"empty",
"(",
"$",
"row",
"->",
"userid",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"user",
"=",
"(",
"object",
")",
"[",
"]",
";",
"username_load_fields_f... | Format the user cell.
@param \stdClass $row
@return string | [
"Format",
"the",
"user",
"cell",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/classes/task_log_table.php#L278-L287 |
220,331 | moodle/moodle | question/type/ddimageortext/edit_ddtoimage_form_base.php | qtype_ddtoimage_edit_form_base.definition_drop_zones | protected function definition_drop_zones($mform, $imagerepeats) {
$mform->addElement('header', 'dropzoneheader', get_string('dropzoneheader', 'qtype_'.$this->qtype()));
$countdropzones = 0;
if (isset($this->question->id)) {
foreach ($this->question->options->drops as $drop) {
... | php | protected function definition_drop_zones($mform, $imagerepeats) {
$mform->addElement('header', 'dropzoneheader', get_string('dropzoneheader', 'qtype_'.$this->qtype()));
$countdropzones = 0;
if (isset($this->question->id)) {
foreach ($this->question->options->drops as $drop) {
... | [
"protected",
"function",
"definition_drop_zones",
"(",
"$",
"mform",
",",
"$",
"imagerepeats",
")",
"{",
"$",
"mform",
"->",
"addElement",
"(",
"'header'",
",",
"'dropzoneheader'",
",",
"get_string",
"(",
"'dropzoneheader'",
",",
"'qtype_'",
".",
"$",
"this",
... | Make and add drop zones to the form.
@param object $mform The Moodle form object.
@param int $imagerepeats The initial number of repeat elements. | [
"Make",
"and",
"add",
"drop",
"zones",
"to",
"the",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/ddimageortext/edit_ddtoimage_form_base.php#L97-L116 |
220,332 | moodle/moodle | question/type/ddimageortext/edit_ddtoimage_form_base.php | qtype_ddtoimage_edit_form_base.get_drag_item_repeats | protected function get_drag_item_repeats() {
$countimages = 0;
if (isset($this->question->id)) {
foreach ($this->question->options->drags as $drag) {
$countimages = max($countimages, $drag->no);
}
}
if (!$countimages) {
$countimages = ... | php | protected function get_drag_item_repeats() {
$countimages = 0;
if (isset($this->question->id)) {
foreach ($this->question->options->drags as $drag) {
$countimages = max($countimages, $drag->no);
}
}
if (!$countimages) {
$countimages = ... | [
"protected",
"function",
"get_drag_item_repeats",
"(",
")",
"{",
"$",
"countimages",
"=",
"0",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"question",
"->",
"id",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"question",
"->",
"options",
"->",... | Returns an array of starting number of repeats, and the total number of repeats.
@return array | [
"Returns",
"an",
"array",
"of",
"starting",
"number",
"of",
"repeats",
"and",
"the",
"total",
"number",
"of",
"repeats",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/ddimageortext/edit_ddtoimage_form_base.php#L162-L181 |
220,333 | moodle/moodle | question/type/ddimageortext/edit_ddtoimage_form_base.php | qtype_ddtoimage_edit_form_base.file_uploaded | public static function file_uploaded($draftitemid) {
$draftareafiles = file_get_drafarea_files($draftitemid);
do {
$draftareafile = array_shift($draftareafiles->list);
} while ($draftareafile !== null && $draftareafile->filename == '.');
if ($draftareafile === null) {
... | php | public static function file_uploaded($draftitemid) {
$draftareafiles = file_get_drafarea_files($draftitemid);
do {
$draftareafile = array_shift($draftareafiles->list);
} while ($draftareafile !== null && $draftareafile->filename == '.');
if ($draftareafile === null) {
... | [
"public",
"static",
"function",
"file_uploaded",
"(",
"$",
"draftitemid",
")",
"{",
"$",
"draftareafiles",
"=",
"file_get_drafarea_files",
"(",
"$",
"draftitemid",
")",
";",
"do",
"{",
"$",
"draftareafile",
"=",
"array_shift",
"(",
"$",
"draftareafiles",
"->",
... | Checks to see if a file has been uploaded.
@param string $draftitemid The draft id
@return bool True if files exist, false if not. | [
"Checks",
"to",
"see",
"if",
"a",
"file",
"has",
"been",
"uploaded",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/ddimageortext/edit_ddtoimage_form_base.php#L194-L203 |
220,334 | moodle/moodle | course/classes/privacy/provider.php | provider.export_context_data | public static function export_context_data(\core_privacy\local\request\contextlist_collection $contextlistcollection) {
global $DB;
$coursecontextids = $DB->get_records_menu('context', ['contextlevel' => CONTEXT_COURSE], '', 'id, instanceid');
$courseids = [];
foreach ($contextlistcolle... | php | public static function export_context_data(\core_privacy\local\request\contextlist_collection $contextlistcollection) {
global $DB;
$coursecontextids = $DB->get_records_menu('context', ['contextlevel' => CONTEXT_COURSE], '', 'id, instanceid');
$courseids = [];
foreach ($contextlistcolle... | [
"public",
"static",
"function",
"export_context_data",
"(",
"\\",
"core_privacy",
"\\",
"local",
"\\",
"request",
"\\",
"contextlist_collection",
"$",
"contextlistcollection",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"coursecontextids",
"=",
"$",
"DB",
"->",
"ge... | Give the component a chance to include any contextual information deemed relevant to any child contexts which are
exporting personal data.
By giving the component access to the full list of contexts being exported across all components, it can determine whether a
descendant context is being exported, and decide whethe... | [
"Give",
"the",
"component",
"a",
"chance",
"to",
"include",
"any",
"contextual",
"information",
"deemed",
"relevant",
"to",
"any",
"child",
"contexts",
"which",
"are",
"exporting",
"personal",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/privacy/provider.php#L151-L208 |
220,335 | moodle/moodle | user/profile/definelib.php | profile_define_base.define_form | public function define_form(&$form) {
$form->addElement('header', '_commonsettings', get_string('profilecommonsettings', 'admin'));
$this->define_form_common($form);
$form->addElement('header', '_specificsettings', get_string('profilespecificsettings', 'admin'));
$this->define_form_spec... | php | public function define_form(&$form) {
$form->addElement('header', '_commonsettings', get_string('profilecommonsettings', 'admin'));
$this->define_form_common($form);
$form->addElement('header', '_specificsettings', get_string('profilespecificsettings', 'admin'));
$this->define_form_spec... | [
"public",
"function",
"define_form",
"(",
"&",
"$",
"form",
")",
"{",
"$",
"form",
"->",
"addElement",
"(",
"'header'",
",",
"'_commonsettings'",
",",
"get_string",
"(",
"'profilecommonsettings'",
",",
"'admin'",
")",
")",
";",
"$",
"this",
"->",
"define_for... | Prints out the form snippet for creating or editing a profile field
@param moodleform $form instance of the moodleform class | [
"Prints",
"out",
"the",
"form",
"snippet",
"for",
"creating",
"or",
"editing",
"a",
"profile",
"field"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/definelib.php#L37-L43 |
220,336 | moodle/moodle | user/profile/definelib.php | profile_define_base.define_form_common | public function define_form_common(&$form) {
$strrequired = get_string('required');
// Accepted values for 'shortname' would follow [a-zA-Z0-9_] pattern,
// but we are accepting any PARAM_TEXT value here,
// and checking [a-zA-Z0-9_] pattern in define_validate_common() function to thro... | php | public function define_form_common(&$form) {
$strrequired = get_string('required');
// Accepted values for 'shortname' would follow [a-zA-Z0-9_] pattern,
// but we are accepting any PARAM_TEXT value here,
// and checking [a-zA-Z0-9_] pattern in define_validate_common() function to thro... | [
"public",
"function",
"define_form_common",
"(",
"&",
"$",
"form",
")",
"{",
"$",
"strrequired",
"=",
"get_string",
"(",
"'required'",
")",
";",
"// Accepted values for 'shortname' would follow [a-zA-Z0-9_] pattern,",
"// but we are accepting any PARAM_TEXT value here,",
"// an... | Prints out the form snippet for the part of creating or editing a profile field common to all data types.
@param moodleform $form instance of the moodleform class | [
"Prints",
"out",
"the",
"form",
"snippet",
"for",
"the",
"part",
"of",
"creating",
"or",
"editing",
"a",
"profile",
"field",
"common",
"to",
"all",
"data",
"types",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/definelib.php#L50-L85 |
220,337 | moodle/moodle | user/profile/definelib.php | profile_define_base.define_save | public function define_save($data) {
global $DB;
$data = $this->define_save_preprocess($data); // Hook for child classes.
$old = false;
if (!empty($data->id)) {
$old = $DB->get_record('user_info_field', array('id' => (int)$data->id));
}
// Check to see if t... | php | public function define_save($data) {
global $DB;
$data = $this->define_save_preprocess($data); // Hook for child classes.
$old = false;
if (!empty($data->id)) {
$old = $DB->get_record('user_info_field', array('id' => (int)$data->id));
}
// Check to see if t... | [
"public",
"function",
"define_save",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"define_save_preprocess",
"(",
"$",
"data",
")",
";",
"// Hook for child classes.",
"$",
"old",
"=",
"false",
";",
"if",
"(",
... | Add a new profile field or save changes to current field
@param array|stdClass $data from the add/edit profile field form | [
"Add",
"a",
"new",
"profile",
"field",
"or",
"save",
"changes",
"to",
"current",
"field"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/definelib.php#L177-L205 |
220,338 | moodle/moodle | lib/classes/event/tag_created.php | tag_created.create_from_tag | public static function create_from_tag($tag) {
$event = self::create(array(
'objectid' => $tag->id,
'relateduserid' => $tag->userid,
'context' => \context_system::instance(),
'other' => array(
'name' => $tag->name,
'rawname' => $tag... | php | public static function create_from_tag($tag) {
$event = self::create(array(
'objectid' => $tag->id,
'relateduserid' => $tag->userid,
'context' => \context_system::instance(),
'other' => array(
'name' => $tag->name,
'rawname' => $tag... | [
"public",
"static",
"function",
"create_from_tag",
"(",
"$",
"tag",
")",
"{",
"$",
"event",
"=",
"self",
"::",
"create",
"(",
"array",
"(",
"'objectid'",
"=>",
"$",
"tag",
"->",
"id",
",",
"'relateduserid'",
"=>",
"$",
"tag",
"->",
"userid",
",",
"'con... | Creates an event from tag object
@since Moodle 3.1
@param \core_tag_tag|\stdClass $tag
@return tag_created | [
"Creates",
"an",
"event",
"from",
"tag",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/event/tag_created.php#L62-L73 |
220,339 | moodle/moodle | lib/classes/event/enrol_instance_deleted.php | enrol_instance_deleted.create_from_record | public static final function create_from_record($enrol) {
$event = static::create(array(
'context' => \context_course::instance($enrol->courseid),
'objectid' => $enrol->id,
'other' => array('enrol' => $enrol->enrol)
));
$event->add_record_snapshot('enrol',... | php | public static final function create_from_record($enrol) {
$event = static::create(array(
'context' => \context_course::instance($enrol->courseid),
'objectid' => $enrol->id,
'other' => array('enrol' => $enrol->enrol)
));
$event->add_record_snapshot('enrol',... | [
"public",
"static",
"final",
"function",
"create_from_record",
"(",
"$",
"enrol",
")",
"{",
"$",
"event",
"=",
"static",
"::",
"create",
"(",
"array",
"(",
"'context'",
"=>",
"\\",
"context_course",
"::",
"instance",
"(",
"$",
"enrol",
"->",
"courseid",
")... | Api to Create new event from enrol object.
@param \stdClass $enrol record from DB table 'enrol'
@return \core\event\base returns instance of new event | [
"Api",
"to",
"Create",
"new",
"event",
"from",
"enrol",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/event/enrol_instance_deleted.php#L50-L58 |
220,340 | moodle/moodle | lib/antivirus/clamav/classes/scanner.php | scanner.is_configured | public function is_configured() {
if ($this->get_config('runningmethod') === 'commandline') {
return (bool)$this->get_config('pathtoclam');
} else if ($this->get_config('runningmethod') === 'unixsocket') {
return (bool)$this->get_config('pathtounixsocket');
}
retu... | php | public function is_configured() {
if ($this->get_config('runningmethod') === 'commandline') {
return (bool)$this->get_config('pathtoclam');
} else if ($this->get_config('runningmethod') === 'unixsocket') {
return (bool)$this->get_config('pathtounixsocket');
}
retu... | [
"public",
"function",
"is_configured",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"get_config",
"(",
"'runningmethod'",
")",
"===",
"'commandline'",
")",
"{",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"get_config",
"(",
"'pathtoclam'",
")",
";",
"... | Are the necessary antivirus settings configured?
@return bool True if all necessary config settings been entered | [
"Are",
"the",
"necessary",
"antivirus",
"settings",
"configured?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/antivirus/clamav/classes/scanner.php#L45-L52 |
220,341 | moodle/moodle | lib/antivirus/clamav/classes/scanner.php | scanner.scan_file | public function scan_file($file, $filename) {
if (!is_readable($file)) {
// This should not happen.
debugging('File is not readable.');
return self::SCAN_RESULT_ERROR;
}
// Execute the scan using preferable method.
$method = 'scan_file_execute_' . $th... | php | public function scan_file($file, $filename) {
if (!is_readable($file)) {
// This should not happen.
debugging('File is not readable.');
return self::SCAN_RESULT_ERROR;
}
// Execute the scan using preferable method.
$method = 'scan_file_execute_' . $th... | [
"public",
"function",
"scan_file",
"(",
"$",
"file",
",",
"$",
"filename",
")",
"{",
"if",
"(",
"!",
"is_readable",
"(",
"$",
"file",
")",
")",
"{",
"// This should not happen.",
"debugging",
"(",
"'File is not readable.'",
")",
";",
"return",
"self",
"::",
... | Scan file.
This method is normally called from antivirus manager (\core\antivirus\manager::scan_file).
@param string $file Full path to the file.
@param string $filename Name of the file (could be different from physical file if temp file is used).
@return int Scanning result constant. | [
"Scan",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/antivirus/clamav/classes/scanner.php#L63-L86 |
220,342 | moodle/moodle | lib/antivirus/clamav/classes/scanner.php | scanner.get_clam_error_code | private function get_clam_error_code($returncode) {
$returncodes = array();
$returncodes[0] = 'No virus found.';
$returncodes[1] = 'Virus(es) found.';
$returncodes[2] = ' An error occured'; // Specific to clamdscan.
// All after here are specific to clamscan.
$returncodes... | php | private function get_clam_error_code($returncode) {
$returncodes = array();
$returncodes[0] = 'No virus found.';
$returncodes[1] = 'Virus(es) found.';
$returncodes[2] = ' An error occured'; // Specific to clamdscan.
// All after here are specific to clamscan.
$returncodes... | [
"private",
"function",
"get_clam_error_code",
"(",
"$",
"returncode",
")",
"{",
"$",
"returncodes",
"=",
"array",
"(",
")",
";",
"$",
"returncodes",
"[",
"0",
"]",
"=",
"'No virus found.'",
";",
"$",
"returncodes",
"[",
"1",
"]",
"=",
"'Virus(es) found.'",
... | Returns the string equivalent of a numeric clam error code
@param int $returncode The numeric error code in question.
@return string The definition of the error code | [
"Returns",
"the",
"string",
"equivalent",
"of",
"a",
"numeric",
"clam",
"error",
"code"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/antivirus/clamav/classes/scanner.php#L120-L146 |
220,343 | moodle/moodle | lib/antivirus/clamav/classes/scanner.php | scanner.scan_file_execute_commandline | public function scan_file_execute_commandline($file) {
$pathtoclam = trim($this->get_config('pathtoclam'));
if (!file_exists($pathtoclam) or !is_executable($pathtoclam)) {
// Misconfigured clam, notify admins.
$notice = get_string('invalidpathtoclam', 'antivirus_clamav', $pathto... | php | public function scan_file_execute_commandline($file) {
$pathtoclam = trim($this->get_config('pathtoclam'));
if (!file_exists($pathtoclam) or !is_executable($pathtoclam)) {
// Misconfigured clam, notify admins.
$notice = get_string('invalidpathtoclam', 'antivirus_clamav', $pathto... | [
"public",
"function",
"scan_file_execute_commandline",
"(",
"$",
"file",
")",
"{",
"$",
"pathtoclam",
"=",
"trim",
"(",
"$",
"this",
"->",
"get_config",
"(",
"'pathtoclam'",
")",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"pathtoclam",
")",
"or",
... | Scan file using command line utility.
@param string $file Full path to the file.
@return int Scanning result constant. | [
"Scan",
"file",
"using",
"command",
"line",
"utility",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/antivirus/clamav/classes/scanner.php#L154-L189 |
220,344 | moodle/moodle | lib/antivirus/clamav/classes/scanner.php | scanner.scan_file_execute_unixsocket | public function scan_file_execute_unixsocket($file) {
$socket = stream_socket_client('unix://' . $this->get_config('pathtounixsocket'),
$errno, $errstr, ANTIVIRUS_CLAMAV_SOCKET_TIMEOUT);
if (!$socket) {
// Can't open socket for some reason, notify admins.
$notice ... | php | public function scan_file_execute_unixsocket($file) {
$socket = stream_socket_client('unix://' . $this->get_config('pathtounixsocket'),
$errno, $errstr, ANTIVIRUS_CLAMAV_SOCKET_TIMEOUT);
if (!$socket) {
// Can't open socket for some reason, notify admins.
$notice ... | [
"public",
"function",
"scan_file_execute_unixsocket",
"(",
"$",
"file",
")",
"{",
"$",
"socket",
"=",
"stream_socket_client",
"(",
"'unix://'",
".",
"$",
"this",
"->",
"get_config",
"(",
"'pathtounixsocket'",
")",
",",
"$",
"errno",
",",
"$",
"errstr",
",",
... | Scan file using Unix domain sockets.
@param string $file Full path to the file.
@return int Scanning result constant. | [
"Scan",
"file",
"using",
"Unix",
"domain",
"sockets",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/antivirus/clamav/classes/scanner.php#L197-L222 |
220,345 | moodle/moodle | lib/antivirus/clamav/classes/scanner.php | scanner.scan_data_execute_unixsocket | public function scan_data_execute_unixsocket($data) {
$socket = stream_socket_client('unix://' . $this->get_config('pathtounixsocket'), $errno, $errstr, ANTIVIRUS_CLAMAV_SOCKET_TIMEOUT);
if (!$socket) {
// Can't open socket for some reason, notify admins.
$notice = get_string('er... | php | public function scan_data_execute_unixsocket($data) {
$socket = stream_socket_client('unix://' . $this->get_config('pathtounixsocket'), $errno, $errstr, ANTIVIRUS_CLAMAV_SOCKET_TIMEOUT);
if (!$socket) {
// Can't open socket for some reason, notify admins.
$notice = get_string('er... | [
"public",
"function",
"scan_data_execute_unixsocket",
"(",
"$",
"data",
")",
"{",
"$",
"socket",
"=",
"stream_socket_client",
"(",
"'unix://'",
".",
"$",
"this",
"->",
"get_config",
"(",
"'pathtounixsocket'",
")",
",",
"$",
"errno",
",",
"$",
"errstr",
",",
... | Scan data using unix socket.
We are running INSTREAM command and passing data stream in chunks.
The format of the chunk is: <length><data> where <length> is the size of the following
data in bytes expressed as a 4 byte unsigned integer in network byte order and <data>
is the actual chunk. Streaming is terminated by se... | [
"Scan",
"data",
"using",
"unix",
"socket",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/antivirus/clamav/classes/scanner.php#L237-L266 |
220,346 | moodle/moodle | lib/antivirus/clamav/classes/scanner.php | scanner.parse_unixsocket_response | private function parse_unixsocket_response($output) {
$splitoutput = explode(': ', $output);
$message = trim($splitoutput[1]);
if ($message === 'OK') {
return self::SCAN_RESULT_OK;
} else {
$parts = explode(' ', $message);
$status = array_pop($parts);
... | php | private function parse_unixsocket_response($output) {
$splitoutput = explode(': ', $output);
$message = trim($splitoutput[1]);
if ($message === 'OK') {
return self::SCAN_RESULT_OK;
} else {
$parts = explode(' ', $message);
$status = array_pop($parts);
... | [
"private",
"function",
"parse_unixsocket_response",
"(",
"$",
"output",
")",
"{",
"$",
"splitoutput",
"=",
"explode",
"(",
"': '",
",",
"$",
"output",
")",
";",
"$",
"message",
"=",
"trim",
"(",
"$",
"splitoutput",
"[",
"1",
"]",
")",
";",
"if",
"(",
... | Parse unix socket command response.
@param string $output The unix socket command response.
@return int Scanning result constant. | [
"Parse",
"unix",
"socket",
"command",
"response",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/antivirus/clamav/classes/scanner.php#L274-L291 |
220,347 | moodle/moodle | lib/classes/persistent.php | persistent.verify_protected_methods | final protected function verify_protected_methods() {
$properties = static::properties_definition();
foreach ($properties as $property => $definition) {
$method = 'get_' . $property;
if (method_exists($this, $method)) {
$reflection = new ReflectionMethod($this, $... | php | final protected function verify_protected_methods() {
$properties = static::properties_definition();
foreach ($properties as $property => $definition) {
$method = 'get_' . $property;
if (method_exists($this, $method)) {
$reflection = new ReflectionMethod($this, $... | [
"final",
"protected",
"function",
"verify_protected_methods",
"(",
")",
"{",
"$",
"properties",
"=",
"static",
"::",
"properties_definition",
"(",
")",
";",
"foreach",
"(",
"$",
"properties",
"as",
"$",
"property",
"=>",
"$",
"definition",
")",
"{",
"$",
"me... | This function is used to verify that custom getters and setters are declared as protected.
Persistent properties should always be accessed via get('property') and set('property', 'value') which
will call the custom getter or setter if it exists. We do not want to allow inconsistent access to the properties. | [
"This",
"function",
"is",
"used",
"to",
"verify",
"that",
"custom",
"getters",
"and",
"setters",
"are",
"declared",
"as",
"protected",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L81-L100 |
220,348 | moodle/moodle | lib/classes/persistent.php | persistent.get | final public function get($property) {
if (!static::has_property($property)) {
throw new coding_exception('Unexpected property \'' . s($property) .'\' requested.');
}
$methodname = 'get_' . $property;
if (method_exists($this, $methodname)) {
return $this->$methodn... | php | final public function get($property) {
if (!static::has_property($property)) {
throw new coding_exception('Unexpected property \'' . s($property) .'\' requested.');
}
$methodname = 'get_' . $property;
if (method_exists($this, $methodname)) {
return $this->$methodn... | [
"final",
"public",
"function",
"get",
"(",
"$",
"property",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"has_property",
"(",
"$",
"property",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'Unexpected property \\''",
".",
"s",
"(",
"$",
"property",... | Data getter.
This is the main getter for all the properties. Developers can implement their own getters (get_propertyname)
and they will be called by this function. Custom getters can use raw_get to get the raw value.
Internally this is not used by {@link self::to_record()} or
{@link self::from_record()} because the d... | [
"Data",
"getter",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L138-L147 |
220,349 | moodle/moodle | lib/classes/persistent.php | persistent.raw_get | final protected function raw_get($property) {
if (!static::has_property($property)) {
throw new coding_exception('Unexpected property \'' . s($property) .'\' requested.');
}
if (!array_key_exists($property, $this->data) && !static::is_property_required($property)) {
$this... | php | final protected function raw_get($property) {
if (!static::has_property($property)) {
throw new coding_exception('Unexpected property \'' . s($property) .'\' requested.');
}
if (!array_key_exists($property, $this->data) && !static::is_property_required($property)) {
$this... | [
"final",
"protected",
"function",
"raw_get",
"(",
"$",
"property",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"has_property",
"(",
"$",
"property",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'Unexpected property \\''",
".",
"s",
"(",
"$",
"pro... | Internal Data getter.
This is the main getter for all the properties. Developers can implement their own getters
but they should be calling {@link self::get()} in order to retrieve the value. Essentially
the getters defined by the developers would only ever be used as helper methods and will not
be called internally a... | [
"Internal",
"Data",
"getter",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L164-L172 |
220,350 | moodle/moodle | lib/classes/persistent.php | persistent.properties_definition | final public static function properties_definition() {
global $CFG;
static $def = null;
if ($def !== null) {
return $def;
}
$def = static::define_properties();
$def['id'] = array(
'default' => 0,
'type' => PARAM_INT,
);
... | php | final public static function properties_definition() {
global $CFG;
static $def = null;
if ($def !== null) {
return $def;
}
$def = static::define_properties();
$def['id'] = array(
'default' => 0,
'type' => PARAM_INT,
);
... | [
"final",
"public",
"static",
"function",
"properties_definition",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"static",
"$",
"def",
"=",
"null",
";",
"if",
"(",
"$",
"def",
"!==",
"null",
")",
"{",
"return",
"$",
"def",
";",
"}",
"$",
"def",
"=",
"st... | Get the properties definition of this model..
@return array | [
"Get",
"the",
"properties",
"definition",
"of",
"this",
"model",
".."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L246-L300 |
220,351 | moodle/moodle | lib/classes/persistent.php | persistent.get_formatted_properties | final public static function get_formatted_properties() {
$properties = static::properties_definition();
$formatted = array();
foreach ($properties as $property => $definition) {
$propertyformat = $property . 'format';
if (($definition['type'] == PARAM_RAW || $definition... | php | final public static function get_formatted_properties() {
$properties = static::properties_definition();
$formatted = array();
foreach ($properties as $property => $definition) {
$propertyformat = $property . 'format';
if (($definition['type'] == PARAM_RAW || $definition... | [
"final",
"public",
"static",
"function",
"get_formatted_properties",
"(",
")",
"{",
"$",
"properties",
"=",
"static",
"::",
"properties_definition",
"(",
")",
";",
"$",
"formatted",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"properties",
"as",
"$",
... | Gets all the formatted properties.
Formatted properties are properties which have a format associated with them.
@return array Keys are property names, values are property format names. | [
"Gets",
"all",
"the",
"formatted",
"properties",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L309-L323 |
220,352 | moodle/moodle | lib/classes/persistent.php | persistent.get_property_default_value | final protected static function get_property_default_value($property) {
$properties = static::properties_definition();
if (!isset($properties[$property]['default'])) {
return null;
}
$value = $properties[$property]['default'];
if ($value instanceof \Closure) {
... | php | final protected static function get_property_default_value($property) {
$properties = static::properties_definition();
if (!isset($properties[$property]['default'])) {
return null;
}
$value = $properties[$property]['default'];
if ($value instanceof \Closure) {
... | [
"final",
"protected",
"static",
"function",
"get_property_default_value",
"(",
"$",
"property",
")",
"{",
"$",
"properties",
"=",
"static",
"::",
"properties_definition",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"properties",
"[",
"$",
"property",
"... | Gets the default value for a property.
This assumes that the property exists.
@param string $property The property name.
@return mixed | [
"Gets",
"the",
"default",
"value",
"for",
"a",
"property",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L333-L343 |
220,353 | moodle/moodle | lib/classes/persistent.php | persistent.get_property_error_message | final protected static function get_property_error_message($property) {
$properties = static::properties_definition();
if (!isset($properties[$property]['message'])) {
return new lang_string('invaliddata', 'error');
}
return $properties[$property]['message'];
} | php | final protected static function get_property_error_message($property) {
$properties = static::properties_definition();
if (!isset($properties[$property]['message'])) {
return new lang_string('invaliddata', 'error');
}
return $properties[$property]['message'];
} | [
"final",
"protected",
"static",
"function",
"get_property_error_message",
"(",
"$",
"property",
")",
"{",
"$",
"properties",
"=",
"static",
"::",
"properties_definition",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"properties",
"[",
"$",
"property",
"... | Gets the error message for a property.
This assumes that the property exists.
@param string $property The property name.
@return lang_string | [
"Gets",
"the",
"error",
"message",
"for",
"a",
"property",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L353-L359 |
220,354 | moodle/moodle | lib/classes/persistent.php | persistent.from_record | final public function from_record(stdClass $record) {
$record = (array) $record;
foreach ($record as $property => $value) {
$this->raw_set($property, $value);
}
return $this;
} | php | final public function from_record(stdClass $record) {
$record = (array) $record;
foreach ($record as $property => $value) {
$this->raw_set($property, $value);
}
return $this;
} | [
"final",
"public",
"function",
"from_record",
"(",
"stdClass",
"$",
"record",
")",
"{",
"$",
"record",
"=",
"(",
"array",
")",
"$",
"record",
";",
"foreach",
"(",
"$",
"record",
"as",
"$",
"property",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
... | Populate this class with data from a DB record.
Note that this does not use any custom setter because the data here is intended to
represent what is stored in the database.
@param \stdClass $record A DB record.
@return persistent | [
"Populate",
"this",
"class",
"with",
"data",
"from",
"a",
"DB",
"record",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L394-L400 |
220,355 | moodle/moodle | lib/classes/persistent.php | persistent.to_record | final public function to_record() {
$data = new stdClass();
$properties = static::properties_definition();
foreach ($properties as $property => $definition) {
$data->$property = $this->raw_get($property);
}
return $data;
} | php | final public function to_record() {
$data = new stdClass();
$properties = static::properties_definition();
foreach ($properties as $property => $definition) {
$data->$property = $this->raw_get($property);
}
return $data;
} | [
"final",
"public",
"function",
"to_record",
"(",
")",
"{",
"$",
"data",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"properties",
"=",
"static",
"::",
"properties_definition",
"(",
")",
";",
"foreach",
"(",
"$",
"properties",
"as",
"$",
"property",
"=>",... | Create a DB record from this class.
Note that this does not use any custom getter because the data here is intended to
represent what is stored in the database.
@return \stdClass | [
"Create",
"a",
"DB",
"record",
"from",
"this",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L410-L417 |
220,356 | moodle/moodle | lib/classes/persistent.php | persistent.read | final public function read() {
global $DB;
if ($this->get('id') <= 0) {
throw new coding_exception('id is required to load');
}
$record = $DB->get_record(static::TABLE, array('id' => $this->get('id')), '*', MUST_EXIST);
$this->from_record($record);
// Valida... | php | final public function read() {
global $DB;
if ($this->get('id') <= 0) {
throw new coding_exception('id is required to load');
}
$record = $DB->get_record(static::TABLE, array('id' => $this->get('id')), '*', MUST_EXIST);
$this->from_record($record);
// Valida... | [
"final",
"public",
"function",
"read",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"this",
"->",
"get",
"(",
"'id'",
")",
"<=",
"0",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'id is required to load'",
")",
";",
"}",
"$",
"reco... | Load the data from the DB.
@return persistent | [
"Load",
"the",
"data",
"from",
"the",
"DB",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L424-L437 |
220,357 | moodle/moodle | lib/classes/persistent.php | persistent.create | final public function create() {
global $DB, $USER;
if ($this->raw_get('id')) {
// The validation methods rely on the ID to know if we're updating or not, the ID should be
// falsy whenever we are creating an object.
throw new coding_exception('Cannot create an objec... | php | final public function create() {
global $DB, $USER;
if ($this->raw_get('id')) {
// The validation methods rely on the ID to know if we're updating or not, the ID should be
// falsy whenever we are creating an object.
throw new coding_exception('Cannot create an objec... | [
"final",
"public",
"function",
"create",
"(",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"if",
"(",
"$",
"this",
"->",
"raw_get",
"(",
"'id'",
")",
")",
"{",
"// The validation methods rely on the ID to know if we're updating or not, the ID should be",
... | Insert a record in the DB.
@return persistent | [
"Insert",
"a",
"record",
"in",
"the",
"DB",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L457-L492 |
220,358 | moodle/moodle | lib/classes/persistent.php | persistent.update | final public function update() {
global $DB, $USER;
if ($this->raw_get('id') <= 0) {
throw new coding_exception('id is required to update');
} else if (!$this->is_valid()) {
throw new invalid_persistent_exception($this->get_errors());
}
// Before update ... | php | final public function update() {
global $DB, $USER;
if ($this->raw_get('id') <= 0) {
throw new coding_exception('id is required to update');
} else if (!$this->is_valid()) {
throw new invalid_persistent_exception($this->get_errors());
}
// Before update ... | [
"final",
"public",
"function",
"update",
"(",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"if",
"(",
"$",
"this",
"->",
"raw_get",
"(",
"'id'",
")",
"<=",
"0",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'id is required to update'",
"... | Update the existing record in the DB.
@return bool True on success. | [
"Update",
"the",
"existing",
"record",
"in",
"the",
"DB",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L522-L552 |
220,359 | moodle/moodle | lib/classes/persistent.php | persistent.delete | final public function delete() {
global $DB;
if ($this->raw_get('id') <= 0) {
throw new coding_exception('id is required to delete');
}
// Hook before delete.
$this->before_delete();
$result = $DB->delete_records(static::TABLE, array('id' => $this->raw_get(... | php | final public function delete() {
global $DB;
if ($this->raw_get('id') <= 0) {
throw new coding_exception('id is required to delete');
}
// Hook before delete.
$this->before_delete();
$result = $DB->delete_records(static::TABLE, array('id' => $this->raw_get(... | [
"final",
"public",
"function",
"delete",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"this",
"->",
"raw_get",
"(",
"'id'",
")",
"<=",
"0",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'id is required to delete'",
")",
";",
"}",
"// ... | Delete an entry from the database.
@return bool True on success. | [
"Delete",
"an",
"entry",
"from",
"the",
"database",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L596-L617 |
220,360 | moodle/moodle | lib/classes/persistent.php | persistent.validate | final public function validate() {
global $CFG;
// Before validate hook.
$this->before_validate();
// If this object has not been validated yet.
if ($this->validated !== true) {
$errors = array();
$properties = static::properties_definition();
... | php | final public function validate() {
global $CFG;
// Before validate hook.
$this->before_validate();
// If this object has not been validated yet.
if ($this->validated !== true) {
$errors = array();
$properties = static::properties_definition();
... | [
"final",
"public",
"function",
"validate",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"// Before validate hook.",
"$",
"this",
"->",
"before_validate",
"(",
")",
";",
"// If this object has not been validated yet.",
"if",
"(",
"$",
"this",
"->",
"validated",
"!==",... | Validates the data.
Developers can implement addition validation by defining a method as follows. Note that
the method MUST return a lang_string() when there is an error, and true when the data is valid.
protected function validate_propertyname($value) {
if ($value !== 'My expected value') {
return new lang_string('i... | [
"Validates",
"the",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L672-L744 |
220,361 | moodle/moodle | lib/classes/persistent.php | persistent.extract_record | public static function extract_record($row, $prefix = null) {
if ($prefix === null) {
$prefix = str_replace('_', '', static::TABLE) . '_';
}
$prefixlength = strlen($prefix);
$data = new stdClass();
foreach ($row as $property => $value) {
if (strpos($prope... | php | public static function extract_record($row, $prefix = null) {
if ($prefix === null) {
$prefix = str_replace('_', '', static::TABLE) . '_';
}
$prefixlength = strlen($prefix);
$data = new stdClass();
foreach ($row as $property => $value) {
if (strpos($prope... | [
"public",
"static",
"function",
"extract_record",
"(",
"$",
"row",
",",
"$",
"prefix",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"prefix",
"===",
"null",
")",
"{",
"$",
"prefix",
"=",
"str_replace",
"(",
"'_'",
",",
"''",
",",
"static",
"::",
"TABLE",
... | Extract a record from a row of data.
Most likely used in combination with {@link self::get_sql_fields()}. This method is
simple enough to be used by non-persistent classes, keep that in mind when modifying it.
e.g. persistent::extract_record($row, 'user'); should work.
@param stdClass $row The row of data.
@param st... | [
"Extract",
"a",
"record",
"from",
"a",
"row",
"of",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L777-L792 |
220,362 | moodle/moodle | lib/classes/persistent.php | persistent.get_records | public static function get_records($filters = array(), $sort = '', $order = 'ASC', $skip = 0, $limit = 0) {
global $DB;
$orderby = '';
if (!empty($sort)) {
$orderby = $sort . ' ' . $order;
}
$records = $DB->get_records(static::TABLE, $filters, $orderby, '*', $skip, ... | php | public static function get_records($filters = array(), $sort = '', $order = 'ASC', $skip = 0, $limit = 0) {
global $DB;
$orderby = '';
if (!empty($sort)) {
$orderby = $sort . ' ' . $order;
}
$records = $DB->get_records(static::TABLE, $filters, $orderby, '*', $skip, ... | [
"public",
"static",
"function",
"get_records",
"(",
"$",
"filters",
"=",
"array",
"(",
")",
",",
"$",
"sort",
"=",
"''",
",",
"$",
"order",
"=",
"'ASC'",
",",
"$",
"skip",
"=",
"0",
",",
"$",
"limit",
"=",
"0",
")",
"{",
"global",
"$",
"DB",
";... | Load a list of records.
@param array $filters Filters to apply.
@param string $sort Field to sort by.
@param string $order Sort order.
@param int $skip Limitstart.
@param int $limit Number of rows to return.
@return \core\persistent[] | [
"Load",
"a",
"list",
"of",
"records",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L805-L821 |
220,363 | moodle/moodle | lib/classes/persistent.php | persistent.get_record | public static function get_record($filters = array()) {
global $DB;
$record = $DB->get_record(static::TABLE, $filters);
return $record ? new static(0, $record) : false;
} | php | public static function get_record($filters = array()) {
global $DB;
$record = $DB->get_record(static::TABLE, $filters);
return $record ? new static(0, $record) : false;
} | [
"public",
"static",
"function",
"get_record",
"(",
"$",
"filters",
"=",
"array",
"(",
")",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"record",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"static",
"::",
"TABLE",
",",
"$",
"filters",
")",
";",
"return",
... | Load a single record.
@param array $filters Filters to apply.
@return false|\core\persistent | [
"Load",
"a",
"single",
"record",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L829-L834 |
220,364 | moodle/moodle | lib/classes/persistent.php | persistent.get_records_select | public static function get_records_select($select, $params = null, $sort = '', $fields = '*', $limitfrom = 0, $limitnum = 0) {
global $DB;
$records = $DB->get_records_select(static::TABLE, $select, $params, $sort, $fields, $limitfrom, $limitnum);
// We return class instances.
$instance... | php | public static function get_records_select($select, $params = null, $sort = '', $fields = '*', $limitfrom = 0, $limitnum = 0) {
global $DB;
$records = $DB->get_records_select(static::TABLE, $select, $params, $sort, $fields, $limitfrom, $limitnum);
// We return class instances.
$instance... | [
"public",
"static",
"function",
"get_records_select",
"(",
"$",
"select",
",",
"$",
"params",
"=",
"null",
",",
"$",
"sort",
"=",
"''",
",",
"$",
"fields",
"=",
"'*'",
",",
"$",
"limitfrom",
"=",
"0",
",",
"$",
"limitnum",
"=",
"0",
")",
"{",
"glob... | Load a list of records based on a select query.
@param string $select
@param array $params
@param string $sort
@param string $fields
@param int $limitfrom
@param int $limitnum
@return \core\persistent[] | [
"Load",
"a",
"list",
"of",
"records",
"based",
"on",
"a",
"select",
"query",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L847-L860 |
220,365 | moodle/moodle | lib/classes/persistent.php | persistent.get_sql_fields | public static function get_sql_fields($alias, $prefix = null) {
global $CFG;
$fields = array();
if ($prefix === null) {
$prefix = str_replace('_', '', static::TABLE) . '_';
}
// Get the properties and move ID to the top.
$properties = static::properties_defi... | php | public static function get_sql_fields($alias, $prefix = null) {
global $CFG;
$fields = array();
if ($prefix === null) {
$prefix = str_replace('_', '', static::TABLE) . '_';
}
// Get the properties and move ID to the top.
$properties = static::properties_defi... | [
"public",
"static",
"function",
"get_sql_fields",
"(",
"$",
"alias",
",",
"$",
"prefix",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"fields",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"prefix",
"===",
"null",
")",
"{",
"$",
"prefix",... | Return the list of fields for use in a SELECT clause.
Having the complete list of fields prefixed allows for multiple persistents to be fetched
in a single query. Use {@link self::extract_record()} to extract the records from the query result.
@param string $alias The alias used for the table.
@param string $prefix T... | [
"Return",
"the",
"list",
"of",
"fields",
"for",
"use",
"in",
"a",
"SELECT",
"clause",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L872-L898 |
220,366 | moodle/moodle | lib/classes/persistent.php | persistent.count_records_select | public static function count_records_select($select, $params = null) {
global $DB;
$count = $DB->count_records_select(static::TABLE, $select, $params);
return $count;
} | php | public static function count_records_select($select, $params = null) {
global $DB;
$count = $DB->count_records_select(static::TABLE, $select, $params);
return $count;
} | [
"public",
"static",
"function",
"count_records_select",
"(",
"$",
"select",
",",
"$",
"params",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"count",
"=",
"$",
"DB",
"->",
"count_records_select",
"(",
"static",
"::",
"TABLE",
",",
"$",
"select",... | Count a list of records.
@param string $select
@param array $params
@return int | [
"Count",
"a",
"list",
"of",
"records",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L920-L925 |
220,367 | moodle/moodle | lib/classes/persistent.php | persistent.record_exists_select | public static function record_exists_select($select, array $params = null) {
global $DB;
return $DB->record_exists_select(static::TABLE, $select, $params);
} | php | public static function record_exists_select($select, array $params = null) {
global $DB;
return $DB->record_exists_select(static::TABLE, $select, $params);
} | [
"public",
"static",
"function",
"record_exists_select",
"(",
"$",
"select",
",",
"array",
"$",
"params",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"return",
"$",
"DB",
"->",
"record_exists_select",
"(",
"static",
"::",
"TABLE",
",",
"$",
"select",
... | Check if a records exists.
@param string $select
@param array $params
@return bool | [
"Check",
"if",
"a",
"records",
"exists",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/persistent.php#L945-L948 |
220,368 | moodle/moodle | lib/filestorage/tgz_extractor.php | tgz_extractor.extract | public function extract(tgz_extractor_handler $handler, file_progress $progress = null) {
$this->mode = self::MODE_EXTRACT;
$this->extract_or_list($handler, $progress);
$results = $this->results;
unset($this->results);
return $results;
} | php | public function extract(tgz_extractor_handler $handler, file_progress $progress = null) {
$this->mode = self::MODE_EXTRACT;
$this->extract_or_list($handler, $progress);
$results = $this->results;
unset($this->results);
return $results;
} | [
"public",
"function",
"extract",
"(",
"tgz_extractor_handler",
"$",
"handler",
",",
"file_progress",
"$",
"progress",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"mode",
"=",
"self",
"::",
"MODE_EXTRACT",
";",
"$",
"this",
"->",
"extract_or_list",
"(",
"$",
... | Extracts the archive.
@param tgz_extractor_handler $handler Will be called for extracted files
@param file_progress $progress Optional progress reporting
@return array Array from archive path => true of processed files
@throws moodle_exception If there is any error processing the archive | [
"Extracts",
"the",
"archive",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/tgz_extractor.php#L140-L146 |
220,369 | moodle/moodle | lib/filestorage/tgz_extractor.php | tgz_extractor.process_header | protected function process_header($block, $handler) {
// If the block consists entirely of nulls, ignore it. (This happens
// twice at end of archive.)
if ($block === str_pad('', tgz_packer::TAR_BLOCK_SIZE, "\0")) {
return;
}
// struct header_posix_ustar {
//... | php | protected function process_header($block, $handler) {
// If the block consists entirely of nulls, ignore it. (This happens
// twice at end of archive.)
if ($block === str_pad('', tgz_packer::TAR_BLOCK_SIZE, "\0")) {
return;
}
// struct header_posix_ustar {
//... | [
"protected",
"function",
"process_header",
"(",
"$",
"block",
",",
"$",
"handler",
")",
"{",
"// If the block consists entirely of nulls, ignore it. (This happens",
"// twice at end of archive.)",
"if",
"(",
"$",
"block",
"===",
"str_pad",
"(",
"''",
",",
"tgz_packer",
... | Process 512-byte header block.
@param string $block Tar block
@param tgz_extractor_handler $handler Will be called for extracted files | [
"Process",
"512",
"-",
"byte",
"header",
"block",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/tgz_extractor.php#L260-L340 |
220,370 | moodle/moodle | lib/filestorage/tgz_extractor.php | tgz_extractor.process_file_block | protected function process_file_block($block, tgz_extractor_handler $handler = null) {
// Write block into buffer.
$blocksize = tgz_packer::TAR_BLOCK_SIZE;
if ($this->currentfileprocessed + tgz_packer::TAR_BLOCK_SIZE > $this->currentfilesize) {
// Partial block at end of file.
... | php | protected function process_file_block($block, tgz_extractor_handler $handler = null) {
// Write block into buffer.
$blocksize = tgz_packer::TAR_BLOCK_SIZE;
if ($this->currentfileprocessed + tgz_packer::TAR_BLOCK_SIZE > $this->currentfilesize) {
// Partial block at end of file.
... | [
"protected",
"function",
"process_file_block",
"(",
"$",
"block",
",",
"tgz_extractor_handler",
"$",
"handler",
"=",
"null",
")",
"{",
"// Write block into buffer.",
"$",
"blocksize",
"=",
"tgz_packer",
"::",
"TAR_BLOCK_SIZE",
";",
"if",
"(",
"$",
"this",
"->",
... | Processes one 512-byte block of an existing file.
@param string $block Data block
@param tgz_extractor_handler $handler Will be called for extracted files | [
"Processes",
"one",
"512",
"-",
"byte",
"block",
"of",
"an",
"existing",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/tgz_extractor.php#L348-L380 |
220,371 | moodle/moodle | lib/filestorage/tgz_extractor.php | tgz_extractor.start_current_file | protected function start_current_file($archivepath, $filesize, $mtime,
tgz_extractor_handler $handler = null) {
global $CFG;
$this->currentarchivepath = $archivepath;
$this->currentmtime = $mtime;
$this->currentfilesize = $filesize;
$this->currentfileprocessed = 0;
... | php | protected function start_current_file($archivepath, $filesize, $mtime,
tgz_extractor_handler $handler = null) {
global $CFG;
$this->currentarchivepath = $archivepath;
$this->currentmtime = $mtime;
$this->currentfilesize = $filesize;
$this->currentfileprocessed = 0;
... | [
"protected",
"function",
"start_current_file",
"(",
"$",
"archivepath",
",",
"$",
"filesize",
",",
"$",
"mtime",
",",
"tgz_extractor_handler",
"$",
"handler",
"=",
"null",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"this",
"->",
"currentarchivepath",
"=",
"$"... | Starts processing a file from archive.
@param string $archivepath Path inside archive
@param int $filesize Size in bytes
@param int $mtime File-modified time
@param tgz_extractor_handler $handler Will be called for extracted files
@throws moodle_exception | [
"Starts",
"processing",
"a",
"file",
"from",
"archive",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/tgz_extractor.php#L391-L444 |
220,372 | moodle/moodle | lib/filestorage/tgz_extractor.php | tgz_extractor.close_current_file | protected function close_current_file($handler) {
if ($this->currentfp !== null) {
if (!fclose($this->currentfp)) {
throw new moodle_exception('errorprocessingarchive', '', '', null,
'Failed to close output file: ' . $this->currentfile);
}
... | php | protected function close_current_file($handler) {
if ($this->currentfp !== null) {
if (!fclose($this->currentfp)) {
throw new moodle_exception('errorprocessingarchive', '', '', null,
'Failed to close output file: ' . $this->currentfile);
}
... | [
"protected",
"function",
"close_current_file",
"(",
"$",
"handler",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"currentfp",
"!==",
"null",
")",
"{",
"if",
"(",
"!",
"fclose",
"(",
"$",
"this",
"->",
"currentfp",
")",
")",
"{",
"throw",
"new",
"moodle_exce... | Closes the current file, calls handler, and sets up data.
@param tgz_extractor_handler $handler Will be called for extracted files
@throws moodle_exception If there is an error closing it | [
"Closes",
"the",
"current",
"file",
"calls",
"handler",
"and",
"sets",
"up",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/tgz_extractor.php#L452-L517 |
220,373 | moodle/moodle | lib/filebrowser/file_browser.php | file_browser.get_file_info | public function get_file_info($context = NULL, $component = NULL, $filearea = NULL, $itemid = NULL, $filepath = NULL, $filename = NULL) {
if (!$context) {
$context = context_system::instance();
}
switch ($context->contextlevel) {
case CONTEXT_SYSTEM:
retur... | php | public function get_file_info($context = NULL, $component = NULL, $filearea = NULL, $itemid = NULL, $filepath = NULL, $filename = NULL) {
if (!$context) {
$context = context_system::instance();
}
switch ($context->contextlevel) {
case CONTEXT_SYSTEM:
retur... | [
"public",
"function",
"get_file_info",
"(",
"$",
"context",
"=",
"NULL",
",",
"$",
"component",
"=",
"NULL",
",",
"$",
"filearea",
"=",
"NULL",
",",
"$",
"itemid",
"=",
"NULL",
",",
"$",
"filepath",
"=",
"NULL",
",",
"$",
"filename",
"=",
"NULL",
")"... | Looks up file_info instance
@param stdClass $context context object
@param string $component component
@param string $filearea file area
@param int $itemid item ID
@param string $filepath file path
@param string $filename file name
@return file_info|null file_info instance or null if not found or access not allowed | [
"Looks",
"up",
"file_info",
"instance"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filebrowser/file_browser.php#L77-L95 |
220,374 | moodle/moodle | lib/filebrowser/file_browser.php | file_browser.get_file_info_context_user | private function get_file_info_context_user($context, $component, $filearea, $itemid, $filepath, $filename) {
global $DB, $USER;
if ($context->instanceid == $USER->id) {
$user = $USER;
} else {
$user = $DB->get_record('user', array('id'=>$context->instanceid));
}
... | php | private function get_file_info_context_user($context, $component, $filearea, $itemid, $filepath, $filename) {
global $DB, $USER;
if ($context->instanceid == $USER->id) {
$user = $USER;
} else {
$user = $DB->get_record('user', array('id'=>$context->instanceid));
}
... | [
"private",
"function",
"get_file_info_context_user",
"(",
"$",
"context",
",",
"$",
"component",
",",
"$",
"filearea",
",",
"$",
"itemid",
",",
"$",
"filepath",
",",
"$",
"filename",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"USER",
";",
"if",
"(",
"$",... | Returns info about the files at User context
@param stdClass $context context object
@param string $component component
@param string $filearea file area
@param int $itemid item ID
@param string $filepath file path
@param string $filename file name
@return file_info|null file_info instance or null if not found or acce... | [
"Returns",
"info",
"about",
"the",
"files",
"at",
"User",
"context"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filebrowser/file_browser.php#L126-L145 |
220,375 | moodle/moodle | lib/filebrowser/file_browser.php | file_browser.is_enrolled | public function is_enrolled($courseid) {
if ($this->enrolledcourses === null || PHPUNIT_TEST) {
// Since get_file_browser() returns a statically cached object we can't rely on cache
// inside the file_browser class in the unittests.
// TODO MDL-59964 remove this caching when ... | php | public function is_enrolled($courseid) {
if ($this->enrolledcourses === null || PHPUNIT_TEST) {
// Since get_file_browser() returns a statically cached object we can't rely on cache
// inside the file_browser class in the unittests.
// TODO MDL-59964 remove this caching when ... | [
"public",
"function",
"is_enrolled",
"(",
"$",
"courseid",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"enrolledcourses",
"===",
"null",
"||",
"PHPUNIT_TEST",
")",
"{",
"// Since get_file_browser() returns a statically cached object we can't rely on cache",
"// inside the file_... | Check if user is enrolled into the course
This function keeps a cache of enrolled courses because it may be called multiple times for many courses in one request
@param int $courseid
@return bool | [
"Check",
"if",
"user",
"is",
"enrolled",
"into",
"the",
"course"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filebrowser/file_browser.php#L228-L236 |
220,376 | moodle/moodle | lib/php-css-parser/CSSList/CSSList.php | CSSList.insert | public function insert($oItem, $oSibling) {
$iIndex = array_search($oSibling, $this->aContents);
if ($iIndex === false) {
return $this->append($oItem);
}
array_splice($this->aContents, $iIndex, 0, array($oItem));
} | php | public function insert($oItem, $oSibling) {
$iIndex = array_search($oSibling, $this->aContents);
if ($iIndex === false) {
return $this->append($oItem);
}
array_splice($this->aContents, $iIndex, 0, array($oItem));
} | [
"public",
"function",
"insert",
"(",
"$",
"oItem",
",",
"$",
"oSibling",
")",
"{",
"$",
"iIndex",
"=",
"array_search",
"(",
"$",
"oSibling",
",",
"$",
"this",
"->",
"aContents",
")",
";",
"if",
"(",
"$",
"iIndex",
"===",
"false",
")",
"{",
"return",
... | Insert an item before its sibling.
@param mixed $oItem The item.
@param mixed $oSibling The sibling. | [
"Insert",
"an",
"item",
"before",
"its",
"sibling",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/php-css-parser/CSSList/CSSList.php#L44-L50 |
220,377 | moodle/moodle | lib/php-css-parser/CSSList/CSSList.php | CSSList.remove | public function remove($oItemToRemove) {
$iKey = array_search($oItemToRemove, $this->aContents, true);
if ($iKey !== false) {
unset($this->aContents[$iKey]);
return true;
}
return false;
} | php | public function remove($oItemToRemove) {
$iKey = array_search($oItemToRemove, $this->aContents, true);
if ($iKey !== false) {
unset($this->aContents[$iKey]);
return true;
}
return false;
} | [
"public",
"function",
"remove",
"(",
"$",
"oItemToRemove",
")",
"{",
"$",
"iKey",
"=",
"array_search",
"(",
"$",
"oItemToRemove",
",",
"$",
"this",
"->",
"aContents",
",",
"true",
")",
";",
"if",
"(",
"$",
"iKey",
"!==",
"false",
")",
"{",
"unset",
"... | Removes an item from the CSS list.
@param RuleSet|Import|Charset|CSSList $oItemToRemove May be a RuleSet (most likely a DeclarationBlock), a Import, a Charset or another CSSList (most likely a MediaQuery) | [
"Removes",
"an",
"item",
"from",
"the",
"CSS",
"list",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/php-css-parser/CSSList/CSSList.php#L56-L63 |
220,378 | moodle/moodle | lib/php-css-parser/CSSList/CSSList.php | CSSList.setContents | public function setContents(array $aContents) {
$this->aContents = array();
foreach ($aContents as $content) {
$this->append($content);
}
} | php | public function setContents(array $aContents) {
$this->aContents = array();
foreach ($aContents as $content) {
$this->append($content);
}
} | [
"public",
"function",
"setContents",
"(",
"array",
"$",
"aContents",
")",
"{",
"$",
"this",
"->",
"aContents",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"aContents",
"as",
"$",
"content",
")",
"{",
"$",
"this",
"->",
"append",
"(",
"$",
"cont... | Set the contents.
@param array $aContents Objects to set as content. | [
"Set",
"the",
"contents",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/php-css-parser/CSSList/CSSList.php#L69-L74 |
220,379 | moodle/moodle | lib/php-css-parser/CSSList/CSSList.php | CSSList.removeDeclarationBlockBySelector | public function removeDeclarationBlockBySelector($mSelector, $bRemoveAll = false) {
if ($mSelector instanceof DeclarationBlock) {
$mSelector = $mSelector->getSelectors();
}
if (!is_array($mSelector)) {
$mSelector = explode(',', $mSelector);
}
foreach ($mSelector as $iKey => &$mSel) {
if (!($mSel inst... | php | public function removeDeclarationBlockBySelector($mSelector, $bRemoveAll = false) {
if ($mSelector instanceof DeclarationBlock) {
$mSelector = $mSelector->getSelectors();
}
if (!is_array($mSelector)) {
$mSelector = explode(',', $mSelector);
}
foreach ($mSelector as $iKey => &$mSel) {
if (!($mSel inst... | [
"public",
"function",
"removeDeclarationBlockBySelector",
"(",
"$",
"mSelector",
",",
"$",
"bRemoveAll",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"mSelector",
"instanceof",
"DeclarationBlock",
")",
"{",
"$",
"mSelector",
"=",
"$",
"mSelector",
"->",
"getSelectors... | Removes a declaration block from the CSS list if it matches all given selectors.
@param array|string $mSelector The selectors to match.
@param boolean $bRemoveAll Whether to stop at the first declaration block found or remove all blocks | [
"Removes",
"a",
"declaration",
"block",
"from",
"the",
"CSS",
"list",
"if",
"it",
"matches",
"all",
"given",
"selectors",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/php-css-parser/CSSList/CSSList.php#L81-L104 |
220,380 | moodle/moodle | report/loglive/classes/renderer_ajax.php | report_loglive_renderer_ajax.render_report_loglive | protected function render_report_loglive(report_loglive_renderable $reportloglive) {
if (empty($reportloglive->selectedlogreader)) {
return null;
}
$table = $reportloglive->get_table(true);
return $table->out($reportloglive->perpage, false);
} | php | protected function render_report_loglive(report_loglive_renderable $reportloglive) {
if (empty($reportloglive->selectedlogreader)) {
return null;
}
$table = $reportloglive->get_table(true);
return $table->out($reportloglive->perpage, false);
} | [
"protected",
"function",
"render_report_loglive",
"(",
"report_loglive_renderable",
"$",
"reportloglive",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"reportloglive",
"->",
"selectedlogreader",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"table",
"=",
"$",
"re... | Render logs for ajax.
@param report_loglive_renderable $reportloglive object of report_loglive_renderable.
@return string html to be displayed to user. | [
"Render",
"logs",
"for",
"ajax",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/loglive/classes/renderer_ajax.php#L54-L60 |
220,381 | moodle/moodle | lib/lessphp/Parser.php | Less_Parser.Reset | public function Reset( $options = null ){
$this->rules = array();
self::$imports = array();
self::$has_extends = false;
self::$imports = array();
self::$contentsMap = array();
$this->env = new Less_Environment($options);
$this->env->Init();
//set new options
if( is_array($options) ){
$this->SetOp... | php | public function Reset( $options = null ){
$this->rules = array();
self::$imports = array();
self::$has_extends = false;
self::$imports = array();
self::$contentsMap = array();
$this->env = new Less_Environment($options);
$this->env->Init();
//set new options
if( is_array($options) ){
$this->SetOp... | [
"public",
"function",
"Reset",
"(",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"rules",
"=",
"array",
"(",
")",
";",
"self",
"::",
"$",
"imports",
"=",
"array",
"(",
")",
";",
"self",
"::",
"$",
"has_extends",
"=",
"false",
";",
"s... | Reset the parser state completely | [
"Reset",
"the",
"parser",
"state",
"completely"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Parser.php#L104-L119 |
220,382 | moodle/moodle | lib/lessphp/Parser.php | Less_Parser.SetOption | public function SetOption($option,$value){
switch($option){
case 'import_dirs':
$this->SetImportDirs($value);
return;
case 'cache_dir':
if( is_string($value) ){
Less_Cache::SetCacheDir($value);
Less_Cache::CheckCacheDir();
}
return;
}
Less_Parser::$options[$option] = $value;
... | php | public function SetOption($option,$value){
switch($option){
case 'import_dirs':
$this->SetImportDirs($value);
return;
case 'cache_dir':
if( is_string($value) ){
Less_Cache::SetCacheDir($value);
Less_Cache::CheckCacheDir();
}
return;
}
Less_Parser::$options[$option] = $value;
... | [
"public",
"function",
"SetOption",
"(",
"$",
"option",
",",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"option",
")",
"{",
"case",
"'import_dirs'",
":",
"$",
"this",
"->",
"SetImportDirs",
"(",
"$",
"value",
")",
";",
"return",
";",
"case",
"'cache_di... | Set one compiler option | [
"Set",
"one",
"compiler",
"option"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Parser.php#L136-L153 |
220,383 | moodle/moodle | lib/lessphp/Parser.php | Less_Parser.unregisterFunction | public function unregisterFunction($name) {
if( isset($this->env->functions[$name]) )
unset($this->env->functions[$name]);
} | php | public function unregisterFunction($name) {
if( isset($this->env->functions[$name]) )
unset($this->env->functions[$name]);
} | [
"public",
"function",
"unregisterFunction",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"env",
"->",
"functions",
"[",
"$",
"name",
"]",
")",
")",
"unset",
"(",
"$",
"this",
"->",
"env",
"->",
"functions",
"[",
"$",
"nam... | Removed an already registered function
@param string $name function name | [
"Removed",
"an",
"already",
"registered",
"function"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Parser.php#L170-L173 |
220,384 | moodle/moodle | lib/lessphp/Parser.php | Less_Parser.getCss | public function getCss(){
$precision = ini_get('precision');
@ini_set('precision',16);
$locale = setlocale(LC_NUMERIC, 0);
setlocale(LC_NUMERIC, "C");
try {
$root = new Less_Tree_Ruleset(array(), $this->rules );
$root->root = true;
$root->firstRoot = true;
$this->PreVisitors($root);
self... | php | public function getCss(){
$precision = ini_get('precision');
@ini_set('precision',16);
$locale = setlocale(LC_NUMERIC, 0);
setlocale(LC_NUMERIC, "C");
try {
$root = new Less_Tree_Ruleset(array(), $this->rules );
$root->root = true;
$root->firstRoot = true;
$this->PreVisitors($root);
self... | [
"public",
"function",
"getCss",
"(",
")",
"{",
"$",
"precision",
"=",
"ini_get",
"(",
"'precision'",
")",
";",
"@",
"ini_set",
"(",
"'precision'",
",",
"16",
")",
";",
"$",
"locale",
"=",
"setlocale",
"(",
"LC_NUMERIC",
",",
"0",
")",
";",
"setlocale",... | Get the current css buffer
@return string | [
"Get",
"the",
"current",
"css",
"buffer"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Parser.php#L181-L240 |
220,385 | moodle/moodle | lib/lessphp/Parser.php | Less_Parser.PreVisitors | private function PreVisitors($root){
if( Less_Parser::$options['plugins'] ){
foreach(Less_Parser::$options['plugins'] as $plugin){
if( !empty($plugin->isPreEvalVisitor) ){
$plugin->run($root);
}
}
}
} | php | private function PreVisitors($root){
if( Less_Parser::$options['plugins'] ){
foreach(Less_Parser::$options['plugins'] as $plugin){
if( !empty($plugin->isPreEvalVisitor) ){
$plugin->run($root);
}
}
}
} | [
"private",
"function",
"PreVisitors",
"(",
"$",
"root",
")",
"{",
"if",
"(",
"Less_Parser",
"::",
"$",
"options",
"[",
"'plugins'",
"]",
")",
"{",
"foreach",
"(",
"Less_Parser",
"::",
"$",
"options",
"[",
"'plugins'",
"]",
"as",
"$",
"plugin",
")",
"{"... | Run pre-compile visitors | [
"Run",
"pre",
"-",
"compile",
"visitors"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Parser.php#L246-L255 |
220,386 | moodle/moodle | lib/lessphp/Parser.php | Less_Parser.PostVisitors | private function PostVisitors($evaldRoot){
$visitors = array();
$visitors[] = new Less_Visitor_joinSelector();
if( self::$has_extends ){
$visitors[] = new Less_Visitor_processExtends();
}
$visitors[] = new Less_Visitor_toCSS();
if( Less_Parser::$options['plugins'] ){
foreach(Less_Parser::$options['... | php | private function PostVisitors($evaldRoot){
$visitors = array();
$visitors[] = new Less_Visitor_joinSelector();
if( self::$has_extends ){
$visitors[] = new Less_Visitor_processExtends();
}
$visitors[] = new Less_Visitor_toCSS();
if( Less_Parser::$options['plugins'] ){
foreach(Less_Parser::$options['... | [
"private",
"function",
"PostVisitors",
"(",
"$",
"evaldRoot",
")",
"{",
"$",
"visitors",
"=",
"array",
"(",
")",
";",
"$",
"visitors",
"[",
"]",
"=",
"new",
"Less_Visitor_joinSelector",
"(",
")",
";",
"if",
"(",
"self",
"::",
"$",
"has_extends",
")",
"... | Run post-compile visitors | [
"Run",
"post",
"-",
"compile",
"visitors"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Parser.php#L262-L291 |
220,387 | moodle/moodle | lib/lessphp/Parser.php | Less_Parser.parse | public function parse( $str, $file_uri = null ){
if( !$file_uri ){
$uri_root = '';
$filename = 'anonymous-file-'.Less_Parser::$next_id++.'.less';
}else{
$file_uri = self::WinPath($file_uri);
$filename = $file_uri;
$uri_root = dirname($file_uri);
}
$previousFileInfo = $this->env->currentFileInfo... | php | public function parse( $str, $file_uri = null ){
if( !$file_uri ){
$uri_root = '';
$filename = 'anonymous-file-'.Less_Parser::$next_id++.'.less';
}else{
$file_uri = self::WinPath($file_uri);
$filename = $file_uri;
$uri_root = dirname($file_uri);
}
$previousFileInfo = $this->env->currentFileInfo... | [
"public",
"function",
"parse",
"(",
"$",
"str",
",",
"$",
"file_uri",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"file_uri",
")",
"{",
"$",
"uri_root",
"=",
"''",
";",
"$",
"filename",
"=",
"'anonymous-file-'",
".",
"Less_Parser",
"::",
"$",
"next_i... | Parse a Less string into css
@param string $str The string to convert
@param string $uri_root The url of the file
@return Less_Tree_Ruleset|Less_Parser | [
"Parse",
"a",
"Less",
"string",
"into",
"css"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Parser.php#L301-L324 |
220,388 | moodle/moodle | lib/lessphp/Parser.php | Less_Parser.ModifyVars | public function ModifyVars( $vars ){
$this->input = Less_Parser::serializeVars( $vars );
$this->_parse();
return $this;
} | php | public function ModifyVars( $vars ){
$this->input = Less_Parser::serializeVars( $vars );
$this->_parse();
return $this;
} | [
"public",
"function",
"ModifyVars",
"(",
"$",
"vars",
")",
"{",
"$",
"this",
"->",
"input",
"=",
"Less_Parser",
"::",
"serializeVars",
"(",
"$",
"vars",
")",
";",
"$",
"this",
"->",
"_parse",
"(",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Allows a user to set variables values
@param array $vars
@return Less_Parser | [
"Allows",
"a",
"user",
"to",
"set",
"variables",
"values"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Parser.php#L383-L389 |
220,389 | moodle/moodle | lib/lessphp/Parser.php | Less_Parser.SetImportDirs | public function SetImportDirs( $dirs ){
Less_Parser::$options['import_dirs'] = array();
foreach($dirs as $path => $uri_root){
$path = self::WinPath($path);
if( !empty($path) ){
$path = rtrim($path,'/').'/';
}
if ( !is_callable($uri_root) ){
$uri_root = self::WinPath($uri_root);
if( !empty... | php | public function SetImportDirs( $dirs ){
Less_Parser::$options['import_dirs'] = array();
foreach($dirs as $path => $uri_root){
$path = self::WinPath($path);
if( !empty($path) ){
$path = rtrim($path,'/').'/';
}
if ( !is_callable($uri_root) ){
$uri_root = self::WinPath($uri_root);
if( !empty... | [
"public",
"function",
"SetImportDirs",
"(",
"$",
"dirs",
")",
"{",
"Less_Parser",
"::",
"$",
"options",
"[",
"'import_dirs'",
"]",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"dirs",
"as",
"$",
"path",
"=>",
"$",
"uri_root",
")",
"{",
"$",
"pat... | Set a list of directories or callbacks the parser should use for determining import paths
@param array $dirs | [
"Set",
"a",
"list",
"of",
"directories",
"or",
"callbacks",
"the",
"parser",
"should",
"use",
"for",
"determining",
"import",
"paths"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Parser.php#L464-L483 |
220,390 | moodle/moodle | lib/lessphp/Parser.php | Less_Parser.SetInput | public function SetInput( $file_path ){
if( $file_path ){
$this->input = file_get_contents( $file_path );
}
$this->pos = $this->furthest = 0;
// Remove potential UTF Byte Order Mark
$this->input = preg_replace('/\\G\xEF\xBB\xBF/', '', $this->input);
$this->input_len = strlen($this->input);
if( Les... | php | public function SetInput( $file_path ){
if( $file_path ){
$this->input = file_get_contents( $file_path );
}
$this->pos = $this->furthest = 0;
// Remove potential UTF Byte Order Mark
$this->input = preg_replace('/\\G\xEF\xBB\xBF/', '', $this->input);
$this->input_len = strlen($this->input);
if( Les... | [
"public",
"function",
"SetInput",
"(",
"$",
"file_path",
")",
"{",
"if",
"(",
"$",
"file_path",
")",
"{",
"$",
"this",
"->",
"input",
"=",
"file_get_contents",
"(",
"$",
"file_path",
")",
";",
"}",
"$",
"this",
"->",
"pos",
"=",
"$",
"this",
"->",
... | Set up the input buffer | [
"Set",
"up",
"the",
"input",
"buffer"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Parser.php#L588-L606 |
220,391 | moodle/moodle | lib/lessphp/Parser.php | Less_Parser.UnsetInput | public function UnsetInput(){
unset($this->input, $this->pos, $this->input_len, $this->furthest);
$this->saveStack = array();
} | php | public function UnsetInput(){
unset($this->input, $this->pos, $this->input_len, $this->furthest);
$this->saveStack = array();
} | [
"public",
"function",
"UnsetInput",
"(",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"input",
",",
"$",
"this",
"->",
"pos",
",",
"$",
"this",
"->",
"input_len",
",",
"$",
"this",
"->",
"furthest",
")",
";",
"$",
"this",
"->",
"saveStack",
"=",
"arr... | Free up some memory | [
"Free",
"up",
"some",
"memory"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Parser.php#L613-L616 |
220,392 | moodle/moodle | lib/lessphp/Parser.php | Less_Parser.match | private function match($toks){
// The match is confirmed, add the match length to `this::pos`,
// and consume any extra white-space characters (' ' || '\n')
// which come after that. The reason for this is that LeSS's
// grammar is mostly white-space insensitive.
//
foreach($toks as $tok){
$char = $to... | php | private function match($toks){
// The match is confirmed, add the match length to `this::pos`,
// and consume any extra white-space characters (' ' || '\n')
// which come after that. The reason for this is that LeSS's
// grammar is mostly white-space insensitive.
//
foreach($toks as $tok){
$char = $to... | [
"private",
"function",
"match",
"(",
"$",
"toks",
")",
"{",
"// The match is confirmed, add the match length to `this::pos`,",
"// and consume any extra white-space characters (' ' || '\\n')",
"// which come after that. The reason for this is that LeSS's",
"// grammar is mostly white-space ins... | Parse from a token, regexp or string, and move forward if match
@param array $toks
@return array | [
"Parse",
"from",
"a",
"token",
"regexp",
"or",
"string",
"and",
"move",
"forward",
"if",
"match"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Parser.php#L677-L709 |
220,393 | moodle/moodle | lib/lessphp/Parser.php | Less_Parser.MatchChar | private function MatchChar($tok){
if( ($this->pos < $this->input_len) && ($this->input[$this->pos] === $tok) ){
$this->skipWhitespace(1);
return $tok;
}
} | php | private function MatchChar($tok){
if( ($this->pos < $this->input_len) && ($this->input[$this->pos] === $tok) ){
$this->skipWhitespace(1);
return $tok;
}
} | [
"private",
"function",
"MatchChar",
"(",
"$",
"tok",
")",
"{",
"if",
"(",
"(",
"$",
"this",
"->",
"pos",
"<",
"$",
"this",
"->",
"input_len",
")",
"&&",
"(",
"$",
"this",
"->",
"input",
"[",
"$",
"this",
"->",
"pos",
"]",
"===",
"$",
"tok",
")"... | Match a single character in the input, | [
"Match",
"a",
"single",
"character",
"in",
"the",
"input"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Parser.php#L730-L735 |
220,394 | moodle/moodle | lib/lessphp/Parser.php | Less_Parser.MatchReg | private function MatchReg($tok){
if( preg_match($tok, $this->input, $match, 0, $this->pos) ){
$this->skipWhitespace(strlen($match[0]));
return $match;
}
} | php | private function MatchReg($tok){
if( preg_match($tok, $this->input, $match, 0, $this->pos) ){
$this->skipWhitespace(strlen($match[0]));
return $match;
}
} | [
"private",
"function",
"MatchReg",
"(",
"$",
"tok",
")",
"{",
"if",
"(",
"preg_match",
"(",
"$",
"tok",
",",
"$",
"this",
"->",
"input",
",",
"$",
"match",
",",
"0",
",",
"$",
"this",
"->",
"pos",
")",
")",
"{",
"$",
"this",
"->",
"skipWhitespace... | Match a regexp from the current start point | [
"Match",
"a",
"regexp",
"from",
"the",
"current",
"start",
"point"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Parser.php#L738-L744 |
220,395 | moodle/moodle | lib/lessphp/Parser.php | Less_Parser.parseComment | private function parseComment(){
if( $this->input[$this->pos] !== '/' ){
return;
}
if( $this->input[$this->pos+1] === '/' ){
$match = $this->MatchReg('/\\G\/\/.*/');
return $this->NewObj4('Less_Tree_Comment',array($match[0], true, $this->pos, $this->env->currentFileInfo));
}
//$comment = $this->Ma... | php | private function parseComment(){
if( $this->input[$this->pos] !== '/' ){
return;
}
if( $this->input[$this->pos+1] === '/' ){
$match = $this->MatchReg('/\\G\/\/.*/');
return $this->NewObj4('Less_Tree_Comment',array($match[0], true, $this->pos, $this->env->currentFileInfo));
}
//$comment = $this->Ma... | [
"private",
"function",
"parseComment",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"input",
"[",
"$",
"this",
"->",
"pos",
"]",
"!==",
"'/'",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"input",
"[",
"$",
"this",
"->",
"pos",
"... | over them. | [
"over",
"them",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Parser.php#L891-L907 |
220,396 | moodle/moodle | lib/lessphp/Parser.php | Less_Parser.parseEntitiesArguments | private function parseEntitiesArguments(){
$args = array();
while( true ){
$arg = $this->MatchFuncs( array('parseEntitiesAssignment','parseExpression') );
if( !$arg ){
break;
}
$args[] = $arg;
if( !$this->MatchChar(',') ){
break;
}
}
return $args;
} | php | private function parseEntitiesArguments(){
$args = array();
while( true ){
$arg = $this->MatchFuncs( array('parseEntitiesAssignment','parseExpression') );
if( !$arg ){
break;
}
$args[] = $arg;
if( !$this->MatchChar(',') ){
break;
}
}
return $args;
} | [
"private",
"function",
"parseEntitiesArguments",
"(",
")",
"{",
"$",
"args",
"=",
"array",
"(",
")",
";",
"while",
"(",
"true",
")",
"{",
"$",
"arg",
"=",
"$",
"this",
"->",
"MatchFuncs",
"(",
"array",
"(",
"'parseEntitiesAssignment'",
",",
"'parseExpressi... | Parse a list of arguments
@return array | [
"Parse",
"a",
"list",
"of",
"arguments"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Parser.php#L1044-L1059 |
220,397 | moodle/moodle | lib/lessphp/Parser.php | Less_Parser.parseMultiplication | function parseMultiplication(){
$return = $m = $this->parseOperand();
if( $return ){
while( true ){
$isSpaced = $this->isWhitespace( -1 );
if( $this->PeekReg('/\\G\/[*\/]/') ){
break;
}
$op = $this->MatchChar('/');
if( !$op ){
$op = $this->MatchChar('*');
if( !$op ){
... | php | function parseMultiplication(){
$return = $m = $this->parseOperand();
if( $return ){
while( true ){
$isSpaced = $this->isWhitespace( -1 );
if( $this->PeekReg('/\\G\/[*\/]/') ){
break;
}
$op = $this->MatchChar('/');
if( !$op ){
$op = $this->MatchChar('*');
if( !$op ){
... | [
"function",
"parseMultiplication",
"(",
")",
"{",
"$",
"return",
"=",
"$",
"m",
"=",
"$",
"this",
"->",
"parseOperand",
"(",
")",
";",
"if",
"(",
"$",
"return",
")",
"{",
"while",
"(",
"true",
")",
"{",
"$",
"isSpaced",
"=",
"$",
"this",
"->",
"i... | Parses multiplication operation
@return Less_Tree_Operation|null | [
"Parses",
"multiplication",
"operation"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Parser.php#L2222-L2253 |
220,398 | moodle/moodle | lib/lessphp/Parser.php | Less_Parser.parseAddition | private function parseAddition (){
$return = $m = $this->parseMultiplication();
if( $return ){
while( true ){
$isSpaced = $this->isWhitespace( -1 );
$op = $this->MatchReg('/\\G[-+]\s+/');
if( $op ){
$op = $op[0];
}else{
if( !$isSpaced ){
$op = $this->match(array('#+','#-'));
... | php | private function parseAddition (){
$return = $m = $this->parseMultiplication();
if( $return ){
while( true ){
$isSpaced = $this->isWhitespace( -1 );
$op = $this->MatchReg('/\\G[-+]\s+/');
if( $op ){
$op = $op[0];
}else{
if( !$isSpaced ){
$op = $this->match(array('#+','#-'));
... | [
"private",
"function",
"parseAddition",
"(",
")",
"{",
"$",
"return",
"=",
"$",
"m",
"=",
"$",
"this",
"->",
"parseMultiplication",
"(",
")",
";",
"if",
"(",
"$",
"return",
")",
"{",
"while",
"(",
"true",
")",
"{",
"$",
"isSpaced",
"=",
"$",
"this"... | Parses an addition operation
@return Less_Tree_Operation|null | [
"Parses",
"an",
"addition",
"operation"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Parser.php#L2261-L2293 |
220,399 | moodle/moodle | lib/lessphp/Parser.php | Less_Parser.parseConditions | private function parseConditions() {
$index = $this->pos;
$return = $a = $this->parseCondition();
if( $a ){
while( true ){
if( !$this->PeekReg('/\\G,\s*(not\s*)?\(/') || !$this->MatchChar(',') ){
break;
}
$b = $this->parseCondition();
if( !$b ){
break;
}
$return = $this->New... | php | private function parseConditions() {
$index = $this->pos;
$return = $a = $this->parseCondition();
if( $a ){
while( true ){
if( !$this->PeekReg('/\\G,\s*(not\s*)?\(/') || !$this->MatchChar(',') ){
break;
}
$b = $this->parseCondition();
if( !$b ){
break;
}
$return = $this->New... | [
"private",
"function",
"parseConditions",
"(",
")",
"{",
"$",
"index",
"=",
"$",
"this",
"->",
"pos",
";",
"$",
"return",
"=",
"$",
"a",
"=",
"$",
"this",
"->",
"parseCondition",
"(",
")",
";",
"if",
"(",
"$",
"a",
")",
"{",
"while",
"(",
"true",... | Parses the conditions
@return Less_Tree_Condition|null | [
"Parses",
"the",
"conditions"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Parser.php#L2301-L2318 |
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.