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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
213,400 | moodle/moodle | calendar/classes/local/event/container.php | container.apply_component_provide_event_action | public static function apply_component_provide_event_action(event_interface $event) {
// Callbacks will get supplied a "legacy" version
// of the event class.
$mapper = self::$eventmapper;
$action = null;
if ($event->get_course_module()) {
$requestinguserid = self::ge... | php | public static function apply_component_provide_event_action(event_interface $event) {
// Callbacks will get supplied a "legacy" version
// of the event class.
$mapper = self::$eventmapper;
$action = null;
if ($event->get_course_module()) {
$requestinguserid = self::ge... | [
"public",
"static",
"function",
"apply_component_provide_event_action",
"(",
"event_interface",
"$",
"event",
")",
"{",
"// Callbacks will get supplied a \"legacy\" version",
"// of the event class.",
"$",
"mapper",
"=",
"self",
"::",
"$",
"eventmapper",
";",
"$",
"action",... | Calls callback 'core_calendar_provide_event_action' from the component responsible for the event
If no callback is present or callback returns null, there is no action on the event
and it will not be displayed on the dashboard.
@param event_interface $event
@return action_event|event_interface | [
"Calls",
"callback",
"core_calendar_provide_event_action",
"from",
"the",
"component",
"responsible",
"for",
"the",
"event"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/local/event/container.php#L277-L310 |
213,401 | moodle/moodle | calendar/classes/local/event/container.php | container.apply_component_is_event_visible | public static function apply_component_is_event_visible(event_interface $event) {
$mapper = self::$eventmapper;
$eventvisible = null;
if ($event->get_course_module()) {
$requestinguserid = self::get_requesting_user();
$legacyevent = $mapper->from_event_to_legacy_event($ev... | php | public static function apply_component_is_event_visible(event_interface $event) {
$mapper = self::$eventmapper;
$eventvisible = null;
if ($event->get_course_module()) {
$requestinguserid = self::get_requesting_user();
$legacyevent = $mapper->from_event_to_legacy_event($ev... | [
"public",
"static",
"function",
"apply_component_is_event_visible",
"(",
"event_interface",
"$",
"event",
")",
"{",
"$",
"mapper",
"=",
"self",
"::",
"$",
"eventmapper",
";",
"$",
"eventvisible",
"=",
"null",
";",
"if",
"(",
"$",
"event",
"->",
"get_course_mod... | Calls callback 'core_calendar_is_event_visible' from the component responsible for the event
The visibility callback is optional, if not present it is assumed as visible.
If it is an actionable event but the get_item_count() returns 0 the visibility
is set to false.
@param event_interface $event
@return bool | [
"Calls",
"callback",
"core_calendar_is_event_visible",
"from",
"the",
"component",
"responsible",
"for",
"the",
"event"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/local/event/container.php#L322-L356 |
213,402 | moodle/moodle | lib/lessphp/Visitor/toCSS.php | Less_Visitor_toCSS.visitRulesetRoot | private function visitRulesetRoot( $rulesetNode ){
$rulesetNode->accept( $this );
if( $rulesetNode->firstRoot || $rulesetNode->rules ){
return $rulesetNode;
}
return array();
} | php | private function visitRulesetRoot( $rulesetNode ){
$rulesetNode->accept( $this );
if( $rulesetNode->firstRoot || $rulesetNode->rules ){
return $rulesetNode;
}
return array();
} | [
"private",
"function",
"visitRulesetRoot",
"(",
"$",
"rulesetNode",
")",
"{",
"$",
"rulesetNode",
"->",
"accept",
"(",
"$",
"this",
")",
";",
"if",
"(",
"$",
"rulesetNode",
"->",
"firstRoot",
"||",
"$",
"rulesetNode",
"->",
"rules",
")",
"{",
"return",
"... | Helper function for visitiRuleset
return array|Less_Tree_Ruleset | [
"Helper",
"function",
"for",
"visitiRuleset"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/lessphp/Visitor/toCSS.php#L162-L168 |
213,403 | moodle/moodle | message/classes/output/preferences/notification_list_processor.php | notification_list_processor.is_preference_enabled | private function is_preference_enabled($name) {
$processor = $this->processor;
$preferences = $this->preferences;
$defaultpreferences = get_message_output_default_preferences();
$checked = false;
// See if user has touched this preference.
if (isset($preferences->{$name}... | php | private function is_preference_enabled($name) {
$processor = $this->processor;
$preferences = $this->preferences;
$defaultpreferences = get_message_output_default_preferences();
$checked = false;
// See if user has touched this preference.
if (isset($preferences->{$name}... | [
"private",
"function",
"is_preference_enabled",
"(",
"$",
"name",
")",
"{",
"$",
"processor",
"=",
"$",
"this",
"->",
"processor",
";",
"$",
"preferences",
"=",
"$",
"this",
"->",
"preferences",
";",
"$",
"defaultpreferences",
"=",
"get_message_output_default_pr... | Check if the given preference is enabled or not.
@param string $name preference name
@return bool | [
"Check",
"if",
"the",
"given",
"preference",
"is",
"enabled",
"or",
"not",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/message/classes/output/preferences/notification_list_processor.php#L86-L105 |
213,404 | moodle/moodle | tag/classes/renderer.php | core_tag_renderer.tag_search_page | public function tag_search_page($query = '', $tagcollid = 0) {
$rv = $this->output->heading(get_string('searchtags', 'tag'), 2);
$searchbox = $this->search_form($query, $tagcollid);
$rv .= html_writer::div($searchbox, '', array('id' => 'tag-search-box'));
$tagcloud = core_tag_collectio... | php | public function tag_search_page($query = '', $tagcollid = 0) {
$rv = $this->output->heading(get_string('searchtags', 'tag'), 2);
$searchbox = $this->search_form($query, $tagcollid);
$rv .= html_writer::div($searchbox, '', array('id' => 'tag-search-box'));
$tagcloud = core_tag_collectio... | [
"public",
"function",
"tag_search_page",
"(",
"$",
"query",
"=",
"''",
",",
"$",
"tagcollid",
"=",
"0",
")",
"{",
"$",
"rv",
"=",
"$",
"this",
"->",
"output",
"->",
"heading",
"(",
"get_string",
"(",
"'searchtags'",
",",
"'tag'",
")",
",",
"2",
")",
... | Renders the tag search page
@param string $query
@param int $tagcollid
@return string | [
"Renders",
"the",
"tag",
"search",
"page"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/renderer.php#L43-L60 |
213,405 | moodle/moodle | tag/classes/renderer.php | core_tag_renderer.tag_index_page | public function tag_index_page($tag, $entities, $tagareaid, $exclusivemode, $fromctx, $ctx, $rec, $page) {
global $CFG, $OUTPUT;
$this->page->requires->js_call_amd('core/tag', 'initTagindexPage');
$tagname = $tag->get_display_name();
$systemcontext = context_system::instance();
... | php | public function tag_index_page($tag, $entities, $tagareaid, $exclusivemode, $fromctx, $ctx, $rec, $page) {
global $CFG, $OUTPUT;
$this->page->requires->js_call_amd('core/tag', 'initTagindexPage');
$tagname = $tag->get_display_name();
$systemcontext = context_system::instance();
... | [
"public",
"function",
"tag_index_page",
"(",
"$",
"tag",
",",
"$",
"entities",
",",
"$",
"tagareaid",
",",
"$",
"exclusivemode",
",",
"$",
"fromctx",
",",
"$",
"ctx",
",",
"$",
"rec",
",",
"$",
"page",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"OUT... | Renders the tag index page
@param core_tag_tag $tag
@param \core_tag\output\tagindex[] $entities
@param int $tagareaid
@param bool $exclusivemode if set to true it means that no other entities tagged with this tag
are displayed on the page and the per-page limit may be bigger
@param int $fromctx context id where the l... | [
"Renders",
"the",
"tag",
"index",
"page"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/renderer.php#L77-L141 |
213,406 | moodle/moodle | tag/classes/renderer.php | core_tag_renderer.tag_links | protected function tag_links($tag) {
if ($links = $tag->get_links()) {
$content = '<ul class="inline-list"><li>' . implode('</li> <li>', $links) . '</li></ul>';
return html_writer::div($content, 'tag-management-box');
}
return '';
} | php | protected function tag_links($tag) {
if ($links = $tag->get_links()) {
$content = '<ul class="inline-list"><li>' . implode('</li> <li>', $links) . '</li></ul>';
return html_writer::div($content, 'tag-management-box');
}
return '';
} | [
"protected",
"function",
"tag_links",
"(",
"$",
"tag",
")",
"{",
"if",
"(",
"$",
"links",
"=",
"$",
"tag",
"->",
"get_links",
"(",
")",
")",
"{",
"$",
"content",
"=",
"'<ul class=\"inline-list\"><li>'",
".",
"implode",
"(",
"'</li> <li>'",
",",
"$",
"lin... | Prints a box that contains the management links of a tag
@param core_tag_tag $tag
@return string | [
"Prints",
"a",
"box",
"that",
"contains",
"the",
"management",
"links",
"of",
"a",
"tag"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/renderer.php#L149-L155 |
213,407 | moodle/moodle | tag/classes/renderer.php | core_tag_renderer.search_form | protected function search_form($query = '', $tagcollid = 0) {
$searchurl = new moodle_url('/tag/search.php');
$output = '<form action="' . $searchurl . '">';
$output .= '<label class="accesshide" for="searchform_query">' . get_string('searchtags', 'tag') . '</label>';
$output .= '<input ... | php | protected function search_form($query = '', $tagcollid = 0) {
$searchurl = new moodle_url('/tag/search.php');
$output = '<form action="' . $searchurl . '">';
$output .= '<label class="accesshide" for="searchform_query">' . get_string('searchtags', 'tag') . '</label>';
$output .= '<input ... | [
"protected",
"function",
"search_form",
"(",
"$",
"query",
"=",
"''",
",",
"$",
"tagcollid",
"=",
"0",
")",
"{",
"$",
"searchurl",
"=",
"new",
"moodle_url",
"(",
"'/tag/search.php'",
")",
";",
"$",
"output",
"=",
"'<form action=\"'",
".",
"$",
"searchurl",... | Prints the tag search box
@param string $query last search string
@param int $tagcollid last selected tag collection id
@return string | [
"Prints",
"the",
"tag",
"search",
"box"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/tag/classes/renderer.php#L164-L178 |
213,408 | moodle/moodle | lib/mlbackend/php/phpml/src/Phpml/Helper/Optimizer/Optimizer.php | Optimizer.setInitialTheta | public function setInitialTheta(array $theta)
{
if (count($theta) != $this->dimensions) {
throw new \Exception("Number of values in the weights array should be $this->dimensions");
}
$this->theta = $theta;
return $this;
} | php | public function setInitialTheta(array $theta)
{
if (count($theta) != $this->dimensions) {
throw new \Exception("Number of values in the weights array should be $this->dimensions");
}
$this->theta = $theta;
return $this;
} | [
"public",
"function",
"setInitialTheta",
"(",
"array",
"$",
"theta",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"theta",
")",
"!=",
"$",
"this",
"->",
"dimensions",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Number of values in the weights array should ... | Sets the weights manually
@param array $theta
@return $this
@throws \Exception | [
"Sets",
"the",
"weights",
"manually"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/phpml/src/Phpml/Helper/Optimizer/Optimizer.php#L48-L57 |
213,409 | moodle/moodle | lib/classes/oauth2/client.php | client.get_additional_login_parameters | public function get_additional_login_parameters() {
$params = '';
if ($this->system) {
if (!empty($this->issuer->get('loginparamsoffline'))) {
$params = $this->issuer->get('loginparamsoffline');
}
} else {
if (!empty($this->issuer->get('loginpa... | php | public function get_additional_login_parameters() {
$params = '';
if ($this->system) {
if (!empty($this->issuer->get('loginparamsoffline'))) {
$params = $this->issuer->get('loginparamsoffline');
}
} else {
if (!empty($this->issuer->get('loginpa... | [
"public",
"function",
"get_additional_login_parameters",
"(",
")",
"{",
"$",
"params",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"system",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"issuer",
"->",
"get",
"(",
"'loginparamsoffline'",
... | Override to append additional params to a authentication request.
@return array (name value pairs). | [
"Override",
"to",
"append",
"additional",
"params",
"to",
"a",
"authentication",
"request",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/client.php#L99-L116 |
213,410 | moodle/moodle | lib/classes/oauth2/client.php | client.store_token | protected function store_token($token) {
if (!$this->system) {
parent::store_token($token);
return;
}
$this->accesstoken = $token;
// Create or update a DB record with the new token.
$persistedtoken = access_token::get_record(['issuerid' => $this->issuer... | php | protected function store_token($token) {
if (!$this->system) {
parent::store_token($token);
return;
}
$this->accesstoken = $token;
// Create or update a DB record with the new token.
$persistedtoken = access_token::get_record(['issuerid' => $this->issuer... | [
"protected",
"function",
"store_token",
"(",
"$",
"token",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"system",
")",
"{",
"parent",
"::",
"store_token",
"(",
"$",
"token",
")",
";",
"return",
";",
"}",
"$",
"this",
"->",
"accesstoken",
"=",
"$",
... | Store a token between requests. Uses session named by get_tokenname for user account tokens
and a database record for system account tokens.
@param stdClass|null $token token object to store or null to clear | [
"Store",
"a",
"token",
"between",
"requests",
".",
"Uses",
"session",
"named",
"by",
"get_tokenname",
"for",
"user",
"account",
"tokens",
"and",
"a",
"database",
"record",
"for",
"system",
"account",
"tokens",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/client.php#L161-L192 |
213,411 | moodle/moodle | lib/classes/oauth2/client.php | client.get_userinfo_mapping | protected function get_userinfo_mapping() {
$fields = user_field_mapping::get_records(['issuerid' => $this->issuer->get('id')]);
$map = [];
foreach ($fields as $field) {
$map[$field->get('externalfield')] = $field->get('internalfield');
}
return $map;
} | php | protected function get_userinfo_mapping() {
$fields = user_field_mapping::get_records(['issuerid' => $this->issuer->get('id')]);
$map = [];
foreach ($fields as $field) {
$map[$field->get('externalfield')] = $field->get('internalfield');
}
return $map;
} | [
"protected",
"function",
"get_userinfo_mapping",
"(",
")",
"{",
"$",
"fields",
"=",
"user_field_mapping",
"::",
"get_records",
"(",
"[",
"'issuerid'",
"=>",
"$",
"this",
"->",
"issuer",
"->",
"get",
"(",
"'id'",
")",
"]",
")",
";",
"$",
"map",
"=",
"[",
... | Get a list of the mapping user fields in an associative array.
@return array | [
"Get",
"a",
"list",
"of",
"the",
"mapping",
"user",
"fields",
"in",
"an",
"associative",
"array",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/client.php#L216-L224 |
213,412 | moodle/moodle | lib/classes/oauth2/client.php | client.upgrade_refresh_token | public function upgrade_refresh_token(system_account $systemaccount) {
$refreshtoken = $systemaccount->get('refreshtoken');
$params = array('refresh_token' => $refreshtoken,
'grant_type' => 'refresh_token'
);
if ($this->basicauth) {
$idsecret = urlencode($this->... | php | public function upgrade_refresh_token(system_account $systemaccount) {
$refreshtoken = $systemaccount->get('refreshtoken');
$params = array('refresh_token' => $refreshtoken,
'grant_type' => 'refresh_token'
);
if ($this->basicauth) {
$idsecret = urlencode($this->... | [
"public",
"function",
"upgrade_refresh_token",
"(",
"system_account",
"$",
"systemaccount",
")",
"{",
"$",
"refreshtoken",
"=",
"$",
"systemaccount",
"->",
"get",
"(",
"'refreshtoken'",
")",
";",
"$",
"params",
"=",
"array",
"(",
"'refresh_token'",
"=>",
"$",
... | Upgrade a refresh token from oauth 2.0 to an access token
@param \core\oauth2\system_account $systemaccount
@return boolean true if token is upgraded succesfully
@throws moodle_exception Request for token upgrade failed for technical reasons | [
"Upgrade",
"a",
"refresh",
"token",
"from",
"oauth",
"2",
".",
"0",
"to",
"an",
"access",
"token"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/client.php#L233-L287 |
213,413 | moodle/moodle | lib/classes/oauth2/client.php | client.get_userinfo | public function get_userinfo() {
$url = $this->get_issuer()->get_endpoint_url('userinfo');
$response = $this->get($url);
if (!$response) {
return false;
}
$userinfo = new stdClass();
try {
$userinfo = json_decode($response);
} catch (\Excep... | php | public function get_userinfo() {
$url = $this->get_issuer()->get_endpoint_url('userinfo');
$response = $this->get($url);
if (!$response) {
return false;
}
$userinfo = new stdClass();
try {
$userinfo = json_decode($response);
} catch (\Excep... | [
"public",
"function",
"get_userinfo",
"(",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"get_issuer",
"(",
")",
"->",
"get_endpoint_url",
"(",
"'userinfo'",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"url",
")",
";",
"if",
... | Fetch the user info from the user info endpoint and map all
the fields back into moodle fields.
@return array|false Moodle user fields for the logged in user (or false if request failed) | [
"Fetch",
"the",
"user",
"info",
"from",
"the",
"user",
"info",
"endpoint",
"and",
"map",
"all",
"the",
"fields",
"back",
"into",
"moodle",
"fields",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/oauth2/client.php#L295-L358 |
213,414 | moodle/moodle | lib/horde/framework/Horde/Mime/Mdn.php | Horde_Mime_Mdn.userConfirmationNeeded | public function userConfirmationNeeded()
{
$return_path = $this->_headers['Return-Path'];
/* RFC 3798 [2.1]: Explicit confirmation is needed if there is no
* Return-Path in the header. Also, "if the message contains more
* than one Return-Path header, the implementation may [] tre... | php | public function userConfirmationNeeded()
{
$return_path = $this->_headers['Return-Path'];
/* RFC 3798 [2.1]: Explicit confirmation is needed if there is no
* Return-Path in the header. Also, "if the message contains more
* than one Return-Path header, the implementation may [] tre... | [
"public",
"function",
"userConfirmationNeeded",
"(",
")",
"{",
"$",
"return_path",
"=",
"$",
"this",
"->",
"_headers",
"[",
"'Return-Path'",
"]",
";",
"/* RFC 3798 [2.1]: Explicit confirmation is needed if there is no\n * Return-Path in the header. Also, \"if the message co... | Is user input required to send the MDN?
Explicit confirmation is needed in some cases to prevent mail loops
and the use of MDNs for mail bombing.
@return boolean Is explicit user input required to send the MDN? | [
"Is",
"user",
"input",
"required",
"to",
"send",
"the",
"MDN?",
"Explicit",
"confirmation",
"is",
"needed",
"in",
"some",
"cases",
"to",
"prevent",
"mail",
"loops",
"and",
"the",
"use",
"of",
"MDNs",
"for",
"mail",
"bombing",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Mdn.php#L74-L112 |
213,415 | moodle/moodle | report/log/classes/renderable.php | report_log_renderable.get_activities_list | public function get_activities_list() {
$activities = array();
// For site just return site errors option.
$sitecontext = context_system::instance();
if ($this->course->id == SITEID && has_capability('report/log:view', $sitecontext)) {
$activities["site_errors"] = get_string... | php | public function get_activities_list() {
$activities = array();
// For site just return site errors option.
$sitecontext = context_system::instance();
if ($this->course->id == SITEID && has_capability('report/log:view', $sitecontext)) {
$activities["site_errors"] = get_string... | [
"public",
"function",
"get_activities_list",
"(",
")",
"{",
"$",
"activities",
"=",
"array",
"(",
")",
";",
"// For site just return site errors option.",
"$",
"sitecontext",
"=",
"context_system",
"::",
"instance",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
... | Helper function to return list of activities to show in selection filter.
@return array list of activities. | [
"Helper",
"function",
"to",
"return",
"list",
"of",
"activities",
"to",
"show",
"in",
"selection",
"filter",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/log/classes/renderable.php#L191-L232 |
213,416 | moodle/moodle | report/log/classes/renderable.php | report_log_renderable.get_selected_group | public function get_selected_group() {
global $SESSION, $USER;
// No groups for system.
if (empty($this->course)) {
return 0;
}
$context = context_course::instance($this->course->id);
$selectedgroup = 0;
// Setup for group handling.
$groupmo... | php | public function get_selected_group() {
global $SESSION, $USER;
// No groups for system.
if (empty($this->course)) {
return 0;
}
$context = context_course::instance($this->course->id);
$selectedgroup = 0;
// Setup for group handling.
$groupmo... | [
"public",
"function",
"get_selected_group",
"(",
")",
"{",
"global",
"$",
"SESSION",
",",
"$",
"USER",
";",
"// No groups for system.",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"course",
")",
")",
"{",
"return",
"0",
";",
"}",
"$",
"context",
"=",
"... | Helper function to get selected group.
@return int selected group. | [
"Helper",
"function",
"to",
"get",
"selected",
"group",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/log/classes/renderable.php#L239-L275 |
213,417 | moodle/moodle | report/log/classes/renderable.php | report_log_renderable.get_course_list | public function get_course_list() {
global $DB, $SITE;
$courses = array();
$sitecontext = context_system::instance();
// First check to see if we can override showcourses and showusers.
$numcourses = $DB->count_records("course");
if ($numcourses < COURSE_MAX_COURSES_PER... | php | public function get_course_list() {
global $DB, $SITE;
$courses = array();
$sitecontext = context_system::instance();
// First check to see if we can override showcourses and showusers.
$numcourses = $DB->count_records("course");
if ($numcourses < COURSE_MAX_COURSES_PER... | [
"public",
"function",
"get_course_list",
"(",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"SITE",
";",
"$",
"courses",
"=",
"array",
"(",
")",
";",
"$",
"sitecontext",
"=",
"context_system",
"::",
"instance",
"(",
")",
";",
"// First check to see if we can over... | Return list of courses to show in selector.
@return array list of courses. | [
"Return",
"list",
"of",
"courses",
"to",
"show",
"in",
"selector",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/log/classes/renderable.php#L309-L335 |
213,418 | moodle/moodle | report/log/classes/renderable.php | report_log_renderable.get_group_list | public function get_group_list() {
// No groups for system.
if (empty($this->course)) {
return array();
}
$context = context_course::instance($this->course->id);
$groups = array();
$groupmode = groups_get_course_groupmode($this->course);
if (($groupm... | php | public function get_group_list() {
// No groups for system.
if (empty($this->course)) {
return array();
}
$context = context_course::instance($this->course->id);
$groups = array();
$groupmode = groups_get_course_groupmode($this->course);
if (($groupm... | [
"public",
"function",
"get_group_list",
"(",
")",
"{",
"// No groups for system.",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"course",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"context",
"=",
"context_course",
"::",
"instance",
"(",
"... | Return list of groups.
@return array list of groups. | [
"Return",
"list",
"of",
"groups",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/log/classes/renderable.php#L342-L362 |
213,419 | moodle/moodle | report/log/classes/renderable.php | report_log_renderable.get_user_list | public function get_user_list() {
global $CFG, $SITE;
$courseid = $SITE->id;
if (!empty($this->course)) {
$courseid = $this->course->id;
}
$context = context_course::instance($courseid);
$limitfrom = empty($this->showusers) ? 0 : '';
$limitnum = empt... | php | public function get_user_list() {
global $CFG, $SITE;
$courseid = $SITE->id;
if (!empty($this->course)) {
$courseid = $this->course->id;
}
$context = context_course::instance($courseid);
$limitfrom = empty($this->showusers) ? 0 : '';
$limitnum = empt... | [
"public",
"function",
"get_user_list",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"SITE",
";",
"$",
"courseid",
"=",
"$",
"SITE",
"->",
"id",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"course",
")",
")",
"{",
"$",
"courseid",
"=",... | Return list of users.
@return array list of users. | [
"Return",
"list",
"of",
"users",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/log/classes/renderable.php#L369-L396 |
213,420 | moodle/moodle | report/log/classes/renderable.php | report_log_renderable.get_date_options | public function get_date_options() {
global $SITE;
$strftimedate = get_string("strftimedate");
$strftimedaydate = get_string("strftimedaydate");
// Get all the possible dates.
// Note that we are keeping track of real (GMT) time and user time.
// User time is only used ... | php | public function get_date_options() {
global $SITE;
$strftimedate = get_string("strftimedate");
$strftimedaydate = get_string("strftimedaydate");
// Get all the possible dates.
// Note that we are keeping track of real (GMT) time and user time.
// User time is only used ... | [
"public",
"function",
"get_date_options",
"(",
")",
"{",
"global",
"$",
"SITE",
";",
"$",
"strftimedate",
"=",
"get_string",
"(",
"\"strftimedate\"",
")",
";",
"$",
"strftimedaydate",
"=",
"get_string",
"(",
"\"strftimedaydate\"",
")",
";",
"// Get all the possibl... | Return list of date options.
@return array date options. | [
"Return",
"list",
"of",
"date",
"options",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/log/classes/renderable.php#L403-L437 |
213,421 | moodle/moodle | report/log/classes/renderable.php | report_log_renderable.get_origin_options | public function get_origin_options() {
$ret = array();
$ret[''] = get_string('allsources', 'report_log');
$ret['cli'] = get_string('cli', 'report_log');
$ret['restore'] = get_string('restore', 'report_log');
$ret['web'] = get_string('web', 'report_log');
$ret['ws'] = get_... | php | public function get_origin_options() {
$ret = array();
$ret[''] = get_string('allsources', 'report_log');
$ret['cli'] = get_string('cli', 'report_log');
$ret['restore'] = get_string('restore', 'report_log');
$ret['web'] = get_string('web', 'report_log');
$ret['ws'] = get_... | [
"public",
"function",
"get_origin_options",
"(",
")",
"{",
"$",
"ret",
"=",
"array",
"(",
")",
";",
"$",
"ret",
"[",
"''",
"]",
"=",
"get_string",
"(",
"'allsources'",
",",
"'report_log'",
")",
";",
"$",
"ret",
"[",
"'cli'",
"]",
"=",
"get_string",
"... | Return list of components to show in selector.
@return array list of origins. | [
"Return",
"list",
"of",
"components",
"to",
"show",
"in",
"selector",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/log/classes/renderable.php#L444-L453 |
213,422 | moodle/moodle | report/log/classes/renderable.php | report_log_renderable.download | public function download() {
$filename = 'logs_' . userdate(time(), get_string('backupnameformat', 'langconfig'), 99, false);
if ($this->course->id !== SITEID) {
$courseshortname = format_string($this->course->shortname, true,
array('context' => context_course::instance($... | php | public function download() {
$filename = 'logs_' . userdate(time(), get_string('backupnameformat', 'langconfig'), 99, false);
if ($this->course->id !== SITEID) {
$courseshortname = format_string($this->course->shortname, true,
array('context' => context_course::instance($... | [
"public",
"function",
"download",
"(",
")",
"{",
"$",
"filename",
"=",
"'logs_'",
".",
"userdate",
"(",
"time",
"(",
")",
",",
"get_string",
"(",
"'backupnameformat'",
",",
"'langconfig'",
")",
",",
"99",
",",
"false",
")",
";",
"if",
"(",
"$",
"this",... | Download logs in specified format. | [
"Download",
"logs",
"in",
"specified",
"format",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/report/log/classes/renderable.php#L508-L518 |
213,423 | moodle/moodle | lib/simplepie/library/SimplePie/Item.php | SimplePie_Item.get_item_tags | public function get_item_tags($namespace, $tag)
{
if (isset($this->data['child'][$namespace][$tag]))
{
return $this->data['child'][$namespace][$tag];
}
else
{
return null;
}
} | php | public function get_item_tags($namespace, $tag)
{
if (isset($this->data['child'][$namespace][$tag]))
{
return $this->data['child'][$namespace][$tag];
}
else
{
return null;
}
} | [
"public",
"function",
"get_item_tags",
"(",
"$",
"namespace",
",",
"$",
"tag",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'child'",
"]",
"[",
"$",
"namespace",
"]",
"[",
"$",
"tag",
"]",
")",
")",
"{",
"return",
"$",
"thi... | Get data for an item-level element
This method allows you to get access to ANY element/attribute that is a
sub-element of the item/entry tag.
See {@see SimplePie::get_feed_tags()} for a description of the return value
@since 1.0
@see http://simplepie.org/wiki/faq/supported_xml_namespaces
@param string $namespace The... | [
"Get",
"data",
"for",
"an",
"item",
"-",
"level",
"element"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Item.php#L144-L154 |
213,424 | moodle/moodle | lib/simplepie/library/SimplePie/Item.php | SimplePie_Item.get_title | public function get_title()
{
if (!isset($this->data['title']))
{
if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
{
$this->data['title'] = $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($... | php | public function get_title()
{
if (!isset($this->data['title']))
{
if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
{
$this->data['title'] = $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($... | [
"public",
"function",
"get_title",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'title'",
"]",
")",
")",
"{",
"if",
"(",
"$",
"return",
"=",
"$",
"this",
"->",
"get_item_tags",
"(",
"SIMPLEPIE_NAMESPACE_ATOM_10",
",",
... | Get the title of the item
Uses `<atom:title>`, `<title>` or `<dc:title>`
@since Beta 2 (previously called `get_item_title` since 0.8)
@return string|null | [
"Get",
"the",
"title",
"of",
"the",
"item"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Item.php#L262-L300 |
213,425 | moodle/moodle | lib/simplepie/library/SimplePie/Item.php | SimplePie_Item.get_categories | public function get_categories()
{
$categories = array();
$type = 'category';
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, $type) as $category)
{
$term = null;
$scheme = null;
$label = null;
if (isset($category['attribs']['']['term']))
{
$term = $this->sanitize($catego... | php | public function get_categories()
{
$categories = array();
$type = 'category';
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, $type) as $category)
{
$term = null;
$scheme = null;
$label = null;
if (isset($category['attribs']['']['term']))
{
$term = $this->sanitize($catego... | [
"public",
"function",
"get_categories",
"(",
")",
"{",
"$",
"categories",
"=",
"array",
"(",
")",
";",
"$",
"type",
"=",
"'category'",
";",
"foreach",
"(",
"(",
"array",
")",
"$",
"this",
"->",
"get_item_tags",
"(",
"SIMPLEPIE_NAMESPACE_ATOM_10",
",",
"$",... | Get all categories for the item
Uses `<atom:category>`, `<category>` or `<dc:subject>`
@since Beta 3
@return SimplePie_Category[]|null List of {@see SimplePie_Category} objects | [
"Get",
"all",
"categories",
"for",
"the",
"item"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Item.php#L468-L526 |
213,426 | moodle/moodle | lib/simplepie/library/SimplePie/Item.php | SimplePie_Item.get_link | public function get_link($key = 0, $rel = 'alternate')
{
$links = $this->get_links($rel);
if ($links[$key] !== null)
{
return $links[$key];
}
else
{
return null;
}
} | php | public function get_link($key = 0, $rel = 'alternate')
{
$links = $this->get_links($rel);
if ($links[$key] !== null)
{
return $links[$key];
}
else
{
return null;
}
} | [
"public",
"function",
"get_link",
"(",
"$",
"key",
"=",
"0",
",",
"$",
"rel",
"=",
"'alternate'",
")",
"{",
"$",
"links",
"=",
"$",
"this",
"->",
"get_links",
"(",
"$",
"rel",
")",
";",
"if",
"(",
"$",
"links",
"[",
"$",
"key",
"]",
"!==",
"nul... | Get a single link for the item
@since Beta 3
@param int $key The link that you want to return. Remember that arrays begin with 0, not 1
@param string $rel The relationship of the link to return
@return string|null Link URL | [
"Get",
"a",
"single",
"link",
"for",
"the",
"item"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Item.php#L986-L997 |
213,427 | moodle/moodle | lib/simplepie/library/SimplePie/Item.php | SimplePie_Item.get_enclosure | public function get_enclosure($key = 0, $prefer = null)
{
$enclosures = $this->get_enclosures();
if (isset($enclosures[$key]))
{
return $enclosures[$key];
}
else
{
return null;
}
} | php | public function get_enclosure($key = 0, $prefer = null)
{
$enclosures = $this->get_enclosures();
if (isset($enclosures[$key]))
{
return $enclosures[$key];
}
else
{
return null;
}
} | [
"public",
"function",
"get_enclosure",
"(",
"$",
"key",
"=",
"0",
",",
"$",
"prefer",
"=",
"null",
")",
"{",
"$",
"enclosures",
"=",
"$",
"this",
"->",
"get_enclosures",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"enclosures",
"[",
"$",
"key",
"]... | Get an enclosure from the item
Supports the <enclosure> RSS tag, as well as Media RSS and iTunes RSS.
@since Beta 2
@todo Add ability to prefer one type of content over another (in a media group).
@param int $key The enclosure that you want to return. Remember that arrays begin with 0, not 1
@return SimplePie_Enclos... | [
"Get",
"an",
"enclosure",
"from",
"the",
"item"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Item.php#L1092-L1103 |
213,428 | moodle/moodle | mod/forum/classes/local/entities/forum.php | forum.is_discussion_time_locked | public function is_discussion_time_locked(discussion_entity $discussion) : bool {
if (!$this->has_lock_discussions_after()) {
return false;
}
if ($this->get_type() === 'single') {
// It does not make sense to lock a single discussion forum.
return false;
... | php | public function is_discussion_time_locked(discussion_entity $discussion) : bool {
if (!$this->has_lock_discussions_after()) {
return false;
}
if ($this->get_type() === 'single') {
// It does not make sense to lock a single discussion forum.
return false;
... | [
"public",
"function",
"is_discussion_time_locked",
"(",
"discussion_entity",
"$",
"discussion",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has_lock_discussions_after",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
... | Check whether the discussion is locked based on forum's time based locking criteria
@param discussion_entity $discussion
@return bool | [
"Check",
"whether",
"the",
"discussion",
"is",
"locked",
"based",
"on",
"forum",
"s",
"time",
"based",
"locking",
"criteria"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/entities/forum.php#L547-L558 |
213,429 | moodle/moodle | mod/forum/classes/local/entities/forum.php | forum.is_discussion_locked | public function is_discussion_locked(discussion_entity $discussion) : bool {
if ($discussion->is_locked()) {
return true;
}
return $this->is_discussion_time_locked($discussion);
} | php | public function is_discussion_locked(discussion_entity $discussion) : bool {
if ($discussion->is_locked()) {
return true;
}
return $this->is_discussion_time_locked($discussion);
} | [
"public",
"function",
"is_discussion_locked",
"(",
"discussion_entity",
"$",
"discussion",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"discussion",
"->",
"is_locked",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"$",
"this",
"->",
"is_discussion_tim... | Is the discussion locked? - Takes into account both discussion settings AND forum's criteria
@param discussion_entity $discussion The discussion to check
@return bool | [
"Is",
"the",
"discussion",
"locked?",
"-",
"Takes",
"into",
"account",
"both",
"discussion",
"settings",
"AND",
"forum",
"s",
"criteria"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/entities/forum.php#L628-L634 |
213,430 | moodle/moodle | repository/nextcloud/lib.php | repository_nextcloud.get_system_oauth_client | private function get_system_oauth_client() {
if ($this->systemoauthclient === false) {
try {
$this->systemoauthclient = \core\oauth2\api::get_system_oauth_client($this->issuer);
} catch (\moodle_exception $e) {
$this->systemoauthclient = false;
... | php | private function get_system_oauth_client() {
if ($this->systemoauthclient === false) {
try {
$this->systemoauthclient = \core\oauth2\api::get_system_oauth_client($this->issuer);
} catch (\moodle_exception $e) {
$this->systemoauthclient = false;
... | [
"private",
"function",
"get_system_oauth_client",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"systemoauthclient",
"===",
"false",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"systemoauthclient",
"=",
"\\",
"core",
"\\",
"oauth2",
"\\",
"api",
"::",
"get_sys... | Get or initialise an oauth client for the system account.
@return false|oauth2_client False if initialisation was unsuccessful, otherwise an initialised client. | [
"Get",
"or",
"initialise",
"an",
"oauth",
"client",
"for",
"the",
"system",
"account",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/nextcloud/lib.php#L153-L162 |
213,431 | moodle/moodle | repository/nextcloud/lib.php | repository_nextcloud.get_system_ocs_client | private function get_system_ocs_client() {
if ($this->systemocsclient === null) {
try {
$systemoauth = $this->get_system_oauth_client();
if (!$systemoauth) {
return null;
}
$this->systemocsclient = new ocs_client($sy... | php | private function get_system_ocs_client() {
if ($this->systemocsclient === null) {
try {
$systemoauth = $this->get_system_oauth_client();
if (!$systemoauth) {
return null;
}
$this->systemocsclient = new ocs_client($sy... | [
"private",
"function",
"get_system_ocs_client",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"systemocsclient",
"===",
"null",
")",
"{",
"try",
"{",
"$",
"systemoauth",
"=",
"$",
"this",
"->",
"get_system_oauth_client",
"(",
")",
";",
"if",
"(",
"!",
"$"... | Get or initialise an ocs client for the system account.
@return null|ocs_client Null if initialisation was unsuccessful, otherwise an initialised client. | [
"Get",
"or",
"initialise",
"an",
"ocs",
"client",
"for",
"the",
"system",
"account",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/nextcloud/lib.php#L169-L182 |
213,432 | moodle/moodle | repository/nextcloud/lib.php | repository_nextcloud.initiate_webdavclient | private function initiate_webdavclient() {
if ($this->dav !== null) {
return $this->dav;
}
$webdavendpoint = issuer_management::parse_endpoint_url('webdav', $this->issuer);
// Selects the necessary information (port, type, server) from the path to build the webdavclient.
... | php | private function initiate_webdavclient() {
if ($this->dav !== null) {
return $this->dav;
}
$webdavendpoint = issuer_management::parse_endpoint_url('webdav', $this->issuer);
// Selects the necessary information (port, type, server) from the path to build the webdavclient.
... | [
"private",
"function",
"initiate_webdavclient",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"dav",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"dav",
";",
"}",
"$",
"webdavendpoint",
"=",
"issuer_management",
"::",
"parse_endpoint_url",
"(",
"'w... | Initiates the webdav client.
@throws \repository_nextcloud\configuration_exception If configuration is missing (endpoints). | [
"Initiates",
"the",
"webdav",
"client",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/nextcloud/lib.php#L189-L218 |
213,433 | moodle/moodle | repository/nextcloud/lib.php | repository_nextcloud.get_link | public function get_link($url) {
$ocsparams = [
'path' => $url,
'shareType' => ocs_client::SHARE_TYPE_PUBLIC,
'publicUpload' => false,
'permissions' => ocs_client::SHARE_PERMISSION_READ
];
$response = $this->ocsclient->call('create_share', $oc... | php | public function get_link($url) {
$ocsparams = [
'path' => $url,
'shareType' => ocs_client::SHARE_TYPE_PUBLIC,
'publicUpload' => false,
'permissions' => ocs_client::SHARE_PERMISSION_READ
];
$response = $this->ocsclient->call('create_share', $oc... | [
"public",
"function",
"get_link",
"(",
"$",
"url",
")",
"{",
"$",
"ocsparams",
"=",
"[",
"'path'",
"=>",
"$",
"url",
",",
"'shareType'",
"=>",
"ocs_client",
"::",
"SHARE_TYPE_PUBLIC",
",",
"'publicUpload'",
"=>",
"false",
",",
"'permissions'",
"=>",
"ocs_cli... | Use OCS to generate a public share to the requested file.
This method derives a download link from the public share URL.
@param string $url relative path to the chosen file
@return string the generated download link.
@throws \repository_nextcloud\request_exception If nextcloud responded badly | [
"Use",
"OCS",
"to",
"generate",
"a",
"public",
"share",
"to",
"the",
"requested",
"file",
".",
"This",
"method",
"derives",
"a",
"download",
"link",
"from",
"the",
"public",
"share",
"URL",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/nextcloud/lib.php#L293-L316 |
213,434 | moodle/moodle | repository/nextcloud/lib.php | repository_nextcloud.get_user_oauth_client | protected function get_user_oauth_client($overrideurl = false) {
if ($this->client) {
return $this->client;
}
if ($overrideurl) {
$returnurl = $overrideurl;
} else {
$returnurl = new moodle_url('/repository/repository_callback.php');
$retur... | php | protected function get_user_oauth_client($overrideurl = false) {
if ($this->client) {
return $this->client;
}
if ($overrideurl) {
$returnurl = $overrideurl;
} else {
$returnurl = new moodle_url('/repository/repository_callback.php');
$retur... | [
"protected",
"function",
"get_user_oauth_client",
"(",
"$",
"overrideurl",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"client",
")",
"{",
"return",
"$",
"this",
"->",
"client",
";",
"}",
"if",
"(",
"$",
"overrideurl",
")",
"{",
"$",
"returnu... | Get a cached user authenticated oauth client.
@param bool|moodle_url $overrideurl Use this url instead of the repo callback.
@return \core\oauth2\client | [
"Get",
"a",
"cached",
"user",
"authenticated",
"oauth",
"client",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/nextcloud/lib.php#L565-L579 |
213,435 | moodle/moodle | repository/nextcloud/lib.php | repository_nextcloud.print_login | public function print_login() {
$client = $this->get_user_oauth_client();
$loginurl = $client->get_login_url();
if ($this->options['ajax']) {
$ret = array();
$btn = new \stdClass();
$btn->type = 'popup';
$btn->url = $loginurl->out(false);
... | php | public function print_login() {
$client = $this->get_user_oauth_client();
$loginurl = $client->get_login_url();
if ($this->options['ajax']) {
$ret = array();
$btn = new \stdClass();
$btn->type = 'popup';
$btn->url = $loginurl->out(false);
... | [
"public",
"function",
"print_login",
"(",
")",
"{",
"$",
"client",
"=",
"$",
"this",
"->",
"get_user_oauth_client",
"(",
")",
";",
"$",
"loginurl",
"=",
"$",
"client",
"->",
"get_login_url",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"options",
"[",
... | Prints a simple Login Button which redirects to an authorization window from Nextcloud.
@return mixed login window properties.
@throws coding_exception | [
"Prints",
"a",
"simple",
"Login",
"Button",
"which",
"redirects",
"to",
"an",
"authorization",
"window",
"from",
"Nextcloud",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/nextcloud/lib.php#L587-L601 |
213,436 | moodle/moodle | repository/nextcloud/lib.php | repository_nextcloud.instance_config_form | public static function instance_config_form($mform) {
if (!has_capability('moodle/site:config', context_system::instance())) {
$mform->addElement('static', null, '', get_string('nopermissions', 'error', get_string('configplugin',
'repository_nextcloud')));
return false;
... | php | public static function instance_config_form($mform) {
if (!has_capability('moodle/site:config', context_system::instance())) {
$mform->addElement('static', null, '', get_string('nopermissions', 'error', get_string('configplugin',
'repository_nextcloud')));
return false;
... | [
"public",
"static",
"function",
"instance_config_form",
"(",
"$",
"mform",
")",
"{",
"if",
"(",
"!",
"has_capability",
"(",
"'moodle/site:config'",
",",
"context_system",
"::",
"instance",
"(",
")",
")",
")",
"{",
"$",
"mform",
"->",
"addElement",
"(",
"'sta... | This method adds a select form and additional information to the settings form..
@param \moodleform $mform Moodle form (passed by reference)
@return bool|void
@throws coding_exception
@throws dml_exception | [
"This",
"method",
"adds",
"a",
"select",
"form",
"and",
"additional",
"information",
"to",
"the",
"settings",
"form",
".."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/nextcloud/lib.php#L652-L707 |
213,437 | moodle/moodle | repository/nextcloud/lib.php | repository_nextcloud.get_listing_prepare_response | private function get_listing_prepare_response($path) {
$ret = [
// Fetch the list dynamically. An AJAX request is sent to the server as soon as the user opens a folder.
'dynload' => true,
'nosearch' => true, // Disable search.
'nologin' => false, // Provide a logi... | php | private function get_listing_prepare_response($path) {
$ret = [
// Fetch the list dynamically. An AJAX request is sent to the server as soon as the user opens a folder.
'dynload' => true,
'nosearch' => true, // Disable search.
'nologin' => false, // Provide a logi... | [
"private",
"function",
"get_listing_prepare_response",
"(",
"$",
"path",
")",
"{",
"$",
"ret",
"=",
"[",
"// Fetch the list dynamically. An AJAX request is sent to the server as soon as the user opens a folder.",
"'dynload'",
"=>",
"true",
",",
"'nosearch'",
"=>",
"true",
","... | Prepare response of get_listing; namely
- defining setting elements,
- filling in the parent path of the currently-viewed directory.
@param string $path Relative path
@return array ret array for use as get_listing's $ret | [
"Prepare",
"response",
"of",
"get_listing",
";",
"namely",
"-",
"defining",
"setting",
"elements",
"-",
"filling",
"in",
"the",
"parent",
"path",
"of",
"the",
"currently",
"-",
"viewed",
"directory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/nextcloud/lib.php#L856-L888 |
213,438 | moodle/moodle | repository/nextcloud/lib.php | repository_nextcloud.get_reference_details | public function get_reference_details($reference, $filestatus = 0) {
if ($this->disabled) {
throw new repository_exception('cannotdownload', 'repository');
}
if (empty($reference)) {
return get_string('unknownsource', 'repository');
}
$source = json_decode... | php | public function get_reference_details($reference, $filestatus = 0) {
if ($this->disabled) {
throw new repository_exception('cannotdownload', 'repository');
}
if (empty($reference)) {
return get_string('unknownsource', 'repository');
}
$source = json_decode... | [
"public",
"function",
"get_reference_details",
"(",
"$",
"reference",
",",
"$",
"filestatus",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"disabled",
")",
"{",
"throw",
"new",
"repository_exception",
"(",
"'cannotdownload'",
",",
"'repository'",
")",
"... | When a controlled link is clicked in the file picker get the human readable info about this file.
@param string $reference
@param int $filestatus
@return string | [
"When",
"a",
"controlled",
"link",
"is",
"clicked",
"in",
"the",
"file",
"picker",
"get",
"the",
"human",
"readable",
"info",
"about",
"this",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/nextcloud/lib.php#L897-L911 |
213,439 | moodle/moodle | admin/roles/classes/define_role_table_advanced.php | core_role_define_role_table_advanced.force_archetype | public function force_archetype($archetype, array $options) {
$archetypes = get_role_archetypes();
if (!isset($archetypes[$archetype])) {
throw new coding_exception('Unknown archetype: '.$archetype);
}
if ($options['shortname']) {
$this->role->shortname = '';
... | php | public function force_archetype($archetype, array $options) {
$archetypes = get_role_archetypes();
if (!isset($archetypes[$archetype])) {
throw new coding_exception('Unknown archetype: '.$archetype);
}
if ($options['shortname']) {
$this->role->shortname = '';
... | [
"public",
"function",
"force_archetype",
"(",
"$",
"archetype",
",",
"array",
"$",
"options",
")",
"{",
"$",
"archetypes",
"=",
"get_role_archetypes",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"archetypes",
"[",
"$",
"archetype",
"]",
")",
")",
... | Change the role definition to match given archetype.
@param string $archetype
@param array $options array with following keys:
'name', 'shortname', 'description', 'permissions', 'archetype',
'contextlevels', 'allowassign', 'allowoverride', 'allowswitch',
'allowview' | [
"Change",
"the",
"role",
"definition",
"to",
"match",
"given",
"archetype",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/roles/classes/define_role_table_advanced.php#L302-L355 |
213,440 | moodle/moodle | admin/roles/classes/define_role_table_advanced.php | core_role_define_role_table_advanced.force_preset | public function force_preset($xml, array $options) {
if (!$info = core_role_preset::parse_preset($xml)) {
throw new coding_exception('Invalid role preset');
}
if ($options['shortname']) {
if (isset($info['shortname'])) {
$this->role->shortname = $info['sh... | php | public function force_preset($xml, array $options) {
if (!$info = core_role_preset::parse_preset($xml)) {
throw new coding_exception('Invalid role preset');
}
if ($options['shortname']) {
if (isset($info['shortname'])) {
$this->role->shortname = $info['sh... | [
"public",
"function",
"force_preset",
"(",
"$",
"xml",
",",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"$",
"info",
"=",
"core_role_preset",
"::",
"parse_preset",
"(",
"$",
"xml",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'Invalid ... | Change the role definition to match given preset.
@param string $xml
@param array $options array with following keys:
'name', 'shortname', 'description', 'permissions', 'archetype',
'contextlevels', 'allowassign', 'allowoverride', 'allowswitch',
'allowview' | [
"Change",
"the",
"role",
"definition",
"to",
"match",
"given",
"preset",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/roles/classes/define_role_table_advanced.php#L366-L418 |
213,441 | moodle/moodle | admin/roles/classes/define_role_table_advanced.php | core_role_define_role_table_advanced.get_allow_roles_list | protected function get_allow_roles_list($type, $roleid = null) {
global $DB;
if ($type !== 'assign' and $type !== 'switch' and $type !== 'override' and $type !== 'view') {
debugging('Invalid role allowed type specified', DEBUG_DEVELOPER);
return array();
}
if ($... | php | protected function get_allow_roles_list($type, $roleid = null) {
global $DB;
if ($type !== 'assign' and $type !== 'switch' and $type !== 'override' and $type !== 'view') {
debugging('Invalid role allowed type specified', DEBUG_DEVELOPER);
return array();
}
if ($... | [
"protected",
"function",
"get_allow_roles_list",
"(",
"$",
"type",
",",
"$",
"roleid",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"$",
"type",
"!==",
"'assign'",
"and",
"$",
"type",
"!==",
"'switch'",
"and",
"$",
"type",
"!==",
"'overr... | Returns an array of roles of the allowed type.
@param string $type Must be one of: assign, switch, or override.
@param int $roleid (null means current role)
@return array | [
"Returns",
"an",
"array",
"of",
"roles",
"of",
"the",
"allowed",
"type",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/roles/classes/define_role_table_advanced.php#L546-L568 |
213,442 | moodle/moodle | admin/roles/classes/define_role_table_advanced.php | core_role_define_role_table_advanced.get_allow_role_control | protected function get_allow_role_control($type) {
if ($type !== 'assign' and $type !== 'switch' and $type !== 'override' and $type !== 'view') {
debugging('Invalid role allowed type specified', DEBUG_DEVELOPER);
return '';
}
$property = 'allow'.$type;
$selected ... | php | protected function get_allow_role_control($type) {
if ($type !== 'assign' and $type !== 'switch' and $type !== 'override' and $type !== 'view') {
debugging('Invalid role allowed type specified', DEBUG_DEVELOPER);
return '';
}
$property = 'allow'.$type;
$selected ... | [
"protected",
"function",
"get_allow_role_control",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"type",
"!==",
"'assign'",
"and",
"$",
"type",
"!==",
"'switch'",
"and",
"$",
"type",
"!==",
"'override'",
"and",
"$",
"type",
"!==",
"'view'",
")",
"{",
"debu... | Returns an array of roles with the allowed type.
@param string $type Must be one of: assign, switch, override or view.
@return array Am array of role names with the allowed type | [
"Returns",
"an",
"array",
"of",
"roles",
"with",
"the",
"allowed",
"type",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/roles/classes/define_role_table_advanced.php#L576-L594 |
213,443 | moodle/moodle | admin/roles/classes/define_role_table_advanced.php | core_role_define_role_table_advanced.print_field | protected function print_field($name, $caption, $field, $helpicon = null) {
global $OUTPUT;
// Attempt to generate HTML like formslib.
echo '<div class="fitem row form-group">';
echo '<div class="fitemtitle col-md-3">';
if ($name) {
echo '<label for="' . $name . '">';... | php | protected function print_field($name, $caption, $field, $helpicon = null) {
global $OUTPUT;
// Attempt to generate HTML like formslib.
echo '<div class="fitem row form-group">';
echo '<div class="fitemtitle col-md-3">';
if ($name) {
echo '<label for="' . $name . '">';... | [
"protected",
"function",
"print_field",
"(",
"$",
"name",
",",
"$",
"caption",
",",
"$",
"field",
",",
"$",
"helpicon",
"=",
"null",
")",
"{",
"global",
"$",
"OUTPUT",
";",
"// Attempt to generate HTML like formslib.",
"echo",
"'<div class=\"fitem row form-group\">'... | Print labels, fields and help icon on role administration page.
@param string $name The field name.
@param string $caption The field caption.
@param string $field The field type.
@param null|string $helpicon The help icon content. | [
"Print",
"labels",
"fields",
"and",
"help",
"icon",
"on",
"role",
"administration",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/roles/classes/define_role_table_advanced.php#L613-L641 |
213,444 | moodle/moodle | lib/form/classes/external.php | external.get_filetypes_browser_data_parameters | public static function get_filetypes_browser_data_parameters() {
return new external_function_parameters([
'onlytypes' => new external_value(PARAM_RAW, 'Limit the browser to the given groups and extensions', VALUE_DEFAULT, ''),
'allowall' => new external_value(PARAM_BOOL, 'Allows to sele... | php | public static function get_filetypes_browser_data_parameters() {
return new external_function_parameters([
'onlytypes' => new external_value(PARAM_RAW, 'Limit the browser to the given groups and extensions', VALUE_DEFAULT, ''),
'allowall' => new external_value(PARAM_BOOL, 'Allows to sele... | [
"public",
"static",
"function",
"get_filetypes_browser_data_parameters",
"(",
")",
"{",
"return",
"new",
"external_function_parameters",
"(",
"[",
"'onlytypes'",
"=>",
"new",
"external_value",
"(",
"PARAM_RAW",
",",
"'Limit the browser to the given groups and extensions'",
",... | Describes the input paramaters of the get_filetypes_browser_data external function.
@return external_description | [
"Describes",
"the",
"input",
"paramaters",
"of",
"the",
"get_filetypes_browser_data",
"external",
"function",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/classes/external.php#L53-L60 |
213,445 | moodle/moodle | lib/form/classes/external.php | external.get_filetypes_browser_data | public static function get_filetypes_browser_data($onlytypes, $allowall, $current) {
$params = self::validate_parameters(self::get_filetypes_browser_data_parameters(),
compact('onlytypes', 'allowall', 'current'));
$util = new filetypes_util();
return ['groups' => $util->data_for_b... | php | public static function get_filetypes_browser_data($onlytypes, $allowall, $current) {
$params = self::validate_parameters(self::get_filetypes_browser_data_parameters(),
compact('onlytypes', 'allowall', 'current'));
$util = new filetypes_util();
return ['groups' => $util->data_for_b... | [
"public",
"static",
"function",
"get_filetypes_browser_data",
"(",
"$",
"onlytypes",
",",
"$",
"allowall",
",",
"$",
"current",
")",
"{",
"$",
"params",
"=",
"self",
"::",
"validate_parameters",
"(",
"self",
"::",
"get_filetypes_browser_data_parameters",
"(",
")",... | Implements the get_filetypes_browser_data external function.
@param string $onlytypes Allow selection from these file types only; for example 'web_image'.
@param bool $allowall Allow to select 'All file types'. Does not apply if onlytypes is set.
@param string $current Current values that should be selected.
@return o... | [
"Implements",
"the",
"get_filetypes_browser_data",
"external",
"function",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/classes/external.php#L70-L78 |
213,446 | moodle/moodle | lib/form/classes/external.php | external.get_filetypes_browser_data_returns | public static function get_filetypes_browser_data_returns() {
$type = new external_single_structure([
'key' => new external_value(PARAM_RAW, 'The file type identifier'),
'name' => new external_value(PARAM_RAW, 'The file type name'),
'selected' => new external_value(PARAM_BOO... | php | public static function get_filetypes_browser_data_returns() {
$type = new external_single_structure([
'key' => new external_value(PARAM_RAW, 'The file type identifier'),
'name' => new external_value(PARAM_RAW, 'The file type name'),
'selected' => new external_value(PARAM_BOO... | [
"public",
"static",
"function",
"get_filetypes_browser_data_returns",
"(",
")",
"{",
"$",
"type",
"=",
"new",
"external_single_structure",
"(",
"[",
"'key'",
"=>",
"new",
"external_value",
"(",
"PARAM_RAW",
",",
"'The file type identifier'",
")",
",",
"'name'",
"=>"... | Describes the output of the get_filetypes_browser_data external function.
@return external_description | [
"Describes",
"the",
"output",
"of",
"the",
"get_filetypes_browser_data",
"external",
"function",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/classes/external.php#L85-L107 |
213,447 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.isSelfExtend | protected function isSelfExtend($target, $origin)
{
foreach ($origin as $sel) {
if (in_array($target, $sel)) {
return true;
}
}
return false;
} | php | protected function isSelfExtend($target, $origin)
{
foreach ($origin as $sel) {
if (in_array($target, $sel)) {
return true;
}
}
return false;
} | [
"protected",
"function",
"isSelfExtend",
"(",
"$",
"target",
",",
"$",
"origin",
")",
"{",
"foreach",
"(",
"$",
"origin",
"as",
"$",
"sel",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"target",
",",
"$",
"sel",
")",
")",
"{",
"return",
"true",
";",
... | Is self extend?
@param array $target
@param array $origin
@return boolean | [
"Is",
"self",
"extend?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L266-L275 |
213,448 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.makeOutputBlock | protected function makeOutputBlock($type, $selectors = null)
{
$out = new OutputBlock;
$out->type = $type;
$out->lines = [];
$out->children = [];
$out->parent = $this->scope;
$out->selectors = $selectors;
$out->depth = $this-... | php | protected function makeOutputBlock($type, $selectors = null)
{
$out = new OutputBlock;
$out->type = $type;
$out->lines = [];
$out->children = [];
$out->parent = $this->scope;
$out->selectors = $selectors;
$out->depth = $this-... | [
"protected",
"function",
"makeOutputBlock",
"(",
"$",
"type",
",",
"$",
"selectors",
"=",
"null",
")",
"{",
"$",
"out",
"=",
"new",
"OutputBlock",
";",
"$",
"out",
"->",
"type",
"=",
"$",
"type",
";",
"$",
"out",
"->",
"lines",
"=",
"[",
"]",
";",
... | Make output block
@param string $type
@param array $selectors
@return \Leafo\ScssPhp\Formatter\OutputBlock | [
"Make",
"output",
"block"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L310-L324 |
213,449 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.missingSelectors | protected function missingSelectors()
{
foreach ($this->extends as $extend) {
if (isset($extend[3])) {
continue;
}
list($target, $origin, $block) = $extend;
// ignore if !optional
if ($block[2]) {
continue;
... | php | protected function missingSelectors()
{
foreach ($this->extends as $extend) {
if (isset($extend[3])) {
continue;
}
list($target, $origin, $block) = $extend;
// ignore if !optional
if ($block[2]) {
continue;
... | [
"protected",
"function",
"missingSelectors",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"extends",
"as",
"$",
"extend",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"extend",
"[",
"3",
"]",
")",
")",
"{",
"continue",
";",
"}",
"list",
"(",
"$",
... | Report missing selectors | [
"Report",
"missing",
"selectors"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L343-L363 |
213,450 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.matchExtendsSingle | protected function matchExtendsSingle($rawSingle, &$outOrigin)
{
$counts = [];
$single = [];
foreach ($rawSingle as $part) {
// matches Number
if (! is_string($part)) {
return false;
}
if (! preg_match('/^[\[.:#%]/', $part) &&... | php | protected function matchExtendsSingle($rawSingle, &$outOrigin)
{
$counts = [];
$single = [];
foreach ($rawSingle as $part) {
// matches Number
if (! is_string($part)) {
return false;
}
if (! preg_match('/^[\[.:#%]/', $part) &&... | [
"protected",
"function",
"matchExtendsSingle",
"(",
"$",
"rawSingle",
",",
"&",
"$",
"outOrigin",
")",
"{",
"$",
"counts",
"=",
"[",
"]",
";",
"$",
"single",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"rawSingle",
"as",
"$",
"part",
")",
"{",
"// match... | Match extends single
@param array $rawSingle
@param array $outOrigin
@return boolean | [
"Match",
"extends",
"single"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L520-L597 |
213,451 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.extractRelationshipFromFragment | protected function extractRelationshipFromFragment(array $fragment)
{
$parents = [];
$children = [];
$j = $i = count($fragment);
for (;;) {
$children = $j != $i ? array_slice($fragment, $j, $i - $j) : [];
$parents = array_slice($fragment, 0, $j);
... | php | protected function extractRelationshipFromFragment(array $fragment)
{
$parents = [];
$children = [];
$j = $i = count($fragment);
for (;;) {
$children = $j != $i ? array_slice($fragment, $j, $i - $j) : [];
$parents = array_slice($fragment, 0, $j);
... | [
"protected",
"function",
"extractRelationshipFromFragment",
"(",
"array",
"$",
"fragment",
")",
"{",
"$",
"parents",
"=",
"[",
"]",
";",
"$",
"children",
"=",
"[",
"]",
";",
"$",
"j",
"=",
"$",
"i",
"=",
"count",
"(",
"$",
"fragment",
")",
";",
"for"... | Extract a relationship from the fragment.
When extracting the last portion of a selector we will be left with a
fragment which may end with a direction relationship combinator. This
method will extract the relationship fragment and return it along side
the rest.
@param array $fragment The selector fragment maybe endi... | [
"Extract",
"a",
"relationship",
"from",
"the",
"fragment",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L611-L630 |
213,452 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.combineSelectorSingle | protected function combineSelectorSingle($base, $other)
{
$tag = [];
$out = [];
$wasTag = true;
foreach ([$base, $other] as $single) {
foreach ($single as $part) {
if (preg_match('/^[\[.:#]/', $part)) {
$out[] = $part;
... | php | protected function combineSelectorSingle($base, $other)
{
$tag = [];
$out = [];
$wasTag = true;
foreach ([$base, $other] as $single) {
foreach ($single as $part) {
if (preg_match('/^[\[.:#]/', $part)) {
$out[] = $part;
... | [
"protected",
"function",
"combineSelectorSingle",
"(",
"$",
"base",
",",
"$",
"other",
")",
"{",
"$",
"tag",
"=",
"[",
"]",
";",
"$",
"out",
"=",
"[",
"]",
";",
"$",
"wasTag",
"=",
"true",
";",
"foreach",
"(",
"[",
"$",
"base",
",",
"$",
"other",... | Combine selector single
@param array $base
@param array $other
@return array | [
"Combine",
"selector",
"single"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L640-L667 |
213,453 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.spliceTree | private function spliceTree($envs, Block $block, $without)
{
$newBlock = null;
foreach ($envs as $e) {
if (! isset($e->block)) {
continue;
}
if ($e->block === $block) {
continue;
}
if (isset($e->block->typ... | php | private function spliceTree($envs, Block $block, $without)
{
$newBlock = null;
foreach ($envs as $e) {
if (! isset($e->block)) {
continue;
}
if ($e->block === $block) {
continue;
}
if (isset($e->block->typ... | [
"private",
"function",
"spliceTree",
"(",
"$",
"envs",
",",
"Block",
"$",
"block",
",",
"$",
"without",
")",
"{",
"$",
"newBlock",
"=",
"null",
";",
"foreach",
"(",
"$",
"envs",
"as",
"$",
"e",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"e",
... | Splice parse tree
@param array $envs
@param \Leafo\ScssPhp\Block $block
@param integer $without
@return array | [
"Splice",
"parse",
"tree"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L813-L881 |
213,454 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.filterWithout | private function filterWithout($envs, $without)
{
$filtered = [];
foreach ($envs as $e) {
if ($e->block && $this->isWithout($without, $e->block)) {
continue;
}
$filtered[] = $e;
}
return $this->extractEnv($filtered);
} | php | private function filterWithout($envs, $without)
{
$filtered = [];
foreach ($envs as $e) {
if ($e->block && $this->isWithout($without, $e->block)) {
continue;
}
$filtered[] = $e;
}
return $this->extractEnv($filtered);
} | [
"private",
"function",
"filterWithout",
"(",
"$",
"envs",
",",
"$",
"without",
")",
"{",
"$",
"filtered",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"envs",
"as",
"$",
"e",
")",
"{",
"if",
"(",
"$",
"e",
"->",
"block",
"&&",
"$",
"this",
"->",
"i... | Filter env stack
@param array $envs
@param integer $without
@return \Leafo\ScssPhp\Compiler\Environment | [
"Filter",
"env",
"stack"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L941-L954 |
213,455 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.compileKeyframeBlock | protected function compileKeyframeBlock(Block $block, $selectors)
{
$env = $this->pushEnv($block);
$envs = $this->compactEnv($env);
$this->env = $this->extractEnv(array_filter($envs, function (Environment $e) {
return ! isset($e->block->selectors);
}));
$this->... | php | protected function compileKeyframeBlock(Block $block, $selectors)
{
$env = $this->pushEnv($block);
$envs = $this->compactEnv($env);
$this->env = $this->extractEnv(array_filter($envs, function (Environment $e) {
return ! isset($e->block->selectors);
}));
$this->... | [
"protected",
"function",
"compileKeyframeBlock",
"(",
"Block",
"$",
"block",
",",
"$",
"selectors",
")",
"{",
"$",
"env",
"=",
"$",
"this",
"->",
"pushEnv",
"(",
"$",
"block",
")",
";",
"$",
"envs",
"=",
"$",
"this",
"->",
"compactEnv",
"(",
"$",
"en... | Compile keyframe block
@param \Leafo\ScssPhp\Block $block
@param array $selectors | [
"Compile",
"keyframe",
"block"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L985-L1005 |
213,456 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.compileComment | protected function compileComment($block)
{
$out = $this->makeOutputBlock(Type::T_COMMENT);
$out->lines[] = $block[1];
$this->scope->children[] = $out;
} | php | protected function compileComment($block)
{
$out = $this->makeOutputBlock(Type::T_COMMENT);
$out->lines[] = $block[1];
$this->scope->children[] = $out;
} | [
"protected",
"function",
"compileComment",
"(",
"$",
"block",
")",
"{",
"$",
"out",
"=",
"$",
"this",
"->",
"makeOutputBlock",
"(",
"Type",
"::",
"T_COMMENT",
")",
";",
"$",
"out",
"->",
"lines",
"[",
"]",
"=",
"$",
"block",
"[",
"1",
"]",
";",
"$"... | Compile root level comment
@param array $block | [
"Compile",
"root",
"level",
"comment"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L1094-L1099 |
213,457 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.evalSelectorPart | protected function evalSelectorPart($part)
{
foreach ($part as &$p) {
if (is_array($p) && ($p[0] === Type::T_INTERPOLATE || $p[0] === Type::T_STRING)) {
$p = $this->compileValue($p);
// force re-evaluation
if (strpos($p, '&') !== false || strpos($... | php | protected function evalSelectorPart($part)
{
foreach ($part as &$p) {
if (is_array($p) && ($p[0] === Type::T_INTERPOLATE || $p[0] === Type::T_STRING)) {
$p = $this->compileValue($p);
// force re-evaluation
if (strpos($p, '&') !== false || strpos($... | [
"protected",
"function",
"evalSelectorPart",
"(",
"$",
"part",
")",
"{",
"foreach",
"(",
"$",
"part",
"as",
"&",
"$",
"p",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"p",
")",
"&&",
"(",
"$",
"p",
"[",
"0",
"]",
"===",
"Type",
"::",
"T_INTERPOLAT... | Evaluate selector part; replaces all the interpolates, stripping quotes
@param array $part
@return array | [
"Evaluate",
"selector",
"part",
";",
"replaces",
"all",
"the",
"interpolates",
"stripping",
"quotes"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L1146-L1165 |
213,458 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.compileMediaQuery | protected function compileMediaQuery($queryList)
{
$out = '@media';
$first = true;
foreach ($queryList as $query) {
$type = null;
$parts = [];
foreach ($query as $q) {
switch ($q[0]) {
case Type::T_MEDIA_TYPE:
... | php | protected function compileMediaQuery($queryList)
{
$out = '@media';
$first = true;
foreach ($queryList as $query) {
$type = null;
$parts = [];
foreach ($query as $q) {
switch ($q[0]) {
case Type::T_MEDIA_TYPE:
... | [
"protected",
"function",
"compileMediaQuery",
"(",
"$",
"queryList",
")",
"{",
"$",
"out",
"=",
"'@media'",
";",
"$",
"first",
"=",
"true",
";",
"foreach",
"(",
"$",
"queryList",
"as",
"$",
"query",
")",
"{",
"$",
"type",
"=",
"null",
";",
"$",
"part... | Compile media query
@param array $queryList
@return string | [
"Compile",
"media",
"query"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L1345-L1408 |
213,459 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.mergeMediaTypes | protected function mergeMediaTypes($type1, $type2)
{
if (empty($type1)) {
return $type2;
}
if (empty($type2)) {
return $type1;
}
$m1 = '';
$t1 = '';
if (count($type1) > 1) {
$m1= strtolower($type1[0]);
$t1= st... | php | protected function mergeMediaTypes($type1, $type2)
{
if (empty($type1)) {
return $type2;
}
if (empty($type2)) {
return $type1;
}
$m1 = '';
$t1 = '';
if (count($type1) > 1) {
$m1= strtolower($type1[0]);
$t1= st... | [
"protected",
"function",
"mergeMediaTypes",
"(",
"$",
"type1",
",",
"$",
"type2",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"type1",
")",
")",
"{",
"return",
"$",
"type2",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"type2",
")",
")",
"{",
"return",
"$... | Merge media types
@param array $type1
@param array $type2
@return array|null | [
"Merge",
"media",
"types"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L1449-L1505 |
213,460 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.compileImport | protected function compileImport($rawPath, $out, $once = false)
{
if ($rawPath[0] === Type::T_STRING) {
$path = $this->compileStringContent($rawPath);
if ($path = $this->findImport($path)) {
if (! $once || ! in_array($path, $this->importedFiles)) {
... | php | protected function compileImport($rawPath, $out, $once = false)
{
if ($rawPath[0] === Type::T_STRING) {
$path = $this->compileStringContent($rawPath);
if ($path = $this->findImport($path)) {
if (! $once || ! in_array($path, $this->importedFiles)) {
... | [
"protected",
"function",
"compileImport",
"(",
"$",
"rawPath",
",",
"$",
"out",
",",
"$",
"once",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"rawPath",
"[",
"0",
"]",
"===",
"Type",
"::",
"T_STRING",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"c... | Compile import; returns true if the value was something that could be imported
@param array $rawPath
@param array $out
@param boolean $once
@return boolean | [
"Compile",
"import",
";",
"returns",
"true",
"if",
"the",
"value",
"was",
"something",
"that",
"could",
"be",
"imported"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L1516-L1553 |
213,461 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.expToString | protected function expToString($exp)
{
list(, $op, $left, $right, /* $inParens */, $whiteLeft, $whiteRight) = $exp;
$content = [$this->reduce($left)];
if ($whiteLeft) {
$content[] = ' ';
}
$content[] = $op;
if ($whiteRight) {
$content[] = '... | php | protected function expToString($exp)
{
list(, $op, $left, $right, /* $inParens */, $whiteLeft, $whiteRight) = $exp;
$content = [$this->reduce($left)];
if ($whiteLeft) {
$content[] = ' ';
}
$content[] = $op;
if ($whiteRight) {
$content[] = '... | [
"protected",
"function",
"expToString",
"(",
"$",
"exp",
")",
"{",
"list",
"(",
",",
"$",
"op",
",",
"$",
"left",
",",
"$",
"right",
",",
"/* $inParens */",
",",
"$",
"whiteLeft",
",",
"$",
"whiteRight",
")",
"=",
"$",
"exp",
";",
"$",
"content",
"... | Reduce expression to string
@param array $exp
@return array | [
"Reduce",
"expression",
"to",
"string"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L1943-L1962 |
213,462 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.opNumberColor | protected function opNumberColor($op, $left, $right)
{
$value = $left[1];
return $this->opColorColor(
$op,
[Type::T_COLOR, $value, $value, $value],
$right
);
} | php | protected function opNumberColor($op, $left, $right)
{
$value = $left[1];
return $this->opColorColor(
$op,
[Type::T_COLOR, $value, $value, $value],
$right
);
} | [
"protected",
"function",
"opNumberColor",
"(",
"$",
"op",
",",
"$",
"left",
",",
"$",
"right",
")",
"{",
"$",
"value",
"=",
"$",
"left",
"[",
"1",
"]",
";",
"return",
"$",
"this",
"->",
"opColorColor",
"(",
"$",
"op",
",",
"[",
"Type",
"::",
"T_C... | Compare number and color
@param string $op
@param array $left
@param array $right
@return array | [
"Compare",
"number",
"and",
"color"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L2524-L2533 |
213,463 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.opEq | protected function opEq($left, $right)
{
if (($lStr = $this->coerceString($left)) && ($rStr = $this->coerceString($right))) {
$lStr[1] = '';
$rStr[1] = '';
$left = $this->compileValue($lStr);
$right = $this->compileValue($rStr);
}
return $thi... | php | protected function opEq($left, $right)
{
if (($lStr = $this->coerceString($left)) && ($rStr = $this->coerceString($right))) {
$lStr[1] = '';
$rStr[1] = '';
$left = $this->compileValue($lStr);
$right = $this->compileValue($rStr);
}
return $thi... | [
"protected",
"function",
"opEq",
"(",
"$",
"left",
",",
"$",
"right",
")",
"{",
"if",
"(",
"(",
"$",
"lStr",
"=",
"$",
"this",
"->",
"coerceString",
"(",
"$",
"left",
")",
")",
"&&",
"(",
"$",
"rStr",
"=",
"$",
"this",
"->",
"coerceString",
"(",
... | Compare number1 == number2
@param array $left
@param array $right
@return array | [
"Compare",
"number1",
"==",
"number2"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L2543-L2554 |
213,464 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.opCmpNumberNumber | protected function opCmpNumberNumber($left, $right)
{
$n = $left[1] - $right[1];
return new Node\Number($n ? $n / abs($n) : 0, '');
} | php | protected function opCmpNumberNumber($left, $right)
{
$n = $left[1] - $right[1];
return new Node\Number($n ? $n / abs($n) : 0, '');
} | [
"protected",
"function",
"opCmpNumberNumber",
"(",
"$",
"left",
",",
"$",
"right",
")",
"{",
"$",
"n",
"=",
"$",
"left",
"[",
"1",
"]",
"-",
"$",
"right",
"[",
"1",
"]",
";",
"return",
"new",
"Node",
"\\",
"Number",
"(",
"$",
"n",
"?",
"$",
"n"... | Three-way comparison, aka spaceship operator
@param array $left
@param array $right
@return \Leafo\ScssPhp\Node\Number | [
"Three",
"-",
"way",
"comparison",
"aka",
"spaceship",
"operator"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L2637-L2642 |
213,465 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.extractInterpolation | protected function extractInterpolation($list)
{
$items = $list[2];
foreach ($items as $i => $item) {
if ($item[0] === Type::T_INTERPOLATE) {
$before = [Type::T_LIST, $list[1], array_slice($items, 0, $i)];
$after = [Type::T_LIST, $list[1], array_slice($i... | php | protected function extractInterpolation($list)
{
$items = $list[2];
foreach ($items as $i => $item) {
if ($item[0] === Type::T_INTERPOLATE) {
$before = [Type::T_LIST, $list[1], array_slice($items, 0, $i)];
$after = [Type::T_LIST, $list[1], array_slice($i... | [
"protected",
"function",
"extractInterpolation",
"(",
"$",
"list",
")",
"{",
"$",
"items",
"=",
"$",
"list",
"[",
"2",
"]",
";",
"foreach",
"(",
"$",
"items",
"as",
"$",
"i",
"=>",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"item",
"[",
"0",
"]",
"... | Extract interpolation; it doesn't need to be recursive, compileValue will handle that
@param array $list
@return array | [
"Extract",
"interpolation",
";",
"it",
"doesn",
"t",
"need",
"to",
"be",
"recursive",
"compileValue",
"will",
"handle",
"that"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L2873-L2887 |
213,466 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.compactEnv | private function compactEnv(Environment $env)
{
for ($envs = []; $env; $env = $env->parent) {
$envs[] = $env;
}
return $envs;
} | php | private function compactEnv(Environment $env)
{
for ($envs = []; $env; $env = $env->parent) {
$envs[] = $env;
}
return $envs;
} | [
"private",
"function",
"compactEnv",
"(",
"Environment",
"$",
"env",
")",
"{",
"for",
"(",
"$",
"envs",
"=",
"[",
"]",
";",
"$",
"env",
";",
"$",
"env",
"=",
"$",
"env",
"->",
"parent",
")",
"{",
"$",
"envs",
"[",
"]",
"=",
"$",
"env",
";",
"... | Convert env linked list to stack
@param \Leafo\ScssPhp\Compiler\Environment $env
@return array | [
"Convert",
"env",
"linked",
"list",
"to",
"stack"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L3010-L3017 |
213,467 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.addParsedFile | public function addParsedFile($path)
{
if (isset($path) && file_exists($path)) {
$this->parsedFiles[realpath($path)] = filemtime($path);
}
} | php | public function addParsedFile($path)
{
if (isset($path) && file_exists($path)) {
$this->parsedFiles[realpath($path)] = filemtime($path);
}
} | [
"public",
"function",
"addParsedFile",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"path",
")",
"&&",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"$",
"this",
"->",
"parsedFiles",
"[",
"realpath",
"(",
"$",
"path",
")",
"]",
"=",
... | Adds to list of parsed files
@api
@param string $path | [
"Adds",
"to",
"list",
"of",
"parsed",
"files"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L3278-L3283 |
213,468 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.handleImportLoop | protected function handleImportLoop($name)
{
for ($env = $this->env; $env; $env = $env->parent) {
$file = $this->sourceNames[$env->block->sourceIndex];
if (realpath($file) === $name) {
$this->throwError('An @import loop has been found: %s imports %s', $file, basename... | php | protected function handleImportLoop($name)
{
for ($env = $this->env; $env; $env = $env->parent) {
$file = $this->sourceNames[$env->block->sourceIndex];
if (realpath($file) === $name) {
$this->throwError('An @import loop has been found: %s imports %s', $file, basename... | [
"protected",
"function",
"handleImportLoop",
"(",
"$",
"name",
")",
"{",
"for",
"(",
"$",
"env",
"=",
"$",
"this",
"->",
"env",
";",
"$",
"env",
";",
"$",
"env",
"=",
"$",
"env",
"->",
"parent",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"s... | Handle import loop
@param string $name
@throws \Exception | [
"Handle",
"import",
"loop"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L3556-L3566 |
213,469 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.getBuiltinFunction | protected function getBuiltinFunction($name)
{
$libName = 'lib' . preg_replace_callback(
'/_(.)/',
function ($m) {
return ucfirst($m[1]);
},
ucfirst($name)
);
return [$this, $libName];
} | php | protected function getBuiltinFunction($name)
{
$libName = 'lib' . preg_replace_callback(
'/_(.)/',
function ($m) {
return ucfirst($m[1]);
},
ucfirst($name)
);
return [$this, $libName];
} | [
"protected",
"function",
"getBuiltinFunction",
"(",
"$",
"name",
")",
"{",
"$",
"libName",
"=",
"'lib'",
".",
"preg_replace_callback",
"(",
"'/_(.)/'",
",",
"function",
"(",
"$",
"m",
")",
"{",
"return",
"ucfirst",
"(",
"$",
"m",
"[",
"1",
"]",
")",
";... | Get built-in function
@param string $name Normalized name
@return array | [
"Get",
"built",
"-",
"in",
"function"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L3675-L3686 |
213,470 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.coerceMap | protected function coerceMap($item)
{
if ($item[0] === Type::T_MAP) {
return $item;
}
if ($item === static::$emptyList) {
return static::$emptyMap;
}
return [Type::T_MAP, [$item], [static::$null]];
} | php | protected function coerceMap($item)
{
if ($item[0] === Type::T_MAP) {
return $item;
}
if ($item === static::$emptyList) {
return static::$emptyMap;
}
return [Type::T_MAP, [$item], [static::$null]];
} | [
"protected",
"function",
"coerceMap",
"(",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"item",
"[",
"0",
"]",
"===",
"Type",
"::",
"T_MAP",
")",
"{",
"return",
"$",
"item",
";",
"}",
"if",
"(",
"$",
"item",
"===",
"static",
"::",
"$",
"emptyList",
")"... | Coerce something to map
@param array $item
@return array | [
"Coerce",
"something",
"to",
"map"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L3913-L3924 |
213,471 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.coerceList | protected function coerceList($item, $delim = ',')
{
if (isset($item) && $item[0] === Type::T_LIST) {
return $item;
}
if (isset($item) && $item[0] === Type::T_MAP) {
$keys = $item[1];
$values = $item[2];
$list = [];
for ($i = 0, $... | php | protected function coerceList($item, $delim = ',')
{
if (isset($item) && $item[0] === Type::T_LIST) {
return $item;
}
if (isset($item) && $item[0] === Type::T_MAP) {
$keys = $item[1];
$values = $item[2];
$list = [];
for ($i = 0, $... | [
"protected",
"function",
"coerceList",
"(",
"$",
"item",
",",
"$",
"delim",
"=",
"','",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"item",
")",
"&&",
"$",
"item",
"[",
"0",
"]",
"===",
"Type",
"::",
"T_LIST",
")",
"{",
"return",
"$",
"item",
";",
... | Coerce something to list
@param array $item
@param string $delim
@return array | [
"Coerce",
"something",
"to",
"list"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L3934-L3960 |
213,472 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.coerceColor | protected function coerceColor($value)
{
switch ($value[0]) {
case Type::T_COLOR:
return $value;
case Type::T_KEYWORD:
$name = strtolower($value[1]);
if (isset(Colors::$cssColors[$name])) {
$rgba = explode(',', Col... | php | protected function coerceColor($value)
{
switch ($value[0]) {
case Type::T_COLOR:
return $value;
case Type::T_KEYWORD:
$name = strtolower($value[1]);
if (isset(Colors::$cssColors[$name])) {
$rgba = explode(',', Col... | [
"protected",
"function",
"coerceColor",
"(",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"value",
"[",
"0",
"]",
")",
"{",
"case",
"Type",
"::",
"T_COLOR",
":",
"return",
"$",
"value",
";",
"case",
"Type",
"::",
"T_KEYWORD",
":",
"$",
"name",
"=",
... | Coerce value to color
@param array $value
@return array|null | [
"Coerce",
"value",
"to",
"color"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L3985-L4006 |
213,473 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.coerceString | protected function coerceString($value)
{
if ($value[0] === Type::T_STRING) {
return $value;
}
return [Type::T_STRING, '', [$this->compileValue($value)]];
} | php | protected function coerceString($value)
{
if ($value[0] === Type::T_STRING) {
return $value;
}
return [Type::T_STRING, '', [$this->compileValue($value)]];
} | [
"protected",
"function",
"coerceString",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"[",
"0",
"]",
"===",
"Type",
"::",
"T_STRING",
")",
"{",
"return",
"$",
"value",
";",
"}",
"return",
"[",
"Type",
"::",
"T_STRING",
",",
"''",
",",
"[",... | Coerce value to string
@param array $value
@return array|null | [
"Coerce",
"value",
"to",
"string"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L4015-L4022 |
213,474 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.fixColor | protected function fixColor($c)
{
foreach ([1, 2, 3] as $i) {
if ($c[$i] < 0) {
$c[$i] = 0;
}
if ($c[$i] > 255) {
$c[$i] = 255;
}
}
return $c;
} | php | protected function fixColor($c)
{
foreach ([1, 2, 3] as $i) {
if ($c[$i] < 0) {
$c[$i] = 0;
}
if ($c[$i] > 255) {
$c[$i] = 255;
}
}
return $c;
} | [
"protected",
"function",
"fixColor",
"(",
"$",
"c",
")",
"{",
"foreach",
"(",
"[",
"1",
",",
"2",
",",
"3",
"]",
"as",
"$",
"i",
")",
"{",
"if",
"(",
"$",
"c",
"[",
"$",
"i",
"]",
"<",
"0",
")",
"{",
"$",
"c",
"[",
"$",
"i",
"]",
"=",
... | Make sure a color's components don't go out of bounds
@param array $c
@return array | [
"Make",
"sure",
"a",
"color",
"s",
"components",
"don",
"t",
"go",
"out",
"of",
"bounds"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L4133-L4146 |
213,475 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.toHSL | public function toHSL($red, $green, $blue)
{
$min = min($red, $green, $blue);
$max = max($red, $green, $blue);
$l = $min + $max;
$d = $max - $min;
if ((int) $d === 0) {
$h = $s = 0;
} else {
if ($l < 255) {
$s = $d / $l;
... | php | public function toHSL($red, $green, $blue)
{
$min = min($red, $green, $blue);
$max = max($red, $green, $blue);
$l = $min + $max;
$d = $max - $min;
if ((int) $d === 0) {
$h = $s = 0;
} else {
if ($l < 255) {
$s = $d / $l;
... | [
"public",
"function",
"toHSL",
"(",
"$",
"red",
",",
"$",
"green",
",",
"$",
"blue",
")",
"{",
"$",
"min",
"=",
"min",
"(",
"$",
"red",
",",
"$",
"green",
",",
"$",
"blue",
")",
";",
"$",
"max",
"=",
"max",
"(",
"$",
"red",
",",
"$",
"green... | Convert RGB to HSL
@api
@param integer $red
@param integer $green
@param integer $blue
@return array | [
"Convert",
"RGB",
"to",
"HSL"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L4159-L4186 |
213,476 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.getNormalizedNumbers | protected function getNormalizedNumbers($args)
{
$unit = null;
$originalUnit = null;
$numbers = [];
foreach ($args as $key => $item) {
if ($item[0] !== Type::T_NUMBER) {
$this->throwError('%s is not a number', $item[0]);
break;
... | php | protected function getNormalizedNumbers($args)
{
$unit = null;
$originalUnit = null;
$numbers = [];
foreach ($args as $key => $item) {
if ($item[0] !== Type::T_NUMBER) {
$this->throwError('%s is not a number', $item[0]);
break;
... | [
"protected",
"function",
"getNormalizedNumbers",
"(",
"$",
"args",
")",
"{",
"$",
"unit",
"=",
"null",
";",
"$",
"originalUnit",
"=",
"null",
";",
"$",
"numbers",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"args",
"as",
"$",
"key",
"=>",
"$",
"item",
... | Helper to normalize args containing numbers
@param array $args
@return array | [
"Helper",
"to",
"normalize",
"args",
"containing",
"numbers"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L4815-L4841 |
213,477 | moodle/moodle | lib/scssphp/Compiler.php | Compiler.libCounter | protected function libCounter($args)
{
$list = array_map([$this, 'compileValue'], $args);
return [Type::T_STRING, '', ['counter(' . implode(',', $list) . ')']];
} | php | protected function libCounter($args)
{
$list = array_map([$this, 'compileValue'], $args);
return [Type::T_STRING, '', ['counter(' . implode(',', $list) . ')']];
} | [
"protected",
"function",
"libCounter",
"(",
"$",
"args",
")",
"{",
"$",
"list",
"=",
"array_map",
"(",
"[",
"$",
"this",
",",
"'compileValue'",
"]",
",",
"$",
"args",
")",
";",
"return",
"[",
"Type",
"::",
"T_STRING",
",",
"''",
",",
"[",
"'counter('... | Workaround IE7's content counter bug.
@param array $args
@return array | [
"Workaround",
"IE7",
"s",
"content",
"counter",
"bug",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Compiler.php#L5289-L5294 |
213,478 | moodle/moodle | enrol/cohort/lib.php | enrol_cohort_plugin.get_instance_name | public function get_instance_name($instance) {
global $DB;
if (empty($instance)) {
$enrol = $this->get_name();
return get_string('pluginname', 'enrol_'.$enrol);
} else if (empty($instance->name)) {
$enrol = $this->get_name();
$cohort = $DB->get_r... | php | public function get_instance_name($instance) {
global $DB;
if (empty($instance)) {
$enrol = $this->get_name();
return get_string('pluginname', 'enrol_'.$enrol);
} else if (empty($instance->name)) {
$enrol = $this->get_name();
$cohort = $DB->get_r... | [
"public",
"function",
"get_instance_name",
"(",
"$",
"instance",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"empty",
"(",
"$",
"instance",
")",
")",
"{",
"$",
"enrol",
"=",
"$",
"this",
"->",
"get_name",
"(",
")",
";",
"return",
"get_string",
"("... | Returns localised name of enrol instance.
@param stdClass $instance (null is accepted too)
@return string | [
"Returns",
"localised",
"name",
"of",
"enrol",
"instance",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/cohort/lib.php#L56-L80 |
213,479 | moodle/moodle | enrol/cohort/lib.php | enrol_cohort_plugin.can_add_instance | public function can_add_instance($courseid) {
global $CFG;
require_once($CFG->dirroot . '/cohort/lib.php');
$coursecontext = context_course::instance($courseid);
if (!has_capability('moodle/course:enrolconfig', $coursecontext) or !has_capability('enrol/cohort:config', $coursecontext)) {
... | php | public function can_add_instance($courseid) {
global $CFG;
require_once($CFG->dirroot . '/cohort/lib.php');
$coursecontext = context_course::instance($courseid);
if (!has_capability('moodle/course:enrolconfig', $coursecontext) or !has_capability('enrol/cohort:config', $coursecontext)) {
... | [
"public",
"function",
"can_add_instance",
"(",
"$",
"courseid",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/cohort/lib.php'",
")",
";",
"$",
"coursecontext",
"=",
"context_course",
"::",
"instance",
"(",
"$"... | Given a courseid this function returns true if the user is able to enrol or configure cohorts.
AND there are cohorts that the user can view.
@param int $courseid
@return bool | [
"Given",
"a",
"courseid",
"this",
"function",
"returns",
"true",
"if",
"the",
"user",
"is",
"able",
"to",
"enrol",
"or",
"configure",
"cohorts",
".",
"AND",
"there",
"are",
"cohorts",
"that",
"the",
"user",
"can",
"view",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/cohort/lib.php#L89-L97 |
213,480 | moodle/moodle | enrol/cohort/lib.php | enrol_cohort_plugin.get_cohort_options | protected function get_cohort_options($instance, $context) {
global $DB, $CFG;
require_once($CFG->dirroot . '/cohort/lib.php');
$cohorts = array();
if ($instance->id) {
if ($cohort = $DB->get_record('cohort', array('id' => $instance->customint1))) {
$name =... | php | protected function get_cohort_options($instance, $context) {
global $DB, $CFG;
require_once($CFG->dirroot . '/cohort/lib.php');
$cohorts = array();
if ($instance->id) {
if ($cohort = $DB->get_record('cohort', array('id' => $instance->customint1))) {
$name =... | [
"protected",
"function",
"get_cohort_options",
"(",
"$",
"instance",
",",
"$",
"context",
")",
"{",
"global",
"$",
"DB",
",",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"dirroot",
".",
"'/cohort/lib.php'",
")",
";",
"$",
"cohorts",
"=",
"arr... | Return an array of valid options for the cohorts.
@param stdClass $instance
@param context $context
@return array | [
"Return",
"an",
"array",
"of",
"valid",
"options",
"for",
"the",
"cohorts",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/cohort/lib.php#L333-L355 |
213,481 | moodle/moodle | enrol/cohort/lib.php | enrol_cohort_plugin.get_role_options | protected function get_role_options($instance, $coursecontext) {
global $DB;
$roles = get_assignable_roles($coursecontext);
$roles[0] = get_string('none');
$roles = array_reverse($roles, true); // Descending default sortorder.
if ($instance->id and !isset($roles[$instance->rolei... | php | protected function get_role_options($instance, $coursecontext) {
global $DB;
$roles = get_assignable_roles($coursecontext);
$roles[0] = get_string('none');
$roles = array_reverse($roles, true); // Descending default sortorder.
if ($instance->id and !isset($roles[$instance->rolei... | [
"protected",
"function",
"get_role_options",
"(",
"$",
"instance",
",",
"$",
"coursecontext",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"roles",
"=",
"get_assignable_roles",
"(",
"$",
"coursecontext",
")",
";",
"$",
"roles",
"[",
"0",
"]",
"=",
"get_string"... | Return an array of valid options for the roles.
@param stdClass $instance
@param context $coursecontext
@return array | [
"Return",
"an",
"array",
"of",
"valid",
"options",
"for",
"the",
"roles",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/cohort/lib.php#L364-L380 |
213,482 | moodle/moodle | enrol/cohort/lib.php | enrol_cohort_plugin.get_group_options | protected function get_group_options($coursecontext) {
$groups = array(0 => get_string('none'));
if (has_capability('moodle/course:managegroups', $coursecontext)) {
$groups[COHORT_CREATE_GROUP] = get_string('creategroup', 'enrol_cohort');
}
foreach (groups_get_all_groups($co... | php | protected function get_group_options($coursecontext) {
$groups = array(0 => get_string('none'));
if (has_capability('moodle/course:managegroups', $coursecontext)) {
$groups[COHORT_CREATE_GROUP] = get_string('creategroup', 'enrol_cohort');
}
foreach (groups_get_all_groups($co... | [
"protected",
"function",
"get_group_options",
"(",
"$",
"coursecontext",
")",
"{",
"$",
"groups",
"=",
"array",
"(",
"0",
"=>",
"get_string",
"(",
"'none'",
")",
")",
";",
"if",
"(",
"has_capability",
"(",
"'moodle/course:managegroups'",
",",
"$",
"courseconte... | Return an array of valid options for the groups.
@param context $coursecontext
@return array | [
"Return",
"an",
"array",
"of",
"valid",
"options",
"for",
"the",
"groups",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/cohort/lib.php#L388-L399 |
213,483 | moodle/moodle | files/converter/googledrive/classes/converter.php | converter.supports | public static function supports($from, $to) {
// This is not a one-liner because of php 5.6.
$imports = self::$imports;
$exports = self::$exports;
return isset($imports[$from]) && isset($exports[$to]);
} | php | public static function supports($from, $to) {
// This is not a one-liner because of php 5.6.
$imports = self::$imports;
$exports = self::$exports;
return isset($imports[$from]) && isset($exports[$to]);
} | [
"public",
"static",
"function",
"supports",
"(",
"$",
"from",
",",
"$",
"to",
")",
"{",
"// This is not a one-liner because of php 5.6.",
"$",
"imports",
"=",
"self",
"::",
"$",
"imports",
";",
"$",
"exports",
"=",
"self",
"::",
"$",
"exports",
";",
"return"... | Whether a file conversion can be completed using this converter.
@param string $from The source type
@param string $to The destination type
@return bool | [
"Whether",
"a",
"file",
"conversion",
"can",
"be",
"completed",
"using",
"this",
"converter",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/files/converter/googledrive/classes/converter.php#L256-L261 |
213,484 | moodle/moodle | calendar/classes/external/month_exporter.php | month_exporter.get_day_names | protected function get_day_names(renderer_base $output) {
$weekdays = $this->related['type']->get_weekdays();
$daysinweek = count($weekdays);
$daynames = [];
for ($i = 0; $i < $daysinweek; $i++) {
// Bump the currentdayno and ensure it loops.
$dayno = ($i + $this... | php | protected function get_day_names(renderer_base $output) {
$weekdays = $this->related['type']->get_weekdays();
$daysinweek = count($weekdays);
$daynames = [];
for ($i = 0; $i < $daysinweek; $i++) {
// Bump the currentdayno and ensure it loops.
$dayno = ($i + $this... | [
"protected",
"function",
"get_day_names",
"(",
"renderer_base",
"$",
"output",
")",
"{",
"$",
"weekdays",
"=",
"$",
"this",
"->",
"related",
"[",
"'type'",
"]",
"->",
"get_weekdays",
"(",
")",
";",
"$",
"daysinweek",
"=",
"count",
"(",
"$",
"weekdays",
"... | Get the list of day names for display, re-ordered from the first day
of the week.
@param renderer_base $output
@return day_name_exporter[] | [
"Get",
"the",
"list",
"of",
"day",
"names",
"for",
"display",
"re",
"-",
"ordered",
"from",
"the",
"first",
"day",
"of",
"the",
"week",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/month_exporter.php#L268-L281 |
213,485 | moodle/moodle | calendar/classes/external/month_exporter.php | month_exporter.get_weeks | protected function get_weeks(renderer_base $output) {
$weeks = [];
$alldays = $this->get_days();
$daysinweek = count($this->related['type']->get_weekdays());
// Calculate which day number is the first, and last day of the week.
$firstdayofweek = $this->firstdayofweek;
... | php | protected function get_weeks(renderer_base $output) {
$weeks = [];
$alldays = $this->get_days();
$daysinweek = count($this->related['type']->get_weekdays());
// Calculate which day number is the first, and last day of the week.
$firstdayofweek = $this->firstdayofweek;
... | [
"protected",
"function",
"get_weeks",
"(",
"renderer_base",
"$",
"output",
")",
"{",
"$",
"weeks",
"=",
"[",
"]",
";",
"$",
"alldays",
"=",
"$",
"this",
"->",
"get_days",
"(",
")",
";",
"$",
"daysinweek",
"=",
"count",
"(",
"$",
"this",
"->",
"relate... | Get the list of week days, ordered into weeks and padded according
to the value of the first day of the week.
@param renderer_base $output
@return array The list of weeks. | [
"Get",
"the",
"list",
"of",
"week",
"days",
"ordered",
"into",
"weeks",
"and",
"padded",
"according",
"to",
"the",
"value",
"of",
"the",
"first",
"day",
"of",
"the",
"week",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/month_exporter.php#L290-L317 |
213,486 | moodle/moodle | calendar/classes/external/month_exporter.php | month_exporter.get_days | protected function get_days() {
$date = $this->related['type']->timestamp_to_date_array($this->calendar->time);
$monthdays = $this->related['type']->get_num_days_in_month($date['year'], $date['mon']);
$days = [];
for ($dayno = 1; $dayno <= $monthdays; $dayno++) {
// Get the ... | php | protected function get_days() {
$date = $this->related['type']->timestamp_to_date_array($this->calendar->time);
$monthdays = $this->related['type']->get_num_days_in_month($date['year'], $date['mon']);
$days = [];
for ($dayno = 1; $dayno <= $monthdays; $dayno++) {
// Get the ... | [
"protected",
"function",
"get_days",
"(",
")",
"{",
"$",
"date",
"=",
"$",
"this",
"->",
"related",
"[",
"'type'",
"]",
"->",
"timestamp_to_date_array",
"(",
"$",
"this",
"->",
"calendar",
"->",
"time",
")",
";",
"$",
"monthdays",
"=",
"$",
"this",
"->... | Get the list of days with the matching date array.
@return array | [
"Get",
"the",
"list",
"of",
"days",
"with",
"the",
"matching",
"date",
"array",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/month_exporter.php#L324-L337 |
213,487 | moodle/moodle | calendar/classes/external/month_exporter.php | month_exporter.get_month_data | protected function get_month_data() {
$date = $this->related['type']->timestamp_to_date_array($this->calendar->time);
$monthtime = $this->related['type']->convert_to_gregorian($date['year'], $date['month'], 1);
return make_timestamp($monthtime['year'], $monthtime['month']);
} | php | protected function get_month_data() {
$date = $this->related['type']->timestamp_to_date_array($this->calendar->time);
$monthtime = $this->related['type']->convert_to_gregorian($date['year'], $date['month'], 1);
return make_timestamp($monthtime['year'], $monthtime['month']);
} | [
"protected",
"function",
"get_month_data",
"(",
")",
"{",
"$",
"date",
"=",
"$",
"this",
"->",
"related",
"[",
"'type'",
"]",
"->",
"timestamp_to_date_array",
"(",
"$",
"this",
"->",
"calendar",
"->",
"time",
")",
";",
"$",
"monthtime",
"=",
"$",
"this",... | Get the current month timestamp.
@return int The month timestamp. | [
"Get",
"the",
"current",
"month",
"timestamp",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/month_exporter.php#L357-L362 |
213,488 | moodle/moodle | calendar/classes/external/month_exporter.php | month_exporter.get_previous_month_data | protected function get_previous_month_data() {
$type = $this->related['type'];
$date = $type->timestamp_to_date_array($this->calendar->time);
list($date['mon'], $date['year']) = $type->get_prev_month($date['year'], $date['mon']);
$time = $type->convert_to_timestamp($date['year'], $date['... | php | protected function get_previous_month_data() {
$type = $this->related['type'];
$date = $type->timestamp_to_date_array($this->calendar->time);
list($date['mon'], $date['year']) = $type->get_prev_month($date['year'], $date['mon']);
$time = $type->convert_to_timestamp($date['year'], $date['... | [
"protected",
"function",
"get_previous_month_data",
"(",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"related",
"[",
"'type'",
"]",
";",
"$",
"date",
"=",
"$",
"type",
"->",
"timestamp_to_date_array",
"(",
"$",
"this",
"->",
"calendar",
"->",
"time",
... | Get the previous month timestamp.
@return int The previous month timestamp. | [
"Get",
"the",
"previous",
"month",
"timestamp",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/month_exporter.php#L369-L376 |
213,489 | moodle/moodle | calendar/classes/external/month_exporter.php | month_exporter.get_next_month_data | protected function get_next_month_data() {
$type = $this->related['type'];
$date = $type->timestamp_to_date_array($this->calendar->time);
list($date['mon'], $date['year']) = $type->get_next_month($date['year'], $date['mon']);
$time = $type->convert_to_timestamp($date['year'], $date['mon'... | php | protected function get_next_month_data() {
$type = $this->related['type'];
$date = $type->timestamp_to_date_array($this->calendar->time);
list($date['mon'], $date['year']) = $type->get_next_month($date['year'], $date['mon']);
$time = $type->convert_to_timestamp($date['year'], $date['mon'... | [
"protected",
"function",
"get_next_month_data",
"(",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"related",
"[",
"'type'",
"]",
";",
"$",
"date",
"=",
"$",
"type",
"->",
"timestamp_to_date_array",
"(",
"$",
"this",
"->",
"calendar",
"->",
"time",
")",... | Get the next month timestamp.
@return int The next month timestamp. | [
"Get",
"the",
"next",
"month",
"timestamp",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/month_exporter.php#L383-L390 |
213,490 | moodle/moodle | calendar/classes/external/month_exporter.php | month_exporter.get_default_add_context | protected function get_default_add_context() {
if (calendar_user_can_add_event($this->calendar->course)) {
return \context_course::instance($this->calendar->course->id);
}
return null;
} | php | protected function get_default_add_context() {
if (calendar_user_can_add_event($this->calendar->course)) {
return \context_course::instance($this->calendar->course->id);
}
return null;
} | [
"protected",
"function",
"get_default_add_context",
"(",
")",
"{",
"if",
"(",
"calendar_user_can_add_event",
"(",
"$",
"this",
"->",
"calendar",
"->",
"course",
")",
")",
"{",
"return",
"\\",
"context_course",
"::",
"instance",
"(",
"$",
"this",
"->",
"calenda... | Get the default context for use when adding a new event.
@return null|\context | [
"Get",
"the",
"default",
"context",
"for",
"use",
"when",
"adding",
"a",
"new",
"event",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/external/month_exporter.php#L434-L440 |
213,491 | moodle/moodle | calendar/classes/local/event/data_access/event_vault.php | event_vault.timefield_pagination_from | protected function timefield_pagination_from(
$field,
$timefrom,
$lastseentime = null,
$lastseenid = null,
$withduration = true
) {
$where = '';
$params = [];
if ($lastseentime && $lastseentime >= $timefrom) {
$where = '((timesort = :timef... | php | protected function timefield_pagination_from(
$field,
$timefrom,
$lastseentime = null,
$lastseenid = null,
$withduration = true
) {
$where = '';
$params = [];
if ($lastseentime && $lastseentime >= $timefrom) {
$where = '((timesort = :timef... | [
"protected",
"function",
"timefield_pagination_from",
"(",
"$",
"field",
",",
"$",
"timefrom",
",",
"$",
"lastseentime",
"=",
"null",
",",
"$",
"lastseenid",
"=",
"null",
",",
"$",
"withduration",
"=",
"true",
")",
"{",
"$",
"where",
"=",
"''",
";",
"$",... | Generates SQL subquery and parameters for 'from' pagination.
@param string $field
@param int $timefrom
@param int|null $lastseentime
@param int|null $lastseenid
@param bool $withduration
@return array | [
"Generates",
"SQL",
"subquery",
"and",
"parameters",
"for",
"from",
"pagination",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/local/event/data_access/event_vault.php#L276-L308 |
213,492 | moodle/moodle | calendar/classes/local/event/data_access/event_vault.php | event_vault.timefield_pagination_to | protected function timefield_pagination_to(
$field,
$timeto,
$lastseentime = null,
$lastseenid = null
) {
$where = [];
$params = [];
if ($lastseentime && $lastseentime > $timeto) {
// The last seen event from this set is after the time sort range ... | php | protected function timefield_pagination_to(
$field,
$timeto,
$lastseentime = null,
$lastseenid = null
) {
$where = [];
$params = [];
if ($lastseentime && $lastseentime > $timeto) {
// The last seen event from this set is after the time sort range ... | [
"protected",
"function",
"timefield_pagination_to",
"(",
"$",
"field",
",",
"$",
"timeto",
",",
"$",
"lastseentime",
"=",
"null",
",",
"$",
"lastseenid",
"=",
"null",
")",
"{",
"$",
"where",
"=",
"[",
"]",
";",
"$",
"params",
"=",
"[",
"]",
";",
"if"... | Generates SQL subquery and parameters for 'to' pagination.
@param string $field
@param int $timeto
@param int|null $lastseentime
@param int|null $lastseenid
@return array|bool | [
"Generates",
"SQL",
"subquery",
"and",
"parameters",
"for",
"to",
"pagination",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/local/event/data_access/event_vault.php#L319-L347 |
213,493 | moodle/moodle | calendar/classes/local/event/data_access/event_vault.php | event_vault.get_from_db | protected function get_from_db(
$userid,
$whereconditions,
$whereparams,
$ordersql,
$offset,
$limitnum
) {
return array_values(
$this->retrievalstrategy->get_raw_events(
[$userid],
null,
null,
... | php | protected function get_from_db(
$userid,
$whereconditions,
$whereparams,
$ordersql,
$offset,
$limitnum
) {
return array_values(
$this->retrievalstrategy->get_raw_events(
[$userid],
null,
null,
... | [
"protected",
"function",
"get_from_db",
"(",
"$",
"userid",
",",
"$",
"whereconditions",
",",
"$",
"whereparams",
",",
"$",
"ordersql",
",",
"$",
"offset",
",",
"$",
"limitnum",
")",
"{",
"return",
"array_values",
"(",
"$",
"this",
"->",
"retrievalstrategy",... | Fetches records from DB.
@param int $userid
@param string $whereconditions
@param array $whereparams
@param string $ordersql
@param int $offset
@param int $limitnum
@return array | [
"Fetches",
"records",
"from",
"DB",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/local/event/data_access/event_vault.php#L370-L391 |
213,494 | moodle/moodle | admin/tool/log/classes/log/observer.php | observer.store | public static function store(\core\event\base $event) {
$logmanager = get_log_manager();
if (get_class($logmanager) === 'tool_log\log\manager') {
/** @var \tool_log\log\manager $logmanager */
$logmanager->process($event);
}
} | php | public static function store(\core\event\base $event) {
$logmanager = get_log_manager();
if (get_class($logmanager) === 'tool_log\log\manager') {
/** @var \tool_log\log\manager $logmanager */
$logmanager->process($event);
}
} | [
"public",
"static",
"function",
"store",
"(",
"\\",
"core",
"\\",
"event",
"\\",
"base",
"$",
"event",
")",
"{",
"$",
"logmanager",
"=",
"get_log_manager",
"(",
")",
";",
"if",
"(",
"get_class",
"(",
"$",
"logmanager",
")",
"===",
"'tool_log\\log\\manager'... | Redirect all events to this log manager, but only if this
log manager is actually used.
@param \core\event\base $event | [
"Redirect",
"all",
"events",
"to",
"this",
"log",
"manager",
"but",
"only",
"if",
"this",
"log",
"manager",
"is",
"actually",
"used",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/classes/log/observer.php#L36-L42 |
213,495 | moodle/moodle | question/type/essay/backup/moodle1/lib.php | moodle1_qtype_essay_handler.process_question | public function process_question(array $data, array $raw) {
// Data added on the upgrade step 2011031000.
$this->write_xml('essay', array(
'id' => $this->converter->get_nextid(),
'responseformat' => 'editor',
'responserequired' => 1,
... | php | public function process_question(array $data, array $raw) {
// Data added on the upgrade step 2011031000.
$this->write_xml('essay', array(
'id' => $this->converter->get_nextid(),
'responseformat' => 'editor',
'responserequired' => 1,
... | [
"public",
"function",
"process_question",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"raw",
")",
"{",
"// Data added on the upgrade step 2011031000.",
"$",
"this",
"->",
"write_xml",
"(",
"'essay'",
",",
"array",
"(",
"'id'",
"=>",
"$",
"this",
"->",
"conve... | Appends the essay specific information to the question | [
"Appends",
"the",
"essay",
"specific",
"information",
"to",
"the",
"question"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/essay/backup/moodle1/lib.php#L41-L55 |
213,496 | moodle/moodle | lib/horde/framework/Horde/Support/Timer.php | Horde_Support_Timer.pop | public function pop()
{
$etime = microtime(true);
if (! ($this->_idx > 0)) {
throw new Exception('No timers have been started');
}
return $etime - $this->_start[--$this->_idx];
} | php | public function pop()
{
$etime = microtime(true);
if (! ($this->_idx > 0)) {
throw new Exception('No timers have been started');
}
return $etime - $this->_start[--$this->_idx];
} | [
"public",
"function",
"pop",
"(",
")",
"{",
"$",
"etime",
"=",
"microtime",
"(",
"true",
")",
";",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"_idx",
">",
"0",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'No timers have been started'",
")",
";",
... | Pop the latest timer start and return the difference with the current
time.
@return float The amount of time passed. | [
"Pop",
"the",
"latest",
"timer",
"start",
"and",
"return",
"the",
"difference",
"with",
"the",
"current",
"time",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Support/Timer.php#L48-L57 |
213,497 | moodle/moodle | blocks/community/classes/privacy/provider.php | provider.export_user_data | public static function export_user_data(approved_contextlist $contextlist) {
global $DB;
// If the user has block_community data, then only the User context should be present so get the first context.
$contexts = $contextlist->get_contexts();
if (count($contexts) == 0) {
ret... | php | public static function export_user_data(approved_contextlist $contextlist) {
global $DB;
// If the user has block_community data, then only the User context should be present so get the first context.
$contexts = $contextlist->get_contexts();
if (count($contexts) == 0) {
ret... | [
"public",
"static",
"function",
"export_user_data",
"(",
"approved_contextlist",
"$",
"contextlist",
")",
"{",
"global",
"$",
"DB",
";",
"// If the user has block_community data, then only the User context should be present so get the first context.",
"$",
"contexts",
"=",
"$",
... | Export all user data for the specified user using the User context level.
@param approved_contextlist $contextlist The approved contexts to export information for. | [
"Export",
"all",
"user",
"data",
"for",
"the",
"specified",
"user",
"using",
"the",
"User",
"context",
"level",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/community/classes/privacy/provider.php#L120-L162 |
213,498 | moodle/moodle | lib/classes/analytics/analyser/site_courses.php | site_courses.get_all_samples | public function get_all_samples(\core_analytics\analysable $site) {
global $DB;
// Getting courses from DB instead of from the site as these samples
// will be stored in memory and we just want the id.
$select = 'id != 1';
$courses = get_courses('all', 'c.sortorder ASC');
... | php | public function get_all_samples(\core_analytics\analysable $site) {
global $DB;
// Getting courses from DB instead of from the site as these samples
// will be stored in memory and we just want the id.
$select = 'id != 1';
$courses = get_courses('all', 'c.sortorder ASC');
... | [
"public",
"function",
"get_all_samples",
"(",
"\\",
"core_analytics",
"\\",
"analysable",
"$",
"site",
")",
"{",
"global",
"$",
"DB",
";",
"// Getting courses from DB instead of from the site as these samples",
"// will be stored in memory and we just want the id.",
"$",
"selec... | Returns all site courses.
@param \core_analytics\analysable $site
@return array | [
"Returns",
"all",
"site",
"courses",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/analytics/analyser/site_courses.php#L82-L100 |
213,499 | moodle/moodle | lib/classes/analytics/analyser/site_courses.php | site_courses.get_samples | public function get_samples($sampleids) {
global $DB;
list($sql, $params) = $DB->get_in_or_equal($sampleids, SQL_PARAMS_NAMED);
$courses = $DB->get_records_select('course', "id $sql", $params);
$courseids = array_keys($courses);
$sampleids = array_combine($courseids, $courseids... | php | public function get_samples($sampleids) {
global $DB;
list($sql, $params) = $DB->get_in_or_equal($sampleids, SQL_PARAMS_NAMED);
$courses = $DB->get_records_select('course', "id $sql", $params);
$courseids = array_keys($courses);
$sampleids = array_combine($courseids, $courseids... | [
"public",
"function",
"get_samples",
"(",
"$",
"sampleids",
")",
"{",
"global",
"$",
"DB",
";",
"list",
"(",
"$",
"sql",
",",
"$",
"params",
")",
"=",
"$",
"DB",
"->",
"get_in_or_equal",
"(",
"$",
"sampleids",
",",
"SQL_PARAMS_NAMED",
")",
";",
"$",
... | Return all complete samples data from sample ids.
@param int[] $sampleids
@return array | [
"Return",
"all",
"complete",
"samples",
"data",
"from",
"sample",
"ids",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/analytics/analyser/site_courses.php#L108-L123 |
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.