Autoptimize - Version 0.3

Version Description

  • Disable CSS media on @imports - caused an infinite loop
Download this release

Release Info

Developer turl
Plugin Icon 128x128 Autoptimize
Version 0.3
Comparing to
See all releases

Code changes from version 0.2 to 0.3

Files changed (3) hide show
  1. autoptimize.php +1 -1
  2. classes/autoptimizeStyles.php +5 -13
  3. readme.txt +4 -1
autoptimize.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Autoptimize
4
  Plugin URI: http://www.turleando.com.ar/
5
  Description: Optimiza tu sitio web, uniendo el CSS y JavaScript, y comprimiéndolo.
6
- Version: 0.2
7
  Author: Emilio López
8
  Author URI: http://www.turleando.com.ar/
9
  Released under the GNU General Public License (GPL)
3
  Plugin Name: Autoptimize
4
  Plugin URI: http://www.turleando.com.ar/
5
  Description: Optimiza tu sitio web, uniendo el CSS y JavaScript, y comprimiéndolo.
6
+ Version: 0.3
7
  Author: Emilio López
8
  Author URI: http://www.turleando.com.ar/
9
  Released under the GNU General Public License (GPL)
classes/autoptimizeStyles.php CHANGED
@@ -1,13 +1,4 @@
1
  <?php
2
- function dodebug($txt,$txt2=null){
3
- static $text = '';
4
- if($txt2 != null)
5
- { $txt = $txt2;
6
- }
7
- file_put_contents(ABSPATH.'/debug.txt',$text.$txt);
8
- $text .= $txt;
9
- }
10
- set_error_handler('dodebug');
11
  class autoptimizeStyles extends autoptimizeBase
12
  {
13
  private $css = array();
@@ -77,7 +68,6 @@ class autoptimizeStyles extends autoptimizeBase
77
  foreach($this->css as $group)
78
  {
79
  list($media,$css) = $group;
80
- dodebug('corro con media css'.$media.' '.$css.'END');
81
  if(preg_match('#^INLINE;#',$css))
82
  {
83
  //<style>
@@ -139,14 +129,16 @@ class autoptimizeStyles extends autoptimizeBase
139
  if(file_exists($path) && is_readable($path))
140
  {
141
  $code = $this->fixurls($path,file_get_contents($path));
142
- $media = preg_replace('#^.*(?:\)|"|\')(.*)(?:\s|;).*$#','$1',$import);
143
  $media = array_map('trim',explode(' ',$media));
144
  if(empty($media))
145
  {
146
- $thiscss = preg_replace('#(/\*FILESTART\*/.*)'.preg_quote($import,'#').'#Us',$code.'$1',$thiscss);
147
- }/*else{
148
  //media in @import - how should I handle these?
 
149
  }*/
 
150
  }/*else{
151
  //getpath is not working?
152
  }*/
1
  <?php
 
 
 
 
 
 
 
 
 
2
  class autoptimizeStyles extends autoptimizeBase
3
  {
4
  private $css = array();
68
  foreach($this->css as $group)
69
  {
70
  list($media,$css) = $group;
 
71
  if(preg_match('#^INLINE;#',$css))
72
  {
73
  //<style>
129
  if(file_exists($path) && is_readable($path))
130
  {
131
  $code = $this->fixurls($path,file_get_contents($path));
132
+ /*$media = preg_replace('#^.*(?:\)|"|\')(.*)(?:\s|;).*$#','$1',$import);
133
  $media = array_map('trim',explode(' ',$media));
134
  if(empty($media))
135
  {
136
+ $thiscss = [...] (Line under)
137
+ }else{
138
  //media in @import - how should I handle these?
139
+ //TODO: Infinite recursion!
140
  }*/
141
+ $thiscss = preg_replace('#(/\*FILESTART\*/.*)'.preg_quote($import,'#').'#Us',$code.'$1',$thiscss);
142
  }/*else{
143
  //getpath is not working?
144
  }*/
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.turleando.com.ar/autoptimize/
4
  Tags: css, html, javascript, js, optimize, speed, cache
5
  Requires at least: 2.6
6
  Tested up to: 2.8
7
- Stable tag: 0.2
8
 
9
  Autoptimize is a Wordpress plugin that speeds up your website, and helps you save bandwidth.
10
 
@@ -28,6 +28,9 @@ It concatenates all scripts and styles, minifies and compresses them, adds expir
28
 
29
  == Changelog ==
30
 
 
 
 
31
  = 0.2 =
32
  * Support CSS media
33
  * Fix an issue in the IE Hacks preservation mechanism
4
  Tags: css, html, javascript, js, optimize, speed, cache
5
  Requires at least: 2.6
6
  Tested up to: 2.8
7
+ Stable tag: 0.3
8
 
9
  Autoptimize is a Wordpress plugin that speeds up your website, and helps you save bandwidth.
10
 
28
 
29
  == Changelog ==
30
 
31
+ = 0.3 =
32
+ * Disable CSS media on @imports - caused an infinite loop
33
+
34
  = 0.2 =
35
  * Support CSS media
36
  * Fix an issue in the IE Hacks preservation mechanism