';
- echo $OUTPUT->image_icon('icon', $modname, 'assign');
+ echo $OUTPUT->image_icon('monologo', $modname, 'assign');
echo '
';
echo $activity->name;
echo '';
diff --git a/mod/bigbluebuttonbn/db/mobile.php b/mod/bigbluebuttonbn/db/mobile.php
index 5c32c69db72..dd600a0e0aa 100644
--- a/mod/bigbluebuttonbn/db/mobile.php
+++ b/mod/bigbluebuttonbn/db/mobile.php
@@ -31,7 +31,7 @@ $addons = [
'coursebigbluebuttonbn' => [ // Handler unique name (can be anything).
'displaydata' => [
'title' => 'pluginname',
- 'icon' => $CFG->wwwroot . '/mod/bigbluebuttonbn/pix/dynamicicon.png',
+ 'icon' => $CFG->wwwroot . '/mod/bigbluebuttonbn/pix/monologo.png',
'class' => '',
],
'delegate' => 'CoreCourseModuleDelegate', // Delegate (where to display the link to the add-on).
diff --git a/mod/data/tests/generator/lib.php b/mod/data/tests/generator/lib.php
index 09fa31c03a9..719552dfa24 100644
--- a/mod/data/tests/generator/lib.php
+++ b/mod/data/tests/generator/lib.php
@@ -311,7 +311,7 @@ class mod_data_generator extends testing_module_generator {
get_file_storage()->create_file_from_string(['component' => 'user', 'filearea' => 'draft',
'contextid' => $usercontext->id, 'itemid' => $itemid, 'filepath' => '/',
'filename' => $filename],
- file_get_contents($CFG->dirroot.'/mod/data/pix/dynamicicon.png'));
+ file_get_contents($CFG->dirroot.'/mod/data/pix/monologo.png'));
}
$fieldname = 'field_' . $fieldid . '_file';
diff --git a/mod/feedback/lib.php b/mod/feedback/lib.php
index 039cde5c7ea..7a707ae8514 100644
--- a/mod/feedback/lib.php
+++ b/mod/feedback/lib.php
@@ -496,7 +496,7 @@ function feedback_print_recent_mod_activity($activity, $courseid, $detail, $modn
if ($detail) {
$modname = $modnames[$activity->type];
echo '
';
}
diff --git a/mod/forum/lib.php b/mod/forum/lib.php
index 8bbdcfe0644..3ad968c3881 100644
--- a/mod/forum/lib.php
+++ b/mod/forum/lib.php
@@ -4208,7 +4208,7 @@ function forum_print_recent_mod_activity($activity, $courseid, $detail, $modname
$output .= html_writer::start_div($class);
if ($detail) {
$aname = s($activity->name);
- $output .= $OUTPUT->image_icon('icon', $aname, $activity->type);
+ $output .= $OUTPUT->image_icon('monologo', $aname, $activity->type);
}
$discussionurl = new moodle_url('/mod/forum/discuss.php', ['d' => $content->discussion]);
$discussionurl->set_anchor('p' . $activity->content->id);
diff --git a/mod/h5pactivity/lib.php b/mod/h5pactivity/lib.php
index 667daaa05de..f35965fade5 100644
--- a/mod/h5pactivity/lib.php
+++ b/mod/h5pactivity/lib.php
@@ -727,7 +727,7 @@ function h5pactivity_print_recent_mod_activity(stdClass $activity, int $courseid
if ($detail) {
$modinfo['modname'] = $activity->name;
$modinfo['modurl'] = new moodle_url('/mod/h5pactivity/view.php', ['id' => $activity->cmid]);
- $modinfo['modicon'] = $OUTPUT->image_icon('icon', $modnames[$activity->type], 'h5pactivity');
+ $modinfo['modicon'] = $OUTPUT->image_icon('monologo', $modnames[$activity->type], 'h5pactivity');
}
$userpicture = $OUTPUT->user_picture($activity->user);
diff --git a/mod/lti/lib.php b/mod/lti/lib.php
index 3c324c2f0fd..528bc2c863c 100644
--- a/mod/lti/lib.php
+++ b/mod/lti/lib.php
@@ -359,7 +359,7 @@ function mod_lti_get_all_content_items(\core_course\local\entity\content_item $d
$type->helplink = get_string('modulename_shortcut_link', 'lti');
}
if (empty($ltitype->icon)) {
- $type->icon = $OUTPUT->pix_icon('icon', '', 'lti', array('class' => 'icon'));
+ $type->icon = $OUTPUT->pix_icon('monologo', '', 'lti', array('class' => 'icon'));
} else {
$type->icon = html_writer::empty_tag('img', array('src' => $ltitype->icon, 'alt' => $ltitype->name, 'class' => 'icon'));
}
diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php
index 87a87a4bd3d..2100cb12b77 100644
--- a/mod/quiz/lib.php
+++ b/mod/quiz/lib.php
@@ -996,7 +996,7 @@ function quiz_print_recent_mod_activity($activity, $courseid, $detail, $modnames
if ($detail) {
$modname = $modnames[$activity->type];
echo '
';
- echo $OUTPUT->image_icon('icon', $modname, $activity->type);
+ echo $OUTPUT->image_icon('monologo', $modname, $activity->type);
echo '
' . $activity->name . '';
echo '
';
diff --git a/mod/workshop/lib.php b/mod/workshop/lib.php
index c2bd468f082..e56a2ef4ffd 100644
--- a/mod/workshop/lib.php
+++ b/mod/workshop/lib.php
@@ -989,7 +989,7 @@ function workshop_print_recent_mod_activity($activity, $courseid, $detail, $modn
echo html_writer::start_tag('h4', array('class'=>'workshop'));
$url = new moodle_url('/mod/workshop/view.php', array('id'=>$activity->cmid));
$name = s($activity->name);
- echo $OUTPUT->image_icon('icon', $name, $activity->type);
+ echo $OUTPUT->image_icon('monologo', $name, $activity->type);
echo ' ' . $modnames[$activity->type];
echo html_writer::link($url, $name, array('class'=>'name', 'style'=>'margin-left: 5px'));
echo html_writer::end_tag('h4');
@@ -1026,7 +1026,7 @@ function workshop_print_recent_mod_activity($activity, $courseid, $detail, $modn
echo html_writer::start_tag('h4', array('class'=>'workshop'));
$url = new moodle_url('/mod/workshop/view.php', array('id'=>$activity->cmid));
$name = s($activity->name);
- echo $OUTPUT->image_icon('icon', $name, $activity->type);
+ echo $OUTPUT->image_icon('monologo', $name, $activity->type);
echo ' ' . $modnames[$activity->type];
echo html_writer::link($url, $name, array('class'=>'name', 'style'=>'margin-left: 5px'));
echo html_writer::end_tag('h4');
diff --git a/report/outline/index.php b/report/outline/index.php
index 532d49428a8..2078ebb5f66 100644
--- a/report/outline/index.php
+++ b/report/outline/index.php
@@ -252,7 +252,7 @@ foreach ($modinfo->sections as $sectionnum=>$section) {
$activitycell = new html_table_cell();
$activitycell->attributes['class'] = 'activity';
- $activityicon = $OUTPUT->pix_icon('icon', $modulename, $cm->modname, array('class'=>'icon'));
+ $activityicon = $OUTPUT->pix_icon('monologo', $modulename, $cm->modname, array('class'=>'icon'));
$attributes = array();
if (!$cm->visible) {
diff --git a/report/outline/locallib.php b/report/outline/locallib.php
index 9d734b7073b..87067cddde6 100644
--- a/report/outline/locallib.php
+++ b/report/outline/locallib.php
@@ -31,7 +31,7 @@ require_once($CFG->dirroot.'/course/lib.php');
function report_outline_print_row($mod, $instance, $result) {
global $OUTPUT, $CFG;
- $image = $OUTPUT->image_icon('icon', $mod->modfullname, $mod->modname);
+ $image = $OUTPUT->image_icon('monologo', $mod->modfullname, $mod->modname);
echo "
";
echo "| $image | ";
diff --git a/report/outline/user.php b/report/outline/user.php
index da3b58386f2..2731b0421a1 100644
--- a/report/outline/user.php
+++ b/report/outline/user.php
@@ -152,7 +152,7 @@ foreach ($sections as $i => $section) {
break;
case "complete":
$user_complete = $mod->modname."_user_complete";
- $image = $OUTPUT->pix_icon('icon', $mod->modfullname, 'mod_'.$mod->modname, array('class'=>'icon'));
+ $image = $OUTPUT->pix_icon('monologo', $mod->modfullname, 'mod_'.$mod->modname, array('class'=>'icon'));
echo "";
diff --git a/report/progress/index.php b/report/progress/index.php
index 6456ff2512a..db2920a1d6a 100644
--- a/report/progress/index.php
+++ b/report/progress/index.php
@@ -316,7 +316,7 @@ foreach($activities as $activity) {
'/view.php?id='.$activity->id.'" title="' . s($displayname) . '">'.
''.$shortenedname.'
'.
''.
- $OUTPUT->image_icon('icon', get_string('modulename', $activity->modname), $activity->modname) .
+ $OUTPUT->image_icon('monologo', get_string('modulename', $activity->modname), $activity->modname) .
'
'.
'';
if ($activity->completionexpected) {
diff --git a/search/classes/base_mod.php b/search/classes/base_mod.php
index ae5e4590a0a..6015f86d3e5 100644
--- a/search/classes/base_mod.php
+++ b/search/classes/base_mod.php
@@ -294,7 +294,7 @@ abstract class base_mod extends base {
* @return \core_search\document_icon
*/
public function get_doc_icon(document $doc) : document_icon {
- return new document_icon('icon', $this->get_module_name());
+ return new document_icon('monologo', $this->get_module_name());
}
/**
diff --git a/search/tests/base_activity_test.php b/search/tests/base_activity_test.php
index 0d855badf75..d74ddead2fb 100644
--- a/search/tests/base_activity_test.php
+++ b/search/tests/base_activity_test.php
@@ -391,7 +391,7 @@ class search_base_activity_testcase extends advanced_testcase {
$result = $baseactivity->get_doc_icon($document);
- $this->assertEquals('icon', $result->get_name());
+ $this->assertEquals('monologo', $result->get_name());
$this->assertEquals('test_activity', $result->get_component());
}
}
diff --git a/theme/boost/classes/output/core_renderer.php b/theme/boost/classes/output/core_renderer.php
index b01ba4138d5..5270d1465d2 100644
--- a/theme/boost/classes/output/core_renderer.php
+++ b/theme/boost/classes/output/core_renderer.php
@@ -154,7 +154,7 @@ class core_renderer extends \core_renderer {
$heading = $this->page->course->fullname;
} else {
$heading = $this->page->cm->get_formatted_name();
- $imagedata = $this->pix_icon('icon', '', $this->page->activityname, ['class' => 'activityicon']);
+ $imagedata = $this->pix_icon('monologo.icon', '', $this->page->activityname, ['class' => 'activityicon']);
$purposeclass = plugin_supports('mod', $this->page->activityname, FEATURE_MOD_PURPOSE);
$purposeclass .= ' activityiconcontainer';
$purposeclass .= ' modicon_' . $this->page->activityname;
diff --git a/theme/image.php b/theme/image.php
index e9cc853f81d..8cc571b7da7 100644
--- a/theme/image.php
+++ b/theme/image.php
@@ -48,15 +48,19 @@ if ($slashargument = min_get_slash_argument()) {
$themename = min_clean_param($themename, 'SAFEDIR');
$component = min_clean_param($component, 'SAFEDIR');
$rev = min_clean_param($rev, 'INT');
- $image = min_clean_param($image, 'SAFEPATH');
-
+ $images = explode('.', $image);
} else {
$themename = min_optional_param('theme', 'standard', 'SAFEDIR');
$component = min_optional_param('component', 'core', 'SAFEDIR');
$rev = min_optional_param('rev', -1, 'INT');
- $image = min_optional_param('image', '', 'SAFEPATH');
+ $images = min_optional_param('images', '', 'RAW');
+ $images = explode('.', $images);
$usesvg = (bool)min_optional_param('svg', '1', 'INT');
}
+$images = array_map(function (string $image) {
+ return min_clean_param($image, 'SAFEPATH');
+}, $images);
+$image = reset($images);
if (empty($component) or $component === 'moodle' or $component === 'core') {
$component = 'core';
@@ -78,31 +82,48 @@ $candidatelocation = "$CFG->localcachedir/theme/$rev/$themename/pix/$component";
$etag = sha1("$rev/$themename/$component/$image");
if ($rev > 0) {
- if (file_exists("$candidatelocation/$image.error")) {
- // This is a major speedup if there are multiple missing images,
- // the only problem is that random requests may pollute our cache.
+ $cacheimage = false;
+ $lookuprequired = false;
+ foreach ($images as $image) {
+ if (file_exists("$candidatelocation/$image.error")) {
+ // This is a major speedup if there are multiple missing images,
+ // the only problem is that random requests may pollute our cache.
+ continue;
+ }
+
+ $lookuprequired = true;
+ if ($usesvg && file_exists("$candidatelocation/$image.svg")) {
+ $cacheimage = "$candidatelocation/$image.svg";
+ $ext = 'svg';
+ } else if (file_exists("$candidatelocation/$image.png")) {
+ $cacheimage = "$candidatelocation/$image.png";
+ $ext = 'png';
+ } else if (file_exists("$candidatelocation/$image.gif")) {
+ $cacheimage = "$candidatelocation/$image.gif";
+ $ext = 'gif';
+ } else if (file_exists("$candidatelocation/$image.jpg")) {
+ $cacheimage = "$candidatelocation/$image.jpg";
+ $ext = 'jpg';
+ } else if (file_exists("$candidatelocation/$image.jpeg")) {
+ $cacheimage = "$candidatelocation/$image.jpeg";
+ $ext = 'jpeg';
+ } else if (file_exists("$candidatelocation/$image.ico")) {
+ $cacheimage = "$candidatelocation/$image.ico";
+ $ext = 'ico';
+ }
+
+ if ($cacheimage) {
+ // The image was found in a candidate location.
+ // It will be served outside of the loop.
+ break;
+ }
+ }
+
+ if (!$lookuprequired) {
+ // None of the images required a lookup - all had previously cached error states.
image_not_found();
}
- $cacheimage = false;
- if ($usesvg && file_exists("$candidatelocation/$image.svg")) {
- $cacheimage = "$candidatelocation/$image.svg";
- $ext = 'svg';
- } else if (file_exists("$candidatelocation/$image.png")) {
- $cacheimage = "$candidatelocation/$image.png";
- $ext = 'png';
- } else if (file_exists("$candidatelocation/$image.gif")) {
- $cacheimage = "$candidatelocation/$image.gif";
- $ext = 'gif';
- } else if (file_exists("$candidatelocation/$image.jpg")) {
- $cacheimage = "$candidatelocation/$image.jpg";
- $ext = 'jpg';
- } else if (file_exists("$candidatelocation/$image.jpeg")) {
- $cacheimage = "$candidatelocation/$image.jpeg";
- $ext = 'jpeg';
- } else if (file_exists("$candidatelocation/$image.ico")) {
- $cacheimage = "$candidatelocation/$image.ico";
- $ext = 'ico';
- }
+
if ($cacheimage) {
if (!empty($_SERVER['HTTP_IF_NONE_MATCH']) || !empty($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
// We do not actually need to verify the etag value because our files
@@ -136,8 +157,15 @@ $themerev = theme_get_revision();
if ($themerev <= 0 or $rev != $themerev) {
// Do not send caching headers if they do not request current revision,
// we do not want to pollute browser caches with outdated images.
- $imagefile = $theme->resolve_image_location($image, $component, $usesvg);
- if (empty($imagefile) or !is_readable($imagefile)) {
+ foreach ($images as $image) {
+ $imagefile = $theme->resolve_image_location($image, $component, $usesvg);
+ if (!empty($imagefile) && is_readable($imagefile)) {
+ break;
+ }
+ $imagefile = null;
+ }
+
+ if (empty($imagefile)) {
image_not_found();
}
send_uncached_image($imagefile);
@@ -154,9 +182,13 @@ make_localcache_directory('theme', false);
// * if the browser has requested the non-SVG version, we *must* cache _both_ the SVG, and the non-SVG versions.
// First get all copies - including, potentially, the SVG version.
-$imagefile = $theme->resolve_image_location($image, $component, true);
+$imagefile = null;
+foreach ($images as $image) {
+ $imagefile = $theme->resolve_image_location($image, $component, true);
+ if (!empty($imagefile) && is_readable($imagefile)) {
+ break;
+ }
-if (empty($imagefile) || !is_readable($imagefile)) {
// Unable to find a copy of the image file in any format.
// We write a .error file for the image now - this will be used above when searching for cached copies to prevent
// trying to find the image in the future.
@@ -167,6 +199,11 @@ if (empty($imagefile) || !is_readable($imagefile)) {
$cacheimage = "$candidatelocation/$image.error";
$fp = fopen($cacheimage, 'w');
fclose($fp);
+
+ $imagefile = null;
+}
+
+if ($imagefile == null) {
image_not_found();
}