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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
220,500 | moodle/moodle | mod/forum/classes/task/send_user_digests.php | send_user_digests.add_message_header | protected function add_message_header() {
$site = get_site();
// Set the subject of the message.
$this->postsubject = get_string('digestmailsubject', 'forum', format_string($site->shortname, true));
// And the content of the header in body.
$headerdata = (object) [
... | php | protected function add_message_header() {
$site = get_site();
// Set the subject of the message.
$this->postsubject = get_string('digestmailsubject', 'forum', format_string($site->shortname, true));
// And the content of the header in body.
$headerdata = (object) [
... | [
"protected",
"function",
"add_message_header",
"(",
")",
"{",
"$",
"site",
"=",
"get_site",
"(",
")",
";",
"// Set the subject of the message.",
"$",
"this",
"->",
"postsubject",
"=",
"get_string",
"(",
"'digestmailsubject'",
",",
"'forum'",
",",
"format_string",
... | Add the header to this message. | [
"Add",
"the",
"header",
"to",
"this",
"message",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/send_user_digests.php#L390-L419 |
220,501 | moodle/moodle | mod/forum/classes/task/send_user_digests.php | send_user_digests.add_discussion_header | protected function add_discussion_header($discussion, $forum, $course) {
global $CFG;
$shortname = format_string($course->shortname, true, [
'context' => \context_course::instance($course->id),
]);
$strforums = get_string('forums', 'forum');
$this->discussi... | php | protected function add_discussion_header($discussion, $forum, $course) {
global $CFG;
$shortname = format_string($course->shortname, true, [
'context' => \context_course::instance($course->id),
]);
$strforums = get_string('forums', 'forum');
$this->discussi... | [
"protected",
"function",
"add_discussion_header",
"(",
"$",
"discussion",
",",
"$",
"forum",
",",
"$",
"course",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"shortname",
"=",
"format_string",
"(",
"$",
"course",
"->",
"shortname",
",",
"true",
",",
"[",
"'... | Add the header for this discussion.
@param \stdClass $discussion The discussion to add the footer for
@param \stdClass $forum The forum that the discussion belongs to
@param \stdClass $course The course that the forum belongs to | [
"Add",
"the",
"header",
"for",
"this",
"discussion",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/send_user_digests.php#L428-L464 |
220,502 | moodle/moodle | mod/forum/classes/task/send_user_digests.php | send_user_digests.add_post_body | protected function add_post_body($author, $post, $discussion, $forum, $cm, $course) {
global $CFG;
$canreply = $this->canpostto[$discussion->id];
$data = new \mod_forum\output\forum_post_email(
$course,
$cm,
$forum,
$discussion,
$post... | php | protected function add_post_body($author, $post, $discussion, $forum, $cm, $course) {
global $CFG;
$canreply = $this->canpostto[$discussion->id];
$data = new \mod_forum\output\forum_post_email(
$course,
$cm,
$forum,
$discussion,
$post... | [
"protected",
"function",
"add_post_body",
"(",
"$",
"author",
",",
"$",
"post",
",",
"$",
"discussion",
",",
"$",
"forum",
",",
"$",
"cm",
",",
"$",
"course",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"canreply",
"=",
"$",
"this",
"->",
"canpostto",
... | Add the body of this post.
@param \stdClass $author The author of the post
@param \stdClass $post The post being sent
@param \stdClass $discussion The discussion that the post is in
@param \stdClass $forum The forum that the discussion belongs to
@param \cminfo $cm The cminfo object for the forum... | [
"Add",
"the",
"body",
"of",
"this",
"post",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/send_user_digests.php#L476-L514 |
220,503 | moodle/moodle | mod/forum/classes/task/send_user_digests.php | send_user_digests.add_discussion_footer | protected function add_discussion_footer($discussion) {
global $CFG;
if ($this->allowhtml) {
$footerlinks = [];
$forum = $this->forums[$discussion->forum];
if (\mod_forum\subscriptions::is_forcesubscribed($forum)) {
// This forum is force subscribed.... | php | protected function add_discussion_footer($discussion) {
global $CFG;
if ($this->allowhtml) {
$footerlinks = [];
$forum = $this->forums[$discussion->forum];
if (\mod_forum\subscriptions::is_forcesubscribed($forum)) {
// This forum is force subscribed.... | [
"protected",
"function",
"add_discussion_footer",
"(",
"$",
"discussion",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"$",
"this",
"->",
"allowhtml",
")",
"{",
"$",
"footerlinks",
"=",
"[",
"]",
";",
"$",
"forum",
"=",
"$",
"this",
"->",
"forums",
... | Add the footer for this discussion.
@param \stdClass $discussion The discussion to add the footer for | [
"Add",
"the",
"footer",
"for",
"this",
"discussion",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/send_user_digests.php#L521-L542 |
220,504 | moodle/moodle | mod/forum/classes/task/send_user_digests.php | send_user_digests.get_maildigest | protected function get_maildigest($forumid) {
$maildigest = -1;
if (isset($this->forumdigesttypes[$forumid])) {
$maildigest = $this->forumdigesttypes[$forumid];
}
if ($maildigest === -1 && !empty($this->recipient->maildigest)) {
$maildigest = $this->recipient->m... | php | protected function get_maildigest($forumid) {
$maildigest = -1;
if (isset($this->forumdigesttypes[$forumid])) {
$maildigest = $this->forumdigesttypes[$forumid];
}
if ($maildigest === -1 && !empty($this->recipient->maildigest)) {
$maildigest = $this->recipient->m... | [
"protected",
"function",
"get_maildigest",
"(",
"$",
"forumid",
")",
"{",
"$",
"maildigest",
"=",
"-",
"1",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"forumdigesttypes",
"[",
"$",
"forumid",
"]",
")",
")",
"{",
"$",
"maildigest",
"=",
"$",
"th... | Get the forum digest type for the specified forum, failing back to
the default setting for the current user if not specified.
@param int $forumid
@return int | [
"Get",
"the",
"forum",
"digest",
"type",
"for",
"the",
"specified",
"forum",
"failing",
"back",
"to",
"the",
"default",
"setting",
"for",
"the",
"current",
"user",
"if",
"not",
"specified",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/send_user_digests.php#L551-L568 |
220,505 | moodle/moodle | mod/forum/classes/task/send_user_digests.php | send_user_digests.send_mail | protected function send_mail() {
// Headers to help prevent auto-responders.
$userfrom = \core_user::get_noreply_user();
$userfrom->customheaders = array(
"Precedence: Bulk",
'X-Auto-Response-Suppress: All',
'Auto-Submitted: auto-generated',
);
... | php | protected function send_mail() {
// Headers to help prevent auto-responders.
$userfrom = \core_user::get_noreply_user();
$userfrom->customheaders = array(
"Precedence: Bulk",
'X-Auto-Response-Suppress: All',
'Auto-Submitted: auto-generated',
);
... | [
"protected",
"function",
"send_mail",
"(",
")",
"{",
"// Headers to help prevent auto-responders.",
"$",
"userfrom",
"=",
"\\",
"core_user",
"::",
"get_noreply_user",
"(",
")",
";",
"$",
"userfrom",
"->",
"customheaders",
"=",
"array",
"(",
"\"Precedence: Bulk\"",
"... | Send the composed message to the user. | [
"Send",
"the",
"composed",
"message",
"to",
"the",
"user",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/send_user_digests.php#L573-L596 |
220,506 | moodle/moodle | mod/forum/classes/task/send_user_digests.php | send_user_digests.get_renderer | protected function get_renderer($maildigest, $html = false) {
global $PAGE;
$type = $maildigest == 2 ? 'emaildigestbasic' : 'emaildigestfull';
$target = $html ? 'htmlemail' : 'textemail';
if (!isset($this->renderers[$target][$type])) {
$this->renderers[$target][$type] = $PA... | php | protected function get_renderer($maildigest, $html = false) {
global $PAGE;
$type = $maildigest == 2 ? 'emaildigestbasic' : 'emaildigestfull';
$target = $html ? 'htmlemail' : 'textemail';
if (!isset($this->renderers[$target][$type])) {
$this->renderers[$target][$type] = $PA... | [
"protected",
"function",
"get_renderer",
"(",
"$",
"maildigest",
",",
"$",
"html",
"=",
"false",
")",
"{",
"global",
"$",
"PAGE",
";",
"$",
"type",
"=",
"$",
"maildigest",
"==",
"2",
"?",
"'emaildigestbasic'",
":",
"'emaildigestfull'",
";",
"$",
"target",
... | Helper to fetch the required renderer, instantiating as required.
@param int $maildigest The type of mail digest being sent
@param bool $html Whether to fetch the HTML renderer
@return \core_renderer | [
"Helper",
"to",
"fetch",
"the",
"required",
"renderer",
"instantiating",
"as",
"required",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/task/send_user_digests.php#L605-L616 |
220,507 | moodle/moodle | mod/feedback/classes/privacy/provider.php | provider.extract_item_record_from_record | protected static function extract_item_record_from_record(stdClass $record) {
$newrec = new stdClass();
foreach ($record as $key => $value) {
if (strpos($key, 'item') !== 0) {
continue;
}
$key = substr($key, 4);
$newrec->{$key} = $value;
... | php | protected static function extract_item_record_from_record(stdClass $record) {
$newrec = new stdClass();
foreach ($record as $key => $value) {
if (strpos($key, 'item') !== 0) {
continue;
}
$key = substr($key, 4);
$newrec->{$key} = $value;
... | [
"protected",
"static",
"function",
"extract_item_record_from_record",
"(",
"stdClass",
"$",
"record",
")",
"{",
"$",
"newrec",
"=",
"new",
"stdClass",
"(",
")",
";",
"foreach",
"(",
"$",
"record",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"("... | Extract an item record from a database record.
@param stdClass $record The record.
@return The item record. | [
"Extract",
"an",
"item",
"record",
"from",
"a",
"database",
"record",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/privacy/provider.php#L358-L368 |
220,508 | moodle/moodle | mod/feedback/classes/privacy/provider.php | provider.prepare_export_query | protected static function prepare_export_query(array $contextids, $userid) {
global $DB;
$makefetchsql = function($istmp) use ($DB, $contextids, $userid) {
$ctxfields = context_helper::get_preload_record_columns_sql('ctx');
list($insql, $inparams) = $DB->get_in_or_equal($context... | php | protected static function prepare_export_query(array $contextids, $userid) {
global $DB;
$makefetchsql = function($istmp) use ($DB, $contextids, $userid) {
$ctxfields = context_helper::get_preload_record_columns_sql('ctx');
list($insql, $inparams) = $DB->get_in_or_equal($context... | [
"protected",
"static",
"function",
"prepare_export_query",
"(",
"array",
"$",
"contextids",
",",
"$",
"userid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"makefetchsql",
"=",
"function",
"(",
"$",
"istmp",
")",
"use",
"(",
"$",
"DB",
",",
"$",
"contextids... | Prepare the query to export all data.
Doing it this way allows for merging all records from both the temporary and final tables
as most of their columns are shared. It is a lot easier to deal with the records when
exporting as we do not need to try to manually group the two types of submissions in the
same reported da... | [
"Prepare",
"the",
"query",
"to",
"export",
"all",
"data",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/feedback/classes/privacy/provider.php#L402-L487 |
220,509 | moodle/moodle | auth/cas/CAS/CAS/ProxiedService/Imap.php | CAS_ProxiedService_Imap.setServiceUrl | public function setServiceUrl ($url)
{
if ($this->hasBeenOpened()) {
throw new CAS_OutOfSequenceException(
'Cannot set the URL, stream already opened.'
);
}
if (!is_string($url) || !strlen($url)) {
throw new CAS_InvalidArgumentException('In... | php | public function setServiceUrl ($url)
{
if ($this->hasBeenOpened()) {
throw new CAS_OutOfSequenceException(
'Cannot set the URL, stream already opened.'
);
}
if (!is_string($url) || !strlen($url)) {
throw new CAS_InvalidArgumentException('In... | [
"public",
"function",
"setServiceUrl",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasBeenOpened",
"(",
")",
")",
"{",
"throw",
"new",
"CAS_OutOfSequenceException",
"(",
"'Cannot set the URL, stream already opened.'",
")",
";",
"}",
"if",
"(",
"!... | Set the URL of the service to pass to CAS for proxy-ticket retrieval.
@param string $url Url to set
@return void
@throws CAS_OutOfSequenceException If called after the stream has been opened. | [
"Set",
"the",
"URL",
"of",
"the",
"service",
"to",
"pass",
"to",
"CAS",
"for",
"proxy",
"-",
"ticket",
"retrieval",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/CAS/CAS/ProxiedService/Imap.php#L102-L114 |
220,510 | moodle/moodle | lib/behat/form_field/behat_form_filemanager.php | behat_form_filemanager.get_value | public function get_value() {
// Wait until DOM and JS is ready.
$this->session->wait(behat_base::get_timeout(), behat_base::PAGE_READY_JS);
// Get the label to restrict the files to this single form field.
$fieldlabel = $this->get_field_locator();
// Get the name of the curre... | php | public function get_value() {
// Wait until DOM and JS is ready.
$this->session->wait(behat_base::get_timeout(), behat_base::PAGE_READY_JS);
// Get the label to restrict the files to this single form field.
$fieldlabel = $this->get_field_locator();
// Get the name of the curre... | [
"public",
"function",
"get_value",
"(",
")",
"{",
"// Wait until DOM and JS is ready.",
"$",
"this",
"->",
"session",
"->",
"wait",
"(",
"behat_base",
"::",
"get_timeout",
"(",
")",
",",
"behat_base",
"::",
"PAGE_READY_JS",
")",
";",
"// Get the label to restrict th... | Gets the value.
@return string A comma-separated list of the root directory file names. | [
"Gets",
"the",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/form_field/behat_form_filemanager.php#L62-L90 |
220,511 | moodle/moodle | lib/behat/form_field/behat_form_filemanager.php | behat_form_filemanager.set_value | public function set_value($value) {
// Getting the filemanager label from the DOM.
$fieldlabel = $this->get_field_locator();
// Getting the filepicker context and using the step definition
// to upload the requested file.
$uploadcontext = behat_context_helper::get('behat_reposi... | php | public function set_value($value) {
// Getting the filemanager label from the DOM.
$fieldlabel = $this->get_field_locator();
// Getting the filepicker context and using the step definition
// to upload the requested file.
$uploadcontext = behat_context_helper::get('behat_reposi... | [
"public",
"function",
"set_value",
"(",
"$",
"value",
")",
"{",
"// Getting the filemanager label from the DOM.",
"$",
"fieldlabel",
"=",
"$",
"this",
"->",
"get_field_locator",
"(",
")",
";",
"// Getting the filepicker context and using the step definition",
"// to upload th... | Sets the field value.
@param string $value
@return void | [
"Sets",
"the",
"field",
"value",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/behat/form_field/behat_form_filemanager.php#L98-L107 |
220,512 | moodle/moodle | grade/report/lib.php | grade_report.get_numusers | public function get_numusers($groups = true, $users = false) {
global $CFG, $DB;
$userwheresql = "";
$groupsql = "";
$groupwheresql = "";
// Limit to users with a gradeable role.
list($gradebookrolessql, $gradebookrolesparams) = $DB->get_in_or_equal(explode(',', $th... | php | public function get_numusers($groups = true, $users = false) {
global $CFG, $DB;
$userwheresql = "";
$groupsql = "";
$groupwheresql = "";
// Limit to users with a gradeable role.
list($gradebookrolessql, $gradebookrolesparams) = $DB->get_in_or_equal(explode(',', $th... | [
"public",
"function",
"get_numusers",
"(",
"$",
"groups",
"=",
"true",
",",
"$",
"users",
"=",
"false",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"$",
"userwheresql",
"=",
"\"\"",
";",
"$",
"groupsql",
"=",
"\"\"",
";",
"$",
"groupwheresql... | Fetches and returns a count of all the users that will be shown on this page.
@param boolean $groups include groups limit
@param boolean $users include users limit - default false, used for searching purposes
@return int Count of users | [
"Fetches",
"and",
"returns",
"a",
"count",
"of",
"all",
"the",
"users",
"that",
"will",
"be",
"shown",
"on",
"this",
"page",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/lib.php#L293-L355 |
220,513 | moodle/moodle | grade/report/lib.php | grade_report.setup_groups | protected function setup_groups() {
// find out current groups mode
if ($this->groupmode = groups_get_course_groupmode($this->course)) {
if (empty($this->gpr->groupid)) {
$this->currentgroup = groups_get_course_group($this->course, true);
} else {
... | php | protected function setup_groups() {
// find out current groups mode
if ($this->groupmode = groups_get_course_groupmode($this->course)) {
if (empty($this->gpr->groupid)) {
$this->currentgroup = groups_get_course_group($this->course, true);
} else {
... | [
"protected",
"function",
"setup_groups",
"(",
")",
"{",
"// find out current groups mode",
"if",
"(",
"$",
"this",
"->",
"groupmode",
"=",
"groups_get_course_groupmode",
"(",
"$",
"this",
"->",
"course",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"... | Sets up this object's group variables, mainly to restrict the selection of users to display. | [
"Sets",
"up",
"this",
"object",
"s",
"group",
"variables",
"mainly",
"to",
"restrict",
"the",
"selection",
"of",
"users",
"to",
"display",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/lib.php#L367-L388 |
220,514 | moodle/moodle | grade/report/lib.php | grade_report.setup_users | public function setup_users() {
global $SESSION, $DB;
$this->userwheresql = "";
$this->userwheresql_params = array();
if (isset($SESSION->gradereport['filterfirstname']) && !empty($SESSION->gradereport['filterfirstname'])) {
$this->userwheresql .= ' AND '.$DB->sql_like('u.fi... | php | public function setup_users() {
global $SESSION, $DB;
$this->userwheresql = "";
$this->userwheresql_params = array();
if (isset($SESSION->gradereport['filterfirstname']) && !empty($SESSION->gradereport['filterfirstname'])) {
$this->userwheresql .= ' AND '.$DB->sql_like('u.fi... | [
"public",
"function",
"setup_users",
"(",
")",
"{",
"global",
"$",
"SESSION",
",",
"$",
"DB",
";",
"$",
"this",
"->",
"userwheresql",
"=",
"\"\"",
";",
"$",
"this",
"->",
"userwheresql_params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$... | Sets up this report's user criteria to restrict the selection of users to display. | [
"Sets",
"up",
"this",
"report",
"s",
"user",
"criteria",
"to",
"restrict",
"the",
"selection",
"of",
"users",
"to",
"display",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/grade/report/lib.php#L393-L406 |
220,515 | moodle/moodle | mod/assign/feedback/file/renderer.php | assignfeedback_file_renderer.render_assignfeedback_file_import_summary | public function render_assignfeedback_file_import_summary($summary) {
$o = '';
$o .= $this->container(get_string('userswithnewfeedback', 'assignfeedback_file', $summary->userswithnewfeedback));
$o .= $this->container(get_string('filesupdated', 'assignfeedback_file', $summary->feedbackfilesupdate... | php | public function render_assignfeedback_file_import_summary($summary) {
$o = '';
$o .= $this->container(get_string('userswithnewfeedback', 'assignfeedback_file', $summary->userswithnewfeedback));
$o .= $this->container(get_string('filesupdated', 'assignfeedback_file', $summary->feedbackfilesupdate... | [
"public",
"function",
"render_assignfeedback_file_import_summary",
"(",
"$",
"summary",
")",
"{",
"$",
"o",
"=",
"''",
";",
"$",
"o",
".=",
"$",
"this",
"->",
"container",
"(",
"get_string",
"(",
"'userswithnewfeedback'",
",",
"'assignfeedback_file'",
",",
"$",
... | Render a summary of the zip file import
@param assignfeedback_file_import_summary $summary - Stats about the zip import
@return string The html response | [
"Render",
"a",
"summary",
"of",
"the",
"zip",
"file",
"import"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/assign/feedback/file/renderer.php#L42-L53 |
220,516 | moodle/moodle | backup/util/xml/parser/processors/simplified_parser_processor.class.php | simplified_parser_processor.selected_parent_exists | protected function selected_parent_exists($path) {
$parentpath = progressive_parser::dirname($path);
while ($parentpath != '/') {
if ($this->path_is_selected($parentpath)) {
return $parentpath;
}
$parentpath = progressive_parser::dirname($parentpath);
... | php | protected function selected_parent_exists($path) {
$parentpath = progressive_parser::dirname($path);
while ($parentpath != '/') {
if ($this->path_is_selected($parentpath)) {
return $parentpath;
}
$parentpath = progressive_parser::dirname($parentpath);
... | [
"protected",
"function",
"selected_parent_exists",
"(",
"$",
"path",
")",
"{",
"$",
"parentpath",
"=",
"progressive_parser",
"::",
"dirname",
"(",
"$",
"path",
")",
";",
"while",
"(",
"$",
"parentpath",
"!=",
"'/'",
")",
"{",
"if",
"(",
"$",
"this",
"->"... | Returns the first selected parent if available or false | [
"Returns",
"the",
"first",
"selected",
"parent",
"if",
"available",
"or",
"false"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/xml/parser/processors/simplified_parser_processor.class.php#L250-L259 |
220,517 | moodle/moodle | lib/htmlpurifier/HTMLPurifier.php | HTMLPurifier.purifyArray | public function purifyArray($array_of_html, $config = null)
{
$context_array = array();
foreach ($array_of_html as $key => $html) {
$array_of_html[$key] = $this->purify($html, $config);
$context_array[$key] = $this->context;
}
$this->context = $context_array;
... | php | public function purifyArray($array_of_html, $config = null)
{
$context_array = array();
foreach ($array_of_html as $key => $html) {
$array_of_html[$key] = $this->purify($html, $config);
$context_array[$key] = $this->context;
}
$this->context = $context_array;
... | [
"public",
"function",
"purifyArray",
"(",
"$",
"array_of_html",
",",
"$",
"config",
"=",
"null",
")",
"{",
"$",
"context_array",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"array_of_html",
"as",
"$",
"key",
"=>",
"$",
"html",
")",
"{",
"$",
"a... | Filters an array of HTML snippets
@param string[] $array_of_html Array of html snippets
@param HTMLPurifier_Config $config Optional config object for this operation.
See HTMLPurifier::purify() for more details.
@return string[] Array of purified HTML | [
"Filters",
"an",
"array",
"of",
"HTML",
"snippets"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier.php#L240-L249 |
220,518 | moodle/moodle | lib/htmlpurifier/HTMLPurifier.php | HTMLPurifier.instance | public static function instance($prototype = null)
{
if (!self::$instance || $prototype) {
if ($prototype instanceof HTMLPurifier) {
self::$instance = $prototype;
} elseif ($prototype) {
self::$instance = new HTMLPurifier($prototype);
} els... | php | public static function instance($prototype = null)
{
if (!self::$instance || $prototype) {
if ($prototype instanceof HTMLPurifier) {
self::$instance = $prototype;
} elseif ($prototype) {
self::$instance = new HTMLPurifier($prototype);
} els... | [
"public",
"static",
"function",
"instance",
"(",
"$",
"prototype",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"instance",
"||",
"$",
"prototype",
")",
"{",
"if",
"(",
"$",
"prototype",
"instanceof",
"HTMLPurifier",
")",
"{",
"self",
"::"... | Singleton for enforcing just one HTML Purifier in your system
@param HTMLPurifier|HTMLPurifier_Config $prototype Optional prototype
HTMLPurifier instance to overload singleton with,
or HTMLPurifier_Config instance to configure the
generated version with.
@return HTMLPurifier | [
"Singleton",
"for",
"enforcing",
"just",
"one",
"HTML",
"Purifier",
"in",
"your",
"system"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/htmlpurifier/HTMLPurifier.php#L261-L273 |
220,519 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.setup_file_system | public function setup_file_system() {
global $CFG;
if ($this->filesystem === null) {
require_once($CFG->libdir . '/filestorage/file_system.php');
if (!empty($CFG->alternative_file_system_class)) {
$class = $CFG->alternative_file_system_class;
} else {
... | php | public function setup_file_system() {
global $CFG;
if ($this->filesystem === null) {
require_once($CFG->libdir . '/filestorage/file_system.php');
if (!empty($CFG->alternative_file_system_class)) {
$class = $CFG->alternative_file_system_class;
} else {
... | [
"public",
"function",
"setup_file_system",
"(",
")",
"{",
"global",
"$",
"CFG",
";",
"if",
"(",
"$",
"this",
"->",
"filesystem",
"===",
"null",
")",
"{",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/filestorage/file_system.php'",
")",
";",
"if"... | Complete setup procedure for the file_system component.
@return file_system | [
"Complete",
"setup",
"procedure",
"for",
"the",
"file_system",
"component",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L69-L84 |
220,520 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.get_pathname_hash | public static function get_pathname_hash($contextid, $component, $filearea, $itemid, $filepath, $filename) {
return sha1("/$contextid/$component/$filearea/$itemid".$filepath.$filename);
} | php | public static function get_pathname_hash($contextid, $component, $filearea, $itemid, $filepath, $filename) {
return sha1("/$contextid/$component/$filearea/$itemid".$filepath.$filename);
} | [
"public",
"static",
"function",
"get_pathname_hash",
"(",
"$",
"contextid",
",",
"$",
"component",
",",
"$",
"filearea",
",",
"$",
"itemid",
",",
"$",
"filepath",
",",
"$",
"filename",
")",
"{",
"return",
"sha1",
"(",
"\"/$contextid/$component/$filearea/$itemid\... | Calculates sha1 hash of unique full path name information.
This hash is a unique file identifier - it is used to improve
performance and overcome db index size limits.
@param int $contextid context ID
@param string $component component
@param string $filearea file area
@param int $itemid item ID
@param string $filepa... | [
"Calculates",
"sha1",
"hash",
"of",
"unique",
"full",
"path",
"name",
"information",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L109-L111 |
220,521 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.file_exists | public function file_exists($contextid, $component, $filearea, $itemid, $filepath, $filename) {
$filepath = clean_param($filepath, PARAM_PATH);
$filename = clean_param($filename, PARAM_FILE);
if ($filename === '') {
$filename = '.';
}
$pathnamehash = $this->get_path... | php | public function file_exists($contextid, $component, $filearea, $itemid, $filepath, $filename) {
$filepath = clean_param($filepath, PARAM_PATH);
$filename = clean_param($filename, PARAM_FILE);
if ($filename === '') {
$filename = '.';
}
$pathnamehash = $this->get_path... | [
"public",
"function",
"file_exists",
"(",
"$",
"contextid",
",",
"$",
"component",
",",
"$",
"filearea",
",",
"$",
"itemid",
",",
"$",
"filepath",
",",
"$",
"filename",
")",
"{",
"$",
"filepath",
"=",
"clean_param",
"(",
"$",
"filepath",
",",
"PARAM_PATH... | Does this file exist?
@param int $contextid context ID
@param string $component component
@param string $filearea file area
@param int $itemid item ID
@param string $filepath file path
@param string $filename file name
@return bool | [
"Does",
"this",
"file",
"exist?"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L124-L134 |
220,522 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.get_file_preview | public function get_file_preview(stored_file $file, $mode) {
$context = context_system::instance();
$path = '/' . trim($mode, '/') . '/';
$preview = $this->get_file($context->id, 'core', 'preview', 0, $path, $file->get_contenthash());
if (!$preview) {
$preview = $this->crea... | php | public function get_file_preview(stored_file $file, $mode) {
$context = context_system::instance();
$path = '/' . trim($mode, '/') . '/';
$preview = $this->get_file($context->id, 'core', 'preview', 0, $path, $file->get_contenthash());
if (!$preview) {
$preview = $this->crea... | [
"public",
"function",
"get_file_preview",
"(",
"stored_file",
"$",
"file",
",",
"$",
"mode",
")",
"{",
"$",
"context",
"=",
"context_system",
"::",
"instance",
"(",
")",
";",
"$",
"path",
"=",
"'/'",
".",
"trim",
"(",
"$",
"mode",
",",
"'/'",
")",
".... | Returns an image file that represent the given stored file as a preview
At the moment, only GIF, JPEG and PNG files are supported to have previews. In the
future, the support for other mimetypes can be added, too (eg. generate an image
preview of PDF, text documents etc).
@param stored_file $file the file we want to ... | [
"Returns",
"an",
"image",
"file",
"that",
"represent",
"the",
"given",
"stored",
"file",
"as",
"a",
"preview"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L235-L249 |
220,523 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.get_unused_filename | public function get_unused_filename($contextid, $component, $filearea, $itemid, $filepath, $filename) {
global $DB;
// Do not accept '.' or an empty file name (zero is acceptable).
if ($filename == '.' || (empty($filename) && !is_numeric($filename))) {
throw new coding_exception('In... | php | public function get_unused_filename($contextid, $component, $filearea, $itemid, $filepath, $filename) {
global $DB;
// Do not accept '.' or an empty file name (zero is acceptable).
if ($filename == '.' || (empty($filename) && !is_numeric($filename))) {
throw new coding_exception('In... | [
"public",
"function",
"get_unused_filename",
"(",
"$",
"contextid",
",",
"$",
"component",
",",
"$",
"filearea",
",",
"$",
"itemid",
",",
"$",
"filepath",
",",
"$",
"filename",
")",
"{",
"global",
"$",
"DB",
";",
"// Do not accept '.' or an empty file name (zero... | Return an available file name.
This will return the next available file name in the area, adding/incrementing a suffix
of the file, ie: file.txt > file (1).txt > file (2).txt > etc...
If the file name passed is available without modification, it is returned as is.
@param int $contextid context ID.
@param string $com... | [
"Return",
"an",
"available",
"file",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L269-L332 |
220,524 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.get_unused_dirname | public function get_unused_dirname($contextid, $component, $filearea, $itemid, $suggestedpath) {
global $DB;
// Ensure suggestedpath has trailing '/'
$suggestedpath = rtrim($suggestedpath, '/'). '/';
// The directory does not exist, we return the same file path.
if (!$this->fil... | php | public function get_unused_dirname($contextid, $component, $filearea, $itemid, $suggestedpath) {
global $DB;
// Ensure suggestedpath has trailing '/'
$suggestedpath = rtrim($suggestedpath, '/'). '/';
// The directory does not exist, we return the same file path.
if (!$this->fil... | [
"public",
"function",
"get_unused_dirname",
"(",
"$",
"contextid",
",",
"$",
"component",
",",
"$",
"filearea",
",",
"$",
"itemid",
",",
"$",
"suggestedpath",
")",
"{",
"global",
"$",
"DB",
";",
"// Ensure suggestedpath has trailing '/'",
"$",
"suggestedpath",
"... | Return an available directory name.
This will return the next available directory name in the area, adding/incrementing a suffix
of the last portion of path, ie: /path/ > /path (1)/ > /path (2)/ > etc...
If the file path passed is available without modification, it is returned as is.
@param int $contextid context ID... | [
"Return",
"an",
"available",
"directory",
"name",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L350-L397 |
220,525 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.create_file_preview | protected function create_file_preview(stored_file $file, $mode) {
$mimetype = $file->get_mimetype();
if ($mimetype === 'image/gif' or $mimetype === 'image/jpeg' or $mimetype === 'image/png') {
// make a preview of the image
$data = $this->create_imagefile_preview($file, $mode)... | php | protected function create_file_preview(stored_file $file, $mode) {
$mimetype = $file->get_mimetype();
if ($mimetype === 'image/gif' or $mimetype === 'image/jpeg' or $mimetype === 'image/png') {
// make a preview of the image
$data = $this->create_imagefile_preview($file, $mode)... | [
"protected",
"function",
"create_file_preview",
"(",
"stored_file",
"$",
"file",
",",
"$",
"mode",
")",
"{",
"$",
"mimetype",
"=",
"$",
"file",
"->",
"get_mimetype",
"(",
")",
";",
"if",
"(",
"$",
"mimetype",
"===",
"'image/gif'",
"or",
"$",
"mimetype",
... | Generates a preview image for the stored file
@param stored_file $file the file we want to preview
@param string $mode preview mode, eg. 'thumb'
@return stored_file|bool the newly created preview file or false | [
"Generates",
"a",
"preview",
"image",
"for",
"the",
"stored",
"file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L406-L439 |
220,526 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.create_imagefile_preview | protected function create_imagefile_preview(stored_file $file, $mode) {
global $CFG;
require_once($CFG->libdir.'/gdlib.php');
if ($mode === 'tinyicon') {
$data = $file->generate_image_thumbnail(24, 24);
} else if ($mode === 'thumb') {
$data = $file->generate_ima... | php | protected function create_imagefile_preview(stored_file $file, $mode) {
global $CFG;
require_once($CFG->libdir.'/gdlib.php');
if ($mode === 'tinyicon') {
$data = $file->generate_image_thumbnail(24, 24);
} else if ($mode === 'thumb') {
$data = $file->generate_ima... | [
"protected",
"function",
"create_imagefile_preview",
"(",
"stored_file",
"$",
"file",
",",
"$",
"mode",
")",
"{",
"global",
"$",
"CFG",
";",
"require_once",
"(",
"$",
"CFG",
"->",
"libdir",
".",
"'/gdlib.php'",
")",
";",
"if",
"(",
"$",
"mode",
"===",
"'... | Generates a preview for the stored image file
@param stored_file $file the image we want to preview
@param string $mode preview mode, eg. 'thumb'
@return string|bool false if a problem occurs, the thumbnail image data otherwise | [
"Generates",
"a",
"preview",
"for",
"the",
"stored",
"image",
"file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L448-L466 |
220,527 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.get_file_by_id | public function get_file_by_id($fileid) {
global $DB;
$sql = "SELECT ".self::instance_sql_fields('f', 'r')."
FROM {files} f
LEFT JOIN {files_reference} r
ON f.referencefileid = r.id
WHERE f.id = ?";
if ($filerecord = $DB->ge... | php | public function get_file_by_id($fileid) {
global $DB;
$sql = "SELECT ".self::instance_sql_fields('f', 'r')."
FROM {files} f
LEFT JOIN {files_reference} r
ON f.referencefileid = r.id
WHERE f.id = ?";
if ($filerecord = $DB->ge... | [
"public",
"function",
"get_file_by_id",
"(",
"$",
"fileid",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"\"SELECT \"",
".",
"self",
"::",
"instance_sql_fields",
"(",
"'f'",
",",
"'r'",
")",
".",
"\"\n FROM {files} f\n LEFT JOI... | Fetch file using local file id.
Please do not rely on file ids, it is usually easier to use
pathname hashes instead.
@param int $fileid file ID
@return stored_file|bool stored_file instance if exists, false if not | [
"Fetch",
"file",
"using",
"local",
"file",
"id",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L477-L490 |
220,528 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.get_file_by_hash | public function get_file_by_hash($pathnamehash) {
global $DB;
$sql = "SELECT ".self::instance_sql_fields('f', 'r')."
FROM {files} f
LEFT JOIN {files_reference} r
ON f.referencefileid = r.id
WHERE f.pathnamehash = ?";
if ($fi... | php | public function get_file_by_hash($pathnamehash) {
global $DB;
$sql = "SELECT ".self::instance_sql_fields('f', 'r')."
FROM {files} f
LEFT JOIN {files_reference} r
ON f.referencefileid = r.id
WHERE f.pathnamehash = ?";
if ($fi... | [
"public",
"function",
"get_file_by_hash",
"(",
"$",
"pathnamehash",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"\"SELECT \"",
".",
"self",
"::",
"instance_sql_fields",
"(",
"'f'",
",",
"'r'",
")",
".",
"\"\n FROM {files} f\n ... | Fetch file using local file full pathname hash
@param string $pathnamehash path name hash
@return stored_file|bool stored_file instance if exists, false if not | [
"Fetch",
"file",
"using",
"local",
"file",
"full",
"pathname",
"hash"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L498-L511 |
220,529 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.get_file | public function get_file($contextid, $component, $filearea, $itemid, $filepath, $filename) {
$filepath = clean_param($filepath, PARAM_PATH);
$filename = clean_param($filename, PARAM_FILE);
if ($filename === '') {
$filename = '.';
}
$pathnamehash = $this->get_pathnam... | php | public function get_file($contextid, $component, $filearea, $itemid, $filepath, $filename) {
$filepath = clean_param($filepath, PARAM_PATH);
$filename = clean_param($filename, PARAM_FILE);
if ($filename === '') {
$filename = '.';
}
$pathnamehash = $this->get_pathnam... | [
"public",
"function",
"get_file",
"(",
"$",
"contextid",
",",
"$",
"component",
",",
"$",
"filearea",
",",
"$",
"itemid",
",",
"$",
"filepath",
",",
"$",
"filename",
")",
"{",
"$",
"filepath",
"=",
"clean_param",
"(",
"$",
"filepath",
",",
"PARAM_PATH",
... | Fetch locally stored file.
@param int $contextid context ID
@param string $component component
@param string $filearea file area
@param int $itemid item ID
@param string $filepath file path
@param string $filename file name
@return stored_file|bool stored_file instance if exists, false if not | [
"Fetch",
"locally",
"stored",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L524-L534 |
220,530 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.get_external_files | public function get_external_files($repositoryid, $sort = '') {
global $DB;
$sql = "SELECT ".self::instance_sql_fields('f', 'r')."
FROM {files} f
LEFT JOIN {files_reference} r
ON f.referencefileid = r.id
WHERE r.repositoryid = ?";
... | php | public function get_external_files($repositoryid, $sort = '') {
global $DB;
$sql = "SELECT ".self::instance_sql_fields('f', 'r')."
FROM {files} f
LEFT JOIN {files_reference} r
ON f.referencefileid = r.id
WHERE r.repositoryid = ?";
... | [
"public",
"function",
"get_external_files",
"(",
"$",
"repositoryid",
",",
"$",
"sort",
"=",
"''",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"sql",
"=",
"\"SELECT \"",
".",
"self",
"::",
"instance_sql_fields",
"(",
"'f'",
",",
"'r'",
")",
".",
"\"\n ... | Returns all files belonging to given repository
@param int $repositoryid
@param string $sort A fragment of SQL to use for sorting | [
"Returns",
"all",
"files",
"belonging",
"to",
"given",
"repository"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L576-L593 |
220,531 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.get_area_tree | public function get_area_tree($contextid, $component, $filearea, $itemid) {
$result = array('dirname'=>'', 'dirfile'=>null, 'subdirs'=>array(), 'files'=>array());
$files = $this->get_area_files($contextid, $component, $filearea, $itemid, '', true);
// first create directory structure
for... | php | public function get_area_tree($contextid, $component, $filearea, $itemid) {
$result = array('dirname'=>'', 'dirfile'=>null, 'subdirs'=>array(), 'files'=>array());
$files = $this->get_area_files($contextid, $component, $filearea, $itemid, '', true);
// first create directory structure
for... | [
"public",
"function",
"get_area_tree",
"(",
"$",
"contextid",
",",
"$",
"component",
",",
"$",
"filearea",
",",
"$",
"itemid",
")",
"{",
"$",
"result",
"=",
"array",
"(",
"'dirname'",
"=>",
"''",
",",
"'dirfile'",
"=>",
"null",
",",
"'subdirs'",
"=>",
... | Returns array based tree structure of area files
@param int $contextid context ID
@param string $component component
@param string $filearea file area
@param int $itemid item ID
@return array each dir represented by dirname, subdirs, files and dirfile array elements | [
"Returns",
"array",
"based",
"tree",
"structure",
"of",
"area",
"files"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L675-L716 |
220,532 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.delete_area_files_select | public function delete_area_files_select($contextid, $component,
$filearea, $itemidstest, array $params = null) {
global $DB;
$where = "contextid = :contextid
AND component = :component
AND filearea = :filearea
AND itemid $itemidstest";
... | php | public function delete_area_files_select($contextid, $component,
$filearea, $itemidstest, array $params = null) {
global $DB;
$where = "contextid = :contextid
AND component = :component
AND filearea = :filearea
AND itemid $itemidstest";
... | [
"public",
"function",
"delete_area_files_select",
"(",
"$",
"contextid",
",",
"$",
"component",
",",
"$",
"filearea",
",",
"$",
"itemidstest",
",",
"array",
"$",
"params",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"where",
"=",
"\"contextid = :... | Delete all the files from certain areas where itemid is limited by an
arbitrary bit of SQL.
@param int $contextid the id of the context the files belong to. Must be given.
@param string $component the owning component. Must be given.
@param string $filearea the file area name. Must be given.
@param string $itemidstest... | [
"Delete",
"all",
"the",
"files",
"from",
"certain",
"areas",
"where",
"itemid",
"is",
"limited",
"by",
"an",
"arbitrary",
"bit",
"of",
"SQL",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L874-L891 |
220,533 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.delete_component_files | public function delete_component_files($component) {
global $DB;
$filerecords = $DB->get_recordset('files', array('component' => $component));
foreach ($filerecords as $filerecord) {
$this->get_file_instance($filerecord)->delete();
}
$filerecords->close();
} | php | public function delete_component_files($component) {
global $DB;
$filerecords = $DB->get_recordset('files', array('component' => $component));
foreach ($filerecords as $filerecord) {
$this->get_file_instance($filerecord)->delete();
}
$filerecords->close();
} | [
"public",
"function",
"delete_component_files",
"(",
"$",
"component",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"filerecords",
"=",
"$",
"DB",
"->",
"get_recordset",
"(",
"'files'",
",",
"array",
"(",
"'component'",
"=>",
"$",
"component",
")",
")",
";",
... | Delete all files associated with the given component.
@param string $component the component owning the file | [
"Delete",
"all",
"files",
"associated",
"with",
"the",
"given",
"component",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L898-L906 |
220,534 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.move_area_files_to_new_context | public function move_area_files_to_new_context($oldcontextid, $newcontextid, $component, $filearea, $itemid = false) {
// Note, this code is based on some code that Petr wrote in
// forum_move_attachments in mod/forum/lib.php. I moved it here because
// I needed it in the question code too.
... | php | public function move_area_files_to_new_context($oldcontextid, $newcontextid, $component, $filearea, $itemid = false) {
// Note, this code is based on some code that Petr wrote in
// forum_move_attachments in mod/forum/lib.php. I moved it here because
// I needed it in the question code too.
... | [
"public",
"function",
"move_area_files_to_new_context",
"(",
"$",
"oldcontextid",
",",
"$",
"newcontextid",
",",
"$",
"component",
",",
"$",
"filearea",
",",
"$",
"itemid",
"=",
"false",
")",
"{",
"// Note, this code is based on some code that Petr wrote in",
"// forum_... | Move all the files in a file area from one context to another.
@param int $oldcontextid the context the files are being moved from.
@param int $newcontextid the context the files are being moved to.
@param string $component the plugin that these files belong to.
@param string $filearea the name of the file area.
@para... | [
"Move",
"all",
"the",
"files",
"in",
"a",
"file",
"area",
"from",
"one",
"context",
"to",
"another",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L918-L937 |
220,535 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.create_directory | public function create_directory($contextid, $component, $filearea, $itemid, $filepath, $userid = null) {
global $DB;
// validate all parameters, we do not want any rubbish stored in database, right?
if (!is_number($contextid) or $contextid < 1) {
throw new file_exception('storedfil... | php | public function create_directory($contextid, $component, $filearea, $itemid, $filepath, $userid = null) {
global $DB;
// validate all parameters, we do not want any rubbish stored in database, right?
if (!is_number($contextid) or $contextid < 1) {
throw new file_exception('storedfil... | [
"public",
"function",
"create_directory",
"(",
"$",
"contextid",
",",
"$",
"component",
",",
"$",
"filearea",
",",
"$",
"itemid",
",",
"$",
"filepath",
",",
"$",
"userid",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
";",
"// validate all parameters, we do no... | Recursively creates directory.
@param int $contextid context ID
@param string $component component
@param string $filearea file area
@param int $itemid item ID
@param string $filepath file path
@param int $userid the user ID
@return bool success | [
"Recursively",
"creates",
"directory",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L950-L1023 |
220,536 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.create_file | protected function create_file($newrecord) {
global $DB;
$newrecord->id = $DB->insert_record('files', $newrecord);
if ($newrecord->filename !== '.') {
// Callback for file created.
if ($pluginsfunction = get_plugins_with_function('after_file_created')) {
... | php | protected function create_file($newrecord) {
global $DB;
$newrecord->id = $DB->insert_record('files', $newrecord);
if ($newrecord->filename !== '.') {
// Callback for file created.
if ($pluginsfunction = get_plugins_with_function('after_file_created')) {
... | [
"protected",
"function",
"create_file",
"(",
"$",
"newrecord",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"newrecord",
"->",
"id",
"=",
"$",
"DB",
"->",
"insert_record",
"(",
"'files'",
",",
"$",
"newrecord",
")",
";",
"if",
"(",
"$",
"newrecord",
"->",
... | Add new file record to database and handle callbacks.
@param stdClass $newrecord | [
"Add",
"new",
"file",
"record",
"to",
"database",
"and",
"handle",
"callbacks",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L1030-L1044 |
220,537 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.synchronise_stored_file_from_file | public function synchronise_stored_file_from_file(stored_file $file, $path, $filerecord) {
list($contenthash, $filesize) = $this->add_file_to_pool($path, null, $filerecord);
$file->set_synchronized($contenthash, $filesize);
} | php | public function synchronise_stored_file_from_file(stored_file $file, $path, $filerecord) {
list($contenthash, $filesize) = $this->add_file_to_pool($path, null, $filerecord);
$file->set_synchronized($contenthash, $filesize);
} | [
"public",
"function",
"synchronise_stored_file_from_file",
"(",
"stored_file",
"$",
"file",
",",
"$",
"path",
",",
"$",
"filerecord",
")",
"{",
"list",
"(",
"$",
"contenthash",
",",
"$",
"filesize",
")",
"=",
"$",
"this",
"->",
"add_file_to_pool",
"(",
"$",
... | Synchronise stored file from file.
@param stored_file $file Stored file to synchronise.
@param string $path Path to the file to synchronise from.
@param stdClass $filerecord The file record from the database. | [
"Synchronise",
"stored",
"file",
"from",
"file",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L1468-L1471 |
220,538 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.synchronise_stored_file_from_string | public function synchronise_stored_file_from_string(stored_file $file, $content, $filerecord) {
list($contenthash, $filesize) = $this->add_string_to_pool($content, $filerecord);
$file->set_synchronized($contenthash, $filesize);
} | php | public function synchronise_stored_file_from_string(stored_file $file, $content, $filerecord) {
list($contenthash, $filesize) = $this->add_string_to_pool($content, $filerecord);
$file->set_synchronized($contenthash, $filesize);
} | [
"public",
"function",
"synchronise_stored_file_from_string",
"(",
"stored_file",
"$",
"file",
",",
"$",
"content",
",",
"$",
"filerecord",
")",
"{",
"list",
"(",
"$",
"contenthash",
",",
"$",
"filesize",
")",
"=",
"$",
"this",
"->",
"add_string_to_pool",
"(",
... | Synchronise stored file from string.
@param stored_file $file Stored file to synchronise.
@param string $content File content.
@param stdClass $filerecord The file record from the database. | [
"Synchronise",
"stored",
"file",
"from",
"string",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L1480-L1483 |
220,539 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.add_file_to_pool | public function add_file_to_pool($pathname, $contenthash = null, $newrecord = null) {
$this->call_before_file_created_plugin_functions($newrecord, $pathname);
return $this->filesystem->add_file_from_path($pathname, $contenthash);
} | php | public function add_file_to_pool($pathname, $contenthash = null, $newrecord = null) {
$this->call_before_file_created_plugin_functions($newrecord, $pathname);
return $this->filesystem->add_file_from_path($pathname, $contenthash);
} | [
"public",
"function",
"add_file_to_pool",
"(",
"$",
"pathname",
",",
"$",
"contenthash",
"=",
"null",
",",
"$",
"newrecord",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"call_before_file_created_plugin_functions",
"(",
"$",
"newrecord",
",",
"$",
"pathname",
")"... | Add file content to sha1 pool.
@param string $pathname path to file
@param string|null $contenthash sha1 hash of content if known (performance only)
@param stdClass|null $newrecord New file record
@return array (contenthash, filesize, newfile) | [
"Add",
"file",
"content",
"to",
"sha1",
"pool",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L1792-L1795 |
220,540 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.add_string_to_pool | public function add_string_to_pool($content, $newrecord = null) {
$this->call_before_file_created_plugin_functions($newrecord, null, $content);
return $this->filesystem->add_file_from_string($content);
} | php | public function add_string_to_pool($content, $newrecord = null) {
$this->call_before_file_created_plugin_functions($newrecord, null, $content);
return $this->filesystem->add_file_from_string($content);
} | [
"public",
"function",
"add_string_to_pool",
"(",
"$",
"content",
",",
"$",
"newrecord",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"call_before_file_created_plugin_functions",
"(",
"$",
"newrecord",
",",
"null",
",",
"$",
"content",
")",
";",
"return",
"$",
"... | Add string content to sha1 pool.
@param string $content file content - binary string
@return array (contenthash, filesize, newfile) | [
"Add",
"string",
"content",
"to",
"sha1",
"pool",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L1803-L1806 |
220,541 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.call_before_file_created_plugin_functions | protected function call_before_file_created_plugin_functions($newrecord, $pathname = null, $content = null) {
$pluginsfunction = get_plugins_with_function('before_file_created');
foreach ($pluginsfunction as $plugintype => $plugins) {
foreach ($plugins as $pluginfunction) {
$... | php | protected function call_before_file_created_plugin_functions($newrecord, $pathname = null, $content = null) {
$pluginsfunction = get_plugins_with_function('before_file_created');
foreach ($pluginsfunction as $plugintype => $plugins) {
foreach ($plugins as $pluginfunction) {
$... | [
"protected",
"function",
"call_before_file_created_plugin_functions",
"(",
"$",
"newrecord",
",",
"$",
"pathname",
"=",
"null",
",",
"$",
"content",
"=",
"null",
")",
"{",
"$",
"pluginsfunction",
"=",
"get_plugins_with_function",
"(",
"'before_file_created'",
")",
"... | before_file_created hook.
@param stdClass|null $newrecord New file record.
@param string|null $pathname Path to file.
@param string|null $content File content. | [
"before_file_created",
"hook",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L1815-L1822 |
220,542 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.pack_reference | public static function pack_reference($params) {
$params = (array)$params;
$reference = array();
$reference['contextid'] = is_null($params['contextid']) ? null : clean_param($params['contextid'], PARAM_INT);
$reference['component'] = is_null($params['component']) ? null : clean_param($pa... | php | public static function pack_reference($params) {
$params = (array)$params;
$reference = array();
$reference['contextid'] = is_null($params['contextid']) ? null : clean_param($params['contextid'], PARAM_INT);
$reference['component'] = is_null($params['component']) ? null : clean_param($pa... | [
"public",
"static",
"function",
"pack_reference",
"(",
"$",
"params",
")",
"{",
"$",
"params",
"=",
"(",
"array",
")",
"$",
"params",
";",
"$",
"reference",
"=",
"array",
"(",
")",
";",
"$",
"reference",
"[",
"'contextid'",
"]",
"=",
"is_null",
"(",
... | When user referring to a moodle file, we build the reference field
@param array $params
@return string | [
"When",
"user",
"referring",
"to",
"a",
"moodle",
"file",
"we",
"build",
"the",
"reference",
"field"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L1868-L1878 |
220,543 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.unpack_reference | public static function unpack_reference($str, $cleanparams = false) {
$decoded = base64_decode($str, true);
if ($decoded === false) {
throw new file_reference_exception(null, $str, null, null, 'Invalid base64 format');
}
$params = @unserialize($decoded); // hide E_NOTICE
... | php | public static function unpack_reference($str, $cleanparams = false) {
$decoded = base64_decode($str, true);
if ($decoded === false) {
throw new file_reference_exception(null, $str, null, null, 'Invalid base64 format');
}
$params = @unserialize($decoded); // hide E_NOTICE
... | [
"public",
"static",
"function",
"unpack_reference",
"(",
"$",
"str",
",",
"$",
"cleanparams",
"=",
"false",
")",
"{",
"$",
"decoded",
"=",
"base64_decode",
"(",
"$",
"str",
",",
"true",
")",
";",
"if",
"(",
"$",
"decoded",
"===",
"false",
")",
"{",
"... | Unpack reference field
@param string $str
@param bool $cleanparams if set to true, array elements will be passed through {@link clean_param()}
@throws file_reference_exception if the $str does not have the expected format
@return array | [
"Unpack",
"reference",
"field"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L1888-L1908 |
220,544 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.search_server_files | public function search_server_files($query, $from = 0, $limit = 20, $count = false) {
global $DB;
$params = array(
'contextlevel' => CONTEXT_USER,
'directory' => '.',
'query' => $query
);
if ($count) {
$select = 'COUNT(1)';
} else ... | php | public function search_server_files($query, $from = 0, $limit = 20, $count = false) {
global $DB;
$params = array(
'contextlevel' => CONTEXT_USER,
'directory' => '.',
'query' => $query
);
if ($count) {
$select = 'COUNT(1)';
} else ... | [
"public",
"function",
"search_server_files",
"(",
"$",
"query",
",",
"$",
"from",
"=",
"0",
",",
"$",
"limit",
"=",
"20",
",",
"$",
"count",
"=",
"false",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"params",
"=",
"array",
"(",
"'contextlevel'",
"=>",
... | Search through the server files.
The query parameter will be used in conjuction with the SQL directive
LIKE, so include '%' in it if you need to. This search will always ignore
user files and directories. Note that the search is case insensitive.
This query can quickly become inefficient so use it sparignly.
@param ... | [
"Search",
"through",
"the",
"server",
"files",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L1926-L1965 |
220,545 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.search_references | public function search_references($reference) {
global $DB;
if (is_null($reference)) {
throw new coding_exception('NULL is not a valid reference to an external file');
}
// Give {@link self::unpack_reference()} a chance to throw exception if the
// reference is not ... | php | public function search_references($reference) {
global $DB;
if (is_null($reference)) {
throw new coding_exception('NULL is not a valid reference to an external file');
}
// Give {@link self::unpack_reference()} a chance to throw exception if the
// reference is not ... | [
"public",
"function",
"search_references",
"(",
"$",
"reference",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"is_null",
"(",
"$",
"reference",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'NULL is not a valid reference to an external file'",
")",
... | Returns all aliases that refer to some stored_file via the given reference
All repositories that provide access to a stored_file are expected to use
{@link self::pack_reference()}. This method can't be used if the given reference
does not use this format or if you are looking for references to an external file
(for ex... | [
"Returns",
"all",
"aliases",
"that",
"refer",
"to",
"some",
"stored_file",
"via",
"the",
"given",
"reference"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L1981-L2009 |
220,546 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.search_references_count | public function search_references_count($reference) {
global $DB;
if (is_null($reference)) {
throw new coding_exception('NULL is not a valid reference to an external file');
}
// Give {@link self::unpack_reference()} a chance to throw exception if the
// reference i... | php | public function search_references_count($reference) {
global $DB;
if (is_null($reference)) {
throw new coding_exception('NULL is not a valid reference to an external file');
}
// Give {@link self::unpack_reference()} a chance to throw exception if the
// reference i... | [
"public",
"function",
"search_references_count",
"(",
"$",
"reference",
")",
"{",
"global",
"$",
"DB",
";",
"if",
"(",
"is_null",
"(",
"$",
"reference",
")",
")",
"{",
"throw",
"new",
"coding_exception",
"(",
"'NULL is not a valid reference to an external file'",
... | Returns the number of aliases that refer to some stored_file via the given reference
All repositories that provide access to a stored_file are expected to use
{@link self::pack_reference()}. This method can't be used if the given reference
does not use this format or if you are looking for references to an external fi... | [
"Returns",
"the",
"number",
"of",
"aliases",
"that",
"refer",
"to",
"some",
"stored_file",
"via",
"the",
"given",
"reference"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L2025-L2046 |
220,547 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.get_references_by_storedfile | public function get_references_by_storedfile(stored_file $storedfile) {
global $DB;
$params = array();
$params['contextid'] = $storedfile->get_contextid();
$params['component'] = $storedfile->get_component();
$params['filearea'] = $storedfile->get_filearea();
$params['i... | php | public function get_references_by_storedfile(stored_file $storedfile) {
global $DB;
$params = array();
$params['contextid'] = $storedfile->get_contextid();
$params['component'] = $storedfile->get_component();
$params['filearea'] = $storedfile->get_filearea();
$params['i... | [
"public",
"function",
"get_references_by_storedfile",
"(",
"stored_file",
"$",
"storedfile",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"params",
"=",
"array",
"(",
")",
";",
"$",
"params",
"[",
"'contextid'",
"]",
"=",
"$",
"storedfile",
"->",
"get_contextid"... | Returns all aliases that link to the given stored_file
Aliases in user draft areas are excluded from the returned list.
@param stored_file $storedfile
@return array of stored_file | [
"Returns",
"all",
"aliases",
"that",
"link",
"to",
"the",
"given",
"stored_file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L2056-L2068 |
220,548 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.get_references_count_by_storedfile | public function get_references_count_by_storedfile(stored_file $storedfile) {
global $DB;
$params = array();
$params['contextid'] = $storedfile->get_contextid();
$params['component'] = $storedfile->get_component();
$params['filearea'] = $storedfile->get_filearea();
$par... | php | public function get_references_count_by_storedfile(stored_file $storedfile) {
global $DB;
$params = array();
$params['contextid'] = $storedfile->get_contextid();
$params['component'] = $storedfile->get_component();
$params['filearea'] = $storedfile->get_filearea();
$par... | [
"public",
"function",
"get_references_count_by_storedfile",
"(",
"stored_file",
"$",
"storedfile",
")",
"{",
"global",
"$",
"DB",
";",
"$",
"params",
"=",
"array",
"(",
")",
";",
"$",
"params",
"[",
"'contextid'",
"]",
"=",
"$",
"storedfile",
"->",
"get_cont... | Returns the number of aliases that link to the given stored_file
Aliases in user draft areas are not counted.
@param stored_file $storedfile
@return int | [
"Returns",
"the",
"number",
"of",
"aliases",
"that",
"link",
"to",
"the",
"given",
"stored_file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L2078-L2090 |
220,549 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.update_references_to_storedfile | public function update_references_to_storedfile(stored_file $storedfile) {
global $CFG, $DB;
$params = array();
$params['contextid'] = $storedfile->get_contextid();
$params['component'] = $storedfile->get_component();
$params['filearea'] = $storedfile->get_filearea();
$p... | php | public function update_references_to_storedfile(stored_file $storedfile) {
global $CFG, $DB;
$params = array();
$params['contextid'] = $storedfile->get_contextid();
$params['component'] = $storedfile->get_component();
$params['filearea'] = $storedfile->get_filearea();
$p... | [
"public",
"function",
"update_references_to_storedfile",
"(",
"stored_file",
"$",
"storedfile",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"DB",
";",
"$",
"params",
"=",
"array",
"(",
")",
";",
"$",
"params",
"[",
"'contextid'",
"]",
"=",
"$",
"storedfile",... | Updates all files that are referencing this file with the new contenthash
and filesize
@param stored_file $storedfile | [
"Updates",
"all",
"files",
"that",
"are",
"referencing",
"this",
"file",
"with",
"the",
"new",
"contenthash",
"and",
"filesize"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L2098-L2120 |
220,550 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.import_external_file | public function import_external_file(stored_file $storedfile, $maxbytes = 0) {
global $CFG;
$storedfile->import_external_file_contents($maxbytes);
$storedfile->delete_reference();
return $storedfile;
} | php | public function import_external_file(stored_file $storedfile, $maxbytes = 0) {
global $CFG;
$storedfile->import_external_file_contents($maxbytes);
$storedfile->delete_reference();
return $storedfile;
} | [
"public",
"function",
"import_external_file",
"(",
"stored_file",
"$",
"storedfile",
",",
"$",
"maxbytes",
"=",
"0",
")",
"{",
"global",
"$",
"CFG",
";",
"$",
"storedfile",
"->",
"import_external_file_contents",
"(",
"$",
"maxbytes",
")",
";",
"$",
"storedfile... | Convert file alias to local file
@throws moodle_exception if file could not be downloaded
@param stored_file $storedfile a stored_file instances
@param int $maxbytes throw an exception if file size is bigger than $maxbytes (0 means no limit)
@return stored_file stored_file | [
"Convert",
"file",
"alias",
"to",
"local",
"file"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L2131-L2136 |
220,551 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.mimetype | public static function mimetype($fullpath, $filename = null) {
if (empty($filename)) {
$filename = $fullpath;
}
// The mimeinfo function determines the mimetype purely based on the file extension.
$type = mimeinfo('type', $filename);
if ($type === 'document/unknown'... | php | public static function mimetype($fullpath, $filename = null) {
if (empty($filename)) {
$filename = $fullpath;
}
// The mimeinfo function determines the mimetype purely based on the file extension.
$type = mimeinfo('type', $filename);
if ($type === 'document/unknown'... | [
"public",
"static",
"function",
"mimetype",
"(",
"$",
"fullpath",
",",
"$",
"filename",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"filename",
")",
")",
"{",
"$",
"filename",
"=",
"$",
"fullpath",
";",
"}",
"// The mimeinfo function determines th... | Return mimetype by given file pathname.
If file has a known extension, we return the mimetype based on extension.
Otherwise (when possible) we try to get the mimetype from file contents.
@param string $fullpath Full path to the file on disk
@param string $filename Correct file name with extension, if omitted will be ... | [
"Return",
"mimetype",
"by",
"given",
"file",
"pathname",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L2148-L2161 |
220,552 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.mimetype_from_file | public static function mimetype_from_file($fullpath) {
if (file_exists($fullpath)) {
// The type is unknown. Attempt to look up the file type now.
$finfo = new finfo(FILEINFO_MIME_TYPE);
return mimeinfo_from_type('type', $finfo->file($fullpath));
}
return 'do... | php | public static function mimetype_from_file($fullpath) {
if (file_exists($fullpath)) {
// The type is unknown. Attempt to look up the file type now.
$finfo = new finfo(FILEINFO_MIME_TYPE);
return mimeinfo_from_type('type', $finfo->file($fullpath));
}
return 'do... | [
"public",
"static",
"function",
"mimetype_from_file",
"(",
"$",
"fullpath",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"fullpath",
")",
")",
"{",
"// The type is unknown. Attempt to look up the file type now.",
"$",
"finfo",
"=",
"new",
"finfo",
"(",
"FILEINFO_MI... | Inspect a file on disk for it's mimetype.
@param string $fullpath Path to file on disk
@return string The mimetype | [
"Inspect",
"a",
"file",
"on",
"disk",
"for",
"it",
"s",
"mimetype",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L2169-L2177 |
220,553 | moodle/moodle | lib/filestorage/file_storage.php | file_storage.update_references | public function update_references($referencefileid, $lastsync, $lifetime, $contenthash, $filesize, $status, $timemodified = null) {
global $DB;
$referencefileid = clean_param($referencefileid, PARAM_INT);
$lastsync = clean_param($lastsync, PARAM_INT);
validate_param($contenthash, PARAM_T... | php | public function update_references($referencefileid, $lastsync, $lifetime, $contenthash, $filesize, $status, $timemodified = null) {
global $DB;
$referencefileid = clean_param($referencefileid, PARAM_INT);
$lastsync = clean_param($lastsync, PARAM_INT);
validate_param($contenthash, PARAM_T... | [
"public",
"function",
"update_references",
"(",
"$",
"referencefileid",
",",
"$",
"lastsync",
",",
"$",
"lifetime",
",",
"$",
"contenthash",
",",
"$",
"filesize",
",",
"$",
"status",
",",
"$",
"timemodified",
"=",
"null",
")",
"{",
"global",
"$",
"DB",
"... | Updates a reference to the external resource and all files that use it
This function is called after synchronisation of an external file and updates the
contenthash, filesize and status of all files that reference this external file
as well as time last synchronised.
@param int $referencefileid
@param int $lastsync
@... | [
"Updates",
"a",
"reference",
"to",
"the",
"external",
"resource",
"and",
"all",
"files",
"that",
"use",
"it"
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/filestorage/file_storage.php#L2375-L2392 |
220,554 | moodle/moodle | lib/form/listing.php | MoodleQuickForm_listing.toHtml | function toHtml() {
global $CFG, $PAGE;
$this->_generateId();
$elementid = $this->getAttribute('id');
$mainhtml = html_writer::tag('div', $this->items[$this->getValue()]->mainhtml,
array('id' => $elementid . '_items_main', 'class' => 'formlistingmain'));
// Add ... | php | function toHtml() {
global $CFG, $PAGE;
$this->_generateId();
$elementid = $this->getAttribute('id');
$mainhtml = html_writer::tag('div', $this->items[$this->getValue()]->mainhtml,
array('id' => $elementid . '_items_main', 'class' => 'formlistingmain'));
// Add ... | [
"function",
"toHtml",
"(",
")",
"{",
"global",
"$",
"CFG",
",",
"$",
"PAGE",
";",
"$",
"this",
"->",
"_generateId",
"(",
")",
";",
"$",
"elementid",
"=",
"$",
"this",
"->",
"getAttribute",
"(",
"'id'",
")",
";",
"$",
"mainhtml",
"=",
"html_writer",
... | Returns HTML for listing form element.
@return string the HTML. | [
"Returns",
"HTML",
"for",
"listing",
"form",
"element",
"."
] | a411b499b98afc9901c24a9466c7e322946a04aa | https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/form/listing.php#L110-L160 |
220,555 | Intervention/image | src/Intervention/Image/Gd/Commands/ResizeCommand.php | ResizeCommand.execute | public function execute($image)
{
$width = $this->argument(0)->value();
$height = $this->argument(1)->value();
$constraints = $this->argument(2)->type('closure')->value();
// resize box
$resized = $image->getSize()->resize($width, $height, $constraints);
// modify i... | php | public function execute($image)
{
$width = $this->argument(0)->value();
$height = $this->argument(1)->value();
$constraints = $this->argument(2)->type('closure')->value();
// resize box
$resized = $image->getSize()->resize($width, $height, $constraints);
// modify i... | [
"public",
"function",
"execute",
"(",
"$",
"image",
")",
"{",
"$",
"width",
"=",
"$",
"this",
"->",
"argument",
"(",
"0",
")",
"->",
"value",
"(",
")",
";",
"$",
"height",
"=",
"$",
"this",
"->",
"argument",
"(",
"1",
")",
"->",
"value",
"(",
"... | Resizes image dimensions
@param \Intervention\Image\Image $image
@return boolean | [
"Resizes",
"image",
"dimensions"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Gd/Commands/ResizeCommand.php#L13-L26 |
220,556 | Intervention/image | src/Intervention/Image/Gd/Commands/ResizeCommand.php | ResizeCommand.modify | protected function modify($image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h)
{
// create new image
$modified = imagecreatetruecolor($dst_w, $dst_h);
// get current image
$resource = $image->getCore();
// preserve transparency
$transIndex = image... | php | protected function modify($image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h)
{
// create new image
$modified = imagecreatetruecolor($dst_w, $dst_h);
// get current image
$resource = $image->getCore();
// preserve transparency
$transIndex = image... | [
"protected",
"function",
"modify",
"(",
"$",
"image",
",",
"$",
"dst_x",
",",
"$",
"dst_y",
",",
"$",
"src_x",
",",
"$",
"src_y",
",",
"$",
"dst_w",
",",
"$",
"dst_h",
",",
"$",
"src_w",
",",
"$",
"src_h",
")",
"{",
"// create new image",
"$",
"mod... | Wrapper function for 'imagecopyresampled'
@param Image $image
@param int $dst_x
@param int $dst_y
@param int $src_x
@param int $src_y
@param int $dst_w
@param int $dst_h
@param int $src_w
@param int $src_h
@return boolean | [
"Wrapper",
"function",
"for",
"imagecopyresampled"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Gd/Commands/ResizeCommand.php#L42-L81 |
220,557 | Intervention/image | src/Intervention/Image/Commands/OrientateCommand.php | OrientateCommand.execute | public function execute($image)
{
switch ($image->exif('Orientation')) {
case 2:
$image->flip();
break;
case 3:
$image->rotate(180);
break;
case 4:
$image->rotate(180)->flip();
... | php | public function execute($image)
{
switch ($image->exif('Orientation')) {
case 2:
$image->flip();
break;
case 3:
$image->rotate(180);
break;
case 4:
$image->rotate(180)->flip();
... | [
"public",
"function",
"execute",
"(",
"$",
"image",
")",
"{",
"switch",
"(",
"$",
"image",
"->",
"exif",
"(",
"'Orientation'",
")",
")",
"{",
"case",
"2",
":",
"$",
"image",
"->",
"flip",
"(",
")",
";",
"break",
";",
"case",
"3",
":",
"$",
"image... | Correct image orientation according to Exif data
@param \Intervention\Image\Image $image
@return boolean | [
"Correct",
"image",
"orientation",
"according",
"to",
"Exif",
"data"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Commands/OrientateCommand.php#L13-L47 |
220,558 | Intervention/image | src/Intervention/Image/ImageManager.php | ImageManager.canvas | public function canvas($width, $height, $background = null)
{
return $this->createDriver()->newImage($width, $height, $background);
} | php | public function canvas($width, $height, $background = null)
{
return $this->createDriver()->newImage($width, $height, $background);
} | [
"public",
"function",
"canvas",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"background",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"createDriver",
"(",
")",
"->",
"newImage",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"backgroun... | Creates an empty image canvas
@param int $width
@param int $height
@param mixed $background
@return \Intervention\Image\Image | [
"Creates",
"an",
"empty",
"image",
"canvas"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/ImageManager.php#L64-L67 |
220,559 | Intervention/image | src/Intervention/Image/Gd/Commands/GammaCommand.php | GammaCommand.execute | public function execute($image)
{
$gamma = $this->argument(0)->type('numeric')->required()->value();
return imagegammacorrect($image->getCore(), 1, $gamma);
} | php | public function execute($image)
{
$gamma = $this->argument(0)->type('numeric')->required()->value();
return imagegammacorrect($image->getCore(), 1, $gamma);
} | [
"public",
"function",
"execute",
"(",
"$",
"image",
")",
"{",
"$",
"gamma",
"=",
"$",
"this",
"->",
"argument",
"(",
"0",
")",
"->",
"type",
"(",
"'numeric'",
")",
"->",
"required",
"(",
")",
"->",
"value",
"(",
")",
";",
"return",
"imagegammacorrect... | Applies gamma correction to a given image
@param \Intervention\Image\Image $image
@return boolean | [
"Applies",
"gamma",
"correction",
"to",
"a",
"given",
"image"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Gd/Commands/GammaCommand.php#L13-L18 |
220,560 | Intervention/image | src/Intervention/Image/Imagick/Encoder.php | Encoder.processTiff | protected function processTiff()
{
$format = 'tiff';
$compression = \Imagick::COMPRESSION_UNDEFINED;
$imagick = $this->image->getCore();
$imagick->setFormat($format);
$imagick->setImageFormat($format);
$imagick->setCompression($compression);
$imagick->setImag... | php | protected function processTiff()
{
$format = 'tiff';
$compression = \Imagick::COMPRESSION_UNDEFINED;
$imagick = $this->image->getCore();
$imagick->setFormat($format);
$imagick->setImageFormat($format);
$imagick->setCompression($compression);
$imagick->setImag... | [
"protected",
"function",
"processTiff",
"(",
")",
"{",
"$",
"format",
"=",
"'tiff'",
";",
"$",
"compression",
"=",
"\\",
"Imagick",
"::",
"COMPRESSION_UNDEFINED",
";",
"$",
"imagick",
"=",
"$",
"this",
"->",
"image",
"->",
"getCore",
"(",
")",
";",
"$",
... | Processes and returns encoded image as TIFF string
@return string | [
"Processes",
"and",
"returns",
"encoded",
"image",
"as",
"TIFF",
"string"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Imagick/Encoder.php#L96-L110 |
220,561 | Intervention/image | src/Intervention/Image/Imagick/Encoder.php | Encoder.processPsd | protected function processPsd()
{
$format = 'psd';
$compression = \Imagick::COMPRESSION_UNDEFINED;
$imagick = $this->image->getCore();
$imagick->setFormat($format);
$imagick->setImageFormat($format);
$imagick->setCompression($compression);
$imagick->setImageC... | php | protected function processPsd()
{
$format = 'psd';
$compression = \Imagick::COMPRESSION_UNDEFINED;
$imagick = $this->image->getCore();
$imagick->setFormat($format);
$imagick->setImageFormat($format);
$imagick->setCompression($compression);
$imagick->setImageC... | [
"protected",
"function",
"processPsd",
"(",
")",
"{",
"$",
"format",
"=",
"'psd'",
";",
"$",
"compression",
"=",
"\\",
"Imagick",
"::",
"COMPRESSION_UNDEFINED",
";",
"$",
"imagick",
"=",
"$",
"this",
"->",
"image",
"->",
"getCore",
"(",
")",
";",
"$",
... | Processes and returns encoded image as PSD string
@return string | [
"Processes",
"and",
"returns",
"encoded",
"image",
"as",
"PSD",
"string"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Imagick/Encoder.php#L155-L167 |
220,562 | Intervention/image | src/Intervention/Image/AbstractEncoder.php | AbstractEncoder.processDataUrl | protected function processDataUrl()
{
$mime = $this->image->mime ? $this->image->mime : 'image/png';
return sprintf('data:%s;base64,%s',
$mime,
base64_encode($this->process($this->image, $mime, $this->quality))
);
} | php | protected function processDataUrl()
{
$mime = $this->image->mime ? $this->image->mime : 'image/png';
return sprintf('data:%s;base64,%s',
$mime,
base64_encode($this->process($this->image, $mime, $this->quality))
);
} | [
"protected",
"function",
"processDataUrl",
"(",
")",
"{",
"$",
"mime",
"=",
"$",
"this",
"->",
"image",
"->",
"mime",
"?",
"$",
"this",
"->",
"image",
"->",
"mime",
":",
"'image/png'",
";",
"return",
"sprintf",
"(",
"'data:%s;base64,%s'",
",",
"$",
"mime... | Processes and returns encoded image as data-url string
@return string | [
"Processes",
"and",
"returns",
"encoded",
"image",
"as",
"data",
"-",
"url",
"string"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/AbstractEncoder.php#L185-L193 |
220,563 | Intervention/image | src/Intervention/Image/AbstractEncoder.php | AbstractEncoder.setFormat | protected function setFormat($format = null)
{
if ($format == '' && $this->image instanceof Image) {
$format = $this->image->mime;
}
$this->format = $format ? $format : 'jpg';
return $this;
} | php | protected function setFormat($format = null)
{
if ($format == '' && $this->image instanceof Image) {
$format = $this->image->mime;
}
$this->format = $format ? $format : 'jpg';
return $this;
} | [
"protected",
"function",
"setFormat",
"(",
"$",
"format",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"format",
"==",
"''",
"&&",
"$",
"this",
"->",
"image",
"instanceof",
"Image",
")",
"{",
"$",
"format",
"=",
"$",
"this",
"->",
"image",
"->",
"mime",
... | Determines output format
@param string $format | [
"Determines",
"output",
"format"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/AbstractEncoder.php#L210-L219 |
220,564 | Intervention/image | src/Intervention/Image/AbstractEncoder.php | AbstractEncoder.setQuality | protected function setQuality($quality)
{
$quality = is_null($quality) ? 90 : $quality;
$quality = $quality === 0 ? 1 : $quality;
if ($quality < 0 || $quality > 100) {
throw new \Intervention\Image\Exception\InvalidArgumentException(
'Quality must range from 0 to... | php | protected function setQuality($quality)
{
$quality = is_null($quality) ? 90 : $quality;
$quality = $quality === 0 ? 1 : $quality;
if ($quality < 0 || $quality > 100) {
throw new \Intervention\Image\Exception\InvalidArgumentException(
'Quality must range from 0 to... | [
"protected",
"function",
"setQuality",
"(",
"$",
"quality",
")",
"{",
"$",
"quality",
"=",
"is_null",
"(",
"$",
"quality",
")",
"?",
"90",
":",
"$",
"quality",
";",
"$",
"quality",
"=",
"$",
"quality",
"===",
"0",
"?",
"1",
":",
"$",
"quality",
";"... | Determines output quality
@param int $quality | [
"Determines",
"output",
"quality"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/AbstractEncoder.php#L226-L240 |
220,565 | Intervention/image | src/Intervention/Image/AbstractDriver.php | AbstractDriver.encode | public function encode($image, $format, $quality)
{
return $this->encoder->process($image, $format, $quality);
} | php | public function encode($image, $format, $quality)
{
return $this->encoder->process($image, $format, $quality);
} | [
"public",
"function",
"encode",
"(",
"$",
"image",
",",
"$",
"format",
",",
"$",
"quality",
")",
"{",
"return",
"$",
"this",
"->",
"encoder",
"->",
"process",
"(",
"$",
"image",
",",
"$",
"format",
",",
"$",
"quality",
")",
";",
"}"
] | Encodes given image
@param Image $image
@param string $format
@param int $quality
@return \Intervention\Image\Image | [
"Encodes",
"given",
"image"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/AbstractDriver.php#L75-L78 |
220,566 | Intervention/image | src/Intervention/Image/Imagick/Commands/FitCommand.php | FitCommand.execute | public function execute($image)
{
$width = $this->argument(0)->type('digit')->required()->value();
$height = $this->argument(1)->type('digit')->value($width);
$constraints = $this->argument(2)->type('closure')->value();
$position = $this->argument(3)->type('string')->value('center');... | php | public function execute($image)
{
$width = $this->argument(0)->type('digit')->required()->value();
$height = $this->argument(1)->type('digit')->value($width);
$constraints = $this->argument(2)->type('closure')->value();
$position = $this->argument(3)->type('string')->value('center');... | [
"public",
"function",
"execute",
"(",
"$",
"image",
")",
"{",
"$",
"width",
"=",
"$",
"this",
"->",
"argument",
"(",
"0",
")",
"->",
"type",
"(",
"'digit'",
")",
"->",
"required",
"(",
")",
"->",
"value",
"(",
")",
";",
"$",
"height",
"=",
"$",
... | Crops and resized an image at the same time
@param \Intervention\Image\Image $image
@return boolean | [
"Crops",
"and",
"resized",
"an",
"image",
"at",
"the",
"same",
"time"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Imagick/Commands/FitCommand.php#L15-L40 |
220,567 | Intervention/image | src/Intervention/Image/Gd/Driver.php | Driver.cloneCore | public function cloneCore($core)
{
$width = imagesx($core);
$height = imagesy($core);
$clone = imagecreatetruecolor($width, $height);
imagealphablending($clone, false);
imagesavealpha($clone, true);
$transparency = imagecolorallocatealpha($clone, 0, 0, 0, 127);
... | php | public function cloneCore($core)
{
$width = imagesx($core);
$height = imagesy($core);
$clone = imagecreatetruecolor($width, $height);
imagealphablending($clone, false);
imagesavealpha($clone, true);
$transparency = imagecolorallocatealpha($clone, 0, 0, 0, 127);
... | [
"public",
"function",
"cloneCore",
"(",
"$",
"core",
")",
"{",
"$",
"width",
"=",
"imagesx",
"(",
"$",
"core",
")",
";",
"$",
"height",
"=",
"imagesy",
"(",
"$",
"core",
")",
";",
"$",
"clone",
"=",
"imagecreatetruecolor",
"(",
"$",
"width",
",",
"... | Returns clone of given core
@return mixed | [
"Returns",
"clone",
"of",
"given",
"core"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Gd/Driver.php#L72-L85 |
220,568 | Intervention/image | src/Intervention/Image/Size.php | Size.relativePosition | public function relativePosition(Size $size)
{
$x = $this->pivot->x - $size->pivot->x;
$y = $this->pivot->y - $size->pivot->y;
return new Point($x, $y);
} | php | public function relativePosition(Size $size)
{
$x = $this->pivot->x - $size->pivot->x;
$y = $this->pivot->y - $size->pivot->y;
return new Point($x, $y);
} | [
"public",
"function",
"relativePosition",
"(",
"Size",
"$",
"size",
")",
"{",
"$",
"x",
"=",
"$",
"this",
"->",
"pivot",
"->",
"x",
"-",
"$",
"size",
"->",
"pivot",
"->",
"x",
";",
"$",
"y",
"=",
"$",
"this",
"->",
"pivot",
"->",
"y",
"-",
"$",... | Calculate the relative position to another Size
based on the pivot point settings of both sizes.
@param Size $size
@return \Intervention\Image\Point | [
"Calculate",
"the",
"relative",
"position",
"to",
"another",
"Size",
"based",
"on",
"the",
"pivot",
"point",
"settings",
"of",
"both",
"sizes",
"."
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Size.php#L211-L217 |
220,569 | Intervention/image | src/Intervention/Image/Size.php | Size.fit | public function fit(Size $size, $position = 'center')
{
// create size with auto height
$auto_height = clone $size;
$auto_height->resize($this->width, null, function ($constraint) {
$constraint->aspectRatio();
});
// decide which version to use
if ($auto... | php | public function fit(Size $size, $position = 'center')
{
// create size with auto height
$auto_height = clone $size;
$auto_height->resize($this->width, null, function ($constraint) {
$constraint->aspectRatio();
});
// decide which version to use
if ($auto... | [
"public",
"function",
"fit",
"(",
"Size",
"$",
"size",
",",
"$",
"position",
"=",
"'center'",
")",
"{",
"// create size with auto height",
"$",
"auto_height",
"=",
"clone",
"$",
"size",
";",
"$",
"auto_height",
"->",
"resize",
"(",
"$",
"this",
"->",
"widt... | Resize given Size to best fitting size of current size.
@param Size $size
@return \Intervention\Image\Size | [
"Resize",
"given",
"Size",
"to",
"best",
"fitting",
"size",
"of",
"current",
"size",
"."
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Size.php#L225-L256 |
220,570 | Intervention/image | src/Intervention/Image/Size.php | Size.fitsInto | public function fitsInto(Size $size)
{
return ($this->width <= $size->width) && ($this->height <= $size->height);
} | php | public function fitsInto(Size $size)
{
return ($this->width <= $size->width) && ($this->height <= $size->height);
} | [
"public",
"function",
"fitsInto",
"(",
"Size",
"$",
"size",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"width",
"<=",
"$",
"size",
"->",
"width",
")",
"&&",
"(",
"$",
"this",
"->",
"height",
"<=",
"$",
"size",
"->",
"height",
")",
";",
"}"
] | Checks if given size fits into current size
@param Size $size
@return boolean | [
"Checks",
"if",
"given",
"size",
"fits",
"into",
"current",
"size"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Size.php#L264-L267 |
220,571 | Intervention/image | src/Intervention/Image/Size.php | Size.align | public function align($position, $offset_x = 0, $offset_y = 0)
{
switch (strtolower($position)) {
case 'top':
case 'top-center':
case 'top-middle':
case 'center-top':
case 'middle-top':
$x = intval($this->width / 2);
... | php | public function align($position, $offset_x = 0, $offset_y = 0)
{
switch (strtolower($position)) {
case 'top':
case 'top-center':
case 'top-middle':
case 'center-top':
case 'middle-top':
$x = intval($this->width / 2);
... | [
"public",
"function",
"align",
"(",
"$",
"position",
",",
"$",
"offset_x",
"=",
"0",
",",
"$",
"offset_y",
"=",
"0",
")",
"{",
"switch",
"(",
"strtolower",
"(",
"$",
"position",
")",
")",
"{",
"case",
"'top'",
":",
"case",
"'top-center'",
":",
"case"... | Aligns current size's pivot point to given position
and moves point automatically by offset.
@param string $position
@param int $offset_x
@param int $offset_y
@return \Intervention\Image\Size | [
"Aligns",
"current",
"size",
"s",
"pivot",
"point",
"to",
"given",
"position",
"and",
"moves",
"point",
"automatically",
"by",
"offset",
"."
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Size.php#L278-L355 |
220,572 | Intervention/image | src/Intervention/Image/Imagick/Decoder.php | Decoder.initFromImagick | public function initFromImagick(\Imagick $object)
{
// currently animations are not supported
// so all images are turned into static
$object = $this->removeAnimation($object);
// reset image orientation
$object->setImageOrientation(\Imagick::ORIENTATION_UNDEFINED);
... | php | public function initFromImagick(\Imagick $object)
{
// currently animations are not supported
// so all images are turned into static
$object = $this->removeAnimation($object);
// reset image orientation
$object->setImageOrientation(\Imagick::ORIENTATION_UNDEFINED);
... | [
"public",
"function",
"initFromImagick",
"(",
"\\",
"Imagick",
"$",
"object",
")",
"{",
"// currently animations are not supported",
"// so all images are turned into static",
"$",
"object",
"=",
"$",
"this",
"->",
"removeAnimation",
"(",
"$",
"object",
")",
";",
"// ... | Initiates new image from Imagick object
@param Imagick $object
@return \Intervention\Image\Image | [
"Initiates",
"new",
"image",
"from",
"Imagick",
"object"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Imagick/Decoder.php#L59-L69 |
220,573 | Intervention/image | src/Intervention/Image/Imagick/Decoder.php | Decoder.removeAnimation | private function removeAnimation(\Imagick $object)
{
$imagick = new \Imagick;
foreach ($object as $frame) {
$imagick->addImage($frame->getImage());
break;
}
$object->destroy();
return $imagick;
} | php | private function removeAnimation(\Imagick $object)
{
$imagick = new \Imagick;
foreach ($object as $frame) {
$imagick->addImage($frame->getImage());
break;
}
$object->destroy();
return $imagick;
} | [
"private",
"function",
"removeAnimation",
"(",
"\\",
"Imagick",
"$",
"object",
")",
"{",
"$",
"imagick",
"=",
"new",
"\\",
"Imagick",
";",
"foreach",
"(",
"$",
"object",
"as",
"$",
"frame",
")",
"{",
"$",
"imagick",
"->",
"addImage",
"(",
"$",
"frame",... | Turns object into one frame Imagick object
by removing all frames except first
@param Imagick $object
@return Imagick | [
"Turns",
"object",
"into",
"one",
"frame",
"Imagick",
"object",
"by",
"removing",
"all",
"frames",
"except",
"first"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Imagick/Decoder.php#L108-L120 |
220,574 | Intervention/image | src/Intervention/Image/Commands/ChecksumCommand.php | ChecksumCommand.execute | public function execute($image)
{
$colors = [];
$size = $image->getSize();
for ($x=0; $x <= ($size->width-1); $x++) {
for ($y=0; $y <= ($size->height-1); $y++) {
$colors[] = $image->pickColor($x, $y, 'array');
}
}
$this->setOutput(md... | php | public function execute($image)
{
$colors = [];
$size = $image->getSize();
for ($x=0; $x <= ($size->width-1); $x++) {
for ($y=0; $y <= ($size->height-1); $y++) {
$colors[] = $image->pickColor($x, $y, 'array');
}
}
$this->setOutput(md... | [
"public",
"function",
"execute",
"(",
"$",
"image",
")",
"{",
"$",
"colors",
"=",
"[",
"]",
";",
"$",
"size",
"=",
"$",
"image",
"->",
"getSize",
"(",
")",
";",
"for",
"(",
"$",
"x",
"=",
"0",
";",
"$",
"x",
"<=",
"(",
"$",
"size",
"->",
"w... | Calculates checksum of given image
@param \Intervention\Image\Image $image
@return boolean | [
"Calculates",
"checksum",
"of",
"given",
"image"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Commands/ChecksumCommand.php#L13-L28 |
220,575 | Intervention/image | src/Intervention/Image/Imagick/Commands/WidenCommand.php | WidenCommand.execute | public function execute($image)
{
$width = $this->argument(0)->type('digit')->required()->value();
$additionalConstraints = $this->argument(1)->type('closure')->value();
$this->arguments[0] = $width;
$this->arguments[1] = null;
$this->arguments[2] = function ($constraint) us... | php | public function execute($image)
{
$width = $this->argument(0)->type('digit')->required()->value();
$additionalConstraints = $this->argument(1)->type('closure')->value();
$this->arguments[0] = $width;
$this->arguments[1] = null;
$this->arguments[2] = function ($constraint) us... | [
"public",
"function",
"execute",
"(",
"$",
"image",
")",
"{",
"$",
"width",
"=",
"$",
"this",
"->",
"argument",
"(",
"0",
")",
"->",
"type",
"(",
"'digit'",
")",
"->",
"required",
"(",
")",
"->",
"value",
"(",
")",
";",
"$",
"additionalConstraints",
... | Resize image proportionally to given width
@param \Intervention\Image\Image $image
@return boolean | [
"Resize",
"image",
"proportionally",
"to",
"given",
"width"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Imagick/Commands/WidenCommand.php#L13-L27 |
220,576 | Intervention/image | src/Intervention/Image/AbstractDecoder.php | AbstractDecoder.initFromUrl | public function initFromUrl($url)
{
$options = [
'http' => [
'method'=>"GET",
'header'=>"Accept-language: en\r\n".
"User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1216.0 Safari/537.2\r\n"
... | php | public function initFromUrl($url)
{
$options = [
'http' => [
'method'=>"GET",
'header'=>"Accept-language: en\r\n".
"User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1216.0 Safari/537.2\r\n"
... | [
"public",
"function",
"initFromUrl",
"(",
"$",
"url",
")",
"{",
"$",
"options",
"=",
"[",
"'http'",
"=>",
"[",
"'method'",
"=>",
"\"GET\"",
",",
"'header'",
"=>",
"\"Accept-language: en\\r\\n\"",
".",
"\"User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML,... | Init from given URL
@param string $url
@return \Intervention\Image\Image | [
"Init",
"from",
"given",
"URL"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/AbstractDecoder.php#L65-L86 |
220,577 | Intervention/image | src/Intervention/Image/AbstractDecoder.php | AbstractDecoder.isFilePath | public function isFilePath()
{
if (is_string($this->data)) {
try {
return is_file($this->data);
} catch (\Exception $e) {
return false;
}
}
return false;
} | php | public function isFilePath()
{
if (is_string($this->data)) {
try {
return is_file($this->data);
} catch (\Exception $e) {
return false;
}
}
return false;
} | [
"public",
"function",
"isFilePath",
"(",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"this",
"->",
"data",
")",
")",
"{",
"try",
"{",
"return",
"is_file",
"(",
"$",
"this",
"->",
"data",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
"... | Determines if current source data is file path
@return boolean | [
"Determines",
"if",
"current",
"source",
"data",
"is",
"file",
"path"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/AbstractDecoder.php#L190-L201 |
220,578 | Intervention/image | src/Intervention/Image/AbstractDecoder.php | AbstractDecoder.isDataUrl | public function isDataUrl()
{
$data = $this->decodeDataUrl($this->data);
return is_null($data) ? false : true;
} | php | public function isDataUrl()
{
$data = $this->decodeDataUrl($this->data);
return is_null($data) ? false : true;
} | [
"public",
"function",
"isDataUrl",
"(",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"decodeDataUrl",
"(",
"$",
"this",
"->",
"data",
")",
";",
"return",
"is_null",
"(",
"$",
"data",
")",
"?",
"false",
":",
"true",
";",
"}"
] | Determines if current source data is data-url
@return boolean | [
"Determines",
"if",
"current",
"source",
"data",
"is",
"data",
"-",
"url"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/AbstractDecoder.php#L247-L252 |
220,579 | Intervention/image | src/Intervention/Image/AbstractDecoder.php | AbstractDecoder.isBase64 | public function isBase64()
{
if (!is_string($this->data)) {
return false;
}
return base64_encode(base64_decode($this->data)) === $this->data;
} | php | public function isBase64()
{
if (!is_string($this->data)) {
return false;
}
return base64_encode(base64_decode($this->data)) === $this->data;
} | [
"public",
"function",
"isBase64",
"(",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"this",
"->",
"data",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"base64_encode",
"(",
"base64_decode",
"(",
"$",
"this",
"->",
"data",
")",
")",
"==="... | Determines if current source data is base64 encoded
@return boolean | [
"Determines",
"if",
"current",
"source",
"data",
"is",
"base64",
"encoded"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/AbstractDecoder.php#L259-L266 |
220,580 | Intervention/image | src/Intervention/Image/AbstractDecoder.php | AbstractDecoder.decodeDataUrl | private function decodeDataUrl($data_url)
{
if (!is_string($data_url)) {
return null;
}
$pattern = "/^data:(?:image\/[a-zA-Z\-\.]+)(?:charset=\".+\")?;base64,(?P<data>.+)$/";
preg_match($pattern, $data_url, $matches);
if (is_array($matches) && array_key_exists('... | php | private function decodeDataUrl($data_url)
{
if (!is_string($data_url)) {
return null;
}
$pattern = "/^data:(?:image\/[a-zA-Z\-\.]+)(?:charset=\".+\")?;base64,(?P<data>.+)$/";
preg_match($pattern, $data_url, $matches);
if (is_array($matches) && array_key_exists('... | [
"private",
"function",
"decodeDataUrl",
"(",
"$",
"data_url",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"data_url",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"pattern",
"=",
"\"/^data:(?:image\\/[a-zA-Z\\-\\.]+)(?:charset=\\\".+\\\")?;base64,(?P<data>.+... | Parses and decodes binary image data from data-url
@param string $data_url
@return string | [
"Parses",
"and",
"decodes",
"binary",
"image",
"data",
"from",
"data",
"-",
"url"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/AbstractDecoder.php#L285-L299 |
220,581 | Intervention/image | src/Intervention/Image/AbstractDecoder.php | AbstractDecoder.init | public function init($data)
{
$this->data = $data;
switch (true) {
case $this->isGdResource():
return $this->initFromGdResource($this->data);
case $this->isImagick():
return $this->initFromImagick($this->data);
case $this->isInt... | php | public function init($data)
{
$this->data = $data;
switch (true) {
case $this->isGdResource():
return $this->initFromGdResource($this->data);
case $this->isImagick():
return $this->initFromImagick($this->data);
case $this->isInt... | [
"public",
"function",
"init",
"(",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"$",
"data",
";",
"switch",
"(",
"true",
")",
"{",
"case",
"$",
"this",
"->",
"isGdResource",
"(",
")",
":",
"return",
"$",
"this",
"->",
"initFromGdResource",
... | Initiates new image from mixed data
@param mixed $data
@return \Intervention\Image\Image | [
"Initiates",
"new",
"image",
"from",
"mixed",
"data"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/AbstractDecoder.php#L307-L347 |
220,582 | Intervention/image | src/Intervention/Image/AbstractColor.php | AbstractColor.format | public function format($type)
{
switch (strtolower($type)) {
case 'rgba':
return $this->getRgba();
case 'hex':
return $this->getHex('#');
case 'int':
case 'integer':
return $this->getInt();
case '... | php | public function format($type)
{
switch (strtolower($type)) {
case 'rgba':
return $this->getRgba();
case 'hex':
return $this->getHex('#');
case 'int':
case 'integer':
return $this->getInt();
case '... | [
"public",
"function",
"format",
"(",
"$",
"type",
")",
"{",
"switch",
"(",
"strtolower",
"(",
"$",
"type",
")",
")",
"{",
"case",
"'rgba'",
":",
"return",
"$",
"this",
"->",
"getRgba",
"(",
")",
";",
"case",
"'hex'",
":",
"return",
"$",
"this",
"->... | Formats current color instance into given format
@param string $type
@return mixed | [
"Formats",
"current",
"color",
"instance",
"into",
"given",
"format"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/AbstractColor.php#L153-L179 |
220,583 | Intervention/image | src/Intervention/Image/Imagick/Commands/BackupCommand.php | BackupCommand.execute | public function execute($image)
{
$backupName = $this->argument(0)->value();
// clone current image resource
$clone = clone $image;
$image->setBackup($clone->getCore(), $backupName);
return true;
} | php | public function execute($image)
{
$backupName = $this->argument(0)->value();
// clone current image resource
$clone = clone $image;
$image->setBackup($clone->getCore(), $backupName);
return true;
} | [
"public",
"function",
"execute",
"(",
"$",
"image",
")",
"{",
"$",
"backupName",
"=",
"$",
"this",
"->",
"argument",
"(",
"0",
")",
"->",
"value",
"(",
")",
";",
"// clone current image resource",
"$",
"clone",
"=",
"clone",
"$",
"image",
";",
"$",
"im... | Saves a backups of current state of image core
@param \Intervention\Image\Image $image
@return boolean | [
"Saves",
"a",
"backups",
"of",
"current",
"state",
"of",
"image",
"core"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Imagick/Commands/BackupCommand.php#L13-L22 |
220,584 | Intervention/image | src/Intervention/Image/AbstractShape.php | AbstractShape.border | public function border($width, $color = null)
{
$this->border_width = is_numeric($width) ? intval($width) : 0;
$this->border_color = is_null($color) ? '#000000' : $color;
} | php | public function border($width, $color = null)
{
$this->border_width = is_numeric($width) ? intval($width) : 0;
$this->border_color = is_null($color) ? '#000000' : $color;
} | [
"public",
"function",
"border",
"(",
"$",
"width",
",",
"$",
"color",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"border_width",
"=",
"is_numeric",
"(",
"$",
"width",
")",
"?",
"intval",
"(",
"$",
"width",
")",
":",
"0",
";",
"$",
"this",
"->",
"b... | Set border width and color of current shape
@param int $width
@param string $color
@return void | [
"Set",
"border",
"width",
"and",
"color",
"of",
"current",
"shape"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/AbstractShape.php#L56-L60 |
220,585 | Intervention/image | src/Intervention/Image/Gd/Commands/CropCommand.php | CropCommand.execute | public function execute($image)
{
$width = $this->argument(0)->type('digit')->required()->value();
$height = $this->argument(1)->type('digit')->required()->value();
$x = $this->argument(2)->type('digit')->value();
$y = $this->argument(3)->type('digit')->value();
if (is_null(... | php | public function execute($image)
{
$width = $this->argument(0)->type('digit')->required()->value();
$height = $this->argument(1)->type('digit')->required()->value();
$x = $this->argument(2)->type('digit')->value();
$y = $this->argument(3)->type('digit')->value();
if (is_null(... | [
"public",
"function",
"execute",
"(",
"$",
"image",
")",
"{",
"$",
"width",
"=",
"$",
"this",
"->",
"argument",
"(",
"0",
")",
"->",
"type",
"(",
"'digit'",
")",
"->",
"required",
"(",
")",
"->",
"value",
"(",
")",
";",
"$",
"height",
"=",
"$",
... | Crop an image instance
@param \Intervention\Image\Image $image
@return boolean | [
"Crop",
"an",
"image",
"instance"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Gd/Commands/CropCommand.php#L16-L39 |
220,586 | Intervention/image | src/Intervention/Image/Commands/ResponseCommand.php | ResponseCommand.execute | public function execute($image)
{
$format = $this->argument(0)->value();
$quality = $this->argument(1)->between(0, 100)->value();
$response = new Response($image, $format, $quality);
$this->setOutput($response->make());
return true;
} | php | public function execute($image)
{
$format = $this->argument(0)->value();
$quality = $this->argument(1)->between(0, 100)->value();
$response = new Response($image, $format, $quality);
$this->setOutput($response->make());
return true;
} | [
"public",
"function",
"execute",
"(",
"$",
"image",
")",
"{",
"$",
"format",
"=",
"$",
"this",
"->",
"argument",
"(",
"0",
")",
"->",
"value",
"(",
")",
";",
"$",
"quality",
"=",
"$",
"this",
"->",
"argument",
"(",
"1",
")",
"->",
"between",
"(",... | Builds HTTP response from given image
@param \Intervention\Image\Image $image
@return boolean | [
"Builds",
"HTTP",
"response",
"from",
"given",
"image"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Commands/ResponseCommand.php#L15-L25 |
220,587 | Intervention/image | src/Intervention/Image/File.php | File.basePath | public function basePath()
{
if ($this->dirname && $this->basename) {
return ($this->dirname .'/'. $this->basename);
}
return null;
} | php | public function basePath()
{
if ($this->dirname && $this->basename) {
return ($this->dirname .'/'. $this->basename);
}
return null;
} | [
"public",
"function",
"basePath",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"dirname",
"&&",
"$",
"this",
"->",
"basename",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"dirname",
".",
"'/'",
".",
"$",
"this",
"->",
"basename",
")",
";",
"}",
"... | Get fully qualified path
@return string | [
"Get",
"fully",
"qualified",
"path"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/File.php#L83-L90 |
220,588 | Intervention/image | src/Intervention/Image/ImageManagerStatic.php | ImageManagerStatic.canvas | public static function canvas($width, $height, $background = null)
{
return self::getManager()->canvas($width, $height, $background);
} | php | public static function canvas($width, $height, $background = null)
{
return self::getManager()->canvas($width, $height, $background);
} | [
"public",
"static",
"function",
"canvas",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"background",
"=",
"null",
")",
"{",
"return",
"self",
"::",
"getManager",
"(",
")",
"->",
"canvas",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"backgrou... | Statically creates an empty image canvas
@param int $width
@param int $height
@param mixed $background
@return \Intervention\Image\Image | [
"Statically",
"creates",
"an",
"empty",
"image",
"canvas"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/ImageManagerStatic.php#L70-L73 |
220,589 | Intervention/image | src/Intervention/Image/ImageManagerStatic.php | ImageManagerStatic.cache | public static function cache(Closure $callback, $lifetime = null, $returnObj = false)
{
return self::getManager()->cache($callback, $lifetime, $returnObj);
} | php | public static function cache(Closure $callback, $lifetime = null, $returnObj = false)
{
return self::getManager()->cache($callback, $lifetime, $returnObj);
} | [
"public",
"static",
"function",
"cache",
"(",
"Closure",
"$",
"callback",
",",
"$",
"lifetime",
"=",
"null",
",",
"$",
"returnObj",
"=",
"false",
")",
"{",
"return",
"self",
"::",
"getManager",
"(",
")",
"->",
"cache",
"(",
"$",
"callback",
",",
"$",
... | Create new cached image and run callback statically
@param Closure $callback
@param int $lifetime
@param boolean $returnObj
@return mixed | [
"Create",
"new",
"cached",
"image",
"and",
"run",
"callback",
"statically"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/ImageManagerStatic.php#L84-L87 |
220,590 | Intervention/image | src/Intervention/Image/Imagick/Shapes/CircleShape.php | CircleShape.applyToImage | public function applyToImage(Image $image, $x = 0, $y = 0)
{
return parent::applyToImage($image, $x, $y);
} | php | public function applyToImage(Image $image, $x = 0, $y = 0)
{
return parent::applyToImage($image, $x, $y);
} | [
"public",
"function",
"applyToImage",
"(",
"Image",
"$",
"image",
",",
"$",
"x",
"=",
"0",
",",
"$",
"y",
"=",
"0",
")",
"{",
"return",
"parent",
"::",
"applyToImage",
"(",
"$",
"image",
",",
"$",
"x",
",",
"$",
"y",
")",
";",
"}"
] | Draw current circle on given image
@param Image $image
@param int $x
@param int $y
@return boolean | [
"Draw",
"current",
"circle",
"on",
"given",
"image"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Imagick/Shapes/CircleShape.php#L36-L39 |
220,591 | Intervention/image | src/Intervention/Image/Imagick/Shapes/PolygonShape.php | PolygonShape.formatPoints | private function formatPoints($points)
{
$ipoints = [];
$count = 1;
foreach ($points as $key => $value) {
if ($count%2 === 0) {
$y = $value;
$ipoints[] = ['x' => $x, 'y' => $y];
} else {
$x = $value;
}
... | php | private function formatPoints($points)
{
$ipoints = [];
$count = 1;
foreach ($points as $key => $value) {
if ($count%2 === 0) {
$y = $value;
$ipoints[] = ['x' => $x, 'y' => $y];
} else {
$x = $value;
}
... | [
"private",
"function",
"formatPoints",
"(",
"$",
"points",
")",
"{",
"$",
"ipoints",
"=",
"[",
"]",
";",
"$",
"count",
"=",
"1",
";",
"foreach",
"(",
"$",
"points",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"count",
"%",
"... | Format polygon points to Imagick format
@param Array $points
@return Array | [
"Format",
"polygon",
"points",
"to",
"Imagick",
"format"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Imagick/Shapes/PolygonShape.php#L63-L79 |
220,592 | Intervention/image | src/Intervention/Image/Gd/Decoder.php | Decoder.gdResourceToTruecolor | public function gdResourceToTruecolor(&$resource)
{
$width = imagesx($resource);
$height = imagesy($resource);
// new canvas
$canvas = imagecreatetruecolor($width, $height);
// fill with transparent color
imagealphablending($canvas, false);
$transparent = im... | php | public function gdResourceToTruecolor(&$resource)
{
$width = imagesx($resource);
$height = imagesy($resource);
// new canvas
$canvas = imagecreatetruecolor($width, $height);
// fill with transparent color
imagealphablending($canvas, false);
$transparent = im... | [
"public",
"function",
"gdResourceToTruecolor",
"(",
"&",
"$",
"resource",
")",
"{",
"$",
"width",
"=",
"imagesx",
"(",
"$",
"resource",
")",
";",
"$",
"height",
"=",
"imagesy",
"(",
"$",
"resource",
")",
";",
"// new canvas",
"$",
"canvas",
"=",
"imagecr... | Transform GD resource into Truecolor version
@param resource $resource
@return bool | [
"Transform",
"GD",
"resource",
"into",
"Truecolor",
"version"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Gd/Decoder.php#L130-L152 |
220,593 | Intervention/image | src/Intervention/Image/Commands/Argument.php | Argument.getCommandName | public function getCommandName()
{
preg_match("/\\\\([\w]+)Command$/", get_class($this->command), $matches);
return isset($matches[1]) ? lcfirst($matches[1]).'()' : 'Method';
} | php | public function getCommandName()
{
preg_match("/\\\\([\w]+)Command$/", get_class($this->command), $matches);
return isset($matches[1]) ? lcfirst($matches[1]).'()' : 'Method';
} | [
"public",
"function",
"getCommandName",
"(",
")",
"{",
"preg_match",
"(",
"\"/\\\\\\\\([\\w]+)Command$/\"",
",",
"get_class",
"(",
"$",
"this",
"->",
"command",
")",
",",
"$",
"matches",
")",
";",
"return",
"isset",
"(",
"$",
"matches",
"[",
"1",
"]",
")",... | Returns name of current arguments command
@return string | [
"Returns",
"name",
"of",
"current",
"arguments",
"command"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Commands/Argument.php#L38-L42 |
220,594 | Intervention/image | src/Intervention/Image/Commands/Argument.php | Argument.value | public function value($default = null)
{
$arguments = $this->command->arguments;
if (is_array($arguments)) {
return isset($arguments[$this->key]) ? $arguments[$this->key] : $default;
}
return $default;
} | php | public function value($default = null)
{
$arguments = $this->command->arguments;
if (is_array($arguments)) {
return isset($arguments[$this->key]) ? $arguments[$this->key] : $default;
}
return $default;
} | [
"public",
"function",
"value",
"(",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"arguments",
"=",
"$",
"this",
"->",
"command",
"->",
"arguments",
";",
"if",
"(",
"is_array",
"(",
"$",
"arguments",
")",
")",
"{",
"return",
"isset",
"(",
"$",
"argumen... | Returns value of current argument
@param mixed $default
@return mixed | [
"Returns",
"value",
"of",
"current",
"argument"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Commands/Argument.php#L50-L59 |
220,595 | Intervention/image | src/Intervention/Image/Image.php | Image.encode | public function encode($format = null, $quality = 90)
{
return $this->driver->encode($this, $format, $quality);
} | php | public function encode($format = null, $quality = 90)
{
return $this->driver->encode($this, $format, $quality);
} | [
"public",
"function",
"encode",
"(",
"$",
"format",
"=",
"null",
",",
"$",
"quality",
"=",
"90",
")",
"{",
"return",
"$",
"this",
"->",
"driver",
"->",
"encode",
"(",
"$",
"this",
",",
"$",
"format",
",",
"$",
"quality",
")",
";",
"}"
] | Starts encoding of current image
@param string $format
@param int $quality
@return \Intervention\Image\Image | [
"Starts",
"encoding",
"of",
"current",
"image"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Image.php#L117-L120 |
220,596 | Intervention/image | src/Intervention/Image/Image.php | Image.save | public function save($path = null, $quality = null)
{
$path = is_null($path) ? $this->basePath() : $path;
if (is_null($path)) {
throw new Exception\NotWritableException(
"Can't write to undefined path."
);
}
$data = $this->encode(pathinfo($pa... | php | public function save($path = null, $quality = null)
{
$path = is_null($path) ? $this->basePath() : $path;
if (is_null($path)) {
throw new Exception\NotWritableException(
"Can't write to undefined path."
);
}
$data = $this->encode(pathinfo($pa... | [
"public",
"function",
"save",
"(",
"$",
"path",
"=",
"null",
",",
"$",
"quality",
"=",
"null",
")",
"{",
"$",
"path",
"=",
"is_null",
"(",
"$",
"path",
")",
"?",
"$",
"this",
"->",
"basePath",
"(",
")",
":",
"$",
"path",
";",
"if",
"(",
"is_nul... | Saves encoded image in filesystem
@param string $path
@param int $quality
@return \Intervention\Image\Image | [
"Saves",
"encoded",
"image",
"in",
"filesystem"
] | a8fca2aeead8168c16cd36b2507ed520d3f4fc66 | https://github.com/Intervention/image/blob/a8fca2aeead8168c16cd36b2507ed520d3f4fc66/src/Intervention/Image/Image.php#L129-L152 |
220,597 | Maatwebsite/Laravel-Excel | src/Reader.php | Reader.garbageCollect | private function garbageCollect()
{
$this->setDefaultValueBinder();
// Force garbage collecting
unset($this->sheetImports, $this->spreadsheet);
$this->currentFile->delete();
} | php | private function garbageCollect()
{
$this->setDefaultValueBinder();
// Force garbage collecting
unset($this->sheetImports, $this->spreadsheet);
$this->currentFile->delete();
} | [
"private",
"function",
"garbageCollect",
"(",
")",
"{",
"$",
"this",
"->",
"setDefaultValueBinder",
"(",
")",
";",
"// Force garbage collecting",
"unset",
"(",
"$",
"this",
"->",
"sheetImports",
",",
"$",
"this",
"->",
"spreadsheet",
")",
";",
"$",
"this",
"... | Garbage collect. | [
"Garbage",
"collect",
"."
] | 1e502de0a3265704b7c48b8f0dbe67cb7fe5b71f | https://github.com/Maatwebsite/Laravel-Excel/blob/1e502de0a3265704b7c48b8f0dbe67cb7fe5b71f/src/Reader.php#L412-L420 |
220,598 | Maatwebsite/Laravel-Excel | src/HasEventBus.php | HasEventBus.registerListeners | public function registerListeners(array $listeners)
{
foreach ($listeners as $event => $listener) {
$this->events[$event][] = $listener;
}
} | php | public function registerListeners(array $listeners)
{
foreach ($listeners as $event => $listener) {
$this->events[$event][] = $listener;
}
} | [
"public",
"function",
"registerListeners",
"(",
"array",
"$",
"listeners",
")",
"{",
"foreach",
"(",
"$",
"listeners",
"as",
"$",
"event",
"=>",
"$",
"listener",
")",
"{",
"$",
"this",
"->",
"events",
"[",
"$",
"event",
"]",
"[",
"]",
"=",
"$",
"list... | Register local event listeners.
@param array $listeners | [
"Register",
"local",
"event",
"listeners",
"."
] | 1e502de0a3265704b7c48b8f0dbe67cb7fe5b71f | https://github.com/Maatwebsite/Laravel-Excel/blob/1e502de0a3265704b7c48b8f0dbe67cb7fe5b71f/src/HasEventBus.php#L22-L27 |
220,599 | swooletw/laravel-swoole | src/Server/Manager.php | Manager.bindToLaravelApp | protected function bindToLaravelApp()
{
$this->bindSandbox();
$this->bindSwooleTable();
if ($this->isServerWebsocket) {
$this->bindRoom();
$this->bindWebsocket();
}
} | php | protected function bindToLaravelApp()
{
$this->bindSandbox();
$this->bindSwooleTable();
if ($this->isServerWebsocket) {
$this->bindRoom();
$this->bindWebsocket();
}
} | [
"protected",
"function",
"bindToLaravelApp",
"(",
")",
"{",
"$",
"this",
"->",
"bindSandbox",
"(",
")",
";",
"$",
"this",
"->",
"bindSwooleTable",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isServerWebsocket",
")",
"{",
"$",
"this",
"->",
"bindRoom",
... | Set bindings to Laravel app. | [
"Set",
"bindings",
"to",
"Laravel",
"app",
"."
] | 5b2b08a45eeb99e32ae66a0b362dc3916164ad31 | https://github.com/swooletw/laravel-swoole/blob/5b2b08a45eeb99e32ae66a0b362dc3916164ad31/src/Server/Manager.php#L307-L316 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.