Browse files

MDL-22955 output: Added block to ensure that SVG is not used within CSS

  • Loading branch information...
Sam Hemelryk
Sam Hemelryk committed Oct 2, 2012
1 parent 436dbee commit f7d6a556cf105f1c60a5d11356171afec2a7b3a1
Showing with 16 additions and 0 deletions.
  1. +16 −0 lib/outputlib.php
@@ -948,6 +948,11 @@ public function javascript_content($type) {
public function post_process($css) {
// now resolve all image locations
if (preg_match_all('/\[\[pix:([a-z_]+\|)?([^\]]+)\]\]/', $css, $matches, PREG_SET_ORDER)) {
// We are going to disable the use of SVG images when available in CSS background-image properties
// as support for it in browsers is at best quirky.
// When we choose to support SVG in background css we will need to remove this code and implement a solution that is
// either consistent or varies the URL for serving CSS depending upon SVG being used if available, or not.
$replaced = array();
foreach ($matches as $match) {
if (isset($replaced[$match[0]])) {
@@ -1131,6 +1136,17 @@ public function use_svg_icons() {
return $this->usesvg;
* Forces the usesvg setting to either true or false, avoiding any decision making.
* This function should only ever be used when absolutely required, and before any generation of image URL's has occurred.
* @param bool $setting True to force the use of svg when available, null otherwise.
private function force_svg_use($setting) {
$this->usesvg = (bool)$setting;
* Checks if file with any image extension exists.

0 comments on commit f7d6a55

Please sign in to comment.