id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
218,300 | moodle/moodle | lib/excellib.class.php | MoodleExcelWorkbook.close | public function close() {
global $CFG;
foreach ($this->objPHPExcel->getAllSheets() as $sheet){
$sheet->setSelectedCells('A1');
}
$this->objPHPExcel->setActiveSheetIndex(0);
$filename = preg_replace('/\.xlsx?$/i', '', $this->filename);
$mimetype = 'applicati... | php | public function close() {
global $CFG;
foreach ($this->objPHPExcel->getAllSheets() as $sheet){
$sheet->setSelectedCells('A1');
}
$this->objPHPExcel->setActiveSheetIndex(0);
$filename = preg_replace('/\.xlsx?$/i', '', $this->filename);
$mimetype = 'applicati... | [
"public",
"function",
"close",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"foreach",
"(",
"$",
"this",
"->",
"objPHPExcel",
"->",
"getAllSheets",
"(",
")",
"as",
"$",
"sheet",
")",
"{",
"$",
"sheet",
"->",
"setSelectedCells",
"(",
"'A1'",
")",
";",
"}... | Close the Moodle Workbook | [
"Close",
"the",
"Moodle",
"Workbook"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/excellib.class.php#L96-L130 |
218,301 | moodle/moodle | lib/excellib.class.php | MoodleExcelWorksheet.insert_bitmap | public function insert_bitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1) {
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setPath($bitmap);
$objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex($col) . ($row+1));
$objDrawing->setOffsetX($x);... | php | public function insert_bitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1) {
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setPath($bitmap);
$objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex($col) . ($row+1));
$objDrawing->setOffsetX($x);... | [
"public",
"function",
"insert_bitmap",
"(",
"$",
"row",
",",
"$",
"col",
",",
"$",
"bitmap",
",",
"$",
"x",
"=",
"0",
",",
"$",
"y",
"=",
"0",
",",
"$",
"scale_x",
"=",
"1",
",",
"$",
"scale_y",
"=",
"1",
")",
"{",
"$",
"objDrawing",
"=",
"ne... | Insert an image in a worksheet.
@param integer $row The row we are going to insert the bitmap into
@param integer $col The column we are going to insert the bitmap into
@param string $bitmap The bitmap filename
@param integer $x The horizontal position (offset) of the image inside the cell.
@param inte... | [
"Insert",
"an",
"image",
"in",
"a",
"worksheet",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/excellib.class.php#L384-L399 |
218,302 | moodle/moodle | lib/excellib.class.php | MoodleExcelFormat.set_bg_color | public function set_bg_color($color) {
if (!isset($this->format['fill']['type'])) {
$this->format['fill']['type'] = PHPExcel_Style_Fill::FILL_SOLID;
}
$this->format['fill']['color']['rgb'] = $this->parse_color($color);
} | php | public function set_bg_color($color) {
if (!isset($this->format['fill']['type'])) {
$this->format['fill']['type'] = PHPExcel_Style_Fill::FILL_SOLID;
}
$this->format['fill']['color']['rgb'] = $this->parse_color($color);
} | [
"public",
"function",
"set_bg_color",
"(",
"$",
"color",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"format",
"[",
"'fill'",
"]",
"[",
"'type'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"format",
"[",
"'fill'",
"]",
"[",
"'type'",
"... | Set background color of the cell.
@param mixed $color either a string (like 'blue'), or an integer (range is [8...63]) | [
"Set",
"background",
"color",
"of",
"the",
"cell",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/excellib.class.php#L658-L663 |
218,303 | moodle/moodle | lib/excellib.class.php | MoodleExcelFormat.set_h_align | public function set_h_align($location) {
switch ($location) {
case 'left':
$this->format['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_LEFT;
break;
case 'center':
case 'centre':
$this->format['alignment']['ho... | php | public function set_h_align($location) {
switch ($location) {
case 'left':
$this->format['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_LEFT;
break;
case 'center':
case 'centre':
$this->format['alignment']['ho... | [
"public",
"function",
"set_h_align",
"(",
"$",
"location",
")",
"{",
"switch",
"(",
"$",
"location",
")",
"{",
"case",
"'left'",
":",
"$",
"this",
"->",
"format",
"[",
"'alignment'",
"]",
"[",
"'horizontal'",
"]",
"=",
"PHPExcel_Style_Alignment",
"::",
"HO... | Set the cell horizontal alignment of the format.
@param string $location alignment for the cell ('left', 'right', 'justify', etc...) | [
"Set",
"the",
"cell",
"horizontal",
"alignment",
"of",
"the",
"format",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/excellib.class.php#L708-L726 |
218,304 | moodle/moodle | lib/excellib.class.php | MoodleExcelFormat.set_v_align | public function set_v_align($location) {
switch ($location) {
case 'top':
$this->format['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_TOP;
break;
case 'vcentre':
case 'vcenter':
case 'centre':
case 'cente... | php | public function set_v_align($location) {
switch ($location) {
case 'top':
$this->format['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_TOP;
break;
case 'vcentre':
case 'vcenter':
case 'centre':
case 'cente... | [
"public",
"function",
"set_v_align",
"(",
"$",
"location",
")",
"{",
"switch",
"(",
"$",
"location",
")",
"{",
"case",
"'top'",
":",
"$",
"this",
"->",
"format",
"[",
"'alignment'",
"]",
"[",
"'vertical'",
"]",
"=",
"PHPExcel_Style_Alignment",
"::",
"VERTI... | Set the cell vertical alignment of the format.
@param string $location alignment for the cell ('top', 'bottom', 'center', 'justify') | [
"Set",
"the",
"cell",
"vertical",
"alignment",
"of",
"the",
"format",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/excellib.class.php#L733-L751 |
218,305 | moodle/moodle | lib/excellib.class.php | MoodleExcelFormat.set_top | public function set_top($style) {
if ($style == 1) {
$this->format['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
} else if ($style == 2) {
$this->format['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THICK;
} else {
$this->format... | php | public function set_top($style) {
if ($style == 1) {
$this->format['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
} else if ($style == 2) {
$this->format['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THICK;
} else {
$this->format... | [
"public",
"function",
"set_top",
"(",
"$",
"style",
")",
"{",
"if",
"(",
"$",
"style",
"==",
"1",
")",
"{",
"$",
"this",
"->",
"format",
"[",
"'borders'",
"]",
"[",
"'top'",
"]",
"[",
"'style'",
"]",
"=",
"PHPExcel_Style_Border",
"::",
"BORDER_THIN",
... | Set the top border of the format.
@param integer $style style for the cell. 1 => thin, 2 => thick | [
"Set",
"the",
"top",
"border",
"of",
"the",
"format",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/excellib.class.php#L758-L766 |
218,306 | moodle/moodle | lib/excellib.class.php | MoodleExcelFormat.set_bottom | public function set_bottom($style) {
if ($style == 1) {
$this->format['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
} else if ($style == 2) {
$this->format['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THICK;
} else {
$thi... | php | public function set_bottom($style) {
if ($style == 1) {
$this->format['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
} else if ($style == 2) {
$this->format['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THICK;
} else {
$thi... | [
"public",
"function",
"set_bottom",
"(",
"$",
"style",
")",
"{",
"if",
"(",
"$",
"style",
"==",
"1",
")",
"{",
"$",
"this",
"->",
"format",
"[",
"'borders'",
"]",
"[",
"'bottom'",
"]",
"[",
"'style'",
"]",
"=",
"PHPExcel_Style_Border",
"::",
"BORDER_TH... | Set the bottom border of the format.
@param integer $style style for the cell. 1 => thin, 2 => thick | [
"Set",
"the",
"bottom",
"border",
"of",
"the",
"format",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/excellib.class.php#L773-L781 |
218,307 | moodle/moodle | lib/excellib.class.php | MoodleExcelFormat.set_left | public function set_left($style) {
if ($style == 1) {
$this->format['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
} else if ($style == 2) {
$this->format['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THICK;
} else {
$this->for... | php | public function set_left($style) {
if ($style == 1) {
$this->format['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
} else if ($style == 2) {
$this->format['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THICK;
} else {
$this->for... | [
"public",
"function",
"set_left",
"(",
"$",
"style",
")",
"{",
"if",
"(",
"$",
"style",
"==",
"1",
")",
"{",
"$",
"this",
"->",
"format",
"[",
"'borders'",
"]",
"[",
"'left'",
"]",
"[",
"'style'",
"]",
"=",
"PHPExcel_Style_Border",
"::",
"BORDER_THIN",... | Set the left border of the format.
@param integer $style style for the cell. 1 => thin, 2 => thick | [
"Set",
"the",
"left",
"border",
"of",
"the",
"format",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/excellib.class.php#L788-L796 |
218,308 | moodle/moodle | lib/excellib.class.php | MoodleExcelFormat.set_right | public function set_right($style) {
if ($style == 1) {
$this->format['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
} else if ($style == 2) {
$this->format['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THICK;
} else {
$this->... | php | public function set_right($style) {
if ($style == 1) {
$this->format['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
} else if ($style == 2) {
$this->format['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THICK;
} else {
$this->... | [
"public",
"function",
"set_right",
"(",
"$",
"style",
")",
"{",
"if",
"(",
"$",
"style",
"==",
"1",
")",
"{",
"$",
"this",
"->",
"format",
"[",
"'borders'",
"]",
"[",
"'right'",
"]",
"[",
"'style'",
"]",
"=",
"PHPExcel_Style_Border",
"::",
"BORDER_THIN... | Set the right border of the format.
@param integer $style style for the cell. 1 => thin, 2 => thick | [
"Set",
"the",
"right",
"border",
"of",
"the",
"format",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/excellib.class.php#L803-L811 |
218,309 | moodle/moodle | calendar/classes/local/api.php | api.get_events | public static function get_events(
$timestartfrom = null,
$timestartto = null,
$timesortfrom = null,
$timesortto = null,
$timestartaftereventid = null,
$timesortaftereventid = null,
$limitnum = 20,
$type = null,
array $usersfilter = null,
a... | php | public static function get_events(
$timestartfrom = null,
$timestartto = null,
$timesortfrom = null,
$timesortto = null,
$timestartaftereventid = null,
$timesortaftereventid = null,
$limitnum = 20,
$type = null,
array $usersfilter = null,
a... | [
"public",
"static",
"function",
"get_events",
"(",
"$",
"timestartfrom",
"=",
"null",
",",
"$",
"timestartto",
"=",
"null",
",",
"$",
"timesortfrom",
"=",
"null",
",",
"$",
"timesortto",
"=",
"null",
",",
"$",
"timestartaftereventid",
"=",
"null",
",",
"$"... | Get all events restricted by various parameters, taking in to account user and group overrides.
@param int|null $timestartfrom Events with timestart from this value (inclusive).
@param int|null $timestartto Events with timestart until this value (inclusive).
@param int|null $timesortfr... | [
"Get",
"all",
"events",
"restricted",
"by",
"various",
"parameters",
"taking",
"in",
"to",
"account",
"user",
"and",
"group",
"overrides",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/local/api.php#L62-L111 |
218,310 | moodle/moodle | calendar/classes/local/api.php | api.get_action_events_by_timesort | public static function get_action_events_by_timesort(
$timesortfrom = null,
$timesortto = null,
$aftereventid = null,
$limitnum = 20,
$limittononsuspendedevents = false,
?\stdClass $user = null
) {
global $USER;
if (!$user) {
$user = $USER... | php | public static function get_action_events_by_timesort(
$timesortfrom = null,
$timesortto = null,
$aftereventid = null,
$limitnum = 20,
$limittononsuspendedevents = false,
?\stdClass $user = null
) {
global $USER;
if (!$user) {
$user = $USER... | [
"public",
"static",
"function",
"get_action_events_by_timesort",
"(",
"$",
"timesortfrom",
"=",
"null",
",",
"$",
"timesortto",
"=",
"null",
",",
"$",
"aftereventid",
"=",
"null",
",",
"$",
"limitnum",
"=",
"20",
",",
"$",
"limittononsuspendedevents",
"=",
"fa... | Get a list of action events for the logged in user by the given
timesort values.
@param int|null $timesortfrom The start timesort value (inclusive)
@param int|null $timesortto The end timesort value (inclusive)
@param int|null $aftereventid Only return events after this one
@param int $limitnum Limit results to this a... | [
"Get",
"a",
"list",
"of",
"action",
"events",
"for",
"the",
"logged",
"in",
"user",
"by",
"the",
"given",
"timesort",
"values",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/local/api.php#L126-L158 |
218,311 | moodle/moodle | calendar/classes/local/api.php | api.get_action_events_by_course | public static function get_action_events_by_course(
$course,
$timesortfrom = null,
$timesortto = null,
$aftereventid = null,
$limitnum = 20
) {
global $USER;
if ($limitnum < 1 || $limitnum > 50) {
throw new limit_invalid_parameter_exception(
... | php | public static function get_action_events_by_course(
$course,
$timesortfrom = null,
$timesortto = null,
$aftereventid = null,
$limitnum = 20
) {
global $USER;
if ($limitnum < 1 || $limitnum > 50) {
throw new limit_invalid_parameter_exception(
... | [
"public",
"static",
"function",
"get_action_events_by_course",
"(",
"$",
"course",
",",
"$",
"timesortfrom",
"=",
"null",
",",
"$",
"timesortto",
"=",
"null",
",",
"$",
"aftereventid",
"=",
"null",
",",
"$",
"limitnum",
"=",
"20",
")",
"{",
"global",
"$",
... | Get a list of action events for the logged in user by the given
course and timesort values.
@param \stdClass $course The course the events must belong to
@param int|null $timesortfrom The start timesort value (inclusive)
@param int|null $timesortto The end timesort value (inclusive)
@param int|null $aftereventid Only ... | [
"Get",
"a",
"list",
"of",
"action",
"events",
"for",
"the",
"logged",
"in",
"user",
"by",
"the",
"given",
"course",
"and",
"timesort",
"values",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/local/api.php#L172-L195 |
218,312 | moodle/moodle | calendar/classes/local/api.php | api.get_action_events_by_courses | public static function get_action_events_by_courses(
$courses = [],
$timesortfrom = null,
$timesortto = null,
$limitnum = 20
) {
$return = [];
foreach ($courses as $course) {
$return[$course->id] = self::get_action_events_by_course(
$cours... | php | public static function get_action_events_by_courses(
$courses = [],
$timesortfrom = null,
$timesortto = null,
$limitnum = 20
) {
$return = [];
foreach ($courses as $course) {
$return[$course->id] = self::get_action_events_by_course(
$cours... | [
"public",
"static",
"function",
"get_action_events_by_courses",
"(",
"$",
"courses",
"=",
"[",
"]",
",",
"$",
"timesortfrom",
"=",
"null",
",",
"$",
"timesortto",
"=",
"null",
",",
"$",
"limitnum",
"=",
"20",
")",
"{",
"$",
"return",
"=",
"[",
"]",
";"... | Get a list of action events for the logged in user by the given
courses and timesort values.
The limit number applies per course, not for the result set as a whole.
E.g. Requesting 3 courses with a limit of 10 will result in up to 30
events being returned (up to 10 per course).
@param array $courses The courses the e... | [
"Get",
"a",
"list",
"of",
"action",
"events",
"for",
"the",
"logged",
"in",
"user",
"by",
"the",
"given",
"courses",
"and",
"timesort",
"values",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/local/api.php#L211-L230 |
218,313 | moodle/moodle | calendar/classes/local/api.php | api.update_event_start_day | public static function update_event_start_day(
event_interface $event,
\DateTimeInterface $startdate
) {
global $DB;
$mapper = container::get_event_mapper();
$legacyevent = $mapper->from_event_to_legacy_event($event);
$hascoursemodule = !empty($event->get_course_modu... | php | public static function update_event_start_day(
event_interface $event,
\DateTimeInterface $startdate
) {
global $DB;
$mapper = container::get_event_mapper();
$legacyevent = $mapper->from_event_to_legacy_event($event);
$hascoursemodule = !empty($event->get_course_modu... | [
"public",
"static",
"function",
"update_event_start_day",
"(",
"event_interface",
"$",
"event",
",",
"\\",
"DateTimeInterface",
"$",
"startdate",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"mapper",
"=",
"container",
"::",
"get_event_mapper",
"(",
")",
";",
"$",... | Change the start day for an event. Only the date will be
modified, the time of day for the event will be left as is.
@param event_interface $event The existing event to modify
@param DateTimeInterface $startdate The new date to use for the start day
@return event_interface The new event with updated start date | [
"Change",
"the",
"start",
"day",
"for",
"an",
"event",
".",
"Only",
"the",
"date",
"will",
"be",
"modified",
"the",
"time",
"of",
"day",
"for",
"the",
"event",
"will",
"be",
"left",
"as",
"is",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/local/api.php#L240-L324 |
218,314 | moodle/moodle | lib/userkey/classes/privacy/provider.php | provider.get_user_contexts_with_script | public static function get_user_contexts_with_script(userlist $userlist, \context $context, string $script,
int $instance = null) {
if (!$context instanceof \context_user) {
return;
}
$params = [
'userid' => $conte... | php | public static function get_user_contexts_with_script(userlist $userlist, \context $context, string $script,
int $instance = null) {
if (!$context instanceof \context_user) {
return;
}
$params = [
'userid' => $conte... | [
"public",
"static",
"function",
"get_user_contexts_with_script",
"(",
"userlist",
"$",
"userlist",
",",
"\\",
"context",
"$",
"context",
",",
"string",
"$",
"script",
",",
"int",
"$",
"instance",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"context",
"inst... | Get the list of users within a specific context for this system.
@param userlist $userlist The userlist containing the list of users who have data in this context/plugin combination.
@param context $context The context.
@param string $script The unique target identifier.
@param int $instance The instance ID. | [
"Get",
"the",
"list",
"of",
"users",
"within",
"a",
"specific",
"context",
"for",
"this",
"system",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/userkey/classes/privacy/provider.php#L76-L101 |
218,315 | moodle/moodle | lib/userkey/classes/privacy/provider.php | provider.delete_userkeys | public static function delete_userkeys(string $script, $userid = null, $instance = null) {
global $DB;
$searchparams = [
'script' => $script,
];
if (null !== $userid) {
$searchparams['userid'] = $userid;
}
if (null !== $instance) {
$... | php | public static function delete_userkeys(string $script, $userid = null, $instance = null) {
global $DB;
$searchparams = [
'script' => $script,
];
if (null !== $userid) {
$searchparams['userid'] = $userid;
}
if (null !== $instance) {
$... | [
"public",
"static",
"function",
"delete_userkeys",
"(",
"string",
"$",
"script",
",",
"$",
"userid",
"=",
"null",
",",
"$",
"instance",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"searchparams",
"=",
"[",
"'script'",
"=>",
"$",
"script",
","... | Deletes all userkeys for a script.
@param string $script The owner of the data (usually a component name).
@param int $userid The owner of the data.
@param int $instance The instance owner of the data. | [
"Deletes",
"all",
"userkeys",
"for",
"a",
"script",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/userkey/classes/privacy/provider.php#L153-L169 |
218,316 | moodle/moodle | lib/phpexcel/PHPExcel/Shared/String.php | PHPExcel_Shared_String.SanitizeUTF8 | public static function SanitizeUTF8($value)
{
if (self::getIsIconvEnabled()) {
$value = @iconv('UTF-8', 'UTF-8', $value);
return $value;
}
if (self::getIsMbstringEnabled()) {
$value = mb_convert_encoding($value, 'UTF-8', 'UTF-8');
return $valu... | php | public static function SanitizeUTF8($value)
{
if (self::getIsIconvEnabled()) {
$value = @iconv('UTF-8', 'UTF-8', $value);
return $value;
}
if (self::getIsMbstringEnabled()) {
$value = mb_convert_encoding($value, 'UTF-8', 'UTF-8');
return $valu... | [
"public",
"static",
"function",
"SanitizeUTF8",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"self",
"::",
"getIsIconvEnabled",
"(",
")",
")",
"{",
"$",
"value",
"=",
"@",
"iconv",
"(",
"'UTF-8'",
",",
"'UTF-8'",
",",
"$",
"value",
")",
";",
"return",
"$"... | Try to sanitize UTF8, stripping invalid byte sequences. Not perfect. Does not surrogate characters.
@param string $value
@return string | [
"Try",
"to",
"sanitize",
"UTF8",
"stripping",
"invalid",
"byte",
"sequences",
".",
"Not",
"perfect",
".",
"Does",
"not",
"surrogate",
"characters",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Shared/String.php#L376-L390 |
218,317 | moodle/moodle | lib/phpexcel/PHPExcel/Shared/String.php | PHPExcel_Shared_String.Substring | public static function Substring($pValue = '', $pStart = 0, $pLength = 0)
{
if (self::getIsMbstringEnabled()) {
return mb_substr($pValue, $pStart, $pLength, 'UTF-8');
}
if (self::getIsIconvEnabled()) {
return iconv_substr($pValue, $pStart, $pLength, 'UTF-8');
... | php | public static function Substring($pValue = '', $pStart = 0, $pLength = 0)
{
if (self::getIsMbstringEnabled()) {
return mb_substr($pValue, $pStart, $pLength, 'UTF-8');
}
if (self::getIsIconvEnabled()) {
return iconv_substr($pValue, $pStart, $pLength, 'UTF-8');
... | [
"public",
"static",
"function",
"Substring",
"(",
"$",
"pValue",
"=",
"''",
",",
"$",
"pStart",
"=",
"0",
",",
"$",
"pLength",
"=",
"0",
")",
"{",
"if",
"(",
"self",
"::",
"getIsMbstringEnabled",
"(",
")",
")",
"{",
"return",
"mb_substr",
"(",
"$",
... | Get a substring of a UTF-8 encoded string. First try mbstring, then iconv, finally strlen
@param string $pValue UTF-8 encoded string
@param int $pStart Start offset
@param int $pLength Maximum number of characters in substring
@return string | [
"Get",
"a",
"substring",
"of",
"a",
"UTF",
"-",
"8",
"encoded",
"string",
".",
"First",
"try",
"mbstring",
"then",
"iconv",
"finally",
"strlen"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Shared/String.php#L578-L590 |
218,318 | moodle/moodle | lib/phpexcel/PHPExcel/Shared/String.php | PHPExcel_Shared_String.StrCaseReverse | public static function StrCaseReverse($pValue = '')
{
if (self::getIsMbstringEnabled()) {
$characters = self::mb_str_split($pValue);
foreach ($characters as &$character) {
if (self::mb_is_upper($character)) {
$character = mb_strtolower($character, ... | php | public static function StrCaseReverse($pValue = '')
{
if (self::getIsMbstringEnabled()) {
$characters = self::mb_str_split($pValue);
foreach ($characters as &$character) {
if (self::mb_is_upper($character)) {
$character = mb_strtolower($character, ... | [
"public",
"static",
"function",
"StrCaseReverse",
"(",
"$",
"pValue",
"=",
"''",
")",
"{",
"if",
"(",
"self",
"::",
"getIsMbstringEnabled",
"(",
")",
")",
"{",
"$",
"characters",
"=",
"self",
"::",
"mb_str_split",
"(",
"$",
"pValue",
")",
";",
"foreach",... | Reverse the case of a string, so that all uppercase characters become lowercase
and all lowercase characters become uppercase
@param string $pValue UTF-8 encoded string
@return string | [
"Reverse",
"the",
"case",
"of",
"a",
"string",
"so",
"that",
"all",
"uppercase",
"characters",
"become",
"lowercase",
"and",
"all",
"lowercase",
"characters",
"become",
"uppercase"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Shared/String.php#L654-L668 |
218,319 | moodle/moodle | lib/phpexcel/PHPExcel/Shared/String.php | PHPExcel_Shared_String.convertToNumberIfFraction | public static function convertToNumberIfFraction(&$operand)
{
if (preg_match('/^'.self::STRING_REGEXP_FRACTION.'$/i', $operand, $match)) {
$sign = ($match[1] == '-') ? '-' : '+';
$fractionFormula = '='.$sign.$match[2].$sign.$match[3];
$operand = PHPExcel_Calculation::getI... | php | public static function convertToNumberIfFraction(&$operand)
{
if (preg_match('/^'.self::STRING_REGEXP_FRACTION.'$/i', $operand, $match)) {
$sign = ($match[1] == '-') ? '-' : '+';
$fractionFormula = '='.$sign.$match[2].$sign.$match[3];
$operand = PHPExcel_Calculation::getI... | [
"public",
"static",
"function",
"convertToNumberIfFraction",
"(",
"&",
"$",
"operand",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^'",
".",
"self",
"::",
"STRING_REGEXP_FRACTION",
".",
"'$/i'",
",",
"$",
"operand",
",",
"$",
"match",
")",
")",
"{",
"$",
... | Identify whether a string contains a fractional numeric value,
and convert it to a numeric if it is
@param string &$operand string value to test
@return boolean | [
"Identify",
"whether",
"a",
"string",
"contains",
"a",
"fractional",
"numeric",
"value",
"and",
"convert",
"it",
"to",
"a",
"numeric",
"if",
"it",
"is"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Shared/String.php#L677-L686 |
218,320 | moodle/moodle | mod/data/field/textarea/field.class.php | data_field_textarea.get_options | private function get_options() {
if (!isset($this->field->param5)) {
$this->field->param5 = 0;
}
$options = array();
$options['trusttext'] = false;
$options['forcehttps'] = false;
$options['subdirs'] = false;
$options['maxfiles'] = -1;
$options... | php | private function get_options() {
if (!isset($this->field->param5)) {
$this->field->param5 = 0;
}
$options = array();
$options['trusttext'] = false;
$options['forcehttps'] = false;
$options['subdirs'] = false;
$options['maxfiles'] = -1;
$options... | [
"private",
"function",
"get_options",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"field",
"->",
"param5",
")",
")",
"{",
"$",
"this",
"->",
"field",
"->",
"param5",
"=",
"0",
";",
"}",
"$",
"options",
"=",
"array",
"(",
")",
... | Returns options for embedded files
@return array | [
"Returns",
"options",
"for",
"embedded",
"files"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/field/textarea/field.class.php#L42-L56 |
218,321 | moodle/moodle | mod/data/field/textarea/field.class.php | data_field_textarea.display_browse_field | function display_browse_field($recordid, $template) {
global $DB;
if ($content = $DB->get_record('data_content', array('fieldid' => $this->field->id, 'recordid' => $recordid))) {
if (isset($content->content)) {
$options = new stdClass();
if ($this->field->par... | php | function display_browse_field($recordid, $template) {
global $DB;
if ($content = $DB->get_record('data_content', array('fieldid' => $this->field->id, 'recordid' => $recordid))) {
if (isset($content->content)) {
$options = new stdClass();
if ($this->field->par... | [
"function",
"display_browse_field",
"(",
"$",
"recordid",
",",
"$",
"template",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"content",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'data_content'",
",",
"array",
"(",
"'fieldid'",
"=>",
"$",
"this",
... | Display the content of the field in browse mode
@param int $recordid
@param object $template
@return bool|string | [
"Display",
"the",
"content",
"of",
"the",
"field",
"in",
"browse",
"mode"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/field/textarea/field.class.php#L242-L260 |
218,322 | moodle/moodle | course/classes/output/course_module_name.php | course_module_name.update | public static function update($itemid, $newvalue) {
$context = context_module::instance($itemid);
// Check access.
\external_api::validate_context($context);
require_capability('moodle/course:manageactivities', $context);
// Update value.
set_coursemodule_name($itemid, $n... | php | public static function update($itemid, $newvalue) {
$context = context_module::instance($itemid);
// Check access.
\external_api::validate_context($context);
require_capability('moodle/course:manageactivities', $context);
// Update value.
set_coursemodule_name($itemid, $n... | [
"public",
"static",
"function",
"update",
"(",
"$",
"itemid",
",",
"$",
"newvalue",
")",
"{",
"$",
"context",
"=",
"context_module",
"::",
"instance",
"(",
"$",
"itemid",
")",
";",
"// Check access.",
"\\",
"external_api",
"::",
"validate_context",
"(",
"$",... | Updates course module name
@param int $itemid course module id
@param string $newvalue new name
@return static | [
"Updates",
"course",
"module",
"name"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/output/course_module_name.php#L88-L99 |
218,323 | moodle/moodle | lib/classes/output/mustache_template_source_loader.php | mustache_template_source_loader.load | public function load(
string $component,
string $name,
string $themename,
bool $includecomments = false
) : string {
// Get the template source from the callback.
$source = ($this->gettemplatesource)($component, $name, $themename);
// Remove comments from tem... | php | public function load(
string $component,
string $name,
string $themename,
bool $includecomments = false
) : string {
// Get the template source from the callback.
$source = ($this->gettemplatesource)($component, $name, $themename);
// Remove comments from tem... | [
"public",
"function",
"load",
"(",
"string",
"$",
"component",
",",
"string",
"$",
"name",
",",
"string",
"$",
"themename",
",",
"bool",
"$",
"includecomments",
"=",
"false",
")",
":",
"string",
"{",
"// Get the template source from the callback.",
"$",
"source"... | Load the template source from the component and template name.
@param string $component The moodle component (e.g. core_message)
@param string $name The template name (e.g. message_drawer)
@param string $themename The theme to load the template for (e.g. boost)
@param bool $includecomments If the comments should be st... | [
"Load",
"the",
"template",
"source",
"from",
"the",
"component",
"and",
"template",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/output/mustache_template_source_loader.php#L85-L100 |
218,324 | moodle/moodle | lib/classes/output/mustache_template_source_loader.php | mustache_template_source_loader.scan_template_source_for_dependencies | protected function scan_template_source_for_dependencies(string $source) : array {
$tokenizer = new Mustache_Tokenizer();
$tokens = $tokenizer->scan($source);
$templates = [];
$strings = [];
$addtodependencies = function($dependencies, $component, $id) {
$id = trim($i... | php | protected function scan_template_source_for_dependencies(string $source) : array {
$tokenizer = new Mustache_Tokenizer();
$tokens = $tokenizer->scan($source);
$templates = [];
$strings = [];
$addtodependencies = function($dependencies, $component, $id) {
$id = trim($i... | [
"protected",
"function",
"scan_template_source_for_dependencies",
"(",
"string",
"$",
"source",
")",
":",
"array",
"{",
"$",
"tokenizer",
"=",
"new",
"Mustache_Tokenizer",
"(",
")",
";",
"$",
"tokens",
"=",
"$",
"tokenizer",
"->",
"scan",
"(",
"$",
"source",
... | Scan over a template source string and return a list of dependencies it requires.
At the moment the list will only include other templates and strings.
The return format is an array indexed with the dependency type (e.g. templates / strings) then
the component (e.g. core_message) with it's value being an array of the ... | [
"Scan",
"over",
"a",
"template",
"source",
"string",
"and",
"return",
"a",
"list",
"of",
"dependencies",
"it",
"requires",
".",
"At",
"the",
"moment",
"the",
"list",
"will",
"only",
"include",
"other",
"templates",
"and",
"strings",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/output/mustache_template_source_loader.php#L284-L343 |
218,325 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/Queue.php | HTMLPurifier_Queue.shift | public function shift() {
if (empty($this->output)) {
$this->output = array_reverse($this->input);
$this->input = array();
}
if (empty($this->output)) {
return NULL;
}
return array_pop($this->output);
} | php | public function shift() {
if (empty($this->output)) {
$this->output = array_reverse($this->input);
$this->input = array();
}
if (empty($this->output)) {
return NULL;
}
return array_pop($this->output);
} | [
"public",
"function",
"shift",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"output",
")",
")",
"{",
"$",
"this",
"->",
"output",
"=",
"array_reverse",
"(",
"$",
"this",
"->",
"input",
")",
";",
"$",
"this",
"->",
"input",
"=",
"arr... | Shifts an element off the front of the queue. | [
"Shifts",
"an",
"element",
"off",
"the",
"front",
"of",
"the",
"queue",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/Queue.php#L32-L41 |
218,326 | moodle/moodle | lib/mlbackend/php/phpml/src/Phpml/Classification/Linear/Perceptron.php | Perceptron.runTraining | protected function runTraining(array $samples, array $targets)
{
// The cost function is the sum of squares
$callback = function ($weights, $sample, $target) {
$this->weights = $weights;
$prediction = $this->outputClass($sample);
$gradient = $prediction - $target... | php | protected function runTraining(array $samples, array $targets)
{
// The cost function is the sum of squares
$callback = function ($weights, $sample, $target) {
$this->weights = $weights;
$prediction = $this->outputClass($sample);
$gradient = $prediction - $target... | [
"protected",
"function",
"runTraining",
"(",
"array",
"$",
"samples",
",",
"array",
"$",
"targets",
")",
"{",
"// The cost function is the sum of squares",
"$",
"callback",
"=",
"function",
"(",
"$",
"weights",
",",
"$",
"sample",
",",
"$",
"target",
")",
"{",... | Trains the perceptron model with Stochastic Gradient Descent optimization
to get the correct set of weights
@param array $samples
@param array $targets | [
"Trains",
"the",
"perceptron",
"model",
"with",
"Stochastic",
"Gradient",
"Descent",
"optimization",
"to",
"get",
"the",
"correct",
"set",
"of",
"weights"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/phpml/src/Phpml/Classification/Linear/Perceptron.php#L170-L184 |
218,327 | moodle/moodle | lib/mlbackend/php/phpml/src/Phpml/Classification/Linear/Perceptron.php | Perceptron.runGradientDescent | protected function runGradientDescent(array $samples, array $targets, \Closure $gradientFunc, bool $isBatch = false)
{
$class = $isBatch ? GD::class : StochasticGD::class;
if (empty($this->optimizer)) {
$this->optimizer = (new $class($this->featureCount))
->setLearningRa... | php | protected function runGradientDescent(array $samples, array $targets, \Closure $gradientFunc, bool $isBatch = false)
{
$class = $isBatch ? GD::class : StochasticGD::class;
if (empty($this->optimizer)) {
$this->optimizer = (new $class($this->featureCount))
->setLearningRa... | [
"protected",
"function",
"runGradientDescent",
"(",
"array",
"$",
"samples",
",",
"array",
"$",
"targets",
",",
"\\",
"Closure",
"$",
"gradientFunc",
",",
"bool",
"$",
"isBatch",
"=",
"false",
")",
"{",
"$",
"class",
"=",
"$",
"isBatch",
"?",
"GD",
"::",... | Executes a Gradient Descent algorithm for
the given cost function
@param array $samples
@param array $targets
@param \Closure $gradientFunc
@param bool $isBatch | [
"Executes",
"a",
"Gradient",
"Descent",
"algorithm",
"for",
"the",
"given",
"cost",
"function"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/phpml/src/Phpml/Classification/Linear/Perceptron.php#L195-L209 |
218,328 | moodle/moodle | lib/mlbackend/php/phpml/src/Phpml/Classification/Linear/Perceptron.php | Perceptron.checkNormalizedSample | protected function checkNormalizedSample(array $sample)
{
if ($this->normalizer) {
$samples = [$sample];
$this->normalizer->transform($samples);
$sample = $samples[0];
}
return $sample;
} | php | protected function checkNormalizedSample(array $sample)
{
if ($this->normalizer) {
$samples = [$sample];
$this->normalizer->transform($samples);
$sample = $samples[0];
}
return $sample;
} | [
"protected",
"function",
"checkNormalizedSample",
"(",
"array",
"$",
"sample",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"normalizer",
")",
"{",
"$",
"samples",
"=",
"[",
"$",
"sample",
"]",
";",
"$",
"this",
"->",
"normalizer",
"->",
"transform",
"(",
"... | Checks if the sample should be normalized and if so, returns the
normalized sample
@param array $sample
@return array | [
"Checks",
"if",
"the",
"sample",
"should",
"be",
"normalized",
"and",
"if",
"so",
"returns",
"the",
"normalized",
"sample"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/phpml/src/Phpml/Classification/Linear/Perceptron.php#L219-L228 |
218,329 | moodle/moodle | mod/quiz/locallib.php | mod_quiz_display_options.make_from_quiz | public static function make_from_quiz($quiz, $when) {
$options = new self();
$options->attempt = self::extract($quiz->reviewattempt, $when, true, false);
$options->correctness = self::extract($quiz->reviewcorrectness, $when);
$options->marks = self::extract($quiz->reviewmarks, $when,
... | php | public static function make_from_quiz($quiz, $when) {
$options = new self();
$options->attempt = self::extract($quiz->reviewattempt, $when, true, false);
$options->correctness = self::extract($quiz->reviewcorrectness, $when);
$options->marks = self::extract($quiz->reviewmarks, $when,
... | [
"public",
"static",
"function",
"make_from_quiz",
"(",
"$",
"quiz",
",",
"$",
"when",
")",
"{",
"$",
"options",
"=",
"new",
"self",
"(",
")",
";",
"$",
"options",
"->",
"attempt",
"=",
"self",
"::",
"extract",
"(",
"$",
"quiz",
"->",
"reviewattempt",
... | Set up the various options from the quiz settings, and a time constant.
@param object $quiz the quiz settings.
@param int $one of the {@link DURING}, {@link IMMEDIATELY_AFTER},
{@link LATER_WHILE_OPEN} or {@link AFTER_CLOSE} constants.
@return mod_quiz_display_options set up appropriately. | [
"Set",
"up",
"the",
"various",
"options",
"from",
"the",
"quiz",
"settings",
"and",
"a",
"time",
"constant",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/locallib.php#L1949-L1971 |
218,330 | moodle/moodle | calendar/classes/external/events_related_objects_cache.php | events_related_objects_cache.get_course | public function get_course(event_interface $event) {
if (is_null($this->courses)) {
$this->load_courses();
}
if ($course = $event->get_course()) {
$courseid = $course->get('id');
return isset($this->courses[$courseid]) ? $this->courses[$courseid] : null;
... | php | public function get_course(event_interface $event) {
if (is_null($this->courses)) {
$this->load_courses();
}
if ($course = $event->get_course()) {
$courseid = $course->get('id');
return isset($this->courses[$courseid]) ? $this->courses[$courseid] : null;
... | [
"public",
"function",
"get_course",
"(",
"event_interface",
"$",
"event",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"courses",
")",
")",
"{",
"$",
"this",
"->",
"load_courses",
"(",
")",
";",
"}",
"if",
"(",
"$",
"course",
"=",
"$",
"... | Get the related course object for a given event.
@param event_interface $event The event object.
@return stdClass|null | [
"Get",
"the",
"related",
"course",
"object",
"for",
"a",
"given",
"event",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/events_related_objects_cache.php#L95-L106 |
218,331 | moodle/moodle | calendar/classes/external/events_related_objects_cache.php | events_related_objects_cache.get_context | public function get_context(event_interface $event) {
global $USER;
$courseid = $event->get_course() ? $event->get_course()->get('id') : null;
$groupid = $event->get_group() ? $event->get_group()->get('id') : null;
$userid = $event->get_user() ? $event->get_user()->get('id') : null;
... | php | public function get_context(event_interface $event) {
global $USER;
$courseid = $event->get_course() ? $event->get_course()->get('id') : null;
$groupid = $event->get_group() ? $event->get_group()->get('id') : null;
$userid = $event->get_user() ? $event->get_user()->get('id') : null;
... | [
"public",
"function",
"get_context",
"(",
"event_interface",
"$",
"event",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"courseid",
"=",
"$",
"event",
"->",
"get_course",
"(",
")",
"?",
"$",
"event",
"->",
"get_course",
"(",
")",
"->",
"get",
"(",
"'id'"... | Get the related context for a given event.
@param event_interface $event The event object.
@return context|null | [
"Get",
"the",
"related",
"context",
"for",
"a",
"given",
"event",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/events_related_objects_cache.php#L114-L135 |
218,332 | moodle/moodle | calendar/classes/external/events_related_objects_cache.php | events_related_objects_cache.get_group | public function get_group(event_interface $event) {
if (is_null($this->groups)) {
$this->load_groups();
}
if ($group = $event->get_group()) {
$groupid = $group->get('id');
return isset($this->groups[$groupid]) ? $this->groups[$groupid] : null;
} else ... | php | public function get_group(event_interface $event) {
if (is_null($this->groups)) {
$this->load_groups();
}
if ($group = $event->get_group()) {
$groupid = $group->get('id');
return isset($this->groups[$groupid]) ? $this->groups[$groupid] : null;
} else ... | [
"public",
"function",
"get_group",
"(",
"event_interface",
"$",
"event",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"groups",
")",
")",
"{",
"$",
"this",
"->",
"load_groups",
"(",
")",
";",
"}",
"if",
"(",
"$",
"group",
"=",
"$",
"even... | Get the related group object for a given event.
@param event_interface $event The event object.
@return stdClass|null | [
"Get",
"the",
"related",
"group",
"object",
"for",
"a",
"given",
"event",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/events_related_objects_cache.php#L143-L154 |
218,333 | moodle/moodle | calendar/classes/external/events_related_objects_cache.php | events_related_objects_cache.get_course_module | public function get_course_module(event_interface $event) {
if (!$event->get_course_module()) {
return null;
}
$id = $event->get_course_module()->get('id');
$name = $event->get_course_module()->get('modname');
$key = $name . '_' . $id;
if (!isset($this->cour... | php | public function get_course_module(event_interface $event) {
if (!$event->get_course_module()) {
return null;
}
$id = $event->get_course_module()->get('id');
$name = $event->get_course_module()->get('modname');
$key = $name . '_' . $id;
if (!isset($this->cour... | [
"public",
"function",
"get_course_module",
"(",
"event_interface",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"event",
"->",
"get_course_module",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"id",
"=",
"$",
"event",
"->",
"get_course_module",
"... | Get the related course module for a given event.
@param event_interface $event The event object.
@return stdClass|null | [
"Get",
"the",
"related",
"course",
"module",
"for",
"a",
"given",
"event",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/events_related_objects_cache.php#L162-L176 |
218,334 | moodle/moodle | calendar/classes/external/events_related_objects_cache.php | events_related_objects_cache.get_module_instance | public function get_module_instance(event_interface $event) {
if (!$event->get_course_module()) {
return null;
}
if (is_null($this->moduleinstances)) {
$this->load_module_instances();
}
$id = $event->get_course_module()->get('instance');
$name = ... | php | public function get_module_instance(event_interface $event) {
if (!$event->get_course_module()) {
return null;
}
if (is_null($this->moduleinstances)) {
$this->load_module_instances();
}
$id = $event->get_course_module()->get('instance');
$name = ... | [
"public",
"function",
"get_module_instance",
"(",
"event_interface",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"event",
"->",
"get_course_module",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"moduleins... | Get the related module instance for a given event.
@param event_interface $event The event object.
@return stdClass|null | [
"Get",
"the",
"related",
"module",
"instance",
"for",
"a",
"given",
"event",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/events_related_objects_cache.php#L184-L203 |
218,335 | moodle/moodle | calendar/classes/external/events_related_objects_cache.php | events_related_objects_cache.load_courses | protected function load_courses() {
global $DB;
$courseids = [];
foreach ($this->events as $event) {
if ($course = $event->get_course()) {
$id = $course->get('id');
$courseids[$id] = true;
}
}
if (empty($courseids)) {
... | php | protected function load_courses() {
global $DB;
$courseids = [];
foreach ($this->events as $event) {
if ($course = $event->get_course()) {
$id = $course->get('id');
$courseids[$id] = true;
}
}
if (empty($courseids)) {
... | [
"protected",
"function",
"load_courses",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"courseids",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"events",
"as",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"course",
"=",
"$",
"event",
"->",
... | Load the list of all of the distinct courses required for the
list of provided events and save the result in memory. | [
"Load",
"the",
"list",
"of",
"all",
"of",
"the",
"distinct",
"courses",
"required",
"for",
"the",
"list",
"of",
"provided",
"events",
"and",
"save",
"the",
"result",
"in",
"memory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/events_related_objects_cache.php#L209-L229 |
218,336 | moodle/moodle | calendar/classes/external/events_related_objects_cache.php | events_related_objects_cache.load_groups | protected function load_groups() {
global $DB;
$groupids = [];
foreach ($this->events as $event) {
if ($group = $event->get_group()) {
$id = $group->get('id');
$groupids[$id] = true;
}
}
if (empty($groupids)) {
... | php | protected function load_groups() {
global $DB;
$groupids = [];
foreach ($this->events as $event) {
if ($group = $event->get_group()) {
$id = $group->get('id');
$groupids[$id] = true;
}
}
if (empty($groupids)) {
... | [
"protected",
"function",
"load_groups",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"groupids",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"events",
"as",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"group",
"=",
"$",
"event",
"->",
"ge... | Load the list of all of the distinct groups required for the
list of provided events and save the result in memory. | [
"Load",
"the",
"list",
"of",
"all",
"of",
"the",
"distinct",
"groups",
"required",
"for",
"the",
"list",
"of",
"provided",
"events",
"and",
"save",
"the",
"result",
"in",
"memory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/events_related_objects_cache.php#L235-L255 |
218,337 | moodle/moodle | calendar/classes/external/events_related_objects_cache.php | events_related_objects_cache.load_module_instances | protected function load_module_instances() {
global $DB;
$this->moduleinstances = [];
$modulestoload = [];
foreach ($this->events as $event) {
if ($module = $event->get_course_module()) {
$id = $module->get('instance');
$name = $module->get('m... | php | protected function load_module_instances() {
global $DB;
$this->moduleinstances = [];
$modulestoload = [];
foreach ($this->events as $event) {
if ($module = $event->get_course_module()) {
$id = $module->get('instance');
$name = $module->get('m... | [
"protected",
"function",
"load_module_instances",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"this",
"->",
"moduleinstances",
"=",
"[",
"]",
";",
"$",
"modulestoload",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"events",
"as",
"$",
"even... | Load the list of all of the distinct module instances required for the
list of provided events and save the result in memory. | [
"Load",
"the",
"list",
"of",
"all",
"of",
"the",
"distinct",
"module",
"instances",
"required",
"for",
"the",
"list",
"of",
"provided",
"events",
"and",
"save",
"the",
"result",
"in",
"memory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/events_related_objects_cache.php#L261-L286 |
218,338 | moodle/moodle | lib/mlbackend/php/classes/processor.php | processor.train_classification | public function train_classification($uniqueid, \stored_file $dataset, $outputdir) {
$modelfilepath = $this->get_model_filepath($outputdir);
$modelmanager = new ModelManager();
if (file_exists($modelfilepath)) {
$classifier = $modelmanager->restoreFromFile($modelfilepath);
... | php | public function train_classification($uniqueid, \stored_file $dataset, $outputdir) {
$modelfilepath = $this->get_model_filepath($outputdir);
$modelmanager = new ModelManager();
if (file_exists($modelfilepath)) {
$classifier = $modelmanager->restoreFromFile($modelfilepath);
... | [
"public",
"function",
"train_classification",
"(",
"$",
"uniqueid",
",",
"\\",
"stored_file",
"$",
"dataset",
",",
"$",
"outputdir",
")",
"{",
"$",
"modelfilepath",
"=",
"$",
"this",
"->",
"get_model_filepath",
"(",
"$",
"outputdir",
")",
";",
"$",
"modelman... | Train this processor classification model using the provided supervised learning dataset.
@param string $uniqueid
@param \stored_file $dataset
@param string $outputdir
@return \stdClass | [
"Train",
"this",
"processor",
"classification",
"model",
"using",
"the",
"provided",
"supervised",
"learning",
"dataset",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/classes/processor.php#L104-L165 |
218,339 | moodle/moodle | lib/mlbackend/php/classes/processor.php | processor.get_evaluation_result_object | protected function get_evaluation_result_object(\stored_file $dataset, $phis, $maxdeviation) {
// Average phi of all evaluations as final score.
if (count($phis) === 1) {
$avgphi = reset($phis);
} else {
$avgphi = \Phpml\Math\Statistic\Mean::arithmetic($phis);
}
... | php | protected function get_evaluation_result_object(\stored_file $dataset, $phis, $maxdeviation) {
// Average phi of all evaluations as final score.
if (count($phis) === 1) {
$avgphi = reset($phis);
} else {
$avgphi = \Phpml\Math\Statistic\Mean::arithmetic($phis);
}
... | [
"protected",
"function",
"get_evaluation_result_object",
"(",
"\\",
"stored_file",
"$",
"dataset",
",",
"$",
"phis",
",",
"$",
"maxdeviation",
")",
"{",
"// Average phi of all evaluations as final score.",
"if",
"(",
"count",
"(",
"$",
"phis",
")",
"===",
"1",
")"... | Returns the results objects from all evaluations.
@param \stored_file $dataset
@param array $phis
@param float $maxdeviation
@return \stdClass | [
"Returns",
"the",
"results",
"objects",
"from",
"all",
"evaluations",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/classes/processor.php#L343-L391 |
218,340 | moodle/moodle | lib/mlbackend/php/classes/processor.php | processor.load_classifier | protected function load_classifier($outputdir) {
$modelfilepath = $this->get_model_filepath($outputdir);
if (!file_exists($modelfilepath)) {
throw new \moodle_exception('errorcantloadmodel', 'mlbackend_php', '', $modelfilepath);
}
$modelmanager = new ModelManager();
... | php | protected function load_classifier($outputdir) {
$modelfilepath = $this->get_model_filepath($outputdir);
if (!file_exists($modelfilepath)) {
throw new \moodle_exception('errorcantloadmodel', 'mlbackend_php', '', $modelfilepath);
}
$modelmanager = new ModelManager();
... | [
"protected",
"function",
"load_classifier",
"(",
"$",
"outputdir",
")",
"{",
"$",
"modelfilepath",
"=",
"$",
"this",
"->",
"get_model_filepath",
"(",
"$",
"outputdir",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"modelfilepath",
")",
")",
"{",
"thro... | Loads the pre-trained classifier.
@throws \moodle_exception
@param string $outputdir
@return \Phpml\Classification\Linear\LogisticRegression | [
"Loads",
"the",
"pre",
"-",
"trained",
"classifier",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/classes/processor.php#L400-L409 |
218,341 | moodle/moodle | lib/mlbackend/php/classes/processor.php | processor.get_phi | protected function get_phi($testlabels, $predictedlabels) {
// Binary here only as well.
$matrix = \Phpml\Metric\ConfusionMatrix::compute($testlabels, $predictedlabels, array(0, 1));
$tptn = $matrix[0][0] * $matrix[1][1];
$fpfn = $matrix[1][0] * $matrix[0][1];
$tpfp = $matrix[0... | php | protected function get_phi($testlabels, $predictedlabels) {
// Binary here only as well.
$matrix = \Phpml\Metric\ConfusionMatrix::compute($testlabels, $predictedlabels, array(0, 1));
$tptn = $matrix[0][0] * $matrix[1][1];
$fpfn = $matrix[1][0] * $matrix[0][1];
$tpfp = $matrix[0... | [
"protected",
"function",
"get_phi",
"(",
"$",
"testlabels",
",",
"$",
"predictedlabels",
")",
"{",
"// Binary here only as well.",
"$",
"matrix",
"=",
"\\",
"Phpml",
"\\",
"Metric",
"\\",
"ConfusionMatrix",
"::",
"compute",
"(",
"$",
"testlabels",
",",
"$",
"p... | Returns the Phi correlation coefficient.
@param array $testlabels
@param array $predictedlabels
@return float | [
"Returns",
"the",
"Phi",
"correlation",
"coefficient",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/classes/processor.php#L532-L550 |
218,342 | moodle/moodle | lib/xmldb/xmldb_file.php | xmldb_file.loadXMLStructure | public function loadXMLStructure() {
if ($this->fileExists()) {
// Let's validate the XML file
if (!$this->validateXMLStructure()) {
return false;
}
$contents = file_get_contents($this->path);
if (strpos($contents, '<STATEMENTS>')) {
... | php | public function loadXMLStructure() {
if ($this->fileExists()) {
// Let's validate the XML file
if (!$this->validateXMLStructure()) {
return false;
}
$contents = file_get_contents($this->path);
if (strpos($contents, '<STATEMENTS>')) {
... | [
"public",
"function",
"loadXMLStructure",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"fileExists",
"(",
")",
")",
"{",
"// Let's validate the XML file",
"if",
"(",
"!",
"$",
"this",
"->",
"validateXMLStructure",
"(",
")",
")",
"{",
"return",
"false",
";"... | Load and the XMLDB structure from file
@return true | [
"Load",
"and",
"the",
"XMLDB",
"structure",
"from",
"file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/xmldb/xmldb_file.php#L137-L163 |
218,343 | moodle/moodle | lib/xmldb/xmldb_file.php | xmldb_file.arr2xmldb_structure | public function arr2xmldb_structure ($xmlarr) {
$structure = new xmldb_structure($this->path);
$structure->arr2xmldb_structure($xmlarr);
return $structure;
} | php | public function arr2xmldb_structure ($xmlarr) {
$structure = new xmldb_structure($this->path);
$structure->arr2xmldb_structure($xmlarr);
return $structure;
} | [
"public",
"function",
"arr2xmldb_structure",
"(",
"$",
"xmlarr",
")",
"{",
"$",
"structure",
"=",
"new",
"xmldb_structure",
"(",
"$",
"this",
"->",
"path",
")",
";",
"$",
"structure",
"->",
"arr2xmldb_structure",
"(",
"$",
"xmlarr",
")",
";",
"return",
"$"... | This function takes an xmlized array and put it into one xmldb_structure
@param array $xmlarr
@return xmldb_structure | [
"This",
"function",
"takes",
"an",
"xmlized",
"array",
"and",
"put",
"it",
"into",
"one",
"xmldb_structure"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/xmldb/xmldb_file.php#L170-L174 |
218,344 | moodle/moodle | lib/xmldb/xmldb_file.php | xmldb_file.saveXMLFile | public function saveXMLFile() {
$structure = $this->getStructure();
$result = file_put_contents($this->path, $structure->xmlOutput());
return $result;
} | php | public function saveXMLFile() {
$structure = $this->getStructure();
$result = file_put_contents($this->path, $structure->xmlOutput());
return $result;
} | [
"public",
"function",
"saveXMLFile",
"(",
")",
"{",
"$",
"structure",
"=",
"$",
"this",
"->",
"getStructure",
"(",
")",
";",
"$",
"result",
"=",
"file_put_contents",
"(",
"$",
"this",
"->",
"path",
",",
"$",
"structure",
"->",
"xmlOutput",
"(",
")",
")... | This function saves the whole xmldb_structure to its file
@return int|bool false on failure, number of written bytes on success | [
"This",
"function",
"saves",
"the",
"whole",
"xmldb_structure",
"to",
"its",
"file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/xmldb/xmldb_file.php#L196-L203 |
218,345 | moodle/moodle | lib/editor/tinymce/plugins/managefiles/lib.php | tinymce_managefiles.update_init_params | protected function update_init_params(array &$params, context $context,
array $options = null) {
global $USER;
if (!isloggedin() or isguestuser()) {
// Must be a real user to manage any files.
return;
}
if (!isset($options['maxfiles']) or $options['ma... | php | protected function update_init_params(array &$params, context $context,
array $options = null) {
global $USER;
if (!isloggedin() or isguestuser()) {
// Must be a real user to manage any files.
return;
}
if (!isset($options['maxfiles']) or $options['ma... | [
"protected",
"function",
"update_init_params",
"(",
"array",
"&",
"$",
"params",
",",
"context",
"$",
"context",
",",
"array",
"$",
"options",
"=",
"null",
")",
"{",
"global",
"$",
"USER",
";",
"if",
"(",
"!",
"isloggedin",
"(",
")",
"or",
"isguestuser",... | Adjusts TinyMCE init parameters for tinymce_managefiles
Adds file area restrictions parameters and actual 'managefiles' button
@param array $params TinyMCE init parameters array
@param context $context Context where editor is being shown
@param array $options Options for this editor | [
"Adjusts",
"TinyMCE",
"init",
"parameters",
"for",
"tinymce_managefiles"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/editor/tinymce/plugins/managefiles/lib.php#L39-L78 |
218,346 | moodle/moodle | mod/wiki/parser/utils.php | parser_utils.wiki_parser_link_callback | public static function wiki_parser_link_callback($link, $options) {
$l = urlencode($link);
if(!empty($options['anchor'])) {
$l .= "#".urlencode($options['anchor']);
}
return array('content' => $link, 'url' => "http://".$l);
} | php | public static function wiki_parser_link_callback($link, $options) {
$l = urlencode($link);
if(!empty($options['anchor'])) {
$l .= "#".urlencode($options['anchor']);
}
return array('content' => $link, 'url' => "http://".$l);
} | [
"public",
"static",
"function",
"wiki_parser_link_callback",
"(",
"$",
"link",
",",
"$",
"options",
")",
"{",
"$",
"l",
"=",
"urlencode",
"(",
"$",
"link",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"options",
"[",
"'anchor'",
"]",
")",
")",
"{",
... | Default link generator | [
"Default",
"link",
"generator"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/wiki/parser/utils.php#L28-L34 |
218,347 | moodle/moodle | mod/wiki/parser/utils.php | parser_utils.wiki_parser_table_callback | public static function wiki_parser_table_callback($table) {
$html = "";
$headers = $table[0];
$columncount = count($headers);
$headerhtml = "";
foreach($headers as $h) {
$text = trim($h[1]);
if($h[0] == 'header') {
$headerhtml .= "\n".parse... | php | public static function wiki_parser_table_callback($table) {
$html = "";
$headers = $table[0];
$columncount = count($headers);
$headerhtml = "";
foreach($headers as $h) {
$text = trim($h[1]);
if($h[0] == 'header') {
$headerhtml .= "\n".parse... | [
"public",
"static",
"function",
"wiki_parser_table_callback",
"(",
"$",
"table",
")",
"{",
"$",
"html",
"=",
"\"\"",
";",
"$",
"headers",
"=",
"$",
"table",
"[",
"0",
"]",
";",
"$",
"columncount",
"=",
"count",
"(",
"$",
"headers",
")",
";",
"$",
"he... | Default table generator | [
"Default",
"table",
"generator"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/wiki/parser/utils.php#L41-L88 |
218,348 | moodle/moodle | mod/forum/classes/task/send_user_notifications.php | send_user_notifications.get_post_author | protected function get_post_author($userid, $course, $forum, $cm, $context) {
if (!isset($this->users[$userid])) {
// This user no longer exists.
return false;
}
$user = $this->users[$userid];
if (!isset($user->groups)) {
// Initialise the groups lis... | php | protected function get_post_author($userid, $course, $forum, $cm, $context) {
if (!isset($this->users[$userid])) {
// This user no longer exists.
return false;
}
$user = $this->users[$userid];
if (!isset($user->groups)) {
// Initialise the groups lis... | [
"protected",
"function",
"get_post_author",
"(",
"$",
"userid",
",",
"$",
"course",
",",
"$",
"forum",
",",
"$",
"cm",
",",
"$",
"context",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"users",
"[",
"$",
"userid",
"]",
")",
")",
"{"... | Fetch and initialise the post author.
@param int $userid The id of the user to fetch
@param \stdClass $course
@param \stdClass $forum
@param \stdClass $cm
@param \context $context
@return \stdClass | [
"Fetch",
"and",
"initialise",
"the",
"post",
"author",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/send_user_notifications.php#L381-L400 |
218,349 | moodle/moodle | mod/forum/classes/task/send_user_notifications.php | send_user_notifications.get_message_headers | protected function get_message_headers($course, $forum, $discussion, $post, $a, $message) {
$cleanforumname = str_replace('"', "'", strip_tags(format_string($forum->name)));
$viewurl = new \moodle_url('/mod/forum/view.php', ['f' => $forum->id]);
$headers = [
// Headers to make email... | php | protected function get_message_headers($course, $forum, $discussion, $post, $a, $message) {
$cleanforumname = str_replace('"', "'", strip_tags(format_string($forum->name)));
$viewurl = new \moodle_url('/mod/forum/view.php', ['f' => $forum->id]);
$headers = [
// Headers to make email... | [
"protected",
"function",
"get_message_headers",
"(",
"$",
"course",
",",
"$",
"forum",
",",
"$",
"discussion",
",",
"$",
"post",
",",
"$",
"a",
",",
"$",
"message",
")",
"{",
"$",
"cleanforumname",
"=",
"str_replace",
"(",
"'\"'",
",",
"\"'\"",
",",
"s... | Get the list of message headers.
@param \stdClass $course
@param \stdClass $forum
@param \stdClass $discussion
@param \stdClass $post
@param \stdClass $a The list of strings for this post
@param \core\message\message $message The message to be sent
@return \stdClass | [
"Get",
"the",
"list",
"of",
"message",
"headers",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/send_user_notifications.php#L431-L476 |
218,350 | moodle/moodle | mod/forum/classes/task/send_user_notifications.php | send_user_notifications.get_reply_address | protected function get_reply_address($course, $forum, $discussion, $post, $cm, $context) {
if ($this->can_post($course, $forum, $discussion, $post, $cm, $context)) {
// Generate a reply-to address from using the Inbound Message handler.
$this->inboundmanager->set_data($post->id);
... | php | protected function get_reply_address($course, $forum, $discussion, $post, $cm, $context) {
if ($this->can_post($course, $forum, $discussion, $post, $cm, $context)) {
// Generate a reply-to address from using the Inbound Message handler.
$this->inboundmanager->set_data($post->id);
... | [
"protected",
"function",
"get_reply_address",
"(",
"$",
"course",
",",
"$",
"forum",
",",
"$",
"discussion",
",",
"$",
"post",
",",
"$",
"cm",
",",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"can_post",
"(",
"$",
"course",
",",
"$",
"f... | Get a no-reply address for this user to reply to the current post.
@param \stdClass $course
@param \stdClass $forum
@param \stdClass $discussion
@param \stdClass $post
@param \stdClass $cm
@param \context $context
@return string | [
"Get",
"a",
"no",
"-",
"reply",
"address",
"for",
"this",
"user",
"to",
"reply",
"to",
"the",
"current",
"post",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/send_user_notifications.php#L489-L499 |
218,351 | moodle/moodle | mod/forum/classes/task/send_user_notifications.php | send_user_notifications.can_post | protected function can_post($course, $forum, $discussion, $post, $cm, $context) {
if (!isset($this->canpostto[$discussion->id])) {
$this->canpostto[$discussion->id] = forum_user_can_post($forum, $discussion, $this->recipient, $cm, $course, $context);
}
return $this->canpostto[$discus... | php | protected function can_post($course, $forum, $discussion, $post, $cm, $context) {
if (!isset($this->canpostto[$discussion->id])) {
$this->canpostto[$discussion->id] = forum_user_can_post($forum, $discussion, $this->recipient, $cm, $course, $context);
}
return $this->canpostto[$discus... | [
"protected",
"function",
"can_post",
"(",
"$",
"course",
",",
"$",
"forum",
",",
"$",
"discussion",
",",
"$",
"post",
",",
"$",
"cm",
",",
"$",
"context",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"canpostto",
"[",
"$",
"discussion... | Check whether the user can post.
@param \stdClass $course
@param \stdClass $forum
@param \stdClass $discussion
@param \stdClass $post
@param \stdClass $cm
@param \context $context
@return bool | [
"Check",
"whether",
"the",
"user",
"can",
"post",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/send_user_notifications.php#L512-L517 |
218,352 | moodle/moodle | mod/forum/classes/task/send_user_notifications.php | send_user_notifications.can_view_fullnames | protected function can_view_fullnames($course, $forum, $discussion, $post, $cm, $context) {
if (!isset($this->viewfullnames[$forum->id])) {
$this->viewfullnames[$forum->id] = has_capability('moodle/site:viewfullnames', $context, $this->recipient->id);
}
return $this->viewfullnames[$... | php | protected function can_view_fullnames($course, $forum, $discussion, $post, $cm, $context) {
if (!isset($this->viewfullnames[$forum->id])) {
$this->viewfullnames[$forum->id] = has_capability('moodle/site:viewfullnames', $context, $this->recipient->id);
}
return $this->viewfullnames[$... | [
"protected",
"function",
"can_view_fullnames",
"(",
"$",
"course",
",",
"$",
"forum",
",",
"$",
"discussion",
",",
"$",
"post",
",",
"$",
"cm",
",",
"$",
"context",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"viewfullnames",
"[",
"$",... | Check whether the user can view full names of other users.
@param \stdClass $course
@param \stdClass $forum
@param \stdClass $discussion
@param \stdClass $post
@param \stdClass $cm
@param \context $context
@return bool | [
"Check",
"whether",
"the",
"user",
"can",
"view",
"full",
"names",
"of",
"other",
"users",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/send_user_notifications.php#L530-L536 |
218,353 | moodle/moodle | mod/forum/classes/task/send_user_notifications.php | send_user_notifications.minimise_user_record | protected function minimise_user_record(\stdClass $user) {
// We store large amount of users in one huge array, make sure we do not store info there we do not actually
// need in mail generation code or messaging.
unset($user->institution);
unset($user->department);
unset($user->... | php | protected function minimise_user_record(\stdClass $user) {
// We store large amount of users in one huge array, make sure we do not store info there we do not actually
// need in mail generation code or messaging.
unset($user->institution);
unset($user->department);
unset($user->... | [
"protected",
"function",
"minimise_user_record",
"(",
"\\",
"stdClass",
"$",
"user",
")",
"{",
"// We store large amount of users in one huge array, make sure we do not store info there we do not actually",
"// need in mail generation code or messaging.",
"unset",
"(",
"$",
"user",
"... | Removes properties from user record that are not necessary for sending post notifications.
@param \stdClass $user | [
"Removes",
"properties",
"from",
"user",
"record",
"that",
"are",
"not",
"necessary",
"for",
"sending",
"post",
"notifications",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/send_user_notifications.php#L543-L554 |
218,354 | moodle/moodle | privacy/classes/local/sitepolicy/handler.php | handler.signup_form | public static function signup_form($mform) {
if ($url = static::get_embed_url()) {
$mform->addElement('header', 'policyagreement', get_string('policyagreement'), '');
$mform->setExpanded('policyagreement');
$mform->addElement('static', 'policylink', '', '<a href="' . $url .
... | php | public static function signup_form($mform) {
if ($url = static::get_embed_url()) {
$mform->addElement('header', 'policyagreement', get_string('policyagreement'), '');
$mform->setExpanded('policyagreement');
$mform->addElement('static', 'policylink', '', '<a href="' . $url .
... | [
"public",
"static",
"function",
"signup_form",
"(",
"$",
"mform",
")",
"{",
"if",
"(",
"$",
"url",
"=",
"static",
"::",
"get_embed_url",
"(",
")",
")",
"{",
"$",
"mform",
"->",
"addElement",
"(",
"'header'",
",",
"'policyagreement'",
",",
"get_string",
"... | Adds "Agree to site policy" checkbox to the signup form.
Sitepolicy handlers can override the simple checkbox with their own controls.
@param \MoodleQuickForm $mform | [
"Adds",
"Agree",
"to",
"site",
"policy",
"checkbox",
"to",
"the",
"signup",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/privacy/classes/local/sitepolicy/handler.php#L103-L112 |
218,355 | moodle/moodle | mod/workshop/mod_form.php | mod_workshop_mod_form.data_preprocessing | public function data_preprocessing(&$data) {
if ($this->current->instance) {
// editing an existing workshop - let us prepare the added editor elements (intro done automatically)
$draftitemid = file_get_submitted_draft_itemid('instructauthors');
$data['instructauthorseditor']... | php | public function data_preprocessing(&$data) {
if ($this->current->instance) {
// editing an existing workshop - let us prepare the added editor elements (intro done automatically)
$draftitemid = file_get_submitted_draft_itemid('instructauthors');
$data['instructauthorseditor']... | [
"public",
"function",
"data_preprocessing",
"(",
"&",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"current",
"->",
"instance",
")",
"{",
"// editing an existing workshop - let us prepare the added editor elements (intro done automatically)",
"$",
"draftitemid",
"... | Prepares the form before data are set
Additional wysiwyg editor are prepared here, the introeditor is prepared automatically by core.
Grade items are set here because the core modedit supports single grade item only.
@param array $data to be set
@return void | [
"Prepares",
"the",
"form",
"before",
"data",
"are",
"set"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/mod_form.php#L275-L325 |
218,356 | moodle/moodle | mod/workshop/mod_form.php | mod_workshop_mod_form.data_postprocessing | public function data_postprocessing($data) {
parent::data_postprocessing($data);
foreach (['text', 'file'] as $type) {
$field = 'submissiontype' . $type;
$available = $field . 'available';
$required = $field . 'required';
if ($data->$required) {
... | php | public function data_postprocessing($data) {
parent::data_postprocessing($data);
foreach (['text', 'file'] as $type) {
$field = 'submissiontype' . $type;
$available = $field . 'available';
$required = $field . 'required';
if ($data->$required) {
... | [
"public",
"function",
"data_postprocessing",
"(",
"$",
"data",
")",
"{",
"parent",
"::",
"data_postprocessing",
"(",
"$",
"data",
")",
";",
"foreach",
"(",
"[",
"'text'",
",",
"'file'",
"]",
"as",
"$",
"type",
")",
"{",
"$",
"field",
"=",
"'submissiontyp... | Combine submission type checkboxes into integer values for the database.
@param stdClass $data The submitted form data. | [
"Combine",
"submission",
"type",
"checkboxes",
"into",
"integer",
"values",
"for",
"the",
"database",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/mod_form.php#L332-L349 |
218,357 | moodle/moodle | mod/workshop/mod_form.php | mod_workshop_mod_form.definition_after_data | public function definition_after_data() {
$mform =& $this->_form;
if ($id = $mform->getElementValue('update')) {
$instance = $mform->getElementValue('instance');
$gradeitems = grade_item::fetch_all(array(
'itemtype' => 'mod',
'itemmodule'... | php | public function definition_after_data() {
$mform =& $this->_form;
if ($id = $mform->getElementValue('update')) {
$instance = $mform->getElementValue('instance');
$gradeitems = grade_item::fetch_all(array(
'itemtype' => 'mod',
'itemmodule'... | [
"public",
"function",
"definition_after_data",
"(",
")",
"{",
"$",
"mform",
"=",
"&",
"$",
"this",
"->",
"_form",
";",
"if",
"(",
"$",
"id",
"=",
"$",
"mform",
"->",
"getElementValue",
"(",
"'update'",
")",
")",
"{",
"$",
"instance",
"=",
"$",
"mform... | Set the grade item categories when editing an instance | [
"Set",
"the",
"grade",
"item",
"categories",
"when",
"editing",
"an",
"instance"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/mod_form.php#L354-L403 |
218,358 | moodle/moodle | mod/workshop/mod_form.php | mod_workshop_mod_form.validation | public function validation($data, $files) {
$errors = parent::validation($data, $files);
// check the phases borders are valid
if ($data['submissionstart'] > 0 and $data['submissionend'] > 0 and $data['submissionstart'] >= $data['submissionend']) {
$errors['submissionend'] = get_str... | php | public function validation($data, $files) {
$errors = parent::validation($data, $files);
// check the phases borders are valid
if ($data['submissionstart'] > 0 and $data['submissionend'] > 0 and $data['submissionstart'] >= $data['submissionend']) {
$errors['submissionend'] = get_str... | [
"public",
"function",
"validation",
"(",
"$",
"data",
",",
"$",
"files",
")",
"{",
"$",
"errors",
"=",
"parent",
"::",
"validation",
"(",
"$",
"data",
",",
"$",
"files",
")",
";",
"// check the phases borders are valid",
"if",
"(",
"$",
"data",
"[",
"'su... | Validates the form input
@param array $data submitted data
@param array $files submitted files
@return array eventual errors indexed by the field name | [
"Validates",
"the",
"form",
"input"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/mod_form.php#L412-L470 |
218,359 | moodle/moodle | mod/forum/classes/local/exporters/forum.php | forum.get_forum_record | private function get_forum_record() : stdClass {
$forumdbdatamapper = $this->related['legacydatamapperfactory']->get_forum_data_mapper();
return $forumdbdatamapper->to_legacy_object($this->forum);
} | php | private function get_forum_record() : stdClass {
$forumdbdatamapper = $this->related['legacydatamapperfactory']->get_forum_data_mapper();
return $forumdbdatamapper->to_legacy_object($this->forum);
} | [
"private",
"function",
"get_forum_record",
"(",
")",
":",
"stdClass",
"{",
"$",
"forumdbdatamapper",
"=",
"$",
"this",
"->",
"related",
"[",
"'legacydatamapperfactory'",
"]",
"->",
"get_forum_data_mapper",
"(",
")",
";",
"return",
"$",
"forumdbdatamapper",
"->",
... | Get the legacy forum record for this forum.
@return stdClass | [
"Get",
"the",
"legacy",
"forum",
"record",
"for",
"this",
"forum",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/exporters/forum.php#L165-L168 |
218,360 | moodle/moodle | admin/tool/policy/classes/privacy/provider.php | provider.export_policy_agreements_for_context | protected static function export_policy_agreements_for_context(\context_user $context) {
global $DB;
$sysctx = \context_system::instance();
$fs = get_file_storage();
$agreementsql = "
SELECT
a.id AS agreementid, a.userid, a.timemodified, a.note, a.status,
... | php | protected static function export_policy_agreements_for_context(\context_user $context) {
global $DB;
$sysctx = \context_system::instance();
$fs = get_file_storage();
$agreementsql = "
SELECT
a.id AS agreementid, a.userid, a.timemodified, a.note, a.status,
... | [
"protected",
"static",
"function",
"export_policy_agreements_for_context",
"(",
"\\",
"context_user",
"$",
"context",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sysctx",
"=",
"\\",
"context_system",
"::",
"instance",
"(",
")",
";",
"$",
"fs",
"=",
"get_file_sto... | Export all policy agreements relating to the specified user context.
@param \context_user $context The context to export | [
"Export",
"all",
"policy",
"agreements",
"relating",
"to",
"the",
"specified",
"user",
"context",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/privacy/provider.php#L223-L293 |
218,361 | moodle/moodle | admin/tool/policy/classes/privacy/provider.php | provider.export_authored_policies | protected static function export_authored_policies(\stdClass $user) {
global $DB;
// Authored policies are exported against the system.
$context = \context_system::instance();
$basecontext = [
get_string('policydocuments', 'tool_policy'),
];
$sql = "SELECT v... | php | protected static function export_authored_policies(\stdClass $user) {
global $DB;
// Authored policies are exported against the system.
$context = \context_system::instance();
$basecontext = [
get_string('policydocuments', 'tool_policy'),
];
$sql = "SELECT v... | [
"protected",
"static",
"function",
"export_authored_policies",
"(",
"\\",
"stdClass",
"$",
"user",
")",
"{",
"global",
"$",
"DB",
";",
"// Authored policies are exported against the system.",
"$",
"context",
"=",
"\\",
"context_system",
"::",
"instance",
"(",
")",
"... | Export all policy agreements that the user authored.
@param stdClass $user The user who has created the policies to export. | [
"Export",
"all",
"policy",
"agreements",
"that",
"the",
"user",
"authored",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/privacy/provider.php#L300-L355 |
218,362 | moodle/moodle | admin/tool/dbtransfer/database_transfer_form.php | database_transfer_form.definition | protected function definition() {
global $CFG;
$mform = $this->_form;
$mform->addElement('header', 'database', get_string('targetdatabase', 'tool_dbtransfer'));
$drivers = tool_dbtransfer_get_drivers();
$drivers = array_reverse($drivers, true);
$drivers[''] = get_strin... | php | protected function definition() {
global $CFG;
$mform = $this->_form;
$mform->addElement('header', 'database', get_string('targetdatabase', 'tool_dbtransfer'));
$drivers = tool_dbtransfer_get_drivers();
$drivers = array_reverse($drivers, true);
$drivers[''] = get_strin... | [
"protected",
"function",
"definition",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"mform",
"=",
"$",
"this",
"->",
"_form",
";",
"$",
"mform",
"->",
"addElement",
"(",
"'header'",
",",
"'database'",
",",
"get_string",
"(",
"'targetdatabase'",
",",
"'... | Define transfer form. | [
"Define",
"transfer",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dbtransfer/database_transfer_form.php#L42-L98 |
218,363 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/AttrDef.php | HTMLPurifier_AttrDef.expandCSSEscape | protected function expandCSSEscape($string)
{
// flexibly parse it
$ret = '';
for ($i = 0, $c = strlen($string); $i < $c; $i++) {
if ($string[$i] === '\\') {
$i++;
if ($i >= $c) {
$ret .= '\\';
break;
... | php | protected function expandCSSEscape($string)
{
// flexibly parse it
$ret = '';
for ($i = 0, $c = strlen($string); $i < $c; $i++) {
if ($string[$i] === '\\') {
$i++;
if ($i >= $c) {
$ret .= '\\';
break;
... | [
"protected",
"function",
"expandCSSEscape",
"(",
"$",
"string",
")",
"{",
"// flexibly parse it",
"$",
"ret",
"=",
"''",
";",
"for",
"(",
"$",
"i",
"=",
"0",
",",
"$",
"c",
"=",
"strlen",
"(",
"$",
"string",
")",
";",
"$",
"i",
"<",
"$",
"c",
";"... | Parses a possibly escaped CSS string and returns the "pure"
version of it. | [
"Parses",
"a",
"possibly",
"escaped",
"CSS",
"string",
"and",
"returns",
"the",
"pure",
"version",
"of",
"it",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/AttrDef.php#L102-L141 |
218,364 | moodle/moodle | lib/adodb/drivers/adodb-ads.inc.php | ADODB_ads.ServerInfo | function ServerInfo()
{
if (!empty($this->host) && ADODB_PHPVER >= 0x4300) {
$stmt = $this->Prepare('EXECUTE PROCEDURE sp_mgGetInstallInfo()');
$res = $this->Execute($stmt);
if(!$res)
print $this->ErrorMsg();
... | php | function ServerInfo()
{
if (!empty($this->host) && ADODB_PHPVER >= 0x4300) {
$stmt = $this->Prepare('EXECUTE PROCEDURE sp_mgGetInstallInfo()');
$res = $this->Execute($stmt);
if(!$res)
print $this->ErrorMsg();
... | [
"function",
"ServerInfo",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"host",
")",
"&&",
"ADODB_PHPVER",
">=",
"0x4300",
")",
"{",
"$",
"stmt",
"=",
"$",
"this",
"->",
"Prepare",
"(",
"'EXECUTE PROCEDURE sp_mgGetInstallInfo()'",
")",
... | returns the Server version and Description | [
"returns",
"the",
"Server",
"version",
"and",
"Description"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-ads.inc.php#L118-L135 |
218,365 | moodle/moodle | lib/adodb/drivers/adodb-ads.inc.php | ADODB_ads.GenID | function GenID($seqname = 'adodbseq', $start = 1)
{
$go = $this->Execute("select * from $seqname");
if (!$go){
$res = $this->Execute("CREATE TABLE $seqname ( ID autoinc( 1 ) ) IN DATABASE");
if(!res){
... | php | function GenID($seqname = 'adodbseq', $start = 1)
{
$go = $this->Execute("select * from $seqname");
if (!$go){
$res = $this->Execute("CREATE TABLE $seqname ( ID autoinc( 1 ) ) IN DATABASE");
if(!res){
... | [
"function",
"GenID",
"(",
"$",
"seqname",
"=",
"'adodbseq'",
",",
"$",
"start",
"=",
"1",
")",
"{",
"$",
"go",
"=",
"$",
"this",
"->",
"Execute",
"(",
"\"select * from $seqname\"",
")",
";",
"if",
"(",
"!",
"$",
"go",
")",
"{",
"$",
"res",
"=",
"... | and gets the ID number of the last inserted record. | [
"and",
"gets",
"the",
"ID",
"number",
"of",
"the",
"last",
"inserted",
"record",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-ads.inc.php#L167-L188 |
218,366 | moodle/moodle | lib/adodb/drivers/adodb-ads.inc.php | ADODB_ads.& | function &MetaTables($ttype = false, $showSchema = false, $mask = false)
{
$recordSet1 = $this->Execute("select * from system.tables");
if(!$recordSet1){
print $this->ErrorMsg();
return false;
}
$recordSet2 = $th... | php | function &MetaTables($ttype = false, $showSchema = false, $mask = false)
{
$recordSet1 = $this->Execute("select * from system.tables");
if(!$recordSet1){
print $this->ErrorMsg();
return false;
}
$recordSet2 = $th... | [
"function",
"&",
"MetaTables",
"(",
"$",
"ttype",
"=",
"false",
",",
"$",
"showSchema",
"=",
"false",
",",
"$",
"mask",
"=",
"false",
")",
"{",
"$",
"recordSet1",
"=",
"$",
"this",
"->",
"Execute",
"(",
"\"select * from system.tables\"",
")",
";",
"if",
... | tables by default on succesfull execustion. | [
"tables",
"by",
"default",
"on",
"succesfull",
"execustion",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-ads.inc.php#L257-L295 |
218,367 | moodle/moodle | lib/adodb/drivers/adodb-ads.inc.php | ADODB_ads.& | function &MetaColumnNames($table, $numIndexes = false, $useattnum = false)
{
$recordSet = $this->Execute("select name from system.columns where parent='$table'");
if(!$recordSet){
print $this->ErrorMsg();
return false;
... | php | function &MetaColumnNames($table, $numIndexes = false, $useattnum = false)
{
$recordSet = $this->Execute("select name from system.columns where parent='$table'");
if(!$recordSet){
print $this->ErrorMsg();
return false;
... | [
"function",
"&",
"MetaColumnNames",
"(",
"$",
"table",
",",
"$",
"numIndexes",
"=",
"false",
",",
"$",
"useattnum",
"=",
"false",
")",
"{",
"$",
"recordSet",
"=",
"$",
"this",
"->",
"Execute",
"(",
"\"select name from system.columns where parent='$table'\"",
")"... | Returns an array of columns names for a given table | [
"Returns",
"an",
"array",
"of",
"columns",
"names",
"for",
"a",
"given",
"table"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/drivers/adodb-ads.inc.php#L489-L505 |
218,368 | moodle/moodle | lib/horde/framework/Horde/Util.php | Horde_Util.nonInputVar | public static function nonInputVar($varname, $default = null)
{
return (isset($_GET[$varname]) || isset($_POST[$varname]) || isset($_COOKIE[$varname]))
? $default
: (isset($GLOBALS[$varname]) ? $GLOBALS[$varname] : $default);
} | php | public static function nonInputVar($varname, $default = null)
{
return (isset($_GET[$varname]) || isset($_POST[$varname]) || isset($_COOKIE[$varname]))
? $default
: (isset($GLOBALS[$varname]) ? $GLOBALS[$varname] : $default);
} | [
"public",
"static",
"function",
"nonInputVar",
"(",
"$",
"varname",
",",
"$",
"default",
"=",
"null",
")",
"{",
"return",
"(",
"isset",
"(",
"$",
"_GET",
"[",
"$",
"varname",
"]",
")",
"||",
"isset",
"(",
"$",
"_POST",
"[",
"$",
"varname",
"]",
")"... | Checks to see if a value has been set by the script and not by GET,
POST, or cookie input. The value being checked MUST be in the global
scope.
@param string $varname The variable name to check.
@param mixed $default Default value if the variable isn't present
or was specified by the user. Defaults to null.
@retur... | [
"Checks",
"to",
"see",
"if",
"a",
"value",
"has",
"been",
"set",
"by",
"the",
"script",
"and",
"not",
"by",
"GET",
"POST",
"or",
"cookie",
"input",
".",
"The",
"value",
"being",
"checked",
"MUST",
"be",
"in",
"the",
"global",
"scope",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Util.php#L76-L81 |
218,369 | moodle/moodle | lib/horde/framework/Horde/Util.php | Horde_Util.formInput | public static function formInput($append_session = 0)
{
return (($append_session == 1) || !isset($_COOKIE[session_name()]))
? '<input type="hidden" name="' . htmlspecialchars(session_name()) . '" value="' . htmlspecialchars(session_id()) . "\" />\n"
: '';
} | php | public static function formInput($append_session = 0)
{
return (($append_session == 1) || !isset($_COOKIE[session_name()]))
? '<input type="hidden" name="' . htmlspecialchars(session_name()) . '" value="' . htmlspecialchars(session_id()) . "\" />\n"
: '';
} | [
"public",
"static",
"function",
"formInput",
"(",
"$",
"append_session",
"=",
"0",
")",
"{",
"return",
"(",
"(",
"$",
"append_session",
"==",
"1",
")",
"||",
"!",
"isset",
"(",
"$",
"_COOKIE",
"[",
"session_name",
"(",
")",
"]",
")",
")",
"?",
"'<inp... | Returns a hidden form input containing the session name and id.
@param boolean $append_session 0 = only if needed, 1 = always.
@return string The hidden form input, if needed/requested. | [
"Returns",
"a",
"hidden",
"form",
"input",
"containing",
"the",
"session",
"name",
"and",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Util.php#L90-L95 |
218,370 | moodle/moodle | lib/horde/framework/Horde/Util.php | Horde_Util.createTempDir | public static function createTempDir($delete = true, $temp_dir = null)
{
if (is_null($temp_dir)) {
$temp_dir = sys_get_temp_dir();
}
if (empty($temp_dir)) {
return false;
}
/* Get the first 8 characters of a random string to use as a temporary
... | php | public static function createTempDir($delete = true, $temp_dir = null)
{
if (is_null($temp_dir)) {
$temp_dir = sys_get_temp_dir();
}
if (empty($temp_dir)) {
return false;
}
/* Get the first 8 characters of a random string to use as a temporary
... | [
"public",
"static",
"function",
"createTempDir",
"(",
"$",
"delete",
"=",
"true",
",",
"$",
"temp_dir",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"temp_dir",
")",
")",
"{",
"$",
"temp_dir",
"=",
"sys_get_temp_dir",
"(",
")",
";",
"}",
"i... | Creates a temporary directory in the system's temporary directory.
@param boolean $delete Delete the temporary directory at the end of
the request?
@param string $temp_dir Use this temporary directory as the directory
where the temporary directory will be created.
@return string The pathname to the new temporary ... | [
"Creates",
"a",
"temporary",
"directory",
"in",
"the",
"system",
"s",
"temporary",
"directory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Util.php#L294-L319 |
218,371 | moodle/moodle | lib/horde/framework/Horde/Util.php | Horde_Util.deleteAtShutdown | public static function deleteAtShutdown($filename, $register = true,
$secure = false)
{
/* Initialization of variables and shutdown functions. */
if (!self::$_shutdownreg) {
register_shutdown_function(array(__CLASS__, 'shutdown'));
... | php | public static function deleteAtShutdown($filename, $register = true,
$secure = false)
{
/* Initialization of variables and shutdown functions. */
if (!self::$_shutdownreg) {
register_shutdown_function(array(__CLASS__, 'shutdown'));
... | [
"public",
"static",
"function",
"deleteAtShutdown",
"(",
"$",
"filename",
",",
"$",
"register",
"=",
"true",
",",
"$",
"secure",
"=",
"false",
")",
"{",
"/* Initialization of variables and shutdown functions. */",
"if",
"(",
"!",
"self",
"::",
"$",
"_shutdownreg",... | Removes given elements at request shutdown.
If called with a filename will delete that file at request shutdown; if
called with a directory will remove that directory and all files in that
directory at request shutdown.
If called with no arguments, return all elements to be deleted (this
should only be done by Horde_... | [
"Removes",
"given",
"elements",
"at",
"request",
"shutdown",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Util.php#L388-L406 |
218,372 | moodle/moodle | lib/horde/framework/Horde/Util.php | Horde_Util.shutdown | public static function shutdown()
{
$ptr = &self::$_shutdowndata;
foreach (array_keys($ptr['paths']) as $val) {
if (@is_file($val)) {
self::_secureDelete($val);
continue;
}
try {
$it = new RecursiveIteratorIterator... | php | public static function shutdown()
{
$ptr = &self::$_shutdowndata;
foreach (array_keys($ptr['paths']) as $val) {
if (@is_file($val)) {
self::_secureDelete($val);
continue;
}
try {
$it = new RecursiveIteratorIterator... | [
"public",
"static",
"function",
"shutdown",
"(",
")",
"{",
"$",
"ptr",
"=",
"&",
"self",
"::",
"$",
"_shutdowndata",
";",
"foreach",
"(",
"array_keys",
"(",
"$",
"ptr",
"[",
"'paths'",
"]",
")",
"as",
"$",
"val",
")",
"{",
"if",
"(",
"@",
"is_file"... | Deletes registered files at request shutdown.
This function should never be called manually; it is registered as a
shutdown function by Horde_Util::deleteAtShutdown() and called
automatically at the end of the request.
Contains code from gpg_functions.php.
Copyright 2002-2003 Braverock Ventures | [
"Deletes",
"registered",
"files",
"at",
"request",
"shutdown",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Util.php#L418-L452 |
218,373 | moodle/moodle | lib/horde/framework/Horde/Util.php | Horde_Util._secureDelete | protected static function _secureDelete($file)
{
if (isset($ptr['secure'][$file])) {
$filesize = filesize($file);
$fp = fopen($file, 'r+');
foreach (self::$patterns as $pattern) {
$pattern = substr(str_repeat($pattern, floor($filesize / strlen($pattern)) +... | php | protected static function _secureDelete($file)
{
if (isset($ptr['secure'][$file])) {
$filesize = filesize($file);
$fp = fopen($file, 'r+');
foreach (self::$patterns as $pattern) {
$pattern = substr(str_repeat($pattern, floor($filesize / strlen($pattern)) +... | [
"protected",
"static",
"function",
"_secureDelete",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"ptr",
"[",
"'secure'",
"]",
"[",
"$",
"file",
"]",
")",
")",
"{",
"$",
"filesize",
"=",
"filesize",
"(",
"$",
"file",
")",
";",
"$",
"f... | Securely delete the file by overwriting the data with a random
string.
@param string $file Filename. | [
"Securely",
"delete",
"the",
"file",
"by",
"overwriting",
"the",
"data",
"with",
"a",
"random",
"string",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Util.php#L460-L474 |
218,374 | moodle/moodle | lib/horde/framework/Horde/Util.php | Horde_Util.loadExtension | public static function loadExtension($ext)
{
/* If $ext is already loaded, our work is done. */
if (self::extensionExists($ext)) {
return true;
}
/* See if we can call dl() at all, by the current ini settings.
* dl() has been removed in some PHP 5.3 SAPIs. */
... | php | public static function loadExtension($ext)
{
/* If $ext is already loaded, our work is done. */
if (self::extensionExists($ext)) {
return true;
}
/* See if we can call dl() at all, by the current ini settings.
* dl() has been removed in some PHP 5.3 SAPIs. */
... | [
"public",
"static",
"function",
"loadExtension",
"(",
"$",
"ext",
")",
"{",
"/* If $ext is already loaded, our work is done. */",
"if",
"(",
"self",
"::",
"extensionExists",
"(",
"$",
"ext",
")",
")",
"{",
"return",
"true",
";",
"}",
"/* See if we can call dl() at a... | Tries to load a PHP extension, behaving correctly for all operating
systems.
@param string $ext The extension to load.
@return boolean True if the extension is now loaded, false if not.
True can mean that the extension was already loaded,
OR was loaded dynamically. | [
"Tries",
"to",
"load",
"a",
"PHP",
"extension",
"behaving",
"correctly",
"for",
"all",
"operating",
"systems",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Util.php#L502-L539 |
218,375 | moodle/moodle | lib/horde/framework/Horde/Util.php | Horde_Util.getPathInfo | public static function getPathInfo()
{
if (isset($_SERVER['PATH_INFO']) &&
(strpos($_SERVER['SERVER_SOFTWARE'], 'lighttpd') === false)) {
return $_SERVER['PATH_INFO'];
} elseif (isset($_SERVER['REQUEST_URI']) &&
isset($_SERVER['SCRIPT_NAME'])) {
... | php | public static function getPathInfo()
{
if (isset($_SERVER['PATH_INFO']) &&
(strpos($_SERVER['SERVER_SOFTWARE'], 'lighttpd') === false)) {
return $_SERVER['PATH_INFO'];
} elseif (isset($_SERVER['REQUEST_URI']) &&
isset($_SERVER['SCRIPT_NAME'])) {
... | [
"public",
"static",
"function",
"getPathInfo",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"'PATH_INFO'",
"]",
")",
"&&",
"(",
"strpos",
"(",
"$",
"_SERVER",
"[",
"'SERVER_SOFTWARE'",
"]",
",",
"'lighttpd'",
")",
"===",
"false",
")",
"... | Utility function to obtain PATH_INFO information.
@return string The PATH_INFO string. | [
"Utility",
"function",
"to",
"obtain",
"PATH_INFO",
"information",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Util.php#L546-L575 |
218,376 | moodle/moodle | mod/workshop/eval/best/backup/moodle2/restore_workshopeval_best_subplugin.class.php | restore_workshopeval_best_subplugin.process_workshopeval_best_setting | public function process_workshopeval_best_setting($data) {
global $DB;
$data = (object)$data;
$data->workshopid = $this->get_new_parentid('workshop');
$DB->insert_record('workshopeval_best_settings', $data);
} | php | public function process_workshopeval_best_setting($data) {
global $DB;
$data = (object)$data;
$data->workshopid = $this->get_new_parentid('workshop');
$DB->insert_record('workshopeval_best_settings', $data);
} | [
"public",
"function",
"process_workshopeval_best_setting",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"data",
"=",
"(",
"object",
")",
"$",
"data",
";",
"$",
"data",
"->",
"workshopid",
"=",
"$",
"this",
"->",
"get_new_parentid",
"(",
"'w... | Processes one workshopeval_best_settings element | [
"Processes",
"one",
"workshopeval_best_settings",
"element"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/eval/best/backup/moodle2/restore_workshopeval_best_subplugin.class.php#L56-L62 |
218,377 | moodle/moodle | question/type/randomsamatch/question.php | qtype_randomsamatch_question.find_right_answer | public function find_right_answer($wrappedquestion) {
// We only take into account *one* (the first) correct answer.
while ($answer = array_shift($wrappedquestion->answers)) {
if (!question_state::graded_state_for_fraction(
$answer->fraction)->is_incorrect()) {
... | php | public function find_right_answer($wrappedquestion) {
// We only take into account *one* (the first) correct answer.
while ($answer = array_shift($wrappedquestion->answers)) {
if (!question_state::graded_state_for_fraction(
$answer->fraction)->is_incorrect()) {
... | [
"public",
"function",
"find_right_answer",
"(",
"$",
"wrappedquestion",
")",
"{",
"// We only take into account *one* (the first) correct answer.",
"while",
"(",
"$",
"answer",
"=",
"array_shift",
"(",
"$",
"wrappedquestion",
"->",
"answers",
")",
")",
"{",
"if",
"(",... | Find the corresponding choice id of the first correct answer of a shortanswer question.
choice is added to the randomsamatch question if it doesn't already exist.
@param object $wrappedquestion short answer question.
@return int correct choice id. | [
"Find",
"the",
"corresponding",
"choice",
"id",
"of",
"the",
"first",
"correct",
"answer",
"of",
"a",
"shortanswer",
"question",
".",
"choice",
"is",
"added",
"to",
"the",
"randomsamatch",
"question",
"if",
"it",
"doesn",
"t",
"already",
"exist",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/randomsamatch/question.php#L70-L87 |
218,378 | moodle/moodle | question/type/randomsamatch/question.php | qtype_randomsamatch_question_loader.load_questions | public function load_questions() {
if ($this->choose > count($this->availablequestions)) {
throw new coding_exception('notenoughtshortanswerquestions');
}
$questionids = draw_rand_array($this->availablequestions, $this->choose);
$questions = array();
foreach ($questi... | php | public function load_questions() {
if ($this->choose > count($this->availablequestions)) {
throw new coding_exception('notenoughtshortanswerquestions');
}
$questionids = draw_rand_array($this->availablequestions, $this->choose);
$questions = array();
foreach ($questi... | [
"public",
"function",
"load_questions",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"choose",
">",
"count",
"(",
"$",
"this",
"->",
"availablequestions",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'notenoughtshortanswerquestions'",
")",
";",
"... | Choose and load the desired number of questions.
@return array of short answer questions. | [
"Choose",
"and",
"load",
"the",
"desired",
"number",
"of",
"questions",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/randomsamatch/question.php#L128-L139 |
218,379 | moodle/moodle | lib/classes/shutdown_manager.php | core_shutdown_manager.initialize | public static function initialize() {
if (self::$registered) {
debugging('Shutdown manager is already initialised!');
}
self::$registered = true;
register_shutdown_function(array('core_shutdown_manager', 'shutdown_handler'));
// Signal handlers should only be used wh... | php | public static function initialize() {
if (self::$registered) {
debugging('Shutdown manager is already initialised!');
}
self::$registered = true;
register_shutdown_function(array('core_shutdown_manager', 'shutdown_handler'));
// Signal handlers should only be used wh... | [
"public",
"static",
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"registered",
")",
"{",
"debugging",
"(",
"'Shutdown manager is already initialised!'",
")",
";",
"}",
"self",
"::",
"$",
"registered",
"=",
"true",
";",
"register_shutd... | Register self as main shutdown handler.
@private to be called from lib/setup.php only! | [
"Register",
"self",
"as",
"main",
"shutdown",
"handler",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/shutdown_manager.php#L45-L62 |
218,380 | moodle/moodle | lib/classes/shutdown_manager.php | core_shutdown_manager.signal_handler | public static function signal_handler($signo) {
// Note: There is no need to manually call the shutdown handler.
// The fact that we are calling exit() in this script means that the standard shutdown handling is performed
// anyway.
switch ($signo) {
case SIGTERM:
... | php | public static function signal_handler($signo) {
// Note: There is no need to manually call the shutdown handler.
// The fact that we are calling exit() in this script means that the standard shutdown handling is performed
// anyway.
switch ($signo) {
case SIGTERM:
... | [
"public",
"static",
"function",
"signal_handler",
"(",
"$",
"signo",
")",
"{",
"// Note: There is no need to manually call the shutdown handler.",
"// The fact that we are calling exit() in this script means that the standard shutdown handling is performed",
"// anyway.",
"switch",
"(",
... | Signal handler for SIGINT, and SIGTERM.
@param int $signo The signal being handled | [
"Signal",
"handler",
"for",
"SIGINT",
"and",
"SIGTERM",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/shutdown_manager.php#L69-L96 |
218,381 | moodle/moodle | lib/classes/shutdown_manager.php | core_shutdown_manager.request_shutdown | protected static function request_shutdown() {
global $CFG;
// Help apache server if possible.
$apachereleasemem = false;
if (function_exists('apache_child_terminate') && function_exists('memory_get_usage') && ini_get_bool('child_terminate')) {
$limit = (empty($CFG->apachema... | php | protected static function request_shutdown() {
global $CFG;
// Help apache server if possible.
$apachereleasemem = false;
if (function_exists('apache_child_terminate') && function_exists('memory_get_usage') && ini_get_bool('child_terminate')) {
$limit = (empty($CFG->apachema... | [
"protected",
"static",
"function",
"request_shutdown",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"// Help apache server if possible.",
"$",
"apachereleasemem",
"=",
"false",
";",
"if",
"(",
"function_exists",
"(",
"'apache_child_terminate'",
")",
"&&",
"function_exist... | Standard shutdown sequence. | [
"Standard",
"shutdown",
"sequence",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/shutdown_manager.php#L166-L207 |
218,382 | moodle/moodle | lib/form/defaultcustom.php | MoodleQuickForm_defaultcustom._createElements | public function _createElements() {
if (!$this->has_customize_switch()) {
$element = $this->createFormElement('hidden', 'customize', 1);
} else {
$element = $this->createFormElement('advcheckbox', 'customize', '', $this->_options['customlabel']);
}
$this->_element... | php | public function _createElements() {
if (!$this->has_customize_switch()) {
$element = $this->createFormElement('hidden', 'customize', 1);
} else {
$element = $this->createFormElement('advcheckbox', 'customize', '', $this->_options['customlabel']);
}
$this->_element... | [
"public",
"function",
"_createElements",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has_customize_switch",
"(",
")",
")",
"{",
"$",
"element",
"=",
"$",
"this",
"->",
"createFormElement",
"(",
"'hidden'",
",",
"'customize'",
",",
"1",
")",
";",
... | This will create all elements in the group | [
"This",
"will",
"create",
"all",
"elements",
"in",
"the",
"group"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/defaultcustom.php#L127-L147 |
218,383 | moodle/moodle | lib/form/defaultcustom.php | MoodleQuickForm_defaultcustom.exportValue | public function exportValue(&$submitvalues, $assoc = false) {
$valuearray = array();
foreach ($this->_elements as $element) {
$thisexport = $element->exportValue($submitvalues[$this->getName()], true);
if ($thisexport != null) {
$valuearray += $thisexport;
... | php | public function exportValue(&$submitvalues, $assoc = false) {
$valuearray = array();
foreach ($this->_elements as $element) {
$thisexport = $element->exportValue($submitvalues[$this->getName()], true);
if ($thisexport != null) {
$valuearray += $thisexport;
... | [
"public",
"function",
"exportValue",
"(",
"&",
"$",
"submitvalues",
",",
"$",
"assoc",
"=",
"false",
")",
"{",
"$",
"valuearray",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_elements",
"as",
"$",
"element",
")",
"{",
"$",
"thise... | Output a value. Give it the name of the group. In case of "default" return false.
@param array $submitvalues values submitted.
@param bool $assoc specifies if returned array is associative
@return array | [
"Output",
"a",
"value",
".",
"Give",
"it",
"the",
"name",
"of",
"the",
"group",
".",
"In",
"case",
"of",
"default",
"return",
"false",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/defaultcustom.php#L266-L278 |
218,384 | moodle/moodle | mod/assign/feedback/file/locallib.php | assign_feedback_file.is_feedback_modified | public function is_feedback_modified(stdClass $grade, stdClass $data) {
global $USER;
$filekey = null;
$draftareainfo = null;
foreach ($data as $key => $value) {
if (strpos($key, 'files_') === 0 && strpos($key, '_filemanager')) {
$filekey = $key;
... | php | public function is_feedback_modified(stdClass $grade, stdClass $data) {
global $USER;
$filekey = null;
$draftareainfo = null;
foreach ($data as $key => $value) {
if (strpos($key, 'files_') === 0 && strpos($key, '_filemanager')) {
$filekey = $key;
... | [
"public",
"function",
"is_feedback_modified",
"(",
"stdClass",
"$",
"grade",
",",
"stdClass",
"$",
"data",
")",
"{",
"global",
"$",
"USER",
";",
"$",
"filekey",
"=",
"null",
";",
"$",
"draftareainfo",
"=",
"null",
";",
"foreach",
"(",
"$",
"data",
"as",
... | Has the feedback file been modified?
@param stdClass $grade Grade object.
@param stdClass $data Form data.
@return boolean True if the file area has been modified, else false. | [
"Has",
"the",
"feedback",
"file",
"been",
"modified?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/file/locallib.php#L87-L142 |
218,385 | moodle/moodle | mod/assign/feedback/file/locallib.php | assign_feedback_file.copy_area_files | private function copy_area_files(file_storage $fs,
$fromcontextid,
$fromcomponent,
$fromfilearea,
$fromitemid,
$tocontextid,
... | php | private function copy_area_files(file_storage $fs,
$fromcontextid,
$fromcomponent,
$fromfilearea,
$fromitemid,
$tocontextid,
... | [
"private",
"function",
"copy_area_files",
"(",
"file_storage",
"$",
"fs",
",",
"$",
"fromcontextid",
",",
"$",
"fromcomponent",
",",
"$",
"fromfilearea",
",",
"$",
"fromitemid",
",",
"$",
"tocontextid",
",",
"$",
"tocomponent",
",",
"$",
"tofilearea",
",",
"... | Copy all the files from one file area to another.
@param file_storage $fs - The source context id
@param int $fromcontextid - The source context id
@param string $fromcomponent - The source component
@param string $fromfilearea - The source filearea
@param int $fromitemid - The source item id
@param int $tocontextid -... | [
"Copy",
"all",
"the",
"files",
"from",
"one",
"file",
"area",
"to",
"another",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/file/locallib.php#L158-L200 |
218,386 | moodle/moodle | mod/assign/feedback/file/locallib.php | assign_feedback_file.get_form_elements_for_user | public function get_form_elements_for_user($grade, MoodleQuickForm $mform, stdClass $data, $userid) {
$fileoptions = $this->get_file_options();
$gradeid = $grade ? $grade->id : 0;
$elementname = 'files_' . $userid;
$data = file_prepare_standard_filemanager($data,
... | php | public function get_form_elements_for_user($grade, MoodleQuickForm $mform, stdClass $data, $userid) {
$fileoptions = $this->get_file_options();
$gradeid = $grade ? $grade->id : 0;
$elementname = 'files_' . $userid;
$data = file_prepare_standard_filemanager($data,
... | [
"public",
"function",
"get_form_elements_for_user",
"(",
"$",
"grade",
",",
"MoodleQuickForm",
"$",
"mform",
",",
"stdClass",
"$",
"data",
",",
"$",
"userid",
")",
"{",
"$",
"fileoptions",
"=",
"$",
"this",
"->",
"get_file_options",
"(",
")",
";",
"$",
"gr... | Get form elements for grading form.
@param stdClass $grade
@param MoodleQuickForm $mform
@param stdClass $data
@param int $userid The userid we are currently grading
@return bool true if elements were added to the form | [
"Get",
"form",
"elements",
"for",
"grading",
"form",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/file/locallib.php#L211-L227 |
218,387 | moodle/moodle | mod/assign/feedback/file/locallib.php | assign_feedback_file.update_file_count | public function update_file_count($grade) {
global $DB;
$filefeedback = $this->get_file_feedback($grade->id);
if ($filefeedback) {
$filefeedback->numfiles = $this->count_files($grade->id, ASSIGNFEEDBACK_FILE_FILEAREA);
return $DB->update_record('assignfeedback_file', $fi... | php | public function update_file_count($grade) {
global $DB;
$filefeedback = $this->get_file_feedback($grade->id);
if ($filefeedback) {
$filefeedback->numfiles = $this->count_files($grade->id, ASSIGNFEEDBACK_FILE_FILEAREA);
return $DB->update_record('assignfeedback_file', $fi... | [
"public",
"function",
"update_file_count",
"(",
"$",
"grade",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"filefeedback",
"=",
"$",
"this",
"->",
"get_file_feedback",
"(",
"$",
"grade",
"->",
"id",
")",
";",
"if",
"(",
"$",
"filefeedback",
")",
"{",
"$",
... | Update the number of files in the file area.
@param stdClass $grade The grade record
@return bool - true if the value was saved | [
"Update",
"the",
"number",
"of",
"files",
"in",
"the",
"file",
"area",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/file/locallib.php#L255-L269 |
218,388 | moodle/moodle | mod/assign/feedback/file/locallib.php | assign_feedback_file.save | public function save(stdClass $grade, stdClass $data) {
$fileoptions = $this->get_file_options();
// The element name may have been for a different user.
foreach ($data as $key => $value) {
if (strpos($key, 'files_') === 0 && strpos($key, '_filemanager')) {
$elementn... | php | public function save(stdClass $grade, stdClass $data) {
$fileoptions = $this->get_file_options();
// The element name may have been for a different user.
foreach ($data as $key => $value) {
if (strpos($key, 'files_') === 0 && strpos($key, '_filemanager')) {
$elementn... | [
"public",
"function",
"save",
"(",
"stdClass",
"$",
"grade",
",",
"stdClass",
"$",
"data",
")",
"{",
"$",
"fileoptions",
"=",
"$",
"this",
"->",
"get_file_options",
"(",
")",
";",
"// The element name may have been for a different user.",
"foreach",
"(",
"$",
"d... | Save the feedback files.
@param stdClass $grade
@param stdClass $data
@return bool | [
"Save",
"the",
"feedback",
"files",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/file/locallib.php#L278-L297 |
218,389 | moodle/moodle | mod/assign/feedback/file/locallib.php | assign_feedback_file.upgrade | public function upgrade(context $oldcontext,
stdClass $oldassignment,
stdClass $oldsubmission,
stdClass $grade,
& $log) {
global $DB;
// Now copy the area files.
$this->assignment->co... | php | public function upgrade(context $oldcontext,
stdClass $oldassignment,
stdClass $oldsubmission,
stdClass $grade,
& $log) {
global $DB;
// Now copy the area files.
$this->assignment->co... | [
"public",
"function",
"upgrade",
"(",
"context",
"$",
"oldcontext",
",",
"stdClass",
"$",
"oldassignment",
",",
"stdClass",
"$",
"oldsubmission",
",",
"stdClass",
"$",
"grade",
",",
"&",
"$",
"log",
")",
"{",
"global",
"$",
"DB",
";",
"// Now copy the area f... | Upgrade the feedback from the old assignment to the new one.
@param context $oldcontext - the database for the old assignment context
@param stdClass $oldassignment The data record for the old assignment
@param stdClass $oldsubmission The data record for the old submission
@param stdClass $grade The data record for th... | [
"Upgrade",
"the",
"feedback",
"from",
"the",
"old",
"assignment",
"to",
"the",
"new",
"one",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/file/locallib.php#L404-L431 |
218,390 | moodle/moodle | mod/assign/feedback/file/locallib.php | assign_feedback_file.view_page | public function view_page($action) {
if ($action == 'uploadfiles') {
$users = required_param('selectedusers', PARAM_SEQUENCE);
return $this->view_batch_upload_files(explode(',', $users));
}
if ($action == 'uploadzip') {
return $this->view_upload_zip();
... | php | public function view_page($action) {
if ($action == 'uploadfiles') {
$users = required_param('selectedusers', PARAM_SEQUENCE);
return $this->view_batch_upload_files(explode(',', $users));
}
if ($action == 'uploadzip') {
return $this->view_upload_zip();
... | [
"public",
"function",
"view_page",
"(",
"$",
"action",
")",
"{",
"if",
"(",
"$",
"action",
"==",
"'uploadfiles'",
")",
"{",
"$",
"users",
"=",
"required_param",
"(",
"'selectedusers'",
",",
"PARAM_SEQUENCE",
")",
";",
"return",
"$",
"this",
"->",
"view_bat... | Called by the assignment module when someone chooses something from the
grading navigation or batch operations list.
@param string $action - The page to view
@return string - The html response | [
"Called",
"by",
"the",
"assignment",
"module",
"when",
"someone",
"chooses",
"something",
"from",
"the",
"grading",
"navigation",
"or",
"batch",
"operations",
"list",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/file/locallib.php#L668-L678 |
218,391 | moodle/moodle | lib/classes/antivirus/scanner.php | scanner.get_config | public function get_config($property) {
if (property_exists($this->config, $property)) {
return $this->config->$property;
}
throw new \coding_exception('Config property "' . $property . '" doesn\'t exist');
} | php | public function get_config($property) {
if (property_exists($this->config, $property)) {
return $this->config->$property;
}
throw new \coding_exception('Config property "' . $property . '" doesn\'t exist');
} | [
"public",
"function",
"get_config",
"(",
"$",
"property",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"this",
"->",
"config",
",",
"$",
"property",
")",
")",
"{",
"return",
"$",
"this",
"->",
"config",
"->",
"$",
"property",
";",
"}",
"throw",
... | Config get method.
@param string $property config property to get.
@return mixed
@throws \coding_exception | [
"Config",
"get",
"method",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/antivirus/scanner.php#L70-L75 |
218,392 | moodle/moodle | lib/classes/antivirus/scanner.php | scanner.message_admins | public function message_admins($notice) {
$site = get_site();
$subject = get_string('emailsubject', 'antivirus', format_string($site->fullname));
$admins = get_admins();
foreach ($admins as $admin) {
$eventdata = new \core\message\message();
$eventdata->courseid... | php | public function message_admins($notice) {
$site = get_site();
$subject = get_string('emailsubject', 'antivirus', format_string($site->fullname));
$admins = get_admins();
foreach ($admins as $admin) {
$eventdata = new \core\message\message();
$eventdata->courseid... | [
"public",
"function",
"message_admins",
"(",
"$",
"notice",
")",
"{",
"$",
"site",
"=",
"get_site",
"(",
")",
";",
"$",
"subject",
"=",
"get_string",
"(",
"'emailsubject'",
",",
"'antivirus'",
",",
"format_string",
"(",
"$",
"site",
"->",
"fullname",
")",
... | Email admins about antivirus scan outcomes.
@param string $notice The body of the email to be sent.
@return void | [
"Email",
"admins",
"about",
"antivirus",
"scan",
"outcomes",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/antivirus/scanner.php#L138-L158 |
218,393 | moodle/moodle | cache/classes/helper.php | cache_helper.get_class_for_mode | public static function get_class_for_mode($mode) {
switch ($mode) {
case cache_store::MODE_APPLICATION :
return 'cache_application';
case cache_store::MODE_REQUEST :
return 'cache_request';
case cache_store::MODE_SESSION :
retur... | php | public static function get_class_for_mode($mode) {
switch ($mode) {
case cache_store::MODE_APPLICATION :
return 'cache_application';
case cache_store::MODE_REQUEST :
return 'cache_request';
case cache_store::MODE_SESSION :
retur... | [
"public",
"static",
"function",
"get_class_for_mode",
"(",
"$",
"mode",
")",
"{",
"switch",
"(",
"$",
"mode",
")",
"{",
"case",
"cache_store",
"::",
"MODE_APPLICATION",
":",
"return",
"'cache_application'",
";",
"case",
"cache_store",
"::",
"MODE_REQUEST",
":",
... | Returns the class for use as a cache loader for the given mode.
@param int $mode One of cache_store::MODE_
@return string
@throws coding_exception | [
"Returns",
"the",
"class",
"for",
"use",
"as",
"a",
"cache",
"loader",
"for",
"the",
"given",
"mode",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L117-L127 |
218,394 | moodle/moodle | cache/classes/helper.php | cache_helper.get_cache_stores | public static function get_cache_stores(cache_definition $definition) {
$instance = cache_config::instance();
$stores = $instance->get_stores_for_definition($definition);
$stores = self::initialise_cachestore_instances($stores, $definition);
return $stores;
} | php | public static function get_cache_stores(cache_definition $definition) {
$instance = cache_config::instance();
$stores = $instance->get_stores_for_definition($definition);
$stores = self::initialise_cachestore_instances($stores, $definition);
return $stores;
} | [
"public",
"static",
"function",
"get_cache_stores",
"(",
"cache_definition",
"$",
"definition",
")",
"{",
"$",
"instance",
"=",
"cache_config",
"::",
"instance",
"(",
")",
";",
"$",
"stores",
"=",
"$",
"instance",
"->",
"get_stores_for_definition",
"(",
"$",
"... | Returns the cache stores to be used with the given definition.
@param cache_definition $definition
@return array | [
"Returns",
"the",
"cache",
"stores",
"to",
"be",
"used",
"with",
"the",
"given",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L134-L139 |
218,395 | moodle/moodle | cache/classes/helper.php | cache_helper.initialise_cachestore_instances | protected static function initialise_cachestore_instances(array $stores, cache_definition $definition) {
$return = array();
$factory = cache_factory::instance();
foreach ($stores as $name => $details) {
$store = $factory->create_store_from_config($name, $details, $definition);
... | php | protected static function initialise_cachestore_instances(array $stores, cache_definition $definition) {
$return = array();
$factory = cache_factory::instance();
foreach ($stores as $name => $details) {
$store = $factory->create_store_from_config($name, $details, $definition);
... | [
"protected",
"static",
"function",
"initialise_cachestore_instances",
"(",
"array",
"$",
"stores",
",",
"cache_definition",
"$",
"definition",
")",
"{",
"$",
"return",
"=",
"array",
"(",
")",
";",
"$",
"factory",
"=",
"cache_factory",
"::",
"instance",
"(",
")... | Internal function for initialising an array of stores against a given cache definition.
@param array $stores
@param cache_definition $definition
@return cache_store[] | [
"Internal",
"function",
"for",
"initialising",
"an",
"array",
"of",
"stores",
"against",
"a",
"given",
"cache",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L148-L158 |
218,396 | moodle/moodle | cache/classes/helper.php | cache_helper.get_cachelock_for_store | public static function get_cachelock_for_store(cache_store $store) {
$instance = cache_config::instance();
$lockconf = $instance->get_lock_for_store($store->my_name());
$factory = cache_factory::instance();
return $factory->create_lock_instance($lockconf);
} | php | public static function get_cachelock_for_store(cache_store $store) {
$instance = cache_config::instance();
$lockconf = $instance->get_lock_for_store($store->my_name());
$factory = cache_factory::instance();
return $factory->create_lock_instance($lockconf);
} | [
"public",
"static",
"function",
"get_cachelock_for_store",
"(",
"cache_store",
"$",
"store",
")",
"{",
"$",
"instance",
"=",
"cache_config",
"::",
"instance",
"(",
")",
";",
"$",
"lockconf",
"=",
"$",
"instance",
"->",
"get_lock_for_store",
"(",
"$",
"store",
... | Returns a cache_lock instance suitable for use with the store.
@param cache_store $store
@return cache_lock_interface | [
"Returns",
"a",
"cache_lock",
"instance",
"suitable",
"for",
"use",
"with",
"the",
"store",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L166-L171 |
218,397 | moodle/moodle | cache/classes/helper.php | cache_helper.early_get_cache_plugins | public static function early_get_cache_plugins() {
global $CFG;
$result = array();
$ignored = array('CVS', '_vti_cnf', 'simpletest', 'db', 'yui', 'tests');
$fulldir = $CFG->dirroot.'/cache/stores';
$items = new DirectoryIterator($fulldir);
foreach ($items as $item) {
... | php | public static function early_get_cache_plugins() {
global $CFG;
$result = array();
$ignored = array('CVS', '_vti_cnf', 'simpletest', 'db', 'yui', 'tests');
$fulldir = $CFG->dirroot.'/cache/stores';
$items = new DirectoryIterator($fulldir);
foreach ($items as $item) {
... | [
"public",
"static",
"function",
"early_get_cache_plugins",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"result",
"=",
"array",
"(",
")",
";",
"$",
"ignored",
"=",
"array",
"(",
"'CVS'",
",",
"'_vti_cnf'",
",",
"'simpletest'",
",",
"'db'",
",",
"'yui'"... | Returns an array of plugins without using core methods.
This function explicitly does NOT use core functions as it will in some circumstances be called before Moodle has
finished initialising. This happens when loading configuration for instance.
@return string | [
"Returns",
"an",
"array",
"of",
"plugins",
"without",
"using",
"core",
"methods",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L181-L204 |
218,398 | moodle/moodle | cache/classes/helper.php | cache_helper.invalidate_by_definition | public static function invalidate_by_definition($component, $area, array $identifiers = array(), $keys = array()) {
$cache = cache::make($component, $area, $identifiers);
if (is_array($keys)) {
$cache->delete_many($keys);
} else if (is_scalar($keys)) {
$cache->delete($key... | php | public static function invalidate_by_definition($component, $area, array $identifiers = array(), $keys = array()) {
$cache = cache::make($component, $area, $identifiers);
if (is_array($keys)) {
$cache->delete_many($keys);
} else if (is_scalar($keys)) {
$cache->delete($key... | [
"public",
"static",
"function",
"invalidate_by_definition",
"(",
"$",
"component",
",",
"$",
"area",
",",
"array",
"$",
"identifiers",
"=",
"array",
"(",
")",
",",
"$",
"keys",
"=",
"array",
"(",
")",
")",
"{",
"$",
"cache",
"=",
"cache",
"::",
"make",... | Invalidates a given set of keys from a given definition.
@todo Invalidating by definition should also add to the event cache so that sessions can be invalidated (when required).
@param string $component
@param string $area
@param array $identifiers
@param array $keys
@return boolean | [
"Invalidates",
"a",
"given",
"set",
"of",
"keys",
"from",
"a",
"given",
"definition",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L217-L227 |
218,399 | moodle/moodle | cache/classes/helper.php | cache_helper.invalidate_by_event | public static function invalidate_by_event($event, array $keys) {
$instance = cache_config::instance();
$invalidationeventset = false;
$factory = cache_factory::instance();
$inuse = $factory->get_caches_in_use();
$purgetoken = null;
foreach ($instance->get_definitions() a... | php | public static function invalidate_by_event($event, array $keys) {
$instance = cache_config::instance();
$invalidationeventset = false;
$factory = cache_factory::instance();
$inuse = $factory->get_caches_in_use();
$purgetoken = null;
foreach ($instance->get_definitions() a... | [
"public",
"static",
"function",
"invalidate_by_event",
"(",
"$",
"event",
",",
"array",
"$",
"keys",
")",
"{",
"$",
"instance",
"=",
"cache_config",
"::",
"instance",
"(",
")",
";",
"$",
"invalidationeventset",
"=",
"false",
";",
"$",
"factory",
"=",
"cach... | Invalidates a given set of keys by means of an event.
Events cannot determine what identifiers might need to be cleared. Event based purge and invalidation
are only supported on caches without identifiers.
@param string $event
@param array $keys | [
"Invalidates",
"a",
"given",
"set",
"of",
"keys",
"by",
"means",
"of",
"an",
"event",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/classes/helper.php#L238-L283 |
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.