* @return string Remapped CSS data
*/
public static function remap( $source, $path ) {
+ global $wgUseDataURLs;
$pattern = '/((?<embed>\s*\/\*\s*\@embed\s*\*\/)(?<rule>[^\;\}]*))?url\([\'"]?(?<file>[^\?\)\:]*)\??[^\)]*[\'"]?\)(?<extra>[^;]*)[\;]?/';
$offset = 0;
while ( preg_match( $pattern, $source, $match, PREG_OFFSET_CAPTURE, $offset ) ) {
// Add version parameter as a time-stamp in ISO 8601 format, using Z for the timezone, meaning GMT
$url = "{$file}?" . gmdate( 'Y-m-d\TH:i:s\Z', round( filemtime( $file ), -2 ) );
// Detect when URLs were preceeded with embed tags, and also verify file size is below the limit
- if ( $match['embed'][1] > 0 && filesize( $file ) < self::EMBED_SIZE_LIMIT ) {
+ if ( $wgUseDataURLs && $match['embed'][1] > 0 && filesize( $file ) < self::EMBED_SIZE_LIMIT ) {
// If we ever get to PHP 5.3, we should use the Fileinfo extension instead of mime_content_type
$type = mime_content_type( $file );
// Strip off any trailing = symbols (makes browsers freak out)
*/
$wgResourceLoaderServerMaxage = 30*24*60*60; // 30 days
+/**
+ * Enable data URL embedding (experimental). This variable is very temporary and
+ * will be removed once we get this feature stable.
+ */
+$wgUseDataURLs = false;
+
/** @} */ # end of cache settings
/************************************************************************//**