Merge branch 'release' of https://github.com/PrestaShop/PrestaShop into release
This commit is contained in:
+13
-24
@@ -152,31 +152,20 @@ class MediaCore
|
||||
$current_css_file = $fileuri;
|
||||
if (strlen($css_content) > 0)
|
||||
{
|
||||
$css_content = preg_replace('#/\*.*?\*/#s', '', $css_content, Media::getBackTrackLimit());
|
||||
$css_content = preg_replace_callback('#url\((?!data:)(?:\'|")?([^\)\'"]*)(?:\'|")?\)#s', array('Tools', 'replaceByAbsoluteURL'), $css_content, Media::getBackTrackLimit());
|
||||
|
||||
$css_content = preg_replace('#\s+#', ' ', $css_content, Media::getBackTrackLimit());
|
||||
$css_content = str_replace("\t", '', $css_content);
|
||||
$css_content = str_replace("\n", '', $css_content);
|
||||
//$css_content = str_replace('}', "}\n", $css_content);
|
||||
|
||||
$css_content = str_replace('; ', ';', $css_content);
|
||||
$css_content = str_replace(': ', ':', $css_content);
|
||||
$css_content = str_replace(' {', '{', $css_content);
|
||||
$css_content = str_replace('{ ', '{', $css_content);
|
||||
$limit = Media::getBackTrackLimit();
|
||||
$css_content = preg_replace('#/\*.*?\*/#s', '', $css_content, $limit);
|
||||
$css_content = preg_replace_callback('#(url\((?!data:)(?:\'|")?)([^\)\'"]*(?:\'|")?\))#s', array('Tools', 'replaceByAbsoluteURL'), $css_content, $limit);
|
||||
$css_content = preg_replace('#\s+#', ' ', $css_content, $limit);
|
||||
$css_content = str_replace(array("\t", "\n", "\r"), '', $css_content);
|
||||
$css_content = str_replace(array('; ', ': '), array(';', ':'), $css_content);
|
||||
$css_content = str_replace(array(' {', '{ '), '{', $css_content);
|
||||
$css_content = str_replace(', ', ',', $css_content);
|
||||
$css_content = str_replace('} ', '}', $css_content);
|
||||
$css_content = str_replace(' }', '}', $css_content);
|
||||
$css_content = str_replace(';}', '}', $css_content);
|
||||
$css_content = str_replace(':0px', ':0', $css_content);
|
||||
$css_content = str_replace(' 0px', ' 0', $css_content);
|
||||
$css_content = str_replace(':0em', ':0', $css_content);
|
||||
$css_content = str_replace(' 0em', ' 0', $css_content);
|
||||
$css_content = str_replace(':0pt', ':0', $css_content);
|
||||
$css_content = str_replace(' 0pt', ' 0', $css_content);
|
||||
$css_content = str_replace(':0%', ':0', $css_content);
|
||||
$css_content = str_replace(' 0%', ' 0', $css_content);
|
||||
|
||||
$css_content = str_replace(array('} ', ' }', ';}'), '}', $css_content);
|
||||
$css_content = str_replace(array(':0px', ':0em', ':0pt', ':0%'), ':0', $css_content);
|
||||
$css_content = str_replace(array(' 0px', ' 0em', ' 0pt', ' 0%'), ' 0', $css_content);
|
||||
$css_content = str_replace('\'images_ie/', '\'images/', $css_content);
|
||||
$css_content = preg_replace_callback('#(AlphaImageLoader\(src=\')([^\']*\',)#s', array('Tools', 'replaceByAbsoluteURL'), $css_content);
|
||||
|
||||
// Store all import url
|
||||
preg_match_all('#@import .*?;#i', $css_content, $m);
|
||||
for ($i = 0, $total = count($m[0]); $i < $total; $i++)
|
||||
|
||||
+10
-8
@@ -987,7 +987,7 @@ class ToolsCore
|
||||
|
||||
// Remove all non-whitelist chars.
|
||||
if ($allow_accented_chars)
|
||||
$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-\pL]/u', '', $str);
|
||||
$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-\pL]/u', '', $str);
|
||||
else
|
||||
$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-]/','', $str);
|
||||
|
||||
@@ -1288,7 +1288,7 @@ class ToolsCore
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, $curl_timeout);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
$opts = stream_context_get_options($stream_context);
|
||||
if (isset($opts['http']['method']) && Tools::strtolower($opts['http']['method']) == 'post')
|
||||
{
|
||||
@@ -1418,13 +1418,11 @@ class ToolsCore
|
||||
public static function replaceByAbsoluteURL($matches)
|
||||
{
|
||||
global $current_css_file;
|
||||
|
||||
$protocol_link = Tools::getCurrentUrlProtocolPrefix();
|
||||
|
||||
if (array_key_exists(1, $matches))
|
||||
if (array_key_exists(1, $matches) && array_key_exists(2, $matches))
|
||||
{
|
||||
$tmp = dirname($current_css_file).'/'.$matches[1];
|
||||
return 'url(\''.$protocol_link.Tools::getMediaServer($tmp).$tmp.'\')';
|
||||
$tmp = dirname($current_css_file).'/'.$matches[2];
|
||||
return $matches[1].$protocol_link.Tools::getMediaServer($tmp).$tmp;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1621,7 +1619,7 @@ class ToolsCore
|
||||
fwrite($write_fd, $media_domains);
|
||||
fwrite($write_fd, $domain_rewrite_cond);
|
||||
fwrite($write_fd, 'RewriteRule ^'.ltrim($uri['virtual'], '/').'(.*) '.$uri['physical']."$1 [L]\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
if ($rewrite_settings)
|
||||
{
|
||||
@@ -1658,6 +1656,10 @@ class ToolsCore
|
||||
fwrite($write_fd, $domain_rewrite_cond);
|
||||
fwrite($write_fd, 'RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]'."\n");
|
||||
}
|
||||
|
||||
fwrite($write_fd, "# AlphaImageLoader for IE and fancybox\n");
|
||||
fwrite($write_fd, $domain_rewrite_cond);
|
||||
fwrite($write_fd, 'RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]'."\n");
|
||||
}
|
||||
// Redirections to dispatcher
|
||||
if ($rewrite_settings)
|
||||
|
||||
Reference in New Issue
Block a user