Head Cleaner - Version 1.4.2.7

Version Description

Download this release

Release Info

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

Code changes from version 1.4.2.6 to 1.4.2.7

head-cleaner.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Head Cleaner
4
- Version: 1.4.2.6
5
  Plugin URI: http://wppluginsj.sourceforge.jp/head-cleaner/
6
  Description: Cleaning tags from your WordPress header and footer.
7
  Author: wokamoto
@@ -12,7 +12,7 @@ Domain Path: /languages/
12
  License:
13
  Released under the GPL license
14
  http://www.gnu.org/copyleft/gpl.html
15
- Copyright 2009 - 2011 wokamoto (email : wokamoto1973@gmail.com)
16
 
17
  This program is free software; you can redistribute it and/or modify
18
  it under the terms of the GNU General Public License as published by
@@ -60,13 +60,15 @@ if (!defined('ABSPATH') && strstr($_SERVER['PHP_SELF'], '/head-cleaner.php')) {
60
  //**************************************************************************************
61
  if (!class_exists('wokController') || !class_exists('wokScriptManager'))
62
  require(dirname(__FILE__).'/includes/common-controller.php');
 
 
63
 
64
  //**************************************************************************************
65
  // Head Cleaner
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.]
@@ -74,7 +76,7 @@ class HeadCleaner extends wokController {
74
  const XMLNS_OG = 'http://ogp.me/ns#';
75
  const XMLNS_FB = 'http://www.facebook.com/2008/fbml';
76
  const IMG_BASE64_MAX_SIZE = 4096;
77
- const OPTION_SAVE_FILE = FALSE;
78
 
79
  // Deafault Options
80
  private $options_default = array(
@@ -100,6 +102,9 @@ class HeadCleaner extends wokController {
100
  'use_ajax_libs' => false ,
101
  'img_base64' => false ,
102
  'add_ogp_tag' => false ,
 
 
 
103
  'add_last_modified' => false ,
104
  'paranoia_mode' => false ,
105
  );
@@ -168,7 +173,7 @@ class HeadCleaner extends wokController {
168
  // Create Directory for Cache
169
  if ( $this->options['cache_enabled'] ) {
170
  $this->cache_path = $this->_create_cache_dir();
171
- if ($this->cache_path !== FALSE) {
172
  $this->cache_url = str_replace(ABSPATH, $this->wp_url, $this->cache_path);
173
  } else {
174
  $this->options['cache_enabled'] = false;
@@ -259,7 +264,7 @@ class HeadCleaner extends wokController {
259
 
260
  $head_js = $this->options_default['head_js'];
261
  foreach ((array) $wk_options['head_js'] as $key => $val) {
262
- if ($val === FALSE)
263
  $head_js[$key] = $val;
264
  }
265
 
@@ -305,10 +310,10 @@ class HeadCleaner extends wokController {
305
  //**************************************************************************************
306
  public function activation(){
307
  $cache_dir = $this->_create_cache_dir();
308
- if ( $cache_dir !== FALSE )
309
  $this->_create_htaccess($cache_dir);
310
 
311
- if (self::OPTION_SAVE_FILE !== FALSE) {
312
  $option_file = dirname(__FILE__) . '/' . self::OPTION_SAVE_FILE;
313
  if ( file_exists($option_file) ) {
314
  $wk_options = unserialize(file_get_contents($option_file));
@@ -325,7 +330,7 @@ class HeadCleaner extends wokController {
325
  // plugin deactivation
326
  //**************************************************************************************
327
  public function deactivation(){
328
- if (self::OPTION_SAVE_FILE !== FALSE) {
329
  $wk_options = serialize($this->options);
330
  $option_file = dirname(__FILE__) . '/' . self::OPTION_SAVE_FILE;
331
  if ( file_put_contents( $option_file, $wk_options ) && file_exists($option_file) ) {
@@ -340,7 +345,7 @@ class HeadCleaner extends wokController {
340
  public function uninstall(){
341
  $this->_delete_settings();
342
  $this->_remove_cache_file();
343
- if (self::OPTION_SAVE_FILE !== FALSE) {
344
  $option_file = dirname(__FILE__) . '/' . self::OPTION_SAVE_FILE;
345
  if ( file_exists($option_file) ) {
346
  @unlink($option_file);
@@ -445,6 +450,10 @@ class HeadCleaner extends wokController {
445
  ob_end_flush();
446
  }
447
 
 
 
 
 
448
  //**************************************************************************************
449
  // filters info save
450
  //**************************************************************************************
@@ -795,8 +804,8 @@ class HeadCleaner extends wokController {
795
  // css file
796
  foreach ((array) $elements_linktag as $element) {
797
  $tag = trim($element->outertext);
798
- if (strpos($css_tag, $tag) === FALSE) {
799
- if (strpos($element->href, $this->wp_url) === FALSE) {
800
  $css_tag .= $this->_tag_trim($tag);
801
  } elseif ( isset($element->id) && !empty($element->id) ) {
802
  $css_tag_with_id .= $this->_tag_trim($tag);
@@ -806,7 +815,7 @@ class HeadCleaner extends wokController {
806
  $media = trim( isset($element->media)
807
  ? $element->media
808
  : $this->options['default_media'] );
809
- $media = ( empty($media) || is_null($media) || $media === FALSE
810
  ? $this->options['default_media']
811
  : $media );
812
  $inner_css .= $this->_tag_trim($tag);
@@ -822,7 +831,7 @@ class HeadCleaner extends wokController {
822
  // inline css
823
  foreach ((array) $elements_styletag as $element) {
824
  $media = trim( isset($element->media) ? $element->media : $this->options['default_media'] );
825
- $media = ( empty($media) || is_null($media) || $media === FALSE ? $this->options['default_media'] : $media );
826
  $wk_text = $this->_remove_comment($element->innertext, 'css');
827
  $wk_text = $this->_css_import($wk_text);
828
  if ( !empty($wk_text) ) {
@@ -921,30 +930,30 @@ class HeadCleaner extends wokController {
921
  if (!isset($this->head_js[$src]))
922
  $this->head_js[$src] = true;
923
 
924
- if (array_search( $src, (array) $this->options['remove_js']) === FALSE) {
925
- $find = FALSE;
926
  if (preg_match('/\/((prototype|jquery|mootools)\.js)\?ver=([\.\d]+)[^\?]*$/i', $src, $matches)) {
927
  list($find, $filename, $product, $version) = $matches;
928
  } elseif (preg_match('/\/((prototype|jquery|mootools)[\-\.](min|[\.\d]+)[^\/]*\.js)\?[^\?]*$/i', $src, $matches)) {
929
  list($find, $filename, $product, $version) = $matches;
930
  } elseif (preg_match('/\/scriptaculous\/((builder|controls|dragdrop|effects|wp\-scriptaculous|scriptaculous|slider|sound|unittest)\.js)\?ver\=([\.\d]+)[^\?]*$/i', $src, $matches)) {
931
  list($find, $filename, $product, $version) = $matches;
932
- $product = (strpos($product, 'scriptaculous') === FALSE
933
  ? 'scriptaculous/' . $product
934
  : 'scriptaculous/scriptaculous');
935
  }
936
  unset($matches);
937
 
938
- if ($find !== FALSE) {
939
  $version = trim(substr($version, -1) === '.' ? substr($version, 0, -1) : $version);
940
  if (empty($version))
941
  $version = preg_replace('/^.*\/([\.\d]+)\/.*$/', '$1', $src);
942
  if (!preg_match('/^[\.\d]*\d$/', $version))
943
  $version = '1';
944
  $js_libs[$product][$version] = $src;
945
- } elseif ($this->head_js[$src] === FALSE) {
946
  $foot_js .= $this->_tag_trim($element->outertext);
947
- } elseif (strpos($src, $this->wp_url) === FALSE) {
948
  $script_tag .= $this->_tag_trim($element->outertext);
949
  } else {
950
  $inner_js .= $this->_tag_trim($element->outertext);
@@ -1146,8 +1155,8 @@ class HeadCleaner extends wokController {
1146
  $inline_js .= $this->_remove_comment($element->innertext, 'js');
1147
  } else {
1148
  $src = $element->src;
1149
- if (array_search( $src, (array) $this->options['remove_js']) === FALSE) {
1150
- if (strpos($src, $this->wp_url) === FALSE) {
1151
  $script_tag .= $this->_tag_trim($element->outertext);
1152
  } else {
1153
  $inner_js .= $this->_tag_trim($element->outertext);
@@ -1159,7 +1168,7 @@ class HeadCleaner extends wokController {
1159
  break;
1160
  default:
1161
  $tag = $this->_tag_trim($element->outertext);
1162
- if (strpos($other_tag, $tag) === FALSE && ! preg_match('/^<\!\-+/', $tag))
1163
  $other_tag .= $tag;
1164
  break;
1165
  }
@@ -1306,7 +1315,7 @@ class HeadCleaner extends wokController {
1306
  $tag = trim($element->outertext);
1307
  $type = strtolower($element->tag);
1308
  if (!($exclusion !== '' && preg_match($exclusion, $tag))) {
1309
- if (strpos($html, $tag) === FALSE) {
1310
  switch($type) {
1311
  case 'meta':
1312
  if (isset($element->name)) {
@@ -1321,7 +1330,7 @@ class HeadCleaner extends wokController {
1321
  : array() );
1322
  if ( isset($element->content) ) {
1323
  foreach((array) explode(',', $element->content) as $content ) {
1324
- if (array_search($content, $contents) === FALSE) {
1325
  $contents[] = $content;
1326
  }
1327
  }
@@ -1445,7 +1454,7 @@ class HeadCleaner extends wokController {
1445
  if (preg_match('/^https?:\/\//i', $base_path))
1446
  $base_path = str_replace($this->wp_url, ABSPATH, $base_path);
1447
  $real_path = realpath($base_path . '/' . $path);
1448
- if ( $real_path === FALSE )
1449
  $real_path = $base_path . '/' . $path;
1450
 
1451
  $abs_url = str_replace(ABSPATH, $this->wp_url, $real_path);
@@ -1677,7 +1686,7 @@ class HeadCleaner extends wokController {
1677
  if (version_compare($ver, '1.4.2', '<'))
1678
  $src = $this->plugin_url . 'includes/js/jquery-1.4.2.min.js';
1679
 
1680
- if ($prototype || $mootools || strpos($src, $this->wp_url) === FALSE) {
1681
  $wk_outer_js .= $this->_script_tag($src);
1682
  } else {
1683
  $js_libs_src[] = $src;
@@ -1687,7 +1696,7 @@ class HeadCleaner extends wokController {
1687
  // jQuery noConflict
1688
  if ($prototype || $mootools) {
1689
  $src = $this->plugin_url . 'includes/js/jquery.noconflict.js';
1690
- if (strpos($src, $this->wp_url) === FALSE) {
1691
  $wk_outer_js .= $this->_script_tag($src);
1692
  } else {
1693
  $js_libs_src[] = $src;
@@ -1703,7 +1712,7 @@ class HeadCleaner extends wokController {
1703
  if (!empty($src)) {
1704
  if (version_compare($ver, '1.2.1', '<='))
1705
  $src = $this->plugin_url . 'includes/js/mootools-1.2.1-core-yc.js';
1706
- if ($prototype || $jquery || strpos($src, $this->wp_url) === FALSE) {
1707
  $wk_outer_js .= $this->_script_tag($src);
1708
  } else {
1709
  $js_libs_src[] = $src;
@@ -2074,7 +2083,7 @@ class HeadCleaner extends wokController {
2074
  if( !file_exists($cache_dir.'/js/') )
2075
  @mkdir($cache_dir . '/js/', $mode);
2076
 
2077
- return (file_exists($cache_dir) ? $cache_dir : FALSE);
2078
  }
2079
 
2080
  //**************************************************************************************
@@ -2111,7 +2120,7 @@ class HeadCleaner extends wokController {
2111
  //**************************************************************************************
2112
  private function _create_htaccess($dir) {
2113
  if (!file_exists($dir))
2114
- return FALSE;
2115
 
2116
  $rewrite_base = trailingslashit(str_replace(ABS_PATH, '/', $dir));
2117
 
@@ -2133,33 +2142,33 @@ class HeadCleaner extends wokController {
2133
  return $this->_file_write($filename, $text, false);
2134
  } else {
2135
  list($content, $cache_path) = $this->_file_read($filename);
2136
- if ($content !== FALSE) {
2137
- if (strpos($content, '# BEGIN Head Cleaner') === FALSE && strpos($content, 'RewriteRule .+ %{REQUEST_URI}.gz') === FALSE) {
2138
  $text = $content . "\n" . $text;
2139
  return $this->_file_write($filename, $text, false);
2140
  } else {
2141
- return TRUE;
2142
  }
2143
  } else {
2144
- return FALSE;
2145
  }
2146
  }
2147
  } else {
2148
  if ( file_exists($filename) ) {
2149
  list($content, $cache_path) = $this->_file_read($filename);
2150
- if ($content !== FALSE) {
2151
  $content = trim(preg_replace('/# BEGIN Head Cleaner.*# END Head Cleaner/ism', '', $content));
2152
  if ( $text === $content || $content === '') {
2153
  @unlink($filename);
2154
- return TRUE;
2155
  } else {
2156
  return $this->_file_write($filename, $content . "\n", false);
2157
  }
2158
  } else {
2159
- return FALSE;
2160
  }
2161
  } else {
2162
- return TRUE;
2163
  }
2164
  }
2165
  }
@@ -2230,15 +2239,19 @@ E__O__T;
2230
  $this->options['head_js'] = $this->head_js;
2231
  }
2232
 
2233
- if (isset($_POST['options_update'])) {
 
 
 
 
2234
  if ($this->wp25)
2235
  check_admin_referer("update_options", "_wpnonce_update_options");
2236
 
2237
  // Update options
2238
- $this->_options_update($this->stripArray($_POST));
2239
  $this->note .= "<strong>".__('Done!', $this->textdomain_name)."</strong>";
2240
 
2241
- } elseif(isset($_POST['remove_cache'])) {
2242
  if ($this->wp25)
2243
  check_admin_referer("remove_cache", "_wpnonce_remove_cache");
2244
 
@@ -2246,7 +2259,7 @@ E__O__T;
2246
  $this->_remove_cache_file();
2247
  $this->note .= "<strong>".__('Done!', $this->textdomain_name)."</strong>";
2248
 
2249
- } elseif(isset($_POST['options_delete'])) {
2250
  if ($this->wp25)
2251
  check_admin_referer("delete_options", "_wpnonce_delete_options");
2252
 
@@ -2258,6 +2271,7 @@ E__O__T;
2258
  } else {
2259
  $this->activation();
2260
  }
 
2261
 
2262
  $out = '';
2263
 
@@ -2338,33 +2352,44 @@ E__O__T;
2338
  $out .= __('Add canonical tag.', $this->textdomain_name);
2339
  $out .= '</td>';
2340
  $out .= '<td>';
 
 
 
 
 
2341
  $out .= $this->_checkbox('add_ogp_tag');
2342
  $out .= __('Add OGP(Open Graph Protocol) tags.', $this->textdomain_name);
2343
  $out .= '</td>';
 
 
 
 
2344
  $out .= '</tr>'."\n";
2345
 
2346
- $out .= '<tr>';
2347
  $out .= '<td>';
2348
- $out .= $this->_checkbox('add_last_modified');
2349
- $out .= __('Add Last modified.', $this->textdomain_name);
2350
  $out .= '</td>';
2351
  $out .= '<td>';
 
 
2352
  $out .= '</td>';
2353
  $out .= '<td>';
 
 
2354
  $out .= '</td>';
2355
  $out .= '</tr>'."\n";
2356
-
2357
  $out .= '<tr>';
2358
  $out .= '<td>';
2359
- $out .= $this->_checkbox('rm_generator', isset($this->options['priority']['wp_head']['wp_generator']) && $this->options['priority']['wp_head']['wp_generator'] <= 0);
2360
  $out .= __('Remove generator tag.', $this->textdomain_name);
2361
  $out .= '</td>';
2362
  $out .= '<td>';
2363
- $out .= $this->_checkbox('rm_rsd_link', isset($this->options['priority']['wp_head']['rsd_link']) && $this->options['priority']['wp_head']['rsd_link'] <= 0);
2364
  $out .= __('Remove RSD link tag.', $this->textdomain_name);
2365
  $out .= '</td>';
2366
  $out .= '<td>';
2367
- $out .= $this->_checkbox('rm_manifest', isset($this->options['priority']['wp_head']['wlwmanifest_link']) && $this->options['priority']['wp_head']['wlwmanifest_link'] <= 0);
2368
  $out .= __('Remove wlwmanifest link tag.', $this->textdomain_name);
2369
  $out .= '</td>';
2370
  $out .= '</tr>'."\n";
@@ -2383,10 +2408,21 @@ E__O__T;
2383
  $out .= '</tr>'."\n";
2384
 
2385
  $out .= '<tr>';
 
 
 
 
2386
  $out .= '<td colspan="2">';
2387
  $out .= $this->_checkbox('paranoia_mode');
2388
  $out .= __('Enabling "<strong>paranoia mode</strong>". Cut waste from the HTML and tries to minimize it.', $this->textdomain_name);
2389
  $out .= '</td>';
 
 
 
 
 
 
 
2390
  $out .= '<td>';
2391
  $out .= $this->_checkbox('debug_mode');
2392
  $out .= __('Debug mode', $this->textdomain_name);
@@ -2420,7 +2456,7 @@ E__O__T;
2420
  $i = 0;
2421
  foreach ($head_filters as $priority => $filters) {
2422
  foreach ($filters as $function_name){
2423
- if ( ! preg_match('/^(' . implode('|', $this->default_head_filters) . ')$/i', $function_name)) {
2424
  $out .= '<tr>';
2425
  $out .= '<th><input type="checkbox" name="head_filters['.$i.']" value="'.$function_name.'"'.($priority > self::PRIORITY ? ' checked="true"' : '').' /></th>';
2426
  $out .= '<th><input type="checkbox" name="head_remove['.$i.']" value="'.$function_name.'"'.($priority <= 0 ? ' checked="true"' : '').' /></th>';
@@ -2458,7 +2494,7 @@ E__O__T;
2458
  $i = 0;
2459
  foreach ($footer_filters as $priority => $filters) {
2460
  foreach ($filters as $function_name){
2461
- if ( ! preg_match('/^(' . implode('|', $this->default_head_filters) . ')$/i', $function_name)) {
2462
  $out .= '<tr>';
2463
  $out .= '<th><input type="checkbox" name="foot_filters['.$i.']" value="'.$function_name.'"'.($priority > self::PRIORITY ? ' checked="true"' : '').' /></th>';
2464
  $out .= '<th><input type="checkbox" name="foot_remove['.$i.']" value="'.$function_name.'"'.($priority <= 0 ? ' checked="true"' : '').' /></th>';
@@ -2485,10 +2521,10 @@ E__O__T;
2485
  $out .= '<th style="padding:0 .5em;">' . __('Remove', $this->textdomain_name) . '</th>'."\n";
2486
  $out .= '<th>' . __('JavaScripts', $this->textdomain_name) . '</th>'."\n";
2487
  foreach ($this->options['head_js'] as $javascript => $value) {
2488
- $remove = (array_search( $javascript, (array)$this->options["remove_js"] ) !== FALSE);
2489
  $out .= '<tr>';
2490
- $out .= '<th><input type="checkbox" name="head_js['.$i.']" value="'.$javascript.'"'.($value === FALSE ? ' checked="true"' : '').' /></th>';
2491
- $out .= '<th><input type="checkbox" name="remove_js['.$i.']" value="'.$javascript.'"'.($remove !== FALSE ? ' checked="true"' : '').' /></th>';
2492
  $out .= '<td>'.$javascript.'</td>';
2493
  $i++;
2494
  }
@@ -2539,86 +2575,169 @@ E__O__T;
2539
  return (isset($check_array[$check_key]) && $check_array[$check_key] === $check_val);
2540
  }
2541
  private function _options_update($recv_param) {
2542
- $head_js = (array) $recv_param['head_js'];
2543
- $remove_js = (array) $recv_param['remove_js'];
2544
- $head_filters = (array) $recv_param['head_filters'];
2545
- $head_remove = (array) $recv_param['head_remove'];
2546
- $foot_filters = (array) $recv_param['foot_filters'];
2547
- $foot_remove = (array) $recv_param['foot_remove'];
2548
-
2549
- // get options
2550
- $this->options['xml_declaration'] = $this->_checkbox_val($recv_param, 'xml_declaration');
2551
- $this->options['ie_conditional'] = $this->_checkbox_val($recv_param, 'ie_conditional');
2552
- $this->options['canonical_tag'] = $this->_checkbox_val($recv_param, 'canonical_tag');
2553
- $this->options['add_ogp_tag'] = $this->_checkbox_val($recv_param, 'add_ogp_tag');
2554
- $this->options['add_last_modified'] = $this->_checkbox_val($recv_param, 'add_last_modified');
2555
- $this->options['foot_js'] = $this->_checkbox_val($recv_param, 'foot_js');
2556
- $this->options['dynamic'] = $this->_checkbox_val($recv_param, 'dynamic');
2557
- $this->options['js_move_foot'] = $this->_checkbox_val($recv_param, 'js_move_foot');
2558
- $this->options['cache_enabled'] = $this->_checkbox_val($recv_param, 'cache_enabled');
2559
- $this->options['combined_css'] = $this->_checkbox_val($recv_param, 'combined_css');
2560
- $this->options['css_optimise'] = $this->_checkbox_val($recv_param, 'css_optimise');
2561
- $this->options['default_media'] = trim($recv_param['default_media']);
2562
- $this->options['img_base64'] = $this->_checkbox_val($recv_param, 'img_base64');
2563
- $this->options['combined_js'] = $this->_checkbox_val($recv_param, 'combined_js');
2564
- $this->options['js_minify'] = $this->_checkbox_val($recv_param, 'js_minify');
2565
- $this->options['paranoia_mode'] = $this->_checkbox_val($recv_param, 'paranoia_mode');
2566
- $this->options['gzip_on'] = $this->_checkbox_val($recv_param, 'gzip_on');
2567
- $this->options['use_ajax_libs'] = $this->_checkbox_val($recv_param, 'use_ajax_libs');
2568
- $this->options['debug_mode'] = $this->_checkbox_val($recv_param, 'debug_mode');
2569
-
2570
- $rm_generator = $this->_checkbox_val($recv_param, 'rm_generator');
2571
- $rm_rsd_link = $this->_checkbox_val($recv_param, 'rm_rsd_link');
2572
- $rm_manifest = $this->_checkbox_val($recv_param, 'rm_manifest');
2573
-
2574
- $this->options['remove_js'] = array();
2575
- foreach ((array) $this->options['head_js'] as $javascript => $value) {
2576
- if (count($head_js) > 0 && array_search($javascript, $head_js) !== FALSE)
2577
- $this->options['head_js'][$javascript] = FALSE;
2578
- else
2579
- $this->options['head_js'][$javascript] = TRUE;
2580
- if (array_search($javascript, (array) $remove_js) !== FALSE)
2581
- $this->options['remove_js'][] = $javascript;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2582
  }
2583
- unset($head_js);
2584
- unset($remove_js);
 
 
2585
 
2586
- // wp_head
2587
- $tag = 'wp_head';
2588
- foreach ((array) $this->options['filters'][$tag] as $function_name => $priority) {
2589
- if (count($head_filters) > 0 && array_search($function_name, $head_filters) !== FALSE)
2590
- $this->options['priority'][$tag][$function_name] = self::PRIORITY + 1;
2591
- elseif (count($head_remove) > 0 && array_search($function_name, $head_remove) !== FALSE)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2592
  $this->options['priority'][$tag][$function_name] = -1;
2593
- elseif (isset($this->options['priority'][$tag][$function_name]))
2594
- $this->options['priority'][$tag][$function_name] = $priority;
2595
- }
2596
- $this->options['priority'][$tag]['wp_generator'] = ($rm_generator ? -1 : $this->options['filters'][$tag]['wp_generator']);
2597
- $this->options['priority'][$tag]['rsd_link'] = ($rm_rsd_link ? -1 : $this->options['filters'][$tag]['rsd_link']);
2598
- $this->options['priority'][$tag]['wlwmanifest_link'] = ($rm_manifest ? -1 : $this->options['filters'][$tag]['wlwmanifest_link']);
2599
- unset($head_filters);
2600
-
2601
- // wp_footer
2602
- $tag = 'wp_footer';
2603
- foreach ((array) $this->options['filters'][$tag] as $function_name => $priority) {
2604
- if (count($foot_filters) > 0 && array_search($function_name, $foot_filters) !== FALSE)
2605
  $this->options['priority'][$tag][$function_name] = self::PRIORITY + 1;
2606
- elseif (count($foot_remove) > 0 && array_search($function_name, $foot_remove) !== FALSE)
2607
  $this->options['priority'][$tag][$function_name] = -1;
2608
- elseif (isset($this->options['priority'][$tag][$function_name]))
2609
- $this->options['priority'][$tag][$function_name] = $priority;
2610
  }
2611
- unset($foot_filters);
2612
-
2613
- // options update
2614
- $this->updateOptions();
2615
-
2616
- // create .htaccess file
2617
- $cache_dir = $this->_create_cache_dir();
2618
- if ( $cache_dir !== FALSE )
2619
- $this->_create_htaccess($cache_dir);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2620
 
2621
- return $this->options;
2622
  }
2623
 
2624
  //**************************************************************************************
@@ -2637,9 +2756,9 @@ E__O__T;
2637
  //**************************************************************************************
2638
  private function _get_function_name($function) {
2639
  $retval = (is_object($function[0])
2640
- ? (get_class($function[0]) !== FALSE ? get_class($function[0]) : $function[0]) . '::' . $function[1]
2641
  : $function );
2642
- return (!is_object($retval) && !is_array($retval) ? $retval : FALSE);
2643
  }
2644
 
2645
  //**************************************************************************************
@@ -2660,7 +2779,7 @@ E__O__T;
2660
  foreach ($active_filters as $priority => $filters) {
2661
  foreach ($filters as $filter) {
2662
  $function_name = $this->_get_function_name($filter['function']);
2663
- if (FALSE !== $function_name) {
2664
  if (!isset($this->filters[$tag]))
2665
  $this->filters[$tag] = array();
2666
  $this->filters[$tag][$function_name] = $priority;
@@ -2692,7 +2811,7 @@ E__O__T;
2692
  unset ($filters);
2693
 
2694
  foreach ( $this->head_js as $key => $val ) {
2695
- if ( !isset($this->options['head_js'][$key]) ) {
2696
  $retval = true;
2697
  break;
2698
  }
@@ -2816,7 +2935,7 @@ E__O__T;
2816
  ? $this->filters[$tag]
2817
  : array());
2818
  foreach ($active_filters as $function_name => $priority) {
2819
- if (strpos($function_name, 'HeadCleaner') === FALSE && strpos($function_name, 'noindex') === FALSE)
2820
  $ret_val .= " ($priority) : $function_name\n";
2821
  }
2822
  $ret_val .= "**************************************************\n\n";
@@ -2966,10 +3085,10 @@ E__O__T;
2966
  $excerpt = '';
2967
  $type = '';
2968
 
2969
- if (is_home()) {
2970
  $excerpt = get_bloginfo('description');
2971
 
2972
- } elseif(is_singular()) {
2973
  global $wpmp_conf, $post;
2974
 
2975
  // get the title
@@ -3030,22 +3149,25 @@ E__O__T;
3030
  $type = 'article';
3031
  }
3032
 
3033
- $ogp_tags = '<meta property="og:site_name" content="' . esc_html(get_bloginfo('name')) . '" />' . "\n";
3034
- if (!empty($url)) {
3035
- $ogp_tags .= '<meta property="og:url" content="' . esc_html($url) . '" />' . "\n";
3036
- }
3037
- if (!empty($title)) {
3038
- $ogp_tags .= '<meta property="og:title" content="' . esc_html($title) . '" />' . "\n";
3039
- }
3040
- if (!empty($thumb)) {
3041
- $ogp_tags .= '<meta property="og:image" content="' . esc_html($thumb) . '" />' . "\n";
3042
- }
3043
- if (!empty($excerpt)) {
3044
- $ogp_tags .= '<meta property="og:description" content="' . esc_html($excerpt) . '" />' . "\n";
3045
- }
3046
- if (!empty($type)) {
3047
- $ogp_tags .= '<meta property="og:type" content="' . esc_html($type) . '" />' . "\n";
3048
- }
 
 
 
3049
 
3050
  return $ogp_tags;
3051
  }
@@ -3239,7 +3361,7 @@ E__O__T;
3239
  $date["year"] = $temp_date[7];
3240
 
3241
  } else {
3242
- return FALSE;
3243
  }
3244
 
3245
  $date["timestamp"] = gmmktime( $date["hour"], $date["minute"], $date["second"], $date["month"], $date["day"], $date["year"] );
1
  <?php
2
  /*
3
  Plugin Name: Head Cleaner
4
+ Version: 1.4.2.7
5
  Plugin URI: http://wppluginsj.sourceforge.jp/head-cleaner/
6
  Description: Cleaning tags from your WordPress header and footer.
7
  Author: wokamoto
12
  License:
13
  Released under the GPL license
14
  http://www.gnu.org/copyleft/gpl.html
15
+ Copyright 2009 - 2012 wokamoto (email : wokamoto1973@gmail.com)
16
 
17
  This program is free software; you can redistribute it and/or modify
18
  it under the terms of the GNU General Public License as published by
60
  //**************************************************************************************
61
  if (!class_exists('wokController') || !class_exists('wokScriptManager'))
62
  require(dirname(__FILE__).'/includes/common-controller.php');
63
+ if (!class_exists('InputValidator'))
64
+ require(dirname(__FILE__).'/includes/class-InputValidator.php');
65
 
66
  //**************************************************************************************
67
  // Head Cleaner
68
  //**************************************************************************************
69
  class HeadCleaner extends wokController {
70
  public $plugin_name = 'head-cleaner';
71
+ public $plugin_ver = '1.5.0';
72
 
73
  const PRIORITY = 10000;
74
  const ANALYZE_EXPIRED = 604800; // 60 * 60 * 24 * 7 [sec.]
76
  const XMLNS_OG = 'http://ogp.me/ns#';
77
  const XMLNS_FB = 'http://www.facebook.com/2008/fbml';
78
  const IMG_BASE64_MAX_SIZE = 4096;
79
+ const OPTION_SAVE_FILE = false;
80
 
81
  // Deafault Options
82
  private $options_default = array(
102
  'use_ajax_libs' => false ,
103
  'img_base64' => false ,
104
  'add_ogp_tag' => false ,
105
+ 'ogp_default_image' => '' ,
106
+ 'fb_admins' => '' ,
107
+ 'fb_app_id' => '' ,
108
  'add_last_modified' => false ,
109
  'paranoia_mode' => false ,
110
  );
173
  // Create Directory for Cache
174
  if ( $this->options['cache_enabled'] ) {
175
  $this->cache_path = $this->_create_cache_dir();
176
+ if ($this->cache_path !== false) {
177
  $this->cache_url = str_replace(ABSPATH, $this->wp_url, $this->cache_path);
178
  } else {
179
  $this->options['cache_enabled'] = false;
264
 
265
  $head_js = $this->options_default['head_js'];
266
  foreach ((array) $wk_options['head_js'] as $key => $val) {
267
+ if ($val === false)
268
  $head_js[$key] = $val;
269
  }
270
 
310
  //**************************************************************************************
311
  public function activation(){
312
  $cache_dir = $this->_create_cache_dir();
313
+ if ( $cache_dir !== false )
314
  $this->_create_htaccess($cache_dir);
315
 
316
+ if (self::OPTION_SAVE_FILE !== false) {
317
  $option_file = dirname(__FILE__) . '/' . self::OPTION_SAVE_FILE;
318
  if ( file_exists($option_file) ) {
319
  $wk_options = unserialize(file_get_contents($option_file));
330
  // plugin deactivation
331
  //**************************************************************************************
332
  public function deactivation(){
333
+ if (self::OPTION_SAVE_FILE !== false) {
334
  $wk_options = serialize($this->options);
335
  $option_file = dirname(__FILE__) . '/' . self::OPTION_SAVE_FILE;
336
  if ( file_put_contents( $option_file, $wk_options ) && file_exists($option_file) ) {
345
  public function uninstall(){
346
  $this->_delete_settings();
347
  $this->_remove_cache_file();
348
+ if (self::OPTION_SAVE_FILE !== false) {
349
  $option_file = dirname(__FILE__) . '/' . self::OPTION_SAVE_FILE;
350
  if ( file_exists($option_file) ) {
351
  @unlink($option_file);
450
  ob_end_flush();
451
  }
452
 
453
+ private function function_enabled( $function_name ) {
454
+ return ( $function_name !== false && !preg_match('/^(' . implode('|', $this->default_head_filters) . ')$/i', $function_name) );
455
+ }
456
+
457
  //**************************************************************************************
458
  // filters info save
459
  //**************************************************************************************
804
  // css file
805
  foreach ((array) $elements_linktag as $element) {
806
  $tag = trim($element->outertext);
807
+ if (strpos($css_tag, $tag) === false) {
808
+ if (strpos($element->href, $this->wp_url) === false) {
809
  $css_tag .= $this->_tag_trim($tag);
810
  } elseif ( isset($element->id) && !empty($element->id) ) {
811
  $css_tag_with_id .= $this->_tag_trim($tag);
815
  $media = trim( isset($element->media)
816
  ? $element->media
817
  : $this->options['default_media'] );
818
+ $media = ( empty($media) || is_null($media) || $media === false
819
  ? $this->options['default_media']
820
  : $media );
821
  $inner_css .= $this->_tag_trim($tag);
831
  // inline css
832
  foreach ((array) $elements_styletag as $element) {
833
  $media = trim( isset($element->media) ? $element->media : $this->options['default_media'] );
834
+ $media = ( empty($media) || is_null($media) || $media === false ? $this->options['default_media'] : $media );
835
  $wk_text = $this->_remove_comment($element->innertext, 'css');
836
  $wk_text = $this->_css_import($wk_text);
837
  if ( !empty($wk_text) ) {
930
  if (!isset($this->head_js[$src]))
931
  $this->head_js[$src] = true;
932
 
933
+ if (array_search( $src, (array) $this->options['remove_js']) === false) {
934
+ $find = false;
935
  if (preg_match('/\/((prototype|jquery|mootools)\.js)\?ver=([\.\d]+)[^\?]*$/i', $src, $matches)) {
936
  list($find, $filename, $product, $version) = $matches;
937
  } elseif (preg_match('/\/((prototype|jquery|mootools)[\-\.](min|[\.\d]+)[^\/]*\.js)\?[^\?]*$/i', $src, $matches)) {
938
  list($find, $filename, $product, $version) = $matches;
939
  } elseif (preg_match('/\/scriptaculous\/((builder|controls|dragdrop|effects|wp\-scriptaculous|scriptaculous|slider|sound|unittest)\.js)\?ver\=([\.\d]+)[^\?]*$/i', $src, $matches)) {
940
  list($find, $filename, $product, $version) = $matches;
941
+ $product = (strpos($product, 'scriptaculous') === false
942
  ? 'scriptaculous/' . $product
943
  : 'scriptaculous/scriptaculous');
944
  }
945
  unset($matches);
946
 
947
+ if ($find !== false) {
948
  $version = trim(substr($version, -1) === '.' ? substr($version, 0, -1) : $version);
949
  if (empty($version))
950
  $version = preg_replace('/^.*\/([\.\d]+)\/.*$/', '$1', $src);
951
  if (!preg_match('/^[\.\d]*\d$/', $version))
952
  $version = '1';
953
  $js_libs[$product][$version] = $src;
954
+ } elseif ($this->head_js[$src] === false) {
955
  $foot_js .= $this->_tag_trim($element->outertext);
956
+ } elseif (strpos($src, $this->wp_url) === false) {
957
  $script_tag .= $this->_tag_trim($element->outertext);
958
  } else {
959
  $inner_js .= $this->_tag_trim($element->outertext);
1155
  $inline_js .= $this->_remove_comment($element->innertext, 'js');
1156
  } else {
1157
  $src = $element->src;
1158
+ if (array_search( $src, (array) $this->options['remove_js']) === false) {
1159
+ if (strpos($src, $this->wp_url) === false) {
1160
  $script_tag .= $this->_tag_trim($element->outertext);
1161
  } else {
1162
  $inner_js .= $this->_tag_trim($element->outertext);
1168
  break;
1169
  default:
1170
  $tag = $this->_tag_trim($element->outertext);
1171
+ if (strpos($other_tag, $tag) === false && ! preg_match('/^<\!\-+/', $tag))
1172
  $other_tag .= $tag;
1173
  break;
1174
  }
1315
  $tag = trim($element->outertext);
1316
  $type = strtolower($element->tag);
1317
  if (!($exclusion !== '' && preg_match($exclusion, $tag))) {
1318
+ if (strpos($html, $tag) === false) {
1319
  switch($type) {
1320
  case 'meta':
1321
  if (isset($element->name)) {
1330
  : array() );
1331
  if ( isset($element->content) ) {
1332
  foreach((array) explode(',', $element->content) as $content ) {
1333
+ if (array_search($content, $contents) === false) {
1334
  $contents[] = $content;
1335
  }
1336
  }
1454
  if (preg_match('/^https?:\/\//i', $base_path))
1455
  $base_path = str_replace($this->wp_url, ABSPATH, $base_path);
1456
  $real_path = realpath($base_path . '/' . $path);
1457
+ if ( $real_path === false )
1458
  $real_path = $base_path . '/' . $path;
1459
 
1460
  $abs_url = str_replace(ABSPATH, $this->wp_url, $real_path);
1686
  if (version_compare($ver, '1.4.2', '<'))
1687
  $src = $this->plugin_url . 'includes/js/jquery-1.4.2.min.js';
1688
 
1689
+ if ($prototype || $mootools || strpos($src, $this->wp_url) === false) {
1690
  $wk_outer_js .= $this->_script_tag($src);
1691
  } else {
1692
  $js_libs_src[] = $src;
1696
  // jQuery noConflict
1697
  if ($prototype || $mootools) {
1698
  $src = $this->plugin_url . 'includes/js/jquery.noconflict.js';
1699
+ if (strpos($src, $this->wp_url) === false) {
1700
  $wk_outer_js .= $this->_script_tag($src);
1701
  } else {
1702
  $js_libs_src[] = $src;
1712
  if (!empty($src)) {
1713
  if (version_compare($ver, '1.2.1', '<='))
1714
  $src = $this->plugin_url . 'includes/js/mootools-1.2.1-core-yc.js';
1715
+ if ($prototype || $jquery || strpos($src, $this->wp_url) === false) {
1716
  $wk_outer_js .= $this->_script_tag($src);
1717
  } else {
1718
  $js_libs_src[] = $src;
2083
  if( !file_exists($cache_dir.'/js/') )
2084
  @mkdir($cache_dir . '/js/', $mode);
2085
 
2086
+ return (file_exists($cache_dir) ? $cache_dir : false);
2087
  }
2088
 
2089
  //**************************************************************************************
2120
  //**************************************************************************************
2121
  private function _create_htaccess($dir) {
2122
  if (!file_exists($dir))
2123
+ return false;
2124
 
2125
  $rewrite_base = trailingslashit(str_replace(ABS_PATH, '/', $dir));
2126
 
2142
  return $this->_file_write($filename, $text, false);
2143
  } else {
2144
  list($content, $cache_path) = $this->_file_read($filename);
2145
+ if ($content !== false) {
2146
+ if (strpos($content, '# BEGIN Head Cleaner') === false && strpos($content, 'RewriteRule .+ %{REQUEST_URI}.gz') === false) {
2147
  $text = $content . "\n" . $text;
2148
  return $this->_file_write($filename, $text, false);
2149
  } else {
2150
+ return true;
2151
  }
2152
  } else {
2153
+ return false;
2154
  }
2155
  }
2156
  } else {
2157
  if ( file_exists($filename) ) {
2158
  list($content, $cache_path) = $this->_file_read($filename);
2159
+ if ($content !== false) {
2160
  $content = trim(preg_replace('/# BEGIN Head Cleaner.*# END Head Cleaner/ism', '', $content));
2161
  if ( $text === $content || $content === '') {
2162
  @unlink($filename);
2163
+ return true;
2164
  } else {
2165
  return $this->_file_write($filename, $content . "\n", false);
2166
  }
2167
  } else {
2168
+ return false;
2169
  }
2170
  } else {
2171
+ return true;
2172
  }
2173
  }
2174
  }
2239
  $this->options['head_js'] = $this->head_js;
2240
  }
2241
 
2242
+ $iv = new InputValidator('POST');
2243
+ $iv->set_rules('options_update', 'required');
2244
+ $iv->set_rules('remove_cache', 'required');
2245
+ $iv->set_rules('options_delete', 'required');
2246
+ if ( !is_wp_error($iv->input('options_update')) ) {
2247
  if ($this->wp25)
2248
  check_admin_referer("update_options", "_wpnonce_update_options");
2249
 
2250
  // Update options
2251
+ $this->_options_update($_POST);
2252
  $this->note .= "<strong>".__('Done!', $this->textdomain_name)."</strong>";
2253
 
2254
+ } elseif( !is_wp_error($iv->input('remove_cache')) ) {
2255
  if ($this->wp25)
2256
  check_admin_referer("remove_cache", "_wpnonce_remove_cache");
2257
 
2259
  $this->_remove_cache_file();
2260
  $this->note .= "<strong>".__('Done!', $this->textdomain_name)."</strong>";
2261
 
2262
+ } elseif( !is_wp_error($iv->input('options_delete')) ) {
2263
  if ($this->wp25)
2264
  check_admin_referer("delete_options", "_wpnonce_delete_options");
2265
 
2271
  } else {
2272
  $this->activation();
2273
  }
2274
+ unset($iv);
2275
 
2276
  $out = '';
2277
 
2352
  $out .= __('Add canonical tag.', $this->textdomain_name);
2353
  $out .= '</td>';
2354
  $out .= '<td>';
2355
+ $out .= '</td>';
2356
+ $out .= '</tr>'."\n";
2357
+
2358
+ $out .= '<tr>';
2359
+ $out .= '<td>';
2360
  $out .= $this->_checkbox('add_ogp_tag');
2361
  $out .= __('Add OGP(Open Graph Protocol) tags.', $this->textdomain_name);
2362
  $out .= '</td>';
2363
+ $out .= '<td colspan="2">';
2364
+ $out .= __('OGP default image URL.', $this->textdomain_name);
2365
+ $out .= "<input type=\"text\" name=\"ogp_default_image\" id=\"ogp_default_image\" value=\"{$this->options['ogp_default_image']}\" style=\"width:256px;margin-left:0.5em;\" />";
2366
+ $out .= '</td>';
2367
  $out .= '</tr>'."\n";
2368
 
2369
+ /* $out .= '<tr>';
2370
  $out .= '<td>';
 
 
2371
  $out .= '</td>';
2372
  $out .= '<td>';
2373
+ $out .= __('fb:admins', $this->textdomain_name);
2374
+ $out .= "<input type=\"text\" name=\"fb_admins\" id=\"fb_admins\" value=\"{$this->options['fb_admins']}\" style=\"margin-left:0.5em;\" />";
2375
  $out .= '</td>';
2376
  $out .= '<td>';
2377
+ $out .= __('fb:app_id', $this->textdomain_name);
2378
+ $out .= "<input type=\"text\" name=\"fb_app_id\" id=\"fb_app_id\" value=\"{$this->options['fb_app_id']}\" style=\"margin-left:0.5em;\" />";
2379
  $out .= '</td>';
2380
  $out .= '</tr>'."\n";
2381
+ */
2382
  $out .= '<tr>';
2383
  $out .= '<td>';
2384
+ $out .= $this->_checkbox('wp_generator', isset($this->options['priority']['wp_head']['wp_generator']) && $this->options['priority']['wp_head']['wp_generator'] <= 0);
2385
  $out .= __('Remove generator tag.', $this->textdomain_name);
2386
  $out .= '</td>';
2387
  $out .= '<td>';
2388
+ $out .= $this->_checkbox('rsd_link', isset($this->options['priority']['wp_head']['rsd_link']) && $this->options['priority']['wp_head']['rsd_link'] <= 0);
2389
  $out .= __('Remove RSD link tag.', $this->textdomain_name);
2390
  $out .= '</td>';
2391
  $out .= '<td>';
2392
+ $out .= $this->_checkbox('wlwmanifest_link', isset($this->options['priority']['wp_head']['wlwmanifest_link']) && $this->options['priority']['wp_head']['wlwmanifest_link'] <= 0);
2393
  $out .= __('Remove wlwmanifest link tag.', $this->textdomain_name);
2394
  $out .= '</td>';
2395
  $out .= '</tr>'."\n";
2408
  $out .= '</tr>'."\n";
2409
 
2410
  $out .= '<tr>';
2411
+ $out .= '<td>';
2412
+ $out .= $this->_checkbox('add_last_modified');
2413
+ $out .= __('Add Last modified.', $this->textdomain_name);
2414
+ $out .= '</td>';
2415
  $out .= '<td colspan="2">';
2416
  $out .= $this->_checkbox('paranoia_mode');
2417
  $out .= __('Enabling "<strong>paranoia mode</strong>". Cut waste from the HTML and tries to minimize it.', $this->textdomain_name);
2418
  $out .= '</td>';
2419
+ $out .= '</tr>'."\n";
2420
+
2421
+ $out .= '<tr>';
2422
+ $out .= '<td>';
2423
+ $out .= '</td>';
2424
+ $out .= '<td>';
2425
+ $out .= '</td>';
2426
  $out .= '<td>';
2427
  $out .= $this->_checkbox('debug_mode');
2428
  $out .= __('Debug mode', $this->textdomain_name);
2456
  $i = 0;
2457
  foreach ($head_filters as $priority => $filters) {
2458
  foreach ($filters as $function_name){
2459
+ if ( $this->function_enabled($function_name) ) {
2460
  $out .= '<tr>';
2461
  $out .= '<th><input type="checkbox" name="head_filters['.$i.']" value="'.$function_name.'"'.($priority > self::PRIORITY ? ' checked="true"' : '').' /></th>';
2462
  $out .= '<th><input type="checkbox" name="head_remove['.$i.']" value="'.$function_name.'"'.($priority <= 0 ? ' checked="true"' : '').' /></th>';
2494
  $i = 0;
2495
  foreach ($footer_filters as $priority => $filters) {
2496
  foreach ($filters as $function_name){
2497
+ if ( $this->function_enabled($function_name) ) {
2498
  $out .= '<tr>';
2499
  $out .= '<th><input type="checkbox" name="foot_filters['.$i.']" value="'.$function_name.'"'.($priority > self::PRIORITY ? ' checked="true"' : '').' /></th>';
2500
  $out .= '<th><input type="checkbox" name="foot_remove['.$i.']" value="'.$function_name.'"'.($priority <= 0 ? ' checked="true"' : '').' /></th>';
2521
  $out .= '<th style="padding:0 .5em;">' . __('Remove', $this->textdomain_name) . '</th>'."\n";
2522
  $out .= '<th>' . __('JavaScripts', $this->textdomain_name) . '</th>'."\n";
2523
  foreach ($this->options['head_js'] as $javascript => $value) {
2524
+ $remove = (array_search( $javascript, (array)$this->options["remove_js"] ) !== false);
2525
  $out .= '<tr>';
2526
+ $out .= '<th><input type="checkbox" name="head_js['.$i.']" value="'.$javascript.'"'.($value === false ? ' checked="true"' : '').' /></th>';
2527
+ $out .= '<th><input type="checkbox" name="remove_js['.$i.']" value="'.$javascript.'"'.($remove !== false ? ' checked="true"' : '').' /></th>';
2528
  $out .= '<td>'.$javascript.'</td>';
2529
  $i++;
2530
  }
2575
  return (isset($check_array[$check_key]) && $check_array[$check_key] === $check_val);
2576
  }
2577
  private function _options_update($recv_param) {
2578
+ $fields = array(
2579
+ 'head_js',
2580
+ 'remove_js',
2581
+ 'head_filters',
2582
+ 'head_remove',
2583
+ 'foot_filters',
2584
+ 'foot_remove',
2585
+ 'xml_declaration',
2586
+ 'ie_conditional',
2587
+ 'canonical_tag',
2588
+ 'add_ogp_tag',
2589
+ 'ogp_default_image',
2590
+ 'fb_admins',
2591
+ 'fb_app_id',
2592
+ 'add_last_modified',
2593
+ 'foot_js',
2594
+ 'dynamic',
2595
+ 'js_move_foot',
2596
+ 'cache_enabled',
2597
+ 'combined_css',
2598
+ 'css_optimise',
2599
+ 'default_media',
2600
+ 'img_base64',
2601
+ 'combined_js',
2602
+ 'js_minify',
2603
+ 'paranoia_mode',
2604
+ 'gzip_on',
2605
+ 'use_ajax_libs',
2606
+ 'debug_mode',
2607
+ 'wp_generator',
2608
+ 'rsd_link',
2609
+ 'wlwmanifest_link',
2610
+ );
2611
+
2612
+ $iv = new InputValidator($recv_param);
2613
+ foreach ( $fields as $field ) {
2614
+ switch ($field) {
2615
+ case 'head_js':
2616
+ case 'remove_js':
2617
+ case 'head_filters':
2618
+ case 'head_remove':
2619
+ case 'foot_filters':
2620
+ case 'foot_remove':
2621
+ $iv->set_rules($field, array('trim','esc_html','required'));
2622
+ break;
2623
+ case 'ogp_default_image':
2624
+ $iv->set_rules($field, array('trim','esc_html','url'));
2625
+ break;
2626
+ case 'fb_admins':
2627
+ case 'fb_app_id':
2628
+ $iv->set_rules($field, array('trim','esc_html'));
2629
+ break;
2630
+ case 'default_media':
2631
+ $iv->set_rules($field, array('trim','esc_html'));
2632
+ break;
2633
+ default:
2634
+ $iv->set_rules($field, 'bool');
2635
  }
2636
+ }
2637
+ $options = $iv->input($fields);
2638
+ $options['remove_js'] = is_wp_error($options['remove_js']) ? array() : (array)$options['remove_js'];
2639
+ unset($iv);
2640
 
2641
+ // head js
2642
+ $head_js = is_wp_error($options['head_js']) ? array() : (array)$options['head_js'];
2643
+ unset($options['head_js']);
2644
+ if ( function_exists('dbgx_trace_var') ) {
2645
+ dbgx_trace_var($head_js);
2646
+ }
2647
+ foreach ( (array) $this->options['head_js'] as $javascript => $value ) {
2648
+ if ( array_search($javascript, $head_js) !== false )
2649
+ $this->options['head_js'][$javascript] = false;
2650
+ else
2651
+ $this->options['head_js'][$javascript] = true;
2652
+ }
2653
+ unset($head_js);
2654
+
2655
+ // wp_head
2656
+ $tag = 'wp_head';
2657
+ $all_filters = array_merge(
2658
+ (array)$this->options['filters'][$tag],
2659
+ array(
2660
+ 'wp_generator' => 10 ,
2661
+ 'rsd_link' => 10 ,
2662
+ 'wlwmanifest_link' => 10 ,
2663
+ ));
2664
+ $head_filters = is_wp_error($options['head_filters']) ? array() : (array)$options['head_filters'];
2665
+ $head_remove = is_wp_error($options['head_remove']) ? array() : (array)$options['head_remove'];
2666
+ unset($options['head_filters']);
2667
+ unset($options['head_remove']);
2668
+ if ( function_exists('dbgx_trace_var') ) {
2669
+ dbgx_trace_var($head_filters);
2670
+ dbgx_trace_var($head_remove);
2671
+ }
2672
+ foreach ( $all_filters as $function_name => $priority ) {
2673
+ switch ($function_name) {
2674
+ case 'wp_generator':
2675
+ case 'rsd_link':
2676
+ case 'wlwmanifest_link':
2677
+ if ( $options[$function_name] )
2678
  $this->options['priority'][$tag][$function_name] = -1;
2679
+ elseif ( isset($this->options['priority'][$tag][$function_name]) )
2680
+ unset($this->options['priority'][$tag][$function_name]);
2681
+ break;
2682
+ default:
2683
+ if ( array_search($function_name, $head_filters) !== false )
 
 
 
 
 
 
 
2684
  $this->options['priority'][$tag][$function_name] = self::PRIORITY + 1;
2685
+ elseif ( array_search($function_name, $head_remove) !== false )
2686
  $this->options['priority'][$tag][$function_name] = -1;
2687
+ elseif ( isset($this->options['priority'][$tag][$function_name]) )
2688
+ unset($this->options['priority'][$tag][$function_name]);
2689
  }
2690
+ if ( !$this->function_enabled($function_name) && isset($this->options['filters'][$tag][$function_name]) )
2691
+ unset($this->options['filters'][$tag][$function_name]);
2692
+ }
2693
+ unset($all_filters);
2694
+ unset($head_filters);
2695
+ unset($head_remove);
2696
+
2697
+ // wp_footer
2698
+ $tag = 'wp_footer';
2699
+ $all_filters = (array)$this->options['filters'][$tag];
2700
+ $foot_filters = is_wp_error($options['foot_filters']) ? array() : (array)$options['foot_filters'];
2701
+ $foot_remove = is_wp_error($options['foot_remove']) ? array() : (array)$options['foot_remove'];
2702
+ unset($options['foot_filters']);
2703
+ unset($options['foot_remove']);
2704
+ if ( function_exists('dbgx_trace_var') ) {
2705
+ dbgx_trace_var($foot_filters);
2706
+ dbgx_trace_var($foot_remove);
2707
+ }
2708
+ foreach ( $all_filters as $function_name => $priority ) {
2709
+ if ( array_search($function_name, $foot_filters) !== false )
2710
+ $this->options['priority'][$tag][$function_name] = self::PRIORITY + 1;
2711
+ elseif ( array_search($function_name, $foot_remove) !== false )
2712
+ $this->options['priority'][$tag][$function_name] = -1;
2713
+ elseif ( isset($this->options['priority'][$tag][$function_name]) )
2714
+ unset($this->options['priority'][$tag][$function_name]);
2715
+ if ( !$this->function_enabled($function_name) && isset($this->options['filters'][$tag][$function_name]) )
2716
+ unset($this->options['filters'][$tag][$function_name]);
2717
+ }
2718
+ unset($all_filters);
2719
+ unset($foot_filters);
2720
+ unset($foot_remove);
2721
+
2722
+ foreach ( $this->options as $key => &$option ) {
2723
+ if ( isset($options[$key]) && $option !== $options[$key] ) {
2724
+ $option = $options[$key];
2725
+ }
2726
+ }
2727
+ if ( function_exists('dbgx_trace_var') ) {
2728
+ dbgx_trace_var($this->options);
2729
+ }
2730
+ unset($options);
2731
+
2732
+ // options update
2733
+ $this->updateOptions();
2734
+
2735
+ // create .htaccess file
2736
+ $cache_dir = $this->_create_cache_dir();
2737
+ if ( $cache_dir !== false )
2738
+ $this->_create_htaccess($cache_dir);
2739
 
2740
+ return $this->options;
2741
  }
2742
 
2743
  //**************************************************************************************
2756
  //**************************************************************************************
2757
  private function _get_function_name($function) {
2758
  $retval = (is_object($function[0])
2759
+ ? (get_class($function[0]) !== false ? get_class($function[0]) : $function[0]) . '::' . $function[1]
2760
  : $function );
2761
+ return (!is_object($retval) && !is_array($retval) ? $retval : false);
2762
  }
2763
 
2764
  //**************************************************************************************
2779
  foreach ($active_filters as $priority => $filters) {
2780
  foreach ($filters as $filter) {
2781
  $function_name = $this->_get_function_name($filter['function']);
2782
+ if ( $this->function_enabled($function_name) ) {
2783
  if (!isset($this->filters[$tag]))
2784
  $this->filters[$tag] = array();
2785
  $this->filters[$tag][$function_name] = $priority;
2811
  unset ($filters);
2812
 
2813
  foreach ( $this->head_js as $key => $val ) {
2814
+ if ( is_array($this->options['head_js']) && !isset($this->options['head_js'][$key]) ) {
2815
  $retval = true;
2816
  break;
2817
  }
2935
  ? $this->filters[$tag]
2936
  : array());
2937
  foreach ($active_filters as $function_name => $priority) {
2938
+ if (strpos($function_name, 'HeadCleaner') === false && strpos($function_name, 'noindex') === false)
2939
  $ret_val .= " ($priority) : $function_name\n";
2940
  }
2941
  $ret_val .= "**************************************************\n\n";
3085
  $excerpt = '';
3086
  $type = '';
3087
 
3088
+ if ( is_home() ) {
3089
  $excerpt = get_bloginfo('description');
3090
 
3091
+ } elseif( is_singular() ) {
3092
  global $wpmp_conf, $post;
3093
 
3094
  // get the title
3149
  $type = 'article';
3150
  }
3151
 
3152
+ if ( empty($thumb) && !empty($this->options['ogp_default_image']) )
3153
+ $thumb = $this->options['ogp_default_image'];
3154
+
3155
+ $ogp_tag = '<meta property="%s" content="%s" />' . "\n";
3156
+ $ogp_tags = sprintf($ogp_tag, 'og:site_name', esc_html(get_bloginfo('name')));
3157
+ if ( !empty($url) )
3158
+ $ogp_tags .= sprintf($ogp_tag, 'og:url', esc_html($url));
3159
+ if ( !empty($title) )
3160
+ $ogp_tags .= sprintf($ogp_tag, 'og:title', esc_html($title));
3161
+ if ( !empty($thumb) )
3162
+ $ogp_tags .= sprintf($ogp_tag, 'og:image', esc_html($thumb));
3163
+ if ( !empty($excerpt) )
3164
+ $ogp_tags .= sprintf($ogp_tag, 'og:description', esc_html($excerpt));
3165
+ if ( !empty($type) )
3166
+ $ogp_tags .= sprintf($ogp_tag, 'og:type', esc_html($type));
3167
+ if ( !empty($this->options['fb_admins']) )
3168
+ $ogp_tags .= sprintf($ogp_tag, 'fb:admins', esc_html($this->options['fb_admins']));
3169
+ if ( !empty($this->options['fb_app_id']) )
3170
+ $ogp_tags .= sprintf($ogp_tag, 'fb:app_id', esc_html($this->options['fb_app_id']));
3171
 
3172
  return $ogp_tags;
3173
  }
3361
  $date["year"] = $temp_date[7];
3362
 
3363
  } else {
3364
+ return false;
3365
  }
3366
 
3367
  $date["timestamp"] = gmmktime( $date["hour"], $date["minute"], $date["second"], $date["month"], $date["day"], $date["year"] );
includes/class-InputValidator.php ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( !class_exists('InputValidator') ) :
3
+ require_once(dirname(__FILE__).'/class-WP_Function_Wrapper.php');
4
+
5
+ class InputValidator {
6
+ const PASSWORD_MIN_LENGTH = 6;
7
+
8
+ private $inputs = array();
9
+ private $rules = array();
10
+ private $errors = array();
11
+
12
+ private $rc;
13
+
14
+ function __construct( $method = 'POST' ) {
15
+ $method = is_string($method) ? strtoupper($method) : $method;
16
+ switch ($method) {
17
+ case 'POST':
18
+ $this->inputs = $_POST;
19
+ break;
20
+ case 'GET':
21
+ $this->inputs = $_GET;
22
+ break;
23
+ case 'COOKIE':
24
+ $this->inputs = $_COOKIE;
25
+ break;
26
+ default:
27
+ if ( is_array($method) ) {
28
+ $this->inputs = $method;
29
+ } else {
30
+ $this->inputs = $_POST;
31
+ }
32
+ }
33
+ $this->errors_init();
34
+ $this->rc = new ReflectionClass("InputValidator");
35
+ }
36
+
37
+ /*
38
+ * validate
39
+ */
40
+ private function validate( $field, $val, &$err ) {
41
+ $err = '';
42
+ if ( isset($this->rules[$field]) ) {
43
+ $rules = (array)$this->rules[$field];
44
+ if ( !is_array($val) ) {
45
+ foreach ( $rules as $rule ) {
46
+ if ( isset($rule['func']) && is_callable($rule['func']) ) {
47
+ $args = (array)( isset($rule['args']) ? $rule['args'] : array($field) );
48
+ $args = array_merge( array($val), $args );
49
+ $val = call_user_func_array( $rule['func'], $args );
50
+ if ( WP_Function_Wrapper::is_wp_error($val) ) {
51
+ $err = $val;
52
+ return $val;
53
+ }
54
+ }
55
+ }
56
+ } else {
57
+ $errors = array();
58
+ foreach ( $val as $key => &$v ) {
59
+ $e = '';
60
+ $v = $this->validate( $field, $v, $e );
61
+ if ( !empty($e) )
62
+ $errors[$key] = $e;
63
+ }
64
+ if ( count($errors) > 0 )
65
+ $err = $errors;
66
+ }
67
+ }
68
+ return $val;
69
+ }
70
+
71
+ private function array_fetch( $array, $field = '', $validate = true ) {
72
+ $val = isset($array[$field]) ? $array[$field] : null;
73
+ if ( $validate ) {
74
+ $err = '';
75
+ $val = $this->validate( $field, $val, $err );
76
+ if ( !empty($err) )
77
+ $this->set_error( $field, $err );
78
+ }
79
+ return $val;
80
+ }
81
+
82
+ /*
83
+ * get input data
84
+ */
85
+ public function input( $index = false, $validate = true ) {
86
+ if ( !$index ) {
87
+ $post = array();
88
+ foreach (array_keys($this->inputs) as $key) {
89
+ $post[$key] = $this->array_fetch($this->inputs, $key, $validate);
90
+ }
91
+ return $post;
92
+ } else if ( is_array($index) ) {
93
+ $post = array();
94
+ foreach ($index as $key) {
95
+ $post[$key] = $this->array_fetch($this->inputs, $key, $validate);
96
+ }
97
+ return $post;
98
+ } else {
99
+ return $this->array_fetch($this->inputs, $index, $validate);
100
+ }
101
+ }
102
+
103
+ /*
104
+ * set validate rules
105
+ */
106
+ public function set_rules( $field, $func ) {
107
+ if ( !isset($this->rules[$field]) ) {
108
+ $this->rules[$field] = array();
109
+ }
110
+
111
+ $arg_list = func_get_args();
112
+ unset($arg_list[1]);
113
+
114
+ if ( is_string($func) && $this->rc->hasMethod($func) ) {
115
+ $this->rules[$field][] = array( 'func' => array(&$this, $func), 'args' => $arg_list );
116
+ } else if ( is_callable($func) ) {
117
+ $this->rules[$field][] = array( 'func' => $func, 'args' => $arg_list );
118
+ } else if ( is_array($func) ) {
119
+ foreach ( $func as $f ) {
120
+ $this->set_rules( $field, $f );
121
+ }
122
+ }
123
+ }
124
+
125
+ /*
126
+ * get errors
127
+ */
128
+ public function get_errors() {
129
+ return $this->errors;
130
+ }
131
+
132
+ public function errors_init() {
133
+ $this->errors = array();
134
+ }
135
+
136
+ private function set_error( $field, $message = '' ) {
137
+ if ( !is_array($message) ) {
138
+ $message =
139
+ WP_Function_Wrapper::is_wp_error($message)
140
+ ? WP_Function_Wrapper::get_error_message($field, $message)
141
+ : '';
142
+ } else {
143
+ $err = array();
144
+ foreach ( $message as $key => $val ) {
145
+ if ( WP_Function_Wrapper::is_wp_error($val) ) {
146
+ $err[$key] = WP_Function_Wrapper::get_error_message($field, $val);
147
+ }
148
+ }
149
+ $message = count($err) > 0 ? $err : '';
150
+ }
151
+
152
+ if ( !empty($message) ) {
153
+ if ( !isset($this->errors[$field]) )
154
+ $this->errors[$field] = array();
155
+ if ( !in_array($message, $this->errors[$field]) )
156
+ $this->errors[$field] = $message;
157
+ }
158
+ }
159
+
160
+ /*
161
+ * validate rules
162
+ */
163
+ private function trim( $val ) {
164
+ return trim($val);
165
+ }
166
+
167
+ private function esc_html( $val ) {
168
+ return WP_Function_Wrapper::esc_html( $val );
169
+ }
170
+
171
+ private function required( $val, $field = '' ) {
172
+ if ( empty($val) ) {
173
+ return WP_Function_Wrapper::wp_error( $field, sprintf('The "%s" field is required.', $field), $val );
174
+ }
175
+ return $val;
176
+ }
177
+
178
+ private function min_length( $val, $field = '', $min_length = false ) {
179
+ if ( !is_numeric($min_length) )
180
+ return $val;
181
+ if ( strlen($val) < $min_length ) {
182
+ return WP_Function_Wrapper::wp_error( $field, sprintf('The "%s" field must be at least %s characters in length.', $field, $min_length), $val );
183
+ }
184
+ return $val;
185
+ }
186
+
187
+ private function max_length( $val, $field = '', $max_length = false ) {
188
+ if ( !is_numeric($max_length) )
189
+ return $val;
190
+ if ( strlen($val) > $min_length ) {
191
+ return WP_Function_Wrapper::wp_error( $field, sprintf('The "%s" field must be at most %s characters in length.', $field, $max_length), $val );
192
+ }
193
+ return $val;
194
+ }
195
+
196
+ private function password_min_length( $val, $field = '', $min_length = false ) {
197
+ if ( !is_numeric($min_length) )
198
+ $min_length = self::PASSWORD_MIN_LENGTH;
199
+ return $this->min_length( $val, $field, $min_length );
200
+ }
201
+
202
+ private function bool( $val ) {
203
+ if ( is_bool($val) ) {
204
+ return $val;
205
+ } else if ( is_numeric($val) ) {
206
+ return intval($val) > 0;
207
+ } else if (empty($val) || !isset($val) || preg_match('/^(false|off|no)$/i', $val)) {
208
+ return false;
209
+ } else {
210
+ return true;
211
+ }
212
+ }
213
+
214
+ private function url( $val, $field = '' ) {
215
+ $val_org = $val;
216
+ $val = str_replace(
217
+ array('/',':','#','&', '?'),
218
+ array('/',':','#','&', '?'),
219
+ function_exists('mb_convert_kana') ? mb_convert_kana($val, 'as') : $val
220
+ );
221
+ $regex = '/^\b(?:https?|shttp):\/\/(?:(?:[-_.!~*\'()a-zA-Z0-9;:&=+$,]|%[0-9A-Fa-f][0-9A-Fa-f])*@)?(?:(?:[a-zA-Z0-9](?:[-a-zA-Z0-9]*[a-zA-Z0-9])?\.)*[a-zA-Z](?:[-a-zA-Z0-9]*[a-zA-Z0-9])?\.?|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)(?::[0-9]*)?(?:\/(?:[-_.!~*\'()a-zA-Z0-9:@&=+$,]|%[0-9A-Fa-f][0-9A-Fa-f])*(?:;(?:[-_.!~*\'()a-zA-Z0-9:@&=+$,]|%[0-9A-Fa-f][0-9A-Fa-f])*)*(?:\/(?:[-_.!~*\'()a-zA-Z0-9:@&=+$,]|%[0-9A-Fa-f][0-9A-Fa-f])*(?:;(?:[-_.!~*\'()a-zA-Z0-9:@&=+$,]|%[0-9A-Fa-f][0-9A-Fa-f])*)*)*)?(?:\?(?:[-_.!~*\'()a-zA-Z0-9;\/?:@&=+$,]|%[0-9A-Fa-f][0-9A-Fa-f])*)?(?:#(?:[-_.!~*\'()a-zA-Z0-9;\/?:@&=+$,]|%[0-9A-Fa-f][0-9A-Fa-f])*)?$/i';
222
+ if ( !preg_match($regex, $val) ) {
223
+ return WP_Function_Wrapper::wp_error( $field, sprintf('The "%s" field is invalid.', $field), $val_org );
224
+ }
225
+ return $val;
226
+ }
227
+
228
+ private function email( $val, $field = '' ) {
229
+ $val_org = $val;
230
+ $val = str_replace(
231
+ array('@','。','.','+'),
232
+ array('@','.','.','+'),
233
+ function_exists('mb_convert_kana') ? mb_convert_kana($val, 'as') : $val
234
+ );
235
+ if ( !($val = WP_Function_Wrapper::is_email($val)) ) {
236
+ return WP_Function_Wrapper::wp_error( $field, sprintf('The "%s" field is invalid.', $field), $val_org );
237
+ }
238
+ return $val;
239
+ }
240
+
241
+ private function tel( $val, $field = '' ) {
242
+ $val_org = $val;
243
+ $val = str_replace(
244
+ array('ー','-','(',')'),
245
+ array('-','-','(',')'),
246
+ function_exists('mb_convert_kana') ? mb_convert_kana($val, 'ns') : $val
247
+ );
248
+ if ( !preg_match('/^[0-9\-\(\)]+$/', $val) ) {
249
+ return WP_Function_Wrapper::wp_error( $field, sprintf('The "%s" field is invalid.', $field), $val_org );
250
+ }
251
+ return $val;
252
+ }
253
+
254
+ private function postcode( $val, $field = '' ) {
255
+ $val_org = $val;
256
+ $val = str_replace(
257
+ array('ー','-'),
258
+ array('-','-'),
259
+ function_exists('mb_convert_kana') ? mb_convert_kana($val, 'ns') : $val
260
+ );
261
+ if ( !preg_match('/^[0-9\-]+$/', $val) ) {
262
+ return WP_Function_Wrapper::wp_error( $field, sprintf('The "%s" field is invalid.', $field), $val_org );
263
+ }
264
+ return $val;
265
+ }
266
+
267
+ private function numeric( $val, $field = '' ) {
268
+ $val_org = $val;
269
+ $val = function_exists('mb_convert_kana') ? mb_convert_kana($val, 'ns') : $val;
270
+ if ( !is_numeric($val) ) {
271
+ return WP_Function_Wrapper::wp_error( $field, sprintf('The "%s" field is invalid.', $field), $val_org );
272
+ }
273
+ return $val;
274
+ }
275
+
276
+ private function match( $val, $field, $regex ) {
277
+ if ( !preg_match($regex, $val) ) {
278
+ return WP_Function_Wrapper::wp_error( $field, sprintf('The "%s" field is invalid.', $field), $val );
279
+ }
280
+ return $val;
281
+ }
282
+
283
+ private function kana( $val ) {
284
+ $val = function_exists('mb_convert_kana') ? mb_convert_kana($val, 'ASKVC') : $val;
285
+ return $val;
286
+ }
287
+ } // end of class
288
+
289
+ endif;
290
+ // EOF
includes/class-WP_Function_Wrapper.php ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class WP_Function_Wrapper {
3
+ static public function wp_error($field, $message, $data = '') {
4
+ if ( class_exists('WP_Error') ) {
5
+ return new WP_Error($field, $message, $data);
6
+ } else {
7
+ $error = new stdClass();
8
+ $error->validate = false;
9
+ $error->field = $field;
10
+ $error->message = $message;
11
+ $error->data = $data;
12
+ return $error;
13
+ }
14
+ }
15
+
16
+ static public function is_wp_error($thing) {
17
+ if ( function_exists('is_wp_error') ) {
18
+ return is_wp_error( $thing );
19
+ } else {
20
+ return ( is_object($thing) && isset($thing->validate) && $thing->validate === false);
21
+ }
22
+ }
23
+
24
+ static public function get_error_message($field, $thing) {
25
+ if ( self::is_wp_error($thing) ) {
26
+ return class_exists('WP_Error')
27
+ ? $thing->get_error_message()
28
+ : (isset($thing->message) ? $thing->message : sprintf('The "%s" field is invalid.', $field));
29
+ } else {
30
+ return null;
31
+ }
32
+ }
33
+
34
+ static public function is_email( $email, $deprecated = false ) {
35
+ if ( function_exists('is_email') ) {
36
+ return is_email( $email, $deprecated );
37
+ } else {
38
+ // Test for the minimum length the email can be
39
+ if ( strlen( $email ) < 3 )
40
+ return false;
41
+
42
+ // Test for an @ character after the first position
43
+ if ( strpos( $email, '@', 1 ) === false )
44
+ return false;
45
+
46
+ // Split out the local and domain parts
47
+ list( $local, $domain ) = explode( '@', $email, 2 );
48
+
49
+ // LOCAL PART
50
+ // Test for invalid characters
51
+ if ( !preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) )
52
+ return false;
53
+
54
+ // DOMAIN PART
55
+ // Test for sequences of periods
56
+ if ( preg_match( '/\.{2,}/', $domain ) )
57
+ return false;
58
+
59
+ // Test for leading and trailing periods and whitespace
60
+ if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain )
61
+ return false;
62
+
63
+ // Split the domain into subs
64
+ $subs = explode( '.', $domain );
65
+
66
+ // Assume the domain will have at least two subs
67
+ if ( 2 > count( $subs ) )
68
+ return false;
69
+
70
+ // Loop through each sub
71
+ foreach ( $subs as $sub ) {
72
+ // Test for leading and trailing hyphens and whitespace
73
+ if ( trim( $sub, " \t\n\r\0\x0B-" ) !== $sub )
74
+ return false;
75
+
76
+ // Test for invalid characters
77
+ if ( !preg_match('/^[a-z0-9-]+$/i', $sub ) )
78
+ return false;
79
+ }
80
+
81
+ // Congratulations your email made it!
82
+ return $email;
83
+ }
84
+ }
85
+
86
+ static public function esc_html( $text ) {
87
+ if ( function_exists('esc_html') ) {
88
+ return esc_html($text);
89
+ } else {
90
+ $safe_text = self::wp_check_invalid_utf8( $text );
91
+ $safe_text = self::wp_specialchars( $safe_text, ENT_QUOTES );
92
+ return $safe_text;
93
+ }
94
+ }
95
+
96
+ static public function wp_check_invalid_utf8( $string, $strip = false ) {
97
+ if ( function_exists('wp_check_invalid_utf8') ) {
98
+ return wp_check_invalid_utf8( $string, $strip );
99
+ } else {
100
+ $string = (string) $string;
101
+ if ( 0 === strlen( $string ) ) {
102
+ return '';
103
+ }
104
+
105
+ // Check for support for utf8 in the installed PCRE library once and store the result in a static
106
+ static $utf8_pcre;
107
+ if ( !isset( $utf8_pcre ) ) {
108
+ $utf8_pcre = @preg_match( '/^./u', 'a' );
109
+ }
110
+ // We can't demand utf8 in the PCRE installation, so just return the string in those cases
111
+ if ( !$utf8_pcre ) {
112
+ return $string;
113
+ }
114
+
115
+ // preg_match fails when it encounters invalid UTF8 in $string
116
+ if ( 1 === @preg_match( '/^./us', $string ) ) {
117
+ return $string;
118
+ }
119
+
120
+ // Attempt to strip the bad chars if requested (not recommended)
121
+ if ( $strip && function_exists( 'iconv' ) ) {
122
+ return iconv( 'utf-8', 'utf-8', $string );
123
+ }
124
+
125
+ return '';
126
+ }
127
+ }
128
+
129
+ static public function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
130
+ if ( function_exists('_wp_specialchars') ) {
131
+ return _wp_specialchars( $string, $quote_style, $charset, $double_encode );
132
+ } else {
133
+ $string = (string) $string;
134
+ if ( 0 === strlen( $string ) )
135
+ return '';
136
+
137
+ // Don't bother if there are no specialchars - saves some processing
138
+ if ( ! preg_match( '/[&<>"\']/', $string ) )
139
+ return $string;
140
+
141
+ // Account for the previous behaviour of the function when the $quote_style is not an accepted value
142
+ if ( empty( $quote_style ) )
143
+ $quote_style = ENT_NOQUOTES;
144
+ elseif ( ! in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) )
145
+ $quote_style = ENT_QUOTES;
146
+
147
+ // Store the site charset as a static to avoid multiple calls to wp_load_alloptions()
148
+ if ( ! $charset )
149
+ $charset = 'UTF-8';
150
+
151
+ if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) )
152
+ $charset = 'UTF-8';
153
+
154
+ $_quote_style = $quote_style;
155
+ if ( $quote_style === 'double' ) {
156
+ $quote_style = ENT_COMPAT;
157
+ $_quote_style = ENT_COMPAT;
158
+ } elseif ( $quote_style === 'single' ) {
159
+ $quote_style = ENT_NOQUOTES;
160
+ }
161
+
162
+ $string = @htmlspecialchars( $string, $quote_style, $charset );
163
+
164
+ // Backwards compatibility
165
+ if ( 'single' === $_quote_style )
166
+ $string = str_replace( "'", '&#039;', $string );
167
+
168
+ return $string;
169
+ }
170
+ }
171
+
172
+ } // end of class
173
+ // EOF
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-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,178 +20,182 @@ msgstr ""
20
  msgid "Cleaning tags from your WordPress header and footer."
21
  msgstr "WordPress サイトの &lt;head&gt; の中身と、フッタ領域を整形しなおします。"
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 "&lt;head&gt; 内の 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 "メタタグ &quot;canonical&quot; を追加"
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 "メタタグ &quot;Last Modified&quot; を追加"
101
 
102
- #: ../head-cleaner.php:2217
103
  msgid "Remove generator tag."
104
  msgstr "メタタグ &quot;generator&quot; を削除"
105
 
106
- #: ../head-cleaner.php:2221
107
  msgid "Remove RSD link tag."
108
  msgstr "リンクタグ &quot;RSD&quot; を削除"
109
 
110
- #: ../head-cleaner.php:2225
111
  msgid "Remove wlwmanifest link tag."
112
  msgstr "リンクタグ &quot;wlwmanifest&quot; を削除."
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 "&quot;パラノイアモード&quot; を有効にする。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 "&lt;head&gt; 内の有効なフィルタ"
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 "&lt;head&gt; 部で有効な 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 &quot;Head Cleaner&quot; are deleted."
188
  msgstr "&quot;Head Cleaner&quot; の設定をすべて消去する。"
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
 
2
  msgstr ""
3
  "Project-Id-Version: Head Cleaner\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-04-19 14:58+0900\n"
6
+ "PO-Revision-Date: 2012-04-19 15:28+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 サイトの &lt;head&gt; の中身と、フッタ領域を整形しなおします。"
22
 
23
+ #: ../head-cleaner.php:2178
24
  msgid "Head Cleaner"
25
  msgstr "Head Cleaner"
26
 
27
+ #: ../head-cleaner.php:2189
28
+ #: ../includes/common-controller.php:195
29
  msgid "Settings"
30
  msgstr "設定"
31
 
32
+ #: ../head-cleaner.php:2250
33
+ #: ../head-cleaner.php:2258
34
+ #: ../head-cleaner.php:2266
35
  msgid "Done!"
36
  msgstr "完了!"
37
 
38
+ #: ../head-cleaner.php:2279
39
  msgid "Head Cleaner Options"
40
  msgstr "Head Cleaner 設定"
41
 
42
+ #: ../head-cleaner.php:2288
43
  msgid "CSS and JavaScript are cached on the server."
44
  msgstr "CSS と JavaScript を、サーバ上にキャッシュする"
45
 
46
+ #: ../head-cleaner.php:2292
47
  msgid "CSS and JS are dynamically generated."
48
  msgstr "CSS, JS を動的生成する。"
49
 
50
+ #: ../head-cleaner.php:2295
51
  msgid "Default media attribute applied to CSS."
52
  msgstr "CSS に適用するデフォルト media 属性"
53
 
54
+ #: ../head-cleaner.php:2303
55
  msgid "Two or more CSS is combined."
56
  msgstr "複数の CSS を結合する"
57
 
58
+ #: ../head-cleaner.php:2307
59
  msgid "CSS is optimized."
60
  msgstr "CSS を最適化する"
61
 
62
+ #: ../head-cleaner.php:2311
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:2318
67
  msgid "Two or more JavaScript is combined."
68
  msgstr "複数の JavaScript を結合する"
69
 
70
+ #: ../head-cleaner.php:2322
71
  msgid "JavaScript is minified."
72
  msgstr "JavaScript を小さくする"
73
 
74
+ #: ../head-cleaner.php:2326
75
  msgid "Bottom JavaScript is combined, too."
76
  msgstr "フッタ領域の JavaScript も対象にする"
77
 
78
+ #: ../head-cleaner.php:2333
79
  msgid "Put JavaScripts at the Bottom."
80
  msgstr "&lt;head&gt; 内の JavaScript を、フッタ領域に移動"
81
 
82
+ #: ../head-cleaner.php:2337
83
  msgid "Use Google Ajax Libraries."
84
  msgstr "Google Ajax Libraries を利用する"
85
 
86
+ #: ../head-cleaner.php:2346
87
  msgid "Add XML Declaration."
88
  msgstr "XML宣言を付与"
89
 
90
+ #: ../head-cleaner.php:2350
91
  msgid "Add canonical tag."
92
  msgstr "メタタグ &quot;canonical&quot; を追加"
93
 
94
+ #: ../head-cleaner.php:2359
95
  msgid "Add OGP(Open Graph Protocol) tags."
96
  msgstr "OGP(Open Graph Protocol) 対応のメタタグを追加"
97
 
98
+ #: ../head-cleaner.php:2362
99
+ msgid "OGP default image URL."
100
+ msgstr "OGP にセットするデフォルト画像 (URLを指定)"
101
+
102
+ #: ../head-cleaner.php:2370
103
  msgid "Add Last modified."
104
  msgstr "メタタグ &quot;Last Modified&quot; を追加"
105
 
106
+ #: ../head-cleaner.php:2381
107
  msgid "Remove generator tag."
108
  msgstr "メタタグ &quot;generator&quot; を削除"
109
 
110
+ #: ../head-cleaner.php:2385
111
  msgid "Remove RSD link tag."
112
  msgstr "リンクタグ &quot;RSD&quot; を削除"
113
 
114
+ #: ../head-cleaner.php:2389
115
  msgid "Remove wlwmanifest link tag."
116
  msgstr "リンクタグ &quot;wlwmanifest&quot; を削除."
117
 
118
+ #: ../head-cleaner.php:2396
119
  msgid "Remove IE Conditional Tag."
120
  msgstr "IEコンディショナルタグを削除"
121
 
122
+ #: ../head-cleaner.php:2409
123
  msgid "Enabling \"<strong>paranoia mode</strong>\". Cut waste from the HTML and tries to minimize it."
124
  msgstr "&quot;パラノイアモード&quot; を有効にする。HTMLソースから無駄を省き、できるだけサイズを小さくしようとします。"
125
 
126
+ #: ../head-cleaner.php:2413
127
  msgid "Debug mode"
128
  msgstr "デバッグモード"
129
 
130
+ #: ../head-cleaner.php:2421
131
  msgid "Active Filters"
132
  msgstr "有効なフィルタ"
133
 
134
+ #: ../head-cleaner.php:2424
135
+ #: ../head-cleaner.php:2462
136
  msgid "Don't process!"
137
  msgstr "対象外"
138
 
139
+ #: ../head-cleaner.php:2425
140
+ #: ../head-cleaner.php:2463
141
+ #: ../head-cleaner.php:2506
142
  msgid "Remove"
143
  msgstr "削除"
144
 
145
+ #: ../head-cleaner.php:2426
146
  msgid "Head filters"
147
  msgstr "&lt;head&gt; 内の有効なフィルタ"
148
 
149
+ #: ../head-cleaner.php:2428
150
+ #: ../head-cleaner.php:2466
151
  msgid "Priority"
152
  msgstr "フィルタの優先順位"
153
 
154
+ #: ../head-cleaner.php:2464
155
  msgid "Bottom filters"
156
  msgstr "フッタ領域の有効なフィルタ"
157
 
158
+ #: ../head-cleaner.php:2502
159
  msgid "Active JavaScripts"
160
  msgstr "&lt;head&gt; 部で有効な JavaScript"
161
 
162
+ #: ../head-cleaner.php:2505
163
  msgid "Move to footer"
164
  msgstr "フッタに移動"
165
 
166
+ #: ../head-cleaner.php:2507
167
  msgid "JavaScripts"
168
  msgstr "JavaScript"
169
 
170
+ #: ../head-cleaner.php:2521
171
  msgid "Update Options"
172
  msgstr "更新"
173
 
174
+ #: ../head-cleaner.php:2527
175
  msgid "Remove all cache files"
176
  msgstr "キャッシュファイル削除"
177
 
178
+ #: ../head-cleaner.php:2531
179
  msgid "All cache files are removed."
180
  msgstr "キャッシュフォルダ内のファイルをすべて削除する。"
181
 
182
+ #: ../head-cleaner.php:2532
183
  msgid "Remove All Cache Files"
184
  msgstr "削除"
185
 
186
+ #: ../head-cleaner.php:2537
187
  msgid "Uninstall"
188
  msgstr "アンインストール"
189
 
190
+ #: ../head-cleaner.php:2541
191
  msgid "All the settings of &quot;Head Cleaner&quot; are deleted."
192
  msgstr "&quot;Head Cleaner&quot; の設定をすべて消去する。"
193
 
194
+ #: ../head-cleaner.php:2542
195
  msgid "Delete Options"
196
  msgstr "削除"
197
 
198
+ #: ../head-cleaner.php:3108
199
  msgid "There is no excerpt because this is a protected post."
200
  msgstr "この投稿は保護されているので抜粋文はありません。"
201
 
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-04-11 16:15+0900\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: \n"
8
  "Language-Team: \n"
@@ -14,178 +14,182 @@ msgstr ""
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 &quot;Head Cleaner&quot; 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
 
2
  msgstr ""
3
  "Project-Id-Version: Head Cleaner\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-04-19 14:58+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:2178
18
  msgid "Head Cleaner"
19
  msgstr ""
20
 
21
+ #: ../head-cleaner.php:2189
22
+ #: ../includes/common-controller.php:195
23
  msgid "Settings"
24
  msgstr ""
25
 
26
+ #: ../head-cleaner.php:2250
27
+ #: ../head-cleaner.php:2258
28
+ #: ../head-cleaner.php:2266
29
  msgid "Done!"
30
  msgstr ""
31
 
32
+ #: ../head-cleaner.php:2279
33
  msgid "Head Cleaner Options"
34
  msgstr ""
35
 
36
+ #: ../head-cleaner.php:2288
37
  msgid "CSS and JavaScript are cached on the server."
38
  msgstr ""
39
 
40
+ #: ../head-cleaner.php:2292
41
  msgid "CSS and JS are dynamically generated."
42
  msgstr ""
43
 
44
+ #: ../head-cleaner.php:2295
45
  msgid "Default media attribute applied to CSS."
46
  msgstr ""
47
 
48
+ #: ../head-cleaner.php:2303
49
  msgid "Two or more CSS is combined."
50
  msgstr ""
51
 
52
+ #: ../head-cleaner.php:2307
53
  msgid "CSS is optimized."
54
  msgstr ""
55
 
56
+ #: ../head-cleaner.php:2311
57
  msgid "URLs of images in CSS will be converted into the data scheme URIs."
58
  msgstr ""
59
 
60
+ #: ../head-cleaner.php:2318
61
  msgid "Two or more JavaScript is combined."
62
  msgstr ""
63
 
64
+ #: ../head-cleaner.php:2322
65
  msgid "JavaScript is minified."
66
  msgstr ""
67
 
68
+ #: ../head-cleaner.php:2326
69
  msgid "Bottom JavaScript is combined, too."
70
  msgstr ""
71
 
72
+ #: ../head-cleaner.php:2333
73
  msgid "Put JavaScripts at the Bottom."
74
  msgstr ""
75
 
76
+ #: ../head-cleaner.php:2337
77
  msgid "Use Google Ajax Libraries."
78
  msgstr ""
79
 
80
+ #: ../head-cleaner.php:2346
81
  msgid "Add XML Declaration."
82
  msgstr ""
83
 
84
+ #: ../head-cleaner.php:2350
85
  msgid "Add canonical tag."
86
  msgstr ""
87
 
88
+ #: ../head-cleaner.php:2359
89
  msgid "Add OGP(Open Graph Protocol) tags."
90
  msgstr ""
91
 
92
+ #: ../head-cleaner.php:2362
93
+ msgid "OGP default image URL."
94
+ msgstr ""
95
+
96
+ #: ../head-cleaner.php:2370
97
  msgid "Add Last modified."
98
  msgstr ""
99
 
100
+ #: ../head-cleaner.php:2381
101
  msgid "Remove generator tag."
102
  msgstr ""
103
 
104
+ #: ../head-cleaner.php:2385
105
  msgid "Remove RSD link tag."
106
  msgstr ""
107
 
108
+ #: ../head-cleaner.php:2389
109
  msgid "Remove wlwmanifest link tag."
110
  msgstr ""
111
 
112
+ #: ../head-cleaner.php:2396
113
  msgid "Remove IE Conditional Tag."
114
  msgstr ""
115
 
116
+ #: ../head-cleaner.php:2409
117
  msgid "Enabling \"<strong>paranoia mode</strong>\". Cut waste from the HTML and tries to minimize it."
118
  msgstr ""
119
 
120
+ #: ../head-cleaner.php:2413
121
  msgid "Debug mode"
122
  msgstr ""
123
 
124
+ #: ../head-cleaner.php:2421
125
  msgid "Active Filters"
126
  msgstr ""
127
 
128
+ #: ../head-cleaner.php:2424
129
+ #: ../head-cleaner.php:2462
130
  msgid "Don't process!"
131
  msgstr ""
132
 
133
+ #: ../head-cleaner.php:2425
134
+ #: ../head-cleaner.php:2463
135
+ #: ../head-cleaner.php:2506
136
  msgid "Remove"
137
  msgstr ""
138
 
139
+ #: ../head-cleaner.php:2426
140
  msgid "Head filters"
141
  msgstr ""
142
 
143
+ #: ../head-cleaner.php:2428
144
+ #: ../head-cleaner.php:2466
145
  msgid "Priority"
146
  msgstr ""
147
 
148
+ #: ../head-cleaner.php:2464
149
  msgid "Bottom filters"
150
  msgstr ""
151
 
152
+ #: ../head-cleaner.php:2502
153
  msgid "Active JavaScripts"
154
  msgstr ""
155
 
156
+ #: ../head-cleaner.php:2505
157
  msgid "Move to footer"
158
  msgstr ""
159
 
160
+ #: ../head-cleaner.php:2507
161
  msgid "JavaScripts"
162
  msgstr ""
163
 
164
+ #: ../head-cleaner.php:2521
165
  msgid "Update Options"
166
  msgstr ""
167
 
168
+ #: ../head-cleaner.php:2527
169
  msgid "Remove all cache files"
170
  msgstr ""
171
 
172
+ #: ../head-cleaner.php:2531
173
  msgid "All cache files are removed."
174
  msgstr ""
175
 
176
+ #: ../head-cleaner.php:2532
177
  msgid "Remove All Cache Files"
178
  msgstr ""
179
 
180
+ #: ../head-cleaner.php:2537
181
  msgid "Uninstall"
182
  msgstr ""
183
 
184
+ #: ../head-cleaner.php:2541
185
  msgid "All the settings of &quot;Head Cleaner&quot; are deleted."
186
  msgstr ""
187
 
188
+ #: ../head-cleaner.php:2542
189
  msgid "Delete Options"
190
  msgstr ""
191
 
192
+ #: ../head-cleaner.php:3108
193
  msgid "There is no excerpt because this is a protected post."
194
  msgstr ""
195
 
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.3.1
7
- Stable tag: 1.4.2.6
8
 
9
  Cleaning tags from your WordPress header and footer.
10
 
4
  Tags: head, header, footer, javascript, css, optimization, minified, performance, facebook, OGP
5
  Requires at least: 2.5
6
  Tested up to: 3.3.1
7
+ Stable tag: 1.4.2.7
8
 
9
  Cleaning tags from your WordPress header and footer.
10
 
readme_ja.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=9S8AJ
4
  Tags: head optimization, javascript, css, optimization, minified, performance
5
  Requires at least: 2.5
6
  Tested up to: 3.3.1
7
- Stable tag: 1.4.2.6
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.3.1
7
+ Stable tag: 1.4.2.7
8
 
9
  Head と footer をお掃除します。
10