Version Description
Download this release
Release Info
Developer | wokamoto |
Plugin | Head Cleaner |
Version | 1.3.12 |
Comparing to | |
See all releases |
Code changes from version 1.3.11 to 1.3.12
- head-cleaner.php +41 -29
- readme.txt +5 -2
- readme_ja.txt +2 -2
head-cleaner.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Head Cleaner
|
4 |
-
Version: 1.3.
|
5 |
Plugin URI: http://wppluginsj.sourceforge.jp/head-cleaner/
|
6 |
Description: Cleaning tags from your WordPress header and footer.
|
7 |
Author: wokamoto
|
@@ -60,6 +60,8 @@ if (!defined('HC_CACHE_DIR'))
|
|
60 |
define('HC_CACHE_DIR', 'cache/head-cleaner');
|
61 |
if (!defined('HC_MAKE_GZ_FILE'))
|
62 |
define('HC_MAKE_GZ_FILE', false);
|
|
|
|
|
63 |
|
64 |
//**************************************************************************************
|
65 |
if (!defined('ABSPATH') && strstr($_SERVER['PHP_SELF'], '/head-cleaner.php')) {
|
@@ -153,7 +155,7 @@ if (!class_exists('wokController') || !class_exists('wokScriptManager'))
|
|
153 |
//**************************************************************************************
|
154 |
class HeadCleaner extends wokController {
|
155 |
public $plugin_name = 'head-cleaner';
|
156 |
-
public $plugin_ver = '1.3.
|
157 |
|
158 |
// Deafault Options
|
159 |
private $options_default = array(
|
@@ -230,9 +232,6 @@ class HeadCleaner extends wokController {
|
|
230 |
/**********************************************************
|
231 |
* Constructor
|
232 |
***********************************************************/
|
233 |
-
public function HeadCleaner() {
|
234 |
-
$this->__construct();
|
235 |
-
}
|
236 |
public function __construct() {
|
237 |
$this->init(__FILE__);
|
238 |
$this->options = $this->_init_options($this->getOptions());
|
@@ -273,13 +272,16 @@ class HeadCleaner extends wokController {
|
|
273 |
add_action('get_header', array(&$this, 'head_start'));
|
274 |
add_action('wp_footer', array(&$this, 'filters_save'), 11);
|
275 |
|
276 |
-
//
|
277 |
-
|
278 |
-
|
|
|
|
|
279 |
|
280 |
-
|
281 |
-
|
282 |
-
|
|
|
283 |
}
|
284 |
}
|
285 |
|
@@ -494,17 +496,17 @@ class HeadCleaner extends wokController {
|
|
494 |
$script_tag = ''; $inline_js = '';
|
495 |
|
496 |
// for IE conditional tag
|
497 |
-
$IE_conditional_tag_pattern = '/<\!-+[ \t]*\[if[ \t]+%sIE%s[ \t]*?\][ \t]*>(.*?)<\![ \t]*\[endif\][ \t]*-+>/ism';
|
498 |
$IE_conditional_tags = array();
|
499 |
$ie6 = false;
|
500 |
if ($this->options['ie_conditional']) {
|
501 |
$ua = trim(strtolower($_SERVER['HTTP_USER_AGENT']));
|
502 |
$ie = (strpos($ua, 'msie') !== false)
|
503 |
&& (! preg_match('/(gecko|applewebkit|opera|sleipnir|chrome)/i', $ua));
|
504 |
-
$ie_ver = ($ie ? preg_replace('/^.*msie +([\d
|
505 |
$ie6 = ($ie ? version_compare($ie_ver, '7.0', '<') : false);
|
506 |
if ($ie) {
|
507 |
-
$
|
|
|
508 |
|
509 |
$replace_patterns = array();
|
510 |
if (version_compare($ie_ver, '5.5', '<')) { // IE 5
|
@@ -529,6 +531,10 @@ class HeadCleaner extends wokController {
|
|
529 |
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)', ' 8\.?0?'); // >= 8, <= 8, = 8
|
530 |
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' [567]\.?0?'); // > 5 - 7, >= 5 - 7
|
531 |
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' 5\.5'); // > 5.5, >= 5.5
|
|
|
|
|
|
|
|
|
532 |
}
|
533 |
|
534 |
if (count($replace_patterns) > 0)
|
@@ -536,9 +542,9 @@ class HeadCleaner extends wokController {
|
|
536 |
unset($replace_patterns);
|
537 |
}
|
538 |
} else {
|
539 |
-
$
|
540 |
-
preg_match_all($
|
541 |
-
$head_txt = preg_replace($
|
542 |
}
|
543 |
|
544 |
if (preg_match('/^(.*)(<html[^>]*>[^<]*)(<head[^>]*>[^<]*)(.*)$/ism', $head_txt, $matches)) {
|
@@ -755,18 +761,18 @@ class HeadCleaner extends wokController {
|
|
755 |
|
756 |
// for IE conditional tag
|
757 |
if (!$this->options['ie_conditional'] && count($IE_conditional_tags) > 0) {
|
758 |
-
$IE_conditional_tag_pattern = '/(<\!-+[ \t]*\[if[ \t]+.*IE.*[ \t]*?\][ \t]*>)[ \t\r\n]*(.*?)[ \t\r\n]*(<\![ \t]*\[endif\][ \t]*-+>)/
|
759 |
foreach ((array) $IE_conditional_tags as $IE_conditional_tag) {
|
760 |
-
if (isset($IE_conditional_tag[0])
|
761 |
-
$IE_tag = trim(preg_replace($IE_conditional_tag_pattern, "$1
|
762 |
if ( strpos(strtolower($IE_tag), '<link') !== false )
|
763 |
-
$css_tag = trim($css_tag) . "\n" . $IE_tag;
|
764 |
elseif ( strpos(strtolower($IE_tag), '<style') !== false )
|
765 |
-
$inline_css = trim($inline_css) . "\n" . $IE_tag;
|
766 |
elseif ( strpos(strtolower($IE_tag), '<script') !== false )
|
767 |
-
$inline_js = trim($inline_js) . "\n" . $IE_tag;
|
768 |
-
|
769 |
-
$object_tag = trim($object_tag) . "\n" . $IE_tag;
|
770 |
}
|
771 |
}
|
772 |
}
|
@@ -1112,7 +1118,13 @@ class HeadCleaner extends wokController {
|
|
1112 |
private function _file_read($filename) {
|
1113 |
$content = false;
|
1114 |
if (preg_match('/^https?:\/\//i', $filename)) {
|
1115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1116 |
} else {
|
1117 |
$filename = realpath($filename);
|
1118 |
if ($filename !== FALSE && file_exists($filename)) {
|
@@ -1251,14 +1263,14 @@ class HeadCleaner extends wokController {
|
|
1251 |
unset ($scriptaculous);
|
1252 |
}
|
1253 |
|
1254 |
-
// jQuery 1.2.6 or 1.
|
1255 |
if ($jquery) {
|
1256 |
list($src, $ver) = $this->_newer_version_src($js_libs['jquery']);
|
1257 |
if (!empty($src)) {
|
1258 |
if ($prototype)
|
1259 |
$src = $this->plugin_url . 'includes/js/jquery-1.2.6.min.js';
|
1260 |
-
elseif (version_compare($ver, '1.
|
1261 |
-
$src = $this->plugin_url . 'includes/js/jquery-1.
|
1262 |
|
1263 |
if ($prototype || $mootools || strpos($src, $this->wp_url) === FALSE) {
|
1264 |
$wk_outer_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Head Cleaner
|
4 |
+
Version: 1.3.12
|
5 |
Plugin URI: http://wppluginsj.sourceforge.jp/head-cleaner/
|
6 |
Description: Cleaning tags from your WordPress header and footer.
|
7 |
Author: wokamoto
|
60 |
define('HC_CACHE_DIR', 'cache/head-cleaner');
|
61 |
if (!defined('HC_MAKE_GZ_FILE'))
|
62 |
define('HC_MAKE_GZ_FILE', false);
|
63 |
+
if (!defined('HC_RAW_SHORTCODE'))
|
64 |
+
define('HC_RAW_SHORTCODE', false);
|
65 |
|
66 |
//**************************************************************************************
|
67 |
if (!defined('ABSPATH') && strstr($_SERVER['PHP_SELF'], '/head-cleaner.php')) {
|
155 |
//**************************************************************************************
|
156 |
class HeadCleaner extends wokController {
|
157 |
public $plugin_name = 'head-cleaner';
|
158 |
+
public $plugin_ver = '1.3.12';
|
159 |
|
160 |
// Deafault Options
|
161 |
private $options_default = array(
|
232 |
/**********************************************************
|
233 |
* Constructor
|
234 |
***********************************************************/
|
|
|
|
|
|
|
235 |
public function __construct() {
|
236 |
$this->init(__FILE__);
|
237 |
$this->options = $this->_init_options($this->getOptions());
|
272 |
add_action('get_header', array(&$this, 'head_start'));
|
273 |
add_action('wp_footer', array(&$this, 'filters_save'), 11);
|
274 |
|
275 |
+
// [raw] shortcode support
|
276 |
+
if (HC_RAW_SHORTCODE) {
|
277 |
+
remove_filter('the_content', 'wpautop');
|
278 |
+
remove_filter('the_content', 'wptexturize');
|
279 |
+
add_filter('the_content', array(&$head_cleaner, 'raw_formatter'), 99);
|
280 |
|
281 |
+
remove_filter('the_excerpt', 'wpautop');
|
282 |
+
remove_filter('the_excerpt', 'wptexturize');
|
283 |
+
add_filter('the_excerpt', array(&$head_cleaner, 'raw_formatter'), 99);
|
284 |
+
}
|
285 |
}
|
286 |
}
|
287 |
|
496 |
$script_tag = ''; $inline_js = '';
|
497 |
|
498 |
// for IE conditional tag
|
|
|
499 |
$IE_conditional_tags = array();
|
500 |
$ie6 = false;
|
501 |
if ($this->options['ie_conditional']) {
|
502 |
$ua = trim(strtolower($_SERVER['HTTP_USER_AGENT']));
|
503 |
$ie = (strpos($ua, 'msie') !== false)
|
504 |
&& (! preg_match('/(gecko|applewebkit|opera|sleipnir|chrome)/i', $ua));
|
505 |
+
$ie_ver = ($ie ? preg_replace('/^.*msie +([\d+\.]+);.*$/i', '$1', $ua) : false);
|
506 |
$ie6 = ($ie ? version_compare($ie_ver, '7.0', '<') : false);
|
507 |
if ($ie) {
|
508 |
+
$IE_conditional_tag_pattern = '/<\!-+[ \t]*\[if[ \t]+IE[ \t]*?\][ \t]*>(.*?)<\![ \t]*\[endif\][ \t]*-+>/i';
|
509 |
+
$head_txt = preg_replace($IE_conditional_tag_pattern, '$1', $head_txt);
|
510 |
|
511 |
$replace_patterns = array();
|
512 |
if (version_compare($ie_ver, '5.5', '<')) { // IE 5
|
531 |
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)', ' 8\.?0?'); // >= 8, <= 8, = 8
|
532 |
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' [567]\.?0?'); // > 5 - 7, >= 5 - 7
|
533 |
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' 5\.5'); // > 5.5, >= 5.5
|
534 |
+
} elseif (version_compare($ie_ver, '10.0', '<')) { // IE 9
|
535 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)', ' 9\.?0?'); // >= 8, <= 8, = 8
|
536 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' [5678]\.?0?'); // > 5 - 7, >= 5 - 7
|
537 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' 5\.5'); // > 5.5, >= 5.5
|
538 |
}
|
539 |
|
540 |
if (count($replace_patterns) > 0)
|
542 |
unset($replace_patterns);
|
543 |
}
|
544 |
} else {
|
545 |
+
$IE_conditional_tag_pattern = '/<\!-+[ \t]*\[if[ \t]+([lg]te[ \t]*)?IE([ \t]+[056789\.]*)?[ \t]*?\][ \t]*>(.*?)<\![ \t]*\[endif\][ \t]*-+>/i';
|
546 |
+
preg_match_all($IE_conditional_tag_pattern, $head_txt, $IE_conditional_tags, PREG_SET_ORDER);
|
547 |
+
$head_txt = preg_replace($IE_conditional_tag_pattern, '', $head_txt);
|
548 |
}
|
549 |
|
550 |
if (preg_match('/^(.*)(<html[^>]*>[^<]*)(<head[^>]*>[^<]*)(.*)$/ism', $head_txt, $matches)) {
|
761 |
|
762 |
// for IE conditional tag
|
763 |
if (!$this->options['ie_conditional'] && count($IE_conditional_tags) > 0) {
|
764 |
+
$IE_conditional_tag_pattern = '/(<\!-+[ \t]*\[if[ \t]+.*IE.*[ \t]*?\][ \t]*>)[ \t\r\n]*(.*?)[ \t\r\n]*(<\![ \t]*\[endif\][ \t]*-+>)/i';
|
765 |
foreach ((array) $IE_conditional_tags as $IE_conditional_tag) {
|
766 |
+
if (isset($IE_conditional_tag[0])) {
|
767 |
+
$IE_tag = trim(preg_replace($IE_conditional_tag_pattern, "$1$2$3", $IE_conditional_tag[0]));
|
768 |
if ( strpos(strtolower($IE_tag), '<link') !== false )
|
769 |
+
$css_tag = trim($css_tag) . "\n" . $IE_tag . "\n";
|
770 |
elseif ( strpos(strtolower($IE_tag), '<style') !== false )
|
771 |
+
$inline_css = trim($inline_css) . "\n" . $IE_tag . "\n";
|
772 |
elseif ( strpos(strtolower($IE_tag), '<script') !== false )
|
773 |
+
$inline_js = trim($inline_js) . "\n" . $IE_tag . "\n";
|
774 |
+
elseif ( !empty($IE_tag) )
|
775 |
+
$object_tag = trim($object_tag) . "\n" . $IE_tag . "\n";
|
776 |
}
|
777 |
}
|
778 |
}
|
1118 |
private function _file_read($filename) {
|
1119 |
$content = false;
|
1120 |
if (preg_match('/^https?:\/\//i', $filename)) {
|
1121 |
+
if (function_exists('wp_remote_get')) {
|
1122 |
+
$ret = wp_remote_get($filename);
|
1123 |
+
if (is_array($ret) && isset($ret["body"]) && !empty($ret["body"]))
|
1124 |
+
$content = $ret["body"];
|
1125 |
+
}
|
1126 |
+
if ($content === false)
|
1127 |
+
$content = @file_get_contents($filename);
|
1128 |
} else {
|
1129 |
$filename = realpath($filename);
|
1130 |
if ($filename !== FALSE && file_exists($filename)) {
|
1263 |
unset ($scriptaculous);
|
1264 |
}
|
1265 |
|
1266 |
+
// jQuery 1.2.6 or 1.4.2
|
1267 |
if ($jquery) {
|
1268 |
list($src, $ver) = $this->_newer_version_src($js_libs['jquery']);
|
1269 |
if (!empty($src)) {
|
1270 |
if ($prototype)
|
1271 |
$src = $this->plugin_url . 'includes/js/jquery-1.2.6.min.js';
|
1272 |
+
elseif (version_compare($ver, '1.4.2', '<='))
|
1273 |
+
$src = $this->plugin_url . 'includes/js/jquery-1.4.2.min.js';
|
1274 |
|
1275 |
if ($prototype || $mootools || strpos($src, $this->wp_url) === FALSE) {
|
1276 |
$wk_outer_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: wokamoto
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=9S8AJCY7XB8F4&lc=JP&item_name=WordPress%20Plugins&item_number=wp%2dplugins¤cy_code=JPY&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
|
4 |
Tags: head, header, footer, javascript, css, optimization, minified, performance
|
5 |
Requires at least: 2.5
|
6 |
-
Tested up to: 3.0
|
7 |
-
Stable tag: 1.3.
|
8 |
|
9 |
Cleaning tags from your WordPress header and footer.
|
10 |
|
@@ -89,6 +89,9 @@ Head Cleaner Ver.1.1.5 includes 'php_browscap.ini' .
|
|
89 |
|
90 |
== Changelog ==
|
91 |
|
|
|
|
|
|
|
92 |
**1.3.11 - July 7, 2010**
|
93 |
Minor bug fixes.
|
94 |
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=9S8AJCY7XB8F4&lc=JP&item_name=WordPress%20Plugins&item_number=wp%2dplugins¤cy_code=JPY&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
|
4 |
Tags: head, header, footer, javascript, css, optimization, minified, performance
|
5 |
Requires at least: 2.5
|
6 |
+
Tested up to: 3.0.1
|
7 |
+
Stable tag: 1.3.12
|
8 |
|
9 |
Cleaning tags from your WordPress header and footer.
|
10 |
|
89 |
|
90 |
== Changelog ==
|
91 |
|
92 |
+
**1.3.12 - August 11, 2010**
|
93 |
+
Fixed a bug, IE Conditional tags.
|
94 |
+
|
95 |
**1.3.11 - July 7, 2010**
|
96 |
Minor bug fixes.
|
97 |
|
readme_ja.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: wokamoto
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=9S8AJCY7XB8F4&lc=JP&item_name=WordPress%20Plugins&item_number=wp%2dplugins¤cy_code=JPY&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
|
4 |
Tags: head optimization, javascript, css, optimization, minified, performance
|
5 |
Requires at least: 2.5
|
6 |
-
Tested up to: 3.0
|
7 |
-
Stable tag: 1.3.
|
8 |
|
9 |
Head �� footer �����|�����܂��B
|
10 |
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=9S8AJCY7XB8F4&lc=JP&item_name=WordPress%20Plugins&item_number=wp%2dplugins¤cy_code=JPY&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
|
4 |
Tags: head optimization, javascript, css, optimization, minified, performance
|
5 |
Requires at least: 2.5
|
6 |
+
Tested up to: 3.0.1
|
7 |
+
Stable tag: 1.3.12
|
8 |
|
9 |
Head �� footer �����|�����܂��B
|
10 |
|