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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
216,900 | moodle/moodle | user/externallib.php | core_user_external.get_private_files_info | public static function get_private_files_info($userid = 0) {
global $CFG, $USER;
require_once($CFG->libdir . '/filelib.php');
$params = self::validate_parameters(self::get_private_files_info_parameters(), array('userid' => $userid));
$warnings = array();
$context = context_syst... | php | public static function get_private_files_info($userid = 0) {
global $CFG, $USER;
require_once($CFG->libdir . '/filelib.php');
$params = self::validate_parameters(self::get_private_files_info_parameters(), array('userid' => $userid));
$warnings = array();
$context = context_syst... | [
"public",
"static",
"function",
"get_private_files_info",
"(",
"$",
"userid",
"=",
"0",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"USER",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/filelib.php'",
")",
";",
"$",
"params",
"=",
"self",
... | Returns general information about files in the user private files area.
@param int $userid Id of the user, default to current user.
@return array of warnings and file area information
@since Moodle 3.4
@throws moodle_exception | [
"Returns",
"general",
"information",
"about",
"files",
"in",
"the",
"user",
"private",
"files",
"area",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/externallib.php#L1956-L1986 |
216,901 | moodle/moodle | favourites/classes/service_factory.php | service_factory.get_service_for_user_context | public static function get_service_for_user_context(\context_user $context) : local\service\user_favourite_service {
return new local\service\user_favourite_service($context, new local\repository\favourite_repository());
} | php | public static function get_service_for_user_context(\context_user $context) : local\service\user_favourite_service {
return new local\service\user_favourite_service($context, new local\repository\favourite_repository());
} | [
"public",
"static",
"function",
"get_service_for_user_context",
"(",
"\\",
"context_user",
"$",
"context",
")",
":",
"local",
"\\",
"service",
"\\",
"user_favourite_service",
"{",
"return",
"new",
"local",
"\\",
"service",
"\\",
"user_favourite_service",
"(",
"$",
... | Returns a basic service object providing operations for user favourites.
@param \context_user $context the context of the user to which the service should be scoped.
@return \core_favourites\local\service\user_favourite_service the service object. | [
"Returns",
"a",
"basic",
"service",
"object",
"providing",
"operations",
"for",
"user",
"favourites",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/favourites/classes/service_factory.php#L45-L47 |
216,902 | moodle/moodle | backup/moodle2/restore_qtype_extrafields_plugin.class.php | restore_qtype_extrafields_plugin.process_extraanswerdata | public function process_extraanswerdata($data) {
global $DB;
$extra = $this->qtypeobj->extra_answer_fields();
$tablename = array_shift($extra);
$oldquestionid = $this->get_old_parentid('question');
$questioncreated = $this->get_mappingid('question_created', $oldquestionid) ? tr... | php | public function process_extraanswerdata($data) {
global $DB;
$extra = $this->qtypeobj->extra_answer_fields();
$tablename = array_shift($extra);
$oldquestionid = $this->get_old_parentid('question');
$questioncreated = $this->get_mappingid('question_created', $oldquestionid) ? tr... | [
"public",
"function",
"process_extraanswerdata",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"extra",
"=",
"$",
"this",
"->",
"qtypeobj",
"->",
"extra_answer_fields",
"(",
")",
";",
"$",
"tablename",
"=",
"array_shift",
"(",
"$",
"extra",
... | Processes the extra answer data
@param array $data extra answer data | [
"Processes",
"the",
"extra",
"answer",
"data"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/restore_qtype_extrafields_plugin.class.php#L83-L98 |
216,903 | moodle/moodle | question/type/edit_question_form.php | question_edit_form.can_preview | protected function can_preview() {
return empty($this->question->beingcopied) && !empty($this->question->id) &&
$this->question->formoptions->canedit;
} | php | protected function can_preview() {
return empty($this->question->beingcopied) && !empty($this->question->id) &&
$this->question->formoptions->canedit;
} | [
"protected",
"function",
"can_preview",
"(",
")",
"{",
"return",
"empty",
"(",
"$",
"this",
"->",
"question",
"->",
"beingcopied",
")",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"question",
"->",
"id",
")",
"&&",
"$",
"this",
"->",
"question",
"->",
... | Is the question being edited in a state where it can be previewed?
@return bool whether to show the preview link. | [
"Is",
"the",
"question",
"being",
"edited",
"in",
"a",
"state",
"where",
"it",
"can",
"be",
"previewed?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/edit_question_form.php#L276-L279 |
216,904 | moodle/moodle | question/type/edit_question_form.php | question_edit_form.get_per_answer_fields | protected function get_per_answer_fields($mform, $label, $gradeoptions,
&$repeatedoptions, &$answersoption) {
$repeated = array();
$answeroptions = array();
$answeroptions[] = $mform->createElement('text', 'answer',
$label, array('size' => 40));
$answeroptions... | php | protected function get_per_answer_fields($mform, $label, $gradeoptions,
&$repeatedoptions, &$answersoption) {
$repeated = array();
$answeroptions = array();
$answeroptions[] = $mform->createElement('text', 'answer',
$label, array('size' => 40));
$answeroptions... | [
"protected",
"function",
"get_per_answer_fields",
"(",
"$",
"mform",
",",
"$",
"label",
",",
"$",
"gradeoptions",
",",
"&",
"$",
"repeatedoptions",
",",
"&",
"$",
"answersoption",
")",
"{",
"$",
"repeated",
"=",
"array",
"(",
")",
";",
"$",
"answeroptions"... | Get the list of form elements to repeat, one for each answer.
@param object $mform the form being built.
@param $label the label to use for each option.
@param $gradeoptions the possible grades for each answer.
@param $repeatedoptions reference to array of repeated options to fill
@param $answersoption reference to ret... | [
"Get",
"the",
"list",
"of",
"form",
"elements",
"to",
"repeat",
"one",
"for",
"each",
"answer",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/edit_question_form.php#L291-L307 |
216,905 | moodle/moodle | question/type/edit_question_form.php | question_edit_form.add_tag_fields | protected function add_tag_fields($mform) {
global $CFG, $DB;
$hastagcapability = question_has_capability_on($this->question, 'tag');
// Is the question category in a course context?
$qcontext = $this->categorycontext;
$qcoursecontext = $qcontext->get_course_context(false);
... | php | protected function add_tag_fields($mform) {
global $CFG, $DB;
$hastagcapability = question_has_capability_on($this->question, 'tag');
// Is the question category in a course context?
$qcontext = $this->categorycontext;
$qcoursecontext = $qcontext->get_course_context(false);
... | [
"protected",
"function",
"add_tag_fields",
"(",
"$",
"mform",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"$",
"hastagcapability",
"=",
"question_has_capability_on",
"(",
"$",
"this",
"->",
"question",
",",
"'tag'",
")",
";",
"// Is the question categ... | Add the tag and course tag fields to the mform.
If the form is being built in a course context then add the field
for course tags.
If the question category doesn't belong to a course context or we
aren't editing in a course context then add the tags element to allow
tags to be added to the question category context.
... | [
"Add",
"the",
"tag",
"and",
"course",
"tag",
"fields",
"to",
"the",
"mform",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/edit_question_form.php#L321-L376 |
216,906 | moodle/moodle | question/type/edit_question_form.php | question_edit_form.add_per_answer_fields | protected function add_per_answer_fields(&$mform, $label, $gradeoptions,
$minoptions = QUESTION_NUMANS_START, $addoptions = QUESTION_NUMANS_ADD) {
$mform->addElement('header', 'answerhdr',
get_string('answers', 'question'), '');
$mform->setExpanded('answerhdr', 1);
... | php | protected function add_per_answer_fields(&$mform, $label, $gradeoptions,
$minoptions = QUESTION_NUMANS_START, $addoptions = QUESTION_NUMANS_ADD) {
$mform->addElement('header', 'answerhdr',
get_string('answers', 'question'), '');
$mform->setExpanded('answerhdr', 1);
... | [
"protected",
"function",
"add_per_answer_fields",
"(",
"&",
"$",
"mform",
",",
"$",
"label",
",",
"$",
"gradeoptions",
",",
"$",
"minoptions",
"=",
"QUESTION_NUMANS_START",
",",
"$",
"addoptions",
"=",
"QUESTION_NUMANS_ADD",
")",
"{",
"$",
"mform",
"->",
"addE... | Add a set of form fields, obtained from get_per_answer_fields, to the form,
one for each existing answer, with some blanks for some new ones.
@param object $mform the form being built.
@param $label the label to use for each option.
@param $gradeoptions the possible grades for each answer.
@param $minoptions the minimu... | [
"Add",
"a",
"set",
"of",
"form",
"fields",
"obtained",
"from",
"get_per_answer_fields",
"to",
"the",
"form",
"one",
"for",
"each",
"existing",
"answer",
"with",
"some",
"blanks",
"for",
"some",
"new",
"ones",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/edit_question_form.php#L388-L407 |
216,907 | moodle/moodle | question/type/edit_question_form.php | question_edit_form.get_hint_fields | protected function get_hint_fields($withclearwrong = false, $withshownumpartscorrect = false) {
$mform = $this->_form;
$repeatedoptions = array();
$repeated = array();
$repeated[] = $mform->createElement('editor', 'hint', get_string('hintn', 'question'),
array('rows' => ... | php | protected function get_hint_fields($withclearwrong = false, $withshownumpartscorrect = false) {
$mform = $this->_form;
$repeatedoptions = array();
$repeated = array();
$repeated[] = $mform->createElement('editor', 'hint', get_string('hintn', 'question'),
array('rows' => ... | [
"protected",
"function",
"get_hint_fields",
"(",
"$",
"withclearwrong",
"=",
"false",
",",
"$",
"withshownumpartscorrect",
"=",
"false",
")",
"{",
"$",
"mform",
"=",
"$",
"this",
"->",
"_form",
";",
"$",
"repeatedoptions",
"=",
"array",
"(",
")",
";",
"$",... | Create the form elements required by one hint.
@param string $withclearwrong whether this quesiton type uses the 'Clear wrong' option on hints.
@param string $withshownumpartscorrect whether this quesiton type uses the 'Show num parts correct' option on hints.
@return array form field elements for one hint. | [
"Create",
"the",
"form",
"elements",
"required",
"by",
"one",
"hint",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/edit_question_form.php#L446-L471 |
216,908 | moodle/moodle | question/type/edit_question_form.php | question_edit_form.data_preprocessing_extra_answer_fields | protected function data_preprocessing_extra_answer_fields($question, $extraanswerfields) {
// Setting $question->$field[$key] won't work in PHP, so we need set an array of answer values to $question->$field.
// As we may have several extra fields with data for several answers in each, we use an array of... | php | protected function data_preprocessing_extra_answer_fields($question, $extraanswerfields) {
// Setting $question->$field[$key] won't work in PHP, so we need set an array of answer values to $question->$field.
// As we may have several extra fields with data for several answers in each, we use an array of... | [
"protected",
"function",
"data_preprocessing_extra_answer_fields",
"(",
"$",
"question",
",",
"$",
"extraanswerfields",
")",
"{",
"// Setting $question->$field[$key] won't work in PHP, so we need set an array of answer values to $question->$field.",
"// As we may have several extra fields wi... | Perform the necessary preprocessing for the extra answer fields.
Questions that do something not trivial when editing extra answer fields
will want to override this.
@param object $question the data being passed to the form.
@param array $extraanswerfields extra answer fields (without table name).
@return object $ques... | [
"Perform",
"the",
"necessary",
"preprocessing",
"for",
"the",
"extra",
"answer",
"fields",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/edit_question_form.php#L675-L701 |
216,909 | moodle/moodle | backup/util/ui/classes/privacy/provider.php | provider.delete_data_for_all_users_in_context | public static function delete_data_for_all_users_in_context(\context $context) {
global $DB;
if ($context instanceof \context_course) {
$sectionsql = "itemid IN (SELECT id FROM {course_sections} WHERE course = ?) AND type = ?";
$DB->delete_records_select('backup_controllers', $s... | php | public static function delete_data_for_all_users_in_context(\context $context) {
global $DB;
if ($context instanceof \context_course) {
$sectionsql = "itemid IN (SELECT id FROM {course_sections} WHERE course = ?) AND type = ?";
$DB->delete_records_select('backup_controllers', $s... | [
"public",
"static",
"function",
"delete_data_for_all_users_in_context",
"(",
"\\",
"context",
"$",
"context",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"context",
"instanceof",
"\\",
"context_course",
")",
"{",
"$",
"sectionsql",
"=",
"\"itemid IN (SEL... | Delete all user data which matches the specified context.
Only dealing with the specific context - not it's child contexts.
@param \context $context A user context. | [
"Delete",
"all",
"user",
"data",
"which",
"matches",
"the",
"specified",
"context",
".",
"Only",
"dealing",
"with",
"the",
"specific",
"context",
"-",
"not",
"it",
"s",
"child",
"contexts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/classes/privacy/provider.php#L230-L242 |
216,910 | moodle/moodle | backup/util/ui/classes/privacy/provider.php | provider.delete_data_for_users | public static function delete_data_for_users(approved_userlist $userlist) {
global $DB;
if (empty($userlist->get_userids())) {
return;
}
$context = $userlist->get_context();
if ($context instanceof \context_course) {
list($usersql, $userparams) = $DB->ge... | php | public static function delete_data_for_users(approved_userlist $userlist) {
global $DB;
if (empty($userlist->get_userids())) {
return;
}
$context = $userlist->get_context();
if ($context instanceof \context_course) {
list($usersql, $userparams) = $DB->ge... | [
"public",
"static",
"function",
"delete_data_for_users",
"(",
"approved_userlist",
"$",
"userlist",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"userlist",
"->",
"get_userids",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"$",
"cont... | Delete multiple users within a single context.
Only dealing with the specific context - not it's child contexts.
@param approved_userlist $userlist The approved context and user information to delete information for. | [
"Delete",
"multiple",
"users",
"within",
"a",
"single",
"context",
".",
"Only",
"dealing",
"with",
"the",
"specific",
"context",
"-",
"not",
"it",
"s",
"child",
"contexts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/classes/privacy/provider.php#L250-L286 |
216,911 | moodle/moodle | backup/util/ui/classes/privacy/provider.php | provider.delete_data_for_user | public static function delete_data_for_user(approved_contextlist $contextlist) {
global $DB;
if (empty($contextlist->count())) {
return;
}
$userid = $contextlist->get_user()->id;
foreach ($contextlist->get_contexts() as $context) {
if ($context instanceo... | php | public static function delete_data_for_user(approved_contextlist $contextlist) {
global $DB;
if (empty($contextlist->count())) {
return;
}
$userid = $contextlist->get_user()->id;
foreach ($contextlist->get_contexts() as $context) {
if ($context instanceo... | [
"public",
"static",
"function",
"delete_data_for_user",
"(",
"approved_contextlist",
"$",
"contextlist",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"contextlist",
"->",
"count",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"$",
"us... | Delete all user data for the specified user, in the specified contexts.
Only dealing with the specific context - not it's child contexts.
@param approved_contextlist $contextlist The approved contexts and user information to delete information for. | [
"Delete",
"all",
"user",
"data",
"for",
"the",
"specified",
"user",
"in",
"the",
"specified",
"contexts",
".",
"Only",
"dealing",
"with",
"the",
"specific",
"context",
"-",
"not",
"it",
"s",
"child",
"contexts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/classes/privacy/provider.php#L294-L335 |
216,912 | moodle/moodle | calendar/classes/type_base.php | type_base.convert_to_timestamp | public function convert_to_timestamp($year, $month, $day, $hour = 0, $minute = 0) {
$gregorianinfo = $this->convert_to_gregorian($year, $month, $day, $hour, $minute);
return make_timestamp(
$gregorianinfo['year'],
$gregorianinfo['month'],
$gregorianinfo['day'],
... | php | public function convert_to_timestamp($year, $month, $day, $hour = 0, $minute = 0) {
$gregorianinfo = $this->convert_to_gregorian($year, $month, $day, $hour, $minute);
return make_timestamp(
$gregorianinfo['year'],
$gregorianinfo['month'],
$gregorianinfo['day'],
... | [
"public",
"function",
"convert_to_timestamp",
"(",
"$",
"year",
",",
"$",
"month",
",",
"$",
"day",
",",
"$",
"hour",
"=",
"0",
",",
"$",
"minute",
"=",
"0",
")",
"{",
"$",
"gregorianinfo",
"=",
"$",
"this",
"->",
"convert_to_gregorian",
"(",
"$",
"y... | Provided with a day, month, year, hour and minute in the specific
calendar type convert it into the equivalent Unix Time Stamp.
@param int $year
@param int $month
@param int $day
@param int $hour
@param int $minute
@return int timestamp | [
"Provided",
"with",
"a",
"day",
"month",
"year",
"hour",
"and",
"minute",
"in",
"the",
"specific",
"calendar",
"type",
"convert",
"it",
"into",
"the",
"equivalent",
"Unix",
"Time",
"Stamp",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/type_base.php#L232-L241 |
216,913 | moodle/moodle | calendar/classes/type_base.php | type_base.get_prev_day | public function get_prev_day($daytimestamp) {
$date = new \DateTime();
$date->setTimestamp($daytimestamp);
$date->modify('-1 day');
return $date->getTimestamp();
} | php | public function get_prev_day($daytimestamp) {
$date = new \DateTime();
$date->setTimestamp($daytimestamp);
$date->modify('-1 day');
return $date->getTimestamp();
} | [
"public",
"function",
"get_prev_day",
"(",
"$",
"daytimestamp",
")",
"{",
"$",
"date",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"$",
"date",
"->",
"setTimestamp",
"(",
"$",
"daytimestamp",
")",
";",
"$",
"date",
"->",
"modify",
"(",
"'-1 day'",
")"... | Get the previous day.
@param int $daytimestamp The day timestamp.
@return int previous day timestamp | [
"Get",
"the",
"previous",
"day",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/type_base.php#L249-L255 |
216,914 | moodle/moodle | calendar/classes/type_base.php | type_base.get_next_day | public function get_next_day($daytimestamp) {
$date = new \DateTime();
$date->setTimestamp($daytimestamp);
$date->modify('+1 day');
return $date->getTimestamp();
} | php | public function get_next_day($daytimestamp) {
$date = new \DateTime();
$date->setTimestamp($daytimestamp);
$date->modify('+1 day');
return $date->getTimestamp();
} | [
"public",
"function",
"get_next_day",
"(",
"$",
"daytimestamp",
")",
"{",
"$",
"date",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"$",
"date",
"->",
"setTimestamp",
"(",
"$",
"daytimestamp",
")",
";",
"$",
"date",
"->",
"modify",
"(",
"'+1 day'",
")"... | Get the next day.
@param int $daytimestamp The day timestamp.
@return int the following day | [
"Get",
"the",
"next",
"day",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/type_base.php#L263-L269 |
216,915 | moodle/moodle | lib/behat/form_field/behat_form_radio.php | behat_form_radio.set_value | public function set_value($value) {
if ($this->running_javascript()) {
// Check on radio button.
$this->field->click();
// Trigger the onchange event as triggered when 'selecting' the radio.
if (!empty($value) && !$this->field->isSelected()) {
$t... | php | public function set_value($value) {
if ($this->running_javascript()) {
// Check on radio button.
$this->field->click();
// Trigger the onchange event as triggered when 'selecting' the radio.
if (!empty($value) && !$this->field->isSelected()) {
$t... | [
"public",
"function",
"set_value",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"running_javascript",
"(",
")",
")",
"{",
"// Check on radio button.",
"$",
"this",
"->",
"field",
"->",
"click",
"(",
")",
";",
"// Trigger the onchange event as tri... | Sets the value of a radio
Partially overwriting behat_form_checkbox
implementation as when JS is disabled we
can not check() and we should use setValue()
@param string $value
@return void | [
"Sets",
"the",
"value",
"of",
"a",
"radio"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/form_field/behat_form_radio.php#L75-L89 |
216,916 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/UnitConverter.php | HTMLPurifier_UnitConverter.div | private function div($s1, $s2, $scale)
{
if ($this->bcmath) {
return bcdiv($s1, $s2, $scale);
} else {
return $this->scale((float)$s1 / (float)$s2, $scale);
}
} | php | private function div($s1, $s2, $scale)
{
if ($this->bcmath) {
return bcdiv($s1, $s2, $scale);
} else {
return $this->scale((float)$s1 / (float)$s2, $scale);
}
} | [
"private",
"function",
"div",
"(",
"$",
"s1",
",",
"$",
"s2",
",",
"$",
"scale",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"bcmath",
")",
"{",
"return",
"bcdiv",
"(",
"$",
"s1",
",",
"$",
"s2",
",",
"$",
"scale",
")",
";",
"}",
"else",
"{",
"... | Divides two numbers, using arbitrary precision when available.
@param string $s1
@param string $s2
@param int $scale
@return string | [
"Divides",
"two",
"numbers",
"using",
"arbitrary",
"precision",
"when",
"available",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/UnitConverter.php#L246-L253 |
216,917 | moodle/moodle | lib/adodb/datadict/datadict-mssqlnative.inc.php | ADODB2_mssqlnative.DropColumnSQL | function DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
{
$tabname = $this->TableName ($tabname);
if (!is_array($flds))
$flds = explode(',',$flds);
$f = array();
$s = 'ALTER TABLE ' . $tabname;
foreach($flds as $v) {
if ( $constraintname = $this->DefaultConstraintname($tabname,$v) ) {
... | php | function DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
{
$tabname = $this->TableName ($tabname);
if (!is_array($flds))
$flds = explode(',',$flds);
$f = array();
$s = 'ALTER TABLE ' . $tabname;
foreach($flds as $v) {
if ( $constraintname = $this->DefaultConstraintname($tabname,$v) ) {
... | [
"function",
"DropColumnSQL",
"(",
"$",
"tabname",
",",
"$",
"flds",
",",
"$",
"tableflds",
"=",
"''",
",",
"$",
"tableoptions",
"=",
"''",
")",
"{",
"$",
"tabname",
"=",
"$",
"this",
"->",
"TableName",
"(",
"$",
"tabname",
")",
";",
"if",
"(",
"!",... | Drop a column, syntax is ALTER TABLE table DROP COLUMN column,column
@param string $tabname Table Name
@param string[] $flds One, or an array of Fields To Drop
@param string $tableflds Throwaway value to make the function match the parent
@param string $tableoptions Throway value to make the func... | [
"Drop",
"a",
"column",
"syntax",
"is",
"ALTER",
"TABLE",
"table",
"DROP",
"COLUMN",
"column",
"column"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/adodb/datadict/datadict-mssqlnative.inc.php#L223-L239 |
216,918 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/URISchemeRegistry.php | HTMLPurifier_URISchemeRegistry.instance | public static function instance($prototype = null)
{
static $instance = null;
if ($prototype !== null) {
$instance = $prototype;
} elseif ($instance === null || $prototype == true) {
$instance = new HTMLPurifier_URISchemeRegistry();
}
return $instance;... | php | public static function instance($prototype = null)
{
static $instance = null;
if ($prototype !== null) {
$instance = $prototype;
} elseif ($instance === null || $prototype == true) {
$instance = new HTMLPurifier_URISchemeRegistry();
}
return $instance;... | [
"public",
"static",
"function",
"instance",
"(",
"$",
"prototype",
"=",
"null",
")",
"{",
"static",
"$",
"instance",
"=",
"null",
";",
"if",
"(",
"$",
"prototype",
"!==",
"null",
")",
"{",
"$",
"instance",
"=",
"$",
"prototype",
";",
"}",
"elseif",
"... | Retrieve sole instance of the registry.
@param HTMLPurifier_URISchemeRegistry $prototype Optional prototype to overload sole instance with,
or bool true to reset to default registry.
@return HTMLPurifier_URISchemeRegistry
@note Pass a registry object $prototype with a compatible interface and
the function will copy it ... | [
"Retrieve",
"sole",
"instance",
"of",
"the",
"registry",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/URISchemeRegistry.php#L17-L26 |
216,919 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/URISchemeRegistry.php | HTMLPurifier_URISchemeRegistry.getScheme | public function getScheme($scheme, $config, $context)
{
if (!$config) {
$config = HTMLPurifier_Config::createDefault();
}
// important, otherwise attacker could include arbitrary file
$allowed_schemes = $config->get('URI.AllowedSchemes');
if (!$config->get('URI.O... | php | public function getScheme($scheme, $config, $context)
{
if (!$config) {
$config = HTMLPurifier_Config::createDefault();
}
// important, otherwise attacker could include arbitrary file
$allowed_schemes = $config->get('URI.AllowedSchemes');
if (!$config->get('URI.O... | [
"public",
"function",
"getScheme",
"(",
"$",
"scheme",
",",
"$",
"config",
",",
"$",
"context",
")",
"{",
"if",
"(",
"!",
"$",
"config",
")",
"{",
"$",
"config",
"=",
"HTMLPurifier_Config",
"::",
"createDefault",
"(",
")",
";",
"}",
"// important, otherw... | Retrieves a scheme validator object
@param string $scheme String scheme name like http or mailto
@param HTMLPurifier_Config $config
@param HTMLPurifier_Context $context
@return HTMLPurifier_URIScheme | [
"Retrieves",
"a",
"scheme",
"validator",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/URISchemeRegistry.php#L41-L68 |
216,920 | moodle/moodle | lib/classes/task/tag_cron_task.php | tag_cron_task.compute_correlations | public function compute_correlations($mincorrelation = 2) {
global $DB;
// This mighty one line query fetches a row from the database for every
// individual tag correlation. We then need to process the rows collecting
// the correlations for each tag id.
// The fields used by t... | php | public function compute_correlations($mincorrelation = 2) {
global $DB;
// This mighty one line query fetches a row from the database for every
// individual tag correlation. We then need to process the rows collecting
// the correlations for each tag id.
// The fields used by t... | [
"public",
"function",
"compute_correlations",
"(",
"$",
"mincorrelation",
"=",
"2",
")",
"{",
"global",
"$",
"DB",
";",
"// This mighty one line query fetches a row from the database for every",
"// individual tag correlation. We then need to process the rows collecting",
"// the cor... | Calculates and stores the correlated tags of all tags.
The correlations are stored in the 'tag_correlation' table.
Two tags are correlated if they appear together a lot. Ex.: Users tagged with "computers"
will probably also be tagged with "algorithms".
The rationale for the 'tag_correlation' table is performance. It... | [
"Calculates",
"and",
"stores",
"the",
"correlated",
"tags",
"of",
"all",
"tags",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/task/tag_cron_task.php#L69-L145 |
216,921 | moodle/moodle | lib/classes/task/tag_cron_task.php | tag_cron_task.cleanup | public function cleanup() {
global $DB;
// Get ids to delete from instances where the tag has been deleted. This should never happen apparently.
$sql = "SELECT ti.id
FROM {tag_instance} ti
LEFT JOIN {tag} t ON t.id = ti.tagid
WHERE t.id IS null";
... | php | public function cleanup() {
global $DB;
// Get ids to delete from instances where the tag has been deleted. This should never happen apparently.
$sql = "SELECT ti.id
FROM {tag_instance} ti
LEFT JOIN {tag} t ON t.id = ti.tagid
WHERE t.id IS null";
... | [
"public",
"function",
"cleanup",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"// Get ids to delete from instances where the tag has been deleted. This should never happen apparently.",
"$",
"sql",
"=",
"\"SELECT ti.id\n FROM {tag_instance} ti\n LEFT JOIN {tag} t... | Clean up the tag tables, making sure all tagged object still exists.
This method is called from cron.
This should normally not be necessary, but in case related tags are not deleted
when the tagged record is removed, this should be done once in a while, perhaps
on an occasional cron run. On a site with lots of tags,... | [
"Clean",
"up",
"the",
"tag",
"tables",
"making",
"sure",
"all",
"tagged",
"object",
"still",
"exists",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/task/tag_cron_task.php#L157-L213 |
216,922 | moodle/moodle | lib/classes/task/tag_cron_task.php | tag_cron_task.process_computed_correlation | public function process_computed_correlation(stdClass $tagcorrelation) {
global $DB;
// You must provide a tagid and correlatedtags must be set and be an array.
if (empty($tagcorrelation->tagid) || !isset($tagcorrelation->correlatedtags) ||
!is_array($tagcorrelation->correlatedt... | php | public function process_computed_correlation(stdClass $tagcorrelation) {
global $DB;
// You must provide a tagid and correlatedtags must be set and be an array.
if (empty($tagcorrelation->tagid) || !isset($tagcorrelation->correlatedtags) ||
!is_array($tagcorrelation->correlatedt... | [
"public",
"function",
"process_computed_correlation",
"(",
"stdClass",
"$",
"tagcorrelation",
")",
"{",
"global",
"$",
"DB",
";",
"// You must provide a tagid and correlatedtags must be set and be an array.",
"if",
"(",
"empty",
"(",
"$",
"tagcorrelation",
"->",
"tagid",
... | This function processes a tag correlation and makes changes in the database as required.
The tag correlation object needs have both a tagid property and a correlatedtags property that is an array.
@param stdClass $tagcorrelation
@return int/bool The id of the tag correlation that was just processed or false. | [
"This",
"function",
"processes",
"a",
"tag",
"correlation",
"and",
"makes",
"changes",
"in",
"the",
"database",
"as",
"required",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/task/tag_cron_task.php#L223-L241 |
216,923 | moodle/moodle | lib/classes/task/tag_cron_task.php | tag_cron_task.bulk_delete_instances | public function bulk_delete_instances($instances) {
global $DB;
$instanceids = array();
foreach ($instances as $instance) {
$instanceids[] = $instance->id;
}
// This is a multi db compatible method of creating the correct sql when using the 'IN' value.
// $i... | php | public function bulk_delete_instances($instances) {
global $DB;
$instanceids = array();
foreach ($instances as $instance) {
$instanceids[] = $instance->id;
}
// This is a multi db compatible method of creating the correct sql when using the 'IN' value.
// $i... | [
"public",
"function",
"bulk_delete_instances",
"(",
"$",
"instances",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"instanceids",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"instances",
"as",
"$",
"instance",
")",
"{",
"$",
"instanceids",
"[",
"]",
... | This function will delete numerous tag instances efficiently.
This removes tag instances only. It doesn't check to see if it is the last use of a tag.
@param array $instances An array of tag instance objects with the addition of the tagname and tagrawname
(used for recording a delete event). | [
"This",
"function",
"will",
"delete",
"numerous",
"tag",
"instances",
"efficiently",
".",
"This",
"removes",
"tag",
"instances",
"only",
".",
"It",
"doesn",
"t",
"check",
"to",
"see",
"if",
"it",
"is",
"the",
"last",
"use",
"of",
"a",
"tag",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/task/tag_cron_task.php#L250-L270 |
216,924 | moodle/moodle | question/behaviour/adaptive/behaviour.php | qbehaviour_adaptive.adaptive_mark_details_from_step | protected function adaptive_mark_details_from_step(question_attempt_step $gradedstep,
question_state $state, $maxmark, $penalty) {
$details = new qbehaviour_adaptive_mark_details($state);
$details->maxmark = $maxmark;
$details->actualmark = $gradedstep->get_fraction() * $details-... | php | protected function adaptive_mark_details_from_step(question_attempt_step $gradedstep,
question_state $state, $maxmark, $penalty) {
$details = new qbehaviour_adaptive_mark_details($state);
$details->maxmark = $maxmark;
$details->actualmark = $gradedstep->get_fraction() * $details-... | [
"protected",
"function",
"adaptive_mark_details_from_step",
"(",
"question_attempt_step",
"$",
"gradedstep",
",",
"question_state",
"$",
"state",
",",
"$",
"maxmark",
",",
"$",
"penalty",
")",
"{",
"$",
"details",
"=",
"new",
"qbehaviour_adaptive_mark_details",
"(",
... | Actually populate the qbehaviour_adaptive_mark_details object.
@param question_attempt_step $gradedstep the step that holds the relevant mark details.
@param question_state $state the state corresponding to $gradedstep.
@param unknown_type $maxmark the maximum mark for this question_attempt.
@param unknown_type $penalt... | [
"Actually",
"populate",
"the",
"qbehaviour_adaptive_mark_details",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/behaviour/adaptive/behaviour.php#L263-L277 |
216,925 | moodle/moodle | lib/filebrowser/file_info.php | file_info.get_params_rawencoded | public function get_params_rawencoded() {
$params = $this->get_params();
$encoded = array();
$encoded[] = 'contextid=' . $params['contextid'];
$encoded[] = 'component=' . $params['component'];
$encoded[] = 'filearea=' . $params['filearea'];
$encoded[] = 'itemid=' . (is_nu... | php | public function get_params_rawencoded() {
$params = $this->get_params();
$encoded = array();
$encoded[] = 'contextid=' . $params['contextid'];
$encoded[] = 'component=' . $params['component'];
$encoded[] = 'filearea=' . $params['filearea'];
$encoded[] = 'itemid=' . (is_nu... | [
"public",
"function",
"get_params_rawencoded",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"get_params",
"(",
")",
";",
"$",
"encoded",
"=",
"array",
"(",
")",
";",
"$",
"encoded",
"[",
"]",
"=",
"'contextid='",
".",
"$",
"params",
"[",
"'c... | Returns array of url encoded params.
@return array with numeric keys | [
"Returns",
"array",
"of",
"url",
"encoded",
"params",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filebrowser/file_info.php#L213-L224 |
216,926 | moodle/moodle | lib/htmlpurifier/HTMLPurifier/Bootstrap.php | HTMLPurifier_Bootstrap.getPath | public static function getPath($class)
{
if (strncmp('HTMLPurifier', $class, 12) !== 0) {
return false;
}
// Custom implementations
if (strncmp('HTMLPurifier_Language_', $class, 22) === 0) {
$code = str_replace('_', '-', substr($class, 22));
$file ... | php | public static function getPath($class)
{
if (strncmp('HTMLPurifier', $class, 12) !== 0) {
return false;
}
// Custom implementations
if (strncmp('HTMLPurifier_Language_', $class, 22) === 0) {
$code = str_replace('_', '-', substr($class, 22));
$file ... | [
"public",
"static",
"function",
"getPath",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"strncmp",
"(",
"'HTMLPurifier'",
",",
"$",
"class",
",",
"12",
")",
"!==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"// Custom implementations",
"if",
"(",
"strncmp",
... | Returns the path for a specific class.
@param string $class Class path to get
@return string | [
"Returns",
"the",
"path",
"for",
"a",
"specific",
"class",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/Bootstrap.php#L58-L74 |
216,927 | moodle/moodle | lib/pear/HTML/QuickForm/autocomplete.php | HTML_QuickForm_autocomplete.toHtml | function toHtml()
{
// prevent problems with grouped elements
$arrayName = str_replace(array('[', ']'), array('__', ''), $this->getName()) . '_values';
$this->updateAttributes(array(
'onkeypress' => 'return autocomplete(this, event, ' . $arrayName . ');'
));
if (... | php | function toHtml()
{
// prevent problems with grouped elements
$arrayName = str_replace(array('[', ']'), array('__', ''), $this->getName()) . '_values';
$this->updateAttributes(array(
'onkeypress' => 'return autocomplete(this, event, ' . $arrayName . ');'
));
if (... | [
"function",
"toHtml",
"(",
")",
"{",
"// prevent problems with grouped elements",
"$",
"arrayName",
"=",
"str_replace",
"(",
"array",
"(",
"'['",
",",
"']'",
")",
",",
"array",
"(",
"'__'",
",",
"''",
")",
",",
"$",
"this",
"->",
"getName",
"(",
")",
")"... | Returns Html for the autocomplete input text element
@access public
@return string | [
"Returns",
"Html",
"for",
"the",
"autocomplete",
"input",
"text",
"element"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/pear/HTML/QuickForm/autocomplete.php#L121-L254 |
216,928 | moodle/moodle | grade/grading/classes/privacy/gradingform_legacy_polyfill.php | gradingform_legacy_polyfill.get_gradingform_export_data | public static function get_gradingform_export_data(\context $context, $definition, int $userid) {
debugging('This method is deprecated. Please use the gradingform_provider_v2 interface', DEBUG_DEVELOPER);
return static::_get_gradingform_export_data($context, $definition, $userid);
} | php | public static function get_gradingform_export_data(\context $context, $definition, int $userid) {
debugging('This method is deprecated. Please use the gradingform_provider_v2 interface', DEBUG_DEVELOPER);
return static::_get_gradingform_export_data($context, $definition, $userid);
} | [
"public",
"static",
"function",
"get_gradingform_export_data",
"(",
"\\",
"context",
"$",
"context",
",",
"$",
"definition",
",",
"int",
"$",
"userid",
")",
"{",
"debugging",
"(",
"'This method is deprecated. Please use the gradingform_provider_v2 interface'",
",",
"DEBUG... | This method is used to export any user data this sub-plugin has using the object to get the context and userid.
@deprecated Since Moodle 3.6 MDL-62535 Please use the methods in the gradingform_provider_v2 interface.
@todo MDL-63167 remove this method.
@param context $context Context owner of the data.
@param stdClass... | [
"This",
"method",
"is",
"used",
"to",
"export",
"any",
"user",
"data",
"this",
"sub",
"-",
"plugin",
"has",
"using",
"the",
"object",
"to",
"get",
"the",
"context",
"and",
"userid",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/grading/classes/privacy/gradingform_legacy_polyfill.php#L69-L72 |
216,929 | moodle/moodle | mod/assign/submission/file/backup/moodle2/restore_assignsubmission_file_subplugin.class.php | restore_assignsubmission_file_subplugin.process_assignsubmission_file_submission | public function process_assignsubmission_file_submission($data) {
global $DB;
$data = (object)$data;
$data->assignment = $this->get_new_parentid('assign');
$oldsubmissionid = $data->submission;
// The mapping is set in the restore for the core assign activity
// when a s... | php | public function process_assignsubmission_file_submission($data) {
global $DB;
$data = (object)$data;
$data->assignment = $this->get_new_parentid('assign');
$oldsubmissionid = $data->submission;
// The mapping is set in the restore for the core assign activity
// when a s... | [
"public",
"function",
"process_assignsubmission_file_submission",
"(",
"$",
"data",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"data",
"=",
"(",
"object",
")",
"$",
"data",
";",
"$",
"data",
"->",
"assignment",
"=",
"$",
"this",
"->",
"get_new_parentid",
"("... | Processes one submission_file element
@param mixed $data
@return void | [
"Processes",
"one",
"submission_file",
"element"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/submission/file/backup/moodle2/restore_assignsubmission_file_subplugin.class.php#L58-L75 |
216,930 | moodle/moodle | admin/tool/task/classes/run_from_cli.php | run_from_cli.find_php_cli_path | protected static function find_php_cli_path() {
global $CFG;
if (!empty($CFG->pathtophp) && is_executable(trim($CFG->pathtophp))) {
return $CFG->pathtophp;
}
return false;
} | php | protected static function find_php_cli_path() {
global $CFG;
if (!empty($CFG->pathtophp) && is_executable(trim($CFG->pathtophp))) {
return $CFG->pathtophp;
}
return false;
} | [
"protected",
"static",
"function",
"find_php_cli_path",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"CFG",
"->",
"pathtophp",
")",
"&&",
"is_executable",
"(",
"trim",
"(",
"$",
"CFG",
"->",
"pathtophp",
")",
")",
")",
... | Find the path of PHP CLI binary.
@return string|false The PHP CLI executable PATH | [
"Find",
"the",
"path",
"of",
"PHP",
"CLI",
"binary",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/task/classes/run_from_cli.php#L42-L50 |
216,931 | moodle/moodle | admin/tool/task/classes/run_from_cli.php | run_from_cli.execute | public static function execute(\core\task\task_base $task):bool {
global $CFG;
if (!self::is_runnable()) {
$redirecturl = new \moodle_url('/admin/settings.php', ['section' => 'systempaths']);
throw new \moodle_exception('cannotfindthepathtothecli', 'tool_task', $redirecturl->out... | php | public static function execute(\core\task\task_base $task):bool {
global $CFG;
if (!self::is_runnable()) {
$redirecturl = new \moodle_url('/admin/settings.php', ['section' => 'systempaths']);
throw new \moodle_exception('cannotfindthepathtothecli', 'tool_task', $redirecturl->out... | [
"public",
"static",
"function",
"execute",
"(",
"\\",
"core",
"\\",
"task",
"\\",
"task_base",
"$",
"task",
")",
":",
"bool",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"!",
"self",
"::",
"is_runnable",
"(",
")",
")",
"{",
"$",
"redirecturl",
"=",
... | Executes a cron from web invocation using PHP CLI.
@param \core\task\task_base $task Task that be executed via CLI.
@return bool
@throws \moodle_exception | [
"Executes",
"a",
"cron",
"from",
"web",
"invocation",
"using",
"PHP",
"CLI",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/task/classes/run_from_cli.php#L68-L94 |
216,932 | moodle/moodle | lib/phpexcel/PHPExcel/Shared/ZipArchive.php | PHPExcel_Shared_ZipArchive.addFromString | public function addFromString($localname, $contents)
{
$filenameParts = pathinfo($localname);
$handle = fopen($this->tempDir.'/'.$filenameParts["basename"], "wb");
fwrite($handle, $contents);
fclose($handle);
$res = $this->zip->add($this->tempDir.'/'.$filenameParts["basenam... | php | public function addFromString($localname, $contents)
{
$filenameParts = pathinfo($localname);
$handle = fopen($this->tempDir.'/'.$filenameParts["basename"], "wb");
fwrite($handle, $contents);
fclose($handle);
$res = $this->zip->add($this->tempDir.'/'.$filenameParts["basenam... | [
"public",
"function",
"addFromString",
"(",
"$",
"localname",
",",
"$",
"contents",
")",
"{",
"$",
"filenameParts",
"=",
"pathinfo",
"(",
"$",
"localname",
")",
";",
"$",
"handle",
"=",
"fopen",
"(",
"$",
"this",
"->",
"tempDir",
".",
"'/'",
".",
"$",
... | Add a new file to the zip archive from a string of raw data.
@param string $localname Directory/Name of the file to add to the zip archive
@param string $contents String of data to add to the zip archive | [
"Add",
"a",
"new",
"file",
"to",
"the",
"zip",
"archive",
"from",
"a",
"string",
"of",
"raw",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Shared/ZipArchive.php#L86-L100 |
216,933 | moodle/moodle | lib/filestorage/zip_archive.php | zip_archive.close | public function close() {
if (!isset($this->za)) {
return false;
}
if ($this->emptyziphack) {
@$this->za->close();
$this->za = null;
$this->mode = null;
$this->namelookup = null;
$this->modified = false;
@unlink... | php | public function close() {
if (!isset($this->za)) {
return false;
}
if ($this->emptyziphack) {
@$this->za->close();
$this->za = null;
$this->mode = null;
$this->namelookup = null;
$this->modified = false;
@unlink... | [
"public",
"function",
"close",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"za",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"emptyziphack",
")",
"{",
"@",
"$",
"this",
"->",
"za",
"->",
"close"... | Close archive, write changes to disk.
@return bool success | [
"Close",
"archive",
"write",
"changes",
"to",
"disk",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/zip_archive.php#L188-L235 |
216,934 | moodle/moodle | lib/filestorage/zip_archive.php | zip_archive.get_stream | public function get_stream($index) {
if (!isset($this->za)) {
return false;
}
$name = $this->za->getNameIndex($index);
if ($name === false) {
return false;
}
return $this->za->getStream($name);
} | php | public function get_stream($index) {
if (!isset($this->za)) {
return false;
}
$name = $this->za->getNameIndex($index);
if ($name === false) {
return false;
}
return $this->za->getStream($name);
} | [
"public",
"function",
"get_stream",
"(",
"$",
"index",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"za",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"name",
"=",
"$",
"this",
"->",
"za",
"->",
"getNameIndex",
"(",
"$",
"index"... | Returns file stream for reading of content.
@param int $index index of file
@return resource|bool file handle or false if error | [
"Returns",
"file",
"stream",
"for",
"reading",
"of",
"content",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/zip_archive.php#L243-L254 |
216,935 | moodle/moodle | lib/filestorage/zip_archive.php | zip_archive.get_info | public function get_info($index) {
if (!isset($this->za)) {
return false;
}
// Need to use the ZipArchive's numfiles, as $this->count() relies on this function to count actual files (skipping OSX junk).
if ($index < 0 or $index >=$this->za->numFiles) {
return fal... | php | public function get_info($index) {
if (!isset($this->za)) {
return false;
}
// Need to use the ZipArchive's numfiles, as $this->count() relies on this function to count actual files (skipping OSX junk).
if ($index < 0 or $index >=$this->za->numFiles) {
return fal... | [
"public",
"function",
"get_info",
"(",
"$",
"index",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"za",
")",
")",
"{",
"return",
"false",
";",
"}",
"// Need to use the ZipArchive's numfiles, as $this->count() relies on this function to count actual files... | Returns file information.
@param int $index index of file
@return stdClass|bool info object or false if error | [
"Returns",
"file",
"information",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/zip_archive.php#L262-L300 |
216,936 | moodle/moodle | lib/filestorage/zip_archive.php | zip_archive.add_file_from_pathname | public function add_file_from_pathname($localname, $pathname) {
if ($this->emptyziphack) {
$this->close();
$this->open($this->archivepathname, file_archive::OVERWRITE, $this->encoding);
}
if (!isset($this->za)) {
return false;
}
if ($this->ar... | php | public function add_file_from_pathname($localname, $pathname) {
if ($this->emptyziphack) {
$this->close();
$this->open($this->archivepathname, file_archive::OVERWRITE, $this->encoding);
}
if (!isset($this->za)) {
return false;
}
if ($this->ar... | [
"public",
"function",
"add_file_from_pathname",
"(",
"$",
"localname",
",",
"$",
"pathname",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"emptyziphack",
")",
"{",
"$",
"this",
"->",
"close",
"(",
")",
";",
"$",
"this",
"->",
"open",
"(",
"$",
"this",
"->... | Add file into archive.
@param string $localname name of file in archive
@param string $pathname location of file
@return bool success | [
"Add",
"file",
"into",
"archive",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/zip_archive.php#L373-L408 |
216,937 | moodle/moodle | lib/filestorage/zip_archive.php | zip_archive.add_file_from_string | public function add_file_from_string($localname, $contents) {
if ($this->emptyziphack) {
$this->close();
$this->open($this->archivepathname, file_archive::OVERWRITE, $this->encoding);
}
if (!isset($this->za)) {
return false;
}
$localname = tr... | php | public function add_file_from_string($localname, $contents) {
if ($this->emptyziphack) {
$this->close();
$this->open($this->archivepathname, file_archive::OVERWRITE, $this->encoding);
}
if (!isset($this->za)) {
return false;
}
$localname = tr... | [
"public",
"function",
"add_file_from_string",
"(",
"$",
"localname",
",",
"$",
"contents",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"emptyziphack",
")",
"{",
"$",
"this",
"->",
"close",
"(",
")",
";",
"$",
"this",
"->",
"open",
"(",
"$",
"this",
"->",... | Add content of string into archive.
@param string $localname name of file in archive
@param string $contents contents
@return bool success | [
"Add",
"content",
"of",
"string",
"into",
"archive",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/zip_archive.php#L417-L450 |
216,938 | moodle/moodle | lib/filestorage/zip_archive.php | zip_archive.add_directory | public function add_directory($localname) {
if ($this->emptyziphack) {
$this->close();
$this->open($this->archivepathname, file_archive::OVERWRITE, $this->encoding);
}
if (!isset($this->za)) {
return false;
}
$localname = trim($localname, '/')... | php | public function add_directory($localname) {
if ($this->emptyziphack) {
$this->close();
$this->open($this->archivepathname, file_archive::OVERWRITE, $this->encoding);
}
if (!isset($this->za)) {
return false;
}
$localname = trim($localname, '/')... | [
"public",
"function",
"add_directory",
"(",
"$",
"localname",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"emptyziphack",
")",
"{",
"$",
"this",
"->",
"close",
"(",
")",
";",
"$",
"this",
"->",
"open",
"(",
"$",
"this",
"->",
"archivepathname",
",",
"fil... | Add empty directory into archive.
@param string $localname name of file in archive
@return bool success | [
"Add",
"empty",
"directory",
"into",
"archive",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/zip_archive.php#L458-L482 |
216,939 | moodle/moodle | lib/filestorage/zip_archive.php | zip_archive.valid | public function valid() {
if (!isset($this->za)) {
return false;
}
// Skip over unwanted system files (get_info will return false).
while (!$this->get_info($this->pos) && $this->pos < $this->za->numFiles) {
$this->next();
}
// No files left - we'... | php | public function valid() {
if (!isset($this->za)) {
return false;
}
// Skip over unwanted system files (get_info will return false).
while (!$this->get_info($this->pos) && $this->pos < $this->za->numFiles) {
$this->next();
}
// No files left - we'... | [
"public",
"function",
"valid",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"za",
")",
")",
"{",
"return",
"false",
";",
"}",
"// Skip over unwanted system files (get_info will return false).",
"while",
"(",
"!",
"$",
"this",
"->",
"get_in... | Did we reach the end?
@return bool | [
"Did",
"we",
"reach",
"the",
"end?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/zip_archive.php#L525-L541 |
216,940 | moodle/moodle | lib/filestorage/zip_archive.php | zip_archive.zip_get_central_end | public static function zip_get_central_end($fp, $filesize) {
// Find end of central directory record.
fseek($fp, $filesize - 22);
$info = unpack('Vsig', fread($fp, 4));
if ($info['sig'] === 0x06054b50) {
// There is no comment.
fseek($fp, $filesize - 22);
... | php | public static function zip_get_central_end($fp, $filesize) {
// Find end of central directory record.
fseek($fp, $filesize - 22);
$info = unpack('Vsig', fread($fp, 4));
if ($info['sig'] === 0x06054b50) {
// There is no comment.
fseek($fp, $filesize - 22);
... | [
"public",
"static",
"function",
"zip_get_central_end",
"(",
"$",
"fp",
",",
"$",
"filesize",
")",
"{",
"// Find end of central directory record.",
"fseek",
"(",
"$",
"fp",
",",
"$",
"filesize",
"-",
"22",
")",
";",
"$",
"info",
"=",
"unpack",
"(",
"'Vsig'",
... | Read end of central signature of ZIP file.
@internal
@static
@param resource $fp
@param int $filesize
@return array|bool | [
"Read",
"end",
"of",
"central",
"signature",
"of",
"ZIP",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/zip_archive.php#L800-L827 |
216,941 | moodle/moodle | lib/filestorage/zip_archive.php | zip_archive.zip_parse_file_header | public static function zip_parse_file_header($data, $centralend, &$pos) {
$file = unpack('Vsig/vversion/vversion_req/vgeneral/vmethod/Vmodified/Vcrc/Vsize_compressed/Vsize/vname_length/vextra_length/vcomment_length/vdisk/vattr/Vattrext/Vlocal_offset', substr($data, $pos, 46));
$file['central_offset'] = ... | php | public static function zip_parse_file_header($data, $centralend, &$pos) {
$file = unpack('Vsig/vversion/vversion_req/vgeneral/vmethod/Vmodified/Vcrc/Vsize_compressed/Vsize/vname_length/vextra_length/vcomment_length/vdisk/vattr/Vattrext/Vlocal_offset', substr($data, $pos, 46));
$file['central_offset'] = ... | [
"public",
"static",
"function",
"zip_parse_file_header",
"(",
"$",
"data",
",",
"$",
"centralend",
",",
"&",
"$",
"pos",
")",
"{",
"$",
"file",
"=",
"unpack",
"(",
"'Vsig/vversion/vversion_req/vgeneral/vmethod/Vmodified/Vcrc/Vsize_compressed/Vsize/vname_length/vextra_length... | Parse file header.
@internal
@param string $data
@param array $centralend
@param int $pos (modified)
@return array|bool file info | [
"Parse",
"file",
"header",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/zip_archive.php#L837-L867 |
216,942 | moodle/moodle | lib/google/src/Google/Auth/AppIdentity.php | Google_Auth_AppIdentity.authenticateForScope | public function authenticateForScope($scopes)
{
if ($this->token && $this->tokenScopes == $scopes) {
return $this->token;
}
$cacheKey = self::CACHE_PREFIX;
if (is_string($scopes)) {
$cacheKey .= $scopes;
} else if (is_array($scopes)) {
$cacheKey .= implode(":", $scopes);
}
... | php | public function authenticateForScope($scopes)
{
if ($this->token && $this->tokenScopes == $scopes) {
return $this->token;
}
$cacheKey = self::CACHE_PREFIX;
if (is_string($scopes)) {
$cacheKey .= $scopes;
} else if (is_array($scopes)) {
$cacheKey .= implode(":", $scopes);
}
... | [
"public",
"function",
"authenticateForScope",
"(",
"$",
"scopes",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"token",
"&&",
"$",
"this",
"->",
"tokenScopes",
"==",
"$",
"scopes",
")",
"{",
"return",
"$",
"this",
"->",
"token",
";",
"}",
"$",
"cacheKey",
... | Retrieve an access token for the scopes supplied. | [
"Retrieve",
"an",
"access",
"token",
"for",
"the",
"scopes",
"supplied",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/google/src/Google/Auth/AppIdentity.php#L47-L70 |
216,943 | moodle/moodle | lib/google/src/Google/Auth/AppIdentity.php | Google_Auth_AppIdentity.retrieveToken | private function retrieveToken($scopes, $cacheKey)
{
$this->token = AppIdentityService::getAccessToken($scopes);
if ($this->token) {
$this->client->getCache()->set(
$cacheKey,
$this->token
);
}
} | php | private function retrieveToken($scopes, $cacheKey)
{
$this->token = AppIdentityService::getAccessToken($scopes);
if ($this->token) {
$this->client->getCache()->set(
$cacheKey,
$this->token
);
}
} | [
"private",
"function",
"retrieveToken",
"(",
"$",
"scopes",
",",
"$",
"cacheKey",
")",
"{",
"$",
"this",
"->",
"token",
"=",
"AppIdentityService",
"::",
"getAccessToken",
"(",
"$",
"scopes",
")",
";",
"if",
"(",
"$",
"this",
"->",
"token",
")",
"{",
"$... | Retrieve a new access token and store it in cache
@param mixed $scopes
@param string $cacheKey | [
"Retrieve",
"a",
"new",
"access",
"token",
"and",
"store",
"it",
"in",
"cache"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/google/src/Google/Auth/AppIdentity.php#L77-L86 |
216,944 | moodle/moodle | lib/form/url.php | MoodleQuickForm_url.get_filepicker_unique_id | protected function get_filepicker_unique_id() : string {
if (empty($this->filepickeruniqueid)) {
$this->filepickeruniqueid = uniqid();
}
return $this->filepickeruniqueid;
} | php | protected function get_filepicker_unique_id() : string {
if (empty($this->filepickeruniqueid)) {
$this->filepickeruniqueid = uniqid();
}
return $this->filepickeruniqueid;
} | [
"protected",
"function",
"get_filepicker_unique_id",
"(",
")",
":",
"string",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"filepickeruniqueid",
")",
")",
"{",
"$",
"this",
"->",
"filepickeruniqueid",
"=",
"uniqid",
"(",
")",
";",
"}",
"return",
"$",
... | Returns the unique id of the file picker associated with this url element, setting it in the process if not set.
@return string the unique id of the file picker. | [
"Returns",
"the",
"unique",
"id",
"of",
"the",
"file",
"picker",
"associated",
"with",
"this",
"url",
"element",
"setting",
"it",
"in",
"the",
"process",
"if",
"not",
"set",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/url.php#L217-L222 |
216,945 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Ids.php | Horde_Imap_Client_Ids.add | public function add($ids)
{
if (!is_null($ids)) {
if (is_string($ids) &&
in_array($ids, array(self::ALL, self::SEARCH_RES, self::LARGEST))) {
$this->_ids = $ids;
} elseif ($add = $this->_resolveIds($ids)) {
if (is_array($this->_ids) && ... | php | public function add($ids)
{
if (!is_null($ids)) {
if (is_string($ids) &&
in_array($ids, array(self::ALL, self::SEARCH_RES, self::LARGEST))) {
$this->_ids = $ids;
} elseif ($add = $this->_resolveIds($ids)) {
if (is_array($this->_ids) && ... | [
"public",
"function",
"add",
"(",
"$",
"ids",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"ids",
")",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"ids",
")",
"&&",
"in_array",
"(",
"$",
"ids",
",",
"array",
"(",
"self",
"::",
"ALL",
",",
"... | Add IDs to the current object.
@param mixed $ids Either self::ALL, self::SEARCH_RES, self::LARGEST,
Horde_Imap_Client_Ids object, array, or sequence
string. | [
"Add",
"IDs",
"to",
"the",
"current",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Ids.php#L162-L185 |
216,946 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Ids.php | Horde_Imap_Client_Ids.remove | public function remove($ids)
{
if (!$this->isEmpty() &&
($remove = $this->_resolveIds($ids))) {
$this->_ids = array_diff($this->_ids, array_unique($remove));
}
} | php | public function remove($ids)
{
if (!$this->isEmpty() &&
($remove = $this->_resolveIds($ids))) {
$this->_ids = array_diff($this->_ids, array_unique($remove));
}
} | [
"public",
"function",
"remove",
"(",
"$",
"ids",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isEmpty",
"(",
")",
"&&",
"(",
"$",
"remove",
"=",
"$",
"this",
"->",
"_resolveIds",
"(",
"$",
"ids",
")",
")",
")",
"{",
"$",
"this",
"->",
"_ids",
... | Removed IDs from the current object.
@since 2.17.0
@param mixed $ids Either Horde_Imap_Client_Ids object, array, or
sequence string. | [
"Removed",
"IDs",
"from",
"the",
"current",
"object",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Ids.php#L195-L201 |
216,947 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Ids.php | Horde_Imap_Client_Ids.sort | public function sort()
{
if (!$this->_sorted && is_array($this->_ids)) {
$this->_sort($this->_ids);
$this->_sorted = true;
}
} | php | public function sort()
{
if (!$this->_sorted && is_array($this->_ids)) {
$this->_sort($this->_ids);
$this->_sorted = true;
}
} | [
"public",
"function",
"sort",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_sorted",
"&&",
"is_array",
"(",
"$",
"this",
"->",
"_ids",
")",
")",
"{",
"$",
"this",
"->",
"_sort",
"(",
"$",
"this",
"->",
"_ids",
")",
";",
"$",
"this",
"->",... | Sorts the IDs. | [
"Sorts",
"the",
"IDs",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Ids.php#L226-L232 |
216,948 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Ids.php | Horde_Imap_Client_Ids.split | public function split($length)
{
$id = new Horde_Stream_Temp();
$id->add($this->tostring_sort, true);
$out = array();
do {
$out[] = $id->substring(0, $length) . $id->getToChar(',');
} while (!$id->eof());
return $out;
} | php | public function split($length)
{
$id = new Horde_Stream_Temp();
$id->add($this->tostring_sort, true);
$out = array();
do {
$out[] = $id->substring(0, $length) . $id->getToChar(',');
} while (!$id->eof());
return $out;
} | [
"public",
"function",
"split",
"(",
"$",
"length",
")",
"{",
"$",
"id",
"=",
"new",
"Horde_Stream_Temp",
"(",
")",
";",
"$",
"id",
"->",
"add",
"(",
"$",
"this",
"->",
"tostring_sort",
",",
"true",
")",
";",
"$",
"out",
"=",
"array",
"(",
")",
";... | Split the sequence string at an approximate length.
@since 2.7.0
@param integer $length Length to split.
@return array A list containing individual sequence strings. | [
"Split",
"the",
"sequence",
"string",
"at",
"an",
"approximate",
"length",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Ids.php#L253-L265 |
216,949 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Ids.php | Horde_Imap_Client_Ids._toSequenceString | protected function _toSequenceString($sort = true)
{
if (empty($this->_ids)) {
return '';
}
$in = $this->_ids;
if ($sort && !$this->_sorted) {
$this->_sort($in);
}
$first = $last = array_shift($in);
$i = count($in) - 1;
$out ... | php | protected function _toSequenceString($sort = true)
{
if (empty($this->_ids)) {
return '';
}
$in = $this->_ids;
if ($sort && !$this->_sorted) {
$this->_sort($in);
}
$first = $last = array_shift($in);
$i = count($in) - 1;
$out ... | [
"protected",
"function",
"_toSequenceString",
"(",
"$",
"sort",
"=",
"true",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_ids",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"in",
"=",
"$",
"this",
"->",
"_ids",
";",
"if",
"(",
"$",
... | Create an IMAP message sequence string from a list of indices.
Index Format: range_start:range_end,uid,uid2,...
@param boolean $sort Numerically sort the IDs before creating the
range?
@return string The IMAP message sequence string. | [
"Create",
"an",
"IMAP",
"message",
"sequence",
"string",
"from",
"a",
"list",
"of",
"indices",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Ids.php#L300-L340 |
216,950 | moodle/moodle | lib/horde/framework/Horde/Imap/Client/Ids.php | Horde_Imap_Client_Ids._fromSequenceString | protected function _fromSequenceString($str)
{
$ids = array();
$str = trim($str);
if (!strlen($str)) {
return $ids;
}
$idarray = explode(',', $str);
foreach ($idarray as $val) {
$range = explode(':', $val);
if (isset($range[1])) ... | php | protected function _fromSequenceString($str)
{
$ids = array();
$str = trim($str);
if (!strlen($str)) {
return $ids;
}
$idarray = explode(',', $str);
foreach ($idarray as $val) {
$range = explode(':', $val);
if (isset($range[1])) ... | [
"protected",
"function",
"_fromSequenceString",
"(",
"$",
"str",
")",
"{",
"$",
"ids",
"=",
"array",
"(",
")",
";",
"$",
"str",
"=",
"trim",
"(",
"$",
"str",
")",
";",
"if",
"(",
"!",
"strlen",
"(",
"$",
"str",
")",
")",
"{",
"return",
"$",
"id... | Parse an IMAP message sequence string into a list of indices.
@see _toSequenceString()
@param string $str The IMAP message sequence string.
@return array An array of indices. | [
"Parse",
"an",
"IMAP",
"message",
"sequence",
"string",
"into",
"a",
"list",
"of",
"indices",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Imap/Client/Ids.php#L351-L374 |
216,951 | moodle/moodle | enrol/editinstance_form.php | enrol_instance_edit_form.validation | public function validation($data, $files) {
$errors = parent::validation($data, $files);
list($instance, $plugin, $context, $type) = $this->_customdata;
$pluginerrors = $plugin->edit_instance_validation($data, $files, $instance, $context);
$errors = array_merge($errors, $pluginerrors)... | php | public function validation($data, $files) {
$errors = parent::validation($data, $files);
list($instance, $plugin, $context, $type) = $this->_customdata;
$pluginerrors = $plugin->edit_instance_validation($data, $files, $instance, $context);
$errors = array_merge($errors, $pluginerrors)... | [
"public",
"function",
"validation",
"(",
"$",
"data",
",",
"$",
"files",
")",
"{",
"$",
"errors",
"=",
"parent",
"::",
"validation",
"(",
"$",
"data",
",",
"$",
"files",
")",
";",
"list",
"(",
"$",
"instance",
",",
"$",
"plugin",
",",
"$",
"context... | Validate this form. Calls plugin validation method.
@param array $data
@param array $files
@return array | [
"Validate",
"this",
"form",
".",
"Calls",
"plugin",
"validation",
"method",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/editinstance_form.php#L79-L89 |
216,952 | moodle/moodle | user/editadvanced_form.php | user_editadvanced_form.definition_after_data | public function definition_after_data() {
global $USER, $CFG, $DB, $OUTPUT;
$mform = $this->_form;
// Trim required name fields.
foreach (useredit_get_required_name_fields() as $field) {
$mform->applyFilter($field, 'trim');
}
if ($userid = $mform->getElemen... | php | public function definition_after_data() {
global $USER, $CFG, $DB, $OUTPUT;
$mform = $this->_form;
// Trim required name fields.
foreach (useredit_get_required_name_fields() as $field) {
$mform->applyFilter($field, 'trim');
}
if ($userid = $mform->getElemen... | [
"public",
"function",
"definition_after_data",
"(",
")",
"{",
"global",
"$",
"USER",
",",
"$",
"CFG",
",",
"$",
"DB",
",",
"$",
"OUTPUT",
";",
"$",
"mform",
"=",
"$",
"this",
"->",
"_form",
";",
"// Trim required name fields.",
"foreach",
"(",
"useredit_ge... | Extend the form definition after data has been parsed. | [
"Extend",
"the",
"form",
"definition",
"after",
"data",
"has",
"been",
"parsed",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/editadvanced_form.php#L169-L243 |
216,953 | moodle/moodle | lib/phpexcel/PHPExcel/Worksheet/PageSetup.php | PHPExcel_Worksheet_PageSetup.setPrintAreaByColumnAndRow | public function setPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE)
{
return $this->setPrintArea(
PHPExcel_Cell::stringFromColumnIndex($column1) . $row1 . ':' . PHPExcel_Cell::stringFromColumnIndex($column2) . $row2,
$inde... | php | public function setPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE)
{
return $this->setPrintArea(
PHPExcel_Cell::stringFromColumnIndex($column1) . $row1 . ':' . PHPExcel_Cell::stringFromColumnIndex($column2) . $row2,
$inde... | [
"public",
"function",
"setPrintAreaByColumnAndRow",
"(",
"$",
"column1",
",",
"$",
"row1",
",",
"$",
"column2",
",",
"$",
"row2",
",",
"$",
"index",
"=",
"0",
",",
"$",
"method",
"=",
"self",
"::",
"SETPRINTRANGE_OVERWRITE",
")",
"{",
"return",
"$",
"thi... | Set print area
@param int $column1 Column 1
@param int $row1 Row 1
@param int $column2 Column 2
@param int $row2 Row 2
@param int $index Identifier for a specific print area range allowing several ranges to be set
When the method is "O"verwri... | [
"Set",
"print",
"area"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Worksheet/PageSetup.php#L759-L766 |
216,954 | moodle/moodle | mod/data/lib.php | data_field_base.define_default_field | function define_default_field() {
global $OUTPUT;
if (empty($this->data->id)) {
echo $OUTPUT->notification('Programmer error: dataid not defined in field class');
}
$this->field = new stdClass();
$this->field->id = 0;
$this->field->dataid = $this->data->id;
... | php | function define_default_field() {
global $OUTPUT;
if (empty($this->data->id)) {
echo $OUTPUT->notification('Programmer error: dataid not defined in field class');
}
$this->field = new stdClass();
$this->field->id = 0;
$this->field->dataid = $this->data->id;
... | [
"function",
"define_default_field",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"data",
"->",
"id",
")",
")",
"{",
"echo",
"$",
"OUTPUT",
"->",
"notification",
"(",
"'Programmer error: dataid not defined in field cl... | This field just sets up a default field object
@return bool | [
"This",
"field",
"just",
"sets",
"up",
"a",
"default",
"field",
"object"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/lib.php#L144-L161 |
216,955 | moodle/moodle | mod/data/lib.php | data_field_base.define_field | function define_field($data) {
$this->field->type = $this->type;
$this->field->dataid = $this->data->id;
$this->field->name = trim($data->name);
$this->field->description = trim($data->description);
$this->field->required = !empty($data->required) ? 1 : 0;
... | php | function define_field($data) {
$this->field->type = $this->type;
$this->field->dataid = $this->data->id;
$this->field->name = trim($data->name);
$this->field->description = trim($data->description);
$this->field->required = !empty($data->required) ? 1 : 0;
... | [
"function",
"define_field",
"(",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"field",
"->",
"type",
"=",
"$",
"this",
"->",
"type",
";",
"$",
"this",
"->",
"field",
"->",
"dataid",
"=",
"$",
"this",
"->",
"data",
"->",
"id",
";",
"$",
"this",
"->",... | Set up the field object according to data in an object. Now is the time to clean it!
@return bool | [
"Set",
"up",
"the",
"field",
"object",
"according",
"to",
"data",
"in",
"an",
"object",
".",
"Now",
"is",
"the",
"time",
"to",
"clean",
"it!"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/lib.php#L168-L193 |
216,956 | moodle/moodle | mod/data/lib.php | data_field_base.update_field | function update_field() {
global $DB;
$DB->update_record('data_fields', $this->field);
// Trigger an event for updating this field.
$event = \mod_data\event\field_updated::create(array(
'objectid' => $this->field->id,
'context' => $this->context,
'ot... | php | function update_field() {
global $DB;
$DB->update_record('data_fields', $this->field);
// Trigger an event for updating this field.
$event = \mod_data\event\field_updated::create(array(
'objectid' => $this->field->id,
'context' => $this->context,
'ot... | [
"function",
"update_field",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"DB",
"->",
"update_record",
"(",
"'data_fields'",
",",
"$",
"this",
"->",
"field",
")",
";",
"// Trigger an event for updating this field.",
"$",
"event",
"=",
"\\",
"mod_data",
"\\",
... | Update a field in the database
@global object
@return bool | [
"Update",
"a",
"field",
"in",
"the",
"database"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/lib.php#L233-L250 |
216,957 | moodle/moodle | mod/data/lib.php | data_field_base.delete_field | function delete_field() {
global $DB;
if (!empty($this->field->id)) {
// Get the field before we delete it.
$field = $DB->get_record('data_fields', array('id' => $this->field->id));
$this->delete_content();
$DB->delete_records('data_fields', array('id'=>... | php | function delete_field() {
global $DB;
if (!empty($this->field->id)) {
// Get the field before we delete it.
$field = $DB->get_record('data_fields', array('id' => $this->field->id));
$this->delete_content();
$DB->delete_records('data_fields', array('id'=>... | [
"function",
"delete_field",
"(",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"field",
"->",
"id",
")",
")",
"{",
"// Get the field before we delete it.",
"$",
"field",
"=",
"$",
"DB",
"->",
"get_record",
"(",
"'... | Delete a field completely
@global object
@return bool | [
"Delete",
"a",
"field",
"completely"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/lib.php#L258-L282 |
216,958 | moodle/moodle | mod/data/lib.php | data_field_base.display_add_field | function display_add_field($recordid=0, $formdata=null) {
global $DB, $OUTPUT;
if ($formdata) {
$fieldname = 'field_' . $this->field->id;
$content = $formdata->$fieldname;
} else if ($recordid) {
$content = $DB->get_field('data_content', 'content', array('fie... | php | function display_add_field($recordid=0, $formdata=null) {
global $DB, $OUTPUT;
if ($formdata) {
$fieldname = 'field_' . $this->field->id;
$content = $formdata->$fieldname;
} else if ($recordid) {
$content = $DB->get_field('data_content', 'content', array('fie... | [
"function",
"display_add_field",
"(",
"$",
"recordid",
"=",
"0",
",",
"$",
"formdata",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"OUTPUT",
";",
"if",
"(",
"$",
"formdata",
")",
"{",
"$",
"fieldname",
"=",
"'field_'",
".",
"$",
"this",
"... | Print the relevant form element in the ADD template for this field
@global object
@param int $recordid
@return string | [
"Print",
"the",
"relevant",
"form",
"element",
"in",
"the",
"ADD",
"template",
"for",
"this",
"field"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/lib.php#L291-L320 |
216,959 | moodle/moodle | mod/data/lib.php | data_field_base.display_edit_field | function display_edit_field() {
global $CFG, $DB, $OUTPUT;
if (empty($this->field)) { // No field has been defined yet, try and make one
$this->define_default_field();
}
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide');
echo '<form id="editfield" ... | php | function display_edit_field() {
global $CFG, $DB, $OUTPUT;
if (empty($this->field)) { // No field has been defined yet, try and make one
$this->define_default_field();
}
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide');
echo '<form id="editfield" ... | [
"function",
"display_edit_field",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
",",
"$",
"OUTPUT",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"field",
")",
")",
"{",
"// No field has been defined yet, try and make one",
"$",
"this",
"->",
"de... | Print the relevant form element to define the attributes for this field
viewable by teachers only.
@global object
@global object
@return void Output is echo'd | [
"Print",
"the",
"relevant",
"form",
"element",
"to",
"define",
"the",
"attributes",
"for",
"this",
"field",
"viewable",
"by",
"teachers",
"only",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/lib.php#L330-L363 |
216,960 | moodle/moodle | mod/data/lib.php | data_field_base.update_content | function update_content($recordid, $value, $name=''){
global $DB;
$content = new stdClass();
$content->fieldid = $this->field->id;
$content->recordid = $recordid;
$content->content = clean_param($value, PARAM_NOTAGS);
if ($oldcontent = $DB->get_record('data_content', ar... | php | function update_content($recordid, $value, $name=''){
global $DB;
$content = new stdClass();
$content->fieldid = $this->field->id;
$content->recordid = $recordid;
$content->content = clean_param($value, PARAM_NOTAGS);
if ($oldcontent = $DB->get_record('data_content', ar... | [
"function",
"update_content",
"(",
"$",
"recordid",
",",
"$",
"value",
",",
"$",
"name",
"=",
"''",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"content",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"content",
"->",
"fieldid",
"=",
"$",
"this",
"->",
... | Update the content of one data field in the data_content table
@global object
@param int $recordid
@param mixed $value
@param string $name
@return bool | [
"Update",
"the",
"content",
"of",
"one",
"data",
"field",
"in",
"the",
"data_content",
"table"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/lib.php#L402-L416 |
216,961 | moodle/moodle | mod/data/lib.php | data_field_base.delete_content | function delete_content($recordid=0) {
global $DB;
if ($recordid) {
$conditions = array('fieldid'=>$this->field->id, 'recordid'=>$recordid);
} else {
$conditions = array('fieldid'=>$this->field->id);
}
$rs = $DB->get_recordset('data_content', $conditions... | php | function delete_content($recordid=0) {
global $DB;
if ($recordid) {
$conditions = array('fieldid'=>$this->field->id, 'recordid'=>$recordid);
} else {
$conditions = array('fieldid'=>$this->field->id);
}
$rs = $DB->get_recordset('data_content', $conditions... | [
"function",
"delete_content",
"(",
"$",
"recordid",
"=",
"0",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"recordid",
")",
"{",
"$",
"conditions",
"=",
"array",
"(",
"'fieldid'",
"=>",
"$",
"this",
"->",
"field",
"->",
"id",
",",
"'recordid'"... | Delete all content associated with the field
@global object
@param int $recordid
@return bool | [
"Delete",
"all",
"content",
"associated",
"with",
"the",
"field"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/lib.php#L425-L444 |
216,962 | moodle/moodle | mod/data/lib.php | data_field_base.image | function image() {
global $OUTPUT;
$params = array('d'=>$this->data->id, 'fid'=>$this->field->id, 'mode'=>'display', 'sesskey'=>sesskey());
$link = new moodle_url('/mod/data/field.php', $params);
$str = '<a href="'.$link->out().'">';
$str .= $OUTPUT->pix_icon('field/' . $this->t... | php | function image() {
global $OUTPUT;
$params = array('d'=>$this->data->id, 'fid'=>$this->field->id, 'mode'=>'display', 'sesskey'=>sesskey());
$link = new moodle_url('/mod/data/field.php', $params);
$str = '<a href="'.$link->out().'">';
$str .= $OUTPUT->pix_icon('field/' . $this->t... | [
"function",
"image",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"$",
"params",
"=",
"array",
"(",
"'d'",
"=>",
"$",
"this",
"->",
"data",
"->",
"id",
",",
"'fid'",
"=>",
"$",
"this",
"->",
"field",
"->",
"id",
",",
"'mode'",
"=>",
"'display'",
... | Prints the respective type icon
@global object
@return string | [
"Prints",
"the",
"respective",
"type",
"icon"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/lib.php#L505-L514 |
216,963 | moodle/moodle | mod/data/lib.php | data_preset_importer.data_preset_get_file_contents | public function data_preset_get_file_contents(&$filestorage, &$fileobj, $dir, $filename) {
if(empty($filestorage) || empty($fileobj)) {
if (substr($dir, -1)!='/') {
$dir .= '/';
}
if (file_exists($dir.$filename)) {
return file_get_contents($dir... | php | public function data_preset_get_file_contents(&$filestorage, &$fileobj, $dir, $filename) {
if(empty($filestorage) || empty($fileobj)) {
if (substr($dir, -1)!='/') {
$dir .= '/';
}
if (file_exists($dir.$filename)) {
return file_get_contents($dir... | [
"public",
"function",
"data_preset_get_file_contents",
"(",
"&",
"$",
"filestorage",
",",
"&",
"$",
"fileobj",
",",
"$",
"dir",
",",
"$",
"filename",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"filestorage",
")",
"||",
"empty",
"(",
"$",
"fileobj",
")",
"... | Retreive the contents of a file. That file may either be in a conventional directory of the Moodle file storage
@param file_storage $filestorage. should be null if using a conventional directory
@param stored_file $fileobj the directory to look in. null if using a conventional directory
@param string $dir the directory... | [
"Retreive",
"the",
"contents",
"of",
"a",
"file",
".",
"That",
"file",
"may",
"either",
"be",
"in",
"a",
"conventional",
"directory",
"of",
"the",
"Moodle",
"file",
"storage"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/lib.php#L2489-L2508 |
216,964 | moodle/moodle | competency/classes/course_competency_settings.php | course_competency_settings.get_by_courseid | public static function get_by_courseid($courseid) {
global $DB;
$params = array(
'courseid' => $courseid
);
$settings = new static(null, (object) $params);
if ($record = $DB->get_record(self::TABLE, $params)) {
$settings->from_record($record);
}
... | php | public static function get_by_courseid($courseid) {
global $DB;
$params = array(
'courseid' => $courseid
);
$settings = new static(null, (object) $params);
if ($record = $DB->get_record(self::TABLE, $params)) {
$settings->from_record($record);
}
... | [
"public",
"static",
"function",
"get_by_courseid",
"(",
"$",
"courseid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"params",
"=",
"array",
"(",
"'courseid'",
"=>",
"$",
"courseid",
")",
";",
"$",
"settings",
"=",
"new",
"static",
"(",
"null",
",",
"(",
... | Get a the course settings for a single course.
@param int $courseid The course id
@return course_competency_settings | [
"Get",
"a",
"the",
"course",
"settings",
"for",
"a",
"single",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/course_competency_settings.php#L67-L80 |
216,965 | moodle/moodle | competency/classes/course_competency_settings.php | course_competency_settings.can_read | public static function can_read($courseid) {
$context = context_course::instance($courseid);
$capabilities = array('moodle/competency:coursecompetencyview', 'moodle/competency:coursecompetencymanage');
return has_any_capability($capabilities, $context);
} | php | public static function can_read($courseid) {
$context = context_course::instance($courseid);
$capabilities = array('moodle/competency:coursecompetencyview', 'moodle/competency:coursecompetencymanage');
return has_any_capability($capabilities, $context);
} | [
"public",
"static",
"function",
"can_read",
"(",
"$",
"courseid",
")",
"{",
"$",
"context",
"=",
"context_course",
"::",
"instance",
"(",
"$",
"courseid",
")",
";",
"$",
"capabilities",
"=",
"array",
"(",
"'moodle/competency:coursecompetencyview'",
",",
"'moodle... | Can the current user view competency settings for this course.
@param int $courseid The course ID.
@return bool | [
"Can",
"the",
"current",
"user",
"view",
"competency",
"settings",
"for",
"this",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/course_competency_settings.php#L88-L94 |
216,966 | moodle/moodle | competency/classes/course_competency_settings.php | course_competency_settings.can_manage_course | public static function can_manage_course($courseid) {
$context = context_course::instance($courseid);
$capabilities = array('moodle/competency:coursecompetencyconfigure');
return has_any_capability($capabilities, $context);
} | php | public static function can_manage_course($courseid) {
$context = context_course::instance($courseid);
$capabilities = array('moodle/competency:coursecompetencyconfigure');
return has_any_capability($capabilities, $context);
} | [
"public",
"static",
"function",
"can_manage_course",
"(",
"$",
"courseid",
")",
"{",
"$",
"context",
"=",
"context_course",
"::",
"instance",
"(",
"$",
"courseid",
")",
";",
"$",
"capabilities",
"=",
"array",
"(",
"'moodle/competency:coursecompetencyconfigure'",
"... | Can the current user change competency settings for this course.
@param int $courseid The course ID.
@return bool | [
"Can",
"the",
"current",
"user",
"change",
"competency",
"settings",
"for",
"this",
"course",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/competency/classes/course_competency_settings.php#L102-L108 |
216,967 | moodle/moodle | admin/tool/policy/classes/output/page_agreedocs.php | page_agreedocs.redirect_to_policies | protected function redirect_to_policies($userid, $returnurl = null) {
// Make a list of all policies that the user has not answered yet.
$allpolicies = $this->policies;
if ($this->isexistinguser) {
$acceptances = api::get_user_acceptances($userid);
foreach ($allpolicies... | php | protected function redirect_to_policies($userid, $returnurl = null) {
// Make a list of all policies that the user has not answered yet.
$allpolicies = $this->policies;
if ($this->isexistinguser) {
$acceptances = api::get_user_acceptances($userid);
foreach ($allpolicies... | [
"protected",
"function",
"redirect_to_policies",
"(",
"$",
"userid",
",",
"$",
"returnurl",
"=",
"null",
")",
"{",
"// Make a list of all policies that the user has not answered yet.",
"$",
"allpolicies",
"=",
"$",
"this",
"->",
"policies",
";",
"if",
"(",
"$",
"thi... | Before display the consent page, the user has to view all the still-non-accepted policy docs.
This function checks if the non-accepted policy docs have been shown and redirect to them.
@param int $userid User identifier who wants to access to the consent page.
@param moodle_url $returnurl URL to return after shown the... | [
"Before",
"display",
"the",
"consent",
"page",
"the",
"user",
"has",
"to",
"view",
"all",
"the",
"still",
"-",
"non",
"-",
"accepted",
"policy",
"docs",
".",
"This",
"function",
"checks",
"if",
"the",
"non",
"-",
"accepted",
"policy",
"docs",
"have",
"be... | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/output/page_agreedocs.php#L228-L308 |
216,968 | moodle/moodle | admin/tool/policy/classes/output/page_agreedocs.php | page_agreedocs.prepare_user_acceptances | protected function prepare_user_acceptances($userid) {
global $USER;
// Get all the policy version acceptances for this user.
$lang = current_language();
foreach ($this->policies as $policy) {
// Get a link to display the full policy document.
$policy->url = new ... | php | protected function prepare_user_acceptances($userid) {
global $USER;
// Get all the policy version acceptances for this user.
$lang = current_language();
foreach ($this->policies as $policy) {
// Get a link to display the full policy document.
$policy->url = new ... | [
"protected",
"function",
"prepare_user_acceptances",
"(",
"$",
"userid",
")",
"{",
"global",
"$",
"USER",
";",
"// Get all the policy version acceptances for this user.",
"$",
"lang",
"=",
"current_language",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"polici... | Prepare user acceptances.
@param int $userid | [
"Prepare",
"user",
"acceptances",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/output/page_agreedocs.php#L395-L445 |
216,969 | moodle/moodle | cache/disabledlib.php | cache_config_disabled.generate_configuration_array | protected function generate_configuration_array() {
$configuration = array();
$configuration['stores'] = $this->configstores;
$configuration['modemappings'] = $this->configmodemappings;
$configuration['definitions'] = $this->configdefinitions;
$configuration['definitionmappings']... | php | protected function generate_configuration_array() {
$configuration = array();
$configuration['stores'] = $this->configstores;
$configuration['modemappings'] = $this->configmodemappings;
$configuration['definitions'] = $this->configdefinitions;
$configuration['definitionmappings']... | [
"protected",
"function",
"generate_configuration_array",
"(",
")",
"{",
"$",
"configuration",
"=",
"array",
"(",
")",
";",
"$",
"configuration",
"[",
"'stores'",
"]",
"=",
"$",
"this",
"->",
"configstores",
";",
"$",
"configuration",
"[",
"'modemappings'",
"]"... | Generates a configuration array suitable to be written to the config file.
@return array | [
"Generates",
"a",
"configuration",
"array",
"suitable",
"to",
"be",
"written",
"to",
"the",
"config",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/disabledlib.php#L327-L335 |
216,970 | moodle/moodle | repository/equella/lib.php | repository_equella.get_listing | public function get_listing($path = null, $page = null) {
global $COURSE;
$callbackurl = new moodle_url('/repository/equella/callback.php', array('repo_id'=>$this->id));
$mimetypesstr = '';
$restrict = '';
if (!empty($this->mimetypes)) {
$mimetypesstr = '&mimeTypes='... | php | public function get_listing($path = null, $page = null) {
global $COURSE;
$callbackurl = new moodle_url('/repository/equella/callback.php', array('repo_id'=>$this->id));
$mimetypesstr = '';
$restrict = '';
if (!empty($this->mimetypes)) {
$mimetypesstr = '&mimeTypes='... | [
"public",
"function",
"get_listing",
"(",
"$",
"path",
"=",
"null",
",",
"$",
"page",
"=",
"null",
")",
"{",
"global",
"$",
"COURSE",
";",
"$",
"callbackurl",
"=",
"new",
"moodle_url",
"(",
"'/repository/equella/callback.php'",
",",
"array",
"(",
"'repo_id'"... | Display embedded equella interface
@param string $path
@param mixed $page
@return array | [
"Display",
"embedded",
"equella",
"interface"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/equella/lib.php#L67-L110 |
216,971 | moodle/moodle | repository/equella/lib.php | repository_equella.connection_result | private function connection_result($errno = null) {
static $countfailures = array();
$sess = sesskey();
if (!array_key_exists($sess, $countfailures)) {
$countfailures[$sess] = 0;
}
if ($errno !== null) {
if ($errno == 0) {
// reset count of... | php | private function connection_result($errno = null) {
static $countfailures = array();
$sess = sesskey();
if (!array_key_exists($sess, $countfailures)) {
$countfailures[$sess] = 0;
}
if ($errno !== null) {
if ($errno == 0) {
// reset count of... | [
"private",
"function",
"connection_result",
"(",
"$",
"errno",
"=",
"null",
")",
"{",
"static",
"$",
"countfailures",
"=",
"array",
"(",
")",
";",
"$",
"sess",
"=",
"sesskey",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"sess",
",",
... | Counts the number of failed connections.
If we received the connection timeout more than 3 times in a row, we don't attemt to
connect to the server any more during this request.
This function is used by {@link repository_equella::sync_reference()} that
synchronises the file size of referenced files.
@param int $errn... | [
"Counts",
"the",
"number",
"of",
"failed",
"connections",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/equella/lib.php#L148-L164 |
216,972 | moodle/moodle | repository/equella/lib.php | repository_equella.get_instance_option_names | public static function get_instance_option_names() {
$rv = array('equella_url', 'equella_select_restriction', 'equella_options',
'equella_shareid', 'equella_sharedsecret'
);
foreach (self::get_all_editing_roles() as $role) {
array_push($rv, "equella_{$role->shortname}_sh... | php | public static function get_instance_option_names() {
$rv = array('equella_url', 'equella_select_restriction', 'equella_options',
'equella_shareid', 'equella_sharedsecret'
);
foreach (self::get_all_editing_roles() as $role) {
array_push($rv, "equella_{$role->shortname}_sh... | [
"public",
"static",
"function",
"get_instance_option_names",
"(",
")",
"{",
"$",
"rv",
"=",
"array",
"(",
"'equella_url'",
",",
"'equella_select_restriction'",
",",
"'equella_options'",
",",
"'equella_shareid'",
",",
"'equella_sharedsecret'",
")",
";",
"foreach",
"(",... | Names of the instance settings
@return array | [
"Names",
"of",
"the",
"instance",
"settings"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/equella/lib.php#L308-L319 |
216,973 | moodle/moodle | repository/equella/lib.php | repository_equella.getssotoken_raw | private static function getssotoken_raw($username, $shareid, $sharedsecret) {
$time = time() . '000';
return urlencode($username)
. ':'
. $shareid
. ':'
. $time
. ':'
. base64_encode(pack('H*', md5($username . $shareid . $time . $sh... | php | private static function getssotoken_raw($username, $shareid, $sharedsecret) {
$time = time() . '000';
return urlencode($username)
. ':'
. $shareid
. ':'
. $time
. ':'
. base64_encode(pack('H*', md5($username . $shareid . $time . $sh... | [
"private",
"static",
"function",
"getssotoken_raw",
"(",
"$",
"username",
",",
"$",
"shareid",
",",
"$",
"sharedsecret",
")",
"{",
"$",
"time",
"=",
"time",
"(",
")",
".",
"'000'",
";",
"return",
"urlencode",
"(",
"$",
"username",
")",
".",
"':'",
".",... | Generate equella token
@param string $username
@param string $shareid
@param string $sharedsecret
@return string | [
"Generate",
"equella",
"token"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/equella/lib.php#L329-L338 |
216,974 | moodle/moodle | repository/equella/lib.php | repository_equella.getssotoken | private function getssotoken($readwrite = 'read') {
global $USER;
if (empty($USER->username)) {
return false;
}
if ($readwrite == 'write') {
foreach (self::get_all_editing_roles() as $role) {
if (user_has_role_assignment($USER->id, $role->id, $t... | php | private function getssotoken($readwrite = 'read') {
global $USER;
if (empty($USER->username)) {
return false;
}
if ($readwrite == 'write') {
foreach (self::get_all_editing_roles() as $role) {
if (user_has_role_assignment($USER->id, $role->id, $t... | [
"private",
"function",
"getssotoken",
"(",
"$",
"readwrite",
"=",
"'read'",
")",
"{",
"global",
"$",
"USER",
";",
"if",
"(",
"empty",
"(",
"$",
"USER",
"->",
"username",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"readwrite",
"==",
... | Generate equella sso token
@param string $readwrite
@return string | [
"Generate",
"equella",
"sso",
"token"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/equella/lib.php#L361-L386 |
216,975 | moodle/moodle | lib/flickrclient.php | flickr_client.set_request_token_secret | public function set_request_token_secret(array $identifiers, $secret) {
if (empty($identifiers) || empty($identifiers['caller'])) {
throw new coding_exception('Invalid call identification');
}
$cache = cache::make_from_params(cache_store::MODE_SESSION, 'core', 'flickrclient', $iden... | php | public function set_request_token_secret(array $identifiers, $secret) {
if (empty($identifiers) || empty($identifiers['caller'])) {
throw new coding_exception('Invalid call identification');
}
$cache = cache::make_from_params(cache_store::MODE_SESSION, 'core', 'flickrclient', $iden... | [
"public",
"function",
"set_request_token_secret",
"(",
"array",
"$",
"identifiers",
",",
"$",
"secret",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"identifiers",
")",
"||",
"empty",
"(",
"$",
"identifiers",
"[",
"'caller'",
"]",
")",
")",
"{",
"throw",
"new... | Temporarily store the request token secret in the session.
The request token secret is returned by the oauth request_token method.
It needs to be stored in the session before the user is redirected to
the Flickr to authorize the client. After redirecting back, this secret
is used for exchanging the request token with ... | [
"Temporarily",
"store",
"the",
"request",
"token",
"secret",
"in",
"the",
"session",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/flickrclient.php#L89-L97 |
216,976 | moodle/moodle | lib/flickrclient.php | flickr_client.get_request_token_secret | public function get_request_token_secret(array $identifiers) {
if (empty($identifiers) || empty($identifiers['caller'])) {
throw new coding_exception('Invalid call identification');
}
$cache = cache::make_from_params(cache_store::MODE_SESSION, 'core', 'flickrclient', $identifiers);... | php | public function get_request_token_secret(array $identifiers) {
if (empty($identifiers) || empty($identifiers['caller'])) {
throw new coding_exception('Invalid call identification');
}
$cache = cache::make_from_params(cache_store::MODE_SESSION, 'core', 'flickrclient', $identifiers);... | [
"public",
"function",
"get_request_token_secret",
"(",
"array",
"$",
"identifiers",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"identifiers",
")",
"||",
"empty",
"(",
"$",
"identifiers",
"[",
"'caller'",
"]",
")",
")",
"{",
"throw",
"new",
"coding_exception",
... | Returns previously stored request token secret.
See {@link self::set_request_token_secret()} for more details on the
$identifiers argument.
@param array $identifiers Identification of the call
@return string|bool False on error, string secret otherwise. | [
"Returns",
"previously",
"stored",
"request",
"token",
"secret",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/flickrclient.php#L108-L117 |
216,977 | moodle/moodle | lib/flickrclient.php | flickr_client.call | public function call($function, array $params = [], $method = 'GET') {
if (strpos($function, 'flickr.') !== 0) {
$function = 'flickr.'.$function;
}
$params['method'] = $function;
$params['format'] = 'json';
$params['nojsoncallback'] = 1;
$rawresponse = $thi... | php | public function call($function, array $params = [], $method = 'GET') {
if (strpos($function, 'flickr.') !== 0) {
$function = 'flickr.'.$function;
}
$params['method'] = $function;
$params['format'] = 'json';
$params['nojsoncallback'] = 1;
$rawresponse = $thi... | [
"public",
"function",
"call",
"(",
"$",
"function",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"method",
"=",
"'GET'",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"function",
",",
"'flickr.'",
")",
"!==",
"0",
")",
"{",
"$",
"function",
"... | Call a Flickr API method.
@param string $function API function name like 'flickr.photos.getSizes' or just 'photos.getSizes'
@param array $params Additional API call arguments.
@param string $method HTTP method to use (GET or POST).
@return object|bool Response as returned by the Flickr or false on invalid authenticati... | [
"Call",
"a",
"Flickr",
"API",
"method",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/flickrclient.php#L127-L156 |
216,978 | moodle/moodle | lib/flickrclient.php | flickr_client.get_photo_url | public function get_photo_url($photoid) {
$cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'core', 'flickrclient');
$url = $cache->get('photourl_'.$photoid);
if ($url === false) {
$response = $this->call('photos.getSizes', ['photo_id' => $photoid]);
// S... | php | public function get_photo_url($photoid) {
$cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'core', 'flickrclient');
$url = $cache->get('photourl_'.$photoid);
if ($url === false) {
$response = $this->call('photos.getSizes', ['photo_id' => $photoid]);
// S... | [
"public",
"function",
"get_photo_url",
"(",
"$",
"photoid",
")",
"{",
"$",
"cache",
"=",
"cache",
"::",
"make_from_params",
"(",
"cache_store",
"::",
"MODE_APPLICATION",
",",
"'core'",
",",
"'flickrclient'",
")",
";",
"$",
"url",
"=",
"$",
"cache",
"->",
"... | Return the URL to fetch the given photo from.
Flickr photos are distributed via farm servers staticflickr.com in
various sizes (resolutions). The method tries to find the source URL of
the photo in the highest possible resolution. Results are cached so that
we do not need to query the Flickr API over and over again.
... | [
"Return",
"the",
"URL",
"to",
"fetch",
"the",
"given",
"photo",
"from",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/flickrclient.php#L169-L196 |
216,979 | moodle/moodle | lib/flickrclient.php | flickr_client.upload | public function upload(stored_file $photo, array $meta = []) {
$args = [
'title' => isset($meta['title']) ? $meta['title'] : null,
'description' => isset($meta['description']) ? $meta['description'] : null,
'tags' => isset($meta['tags']) ? $meta['tags'] : null,
'... | php | public function upload(stored_file $photo, array $meta = []) {
$args = [
'title' => isset($meta['title']) ? $meta['title'] : null,
'description' => isset($meta['description']) ? $meta['description'] : null,
'tags' => isset($meta['tags']) ? $meta['tags'] : null,
'... | [
"public",
"function",
"upload",
"(",
"stored_file",
"$",
"photo",
",",
"array",
"$",
"meta",
"=",
"[",
"]",
")",
"{",
"$",
"args",
"=",
"[",
"'title'",
"=>",
"isset",
"(",
"$",
"meta",
"[",
"'title'",
"]",
")",
"?",
"$",
"meta",
"[",
"'title'",
"... | Upload a photo from Moodle file pool to Flickr.
Optional meta information are title, description, tags, is_public,
is_friend, is_family, safety_level, content_type and hidden.
See {@link https://www.flickr.com/services/api/upload.api.html}.
Upload can't be asynchronous because then the query would not return the
phot... | [
"Upload",
"a",
"photo",
"from",
"Moodle",
"file",
"pool",
"to",
"Flickr",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/flickrclient.php#L213-L252 |
216,980 | moodle/moodle | enrol/bulkchange_forms.php | enrol_bulk_enrolment_change_form.get_users_table | protected function get_users_table(array $users, array $statusoptions) {
$table = new html_table();
$table->head = array(
get_string('name'),
get_string('participationstatus', 'enrol'),
get_string('enroltimestart', 'enrol'),
get_string('enroltimeend', 'enr... | php | protected function get_users_table(array $users, array $statusoptions) {
$table = new html_table();
$table->head = array(
get_string('name'),
get_string('participationstatus', 'enrol'),
get_string('enroltimestart', 'enrol'),
get_string('enroltimeend', 'enr... | [
"protected",
"function",
"get_users_table",
"(",
"array",
"$",
"users",
",",
"array",
"$",
"statusoptions",
")",
"{",
"$",
"table",
"=",
"new",
"html_table",
"(",
")",
";",
"$",
"table",
"->",
"head",
"=",
"array",
"(",
"get_string",
"(",
"'name'",
")",
... | Generates an HTML table to display the users being affected by the bulk change.
@param array $users
@param array $statusoptions
@return string | [
"Generates",
"an",
"HTML",
"table",
"to",
"display",
"the",
"users",
"being",
"affected",
"by",
"the",
"bulk",
"change",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/bulkchange_forms.php#L70-L91 |
216,981 | moodle/moodle | lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php | FileSystemHelper.createRootFolder | protected function createRootFolder()
{
$this->rootFolder = $this->createFolder($this->baseFolderRealPath, uniqid('xlsx', true));
return $this;
} | php | protected function createRootFolder()
{
$this->rootFolder = $this->createFolder($this->baseFolderRealPath, uniqid('xlsx', true));
return $this;
} | [
"protected",
"function",
"createRootFolder",
"(",
")",
"{",
"$",
"this",
"->",
"rootFolder",
"=",
"$",
"this",
"->",
"createFolder",
"(",
"$",
"this",
"->",
"baseFolderRealPath",
",",
"uniqid",
"(",
"'xlsx'",
",",
"true",
")",
")",
";",
"return",
"$",
"t... | Creates the folder that will be used as root
@return FileSystemHelper
@throws \Box\Spout\Common\Exception\IOException If unable to create the folder | [
"Creates",
"the",
"folder",
"that",
"will",
"be",
"used",
"as",
"root"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php#L95-L99 |
216,982 | moodle/moodle | lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php | FileSystemHelper.createRelsFolderAndFile | protected function createRelsFolderAndFile()
{
$this->relsFolder = $this->createFolder($this->rootFolder, self::RELS_FOLDER_NAME);
$this->createRelsFile();
return $this;
} | php | protected function createRelsFolderAndFile()
{
$this->relsFolder = $this->createFolder($this->rootFolder, self::RELS_FOLDER_NAME);
$this->createRelsFile();
return $this;
} | [
"protected",
"function",
"createRelsFolderAndFile",
"(",
")",
"{",
"$",
"this",
"->",
"relsFolder",
"=",
"$",
"this",
"->",
"createFolder",
"(",
"$",
"this",
"->",
"rootFolder",
",",
"self",
"::",
"RELS_FOLDER_NAME",
")",
";",
"$",
"this",
"->",
"createRelsF... | Creates the "_rels" folder under the root folder as well as the ".rels" file in it
@return FileSystemHelper
@throws \Box\Spout\Common\Exception\IOException If unable to create the folder or the ".rels" file | [
"Creates",
"the",
"_rels",
"folder",
"under",
"the",
"root",
"folder",
"as",
"well",
"as",
"the",
".",
"rels",
"file",
"in",
"it"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php#L107-L114 |
216,983 | moodle/moodle | lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php | FileSystemHelper.createDocPropsFolderAndFiles | protected function createDocPropsFolderAndFiles()
{
$this->docPropsFolder = $this->createFolder($this->rootFolder, self::DOC_PROPS_FOLDER_NAME);
$this->createAppXmlFile();
$this->createCoreXmlFile();
return $this;
} | php | protected function createDocPropsFolderAndFiles()
{
$this->docPropsFolder = $this->createFolder($this->rootFolder, self::DOC_PROPS_FOLDER_NAME);
$this->createAppXmlFile();
$this->createCoreXmlFile();
return $this;
} | [
"protected",
"function",
"createDocPropsFolderAndFiles",
"(",
")",
"{",
"$",
"this",
"->",
"docPropsFolder",
"=",
"$",
"this",
"->",
"createFolder",
"(",
"$",
"this",
"->",
"rootFolder",
",",
"self",
"::",
"DOC_PROPS_FOLDER_NAME",
")",
";",
"$",
"this",
"->",
... | Creates the "docProps" folder under the root folder as well as the "app.xml" and "core.xml" files in it
@return FileSystemHelper
@throws \Box\Spout\Common\Exception\IOException If unable to create the folder or one of the files | [
"Creates",
"the",
"docProps",
"folder",
"under",
"the",
"root",
"folder",
"as",
"well",
"as",
"the",
"app",
".",
"xml",
"and",
"core",
".",
"xml",
"files",
"in",
"it"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php#L144-L152 |
216,984 | moodle/moodle | lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php | FileSystemHelper.createAppXmlFile | protected function createAppXmlFile()
{
$appName = self::APP_NAME;
$appXmlFileContents = <<<EOD
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties">
<Application>$appName</Application>
<TotalTim... | php | protected function createAppXmlFile()
{
$appName = self::APP_NAME;
$appXmlFileContents = <<<EOD
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties">
<Application>$appName</Application>
<TotalTim... | [
"protected",
"function",
"createAppXmlFile",
"(",
")",
"{",
"$",
"appName",
"=",
"self",
"::",
"APP_NAME",
";",
"$",
"appXmlFileContents",
"=",
" <<<EOD\n<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocumen... | Creates the "app.xml" file under the "docProps" folder
@return FileSystemHelper
@throws \Box\Spout\Common\Exception\IOException If unable to create the file | [
"Creates",
"the",
"app",
".",
"xml",
"file",
"under",
"the",
"docProps",
"folder"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php#L160-L174 |
216,985 | moodle/moodle | lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php | FileSystemHelper.createCoreXmlFile | protected function createCoreXmlFile()
{
$createdDate = (new \DateTime())->format(\DateTime::W3C);
$coreXmlFileContents = <<<EOD
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="htt... | php | protected function createCoreXmlFile()
{
$createdDate = (new \DateTime())->format(\DateTime::W3C);
$coreXmlFileContents = <<<EOD
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="htt... | [
"protected",
"function",
"createCoreXmlFile",
"(",
")",
"{",
"$",
"createdDate",
"=",
"(",
"new",
"\\",
"DateTime",
"(",
")",
")",
"->",
"format",
"(",
"\\",
"DateTime",
"::",
"W3C",
")",
";",
"$",
"coreXmlFileContents",
"=",
" <<<EOD\n<?xml version=\"1.0\" en... | Creates the "core.xml" file under the "docProps" folder
@return FileSystemHelper
@throws \Box\Spout\Common\Exception\IOException If unable to create the file | [
"Creates",
"the",
"core",
".",
"xml",
"file",
"under",
"the",
"docProps",
"folder"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php#L182-L197 |
216,986 | moodle/moodle | lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php | FileSystemHelper.createXlFolderAndSubFolders | protected function createXlFolderAndSubFolders()
{
$this->xlFolder = $this->createFolder($this->rootFolder, self::XL_FOLDER_NAME);
$this->createXlRelsFolder();
$this->createXlWorksheetsFolder();
return $this;
} | php | protected function createXlFolderAndSubFolders()
{
$this->xlFolder = $this->createFolder($this->rootFolder, self::XL_FOLDER_NAME);
$this->createXlRelsFolder();
$this->createXlWorksheetsFolder();
return $this;
} | [
"protected",
"function",
"createXlFolderAndSubFolders",
"(",
")",
"{",
"$",
"this",
"->",
"xlFolder",
"=",
"$",
"this",
"->",
"createFolder",
"(",
"$",
"this",
"->",
"rootFolder",
",",
"self",
"::",
"XL_FOLDER_NAME",
")",
";",
"$",
"this",
"->",
"createXlRel... | Creates the "xl" folder under the root folder as well as its subfolders
@return FileSystemHelper
@throws \Box\Spout\Common\Exception\IOException If unable to create at least one of the folders | [
"Creates",
"the",
"xl",
"folder",
"under",
"the",
"root",
"folder",
"as",
"well",
"as",
"its",
"subfolders"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php#L205-L212 |
216,987 | moodle/moodle | lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php | FileSystemHelper.createXlRelsFolder | protected function createXlRelsFolder()
{
$this->xlRelsFolder = $this->createFolder($this->xlFolder, self::RELS_FOLDER_NAME);
return $this;
} | php | protected function createXlRelsFolder()
{
$this->xlRelsFolder = $this->createFolder($this->xlFolder, self::RELS_FOLDER_NAME);
return $this;
} | [
"protected",
"function",
"createXlRelsFolder",
"(",
")",
"{",
"$",
"this",
"->",
"xlRelsFolder",
"=",
"$",
"this",
"->",
"createFolder",
"(",
"$",
"this",
"->",
"xlFolder",
",",
"self",
"::",
"RELS_FOLDER_NAME",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Creates the "_rels" folder under the "xl" folder
@return FileSystemHelper
@throws \Box\Spout\Common\Exception\IOException If unable to create the folder | [
"Creates",
"the",
"_rels",
"folder",
"under",
"the",
"xl",
"folder"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php#L220-L224 |
216,988 | moodle/moodle | lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php | FileSystemHelper.createXlWorksheetsFolder | protected function createXlWorksheetsFolder()
{
$this->xlWorksheetsFolder = $this->createFolder($this->xlFolder, self::WORKSHEETS_FOLDER_NAME);
return $this;
} | php | protected function createXlWorksheetsFolder()
{
$this->xlWorksheetsFolder = $this->createFolder($this->xlFolder, self::WORKSHEETS_FOLDER_NAME);
return $this;
} | [
"protected",
"function",
"createXlWorksheetsFolder",
"(",
")",
"{",
"$",
"this",
"->",
"xlWorksheetsFolder",
"=",
"$",
"this",
"->",
"createFolder",
"(",
"$",
"this",
"->",
"xlFolder",
",",
"self",
"::",
"WORKSHEETS_FOLDER_NAME",
")",
";",
"return",
"$",
"this... | Creates the "worksheets" folder under the "xl" folder
@return FileSystemHelper
@throws \Box\Spout\Common\Exception\IOException If unable to create the folder | [
"Creates",
"the",
"worksheets",
"folder",
"under",
"the",
"xl",
"folder"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php#L232-L236 |
216,989 | moodle/moodle | lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php | FileSystemHelper.createWorkbookFile | public function createWorkbookFile($worksheets)
{
$workbookXmlFileContents = <<<EOD
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
<sheets>
... | php | public function createWorkbookFile($worksheets)
{
$workbookXmlFileContents = <<<EOD
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
<sheets>
... | [
"public",
"function",
"createWorkbookFile",
"(",
"$",
"worksheets",
")",
"{",
"$",
"workbookXmlFileContents",
"=",
" <<<EOD\n<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.ope... | Creates the "workbook.xml" file under the "xl" folder
@param Worksheet[] $worksheets
@return FileSystemHelper | [
"Creates",
"the",
"workbook",
".",
"xml",
"file",
"under",
"the",
"xl",
"folder"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php#L278-L304 |
216,990 | moodle/moodle | lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php | FileSystemHelper.createStylesFile | public function createStylesFile($styleHelper)
{
$stylesXmlFileContents = $styleHelper->getStylesXMLFileContent();
$this->createFileWithContents($this->xlFolder, self::STYLES_XML_FILE_NAME, $stylesXmlFileContents);
return $this;
} | php | public function createStylesFile($styleHelper)
{
$stylesXmlFileContents = $styleHelper->getStylesXMLFileContent();
$this->createFileWithContents($this->xlFolder, self::STYLES_XML_FILE_NAME, $stylesXmlFileContents);
return $this;
} | [
"public",
"function",
"createStylesFile",
"(",
"$",
"styleHelper",
")",
"{",
"$",
"stylesXmlFileContents",
"=",
"$",
"styleHelper",
"->",
"getStylesXMLFileContent",
"(",
")",
";",
"$",
"this",
"->",
"createFileWithContents",
"(",
"$",
"this",
"->",
"xlFolder",
"... | Creates the "styles.xml" file under the "xl" folder
@param StyleHelper $styleHelper
@return FileSystemHelper | [
"Creates",
"the",
"styles",
".",
"xml",
"file",
"under",
"the",
"xl",
"folder"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php#L340-L346 |
216,991 | moodle/moodle | backup/util/ui/backup_ui_setting.class.php | backup_setting_ui.make | final public static function make(backup_setting $setting, $type, $label, array $attributes = null, array $options = null) {
// Base the decision we make on the type that was sent.
switch ($type) {
case backup_setting::UI_HTML_CHECKBOX :
return new backup_setting_ui_checkbox(... | php | final public static function make(backup_setting $setting, $type, $label, array $attributes = null, array $options = null) {
// Base the decision we make on the type that was sent.
switch ($type) {
case backup_setting::UI_HTML_CHECKBOX :
return new backup_setting_ui_checkbox(... | [
"final",
"public",
"static",
"function",
"make",
"(",
"backup_setting",
"$",
"setting",
",",
"$",
"type",
",",
"$",
"label",
",",
"array",
"$",
"attributes",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"null",
")",
"{",
"// Base the decision we make on t... | Creates a new backup setting ui based on the setting it is given
@throws backup_setting_ui_exception if the setting type is not supported,
@param backup_setting $setting
@param int $type The backup_setting UI type. One of backup_setting::UI_*;
@param string $label The label to display with the setting ui
@param array ... | [
"Creates",
"a",
"new",
"backup",
"setting",
"ui",
"based",
"on",
"the",
"setting",
"it",
"is",
"given"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/backup_ui_setting.class.php#L245-L259 |
216,992 | moodle/moodle | backup/util/ui/backup_ui_setting.class.php | backup_setting_ui.get_label | public function get_label(base_task $task = null) {
// If a task has been provided and the label is not already set meaningfully
// we will attempt to improve it.
if (!is_null($task) && $this->label == $this->setting->get_name() && strpos($this->setting->get_name(), '_include') !== false) {
... | php | public function get_label(base_task $task = null) {
// If a task has been provided and the label is not already set meaningfully
// we will attempt to improve it.
if (!is_null($task) && $this->label == $this->setting->get_name() && strpos($this->setting->get_name(), '_include') !== false) {
... | [
"public",
"function",
"get_label",
"(",
"base_task",
"$",
"task",
"=",
"null",
")",
"{",
"// If a task has been provided and the label is not already set meaningfully",
"// we will attempt to improve it.",
"if",
"(",
"!",
"is_null",
"(",
"$",
"task",
")",
"&&",
"$",
"th... | Gets the label for this item
@param base_task $task Optional, if provided and the setting is an include
$task is used to set the setting label
@return string | [
"Gets",
"the",
"label",
"for",
"this",
"item"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/backup_ui_setting.class.php#L288-L299 |
216,993 | moodle/moodle | backup/util/ui/backup_ui_setting.class.php | backup_setting_ui.is_changeable | public function is_changeable($level = null) {
if ($this->setting->get_status() === backup_setting::NOT_LOCKED) {
// Its not locked so its chanegable.
return true;
} else if ($this->setting->get_status() !== backup_setting::LOCKED_BY_HIERARCHY) {
// Its not changeable... | php | public function is_changeable($level = null) {
if ($this->setting->get_status() === backup_setting::NOT_LOCKED) {
// Its not locked so its chanegable.
return true;
} else if ($this->setting->get_status() !== backup_setting::LOCKED_BY_HIERARCHY) {
// Its not changeable... | [
"public",
"function",
"is_changeable",
"(",
"$",
"level",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"setting",
"->",
"get_status",
"(",
")",
"===",
"backup_setting",
"::",
"NOT_LOCKED",
")",
"{",
"// Its not locked so its chanegable.",
"return",
"tr... | Returns true if the setting is changeable.
A setting is changeable if it meets either of the two following conditions.
1. The setting is not locked
2. The setting is locked but only by settings that are of the same level (same page)
Condition 2 is really why we have this function
@param int $level Optional, if provi... | [
"Returns",
"true",
"if",
"the",
"setting",
"is",
"changeable",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/backup_ui_setting.class.php#L315-L338 |
216,994 | moodle/moodle | backup/util/ui/backup_ui_setting.class.php | backup_setting_ui_checkbox.get_static_value | public function get_static_value() {
global $OUTPUT;
// Checkboxes are always yes or no.
if ($this->get_value()) {
return $OUTPUT->pix_icon('i/valid', get_string('yes'));
} else {
return $OUTPUT->pix_icon('i/invalid', get_string('no'));
}
} | php | public function get_static_value() {
global $OUTPUT;
// Checkboxes are always yes or no.
if ($this->get_value()) {
return $OUTPUT->pix_icon('i/valid', get_string('yes'));
} else {
return $OUTPUT->pix_icon('i/invalid', get_string('no'));
}
} | [
"public",
"function",
"get_static_value",
"(",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"// Checkboxes are always yes or no.",
"if",
"(",
"$",
"this",
"->",
"get_value",
"(",
")",
")",
"{",
"return",
"$",
"OUTPUT",
"->",
"pix_icon",
"(",
"'i/valid'",
",",
"ge... | Gets the static value for the element
@global core_renderer $OUTPUT
@return string | [
"Gets",
"the",
"static",
"value",
"for",
"the",
"element"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/backup_ui_setting.class.php#L454-L462 |
216,995 | moodle/moodle | backup/util/ui/backup_ui_setting.class.php | backup_setting_ui_checkbox.is_changeable | public function is_changeable($level = null) {
if ($this->changeable === false) {
return false;
} else {
return parent::is_changeable($level);
}
} | php | public function is_changeable($level = null) {
if ($this->changeable === false) {
return false;
} else {
return parent::is_changeable($level);
}
} | [
"public",
"function",
"is_changeable",
"(",
"$",
"level",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"changeable",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"return",
"parent",
"::",
"is_changeable",
"(",
"$",
"level... | Returns true if the setting is changeable
@param int $level Optional, if provided only depedency_settings below or equal to this level are considered,
when checking if the ui_setting is changeable. Although dependencies might cause a lock on this setting,
they could be changeable in the same view.
@return bool | [
"Returns",
"true",
"if",
"the",
"setting",
"is",
"changeable"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/backup_ui_setting.class.php#L471-L477 |
216,996 | moodle/moodle | backup/util/ui/backup_ui_setting.class.php | backup_setting_ui_select.is_changeable | public function is_changeable($level = null) {
if (count($this->values) == 1) {
return false;
} else {
return parent::is_changeable($level);
}
} | php | public function is_changeable($level = null) {
if (count($this->values) == 1) {
return false;
} else {
return parent::is_changeable($level);
}
} | [
"public",
"function",
"is_changeable",
"(",
"$",
"level",
"=",
"null",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"values",
")",
"==",
"1",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"return",
"parent",
"::",
"is_changeable",
"(",... | Returns true if the setting is changeable, false otherwise
@param int $level Optional, if provided only depedency_settings below or equal to this level are considered,
when checking if the ui_setting is changeable. Although dependencies might cause a lock on this setting,
they could be changeable in the same view.
@re... | [
"Returns",
"true",
"if",
"the",
"setting",
"is",
"changeable",
"false",
"otherwise"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/ui/backup_ui_setting.class.php#L655-L661 |
216,997 | moodle/moodle | lib/jabber/XMPP/XMLStream.php | XMPPHP_XMLStream.addIdHandler | public function addIdHandler($id, $pointer, $obj = null) {
$this->idhandlers[$id] = array($pointer, $obj);
} | php | public function addIdHandler($id, $pointer, $obj = null) {
$this->idhandlers[$id] = array($pointer, $obj);
} | [
"public",
"function",
"addIdHandler",
"(",
"$",
"id",
",",
"$",
"pointer",
",",
"$",
"obj",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"idhandlers",
"[",
"$",
"id",
"]",
"=",
"array",
"(",
"$",
"pointer",
",",
"$",
"obj",
")",
";",
"}"
] | Add ID Handler
@param integer $id
@param string $pointer
@param string $obj | [
"Add",
"ID",
"Handler"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/jabber/XMPP/XMLStream.php#L234-L236 |
216,998 | moodle/moodle | lib/jabber/XMPP/XMLStream.php | XMPPHP_XMLStream.disconnect | public function disconnect() {
$this->log->log("Disconnecting...", XMPPHP_Log::LEVEL_VERBOSE);
if(false == (bool) $this->socket) {
return;
}
$this->reconnect = false;
$this->send($this->stream_end);
$this->sent_disconnect = true;
$this->processUntil('end_stream', 5);
$this->disconnected = true;
} | php | public function disconnect() {
$this->log->log("Disconnecting...", XMPPHP_Log::LEVEL_VERBOSE);
if(false == (bool) $this->socket) {
return;
}
$this->reconnect = false;
$this->send($this->stream_end);
$this->sent_disconnect = true;
$this->processUntil('end_stream', 5);
$this->disconnected = true;
} | [
"public",
"function",
"disconnect",
"(",
")",
"{",
"$",
"this",
"->",
"log",
"->",
"log",
"(",
"\"Disconnecting...\"",
",",
"XMPPHP_Log",
"::",
"LEVEL_VERBOSE",
")",
";",
"if",
"(",
"false",
"==",
"(",
"bool",
")",
"$",
"this",
"->",
"socket",
")",
"{"... | Disconnect from XMPP Host | [
"Disconnect",
"from",
"XMPP",
"Host"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/jabber/XMPP/XMLStream.php#L350-L360 |
216,999 | moodle/moodle | lib/jabber/XMPP/XMLStream.php | XMPPHP_XMLStream.__process | private function __process($maximum=5) {
$remaining = $maximum;
do {
$starttime = (microtime(true) * 1000000);
$read = array($this->socket);
$write = array();
$except = array();
if (is_null($maximum)) {
$secs = NULL;
$usecs = NULL;
} else if ($maximum == 0) {
$secs = 0;
$usec... | php | private function __process($maximum=5) {
$remaining = $maximum;
do {
$starttime = (microtime(true) * 1000000);
$read = array($this->socket);
$write = array();
$except = array();
if (is_null($maximum)) {
$secs = NULL;
$usecs = NULL;
} else if ($maximum == 0) {
$secs = 0;
$usec... | [
"private",
"function",
"__process",
"(",
"$",
"maximum",
"=",
"5",
")",
"{",
"$",
"remaining",
"=",
"$",
"maximum",
";",
"do",
"{",
"$",
"starttime",
"=",
"(",
"microtime",
"(",
"true",
")",
"*",
"1000000",
")",
";",
"$",
"read",
"=",
"array",
"(",... | Core reading tool
0 -> only read if data is immediately ready
NULL -> wait forever and ever
integer -> process for this amount of time | [
"Core",
"reading",
"tool",
"0",
"-",
">",
"only",
"read",
"if",
"data",
"is",
"immediately",
"ready",
"NULL",
"-",
">",
"wait",
"forever",
"and",
"ever",
"integer",
"-",
">",
"process",
"for",
"this",
"amount",
"of",
"time"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/jabber/XMPP/XMLStream.php#L378-L429 |
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.