PluginProbe
Autoptimize / trunk
Autoptimize vtrunk
3.1.16 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 All 108 releases
← All changes | autoptimize_helper.php_example +9 -9 2.3.4 → trunk View file →
@@ -4,9 +4,9 @@
4 4 Plugin URI: http://blog.futtta.be/autoptimize
5 5 Description: Autoptimize Helper contains some helper functions to make Autoptimize even more flexible
6 6 Author: Frank Goossens (futtta)
7 7 Version: 0.2
8 -Author URI: http://blog.futtta.be/
8 +Author URI: http://blog.futtta.be/
9 9 */
10 10
11 11 /* autoptimize_filter_css_datauri_maxsize: change the threshold at which background images are turned into data uri's;
12 12
@@ -22,9 +22,9 @@
22 22 @param $imageexcl: default images excluded (empty)
23 23 @return: comma-seperated list of images to exclude */
24 24 // add_filter('autoptimize_filter_css_datauri_exclude','my_ao_exclude_image',10,1);
25 25 function my_ao_exclude_image($imageexcl) {
26 - return "adfreebutton.jpg, otherimage.png";
26 + return $imageexcl . ", adfreebutton.jpg, otherimage.png";
27 27 }
28 28
29 29 /* autoptimize_filter_js_defer: change flag added to javascript
30 30
@@ -32,19 +32,19 @@
32 32 @return: new value */
33 33 // add_filter('autoptimize_filter_js_defer','my_ao_override_defer',10,1);
34 34 function my_ao_override_defer($defer) {
35 35 return $defer."async ";
36 -}
36 +}
37 37
38 38 /* autoptimize_filter_noptimize: stop autoptimize from optimizing, e.g. based on URL as in example
39 39
40 40 @return: boolean, true or false */
41 -// add_filter('autoptimize_filter_noptimize','my_ao_noptimize',10,0);
42 -function my_ao_noptimize() {
41 +// add_filter('autoptimize_filter_noptimize','my_ao_noptimize',10,1);
42 +function my_ao_noptimize( $flag_in ) {
43 43 if (strpos($_SERVER['REQUEST_URI'],'no-autoptimize-now')!==false) {
44 44 return true;
45 45 } else {
46 - return false;
46 + return $flag_in;
47 47 }
48 48 }
49 49
50 50 /* autoptimize_filter_js_exclude; JS optimization exclude strings, as configured in admin page
@@ -132,12 +132,12 @@
132 132 // add_filter('autoptimize_filter_css_defer_inline','my_ao_css_defer_inline',10,1);
133 133 function my_ao_css_defer_inline($inlined) {
134 134 return $inlined."h2,h1{color:red !important;}";
135 135 }
136 -
136 +
137 137 /* autoptimize_filter_css_fonts_cdn: do we want to move fonts to the CDN-url as well
138 138
139 -@return: false (default) or true */
139 +@return: false (default) or true */
140 140 // add_filter('autoptimize_filter_css_fonts_cdn','my_css_cdnfont',10,0);
141 141 function my_css_cdnfont(){
142 - return true;
142 + return true;
143 143 }