Version Description
First of all; Happy holidays, all the best for 2015!!
- New: support for alternative cache-directory and file-prefix as requested by a.o. Jassi Bacha, Cluster666 and Baris Unver.
- Improvement: hard-exclude all linked-data json objects (script type=application/ld+json)
- Improvement: several filters added to the API, e.g. to alter optimized HTML, CSS or JS
- Bugfix: set Autoptimize priority back from 11 to 2 (as previously) to avoid some pages not being optimized (thanks to CaveatLector for investigating & reporting)
- Bugfix (in YUI-CSS-compressor-PHP-port): don't convert bools to percentages in rotate3D-transforms (cfr. bugreport on Github)
- Bugfix: background images with a space in the path didn't load, reported by johnh10.
- Bugfix: SVG image with fill:url broken after CSS optimization as reported by Tkama
- Updated translation for Swedish, new translation for Ukrainian by Zanatoly of SebWeo.com
- Updated readme.txt
- Confirmed working with WordPress 4.1
Download this release
Release Info
Developer | futtta |
Plugin | Autoptimize |
Version | 1.9.2 |
Comparing to | |
See all releases |
Code changes from version 1.9.1 to 1.9.2
- autoptimize.php +17 -10
- classes/autoptimizeCache.php +3 -3
- classes/autoptimizeScripts.php +27 -15
- classes/autoptimizeStyles.php +38 -20
- classes/external/php/yui-php-cssmin-2.4.8-3.php +1 -1
- classes/external/php/yui-php-cssmin-2.4.8-3_fixes.php +777 -0
- localization/autoptimize-sv_SE.mo +0 -0
- localization/autoptimize-sv_SE.po +79 -75
- localization/autoptimize-uk_UA.mo +0 -0
- localization/autoptimize-uk_UA.po +378 -0
- readme.txt +56 -6
autoptimize.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Autoptimize
|
4 |
Plugin URI: http://blog.futtta.be/autoptimize
|
5 |
Description: Optimizes your website, concatenating the CSS and JavaScript code, and compressing it.
|
6 |
-
Version: 1.9.
|
7 |
Author: Frank Goossens (futtta)
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
Domain Path: localization/
|
@@ -23,15 +23,20 @@ define('AUTOPTIMIZE_CACHE_NOGZIP',(bool) get_option('autoptimize_cache_nogzip'))
|
|
23 |
// Load cache class
|
24 |
include(WP_PLUGIN_DIR.'/autoptimize/classes/autoptimizeCache.php');
|
25 |
|
|
|
|
|
|
|
|
|
|
|
26 |
// Plugin dir constants (plugin url's defined later to accomodate domain mapped sites)
|
27 |
if (is_multisite()) {
|
28 |
$blog_id = get_current_blog_id();
|
29 |
-
define('AUTOPTIMIZE_CACHE_DIR' , WP_CONTENT_DIR.
|
30 |
} else {
|
31 |
-
define('AUTOPTIMIZE_CACHE_DIR',WP_CONTENT_DIR.
|
32 |
}
|
33 |
define('AUTOPTIMIZE_CACHE_DELAY',true);
|
34 |
-
define('WP_ROOT_DIR',str_replace(
|
35 |
|
36 |
// Initialize the cache at least once
|
37 |
$conf = autoptimizeConfig::instance();
|
@@ -39,7 +44,7 @@ $conf = autoptimizeConfig::instance();
|
|
39 |
/* Check if we're updating, in which case we might need to do stuff and flush the cache
|
40 |
to avoid old versions of aggregated files lingering around */
|
41 |
|
42 |
-
$autoptimize_version="1.9.
|
43 |
$autoptimize_db_version=get_option('autoptimize_version','none');
|
44 |
|
45 |
if ($autoptimize_db_version !== $autoptimize_version) {
|
@@ -185,7 +190,7 @@ function autoptimize_start_buffering() {
|
|
185 |
}
|
186 |
} else {
|
187 |
if (!class_exists('CSSmin')) {
|
188 |
-
@include(WP_PLUGIN_DIR.'/autoptimize/classes/external/php/yui-php-cssmin-2.4.8-
|
189 |
}
|
190 |
}
|
191 |
define('COMPRESS_CSS',false);
|
@@ -208,13 +213,14 @@ function autoptimize_end_buffering($content) {
|
|
208 |
define('AUTOPTIMIZE_WP_SITE_URL',site_url());
|
209 |
define('AUTOPTIMIZE_WP_CONTENT_URL',content_url());
|
210 |
}
|
|
|
211 |
if ( is_multisite() ) {
|
212 |
$blog_id = get_current_blog_id();
|
213 |
-
define('AUTOPTIMIZE_CACHE_URL'
|
214 |
} else {
|
215 |
-
define('AUTOPTIMIZE_CACHE_URL',AUTOPTIMIZE_WP_CONTENT_URL.
|
216 |
}
|
217 |
-
define('AUTOPTIMIZE_WP_ROOT_URL',str_replace(
|
218 |
|
219 |
// Config element
|
220 |
$conf = autoptimizeConfig::instance();
|
@@ -262,6 +268,7 @@ function autoptimize_end_buffering($content) {
|
|
262 |
}
|
263 |
unset($instance);
|
264 |
}
|
|
|
265 |
return $content;
|
266 |
}
|
267 |
|
@@ -305,7 +312,7 @@ if(autoptimizeCache::cacheavail()) {
|
|
305 |
$conf = autoptimizeConfig::instance();
|
306 |
if( $conf->get('autoptimize_html') || $conf->get('autoptimize_js') || $conf->get('autoptimize_css') || $conf->get('autoptimize_cdn_js') || $conf->get('autoptimize_cdn_css')) {
|
307 |
// Hook to wordpress
|
308 |
-
add_action('template_redirect','autoptimize_start_buffering',
|
309 |
}
|
310 |
}
|
311 |
|
3 |
Plugin Name: Autoptimize
|
4 |
Plugin URI: http://blog.futtta.be/autoptimize
|
5 |
Description: Optimizes your website, concatenating the CSS and JavaScript code, and compressing it.
|
6 |
+
Version: 1.9.2
|
7 |
Author: Frank Goossens (futtta)
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
Domain Path: localization/
|
23 |
// Load cache class
|
24 |
include(WP_PLUGIN_DIR.'/autoptimize/classes/autoptimizeCache.php');
|
25 |
|
26 |
+
// wp-content dir, dirname of AO cache dir and AO-prefix can be overridden in wp-config.php
|
27 |
+
if (!defined('AUTOPTIMIZE_CACHE_CHILD_DIR')) { define('AUTOPTIMIZE_CACHE_CHILD_DIR','/cache/autoptimize/'); }
|
28 |
+
if (!defined('AUTOPTIMIZE_WP_CONTENT_NAME')) { define('AUTOPTIMIZE_WP_CONTENT_NAME','/wp-content'); }
|
29 |
+
if (!defined('AUTOPTIMIZE_CACHEFILE_PREFIX')) { define('AUTOPTIMIZE_CACHEFILE_PREFIX', 'autoptimize_'); }
|
30 |
+
|
31 |
// Plugin dir constants (plugin url's defined later to accomodate domain mapped sites)
|
32 |
if (is_multisite()) {
|
33 |
$blog_id = get_current_blog_id();
|
34 |
+
define('AUTOPTIMIZE_CACHE_DIR' , WP_CONTENT_DIR.AUTOPTIMIZE_CACHE_CHILD_DIR.$blog_id.'/' );
|
35 |
} else {
|
36 |
+
define('AUTOPTIMIZE_CACHE_DIR',WP_CONTENT_DIR.AUTOPTIMIZE_CACHE_CHILD_DIR);
|
37 |
}
|
38 |
define('AUTOPTIMIZE_CACHE_DELAY',true);
|
39 |
+
define('WP_ROOT_DIR',str_replace(AUTOPTIMIZE_WP_CONTENT_NAME,'',WP_CONTENT_DIR));
|
40 |
|
41 |
// Initialize the cache at least once
|
42 |
$conf = autoptimizeConfig::instance();
|
44 |
/* Check if we're updating, in which case we might need to do stuff and flush the cache
|
45 |
to avoid old versions of aggregated files lingering around */
|
46 |
|
47 |
+
$autoptimize_version="1.9.2";
|
48 |
$autoptimize_db_version=get_option('autoptimize_version','none');
|
49 |
|
50 |
if ($autoptimize_db_version !== $autoptimize_version) {
|
190 |
}
|
191 |
} else {
|
192 |
if (!class_exists('CSSmin')) {
|
193 |
+
@include(WP_PLUGIN_DIR.'/autoptimize/classes/external/php/yui-php-cssmin-2.4.8-3_fixes.php');
|
194 |
}
|
195 |
}
|
196 |
define('COMPRESS_CSS',false);
|
213 |
define('AUTOPTIMIZE_WP_SITE_URL',site_url());
|
214 |
define('AUTOPTIMIZE_WP_CONTENT_URL',content_url());
|
215 |
}
|
216 |
+
|
217 |
if ( is_multisite() ) {
|
218 |
$blog_id = get_current_blog_id();
|
219 |
+
define('AUTOPTIMIZE_CACHE_URL',AUTOPTIMIZE_WP_CONTENT_URL.AUTOPTIMIZE_CACHE_CHILD_DIR.$blog_id.'/' );
|
220 |
} else {
|
221 |
+
define('AUTOPTIMIZE_CACHE_URL',AUTOPTIMIZE_WP_CONTENT_URL.AUTOPTIMIZE_CACHE_CHILD_DIR);
|
222 |
}
|
223 |
+
define('AUTOPTIMIZE_WP_ROOT_URL',str_replace(AUTOPTIMIZE_WP_CONTENT_NAME,'',AUTOPTIMIZE_WP_CONTENT_URL));
|
224 |
|
225 |
// Config element
|
226 |
$conf = autoptimizeConfig::instance();
|
268 |
}
|
269 |
unset($instance);
|
270 |
}
|
271 |
+
$content = apply_filters( 'autoptimize_html_after_minify', $content );
|
272 |
return $content;
|
273 |
}
|
274 |
|
312 |
$conf = autoptimizeConfig::instance();
|
313 |
if( $conf->get('autoptimize_html') || $conf->get('autoptimize_js') || $conf->get('autoptimize_css') || $conf->get('autoptimize_cdn_js') || $conf->get('autoptimize_cdn_css')) {
|
314 |
// Hook to wordpress
|
315 |
+
add_action('template_redirect','autoptimize_start_buffering',2);
|
316 |
}
|
317 |
}
|
318 |
|
classes/autoptimizeCache.php
CHANGED
@@ -12,12 +12,12 @@ class autoptimizeCache {
|
|
12 |
$this->delayed = AUTOPTIMIZE_CACHE_DELAY;
|
13 |
$this->nogzip = AUTOPTIMIZE_CACHE_NOGZIP;
|
14 |
if($this->nogzip == false) {
|
15 |
-
$this->filename =
|
16 |
} else {
|
17 |
if (in_array($ext, array("js","css"))) {
|
18 |
-
$this->filename = $ext.'/
|
19 |
} else {
|
20 |
-
$this->filename = '/
|
21 |
}
|
22 |
}
|
23 |
}
|
12 |
$this->delayed = AUTOPTIMIZE_CACHE_DELAY;
|
13 |
$this->nogzip = AUTOPTIMIZE_CACHE_NOGZIP;
|
14 |
if($this->nogzip == false) {
|
15 |
+
$this->filename = AUTOPTIMIZE_CACHEFILE_PREFIX.$md5.'.php';
|
16 |
} else {
|
17 |
if (in_array($ext, array("js","css"))) {
|
18 |
+
$this->filename = $ext.'/'.AUTOPTIMIZE_CACHEFILE_PREFIX.$md5.'.'.$ext;
|
19 |
} else {
|
20 |
+
$this->filename = '/'.AUTOPTIMIZE_CACHEFILE_PREFIX.$md5.'.'.$ext;
|
21 |
}
|
22 |
}
|
23 |
}
|
classes/autoptimizeScripts.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
|
4 |
-
class autoptimizeScripts extends autoptimizeBase
|
5 |
-
{
|
6 |
private $scripts = array();
|
7 |
-
private $dontmove = array('document.write','html5.js','show_ads.js','google_ad','blogcatalog.com/w','tweetmeme.com/i','mybloglog.com/','histats.com/js','ads.smowtion.com/ad.js','statcounter.com/counter/counter.js','widgets.amung.us','ws.amazon.com/widgets','media.fastclick.net','/ads/','comment-form-quicktags/quicktags.php','edToolbar','intensedebate.com','scripts.chitika.net/','_gaq.push','jotform.com/','admin-bar.min.js','GoogleAnalyticsObject','plupload.full.min.js','syntaxhighlighter','adsbygoogle','
|
8 |
private $domove = array('gaJsHost','load_cmc','jd.gallery.transitions.js','swfobject.embedSWF(','tiny_mce.js','tinyMCEPreInit.go');
|
9 |
private $domovelast = array('addthis.com','/afsonline/show_afs_search.js','disqus.js','networkedblogs.com/getnetworkwidget','infolinks.com/js/','jd.gallery.js.php','jd.gallery.transitions.js','swfobject.embedSWF(','linkwithin.com/widget.js','tiny_mce.js','tinyMCEPreInit.go');
|
10 |
private $trycatch = false;
|
|
|
11 |
private $forcehead = false;
|
12 |
private $jscode = '';
|
13 |
private $url = '';
|
@@ -16,11 +16,9 @@ class autoptimizeScripts extends autoptimizeBase
|
|
16 |
private $md5hash = '';
|
17 |
|
18 |
//Reads the page and collects script tags
|
19 |
-
public function read($options)
|
20 |
-
{
|
21 |
//Remove everything that's not the header
|
22 |
-
if($options['justhead'] == true)
|
23 |
-
{
|
24 |
$content = explode('</head>',$this->content,2);
|
25 |
$this->content = $content[0].'</head>';
|
26 |
$this->restofcontent = $content[1];
|
@@ -144,18 +142,28 @@ class autoptimizeScripts extends autoptimizeBase
|
|
144 |
if($this->trycatch) {
|
145 |
$script = 'try{'.$script.'}catch(e){}';
|
146 |
}
|
|
|
|
|
|
|
|
|
|
|
147 |
$this->jscode .= "\n" . $script;
|
148 |
} else {
|
149 |
//External script
|
150 |
if($script !== false && file_exists($script) && is_readable($script)) {
|
151 |
-
$
|
152 |
-
$
|
153 |
-
$
|
154 |
//Add try-catch?
|
155 |
if($this->trycatch) {
|
156 |
-
$
|
|
|
|
|
|
|
|
|
|
|
157 |
}
|
158 |
-
$this->jscode .= "\n".$
|
159 |
}/*else{
|
160 |
//Couldn't read JS. Maybe getpath isn't working?
|
161 |
}*/
|
@@ -171,10 +179,12 @@ class autoptimizeScripts extends autoptimizeBase
|
|
171 |
}
|
172 |
unset($ccheck);
|
173 |
|
174 |
-
//$this->jscode has all the uncompressed code now.
|
175 |
-
if
|
|
|
176 |
if (@is_callable(array(new JSMin,"minify"))) {
|
177 |
$tmp_jscode = trim(JSMin::minify($this->jscode));
|
|
|
178 |
if (!empty($tmp_jscode)) {
|
179 |
$this->jscode = $tmp_jscode;
|
180 |
unset($tmp_jscode);
|
@@ -183,9 +193,11 @@ class autoptimizeScripts extends autoptimizeBase
|
|
183 |
} else {
|
184 |
return false;
|
185 |
}
|
186 |
-
|
187 |
return false;
|
|
|
188 |
}
|
|
|
189 |
}
|
190 |
|
191 |
//Caches the JS in uncompressed, deflated and gzipped form.
|
1 |
<?php
|
2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
|
4 |
+
class autoptimizeScripts extends autoptimizeBase {
|
|
|
5 |
private $scripts = array();
|
6 |
+
private $dontmove = array('document.write','html5.js','show_ads.js','google_ad','blogcatalog.com/w','tweetmeme.com/i','mybloglog.com/','histats.com/js','ads.smowtion.com/ad.js','statcounter.com/counter/counter.js','widgets.amung.us','ws.amazon.com/widgets','media.fastclick.net','/ads/','comment-form-quicktags/quicktags.php','edToolbar','intensedebate.com','scripts.chitika.net/','_gaq.push','jotform.com/','admin-bar.min.js','GoogleAnalyticsObject','plupload.full.min.js','syntaxhighlighter','adsbygoogle','application/ld+json');
|
7 |
private $domove = array('gaJsHost','load_cmc','jd.gallery.transitions.js','swfobject.embedSWF(','tiny_mce.js','tinyMCEPreInit.go');
|
8 |
private $domovelast = array('addthis.com','/afsonline/show_afs_search.js','disqus.js','networkedblogs.com/getnetworkwidget','infolinks.com/js/','jd.gallery.js.php','jd.gallery.transitions.js','swfobject.embedSWF(','linkwithin.com/widget.js','tiny_mce.js','tinyMCEPreInit.go');
|
9 |
private $trycatch = false;
|
10 |
+
private $alreadyminified = false;
|
11 |
private $forcehead = false;
|
12 |
private $jscode = '';
|
13 |
private $url = '';
|
16 |
private $md5hash = '';
|
17 |
|
18 |
//Reads the page and collects script tags
|
19 |
+
public function read($options) {
|
|
|
20 |
//Remove everything that's not the header
|
21 |
+
if($options['justhead'] == true) {
|
|
|
22 |
$content = explode('</head>',$this->content,2);
|
23 |
$this->content = $content[0].'</head>';
|
24 |
$this->restofcontent = $content[1];
|
142 |
if($this->trycatch) {
|
143 |
$script = 'try{'.$script.'}catch(e){}';
|
144 |
}
|
145 |
+
$tmpscript = apply_filters( 'autoptimize_js_individual_script', $script, "" );
|
146 |
+
if ($tmpscript!==$script && !empty($tmpscript)) {
|
147 |
+
$script=$tmpscript;
|
148 |
+
$this->alreadyminified=true;
|
149 |
+
}
|
150 |
$this->jscode .= "\n" . $script;
|
151 |
} else {
|
152 |
//External script
|
153 |
if($script !== false && file_exists($script) && is_readable($script)) {
|
154 |
+
$scriptsrc = file_get_contents($script);
|
155 |
+
$scriptsrc = preg_replace('/\x{EF}\x{BB}\x{BF}/','',$scriptsrc);
|
156 |
+
$scriptsrc = rtrim($scriptsrc,";\n\t\r").';';
|
157 |
//Add try-catch?
|
158 |
if($this->trycatch) {
|
159 |
+
$scriptsrc = 'try{'.$scriptsrc.'}catch(e){}';
|
160 |
+
}
|
161 |
+
$tmpscriptsrc = apply_filters( 'autoptimize_js_individual_script', $scriptsrc, $script );
|
162 |
+
if ($tmpscriptsrc!==$scriptsrc && !empty($tmpscriptsrc)) {
|
163 |
+
$scriptsrc=$tmpscriptsrc;
|
164 |
+
$this->alreadyminified=true;
|
165 |
}
|
166 |
+
$this->jscode .= "\n".$scriptsrc;
|
167 |
}/*else{
|
168 |
//Couldn't read JS. Maybe getpath isn't working?
|
169 |
}*/
|
179 |
}
|
180 |
unset($ccheck);
|
181 |
|
182 |
+
//$this->jscode has all the uncompressed code now.
|
183 |
+
if ($this->alreadyminified!==true) {
|
184 |
+
if (class_exists('JSMin') && apply_filters( 'autoptimize_js_do_minify' , true)) {
|
185 |
if (@is_callable(array(new JSMin,"minify"))) {
|
186 |
$tmp_jscode = trim(JSMin::minify($this->jscode));
|
187 |
+
$tmp_jscode = apply_filters( 'autoptimize_js_after_minify', $tmp_jscode );
|
188 |
if (!empty($tmp_jscode)) {
|
189 |
$this->jscode = $tmp_jscode;
|
190 |
unset($tmp_jscode);
|
193 |
} else {
|
194 |
return false;
|
195 |
}
|
196 |
+
} else {
|
197 |
return false;
|
198 |
+
}
|
199 |
}
|
200 |
+
return true;
|
201 |
}
|
202 |
|
203 |
//Caches the JS in uncompressed, deflated and gzipped form.
|
classes/autoptimizeStyles.php
CHANGED
@@ -9,6 +9,7 @@ class autoptimizeStyles extends autoptimizeBase {
|
|
9 |
private $mhtml = '';
|
10 |
private $datauris = false;
|
11 |
private $hashmap = array();
|
|
|
12 |
|
13 |
//Reads the page and collects style tags
|
14 |
public function read($options) {
|
@@ -76,20 +77,20 @@ class autoptimizeStyles extends autoptimizeBase {
|
|
76 |
$media[] = $elem;
|
77 |
}
|
78 |
} else {
|
79 |
-
//No media specified - applies to all
|
80 |
$media = array('all');
|
81 |
}
|
82 |
|
83 |
if(preg_match('#<link.*href=("|\')(.*)("|\')#Usmi',$tag,$source)) {
|
84 |
-
|
85 |
$url = current(explode('?',$source[2],2));
|
86 |
$path = $this->getpath($url);
|
87 |
|
88 |
-
if($path
|
89 |
-
//Good link
|
90 |
$this->css[] = array($media,$path);
|
91 |
}else{
|
92 |
-
//Link is dynamic (.php etc)
|
93 |
$tag = '';
|
94 |
}
|
95 |
} else {
|
@@ -108,7 +109,7 @@ class autoptimizeStyles extends autoptimizeBase {
|
|
108 |
}
|
109 |
}
|
110 |
|
111 |
-
//Remove the original style tag
|
112 |
$this->content = str_replace($tag,'',$this->content);
|
113 |
}
|
114 |
}
|
@@ -123,16 +124,27 @@ class autoptimizeStyles extends autoptimizeBase {
|
|
123 |
foreach($this->css as $group) {
|
124 |
list($media,$css) = $group;
|
125 |
if(preg_match('#^INLINE;#',$css)) {
|
126 |
-
|
127 |
$css = preg_replace('#^INLINE;#','',$css);
|
128 |
$css = $this->fixurls(ABSPATH.'/index.php',$css);
|
|
|
|
|
|
|
|
|
|
|
129 |
} else {
|
130 |
//<link>
|
131 |
if($css !== false && file_exists($css) && is_readable($css)) {
|
|
|
132 |
$css = $this->fixurls($css,file_get_contents($css));
|
133 |
$css = preg_replace('/\x{EF}\x{BB}\x{BF}/','',$css);
|
|
|
|
|
|
|
|
|
|
|
134 |
} else {
|
135 |
-
//Couldn't read CSS. Maybe getpath isn't working?
|
136 |
$css = '';
|
137 |
}
|
138 |
}
|
@@ -151,7 +163,7 @@ class autoptimizeStyles extends autoptimizeBase {
|
|
151 |
$md5sum = md5($code);
|
152 |
$medianame = $media;
|
153 |
foreach($md5list as $med => $sum) {
|
154 |
-
//If same code
|
155 |
if($sum === $md5sum) {
|
156 |
//Add the merged code
|
157 |
$medianame = $med.', '.$media;
|
@@ -165,7 +177,7 @@ class autoptimizeStyles extends autoptimizeBase {
|
|
165 |
}
|
166 |
unset($tmpcss);
|
167 |
|
168 |
-
//Manage @imports, while is for recursive import management
|
169 |
foreach ($this->csscode as &$thiscss) {
|
170 |
// Flag to trigger import reconstitution and var to hold external imports
|
171 |
$fiximports = false;
|
@@ -179,6 +191,11 @@ class autoptimizeStyles extends autoptimizeBase {
|
|
179 |
if (file_exists($path) && is_readable($path)) {
|
180 |
$code = addcslashes($this->fixurls($path,file_get_contents($path)),"\\");
|
181 |
$code = preg_replace('/\x{EF}\x{BB}\x{BF}/','',$code);
|
|
|
|
|
|
|
|
|
|
|
182 |
if(!empty($code)) {
|
183 |
$tmp_thiscss = preg_replace('#(/\*FILESTART\*/.*)'.preg_quote($import,'#').'#Us','/*FILESTART2*/'.$code.'$1',$thiscss);
|
184 |
if (!empty($tmp_thiscss)) {
|
@@ -287,10 +304,10 @@ class autoptimizeStyles extends autoptimizeBase {
|
|
287 |
}
|
288 |
unset($icheck);
|
289 |
|
290 |
-
//Add it to the list for replacement
|
291 |
$imgreplace[$matches[1][$count]] = str_replace($quotedurl,$headAndData,$matches[1][$count]).";\n*".str_replace($quotedurl,'mhtml:%%MHTML%%!'.$mhtmlcount,$matches[1][$count]).";\n_".$matches[1][$count].';';
|
292 |
|
293 |
-
//Store image on the mhtml document
|
294 |
$this->mhtml .= "--_\r\nContent-Location:{$mhtmlcount}\r\nContent-Transfer-Encoding:base64\r\n\r\n{$base64data}\r\n";
|
295 |
$mhtmlcount++;
|
296 |
}
|
@@ -308,8 +325,8 @@ class autoptimizeStyles extends autoptimizeBase {
|
|
308 |
$code = str_replace(array_keys($imgreplace),array_values($imgreplace),$code);
|
309 |
}
|
310 |
|
311 |
-
//Minify
|
312 |
-
if (apply_filters( "autoptimize_css_do_minify", true)) {
|
313 |
if (class_exists('Minify_CSS_Compressor')) {
|
314 |
$tmp_code = trim(Minify_CSS_Compressor::process($code));
|
315 |
} else if(class_exists('CSSmin')) {
|
@@ -320,7 +337,7 @@ class autoptimizeStyles extends autoptimizeBase {
|
|
320 |
$tmp_code = trim(CssMin::minify($code));
|
321 |
}
|
322 |
}
|
323 |
-
|
324 |
if (!empty($tmp_code)) {
|
325 |
$code = $tmp_code;
|
326 |
unset($tmp_code);
|
@@ -335,19 +352,19 @@ class autoptimizeStyles extends autoptimizeBase {
|
|
335 |
|
336 |
//Caches the CSS in uncompressed, deflated and gzipped form.
|
337 |
public function cache() {
|
338 |
-
if($this->datauris)
|
339 |
// MHTML Preparation
|
340 |
$this->mhtml = "/*\r\nContent-Type: multipart/related; boundary=\"_\"\r\n\r\n".$this->mhtml."*/\r\n";
|
341 |
$md5 = md5($this->mhtml);
|
342 |
$cache = new autoptimizeCache($md5,'txt');
|
343 |
if(!$cache->check()) {
|
344 |
-
//Cache our images for IE
|
345 |
$cache->cache($this->mhtml,'text/plain');
|
346 |
}
|
347 |
$mhtml = AUTOPTIMIZE_CACHE_URL.$cache->getname();
|
348 |
}
|
349 |
|
350 |
-
//CSS cache
|
351 |
foreach($this->csscode as $media => $code) {
|
352 |
$md5 = $this->hashmap[md5($code)];
|
353 |
|
@@ -465,7 +482,7 @@ class autoptimizeStyles extends autoptimizeBase {
|
|
465 |
// quick fix for import-troubles in e.g. arras theme
|
466 |
$code=preg_replace('#@import ("|\')(.+?)\.css("|\')#','@import url("${2}.css")',$code);
|
467 |
|
468 |
-
if(preg_match_all('#url\((?!data)(.*)\)#Usi',$code,$matches)) {
|
469 |
$replace = array();
|
470 |
foreach($matches[1] as $k => $url) {
|
471 |
// Remove quotes
|
@@ -482,7 +499,8 @@ class autoptimizeStyles extends autoptimizeBase {
|
|
482 |
continue;
|
483 |
} else {
|
484 |
// relative URL
|
485 |
-
$newurl = preg_replace('/https?:/','',AUTOPTIMIZE_WP_ROOT_URL.str_replace('//','/',$dir.'/'.$url));
|
|
|
486 |
$hash = md5($url);
|
487 |
$code = str_replace($matches[0][$k],$hash,$code);
|
488 |
|
9 |
private $mhtml = '';
|
10 |
private $datauris = false;
|
11 |
private $hashmap = array();
|
12 |
+
private $alreadyminified = false;
|
13 |
|
14 |
//Reads the page and collects style tags
|
15 |
public function read($options) {
|
77 |
$media[] = $elem;
|
78 |
}
|
79 |
} else {
|
80 |
+
// No media specified - applies to all
|
81 |
$media = array('all');
|
82 |
}
|
83 |
|
84 |
if(preg_match('#<link.*href=("|\')(.*)("|\')#Usmi',$tag,$source)) {
|
85 |
+
// <link>
|
86 |
$url = current(explode('?',$source[2],2));
|
87 |
$path = $this->getpath($url);
|
88 |
|
89 |
+
if($path!==false && preg_match('#\.css$#',$path)) {
|
90 |
+
// Good link
|
91 |
$this->css[] = array($media,$path);
|
92 |
}else{
|
93 |
+
// Link is dynamic (.php etc)
|
94 |
$tag = '';
|
95 |
}
|
96 |
} else {
|
109 |
}
|
110 |
}
|
111 |
|
112 |
+
// Remove the original style tag
|
113 |
$this->content = str_replace($tag,'',$this->content);
|
114 |
}
|
115 |
}
|
124 |
foreach($this->css as $group) {
|
125 |
list($media,$css) = $group;
|
126 |
if(preg_match('#^INLINE;#',$css)) {
|
127 |
+
// <style>
|
128 |
$css = preg_replace('#^INLINE;#','',$css);
|
129 |
$css = $this->fixurls(ABSPATH.'/index.php',$css);
|
130 |
+
$tmpstyle = apply_filters( 'autoptimize_css_individual_style', $css, "" );
|
131 |
+
if ($tmpstyle!==$css && !empty($tmpstyle)) {
|
132 |
+
$css=$tmpstyle;
|
133 |
+
$this->alreadyminified=true;
|
134 |
+
}
|
135 |
} else {
|
136 |
//<link>
|
137 |
if($css !== false && file_exists($css) && is_readable($css)) {
|
138 |
+
$cssPath = $css;
|
139 |
$css = $this->fixurls($css,file_get_contents($css));
|
140 |
$css = preg_replace('/\x{EF}\x{BB}\x{BF}/','',$css);
|
141 |
+
$tmpstyle = apply_filters( 'autoptimize_css_individual_style', $css, $cssPath );
|
142 |
+
if ($tmpstyle!==$css && !empty($tmpstyle)) {
|
143 |
+
$css=$tmpstyle;
|
144 |
+
$this->alreadyminified=true;
|
145 |
+
}
|
146 |
} else {
|
147 |
+
// Couldn't read CSS. Maybe getpath isn't working?
|
148 |
$css = '';
|
149 |
}
|
150 |
}
|
163 |
$md5sum = md5($code);
|
164 |
$medianame = $media;
|
165 |
foreach($md5list as $med => $sum) {
|
166 |
+
// If same code
|
167 |
if($sum === $md5sum) {
|
168 |
//Add the merged code
|
169 |
$medianame = $med.', '.$media;
|
177 |
}
|
178 |
unset($tmpcss);
|
179 |
|
180 |
+
// Manage @imports, while is for recursive import management
|
181 |
foreach ($this->csscode as &$thiscss) {
|
182 |
// Flag to trigger import reconstitution and var to hold external imports
|
183 |
$fiximports = false;
|
191 |
if (file_exists($path) && is_readable($path)) {
|
192 |
$code = addcslashes($this->fixurls($path,file_get_contents($path)),"\\");
|
193 |
$code = preg_replace('/\x{EF}\x{BB}\x{BF}/','',$code);
|
194 |
+
$tmpstyle = apply_filters( 'autoptimize_css_individual_style', $code, "" );
|
195 |
+
if ($tmpstyle!==$code && !empty($tmpstyle)) {
|
196 |
+
$code=$tmpstyle;
|
197 |
+
$this->alreadyminified=true;
|
198 |
+
}
|
199 |
if(!empty($code)) {
|
200 |
$tmp_thiscss = preg_replace('#(/\*FILESTART\*/.*)'.preg_quote($import,'#').'#Us','/*FILESTART2*/'.$code.'$1',$thiscss);
|
201 |
if (!empty($tmp_thiscss)) {
|
304 |
}
|
305 |
unset($icheck);
|
306 |
|
307 |
+
// Add it to the list for replacement
|
308 |
$imgreplace[$matches[1][$count]] = str_replace($quotedurl,$headAndData,$matches[1][$count]).";\n*".str_replace($quotedurl,'mhtml:%%MHTML%%!'.$mhtmlcount,$matches[1][$count]).";\n_".$matches[1][$count].';';
|
309 |
|
310 |
+
// Store image on the mhtml document
|
311 |
$this->mhtml .= "--_\r\nContent-Location:{$mhtmlcount}\r\nContent-Transfer-Encoding:base64\r\n\r\n{$base64data}\r\n";
|
312 |
$mhtmlcount++;
|
313 |
}
|
325 |
$code = str_replace(array_keys($imgreplace),array_values($imgreplace),$code);
|
326 |
}
|
327 |
|
328 |
+
// Minify
|
329 |
+
if (($this->already_minified!==true) && (apply_filters( "autoptimize_css_do_minify", true))) {
|
330 |
if (class_exists('Minify_CSS_Compressor')) {
|
331 |
$tmp_code = trim(Minify_CSS_Compressor::process($code));
|
332 |
} else if(class_exists('CSSmin')) {
|
337 |
$tmp_code = trim(CssMin::minify($code));
|
338 |
}
|
339 |
}
|
340 |
+
$tmp_code = apply_filters( 'autoptimize_css_after_minify',$tmp_code );
|
341 |
if (!empty($tmp_code)) {
|
342 |
$code = $tmp_code;
|
343 |
unset($tmp_code);
|
352 |
|
353 |
//Caches the CSS in uncompressed, deflated and gzipped form.
|
354 |
public function cache() {
|
355 |
+
if($this->datauris) {
|
356 |
// MHTML Preparation
|
357 |
$this->mhtml = "/*\r\nContent-Type: multipart/related; boundary=\"_\"\r\n\r\n".$this->mhtml."*/\r\n";
|
358 |
$md5 = md5($this->mhtml);
|
359 |
$cache = new autoptimizeCache($md5,'txt');
|
360 |
if(!$cache->check()) {
|
361 |
+
// Cache our images for IE
|
362 |
$cache->cache($this->mhtml,'text/plain');
|
363 |
}
|
364 |
$mhtml = AUTOPTIMIZE_CACHE_URL.$cache->getname();
|
365 |
}
|
366 |
|
367 |
+
// CSS cache
|
368 |
foreach($this->csscode as $media => $code) {
|
369 |
$md5 = $this->hashmap[md5($code)];
|
370 |
|
482 |
// quick fix for import-troubles in e.g. arras theme
|
483 |
$code=preg_replace('#@import ("|\')(.+?)\.css("|\')#','@import url("${2}.css")',$code);
|
484 |
|
485 |
+
if(preg_match_all('#url\((?!data)(?!\#)(.*)\)#Usi',$code,$matches)) {
|
486 |
$replace = array();
|
487 |
foreach($matches[1] as $k => $url) {
|
488 |
// Remove quotes
|
499 |
continue;
|
500 |
} else {
|
501 |
// relative URL
|
502 |
+
$newurl = preg_replace('/https?:/','',str_replace(" ","%20",AUTOPTIMIZE_WP_ROOT_URL.str_replace('//','/',$dir.'/'.$url)));
|
503 |
+
|
504 |
$hash = md5($url);
|
505 |
$code = str_replace($matches[0][$k],$hash,$code);
|
506 |
|
classes/external/php/yui-php-cssmin-2.4.8-3.php
CHANGED
@@ -774,4 +774,4 @@ class CSSmin
|
|
774 |
|
775 |
return (int) $size;
|
776 |
}
|
777 |
-
}
|
774 |
|
775 |
return (int) $size;
|
776 |
}
|
777 |
+
}
|
classes/external/php/yui-php-cssmin-2.4.8-3_fixes.php
ADDED
@@ -0,0 +1,777 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*!
|
4 |
+
* cssmin.php 2.4.8-3
|
5 |
+
* Author: Tubal Martin - http://tubalmartin.me/
|
6 |
+
* Repo: https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port
|
7 |
+
*
|
8 |
+
* This is a PHP port of the CSS minification tool distributed with YUICompressor,
|
9 |
+
* itself a port of the cssmin utility by Isaac Schlueter - http://foohack.com/
|
10 |
+
* Permission is hereby granted to use the PHP version under the same
|
11 |
+
* conditions as the YUICompressor.
|
12 |
+
*/
|
13 |
+
|
14 |
+
/*!
|
15 |
+
* YUI Compressor
|
16 |
+
* http://developer.yahoo.com/yui/compressor/
|
17 |
+
* Author: Julien Lecomte - http://www.julienlecomte.net/
|
18 |
+
* Copyright (c) 2013 Yahoo! Inc. All rights reserved.
|
19 |
+
* The copyrights embodied in the content of this file are licensed
|
20 |
+
* by Yahoo! Inc. under the BSD (revised) open source license.
|
21 |
+
*/
|
22 |
+
|
23 |
+
class CSSmin
|
24 |
+
{
|
25 |
+
const NL = '___YUICSSMIN_PRESERVED_NL___';
|
26 |
+
const TOKEN = '___YUICSSMIN_PRESERVED_TOKEN_';
|
27 |
+
const COMMENT = '___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_';
|
28 |
+
const CLASSCOLON = '___YUICSSMIN_PSEUDOCLASSCOLON___';
|
29 |
+
const QUERY_FRACTION = '___YUICSSMIN_QUERY_FRACTION___';
|
30 |
+
|
31 |
+
private $comments;
|
32 |
+
private $preserved_tokens;
|
33 |
+
private $memory_limit;
|
34 |
+
private $max_execution_time;
|
35 |
+
private $pcre_backtrack_limit;
|
36 |
+
private $pcre_recursion_limit;
|
37 |
+
private $raise_php_limits;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @param bool|int $raise_php_limits
|
41 |
+
* If true, PHP settings will be raised if needed
|
42 |
+
*/
|
43 |
+
public function __construct($raise_php_limits = TRUE)
|
44 |
+
{
|
45 |
+
// Set suggested PHP limits
|
46 |
+
$this->memory_limit = 128 * 1048576; // 128MB in bytes
|
47 |
+
$this->max_execution_time = 60; // 1 min
|
48 |
+
$this->pcre_backtrack_limit = 1000 * 1000;
|
49 |
+
$this->pcre_recursion_limit = 500 * 1000;
|
50 |
+
|
51 |
+
$this->raise_php_limits = (bool) $raise_php_limits;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Minify a string of CSS
|
56 |
+
* @param string $css
|
57 |
+
* @param int|bool $linebreak_pos
|
58 |
+
* @return string
|
59 |
+
*/
|
60 |
+
public function run($css = '', $linebreak_pos = FALSE)
|
61 |
+
{
|
62 |
+
if (empty($css)) {
|
63 |
+
return '';
|
64 |
+
}
|
65 |
+
|
66 |
+
if ($this->raise_php_limits) {
|
67 |
+
$this->do_raise_php_limits();
|
68 |
+
}
|
69 |
+
|
70 |
+
$this->comments = array();
|
71 |
+
$this->preserved_tokens = array();
|
72 |
+
|
73 |
+
$start_index = 0;
|
74 |
+
$length = strlen($css);
|
75 |
+
|
76 |
+
$css = $this->extract_data_urls($css);
|
77 |
+
|
78 |
+
// collect all comment blocks...
|
79 |
+
while (($start_index = $this->index_of($css, '/*', $start_index)) >= 0) {
|
80 |
+
$end_index = $this->index_of($css, '*/', $start_index + 2);
|
81 |
+
if ($end_index < 0) {
|
82 |
+
$end_index = $length;
|
83 |
+
}
|
84 |
+
$comment_found = $this->str_slice($css, $start_index + 2, $end_index);
|
85 |
+
$this->comments[] = $comment_found;
|
86 |
+
$comment_preserve_string = self::COMMENT . (count($this->comments) - 1) . '___';
|
87 |
+
$css = $this->str_slice($css, 0, $start_index + 2) . $comment_preserve_string . $this->str_slice($css, $end_index);
|
88 |
+
// Set correct start_index: Fixes issue #2528130
|
89 |
+
$start_index = $end_index + 2 + strlen($comment_preserve_string) - strlen($comment_found);
|
90 |
+
}
|
91 |
+
|
92 |
+
// preserve strings so their content doesn't get accidentally minified
|
93 |
+
$css = preg_replace_callback('/(?:"(?:[^\\\\"]|\\\\.|\\\\)*")|'."(?:'(?:[^\\\\']|\\\\.|\\\\)*')/S", array($this, 'replace_string'), $css);
|
94 |
+
|
95 |
+
// Let's divide css code in chunks of 5.000 chars aprox.
|
96 |
+
// Reason: PHP's PCRE functions like preg_replace have a "backtrack limit"
|
97 |
+
// of 100.000 chars by default (php < 5.3.7) so if we're dealing with really
|
98 |
+
// long strings and a (sub)pattern matches a number of chars greater than
|
99 |
+
// the backtrack limit number (i.e. /(.*)/s) PCRE functions may fail silently
|
100 |
+
// returning NULL and $css would be empty.
|
101 |
+
$charset = '';
|
102 |
+
$charset_regexp = '/(@charset)( [^;]+;)/i';
|
103 |
+
$css_chunks = array();
|
104 |
+
$css_chunk_length = 5000; // aprox size, not exact
|
105 |
+
$start_index = 0;
|
106 |
+
$i = $css_chunk_length; // save initial iterations
|
107 |
+
$l = strlen($css);
|
108 |
+
|
109 |
+
|
110 |
+
// if the number of characters is 5000 or less, do not chunk
|
111 |
+
if ($l <= $css_chunk_length) {
|
112 |
+
$css_chunks[] = $css;
|
113 |
+
} else {
|
114 |
+
// chunk css code securely
|
115 |
+
while ($i < $l) {
|
116 |
+
$i += 50; // save iterations
|
117 |
+
if ($l - $start_index <= $css_chunk_length || $i >= $l) {
|
118 |
+
$css_chunks[] = $this->str_slice($css, $start_index);
|
119 |
+
break;
|
120 |
+
}
|
121 |
+
if ($css[$i - 1] === '}' && $i - $start_index > $css_chunk_length) {
|
122 |
+
// If there are two ending curly braces }} separated or not by spaces,
|
123 |
+
// join them in the same chunk (i.e. @media blocks)
|
124 |
+
$next_chunk = substr($css, $i);
|
125 |
+
if (preg_match('/^\s*\}/', $next_chunk)) {
|
126 |
+
$i = $i + $this->index_of($next_chunk, '}') + 1;
|
127 |
+
}
|
128 |
+
|
129 |
+
$css_chunks[] = $this->str_slice($css, $start_index, $i);
|
130 |
+
$start_index = $i;
|
131 |
+
}
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
// Minify each chunk
|
136 |
+
for ($i = 0, $n = count($css_chunks); $i < $n; $i++) {
|
137 |
+
$css_chunks[$i] = $this->minify($css_chunks[$i], $linebreak_pos);
|
138 |
+
// Keep the first @charset at-rule found
|
139 |
+
if (empty($charset) && preg_match($charset_regexp, $css_chunks[$i], $matches)) {
|
140 |
+
$charset = strtolower($matches[1]) . $matches[2];
|
141 |
+
}
|
142 |
+
// Delete all @charset at-rules
|
143 |
+
$css_chunks[$i] = preg_replace($charset_regexp, '', $css_chunks[$i]);
|
144 |
+
}
|
145 |
+
|
146 |
+
// Update the first chunk and push the charset to the top of the file.
|
147 |
+
$css_chunks[0] = $charset . $css_chunks[0];
|
148 |
+
|
149 |
+
return implode('', $css_chunks);
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Sets the memory limit for this script
|
154 |
+
* @param int|string $limit
|
155 |
+
*/
|
156 |
+
public function set_memory_limit($limit)
|
157 |
+
{
|
158 |
+
$this->memory_limit = $this->normalize_int($limit);
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Sets the maximum execution time for this script
|
163 |
+
* @param int|string $seconds
|
164 |
+
*/
|
165 |
+
public function set_max_execution_time($seconds)
|
166 |
+
{
|
167 |
+
$this->max_execution_time = (int) $seconds;
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Sets the PCRE backtrack limit for this script
|
172 |
+
* @param int $limit
|
173 |
+
*/
|
174 |
+
public function set_pcre_backtrack_limit($limit)
|
175 |
+
{
|
176 |
+
$this->pcre_backtrack_limit = (int) $limit;
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Sets the PCRE recursion limit for this script
|
181 |
+
* @param int $limit
|
182 |
+
*/
|
183 |
+
public function set_pcre_recursion_limit($limit)
|
184 |
+
{
|
185 |
+
$this->pcre_recursion_limit = (int) $limit;
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Try to configure PHP to use at least the suggested minimum settings
|
190 |
+
*/
|
191 |
+
private function do_raise_php_limits()
|
192 |
+
{
|
193 |
+
$php_limits = array(
|
194 |
+
'memory_limit' => $this->memory_limit,
|
195 |
+
'max_execution_time' => $this->max_execution_time,
|
196 |
+
'pcre.backtrack_limit' => $this->pcre_backtrack_limit,
|
197 |
+
'pcre.recursion_limit' => $this->pcre_recursion_limit
|
198 |
+
);
|
199 |
+
|
200 |
+
// If current settings are higher respect them.
|
201 |
+
foreach ($php_limits as $name => $suggested) {
|
202 |
+
$current = $this->normalize_int(ini_get($name));
|
203 |
+
// memory_limit exception: allow -1 for "no memory limit".
|
204 |
+
if ($current > -1 && ($suggested == -1 || $current < $suggested)) {
|
205 |
+
ini_set($name, $suggested);
|
206 |
+
}
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Does bulk of the minification
|
212 |
+
* @param string $css
|
213 |
+
* @param int|bool $linebreak_pos
|
214 |
+
* @return string
|
215 |
+
*/
|
216 |
+
private function minify($css, $linebreak_pos)
|
217 |
+
{
|
218 |
+
// strings are safe, now wrestle the comments
|
219 |
+
for ($i = 0, $max = count($this->comments); $i < $max; $i++) {
|
220 |
+
|
221 |
+
$token = $this->comments[$i];
|
222 |
+
$placeholder = '/' . self::COMMENT . $i . '___/';
|
223 |
+
|
224 |
+
// ! in the first position of the comment means preserve
|
225 |
+
// so push to the preserved tokens keeping the !
|
226 |
+
if (substr($token, 0, 1) === '!') {
|
227 |
+
$this->preserved_tokens[] = $token;
|
228 |
+
$token_tring = self::TOKEN . (count($this->preserved_tokens) - 1) . '___';
|
229 |
+
$css = preg_replace($placeholder, $token_tring, $css, 1);
|
230 |
+
// Preserve new lines for /*! important comments
|
231 |
+
$css = preg_replace('/\s*[\n\r\f]+\s*(\/\*'. $token_tring .')/S', self::NL.'$1', $css);
|
232 |
+
$css = preg_replace('/('. $token_tring .'\*\/)\s*[\n\r\f]+\s*/', '$1'.self::NL, $css);
|
233 |
+
continue;
|
234 |
+
}
|
235 |
+
|
236 |
+
// \ in the last position looks like hack for Mac/IE5
|
237 |
+
// shorten that to /*\*/ and the next one to /**/
|
238 |
+
if (substr($token, (strlen($token) - 1), 1) === '\\') {
|
239 |
+
$this->preserved_tokens[] = '\\';
|
240 |
+
$css = preg_replace($placeholder, self::TOKEN . (count($this->preserved_tokens) - 1) . '___', $css, 1);
|
241 |
+
$i = $i + 1; // attn: advancing the loop
|
242 |
+
$this->preserved_tokens[] = '';
|
243 |
+
$css = preg_replace('/' . self::COMMENT . $i . '___/', self::TOKEN . (count($this->preserved_tokens) - 1) . '___', $css, 1);
|
244 |
+
continue;
|
245 |
+
}
|
246 |
+
|
247 |
+
// keep empty comments after child selectors (IE7 hack)
|
248 |
+
// e.g. html >/**/ body
|
249 |
+
if (strlen($token) === 0) {
|
250 |
+
$start_index = $this->index_of($css, $this->str_slice($placeholder, 1, -1));
|
251 |
+
if ($start_index > 2) {
|
252 |
+
if (substr($css, $start_index - 3, 1) === '>') {
|
253 |
+
$this->preserved_tokens[] = '';
|
254 |
+
$css = preg_replace($placeholder, self::TOKEN . (count($this->preserved_tokens) - 1) . '___', $css, 1);
|
255 |
+
}
|
256 |
+
}
|
257 |
+
}
|
258 |
+
|
259 |
+
// in all other cases kill the comment
|
260 |
+
$css = preg_replace('/\/\*' . $this->str_slice($placeholder, 1, -1) . '\*\//', '', $css, 1);
|
261 |
+
}
|
262 |
+
|
263 |
+
|
264 |
+
// Normalize all whitespace strings to single spaces. Easier to work with that way.
|
265 |
+
$css = preg_replace('/\s+/', ' ', $css);
|
266 |
+
|
267 |
+
// Fix IE7 issue on matrix filters which browser accept whitespaces between Matrix parameters
|
268 |
+
$css = preg_replace_callback('/\s*filter\:\s*progid:DXImageTransform\.Microsoft\.Matrix\(([^\)]+)\)/', array($this, 'preserve_old_IE_specific_matrix_definition'), $css);
|
269 |
+
|
270 |
+
// Shorten & preserve calculations calc(...) since spaces are important
|
271 |
+
$css = preg_replace_callback('/calc(\(((?:[^\(\)]+|(?1))*)\))/i', array($this, 'replace_calc'), $css);
|
272 |
+
|
273 |
+
// Replace positive sign from numbers preceded by : or a white-space before the leading space is removed
|
274 |
+
// +1.2em to 1.2em, +.8px to .8px, +2% to 2%
|
275 |
+
$css = preg_replace('/((?<!\\\\)\:|\s)\+(\.?\d+)/S', '$1$2', $css);
|
276 |
+
|
277 |
+
// Remove leading zeros from integer and float numbers preceded by : or a white-space
|
278 |
+
// 000.6 to .6, -0.8 to -.8, 0050 to 50, -01.05 to -1.05
|
279 |
+
$css = preg_replace('/((?<!\\\\)\:|\s)(\-?)0+(\.?\d+)/S', '$1$2$3', $css);
|
280 |
+
|
281 |
+
// Remove trailing zeros from float numbers preceded by : or a white-space
|
282 |
+
// -6.0100em to -6.01em, .0100 to .01, 1.200px to 1.2px
|
283 |
+
$css = preg_replace('/((?<!\\\\)\:|\s)(\-?)(\d?\.\d+?)0+([^\d])/S', '$1$2$3$4', $css);
|
284 |
+
|
285 |
+
// Remove trailing .0 -> -9.0 to -9
|
286 |
+
$css = preg_replace('/((?<!\\\\)\:|\s)(\-?\d+)\.0([^\d])/S', '$1$2$3', $css);
|
287 |
+
|
288 |
+
// Replace 0 length numbers with 0
|
289 |
+
$css = preg_replace('/((?<!\\\\)\:|\s)\-?\.?0+([^\d])/S', '${1}0$2', $css);
|
290 |
+
|
291 |
+
// Remove the spaces before the things that should not have spaces before them.
|
292 |
+
// But, be careful not to turn "p :link {...}" into "p:link{...}"
|
293 |
+
// Swap out any pseudo-class colons with the token, and then swap back.
|
294 |
+
$css = preg_replace_callback('/(?:^|\})[^\{]*\s+\:/', array($this, 'replace_colon'), $css);
|
295 |
+
|
296 |
+
// Remove spaces before the things that should not have spaces before them.
|
297 |
+
$css = preg_replace('/\s+([\!\{\}\;\:\>\+\(\)\]\~\=,])/', '$1', $css);
|
298 |
+
|
299 |
+
// Restore spaces for !important
|
300 |
+
$css = preg_replace('/\!important/i', ' !important', $css);
|
301 |
+
|
302 |
+
// bring back the colon
|
303 |
+
$css = preg_replace('/' . self::CLASSCOLON . '/', ':', $css);
|
304 |
+
|
305 |
+
// retain space for special IE6 cases
|
306 |
+
$css = preg_replace_callback('/\:first\-(line|letter)(\{|,)/i', array($this, 'lowercase_pseudo_first'), $css);
|
307 |
+
|
308 |
+
// no space after the end of a preserved comment
|
309 |
+
$css = preg_replace('/\*\/ /', '*/', $css);
|
310 |
+
|
311 |
+
// lowercase some popular @directives
|
312 |
+
$css = preg_replace_callback('/@(font-face|import|(?:-(?:atsc|khtml|moz|ms|o|wap|webkit)-)?keyframe|media|page|namespace)/i', array($this, 'lowercase_directives'), $css);
|
313 |
+
|
314 |
+
// lowercase some more common pseudo-elements
|
315 |
+
$css = preg_replace_callback('/:(active|after|before|checked|disabled|empty|enabled|first-(?:child|of-type)|focus|hover|last-(?:child|of-type)|link|only-(?:child|of-type)|root|:selection|target|visited)/i', array($this, 'lowercase_pseudo_elements'), $css);
|
316 |
+
|
317 |
+
// lowercase some more common functions
|
318 |
+
$css = preg_replace_callback('/:(lang|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|(?:-(?:moz|webkit)-)?any)\(/i', array($this, 'lowercase_common_functions'), $css);
|
319 |
+
|
320 |
+
// lower case some common function that can be values
|
321 |
+
// NOTE: rgb() isn't useful as we replace with #hex later, as well as and() is already done for us
|
322 |
+
$css = preg_replace_callback('/([:,\( ]\s*)(attr|color-stop|from|rgba|to|url|(?:-(?:atsc|khtml|moz|ms|o|wap|webkit)-)?(?:calc|max|min|(?:repeating-)?(?:linear|radial)-gradient)|-webkit-gradient)/iS', array($this, 'lowercase_common_functions_values'), $css);
|
323 |
+
|
324 |
+
// Put the space back in some cases, to support stuff like
|
325 |
+
// @media screen and (-webkit-min-device-pixel-ratio:0){
|
326 |
+
$css = preg_replace('/\band\(/i', 'and (', $css);
|
327 |
+
|
328 |
+
// Remove the spaces after the things that should not have spaces after them.
|
329 |
+
$css = preg_replace('/([\!\{\}\:;\>\+\(\[\~\=,])\s+/S', '$1', $css);
|
330 |
+
|
331 |
+
// remove unnecessary semicolons
|
332 |
+
$css = preg_replace('/;+\}/', '}', $css);
|
333 |
+
|
334 |
+
// Fix for issue: #2528146
|
335 |
+
// Restore semicolon if the last property is prefixed with a `*` (lte IE7 hack)
|
336 |
+
// to avoid issues on Symbian S60 3.x browsers.
|
337 |
+
$css = preg_replace('/(\*[a-z0-9\-]+\s*\:[^;\}]+)(\})/', '$1;$2', $css);
|
338 |
+
|
339 |
+
// Replace 0 <length> and 0 <percentage> values with 0.
|
340 |
+
// <length> data type: https://developer.mozilla.org/en-US/docs/Web/CSS/length
|
341 |
+
// <percentage> data type: https://developer.mozilla.org/en-US/docs/Web/CSS/percentage
|
342 |
+
$css = preg_replace('/([^\\\\]\:|\s)0(?:em|ex|ch|rem|vw|vh|vm|vmin|cm|mm|in|px|pt|pc|%)/iS', '${1}0', $css);
|
343 |
+
|
344 |
+
// 0% step in a keyframe? restore the % unit
|
345 |
+
$css = preg_replace_callback('/(@[a-z\-]*?keyframes[^\{]+\{)(.*?)(\}\})/iS', array($this, 'replace_keyframe_zero'), $css);
|
346 |
+
|
347 |
+
// Replace 0 0; or 0 0 0; or 0 0 0 0; with 0.
|
348 |
+
$css = preg_replace('/\:0(?: 0){1,3}(;|\}| \!)/', ':0$1', $css);
|
349 |
+
|
350 |
+
// Fix for issue: #2528142
|
351 |
+
// Replace text-shadow:0; with text-shadow:0 0 0;
|
352 |
+
$css = preg_replace('/(text-shadow\:0)(;|\}| \!)/i', '$1 0 0$2', $css);
|
353 |
+
|
354 |
+
// Replace background-position:0; with background-position:0 0;
|
355 |
+
// same for transform-origin
|
356 |
+
// Changing -webkit-mask-position: 0 0 to just a single 0 will result in the second parameter defaulting to 50% (center)
|
357 |
+
$css = preg_replace('/(background\-position|webkit-mask-position|(?:webkit|moz|o|ms|)\-?transform\-origin)\:0(;|\}| \!)/iS', '$1:0 0$2', $css);
|
358 |
+
|
359 |
+
// Shorten colors from rgb(51,102,153) to #336699, rgb(100%,0%,0%) to #ff0000 (sRGB color space)
|
360 |
+
// Shorten colors from hsl(0, 100%, 50%) to #ff0000 (sRGB color space)
|
361 |
+
// This makes it more likely that it'll get further compressed in the next step.
|
362 |
+
$css = preg_replace_callback('/rgb\s*\(\s*([0-9,\s\-\.\%]+)\s*\)(.{1})/i', array($this, 'rgb_to_hex'), $css);
|
363 |
+
$css = preg_replace_callback('/hsl\s*\(\s*([0-9,\s\-\.\%]+)\s*\)(.{1})/i', array($this, 'hsl_to_hex'), $css);
|
364 |
+
|
365 |
+
// Shorten colors from #AABBCC to #ABC or short color name.
|
366 |
+
$css = $this->compress_hex_colors($css);
|
367 |
+
|
368 |
+
// border: none to border:0, outline: none to outline:0
|
369 |
+
$css = preg_replace('/(border\-?(?:top|right|bottom|left|)|outline)\:none(;|\}| \!)/iS', '$1:0$2', $css);
|
370 |
+
|
371 |
+
// shorter opacity IE filter
|
372 |
+
$css = preg_replace('/progid\:DXImageTransform\.Microsoft\.Alpha\(Opacity\=/i', 'alpha(opacity=', $css);
|
373 |
+
|
374 |
+
// Find a fraction that is used for Opera's -o-device-pixel-ratio query
|
375 |
+
// Add token to add the "\" back in later
|
376 |
+
$css = preg_replace('/\(([a-z\-]+):([0-9]+)\/([0-9]+)\)/i', '($1:$2'. self::QUERY_FRACTION .'$3)', $css);
|
377 |
+
|
378 |
+
// Remove empty rules.
|
379 |
+
$css = preg_replace('/[^\};\{\/]+\{\}/S', '', $css);
|
380 |
+
|
381 |
+
// Add "/" back to fix Opera -o-device-pixel-ratio query
|
382 |
+
$css = preg_replace('/'. self::QUERY_FRACTION .'/', '/', $css);
|
383 |
+
|
384 |
+
// Replace multiple semi-colons in a row by a single one
|
385 |
+
// See SF bug #1980989
|
386 |
+
$css = preg_replace('/;;+/', ';', $css);
|
387 |
+
|
388 |
+
// Restore new lines for /*! important comments
|
389 |
+
$css = preg_replace('/'. self::NL .'/', "\n", $css);
|
390 |
+
|
391 |
+
// Lowercase all uppercase properties
|
392 |
+
$css = preg_replace_callback('/(\{|\;)([A-Z\-]+)(\:)/', array($this, 'lowercase_properties'), $css);
|
393 |
+
|
394 |
+
// Some source control tools don't like it when files containing lines longer
|
395 |
+
// than, say 8000 characters, are checked in. The linebreak option is used in
|
396 |
+
// that case to split long lines after a specific column.
|
397 |
+
if ($linebreak_pos !== FALSE && (int) $linebreak_pos >= 0) {
|
398 |
+
$linebreak_pos = (int) $linebreak_pos;
|
399 |
+
$start_index = $i = 0;
|
400 |
+
while ($i < strlen($css)) {
|
401 |
+
$i++;
|
402 |
+
if ($css[$i - 1] === '}' && $i - $start_index > $linebreak_pos) {
|
403 |
+
$css = $this->str_slice($css, 0, $i) . "\n" . $this->str_slice($css, $i);
|
404 |
+
$start_index = $i;
|
405 |
+
}
|
406 |
+
}
|
407 |
+
}
|
408 |
+
|
409 |
+
// restore preserved comments and strings in reverse order
|
410 |
+
for ($i = count($this->preserved_tokens) - 1; $i >= 0; $i--) {
|
411 |
+
$css = preg_replace('/' . self::TOKEN . $i . '___/', $this->preserved_tokens[$i], $css, 1);
|
412 |
+
}
|
413 |
+
|
414 |
+
// Trim the final string (for any leading or trailing white spaces)
|
415 |
+
return trim($css);
|
416 |
+
}
|
417 |
+
|
418 |
+
/**
|
419 |
+
* Utility method to replace all data urls with tokens before we start
|
420 |
+
* compressing, to avoid performance issues running some of the subsequent
|
421 |
+
* regexes against large strings chunks.
|
422 |
+
*
|
423 |
+
* @param string $css
|
424 |
+
* @return string
|
425 |
+
*/
|
426 |
+
private function extract_data_urls($css)
|
427 |
+
{
|
428 |
+
// Leave data urls alone to increase parse performance.
|
429 |
+
$max_index = strlen($css) - 1;
|
430 |
+
$append_index = $index = $last_index = $offset = 0;
|
431 |
+
$sb = array();
|
432 |
+
$pattern = '/url\(\s*(["\']?)data\:/i';
|
433 |
+
|
434 |
+
// Since we need to account for non-base64 data urls, we need to handle
|
435 |
+
// ' and ) being part of the data string. Hence switching to indexOf,
|
436 |
+
// to determine whether or not we have matching string terminators and
|
437 |
+
// handling sb appends directly, instead of using matcher.append* methods.
|
438 |
+
|
439 |
+
while (preg_match($pattern, $css, $m, 0, $offset)) {
|
440 |
+
$index = $this->index_of($css, $m[0], $offset);
|
441 |
+
$last_index = $index + strlen($m[0]);
|
442 |
+
$start_index = $index + 4; // "url(".length()
|
443 |
+
$end_index = $last_index - 1;
|
444 |
+
$terminator = $m[1]; // ', " or empty (not quoted)
|
445 |
+
$found_terminator = FALSE;
|
446 |
+
|
447 |
+
if (strlen($terminator) === 0) {
|
448 |
+
$terminator = ')';
|
449 |
+
}
|
450 |
+
|
451 |
+
while ($found_terminator === FALSE && $end_index+1 <= $max_index) {
|
452 |
+
$end_index = $this->index_of($css, $terminator, $end_index + 1);
|
453 |
+
|
454 |
+
// endIndex == 0 doesn't really apply here
|
455 |
+
if ($end_index > 0 && substr($css, $end_index - 1, 1) !== '\\') {
|
456 |
+
$found_terminator = TRUE;
|
457 |
+
if (')' != $terminator) {
|
458 |
+
$end_index = $this->index_of($css, ')', $end_index);
|
459 |
+
}
|
460 |
+
}
|
461 |
+
}
|
462 |
+
|
463 |
+
// Enough searching, start moving stuff over to the buffer
|
464 |
+
$sb[] = $this->str_slice($css, $append_index, $index);
|
465 |
+
|
466 |
+
if ($found_terminator) {
|
467 |
+
$token = $this->str_slice($css, $start_index, $end_index);
|
468 |
+
$token = preg_replace('/\s+/', '', $token);
|
469 |
+
$this->preserved_tokens[] = $token;
|
470 |
+
|
471 |
+
$preserver = 'url(' . self::TOKEN . (count($this->preserved_tokens) - 1) . '___)';
|
472 |
+
$sb[] = $preserver;
|
473 |
+
|
474 |
+
$append_index = $end_index + 1;
|
475 |
+
} else {
|
476 |
+
// No end terminator found, re-add the whole match. Should we throw/warn here?
|
477 |
+
$sb[] = $this->str_slice($css, $index, $last_index);
|
478 |
+
$append_index = $last_index;
|
479 |
+
}
|
480 |
+
|
481 |
+
$offset = $last_index;
|
482 |
+
}
|
483 |
+
|
484 |
+
$sb[] = $this->str_slice($css, $append_index);
|
485 |
+
|
486 |
+
return implode('', $sb);
|
487 |
+
}
|
488 |
+
|
489 |
+
/**
|
490 |
+
* Utility method to compress hex color values of the form #AABBCC to #ABC or short color name.
|
491 |
+
*
|
492 |
+
* DOES NOT compress CSS ID selectors which match the above pattern (which would break things).
|
493 |
+
* e.g. #AddressForm { ... }
|
494 |
+
*
|
495 |
+
* DOES NOT compress IE filters, which have hex color values (which would break things).
|
496 |
+
* e.g. filter: chroma(color="#FFFFFF");
|
497 |
+
*
|
498 |
+
* DOES NOT compress invalid hex values.
|
499 |
+
* e.g. background-color: #aabbccdd
|
500 |
+
*
|
501 |
+
* @param string $css
|
502 |
+
* @return string
|
503 |
+
*/
|
504 |
+
private function compress_hex_colors($css)
|
505 |
+
{
|
506 |
+
// Look for hex colors inside { ... } (to avoid IDs) and which don't have a =, or a " in front of them (to avoid filters)
|
507 |
+
$pattern = '/(\=\s*?["\']?)?#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])(\}|[^0-9a-f{][^{]*?\})/iS';
|
508 |
+
$_index = $index = $last_index = $offset = 0;
|
509 |
+
$sb = array();
|
510 |
+
// See: http://ajaxmin.codeplex.com/wikipage?title=CSS%20Colors
|
511 |
+
$short_safe = array(
|
512 |
+
'#808080' => 'gray',
|
513 |
+
'#008000' => 'green',
|
514 |
+
'#800000' => 'maroon',
|
515 |
+
'#000080' => 'navy',
|
516 |
+
'#808000' => 'olive',
|
517 |
+
'#ffa500' => 'orange',
|
518 |
+
'#800080' => 'purple',
|
519 |
+
'#c0c0c0' => 'silver',
|
520 |
+
'#008080' => 'teal',
|
521 |
+
'#f00' => 'red'
|
522 |
+
);
|
523 |
+
|
524 |
+
while (preg_match($pattern, $css, $m, 0, $offset)) {
|
525 |
+
$index = $this->index_of($css, $m[0], $offset);
|
526 |
+
$last_index = $index + strlen($m[0]);
|
527 |
+
$is_filter = $m[1] !== null && $m[1] !== '';
|
528 |
+
|
529 |
+
$sb[] = $this->str_slice($css, $_index, $index);
|
530 |
+
|
531 |
+
if ($is_filter) {
|
532 |
+
// Restore, maintain case, otherwise filter will break
|
533 |
+
$sb[] = $m[1] . '#' . $m[2] . $m[3] . $m[4] . $m[5] . $m[6] . $m[7];
|
534 |
+
} else {
|
535 |
+
if (strtolower($m[2]) == strtolower($m[3]) &&
|
536 |
+
strtolower($m[4]) == strtolower($m[5]) &&
|
537 |
+
strtolower($m[6]) == strtolower($m[7])) {
|
538 |
+
// Compress.
|
539 |
+
$hex = '#' . strtolower($m[3] . $m[5] . $m[7]);
|
540 |
+
} else {
|
541 |
+
// Non compressible color, restore but lower case.
|
542 |
+
$hex = '#' . strtolower($m[2] . $m[3] . $m[4] . $m[5] . $m[6] . $m[7]);
|
543 |
+
}
|
544 |
+
// replace Hex colors to short safe color names
|
545 |
+
$sb[] = array_key_exists($hex, $short_safe) ? $short_safe[$hex] : $hex;
|
546 |
+
}
|
547 |
+
|
548 |
+
$_index = $offset = $last_index - strlen($m[8]);
|
549 |
+
}
|
550 |
+
|
551 |
+
$sb[] = $this->str_slice($css, $_index);
|
552 |
+
|
553 |
+
return implode('', $sb);
|
554 |
+
}
|
555 |
+
|
556 |
+
/* CALLBACKS
|
557 |
+
* ---------------------------------------------------------------------------------------------
|
558 |
+
*/
|
559 |
+
|
560 |
+
private function replace_string($matches)
|
561 |
+
{
|
562 |
+
$match = $matches[0];
|
563 |
+
$quote = substr($match, 0, 1);
|
564 |
+
// Must use addcslashes in PHP to avoid parsing of backslashes
|
565 |
+
$match = addcslashes($this->str_slice($match, 1, -1), '\\');
|
566 |
+
|
567 |
+
// maybe the string contains a comment-like substring?
|
568 |
+
// one, maybe more? put'em back then
|
569 |
+
if (($pos = $this->index_of($match, self::COMMENT)) >= 0) {
|
570 |
+
for ($i = 0, $max = count($this->comments); $i < $max; $i++) {
|
571 |
+
$match = preg_replace('/' . self::COMMENT . $i . '___/', $this->comments[$i], $match, 1);
|
572 |
+
}
|
573 |
+
}
|
574 |
+
|
575 |
+
// minify alpha opacity in filter strings
|
576 |
+
$match = preg_replace('/progid\:DXImageTransform\.Microsoft\.Alpha\(Opacity\=/i', 'alpha(opacity=', $match);
|
577 |
+
|
578 |
+
$this->preserved_tokens[] = $match;
|
579 |
+
return $quote . self::TOKEN . (count($this->preserved_tokens) - 1) . '___' . $quote;
|
580 |
+
}
|
581 |
+
|
582 |
+
private function replace_colon($matches)
|
583 |
+
{
|
584 |
+
return preg_replace('/\:/', self::CLASSCOLON, $matches[0]);
|
585 |
+
}
|
586 |
+
|
587 |
+
private function replace_calc($matches)
|
588 |
+
{
|
589 |
+
$this->preserved_tokens[] = trim(preg_replace('/\s*([\*\/\(\),])\s*/', '$1', $matches[2]));
|
590 |
+
return 'calc('. self::TOKEN . (count($this->preserved_tokens) - 1) . '___' . ')';
|
591 |
+
}
|
592 |
+
|
593 |
+
private function preserve_old_IE_specific_matrix_definition($matches)
|
594 |
+
{
|
595 |
+
$this->preserved_tokens[] = $matches[1];
|
596 |
+
return 'filter:progid:DXImageTransform.Microsoft.Matrix(' . self::TOKEN . (count($this->preserved_tokens) - 1) . '___' . ')';
|
597 |
+
}
|
598 |
+
|
599 |
+
private function replace_keyframe_zero($matches)
|
600 |
+
{
|
601 |
+
return $matches[1] . preg_replace('/0(\{|,[^\)\{]+\{)/', '0%$1', $matches[2]) . $matches[3];
|
602 |
+
}
|
603 |
+
|
604 |
+
private function rgb_to_hex($matches)
|
605 |
+
{
|
606 |
+
// Support for percentage values rgb(100%, 0%, 45%);
|
607 |
+
if ($this->index_of($matches[1], '%') >= 0){
|
608 |
+
$rgbcolors = explode(',', str_replace('%', '', $matches[1]));
|
609 |
+
for ($i = 0; $i < count($rgbcolors); $i++) {
|
610 |
+
$rgbcolors[$i] = $this->round_number(floatval($rgbcolors[$i]) * 2.55);
|
611 |
+
}
|
612 |
+
} else {
|
613 |
+
$rgbcolors = explode(',', $matches[1]);
|
614 |
+
}
|
615 |
+
|
616 |
+
// Values outside the sRGB color space should be clipped (0-255)
|
617 |
+
for ($i = 0; $i < count($rgbcolors); $i++) {
|
618 |
+
$rgbcolors[$i] = $this->clamp_number(intval($rgbcolors[$i], 10), 0, 255);
|
619 |
+
$rgbcolors[$i] = sprintf("%02x", $rgbcolors[$i]);
|
620 |
+
}
|
621 |
+
|
622 |
+
// Fix for issue #2528093
|
623 |
+
if (!preg_match('/[\s\,\);\}]/', $matches[2])){
|
624 |
+
$matches[2] = ' ' . $matches[2];
|
625 |
+
}
|
626 |
+
|
627 |
+
return '#' . implode('', $rgbcolors) . $matches[2];
|
628 |
+
}
|
629 |
+
|
630 |
+
private function hsl_to_hex($matches)
|
631 |
+
{
|
632 |
+
$values = explode(',', str_replace('%', '', $matches[1]));
|
633 |
+
$h = floatval($values[0]);
|
634 |
+
$s = floatval($values[1]);
|
635 |
+
$l = floatval($values[2]);
|
636 |
+
|
637 |
+
// Wrap and clamp, then fraction!
|
638 |
+
$h = ((($h % 360) + 360) % 360) / 360;
|
639 |
+
$s = $this->clamp_number($s, 0, 100) / 100;
|
640 |
+
$l = $this->clamp_number($l, 0, 100) / 100;
|
641 |
+
|
642 |
+
if ($s == 0) {
|
643 |
+
$r = $g = $b = $this->round_number(255 * $l);
|
644 |
+
} else {
|
645 |
+
$v2 = $l < 0.5 ? $l * (1 + $s) : ($l + $s) - ($s * $l);
|
646 |
+
$v1 = (2 * $l) - $v2;
|
647 |
+
$r = $this->round_number(255 * $this->hue_to_rgb($v1, $v2, $h + (1/3)));
|
648 |
+
$g = $this->round_number(255 * $this->hue_to_rgb($v1, $v2, $h));
|
649 |
+
$b = $this->round_number(255 * $this->hue_to_rgb($v1, $v2, $h - (1/3)));
|
650 |
+
}
|
651 |
+
|
652 |
+
return $this->rgb_to_hex(array('', $r.','.$g.','.$b, $matches[2]));
|
653 |
+
}
|
654 |
+
|
655 |
+
private function lowercase_pseudo_first($matches)
|
656 |
+
{
|
657 |
+
return ':first-'. strtolower($matches[1]) .' '. $matches[2];
|
658 |
+
}
|
659 |
+
|
660 |
+
private function lowercase_directives($matches)
|
661 |
+
{
|
662 |
+
return '@'. strtolower($matches[1]);
|
663 |
+
}
|
664 |
+
|
665 |
+
private function lowercase_pseudo_elements($matches)
|
666 |
+
{
|
667 |
+
return ':'. strtolower($matches[1]);
|
668 |
+
}
|
669 |
+
|
670 |
+
private function lowercase_common_functions($matches)
|
671 |
+
{
|
672 |
+
return ':'. strtolower($matches[1]) .'(';
|
673 |
+
}
|
674 |
+
|
675 |
+
private function lowercase_common_functions_values($matches)
|
676 |
+
{
|
677 |
+
return $matches[1] . strtolower($matches[2]);
|
678 |
+
}
|
679 |
+
|
680 |
+
private function lowercase_properties($matches)
|
681 |
+
{
|
682 |
+
return $matches[1].strtolower($matches[2]).$matches[3];
|
683 |
+
}
|
684 |
+
|
685 |
+
/* HELPERS
|
686 |
+
* ---------------------------------------------------------------------------------------------
|
687 |
+
*/
|
688 |
+
|
689 |
+
private function hue_to_rgb($v1, $v2, $vh)
|
690 |
+
{
|
691 |
+
$vh = $vh < 0 ? $vh + 1 : ($vh > 1 ? $vh - 1 : $vh);
|
692 |
+
if ($vh * 6 < 1) return $v1 + ($v2 - $v1) * 6 * $vh;
|
693 |
+
if ($vh * 2 < 1) return $v2;
|
694 |
+
if ($vh * 3 < 2) return $v1 + ($v2 - $v1) * ((2/3) - $vh) * 6;
|
695 |
+
return $v1;
|
696 |
+
}
|
697 |
+
|
698 |
+
private function round_number($n)
|
699 |
+
{
|
700 |
+
return intval(floor(floatval($n) + 0.5), 10);
|
701 |
+
}
|
702 |
+
|
703 |
+
private function clamp_number($n, $min, $max)
|
704 |
+
{
|
705 |
+
return min(max($n, $min), $max);
|
706 |
+
}
|
707 |
+
|
708 |
+
/**
|
709 |
+
* PHP port of Javascript's "indexOf" function for strings only
|
710 |
+
* Author: Tubal Martin http://blog.margenn.com
|
711 |
+
*
|
712 |
+
* @param string $haystack
|
713 |
+
* @param string $needle
|
714 |
+
* @param int $offset index (optional)
|
715 |
+
* @return int
|
716 |
+
*/
|
717 |
+
private function index_of($haystack, $needle, $offset = 0)
|
718 |
+
{
|
719 |
+
$index = strpos($haystack, $needle, $offset);
|
720 |
+
|
721 |
+
return ($index !== FALSE) ? $index : -1;
|
722 |
+
}
|
723 |
+
|
724 |
+
/**
|
725 |
+
* PHP port of Javascript's "slice" function for strings only
|
726 |
+
* Author: Tubal Martin http://blog.margenn.com
|
727 |
+
* Tests: http://margenn.com/tubal/str_slice/
|
728 |
+
*
|
729 |
+
* @param string $str
|
730 |
+
* @param int $start index
|
731 |
+
* @param int|bool $end index (optional)
|
732 |
+
* @return string
|
733 |
+
*/
|
734 |
+
private function str_slice($str, $start = 0, $end = FALSE)
|
735 |
+
{
|
736 |
+
if ($end !== FALSE && ($start < 0 || $end <= 0)) {
|
737 |
+
$max = strlen($str);
|
738 |
+
|
739 |
+
if ($start < 0) {
|
740 |
+
if (($start = $max + $start) < 0) {
|
741 |
+
return '';
|
742 |
+
}
|
743 |
+
}
|
744 |
+
|
745 |
+
if ($end < 0) {
|
746 |
+
if (($end = $max + $end) < 0) {
|
747 |
+
return '';
|
748 |
+
}
|
749 |
+
}
|
750 |
+
|
751 |
+
if ($end <= $start) {
|
752 |
+
return '';
|
753 |
+
}
|
754 |
+
}
|
755 |
+
|
756 |
+
$slice = ($end === FALSE) ? substr($str, $start) : substr($str, $start, $end - $start);
|
757 |
+
return ($slice === FALSE) ? '' : $slice;
|
758 |
+
}
|
759 |
+
|
760 |
+
/**
|
761 |
+
* Convert strings like "64M" or "30" to int values
|
762 |
+
* @param mixed $size
|
763 |
+
* @return int
|
764 |
+
*/
|
765 |
+
private function normalize_int($size)
|
766 |
+
{
|
767 |
+
if (is_string($size)) {
|
768 |
+
switch (substr($size, -1)) {
|
769 |
+
case 'M': case 'm': return $size * 1048576;
|
770 |
+
case 'K': case 'k': return $size * 1024;
|
771 |
+
case 'G': case 'g': return $size * 1073741824;
|
772 |
+
}
|
773 |
+
}
|
774 |
+
|
775 |
+
return (int) $size;
|
776 |
+
}
|
777 |
+
}
|
localization/autoptimize-sv_SE.mo
CHANGED
Binary file
|
localization/autoptimize-sv_SE.po
CHANGED
@@ -2,30 +2,29 @@
|
|
2 |
# This file is distributed under the same license as the Autoptimize package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Autoptimize 1.
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/autoptimize\n"
|
7 |
-
"POT-Creation-Date: 2014-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"PO-Revision-Date: 2014-
|
12 |
"Last-Translator: Jonathan Sulo <jonathan@sulo.se>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
-
"
|
15 |
-
"Language:
|
16 |
-
"X-Generator: Poedit 1.6.3\n"
|
17 |
|
18 |
-
#: autoptimize.php:
|
19 |
msgid ""
|
20 |
"Thank you for installing and activating Autoptimize. Please configure it "
|
21 |
"under \"Settings\" -> \"Autoptimize\" to start improving your site's "
|
22 |
"performance."
|
23 |
msgstr ""
|
24 |
-
"Tack för att du
|
25 |
-
"
|
26 |
-
"prestandan på din
|
27 |
|
28 |
-
#: autoptimize.php:
|
29 |
msgid ""
|
30 |
"Autoptimize has just been updated. Please <strong>test your site now</"
|
31 |
"strong> and adapt Autoptimize config if needed."
|
@@ -33,31 +32,31 @@ msgstr ""
|
|
33 |
"Autoptimize har precis uppdaterats. Vänligen <strong>testa din sida nu</"
|
34 |
"strong> och ändra inställningarna för Autoptimize vid behov. "
|
35 |
|
36 |
-
#: classes/autoptimizeConfig.php:
|
37 |
msgid "Autoptimize Settings"
|
38 |
msgstr "Inställningar för Autoptimize"
|
39 |
|
40 |
-
#: classes/autoptimizeConfig.php:
|
41 |
msgid "Show advanced settings"
|
42 |
msgstr "Visa avancerade inställningar"
|
43 |
|
44 |
-
#: classes/autoptimizeConfig.php:
|
45 |
msgid "Hide advanced settings"
|
46 |
msgstr "Dölj avancerade inställningar"
|
47 |
|
48 |
-
#: classes/autoptimizeConfig.php:
|
49 |
msgid "HTML Options"
|
50 |
msgstr "HTML-alternativ"
|
51 |
|
52 |
-
#: classes/autoptimizeConfig.php:
|
53 |
msgid "Optimize HTML Code?"
|
54 |
msgstr "Optimera HTML-kod?"
|
55 |
|
56 |
-
#: classes/autoptimizeConfig.php:
|
57 |
msgid "Keep HTML comments?"
|
58 |
msgstr "Behåll HTML-kommentarer?"
|
59 |
|
60 |
-
#: classes/autoptimizeConfig.php:
|
61 |
msgid ""
|
62 |
"Enable this if you want HTML comments to remain in the page, needed for e.g. "
|
63 |
"AdSense to function properly."
|
@@ -65,19 +64,19 @@ msgstr ""
|
|
65 |
"Välj detta för att behålla HTML-kommentarer på sidan, vilket behövs för att "
|
66 |
"t ex AdSense ska fungera bra."
|
67 |
|
68 |
-
#: classes/autoptimizeConfig.php:
|
69 |
msgid "JavaScript Options"
|
70 |
msgstr "JavaScript-alternativ"
|
71 |
|
72 |
-
#: classes/autoptimizeConfig.php:
|
73 |
msgid "Optimize JavaScript Code?"
|
74 |
msgstr "Optimera JavaScript-kod?"
|
75 |
|
76 |
-
#: classes/autoptimizeConfig.php:
|
77 |
msgid "Force JavaScript in <head>?"
|
78 |
msgstr "Tvinga in JavaScript i <head>?"
|
79 |
|
80 |
-
#: classes/autoptimizeConfig.php:
|
81 |
msgid ""
|
82 |
"For performance reasons it is better to include JavaScript at the bottom of "
|
83 |
"HTML, but this sometimes breaks things. Especially useful for jQuery-based "
|
@@ -87,11 +86,11 @@ msgstr ""
|
|
87 |
"koden, men det kan ibland orsaka fel. Särskilt användbart för jQuery-"
|
88 |
"baserade teman."
|
89 |
|
90 |
-
#: classes/autoptimizeConfig.php:
|
91 |
msgid "Look for scripts only in <head>?"
|
92 |
msgstr "Leta efter script enbart i <head>?"
|
93 |
|
94 |
-
#: classes/autoptimizeConfig.php:
|
95 |
msgid ""
|
96 |
"Mostly usefull in combination with previous option when using jQuery-based "
|
97 |
"templates, but might help keeping cache size under control."
|
@@ -99,11 +98,11 @@ msgstr ""
|
|
99 |
"Mest användbart i kombination med föregående alternativ, när jQuery-baserade "
|
100 |
"teman används, men kan även reducera storleken på cachen."
|
101 |
|
102 |
-
#: classes/autoptimizeConfig.php:
|
103 |
msgid "Exclude scripts from Autoptimize:"
|
104 |
msgstr "Exkludera script från Autoptimize:"
|
105 |
|
106 |
-
#: classes/autoptimizeConfig.php:
|
107 |
msgid ""
|
108 |
"A comma-seperated list of scripts you want to exclude from being optimized, "
|
109 |
"for example 'whatever.js, another.js' (without the quotes) to exclude those "
|
@@ -113,29 +112,29 @@ msgstr ""
|
|
113 |
"Ange t ex 'whatever.js, another.js' (utan citattecken) för att inte "
|
114 |
"sammanfoga och minimera dessa script."
|
115 |
|
116 |
-
#: classes/autoptimizeConfig.php:
|
117 |
msgid "Add try-catch wrapping?"
|
118 |
msgstr "Lägg till try-catch-inbäddning?"
|
119 |
|
120 |
-
#: classes/autoptimizeConfig.php:
|
121 |
msgid ""
|
122 |
"If your scripts break because of an script error, you might want to try this."
|
123 |
msgstr ""
|
124 |
"Om script slutar fungera pga ett script-fel, testa då detta alternativ."
|
125 |
|
126 |
-
#: classes/autoptimizeConfig.php:
|
127 |
msgid "CSS Options"
|
128 |
msgstr "CSS-alternativ"
|
129 |
|
130 |
-
#: classes/autoptimizeConfig.php:
|
131 |
msgid "Optimize CSS Code?"
|
132 |
msgstr "Optimera CSS-kod?"
|
133 |
|
134 |
-
#: classes/autoptimizeConfig.php:
|
135 |
msgid "Generate data: URIs for images?"
|
136 |
msgstr "Generera data: URI för bilder?"
|
137 |
|
138 |
-
#: classes/autoptimizeConfig.php:
|
139 |
msgid ""
|
140 |
"Enable this to include small background-images in the CSS itself instead of "
|
141 |
"as seperate downloads."
|
@@ -143,11 +142,11 @@ msgstr ""
|
|
143 |
"Välj detta för att inkludera mindre bakgrundsbilder direkt i CSS, istället "
|
144 |
"för som separata nedladdningar."
|
145 |
|
146 |
-
#: classes/autoptimizeConfig.php:
|
147 |
msgid "Look for styles only in <head>?"
|
148 |
msgstr "Leta efter stilmallar enbart inom <head>?"
|
149 |
|
150 |
-
#: classes/autoptimizeConfig.php:
|
151 |
msgid ""
|
152 |
"Don't autoptimize CSS outside the head-section. If the cache gets big, you "
|
153 |
"might want to enable this."
|
@@ -155,87 +154,91 @@ msgstr ""
|
|
155 |
"Optimera inte CSS utanför head-sektionen. Om cachen blir för stor, testa då "
|
156 |
"detta alternativ."
|
157 |
|
158 |
-
#: classes/autoptimizeConfig.php:
|
159 |
-
msgid "Defer CSS
|
160 |
-
msgstr "
|
161 |
|
162 |
-
#: classes/autoptimizeConfig.php:
|
163 |
msgid ""
|
164 |
-
"
|
165 |
-
"
|
166 |
-
"
|
167 |
msgstr ""
|
168 |
-
"
|
169 |
-
"
|
170 |
-
"
|
171 |
-
"
|
172 |
|
173 |
-
#: classes/autoptimizeConfig.php:
|
|
|
|
|
|
|
|
|
174 |
msgid "Inline all CSS?"
|
175 |
msgstr "Inkludera all CSS?"
|
176 |
|
177 |
-
#: classes/autoptimizeConfig.php:
|
178 |
msgid ""
|
179 |
"Inlining all CSS can improve performance for sites with a low pageviews/ "
|
180 |
-
"visitor-rate, but may slow down performance otherwise.
|
181 |
-
"CSS deferring."
|
182 |
msgstr ""
|
183 |
"Att inkludera all CSS (inline) kan förbättra prestandan på sidor med få "
|
184 |
-
"sidvisningar/besökare, men det kan även försämra prestandan.
|
185 |
-
"inaktiverar senarelagd inladdning av CSS."
|
186 |
|
187 |
-
#: classes/autoptimizeConfig.php:
|
188 |
msgid "Exclude CSS from Autoptimize:"
|
189 |
-
msgstr "
|
190 |
|
191 |
-
#: classes/autoptimizeConfig.php:
|
192 |
msgid "A comma-seperated list of CSS you want to exclude from being optimized."
|
193 |
msgstr ""
|
194 |
"En komma-separerad lista med stilmallar som ska exkluderas från optimering."
|
195 |
|
196 |
-
#: classes/autoptimizeConfig.php:
|
197 |
msgid "CDN Options"
|
198 |
msgstr "CDN-alternativ"
|
199 |
|
200 |
-
#: classes/autoptimizeConfig.php:
|
201 |
msgid "CDN Base URL"
|
202 |
msgstr "CDN bas-URL"
|
203 |
|
204 |
-
#: classes/autoptimizeConfig.php:
|
205 |
msgid ""
|
206 |
"Enter your CDN blog root directory URL if you want to enable CDN for images "
|
207 |
"referenced in the CSS."
|
208 |
-
msgstr "
|
|
|
|
|
209 |
|
210 |
-
#: classes/autoptimizeConfig.php:
|
211 |
msgid "Cache Info"
|
212 |
msgstr "Cache-information"
|
213 |
|
214 |
-
#: classes/autoptimizeConfig.php:
|
215 |
msgid "Cache folder"
|
216 |
msgstr "Cache-mapp"
|
217 |
|
218 |
-
#: classes/autoptimizeConfig.php:
|
219 |
msgid "Can we write?"
|
220 |
msgstr "Kan vi skriva?"
|
221 |
|
222 |
-
#: classes/autoptimizeConfig.php:
|
223 |
msgid "Yes"
|
224 |
msgstr "Ja"
|
225 |
|
226 |
-
#: classes/autoptimizeConfig.php:
|
227 |
msgid "No"
|
228 |
msgstr "Nej"
|
229 |
|
230 |
-
#: classes/autoptimizeConfig.php:
|
231 |
msgid "Cached styles and scripts"
|
232 |
msgstr "Stilmallar och script i cachen"
|
233 |
|
234 |
-
#: classes/autoptimizeConfig.php:
|
235 |
msgid "Save aggregated script/css as static files?"
|
236 |
msgstr "Spara sammanfogade script/stilmallar som statiska filer?"
|
237 |
|
238 |
-
#: classes/autoptimizeConfig.php:
|
239 |
msgid ""
|
240 |
"By default files saved are static css/js, uncheck this option if your "
|
241 |
"webserver doesn't properly handle the compression and expiry."
|
@@ -243,40 +246,41 @@ msgstr ""
|
|
243 |
"Som standard sparas filer som statisk CSS/Javascript. Välj detta alternativ "
|
244 |
"om din webbserver inte kan hantera komprimering och utgångstid ordentligt."
|
245 |
|
246 |
-
#: classes/autoptimizeConfig.php:
|
247 |
msgid "Save Changes"
|
248 |
msgstr "Spara ändringar"
|
249 |
|
250 |
-
#: classes/autoptimizeConfig.php:
|
251 |
msgid "Save Changes and Empty Cache"
|
252 |
msgstr "Spara ändringar och töm cache"
|
253 |
|
254 |
-
#: classes/autoptimizeConfig.php:
|
255 |
msgid "futtta about"
|
256 |
msgstr "Om futtta"
|
257 |
|
|
|
258 |
#. Plugin Name of the plugin/theme
|
259 |
-
#: classes/autoptimizeConfig.php:
|
260 |
msgid "Autoptimize"
|
261 |
msgstr "Autoptimize"
|
262 |
|
263 |
-
#: classes/autoptimizeConfig.php:
|
264 |
msgid "WordPress"
|
265 |
msgstr "WordPress"
|
266 |
|
267 |
-
#: classes/autoptimizeConfig.php:
|
268 |
msgid "Web Technology"
|
269 |
msgstr "Webbteknik"
|
270 |
|
271 |
-
#: classes/autoptimizeConfig.php:
|
272 |
msgid "Do not donate for this plugin!"
|
273 |
msgstr "Donera inte för detta tillägg!"
|
274 |
|
275 |
-
#: classes/autoptimizeConfig.php:
|
276 |
msgid "Autoptimize Options"
|
277 |
msgstr "Autoptimize-alternativ"
|
278 |
|
279 |
-
#: classes/autoptimizeConfig.php:
|
280 |
msgid "Settings"
|
281 |
msgstr "Inställningar"
|
282 |
|
2 |
# This file is distributed under the same license as the Autoptimize package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Autoptimize 1.9.0\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/autoptimize\n"
|
7 |
+
"POT-Creation-Date: 2014-08-22 05:35:46+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2014-09-19 20:45+0100\n"
|
12 |
"Last-Translator: Jonathan Sulo <jonathan@sulo.se>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
+
"X-Generator: Poedit 1.5.4\n"
|
15 |
+
"Language: Swedish\n"
|
|
|
16 |
|
17 |
+
#: autoptimize.php:124
|
18 |
msgid ""
|
19 |
"Thank you for installing and activating Autoptimize. Please configure it "
|
20 |
"under \"Settings\" -> \"Autoptimize\" to start improving your site's "
|
21 |
"performance."
|
22 |
msgstr ""
|
23 |
+
"Tack för att du installerat och aktiverat Autoptimize. Vänligen konfigurera "
|
24 |
+
"det under \"Inställningar \" -> \"Autoptimize \" för att börja förbättra "
|
25 |
+
"prestandan på din sida."
|
26 |
|
27 |
+
#: autoptimize.php:130
|
28 |
msgid ""
|
29 |
"Autoptimize has just been updated. Please <strong>test your site now</"
|
30 |
"strong> and adapt Autoptimize config if needed."
|
32 |
"Autoptimize har precis uppdaterats. Vänligen <strong>testa din sida nu</"
|
33 |
"strong> och ändra inställningarna för Autoptimize vid behov. "
|
34 |
|
35 |
+
#: classes/autoptimizeConfig.php:48
|
36 |
msgid "Autoptimize Settings"
|
37 |
msgstr "Inställningar för Autoptimize"
|
38 |
|
39 |
+
#: classes/autoptimizeConfig.php:54 classes/autoptimizeConfig.php:60
|
40 |
msgid "Show advanced settings"
|
41 |
msgstr "Visa avancerade inställningar"
|
42 |
|
43 |
+
#: classes/autoptimizeConfig.php:55 classes/autoptimizeConfig.php:61
|
44 |
msgid "Hide advanced settings"
|
45 |
msgstr "Dölj avancerade inställningar"
|
46 |
|
47 |
+
#: classes/autoptimizeConfig.php:69
|
48 |
msgid "HTML Options"
|
49 |
msgstr "HTML-alternativ"
|
50 |
|
51 |
+
#: classes/autoptimizeConfig.php:72
|
52 |
msgid "Optimize HTML Code?"
|
53 |
msgstr "Optimera HTML-kod?"
|
54 |
|
55 |
+
#: classes/autoptimizeConfig.php:76
|
56 |
msgid "Keep HTML comments?"
|
57 |
msgstr "Behåll HTML-kommentarer?"
|
58 |
|
59 |
+
#: classes/autoptimizeConfig.php:78
|
60 |
msgid ""
|
61 |
"Enable this if you want HTML comments to remain in the page, needed for e.g. "
|
62 |
"AdSense to function properly."
|
64 |
"Välj detta för att behålla HTML-kommentarer på sidan, vilket behövs för att "
|
65 |
"t ex AdSense ska fungera bra."
|
66 |
|
67 |
+
#: classes/autoptimizeConfig.php:82
|
68 |
msgid "JavaScript Options"
|
69 |
msgstr "JavaScript-alternativ"
|
70 |
|
71 |
+
#: classes/autoptimizeConfig.php:85
|
72 |
msgid "Optimize JavaScript Code?"
|
73 |
msgstr "Optimera JavaScript-kod?"
|
74 |
|
75 |
+
#: classes/autoptimizeConfig.php:89
|
76 |
msgid "Force JavaScript in <head>?"
|
77 |
msgstr "Tvinga in JavaScript i <head>?"
|
78 |
|
79 |
+
#: classes/autoptimizeConfig.php:91
|
80 |
msgid ""
|
81 |
"For performance reasons it is better to include JavaScript at the bottom of "
|
82 |
"HTML, but this sometimes breaks things. Especially useful for jQuery-based "
|
86 |
"koden, men det kan ibland orsaka fel. Särskilt användbart för jQuery-"
|
87 |
"baserade teman."
|
88 |
|
89 |
+
#: classes/autoptimizeConfig.php:94
|
90 |
msgid "Look for scripts only in <head>?"
|
91 |
msgstr "Leta efter script enbart i <head>?"
|
92 |
|
93 |
+
#: classes/autoptimizeConfig.php:96
|
94 |
msgid ""
|
95 |
"Mostly usefull in combination with previous option when using jQuery-based "
|
96 |
"templates, but might help keeping cache size under control."
|
98 |
"Mest användbart i kombination med föregående alternativ, när jQuery-baserade "
|
99 |
"teman används, men kan även reducera storleken på cachen."
|
100 |
|
101 |
+
#: classes/autoptimizeConfig.php:99
|
102 |
msgid "Exclude scripts from Autoptimize:"
|
103 |
msgstr "Exkludera script från Autoptimize:"
|
104 |
|
105 |
+
#: classes/autoptimizeConfig.php:101
|
106 |
msgid ""
|
107 |
"A comma-seperated list of scripts you want to exclude from being optimized, "
|
108 |
"for example 'whatever.js, another.js' (without the quotes) to exclude those "
|
112 |
"Ange t ex 'whatever.js, another.js' (utan citattecken) för att inte "
|
113 |
"sammanfoga och minimera dessa script."
|
114 |
|
115 |
+
#: classes/autoptimizeConfig.php:104
|
116 |
msgid "Add try-catch wrapping?"
|
117 |
msgstr "Lägg till try-catch-inbäddning?"
|
118 |
|
119 |
+
#: classes/autoptimizeConfig.php:106
|
120 |
msgid ""
|
121 |
"If your scripts break because of an script error, you might want to try this."
|
122 |
msgstr ""
|
123 |
"Om script slutar fungera pga ett script-fel, testa då detta alternativ."
|
124 |
|
125 |
+
#: classes/autoptimizeConfig.php:110
|
126 |
msgid "CSS Options"
|
127 |
msgstr "CSS-alternativ"
|
128 |
|
129 |
+
#: classes/autoptimizeConfig.php:113
|
130 |
msgid "Optimize CSS Code?"
|
131 |
msgstr "Optimera CSS-kod?"
|
132 |
|
133 |
+
#: classes/autoptimizeConfig.php:117
|
134 |
msgid "Generate data: URIs for images?"
|
135 |
msgstr "Generera data: URI för bilder?"
|
136 |
|
137 |
+
#: classes/autoptimizeConfig.php:119
|
138 |
msgid ""
|
139 |
"Enable this to include small background-images in the CSS itself instead of "
|
140 |
"as seperate downloads."
|
142 |
"Välj detta för att inkludera mindre bakgrundsbilder direkt i CSS, istället "
|
143 |
"för som separata nedladdningar."
|
144 |
|
145 |
+
#: classes/autoptimizeConfig.php:122
|
146 |
msgid "Look for styles only in <head>?"
|
147 |
msgstr "Leta efter stilmallar enbart inom <head>?"
|
148 |
|
149 |
+
#: classes/autoptimizeConfig.php:124
|
150 |
msgid ""
|
151 |
"Don't autoptimize CSS outside the head-section. If the cache gets big, you "
|
152 |
"might want to enable this."
|
154 |
"Optimera inte CSS utanför head-sektionen. Om cachen blir för stor, testa då "
|
155 |
"detta alternativ."
|
156 |
|
157 |
+
#: classes/autoptimizeConfig.php:127
|
158 |
+
msgid "Inline and Defer CSS?"
|
159 |
+
msgstr "Inkludera och senarelägg inladdning av CSS?"
|
160 |
|
161 |
+
#: classes/autoptimizeConfig.php:129
|
162 |
msgid ""
|
163 |
+
"Inline \"above the fold CSS\" while loading the main autoptimized CSS only "
|
164 |
+
"after page load. <a href=\"http://wordpress.org/plugins/autoptimize/faq/\" "
|
165 |
+
"target=\"_blank\">Check the FAQ</a> before activating this option!"
|
166 |
msgstr ""
|
167 |
+
"Inkludera \"det första/above the fold CSS\" medan huvudsaklig autoptimerad "
|
168 |
+
"CSS laddas efter sidan har laddat. <a href=\"http://wordpress.org/plugins/"
|
169 |
+
"autoptimize/faq/\" target=\"_blank\">Kontrollera FAQ:n</a> innan detta "
|
170 |
+
"alternativ aktiveras!"
|
171 |
|
172 |
+
#: classes/autoptimizeConfig.php:133
|
173 |
+
msgid "Paste the above the fold CSS here."
|
174 |
+
msgstr "Klistra in det första/above the fold CSS här."
|
175 |
+
|
176 |
+
#: classes/autoptimizeConfig.php:136
|
177 |
msgid "Inline all CSS?"
|
178 |
msgstr "Inkludera all CSS?"
|
179 |
|
180 |
+
#: classes/autoptimizeConfig.php:138
|
181 |
msgid ""
|
182 |
"Inlining all CSS can improve performance for sites with a low pageviews/ "
|
183 |
+
"visitor-rate, but may slow down performance otherwise."
|
|
|
184 |
msgstr ""
|
185 |
"Att inkludera all CSS (inline) kan förbättra prestandan på sidor med få "
|
186 |
+
"sidvisningar/besökare, men det kan även försämra prestandan."
|
|
|
187 |
|
188 |
+
#: classes/autoptimizeConfig.php:141
|
189 |
msgid "Exclude CSS from Autoptimize:"
|
190 |
+
msgstr "Exkludera CSS från Autoptimize:"
|
191 |
|
192 |
+
#: classes/autoptimizeConfig.php:143
|
193 |
msgid "A comma-seperated list of CSS you want to exclude from being optimized."
|
194 |
msgstr ""
|
195 |
"En komma-separerad lista med stilmallar som ska exkluderas från optimering."
|
196 |
|
197 |
+
#: classes/autoptimizeConfig.php:147
|
198 |
msgid "CDN Options"
|
199 |
msgstr "CDN-alternativ"
|
200 |
|
201 |
+
#: classes/autoptimizeConfig.php:150
|
202 |
msgid "CDN Base URL"
|
203 |
msgstr "CDN bas-URL"
|
204 |
|
205 |
+
#: classes/autoptimizeConfig.php:152
|
206 |
msgid ""
|
207 |
"Enter your CDN blog root directory URL if you want to enable CDN for images "
|
208 |
"referenced in the CSS."
|
209 |
+
msgstr ""
|
210 |
+
"Ange sökväg med URL för din webbplats CDN om du vill aktivera CDN för bilder "
|
211 |
+
"anropade via CSS."
|
212 |
|
213 |
+
#: classes/autoptimizeConfig.php:156
|
214 |
msgid "Cache Info"
|
215 |
msgstr "Cache-information"
|
216 |
|
217 |
+
#: classes/autoptimizeConfig.php:159
|
218 |
msgid "Cache folder"
|
219 |
msgstr "Cache-mapp"
|
220 |
|
221 |
+
#: classes/autoptimizeConfig.php:163
|
222 |
msgid "Can we write?"
|
223 |
msgstr "Kan vi skriva?"
|
224 |
|
225 |
+
#: classes/autoptimizeConfig.php:164
|
226 |
msgid "Yes"
|
227 |
msgstr "Ja"
|
228 |
|
229 |
+
#: classes/autoptimizeConfig.php:164
|
230 |
msgid "No"
|
231 |
msgstr "Nej"
|
232 |
|
233 |
+
#: classes/autoptimizeConfig.php:167
|
234 |
msgid "Cached styles and scripts"
|
235 |
msgstr "Stilmallar och script i cachen"
|
236 |
|
237 |
+
#: classes/autoptimizeConfig.php:171
|
238 |
msgid "Save aggregated script/css as static files?"
|
239 |
msgstr "Spara sammanfogade script/stilmallar som statiska filer?"
|
240 |
|
241 |
+
#: classes/autoptimizeConfig.php:173
|
242 |
msgid ""
|
243 |
"By default files saved are static css/js, uncheck this option if your "
|
244 |
"webserver doesn't properly handle the compression and expiry."
|
246 |
"Som standard sparas filer som statisk CSS/Javascript. Välj detta alternativ "
|
247 |
"om din webbserver inte kan hantera komprimering och utgångstid ordentligt."
|
248 |
|
249 |
+
#: classes/autoptimizeConfig.php:179
|
250 |
msgid "Save Changes"
|
251 |
msgstr "Spara ändringar"
|
252 |
|
253 |
+
#: classes/autoptimizeConfig.php:180
|
254 |
msgid "Save Changes and Empty Cache"
|
255 |
msgstr "Spara ändringar och töm cache"
|
256 |
|
257 |
+
#: classes/autoptimizeConfig.php:188
|
258 |
msgid "futtta about"
|
259 |
msgstr "Om futtta"
|
260 |
|
261 |
+
#. #-#-#-#-# plugin.pot (Autoptimize 1.8.5) #-#-#-#-#
|
262 |
#. Plugin Name of the plugin/theme
|
263 |
+
#: classes/autoptimizeConfig.php:190
|
264 |
msgid "Autoptimize"
|
265 |
msgstr "Autoptimize"
|
266 |
|
267 |
+
#: classes/autoptimizeConfig.php:191
|
268 |
msgid "WordPress"
|
269 |
msgstr "WordPress"
|
270 |
|
271 |
+
#: classes/autoptimizeConfig.php:192
|
272 |
msgid "Web Technology"
|
273 |
msgstr "Webbteknik"
|
274 |
|
275 |
+
#: classes/autoptimizeConfig.php:197
|
276 |
msgid "Do not donate for this plugin!"
|
277 |
msgstr "Donera inte för detta tillägg!"
|
278 |
|
279 |
+
#: classes/autoptimizeConfig.php:313
|
280 |
msgid "Autoptimize Options"
|
281 |
msgstr "Autoptimize-alternativ"
|
282 |
|
283 |
+
#: classes/autoptimizeConfig.php:358 classes/autoptimizeConfig.php:364
|
284 |
msgid "Settings"
|
285 |
msgstr "Inställningar"
|
286 |
|
localization/autoptimize-uk_UA.mo
ADDED
Binary file
|
localization/autoptimize-uk_UA.po
ADDED
@@ -0,0 +1,378 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Autoptimize v1.9.1\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2014-12-02 21:53+0200\n"
|
7 |
+
"Last-Translator: ZAnatoly <zanatoly.web@gmail.com>\n"
|
8 |
+
"Language-Team: SebWeo.com\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=3; plural=n%100/10==1 ? 2 : n%10==1 ? 0 : (n"
|
13 |
+
"+9)%10>3 ? 2 : 1;\n"
|
14 |
+
"X-Generator: Poedit 1.6.11\n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
|
17 |
+
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
|
18 |
+
"X-Poedit-Basepath: ../\n"
|
19 |
+
"X-Textdomain-Support: yes\n"
|
20 |
+
"Language: uk_UA\n"
|
21 |
+
"X-Poedit-SearchPath-0: .\n"
|
22 |
+
|
23 |
+
# @ autoptimize
|
24 |
+
#. translators: plugin header field 'Name'
|
25 |
+
#: autoptimize.php:0 classes/autoptimizeConfig.php:190
|
26 |
+
msgid "Autoptimize"
|
27 |
+
msgstr ""
|
28 |
+
|
29 |
+
# @ autoptimize
|
30 |
+
#. translators: plugin header field 'PluginURI'
|
31 |
+
#: autoptimize.php:0
|
32 |
+
msgid "http://blog.futtta.be/autoptimize"
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
# @ autoptimize
|
36 |
+
#. translators: plugin header field 'Description'
|
37 |
+
#: autoptimize.php:0
|
38 |
+
msgid ""
|
39 |
+
"Optimizes your website, concatenating the CSS and JavaScript code, and "
|
40 |
+
"compressing it."
|
41 |
+
msgstr ""
|
42 |
+
"Оптимізує ваш сайт, об'єднуючи всі файли CSS і JavaScript в окремі, та "
|
43 |
+
"стискаючи їх."
|
44 |
+
|
45 |
+
# @ autoptimize
|
46 |
+
#. translators: plugin header field 'Author'
|
47 |
+
#: autoptimize.php:0
|
48 |
+
msgid "Frank Goossens (futtta)"
|
49 |
+
msgstr ""
|
50 |
+
|
51 |
+
# @ autoptimize
|
52 |
+
#. translators: plugin header field 'AuthorURI'
|
53 |
+
#: autoptimize.php:0
|
54 |
+
msgid "http://blog.futtta.be/"
|
55 |
+
msgstr ""
|
56 |
+
|
57 |
+
# @ autoptimize
|
58 |
+
#. translators: plugin header field 'Version'
|
59 |
+
#: autoptimize.php:0
|
60 |
+
msgid "1.9.1"
|
61 |
+
msgstr ""
|
62 |
+
|
63 |
+
# @ autoptimize
|
64 |
+
#: autoptimize.php:124
|
65 |
+
msgid ""
|
66 |
+
"Thank you for installing and activating Autoptimize. Please configure it "
|
67 |
+
"under \"Settings\" -> \"Autoptimize\" to start improving your site's "
|
68 |
+
"performance."
|
69 |
+
msgstr ""
|
70 |
+
"Дякуємо за встановлення та активацію Autoptimize. Будь ласка, налаштуйте "
|
71 |
+
"його в \"Інструменти\" -> \"Autoptimize\", щоб почати оптимізацію сайту."
|
72 |
+
|
73 |
+
# @ autoptimize
|
74 |
+
#: autoptimize.php:130
|
75 |
+
msgid ""
|
76 |
+
"Autoptimize has just been updated. Please <strong>test your site now</"
|
77 |
+
"strong> and adapt Autoptimize config if needed."
|
78 |
+
msgstr ""
|
79 |
+
"Autoptimize щойно був оновлений. Будь ласка, <strong> перевірте свій сайт "
|
80 |
+
"зараз </strong> та налаштуйте конфігурацію Autoptimize, якщо необхідно."
|
81 |
+
|
82 |
+
# @ autoptimize
|
83 |
+
#: classes/autoptimizeConfig.php:48
|
84 |
+
msgid "Autoptimize Settings"
|
85 |
+
msgstr "Налаштування Autoptimize"
|
86 |
+
|
87 |
+
# @ autoptimize
|
88 |
+
#: classes/autoptimizeConfig.php:54 classes/autoptimizeConfig.php:60
|
89 |
+
msgid "Show advanced settings"
|
90 |
+
msgstr "Показати розширені налаштування"
|
91 |
+
|
92 |
+
# @ autoptimize
|
93 |
+
#: classes/autoptimizeConfig.php:55 classes/autoptimizeConfig.php:61
|
94 |
+
msgid "Hide advanced settings"
|
95 |
+
msgstr "Приховати розширені параметри"
|
96 |
+
|
97 |
+
# @ autoptimize
|
98 |
+
#: classes/autoptimizeConfig.php:69
|
99 |
+
msgid "HTML Options"
|
100 |
+
msgstr "Опції HTML"
|
101 |
+
|
102 |
+
# @ autoptimize
|
103 |
+
#: classes/autoptimizeConfig.php:72
|
104 |
+
msgid "Optimize HTML Code?"
|
105 |
+
msgstr "Оптимізувати HTML код?"
|
106 |
+
|
107 |
+
# @ autoptimize
|
108 |
+
#: classes/autoptimizeConfig.php:76
|
109 |
+
msgid "Keep HTML comments?"
|
110 |
+
msgstr "Залишити HTML-коментарі?"
|
111 |
+
|
112 |
+
# @ autoptimize
|
113 |
+
#: classes/autoptimizeConfig.php:78
|
114 |
+
msgid ""
|
115 |
+
"Enable this if you want HTML comments to remain in the page, needed for e.g. "
|
116 |
+
"AdSense to function properly."
|
117 |
+
msgstr ""
|
118 |
+
"Включіть, якщо ви хочете залишити HTML-коментарі на сторінці, які необхідні, "
|
119 |
+
"наприклад, для нормального функціонування реклами AdSense."
|
120 |
+
|
121 |
+
# @ autoptimize
|
122 |
+
#: classes/autoptimizeConfig.php:82
|
123 |
+
msgid "JavaScript Options"
|
124 |
+
msgstr "Опції JavaScript"
|
125 |
+
|
126 |
+
# @ autoptimize
|
127 |
+
#: classes/autoptimizeConfig.php:85
|
128 |
+
msgid "Optimize JavaScript Code?"
|
129 |
+
msgstr "Оптимізувати код JavaScript?"
|
130 |
+
|
131 |
+
# @ autoptimize
|
132 |
+
#: classes/autoptimizeConfig.php:89
|
133 |
+
msgid "Force JavaScript in <head>?"
|
134 |
+
msgstr "Перемістити код JavaScript в секцію <head>?"
|
135 |
+
|
136 |
+
# @ autoptimize
|
137 |
+
#: classes/autoptimizeConfig.php:91
|
138 |
+
msgid ""
|
139 |
+
"For performance reasons it is better to include JavaScript at the bottom of "
|
140 |
+
"HTML, but this sometimes breaks things. Especially useful for jQuery-based "
|
141 |
+
"themes."
|
142 |
+
msgstr ""
|
143 |
+
"Для підвищення продуктивності краще розміщувати JavaScript в нижній частині "
|
144 |
+
"HTML, але іноді він потрібен і в секції head. Особливо для тем на основі "
|
145 |
+
"jQuery."
|
146 |
+
|
147 |
+
# @ autoptimize
|
148 |
+
#: classes/autoptimizeConfig.php:94
|
149 |
+
msgid "Look for scripts only in <head>?"
|
150 |
+
msgstr "Оптимізувати скрипти тільки в секції <head>?"
|
151 |
+
|
152 |
+
# @ autoptimize
|
153 |
+
#: classes/autoptimizeConfig.php:96
|
154 |
+
msgid ""
|
155 |
+
"Mostly usefull in combination with previous option when using jQuery-based "
|
156 |
+
"templates, but might help keeping cache size under control."
|
157 |
+
msgstr ""
|
158 |
+
"Корисна опція (в поєднанні з попередньою опцією), при використанні шаблонів "
|
159 |
+
"на основі jQuery, що може допомогти контролювати розмір кешу."
|
160 |
+
|
161 |
+
# @ autoptimize
|
162 |
+
#: classes/autoptimizeConfig.php:99
|
163 |
+
msgid "Exclude scripts from Autoptimize:"
|
164 |
+
msgstr "Не оптимізувати за допомогою Autoptimize наступні скрипти:"
|
165 |
+
|
166 |
+
# @ autoptimize
|
167 |
+
#: classes/autoptimizeConfig.php:101
|
168 |
+
msgid ""
|
169 |
+
"A comma-seperated list of scripts you want to exclude from being optimized, "
|
170 |
+
"for example 'whatever.js, another.js' (without the quotes) to exclude those "
|
171 |
+
"scripts from being aggregated and minimized by Autoptimize."
|
172 |
+
msgstr ""
|
173 |
+
"Розділений комами список скриптів для виключення від обробки, наприклад "
|
174 |
+
"'whatever.js, another.js' (без апострофів). Ці скрипти не будуть "
|
175 |
+
"оброблюватись та мінімізуватись плагіном Autoptimize."
|
176 |
+
|
177 |
+
# @ autoptimize
|
178 |
+
#: classes/autoptimizeConfig.php:104
|
179 |
+
msgid "Add try-catch wrapping?"
|
180 |
+
msgstr "Додати інструкцію виключення?"
|
181 |
+
|
182 |
+
# @ autoptimize
|
183 |
+
#: classes/autoptimizeConfig.php:106
|
184 |
+
msgid ""
|
185 |
+
"If your scripts break because of an script error, you might want to try this."
|
186 |
+
msgstr ""
|
187 |
+
"Якщо ваші скрипти не працюють через помилку, ви можете спробувати це "
|
188 |
+
"налаштування."
|
189 |
+
|
190 |
+
# @ autoptimize
|
191 |
+
#: classes/autoptimizeConfig.php:110
|
192 |
+
msgid "CSS Options"
|
193 |
+
msgstr "Опції CSS"
|
194 |
+
|
195 |
+
# @ autoptimize
|
196 |
+
#: classes/autoptimizeConfig.php:113
|
197 |
+
msgid "Optimize CSS Code?"
|
198 |
+
msgstr "Оптимізувати CSS код?"
|
199 |
+
|
200 |
+
# @ autoptimize
|
201 |
+
#: classes/autoptimizeConfig.php:117
|
202 |
+
msgid "Generate data: URIs for images?"
|
203 |
+
msgstr "Створення даних: URI для зображень?"
|
204 |
+
|
205 |
+
# @ autoptimize
|
206 |
+
#: classes/autoptimizeConfig.php:119
|
207 |
+
msgid ""
|
208 |
+
"Enable this to include small background-images in the CSS itself instead of "
|
209 |
+
"as seperate downloads."
|
210 |
+
msgstr ""
|
211 |
+
"Цей параметр використовується, щоб включати невеликі фонові зображення в сам "
|
212 |
+
"код CSS, а не як окреме завантаження картинок."
|
213 |
+
|
214 |
+
# @ autoptimize
|
215 |
+
#: classes/autoptimizeConfig.php:122
|
216 |
+
msgid "Look for styles only in <head>?"
|
217 |
+
msgstr "Шукати файли CSS тільки в секції <head>?"
|
218 |
+
|
219 |
+
# @ autoptimize
|
220 |
+
#: classes/autoptimizeConfig.php:124
|
221 |
+
msgid ""
|
222 |
+
"Don't autoptimize CSS outside the head-section. If the cache gets big, you "
|
223 |
+
"might want to enable this."
|
224 |
+
msgstr ""
|
225 |
+
"Не оптимізувати CSS за межами секції head. Якщо кеш виходить завеликим, вам, "
|
226 |
+
"можливо, допоможе включення цієї опції."
|
227 |
+
|
228 |
+
# @ autoptimize
|
229 |
+
#: classes/autoptimizeConfig.php:127
|
230 |
+
msgid "Inline and Defer CSS?"
|
231 |
+
msgstr "Вбудовані та відкладені CSS?"
|
232 |
+
|
233 |
+
# @ autoptimize
|
234 |
+
#: classes/autoptimizeConfig.php:129
|
235 |
+
msgid ""
|
236 |
+
"Inline \"above the fold CSS\" while loading the main autoptimized CSS only "
|
237 |
+
"after page load. <a href=\"http://wordpress.org/plugins/autoptimize/faq/\" "
|
238 |
+
"target=\"_blank\">Check the FAQ</a> before activating this option!"
|
239 |
+
msgstr ""
|
240 |
+
"Вбудовувати \"над цим CSS\" при завантаженні основного CSS, оптимізованого "
|
241 |
+
"плагіном, тільки після завантаження сторінки. <a href=\"http://wordpress.org/"
|
242 |
+
"plugins/autoptimize/faq/\" target=\"_blank\">Ознайомтесь із FAQ</a>, перш "
|
243 |
+
"ніж активувати цю опцію!"
|
244 |
+
|
245 |
+
# @ autoptimize
|
246 |
+
#: classes/autoptimizeConfig.php:133
|
247 |
+
msgid "Paste the above the fold CSS here."
|
248 |
+
msgstr "Вставити над цим CSS."
|
249 |
+
|
250 |
+
# @ autoptimize
|
251 |
+
#: classes/autoptimizeConfig.php:136
|
252 |
+
msgid "Inline all CSS?"
|
253 |
+
msgstr "Вбудувати весь код CSS?"
|
254 |
+
|
255 |
+
# @ autoptimize
|
256 |
+
#: classes/autoptimizeConfig.php:138
|
257 |
+
msgid ""
|
258 |
+
"Inlining all CSS can improve performance for sites with a low pageviews/ "
|
259 |
+
"visitor-rate, but may slow down performance otherwise."
|
260 |
+
msgstr ""
|
261 |
+
"Вбудовування всього CSS може підвищити продуктивність сайтів з низьким "
|
262 |
+
"рівнем переглядів на одного відвідувача сайту, але може уповільнити роботу в "
|
263 |
+
"інших випадках."
|
264 |
+
|
265 |
+
# @ autoptimize
|
266 |
+
#: classes/autoptimizeConfig.php:141
|
267 |
+
msgid "Exclude CSS from Autoptimize:"
|
268 |
+
msgstr "Виключити файли CSS від обробки Autoptimize:"
|
269 |
+
|
270 |
+
# @ autoptimize
|
271 |
+
#: classes/autoptimizeConfig.php:143
|
272 |
+
msgid "A comma-seperated list of CSS you want to exclude from being optimized."
|
273 |
+
msgstr ""
|
274 |
+
"Напишіть перелік файлів CSS (розділені комами), які ви не хочете "
|
275 |
+
"оптимізувати."
|
276 |
+
|
277 |
+
# @ autoptimize
|
278 |
+
#: classes/autoptimizeConfig.php:147
|
279 |
+
msgid "CDN Options"
|
280 |
+
msgstr "Опції CDN"
|
281 |
+
|
282 |
+
# @ autoptimize
|
283 |
+
#: classes/autoptimizeConfig.php:150
|
284 |
+
msgid "CDN Base URL"
|
285 |
+
msgstr "Головний URL CDN"
|
286 |
+
|
287 |
+
# @ autoptimize
|
288 |
+
#: classes/autoptimizeConfig.php:152
|
289 |
+
msgid ""
|
290 |
+
"Enter your CDN blog root directory URL if you want to enable CDN for images "
|
291 |
+
"referenced in the CSS."
|
292 |
+
msgstr ""
|
293 |
+
"Вкажіть основний URL сайту каталогів CDN, якщо ви хочете використовувати CDN "
|
294 |
+
"для зображень, що підключаються в CSS."
|
295 |
+
|
296 |
+
# @ autoptimize
|
297 |
+
#: classes/autoptimizeConfig.php:156
|
298 |
+
msgid "Cache Info"
|
299 |
+
msgstr "Інформація кешу"
|
300 |
+
|
301 |
+
# @ autoptimize
|
302 |
+
#: classes/autoptimizeConfig.php:159
|
303 |
+
msgid "Cache folder"
|
304 |
+
msgstr "Папка кешу"
|
305 |
+
|
306 |
+
# @ autoptimize
|
307 |
+
#: classes/autoptimizeConfig.php:163
|
308 |
+
msgid "Can we write?"
|
309 |
+
msgstr "Ми можемо записати?"
|
310 |
+
|
311 |
+
# @ autoptimize
|
312 |
+
#: classes/autoptimizeConfig.php:164
|
313 |
+
msgid "Yes"
|
314 |
+
msgstr "Так"
|
315 |
+
|
316 |
+
# @ autoptimize
|
317 |
+
#: classes/autoptimizeConfig.php:164
|
318 |
+
msgid "No"
|
319 |
+
msgstr "Ні"
|
320 |
+
|
321 |
+
# @ autoptimize
|
322 |
+
#: classes/autoptimizeConfig.php:167
|
323 |
+
msgid "Cached styles and scripts"
|
324 |
+
msgstr "Кешувати стилі та скрипти"
|
325 |
+
|
326 |
+
# @ autoptimize
|
327 |
+
#: classes/autoptimizeConfig.php:171
|
328 |
+
msgid "Save aggregated script/css as static files?"
|
329 |
+
msgstr "Зберігати отримані скрипти/стилі як статичні файли?"
|
330 |
+
|
331 |
+
# @ autoptimize
|
332 |
+
#: classes/autoptimizeConfig.php:173
|
333 |
+
msgid ""
|
334 |
+
"By default files saved are static css/js, uncheck this option if your "
|
335 |
+
"webserver doesn't properly handle the compression and expiry."
|
336 |
+
msgstr ""
|
337 |
+
"За замовчуванням файли зберігаються як статичні css/js, зніміть галочку, "
|
338 |
+
"якщо ваш веб-сервер не правильно обробляє стистення та застарий."
|
339 |
+
|
340 |
+
# @ autoptimize
|
341 |
+
#: classes/autoptimizeConfig.php:179
|
342 |
+
msgid "Save Changes"
|
343 |
+
msgstr "Зберегти зміни"
|
344 |
+
|
345 |
+
# @ autoptimize
|
346 |
+
#: classes/autoptimizeConfig.php:180
|
347 |
+
msgid "Save Changes and Empty Cache"
|
348 |
+
msgstr "Зберегти зміни та очистити кеш"
|
349 |
+
|
350 |
+
# @ autoptimize
|
351 |
+
#: classes/autoptimizeConfig.php:188
|
352 |
+
msgid "futtta about"
|
353 |
+
msgstr "про futtta"
|
354 |
+
|
355 |
+
# @ autoptimize
|
356 |
+
#: classes/autoptimizeConfig.php:191
|
357 |
+
msgid "WordPress"
|
358 |
+
msgstr ""
|
359 |
+
|
360 |
+
# @ autoptimize
|
361 |
+
#: classes/autoptimizeConfig.php:192
|
362 |
+
msgid "Web Technology"
|
363 |
+
msgstr ""
|
364 |
+
|
365 |
+
# @ default
|
366 |
+
#: classes/autoptimizeConfig.php:197
|
367 |
+
msgid "Do not donate for this plugin!"
|
368 |
+
msgstr ""
|
369 |
+
|
370 |
+
# @ autoptimize
|
371 |
+
#: classes/autoptimizeConfig.php:316
|
372 |
+
msgid "Autoptimize Options"
|
373 |
+
msgstr "Опції Autoptimize"
|
374 |
+
|
375 |
+
# @ default
|
376 |
+
#: classes/autoptimizeConfig.php:361 classes/autoptimizeConfig.php:367
|
377 |
+
msgid "Settings"
|
378 |
+
msgstr ""
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Autoptimize ===
|
2 |
Contributors: futtta, turl
|
3 |
-
Tags: css, html, javascript, js, optimize, speed, cache, data-uri, aggregate, minimize, minification, performance, pagespeed, booster, multisite
|
4 |
Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
|
5 |
Requires at least: 2.7
|
6 |
Tested up to: 4.1
|
7 |
-
Stable tag: 1.9.
|
8 |
|
9 |
Autoptimize speeds up your website and helps you save bandwidth by aggregating and minimizing JS, CSS and HTML.
|
10 |
|
@@ -33,6 +33,12 @@ It concatenates all scripts and styles, minifies and compresses them, adds expir
|
|
33 |
|
34 |
Although Autoptimize comes without any warranties, it will in general work flawlessly if you configure it correctly. See "Troubleshooting" below for info on how to configure in case of problems.
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
= What is the use of "inline and defer CSS"? =
|
37 |
|
38 |
CSS in general should go in the head of the document. Recently a.o. Google started promoting deferring non-essential CSS, while inlining those styles needed to build the page above the fold. This is especially important to render pages as quickly as possible on mobile devices. As from Autoptimize 1.9.0 this is easy; select "inline and defer CSS", paste the block of "above the fold CSS" in the input field (text area) and you're good to go!
|
@@ -55,13 +61,17 @@ You can find more information on this topic [in this blog post](http://blog.futt
|
|
55 |
|
56 |
= My cache is getting huge, doesn't Autoptimize purge the cache? =
|
57 |
|
58 |
-
Autoptimize does not have its proper cache purging mechanism, as this could remove optimized CSS/JS which is still referred to in other caches which would break your site.
|
|
|
|
|
59 |
|
60 |
-
|
|
|
|
|
61 |
|
62 |
= What can I do with the API? =
|
63 |
|
64 |
-
A whole lot; there are filters you can use to conditionally disable Autoptimize per request, to change the CSS- and JS-excludes, to change the limit for CSS background-images to be inlined in the CSS, to define what JS-files are moved behing the aggregated on, to change the defer-attribute on the aggregated JS script-tag,
|
65 |
|
66 |
= How can I use/ activate autoptimize_helper.php_example? =
|
67 |
|
@@ -69,7 +79,7 @@ Copy it to /wp-content/plugins/autoptimize_helper.php and activate it in WordPre
|
|
69 |
|
70 |
= How does CDN work? =
|
71 |
|
72 |
-
Starting from version 1.7.0, CDN is activated upon entering the CDN blog root directory (e.g. http://cdn.example.net/wordpress/). If that URL is present, it will used for all Autoptimize-generated files (i.e. aggregated CSS and JS),
|
73 |
|
74 |
If you want your uploaded images to be on the CDN as well, you can change the upload_url_path in your WordPress configuration (/wp-admin/options.php) to the target CDN upload directory (e.g. http://cdn.example.net/wordpress/wp-content/uploads/). Do take into consideration this only works for images uploaded from that point onwards, not for images that already were uploaded. Thanks to [BeautyPirate for the tip](http://wordpress.org/support/topic/please-don%c2%b4t-remove-cdn?replies=15#post-4720048)!
|
75 |
|
@@ -101,6 +111,14 @@ If your blog doesn't function normally after having turned on Autoptimize, here
|
|
101 |
* If you can't get either CSS or JS optimization working, you can off course always continue using the other two optimization-techniques.
|
102 |
* If you tried the troubleshooting tips above and you still can't get CSS and JS working at all, you can ask for support on the [WordPress Autoptimize support forum](http://wordpress.org/support/plugin/autoptimize). See below for a description of what information you should provide in your "trouble ticket"
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
= What is noptimize? =
|
105 |
|
106 |
Starting with version 1.6.6 Autoptimize excludes everything inside noptimize tags, e.g.:
|
@@ -108,6 +126,19 @@ Starting with version 1.6.6 Autoptimize excludes everything inside noptimize tag
|
|
108 |
|
109 |
You can do this in your page/ post content, in widgets and in your theme files (consider creating [a child theme](http://codex.wordpress.org/Child_Themes) to avoid your work being overwritten by theme updates).
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
= Where can I report an error? =
|
112 |
|
113 |
You can report problems on the [wordpress.org support forum](http://wordpress.org/support/plugin/autoptimize), or [contact the maintainer using this contact form](http://blog.futtta.be/contact/).
|
@@ -121,12 +152,31 @@ You can report problems on the [wordpress.org support forum](http://wordpress.or
|
|
121 |
* optionally plugins used (if you suspect one or more plugins are raising havoc)
|
122 |
|
123 |
= I want out, how should I remove Autoptimize? =
|
|
|
124 |
* Disable the plugin (this will remove options and cache)
|
125 |
* Remove the plugin
|
126 |
* Clear any cache that might still have pages which reference Autoptimized CSS/JS (e.g. of a page caching plugin such as WP Super Cache)
|
127 |
|
|
|
|
|
|
|
|
|
128 |
== Changelog ==
|
129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
= 1.9.1 =
|
131 |
* hard-exclude [the sidelink-search-box introduced in WP SEO v1.6](http://wordpress.org/plugins/wordpress-seo/changelog/) from JS optimization (this [broke some JS-optimization badly](http://wordpress.org/support/topic/190-breaks-js?replies=4))
|
132 |
* bugfix: first add semi-colon to inline script, only then add try-catch if required instead of the other way around.
|
1 |
=== Autoptimize ===
|
2 |
Contributors: futtta, turl
|
3 |
+
Tags: css, html, javascript, js, optimize, speed, cache, data-uri, aggregate, minimize, minification, performance, pagespeed, booster, multisite, minify
|
4 |
Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
|
5 |
Requires at least: 2.7
|
6 |
Tested up to: 4.1
|
7 |
+
Stable tag: 1.9.2
|
8 |
|
9 |
Autoptimize speeds up your website and helps you save bandwidth by aggregating and minimizing JS, CSS and HTML.
|
10 |
|
33 |
|
34 |
Although Autoptimize comes without any warranties, it will in general work flawlessly if you configure it correctly. See "Troubleshooting" below for info on how to configure in case of problems.
|
35 |
|
36 |
+
= I activated Autoptimize, but Google Pagespeed Insight still complains? =
|
37 |
+
|
38 |
+
If you have render-blocking JS: be sure not to tick the "force JS in head" if not absolutely needed.
|
39 |
+
|
40 |
+
If you have render-blocking CSS: consider to "inline" or "inline and defer" your CSS. There's more info on these topics below.
|
41 |
+
|
42 |
= What is the use of "inline and defer CSS"? =
|
43 |
|
44 |
CSS in general should go in the head of the document. Recently a.o. Google started promoting deferring non-essential CSS, while inlining those styles needed to build the page above the fold. This is especially important to render pages as quickly as possible on mobile devices. As from Autoptimize 1.9.0 this is easy; select "inline and defer CSS", paste the block of "above the fold CSS" in the input field (text area) and you're good to go!
|
61 |
|
62 |
= My cache is getting huge, doesn't Autoptimize purge the cache? =
|
63 |
|
64 |
+
Autoptimize does not have its proper cache purging mechanism, as this could remove optimized CSS/JS which is still referred to in other caches, which would break your site.
|
65 |
+
|
66 |
+
You can however keep the cache size at an acceptable level by either:
|
67 |
|
68 |
+
* ticking the "look only in head" option for JS and/or CSS.
|
69 |
+
* using the API to force AO not to aggregate inline CSS or JS (see example-code in autoptimize_helper.php_example).
|
70 |
+
* excluding JS-variables (or sometimes CSS-selectors) that change on a per page (or per pageload) basis. You can read how you can do that [in this blogpost](http://blog.futtta.be/2014/03/19/how-to-keep-autoptimizes-cache-size-under-control-and-improve-visitor-experience/).
|
71 |
|
72 |
= What can I do with the API? =
|
73 |
|
74 |
+
A whole lot; there are filters you can use to conditionally disable Autoptimize per request, to change the CSS- and JS-excludes, to change the limit for CSS background-images to be inlined in the CSS, to define what JS-files are moved behing the aggregated on, to change the defer-attribute on the aggregated JS script-tag, ... There are examples for many filters in autoptimize_helper.php_example.
|
75 |
|
76 |
= How can I use/ activate autoptimize_helper.php_example? =
|
77 |
|
79 |
|
80 |
= How does CDN work? =
|
81 |
|
82 |
+
Starting from version 1.7.0, CDN is activated upon entering the CDN blog root directory (e.g. http://cdn.example.net/wordpress/). If that URL is present, it will used for all Autoptimize-generated files (i.e. aggregated CSS and JS), including background-images in the CSS (when not using data-uri's).
|
83 |
|
84 |
If you want your uploaded images to be on the CDN as well, you can change the upload_url_path in your WordPress configuration (/wp-admin/options.php) to the target CDN upload directory (e.g. http://cdn.example.net/wordpress/wp-content/uploads/). Do take into consideration this only works for images uploaded from that point onwards, not for images that already were uploaded. Thanks to [BeautyPirate for the tip](http://wordpress.org/support/topic/please-don%c2%b4t-remove-cdn?replies=15#post-4720048)!
|
85 |
|
111 |
* If you can't get either CSS or JS optimization working, you can off course always continue using the other two optimization-techniques.
|
112 |
* If you tried the troubleshooting tips above and you still can't get CSS and JS working at all, you can ask for support on the [WordPress Autoptimize support forum](http://wordpress.org/support/plugin/autoptimize). See below for a description of what information you should provide in your "trouble ticket"
|
113 |
|
114 |
+
= Help, I have a blank page after enabling Autoptimize!! =
|
115 |
+
|
116 |
+
In some rare cases the [CSS minification component](https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port/) currently used by Autoptimize crashes due to a lack of resources (see [detailed technical explanation here](http://blog.futtta.be/2014/01/14/irregular-expressions-have-your-stack-for-lunch/)). You can in that case either disable CSS optimization, try to exclude specific CSS from being aggregated or activate the legacy minifiers which don't have that problem. The latter can be accomplished by adding this to your wp-config.php:
|
117 |
+
|
118 |
+
`define("AUTOPTIMIZE_LEGACY_MINIFIERS","true");`
|
119 |
+
|
120 |
+
The "legacy minifiers" will remain in Autoptimize "for ever" and changes to wp-config.php are not affected by core-, theme- or plugin-upgrades so you should be good to go.
|
121 |
+
|
122 |
= What is noptimize? =
|
123 |
|
124 |
Starting with version 1.6.6 Autoptimize excludes everything inside noptimize tags, e.g.:
|
126 |
|
127 |
You can do this in your page/ post content, in widgets and in your theme files (consider creating [a child theme](http://codex.wordpress.org/Child_Themes) to avoid your work being overwritten by theme updates).
|
128 |
|
129 |
+
= Can I change the directory & filename of cached autoptimize files? =
|
130 |
+
|
131 |
+
Yes, if you want to serve files from e.g. /wp-content/resources/aggregated_12345.css instead of the default /wp-content/cache/autoptimize/autoptimize_12345.css, then add this to wp-config.php:
|
132 |
+
`
|
133 |
+
define('AUTOPTIMIZE_CACHE_CHILD_DIR','/resources/');
|
134 |
+
define('AUTOPTIMIZE_CACHEFILE_PREFIX','aggregated_');
|
135 |
+
`
|
136 |
+
|
137 |
+
If you renamed your wp-content-folder, you can tell Autoptimize about that with;
|
138 |
+
`
|
139 |
+
define( 'AUTOPTIMIZE_WP_CONTENT_NAME','/content' );
|
140 |
+
`
|
141 |
+
|
142 |
= Where can I report an error? =
|
143 |
|
144 |
You can report problems on the [wordpress.org support forum](http://wordpress.org/support/plugin/autoptimize), or [contact the maintainer using this contact form](http://blog.futtta.be/contact/).
|
152 |
* optionally plugins used (if you suspect one or more plugins are raising havoc)
|
153 |
|
154 |
= I want out, how should I remove Autoptimize? =
|
155 |
+
|
156 |
* Disable the plugin (this will remove options and cache)
|
157 |
* Remove the plugin
|
158 |
* Clear any cache that might still have pages which reference Autoptimized CSS/JS (e.g. of a page caching plugin such as WP Super Cache)
|
159 |
|
160 |
+
= How can I help/ contribute? =
|
161 |
+
|
162 |
+
Just [fork Autoptimize on Github](https://github.com/futtta/autoptimize) and code away!
|
163 |
+
|
164 |
== Changelog ==
|
165 |
|
166 |
+
= 1.9.2 =
|
167 |
+
First of all; Happy holidays, all the best for 2015!!
|
168 |
+
|
169 |
+
* New: support for alternative cache-directory and file-prefix as requested by a.o. [Jassi Bacha](https://wordpress.org/support/topic/requesthelp-add-ability-to-specify-cache-folder?replies=1#post-6300128), [Cluster666](https://wordpress.org/support/topic/rewrite-js-path?replies=6#post-6363535) and Baris Unver.
|
170 |
+
* Improvement: hard-exclude all linked-data json objects (script type=application/ld+json)
|
171 |
+
* Improvement: several filters added to the API, e.g. to alter optimized HTML, CSS or JS
|
172 |
+
* Bugfix: set Autoptimize priority back from 11 to 2 (as previously) to avoid some pages not being optimized (thanks to [CaveatLector for investigating & reporting](https://wordpress.org/support/topic/wp-property-plugin-add_action-priority-incompatibility?replies=1))
|
173 |
+
* Bugfix (in YUI-CSS-compressor-PHP-port): don't convert bools to percentages in rotate3D-transforms (cfr. [bugreport on Github](https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port/issues/17))
|
174 |
+
* Bugfix: background images with a space in the path didn't load, [reported by johnh10](https://wordpress.org/support/topic/optimize-css-code-error-with-background-image-elements?replies=6#post-6201582).
|
175 |
+
* Bugfix: SVG image with fill:url broken after CSS optimization as [reported by Tkama](https://wordpress.org/support/topic/one-more-broblem-with-plugin?replies=2)
|
176 |
+
* Updated translation for Swedish, new translation for Ukrainian by [Zanatoly of SebWeo.com](http://SebWeo.com)
|
177 |
+
* Updated readme.txt
|
178 |
+
* Confirmed working with WordPress 4.1
|
179 |
+
|
180 |
= 1.9.1 =
|
181 |
* hard-exclude [the sidelink-search-box introduced in WP SEO v1.6](http://wordpress.org/plugins/wordpress-seo/changelog/) from JS optimization (this [broke some JS-optimization badly](http://wordpress.org/support/topic/190-breaks-js?replies=4))
|
182 |
* bugfix: first add semi-colon to inline script, only then add try-catch if required instead of the other way around.
|