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
217,700
moodle/moodle
lib/phpexcel/PHPExcel/Cell.php
PHPExcel_Cell.getMergeRange
public function getMergeRange() { foreach ($this->getWorksheet()->getMergeCells() as $mergeRange) { if ($this->isInRange($mergeRange)) { return $mergeRange; } } return false; }
php
public function getMergeRange() { foreach ($this->getWorksheet()->getMergeCells() as $mergeRange) { if ($this->isInRange($mergeRange)) { return $mergeRange; } } return false; }
[ "public", "function", "getMergeRange", "(", ")", "{", "foreach", "(", "$", "this", "->", "getWorksheet", "(", ")", "->", "getMergeCells", "(", ")", "as", "$", "mergeRange", ")", "{", "if", "(", "$", "this", "->", "isInRange", "(", "$", "mergeRange", ")...
If this cell is in a merge range, then return the range @return string
[ "If", "this", "cell", "is", "in", "a", "merge", "range", "then", "return", "the", "range" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Cell.php#L524-L532
217,701
moodle/moodle
lib/phpexcel/PHPExcel/Cell.php
PHPExcel_Cell.isInRange
public function isInRange($pRange = 'A1:A1') { list($rangeStart, $rangeEnd) = self::rangeBoundaries($pRange); // Translate properties $myColumn = self::columnIndexFromString($this->getColumn()); $myRow = $this->getRow(); // Verify if cell is in range return (($ra...
php
public function isInRange($pRange = 'A1:A1') { list($rangeStart, $rangeEnd) = self::rangeBoundaries($pRange); // Translate properties $myColumn = self::columnIndexFromString($this->getColumn()); $myRow = $this->getRow(); // Verify if cell is in range return (($ra...
[ "public", "function", "isInRange", "(", "$", "pRange", "=", "'A1:A1'", ")", "{", "list", "(", "$", "rangeStart", ",", "$", "rangeEnd", ")", "=", "self", "::", "rangeBoundaries", "(", "$", "pRange", ")", ";", "// Translate properties", "$", "myColumn", "=",...
Is cell in a specific range? @param string $pRange Cell range (e.g. A1:A1) @return boolean
[ "Is", "cell", "in", "a", "specific", "range?" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Cell.php#L563-L575
217,702
moodle/moodle
lib/phpexcel/PHPExcel/Cell.php
PHPExcel_Cell.rangeBoundaries
public static function rangeBoundaries($pRange = 'A1:A1') { // Ensure $pRange is a valid range if (empty($pRange)) { $pRange = self::DEFAULT_RANGE; } // Uppercase coordinate $pRange = strtoupper($pRange); // Extract range if (strpos($pRange, ':')...
php
public static function rangeBoundaries($pRange = 'A1:A1') { // Ensure $pRange is a valid range if (empty($pRange)) { $pRange = self::DEFAULT_RANGE; } // Uppercase coordinate $pRange = strtoupper($pRange); // Extract range if (strpos($pRange, ':')...
[ "public", "static", "function", "rangeBoundaries", "(", "$", "pRange", "=", "'A1:A1'", ")", "{", "// Ensure $pRange is a valid range", "if", "(", "empty", "(", "$", "pRange", ")", ")", "{", "$", "pRange", "=", "self", "::", "DEFAULT_RANGE", ";", "}", "// Upp...
Calculate range boundaries @param string $pRange Cell range (e.g. A1:A1) @return array Range coordinates array(Start Cell, End Cell) where Start Cell and End Cell are arrays (Column Number, Row Number)
[ "Calculate", "range", "boundaries" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Cell.php#L715-L741
217,703
moodle/moodle
lib/phpexcel/PHPExcel/Cell.php
PHPExcel_Cell.rangeDimension
public static function rangeDimension($pRange = 'A1:A1') { // Calculate range outer borders list($rangeStart, $rangeEnd) = self::rangeBoundaries($pRange); return array( ($rangeEnd[0] - $rangeStart[0] + 1), ($rangeEnd[1] - $rangeStart[1] + 1) ); }
php
public static function rangeDimension($pRange = 'A1:A1') { // Calculate range outer borders list($rangeStart, $rangeEnd) = self::rangeBoundaries($pRange); return array( ($rangeEnd[0] - $rangeStart[0] + 1), ($rangeEnd[1] - $rangeStart[1] + 1) ); }
[ "public", "static", "function", "rangeDimension", "(", "$", "pRange", "=", "'A1:A1'", ")", "{", "// Calculate range outer borders", "list", "(", "$", "rangeStart", ",", "$", "rangeEnd", ")", "=", "self", "::", "rangeBoundaries", "(", "$", "pRange", ")", ";", ...
Calculate range dimension @param string $pRange Cell range (e.g. A1:A1) @return array Range dimension (width, height)
[ "Calculate", "range", "dimension" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Cell.php#L749-L755
217,704
moodle/moodle
lib/phpexcel/PHPExcel/Cell.php
PHPExcel_Cell.compareCells
public static function compareCells(PHPExcel_Cell $a, PHPExcel_Cell $b) { if ($a->getRow() < $b->getRow()) { return -1; } elseif ($a->getRow() > $b->getRow()) { return 1; } elseif (self::columnIndexFromString($a->getColumn()) < self::columnIndexFromString($b->getColum...
php
public static function compareCells(PHPExcel_Cell $a, PHPExcel_Cell $b) { if ($a->getRow() < $b->getRow()) { return -1; } elseif ($a->getRow() > $b->getRow()) { return 1; } elseif (self::columnIndexFromString($a->getColumn()) < self::columnIndexFromString($b->getColum...
[ "public", "static", "function", "compareCells", "(", "PHPExcel_Cell", "$", "a", ",", "PHPExcel_Cell", "$", "b", ")", "{", "if", "(", "$", "a", "->", "getRow", "(", ")", "<", "$", "b", "->", "getRow", "(", ")", ")", "{", "return", "-", "1", ";", "...
Compare 2 cells @param PHPExcel_Cell $a Cell a @param PHPExcel_Cell $b Cell b @return int Result of comparison (always -1 or 1, never zero!)
[ "Compare", "2", "cells" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Cell.php#L926-L937
217,705
moodle/moodle
lib/phpexcel/PHPExcel/Writer/Excel2007/Comments.php
PHPExcel_Writer_Excel2007_Comments.writeComment
private function writeComment(PHPExcel_Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', PHPExcel_Comment $pComment = null, $pAuthors = null) { // comment $objWriter->startElement('comment'); $objWriter->writeAttribute('ref', $pCellReference); $objWriter->writeAttribute('au...
php
private function writeComment(PHPExcel_Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', PHPExcel_Comment $pComment = null, $pAuthors = null) { // comment $objWriter->startElement('comment'); $objWriter->writeAttribute('ref', $pCellReference); $objWriter->writeAttribute('au...
[ "private", "function", "writeComment", "(", "PHPExcel_Shared_XMLWriter", "$", "objWriter", "=", "null", ",", "$", "pCellReference", "=", "'A1'", ",", "PHPExcel_Comment", "$", "pComment", "=", "null", ",", "$", "pAuthors", "=", "null", ")", "{", "// comment", "...
Write comment to XML format @param PHPExcel_Shared_XMLWriter $objWriter XML Writer @param string $pCellReference Cell reference @param PHPExcel_Comment $pComment Comment @param array $pAuthors ...
[ "Write", "comment", "to", "XML", "format" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Writer/Excel2007/Comments.php#L95-L108
217,706
moodle/moodle
lib/phpexcel/PHPExcel/Writer/Excel2007/Comments.php
PHPExcel_Writer_Excel2007_Comments.writeVMLComments
public function writeVMLComments(PHPExcel_Worksheet $pWorksheet = null) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->get...
php
public function writeVMLComments(PHPExcel_Worksheet $pWorksheet = null) { // Create XML writer $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->get...
[ "public", "function", "writeVMLComments", "(", "PHPExcel_Worksheet", "$", "pWorksheet", "=", "null", ")", "{", "// Create XML writer", "$", "objWriter", "=", "null", ";", "if", "(", "$", "this", "->", "getParentWriter", "(", ")", "->", "getUseDiskCaching", "(", ...
Write VML comments to XML format @param PHPExcel_Worksheet $pWorksheet @return string XML Output @throws PHPExcel_Writer_Exception
[ "Write", "VML", "comments", "to", "XML", "format" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Writer/Excel2007/Comments.php#L117-L180
217,707
moodle/moodle
calendar/classes/local/event/entities/repeat_event_collection.php
repeat_event_collection.get_parent_record
protected function get_parent_record() { global $DB; if (!isset($this->parentrecord)) { $this->parentrecord = $DB->get_record('event', ['id' => $this->parentid]); } return $this->parentrecord; }
php
protected function get_parent_record() { global $DB; if (!isset($this->parentrecord)) { $this->parentrecord = $DB->get_record('event', ['id' => $this->parentid]); } return $this->parentrecord; }
[ "protected", "function", "get_parent_record", "(", ")", "{", "global", "$", "DB", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "parentrecord", ")", ")", "{", "$", "this", "->", "parentrecord", "=", "$", "DB", "->", "get_record", "(", "'event'"...
Return the parent DB record. @return \stdClass
[ "Return", "the", "parent", "DB", "record", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/local/event/entities/repeat_event_collection.php#L117-L125
217,708
moodle/moodle
calendar/classes/local/event/entities/repeat_event_collection.php
repeat_event_collection.load_event_records
protected function load_event_records($start = 0) { global $DB; while ($records = $DB->get_records_select( 'event', 'id <> :parentid AND repeatid = :repeatid', [ 'parentid' => $this->parentid, 'repeatid' => $this->parentid, ...
php
protected function load_event_records($start = 0) { global $DB; while ($records = $DB->get_records_select( 'event', 'id <> :parentid AND repeatid = :repeatid', [ 'parentid' => $this->parentid, 'repeatid' => $this->parentid, ...
[ "protected", "function", "load_event_records", "(", "$", "start", "=", "0", ")", "{", "global", "$", "DB", ";", "while", "(", "$", "records", "=", "$", "DB", "->", "get_records_select", "(", "'event'", ",", "'id <> :parentid AND repeatid = :repeatid'", ",", "[...
Generate more event records. @param int $start Start offset. @return \stdClass[]
[ "Generate", "more", "event", "records", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/calendar/classes/local/event/entities/repeat_event_collection.php#L133-L150
217,709
moodle/moodle
admin/tool/dataprivacy/classes/task/delete_expired_contexts.php
delete_expired_contexts.execute
public function execute() { $manager = new \tool_dataprivacy\expired_contexts_manager(new \text_progress_trace()); list($courses, $users) = $manager->process_approved_deletions(); mtrace("Processed deletions for {$courses} course contexts, and {$users} user contexts as expired"); }
php
public function execute() { $manager = new \tool_dataprivacy\expired_contexts_manager(new \text_progress_trace()); list($courses, $users) = $manager->process_approved_deletions(); mtrace("Processed deletions for {$courses} course contexts, and {$users} user contexts as expired"); }
[ "public", "function", "execute", "(", ")", "{", "$", "manager", "=", "new", "\\", "tool_dataprivacy", "\\", "expired_contexts_manager", "(", "new", "\\", "text_progress_trace", "(", ")", ")", ";", "list", "(", "$", "courses", ",", "$", "users", ")", "=", ...
Run the task to delete context instances based on their retention periods.
[ "Run", "the", "task", "to", "delete", "context", "instances", "based", "on", "their", "retention", "periods", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/task/delete_expired_contexts.php#L56-L60
217,710
moodle/moodle
admin/tool/log/classes/helper/store.php
store.helper_setup
protected function helper_setup(\tool_log\log\manager $manager) { $this->manager = $manager; $called = get_called_class(); $parts = explode('\\', $called); if (!isset($parts[0]) || strpos($parts[0], 'logstore_') !== 0) { throw new \coding_exception("Store $called doesn't defi...
php
protected function helper_setup(\tool_log\log\manager $manager) { $this->manager = $manager; $called = get_called_class(); $parts = explode('\\', $called); if (!isset($parts[0]) || strpos($parts[0], 'logstore_') !== 0) { throw new \coding_exception("Store $called doesn't defi...
[ "protected", "function", "helper_setup", "(", "\\", "tool_log", "\\", "log", "\\", "manager", "$", "manager", ")", "{", "$", "this", "->", "manager", "=", "$", "manager", ";", "$", "called", "=", "get_called_class", "(", ")", ";", "$", "parts", "=", "e...
Setup store specific variables. @param \tool_log\log\manager $manager manager instance.
[ "Setup", "store", "specific", "variables", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/classes/helper/store.php#L52-L61
217,711
moodle/moodle
admin/tool/log/classes/helper/store.php
store.get_config
protected function get_config($name, $default = null) { $value = get_config($this->component, $name); if ($value !== false) { return $value; } return $default; }
php
protected function get_config($name, $default = null) { $value = get_config($this->component, $name); if ($value !== false) { return $value; } return $default; }
[ "protected", "function", "get_config", "(", "$", "name", ",", "$", "default", "=", "null", ")", "{", "$", "value", "=", "get_config", "(", "$", "this", "->", "component", ",", "$", "name", ")", ";", "if", "(", "$", "value", "!==", "false", ")", "{"...
Api to get plugin config @param string $name name of the config. @param null|mixed $default default value to return. @return mixed|null return config value.
[ "Api", "to", "get", "plugin", "config" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/classes/helper/store.php#L71-L77
217,712
moodle/moodle
lib/mlbackend/php/phpml/src/Phpml/Classification/Ensemble/AdaBoost.php
AdaBoost.evaluateClassifier
protected function evaluateClassifier(Classifier $classifier) { $total = (float) array_sum($this->weights); $wrong = 0; foreach ($this->samples as $index => $sample) { $predicted = $classifier->predict($sample); if ($predicted != $this->targets[$index]) { ...
php
protected function evaluateClassifier(Classifier $classifier) { $total = (float) array_sum($this->weights); $wrong = 0; foreach ($this->samples as $index => $sample) { $predicted = $classifier->predict($sample); if ($predicted != $this->targets[$index]) { ...
[ "protected", "function", "evaluateClassifier", "(", "Classifier", "$", "classifier", ")", "{", "$", "total", "=", "(", "float", ")", "array_sum", "(", "$", "this", "->", "weights", ")", ";", "$", "wrong", "=", "0", ";", "foreach", "(", "$", "this", "->...
Evaluates the classifier and returns the classification error rate @param Classifier $classifier @return float
[ "Evaluates", "the", "classifier", "and", "returns", "the", "classification", "error", "rate" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/phpml/src/Phpml/Classification/Ensemble/AdaBoost.php#L205-L217
217,713
moodle/moodle
lib/mlbackend/php/phpml/src/Phpml/Classification/Ensemble/AdaBoost.php
AdaBoost.updateWeights
protected function updateWeights(Classifier $classifier, float $alpha) { $sumOfWeights = array_sum($this->weights); $weightsT1 = []; foreach ($this->weights as $index => $weight) { $desired = $this->targets[$index]; $output = $classifier->predict($this->samples[$index...
php
protected function updateWeights(Classifier $classifier, float $alpha) { $sumOfWeights = array_sum($this->weights); $weightsT1 = []; foreach ($this->weights as $index => $weight) { $desired = $this->targets[$index]; $output = $classifier->predict($this->samples[$index...
[ "protected", "function", "updateWeights", "(", "Classifier", "$", "classifier", ",", "float", "$", "alpha", ")", "{", "$", "sumOfWeights", "=", "array_sum", "(", "$", "this", "->", "weights", ")", ";", "$", "weightsT1", "=", "[", "]", ";", "foreach", "("...
Updates the sample weights @param Classifier $classifier @param float $alpha
[ "Updates", "the", "sample", "weights" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/mlbackend/php/phpml/src/Phpml/Classification/Ensemble/AdaBoost.php#L239-L253
217,714
moodle/moodle
lib/grade/grade_category.php
grade_category.fetch
public static function fetch($params) { if ($records = self::retrieve_record_set($params)) { return reset($records); } $record = grade_object::fetch_helper('grade_categories', 'grade_category', $params); // We store it as an array to keep a key => result set interface in th...
php
public static function fetch($params) { if ($records = self::retrieve_record_set($params)) { return reset($records); } $record = grade_object::fetch_helper('grade_categories', 'grade_category', $params); // We store it as an array to keep a key => result set interface in th...
[ "public", "static", "function", "fetch", "(", "$", "params", ")", "{", "if", "(", "$", "records", "=", "self", "::", "retrieve_record_set", "(", "$", "params", ")", ")", "{", "return", "reset", "(", "$", "records", ")", ";", "}", "$", "record", "=", ...
Finds and returns a grade_category instance based on params. @param array $params associative arrays varname=>value @return grade_category The retrieved grade_category instance or false if none found.
[ "Finds", "and", "returns", "a", "grade_category", "instance", "based", "on", "params", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L190-L207
217,715
moodle/moodle
lib/grade/grade_category.php
grade_category.fetch_all
public static function fetch_all($params) { if ($records = self::retrieve_record_set($params)) { return $records; } $records = grade_object::fetch_all_helper('grade_categories', 'grade_category', $params); self::set_record_set($params, $records); return $records; ...
php
public static function fetch_all($params) { if ($records = self::retrieve_record_set($params)) { return $records; } $records = grade_object::fetch_all_helper('grade_categories', 'grade_category', $params); self::set_record_set($params, $records); return $records; ...
[ "public", "static", "function", "fetch_all", "(", "$", "params", ")", "{", "if", "(", "$", "records", "=", "self", "::", "retrieve_record_set", "(", "$", "params", ")", ")", "{", "return", "$", "records", ";", "}", "$", "records", "=", "grade_object", ...
Finds and returns all grade_category instances based on params. @param array $params associative arrays varname=>value @return array array of grade_category insatnces or false if none found.
[ "Finds", "and", "returns", "all", "grade_category", "instances", "based", "on", "params", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L215-L224
217,716
moodle/moodle
lib/grade/grade_category.php
grade_category.qualifies_for_regrading
public function qualifies_for_regrading() { if (empty($this->id)) { debugging("Can not regrade non existing category"); return false; } $db_item = grade_category::fetch(array('id'=>$this->id)); $aggregationdiff = $db_item->aggregation != $this->aggregati...
php
public function qualifies_for_regrading() { if (empty($this->id)) { debugging("Can not regrade non existing category"); return false; } $db_item = grade_category::fetch(array('id'=>$this->id)); $aggregationdiff = $db_item->aggregation != $this->aggregati...
[ "public", "function", "qualifies_for_regrading", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "id", ")", ")", "{", "debugging", "(", "\"Can not regrade non existing category\"", ")", ";", "return", "false", ";", "}", "$", "db_item", "=", "grade...
Compares the values held by this object with those of the matching record in DB, and returns whether or not these differences are sufficient to justify an update of all parent objects. This assumes that this object has an ID number and a matching record in DB. If not, it will return false. @return bool
[ "Compares", "the", "values", "held", "by", "this", "object", "with", "those", "of", "the", "matching", "record", "in", "DB", "and", "returns", "whether", "or", "not", "these", "differences", "are", "sufficient", "to", "justify", "an", "update", "of", "all", ...
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L416-L431
217,717
moodle/moodle
lib/grade/grade_category.php
grade_category.aggregate_values
public function aggregate_values($grade_values, $items) { debugging('grade_category::aggregate_values() is deprecated. Call grade_category::aggregate_values_and_adjust_bounds() instead.', DEBUG_DEVELOPER); $result = $this->aggregate_values_and_adjust_bounds($grade_values, $items); ...
php
public function aggregate_values($grade_values, $items) { debugging('grade_category::aggregate_values() is deprecated. Call grade_category::aggregate_values_and_adjust_bounds() instead.', DEBUG_DEVELOPER); $result = $this->aggregate_values_and_adjust_bounds($grade_values, $items); ...
[ "public", "function", "aggregate_values", "(", "$", "grade_values", ",", "$", "items", ")", "{", "debugging", "(", "'grade_category::aggregate_values() is deprecated.\n Call grade_category::aggregate_values_and_adjust_bounds() instead.'", ",", "DEBUG_DEVELOPER", ")"...
Internal function that calculates the aggregated grade for this grade category Must be public as it is used by grade_grade::get_hiding_affected() @deprecated since Moodle 2.8 @param array $grade_values An array of values to be aggregated @param array $items The array of grade_items @return float The aggregate grade f...
[ "Internal", "function", "that", "calculates", "the", "aggregated", "grade", "for", "this", "grade", "category" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L1470-L1475
217,718
moodle/moodle
lib/grade/grade_category.php
grade_category.auto_update_max
private function auto_update_max() { global $CFG, $DB; if ($this->aggregation != GRADE_AGGREGATE_SUM) { // not needed at all return; } // Find grade items of immediate children (category or grade items) and force site settings. $this->load_grade_item(); ...
php
private function auto_update_max() { global $CFG, $DB; if ($this->aggregation != GRADE_AGGREGATE_SUM) { // not needed at all return; } // Find grade items of immediate children (category or grade items) and force site settings. $this->load_grade_item(); ...
[ "private", "function", "auto_update_max", "(", ")", "{", "global", "$", "CFG", ",", "$", "DB", ";", "if", "(", "$", "this", "->", "aggregation", "!=", "GRADE_AGGREGATE_SUM", ")", "{", "// not needed at all", "return", ";", "}", "// Find grade items of immediate ...
Some aggregation types may need to update their max grade. This must be executed after updating the weights as it relies on them. @return void
[ "Some", "aggregation", "types", "may", "need", "to", "update", "their", "max", "grade", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L1484-L1561
217,719
moodle/moodle
lib/grade/grade_category.php
grade_category.can_apply_limit_rules
public function can_apply_limit_rules() { if ($this->canapplylimitrules !== null) { return $this->canapplylimitrules; } // Set it to be supported by default. $this->canapplylimitrules = true; // Natural aggregation. if ($this->aggregation == GRADE_AGGREGATE_...
php
public function can_apply_limit_rules() { if ($this->canapplylimitrules !== null) { return $this->canapplylimitrules; } // Set it to be supported by default. $this->canapplylimitrules = true; // Natural aggregation. if ($this->aggregation == GRADE_AGGREGATE_...
[ "public", "function", "can_apply_limit_rules", "(", ")", "{", "if", "(", "$", "this", "->", "canapplylimitrules", "!==", "null", ")", "{", "return", "$", "this", "->", "canapplylimitrules", ";", "}", "// Set it to be supported by default.", "$", "this", "->", "c...
Returns whether or not we can apply the limit rules. There are cases where drop lowest or keep highest should not be used at all. This method will determine whether or not this logic can be applied considering the current setup of the category. @return bool
[ "Returns", "whether", "or", "not", "we", "can", "apply", "the", "limit", "rules", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L1849-L1902
217,720
moodle/moodle
lib/grade/grade_category.php
grade_category.aggregation_uses_aggregationcoef
public static function aggregation_uses_aggregationcoef($aggregation) { return ($aggregation == GRADE_AGGREGATE_WEIGHTED_MEAN or $aggregation == GRADE_AGGREGATE_WEIGHTED_MEAN2 or $aggregation == GRADE_AGGREGATE_EXTRACREDIT_MEAN or $aggregation == GRADE_AGGREGATE_SUM); ...
php
public static function aggregation_uses_aggregationcoef($aggregation) { return ($aggregation == GRADE_AGGREGATE_WEIGHTED_MEAN or $aggregation == GRADE_AGGREGATE_WEIGHTED_MEAN2 or $aggregation == GRADE_AGGREGATE_EXTRACREDIT_MEAN or $aggregation == GRADE_AGGREGATE_SUM); ...
[ "public", "static", "function", "aggregation_uses_aggregationcoef", "(", "$", "aggregation", ")", "{", "return", "(", "$", "aggregation", "==", "GRADE_AGGREGATE_WEIGHTED_MEAN", "or", "$", "aggregation", "==", "GRADE_AGGREGATE_WEIGHTED_MEAN2", "or", "$", "aggregation", "...
Returns true if aggregation uses aggregationcoef @param int $aggregation Aggregation const. @return bool True if an aggregation coefficient is being used
[ "Returns", "true", "if", "aggregation", "uses", "aggregationcoef" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L1941-L1947
217,721
moodle/moodle
lib/grade/grade_category.php
grade_category.fetch_course_tree
public static function fetch_course_tree($courseid, $include_category_items=false) { $course_category = grade_category::fetch_course_category($courseid); $category_array = array('object'=>$course_category, 'type'=>'category', 'depth'=>1, 'children'=>$course_category->get_...
php
public static function fetch_course_tree($courseid, $include_category_items=false) { $course_category = grade_category::fetch_course_category($courseid); $category_array = array('object'=>$course_category, 'type'=>'category', 'depth'=>1, 'children'=>$course_category->get_...
[ "public", "static", "function", "fetch_course_tree", "(", "$", "courseid", ",", "$", "include_category_items", "=", "false", ")", "{", "$", "course_category", "=", "grade_category", "::", "fetch_course_category", "(", "$", "courseid", ")", ";", "$", "category_arra...
Returns tree with all grade_items and categories as elements @param int $courseid The course ID @param bool $include_category_items as category children @return array
[ "Returns", "tree", "with", "all", "grade_items", "and", "categories", "as", "elements" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L2010-L2018
217,722
moodle/moodle
lib/grade/grade_category.php
grade_category._fetch_course_tree_recursion
static private function _fetch_course_tree_recursion($category_array, &$sortorder) { if (isset($category_array['object']->gradetype) && $category_array['object']->gradetype==GRADE_TYPE_NONE) { return null; } // store the grade_item or grade_category instance with extra info ...
php
static private function _fetch_course_tree_recursion($category_array, &$sortorder) { if (isset($category_array['object']->gradetype) && $category_array['object']->gradetype==GRADE_TYPE_NONE) { return null; } // store the grade_item or grade_category instance with extra info ...
[ "static", "private", "function", "_fetch_course_tree_recursion", "(", "$", "category_array", ",", "&", "$", "sortorder", ")", "{", "if", "(", "isset", "(", "$", "category_array", "[", "'object'", "]", "->", "gradetype", ")", "&&", "$", "category_array", "[", ...
An internal function that recursively sorts grade categories within a course @param array $category_array The seed of the recursion @param int $sortorder The current sortorder @return array An array containing 'object', 'type', 'depth' and optionally 'children'
[ "An", "internal", "function", "that", "recursively", "sorts", "grade", "categories", "within", "a", "course" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L2027-L2068
217,723
moodle/moodle
lib/grade/grade_category.php
grade_category._get_children_recursion
private static function _get_children_recursion($category) { $children_array = array(); foreach ($category->children as $sortorder=>$child) { if (array_key_exists('itemtype', $child)) { $grade_item = new grade_item($child, false); if (in_array($grade_item->...
php
private static function _get_children_recursion($category) { $children_array = array(); foreach ($category->children as $sortorder=>$child) { if (array_key_exists('itemtype', $child)) { $grade_item = new grade_item($child, false); if (in_array($grade_item->...
[ "private", "static", "function", "_get_children_recursion", "(", "$", "category", ")", "{", "$", "children_array", "=", "array", "(", ")", ";", "foreach", "(", "$", "category", "->", "children", "as", "$", "sortorder", "=>", "$", "child", ")", "{", "if", ...
Private method used to retrieve all children of this category recursively @param grade_category $category Source of current recursion @return array An array of child grade categories
[ "Private", "method", "used", "to", "retrieve", "all", "children", "of", "this", "category", "recursively" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L2190-L2223
217,724
moodle/moodle
lib/grade/grade_category.php
grade_category.get_grade_item
public function get_grade_item() { if (empty($this->id)) { debugging("Attempt to obtain a grade_category's associated grade_item without the category's ID being set."); return false; } if (empty($this->parent)) { $params = array('courseid'=>$this->courseid, '...
php
public function get_grade_item() { if (empty($this->id)) { debugging("Attempt to obtain a grade_category's associated grade_item without the category's ID being set."); return false; } if (empty($this->parent)) { $params = array('courseid'=>$this->courseid, '...
[ "public", "function", "get_grade_item", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "id", ")", ")", "{", "debugging", "(", "\"Attempt to obtain a grade_category's associated grade_item without the category's ID being set.\"", ")", ";", "return", "false", ...
Retrieves this grade categories' associated grade_item from the database If no grade_item exists yet, creates one. @return grade_item
[ "Retrieves", "this", "grade", "categories", "associated", "grade_item", "from", "the", "database" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L2244-L2274
217,725
moodle/moodle
lib/grade/grade_category.php
grade_category.get_name
public function get_name() { global $DB; // For a course category, we return the course name if the fullname is set to '?' in the DB (empty in the category edit form) if (empty($this->parent) && $this->fullname == '?') { $course = $DB->get_record('course', array('id'=> $this->coursei...
php
public function get_name() { global $DB; // For a course category, we return the course name if the fullname is set to '?' in the DB (empty in the category edit form) if (empty($this->parent) && $this->fullname == '?') { $course = $DB->get_record('course', array('id'=> $this->coursei...
[ "public", "function", "get_name", "(", ")", "{", "global", "$", "DB", ";", "// For a course category, we return the course name if the fullname is set to '?' in the DB (empty in the category edit form)", "if", "(", "empty", "(", "$", "this", "->", "parent", ")", "&&", "$", ...
Returns the most descriptive field for this grade category @return string name
[ "Returns", "the", "most", "descriptive", "field", "for", "this", "grade", "category" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L2307-L2319
217,726
moodle/moodle
lib/grade/grade_category.php
grade_category.get_description
public function get_description() { $allhelp = array(); if ($this->aggregation != GRADE_AGGREGATE_SUM) { $aggrstrings = grade_helper::get_aggregation_strings(); $allhelp[] = $aggrstrings[$this->aggregation]; } if ($this->droplow && $this->can_apply_limit_rules())...
php
public function get_description() { $allhelp = array(); if ($this->aggregation != GRADE_AGGREGATE_SUM) { $aggrstrings = grade_helper::get_aggregation_strings(); $allhelp[] = $aggrstrings[$this->aggregation]; } if ($this->droplow && $this->can_apply_limit_rules())...
[ "public", "function", "get_description", "(", ")", "{", "$", "allhelp", "=", "array", "(", ")", ";", "if", "(", "$", "this", "->", "aggregation", "!=", "GRADE_AGGREGATE_SUM", ")", "{", "$", "aggrstrings", "=", "grade_helper", "::", "get_aggregation_strings", ...
Describe the aggregation settings for this category so the reports make more sense. @return string description
[ "Describe", "the", "aggregation", "settings", "for", "this", "category", "so", "the", "reports", "make", "more", "sense", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L2326-L2346
217,727
moodle/moodle
lib/grade/grade_category.php
grade_category.set_parent
public function set_parent($parentid, $source=null) { if ($this->parent == $parentid) { return true; } if ($parentid == $this->id) { print_error('cannotassignselfasparent'); } if (empty($this->parent) and $this->is_course_category()) { print_...
php
public function set_parent($parentid, $source=null) { if ($this->parent == $parentid) { return true; } if ($parentid == $this->id) { print_error('cannotassignselfasparent'); } if (empty($this->parent) and $this->is_course_category()) { print_...
[ "public", "function", "set_parent", "(", "$", "parentid", ",", "$", "source", "=", "null", ")", "{", "if", "(", "$", "this", "->", "parent", "==", "$", "parentid", ")", "{", "return", "true", ";", "}", "if", "(", "$", "parentid", "==", "$", "this",...
Sets this category's parent id @param int $parentid The ID of the category that is the new parent to $this @param string $source From where was the object updated (mod/forum, manual, etc.) @return bool success
[ "Sets", "this", "category", "s", "parent", "id" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L2355-L2383
217,728
moodle/moodle
lib/grade/grade_category.php
grade_category.fetch_course_category
public static function fetch_course_category($courseid) { if (empty($courseid)) { debugging('Missing course id!'); return false; } // course category has no parent if ($course_category = grade_category::fetch(array('courseid'=>$courseid, 'parent'=>null))) { ...
php
public static function fetch_course_category($courseid) { if (empty($courseid)) { debugging('Missing course id!'); return false; } // course category has no parent if ($course_category = grade_category::fetch(array('courseid'=>$courseid, 'parent'=>null))) { ...
[ "public", "static", "function", "fetch_course_category", "(", "$", "courseid", ")", "{", "if", "(", "empty", "(", "$", "courseid", ")", ")", "{", "debugging", "(", "'Missing course id!'", ")", ";", "return", "false", ";", "}", "// course category has no parent",...
Return the course level grade_category object @param int $courseid The Course ID @return grade_category Returns the course level grade_category instance
[ "Return", "the", "course", "level", "grade_category", "object" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L2461-L2477
217,729
moodle/moodle
lib/grade/grade_category.php
grade_category.set_locked
public function set_locked($lockedstate, $cascade=false, $refresh=true) { $this->load_grade_item(); $result = $this->grade_item->set_locked($lockedstate, $cascade, true); if ($cascade) { //process all children - items and categories if ($children = grade_item::fetch_all...
php
public function set_locked($lockedstate, $cascade=false, $refresh=true) { $this->load_grade_item(); $result = $this->grade_item->set_locked($lockedstate, $cascade, true); if ($cascade) { //process all children - items and categories if ($children = grade_item::fetch_all...
[ "public", "function", "set_locked", "(", "$", "lockedstate", ",", "$", "cascade", "=", "false", ",", "$", "refresh", "=", "true", ")", "{", "$", "this", "->", "load_grade_item", "(", ")", ";", "$", "result", "=", "$", "this", "->", "grade_item", "->", ...
Sets the grade_item's locked variable and updates the grade_item. Calls set_locked() on the categories' grade_item @param int $lockedstate 0, 1 or a timestamp int(10) after which date the item will be locked. @param bool $cascade lock/unlock child objects too @param bool $refresh refresh grades when unlocking @retur...
[ "Sets", "the", "grade_item", "s", "locked", "variable", "and", "updates", "the", "grade_item", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L2510-L2538
217,730
moodle/moodle
lib/grade/grade_category.php
grade_category.set_hidden
public function set_hidden($hidden, $cascade=false) { $this->load_grade_item(); //this hides the associated grade item (the course total) $this->grade_item->set_hidden($hidden, $cascade); //this hides the category itself and everything it contains parent::set_hidden($hidden, $cas...
php
public function set_hidden($hidden, $cascade=false) { $this->load_grade_item(); //this hides the associated grade item (the course total) $this->grade_item->set_hidden($hidden, $cascade); //this hides the category itself and everything it contains parent::set_hidden($hidden, $cas...
[ "public", "function", "set_hidden", "(", "$", "hidden", ",", "$", "cascade", "=", "false", ")", "{", "$", "this", "->", "load_grade_item", "(", ")", ";", "//this hides the associated grade item (the course total)", "$", "this", "->", "grade_item", "->", "set_hidde...
Sets the grade_item's hidden variable and updates the grade_item. Overrides grade_item::set_hidden() to add cascading of the hidden value to grade items in this grade category @param int $hidden 0 mean always visible, 1 means always hidden and a number > 1 is a timestamp to hide until @param bool $cascade apply to ch...
[ "Sets", "the", "grade_item", "s", "hidden", "variable", "and", "updates", "the", "grade_item", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L2590-L2627
217,731
moodle/moodle
lib/grade/grade_category.php
grade_category.apply_default_settings
public function apply_default_settings() { global $CFG; foreach ($this->forceable as $property) { if (isset($CFG->{"grade_$property"})) { if ($CFG->{"grade_$property"} == -1) { continue; //temporary bc before version bump } ...
php
public function apply_default_settings() { global $CFG; foreach ($this->forceable as $property) { if (isset($CFG->{"grade_$property"})) { if ($CFG->{"grade_$property"} == -1) { continue; //temporary bc before version bump } ...
[ "public", "function", "apply_default_settings", "(", ")", "{", "global", "$", "CFG", ";", "foreach", "(", "$", "this", "->", "forceable", "as", "$", "property", ")", "{", "if", "(", "isset", "(", "$", "CFG", "->", "{", "\"grade_$property\"", "}", ")", ...
Applies default settings on this category @return bool True if anything changed
[ "Applies", "default", "settings", "on", "this", "category" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L2634-L2647
217,732
moodle/moodle
lib/grade/grade_category.php
grade_category.apply_forced_settings
public function apply_forced_settings() { global $CFG; $updated = false; foreach ($this->forceable as $property) { if (isset($CFG->{"grade_$property"}) and isset($CFG->{"grade_{$property}_flag"}) and ((int) $CFG->{"grade_{$proper...
php
public function apply_forced_settings() { global $CFG; $updated = false; foreach ($this->forceable as $property) { if (isset($CFG->{"grade_$property"}) and isset($CFG->{"grade_{$property}_flag"}) and ((int) $CFG->{"grade_{$proper...
[ "public", "function", "apply_forced_settings", "(", ")", "{", "global", "$", "CFG", ";", "$", "updated", "=", "false", ";", "foreach", "(", "$", "this", "->", "forceable", "as", "$", "property", ")", "{", "if", "(", "isset", "(", "$", "CFG", "->", "{...
Applies forced settings on this category @return bool True if anything changed
[ "Applies", "forced", "settings", "on", "this", "category" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L2654-L2673
217,733
moodle/moodle
lib/grade/grade_category.php
grade_category.retrieve_record_set
protected static function retrieve_record_set($params) { $cache = cache::make('core', 'grade_categories'); return $cache->get(self::generate_record_set_key($params)); }
php
protected static function retrieve_record_set($params) { $cache = cache::make('core', 'grade_categories'); return $cache->get(self::generate_record_set_key($params)); }
[ "protected", "static", "function", "retrieve_record_set", "(", "$", "params", ")", "{", "$", "cache", "=", "cache", "::", "make", "(", "'core'", ",", "'grade_categories'", ")", ";", "return", "$", "cache", "->", "get", "(", "self", "::", "generate_record_set...
Tries to retrieve a record set from the cache. @param array $params The query params @return grade_object[]|bool An array of grade_objects or false if not found.
[ "Tries", "to", "retrieve", "a", "record", "set", "from", "the", "cache", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L2746-L2749
217,734
moodle/moodle
lib/grade/grade_category.php
grade_category.set_record_set
protected static function set_record_set($params, $records) { $cache = cache::make('core', 'grade_categories'); return $cache->set(self::generate_record_set_key($params), $records); }
php
protected static function set_record_set($params, $records) { $cache = cache::make('core', 'grade_categories'); return $cache->set(self::generate_record_set_key($params), $records); }
[ "protected", "static", "function", "set_record_set", "(", "$", "params", ",", "$", "records", ")", "{", "$", "cache", "=", "cache", "::", "make", "(", "'core'", ",", "'grade_categories'", ")", ";", "return", "$", "cache", "->", "set", "(", "self", "::", ...
Sets a result to the records cache, even if there were no results. @param string $params The query params @param grade_object[]|bool $records An array of grade_objects or false if there are no records matching the $key filters @return void
[ "Sets", "a", "result", "to", "the", "records", "cache", "even", "if", "there", "were", "no", "results", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/grade/grade_category.php#L2758-L2761
217,735
moodle/moodle
mod/quiz/accessmanager.php
quiz_access_manager.make_rules
protected function make_rules($quizobj, $timenow, $canignoretimelimits) { $rules = array(); foreach (self::get_rule_classes() as $ruleclass) { $rule = $ruleclass::make($quizobj, $timenow, $canignoretimelimits); if ($rule) { $rules[$ruleclass] = $rule; ...
php
protected function make_rules($quizobj, $timenow, $canignoretimelimits) { $rules = array(); foreach (self::get_rule_classes() as $ruleclass) { $rule = $ruleclass::make($quizobj, $timenow, $canignoretimelimits); if ($rule) { $rules[$ruleclass] = $rule; ...
[ "protected", "function", "make_rules", "(", "$", "quizobj", ",", "$", "timenow", ",", "$", "canignoretimelimits", ")", "{", "$", "rules", "=", "array", "(", ")", ";", "foreach", "(", "self", "::", "get_rule_classes", "(", ")", "as", "$", "ruleclass", ")"...
Make all the rules relevant to a particular quiz. @param quiz $quizobj information about the quiz in question. @param int $timenow the time that should be considered as 'now'. @param bool $canignoretimelimits whether the current user is exempt from time limits by the mod/quiz:ignoretimelimits capability. @return array ...
[ "Make", "all", "the", "rules", "relevant", "to", "a", "particular", "quiz", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/accessmanager.php#L67-L87
217,736
moodle/moodle
mod/quiz/accessmanager.php
quiz_access_manager.add_settings_form_fields
public static function add_settings_form_fields( mod_quiz_mod_form $quizform, MoodleQuickForm $mform) { foreach (self::get_rule_classes() as $rule) { $rule::add_settings_form_fields($quizform, $mform); } }
php
public static function add_settings_form_fields( mod_quiz_mod_form $quizform, MoodleQuickForm $mform) { foreach (self::get_rule_classes() as $rule) { $rule::add_settings_form_fields($quizform, $mform); } }
[ "public", "static", "function", "add_settings_form_fields", "(", "mod_quiz_mod_form", "$", "quizform", ",", "MoodleQuickForm", "$", "mform", ")", "{", "foreach", "(", "self", "::", "get_rule_classes", "(", ")", "as", "$", "rule", ")", "{", "$", "rule", "::", ...
Add any form fields that the access rules require to the settings form. Note that the standard plugins do not use this mechanism, becuase all their settings are stored in the quiz table. @param mod_quiz_mod_form $quizform the quiz settings form that is being built. @param MoodleQuickForm $mform the wrapped MoodleQuic...
[ "Add", "any", "form", "fields", "that", "the", "access", "rules", "require", "to", "the", "settings", "form", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/accessmanager.php#L105-L111
217,737
moodle/moodle
mod/quiz/accessmanager.php
quiz_access_manager.get_browser_security_choices
public static function get_browser_security_choices() { $options = array('-' => get_string('none', 'quiz')); foreach (self::get_rule_classes() as $rule) { $options += $rule::get_browser_security_choices(); } return $options; }
php
public static function get_browser_security_choices() { $options = array('-' => get_string('none', 'quiz')); foreach (self::get_rule_classes() as $rule) { $options += $rule::get_browser_security_choices(); } return $options; }
[ "public", "static", "function", "get_browser_security_choices", "(", ")", "{", "$", "options", "=", "array", "(", "'-'", "=>", "get_string", "(", "'none'", ",", "'quiz'", ")", ")", ";", "foreach", "(", "self", "::", "get_rule_classes", "(", ")", "as", "$",...
The the options for the Browser security settings menu. @return array key => lang string.
[ "The", "the", "options", "for", "the", "Browser", "security", "settings", "menu", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/accessmanager.php#L118-L124
217,738
moodle/moodle
mod/quiz/accessmanager.php
quiz_access_manager.get_load_sql
protected static function get_load_sql($quizid, $rules, $basefields) { $allfields = $basefields; $alljoins = '{quiz} quiz'; $allparams = array('quizid' => $quizid); foreach ($rules as $rule) { list($fields, $joins, $params) = $rule::get_settings_sql($quizid); if ...
php
protected static function get_load_sql($quizid, $rules, $basefields) { $allfields = $basefields; $alljoins = '{quiz} quiz'; $allparams = array('quizid' => $quizid); foreach ($rules as $rule) { list($fields, $joins, $params) = $rule::get_settings_sql($quizid); if ...
[ "protected", "static", "function", "get_load_sql", "(", "$", "quizid", ",", "$", "rules", ",", "$", "basefields", ")", "{", "$", "allfields", "=", "$", "basefields", ";", "$", "alljoins", "=", "'{quiz} quiz'", ";", "$", "allparams", "=", "array", "(", "'...
Build the SQL for loading all the access settings in one go. @param int $quizid the quiz id. @param string $basefields initial part of the select list. @return array with two elements, the sql and the placeholder values. If $basefields is '' then you must allow for the possibility that there is no data to load, in whic...
[ "Build", "the", "SQL", "for", "loading", "all", "the", "access", "settings", "in", "one", "go", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/accessmanager.php#L185-L211
217,739
moodle/moodle
mod/quiz/accessmanager.php
quiz_access_manager.load_settings
public static function load_settings($quizid) { global $DB; $rules = self::get_rule_classes(); list($sql, $params) = self::get_load_sql($quizid, $rules, ''); if ($sql) { $data = (array) $DB->get_record_sql($sql, $params); } else { $data = array(); ...
php
public static function load_settings($quizid) { global $DB; $rules = self::get_rule_classes(); list($sql, $params) = self::get_load_sql($quizid, $rules, ''); if ($sql) { $data = (array) $DB->get_record_sql($sql, $params); } else { $data = array(); ...
[ "public", "static", "function", "load_settings", "(", "$", "quizid", ")", "{", "global", "$", "DB", ";", "$", "rules", "=", "self", "::", "get_rule_classes", "(", ")", ";", "list", "(", "$", "sql", ",", "$", "params", ")", "=", "self", "::", "get_loa...
Load any settings required by the access rules. We try to do this with a single DB query. Note that the standard plugins do not use this mechanism, becuase all their settings are stored in the quiz table. @param int $quizid the quiz id. @return array setting value name => value. The value names should all start with ...
[ "Load", "any", "settings", "required", "by", "the", "access", "rules", ".", "We", "try", "to", "do", "this", "with", "a", "single", "DB", "query", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/accessmanager.php#L224-L241
217,740
moodle/moodle
mod/quiz/accessmanager.php
quiz_access_manager.load_quiz_and_settings
public static function load_quiz_and_settings($quizid) { global $DB; $rules = self::get_rule_classes(); list($sql, $params) = self::get_load_sql($quizid, $rules, 'quiz.*'); $quiz = $DB->get_record_sql($sql, $params, MUST_EXIST); foreach ($rules as $rule) { foreach (...
php
public static function load_quiz_and_settings($quizid) { global $DB; $rules = self::get_rule_classes(); list($sql, $params) = self::get_load_sql($quizid, $rules, 'quiz.*'); $quiz = $DB->get_record_sql($sql, $params, MUST_EXIST); foreach ($rules as $rule) { foreach (...
[ "public", "static", "function", "load_quiz_and_settings", "(", "$", "quizid", ")", "{", "global", "$", "DB", ";", "$", "rules", "=", "self", "::", "get_rule_classes", "(", ")", ";", "list", "(", "$", "sql", ",", "$", "params", ")", "=", "self", "::", ...
Load the quiz settings and any settings required by the access rules. We try to do this with a single DB query. Note that the standard plugins do not use this mechanism, becuase all their settings are stored in the quiz table. @param int $quizid the quiz id. @return object mdl_quiz row with extra fields.
[ "Load", "the", "quiz", "settings", "and", "any", "settings", "required", "by", "the", "access", "rules", ".", "We", "try", "to", "do", "this", "with", "a", "single", "DB", "query", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/accessmanager.php#L253-L267
217,741
moodle/moodle
mod/quiz/accessmanager.php
quiz_access_manager.describe_rules
public function describe_rules() { $result = array(); foreach ($this->rules as $rule) { $result = $this->accumulate_messages($result, $rule->description()); } return $result; }
php
public function describe_rules() { $result = array(); foreach ($this->rules as $rule) { $result = $this->accumulate_messages($result, $rule->description()); } return $result; }
[ "public", "function", "describe_rules", "(", ")", "{", "$", "result", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "rules", "as", "$", "rule", ")", "{", "$", "result", "=", "$", "this", "->", "accumulate_messages", "(", "$", "resul...
Provide a description of the rules that apply to this quiz, such as is shown at the top of the quiz view page. Note that not all rules consider themselves important enough to output a description. @return array an array of description messages which may be empty. It would be sensible to output each one surrounded by &...
[ "Provide", "a", "description", "of", "the", "rules", "that", "apply", "to", "this", "quiz", "such", "as", "is", "shown", "at", "the", "top", "of", "the", "quiz", "view", "page", ".", "Note", "that", "not", "all", "rules", "consider", "themselves", "impor...
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/accessmanager.php#L304-L310
217,742
moodle/moodle
mod/quiz/accessmanager.php
quiz_access_manager.prevent_new_attempt
public function prevent_new_attempt($numprevattempts, $lastattempt) { $reasons = array(); foreach ($this->rules as $rule) { $reasons = $this->accumulate_messages($reasons, $rule->prevent_new_attempt($numprevattempts, $lastattempt)); } return $reasons; ...
php
public function prevent_new_attempt($numprevattempts, $lastattempt) { $reasons = array(); foreach ($this->rules as $rule) { $reasons = $this->accumulate_messages($reasons, $rule->prevent_new_attempt($numprevattempts, $lastattempt)); } return $reasons; ...
[ "public", "function", "prevent_new_attempt", "(", "$", "numprevattempts", ",", "$", "lastattempt", ")", "{", "$", "reasons", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "rules", "as", "$", "rule", ")", "{", "$", "reasons", "=", "$",...
Whether or not a user should be allowed to start a new attempt at this quiz now. If there are any restrictions in force now, return an array of reasons why access should be blocked. If access is OK, return false. @param int $numattempts the number of previous attempts this user has made. @param object|false $lastattem...
[ "Whether", "or", "not", "a", "user", "should", "be", "allowed", "to", "start", "a", "new", "attempt", "at", "this", "quiz", "now", ".", "If", "there", "are", "any", "restrictions", "in", "force", "now", "return", "an", "array", "of", "reasons", "why", ...
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/accessmanager.php#L323-L330
217,743
moodle/moodle
mod/quiz/accessmanager.php
quiz_access_manager.prevent_access
public function prevent_access() { $reasons = array(); foreach ($this->rules as $rule) { $reasons = $this->accumulate_messages($reasons, $rule->prevent_access()); } return $reasons; }
php
public function prevent_access() { $reasons = array(); foreach ($this->rules as $rule) { $reasons = $this->accumulate_messages($reasons, $rule->prevent_access()); } return $reasons; }
[ "public", "function", "prevent_access", "(", ")", "{", "$", "reasons", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "rules", "as", "$", "rule", ")", "{", "$", "reasons", "=", "$", "this", "->", "accumulate_messages", "(", "$", "rea...
Whether the user should be blocked from starting a new attempt or continuing an attempt now. If there are any restrictions in force now, return an array of reasons why access should be blocked. If access is OK, return false. @return mixed An array of reason why access is not allowed, or an empty array (== false) if ac...
[ "Whether", "the", "user", "should", "be", "blocked", "from", "starting", "a", "new", "attempt", "or", "continuing", "an", "attempt", "now", ".", "If", "there", "are", "any", "restrictions", "in", "force", "now", "return", "an", "array", "of", "reasons", "w...
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/accessmanager.php#L340-L346
217,744
moodle/moodle
mod/quiz/accessmanager.php
quiz_access_manager.get_preflight_check_form
public function get_preflight_check_form(moodle_url $url, $attemptid) { // This form normally wants POST submissins. However, it also needs to // accept GET submissions. Since formslib is strict, we have to detect // which case we are in, and set the form property appropriately. $method ...
php
public function get_preflight_check_form(moodle_url $url, $attemptid) { // This form normally wants POST submissins. However, it also needs to // accept GET submissions. Since formslib is strict, we have to detect // which case we are in, and set the form property appropriately. $method ...
[ "public", "function", "get_preflight_check_form", "(", "moodle_url", "$", "url", ",", "$", "attemptid", ")", "{", "// This form normally wants POST submissins. However, it also needs to", "// accept GET submissions. Since formslib is strict, we have to detect", "// which case we are in, ...
Build the form required to do the pre-flight checks. @param moodle_url $url the form action URL. @param int|null $attemptid the id of the current attempt, if there is one, otherwise null. @return mod_quiz_preflight_check_form the form.
[ "Build", "the", "form", "required", "to", "do", "the", "pre", "-", "flight", "checks", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/accessmanager.php#L370-L381
217,745
moodle/moodle
mod/quiz/accessmanager.php
quiz_access_manager.is_finished
public function is_finished($numprevattempts, $lastattempt) { foreach ($this->rules as $rule) { if ($rule->is_finished($numprevattempts, $lastattempt)) { return true; } } return false; }
php
public function is_finished($numprevattempts, $lastattempt) { foreach ($this->rules as $rule) { if ($rule->is_finished($numprevattempts, $lastattempt)) { return true; } } return false; }
[ "public", "function", "is_finished", "(", "$", "numprevattempts", ",", "$", "lastattempt", ")", "{", "foreach", "(", "$", "this", "->", "rules", "as", "$", "rule", ")", "{", "if", "(", "$", "rule", "->", "is_finished", "(", "$", "numprevattempts", ",", ...
Do any of the rules mean that this student will no be allowed any further attempts at this quiz. Used, for example, to change the label by the grade displayed on the view page from 'your current grade is' to 'your final grade is'. @param int $numattempts the number of previous attempts this user has made. @param objec...
[ "Do", "any", "of", "the", "rules", "mean", "that", "this", "student", "will", "no", "be", "allowed", "any", "further", "attempts", "at", "this", "quiz", ".", "Used", "for", "example", "to", "change", "the", "label", "by", "the", "grade", "displayed", "on...
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/accessmanager.php#L415-L422
217,746
moodle/moodle
mod/quiz/accessmanager.php
quiz_access_manager.get_end_time
public function get_end_time($attempt) { $timeclose = false; foreach ($this->rules as $rule) { $ruletimeclose = $rule->end_time($attempt); if ($ruletimeclose !== false && ($timeclose === false || $ruletimeclose < $timeclose)) { $timeclose = $ruletimeclose; ...
php
public function get_end_time($attempt) { $timeclose = false; foreach ($this->rules as $rule) { $ruletimeclose = $rule->end_time($attempt); if ($ruletimeclose !== false && ($timeclose === false || $ruletimeclose < $timeclose)) { $timeclose = $ruletimeclose; ...
[ "public", "function", "get_end_time", "(", "$", "attempt", ")", "{", "$", "timeclose", "=", "false", ";", "foreach", "(", "$", "this", "->", "rules", "as", "$", "rule", ")", "{", "$", "ruletimeclose", "=", "$", "rule", "->", "end_time", "(", "$", "at...
Compute when the attempt must be submitted. @param object $attempt the data from the relevant quiz_attempts row. @return int|false the attempt close time. False if there is no limit.
[ "Compute", "when", "the", "attempt", "must", "be", "submitted", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/accessmanager.php#L443-L452
217,747
moodle/moodle
mod/quiz/accessmanager.php
quiz_access_manager.get_time_left_display
public function get_time_left_display($attempt, $timenow) { $timeleft = false; foreach ($this->rules as $rule) { $ruletimeleft = $rule->time_left_display($attempt, $timenow); if ($ruletimeleft !== false && ($timeleft === false || $ruletimeleft < $timeleft)) { $tim...
php
public function get_time_left_display($attempt, $timenow) { $timeleft = false; foreach ($this->rules as $rule) { $ruletimeleft = $rule->time_left_display($attempt, $timenow); if ($ruletimeleft !== false && ($timeleft === false || $ruletimeleft < $timeleft)) { $tim...
[ "public", "function", "get_time_left_display", "(", "$", "attempt", ",", "$", "timenow", ")", "{", "$", "timeleft", "=", "false", ";", "foreach", "(", "$", "this", "->", "rules", "as", "$", "rule", ")", "{", "$", "ruletimeleft", "=", "$", "rule", "->",...
Compute what should be displayed to the user for time remaining in this attempt. @param object $attempt the data from the relevant quiz_attempts row. @param int $timenow the time to consider as 'now'. @return int|false the number of seconds remaining for this attempt. False if no limit should be displayed.
[ "Compute", "what", "should", "be", "displayed", "to", "the", "user", "for", "time", "remaining", "in", "this", "attempt", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/accessmanager.php#L462-L471
217,748
moodle/moodle
mod/quiz/accessmanager.php
quiz_access_manager.back_to_view_page
public function back_to_view_page($output, $message = '') { if ($this->attempt_must_be_in_popup()) { echo $output->close_attempt_popup($this->quizobj->view_url(), $message); die(); } else { redirect($this->quizobj->view_url(), $message); } }
php
public function back_to_view_page($output, $message = '') { if ($this->attempt_must_be_in_popup()) { echo $output->close_attempt_popup($this->quizobj->view_url(), $message); die(); } else { redirect($this->quizobj->view_url(), $message); } }
[ "public", "function", "back_to_view_page", "(", "$", "output", ",", "$", "message", "=", "''", ")", "{", "if", "(", "$", "this", "->", "attempt_must_be_in_popup", "(", ")", ")", "{", "echo", "$", "output", "->", "close_attempt_popup", "(", "$", "this", "...
Send the user back to the quiz view page. Normally this is just a redirect, but If we were in a secure window, we close this window, and reload the view window we came from. This method does not return; @param mod_quiz_renderer $output the quiz renderer. @param string $message optional message to output while redirec...
[ "Send", "the", "user", "back", "to", "the", "quiz", "view", "page", ".", "Normally", "this", "is", "just", "a", "redirect", "but", "If", "we", "were", "in", "a", "secure", "window", "we", "close", "this", "window", "and", "reload", "the", "view", "wind...
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/accessmanager.php#L506-L513
217,749
moodle/moodle
mod/quiz/accessmanager.php
quiz_access_manager.make_review_link
public function make_review_link($attempt, $reviewoptions, $output) { // If the attempt is still open, don't link. if (in_array($attempt->state, array(quiz_attempt::IN_PROGRESS, quiz_attempt::OVERDUE))) { return $output->no_review_message(''); } $when = quiz_attempt_state($...
php
public function make_review_link($attempt, $reviewoptions, $output) { // If the attempt is still open, don't link. if (in_array($attempt->state, array(quiz_attempt::IN_PROGRESS, quiz_attempt::OVERDUE))) { return $output->no_review_message(''); } $when = quiz_attempt_state($...
[ "public", "function", "make_review_link", "(", "$", "attempt", ",", "$", "reviewoptions", ",", "$", "output", ")", "{", "// If the attempt is still open, don't link.", "if", "(", "in_array", "(", "$", "attempt", "->", "state", ",", "array", "(", "quiz_attempt", ...
Make some text into a link to review the quiz, if that is appropriate. @param string $linktext some text. @param object $attempt the attempt object @return string some HTML, the $linktext either unmodified or wrapped in a link to the review page.
[ "Make", "some", "text", "into", "a", "link", "to", "review", "the", "quiz", "if", "that", "is", "appropriate", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/accessmanager.php#L523-L541
217,750
moodle/moodle
mod/quiz/accessmanager.php
quiz_access_manager.validate_preflight_check
public function validate_preflight_check($data, $files, $attemptid) { $errors = array(); foreach ($this->rules as $rule) { if ($rule->is_preflight_check_required($attemptid)) { $errors = $rule->validate_preflight_check($data, $files, $errors, $attemptid); } ...
php
public function validate_preflight_check($data, $files, $attemptid) { $errors = array(); foreach ($this->rules as $rule) { if ($rule->is_preflight_check_required($attemptid)) { $errors = $rule->validate_preflight_check($data, $files, $errors, $attemptid); } ...
[ "public", "function", "validate_preflight_check", "(", "$", "data", ",", "$", "files", ",", "$", "attemptid", ")", "{", "$", "errors", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "rules", "as", "$", "rule", ")", "{", "if", "(", ...
Run the preflight checks using the given data in all the rules supporting them. @param array $data passed data for validation @param array $files un-used, Moodle seems to not support it anymore @param int|null $attemptid the id of the current attempt, if there is one, otherwise null. @return array of errors, empty arr...
[ "Run", "the", "preflight", "checks", "using", "the", "given", "data", "in", "all", "the", "rules", "supporting", "them", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/quiz/accessmanager.php#L553-L561
217,751
moodle/moodle
lib/htmlpurifier/HTMLPurifier/DefinitionCacheFactory.php
HTMLPurifier_DefinitionCacheFactory.instance
public static function instance($prototype = null) { static $instance; if ($prototype !== null) { $instance = $prototype; } elseif ($instance === null || $prototype === true) { $instance = new HTMLPurifier_DefinitionCacheFactory(); $instance->setup(); ...
php
public static function instance($prototype = null) { static $instance; if ($prototype !== null) { $instance = $prototype; } elseif ($instance === null || $prototype === true) { $instance = new HTMLPurifier_DefinitionCacheFactory(); $instance->setup(); ...
[ "public", "static", "function", "instance", "(", "$", "prototype", "=", "null", ")", "{", "static", "$", "instance", ";", "if", "(", "$", "prototype", "!==", "null", ")", "{", "$", "instance", "=", "$", "prototype", ";", "}", "elseif", "(", "$", "ins...
Retrieves an instance of global definition cache factory. @param HTMLPurifier_DefinitionCacheFactory $prototype @return HTMLPurifier_DefinitionCacheFactory
[ "Retrieves", "an", "instance", "of", "global", "definition", "cache", "factory", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/DefinitionCacheFactory.php#L36-L46
217,752
moodle/moodle
lib/htmlpurifier/HTMLPurifier/DefinitionCacheFactory.php
HTMLPurifier_DefinitionCacheFactory.create
public function create($type, $config) { $method = $config->get('Cache.DefinitionImpl'); if ($method === null) { return new HTMLPurifier_DefinitionCache_Null($type); } if (!empty($this->caches[$method][$type])) { return $this->caches[$method][$type]; }...
php
public function create($type, $config) { $method = $config->get('Cache.DefinitionImpl'); if ($method === null) { return new HTMLPurifier_DefinitionCache_Null($type); } if (!empty($this->caches[$method][$type])) { return $this->caches[$method][$type]; }...
[ "public", "function", "create", "(", "$", "type", ",", "$", "config", ")", "{", "$", "method", "=", "$", "config", "->", "get", "(", "'Cache.DefinitionImpl'", ")", ";", "if", "(", "$", "method", "===", "null", ")", "{", "return", "new", "HTMLPurifier_D...
Factory method that creates a cache object based on configuration @param string $type Name of definitions handled by cache @param HTMLPurifier_Config $config Config instance @return mixed
[ "Factory", "method", "that", "creates", "a", "cache", "object", "based", "on", "configuration" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/DefinitionCacheFactory.php#L64-L90
217,753
moodle/moodle
lib/htmlpurifier/HTMLPurifier/DefinitionCacheFactory.php
HTMLPurifier_DefinitionCacheFactory.addDecorator
public function addDecorator($decorator) { if (is_string($decorator)) { $class = "HTMLPurifier_DefinitionCache_Decorator_$decorator"; $decorator = new $class; } $this->decorators[$decorator->name] = $decorator; }
php
public function addDecorator($decorator) { if (is_string($decorator)) { $class = "HTMLPurifier_DefinitionCache_Decorator_$decorator"; $decorator = new $class; } $this->decorators[$decorator->name] = $decorator; }
[ "public", "function", "addDecorator", "(", "$", "decorator", ")", "{", "if", "(", "is_string", "(", "$", "decorator", ")", ")", "{", "$", "class", "=", "\"HTMLPurifier_DefinitionCache_Decorator_$decorator\"", ";", "$", "decorator", "=", "new", "$", "class", ";...
Registers a decorator to add to all new cache objects @param HTMLPurifier_DefinitionCache_Decorator|string $decorator An instance or the name of a decorator
[ "Registers", "a", "decorator", "to", "add", "to", "all", "new", "cache", "objects" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/DefinitionCacheFactory.php#L96-L103
217,754
moodle/moodle
lib/classes/output/mustache_shorten_text_helper.php
mustache_shorten_text_helper.shorten
public function shorten($args, Mustache_LambdaHelper $helper) { // Split the text into an array of variables. list($length, $text) = explode(',', $args, 2); $length = trim($length); $text = trim($text); // Allow mustache tags in the text. $text = $helper->render($text); ...
php
public function shorten($args, Mustache_LambdaHelper $helper) { // Split the text into an array of variables. list($length, $text) = explode(',', $args, 2); $length = trim($length); $text = trim($text); // Allow mustache tags in the text. $text = $helper->render($text); ...
[ "public", "function", "shorten", "(", "$", "args", ",", "Mustache_LambdaHelper", "$", "helper", ")", "{", "// Split the text into an array of variables.", "list", "(", "$", "length", ",", "$", "text", ")", "=", "explode", "(", "','", ",", "$", "args", ",", "...
Read a length and text component from the string. {{#shortentext}}50,Some test to shorten{{/shortentext}} Both args are required. The length must come first. @param string $args The text to parse for arguments. @param Mustache_LambdaHelper $helper Used to render nested mustache variables. @return string
[ "Read", "a", "length", "and", "text", "component", "from", "the", "string", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/output/mustache_shorten_text_helper.php#L52-L62
217,755
moodle/moodle
lib/htmlpurifier/HTMLPurifier/Generator.php
HTMLPurifier_Generator.generateScriptFromToken
public function generateScriptFromToken($token) { if (!$token instanceof HTMLPurifier_Token_Text) { return $this->generateFromToken($token); } // Thanks <http://lachy.id.au/log/2005/05/script-comments> $data = preg_replace('#//\s*$#', '', $token->data); return '<!...
php
public function generateScriptFromToken($token) { if (!$token instanceof HTMLPurifier_Token_Text) { return $this->generateFromToken($token); } // Thanks <http://lachy.id.au/log/2005/05/script-comments> $data = preg_replace('#//\s*$#', '', $token->data); return '<!...
[ "public", "function", "generateScriptFromToken", "(", "$", "token", ")", "{", "if", "(", "!", "$", "token", "instanceof", "HTMLPurifier_Token_Text", ")", "{", "return", "$", "this", "->", "generateFromToken", "(", "$", "token", ")", ";", "}", "// Thanks <http:...
Special case processor for the contents of script tags @param HTMLPurifier_Token $token HTMLPurifier_Token object. @return string @warning This runs into problems if there's already a literal --> somewhere inside the script contents.
[ "Special", "case", "processor", "for", "the", "contents", "of", "script", "tags" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/Generator.php#L193-L201
217,756
moodle/moodle
lib/htmlpurifier/HTMLPurifier/Generator.php
HTMLPurifier_Generator.generateAttributes
public function generateAttributes($assoc_array_of_attributes, $element = '') { $html = ''; if ($this->_sortAttr) { ksort($assoc_array_of_attributes); } foreach ($assoc_array_of_attributes as $key => $value) { if (!$this->_xhtml) { // Remove na...
php
public function generateAttributes($assoc_array_of_attributes, $element = '') { $html = ''; if ($this->_sortAttr) { ksort($assoc_array_of_attributes); } foreach ($assoc_array_of_attributes as $key => $value) { if (!$this->_xhtml) { // Remove na...
[ "public", "function", "generateAttributes", "(", "$", "assoc_array_of_attributes", ",", "$", "element", "=", "''", ")", "{", "$", "html", "=", "''", ";", "if", "(", "$", "this", "->", "_sortAttr", ")", "{", "ksort", "(", "$", "assoc_array_of_attributes", "...
Generates attribute declarations from attribute array. @note This does not include the leading or trailing space. @param array $assoc_array_of_attributes Attribute array @param string $element Name of element attributes are for, used to check attribute minimization. @return string Generated HTML fragment for insertion.
[ "Generates", "attribute", "declarations", "from", "attribute", "array", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/Generator.php#L211-L263
217,757
moodle/moodle
lib/htmlpurifier/HTMLPurifier/Generator.php
HTMLPurifier_Generator.escape
public function escape($string, $quote = null) { // Workaround for APC bug on Mac Leopard reported by sidepodcast // http://htmlpurifier.org/phorum/read.php?3,4823,4846 if ($quote === null) { $quote = ENT_COMPAT; } return htmlspecialchars($string, $quote, 'UTF-8')...
php
public function escape($string, $quote = null) { // Workaround for APC bug on Mac Leopard reported by sidepodcast // http://htmlpurifier.org/phorum/read.php?3,4823,4846 if ($quote === null) { $quote = ENT_COMPAT; } return htmlspecialchars($string, $quote, 'UTF-8')...
[ "public", "function", "escape", "(", "$", "string", ",", "$", "quote", "=", "null", ")", "{", "// Workaround for APC bug on Mac Leopard reported by sidepodcast", "// http://htmlpurifier.org/phorum/read.php?3,4823,4846", "if", "(", "$", "quote", "===", "null", ")", "{", ...
Escapes raw text data. @todo This really ought to be protected, but until we have a facility for properly generating HTML here w/o using tokens, it stays public. @param string $string String data to escape for HTML. @param int $quote Quoting style, like htmlspecialchars. ENT_NOQUOTES is permissible for non-attribute ou...
[ "Escapes", "raw", "text", "data", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier/Generator.php#L275-L283
217,758
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.setDispositionParameter
public function setDispositionParameter($label, $data) { $cd = $this->_headers['content-disposition']; if (is_null($data)) { unset($cd[$label]); } elseif (strlen($data)) { $cd[$label] = $data; if (strcasecmp($label, 'size') === 0) { // RF...
php
public function setDispositionParameter($label, $data) { $cd = $this->_headers['content-disposition']; if (is_null($data)) { unset($cd[$label]); } elseif (strlen($data)) { $cd[$label] = $data; if (strcasecmp($label, 'size') === 0) { // RF...
[ "public", "function", "setDispositionParameter", "(", "$", "label", ",", "$", "data", ")", "{", "$", "cd", "=", "$", "this", "->", "_headers", "[", "'content-disposition'", "]", ";", "if", "(", "is_null", "(", "$", "data", ")", ")", "{", "unset", "(", ...
Add a disposition parameter to this part. @param string $label The disposition parameter label. @param string $data The disposition parameter data. If null, removes the parameter (@since 2.8.0).
[ "Add", "a", "disposition", "parameter", "to", "this", "part", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L233-L252
217,759
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.getName
public function getName($default = false) { if (!($name = $this->getDispositionParameter('filename')) && !($name = $this->getContentTypeParameter('name')) && $default) { $name = preg_replace('|\W|', '_', $this->getDescription(false)); } return $name; ...
php
public function getName($default = false) { if (!($name = $this->getDispositionParameter('filename')) && !($name = $this->getContentTypeParameter('name')) && $default) { $name = preg_replace('|\W|', '_', $this->getDescription(false)); } return $name; ...
[ "public", "function", "getName", "(", "$", "default", "=", "false", ")", "{", "if", "(", "!", "(", "$", "name", "=", "$", "this", "->", "getDispositionParameter", "(", "'filename'", ")", ")", "&&", "!", "(", "$", "name", "=", "$", "this", "->", "ge...
Get the name of this part. @param boolean $default If the name parameter doesn't exist, should we use the default name from the description parameter? @return string The name of the part.
[ "Get", "the", "name", "of", "this", "part", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L299-L308
217,760
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.setContents
public function setContents($contents, $options = array()) { if (is_resource($contents) && ($contents === $this->_contents)) { return; } if (empty($options['encoding'])) { $options['encoding'] = $this->_transferEncoding; } $fp = (empty($options['uses...
php
public function setContents($contents, $options = array()) { if (is_resource($contents) && ($contents === $this->_contents)) { return; } if (empty($options['encoding'])) { $options['encoding'] = $this->_transferEncoding; } $fp = (empty($options['uses...
[ "public", "function", "setContents", "(", "$", "contents", ",", "$", "options", "=", "array", "(", ")", ")", "{", "if", "(", "is_resource", "(", "$", "contents", ")", "&&", "(", "$", "contents", "===", "$", "this", "->", "_contents", ")", ")", "{", ...
Set the body contents of this part. @param mixed $contents The part body. Either a string or a stream resource, or an array containing both. @param array $options Additional options: - encoding: (string) The encoding of $contents. DEFAULT: Current transfer encoding value. - usestream: (boolean) If $contents is a st...
[ "Set", "the", "body", "contents", "of", "this", "part", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L322-L341
217,761
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.appendContents
public function appendContents($contents, $options = array()) { if (empty($this->_contents)) { $this->setContents($contents, $options); } else { $fp = (empty($options['usestream']) || !is_resource($contents)) ? $this->_writeStream($contents) : ...
php
public function appendContents($contents, $options = array()) { if (empty($this->_contents)) { $this->setContents($contents, $options); } else { $fp = (empty($options['usestream']) || !is_resource($contents)) ? $this->_writeStream($contents) : ...
[ "public", "function", "appendContents", "(", "$", "contents", ",", "$", "options", "=", "array", "(", ")", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "_contents", ")", ")", "{", "$", "this", "->", "setContents", "(", "$", "contents", ",", ...
Add to the body contents of this part. @param mixed $contents The part body. Either a string or a stream resource, or an array containing both. - encoding: (string) The encoding of $contents. DEFAULT: Current transfer encoding value. - usestream: (boolean) If $contents is a stream, should we directly use that stream?...
[ "Add", "to", "the", "body", "contents", "of", "this", "part", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L354-L366
217,762
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.clearContents
public function clearContents() { if (!empty($this->_contents)) { fclose($this->_contents); $this->_contents = null; unset($this->_temp['sendTransferEncoding']); } }
php
public function clearContents() { if (!empty($this->_contents)) { fclose($this->_contents); $this->_contents = null; unset($this->_temp['sendTransferEncoding']); } }
[ "public", "function", "clearContents", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "_contents", ")", ")", "{", "fclose", "(", "$", "this", "->", "_contents", ")", ";", "$", "this", "->", "_contents", "=", "null", ";", "unset", "...
Clears the body contents of this part.
[ "Clears", "the", "body", "contents", "of", "this", "part", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L371-L378
217,763
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.getContents
public function getContents($options = array()) { return empty($options['canonical']) ? (empty($options['stream']) ? $this->_readStream($this->_contents) : $this->_contents) : $this->replaceEOL($this->_contents, self::RFC_EOL, !empty($options['stream'])); }
php
public function getContents($options = array()) { return empty($options['canonical']) ? (empty($options['stream']) ? $this->_readStream($this->_contents) : $this->_contents) : $this->replaceEOL($this->_contents, self::RFC_EOL, !empty($options['stream'])); }
[ "public", "function", "getContents", "(", "$", "options", "=", "array", "(", ")", ")", "{", "return", "empty", "(", "$", "options", "[", "'canonical'", "]", ")", "?", "(", "empty", "(", "$", "options", "[", "'stream'", "]", ")", "?", "$", "this", "...
Return the body of the part. @param array $options Additional options: - canonical: (boolean) Returns the contents in strict RFC 822 & 2045 output - namely, all newlines end with the canonical <CR><LF> sequence. DEFAULT: No - stream: (boolean) Return the body as a stream resource. DEFAULT: No @return mixed The body...
[ "Return", "the", "body", "of", "the", "part", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L394-L399
217,764
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part._transferDecode
protected function _transferDecode($fp, $encoding) { /* If the contents are empty, return now. */ fseek($fp, 0, SEEK_END); if (ftell($fp)) { switch ($encoding) { case 'base64': try { return $this->_writeStream($fp, array( ...
php
protected function _transferDecode($fp, $encoding) { /* If the contents are empty, return now. */ fseek($fp, 0, SEEK_END); if (ftell($fp)) { switch ($encoding) { case 'base64': try { return $this->_writeStream($fp, array( ...
[ "protected", "function", "_transferDecode", "(", "$", "fp", ",", "$", "encoding", ")", "{", "/* If the contents are empty, return now. */", "fseek", "(", "$", "fp", ",", "0", ",", "SEEK_END", ")", ";", "if", "(", "ftell", "(", "$", "fp", ")", ")", "{", "...
Decodes the contents of the part to binary encoding. @param resource $fp A stream containing the data to decode. @param string $encoding The original file encoding. @return resource A new file resource with the decoded data.
[ "Decodes", "the", "contents", "of", "the", "part", "to", "binary", "encoding", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L409-L453
217,765
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part._transferEncode
protected function _transferEncode($fp, $encoding) { $this->_temp['transferEncodeClose'] = true; switch ($encoding) { case 'base64': /* Base64 Encoding: See RFC 2045, section 6.8 */ return $this->_writeStream($fp, array( 'filter' => array( ...
php
protected function _transferEncode($fp, $encoding) { $this->_temp['transferEncodeClose'] = true; switch ($encoding) { case 'base64': /* Base64 Encoding: See RFC 2045, section 6.8 */ return $this->_writeStream($fp, array( 'filter' => array( ...
[ "protected", "function", "_transferEncode", "(", "$", "fp", ",", "$", "encoding", ")", "{", "$", "this", "->", "_temp", "[", "'transferEncodeClose'", "]", "=", "true", ";", "switch", "(", "$", "encoding", ")", "{", "case", "'base64'", ":", "/* Base64 Encod...
Encodes the contents of the part as necessary for transport. @param resource $fp A stream containing the data to encode. @param string $encoding The encoding to use. @return resource A new file resource with the encoded data.
[ "Encodes", "the", "contents", "of", "the", "part", "as", "necessary", "for", "transport", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L463-L505
217,766
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.getType
public function getType($charset = false) { $ct = $this->_headers['content-type']; return $charset ? $ct->type_charset : $ct->value; }
php
public function getType($charset = false) { $ct = $this->_headers['content-type']; return $charset ? $ct->type_charset : $ct->value; }
[ "public", "function", "getType", "(", "$", "charset", "=", "false", ")", "{", "$", "ct", "=", "$", "this", "->", "_headers", "[", "'content-type'", "]", ";", "return", "$", "charset", "?", "$", "ct", "->", "type_charset", ":", "$", "ct", "->", "value...
Get the full MIME Content-Type of this part. @param boolean $charset Append character set information to the end of the content type if this is a text/* part? ` @return string The MIME type of this part.
[ "Get", "the", "full", "MIME", "Content", "-", "Type", "of", "this", "part", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L530-L537
217,767
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.setDescription
public function setDescription($description) { if (is_null($description)) { unset($this->_headers['content-description']); } else { if (!($hdr = $this->_headers['content-description'])) { $hdr = new Horde_Mime_Headers_ContentDescription(null, ''); ...
php
public function setDescription($description) { if (is_null($description)) { unset($this->_headers['content-description']); } else { if (!($hdr = $this->_headers['content-description'])) { $hdr = new Horde_Mime_Headers_ContentDescription(null, ''); ...
[ "public", "function", "setDescription", "(", "$", "description", ")", "{", "if", "(", "is_null", "(", "$", "description", ")", ")", "{", "unset", "(", "$", "this", "->", "_headers", "[", "'content-description'", "]", ")", ";", "}", "else", "{", "if", "...
Set the description of this part. @param string $description The description of this part. If null, deletes the description (@since 2.8.0).
[ "Set", "the", "description", "of", "this", "part", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L695-L706
217,768
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.getDescription
public function getDescription($default = false) { if (($ob = $this->_headers['content-description']) && strlen($ob->value)) { return $ob->value; } return $default ? $this->getName() : ''; }
php
public function getDescription($default = false) { if (($ob = $this->_headers['content-description']) && strlen($ob->value)) { return $ob->value; } return $default ? $this->getName() : ''; }
[ "public", "function", "getDescription", "(", "$", "default", "=", "false", ")", "{", "if", "(", "(", "$", "ob", "=", "$", "this", "->", "_headers", "[", "'content-description'", "]", ")", "&&", "strlen", "(", "$", "ob", "->", "value", ")", ")", "{", ...
Get the description of this part. @param boolean $default If the description parameter doesn't exist, should we use the name of the part? @return string The description of this part.
[ "Get", "the", "description", "of", "this", "part", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L716-L726
217,769
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.setTransferEncoding
public function setTransferEncoding($encoding, $options = array()) { if (empty($encoding) || (empty($options['send']) && !empty($this->_contents))) { return; } switch ($encoding = Horde_String::lower($encoding)) { case '7bit': case '8bit': cas...
php
public function setTransferEncoding($encoding, $options = array()) { if (empty($encoding) || (empty($options['send']) && !empty($this->_contents))) { return; } switch ($encoding = Horde_String::lower($encoding)) { case '7bit': case '8bit': cas...
[ "public", "function", "setTransferEncoding", "(", "$", "encoding", ",", "$", "options", "=", "array", "(", ")", ")", "{", "if", "(", "empty", "(", "$", "encoding", ")", "||", "(", "empty", "(", "$", "options", "[", "'send'", "]", ")", "&&", "!", "e...
Set the transfer encoding to use for this part. Only needed in the following circumstances: 1.) Indicate what the transfer encoding is if the data has not yet been set in the object (can only be set if there presently are not any contents). 2.) Force the encoding to a certain type on a toString() call (if 'send' is tr...
[ "Set", "the", "transfer", "encoding", "to", "use", "for", "this", "part", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L743-L778
217,770
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.addMimeHeaders
public function addMimeHeaders($options = array()) { if (empty($options['headers'])) { $headers = new Horde_Mime_Headers(); } else { $headers = $options['headers']; $headers->removeHeader('Content-Disposition'); $headers->removeHeader('Content-Transfer...
php
public function addMimeHeaders($options = array()) { if (empty($options['headers'])) { $headers = new Horde_Mime_Headers(); } else { $headers = $options['headers']; $headers->removeHeader('Content-Disposition'); $headers->removeHeader('Content-Transfer...
[ "public", "function", "addMimeHeaders", "(", "$", "options", "=", "array", "(", ")", ")", "{", "if", "(", "empty", "(", "$", "options", "[", "'headers'", "]", ")", ")", "{", "$", "headers", "=", "new", "Horde_Mime_Headers", "(", ")", ";", "}", "else"...
Returns a Horde_Mime_Header object containing all MIME headers needed for the part. @param array $options Additional options: - encode: (integer) A mask of allowable encodings. DEFAULT: Auto-determined - headers: (Horde_Mime_Headers) The object to add the MIME headers to. DEFAULT: Add headers to a new object @return...
[ "Returns", "a", "Horde_Mime_Header", "object", "containing", "all", "MIME", "headers", "needed", "for", "the", "part", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L866-L930
217,771
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part._getTransferEncoding
protected function _getTransferEncoding($encode = self::ENCODE_7BIT) { if (!empty($this->_temp['sendEncoding'])) { return $this->_temp['sendEncoding']; } elseif (!empty($this->_temp['sendTransferEncoding'][$encode])) { return $this->_temp['sendTransferEncoding'][$encode]; ...
php
protected function _getTransferEncoding($encode = self::ENCODE_7BIT) { if (!empty($this->_temp['sendEncoding'])) { return $this->_temp['sendEncoding']; } elseif (!empty($this->_temp['sendTransferEncoding'][$encode])) { return $this->_temp['sendTransferEncoding'][$encode]; ...
[ "protected", "function", "_getTransferEncoding", "(", "$", "encode", "=", "self", "::", "ENCODE_7BIT", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "_temp", "[", "'sendEncoding'", "]", ")", ")", "{", "return", "$", "this", "->", "_temp", ...
Get the transfer encoding for the part based on the user requested transfer encoding and the current contents of the part. @param integer $encode A mask of allowable encodings. @return string The transfer-encoding of this part.
[ "Get", "the", "transfer", "encoding", "for", "the", "part", "based", "on", "the", "user", "requested", "transfer", "encoding", "and", "the", "current", "contents", "of", "the", "part", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L1131-L1208
217,772
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.replaceEOL
public function replaceEOL($text, $eol = null, $stream = false) { if (is_null($eol)) { $eol = $this->getEOL(); } stream_filter_register('horde_eol', 'Horde_Stream_Filter_Eol'); $fp = $this->_writeStream($text, array( 'filter' => array( 'horde_...
php
public function replaceEOL($text, $eol = null, $stream = false) { if (is_null($eol)) { $eol = $this->getEOL(); } stream_filter_register('horde_eol', 'Horde_Stream_Filter_Eol'); $fp = $this->_writeStream($text, array( 'filter' => array( 'horde_...
[ "public", "function", "replaceEOL", "(", "$", "text", ",", "$", "eol", "=", "null", ",", "$", "stream", "=", "false", ")", "{", "if", "(", "is_null", "(", "$", "eol", ")", ")", "{", "$", "eol", "=", "$", "this", "->", "getEOL", "(", ")", ";", ...
Replace newlines in this part's contents with those specified by either the given newline sequence or the part's current EOL setting. @param mixed $text The text to replace. Either a string or a stream resource. If a stream, and returning a string, will close the stream when done. @param string $eol The EOL ...
[ "Replace", "newlines", "in", "this", "part", "s", "contents", "with", "those", "specified", "by", "either", "the", "given", "newline", "sequence", "or", "the", "part", "s", "current", "EOL", "setting", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L1225-L1239
217,773
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.getBytes
public function getBytes($approx = false) { if ($this->getPrimaryType() == 'multipart') { if (isset($this->_bytes)) { return $this->_bytes; } $bytes = 0; foreach ($this as $part) { $bytes += $part->getBytes($approx); ...
php
public function getBytes($approx = false) { if ($this->getPrimaryType() == 'multipart') { if (isset($this->_bytes)) { return $this->_bytes; } $bytes = 0; foreach ($this as $part) { $bytes += $part->getBytes($approx); ...
[ "public", "function", "getBytes", "(", "$", "approx", "=", "false", ")", "{", "if", "(", "$", "this", "->", "getPrimaryType", "(", ")", "==", "'multipart'", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "_bytes", ")", ")", "{", "return", "$...
Determine the size of this MIME part and its child members. @todo Remove $approx parameter. @param boolean $approx If true, determines an approximate size for parts consisting of base64 encoded data. @return integer Size of the part, in bytes.
[ "Determine", "the", "size", "of", "this", "MIME", "part", "and", "its", "child", "members", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L1251-L1279
217,774
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.getSize
public function getSize($approx = false) { if (!($bytes = $this->getBytes($approx))) { return 0; } $localeinfo = Horde_Nls::getLocaleInfo(); // TODO: Workaround broken number_format() prior to PHP 5.4.0. return str_replace( array('X', 'Y'), ...
php
public function getSize($approx = false) { if (!($bytes = $this->getBytes($approx))) { return 0; } $localeinfo = Horde_Nls::getLocaleInfo(); // TODO: Workaround broken number_format() prior to PHP 5.4.0. return str_replace( array('X', 'Y'), ...
[ "public", "function", "getSize", "(", "$", "approx", "=", "false", ")", "{", "if", "(", "!", "(", "$", "bytes", "=", "$", "this", "->", "getBytes", "(", "$", "approx", ")", ")", ")", "{", "return", "0", ";", "}", "$", "localeinfo", "=", "Horde_Nl...
Output the size of this MIME part in KB. @todo Remove $approx parameter. @param boolean $approx If true, determines an approximate size for parts consisting of base64 encoded data. @return string Size of the part in KB.
[ "Output", "the", "size", "of", "this", "MIME", "part", "in", "KB", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L1311-L1325
217,775
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.setContentId
public function setContentId($cid = null) { if (!is_null($id = $this->getContentId())) { return $id; } $this->_headers->addHeaderOb( is_null($cid) ? Horde_Mime_Headers_ContentId::create() : new Horde_Mime_Headers_ContentId(null, $cid) ...
php
public function setContentId($cid = null) { if (!is_null($id = $this->getContentId())) { return $id; } $this->_headers->addHeaderOb( is_null($cid) ? Horde_Mime_Headers_ContentId::create() : new Horde_Mime_Headers_ContentId(null, $cid) ...
[ "public", "function", "setContentId", "(", "$", "cid", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "id", "=", "$", "this", "->", "getContentId", "(", ")", ")", ")", "{", "return", "$", "id", ";", "}", "$", "this", "->", "_headers"...
Sets the Content-ID header for this part. @param string $cid Use this CID (if not already set). Else, generate a random CID. @return string The Content-ID for this part.
[ "Sets", "the", "Content", "-", "ID", "header", "for", "this", "part", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L1335-L1348
217,776
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.buildMimeIds
public function buildMimeIds($id = null, $rfc822 = false) { $this->_status &= ~self::STATUS_REINDEX; if (is_null($id)) { $rfc822 = true; $id = ''; } if ($rfc822) { if (empty($this->_parts) && ($this->getPrimaryType() != 'multipart...
php
public function buildMimeIds($id = null, $rfc822 = false) { $this->_status &= ~self::STATUS_REINDEX; if (is_null($id)) { $rfc822 = true; $id = ''; } if ($rfc822) { if (empty($this->_parts) && ($this->getPrimaryType() != 'multipart...
[ "public", "function", "buildMimeIds", "(", "$", "id", "=", "null", ",", "$", "rfc822", "=", "false", ")", "{", "$", "this", "->", "_status", "&=", "~", "self", "::", "STATUS_REINDEX", ";", "if", "(", "is_null", "(", "$", "id", ")", ")", "{", "$", ...
Build the MIME IDs for this part and all subparts. @param string $id The ID of this part. @param boolean $rfc822 Is this a message/rfc822 part?
[ "Build", "the", "MIME", "IDs", "for", "this", "part", "and", "all", "subparts", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L1388-L1430
217,777
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.isBasePart
public function isBasePart($base) { if (empty($base)) { $this->_status &= ~self::STATUS_BASEPART; } else { $this->_status |= self::STATUS_BASEPART; } }
php
public function isBasePart($base) { if (empty($base)) { $this->_status &= ~self::STATUS_BASEPART; } else { $this->_status |= self::STATUS_BASEPART; } }
[ "public", "function", "isBasePart", "(", "$", "base", ")", "{", "if", "(", "empty", "(", "$", "base", ")", ")", "{", "$", "this", "->", "_status", "&=", "~", "self", "::", "STATUS_BASEPART", ";", "}", "else", "{", "$", "this", "->", "_status", "|="...
Is this the base MIME part? @param boolean $base True if this is the base MIME part.
[ "Is", "this", "the", "base", "MIME", "part?" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L1437-L1444
217,778
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.isAttachment
public function isAttachment() { $type = $this->getType(); switch ($type) { case 'application/ms-tnef': case 'application/pgp-keys': case 'application/vnd.ms-tnef': return false; } if ($this->parent) { switch ($this->parent->getType()...
php
public function isAttachment() { $type = $this->getType(); switch ($type) { case 'application/ms-tnef': case 'application/pgp-keys': case 'application/vnd.ms-tnef': return false; } if ($this->parent) { switch ($this->parent->getType()...
[ "public", "function", "isAttachment", "(", ")", "{", "$", "type", "=", "$", "this", "->", "getType", "(", ")", ";", "switch", "(", "$", "type", ")", "{", "case", "'application/ms-tnef'", ":", "case", "'application/pgp-keys'", ":", "case", "'application/vnd.m...
Determines if this MIME part is an attachment for display purposes. @since Horde_Mime 2.10.0 @return boolean True if this part should be considered an attachment.
[ "Determines", "if", "this", "MIME", "part", "is", "an", "attachment", "for", "display", "purposes", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L1453-L1505
217,779
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.setMetadata
public function setMetadata($key, $data = null) { if (is_null($data)) { unset($this->_metadata[$key]); } else { $this->_metadata[$key] = $data; } }
php
public function setMetadata($key, $data = null) { if (is_null($data)) { unset($this->_metadata[$key]); } else { $this->_metadata[$key] = $data; } }
[ "public", "function", "setMetadata", "(", "$", "key", ",", "$", "data", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "data", ")", ")", "{", "unset", "(", "$", "this", "->", "_metadata", "[", "$", "key", "]", ")", ";", "}", "else", "{"...
Set a piece of metadata on this object. @param string $key The metadata key. @param mixed $data The metadata. If null, clears the key.
[ "Set", "a", "piece", "of", "metadata", "on", "this", "object", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L1513-L1520
217,780
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.getMetadata
public function getMetadata($key) { return isset($this->_metadata[$key]) ? $this->_metadata[$key] : null; }
php
public function getMetadata($key) { return isset($this->_metadata[$key]) ? $this->_metadata[$key] : null; }
[ "public", "function", "getMetadata", "(", "$", "key", ")", "{", "return", "isset", "(", "$", "this", "->", "_metadata", "[", "$", "key", "]", ")", "?", "$", "this", "->", "_metadata", "[", "$", "key", "]", ":", "null", ";", "}" ]
Retrieves metadata from this object. @param string $key The metadata key. @return mixed The metadata, or null if it doesn't exist.
[ "Retrieves", "metadata", "from", "this", "object", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L1529-L1534
217,781
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.getPartByIndex
public function getPartByIndex($index) { if (!isset($this->_parts[$index])) { return null; } $part = $this->_parts[$index]; $part->parent = $this; return $part; }
php
public function getPartByIndex($index) { if (!isset($this->_parts[$index])) { return null; } $part = $this->_parts[$index]; $part->parent = $this; return $part; }
[ "public", "function", "getPartByIndex", "(", "$", "index", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_parts", "[", "$", "index", "]", ")", ")", "{", "return", "null", ";", "}", "$", "part", "=", "$", "this", "->", "_parts", "[",...
Returns a subpart by index. @return Horde_Mime_Part Part, or null if not found.
[ "Returns", "a", "subpart", "by", "index", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L1693-L1703
217,782
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part._reindex
protected function _reindex($force = false) { $id = $this->getMimeId(); if (($this->_status & self::STATUS_REINDEX) || ($force && is_null($id))) { $this->buildMimeIds( is_null($id) ? (($this->getPrimaryType() === 'multipart') ? '0' : '1') ...
php
protected function _reindex($force = false) { $id = $this->getMimeId(); if (($this->_status & self::STATUS_REINDEX) || ($force && is_null($id))) { $this->buildMimeIds( is_null($id) ? (($this->getPrimaryType() === 'multipart') ? '0' : '1') ...
[ "protected", "function", "_reindex", "(", "$", "force", "=", "false", ")", "{", "$", "id", "=", "$", "this", "->", "getMimeId", "(", ")", ";", "if", "(", "(", "$", "this", "->", "_status", "&", "self", "::", "STATUS_REINDEX", ")", "||", "(", "$", ...
Reindexes the MIME IDs, if necessary. @param boolean $force Reindex if the current part doesn't have an ID.
[ "Reindexes", "the", "MIME", "IDs", "if", "necessary", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L1710-L1722
217,783
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part._writeStream
protected function _writeStream($data, $options = array()) { if (empty($options['fp'])) { $fp = fopen('php://temp/maxmemory:' . self::$memoryLimit, 'r+'); } else { $fp = $options['fp']; fseek($fp, 0, SEEK_END); } if (!is_array($data)) { ...
php
protected function _writeStream($data, $options = array()) { if (empty($options['fp'])) { $fp = fopen('php://temp/maxmemory:' . self::$memoryLimit, 'r+'); } else { $fp = $options['fp']; fseek($fp, 0, SEEK_END); } if (!is_array($data)) { ...
[ "protected", "function", "_writeStream", "(", "$", "data", ",", "$", "options", "=", "array", "(", ")", ")", "{", "if", "(", "empty", "(", "$", "options", "[", "'fp'", "]", ")", ")", "{", "$", "fp", "=", "fopen", "(", "'php://temp/maxmemory:'", ".", ...
Write data to a stream. @param array $data The data to write. Either a stream resource or a string. @param array $options Additional options: - error: (boolean) Catch errors when writing to the stream. Throw an ErrorException if an error is found. DEFAULT: false - filter: (array) Filter(s) to apply to the string....
[ "Write", "data", "to", "a", "stream", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L1740-L1799
217,784
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part._readStream
protected function _readStream($fp, $close = false) { $out = ''; if (!is_resource($fp)) { return $out; } rewind($fp); while (!feof($fp)) { $out .= fread($fp, 8192); } if ($close) { fclose($fp); } return $...
php
protected function _readStream($fp, $close = false) { $out = ''; if (!is_resource($fp)) { return $out; } rewind($fp); while (!feof($fp)) { $out .= fread($fp, 8192); } if ($close) { fclose($fp); } return $...
[ "protected", "function", "_readStream", "(", "$", "fp", ",", "$", "close", "=", "false", ")", "{", "$", "out", "=", "''", ";", "if", "(", "!", "is_resource", "(", "$", "fp", ")", ")", "{", "return", "$", "out", ";", "}", "rewind", "(", "$", "fp...
Read data from a stream. @param resource $fp An active stream. @param boolean $close Close the stream when done reading? @return string The data from the stream.
[ "Read", "data", "from", "a", "stream", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L1809-L1827
217,785
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part._scanStream
protected function _scanStream($fp) { rewind($fp); stream_filter_register( 'horde_mime_scan_stream', 'Horde_Mime_Filter_Encoding' ); $filter_params = new stdClass; $filter = stream_filter_append( $fp, 'horde_mime_scan_stream', ...
php
protected function _scanStream($fp) { rewind($fp); stream_filter_register( 'horde_mime_scan_stream', 'Horde_Mime_Filter_Encoding' ); $filter_params = new stdClass; $filter = stream_filter_append( $fp, 'horde_mime_scan_stream', ...
[ "protected", "function", "_scanStream", "(", "$", "fp", ")", "{", "rewind", "(", "$", "fp", ")", ";", "stream_filter_register", "(", "'horde_mime_scan_stream'", ",", "'Horde_Mime_Filter_Encoding'", ")", ";", "$", "filter_params", "=", "new", "stdClass", ";", "$"...
Scans a stream for content type. @param resource $fp A stream resource. @return mixed Either 'binary', '8bit', or false.
[ "Scans", "a", "stream", "for", "content", "type", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L1836-L1859
217,786
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.parseMessage
public static function parseMessage($text, array $opts = array()) { /* Mini-hack to get a blank Horde_Mime part so we can call * replaceEOL(). Convert to EOL, since that is the expected EOL for * use internally within a Horde_Mime_Part object. */ $part = new Horde_Mime_Part(); ...
php
public static function parseMessage($text, array $opts = array()) { /* Mini-hack to get a blank Horde_Mime part so we can call * replaceEOL(). Convert to EOL, since that is the expected EOL for * use internally within a Horde_Mime_Part object. */ $part = new Horde_Mime_Part(); ...
[ "public", "static", "function", "parseMessage", "(", "$", "text", ",", "array", "$", "opts", "=", "array", "(", ")", ")", "{", "/* Mini-hack to get a blank Horde_Mime part so we can call\n * replaceEOL(). Convert to EOL, since that is the expected EOL for\n * use in...
Attempts to build a Horde_Mime_Part object from message text. @param string $text The text of the MIME message. @param array $opts Additional options: - forcemime: (boolean) If true, the message data is assumed to be MIME data. If not, a MIME-Version header must exist (RFC 2045 [4]) to be parsed as a MIME message. ...
[ "Attempts", "to", "build", "a", "Horde_Mime_Part", "object", "from", "message", "text", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L1881-L1896
217,787
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part.getRawPartText
public static function getRawPartText($text, $type, $id) { /* Mini-hack to get a blank Horde_Mime part so we can call * replaceEOL(). From an API perspective, getRawPartText() should be * static since it is not working on MIME part data. */ $part = new Horde_Mime_Part(); $r...
php
public static function getRawPartText($text, $type, $id) { /* Mini-hack to get a blank Horde_Mime part so we can call * replaceEOL(). From an API perspective, getRawPartText() should be * static since it is not working on MIME part data. */ $part = new Horde_Mime_Part(); $r...
[ "public", "static", "function", "getRawPartText", "(", "$", "text", ",", "$", "type", ",", "$", "id", ")", "{", "/* Mini-hack to get a blank Horde_Mime part so we can call\n * replaceEOL(). From an API perspective, getRawPartText() should be\n * static since it is not w...
Attempts to obtain the raw text of a MIME part. @param mixed $text The full text of the MIME message. The text is assumed to be MIME data (no MIME-Version checking is performed). It can be either a stream or a string. @param string $type Either 'header' or 'body'. @param string $id The MIME ID. @return string ...
[ "Attempts", "to", "obtain", "the", "raw", "text", "of", "a", "MIME", "part", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L2046-L2120
217,788
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part._findHeader
protected static function _findHeader($text, $eol) { $hdr_pos = strpos($text, $eol . $eol); return ($hdr_pos === false) ? strlen($text) : $hdr_pos; }
php
protected static function _findHeader($text, $eol) { $hdr_pos = strpos($text, $eol . $eol); return ($hdr_pos === false) ? strlen($text) : $hdr_pos; }
[ "protected", "static", "function", "_findHeader", "(", "$", "text", ",", "$", "eol", ")", "{", "$", "hdr_pos", "=", "strpos", "(", "$", "text", ",", "$", "eol", ".", "$", "eol", ")", ";", "return", "(", "$", "hdr_pos", "===", "false", ")", "?", "...
Find the location of the end of the header text. @param string $text The text to search. @param string $eol The EOL string. @return integer Header position.
[ "Find", "the", "location", "of", "the", "end", "of", "the", "header", "text", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L2130-L2136
217,789
moodle/moodle
lib/horde/framework/Horde/Mime/Part.php
Horde_Mime_Part._findBoundary
protected static function _findBoundary($text, $pos, $boundary, $end = null) { $i = 0; $out = array(); $search = "--" . $boundary; $search_len = strlen($search); while (($pos = strpos($text, $search, $pos)) !== false) { ...
php
protected static function _findBoundary($text, $pos, $boundary, $end = null) { $i = 0; $out = array(); $search = "--" . $boundary; $search_len = strlen($search); while (($pos = strpos($text, $search, $pos)) !== false) { ...
[ "protected", "static", "function", "_findBoundary", "(", "$", "text", ",", "$", "pos", ",", "$", "boundary", ",", "$", "end", "=", "null", ")", "{", "$", "i", "=", "0", ";", "$", "out", "=", "array", "(", ")", ";", "$", "search", "=", "\"--\"", ...
Find the location of the next boundary string. @param string $text The text to search. @param integer $pos The current position in $text. @param string $boundary The boundary string. @param integer $end If set, return after matching this many boundaries. @return array Keys are the boundary number, va...
[ "Find", "the", "location", "of", "the", "next", "boundary", "string", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/horde/framework/Horde/Mime/Part.php#L2150-L2193
217,790
moodle/moodle
lib/classes/event/cohort_member_added.php
cohort_member_added.get_legacy_eventdata
protected function get_legacy_eventdata() { $data = new \stdClass(); $data->cohortid = $this->objectid; $data->userid = $this->relateduserid; return $data; }
php
protected function get_legacy_eventdata() { $data = new \stdClass(); $data->cohortid = $this->objectid; $data->userid = $this->relateduserid; return $data; }
[ "protected", "function", "get_legacy_eventdata", "(", ")", "{", "$", "data", "=", "new", "\\", "stdClass", "(", ")", ";", "$", "data", "->", "cohortid", "=", "$", "this", "->", "objectid", ";", "$", "data", "->", "userid", "=", "$", "this", "->", "re...
Return legacy event data. @return \stdClass
[ "Return", "legacy", "event", "data", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/event/cohort_member_added.php#L91-L96
217,791
moodle/moodle
repository/flickr/lib.php
repository_flickr.logout
public function logout() { set_user_preference('repository_flickr_access_token', null); set_user_preference('repository_flickr_access_token_secret', null); $this->accesstoken = null; $this->accesstokensecret = null; return $this->print_login(); }
php
public function logout() { set_user_preference('repository_flickr_access_token', null); set_user_preference('repository_flickr_access_token_secret', null); $this->accesstoken = null; $this->accesstokensecret = null; return $this->print_login(); }
[ "public", "function", "logout", "(", ")", "{", "set_user_preference", "(", "'repository_flickr_access_token'", ",", "null", ")", ";", "set_user_preference", "(", "'repository_flickr_access_token_secret'", ",", "null", ")", ";", "$", "this", "->", "accesstoken", "=", ...
Purge the stored access token and related user data. @return string
[ "Purge", "the", "stored", "access", "token", "and", "related", "user", "data", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/flickr/lib.php#L102-L111
217,792
moodle/moodle
repository/flickr/lib.php
repository_flickr.print_login
public function print_login() { $reqtoken = $this->flickr->request_token(); $this->flickr->set_request_token_secret(['caller' => 'repository_flickr'], $reqtoken['oauth_token_secret']); // Even when the Flick auth docs states the "perms" argument is // optional, it does not work without...
php
public function print_login() { $reqtoken = $this->flickr->request_token(); $this->flickr->set_request_token_secret(['caller' => 'repository_flickr'], $reqtoken['oauth_token_secret']); // Even when the Flick auth docs states the "perms" argument is // optional, it does not work without...
[ "public", "function", "print_login", "(", ")", "{", "$", "reqtoken", "=", "$", "this", "->", "flickr", "->", "request_token", "(", ")", ";", "$", "this", "->", "flickr", "->", "set_request_token_secret", "(", "[", "'caller'", "=>", "'repository_flickr'", "]"...
Show the interface to log in to Flickr.. @return string|array
[ "Show", "the", "interface", "to", "log", "in", "to", "Flickr", ".." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/flickr/lib.php#L166-L188
217,793
moodle/moodle
repository/flickr/lib.php
repository_flickr.search
public function search($searchtext, $page = 0) { $response = $this->flickr->call('photos.search', [ 'user_id' => 'me', 'per_page' => 24, 'extras' => 'original_format,url_sq,url_o,date_upload,owner_name', 'page' => $page, 'text' => $searchtext, ...
php
public function search($searchtext, $page = 0) { $response = $this->flickr->call('photos.search', [ 'user_id' => 'me', 'per_page' => 24, 'extras' => 'original_format,url_sq,url_o,date_upload,owner_name', 'page' => $page, 'text' => $searchtext, ...
[ "public", "function", "search", "(", "$", "searchtext", ",", "$", "page", "=", "0", ")", "{", "$", "response", "=", "$", "this", "->", "flickr", "->", "call", "(", "'photos.search'", ",", "[", "'user_id'", "=>", "'me'", ",", "'per_page'", "=>", "24", ...
Search for the user's photos at Flickr @param string $searchtext Photos with title, description or tags containing the text will be returned @param int $page Page number to load @return array
[ "Search", "for", "the", "user", "s", "photos", "at", "Flickr" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/flickr/lib.php#L197-L261
217,794
moodle/moodle
repository/flickr/lib.php
repository_flickr.callback
public function callback() { $token = required_param('oauth_token', PARAM_RAW); $verifier = required_param('oauth_verifier', PARAM_RAW); $secret = $this->flickr->get_request_token_secret(['caller' => 'repository_flickr']); // Exchange the request token for the access token. $ac...
php
public function callback() { $token = required_param('oauth_token', PARAM_RAW); $verifier = required_param('oauth_verifier', PARAM_RAW); $secret = $this->flickr->get_request_token_secret(['caller' => 'repository_flickr']); // Exchange the request token for the access token. $ac...
[ "public", "function", "callback", "(", ")", "{", "$", "token", "=", "required_param", "(", "'oauth_token'", ",", "PARAM_RAW", ")", ";", "$", "verifier", "=", "required_param", "(", "'oauth_verifier'", ",", "PARAM_RAW", ")", ";", "$", "secret", "=", "$", "t...
Handle the oauth authorize callback This is to exchange the approved request token for an access token.
[ "Handle", "the", "oauth", "authorize", "callback" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/repository/flickr/lib.php#L360-L372
217,795
moodle/moodle
admin/tool/langimport/classes/task/update_langpacks_task.php
update_langpacks_task.execute
public function execute() { global $CFG; if (!empty($CFG->skiplangupgrade)) { mtrace('Langpack update skipped. ($CFG->skiplangupgrade set)'); return; } $controller = new \tool_langimport\controller(); if ($controller->update_all_installed_languages()) {...
php
public function execute() { global $CFG; if (!empty($CFG->skiplangupgrade)) { mtrace('Langpack update skipped. ($CFG->skiplangupgrade set)'); return; } $controller = new \tool_langimport\controller(); if ($controller->update_all_installed_languages()) {...
[ "public", "function", "execute", "(", ")", "{", "global", "$", "CFG", ";", "if", "(", "!", "empty", "(", "$", "CFG", "->", "skiplangupgrade", ")", ")", "{", "mtrace", "(", "'Langpack update skipped. ($CFG->skiplangupgrade set)'", ")", ";", "return", ";", "}"...
Run langpack update
[ "Run", "langpack", "update" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/langimport/classes/task/update_langpacks_task.php#L47-L69
217,796
moodle/moodle
blocks/mentees/block_mentees.php
block_mentees.instance_can_be_docked
public function instance_can_be_docked() { return parent::instance_can_be_docked() && isset($this->config->title) && !empty($this->config->title); }
php
public function instance_can_be_docked() { return parent::instance_can_be_docked() && isset($this->config->title) && !empty($this->config->title); }
[ "public", "function", "instance_can_be_docked", "(", ")", "{", "return", "parent", "::", "instance_can_be_docked", "(", ")", "&&", "isset", "(", "$", "this", "->", "config", "->", "title", ")", "&&", "!", "empty", "(", "$", "this", "->", "config", "->", ...
Returns true if the block can be docked. The mentees block can only be docked if it has a non-empty title. @return bool
[ "Returns", "true", "if", "the", "block", "can", "be", "docked", ".", "The", "mentees", "block", "can", "only", "be", "docked", "if", "it", "has", "a", "non", "-", "empty", "title", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/mentees/block_mentees.php#L78-L80
217,797
moodle/moodle
lib/modinfolib.php
course_modinfo.get_used_module_names
public function get_used_module_names($plural = false) { $modnames = get_module_types_names($plural); $modnamesused = array(); foreach ($this->get_cms() as $cmid => $mod) { if (!isset($modnamesused[$mod->modname]) && isset($modnames[$mod->modname]) && $mod->uservisible) { ...
php
public function get_used_module_names($plural = false) { $modnames = get_module_types_names($plural); $modnamesused = array(); foreach ($this->get_cms() as $cmid => $mod) { if (!isset($modnamesused[$mod->modname]) && isset($modnames[$mod->modname]) && $mod->uservisible) { ...
[ "public", "function", "get_used_module_names", "(", "$", "plural", "=", "false", ")", "{", "$", "modnames", "=", "get_module_types_names", "(", "$", "plural", ")", ";", "$", "modnamesused", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", ...
Returns array of localised human-readable module names used in this course @param bool $plural if true returns the plural form of modules names @return array
[ "Returns", "array", "of", "localised", "human", "-", "readable", "module", "names", "used", "in", "this", "course" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/modinfolib.php#L255-L265
217,798
moodle/moodle
lib/modinfolib.php
course_modinfo.get_groups_all
private function get_groups_all() { if (is_null($this->groups)) { // NOTE: Performance could be improved here. The system caches user groups // in $USER->groupmember[$courseid] => array of groupid=>groupid. Unfortunately this // structure does not include grouping information...
php
private function get_groups_all() { if (is_null($this->groups)) { // NOTE: Performance could be improved here. The system caches user groups // in $USER->groupmember[$courseid] => array of groupid=>groupid. Unfortunately this // structure does not include grouping information...
[ "private", "function", "get_groups_all", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "groups", ")", ")", "{", "// NOTE: Performance could be improved here. The system caches user groups", "// in $USER->groupmember[$courseid] => array of groupid=>groupid. Unfortun...
Groups that the current user belongs to organised by grouping id. Calculated on the first request. @return int[][] array of grouping id => array of group id => group id. Includes grouping id 0 for 'all groups'
[ "Groups", "that", "the", "current", "user", "belongs", "to", "organised", "by", "grouping", "id", ".", "Calculated", "on", "the", "first", "request", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/modinfolib.php#L283-L293
217,799
moodle/moodle
lib/modinfolib.php
course_modinfo.get_section_info
public function get_section_info($sectionnumber, $strictness = IGNORE_MISSING) { if (!array_key_exists($sectionnumber, $this->sectioninfo)) { if ($strictness === MUST_EXIST) { throw new moodle_exception('sectionnotexist'); } else { return null; ...
php
public function get_section_info($sectionnumber, $strictness = IGNORE_MISSING) { if (!array_key_exists($sectionnumber, $this->sectioninfo)) { if ($strictness === MUST_EXIST) { throw new moodle_exception('sectionnotexist'); } else { return null; ...
[ "public", "function", "get_section_info", "(", "$", "sectionnumber", ",", "$", "strictness", "=", "IGNORE_MISSING", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "sectionnumber", ",", "$", "this", "->", "sectioninfo", ")", ")", "{", "if", "(", "$...
Gets data about specific numbered section. @param int $sectionnumber Number (not id) of section @param int $strictness Use MUST_EXIST to throw exception if it doesn't @return section_info Information for numbered section or null if not found
[ "Gets", "data", "about", "specific", "numbered", "section", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/modinfolib.php#L323-L332