public static function prepareCssForOutput($css, $direction, $minify = false) { $css = self::translateCssRules($css); if ($direction == 'RTL') { $css = XenForo_Template_Helper_RightToLeft::getRtlCss($css); } $css = preg_replace('/rtl-raw\\.([a-zA-Z0-9-]+\\s*:)/', '$1', $css); if ($minify) { // the CSS minifier doesn't handle long data URI values well due to some regex issues, // so rip them out and then restore them after minifying $dataUriMap = array(); if (preg_match_all('#url\\((?:(\'|"|)data:.*\\1)\\)#siU', $css, $matches)) { foreach ($matches[0] as $i => $match) { $replace = "url('__tempDataUriReplacement-{$i}__')"; $css = str_replace($match, $replace, $css); $dataUriMap[$replace] = $match; } } $css = Minify_CSS_Compressor::process($css); foreach ($dataUriMap as $find => $replace) { $css = str_replace($find, $replace, $css); } } return $css; }
public static function prepareCssForOutput($css, $direction, $minify = false) { $css = self::translateCssRules($css); if ($direction == 'RTL') { $css = XenForo_Template_Helper_RightToLeft::getRtlCss($css); } $css = preg_replace('/rtl-raw\\.([a-zA-Z0-9-]+\\s*:)/', '$1', $css); if ($minify) { $css = Minify_CSS_Compressor::process($css); } return $css; }
protected function _replaceRtlCss(array $matches) { return XenForo_Template_Helper_RightToLeft::getRtlCss($matches[1]); }