Head Cleaner - Version 1.4.0.1

Version Description

Download this release

Release Info

Developer wokamoto
Plugin Icon wp plugin Head Cleaner
Version 1.4.0.1
Comparing to
See all releases

Code changes from version 1.4.0 to 1.4.0.1

Files changed (3) hide show
  1. head-cleaner.php +22 -12
  2. readme.txt +1 -1
  3. readme_ja.txt +1 -1
head-cleaner.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Head Cleaner
4
- Version: 1.4.0
5
  Plugin URI: http://wppluginsj.sourceforge.jp/head-cleaner/
6
  Description: Cleaning tags from your WordPress header and footer.
7
  Author: wokamoto
@@ -267,12 +267,14 @@ class HeadCleaner extends wokController {
267
  $cache_dir = $this->_create_cache_dir();
268
  if ( $cache_dir !== FALSE )
269
  $this->_create_htaccess($cache_dir);
 
270
  }
271
 
272
  //**************************************************************************************
273
  // plugin deactivation
274
  //**************************************************************************************
275
  public function deactivation(){
 
276
  }
277
 
278
  //**************************************************************************************
@@ -715,13 +717,19 @@ class HeadCleaner extends wokController {
715
  } else {
716
  if ($this->options['css_optimise'] || $this->options['img_base64']) {
717
  foreach ($inner_css_src as $path) {
718
- $real_path = realpath(preg_replace('/^([^\?]*)([\?]?.*)$/', "$1", str_replace($this->wp_url, ABSPATH, $path)));
719
- if ($real_path !== false && file_exists($real_path)) {
720
  list($content, $cache_path) = $this->_file_read($real_path, 'css');
721
  if (file_exists($cache_path)) {
722
  $cache_url = str_replace(ABSPATH, $this->wp_url, $cache_path);
723
  $inner_css = str_replace($path, $cache_url, $inner_css);
724
  }
 
 
 
 
 
 
725
  }
726
  }
727
  }
@@ -1256,16 +1264,20 @@ class HeadCleaner extends wokController {
1256
  $cache_filename = $this->_cache_filename($filename, $type);
1257
 
1258
  if (!file_exists($cache_filename)) {
1259
- $src = trim(preg_replace('/([^\?]*)(\?[^\?]*)$/i', '$1', str_replace($this->wp_url, ABSPATH, $style)));
 
 
 
 
1260
  if (preg_match('/^https?:\/\//i', $src)) {
1261
  $content = $this->_remote_get($src);
1262
 
1263
  } else {
1264
  $src = realpath($src);
1265
- if ($filename !== FALSE && file_exists($src)) {
1266
- $handle = @fopen($src, 'r');
1267
- $content = trim(@fread($handle, filesize($src)));
1268
- @fclose($handle);
1269
  }
1270
  }
1271
 
@@ -1296,9 +1308,7 @@ class HeadCleaner extends wokController {
1296
  $this->_file_write($cache_filename, $content, $this->options['gzip_on'] || HC_MAKE_GZ_FILE);
1297
 
1298
  } else {
1299
- $handle = @fopen($cache_filename, 'r');
1300
- $content = trim(@fread($handle, filesize($cache_filename)));
1301
- @fclose($handle);
1302
  }
1303
 
1304
  $this->org_len += strlen(bin2hex($content));
@@ -1714,7 +1724,7 @@ class HeadCleaner extends wokController {
1714
  if ( is_array($ret) && isset($ret["body"]) && !empty($ret["body"]) )
1715
  return $ret["body"];
1716
  } else {
1717
- return @file_get_contents($filename);
1718
  }
1719
 
1720
  return false;
1
  <?php
2
  /*
3
  Plugin Name: Head Cleaner
4
+ Version: 1.4.0.1
5
  Plugin URI: http://wppluginsj.sourceforge.jp/head-cleaner/
6
  Description: Cleaning tags from your WordPress header and footer.
7
  Author: wokamoto
267
  $cache_dir = $this->_create_cache_dir();
268
  if ( $cache_dir !== FALSE )
269
  $this->_create_htaccess($cache_dir);
270
+ $this->_remove_cache_file();
271
  }
272
 
273
  //**************************************************************************************
274
  // plugin deactivation
275
  //**************************************************************************************
276
  public function deactivation(){
277
+ $this->_remove_cache_file();
278
  }
279
 
280
  //**************************************************************************************
717
  } else {
718
  if ($this->options['css_optimise'] || $this->options['img_base64']) {
719
  foreach ($inner_css_src as $path) {
720
+ $real_path = trim(preg_replace('/(\.css)(\?[^\?]*)$/i', '$1', str_replace($this->wp_url, ABSPATH, $path)));
721
+ if (file_exists($real_path)) {
722
  list($content, $cache_path) = $this->_file_read($real_path, 'css');
723
  if (file_exists($cache_path)) {
724
  $cache_url = str_replace(ABSPATH, $this->wp_url, $cache_path);
725
  $inner_css = str_replace($path, $cache_url, $inner_css);
726
  }
727
+ } else {
728
+ list($content, $cache_path) = $this->_file_read($path, 'css');
729
+ if (file_exists($cache_path)) {
730
+ $cache_url = str_replace(ABSPATH, $this->wp_url, $cache_path);
731
+ $inner_css = str_replace($path, $cache_url, $inner_css);
732
+ }
733
  }
734
  }
735
  }
1264
  $cache_filename = $this->_cache_filename($filename, $type);
1265
 
1266
  if (!file_exists($cache_filename)) {
1267
+ $src =
1268
+ preg_match('/\.'.preg_quote($type).'[\?]*[^\?]*)$/i', $src)
1269
+ ? trim(preg_replace('/(\.'.preg_quote($type).')([\?]*[^\?]*)$/i', '$1', str_replace($this->wp_url, ABSPATH, $src)))
1270
+ : $filename
1271
+ ;
1272
  if (preg_match('/^https?:\/\//i', $src)) {
1273
  $content = $this->_remote_get($src);
1274
 
1275
  } else {
1276
  $src = realpath($src);
1277
+ if ($src !== FALSE && file_exists($src)) {
1278
+ $content = @file_get_contents($src);
1279
+ } else {
1280
+ $content = $this->_remote_get($filename);
1281
  }
1282
  }
1283
 
1308
  $this->_file_write($cache_filename, $content, $this->options['gzip_on'] || HC_MAKE_GZ_FILE);
1309
 
1310
  } else {
1311
+ $content = @file_get_contents($cache_filename);
 
 
1312
  }
1313
 
1314
  $this->org_len += strlen(bin2hex($content));
1724
  if ( is_array($ret) && isset($ret["body"]) && !empty($ret["body"]) )
1725
  return $ret["body"];
1726
  } else {
1727
+ return @file_get_contents($url);
1728
  }
1729
 
1730
  return false;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=9S8AJ
4
  Tags: head, header, footer, javascript, css, optimization, minified, performance
5
  Requires at least: 2.5
6
  Tested up to: 3.0.2
7
- Stable tag: 1.4.0
8
 
9
  Cleaning tags from your WordPress header and footer.
10
 
4
  Tags: head, header, footer, javascript, css, optimization, minified, performance
5
  Requires at least: 2.5
6
  Tested up to: 3.0.2
7
+ Stable tag: 1.4.0.1
8
 
9
  Cleaning tags from your WordPress header and footer.
10
 
readme_ja.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=9S8AJ
4
  Tags: head optimization, javascript, css, optimization, minified, performance
5
  Requires at least: 2.5
6
  Tested up to: 3.0.2
7
- Stable tag: 1.4.0
8
 
9
  Head と footer をお掃除します。
10
 
4
  Tags: head optimization, javascript, css, optimization, minified, performance
5
  Requires at least: 2.5
6
  Tested up to: 3.0.2
7
+ Stable tag: 1.4.0.1
8
 
9
  Head と footer をお掃除します。
10