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
211,900
moodle/moodle
lib/phpexcel/PHPExcel/Shared/Drawing.php
PHPExcel_Shared_Drawing.pixelsToCellDimension
public static function pixelsToCellDimension($pValue = 0, PHPExcel_Style_Font $pDefaultFont) { // Font name and size $name = $pDefaultFont->getName(); $size = $pDefaultFont->getSize(); if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) { // Exact width ...
php
public static function pixelsToCellDimension($pValue = 0, PHPExcel_Style_Font $pDefaultFont) { // Font name and size $name = $pDefaultFont->getName(); $size = $pDefaultFont->getSize(); if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) { // Exact width ...
[ "public", "static", "function", "pixelsToCellDimension", "(", "$", "pValue", "=", "0", ",", "PHPExcel_Style_Font", "$", "pDefaultFont", ")", "{", "// Font name and size", "$", "name", "=", "$", "pDefaultFont", "->", "getName", "(", ")", ";", "$", "size", "=", ...
Convert pixels to column width. Exact algorithm not known. By inspection of a real Excel file using Calibri 11, one finds 1000px ~ 142.85546875 This gives a conversion factor of 7. Also, we assume that pixels and font size are proportional. @param int $pValue Value in pixels @param PHPExcel_Style_Font $pDef...
[ "Convert", "pixels", "to", "column", "width", ".", "Exact", "algorithm", "not", "known", ".", "By", "inspection", "of", "a", "real", "Excel", "file", "using", "Calibri", "11", "one", "finds", "1000px", "~", "142", ".", "85546875", "This", "gives", "a", "...
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Shared/Drawing.php#L73-L89
211,901
moodle/moodle
completion/criteria/completion_criteria.php
completion_criteria.factory
public static function factory($params) { global $CFG, $COMPLETION_CRITERIA_TYPES; if (!isset($params['criteriatype']) || !isset($COMPLETION_CRITERIA_TYPES[$params['criteriatype']])) { print_error('invalidcriteriatype', 'completion'); } $class = 'completion_criteria_'.$COMP...
php
public static function factory($params) { global $CFG, $COMPLETION_CRITERIA_TYPES; if (!isset($params['criteriatype']) || !isset($COMPLETION_CRITERIA_TYPES[$params['criteriatype']])) { print_error('invalidcriteriatype', 'completion'); } $class = 'completion_criteria_'.$COMP...
[ "public", "static", "function", "factory", "(", "$", "params", ")", "{", "global", "$", "CFG", ",", "$", "COMPLETION_CRITERIA_TYPES", ";", "if", "(", "!", "isset", "(", "$", "params", "[", "'criteriatype'", "]", ")", "||", "!", "isset", "(", "$", "COMP...
Factory method for creating correct class object @param array $params associative arrays varname=>value @return completion_criteria
[ "Factory", "method", "for", "creating", "correct", "class", "object" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/criteria/completion_criteria.php#L169-L180
211,902
moodle/moodle
completion/criteria/completion_criteria.php
completion_criteria.get_icon
public function get_icon($alt, array $attributes = null) { global $COMPLETION_CRITERIA_TYPES; $criteriatype = $COMPLETION_CRITERIA_TYPES[$this->criteriatype]; return new pix_icon('i/'.$criteriatype, $alt, 'moodle', $attributes); }
php
public function get_icon($alt, array $attributes = null) { global $COMPLETION_CRITERIA_TYPES; $criteriatype = $COMPLETION_CRITERIA_TYPES[$this->criteriatype]; return new pix_icon('i/'.$criteriatype, $alt, 'moodle', $attributes); }
[ "public", "function", "get_icon", "(", "$", "alt", ",", "array", "$", "attributes", "=", "null", ")", "{", "global", "$", "COMPLETION_CRITERIA_TYPES", ";", "$", "criteriatype", "=", "$", "COMPLETION_CRITERIA_TYPES", "[", "$", "this", "->", "criteriatype", "]",...
Return pix_icon for display in reports. @param string $alt The alt text to use for the icon @param array $attributes html attributes @return pix_icon
[ "Return", "pix_icon", "for", "display", "in", "reports", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/completion/criteria/completion_criteria.php#L244-L249
211,903
moodle/moodle
blocks/timeline/classes/privacy/provider.php
provider.get_metadata
public static function get_metadata(collection $collection) : collection { $collection->add_user_preference('block_timeline_user_sort_preference', 'privacy:metadata:timelinesortpreference'); $collection->add_user_preference('block_timeline_user_filter_preference', 'privacy:metadata:timelinefilterprefere...
php
public static function get_metadata(collection $collection) : collection { $collection->add_user_preference('block_timeline_user_sort_preference', 'privacy:metadata:timelinesortpreference'); $collection->add_user_preference('block_timeline_user_filter_preference', 'privacy:metadata:timelinefilterprefere...
[ "public", "static", "function", "get_metadata", "(", "collection", "$", "collection", ")", ":", "collection", "{", "$", "collection", "->", "add_user_preference", "(", "'block_timeline_user_sort_preference'", ",", "'privacy:metadata:timelinesortpreference'", ")", ";", "$"...
Returns meta-data information about the myoverview block. @param \core_privacy\local\metadata\collection $collection A collection of meta-data. @return \core_privacy\local\metadata\collection Return the collection of meta-data.
[ "Returns", "meta", "-", "data", "information", "about", "the", "myoverview", "block", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/timeline/classes/privacy/provider.php#L44-L49
211,904
moodle/moodle
lib/simplepie/library/SimplePie/Parse/Date.php
SimplePie_Parse_Date.parse
public function parse($date) { foreach ($this->user as $method) { if (($returned = call_user_func($method, $date)) !== false) { return $returned; } } foreach ($this->built_in as $method) { if (($returned = call_user_func(array($this, $method), $date)) !== false) { return $returned; ...
php
public function parse($date) { foreach ($this->user as $method) { if (($returned = call_user_func($method, $date)) !== false) { return $returned; } } foreach ($this->built_in as $method) { if (($returned = call_user_func(array($this, $method), $date)) !== false) { return $returned; ...
[ "public", "function", "parse", "(", "$", "date", ")", "{", "foreach", "(", "$", "this", "->", "user", "as", "$", "method", ")", "{", "if", "(", "(", "$", "returned", "=", "call_user_func", "(", "$", "method", ",", "$", "date", ")", ")", "!==", "f...
Parse a date @final @access public @param string $date Date to parse @return int Timestamp corresponding to date string, or false on failure
[ "Parse", "a", "date" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Parse/Date.php#L590-L609
211,905
moodle/moodle
lib/simplepie/library/SimplePie/Parse/Date.php
SimplePie_Parse_Date.date_rfc2822
public function date_rfc2822($date) { static $pcre; if (!$pcre) { $wsp = '[\x09\x20]'; $fws = '(?:' . $wsp . '+|' . $wsp . '*(?:\x0D\x0A' . $wsp . '+)+)'; $optional_fws = $fws . '?'; $day_name = $this->day_pcre; $month = $this->month_pcre; $day = '([0-9]{1,2})'; $hour = $minute = $second = '...
php
public function date_rfc2822($date) { static $pcre; if (!$pcre) { $wsp = '[\x09\x20]'; $fws = '(?:' . $wsp . '+|' . $wsp . '*(?:\x0D\x0A' . $wsp . '+)+)'; $optional_fws = $fws . '?'; $day_name = $this->day_pcre; $month = $this->month_pcre; $day = '([0-9]{1,2})'; $hour = $minute = $second = '...
[ "public", "function", "date_rfc2822", "(", "$", "date", ")", "{", "static", "$", "pcre", ";", "if", "(", "!", "$", "pcre", ")", "{", "$", "wsp", "=", "'[\\x09\\x20]'", ";", "$", "fws", "=", "'(?:'", ".", "$", "wsp", ".", "'+|'", ".", "$", "wsp", ...
Parse RFC2822's date format @access protected @return int Timestamp
[ "Parse", "RFC2822", "s", "date", "format" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Parse/Date.php#L770-L855
211,906
moodle/moodle
lib/simplepie/library/SimplePie/Parse/Date.php
SimplePie_Parse_Date.date_rfc850
public function date_rfc850($date) { static $pcre; if (!$pcre) { $space = '[\x09\x20]+'; $day_name = $this->day_pcre; $month = $this->month_pcre; $day = '([0-9]{1,2})'; $year = $hour = $minute = $second = '([0-9]{2})'; $zone = '([A-Z]{1,5})'; $pcre = '/^' . $day_name . ',' . $space . $day . ...
php
public function date_rfc850($date) { static $pcre; if (!$pcre) { $space = '[\x09\x20]+'; $day_name = $this->day_pcre; $month = $this->month_pcre; $day = '([0-9]{1,2})'; $year = $hour = $minute = $second = '([0-9]{2})'; $zone = '([A-Z]{1,5})'; $pcre = '/^' . $day_name . ',' . $space . $day . ...
[ "public", "function", "date_rfc850", "(", "$", "date", ")", "{", "static", "$", "pcre", ";", "if", "(", "!", "$", "pcre", ")", "{", "$", "space", "=", "'[\\x09\\x20]+'", ";", "$", "day_name", "=", "$", "this", "->", "day_pcre", ";", "$", "month", "...
Parse RFC850's date format @access protected @return int Timestamp
[ "Parse", "RFC850", "s", "date", "format" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/simplepie/library/SimplePie/Parse/Date.php#L863-L920
211,907
moodle/moodle
mod/data/mod_form.php
mod_data_mod_form.data_preprocessing
public function data_preprocessing(&$defaultvalues) { parent::data_preprocessing($defaultvalues); $defaultvalues['completionentriesenabled'] = !empty($defaultvalues['completionentries']) ? 1 : 0; if (empty($defaultvalues['completionentries'])) { $defaultvalues['completionentries'] = ...
php
public function data_preprocessing(&$defaultvalues) { parent::data_preprocessing($defaultvalues); $defaultvalues['completionentriesenabled'] = !empty($defaultvalues['completionentries']) ? 1 : 0; if (empty($defaultvalues['completionentries'])) { $defaultvalues['completionentries'] = ...
[ "public", "function", "data_preprocessing", "(", "&", "$", "defaultvalues", ")", "{", "parent", "::", "data_preprocessing", "(", "$", "defaultvalues", ")", ";", "$", "defaultvalues", "[", "'completionentriesenabled'", "]", "=", "!", "empty", "(", "$", "defaultva...
Set up the completion checkbox which is not part of standard data. @param array $defaultvalues
[ "Set", "up", "the", "completion", "checkbox", "which", "is", "not", "part", "of", "standard", "data", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/mod_form.php#L153-L159
211,908
moodle/moodle
lib/classes/task/file_temp_cleanup_task.php
file_temp_cleanup_task.execute_on
protected function execute_on($tmpdir) { global $CFG; // Default to last weeks time. $time = time() - ($CFG->tempdatafoldercleanup * 3600); $dir = new \RecursiveDirectoryIterator($tmpdir); // Show all child nodes prior to their parent. $iter = new \RecursiveIteratorIter...
php
protected function execute_on($tmpdir) { global $CFG; // Default to last weeks time. $time = time() - ($CFG->tempdatafoldercleanup * 3600); $dir = new \RecursiveDirectoryIterator($tmpdir); // Show all child nodes prior to their parent. $iter = new \RecursiveIteratorIter...
[ "protected", "function", "execute_on", "(", "$", "tmpdir", ")", "{", "global", "$", "CFG", ";", "// Default to last weeks time.", "$", "time", "=", "time", "(", ")", "-", "(", "$", "CFG", "->", "tempdatafoldercleanup", "*", "3600", ")", ";", "$", "dir", ...
Do the job, given the target directory. @param string $tmpdir The directory hosting the candidate stale temp files.
[ "Do", "the", "job", "given", "the", "target", "directory", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/task/file_temp_cleanup_task.php#L45-L97
211,909
moodle/moodle
repository/dropbox/classes/dropbox.php
dropbox.fetch_dropbox_data
protected function fetch_dropbox_data($endpoint, $data = []) { $url = $this->get_api_endpoint($endpoint); $this->cleanopt(); $this->resetHeader(); if ($data === null) { // Some API endpoints explicitly expect a data submission of 'null'. $options['CURLOPT_POSTFIE...
php
protected function fetch_dropbox_data($endpoint, $data = []) { $url = $this->get_api_endpoint($endpoint); $this->cleanopt(); $this->resetHeader(); if ($data === null) { // Some API endpoints explicitly expect a data submission of 'null'. $options['CURLOPT_POSTFIE...
[ "protected", "function", "fetch_dropbox_data", "(", "$", "endpoint", ",", "$", "data", "=", "[", "]", ")", "{", "$", "url", "=", "$", "this", "->", "get_api_endpoint", "(", "$", "endpoint", ")", ";", "$", "this", "->", "cleanopt", "(", ")", ";", "$",...
Make an API call against the specified endpoint with supplied data. @param string $endpoint The endpoint to be contacted @param array $data Any data to pass to the endpoint @return object Content decoded from the endpoint
[ "Make", "an", "API", "call", "against", "the", "specified", "endpoint", "with", "supplied", "data", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/dropbox/classes/dropbox.php#L97-L140
211,910
moodle/moodle
repository/dropbox/classes/dropbox.php
dropbox.fetch_dropbox_content
protected function fetch_dropbox_content($endpoint, $data = []) { $url = $this->get_content_endpoint($endpoint); $this->cleanopt(); $this->resetHeader(); $options['CURLOPT_POST'] = 1; $this->setHeader('Content-Type: '); $this->setHeader('Dropbox-API-Arg: ' . json_encode(...
php
protected function fetch_dropbox_content($endpoint, $data = []) { $url = $this->get_content_endpoint($endpoint); $this->cleanopt(); $this->resetHeader(); $options['CURLOPT_POST'] = 1; $this->setHeader('Content-Type: '); $this->setHeader('Dropbox-API-Arg: ' . json_encode(...
[ "protected", "function", "fetch_dropbox_content", "(", "$", "endpoint", ",", "$", "data", "=", "[", "]", ")", "{", "$", "url", "=", "$", "this", "->", "get_content_endpoint", "(", "$", "endpoint", ")", ";", "$", "this", "->", "cleanopt", "(", ")", ";",...
Fetch content from the specified endpoint with the supplied data. @param string $endpoint The endpoint to be contacted @param array $data Any data to pass to the endpoint @return string The returned data
[ "Fetch", "content", "from", "the", "specified", "endpoint", "with", "the", "supplied", "data", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/dropbox/classes/dropbox.php#L159-L172
211,911
moodle/moodle
repository/dropbox/classes/dropbox.php
dropbox.check_and_handle_api_errors
protected function check_and_handle_api_errors($data) { if ($this->info['http_code'] == 200) { // Dropbox only returns errors on non-200 response codes. return; } switch($this->info['http_code']) { case 400: // Bad input parameter. Error messa...
php
protected function check_and_handle_api_errors($data) { if ($this->info['http_code'] == 200) { // Dropbox only returns errors on non-200 response codes. return; } switch($this->info['http_code']) { case 400: // Bad input parameter. Error messa...
[ "protected", "function", "check_and_handle_api_errors", "(", "$", "data", ")", "{", "if", "(", "$", "this", "->", "info", "[", "'http_code'", "]", "==", "200", ")", "{", "// Dropbox only returns errors on non-200 response codes.", "return", ";", "}", "switch", "("...
Check for an attempt to handle API errors. This function attempts to deal with errors as per https://www.dropbox.com/developers/documentation/http/documentation#error-handling. @param mixed $data The returned content. @throws moodle_exception
[ "Check", "for", "an", "attempt", "to", "handle", "API", "errors", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/dropbox/classes/dropbox.php#L183-L216
211,912
moodle/moodle
repository/dropbox/classes/dropbox.php
dropbox.get_file_share_info
public function get_file_share_info($id) { // Attempt to fetch any existing shared link first. $data = $this->fetch_dropbox_data('sharing/list_shared_links', [ 'path' => $id, ]); if (isset($data->links)) { $link = reset($data->links); if ...
php
public function get_file_share_info($id) { // Attempt to fetch any existing shared link first. $data = $this->fetch_dropbox_data('sharing/list_shared_links', [ 'path' => $id, ]); if (isset($data->links)) { $link = reset($data->links); if ...
[ "public", "function", "get_file_share_info", "(", "$", "id", ")", "{", "// Attempt to fetch any existing shared link first.", "$", "data", "=", "$", "this", "->", "fetch_dropbox_data", "(", "'sharing/list_shared_links'", ",", "[", "'path'", "=>", "$", "id", ",", "]"...
Fetch a valid public share link for the specified file. @param string $id The file path or file id of the file to fetch information for. @return object An object containing the id, path, size, and URL of the entry
[ "Fetch", "a", "valid", "public", "share", "link", "for", "the", "specified", "file", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/dropbox/classes/dropbox.php#L303-L331
211,913
moodle/moodle
lib/phpexcel/PHPExcel/Writer/Excel2007/Drawing.php
PHPExcel_Writer_Excel2007_Drawing.allDrawings
public function allDrawings(PHPExcel $pPHPExcel = null) { // Get an array of all drawings $aDrawings = array(); // Loop through PHPExcel $sheetCount = $pPHPExcel->getSheetCount(); for ($i = 0; $i < $sheetCount; ++$i) { // Loop through images and add to array ...
php
public function allDrawings(PHPExcel $pPHPExcel = null) { // Get an array of all drawings $aDrawings = array(); // Loop through PHPExcel $sheetCount = $pPHPExcel->getSheetCount(); for ($i = 0; $i < $sheetCount; ++$i) { // Loop through images and add to array ...
[ "public", "function", "allDrawings", "(", "PHPExcel", "$", "pPHPExcel", "=", "null", ")", "{", "// Get an array of all drawings", "$", "aDrawings", "=", "array", "(", ")", ";", "// Loop through PHPExcel", "$", "sheetCount", "=", "$", "pPHPExcel", "->", "getSheetCo...
Get an array of all drawings @param PHPExcel $pPHPExcel @return PHPExcel_Worksheet_Drawing[] All drawings in PHPExcel @throws PHPExcel_Writer_Exception
[ "Get", "an", "array", "of", "all", "drawings" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Writer/Excel2007/Drawing.php#L570-L588
211,914
moodle/moodle
mod/forum/classes/local/factories/builder.php
builder.get_exported_posts_builder
public function get_exported_posts_builder() : exported_posts_builder { return new exported_posts_builder( $this->rendererbase, $this->legacydatamapperfactory, $this->exporterfactory, $this->vaultfactory, $this->managerfactory->get_rating_manager() ...
php
public function get_exported_posts_builder() : exported_posts_builder { return new exported_posts_builder( $this->rendererbase, $this->legacydatamapperfactory, $this->exporterfactory, $this->vaultfactory, $this->managerfactory->get_rating_manager() ...
[ "public", "function", "get_exported_posts_builder", "(", ")", ":", "exported_posts_builder", "{", "return", "new", "exported_posts_builder", "(", "$", "this", "->", "rendererbase", ",", "$", "this", "->", "legacydatamapperfactory", ",", "$", "this", "->", "exporterf...
Get an instance of the exported posts builder. @return exported_posts_builder
[ "Get", "an", "instance", "of", "the", "exported", "posts", "builder", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/builder.php#L88-L96
211,915
moodle/moodle
mod/forum/classes/local/factories/builder.php
builder.get_exported_discussion_summaries_builder
public function get_exported_discussion_summaries_builder() : exported_discussion_summaries_builder { return new exported_discussion_summaries_builder( $this->rendererbase, $this->legacydatamapperfactory, $this->exporterfactory, $this->vaultfactory, $t...
php
public function get_exported_discussion_summaries_builder() : exported_discussion_summaries_builder { return new exported_discussion_summaries_builder( $this->rendererbase, $this->legacydatamapperfactory, $this->exporterfactory, $this->vaultfactory, $t...
[ "public", "function", "get_exported_discussion_summaries_builder", "(", ")", ":", "exported_discussion_summaries_builder", "{", "return", "new", "exported_discussion_summaries_builder", "(", "$", "this", "->", "rendererbase", ",", "$", "this", "->", "legacydatamapperfactory",...
Get an instance of the exported discussion summaries builder. @return exported_discussion_summaries_builder
[ "Get", "an", "instance", "of", "the", "exported", "discussion", "summaries", "builder", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/builder.php#L103-L111
211,916
moodle/moodle
mod/forum/classes/local/factories/builder.php
builder.get_exported_discussion_builder
public function get_exported_discussion_builder() : exported_discussion_builder { return new exported_discussion_builder( $this->rendererbase, $this->legacydatamapperfactory, $this->exporterfactory, $this->vaultfactory, $this->managerfactory->get_ratin...
php
public function get_exported_discussion_builder() : exported_discussion_builder { return new exported_discussion_builder( $this->rendererbase, $this->legacydatamapperfactory, $this->exporterfactory, $this->vaultfactory, $this->managerfactory->get_ratin...
[ "public", "function", "get_exported_discussion_builder", "(", ")", ":", "exported_discussion_builder", "{", "return", "new", "exported_discussion_builder", "(", "$", "this", "->", "rendererbase", ",", "$", "this", "->", "legacydatamapperfactory", ",", "$", "this", "->...
Get an instance of the exported discussion builder. @return exported_discussion_summaries_builder
[ "Get", "an", "instance", "of", "the", "exported", "discussion", "builder", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/factories/builder.php#L118-L126
211,917
moodle/moodle
lib/htmlpurifier/HTMLPurifier/EntityLookup.php
HTMLPurifier_EntityLookup.setup
public function setup($file = false) { if (!$file) { $file = HTMLPURIFIER_PREFIX . '/HTMLPurifier/EntityLookup/entities.ser'; } $this->table = unserialize(file_get_contents($file)); }
php
public function setup($file = false) { if (!$file) { $file = HTMLPURIFIER_PREFIX . '/HTMLPurifier/EntityLookup/entities.ser'; } $this->table = unserialize(file_get_contents($file)); }
[ "public", "function", "setup", "(", "$", "file", "=", "false", ")", "{", "if", "(", "!", "$", "file", ")", "{", "$", "file", "=", "HTMLPURIFIER_PREFIX", ".", "'/HTMLPurifier/EntityLookup/entities.ser'", ";", "}", "$", "this", "->", "table", "=", "unseriali...
Sets up the entity lookup table from the serialized file contents. @param bool $file @note The serialized contents are versioned, but were generated using the maintenance script generate_entity_file.php @warning This is not in constructor to help enforce the Singleton
[ "Sets", "up", "the", "entity", "lookup", "table", "from", "the", "serialized", "file", "contents", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/EntityLookup.php#L21-L27
211,918
moodle/moodle
admin/tool/usertours/classes/target.php
target.get_target_type
public static function get_target_type(step $step) { if (!isset(self::$mapping[$step->get_targettype()])) { throw new \moodle_exception('Unknown Target type'); } $targettype = self::$mapping[$step->get_targettype()]; return "\\tool_usertours\\local\\target\\{$targettype}"; ...
php
public static function get_target_type(step $step) { if (!isset(self::$mapping[$step->get_targettype()])) { throw new \moodle_exception('Unknown Target type'); } $targettype = self::$mapping[$step->get_targettype()]; return "\\tool_usertours\\local\\target\\{$targettype}"; ...
[ "public", "static", "function", "get_target_type", "(", "step", "$", "step", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "mapping", "[", "$", "step", "->", "get_targettype", "(", ")", "]", ")", ")", "{", "throw", "new", "\\", "moodle_e...
Return the instance of the class for this target. @param step $step The step. @return target The target instance.
[ "Return", "the", "instance", "of", "the", "class", "for", "this", "target", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/usertours/classes/target.php#L78-L85
211,919
moodle/moodle
admin/tool/monitor/classes/output/managesubs/renderer.php
renderer.render_rules_link
public function render_rules_link($ruleurl) { echo \html_writer::start_div(); $a = \html_writer::link($ruleurl, get_string('managerules', 'tool_monitor')); $link = \html_writer::tag('span', get_string('manageruleslink', 'tool_monitor', $a)); echo $link; echo \html_writer::end_div...
php
public function render_rules_link($ruleurl) { echo \html_writer::start_div(); $a = \html_writer::link($ruleurl, get_string('managerules', 'tool_monitor')); $link = \html_writer::tag('span', get_string('manageruleslink', 'tool_monitor', $a)); echo $link; echo \html_writer::end_div...
[ "public", "function", "render_rules_link", "(", "$", "ruleurl", ")", "{", "echo", "\\", "html_writer", "::", "start_div", "(", ")", ";", "$", "a", "=", "\\", "html_writer", "::", "link", "(", "$", "ruleurl", ",", "get_string", "(", "'managerules'", ",", ...
Html to add a link to go to the rule manager page. @param moodle_url $ruleurl The url of the rule manager page. @return string html for the link to the rule manager page.
[ "Html", "to", "add", "a", "link", "to", "go", "to", "the", "rule", "manager", "page", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/monitor/classes/output/managesubs/renderer.php#L103-L109
211,920
moodle/moodle
enrol/flatfile/classes/privacy/provider.php
provider.validate_contextlist_contexts
protected static function validate_contextlist_contexts(approved_contextlist $contextlist) { return array_reduce($contextlist->get_contexts(), function($carry, $context) { if ($context->contextlevel == CONTEXT_COURSE) { $carry[] = $context; } return $carry; ...
php
protected static function validate_contextlist_contexts(approved_contextlist $contextlist) { return array_reduce($contextlist->get_contexts(), function($carry, $context) { if ($context->contextlevel == CONTEXT_COURSE) { $carry[] = $context; } return $carry; ...
[ "protected", "static", "function", "validate_contextlist_contexts", "(", "approved_contextlist", "$", "contextlist", ")", "{", "return", "array_reduce", "(", "$", "contextlist", "->", "get_contexts", "(", ")", ",", "function", "(", "$", "carry", ",", "$", "context...
Simple sanity check on the contextlist contexts, making sure they're of CONTEXT_COURSE contextlevel. @param approved_contextlist $contextlist @return array the array of contexts filtered to only include those of CONTEXT_COURSE contextlevel.
[ "Simple", "sanity", "check", "on", "the", "contextlist", "contexts", "making", "sure", "they", "re", "of", "CONTEXT_COURSE", "contextlevel", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/flatfile/classes/privacy/provider.php#L221-L228
211,921
moodle/moodle
mod/data/classes/search/entry.php
entry.get_doc_url
public function get_doc_url(\core_search\document $doc) { $entry = $this->get_entry($doc->get('itemid')); return new \moodle_url('/mod/data/view.php', array( 'd' => $entry->dataid, 'rid' => $entry->id )); }
php
public function get_doc_url(\core_search\document $doc) { $entry = $this->get_entry($doc->get('itemid')); return new \moodle_url('/mod/data/view.php', array( 'd' => $entry->dataid, 'rid' => $entry->id )); }
[ "public", "function", "get_doc_url", "(", "\\", "core_search", "\\", "document", "$", "doc", ")", "{", "$", "entry", "=", "$", "this", "->", "get_entry", "(", "$", "doc", "->", "get", "(", "'itemid'", ")", ")", ";", "return", "new", "\\", "moodle_url",...
Link to database entry. @param \core_search\document $doc @return \moodle_url
[ "Link", "to", "database", "entry", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/classes/search/entry.php#L194-L197
211,922
moodle/moodle
mod/data/classes/search/entry.php
entry.get_context_url
public function get_context_url(\core_search\document $doc) { $entry = $this->get_entry($doc->get('itemid')); return new \moodle_url('/mod/data/view.php', array('d' => $entry->dataid)); }
php
public function get_context_url(\core_search\document $doc) { $entry = $this->get_entry($doc->get('itemid')); return new \moodle_url('/mod/data/view.php', array('d' => $entry->dataid)); }
[ "public", "function", "get_context_url", "(", "\\", "core_search", "\\", "document", "$", "doc", ")", "{", "$", "entry", "=", "$", "this", "->", "get_entry", "(", "$", "doc", "->", "get", "(", "'itemid'", ")", ")", ";", "return", "new", "\\", "moodle_u...
Link to the database activity. @param \core_search\document $doc @return \moodle_url
[ "Link", "to", "the", "database", "activity", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/classes/search/entry.php#L205-L208
211,923
moodle/moodle
mod/data/classes/search/entry.php
entry.attach_files
public function attach_files($doc) { global $DB; $entryid = $doc->get('itemid'); try { $entry = $this->get_entry($entryid); } catch (\dml_missing_record_exception $e) { debugging('Could not get record to attach files to '.$doc->get('id'), DEBUG_DEVELOPER); ...
php
public function attach_files($doc) { global $DB; $entryid = $doc->get('itemid'); try { $entry = $this->get_entry($entryid); } catch (\dml_missing_record_exception $e) { debugging('Could not get record to attach files to '.$doc->get('id'), DEBUG_DEVELOPER); ...
[ "public", "function", "attach_files", "(", "$", "doc", ")", "{", "global", "$", "DB", ";", "$", "entryid", "=", "$", "doc", "->", "get", "(", "'itemid'", ")", ";", "try", "{", "$", "entry", "=", "$", "this", "->", "get_entry", "(", "$", "entryid", ...
Add the database entries attachments. @param \core_search\document $doc @return void
[ "Add", "the", "database", "entries", "attachments", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/classes/search/entry.php#L225-L246
211,924
moodle/moodle
mod/data/classes/search/entry.php
entry.get_entry
protected function get_entry($entryid) { global $DB; if (empty($this->entriesdata[$entryid])) { $this->entriesdata[$entryid] = $DB->get_record('data_records', array( 'id' => $entryid ), '*', MUST_EXIST); } return $this->entriesdata[$entryid]; }
php
protected function get_entry($entryid) { global $DB; if (empty($this->entriesdata[$entryid])) { $this->entriesdata[$entryid] = $DB->get_record('data_records', array( 'id' => $entryid ), '*', MUST_EXIST); } return $this->entriesdata[$entryid]; }
[ "protected", "function", "get_entry", "(", "$", "entryid", ")", "{", "global", "$", "DB", ";", "if", "(", "empty", "(", "$", "this", "->", "entriesdata", "[", "$", "entryid", "]", ")", ")", "{", "$", "this", "->", "entriesdata", "[", "$", "entryid", ...
Get database entry data @throws \dml_exception @param int $entryid @return stdClass
[ "Get", "database", "entry", "data" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/classes/search/entry.php#L255-L263
211,925
moodle/moodle
mod/data/classes/search/entry.php
entry.get_field_class_name
protected function get_field_class_name($fieldtype) { global $CFG; $fieldtype = trim($fieldtype); require_once($CFG->dirroot . '/mod/data/field/' . $fieldtype . '/field.class.php'); return 'data_field_' . $fieldtype; }
php
protected function get_field_class_name($fieldtype) { global $CFG; $fieldtype = trim($fieldtype); require_once($CFG->dirroot . '/mod/data/field/' . $fieldtype . '/field.class.php'); return 'data_field_' . $fieldtype; }
[ "protected", "function", "get_field_class_name", "(", "$", "fieldtype", ")", "{", "global", "$", "CFG", ";", "$", "fieldtype", "=", "trim", "(", "$", "fieldtype", ")", ";", "require_once", "(", "$", "CFG", "->", "dirroot", ".", "'/mod/data/field/'", ".", "...
Returns the class name for that field type and includes it. @param string $fieldtype @return string
[ "Returns", "the", "class", "name", "for", "that", "field", "type", "and", "includes", "it", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/classes/search/entry.php#L350-L356
211,926
moodle/moodle
admin/tool/monitor/classes/notification_task.php
notification_task.generate_message
protected function generate_message($subscriptionid, \stdClass $eventobj) { try { $subscription = subscription_manager::get_subscription($subscriptionid); } catch (\dml_exception $e) { // Race condition, someone deleted the subscription. return false; } ...
php
protected function generate_message($subscriptionid, \stdClass $eventobj) { try { $subscription = subscription_manager::get_subscription($subscriptionid); } catch (\dml_exception $e) { // Race condition, someone deleted the subscription. return false; } ...
[ "protected", "function", "generate_message", "(", "$", "subscriptionid", ",", "\\", "stdClass", "$", "eventobj", ")", "{", "try", "{", "$", "subscription", "=", "subscription_manager", "::", "get_subscription", "(", "$", "subscriptionid", ")", ";", "}", "catch",...
Generates the message object for a give subscription and event. @param int $subscriptionid Subscription instance @param \stdClass $eventobj Event data @return false|\stdClass message object
[ "Generates", "the", "message", "object", "for", "a", "give", "subscription", "and", "event", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/monitor/classes/notification_task.php#L64-L100
211,927
moodle/moodle
admin/tool/monitor/classes/notification_task.php
notification_task.replace_placeholders
protected function replace_placeholders($template, subscription $subscription, $eventobj, $context) { $template = str_replace('{link}', $eventobj->link, $template); if ($eventobj->contextlevel == CONTEXT_MODULE && !empty($eventobj->contextinstanceid) && (strpos($template, '{modulelink}') !==...
php
protected function replace_placeholders($template, subscription $subscription, $eventobj, $context) { $template = str_replace('{link}', $eventobj->link, $template); if ($eventobj->contextlevel == CONTEXT_MODULE && !empty($eventobj->contextinstanceid) && (strpos($template, '{modulelink}') !==...
[ "protected", "function", "replace_placeholders", "(", "$", "template", ",", "subscription", "$", "subscription", ",", "$", "eventobj", ",", "$", "context", ")", "{", "$", "template", "=", "str_replace", "(", "'{link}'", ",", "$", "eventobj", "->", "link", ",...
Replace place holders in the template with respective content. @param string $template Message template. @param subscription $subscription subscription instance @param \stdclass $eventobj Event data @param \context $context context object @return mixed final template string.
[ "Replace", "place", "holders", "in", "the", "template", "with", "respective", "content", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/monitor/classes/notification_task.php#L112-L125
211,928
moodle/moodle
grade/report/singleview/classes/local/ui/override.php
override.is_disabled
public function is_disabled() { $lockedgrade = $lockedgradeitem = 0; if (!empty($this->grade->locked)) { $lockedgrade = 1; } if (!empty($this->grade->grade_item->locked)) { $lockedgradeitem = 1; } return ($lockedgrade || $lockedgradeitem); }
php
public function is_disabled() { $lockedgrade = $lockedgradeitem = 0; if (!empty($this->grade->locked)) { $lockedgrade = 1; } if (!empty($this->grade->grade_item->locked)) { $lockedgradeitem = 1; } return ($lockedgrade || $lockedgradeitem); }
[ "public", "function", "is_disabled", "(", ")", "{", "$", "lockedgrade", "=", "$", "lockedgradeitem", "=", "0", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "grade", "->", "locked", ")", ")", "{", "$", "lockedgrade", "=", "1", ";", "}", "if...
Is this input disabled @return bool
[ "Is", "this", "input", "disabled" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/ui/override.php#L55-L64
211,929
moodle/moodle
grade/report/singleview/classes/local/ui/override.php
override.get_label
public function get_label() { if (!isset($this->grade->label)) { $this->grade->label = ''; } return $this->grade->label; }
php
public function get_label() { if (!isset($this->grade->label)) { $this->grade->label = ''; } return $this->grade->label; }
[ "public", "function", "get_label", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "grade", "->", "label", ")", ")", "{", "$", "this", "->", "grade", "->", "label", "=", "''", ";", "}", "return", "$", "this", "->", "grade", "->", ...
Get the label for this form element. @return string
[ "Get", "the", "label", "for", "this", "form", "element", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/ui/override.php#L71-L76
211,930
moodle/moodle
grade/report/singleview/classes/local/ui/override.php
override.determine_format
public function determine_format() { if (!$this->grade->grade_item->is_overridable_item()) { return new empty_element(); } return new checkbox_attribute( $this->get_name(), $this->get_label(), $this->is_checked(), $this->is_disabled() ...
php
public function determine_format() { if (!$this->grade->grade_item->is_overridable_item()) { return new empty_element(); } return new checkbox_attribute( $this->get_name(), $this->get_label(), $this->is_checked(), $this->is_disabled() ...
[ "public", "function", "determine_format", "(", ")", "{", "if", "(", "!", "$", "this", "->", "grade", "->", "grade_item", "->", "is_overridable_item", "(", ")", ")", "{", "return", "new", "empty_element", "(", ")", ";", "}", "return", "new", "checkbox_attri...
Generate the element for this form input. @return element
[ "Generate", "the", "element", "for", "this", "form", "input", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/ui/override.php#L83-L93
211,931
moodle/moodle
grade/report/singleview/classes/local/ui/override.php
override.set
public function set($value) { if (empty($this->grade->id)) { return false; } $state = $value == 0 ? false : true; $this->grade->set_overridden($state); $this->grade->grade_item->force_regrading(); return false; }
php
public function set($value) { if (empty($this->grade->id)) { return false; } $state = $value == 0 ? false : true; $this->grade->set_overridden($state); $this->grade->grade_item->force_regrading(); return false; }
[ "public", "function", "set", "(", "$", "value", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "grade", "->", "id", ")", ")", "{", "return", "false", ";", "}", "$", "state", "=", "$", "value", "==", "0", "?", "false", ":", "true", ";", ...
Save the modified value of this form element. @param string $value The new value to set @return mixed string|false Any error message
[ "Save", "the", "modified", "value", "of", "this", "form", "element", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/singleview/classes/local/ui/override.php#L101-L111
211,932
moodle/moodle
blocks/edit_form.php
block_edit_form.is_editing_the_frontpage
public function is_editing_the_frontpage() { // There are some conditions to check related to contexts. $ctxconditions = $this->page->context->contextlevel == CONTEXT_COURSE && $this->page->context->instanceid == get_site()->id; $issiteindex = (strpos($this->page->pagetype, 'site-ind...
php
public function is_editing_the_frontpage() { // There are some conditions to check related to contexts. $ctxconditions = $this->page->context->contextlevel == CONTEXT_COURSE && $this->page->context->instanceid == get_site()->id; $issiteindex = (strpos($this->page->pagetype, 'site-ind...
[ "public", "function", "is_editing_the_frontpage", "(", ")", "{", "// There are some conditions to check related to contexts.", "$", "ctxconditions", "=", "$", "this", "->", "page", "->", "context", "->", "contextlevel", "==", "CONTEXT_COURSE", "&&", "$", "this", "->", ...
Returns true if the user is editing a frontpage. @return bool
[ "Returns", "true", "if", "the", "user", "is", "editing", "a", "frontpage", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/edit_form.php#L242-L249
211,933
moodle/moodle
enrol/database/lib.php
enrol_database_plugin.allow_unenrol_user
public function allow_unenrol_user(stdClass $instance, stdClass $ue) { if ($ue->status == ENROL_USER_SUSPENDED) { return true; } return false; }
php
public function allow_unenrol_user(stdClass $instance, stdClass $ue) { if ($ue->status == ENROL_USER_SUSPENDED) { return true; } return false; }
[ "public", "function", "allow_unenrol_user", "(", "stdClass", "$", "instance", ",", "stdClass", "$", "ue", ")", "{", "if", "(", "$", "ue", "->", "status", "==", "ENROL_USER_SUSPENDED", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}" ]
Does this plugin allow manual unenrolment of a specific user? Yes, but only if user suspended... @param stdClass $instance course enrol instance @param stdClass $ue record from user_enrolments table @return bool - true means user with 'enrol/xxx:unenrol' may unenrol this user, false means nobody may touch this user e...
[ "Does", "this", "plugin", "allow", "manual", "unenrolment", "of", "a", "specific", "user?", "Yes", "but", "only", "if", "user", "suspended", "..." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/database/lib.php#L77-L83
211,934
moodle/moodle
enrol/database/lib.php
enrol_database_plugin.db_init
protected function db_init() { global $CFG; require_once($CFG->libdir.'/adodb/adodb.inc.php'); // Connect to the external database (forcing new connection). $extdb = ADONewConnection($this->get_config('dbtype')); if ($this->get_config('debugdb')) { $extdb->debug = t...
php
protected function db_init() { global $CFG; require_once($CFG->libdir.'/adodb/adodb.inc.php'); // Connect to the external database (forcing new connection). $extdb = ADONewConnection($this->get_config('dbtype')); if ($this->get_config('debugdb')) { $extdb->debug = t...
[ "protected", "function", "db_init", "(", ")", "{", "global", "$", "CFG", ";", "require_once", "(", "$", "CFG", "->", "libdir", ".", "'/adodb/adodb.inc.php'", ")", ";", "// Connect to the external database (forcing new connection).", "$", "extdb", "=", "ADONewConnectio...
Tries to make connection to the external database. @return null|ADONewConnection
[ "Tries", "to", "make", "connection", "to", "the", "external", "database", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/enrol/database/lib.php#L853-L878
211,935
moodle/moodle
lib/portfolio/formats/leap2a/lib.php
portfolio_format_leap2a_writer.add_entry
public function add_entry(portfolio_format_leap2a_entry $entry) { if (array_key_exists($entry->id, $this->entries)) { if (!($entry instanceof portfolio_format_leap2a_file)) { throw new portfolio_format_leap2a_exception('leap2a_entryalreadyexists', 'portfolio', '', $entry->id); ...
php
public function add_entry(portfolio_format_leap2a_entry $entry) { if (array_key_exists($entry->id, $this->entries)) { if (!($entry instanceof portfolio_format_leap2a_file)) { throw new portfolio_format_leap2a_exception('leap2a_entryalreadyexists', 'portfolio', '', $entry->id); ...
[ "public", "function", "add_entry", "(", "portfolio_format_leap2a_entry", "$", "entry", ")", "{", "if", "(", "array_key_exists", "(", "$", "entry", "->", "id", ",", "$", "this", "->", "entries", ")", ")", "{", "if", "(", "!", "(", "$", "entry", "instanceo...
Adds a entry to the feed ready to be exported @param portfolio_format_leap2a_entry $entry new feed entry to add @return portfolio_format_leap2a_entry
[ "Adds", "a", "entry", "to", "the", "feed", "ready", "to", "be", "exported" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/formats/leap2a/lib.php#L111-L119
211,936
moodle/moodle
lib/portfolio/formats/leap2a/lib.php
portfolio_format_leap2a_writer.make_selection
public function make_selection($selectionentry, $ids, $selectiontype) { $selectionid = null; if ($selectionentry instanceof portfolio_format_leap2a_entry) { $selectionid = $selectionentry->id; } else if (is_string($selectionentry)) { $selectionid = $selectionentry; ...
php
public function make_selection($selectionentry, $ids, $selectiontype) { $selectionid = null; if ($selectionentry instanceof portfolio_format_leap2a_entry) { $selectionid = $selectionentry->id; } else if (is_string($selectionentry)) { $selectionid = $selectionentry; ...
[ "public", "function", "make_selection", "(", "$", "selectionentry", ",", "$", "ids", ",", "$", "selectiontype", ")", "{", "$", "selectionid", "=", "null", ";", "if", "(", "$", "selectionentry", "instanceof", "portfolio_format_leap2a_entry", ")", "{", "$", "sel...
Select an entry that has previously been added into the feed @param portfolio_format_leap2a_entry|string $selectionentry the entry to make a selection (id or entry object) @param array $ids array of ids this selection includes @param string $selectiontype for selection type, see: http://wiki.cetis.ac.uk/2009-03/LEAP2A...
[ "Select", "an", "entry", "that", "has", "previously", "been", "added", "into", "the", "feed" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/formats/leap2a/lib.php#L128-L150
211,937
moodle/moodle
lib/portfolio/formats/leap2a/lib.php
portfolio_format_leap2a_writer.link_files
public function link_files($entry, $files) { foreach ($files as $file) { $fileentry = new portfolio_format_leap2a_file($file->get_filename(), $file); $this->add_entry($fileentry); $entry->add_link($fileentry, 'related'); $fileentry->add_link($entry, 'related'); ...
php
public function link_files($entry, $files) { foreach ($files as $file) { $fileentry = new portfolio_format_leap2a_file($file->get_filename(), $file); $this->add_entry($fileentry); $entry->add_link($fileentry, 'related'); $fileentry->add_link($entry, 'related'); ...
[ "public", "function", "link_files", "(", "$", "entry", ",", "$", "files", ")", "{", "foreach", "(", "$", "files", "as", "$", "file", ")", "{", "$", "fileentry", "=", "new", "portfolio_format_leap2a_file", "(", "$", "file", "->", "get_filename", "(", ")",...
Helper function to link some stored_files into the feed and link them to a particular entry @param portfolio_format_leap2a_entry $entry feed object @param array $files array of stored_files to link
[ "Helper", "function", "to", "link", "some", "stored_files", "into", "the", "feed", "and", "link", "them", "to", "a", "particular", "entry" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/formats/leap2a/lib.php#L158-L165
211,938
moodle/moodle
lib/portfolio/formats/leap2a/lib.php
portfolio_format_leap2a_writer.validate
private function validate() { foreach ($this->entries as $entry) { // first call the entry's own validation method // which will throw an exception if there's anything wrong $entry->validate(); // now make sure that all links are in place foreach ($ent...
php
private function validate() { foreach ($this->entries as $entry) { // first call the entry's own validation method // which will throw an exception if there's anything wrong $entry->validate(); // now make sure that all links are in place foreach ($ent...
[ "private", "function", "validate", "(", ")", "{", "foreach", "(", "$", "this", "->", "entries", "as", "$", "entry", ")", "{", "// first call the entry's own validation method", "// which will throw an exception if there's anything wrong", "$", "entry", "->", "validate", ...
Validate the feed and all entries
[ "Validate", "the", "feed", "and", "all", "entries" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/formats/leap2a/lib.php#L170-L189
211,939
moodle/moodle
lib/portfolio/formats/leap2a/lib.php
portfolio_format_leap2a_writer.to_xml
public function to_xml() { $this->validate(); foreach ($this->entries as $entry) { $entry->id = 'portfolio:' . $entry->id; $this->feed->appendChild($entry->to_dom($this->dom, $this->user)); } return $this->dom->saveXML(); }
php
public function to_xml() { $this->validate(); foreach ($this->entries as $entry) { $entry->id = 'portfolio:' . $entry->id; $this->feed->appendChild($entry->to_dom($this->dom, $this->user)); } return $this->dom->saveXML(); }
[ "public", "function", "to_xml", "(", ")", "{", "$", "this", "->", "validate", "(", ")", ";", "foreach", "(", "$", "this", "->", "entries", "as", "$", "entry", ")", "{", "$", "entry", "->", "id", "=", "'portfolio:'", ".", "$", "entry", "->", "id", ...
Return the entire feed as a string. Then, it calls for validation @return string feeds' content in xml
[ "Return", "the", "entire", "feed", "as", "a", "string", ".", "Then", "it", "calls", "for", "validation" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/formats/leap2a/lib.php#L197-L204
211,940
moodle/moodle
lib/portfolio/formats/leap2a/lib.php
portfolio_format_leap2a_entry.validate
public function validate() { foreach ($this->requiredfields as $key) { if (empty($this->{$key})) { throw new portfolio_format_leap2a_exception('leap2a_missingfield', 'portfolio', '', $key); } } if ($this->type == 'selection') { if (count($this-...
php
public function validate() { foreach ($this->requiredfields as $key) { if (empty($this->{$key})) { throw new portfolio_format_leap2a_exception('leap2a_missingfield', 'portfolio', '', $key); } } if ($this->type == 'selection') { if (count($this-...
[ "public", "function", "validate", "(", ")", "{", "foreach", "(", "$", "this", "->", "requiredfields", "as", "$", "key", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "{", "$", "key", "}", ")", ")", "{", "throw", "new", "portfolio_format_leap2...
Validate this entry. At the moment this just makes sure required fields exist but it could also check things against a list, for example @todo MDL-31303 - add category with a scheme 'selection_type'
[ "Validate", "this", "entry", ".", "At", "the", "moment", "this", "just", "makes", "sure", "required", "fields", "exist", "but", "it", "could", "also", "check", "things", "against", "a", "list", "for", "example" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/formats/leap2a/lib.php#L304-L316
211,941
moodle/moodle
lib/portfolio/formats/leap2a/lib.php
portfolio_format_leap2a_file.add_extra_links
protected function add_extra_links($dom, $entry) { $link = $dom->createElement('link'); $link->setAttribute('rel', 'enclosure'); $link->setAttribute('href', portfolio_format_leap2a::get_file_directory() . $this->referencedfile->get_filename()); $link->setAttribute('length', $this->refer...
php
protected function add_extra_links($dom, $entry) { $link = $dom->createElement('link'); $link->setAttribute('rel', 'enclosure'); $link->setAttribute('href', portfolio_format_leap2a::get_file_directory() . $this->referencedfile->get_filename()); $link->setAttribute('length', $this->refer...
[ "protected", "function", "add_extra_links", "(", "$", "dom", ",", "$", "entry", ")", "{", "$", "link", "=", "$", "dom", "->", "createElement", "(", "'link'", ")", ";", "$", "link", "->", "setAttribute", "(", "'rel'", ",", "'enclosure'", ")", ";", "$", ...
Implement the hook to add extra links to attach the file in an enclosure @param DomDocument $dom feed object @param DomDocument $entry feed added link
[ "Implement", "the", "hook", "to", "add", "extra", "links", "to", "attach", "the", "file", "in", "an", "enclosure" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/portfolio/formats/leap2a/lib.php#L524-L531
211,942
moodle/moodle
question/classes/statistics/responses/analysis_for_question_all_tries.php
analysis_for_question_all_tries.get_maximum_tries
public function get_maximum_tries() { $max = 1; foreach ($this->get_variant_nos() as $variantno) { foreach ($this->get_subpart_ids($variantno) as $subpartid) { $max = max($max, $this->get_analysis_for_subpart($variantno, $subpartid)->get_maximum_tries()); } ...
php
public function get_maximum_tries() { $max = 1; foreach ($this->get_variant_nos() as $variantno) { foreach ($this->get_subpart_ids($variantno) as $subpartid) { $max = max($max, $this->get_analysis_for_subpart($variantno, $subpartid)->get_maximum_tries()); } ...
[ "public", "function", "get_maximum_tries", "(", ")", "{", "$", "max", "=", "1", ";", "foreach", "(", "$", "this", "->", "get_variant_nos", "(", ")", "as", "$", "variantno", ")", "{", "foreach", "(", "$", "this", "->", "get_subpart_ids", "(", "$", "vari...
What is the highest number of tries at this question? @return int try number
[ "What", "is", "the", "highest", "number", "of", "tries", "at", "this", "question?" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/responses/analysis_for_question_all_tries.php#L74-L82
211,943
moodle/moodle
mod/page/classes/external.php
mod_page_external.get_pages_by_courses
public static function get_pages_by_courses($courseids = array()) { $warnings = array(); $returnedpages = array(); $params = array( 'courseids' => $courseids, ); $params = self::validate_parameters(self::get_pages_by_courses_parameters(), $params); $mycours...
php
public static function get_pages_by_courses($courseids = array()) { $warnings = array(); $returnedpages = array(); $params = array( 'courseids' => $courseids, ); $params = self::validate_parameters(self::get_pages_by_courses_parameters(), $params); $mycours...
[ "public", "static", "function", "get_pages_by_courses", "(", "$", "courseids", "=", "array", "(", ")", ")", "{", "$", "warnings", "=", "array", "(", ")", ";", "$", "returnedpages", "=", "array", "(", ")", ";", "$", "params", "=", "array", "(", "'course...
Returns a list of pages in a provided list of courses. If no list is provided all pages that the user can view will be returned. @param array $courseids course ids @return array of warnings and pages @since Moodle 3.3
[ "Returns", "a", "list", "of", "pages", "in", "a", "provided", "list", "of", "courses", ".", "If", "no", "list", "is", "provided", "all", "pages", "that", "the", "user", "can", "view", "will", "be", "returned", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/page/classes/external.php#L131-L178
211,944
moodle/moodle
admin/tool/recyclebin/classes/task/cleanup_category_bin.php
cleanup_category_bin.execute
public function execute() { global $DB; // Check if the category bin is disabled or there is no expiry time. $lifetime = get_config('tool_recyclebin', 'categorybinexpiry'); if (!\tool_recyclebin\category_bin::is_enabled() || $lifetime <= 0) { return true; } ...
php
public function execute() { global $DB; // Check if the category bin is disabled or there is no expiry time. $lifetime = get_config('tool_recyclebin', 'categorybinexpiry'); if (!\tool_recyclebin\category_bin::is_enabled() || $lifetime <= 0) { return true; } ...
[ "public", "function", "execute", "(", ")", "{", "global", "$", "DB", ";", "// Check if the category bin is disabled or there is no expiry time.", "$", "lifetime", "=", "get_config", "(", "'tool_recyclebin'", ",", "'categorybinexpiry'", ")", ";", "if", "(", "!", "\\", ...
Delete all expired items.
[ "Delete", "all", "expired", "items", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/recyclebin/classes/task/cleanup_category_bin.php#L46-L66
211,945
moodle/moodle
lib/scssphp/Parser.php
Parser.throwParseError
public function throwParseError($msg = 'parse error') { list($line, /* $column */) = $this->getSourcePosition($this->count); $loc = empty($this->sourceName) ? "line: $line" : "$this->sourceName on line $line"; if ($this->peek("(.*?)(\n|$)", $m, $this->count)) { throw new Parser...
php
public function throwParseError($msg = 'parse error') { list($line, /* $column */) = $this->getSourcePosition($this->count); $loc = empty($this->sourceName) ? "line: $line" : "$this->sourceName on line $line"; if ($this->peek("(.*?)(\n|$)", $m, $this->count)) { throw new Parser...
[ "public", "function", "throwParseError", "(", "$", "msg", "=", "'parse error'", ")", "{", "list", "(", "$", "line", ",", "/* $column */", ")", "=", "$", "this", "->", "getSourcePosition", "(", "$", "this", "->", "count", ")", ";", "$", "loc", "=", "emp...
Throw parser error @api @param string $msg @throws \Leafo\ScssPhp\Exception\ParserException
[ "Throw", "parser", "error" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L121-L132
211,946
moodle/moodle
lib/scssphp/Parser.php
Parser.parseValue
public function parseValue($buffer, &$out) { $this->count = 0; $this->env = null; $this->inParens = false; $this->eatWhiteDefault = true; $this->buffer = (string) $buffer; $this->saveEncoding(); $list = $this->valueList(...
php
public function parseValue($buffer, &$out) { $this->count = 0; $this->env = null; $this->inParens = false; $this->eatWhiteDefault = true; $this->buffer = (string) $buffer; $this->saveEncoding(); $list = $this->valueList(...
[ "public", "function", "parseValue", "(", "$", "buffer", ",", "&", "$", "out", ")", "{", "$", "this", "->", "count", "=", "0", ";", "$", "this", "->", "env", "=", "null", ";", "$", "this", "->", "inParens", "=", "false", ";", "$", "this", "->", ...
Parse a value or value list @api @param string $buffer @param string $out @return boolean
[ "Parse", "a", "value", "or", "value", "list" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L197-L212
211,947
moodle/moodle
lib/scssphp/Parser.php
Parser.parseSelector
public function parseSelector($buffer, &$out) { $this->count = 0; $this->env = null; $this->inParens = false; $this->eatWhiteDefault = true; $this->buffer = (string) $buffer; $this->saveEncoding(); $selector = $this->sel...
php
public function parseSelector($buffer, &$out) { $this->count = 0; $this->env = null; $this->inParens = false; $this->eatWhiteDefault = true; $this->buffer = (string) $buffer; $this->saveEncoding(); $selector = $this->sel...
[ "public", "function", "parseSelector", "(", "$", "buffer", ",", "&", "$", "out", ")", "{", "$", "this", "->", "count", "=", "0", ";", "$", "this", "->", "env", "=", "null", ";", "$", "this", "->", "inParens", "=", "false", ";", "$", "this", "->",...
Parse a selector or selector list @api @param string $buffer @param string $out @return boolean
[ "Parse", "a", "selector", "or", "selector", "list" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L224-L239
211,948
moodle/moodle
lib/scssphp/Parser.php
Parser.peek
protected function peek($regex, &$out, $from = null) { if (! isset($from)) { $from = $this->count; } $r = '/' . $regex . '/' . $this->patternModifiers; $result = preg_match($r, $this->buffer, $out, null, $from); return $result; }
php
protected function peek($regex, &$out, $from = null) { if (! isset($from)) { $from = $this->count; } $r = '/' . $regex . '/' . $this->patternModifiers; $result = preg_match($r, $this->buffer, $out, null, $from); return $result; }
[ "protected", "function", "peek", "(", "$", "regex", ",", "&", "$", "out", ",", "$", "from", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "from", ")", ")", "{", "$", "from", "=", "$", "this", "->", "count", ";", "}", "$", "r", "...
Peek input stream @param string $regex @param array $out @param integer $from @return integer
[ "Peek", "input", "stream" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L787-L797
211,949
moodle/moodle
lib/scssphp/Parser.php
Parser.matchString
protected function matchString(&$m, $delim) { $token = null; $end = strlen($this->buffer); // look for either ending delim, escape, or string interpolation foreach (['#{', '\\', $delim] as $lookahead) { $pos = strpos($this->buffer, $lookahead, $this->count); ...
php
protected function matchString(&$m, $delim) { $token = null; $end = strlen($this->buffer); // look for either ending delim, escape, or string interpolation foreach (['#{', '\\', $delim] as $lookahead) { $pos = strpos($this->buffer, $lookahead, $this->count); ...
[ "protected", "function", "matchString", "(", "&", "$", "m", ",", "$", "delim", ")", "{", "$", "token", "=", "null", ";", "$", "end", "=", "strlen", "(", "$", "this", "->", "buffer", ")", ";", "// look for either ending delim, escape, or string interpolation", ...
Match string looking for either ending delim, escape, or string interpolation {@internal This is a workaround for preg_match's 250K string match limit. }} @param array $m Matches (passed by reference) @param string $delim Delimeter @return boolean True if match; false otherwise
[ "Match", "string", "looking", "for", "either", "ending", "delim", "escape", "or", "string", "interpolation" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L827-L856
211,950
moodle/moodle
lib/scssphp/Parser.php
Parser.literal
protected function literal($what, $eatWhitespace = null) { if (! isset($eatWhitespace)) { $eatWhitespace = $this->eatWhiteDefault; } $len = strlen($what); if (strcasecmp(substr($this->buffer, $this->count, $len), $what) === 0) { $this->count += $len; ...
php
protected function literal($what, $eatWhitespace = null) { if (! isset($eatWhitespace)) { $eatWhitespace = $this->eatWhiteDefault; } $len = strlen($what); if (strcasecmp(substr($this->buffer, $this->count, $len), $what) === 0) { $this->count += $len; ...
[ "protected", "function", "literal", "(", "$", "what", ",", "$", "eatWhitespace", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "eatWhitespace", ")", ")", "{", "$", "eatWhitespace", "=", "$", "this", "->", "eatWhiteDefault", ";", "}", "$", ...
Match literal string @param string $what @param boolean $eatWhitespace @return boolean
[ "Match", "literal", "string" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L896-L915
211,951
moodle/moodle
lib/scssphp/Parser.php
Parser.whitespace
protected function whitespace() { $gotWhite = false; while (preg_match(static::$whitePattern, $this->buffer, $m, null, $this->count)) { if (isset($m[1]) && empty($this->commentsSeen[$this->count])) { $this->appendComment([Type::T_COMMENT, $m[1]]); $this-...
php
protected function whitespace() { $gotWhite = false; while (preg_match(static::$whitePattern, $this->buffer, $m, null, $this->count)) { if (isset($m[1]) && empty($this->commentsSeen[$this->count])) { $this->appendComment([Type::T_COMMENT, $m[1]]); $this-...
[ "protected", "function", "whitespace", "(", ")", "{", "$", "gotWhite", "=", "false", ";", "while", "(", "preg_match", "(", "static", "::", "$", "whitePattern", ",", "$", "this", "->", "buffer", ",", "$", "m", ",", "null", ",", "$", "this", "->", "cou...
Match some whitespace @return boolean
[ "Match", "some", "whitespace" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L922-L938
211,952
moodle/moodle
lib/scssphp/Parser.php
Parser.appendComment
protected function appendComment($comment) { $comment[1] = substr(preg_replace(['/^\s+/m', '/^(.)/m'], ['', ' \1'], $comment[1]), 1); $this->env->comments[] = $comment; }
php
protected function appendComment($comment) { $comment[1] = substr(preg_replace(['/^\s+/m', '/^(.)/m'], ['', ' \1'], $comment[1]), 1); $this->env->comments[] = $comment; }
[ "protected", "function", "appendComment", "(", "$", "comment", ")", "{", "$", "comment", "[", "1", "]", "=", "substr", "(", "preg_replace", "(", "[", "'/^\\s+/m'", ",", "'/^(.)/m'", "]", ",", "[", "''", ",", "' \\1'", "]", ",", "$", "comment", "[", "...
Append comment to current block @param array $comment
[ "Append", "comment", "to", "current", "block" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L945-L950
211,953
moodle/moodle
lib/scssphp/Parser.php
Parser.append
protected function append($statement, $pos = null) { if ($pos !== null) { list($line, $column) = $this->getSourcePosition($pos); $statement[static::SOURCE_LINE] = $line; $statement[static::SOURCE_COLUMN] = $column; $statement[static::SOURCE_INDEX] = $this-...
php
protected function append($statement, $pos = null) { if ($pos !== null) { list($line, $column) = $this->getSourcePosition($pos); $statement[static::SOURCE_LINE] = $line; $statement[static::SOURCE_COLUMN] = $column; $statement[static::SOURCE_INDEX] = $this-...
[ "protected", "function", "append", "(", "$", "statement", ",", "$", "pos", "=", "null", ")", "{", "if", "(", "$", "pos", "!==", "null", ")", "{", "list", "(", "$", "line", ",", "$", "column", ")", "=", "$", "this", "->", "getSourcePosition", "(", ...
Append statement to current block @param array $statement @param integer $pos
[ "Append", "statement", "to", "current", "block" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L958-L976
211,954
moodle/moodle
lib/scssphp/Parser.php
Parser.last
protected function last() { $i = count($this->env->children) - 1; if (isset($this->env->children[$i])) { return $this->env->children[$i]; } }
php
protected function last() { $i = count($this->env->children) - 1; if (isset($this->env->children[$i])) { return $this->env->children[$i]; } }
[ "protected", "function", "last", "(", ")", "{", "$", "i", "=", "count", "(", "$", "this", "->", "env", "->", "children", ")", "-", "1", ";", "if", "(", "isset", "(", "$", "this", "->", "env", "->", "children", "[", "$", "i", "]", ")", ")", "{...
Returns last child was appended @return array|null
[ "Returns", "last", "child", "was", "appended" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L983-L990
211,955
moodle/moodle
lib/scssphp/Parser.php
Parser.expHelper
protected function expHelper($lhs, $minP) { $operators = static::$operatorPattern; $ss = $this->seek(); $whiteBefore = isset($this->buffer[$this->count - 1]) && ctype_space($this->buffer[$this->count - 1]); while ($this->match($operators, $m, false) && static::$preceden...
php
protected function expHelper($lhs, $minP) { $operators = static::$operatorPattern; $ss = $this->seek(); $whiteBefore = isset($this->buffer[$this->count - 1]) && ctype_space($this->buffer[$this->count - 1]); while ($this->match($operators, $m, false) && static::$preceden...
[ "protected", "function", "expHelper", "(", "$", "lhs", ",", "$", "minP", ")", "{", "$", "operators", "=", "static", "::", "$", "operatorPattern", ";", "$", "ss", "=", "$", "this", "->", "seek", "(", ")", ";", "$", "whiteBefore", "=", "isset", "(", ...
Parse left-hand side of subexpression @param array $lhs @param integer $minP @return array
[ "Parse", "left", "-", "hand", "side", "of", "subexpression" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L1251-L1292
211,956
moodle/moodle
lib/scssphp/Parser.php
Parser.parenValue
protected function parenValue(&$out) { $s = $this->seek(); $inParens = $this->inParens; if ($this->literal('(')) { if ($this->literal(')')) { $out = [Type::T_LIST, '', []]; return true; } $this->inParens = true; ...
php
protected function parenValue(&$out) { $s = $this->seek(); $inParens = $this->inParens; if ($this->literal('(')) { if ($this->literal(')')) { $out = [Type::T_LIST, '', []]; return true; } $this->inParens = true; ...
[ "protected", "function", "parenValue", "(", "&", "$", "out", ")", "{", "$", "s", "=", "$", "this", "->", "seek", "(", ")", ";", "$", "inParens", "=", "$", "this", "->", "inParens", ";", "if", "(", "$", "this", "->", "literal", "(", "'('", ")", ...
Parse parenthesized value @param array $out @return boolean
[ "Parse", "parenthesized", "value" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L1374-L1401
211,957
moodle/moodle
lib/scssphp/Parser.php
Parser.selectors
protected function selectors(&$out) { $s = $this->seek(); $selectors = []; while ($this->selector($sel)) { $selectors[] = $sel; if (! $this->literal(',')) { break; } while ($this->literal(',')) { ; // ignore e...
php
protected function selectors(&$out) { $s = $this->seek(); $selectors = []; while ($this->selector($sel)) { $selectors[] = $sel; if (! $this->literal(',')) { break; } while ($this->literal(',')) { ; // ignore e...
[ "protected", "function", "selectors", "(", "&", "$", "out", ")", "{", "$", "s", "=", "$", "this", "->", "seek", "(", ")", ";", "$", "selectors", "=", "[", "]", ";", "while", "(", "$", "this", "->", "selector", "(", "$", "sel", ")", ")", "{", ...
Parse comma separated selector list @param array $out @return boolean
[ "Parse", "comma", "separated", "selector", "list" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L1976-L2002
211,958
moodle/moodle
lib/scssphp/Parser.php
Parser.selector
protected function selector(&$out) { $selector = []; for (;;) { if ($this->match('[>+~]+', $m)) { $selector[] = [$m[0]]; continue; } if ($this->selectorSingle($part)) { $selector[] = $part; $this->m...
php
protected function selector(&$out) { $selector = []; for (;;) { if ($this->match('[>+~]+', $m)) { $selector[] = [$m[0]]; continue; } if ($this->selectorSingle($part)) { $selector[] = $part; $this->m...
[ "protected", "function", "selector", "(", "&", "$", "out", ")", "{", "$", "selector", "=", "[", "]", ";", "for", "(", ";", ";", ")", "{", "if", "(", "$", "this", "->", "match", "(", "'[>+~]+'", ",", "$", "m", ")", ")", "{", "$", "selector", "...
Parse whitespace separated selector list @param array $out @return boolean
[ "Parse", "whitespace", "separated", "selector", "list" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L2011-L2041
211,959
moodle/moodle
lib/scssphp/Parser.php
Parser.placeholder
protected function placeholder(&$placeholder) { if ($this->match( $this->utf8 ? '([\pL\w\-_]+|#[{][$][\pL\w\-_]+[}])' : '([\w\-_]+|#[{][$][\w\-_]+[}])', $m )) { $placeholder = $m[1]; return true; } retu...
php
protected function placeholder(&$placeholder) { if ($this->match( $this->utf8 ? '([\pL\w\-_]+|#[{][$][\pL\w\-_]+[}])' : '([\w\-_]+|#[{][$][\w\-_]+[}])', $m )) { $placeholder = $m[1]; return true; } retu...
[ "protected", "function", "placeholder", "(", "&", "$", "placeholder", ")", "{", "if", "(", "$", "this", "->", "match", "(", "$", "this", "->", "utf8", "?", "'([\\pL\\w\\-_]+|#[{][$][\\pL\\w\\-_]+[}])'", ":", "'([\\w\\-_]+|#[{][$][\\w\\-_]+[}])'", ",", "$", "m", ...
Parse a placeholder @param string $placeholder @return boolean
[ "Parse", "a", "placeholder" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L2238-L2252
211,960
moodle/moodle
lib/scssphp/Parser.php
Parser.url
protected function url(&$out) { if ($this->match('(url\(\s*(["\']?)([^)]+)\2\s*\))', $m)) { $out = [Type::T_STRING, '', ['url(' . $m[2] . $m[3] . $m[2] . ')']]; return true; } return false; }
php
protected function url(&$out) { if ($this->match('(url\(\s*(["\']?)([^)]+)\2\s*\))', $m)) { $out = [Type::T_STRING, '', ['url(' . $m[2] . $m[3] . $m[2] . ')']]; return true; } return false; }
[ "protected", "function", "url", "(", "&", "$", "out", ")", "{", "if", "(", "$", "this", "->", "match", "(", "'(url\\(\\s*([\"\\']?)([^)]+)\\2\\s*\\))'", ",", "$", "m", ")", ")", "{", "$", "out", "=", "[", "Type", "::", "T_STRING", ",", "''", ",", "["...
Parse a url @param array $out @return boolean
[ "Parse", "a", "url" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L2261-L2270
211,961
moodle/moodle
lib/scssphp/Parser.php
Parser.stripAssignmentFlags
protected function stripAssignmentFlags(&$value) { $flags = []; for ($token = &$value; $token[0] === Type::T_LIST && ($s = count($token[2])); $token = &$lastNode) { $lastNode = &$token[2][$s - 1]; while ($lastNode[0] === Type::T_KEYWORD && in_array($lastNode[1], ['!default'...
php
protected function stripAssignmentFlags(&$value) { $flags = []; for ($token = &$value; $token[0] === Type::T_LIST && ($s = count($token[2])); $token = &$lastNode) { $lastNode = &$token[2][$s - 1]; while ($lastNode[0] === Type::T_KEYWORD && in_array($lastNode[1], ['!default'...
[ "protected", "function", "stripAssignmentFlags", "(", "&", "$", "value", ")", "{", "$", "flags", "=", "[", "]", ";", "for", "(", "$", "token", "=", "&", "$", "value", ";", "$", "token", "[", "0", "]", "===", "Type", "::", "T_LIST", "&&", "(", "$"...
Strip assignment flag from the list @param array $value @return array
[ "Strip", "assignment", "flag", "from", "the", "list" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L2298-L2319
211,962
moodle/moodle
lib/scssphp/Parser.php
Parser.stripOptionalFlag
protected function stripOptionalFlag(&$selectors) { $optional = false; $selector = end($selectors); $part = end($selector); if ($part === ['!optional']) { array_pop($selectors[count($selectors) - 1]); $optional = true; } return $optional; ...
php
protected function stripOptionalFlag(&$selectors) { $optional = false; $selector = end($selectors); $part = end($selector); if ($part === ['!optional']) { array_pop($selectors[count($selectors) - 1]); $optional = true; } return $optional; ...
[ "protected", "function", "stripOptionalFlag", "(", "&", "$", "selectors", ")", "{", "$", "optional", "=", "false", ";", "$", "selector", "=", "end", "(", "$", "selectors", ")", ";", "$", "part", "=", "end", "(", "$", "selector", ")", ";", "if", "(", ...
Strip optional flag from selector list @param array $selectors @return string
[ "Strip", "optional", "flag", "from", "selector", "list" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L2328-L2342
211,963
moodle/moodle
lib/scssphp/Parser.php
Parser.flattenList
protected function flattenList($value) { if ($value[0] === Type::T_LIST && count($value[2]) === 1) { return $this->flattenList($value[2][0]); } return $value; }
php
protected function flattenList($value) { if ($value[0] === Type::T_LIST && count($value[2]) === 1) { return $this->flattenList($value[2][0]); } return $value; }
[ "protected", "function", "flattenList", "(", "$", "value", ")", "{", "if", "(", "$", "value", "[", "0", "]", "===", "Type", "::", "T_LIST", "&&", "count", "(", "$", "value", "[", "2", "]", ")", "===", "1", ")", "{", "return", "$", "this", "->", ...
Turn list of length 1 into value type @param array $value @return array
[ "Turn", "list", "of", "length", "1", "into", "value", "type" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L2351-L2358
211,964
moodle/moodle
lib/scssphp/Parser.php
Parser.extractLineNumbers
private function extractLineNumbers($buffer) { $this->sourcePositions = [0 => 0]; $prev = 0; while (($pos = strpos($buffer, "\n", $prev)) !== false) { $this->sourcePositions[] = $pos; $prev = $pos + 1; } $this->sourcePositions[] = strlen($buffer); ...
php
private function extractLineNumbers($buffer) { $this->sourcePositions = [0 => 0]; $prev = 0; while (($pos = strpos($buffer, "\n", $prev)) !== false) { $this->sourcePositions[] = $pos; $prev = $pos + 1; } $this->sourcePositions[] = strlen($buffer); ...
[ "private", "function", "extractLineNumbers", "(", "$", "buffer", ")", "{", "$", "this", "->", "sourcePositions", "=", "[", "0", "=>", "0", "]", ";", "$", "prev", "=", "0", ";", "while", "(", "(", "$", "pos", "=", "strpos", "(", "$", "buffer", ",", ...
Extract line numbers from buffer @param string $buffer
[ "Extract", "line", "numbers", "from", "buffer" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L2419-L2434
211,965
moodle/moodle
lib/scssphp/Parser.php
Parser.saveEncoding
private function saveEncoding() { if (version_compare(PHP_VERSION, '7.2.0') >= 0) { return; } $iniDirective = 'mbstring' . '.func_overload'; // deprecated in PHP 7.2 if (ini_get($iniDirective) & 2) { $this->encoding = mb_internal_encoding(); mb_...
php
private function saveEncoding() { if (version_compare(PHP_VERSION, '7.2.0') >= 0) { return; } $iniDirective = 'mbstring' . '.func_overload'; // deprecated in PHP 7.2 if (ini_get($iniDirective) & 2) { $this->encoding = mb_internal_encoding(); mb_...
[ "private", "function", "saveEncoding", "(", ")", "{", "if", "(", "version_compare", "(", "PHP_VERSION", ",", "'7.2.0'", ")", ">=", "0", ")", "{", "return", ";", "}", "$", "iniDirective", "=", "'mbstring'", ".", "'.func_overload'", ";", "// deprecated in PHP 7....
Save internal encoding
[ "Save", "internal", "encoding" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/scssphp/Parser.php#L2470-L2483
211,966
moodle/moodle
question/classes/output/qbank_chooser.php
qbank_chooser.get
public static function get($course, $hiddenparams, array $allowedqtypes = null) { $realqtypes = array(); $fakeqtypes = array(); foreach (question_bank::get_creatable_qtypes() as $qtypename => $qtype) { if ($allowedqtypes && !in_array($qtypename, $allowedqtypes)) { co...
php
public static function get($course, $hiddenparams, array $allowedqtypes = null) { $realqtypes = array(); $fakeqtypes = array(); foreach (question_bank::get_creatable_qtypes() as $qtypename => $qtype) { if ($allowedqtypes && !in_array($qtypename, $allowedqtypes)) { co...
[ "public", "static", "function", "get", "(", "$", "course", ",", "$", "hiddenparams", ",", "array", "$", "allowedqtypes", "=", "null", ")", "{", "$", "realqtypes", "=", "array", "(", ")", ";", "$", "fakeqtypes", "=", "array", "(", ")", ";", "foreach", ...
Get an instance of the question bank chooser. @param stdClass $course The course. @param array $hiddenparams Hidden parameters. @param array|null $allowedqtypes Allowed question types. @return qbank_chooser
[ "Get", "an", "instance", "of", "the", "question", "bank", "chooser", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/output/qbank_chooser.php#L87-L103
211,967
moodle/moodle
customfield/classes/api.php
api.get_instance_fields_data
public static function get_instance_fields_data(array $fields, int $instanceid, bool $adddefaults = true) : array { return self::get_instances_fields_data($fields, [$instanceid], $adddefaults)[$instanceid]; }
php
public static function get_instance_fields_data(array $fields, int $instanceid, bool $adddefaults = true) : array { return self::get_instances_fields_data($fields, [$instanceid], $adddefaults)[$instanceid]; }
[ "public", "static", "function", "get_instance_fields_data", "(", "array", "$", "fields", ",", "int", "$", "instanceid", ",", "bool", "$", "adddefaults", "=", "true", ")", ":", "array", "{", "return", "self", "::", "get_instances_fields_data", "(", "$", "fields...
For the given instance and list of fields fields retrieves data associated with them @param field_controller[] $fields list of fields indexed by field id @param int $instanceid @param bool $adddefaults @return data_controller[] array of data_controller objects indexed by fieldid. All fields are present, some data_cont...
[ "For", "the", "given", "instance", "and", "list", "of", "fields", "fields", "retrieves", "data", "associated", "with", "them" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/api.php#L57-L59
211,968
moodle/moodle
customfield/classes/api.php
api.get_instances_fields_data
public static function get_instances_fields_data(array $fields, array $instanceids, bool $adddefaults = true) : array { global $DB; // Create the results array where instances and fields order is the same as in the input arrays. $result = array_fill_keys($instanceids, array_fill_keys(array_keys...
php
public static function get_instances_fields_data(array $fields, array $instanceids, bool $adddefaults = true) : array { global $DB; // Create the results array where instances and fields order is the same as in the input arrays. $result = array_fill_keys($instanceids, array_fill_keys(array_keys...
[ "public", "static", "function", "get_instances_fields_data", "(", "array", "$", "fields", ",", "array", "$", "instanceids", ",", "bool", "$", "adddefaults", "=", "true", ")", ":", "array", "{", "global", "$", "DB", ";", "// Create the results array where instances...
For given list of instances and fields retrieves data associated with them @param field_controller[] $fields list of fields indexed by field id @param int[] $instanceids @param bool $adddefaults @return data_controller[][] 2-dimension array, first index is instanceid, second index is fieldid. If ($adddefaults): All in...
[ "For", "given", "list", "of", "instances", "and", "fields", "retrieves", "data", "associated", "with", "them" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/api.php#L72-L113
211,969
moodle/moodle
customfield/classes/api.php
api.get_available_field_types
public static function get_available_field_types() { $fieldtypes = array(); $plugins = \core\plugininfo\customfield::get_enabled_plugins(); foreach ($plugins as $type => $unused) { $fieldtypes[$type] = get_string('pluginname', 'customfield_' . $type); } asort($fieldt...
php
public static function get_available_field_types() { $fieldtypes = array(); $plugins = \core\plugininfo\customfield::get_enabled_plugins(); foreach ($plugins as $type => $unused) { $fieldtypes[$type] = get_string('pluginname', 'customfield_' . $type); } asort($fieldt...
[ "public", "static", "function", "get_available_field_types", "(", ")", "{", "$", "fieldtypes", "=", "array", "(", ")", ";", "$", "plugins", "=", "\\", "core", "\\", "plugininfo", "\\", "customfield", "::", "get_enabled_plugins", "(", ")", ";", "foreach", "("...
Retrieve a list of all available custom field types @return array a list of the fieldtypes suitable to use in a select statement
[ "Retrieve", "a", "list", "of", "all", "available", "custom", "field", "types" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/api.php#L120-L130
211,970
moodle/moodle
customfield/classes/api.php
api.save_field_configuration
public static function save_field_configuration(field_controller $field, \stdClass $formdata) { foreach ($formdata as $key => $value) { if ($key === 'configdata' && is_array($formdata->configdata)) { $field->set($key, json_encode($value)); } else if ($key === 'id' || ($ke...
php
public static function save_field_configuration(field_controller $field, \stdClass $formdata) { foreach ($formdata as $key => $value) { if ($key === 'configdata' && is_array($formdata->configdata)) { $field->set($key, json_encode($value)); } else if ($key === 'id' || ($ke...
[ "public", "static", "function", "save_field_configuration", "(", "field_controller", "$", "field", ",", "\\", "stdClass", "$", "formdata", ")", "{", "foreach", "(", "$", "formdata", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "$", "key", "...
Updates or creates a field with data that came from a form @param field_controller $field @param \stdClass $formdata
[ "Updates", "or", "creates", "a", "field", "with", "data", "that", "came", "from", "a", "form" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/api.php#L138-L179
211,971
moodle/moodle
customfield/classes/api.php
api.delete_field_configuration
public static function delete_field_configuration(field_controller $field) : bool { $event = field_deleted::create_from_object($field); get_file_storage()->delete_area_files($field->get_handler()->get_configuration_context()->id, 'core_customfield', 'description', $field->get('id')); ...
php
public static function delete_field_configuration(field_controller $field) : bool { $event = field_deleted::create_from_object($field); get_file_storage()->delete_area_files($field->get_handler()->get_configuration_context()->id, 'core_customfield', 'description', $field->get('id')); ...
[ "public", "static", "function", "delete_field_configuration", "(", "field_controller", "$", "field", ")", ":", "bool", "{", "$", "event", "=", "field_deleted", "::", "create_from_object", "(", "$", "field", ")", ";", "get_file_storage", "(", ")", "->", "delete_a...
Delete a field @param field_controller $field
[ "Delete", "a", "field" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/api.php#L233-L240
211,972
moodle/moodle
customfield/classes/api.php
api.get_category_inplace_editable
public static function get_category_inplace_editable(category_controller $category, bool $editable = true) : inplace_editable { return new inplace_editable('core_customfield', 'category', $category->get('id'), ...
php
public static function get_category_inplace_editable(category_controller $category, bool $editable = true) : inplace_editable { return new inplace_editable('core_customfield', 'category', $category->get('id'), ...
[ "public", "static", "function", "get_category_inplace_editable", "(", "category_controller", "$", "category", ",", "bool", "$", "editable", "=", "true", ")", ":", "inplace_editable", "{", "return", "new", "inplace_editable", "(", "'core_customfield'", ",", "'category'...
Returns an object for inplace editable @param category_controller $category category that needs to be moved @param bool $editable @return inplace_editable
[ "Returns", "an", "object", "for", "inplace", "editable" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/api.php#L249-L259
211,973
moodle/moodle
customfield/classes/api.php
api.move_category
public static function move_category(category_controller $category, int $beforeid = 0) { global $DB; $records = $DB->get_records(category::TABLE, [ 'component' => $category->get('component'), 'area' => $category->get('area'), 'itemid' => $category->get('itemid') ...
php
public static function move_category(category_controller $category, int $beforeid = 0) { global $DB; $records = $DB->get_records(category::TABLE, [ 'component' => $category->get('component'), 'area' => $category->get('area'), 'itemid' => $category->get('itemid') ...
[ "public", "static", "function", "move_category", "(", "category_controller", "$", "category", ",", "int", "$", "beforeid", "=", "0", ")", "{", "global", "$", "DB", ";", "$", "records", "=", "$", "DB", "->", "get_records", "(", "category", "::", "TABLE", ...
Reorder categories, move given category before another category @param category_controller $category category that needs to be moved @param int $beforeid id of the category this category needs to be moved before, 0 to move to the end
[ "Reorder", "categories", "move", "given", "category", "before", "another", "category" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/api.php#L267-L294
211,974
moodle/moodle
customfield/classes/api.php
api.save_category
public static function save_category(category_controller $category) { $isnewcategory = empty($category->get('id')); $category->save(); if ($isnewcategory) { // Move to the end. self::move_category($category); category_created::create_from_object($category)->...
php
public static function save_category(category_controller $category) { $isnewcategory = empty($category->get('id')); $category->save(); if ($isnewcategory) { // Move to the end. self::move_category($category); category_created::create_from_object($category)->...
[ "public", "static", "function", "save_category", "(", "category_controller", "$", "category", ")", "{", "$", "isnewcategory", "=", "empty", "(", "$", "category", "->", "get", "(", "'id'", ")", ")", ";", "$", "category", "->", "save", "(", ")", ";", "if",...
Insert or update custom field category @param category_controller $category
[ "Insert", "or", "update", "custom", "field", "category" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/api.php#L301-L313
211,975
moodle/moodle
customfield/classes/api.php
api.delete_category
public static function delete_category(category_controller $category) : bool { $event = category_deleted::create_from_object($category); // Delete all fields. foreach ($category->get_fields() as $field) { self::delete_field_configuration($field); } $result = $catego...
php
public static function delete_category(category_controller $category) : bool { $event = category_deleted::create_from_object($category); // Delete all fields. foreach ($category->get_fields() as $field) { self::delete_field_configuration($field); } $result = $catego...
[ "public", "static", "function", "delete_category", "(", "category_controller", "$", "category", ")", ":", "bool", "{", "$", "event", "=", "category_deleted", "::", "create_from_object", "(", "$", "category", ")", ";", "// Delete all fields.", "foreach", "(", "$", ...
Delete a custom field category @param category_controller $category @return bool
[ "Delete", "a", "custom", "field", "category" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/api.php#L321-L332
211,976
moodle/moodle
customfield/classes/api.php
api.get_categories_with_fields
public static function get_categories_with_fields(string $component, string $area, int $itemid) : array { global $DB; $categories = []; $options = [ 'component' => $component, 'area' => $area, 'itemid' => $itemid ]; $plug...
php
public static function get_categories_with_fields(string $component, string $area, int $itemid) : array { global $DB; $categories = []; $options = [ 'component' => $component, 'area' => $area, 'itemid' => $itemid ]; $plug...
[ "public", "static", "function", "get_categories_with_fields", "(", "string", "$", "component", ",", "string", "$", "area", ",", "int", "$", "itemid", ")", ":", "array", "{", "global", "$", "DB", ";", "$", "categories", "=", "[", "]", ";", "$", "options",...
Returns a list of categories with their related fields. @param string $component @param string $area @param int $itemid @return category_controller[]
[ "Returns", "a", "list", "of", "categories", "with", "their", "related", "fields", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/customfield/classes/api.php#L342-L392
211,977
moodle/moodle
lib/htmlpurifier/HTMLPurifier/ConfigSchema/InterchangeBuilder.php
HTMLPurifier_ConfigSchema_InterchangeBuilder.build
public function build($interchange, $hash) { if (!$hash instanceof HTMLPurifier_StringHash) { $hash = new HTMLPurifier_StringHash($hash); } if (!isset($hash['ID'])) { throw new HTMLPurifier_ConfigSchema_Exception('Hash does not have any ID'); } if (str...
php
public function build($interchange, $hash) { if (!$hash instanceof HTMLPurifier_StringHash) { $hash = new HTMLPurifier_StringHash($hash); } if (!isset($hash['ID'])) { throw new HTMLPurifier_ConfigSchema_Exception('Hash does not have any ID'); } if (str...
[ "public", "function", "build", "(", "$", "interchange", ",", "$", "hash", ")", "{", "if", "(", "!", "$", "hash", "instanceof", "HTMLPurifier_StringHash", ")", "{", "$", "hash", "=", "new", "HTMLPurifier_StringHash", "(", "$", "hash", ")", ";", "}", "if",...
Builds an interchange object based on a hash. @param HTMLPurifier_ConfigSchema_Interchange $interchange HTMLPurifier_ConfigSchema_Interchange object to build @param HTMLPurifier_StringHash $hash source data @throws HTMLPurifier_ConfigSchema_Exception
[ "Builds", "an", "interchange", "object", "based", "on", "a", "hash", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/ConfigSchema/InterchangeBuilder.php#L82-L100
211,978
moodle/moodle
lib/htmlpurifier/HTMLPurifier/ConfigSchema/InterchangeBuilder.php
HTMLPurifier_ConfigSchema_InterchangeBuilder._findUnused
protected function _findUnused($hash) { $accessed = $hash->getAccessed(); foreach ($hash as $k => $v) { if (!isset($accessed[$k])) { trigger_error("String hash key '$k' not used by builder", E_USER_NOTICE); } } }
php
protected function _findUnused($hash) { $accessed = $hash->getAccessed(); foreach ($hash as $k => $v) { if (!isset($accessed[$k])) { trigger_error("String hash key '$k' not used by builder", E_USER_NOTICE); } } }
[ "protected", "function", "_findUnused", "(", "$", "hash", ")", "{", "$", "accessed", "=", "$", "hash", "->", "getAccessed", "(", ")", ";", "foreach", "(", "$", "hash", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(", "!", "isset", "(", "$", ...
Triggers errors for any unused keys passed in the hash; such keys may indicate typos, missing values, etc. @param HTMLPurifier_StringHash $hash Hash to check.
[ "Triggers", "errors", "for", "any", "unused", "keys", "passed", "in", "the", "hash", ";", "such", "keys", "may", "indicate", "typos", "missing", "values", "etc", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/ConfigSchema/InterchangeBuilder.php#L215-L223
211,979
moodle/moodle
availability/condition/grouping/classes/frontend.php
frontend.get_all_groupings
protected function get_all_groupings($courseid) { global $DB; if ($courseid != $this->allgroupingscourseid) { $this->allgroupings = $DB->get_records('groupings', array('courseid' => $courseid), 'id, name'); $this->allgroupingscourseid = $courseid; } ...
php
protected function get_all_groupings($courseid) { global $DB; if ($courseid != $this->allgroupingscourseid) { $this->allgroupings = $DB->get_records('groupings', array('courseid' => $courseid), 'id, name'); $this->allgroupingscourseid = $courseid; } ...
[ "protected", "function", "get_all_groupings", "(", "$", "courseid", ")", "{", "global", "$", "DB", ";", "if", "(", "$", "courseid", "!=", "$", "this", "->", "allgroupingscourseid", ")", "{", "$", "this", "->", "allgroupings", "=", "$", "DB", "->", "get_r...
Gets all the groupings on the course. @param int $courseid Course id @return array Array of grouping objects
[ "Gets", "all", "the", "groupings", "on", "the", "course", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/availability/condition/grouping/classes/frontend.php#L63-L71
211,980
moodle/moodle
admin/tool/lp/classes/form/competency.php
competency.extra_validation
protected function extra_validation($data, $files, array &$errors) { $newerrors = array(); // Move the error from scaleconfiguration to the form element scale ID. if (isset($errors['scaleconfiguration']) && !isset($errors['scaleid'])) { $newerrors['scaleid'] = $errors['scaleconfigura...
php
protected function extra_validation($data, $files, array &$errors) { $newerrors = array(); // Move the error from scaleconfiguration to the form element scale ID. if (isset($errors['scaleconfiguration']) && !isset($errors['scaleid'])) { $newerrors['scaleid'] = $errors['scaleconfigura...
[ "protected", "function", "extra_validation", "(", "$", "data", ",", "$", "files", ",", "array", "&", "$", "errors", ")", "{", "$", "newerrors", "=", "array", "(", ")", ";", "// Move the error from scaleconfiguration to the form element scale ID.", "if", "(", "isse...
Extra validation. @param stdClass $data Data to validate. @param array $files Array of files. @param array $errors Currently reported errors. @return array of additional errors, or overridden errors.
[ "Extra", "validation", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/lp/classes/form/competency.php#L161-L169
211,981
moodle/moodle
lib/filestorage/tgz_packer.php
tgz_packer.is_tgz_file
public static function is_tgz_file($archivefile) { if (is_a($archivefile, 'stored_file')) { $fp = $archivefile->get_content_file_handle(); } else { $fp = fopen($archivefile, 'rb'); } $firstbytes = fread($fp, 2); fclose($fp); return ($firstbytes[0] ...
php
public static function is_tgz_file($archivefile) { if (is_a($archivefile, 'stored_file')) { $fp = $archivefile->get_content_file_handle(); } else { $fp = fopen($archivefile, 'rb'); } $firstbytes = fread($fp, 2); fclose($fp); return ($firstbytes[0] ...
[ "public", "static", "function", "is_tgz_file", "(", "$", "archivefile", ")", "{", "if", "(", "is_a", "(", "$", "archivefile", ",", "'stored_file'", ")", ")", "{", "$", "fp", "=", "$", "archivefile", "->", "get_content_file_handle", "(", ")", ";", "}", "e...
Checks whether a file appears to be a .tar.gz file. @param string|stored_file $archivefile @return bool True if file contains the gzip magic number
[ "Checks", "whether", "a", "file", "appears", "to", "be", "a", ".", "tar", ".", "gz", "file", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/tgz_packer.php#L711-L720
211,982
moodle/moodle
lib/mathslib.php
calc_formula.localize
public static function localize($formula) { $formula = str_replace('.', '$', $formula); // temp placeholder $formula = str_replace(',', get_string('listsep', 'langconfig'), $formula); $formula = str_replace('$', get_string('decsep', 'langconfig'), $formula); return $formula; }
php
public static function localize($formula) { $formula = str_replace('.', '$', $formula); // temp placeholder $formula = str_replace(',', get_string('listsep', 'langconfig'), $formula); $formula = str_replace('$', get_string('decsep', 'langconfig'), $formula); return $formula; }
[ "public", "static", "function", "localize", "(", "$", "formula", ")", "{", "$", "formula", "=", "str_replace", "(", "'.'", ",", "'$'", ",", "$", "formula", ")", ";", "// temp placeholder", "$", "formula", "=", "str_replace", "(", "','", ",", "get_string", ...
Similar to format_float, formats the numbers and list separators according to locale specifics. @param string $formula @return string localised formula
[ "Similar", "to", "format_float", "formats", "the", "numbers", "and", "list", "separators", "according", "to", "locale", "specifics", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mathslib.php#L125-L130
211,983
moodle/moodle
lib/mathslib.php
calc_formula.unlocalize
public static function unlocalize($formula) { $formula = str_replace(get_string('decsep', 'langconfig'), '$', $formula); $formula = str_replace(get_string('listsep', 'langconfig'), ',', $formula); $formula = str_replace('$', '.', $formula); // temp placeholder return $formula; }
php
public static function unlocalize($formula) { $formula = str_replace(get_string('decsep', 'langconfig'), '$', $formula); $formula = str_replace(get_string('listsep', 'langconfig'), ',', $formula); $formula = str_replace('$', '.', $formula); // temp placeholder return $formula; }
[ "public", "static", "function", "unlocalize", "(", "$", "formula", ")", "{", "$", "formula", "=", "str_replace", "(", "get_string", "(", "'decsep'", ",", "'langconfig'", ")", ",", "'$'", ",", "$", "formula", ")", ";", "$", "formula", "=", "str_replace", ...
Similar to unformat_float, converts floats and lists to PHP standards. @param string $formula localised formula @return string
[ "Similar", "to", "unformat_float", "converts", "floats", "and", "lists", "to", "PHP", "standards", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mathslib.php#L137-L142
211,984
moodle/moodle
backup/moodle2/backup_course_task.class.php
backup_course_task.encode_links_helper
static private function encode_links_helper($content, $name, $path) { global $CFG; // We want to convert both http and https links. $root = $CFG->wwwroot; $httpsroot = str_replace('http://', 'https://', $root); $httproot = str_replace('https://', 'http://', $root); $http...
php
static private function encode_links_helper($content, $name, $path) { global $CFG; // We want to convert both http and https links. $root = $CFG->wwwroot; $httpsroot = str_replace('http://', 'https://', $root); $httproot = str_replace('https://', 'http://', $root); $http...
[ "static", "private", "function", "encode_links_helper", "(", "$", "content", ",", "$", "name", ",", "$", "path", ")", "{", "global", "$", "CFG", ";", "// We want to convert both http and https links.", "$", "root", "=", "$", "CFG", "->", "wwwroot", ";", "$", ...
Helper method, used by encode_content_links. @param string $content content in which to encode links. @param string $name the name of this type of encoded link. @param string $path the path that identifies this type of link, up to the ?paramname= bit. @return string content with one type of link encoded.
[ "Helper", "method", "used", "by", "encode_content_links", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/backup_course_task.class.php#L175-L189
211,985
moodle/moodle
mod/assignment/classes/privacy/provider.php
provider.has_marked_assignment_submissions
protected static function has_marked_assignment_submissions($assignmentid, $userid) { global $DB; $params = [ 'assignment' => $assignmentid, 'teacher' => $userid ]; $sql = "SELECT count(s.id) as nomarked FROM {assignment_submissions} s ...
php
protected static function has_marked_assignment_submissions($assignmentid, $userid) { global $DB; $params = [ 'assignment' => $assignmentid, 'teacher' => $userid ]; $sql = "SELECT count(s.id) as nomarked FROM {assignment_submissions} s ...
[ "protected", "static", "function", "has_marked_assignment_submissions", "(", "$", "assignmentid", ",", "$", "userid", ")", "{", "global", "$", "DB", ";", "$", "params", "=", "[", "'assignment'", "=>", "$", "assignmentid", ",", "'teacher'", "=>", "$", "userid",...
Helper function to check if a user has marked assignment submissions for a given assignment. @param int $assignmentid The assignment ID to check if user has marked associated submissions. @param int $userid The user ID to check if user has marked associated submissions. @return bool If user has marke...
[ "Helper", "function", "to", "check", "if", "a", "user", "has", "marked", "assignment", "submissions", "for", "a", "given", "assignment", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assignment/classes/privacy/provider.php#L345-L361
211,986
moodle/moodle
mod/assignment/classes/privacy/provider.php
provider.get_assignment_by_context
protected static function get_assignment_by_context($context) { global $DB; $params = [ 'modulename' => 'assignment', 'contextmodule' => CONTEXT_MODULE, 'contextid' => $context->id ]; $sql = "SELECT a.id, a.name, ...
php
protected static function get_assignment_by_context($context) { global $DB; $params = [ 'modulename' => 'assignment', 'contextmodule' => CONTEXT_MODULE, 'contextid' => $context->id ]; $sql = "SELECT a.id, a.name, ...
[ "protected", "static", "function", "get_assignment_by_context", "(", "$", "context", ")", "{", "global", "$", "DB", ";", "$", "params", "=", "[", "'modulename'", "=>", "'assignment'", ",", "'contextmodule'", "=>", "CONTEXT_MODULE", ",", "'contextid'", "=>", "$",...
Helper function to return assignment for a context module. @param object $context The context module object to return the assignment record by. @return mixed The assignment details or null record associated with the context module. @throws \dml_exception
[ "Helper", "function", "to", "return", "assignment", "for", "a", "context", "module", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assignment/classes/privacy/provider.php#L370-L394
211,987
moodle/moodle
mod/assignment/classes/privacy/provider.php
provider.get_assignment_output
protected static function get_assignment_output($assignmentdata) { $assignment = (object) [ 'name' => $assignmentdata->name, 'intro' => $assignmentdata->intro, 'assignmenttype' => $assignmentdata->assignmenttype, 'grade' => $assignmentdata->grade, 'tim...
php
protected static function get_assignment_output($assignmentdata) { $assignment = (object) [ 'name' => $assignmentdata->name, 'intro' => $assignmentdata->intro, 'assignmenttype' => $assignmentdata->assignmenttype, 'grade' => $assignmentdata->grade, 'tim...
[ "protected", "static", "function", "get_assignment_output", "(", "$", "assignmentdata", ")", "{", "$", "assignment", "=", "(", "object", ")", "[", "'name'", "=>", "$", "assignmentdata", "->", "name", ",", "'intro'", "=>", "$", "assignmentdata", "->", "intro", ...
Helper function generate assignment output object for exporting. @param object $assignmentdata Object containing assignment data. @return object Formatted assignment output object for exporting.
[ "Helper", "function", "generate", "assignment", "output", "object", "for", "exporting", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assignment/classes/privacy/provider.php#L497-L515
211,988
moodle/moodle
mod/assignment/classes/privacy/provider.php
provider.get_assignment_submission_output
protected static function get_assignment_submission_output($submissiondata) { $submission = (object) [ 'assignment' => $submissiondata->assignment, 'numfiles' => $submissiondata->numfiles, 'data1' => $submissiondata->data1, 'data2' => $submissiondata->data2, ...
php
protected static function get_assignment_submission_output($submissiondata) { $submission = (object) [ 'assignment' => $submissiondata->assignment, 'numfiles' => $submissiondata->numfiles, 'data1' => $submissiondata->data1, 'data2' => $submissiondata->data2, ...
[ "protected", "static", "function", "get_assignment_submission_output", "(", "$", "submissiondata", ")", "{", "$", "submission", "=", "(", "object", ")", "[", "'assignment'", "=>", "$", "submissiondata", "->", "assignment", ",", "'numfiles'", "=>", "$", "submission...
Helper function generate assignment submission output object for exporting. @param object $submissiondata Object containing assignment submission data. @return object Formatted assignment submission output for exporting.
[ "Helper", "function", "generate", "assignment", "submission", "output", "object", "for", "exporting", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assignment/classes/privacy/provider.php#L523-L547
211,989
moodle/moodle
admin/tool/policy/classes/external.php
external.get_policy_version
public static function get_policy_version($versionid, $behalfid = null) { global $PAGE; $result = []; $warnings = []; $params = external_api::validate_parameters(self::get_policy_version_parameters(), [ 'versionid' => $versionid, 'behalfid' => $behalfid ]...
php
public static function get_policy_version($versionid, $behalfid = null) { global $PAGE; $result = []; $warnings = []; $params = external_api::validate_parameters(self::get_policy_version_parameters(), [ 'versionid' => $versionid, 'behalfid' => $behalfid ]...
[ "public", "static", "function", "get_policy_version", "(", "$", "versionid", ",", "$", "behalfid", "=", "null", ")", "{", "global", "$", "PAGE", ";", "$", "result", "=", "[", "]", ";", "$", "warnings", "=", "[", "]", ";", "$", "params", "=", "externa...
Fetch the details of a policy version. @param int $versionid The policy version ID. @param int $behalfid The id of user on whose behalf the user is viewing the policy. @return array @throws coding_exception @throws dml_exception @throws invalid_parameter_exception @throws restricted_context_exception @throws moodle_ex...
[ "Fetch", "the", "details", "of", "a", "policy", "version", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/external.php#L81-L131
211,990
moodle/moodle
admin/tool/policy/classes/external.php
external.submit_accept_on_behalf
public static function submit_accept_on_behalf($jsonformdata) { // We always must pass webservice params through validate_parameters. $params = self::validate_parameters(self::submit_accept_on_behalf_parameters(), ['jsonformdata' => $jsonformdata]); self::validate_context(context_sy...
php
public static function submit_accept_on_behalf($jsonformdata) { // We always must pass webservice params through validate_parameters. $params = self::validate_parameters(self::submit_accept_on_behalf_parameters(), ['jsonformdata' => $jsonformdata]); self::validate_context(context_sy...
[ "public", "static", "function", "submit_accept_on_behalf", "(", "$", "jsonformdata", ")", "{", "// We always must pass webservice params through validate_parameters.", "$", "params", "=", "self", "::", "validate_parameters", "(", "self", "::", "submit_accept_on_behalf_parameter...
Submit the create group form. @param string $jsonformdata The data from the form, encoded as a json array. @return int new group id.
[ "Submit", "the", "create", "group", "form", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/policy/classes/external.php#L169-L188
211,991
moodle/moodle
lib/htmlpurifier/HTMLPurifier/StringHashParser.php
HTMLPurifier_StringHashParser.parseFile
public function parseFile($file) { if (!file_exists($file)) { return false; } $fh = fopen($file, 'r'); if (!$fh) { return false; } $ret = $this->parseHandle($fh); fclose($fh); return $ret; }
php
public function parseFile($file) { if (!file_exists($file)) { return false; } $fh = fopen($file, 'r'); if (!$fh) { return false; } $ret = $this->parseHandle($fh); fclose($fh); return $ret; }
[ "public", "function", "parseFile", "(", "$", "file", ")", "{", "if", "(", "!", "file_exists", "(", "$", "file", ")", ")", "{", "return", "false", ";", "}", "$", "fh", "=", "fopen", "(", "$", "file", ",", "'r'", ")", ";", "if", "(", "!", "$", ...
Parses a file that contains a single string-hash. @param string $file @return array
[ "Parses", "a", "file", "that", "contains", "a", "single", "string", "-", "hash", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/StringHashParser.php#L41-L53
211,992
moodle/moodle
lib/htmlpurifier/HTMLPurifier/StringHashParser.php
HTMLPurifier_StringHashParser.parseHandle
protected function parseHandle($fh) { $state = false; $single = false; $ret = array(); do { $line = fgets($fh); if ($line === false) { break; } $line = rtrim($line, "\n\r"); if (!$state && $line === ''...
php
protected function parseHandle($fh) { $state = false; $single = false; $ret = array(); do { $line = fgets($fh); if ($line === false) { break; } $line = rtrim($line, "\n\r"); if (!$state && $line === ''...
[ "protected", "function", "parseHandle", "(", "$", "fh", ")", "{", "$", "state", "=", "false", ";", "$", "single", "=", "false", ";", "$", "ret", "=", "array", "(", ")", ";", "do", "{", "$", "line", "=", "fgets", "(", "$", "fh", ")", ";", "if", ...
Internal parser that acepts a file handle. @note While it's possible to simulate in-memory parsing by using custom stream wrappers, if such a use-case arises we should factor out the file handle into its own class. @param resource $fh File handle with pointer at start of valid string-hash block. @return array
[ "Internal", "parser", "that", "acepts", "a", "file", "handle", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/StringHashParser.php#L86-L133
211,993
moodle/moodle
lib/mustache/src/Mustache/Template.php
Mustache_Template.prepareContextStack
protected function prepareContextStack($context = null) { $stack = new Mustache_Context(); $helpers = $this->mustache->getHelpers(); if (!$helpers->isEmpty()) { $stack->push($helpers); } if (!empty($context)) { $stack->push($context); } ...
php
protected function prepareContextStack($context = null) { $stack = new Mustache_Context(); $helpers = $this->mustache->getHelpers(); if (!$helpers->isEmpty()) { $stack->push($helpers); } if (!empty($context)) { $stack->push($context); } ...
[ "protected", "function", "prepareContextStack", "(", "$", "context", "=", "null", ")", "{", "$", "stack", "=", "new", "Mustache_Context", "(", ")", ";", "$", "helpers", "=", "$", "this", "->", "mustache", "->", "getHelpers", "(", ")", ";", "if", "(", "...
Helper method to prepare the Context stack. Adds the Mustache HelperCollection to the stack's top context frame if helpers are present. @param mixed $context Optional first context frame (default: null) @return Mustache_Context
[ "Helper", "method", "to", "prepare", "the", "Context", "stack", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Template.php#L144-L158
211,994
moodle/moodle
lib/mustache/src/Mustache/Template.php
Mustache_Template.resolveValue
protected function resolveValue($value, Mustache_Context $context) { if (($this->strictCallables ? is_object($value) : !is_string($value)) && is_callable($value)) { return $this->mustache ->loadLambda((string) call_user_func($value)) ->renderInternal($context); ...
php
protected function resolveValue($value, Mustache_Context $context) { if (($this->strictCallables ? is_object($value) : !is_string($value)) && is_callable($value)) { return $this->mustache ->loadLambda((string) call_user_func($value)) ->renderInternal($context); ...
[ "protected", "function", "resolveValue", "(", "$", "value", ",", "Mustache_Context", "$", "context", ")", "{", "if", "(", "(", "$", "this", "->", "strictCallables", "?", "is_object", "(", "$", "value", ")", ":", "!", "is_string", "(", "$", "value", ")", ...
Resolve a context value. Invoke the value if it is callable, otherwise return the value. @param mixed $value @param Mustache_Context $context @return string
[ "Resolve", "a", "context", "value", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mustache/src/Mustache/Template.php#L170-L179
211,995
moodle/moodle
user/profile/index_category_form.php
category_form.validation
public function validation($data, $files) { global $CFG, $DB; $errors = parent::validation($data, $files); $data = (object)$data; $duplicate = $DB->get_field('user_info_category', 'id', array('name' => $data->name)); // Check the name is unique. if (!empty($data->id))...
php
public function validation($data, $files) { global $CFG, $DB; $errors = parent::validation($data, $files); $data = (object)$data; $duplicate = $DB->get_field('user_info_category', 'id', array('name' => $data->name)); // Check the name is unique. if (!empty($data->id))...
[ "public", "function", "validation", "(", "$", "data", ",", "$", "files", ")", "{", "global", "$", "CFG", ",", "$", "DB", ";", "$", "errors", "=", "parent", "::", "validation", "(", "$", "data", ",", "$", "files", ")", ";", "$", "data", "=", "(", ...
Perform some moodle validation. @param array $data @param array $files @return array
[ "Perform", "some", "moodle", "validation", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/profile/index_category_form.php#L70-L92
211,996
moodle/moodle
lib/coursecatlib.php
coursecat_sortable_records.sort
public static function sort(array $records, array $fields) { $records = new coursecat_sortable_records($records); $records->sortfields = $fields; $records->uasort(array($records, 'sort_by_many_fields')); return $records->getArrayCopy(); }
php
public static function sort(array $records, array $fields) { $records = new coursecat_sortable_records($records); $records->sortfields = $fields; $records->uasort(array($records, 'sort_by_many_fields')); return $records->getArrayCopy(); }
[ "public", "static", "function", "sort", "(", "array", "$", "records", ",", "array", "$", "fields", ")", "{", "$", "records", "=", "new", "coursecat_sortable_records", "(", "$", "records", ")", ";", "$", "records", "->", "sortfields", "=", "$", "fields", ...
Sorts this array using the given fields. @param array $records @param array $fields @return array
[ "Sorts", "this", "array", "using", "the", "given", "fields", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/coursecatlib.php#L59-L64
211,997
moodle/moodle
lib/coursecatlib.php
coursecat_sortable_records.sort_by_many_fields
public function sort_by_many_fields($a, $b) { foreach ($this->sortfields as $field => $mult) { // Nulls first. if (is_null($a->$field) && !is_null($b->$field)) { return -$mult; } if (is_null($b->$field) && !is_null($a->$field)) { re...
php
public function sort_by_many_fields($a, $b) { foreach ($this->sortfields as $field => $mult) { // Nulls first. if (is_null($a->$field) && !is_null($b->$field)) { return -$mult; } if (is_null($b->$field) && !is_null($a->$field)) { re...
[ "public", "function", "sort_by_many_fields", "(", "$", "a", ",", "$", "b", ")", "{", "foreach", "(", "$", "this", "->", "sortfields", "as", "$", "field", "=>", "$", "mult", ")", "{", "// Nulls first.", "if", "(", "is_null", "(", "$", "a", "->", "$", ...
Sorts the two records based upon many fields. This method should not be called itself, please call $sort instead. It has been marked as access private as such. @access private @param stdClass $a @param stdClass $b @return int
[ "Sorts", "the", "two", "records", "based", "upon", "many", "fields", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/coursecatlib.php#L77-L103
211,998
moodle/moodle
webservice/xmlrpc/lib.php
webservice_xmlrpc_client.encode_request
protected function encode_request($functionname, $params) { $outputoptions = array( 'encoding' => 'utf-8', 'escaping' => 'markup', ); // See MDL-53962 - needed for backwards compatibility on <= 3.0. $params = array_values($params); return xmlrpc_encode_...
php
protected function encode_request($functionname, $params) { $outputoptions = array( 'encoding' => 'utf-8', 'escaping' => 'markup', ); // See MDL-53962 - needed for backwards compatibility on <= 3.0. $params = array_values($params); return xmlrpc_encode_...
[ "protected", "function", "encode_request", "(", "$", "functionname", ",", "$", "params", ")", "{", "$", "outputoptions", "=", "array", "(", "'encoding'", "=>", "'utf-8'", ",", "'escaping'", "=>", "'markup'", ",", ")", ";", "// See MDL-53962 - needed for backwards ...
Generates XML for a method request. @param string $functionname Name of the method to call. @param mixed $params Method parameters compatible with the method signature. @return string
[ "Generates", "XML", "for", "a", "method", "request", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/webservice/xmlrpc/lib.php#L107-L118
211,999
moodle/moodle
webservice/xmlrpc/lib.php
webservice_xmlrpc_client.decode_response
protected function decode_response($response) { // XMLRPC server in Moodle encodes response using function xmlrpc_encode_request() with method==null // see {@link webservice_xmlrpc_server::prepare_response()} . We should use xmlrpc_decode_request() for decoding too. $method = null; $enco...
php
protected function decode_response($response) { // XMLRPC server in Moodle encodes response using function xmlrpc_encode_request() with method==null // see {@link webservice_xmlrpc_server::prepare_response()} . We should use xmlrpc_decode_request() for decoding too. $method = null; $enco...
[ "protected", "function", "decode_response", "(", "$", "response", ")", "{", "// XMLRPC server in Moodle encodes response using function xmlrpc_encode_request() with method==null", "// see {@link webservice_xmlrpc_server::prepare_response()} . We should use xmlrpc_decode_request() for decoding too....
Parses and decodes the response XML @param string $response @return array
[ "Parses", "and", "decodes", "the", "response", "XML" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/webservice/xmlrpc/lib.php#L126-L137