Version Description
Download this release
Release Info
Developer | wokamoto |
Plugin | Head Cleaner |
Version | 1.4.2 |
Comparing to | |
See all releases |
Code changes from version 1.4.1.3 to 1.4.2
- head-cleaner.php +555 -148
- languages/head-cleaner-ja.mo +0 -0
- languages/head-cleaner-ja.po +56 -48
- languages/head-cleaner.pot +55 -47
- readme.txt +5 -1
- 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.
|
5 |
Plugin URI: http://wppluginsj.sourceforge.jp/head-cleaner/
|
6 |
Description: Cleaning tags from your WordPress header and footer.
|
7 |
Author: wokamoto
|
@@ -66,7 +66,7 @@ if (!class_exists('wokController') || !class_exists('wokScriptManager'))
|
|
66 |
//**************************************************************************************
|
67 |
class HeadCleaner extends wokController {
|
68 |
public $plugin_name = 'head-cleaner';
|
69 |
-
public $plugin_ver = '1.4.
|
70 |
|
71 |
const PRIORITY = 10000;
|
72 |
const ANALYZE_EXPIRED = 604800; // 60 * 60 * 24 * 7 [sec.]
|
@@ -99,6 +99,8 @@ class HeadCleaner extends wokController {
|
|
99 |
'use_ajax_libs' => false ,
|
100 |
'img_base64' => false ,
|
101 |
'add_ogp_tag' => false ,
|
|
|
|
|
102 |
);
|
103 |
|
104 |
private $wp_url = '';
|
@@ -141,6 +143,8 @@ class HeadCleaner extends wokController {
|
|
141 |
|
142 |
private $img_urls = array();
|
143 |
|
|
|
|
|
144 |
/**********************************************************
|
145 |
* Constructor
|
146 |
***********************************************************/
|
@@ -155,6 +159,8 @@ class HeadCleaner extends wokController {
|
|
155 |
$this->self_url = $this->wp_plugin_url( basename(dirname(__FILE__)) ) . basename(__FILE__);
|
156 |
$this->lang = (defined('WPLANG') ? WPLANG : 'ja');
|
157 |
$this->charset = get_option('blog_charset');
|
|
|
|
|
158 |
$this->_get_filters('wp_head');
|
159 |
$this->_get_filters('wp_footer');
|
160 |
|
@@ -183,9 +189,26 @@ class HeadCleaner extends wokController {
|
|
183 |
$this->_require_libraries();
|
184 |
|
185 |
// add action
|
186 |
-
|
|
|
|
|
187 |
add_action('wp_footer', array(&$this, 'filters_save'), 11);
|
188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
// [raw] shortcode support
|
190 |
if (HC_RAW_SHORTCODE) {
|
191 |
remove_filter('the_content', 'wpautop');
|
@@ -197,6 +220,14 @@ class HeadCleaner extends wokController {
|
|
197 |
add_filter('the_excerpt', array(&$this, 'raw_formatter'), 99);
|
198 |
}
|
199 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
}
|
201 |
|
202 |
/**********************************************************
|
@@ -244,8 +275,9 @@ class HeadCleaner extends wokController {
|
|
244 |
$includes = dirname(__FILE__) . '/includes/';
|
245 |
|
246 |
// PHP Simple HTML DOM Parser
|
247 |
-
if (!function_exists('str_get_html'))
|
248 |
require($includes . 'simple_html_dom.php' );
|
|
|
249 |
|
250 |
// jsmin.php - PHP implementation of Douglas Crockford's JSMin.
|
251 |
if ($this->options['js_minify'] && !class_exists('JSMin')) {
|
@@ -259,8 +291,9 @@ class HeadCleaner extends wokController {
|
|
259 |
}
|
260 |
|
261 |
// Use Google Ajax Libraries
|
262 |
-
if ($this->options['use_ajax_libs'])
|
263 |
require($includes . 'regist_ajax_libs.php');
|
|
|
264 |
}
|
265 |
|
266 |
//**************************************************************************************
|
@@ -284,11 +317,11 @@ class HeadCleaner extends wokController {
|
|
284 |
// ob_start for Header
|
285 |
//**************************************************************************************
|
286 |
public function head_start(){
|
287 |
-
if (
|
288 |
$ob_handlers = (array) ob_list_handlers();
|
289 |
-
if (
|
290 |
-
foreach (
|
291 |
-
if (
|
292 |
$this->ob_handlers[$ob_handler] = true;
|
293 |
ob_end_flush();
|
294 |
}
|
@@ -298,15 +331,23 @@ class HeadCleaner extends wokController {
|
|
298 |
ob_start(array(&$this, 'head_cleaner'));
|
299 |
$this->mtime_start = microtime();
|
300 |
|
301 |
-
if (
|
302 |
-
|
|
|
303 |
|
304 |
add_action('wp_head', array(&$this, 'end'), self::PRIORITY);
|
305 |
$this->_get_filters('wp_head');
|
306 |
$this->_change_filters_priority('wp_head');
|
|
|
|
|
307 |
|
308 |
-
|
309 |
-
|
|
|
|
|
|
|
|
|
|
|
310 |
}
|
311 |
}
|
312 |
|
@@ -314,11 +355,11 @@ class HeadCleaner extends wokController {
|
|
314 |
// ob_start for footer
|
315 |
//**************************************************************************************
|
316 |
public function footer_start(){
|
317 |
-
if (
|
318 |
$ob_handlers = (array) ob_list_handlers();
|
319 |
-
if (
|
320 |
-
foreach (
|
321 |
-
if (
|
322 |
$this->ob_handlers[$ob_handler] = true;
|
323 |
ob_end_flush();
|
324 |
}
|
@@ -328,7 +369,7 @@ class HeadCleaner extends wokController {
|
|
328 |
ob_start(array(&$this, 'footer_cleaner'));
|
329 |
$this->mtime_start = microtime();
|
330 |
|
331 |
-
add_action('
|
332 |
$this->_get_filters('wp_footer');
|
333 |
$this->_change_filters_priority('wp_footer');
|
334 |
}
|
@@ -338,17 +379,17 @@ class HeadCleaner extends wokController {
|
|
338 |
// ob_handler
|
339 |
//**************************************************************************************
|
340 |
private function ob_handler($content){
|
341 |
-
foreach (
|
342 |
-
if (
|
343 |
$this->ob_handlers[$ob_handler] = false;
|
344 |
switch ($ob_handler) {
|
345 |
case 'All_in_One_SEO_Pack::output_callback_for_title':
|
346 |
global $aiosp;
|
347 |
-
if (
|
348 |
$content = $aiosp->rewrite_title($content);
|
349 |
break;
|
350 |
case 'wpSEO::exe_modify_content':
|
351 |
-
if (
|
352 |
$wpSEO = $GLOBALS['wpSEO'];
|
353 |
$content = $wpSEO->exe_modify_content($content);
|
354 |
}
|
@@ -388,8 +429,10 @@ class HeadCleaner extends wokController {
|
|
388 |
//**************************************************************************************
|
389 |
public function head_cleaner($buffer) {
|
390 |
$buffer = $this->_tag_trim($this->ob_handler($buffer));
|
391 |
-
if (!function_exists('str_get_html'))
|
392 |
-
|
|
|
|
|
393 |
|
394 |
$head_txt = $buffer;
|
395 |
$url = $this->_get_permalink();
|
@@ -414,24 +457,18 @@ class HeadCleaner extends wokController {
|
|
414 |
}
|
415 |
unset($match);
|
416 |
}
|
417 |
-
|
418 |
-
if (preg_match('/<!DOCTYPE [^>]* XHTML [^>]*>/i', $buffer)) {
|
419 |
-
// xhtml
|
420 |
-
$doctype = 'xhtml';
|
421 |
-
$xml_head = empty($xml_head) ? $this->_tag_trim('<?xml version="1.0" encoding="'.$this->charset.'"?>') : $xml_head;
|
422 |
-
$html_tag = empty($html_tag) ? $this->_tag_trim('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$this->lang.'" lang="'.$this->lang.'">') : $html_tag;
|
423 |
-
$head_tag = empty($head_tag) ? $this->_tag_trim('<head profile="http://gmpg.org/xfn/11">') : $head_tag;
|
424 |
-
|
425 |
-
} else {
|
426 |
-
// html
|
427 |
-
$doctype = 'html';
|
428 |
-
$xml_head = '';
|
429 |
-
$html_tag = empty($html_tag) ? $this->_tag_trim('<html dir="ltr" lang="'.$this->lang.'">') : $html_tag;
|
430 |
-
$head_tag = empty($head_tag) ? $this->_tag_trim('<head>') : $head_tag;
|
431 |
-
}
|
432 |
unset($matches);
|
433 |
|
|
|
|
|
|
|
|
|
|
|
|
|
434 |
$ret_val = '';
|
|
|
|
|
|
|
435 |
$meta_tag = '';
|
436 |
$title_tag = '';
|
437 |
$base_tag = '';
|
@@ -444,34 +481,63 @@ class HeadCleaner extends wokController {
|
|
444 |
$inline_js = '';
|
445 |
$noscript_tag = '';
|
446 |
|
447 |
-
//
|
448 |
-
|
|
|
|
|
449 |
|
450 |
-
// Get
|
451 |
-
if (preg_match('
|
452 |
-
$
|
453 |
-
$
|
454 |
-
$head_tag = $this->_tag_trim($matches[3]);
|
455 |
-
$head_txt = $this->_tag_trim($matches[4]);
|
456 |
}
|
457 |
unset($matches);
|
458 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
459 |
if ($this->options['add_ogp_tag']) {
|
460 |
$head_txt .= $this->_get_ogp_tags();
|
461 |
}
|
462 |
|
|
|
463 |
$head_txt = preg_replace_callback(
|
464 |
array('/(content=)(")([^"]*)(")/i', '/(content=)(\')([^\']*)(\')/i'),
|
465 |
array(&$this, '_tag_replace'),
|
466 |
$head_txt
|
467 |
);
|
468 |
-
|
469 |
-
$dom
|
470 |
-
$xml_head . $html_tag . $head_tag . $head_txt .
|
471 |
-
'</head><body></body></html>'
|
472 |
-
);
|
473 |
-
if ($dom === false)
|
474 |
return ($this->_tag_trim($buffer));
|
|
|
475 |
|
476 |
// ***** Parse Start! *****
|
477 |
|
@@ -493,18 +559,21 @@ class HeadCleaner extends wokController {
|
|
493 |
|
494 |
// for IE conditional tag
|
495 |
if (!$this->options['ie_conditional'] && count($IE_conditional_tags) > 0) {
|
496 |
-
$IE_conditional_tag_pattern = '/(<\!-+[ \t]*\[if[ \t]+.*IE.*[ \t]*?\][ \t]*>)[ \t\r\n]*(.*?)[ \t\r\n]*(<\![ \t]*\[endif\][ \t]*-+>)/ims';
|
497 |
foreach ((array) $IE_conditional_tags as $IE_conditional_tag) {
|
498 |
if (isset($IE_conditional_tag[0])) {
|
499 |
-
$IE_tag = $this->_tag_trim(preg_replace($IE_conditional_tag_pattern, "$1$
|
500 |
-
if ( strpos(strtolower($IE_tag), '<
|
|
|
|
|
501 |
$css_tag .= $IE_tag;
|
502 |
-
elseif ( strpos(strtolower($IE_tag), '<style') !== false )
|
503 |
$inline_css .= $IE_tag;
|
504 |
-
elseif ( strpos(strtolower($IE_tag), '<script') !== false )
|
505 |
$inline_js .= $IE_tag;
|
506 |
-
elseif (
|
|
|
507 |
$object_tag .= $IE_tag;
|
|
|
508 |
}
|
509 |
}
|
510 |
}
|
@@ -512,6 +581,7 @@ class HeadCleaner extends wokController {
|
|
512 |
|
513 |
// Build!
|
514 |
$ret_val .=
|
|
|
515 |
$this->_tag_trim($html_tag) .
|
516 |
$this->_tag_trim($head_tag) .
|
517 |
$this->_tag_trim($meta_tag) .
|
@@ -532,15 +602,18 @@ class HeadCleaner extends wokController {
|
|
532 |
$this->foot_js_src .= $script_tag . $inline_js;
|
533 |
$this->foot_js_src = $this->_tag_trim($this->foot_js_src);
|
534 |
}
|
535 |
-
if (!empty($this->foot_js_src))
|
536 |
add_action('wp_footer', array(&$this, 'footer'), 9);
|
|
|
537 |
|
538 |
// dynamic css, js
|
539 |
-
if ($this->options['dynamic'])
|
540 |
$ret_val = $this->_dynamic_js_css($ret_val);
|
|
|
541 |
|
542 |
// set xml declaration
|
543 |
-
$ret_val = (
|
|
|
544 |
? preg_replace('/^<\?xml[^>]*>/i', '', $ret_val)
|
545 |
: $this->_tag_trim(strpos($ret_val, '<?xml') === false ? $xml_head : '') . $ret_val
|
546 |
);
|
@@ -548,14 +621,19 @@ class HeadCleaner extends wokController {
|
|
548 |
$ret_val = str_replace(''', "'", $ret_val);
|
549 |
|
550 |
// add debug information
|
551 |
-
if ($this->options['debug_mode'])
|
552 |
$ret_val .= $this->_get_debug_info($buffer);
|
|
|
553 |
|
554 |
$this->org_len = strlen(bin2hex($buffer));
|
555 |
$this->ret_len = strlen(bin2hex($ret_val));
|
556 |
$this->process_time = $this->_microtime_diff($this->mtime_start);
|
557 |
// $ret_val .= "<!-- {$this->process_time} seconds. {$this->ret_len} / {$this->org_len} (" . (int) (($this->org_len - $this->ret_len) / $this->org_len * 10000) / 100 . "% saving) -->\n";
|
558 |
|
|
|
|
|
|
|
|
|
559 |
$ret_val = apply_filters($this->plugin_name.'/head_cleaner', $ret_val);
|
560 |
return $ret_val;
|
561 |
}
|
@@ -568,7 +646,7 @@ class HeadCleaner extends wokController {
|
|
568 |
//**************************************************************************************
|
569 |
// Parse IE conditional tags
|
570 |
//**************************************************************************************
|
571 |
-
private function _parse_IE_conditional_tags($
|
572 |
// Check USER AGENT
|
573 |
$ua = trim(strtolower($_SERVER['HTTP_USER_AGENT']));
|
574 |
$ie = (strpos($ua, 'msie') !== false && !preg_match('/(gecko|applewebkit|opera|sleipnir|chrome)/i', $ua));
|
@@ -578,49 +656,50 @@ class HeadCleaner extends wokController {
|
|
578 |
$IE_conditional_tags = array();
|
579 |
if ($this->options['ie_conditional']) {
|
580 |
if ($ie) {
|
581 |
-
$IE_conditional_tag_pattern = '/<\!-+[ \t]*\[if[ \t]
|
582 |
-
$
|
583 |
|
584 |
$replace_patterns = array();
|
585 |
if (version_compare($ie_ver, '5.5', '<')) { // IE 5
|
586 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)
|
587 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)
|
588 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)
|
589 |
} elseif (version_compare($ie_ver, '6.0', '<')) { // IE 5.5
|
590 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)
|
591 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)
|
592 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)
|
593 |
} elseif (version_compare($ie_ver, '7.0', '<')) { // IE 6
|
594 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)
|
595 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)
|
596 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)
|
597 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)
|
598 |
} elseif (version_compare($ie_ver, '8.0', '<')) { // IE 7
|
599 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)
|
600 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)
|
601 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)
|
602 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)
|
603 |
} elseif (version_compare($ie_ver, '9.0', '<')) { // IE 8
|
604 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)
|
605 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)
|
606 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)
|
607 |
} elseif (version_compare($ie_ver, '10.0', '<')) { // IE 9
|
608 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)
|
609 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)
|
610 |
-
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)
|
611 |
}
|
612 |
|
613 |
-
if (count($replace_patterns) > 0)
|
614 |
-
$
|
|
|
615 |
unset($replace_patterns);
|
616 |
}
|
617 |
} else {
|
618 |
-
$IE_conditional_tag_pattern = '
|
619 |
-
preg_match_all($IE_conditional_tag_pattern, $
|
620 |
-
$
|
621 |
}
|
622 |
|
623 |
-
return array($
|
624 |
}
|
625 |
|
626 |
//**************************************************************************************
|
@@ -855,6 +934,92 @@ class HeadCleaner extends wokController {
|
|
855 |
return array($script_tag, $inline_js, $foot_js);
|
856 |
}
|
857 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
858 |
//**************************************************************************************
|
859 |
// JavaScript Moved bottom
|
860 |
//**************************************************************************************
|
@@ -867,8 +1032,10 @@ class HeadCleaner extends wokController {
|
|
867 |
//**************************************************************************************
|
868 |
public function footer_cleaner($buffer) {
|
869 |
$buffer = $this->_tag_trim($this->ob_handler($buffer));
|
870 |
-
if (!function_exists('str_get_html'))
|
871 |
-
|
|
|
|
|
872 |
|
873 |
$ret_val = '';
|
874 |
$script_tag = '';
|
@@ -883,9 +1050,7 @@ class HeadCleaner extends wokController {
|
|
883 |
|
884 |
// Get Simple DOM Object
|
885 |
$dom = str_get_html(
|
886 |
-
'<
|
887 |
-
'<div id="footer">' . $fotter_txt . '</div>' .
|
888 |
-
'</body></html>'
|
889 |
);
|
890 |
if ($dom === false)
|
891 |
return $buffer;
|
@@ -978,6 +1143,17 @@ class HeadCleaner extends wokController {
|
|
978 |
|
979 |
// $ret_val .= $this->_process_time();
|
980 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
981 |
$ret_val = apply_filters($this->plugin_name.'/footer_cleaner', $ret_val);
|
982 |
return $ret_val;
|
983 |
}
|
@@ -1000,8 +1176,6 @@ class HeadCleaner extends wokController {
|
|
1000 |
return is_user_logged_in();
|
1001 |
} else {
|
1002 |
global $user;
|
1003 |
-
if (!isset($user))
|
1004 |
-
$user = wp_get_current_user();
|
1005 |
return (!empty($user->ID));
|
1006 |
}
|
1007 |
}
|
@@ -1646,25 +1820,38 @@ class HeadCleaner extends wokController {
|
|
1646 |
//**************************************************************************************
|
1647 |
// Minified JavaScript
|
1648 |
//**************************************************************************************
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1649 |
private function _js_minify($buffer) {
|
1650 |
$js = $this->_tag_trim($buffer);
|
1651 |
if ($this->options['js_minify']) {
|
1652 |
-
|
1653 |
-
$js = JSMin::minify($js);
|
1654 |
-
} else if( class_exists('JSMinPlus') ) {
|
1655 |
-
$js = JSMinPlus::minify($js);
|
1656 |
-
}
|
1657 |
}
|
1658 |
-
|
1659 |
-
$js = apply_filters($this->plugin_name.'/js_minify', $js . (!empty($js) ? "\n" : ''));
|
1660 |
-
|
1661 |
-
return $js;
|
1662 |
}
|
1663 |
|
1664 |
//**************************************************************************************
|
1665 |
// Optimise CSS
|
1666 |
//**************************************************************************************
|
1667 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1668 |
if (preg_match_all('/@import[ \t]*url[ \t]*\([\'"]?([^\)\'"]*)[\'"]?\);?/i', $css, $matches, PREG_SET_ORDER)) {
|
1669 |
$search = array();
|
1670 |
$replace = array();
|
@@ -1672,10 +1859,12 @@ class HeadCleaner extends wokController {
|
|
1672 |
$filename = str_replace($this->wp_url, ABSPATH, trim($match[1]));
|
1673 |
list($content, $cache_path) = $this->_file_read(file_exists($filename) ? $filename : $match[1], 'css');
|
1674 |
$content = $this->_css_url_edit($content, $filename);
|
1675 |
-
if ($this->options['css_optimise'])
|
1676 |
-
$content = $this->
|
1677 |
-
|
1678 |
-
|
|
|
|
|
1679 |
$search[] = $match[0];
|
1680 |
$replace[] = $content;
|
1681 |
}
|
@@ -1691,15 +1880,19 @@ class HeadCleaner extends wokController {
|
|
1691 |
|
1692 |
private function _css_optimise($buffer, $merge = true) {
|
1693 |
$css = $this->_tag_trim($buffer);
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
if ( $merge )
|
1698 |
-
$css = str_replace("\n\n", "\n", $this->
|
|
|
1699 |
$css = trim($css);
|
1700 |
-
$css = apply_filters($this->plugin_name.'/css_optimise', $css . (!empty($css) ? "\n" : ''));
|
1701 |
|
1702 |
-
return $css;
|
|
|
|
|
|
|
|
|
1703 |
}
|
1704 |
|
1705 |
//**************************************************************************************
|
@@ -2071,6 +2264,17 @@ E__O__T;
|
|
2071 |
$out .= '</td>';
|
2072 |
$out .= '</tr>'."\n";
|
2073 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2074 |
$out .= '<tr>';
|
2075 |
$out .= '<td>';
|
2076 |
$out .= $this->_checkbox('rm_generator', isset($this->options['priority']['wp_head']['wp_generator']) && $this->options['priority']['wp_head']['wp_generator'] <= 0);
|
@@ -2092,8 +2296,6 @@ E__O__T;
|
|
2092 |
$out .= __('Remove IE Conditional Tag.', $this->textdomain_name);
|
2093 |
$out .= '</td>';
|
2094 |
$out .= '<td>';
|
2095 |
-
$out .= $this->_checkbox('debug_mode');
|
2096 |
-
$out .= __('Debug mode', $this->textdomain_name);
|
2097 |
$out .= '</td>';
|
2098 |
$out .= '<td>';
|
2099 |
// $out .= $this->_checkbox('gzip_on');
|
@@ -2101,6 +2303,17 @@ E__O__T;
|
|
2101 |
$out .= '</td>';
|
2102 |
$out .= '</tr>'."\n";
|
2103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2104 |
$out .= '</tbody></table>';
|
2105 |
|
2106 |
// Active Filters
|
@@ -2255,23 +2468,25 @@ E__O__T;
|
|
2255 |
$foot_remove = (array) $recv_param['foot_remove'];
|
2256 |
|
2257 |
// get options
|
2258 |
-
$this->options['xml_declaration']
|
2259 |
-
$this->options['ie_conditional']
|
2260 |
-
$this->options['canonical_tag']
|
2261 |
-
$this->options['add_ogp_tag']
|
2262 |
-
$this->options['
|
2263 |
-
$this->options['
|
2264 |
-
$this->options['
|
2265 |
-
$this->options['
|
2266 |
-
$this->options['
|
2267 |
-
$this->options['
|
2268 |
-
$this->options['
|
2269 |
-
$this->options['
|
2270 |
-
$this->options['
|
2271 |
-
$this->options['
|
2272 |
-
$this->options['
|
2273 |
-
$this->options['
|
2274 |
-
$this->options['
|
|
|
|
|
2275 |
|
2276 |
$rm_generator = $this->_checkbox_val($recv_param, 'rm_generator');
|
2277 |
$rm_rsd_link = $this->_checkbox_val($recv_param, 'rm_rsd_link');
|
@@ -2548,7 +2763,7 @@ E__O__T;
|
|
2548 |
round($this->process_time, 4) ,
|
2549 |
$this->ret_len ,
|
2550 |
$this->org_len ,
|
2551 |
-
round(($this->org_len - $this->ret_len) / $this->org_len * 100, 2) . '%' ,
|
2552 |
"{$this->plugin_name} ({$this->plugin_ver})"
|
2553 |
);
|
2554 |
}
|
@@ -2626,10 +2841,10 @@ E__O__T;
|
|
2626 |
|
2627 |
if ($this->options['add_ogp_tag']) {
|
2628 |
if (!preg_match('/xmlns:og=[\'"][^\'"]+[\'"]"/i', $html_tag)) {
|
2629 |
-
$html_tag =
|
2630 |
}
|
2631 |
// if (!preg_match('/xmlns:fb=[\'"][^\'"]+[\'"]"/i', $html_tag)) {
|
2632 |
-
// $html_tag =
|
2633 |
// }
|
2634 |
}
|
2635 |
|
@@ -2680,7 +2895,7 @@ E__O__T;
|
|
2680 |
|
2681 |
// get the thumbnail
|
2682 |
$thumb = '';
|
2683 |
-
if (has_post_thumbnail($id)) {
|
2684 |
$thumb = preg_replace("/^.*['\"](https?:\/\/[^'\"]*)['\"].*/i","$1",get_the_post_thumbnail($id));
|
2685 |
} else {
|
2686 |
$attachments = get_children(array(
|
@@ -2748,6 +2963,203 @@ E__O__T;
|
|
2748 |
|
2749 |
return $ogp_tags;
|
2750 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2751 |
}
|
2752 |
|
2753 |
//**************************************************************************************
|
@@ -2756,9 +3168,4 @@ E__O__T;
|
|
2756 |
global $head_cleaner;
|
2757 |
|
2758 |
$head_cleaner = new HeadCleaner();
|
2759 |
-
|
2760 |
-
if (function_exists('register_activation_hook'))
|
2761 |
-
register_activation_hook(__FILE__, array(&$head_cleaner, 'activation'));
|
2762 |
-
if (function_exists('register_deactivation_hook'))
|
2763 |
-
register_deactivation_hook(__FILE__, array(&$head_cleaner, 'deactivation'));
|
2764 |
?>
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Head Cleaner
|
4 |
+
Version: 1.4.2
|
5 |
Plugin URI: http://wppluginsj.sourceforge.jp/head-cleaner/
|
6 |
Description: Cleaning tags from your WordPress header and footer.
|
7 |
Author: wokamoto
|
66 |
//**************************************************************************************
|
67 |
class HeadCleaner extends wokController {
|
68 |
public $plugin_name = 'head-cleaner';
|
69 |
+
public $plugin_ver = '1.4.2';
|
70 |
|
71 |
const PRIORITY = 10000;
|
72 |
const ANALYZE_EXPIRED = 604800; // 60 * 60 * 24 * 7 [sec.]
|
99 |
'use_ajax_libs' => false ,
|
100 |
'img_base64' => false ,
|
101 |
'add_ogp_tag' => false ,
|
102 |
+
'add_last_modified' => false ,
|
103 |
+
'paranoia_mode' => false ,
|
104 |
);
|
105 |
|
106 |
private $wp_url = '';
|
143 |
|
144 |
private $img_urls = array();
|
145 |
|
146 |
+
private $last_modified = array();
|
147 |
+
|
148 |
/**********************************************************
|
149 |
* Constructor
|
150 |
***********************************************************/
|
159 |
$this->self_url = $this->wp_plugin_url( basename(dirname(__FILE__)) ) . basename(__FILE__);
|
160 |
$this->lang = (defined('WPLANG') ? WPLANG : 'ja');
|
161 |
$this->charset = get_option('blog_charset');
|
162 |
+
$this->last_modified["posts"] = 0;
|
163 |
+
$this->last_modified["theme"] = 0;
|
164 |
$this->_get_filters('wp_head');
|
165 |
$this->_get_filters('wp_footer');
|
166 |
|
189 |
$this->_require_libraries();
|
190 |
|
191 |
// add action
|
192 |
+
if ($this->options['add_last_modified']) {
|
193 |
+
add_action('template_redirect', array(&$this, 'send_http_header_last_modified'));
|
194 |
+
}
|
195 |
add_action('wp_footer', array(&$this, 'filters_save'), 11);
|
196 |
|
197 |
+
if (!$this->_is_mobile()) {
|
198 |
+
// head cleaner
|
199 |
+
add_action('get_header', array(&$this, 'head_start'));
|
200 |
+
|
201 |
+
// paranoia mode
|
202 |
+
if ($this->options['paranoia_mode']) {
|
203 |
+
add_action('wp_head', array(&$this, 'body_start'), self::PRIORITY + 1);
|
204 |
+
}
|
205 |
+
|
206 |
+
// footer cleaner
|
207 |
+
if ($this->options['foot_js']) {
|
208 |
+
add_action('wp_footer', array(&$this, 'footer_start'), 1);
|
209 |
+
}
|
210 |
+
}
|
211 |
+
|
212 |
// [raw] shortcode support
|
213 |
if (HC_RAW_SHORTCODE) {
|
214 |
remove_filter('the_content', 'wpautop');
|
220 |
add_filter('the_excerpt', array(&$this, 'raw_formatter'), 99);
|
221 |
}
|
222 |
}
|
223 |
+
|
224 |
+
// activation & deactivation
|
225 |
+
if (function_exists('register_activation_hook')) {
|
226 |
+
register_activation_hook(__FILE__, array(&$this, 'activation'));
|
227 |
+
}
|
228 |
+
if (function_exists('register_deactivation_hook')) {
|
229 |
+
register_deactivation_hook(__FILE__, array(&$this, 'deactivation'));
|
230 |
+
}
|
231 |
}
|
232 |
|
233 |
/**********************************************************
|
275 |
$includes = dirname(__FILE__) . '/includes/';
|
276 |
|
277 |
// PHP Simple HTML DOM Parser
|
278 |
+
if (!function_exists('str_get_html')) {
|
279 |
require($includes . 'simple_html_dom.php' );
|
280 |
+
}
|
281 |
|
282 |
// jsmin.php - PHP implementation of Douglas Crockford's JSMin.
|
283 |
if ($this->options['js_minify'] && !class_exists('JSMin')) {
|
291 |
}
|
292 |
|
293 |
// Use Google Ajax Libraries
|
294 |
+
if ($this->options['use_ajax_libs']) {
|
295 |
require($includes . 'regist_ajax_libs.php');
|
296 |
+
}
|
297 |
}
|
298 |
|
299 |
//**************************************************************************************
|
317 |
// ob_start for Header
|
318 |
//**************************************************************************************
|
319 |
public function head_start(){
|
320 |
+
if (!$this->_is_mobile()) {
|
321 |
$ob_handlers = (array) ob_list_handlers();
|
322 |
+
if (count($ob_handlers) > 0) {
|
323 |
+
foreach ($ob_handlers as $ob_handler) {
|
324 |
+
if (isset($this->ob_handlers[$ob_handler])) {
|
325 |
$this->ob_handlers[$ob_handler] = true;
|
326 |
ob_end_flush();
|
327 |
}
|
331 |
ob_start(array(&$this, 'head_cleaner'));
|
332 |
$this->mtime_start = microtime();
|
333 |
|
334 |
+
if (function_exists('rel_canonical') && !$this->options['canonical_tag']) {
|
335 |
+
remove_action( 'wp_head', 'rel_canonical' );
|
336 |
+
}
|
337 |
|
338 |
add_action('wp_head', array(&$this, 'end'), self::PRIORITY);
|
339 |
$this->_get_filters('wp_head');
|
340 |
$this->_change_filters_priority('wp_head');
|
341 |
+
}
|
342 |
+
}
|
343 |
|
344 |
+
//**************************************************************************************
|
345 |
+
// ob_start for body
|
346 |
+
//**************************************************************************************
|
347 |
+
public function body_start(){
|
348 |
+
if (!$this->_is_mobile() && $this->options['paranoia_mode'] && !$this->_is_user_logged_in()) {
|
349 |
+
ob_start(array(&$this, 'html_cleaner'));
|
350 |
+
add_action('wp_footer', array(&$this, 'end'), 0);
|
351 |
}
|
352 |
}
|
353 |
|
355 |
// ob_start for footer
|
356 |
//**************************************************************************************
|
357 |
public function footer_start(){
|
358 |
+
if (!$this->_is_mobile() && $this->options['foot_js']) {
|
359 |
$ob_handlers = (array) ob_list_handlers();
|
360 |
+
if (count($ob_handlers) > 0) {
|
361 |
+
foreach ($ob_handlers as $ob_handler) {
|
362 |
+
if (isset($this->ob_handlers[$ob_handler])) {
|
363 |
$this->ob_handlers[$ob_handler] = true;
|
364 |
ob_end_flush();
|
365 |
}
|
369 |
ob_start(array(&$this, 'footer_cleaner'));
|
370 |
$this->mtime_start = microtime();
|
371 |
|
372 |
+
add_action('shutdown', array(&$this, 'end'), 1);
|
373 |
$this->_get_filters('wp_footer');
|
374 |
$this->_change_filters_priority('wp_footer');
|
375 |
}
|
379 |
// ob_handler
|
380 |
//**************************************************************************************
|
381 |
private function ob_handler($content){
|
382 |
+
foreach ($this->ob_handlers as $ob_handler => $enable) {
|
383 |
+
if ($enable) {
|
384 |
$this->ob_handlers[$ob_handler] = false;
|
385 |
switch ($ob_handler) {
|
386 |
case 'All_in_One_SEO_Pack::output_callback_for_title':
|
387 |
global $aiosp;
|
388 |
+
if (isset($aiosp))
|
389 |
$content = $aiosp->rewrite_title($content);
|
390 |
break;
|
391 |
case 'wpSEO::exe_modify_content':
|
392 |
+
if (isset($GLOBALS['wpSEO'])) {
|
393 |
$wpSEO = $GLOBALS['wpSEO'];
|
394 |
$content = $wpSEO->exe_modify_content($content);
|
395 |
}
|
429 |
//**************************************************************************************
|
430 |
public function head_cleaner($buffer) {
|
431 |
$buffer = $this->_tag_trim($this->ob_handler($buffer));
|
432 |
+
if (!function_exists('str_get_html')) {
|
433 |
+
$ret_val = apply_filters($this->plugin_name.'/head_cleaner', $buffer);
|
434 |
+
return $ret_val;
|
435 |
+
}
|
436 |
|
437 |
$head_txt = $buffer;
|
438 |
$url = $this->_get_permalink();
|
457 |
}
|
458 |
unset($match);
|
459 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
460 |
unset($matches);
|
461 |
|
462 |
+
$doctype = (
|
463 |
+
preg_match('/<!DOCTYPE [^>]* XHTML [^>]*>/i', $buffer)
|
464 |
+
? 'xhtml'
|
465 |
+
: 'html'
|
466 |
+
);
|
467 |
+
|
468 |
$ret_val = '';
|
469 |
+
$doctype_tag = '';
|
470 |
+
$html_tag = '';
|
471 |
+
$head_tag = '';
|
472 |
$meta_tag = '';
|
473 |
$title_tag = '';
|
474 |
$base_tag = '';
|
481 |
$inline_js = '';
|
482 |
$noscript_tag = '';
|
483 |
|
484 |
+
// Get <!DOCTYPE> tag
|
485 |
+
if (preg_match('/^(<\!DOCTYPE[^>]*>)/ism', $head_txt, $matches)) {
|
486 |
+
$doctype_tag = $this->_tag_trim($matches[1]);
|
487 |
+
}
|
488 |
|
489 |
+
// Get <head> tag and other
|
490 |
+
if (preg_match('/(<head[^>]*>[^<]*)(.*)$/ism', $head_txt, $matches)) {
|
491 |
+
$head_tag = $this->_tag_trim($matches[1]);
|
492 |
+
$head_txt = $this->_tag_trim($matches[2]);
|
|
|
|
|
493 |
}
|
494 |
unset($matches);
|
495 |
|
496 |
+
// for IE conditional tag
|
497 |
+
list($IE_conditional_tags, $head_txt, $ie6) = $this->_parse_IE_conditional_tags($buffer);
|
498 |
+
|
499 |
+
$IE_conditional_tag_pattern = '/(<\!-+[ \t]*\[if[ \t]*[\(]?[ \t]*(IE|[gl]te?[ \t]+IE)[^\]]+\][ \t]*>)[ \t\r\n]*(.*?)[ \t\r\n]*(<\![ \t]*\[endif\][ \t]*-+>)/ims';
|
500 |
+
if (!$this->options['ie_conditional'] && count($IE_conditional_tags) > 0) {
|
501 |
+
foreach ((array) $IE_conditional_tags as $IE_conditional_tag) {
|
502 |
+
if (isset($IE_conditional_tag[0])) {
|
503 |
+
$IE_tag = $this->_tag_trim(preg_replace($IE_conditional_tag_pattern, "$1$3$4", $IE_conditional_tag[0]));
|
504 |
+
if ( strpos(strtolower($IE_tag), '<html') !== false ) {
|
505 |
+
$html_tag .= $IE_tag;
|
506 |
+
}
|
507 |
+
}
|
508 |
+
}
|
509 |
+
unset($IE_conditional_tag);
|
510 |
+
}
|
511 |
+
|
512 |
+
// Get <html> tag and <head> tag
|
513 |
+
if ($doctype == 'xhtml') {
|
514 |
+
// xhtml
|
515 |
+
$xml_head = empty($xml_head) ? $this->_tag_trim('<?xml version="1.0" encoding="'.$this->charset.'"?>') : $xml_head;
|
516 |
+
$doctype_tag = empty($doctype_tag) ? $this->_tag_trim('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">') : $doctype_tag;
|
517 |
+
$html_tag = empty($html_tag) ? $this->_tag_trim('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$this->lang.'" lang="'.$this->lang.'">') : $html_tag;
|
518 |
+
$head_tag = empty($head_tag) ? $this->_tag_trim('<head profile="http://gmpg.org/xfn/11">') : $head_tag;
|
519 |
+
} else {
|
520 |
+
// html
|
521 |
+
$xml_head = '';
|
522 |
+
$doctype_tag = empty($doctype_tag) ? $this->_tag_trim('<!DOCTYPE html>') : $doctype_tag;
|
523 |
+
$html_tag = empty($html_tag) ? $this->_tag_trim('<html dir="ltr" lang="'.$this->lang.'">') : $html_tag;
|
524 |
+
$head_tag = empty($head_tag) ? $this->_tag_trim('<head>') : $head_tag;
|
525 |
+
}
|
526 |
+
|
527 |
if ($this->options['add_ogp_tag']) {
|
528 |
$head_txt .= $this->_get_ogp_tags();
|
529 |
}
|
530 |
|
531 |
+
// Get Simple DOM Object
|
532 |
$head_txt = preg_replace_callback(
|
533 |
array('/(content=)(")([^"]*)(")/i', '/(content=)(\')([^\']*)(\')/i'),
|
534 |
array(&$this, '_tag_replace'),
|
535 |
$head_txt
|
536 |
);
|
537 |
+
$dom = str_get_html("<html></head>{$head_txt}</head><body></body></html>");
|
538 |
+
if ($dom === false) {
|
|
|
|
|
|
|
|
|
539 |
return ($this->_tag_trim($buffer));
|
540 |
+
}
|
541 |
|
542 |
// ***** Parse Start! *****
|
543 |
|
559 |
|
560 |
// for IE conditional tag
|
561 |
if (!$this->options['ie_conditional'] && count($IE_conditional_tags) > 0) {
|
|
|
562 |
foreach ((array) $IE_conditional_tags as $IE_conditional_tag) {
|
563 |
if (isset($IE_conditional_tag[0])) {
|
564 |
+
$IE_tag = $this->_tag_trim(preg_replace($IE_conditional_tag_pattern, "$1$3$4", $IE_conditional_tag[0]));
|
565 |
+
if ( strpos(strtolower($IE_tag), '<meta') !== false ) {
|
566 |
+
$meta_tag .= $IE_tag;
|
567 |
+
} elseif ( strpos(strtolower($IE_tag), '<link') !== false ) {
|
568 |
$css_tag .= $IE_tag;
|
569 |
+
} elseif ( strpos(strtolower($IE_tag), '<style') !== false ) {
|
570 |
$inline_css .= $IE_tag;
|
571 |
+
} elseif ( strpos(strtolower($IE_tag), '<script') !== false ) {
|
572 |
$inline_js .= $IE_tag;
|
573 |
+
} elseif ( strpos(strtolower($IE_tag), '<html') !== false ) {
|
574 |
+
} elseif ( !empty($IE_tag) ) {
|
575 |
$object_tag .= $IE_tag;
|
576 |
+
}
|
577 |
}
|
578 |
}
|
579 |
}
|
581 |
|
582 |
// Build!
|
583 |
$ret_val .=
|
584 |
+
$this->_tag_trim($doctype_tag) .
|
585 |
$this->_tag_trim($html_tag) .
|
586 |
$this->_tag_trim($head_tag) .
|
587 |
$this->_tag_trim($meta_tag) .
|
602 |
$this->foot_js_src .= $script_tag . $inline_js;
|
603 |
$this->foot_js_src = $this->_tag_trim($this->foot_js_src);
|
604 |
}
|
605 |
+
if (!empty($this->foot_js_src)) {
|
606 |
add_action('wp_footer', array(&$this, 'footer'), 9);
|
607 |
+
}
|
608 |
|
609 |
// dynamic css, js
|
610 |
+
if ($this->options['dynamic']) {
|
611 |
$ret_val = $this->_dynamic_js_css($ret_val);
|
612 |
+
}
|
613 |
|
614 |
// set xml declaration
|
615 |
+
$ret_val = (
|
616 |
+
$ie6 || !$this->options['xml_declaration']
|
617 |
? preg_replace('/^<\?xml[^>]*>/i', '', $ret_val)
|
618 |
: $this->_tag_trim(strpos($ret_val, '<?xml') === false ? $xml_head : '') . $ret_val
|
619 |
);
|
621 |
$ret_val = str_replace(''', "'", $ret_val);
|
622 |
|
623 |
// add debug information
|
624 |
+
if ($this->options['debug_mode']) {
|
625 |
$ret_val .= $this->_get_debug_info($buffer);
|
626 |
+
}
|
627 |
|
628 |
$this->org_len = strlen(bin2hex($buffer));
|
629 |
$this->ret_len = strlen(bin2hex($ret_val));
|
630 |
$this->process_time = $this->_microtime_diff($this->mtime_start);
|
631 |
// $ret_val .= "<!-- {$this->process_time} seconds. {$this->ret_len} / {$this->org_len} (" . (int) (($this->org_len - $this->ret_len) / $this->org_len * 10000) / 100 . "% saving) -->\n";
|
632 |
|
633 |
+
if (!$this->_is_user_logged_in() && $this->options['paranoia_mode']) {
|
634 |
+
$ret_val = $this->html_cleaner($ret_val);
|
635 |
+
}
|
636 |
+
|
637 |
$ret_val = apply_filters($this->plugin_name.'/head_cleaner', $ret_val);
|
638 |
return $ret_val;
|
639 |
}
|
646 |
//**************************************************************************************
|
647 |
// Parse IE conditional tags
|
648 |
//**************************************************************************************
|
649 |
+
private function _parse_IE_conditional_tags($content){
|
650 |
// Check USER AGENT
|
651 |
$ua = trim(strtolower($_SERVER['HTTP_USER_AGENT']));
|
652 |
$ie = (strpos($ua, 'msie') !== false && !preg_match('/(gecko|applewebkit|opera|sleipnir|chrome)/i', $ua));
|
656 |
$IE_conditional_tags = array();
|
657 |
if ($this->options['ie_conditional']) {
|
658 |
if ($ie) {
|
659 |
+
$IE_conditional_tag_pattern = '/<\!-+[ \t]*[\(]?[ \t]*\[if[ \t]*%s[ \t]*\][ \t]*[\)]?[^>]*>(.*?)<\![ \t]*\[endif\][ \t]*-+>/ism';
|
660 |
+
$content = preg_replace(sprintf($IE_conditional_tag_pattern, 'IE'), '$1', $content);
|
661 |
|
662 |
$replace_patterns = array();
|
663 |
if (version_compare($ie_ver, '5.5', '<')) { // IE 5
|
664 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)IE[ \t]*5\.?0?'); // >= 5, <= 5, = 5
|
665 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)IE[ \t]*5\.5'); // < 5.5, <= 5.5
|
666 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)IE[ \t]*[678]\.?0?'); // < 6 - 8, <= 6 - 8
|
667 |
} elseif (version_compare($ie_ver, '6.0', '<')) { // IE 5.5
|
668 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)IE[ \t]*5\.5'); // >= 5.5, <= 5.5, = 5.5
|
669 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)IE[ \t]*[678]\.?0?'); // < 6 - 8, <= 6 - 8
|
670 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)IE[ \t]*5\.?0?'); // > 5, >= 5
|
671 |
} elseif (version_compare($ie_ver, '7.0', '<')) { // IE 6
|
672 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)IE[ \t]*6\.?0?'); // >= 6, <= 6, = 6
|
673 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)IE[ \t]*[78]\.?0?'); // < 7 - 8, <= 7 - 8
|
674 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)IE[ \t]*5\.?0?'); // > 5, >= 5
|
675 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)IE[ \t]*5\.5'); // > 5.5, >= 5.5
|
676 |
} elseif (version_compare($ie_ver, '8.0', '<')) { // IE 7
|
677 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)IE[ \t]*7\.?0?'); // >= 7, <= 7, = 7
|
678 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)IE[ \t]*8\.?0?'); // < 8, <= 8
|
679 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)IE[ \t]*[56]\.?0?'); // > 5 - 6, >= 5 - 6
|
680 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)IE[ \t]*5\.5'); // > 5.5, >= 5.5
|
681 |
} elseif (version_compare($ie_ver, '9.0', '<')) { // IE 8
|
682 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)IE[ \t]*8\.?0?'); // >= 8, <= 8, = 8
|
683 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)IE[ \t]*[567]\.?0?'); // > 5 - 7, >= 5 - 7
|
684 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)IE[ \t]*5\.5'); // > 5.5, >= 5.5
|
685 |
} elseif (version_compare($ie_ver, '10.0', '<')) { // IE 9
|
686 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)IE[ \t]*9\.?0?'); // >= 9, <= 9, = 9
|
687 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)IE[ \t]*[5678]\.?0?'); // > 5 - 8, >= 5 - 8
|
688 |
+
$replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)IE[ \t]*5\.5'); // > 5.5, >= 5.5
|
689 |
}
|
690 |
|
691 |
+
if (count($replace_patterns) > 0) {
|
692 |
+
$content = preg_replace($replace_patterns, '$2', $content);
|
693 |
+
}
|
694 |
unset($replace_patterns);
|
695 |
}
|
696 |
} else {
|
697 |
+
$IE_conditional_tag_pattern = '/(<\!-+[ \t]*\[if[ \t]*[\(]?[ \t]*(IE|[gl]te?[ \t]+IE)[^\]]+\][ \t]*>)[ \t\r\n]*(.*?)[ \t\r\n]*(<\![ \t]*\[endif\][ \t]*-+>)/ims';
|
698 |
+
preg_match_all($IE_conditional_tag_pattern, $content, $IE_conditional_tags, PREG_SET_ORDER);
|
699 |
+
$content = preg_replace($IE_conditional_tag_pattern, '', $content);
|
700 |
}
|
701 |
|
702 |
+
return array($IE_conditional_tags, $content, $ie6);
|
703 |
}
|
704 |
|
705 |
//**************************************************************************************
|
934 |
return array($script_tag, $inline_js, $foot_js);
|
935 |
}
|
936 |
|
937 |
+
//**************************************************************************************
|
938 |
+
// html cleaner
|
939 |
+
//**************************************************************************************
|
940 |
+
public function html_cleaner($content) {
|
941 |
+
$ret_val = $this->_html_cleaner_helper($content);
|
942 |
+
|
943 |
+
if(is_singular()) {
|
944 |
+
$home_url = trailingslashit(get_home_url('/'));
|
945 |
+
$permalink = $this->_get_permalink();
|
946 |
+
$ret_val = str_replace(str_replace($home_url, '/', $permalink), $permalink, $ret_val);
|
947 |
+
$ret_val = str_replace(untrailingslashit(get_home_url('/')).untrailingslashit(get_home_url('/')), untrailingslashit(get_home_url('/')), $ret_val);
|
948 |
+
}
|
949 |
+
|
950 |
+
$ret_val = apply_filters($this->plugin_name.'/html_cleaner', trim($ret_val));
|
951 |
+
return $ret_val ;
|
952 |
+
}
|
953 |
+
|
954 |
+
private function _html_cleaner_helper($content) {
|
955 |
+
$home_url = trailingslashit(get_home_url('/'));
|
956 |
+
|
957 |
+
$pattern = '/(' .
|
958 |
+
'<(meta [^>]*property="og:(url|image)"' .
|
959 |
+
'|link [^>]*rel="(canonical|shortlink)")[^>]*>' .
|
960 |
+
'|<pre[^>]*>.*?<\/pre>' .
|
961 |
+
'|<script[^>]*>.*?<\/script>' .
|
962 |
+
'|<style[^>]*>.*?<\/style>' .
|
963 |
+
'|<[^>]*style=["\'][^"\']*["\'][^>]*>' .
|
964 |
+
')/ims';
|
965 |
+
$replace = array();
|
966 |
+
if (preg_match_all($pattern, $content, $matches)) {
|
967 |
+
foreach ($matches[0] as $match) {
|
968 |
+
if (preg_match('/^(<script[^>]*>)(.*?)(<\/script>)/ims', $match, $wk)) {
|
969 |
+
$replace[] =
|
970 |
+
trim(str_replace($home_url, '/', $wk[1])) .
|
971 |
+
trim($this->js_minify($wk[2])) .
|
972 |
+
trim($wk[3]);
|
973 |
+
} elseif (preg_match('/^(<style[^>]*>)(.*?)(<\/style>)/ims', $match, $wk)) {
|
974 |
+
$replace[] =
|
975 |
+
trim(str_replace($home_url, '/', $wk[1])) .
|
976 |
+
trim($this->css_optimise($wk[2])) .
|
977 |
+
trim($wk[3]);
|
978 |
+
} elseif (preg_match('/^(<[^>]*style=["\'])([^"\']*)(["\'][^>]*>)/ims', $match, $wk)) {
|
979 |
+
$replace[] =
|
980 |
+
trim(str_replace($home_url, '/', $wk[1])) .
|
981 |
+
trim(preg_replace('/([:;])[ \t]+/','$1',$wk[2])) .
|
982 |
+
trim(str_replace($home_url, '/', $wk[3]));
|
983 |
+
} else {
|
984 |
+
$replace[] = trim($match);
|
985 |
+
}
|
986 |
+
unset($wk);
|
987 |
+
}
|
988 |
+
}
|
989 |
+
$ret_val = str_replace($home_url, '/', $content);
|
990 |
+
$ret_val = trim(preg_replace(
|
991 |
+
array('/[\r\n]/', '/[\t ]+/', '/>[\t ]+</', '/[\t ]+>/'),
|
992 |
+
array('', ' ','><', '>'),
|
993 |
+
$ret_val
|
994 |
+
));
|
995 |
+
if (count($replace) > 0 && preg_match_all($pattern, $ret_val, $matches)) {
|
996 |
+
$ret_val = str_replace($matches[0], $replace, $ret_val);
|
997 |
+
}
|
998 |
+
unset($replace);
|
999 |
+
unset($matches);
|
1000 |
+
|
1001 |
+
// remove comments
|
1002 |
+
$pattern = '/<\![\-]+.*?[\-]+>/ims';
|
1003 |
+
$IE_tag_pattern = '/\[if[ \t]*[\(]?[ \t]*(IE|[gl]te?[ \t]+IE)[^\]]*[\)]?[^\]]*\]/i';
|
1004 |
+
$replace = array();
|
1005 |
+
if (preg_match_all($pattern, $ret_val, $matches)) {
|
1006 |
+
foreach ($matches[0] as $match) {
|
1007 |
+
if (preg_match($IE_tag_pattern, $match)) {
|
1008 |
+
$replace[] = trim($match);
|
1009 |
+
} else {
|
1010 |
+
$replace[] = '';
|
1011 |
+
}
|
1012 |
+
}
|
1013 |
+
}
|
1014 |
+
if (count($replace) > 0 && preg_match_all($pattern, $ret_val, $matches)) {
|
1015 |
+
$ret_val = str_replace($matches[0], $replace, $ret_val);
|
1016 |
+
}
|
1017 |
+
unset($replace);
|
1018 |
+
unset($matches);
|
1019 |
+
|
1020 |
+
return $ret_val;
|
1021 |
+
}
|
1022 |
+
|
1023 |
//**************************************************************************************
|
1024 |
// JavaScript Moved bottom
|
1025 |
//**************************************************************************************
|
1032 |
//**************************************************************************************
|
1033 |
public function footer_cleaner($buffer) {
|
1034 |
$buffer = $this->_tag_trim($this->ob_handler($buffer));
|
1035 |
+
if (!function_exists('str_get_html')) {
|
1036 |
+
$ret_val = apply_filters($this->plugin_name.'/footer_cleaner', $buffer);
|
1037 |
+
return $ret_val;
|
1038 |
+
}
|
1039 |
|
1040 |
$ret_val = '';
|
1041 |
$script_tag = '';
|
1050 |
|
1051 |
// Get Simple DOM Object
|
1052 |
$dom = str_get_html(
|
1053 |
+
'<div id="footer">' . $fotter_txt . '</div>'
|
|
|
|
|
1054 |
);
|
1055 |
if ($dom === false)
|
1056 |
return $buffer;
|
1143 |
|
1144 |
// $ret_val .= $this->_process_time();
|
1145 |
|
1146 |
+
if (preg_match('/<\/body>/i', $buffer)) {
|
1147 |
+
$ret_val .= '</body>';
|
1148 |
+
}
|
1149 |
+
if (preg_match('/<\/html>/i', $buffer)) {
|
1150 |
+
$ret_val .= '</html>';
|
1151 |
+
}
|
1152 |
+
|
1153 |
+
if (!$this->_is_user_logged_in() && $this->options['paranoia_mode']) {
|
1154 |
+
$ret_val = $this->html_cleaner($ret_val);
|
1155 |
+
}
|
1156 |
+
|
1157 |
$ret_val = apply_filters($this->plugin_name.'/footer_cleaner', $ret_val);
|
1158 |
return $ret_val;
|
1159 |
}
|
1176 |
return is_user_logged_in();
|
1177 |
} else {
|
1178 |
global $user;
|
|
|
|
|
1179 |
return (!empty($user->ID));
|
1180 |
}
|
1181 |
}
|
1820 |
//**************************************************************************************
|
1821 |
// Minified JavaScript
|
1822 |
//**************************************************************************************
|
1823 |
+
public function js_minify($buffer) {
|
1824 |
+
$js = $buffer;
|
1825 |
+
if ( class_exists('JSMin') ) {
|
1826 |
+
$js = JSMin::minify($js);
|
1827 |
+
} else if( class_exists('JSMinPlus') ) {
|
1828 |
+
$js = JSMinPlus::minify($js);
|
1829 |
+
}
|
1830 |
+
$js = trim($js);
|
1831 |
+
return $js . (!empty($js) ? "\n" : '');
|
1832 |
+
}
|
1833 |
+
|
1834 |
private function _js_minify($buffer) {
|
1835 |
$js = $this->_tag_trim($buffer);
|
1836 |
if ($this->options['js_minify']) {
|
1837 |
+
$js = $this->js_minify($js);
|
|
|
|
|
|
|
|
|
1838 |
}
|
1839 |
+
return apply_filters($this->plugin_name.'/js_minify', $js);
|
|
|
|
|
|
|
1840 |
}
|
1841 |
|
1842 |
//**************************************************************************************
|
1843 |
// Optimise CSS
|
1844 |
//**************************************************************************************
|
1845 |
+
public function css_optimise($buffer) {
|
1846 |
+
$css = $buffer;
|
1847 |
+
if (class_exists('Minify_CSS')) {
|
1848 |
+
$css = Minify_CSS::minify($css);
|
1849 |
+
}
|
1850 |
+
$css = trim($css);
|
1851 |
+
return $css . (!empty($css) ? "\n" : '');
|
1852 |
+
}
|
1853 |
+
|
1854 |
+
public function css_import($css) {
|
1855 |
if (preg_match_all('/@import[ \t]*url[ \t]*\([\'"]?([^\)\'"]*)[\'"]?\);?/i', $css, $matches, PREG_SET_ORDER)) {
|
1856 |
$search = array();
|
1857 |
$replace = array();
|
1859 |
$filename = str_replace($this->wp_url, ABSPATH, trim($match[1]));
|
1860 |
list($content, $cache_path) = $this->_file_read(file_exists($filename) ? $filename : $match[1], 'css');
|
1861 |
$content = $this->_css_url_edit($content, $filename);
|
1862 |
+
if ($this->options['css_optimise']) {
|
1863 |
+
$content = $this->css_optimise($content);
|
1864 |
+
}
|
1865 |
+
if (preg_match('/@import[ \t]*url[ \t]*\([\'"]?[^\)\'"]*[\'"]?\);?/i', $content)) {
|
1866 |
+
$content = $this->css_import($content);
|
1867 |
+
}
|
1868 |
$search[] = $match[0];
|
1869 |
$replace[] = $content;
|
1870 |
}
|
1880 |
|
1881 |
private function _css_optimise($buffer, $merge = true) {
|
1882 |
$css = $this->_tag_trim($buffer);
|
1883 |
+
if ($this->options['css_optimise']) {
|
1884 |
+
$css = $this->css_optimise($css);
|
1885 |
+
}
|
1886 |
+
if ( $merge ) {
|
1887 |
+
$css = str_replace("\n\n", "\n", $this->css_import($css));
|
1888 |
+
}
|
1889 |
$css = trim($css);
|
|
|
1890 |
|
1891 |
+
return apply_filters($this->plugin_name.'/css_optimise', $css);
|
1892 |
+
}
|
1893 |
+
|
1894 |
+
private function _css_import($css) {
|
1895 |
+
return $this->css_import($css);
|
1896 |
}
|
1897 |
|
1898 |
//**************************************************************************************
|
2264 |
$out .= '</td>';
|
2265 |
$out .= '</tr>'."\n";
|
2266 |
|
2267 |
+
$out .= '<tr>';
|
2268 |
+
$out .= '<td>';
|
2269 |
+
$out .= $this->_checkbox('add_last_modified');
|
2270 |
+
$out .= __('Add Last modified.', $this->textdomain_name);
|
2271 |
+
$out .= '</td>';
|
2272 |
+
$out .= '<td>';
|
2273 |
+
$out .= '</td>';
|
2274 |
+
$out .= '<td>';
|
2275 |
+
$out .= '</td>';
|
2276 |
+
$out .= '</tr>'."\n";
|
2277 |
+
|
2278 |
$out .= '<tr>';
|
2279 |
$out .= '<td>';
|
2280 |
$out .= $this->_checkbox('rm_generator', isset($this->options['priority']['wp_head']['wp_generator']) && $this->options['priority']['wp_head']['wp_generator'] <= 0);
|
2296 |
$out .= __('Remove IE Conditional Tag.', $this->textdomain_name);
|
2297 |
$out .= '</td>';
|
2298 |
$out .= '<td>';
|
|
|
|
|
2299 |
$out .= '</td>';
|
2300 |
$out .= '<td>';
|
2301 |
// $out .= $this->_checkbox('gzip_on');
|
2303 |
$out .= '</td>';
|
2304 |
$out .= '</tr>'."\n";
|
2305 |
|
2306 |
+
$out .= '<tr>';
|
2307 |
+
$out .= '<td colspan="2">';
|
2308 |
+
$out .= $this->_checkbox('paranoia_mode');
|
2309 |
+
$out .= __('Enabling "<strong>paranoia mode</strong>". Cut waste from the HTML and tries to minimize it.', $this->textdomain_name);
|
2310 |
+
$out .= '</td>';
|
2311 |
+
$out .= '<td>';
|
2312 |
+
$out .= $this->_checkbox('debug_mode');
|
2313 |
+
$out .= __('Debug mode', $this->textdomain_name);
|
2314 |
+
$out .= '</td>';
|
2315 |
+
$out .= '</tr>'."\n";
|
2316 |
+
|
2317 |
$out .= '</tbody></table>';
|
2318 |
|
2319 |
// Active Filters
|
2468 |
$foot_remove = (array) $recv_param['foot_remove'];
|
2469 |
|
2470 |
// get options
|
2471 |
+
$this->options['xml_declaration'] = $this->_checkbox_val($recv_param, 'xml_declaration');
|
2472 |
+
$this->options['ie_conditional'] = $this->_checkbox_val($recv_param, 'ie_conditional');
|
2473 |
+
$this->options['canonical_tag'] = $this->_checkbox_val($recv_param, 'canonical_tag');
|
2474 |
+
$this->options['add_ogp_tag'] = $this->_checkbox_val($recv_param, 'add_ogp_tag');
|
2475 |
+
$this->options['add_last_modified'] = $this->_checkbox_val($recv_param, 'add_last_modified');
|
2476 |
+
$this->options['foot_js'] = $this->_checkbox_val($recv_param, 'foot_js');
|
2477 |
+
$this->options['dynamic'] = $this->_checkbox_val($recv_param, 'dynamic');
|
2478 |
+
$this->options['js_move_foot'] = $this->_checkbox_val($recv_param, 'js_move_foot');
|
2479 |
+
$this->options['cache_enabled'] = $this->_checkbox_val($recv_param, 'cache_enabled');
|
2480 |
+
$this->options['combined_css'] = $this->_checkbox_val($recv_param, 'combined_css');
|
2481 |
+
$this->options['css_optimise'] = $this->_checkbox_val($recv_param, 'css_optimise');
|
2482 |
+
$this->options['default_media'] = trim($recv_param['default_media']);
|
2483 |
+
$this->options['img_base64'] = $this->_checkbox_val($recv_param, 'img_base64');
|
2484 |
+
$this->options['combined_js'] = $this->_checkbox_val($recv_param, 'combined_js');
|
2485 |
+
$this->options['js_minify'] = $this->_checkbox_val($recv_param, 'js_minify');
|
2486 |
+
$this->options['paranoia_mode'] = $this->_checkbox_val($recv_param, 'paranoia_mode');
|
2487 |
+
$this->options['gzip_on'] = $this->_checkbox_val($recv_param, 'gzip_on');
|
2488 |
+
$this->options['use_ajax_libs'] = $this->_checkbox_val($recv_param, 'use_ajax_libs');
|
2489 |
+
$this->options['debug_mode'] = $this->_checkbox_val($recv_param, 'debug_mode');
|
2490 |
|
2491 |
$rm_generator = $this->_checkbox_val($recv_param, 'rm_generator');
|
2492 |
$rm_rsd_link = $this->_checkbox_val($recv_param, 'rm_rsd_link');
|
2763 |
round($this->process_time, 4) ,
|
2764 |
$this->ret_len ,
|
2765 |
$this->org_len ,
|
2766 |
+
($this->org_len > 0 ? round(($this->org_len - $this->ret_len) / $this->org_len * 100, 2) . '%' : '') ,
|
2767 |
"{$this->plugin_name} ({$this->plugin_ver})"
|
2768 |
);
|
2769 |
}
|
2841 |
|
2842 |
if ($this->options['add_ogp_tag']) {
|
2843 |
if (!preg_match('/xmlns:og=[\'"][^\'"]+[\'"]"/i', $html_tag)) {
|
2844 |
+
$html_tag = preg_replace('/(<html[^>]*)>/i', '$1 xmlns:og="'.$xmlns_og.'">', $html_tag);
|
2845 |
}
|
2846 |
// if (!preg_match('/xmlns:fb=[\'"][^\'"]+[\'"]"/i', $html_tag)) {
|
2847 |
+
// $html_tag = preg_replace('/(<html[^>]*)>/i', '$1 xmlns:fb="'.$xmlns_fb.'">', $html_tag);
|
2848 |
// }
|
2849 |
}
|
2850 |
|
2895 |
|
2896 |
// get the thumbnail
|
2897 |
$thumb = '';
|
2898 |
+
if (function_exists('has_post_thumbnail') && has_post_thumbnail($id)) {
|
2899 |
$thumb = preg_replace("/^.*['\"](https?:\/\/[^'\"]*)['\"].*/i","$1",get_the_post_thumbnail($id));
|
2900 |
} else {
|
2901 |
$attachments = get_children(array(
|
2963 |
|
2964 |
return $ogp_tags;
|
2965 |
}
|
2966 |
+
|
2967 |
+
/**********************************************************
|
2968 |
+
* Send HTTP Header (Last-Modified or 304 Not Modified)
|
2969 |
+
***********************************************************/
|
2970 |
+
public function send_http_header_last_modified() {
|
2971 |
+
if ($this->_is_user_logged_in()) {
|
2972 |
+
return false;
|
2973 |
+
}
|
2974 |
+
|
2975 |
+
$last_modified = $this->get_last_modified();
|
2976 |
+
if ($last_modified !== false) {
|
2977 |
+
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $last_modified . ' GMT'));
|
2978 |
+
|
2979 |
+
$modified_since = $this->_get_modified_since();
|
2980 |
+
if ($modified_since >= $last_modified) {
|
2981 |
+
header("HTTP/1.0 304 Not Modified");
|
2982 |
+
wp_die();
|
2983 |
+
}
|
2984 |
+
|
2985 |
+
if (!is_feed()) {
|
2986 |
+
add_action('wp_head', array(&$this, 'last_modified_meta_tag'));
|
2987 |
+
}
|
2988 |
+
}
|
2989 |
+
}
|
2990 |
+
|
2991 |
+
/**********************************************************
|
2992 |
+
* Get Last Modified Time
|
2993 |
+
***********************************************************/
|
2994 |
+
public function last_modified_meta_tag() {
|
2995 |
+
$last_modified = $this->get_last_modified();
|
2996 |
+
if ($last_modified !== false) {
|
2997 |
+
$last_modified = gmdate('D, d M Y H:i:s', $last_modified . ' GMT');
|
2998 |
+
$last_modified_meta_tag = "<meta http-equiv=\"Last-Modified\" content=\"$last_modified\" />\n";
|
2999 |
+
echo $last_modified_meta_tag;
|
3000 |
+
} else {
|
3001 |
+
return false;
|
3002 |
+
}
|
3003 |
+
}
|
3004 |
+
|
3005 |
+
/**********************************************************
|
3006 |
+
* Get Last Modified Time
|
3007 |
+
***********************************************************/
|
3008 |
+
public function get_last_modified() {
|
3009 |
+
global $posts, $post;
|
3010 |
+
|
3011 |
+
$posts_last_modified = $this->_posts_last_modified(
|
3012 |
+
!is_singular()
|
3013 |
+
? $posts
|
3014 |
+
: array($post)
|
3015 |
+
);
|
3016 |
+
|
3017 |
+
$theme_last_modified = (
|
3018 |
+
!is_feed()
|
3019 |
+
? $this->_theme_last_modified()
|
3020 |
+
: 0
|
3021 |
+
);
|
3022 |
+
|
3023 |
+
$last_modified = ( $posts_last_modified > $theme_last_modified
|
3024 |
+
? $posts_last_modified
|
3025 |
+
: $theme_last_modified
|
3026 |
+
);
|
3027 |
+
|
3028 |
+
return ( $last_modified !== false && $last_modified > 0
|
3029 |
+
? $last_modified
|
3030 |
+
: false
|
3031 |
+
);
|
3032 |
+
}
|
3033 |
+
|
3034 |
+
private function _posts_last_modified($posts) {
|
3035 |
+
if (!is_array($posts))
|
3036 |
+
return 0;
|
3037 |
+
|
3038 |
+
if ($this->last_modified["posts"] === 0) {
|
3039 |
+
$last_modified = 0;
|
3040 |
+
|
3041 |
+
foreach ((array) $posts as $post) {
|
3042 |
+
// get last post modified time
|
3043 |
+
$post_update =strtotime(mysql2date('Y-m-d H:i:s',$post->post_modified_gmt));
|
3044 |
+
if ($last_modified < $post_update)
|
3045 |
+
$last_modified = $post_update;
|
3046 |
+
|
3047 |
+
// get last comment modified time
|
3048 |
+
$post_comments = get_comments(array(
|
3049 |
+
"status" => "approve",
|
3050 |
+
"order" => "DESC",
|
3051 |
+
"number" => 1,
|
3052 |
+
"post_id" => $post->ID,
|
3053 |
+
));
|
3054 |
+
foreach ((array) $post_comments as $post_comment) {
|
3055 |
+
$comment_update =strtotime(mysql2date('Y-m-d H:i:s',$post_comment->comment_date_gmt));
|
3056 |
+
if ($last_modified < $comment_update)
|
3057 |
+
$last_modified = $comment_update;
|
3058 |
+
}
|
3059 |
+
unset($post_comment); unset($post_comments);
|
3060 |
+
}
|
3061 |
+
unset($post);
|
3062 |
+
|
3063 |
+
$this->last_modified["posts"] = ( $last_modified > 0 ? $last_modified : 0);
|
3064 |
+
}
|
3065 |
+
|
3066 |
+
return $this->last_modified["posts"];
|
3067 |
+
}
|
3068 |
+
|
3069 |
+
private function _theme_last_modified() {
|
3070 |
+
if ($this->last_modified["theme"] === 0) {
|
3071 |
+
$last_modified = filemtime(ABSPATH . 'index.php');
|
3072 |
+
|
3073 |
+
if (!is_feed()) {
|
3074 |
+
$theme_dir = untrailingslashit(get_template_directory());
|
3075 |
+
opendir($theme_dir);
|
3076 |
+
while($filename = readdir()) {
|
3077 |
+
if (preg_match('/¥.php$/i', $filename)) {
|
3078 |
+
$modified = filemtime( "{$theme_dir}/{$filename}" );
|
3079 |
+
if ($last_modified < $modified)
|
3080 |
+
$last_modified = $modified;
|
3081 |
+
}
|
3082 |
+
}
|
3083 |
+
}
|
3084 |
+
closedir();
|
3085 |
+
|
3086 |
+
$this->last_modified["theme"] = ( $last_modified > 0 ? $last_modified : 0);
|
3087 |
+
}
|
3088 |
+
|
3089 |
+
return $this->last_modified["theme"];
|
3090 |
+
}
|
3091 |
+
|
3092 |
+
/**********************************************************
|
3093 |
+
* Get Request Header (If-Modified-Since)
|
3094 |
+
***********************************************************/
|
3095 |
+
private function _get_modified_since() {
|
3096 |
+
$requestHeaders = null;
|
3097 |
+
|
3098 |
+
if (function_exists('apache_request_headers')) {
|
3099 |
+
$requestHeaders = apache_request_headers();
|
3100 |
+
} elseif (class_exists('HttpRequest')) {
|
3101 |
+
$requestHeaders = HttpRequest::getHeaders();
|
3102 |
+
}
|
3103 |
+
|
3104 |
+
$modified_since = ( !empty($requestHeaders)
|
3105 |
+
? $requestHeaders['If-Modified-Since']
|
3106 |
+
: $_SERVER['HTTP_IF_MODIFIED_SINCE']
|
3107 |
+
);
|
3108 |
+
unset($requestHeaders);
|
3109 |
+
|
3110 |
+
$date = $this->parse_http_date($modified_since);
|
3111 |
+
|
3112 |
+
return ($date !== false
|
3113 |
+
? $date["timestamp"]
|
3114 |
+
: false
|
3115 |
+
);
|
3116 |
+
}
|
3117 |
+
|
3118 |
+
/**********************************************************
|
3119 |
+
* based on parse_http_date()
|
3120 |
+
* http://www.arielworks.net/articles/2004/0125a
|
3121 |
+
***********************************************************/
|
3122 |
+
private function parse_http_date( $string_date ) {
|
3123 |
+
|
3124 |
+
$define_month = array(
|
3125 |
+
"01" => "Jan", "02" => "Feb", "03" => "Mar",
|
3126 |
+
"04" => "Apr", "05" => "May", "06" => "Jun",
|
3127 |
+
"07" => "Jul", "08" => "Aug", "09" => "Sep",
|
3128 |
+
"10" => "Oct", "11" => "Nov", "12" => "Dec"
|
3129 |
+
);
|
3130 |
+
|
3131 |
+
if( preg_match( "/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), ([0-3][0-9]) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ([0-9]{4}) ([0-2][0-9]):([0-5][0-9]):([0-5][0-9]) GMT$/", $string_date, $temp_date ) ) {
|
3132 |
+
$date["hour"] = $temp_date[5];
|
3133 |
+
$date["minute"] = $temp_date[6];
|
3134 |
+
$date["second"] = $temp_date[7];
|
3135 |
+
$date["month"] = array_search( $temp_date[3], $define_month );
|
3136 |
+
$date["day"] = $temp_date[2];
|
3137 |
+
$date["year"] = $temp_date[4];
|
3138 |
+
|
3139 |
+
} elseif( preg_match( "/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), ([0-3][0-9])-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-([0-9]{2}) ([0-2][0-9]):([0-5][0-9]):([0-5][0-9]) GMT$/", $string_date, $temp_date ) ) {
|
3140 |
+
$date["hour"] = $temp_date[5];
|
3141 |
+
$date["minute"] = $temp_date[6];
|
3142 |
+
$date["second"] = $temp_date[7];
|
3143 |
+
$date["month"] = array_search( $temp_date[3], $define_month );
|
3144 |
+
$date["day"] = $temp_date[2];
|
3145 |
+
$date["year"] = ($temp_date[4] > 70 ? 1900 : 2000) + $temp_date[4];
|
3146 |
+
|
3147 |
+
} elseif( preg_match( "/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ([0-3 ][0-9]) ([0-2][0-9]):([0-5][0-9]):([0-5][0-9]) ([0-9]{4})$/", $string_date, $temp_date ) ) {
|
3148 |
+
$date["hour"] = $temp_date[4];
|
3149 |
+
$date["minute"] = $temp_date[5];
|
3150 |
+
$date["second"] = $temp_date[6];
|
3151 |
+
$date["month"] = array_search( $temp_date[2], $define_month );
|
3152 |
+
$date["day"] = str_replace( " ", 0, $temp_date[3] );
|
3153 |
+
$date["year"] = $temp_date[7];
|
3154 |
+
|
3155 |
+
} else {
|
3156 |
+
return FALSE;
|
3157 |
+
}
|
3158 |
+
|
3159 |
+
$date["timestamp"] = gmmktime( $date["hour"], $date["minute"], $date["second"], $date["month"], $date["day"], $date["year"] );
|
3160 |
+
|
3161 |
+
return $date;
|
3162 |
+
}
|
3163 |
}
|
3164 |
|
3165 |
//**************************************************************************************
|
3168 |
global $head_cleaner;
|
3169 |
|
3170 |
$head_cleaner = new HeadCleaner();
|
|
|
|
|
|
|
|
|
|
|
3171 |
?>
|
languages/head-cleaner-ja.mo
CHANGED
Binary file
|
languages/head-cleaner-ja.po
CHANGED
@@ -2,8 +2,8 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Head Cleaner\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2011-
|
6 |
-
"PO-Revision-Date: 2011-
|
7 |
"Last-Translator: wokamoto <wokamoto1973@gmail.com>\n"
|
8 |
"Language-Team: JAPANESE <http://wppluginsj.sourceforge.jp/>\n"
|
9 |
"MIME-Version: 1.0\n"
|
@@ -20,170 +20,178 @@ msgstr ""
|
|
20 |
msgid "Cleaning tags from your WordPress header and footer."
|
21 |
msgstr "WordPress サイトの <head> の中身と、フッタ領域を整形しなおします。"
|
22 |
|
23 |
-
#: ../head-cleaner.php:
|
24 |
msgid "Head Cleaner"
|
25 |
msgstr "Head Cleaner"
|
26 |
|
27 |
-
#: ../head-cleaner.php:
|
28 |
#: ../includes/common-controller.php:187
|
29 |
msgid "Settings"
|
30 |
msgstr "設定"
|
31 |
|
32 |
-
#: ../head-cleaner.php:
|
33 |
-
#: ../head-cleaner.php:
|
34 |
-
#: ../head-cleaner.php:
|
35 |
msgid "Done!"
|
36 |
msgstr "完了!"
|
37 |
|
38 |
-
#: ../head-cleaner.php:
|
39 |
msgid "Head Cleaner Options"
|
40 |
msgstr "Head Cleaner 設定"
|
41 |
|
42 |
-
#: ../head-cleaner.php:
|
43 |
msgid "CSS and JavaScript are cached on the server."
|
44 |
msgstr "CSS と JavaScript を、サーバ上にキャッシュする"
|
45 |
|
46 |
-
#: ../head-cleaner.php:
|
47 |
msgid "CSS and JS are dynamically generated."
|
48 |
msgstr "CSS, JS を動的生成する。"
|
49 |
|
50 |
-
#: ../head-cleaner.php:
|
51 |
msgid "Default media attribute applied to CSS."
|
52 |
msgstr "CSS に適用するデフォルト media 属性"
|
53 |
|
54 |
-
#: ../head-cleaner.php:
|
55 |
msgid "Two or more CSS is combined."
|
56 |
msgstr "複数の CSS を結合する"
|
57 |
|
58 |
-
#: ../head-cleaner.php:
|
59 |
msgid "CSS is optimized."
|
60 |
msgstr "CSS を最適化する"
|
61 |
|
62 |
-
#: ../head-cleaner.php:
|
63 |
msgid "URLs of images in CSS will be converted into the data scheme URIs."
|
64 |
msgstr "CSS に含まれる画像の URL を、データスキーマ URI に変換する"
|
65 |
|
66 |
-
#: ../head-cleaner.php:
|
67 |
msgid "Two or more JavaScript is combined."
|
68 |
msgstr "複数の JavaScript を結合する"
|
69 |
|
70 |
-
#: ../head-cleaner.php:
|
71 |
msgid "JavaScript is minified."
|
72 |
msgstr "JavaScript を小さくする"
|
73 |
|
74 |
-
#: ../head-cleaner.php:
|
75 |
msgid "Bottom JavaScript is combined, too."
|
76 |
msgstr "フッタ領域の JavaScript も対象にする"
|
77 |
|
78 |
-
#: ../head-cleaner.php:
|
79 |
msgid "Put JavaScripts at the Bottom."
|
80 |
msgstr "<head> 内の JavaScript を、フッタ領域に移動"
|
81 |
|
82 |
-
#: ../head-cleaner.php:
|
83 |
msgid "Use Google Ajax Libraries."
|
84 |
msgstr "Google Ajax Libraries を利用する"
|
85 |
|
86 |
-
#: ../head-cleaner.php:
|
87 |
msgid "Add XML Declaration."
|
88 |
msgstr "XML宣言を付与"
|
89 |
|
90 |
-
#: ../head-cleaner.php:
|
91 |
msgid "Add canonical tag."
|
92 |
msgstr "メタタグ "canonical" を追加"
|
93 |
|
94 |
-
#: ../head-cleaner.php:
|
95 |
msgid "Add OGP(Open Graph Protocol) tags."
|
96 |
msgstr "OGP(Open Graph Protocol) 対応のメタタグを追加"
|
97 |
|
98 |
-
#: ../head-cleaner.php:
|
|
|
|
|
|
|
|
|
99 |
msgid "Remove generator tag."
|
100 |
msgstr "メタタグ "generator" を削除"
|
101 |
|
102 |
-
#: ../head-cleaner.php:
|
103 |
msgid "Remove RSD link tag."
|
104 |
msgstr "リンクタグ "RSD" を削除"
|
105 |
|
106 |
-
#: ../head-cleaner.php:
|
107 |
msgid "Remove wlwmanifest link tag."
|
108 |
msgstr "リンクタグ "wlwmanifest" を削除."
|
109 |
|
110 |
-
#: ../head-cleaner.php:
|
111 |
msgid "Remove IE Conditional Tag."
|
112 |
msgstr "IEコンディショナルタグを削除"
|
113 |
|
114 |
-
#: ../head-cleaner.php:
|
|
|
|
|
|
|
|
|
115 |
msgid "Debug mode"
|
116 |
msgstr "デバッグモード"
|
117 |
|
118 |
-
#: ../head-cleaner.php:
|
119 |
msgid "Active Filters"
|
120 |
msgstr "有効なフィルタ"
|
121 |
|
122 |
-
#: ../head-cleaner.php:
|
123 |
-
#: ../head-cleaner.php:
|
124 |
msgid "Don't process!"
|
125 |
msgstr "対象外"
|
126 |
|
127 |
-
#: ../head-cleaner.php:
|
128 |
-
#: ../head-cleaner.php:
|
129 |
-
#: ../head-cleaner.php:
|
130 |
msgid "Remove"
|
131 |
msgstr "削除"
|
132 |
|
133 |
-
#: ../head-cleaner.php:
|
134 |
msgid "Head filters"
|
135 |
msgstr "<head> 内の有効なフィルタ"
|
136 |
|
137 |
-
#: ../head-cleaner.php:
|
138 |
-
#: ../head-cleaner.php:
|
139 |
msgid "Priority"
|
140 |
msgstr "フィルタの優先順位"
|
141 |
|
142 |
-
#: ../head-cleaner.php:
|
143 |
msgid "Bottom filters"
|
144 |
msgstr "フッタ領域の有効なフィルタ"
|
145 |
|
146 |
-
#: ../head-cleaner.php:
|
147 |
msgid "Active JavaScripts"
|
148 |
msgstr "<head> 部で有効な JavaScript"
|
149 |
|
150 |
-
#: ../head-cleaner.php:
|
151 |
msgid "Move to footer"
|
152 |
msgstr "フッタに移動"
|
153 |
|
154 |
-
#: ../head-cleaner.php:
|
155 |
msgid "JavaScripts"
|
156 |
msgstr "JavaScript"
|
157 |
|
158 |
-
#: ../head-cleaner.php:
|
159 |
msgid "Update Options"
|
160 |
msgstr "更新"
|
161 |
|
162 |
-
#: ../head-cleaner.php:
|
163 |
msgid "Remove all cache files"
|
164 |
msgstr "キャッシュファイル削除"
|
165 |
|
166 |
-
#: ../head-cleaner.php:
|
167 |
msgid "All cache files are removed."
|
168 |
msgstr "キャッシュフォルダ内のファイルをすべて削除する。"
|
169 |
|
170 |
-
#: ../head-cleaner.php:
|
171 |
msgid "Remove All Cache Files"
|
172 |
msgstr "削除"
|
173 |
|
174 |
-
#: ../head-cleaner.php:
|
175 |
msgid "Uninstall"
|
176 |
msgstr "アンインストール"
|
177 |
|
178 |
-
#: ../head-cleaner.php:
|
179 |
msgid "All the settings of "Head Cleaner" are deleted."
|
180 |
msgstr ""Head Cleaner" の設定をすべて消去する。"
|
181 |
|
182 |
-
#: ../head-cleaner.php:
|
183 |
msgid "Delete Options"
|
184 |
msgstr "削除"
|
185 |
|
186 |
-
#: ../head-cleaner.php:
|
187 |
msgid "There is no excerpt because this is a protected post."
|
188 |
msgstr "この投稿は保護されているので抜粋文はありません。"
|
189 |
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Head Cleaner\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2011-04-11 16:15+0900\n"
|
6 |
+
"PO-Revision-Date: 2011-04-11 16:19+0900\n"
|
7 |
"Last-Translator: wokamoto <wokamoto1973@gmail.com>\n"
|
8 |
"Language-Team: JAPANESE <http://wppluginsj.sourceforge.jp/>\n"
|
9 |
"MIME-Version: 1.0\n"
|
20 |
msgid "Cleaning tags from your WordPress header and footer."
|
21 |
msgstr "WordPress サイトの <head> の中身と、フッタ領域を整形しなおします。"
|
22 |
|
23 |
+
#: ../head-cleaner.php:2028
|
24 |
msgid "Head Cleaner"
|
25 |
msgstr "Head Cleaner"
|
26 |
|
27 |
+
#: ../head-cleaner.php:2039
|
28 |
#: ../includes/common-controller.php:187
|
29 |
msgid "Settings"
|
30 |
msgstr "設定"
|
31 |
|
32 |
+
#: ../head-cleaner.php:2096
|
33 |
+
#: ../head-cleaner.php:2104
|
34 |
+
#: ../head-cleaner.php:2112
|
35 |
msgid "Done!"
|
36 |
msgstr "完了!"
|
37 |
|
38 |
+
#: ../head-cleaner.php:2124
|
39 |
msgid "Head Cleaner Options"
|
40 |
msgstr "Head Cleaner 設定"
|
41 |
|
42 |
+
#: ../head-cleaner.php:2133
|
43 |
msgid "CSS and JavaScript are cached on the server."
|
44 |
msgstr "CSS と JavaScript を、サーバ上にキャッシュする"
|
45 |
|
46 |
+
#: ../head-cleaner.php:2137
|
47 |
msgid "CSS and JS are dynamically generated."
|
48 |
msgstr "CSS, JS を動的生成する。"
|
49 |
|
50 |
+
#: ../head-cleaner.php:2140
|
51 |
msgid "Default media attribute applied to CSS."
|
52 |
msgstr "CSS に適用するデフォルト media 属性"
|
53 |
|
54 |
+
#: ../head-cleaner.php:2148
|
55 |
msgid "Two or more CSS is combined."
|
56 |
msgstr "複数の CSS を結合する"
|
57 |
|
58 |
+
#: ../head-cleaner.php:2152
|
59 |
msgid "CSS is optimized."
|
60 |
msgstr "CSS を最適化する"
|
61 |
|
62 |
+
#: ../head-cleaner.php:2156
|
63 |
msgid "URLs of images in CSS will be converted into the data scheme URIs."
|
64 |
msgstr "CSS に含まれる画像の URL を、データスキーマ URI に変換する"
|
65 |
|
66 |
+
#: ../head-cleaner.php:2163
|
67 |
msgid "Two or more JavaScript is combined."
|
68 |
msgstr "複数の JavaScript を結合する"
|
69 |
|
70 |
+
#: ../head-cleaner.php:2167
|
71 |
msgid "JavaScript is minified."
|
72 |
msgstr "JavaScript を小さくする"
|
73 |
|
74 |
+
#: ../head-cleaner.php:2171
|
75 |
msgid "Bottom JavaScript is combined, too."
|
76 |
msgstr "フッタ領域の JavaScript も対象にする"
|
77 |
|
78 |
+
#: ../head-cleaner.php:2178
|
79 |
msgid "Put JavaScripts at the Bottom."
|
80 |
msgstr "<head> 内の JavaScript を、フッタ領域に移動"
|
81 |
|
82 |
+
#: ../head-cleaner.php:2182
|
83 |
msgid "Use Google Ajax Libraries."
|
84 |
msgstr "Google Ajax Libraries を利用する"
|
85 |
|
86 |
+
#: ../head-cleaner.php:2191
|
87 |
msgid "Add XML Declaration."
|
88 |
msgstr "XML宣言を付与"
|
89 |
|
90 |
+
#: ../head-cleaner.php:2195
|
91 |
msgid "Add canonical tag."
|
92 |
msgstr "メタタグ "canonical" を追加"
|
93 |
|
94 |
+
#: ../head-cleaner.php:2199
|
95 |
msgid "Add OGP(Open Graph Protocol) tags."
|
96 |
msgstr "OGP(Open Graph Protocol) 対応のメタタグを追加"
|
97 |
|
98 |
+
#: ../head-cleaner.php:2206
|
99 |
+
msgid "Add Last modified."
|
100 |
+
msgstr "メタタグ "Last Modified" を追加"
|
101 |
+
|
102 |
+
#: ../head-cleaner.php:2217
|
103 |
msgid "Remove generator tag."
|
104 |
msgstr "メタタグ "generator" を削除"
|
105 |
|
106 |
+
#: ../head-cleaner.php:2221
|
107 |
msgid "Remove RSD link tag."
|
108 |
msgstr "リンクタグ "RSD" を削除"
|
109 |
|
110 |
+
#: ../head-cleaner.php:2225
|
111 |
msgid "Remove wlwmanifest link tag."
|
112 |
msgstr "リンクタグ "wlwmanifest" を削除."
|
113 |
|
114 |
+
#: ../head-cleaner.php:2232
|
115 |
msgid "Remove IE Conditional Tag."
|
116 |
msgstr "IEコンディショナルタグを削除"
|
117 |
|
118 |
+
#: ../head-cleaner.php:2245
|
119 |
+
msgid "Enabling \"<strong>paranoia mode</strong>\". Cut waste from the HTML and tries to minimize it."
|
120 |
+
msgstr ""パラノイアモード" を有効にする。HTMLソースから無駄を省き、できるだけサイズを小さくしようとします。"
|
121 |
+
|
122 |
+
#: ../head-cleaner.php:2249
|
123 |
msgid "Debug mode"
|
124 |
msgstr "デバッグモード"
|
125 |
|
126 |
+
#: ../head-cleaner.php:2257
|
127 |
msgid "Active Filters"
|
128 |
msgstr "有効なフィルタ"
|
129 |
|
130 |
+
#: ../head-cleaner.php:2260
|
131 |
+
#: ../head-cleaner.php:2298
|
132 |
msgid "Don't process!"
|
133 |
msgstr "対象外"
|
134 |
|
135 |
+
#: ../head-cleaner.php:2261
|
136 |
+
#: ../head-cleaner.php:2299
|
137 |
+
#: ../head-cleaner.php:2342
|
138 |
msgid "Remove"
|
139 |
msgstr "削除"
|
140 |
|
141 |
+
#: ../head-cleaner.php:2262
|
142 |
msgid "Head filters"
|
143 |
msgstr "<head> 内の有効なフィルタ"
|
144 |
|
145 |
+
#: ../head-cleaner.php:2264
|
146 |
+
#: ../head-cleaner.php:2302
|
147 |
msgid "Priority"
|
148 |
msgstr "フィルタの優先順位"
|
149 |
|
150 |
+
#: ../head-cleaner.php:2300
|
151 |
msgid "Bottom filters"
|
152 |
msgstr "フッタ領域の有効なフィルタ"
|
153 |
|
154 |
+
#: ../head-cleaner.php:2338
|
155 |
msgid "Active JavaScripts"
|
156 |
msgstr "<head> 部で有効な JavaScript"
|
157 |
|
158 |
+
#: ../head-cleaner.php:2341
|
159 |
msgid "Move to footer"
|
160 |
msgstr "フッタに移動"
|
161 |
|
162 |
+
#: ../head-cleaner.php:2343
|
163 |
msgid "JavaScripts"
|
164 |
msgstr "JavaScript"
|
165 |
|
166 |
+
#: ../head-cleaner.php:2357
|
167 |
msgid "Update Options"
|
168 |
msgstr "更新"
|
169 |
|
170 |
+
#: ../head-cleaner.php:2363
|
171 |
msgid "Remove all cache files"
|
172 |
msgstr "キャッシュファイル削除"
|
173 |
|
174 |
+
#: ../head-cleaner.php:2367
|
175 |
msgid "All cache files are removed."
|
176 |
msgstr "キャッシュフォルダ内のファイルをすべて削除する。"
|
177 |
|
178 |
+
#: ../head-cleaner.php:2368
|
179 |
msgid "Remove All Cache Files"
|
180 |
msgstr "削除"
|
181 |
|
182 |
+
#: ../head-cleaner.php:2373
|
183 |
msgid "Uninstall"
|
184 |
msgstr "アンインストール"
|
185 |
|
186 |
+
#: ../head-cleaner.php:2377
|
187 |
msgid "All the settings of "Head Cleaner" are deleted."
|
188 |
msgstr ""Head Cleaner" の設定をすべて消去する。"
|
189 |
|
190 |
+
#: ../head-cleaner.php:2378
|
191 |
msgid "Delete Options"
|
192 |
msgstr "削除"
|
193 |
|
194 |
+
#: ../head-cleaner.php:2860
|
195 |
msgid "There is no excerpt because this is a protected post."
|
196 |
msgstr "この投稿は保護されているので抜粋文はありません。"
|
197 |
|
languages/head-cleaner.pot
CHANGED
@@ -2,7 +2,7 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Head Cleaner\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2011-
|
6 |
"PO-Revision-Date: \n"
|
7 |
"Last-Translator: \n"
|
8 |
"Language-Team: \n"
|
@@ -14,170 +14,178 @@ msgstr ""
|
|
14 |
msgid "Cleaning tags from your WordPress header and footer."
|
15 |
msgstr ""
|
16 |
|
17 |
-
#: ../head-cleaner.php:
|
18 |
msgid "Head Cleaner"
|
19 |
msgstr ""
|
20 |
|
21 |
-
#: ../head-cleaner.php:
|
22 |
#: ../includes/common-controller.php:187
|
23 |
msgid "Settings"
|
24 |
msgstr ""
|
25 |
|
26 |
-
#: ../head-cleaner.php:
|
27 |
-
#: ../head-cleaner.php:
|
28 |
-
#: ../head-cleaner.php:
|
29 |
msgid "Done!"
|
30 |
msgstr ""
|
31 |
|
32 |
-
#: ../head-cleaner.php:
|
33 |
msgid "Head Cleaner Options"
|
34 |
msgstr ""
|
35 |
|
36 |
-
#: ../head-cleaner.php:
|
37 |
msgid "CSS and JavaScript are cached on the server."
|
38 |
msgstr ""
|
39 |
|
40 |
-
#: ../head-cleaner.php:
|
41 |
msgid "CSS and JS are dynamically generated."
|
42 |
msgstr ""
|
43 |
|
44 |
-
#: ../head-cleaner.php:
|
45 |
msgid "Default media attribute applied to CSS."
|
46 |
msgstr ""
|
47 |
|
48 |
-
#: ../head-cleaner.php:
|
49 |
msgid "Two or more CSS is combined."
|
50 |
msgstr ""
|
51 |
|
52 |
-
#: ../head-cleaner.php:
|
53 |
msgid "CSS is optimized."
|
54 |
msgstr ""
|
55 |
|
56 |
-
#: ../head-cleaner.php:
|
57 |
msgid "URLs of images in CSS will be converted into the data scheme URIs."
|
58 |
msgstr ""
|
59 |
|
60 |
-
#: ../head-cleaner.php:
|
61 |
msgid "Two or more JavaScript is combined."
|
62 |
msgstr ""
|
63 |
|
64 |
-
#: ../head-cleaner.php:
|
65 |
msgid "JavaScript is minified."
|
66 |
msgstr ""
|
67 |
|
68 |
-
#: ../head-cleaner.php:
|
69 |
msgid "Bottom JavaScript is combined, too."
|
70 |
msgstr ""
|
71 |
|
72 |
-
#: ../head-cleaner.php:
|
73 |
msgid "Put JavaScripts at the Bottom."
|
74 |
msgstr ""
|
75 |
|
76 |
-
#: ../head-cleaner.php:
|
77 |
msgid "Use Google Ajax Libraries."
|
78 |
msgstr ""
|
79 |
|
80 |
-
#: ../head-cleaner.php:
|
81 |
msgid "Add XML Declaration."
|
82 |
msgstr ""
|
83 |
|
84 |
-
#: ../head-cleaner.php:
|
85 |
msgid "Add canonical tag."
|
86 |
msgstr ""
|
87 |
|
88 |
-
#: ../head-cleaner.php:
|
89 |
msgid "Add OGP(Open Graph Protocol) tags."
|
90 |
msgstr ""
|
91 |
|
92 |
-
#: ../head-cleaner.php:
|
|
|
|
|
|
|
|
|
93 |
msgid "Remove generator tag."
|
94 |
msgstr ""
|
95 |
|
96 |
-
#: ../head-cleaner.php:
|
97 |
msgid "Remove RSD link tag."
|
98 |
msgstr ""
|
99 |
|
100 |
-
#: ../head-cleaner.php:
|
101 |
msgid "Remove wlwmanifest link tag."
|
102 |
msgstr ""
|
103 |
|
104 |
-
#: ../head-cleaner.php:
|
105 |
msgid "Remove IE Conditional Tag."
|
106 |
msgstr ""
|
107 |
|
108 |
-
#: ../head-cleaner.php:
|
|
|
|
|
|
|
|
|
109 |
msgid "Debug mode"
|
110 |
msgstr ""
|
111 |
|
112 |
-
#: ../head-cleaner.php:
|
113 |
msgid "Active Filters"
|
114 |
msgstr ""
|
115 |
|
116 |
-
#: ../head-cleaner.php:
|
117 |
-
#: ../head-cleaner.php:
|
118 |
msgid "Don't process!"
|
119 |
msgstr ""
|
120 |
|
121 |
-
#: ../head-cleaner.php:
|
122 |
-
#: ../head-cleaner.php:
|
123 |
-
#: ../head-cleaner.php:
|
124 |
msgid "Remove"
|
125 |
msgstr ""
|
126 |
|
127 |
-
#: ../head-cleaner.php:
|
128 |
msgid "Head filters"
|
129 |
msgstr ""
|
130 |
|
131 |
-
#: ../head-cleaner.php:
|
132 |
-
#: ../head-cleaner.php:
|
133 |
msgid "Priority"
|
134 |
msgstr ""
|
135 |
|
136 |
-
#: ../head-cleaner.php:
|
137 |
msgid "Bottom filters"
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: ../head-cleaner.php:
|
141 |
msgid "Active JavaScripts"
|
142 |
msgstr ""
|
143 |
|
144 |
-
#: ../head-cleaner.php:
|
145 |
msgid "Move to footer"
|
146 |
msgstr ""
|
147 |
|
148 |
-
#: ../head-cleaner.php:
|
149 |
msgid "JavaScripts"
|
150 |
msgstr ""
|
151 |
|
152 |
-
#: ../head-cleaner.php:
|
153 |
msgid "Update Options"
|
154 |
msgstr ""
|
155 |
|
156 |
-
#: ../head-cleaner.php:
|
157 |
msgid "Remove all cache files"
|
158 |
msgstr ""
|
159 |
|
160 |
-
#: ../head-cleaner.php:
|
161 |
msgid "All cache files are removed."
|
162 |
msgstr ""
|
163 |
|
164 |
-
#: ../head-cleaner.php:
|
165 |
msgid "Remove All Cache Files"
|
166 |
msgstr ""
|
167 |
|
168 |
-
#: ../head-cleaner.php:
|
169 |
msgid "Uninstall"
|
170 |
msgstr ""
|
171 |
|
172 |
-
#: ../head-cleaner.php:
|
173 |
msgid "All the settings of "Head Cleaner" are deleted."
|
174 |
msgstr ""
|
175 |
|
176 |
-
#: ../head-cleaner.php:
|
177 |
msgid "Delete Options"
|
178 |
msgstr ""
|
179 |
|
180 |
-
#: ../head-cleaner.php:
|
181 |
msgid "There is no excerpt because this is a protected post."
|
182 |
msgstr ""
|
183 |
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Head Cleaner\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2011-04-11 16:15+0900\n"
|
6 |
"PO-Revision-Date: \n"
|
7 |
"Last-Translator: \n"
|
8 |
"Language-Team: \n"
|
14 |
msgid "Cleaning tags from your WordPress header and footer."
|
15 |
msgstr ""
|
16 |
|
17 |
+
#: ../head-cleaner.php:2028
|
18 |
msgid "Head Cleaner"
|
19 |
msgstr ""
|
20 |
|
21 |
+
#: ../head-cleaner.php:2039
|
22 |
#: ../includes/common-controller.php:187
|
23 |
msgid "Settings"
|
24 |
msgstr ""
|
25 |
|
26 |
+
#: ../head-cleaner.php:2096
|
27 |
+
#: ../head-cleaner.php:2104
|
28 |
+
#: ../head-cleaner.php:2112
|
29 |
msgid "Done!"
|
30 |
msgstr ""
|
31 |
|
32 |
+
#: ../head-cleaner.php:2124
|
33 |
msgid "Head Cleaner Options"
|
34 |
msgstr ""
|
35 |
|
36 |
+
#: ../head-cleaner.php:2133
|
37 |
msgid "CSS and JavaScript are cached on the server."
|
38 |
msgstr ""
|
39 |
|
40 |
+
#: ../head-cleaner.php:2137
|
41 |
msgid "CSS and JS are dynamically generated."
|
42 |
msgstr ""
|
43 |
|
44 |
+
#: ../head-cleaner.php:2140
|
45 |
msgid "Default media attribute applied to CSS."
|
46 |
msgstr ""
|
47 |
|
48 |
+
#: ../head-cleaner.php:2148
|
49 |
msgid "Two or more CSS is combined."
|
50 |
msgstr ""
|
51 |
|
52 |
+
#: ../head-cleaner.php:2152
|
53 |
msgid "CSS is optimized."
|
54 |
msgstr ""
|
55 |
|
56 |
+
#: ../head-cleaner.php:2156
|
57 |
msgid "URLs of images in CSS will be converted into the data scheme URIs."
|
58 |
msgstr ""
|
59 |
|
60 |
+
#: ../head-cleaner.php:2163
|
61 |
msgid "Two or more JavaScript is combined."
|
62 |
msgstr ""
|
63 |
|
64 |
+
#: ../head-cleaner.php:2167
|
65 |
msgid "JavaScript is minified."
|
66 |
msgstr ""
|
67 |
|
68 |
+
#: ../head-cleaner.php:2171
|
69 |
msgid "Bottom JavaScript is combined, too."
|
70 |
msgstr ""
|
71 |
|
72 |
+
#: ../head-cleaner.php:2178
|
73 |
msgid "Put JavaScripts at the Bottom."
|
74 |
msgstr ""
|
75 |
|
76 |
+
#: ../head-cleaner.php:2182
|
77 |
msgid "Use Google Ajax Libraries."
|
78 |
msgstr ""
|
79 |
|
80 |
+
#: ../head-cleaner.php:2191
|
81 |
msgid "Add XML Declaration."
|
82 |
msgstr ""
|
83 |
|
84 |
+
#: ../head-cleaner.php:2195
|
85 |
msgid "Add canonical tag."
|
86 |
msgstr ""
|
87 |
|
88 |
+
#: ../head-cleaner.php:2199
|
89 |
msgid "Add OGP(Open Graph Protocol) tags."
|
90 |
msgstr ""
|
91 |
|
92 |
+
#: ../head-cleaner.php:2206
|
93 |
+
msgid "Add Last modified."
|
94 |
+
msgstr ""
|
95 |
+
|
96 |
+
#: ../head-cleaner.php:2217
|
97 |
msgid "Remove generator tag."
|
98 |
msgstr ""
|
99 |
|
100 |
+
#: ../head-cleaner.php:2221
|
101 |
msgid "Remove RSD link tag."
|
102 |
msgstr ""
|
103 |
|
104 |
+
#: ../head-cleaner.php:2225
|
105 |
msgid "Remove wlwmanifest link tag."
|
106 |
msgstr ""
|
107 |
|
108 |
+
#: ../head-cleaner.php:2232
|
109 |
msgid "Remove IE Conditional Tag."
|
110 |
msgstr ""
|
111 |
|
112 |
+
#: ../head-cleaner.php:2245
|
113 |
+
msgid "Enabling \"<strong>paranoia mode</strong>\". Cut waste from the HTML and tries to minimize it."
|
114 |
+
msgstr ""
|
115 |
+
|
116 |
+
#: ../head-cleaner.php:2249
|
117 |
msgid "Debug mode"
|
118 |
msgstr ""
|
119 |
|
120 |
+
#: ../head-cleaner.php:2257
|
121 |
msgid "Active Filters"
|
122 |
msgstr ""
|
123 |
|
124 |
+
#: ../head-cleaner.php:2260
|
125 |
+
#: ../head-cleaner.php:2298
|
126 |
msgid "Don't process!"
|
127 |
msgstr ""
|
128 |
|
129 |
+
#: ../head-cleaner.php:2261
|
130 |
+
#: ../head-cleaner.php:2299
|
131 |
+
#: ../head-cleaner.php:2342
|
132 |
msgid "Remove"
|
133 |
msgstr ""
|
134 |
|
135 |
+
#: ../head-cleaner.php:2262
|
136 |
msgid "Head filters"
|
137 |
msgstr ""
|
138 |
|
139 |
+
#: ../head-cleaner.php:2264
|
140 |
+
#: ../head-cleaner.php:2302
|
141 |
msgid "Priority"
|
142 |
msgstr ""
|
143 |
|
144 |
+
#: ../head-cleaner.php:2300
|
145 |
msgid "Bottom filters"
|
146 |
msgstr ""
|
147 |
|
148 |
+
#: ../head-cleaner.php:2338
|
149 |
msgid "Active JavaScripts"
|
150 |
msgstr ""
|
151 |
|
152 |
+
#: ../head-cleaner.php:2341
|
153 |
msgid "Move to footer"
|
154 |
msgstr ""
|
155 |
|
156 |
+
#: ../head-cleaner.php:2343
|
157 |
msgid "JavaScripts"
|
158 |
msgstr ""
|
159 |
|
160 |
+
#: ../head-cleaner.php:2357
|
161 |
msgid "Update Options"
|
162 |
msgstr ""
|
163 |
|
164 |
+
#: ../head-cleaner.php:2363
|
165 |
msgid "Remove all cache files"
|
166 |
msgstr ""
|
167 |
|
168 |
+
#: ../head-cleaner.php:2367
|
169 |
msgid "All cache files are removed."
|
170 |
msgstr ""
|
171 |
|
172 |
+
#: ../head-cleaner.php:2368
|
173 |
msgid "Remove All Cache Files"
|
174 |
msgstr ""
|
175 |
|
176 |
+
#: ../head-cleaner.php:2373
|
177 |
msgid "Uninstall"
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: ../head-cleaner.php:2377
|
181 |
msgid "All the settings of "Head Cleaner" are deleted."
|
182 |
msgstr ""
|
183 |
|
184 |
+
#: ../head-cleaner.php:2378
|
185 |
msgid "Delete Options"
|
186 |
msgstr ""
|
187 |
|
188 |
+
#: ../head-cleaner.php:2860
|
189 |
msgid "There is no excerpt because this is a protected post."
|
190 |
msgstr ""
|
191 |
|
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, facebook, OGP
|
5 |
Requires at least: 2.5
|
6 |
Tested up to: 3.1
|
7 |
-
Stable tag: 1.4.
|
8 |
|
9 |
Cleaning tags from your WordPress header and footer.
|
10 |
|
@@ -91,6 +91,10 @@ Head Cleaner Ver.1.1.5 includes 'php_browscap.ini' .
|
|
91 |
|
92 |
== Changelog ==
|
93 |
|
|
|
|
|
|
|
|
|
94 |
**1.4.1.3 - March 8, 2011**
|
95 |
Minor bug fixes. thx [HaRD](http://www.karuta.org/wp/ HaRD) !
|
96 |
|
4 |
Tags: head, header, footer, javascript, css, optimization, minified, performance, facebook, OGP
|
5 |
Requires at least: 2.5
|
6 |
Tested up to: 3.1
|
7 |
+
Stable tag: 1.4.2
|
8 |
|
9 |
Cleaning tags from your WordPress header and footer.
|
10 |
|
91 |
|
92 |
== Changelog ==
|
93 |
|
94 |
+
**1.4.2 - April 20, 2011**
|
95 |
+
Add an item to the Options page set.
|
96 |
+
(Added the option to "Add Last-Modified tag" and "Paranoia mode")
|
97 |
+
|
98 |
**1.4.1.3 - March 8, 2011**
|
99 |
Minor bug fixes. thx [HaRD](http://www.karuta.org/wp/ HaRD) !
|
100 |
|
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.1
|
7 |
-
Stable tag: 1.4.
|
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.1
|
7 |
+
Stable tag: 1.4.2
|
8 |
|
9 |
Head と footer をお掃除します。
|
10 |
|