Head Cleaner - Version 1.0.3

Version Description

Download this release

Release Info

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

Code changes from version 1.0.2 to 1.0.3

Files changed (3) hide show
  1. head-cleaner.php +31 -19
  2. readme.txt +2 -2
  3. readme_ja.txt +2 -2
head-cleaner.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Head Cleaner
4
- Version: 1.0.2
5
  Plugin URI: http://wppluginsj.sourceforge.jp/head-cleaner/
6
  Description: Cleaning tags from your WordPress header and footer.
7
  Author: wokamoto
@@ -316,24 +316,36 @@ class HeadCleanerController extends wokController {
316
  $ie6 = ($ie ? version_compare($ie_ver, '7.0', '<') : false);
317
  if ($ie) {
318
  // for IE conditional tag
319
- $replace_pattern = '/<\!-+[ \t]*\[if IE%s[ \t]*?\][ \t]*>(.*?)<\![ \t]*\[endif\][ \t]*-+>/ism';
320
- $head_txt = preg_replace(sprintf($replace_pattern, ''), '$1', $head_txt);
321
-
322
- if (version_compare($ie_ver, '5.5', '<')) // IE 5
323
- $replace_pattern = sprintf($replace_pattern, ' 5\.0');
324
- elseif (version_compare($ie_ver, '6.0', '<')) // IE 5.5
325
- $replace_pattern = sprintf($replace_pattern, ' 5\.5');
326
- elseif (version_compare($ie_ver, '7.0', '<')) // IE 6
327
- $replace_pattern = sprintf($replace_pattern, ' 6\.?0?');
328
- elseif (version_compare($ie_ver, '8.0', '<')) // IE 7
329
- $replace_pattern = sprintf($replace_pattern, ' 7\.?0?');
330
- elseif (version_compare($ie_ver, '9.0', '<')) // IE 8
331
- $replace_pattern = sprintf($replace_pattern, ' 8\.?0?');
332
- else
333
- $replace_pattern = '';
334
-
335
- if (!empty($replace_pattern))
336
- $head_txt = preg_replace($replace_pattern, '$1', $head_txt);
 
 
 
 
 
 
 
 
 
 
 
 
337
  }
338
 
339
  if (preg_match('/^(.*)(<html[^>]*>[^<]*)(<head[^>]*>[^<]*)(.*)$/ism', $head_txt, $matches)) {
1
  <?php
2
  /*
3
  Plugin Name: Head Cleaner
4
+ Version: 1.0.3
5
  Plugin URI: http://wppluginsj.sourceforge.jp/head-cleaner/
6
  Description: Cleaning tags from your WordPress header and footer.
7
  Author: wokamoto
316
  $ie6 = ($ie ? version_compare($ie_ver, '7.0', '<') : false);
317
  if ($ie) {
318
  // for IE conditional tag
319
+ $replace_pattern = '/<\!-+[ \t]*\[if[ \t]+%sIE%s[ \t]*?\][ \t]*>(.*?)<\![ \t]*\[endif\][ \t]*-+>/ism';
320
+ $head_txt = preg_replace(sprintf($replace_pattern, '', ''), '$1', $head_txt);
321
+
322
+ $replace_patterns = array();
323
+ if (version_compare($ie_ver, '5.5', '<')) { // IE 5
324
+ $replace_patterns[] = sprintf($replace_pattern, '([lg]te[ \t]*|[ \t]*)', ' 5\.?0?'); // >= 5, <= 5, = 5
325
+ $replace_patterns[] = sprintf($replace_pattern, '(lte?[ \t]*)', ' 5\.5'); // < 5.5, <= 5.5
326
+ $replace_patterns[] = sprintf($replace_pattern, '(lte?[ \t]*)', ' [678]\.?0?'); // < 6 - 8, <= 6 - 8
327
+ } elseif (version_compare($ie_ver, '6.0', '<')) { // IE 5.5
328
+ $replace_patterns[] = sprintf($replace_pattern, '([lg]te[ \t]*|[ \t]*)', ' 5\.5'); // >= 5.5, <= 5.5, = 5.5
329
+ $replace_patterns[] = sprintf($replace_pattern, '(lte?[ \t]*)', ' [678]\.?0?'); // < 6 - 8, <= 6 - 8
330
+ $replace_patterns[] = sprintf($replace_pattern, '(gte?[ \t]*)', ' 5\.?0?'); // > 5, >= 5
331
+ } elseif (version_compare($ie_ver, '7.0', '<')) { // IE 6
332
+ $replace_patterns[] = sprintf($replace_pattern, '([lg]te[ \t]*|[ \t]*)', ' 6\.?0?'); // >= 6, <= 6, = 6
333
+ $replace_patterns[] = sprintf($replace_pattern, '(lte?[ \t]*)', ' [78]\.?0?'); // < 7 - 8, <= 7 - 8
334
+ $replace_patterns[] = sprintf($replace_pattern, '(gte?[ \t]*)', ' 5\.?0?'); // > 5, >= 5
335
+ $replace_patterns[] = sprintf($replace_pattern, '(gte?[ \t]*)', ' 5\.5'); // > 5.5, >= 5.5
336
+ } elseif (version_compare($ie_ver, '8.0', '<')) { // IE 7
337
+ $replace_patterns[] = sprintf($replace_pattern, '([lg]te[ \t]*|[ \t]*)', ' 7\.?0?'); // >= 7, <= 7, = 7
338
+ $replace_patterns[] = sprintf($replace_pattern, '(lte?[ \t]*)', ' 8\.?0?'); // < 8, <= 8
339
+ $replace_patterns[] = sprintf($replace_pattern, '(gte?[ \t]*)', ' [56]\.?0?'); // > 5 - 6, >= 5 - 6
340
+ $replace_patterns[] = sprintf($replace_pattern, '(gte?[ \t]*)', ' 5\.5'); // > 5.5, >= 5.5
341
+ } elseif (version_compare($ie_ver, '9.0', '<')) { // IE 8
342
+ $replace_patterns[] = sprintf($replace_pattern, '([lg]te[ \t]*|[ \t]*)', ' 8\.?0?'); // >= 8, <= 8, = 8
343
+ $replace_patterns[] = sprintf($replace_pattern, '(gte?[ \t]*)', ' [567]\.?0?'); // > 5 - 7, >= 5 - 7
344
+ $replace_patterns[] = sprintf($replace_pattern, '(gte?[ \t]*)', ' 5\.5'); // > 5.5, >= 5.5
345
+ }
346
+
347
+ if (count($replace_patterns) > 0)
348
+ $head_txt = preg_replace($replace_patterns, '$2', $head_txt);
349
  }
350
 
351
  if (preg_match('/^(.*)(<html[^>]*>[^<]*)(<head[^>]*>[^<]*)(.*)$/ism', $head_txt, $matches)) {
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Head Cleaner ===
2
  Contributors: wokamoto
3
- Tags: head, header, footer, javascript, css, optimization, minified
4
  Requires at least: 2.5
5
  Tested up to: 2.7.1
6
- Stable tag: 1.0.2
7
 
8
  Cleaning tags from your WordPress header and footer.
9
 
1
  === Head Cleaner ===
2
  Contributors: wokamoto
3
+ Tags: head, header, footer, javascript, css, optimization, minified, performance
4
  Requires at least: 2.5
5
  Tested up to: 2.7.1
6
+ Stable tag: 1.0.3
7
 
8
  Cleaning tags from your WordPress header and footer.
9
 
readme_ja.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Head Cleaner ===
2
  Contributors: wokamoto
3
- Tags: head optimization, javascript, css, optimization, minified
4
  Requires at least: 2.5
5
  Tested up to: 2.7.1
6
- Stable tag: 1.0.2
7
 
8
  Head �� footer �����|�����܂��B
9
 
1
  === Head Cleaner ===
2
  Contributors: wokamoto
3
+ Tags: head optimization, javascript, css, optimization, minified, performance
4
  Requires at least: 2.5
5
  Tested up to: 2.7.1
6
+ Stable tag: 1.0.3
7
 
8
  Head �� footer �����|�����܂��B
9