Version Description
Download this release
Release Info
Developer | wokamoto |
Plugin | Head Cleaner |
Version | 1.4.2.11 |
Comparing to | |
See all releases |
Code changes from version 1.4.2.10 to 1.4.2.11
- head-cleaner.php +4 -4
- includes/common-controller.php +385 -385
- includes/regist_ajax_libs.php +4 -2
- readme.txt +1 -1
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- uninstall.php +11 -0
head-cleaner.php
CHANGED
@@ -1,7 +1,7 @@
|
|
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
|
@@ -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 -
|
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
|
@@ -3199,9 +3199,9 @@ jQuery(function($){
|
|
3199 |
$title = $title = trim(wp_title('', false));
|
3200 |
$thumb = '';
|
3201 |
$excerpt = '';
|
3202 |
-
$type = '';
|
3203 |
|
3204 |
-
if ( is_home() ) {
|
3205 |
$excerpt = get_bloginfo('description');
|
3206 |
$title = $site_name;
|
3207 |
$type = $this->options['og_type_top'];
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Head Cleaner
|
4 |
+
Version: 1.4.2.11
|
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 - 2013 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
|
3199 |
$title = $title = trim(wp_title('', false));
|
3200 |
$thumb = '';
|
3201 |
$excerpt = '';
|
3202 |
+
$type = $this->options['og_type_top'];
|
3203 |
|
3204 |
+
if ( is_home() || is_front_page() ) {
|
3205 |
$excerpt = get_bloginfo('description');
|
3206 |
$title = $site_name;
|
3207 |
$type = $this->options['og_type_top'];
|
includes/common-controller.php
CHANGED
@@ -1,385 +1,385 @@
|
|
1 |
-
<?php
|
2 |
-
//**************************************************************************************
|
3 |
-
// Require wp-load.php or wp-config.php
|
4 |
-
//**************************************************************************************
|
5 |
-
if(!function_exists('get_option')) {
|
6 |
-
$path = (
|
7 |
-
defined('ABSPATH')
|
8 |
-
? ABSPATH
|
9 |
-
: dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/'
|
10 |
-
);
|
11 |
-
require_once(
|
12 |
-
file_exists($path.'wp-load.php')
|
13 |
-
? $path.'wp-load.php'
|
14 |
-
: $path.'wp-config.php'
|
15 |
-
);
|
16 |
-
}
|
17 |
-
|
18 |
-
//**************************************************************************************
|
19 |
-
// Common Controller
|
20 |
-
//**************************************************************************************
|
21 |
-
if (!class_exists('wokController')) :
|
22 |
-
class wokController {
|
23 |
-
var $file_path;
|
24 |
-
var $plugins_dir, $plugin_dir, $plugin_file, $plugin_url;
|
25 |
-
var $textdomain_name;
|
26 |
-
var $options, $option_name;
|
27 |
-
var $admin_option, $admin_action, $admin_hook;
|
28 |
-
var $note, $error;
|
29 |
-
var $charset;
|
30 |
-
var $wp25, $wp26, $wp27, $wp28, $wp29, $wp30, $wp31, $wp32, $wp33, $wp34;
|
31 |
-
var $inline_js;
|
32 |
-
|
33 |
-
var $jquery_js = 'includes/js/jquery-1.4.2.min.js';
|
34 |
-
var $jquery_ver = '1.4.2';
|
35 |
-
|
36 |
-
var $jquery_noconflict_js = 'includes/js/jquery.noconflict.js';
|
37 |
-
|
38 |
-
/*
|
39 |
-
* initialize
|
40 |
-
*/
|
41 |
-
function init($file) {
|
42 |
-
global $wp_version, $wok_script_manager;
|
43 |
-
|
44 |
-
$this->charset = get_option('blog_charset');
|
45 |
-
$this->wp25 = version_compare($wp_version, "2.5", ">=");
|
46 |
-
$this->wp26 = version_compare($wp_version, "2.6", ">=");
|
47 |
-
$this->wp27 = version_compare($wp_version, "2.7", ">=");
|
48 |
-
$this->wp28 = version_compare($wp_version, "2.8", ">=");
|
49 |
-
$this->wp29 = version_compare($wp_version, "2.9", ">=");
|
50 |
-
$this->wp30 = version_compare($wp_version, "3.0", ">=");
|
51 |
-
$this->wp31 = version_compare($wp_version, "3.1", ">=");
|
52 |
-
$this->wp32 = version_compare($wp_version, "3.2", ">=");
|
53 |
-
$this->wp33 = version_compare($wp_version, "3.3", ">=");
|
54 |
-
$this->wp34 = version_compare($wp_version, "3.4", ">=");
|
55 |
-
|
56 |
-
$this->setPluginDir($file);
|
57 |
-
$this->loadTextdomain();
|
58 |
-
|
59 |
-
$this->note = '';
|
60 |
-
$this->error = 0;
|
61 |
-
|
62 |
-
$this->admin_option = $this->plugin_file;
|
63 |
-
$this->admin_action =
|
64 |
-
trailingslashit(get_bloginfo('wpurl')) . 'wp-admin/'
|
65 |
-
. ($this->wp27 ? 'options-general.php' : 'admin.php')
|
66 |
-
. '?page=' . $this->admin_option;
|
67 |
-
$this->admin_hook = array();
|
68 |
-
|
69 |
-
$this->options = array();
|
70 |
-
$this->option_name = (
|
71 |
-
isset($this->plugin_name) && !empty($this->plugin_name)
|
72 |
-
? $this->plugin_name
|
73 |
-
: $this->plugin_dir ) . " Options";
|
74 |
-
|
75 |
-
if (!isset($wok_script_manager) && class_exists('wokScriptManager'))
|
76 |
-
$wok_script_manager = new wokScriptManager();
|
77 |
-
|
78 |
-
$this->inline_js = array(
|
79 |
-
'admin_head' => '',
|
80 |
-
'head' => '',
|
81 |
-
'footer' => '',
|
82 |
-
);
|
83 |
-
}
|
84 |
-
|
85 |
-
function setPluginDir($file) {
|
86 |
-
$this->file_path = $file;
|
87 |
-
$this->plugins_dir = trailingslashit(defined('PLUGINDIR') ? PLUGINDIR : 'wp-content/plugins');
|
88 |
-
$filename = explode("/", $this->file_path);
|
89 |
-
if(count($filename) <= 1) $filename = explode("\\", $this->file_path);
|
90 |
-
$this->plugin_dir = $filename[count($filename) - 2];
|
91 |
-
$this->plugin_file = $filename[count($filename) - 1];
|
92 |
-
$this->plugin_url = $this->wp_plugin_url($this->plugin_dir);
|
93 |
-
unset($filename);
|
94 |
-
}
|
95 |
-
|
96 |
-
function loadTextdomain( $sub_dir = '' ) {
|
97 |
-
$this->textdomain_name = $this->plugin_dir;
|
98 |
-
$abs_plugin_dir = $this->wp_plugin_dir($this->plugin_dir);
|
99 |
-
$sub_dir = (!empty($sub_dir)
|
100 |
-
? preg_replace('/^\//', '', $sub_dir)
|
101 |
-
: (file_exists($abs_plugin_dir.'languages') ? 'languages' : (file_exists($abs_plugin_dir.'language') ? 'language' : (file_exists($abs_plugin_dir.'lang') ? 'lang' : '')))
|
102 |
-
);
|
103 |
-
$textdomain_dir = trailingslashit(trailingslashit($this->plugin_dir) . $sub_dir);
|
104 |
-
|
105 |
-
if ($this->wp26 && defined('WP_PLUGIN_DIR'))
|
106 |
-
load_plugin_textdomain($this->textdomain_name, false, $textdomain_dir);
|
107 |
-
else
|
108 |
-
load_plugin_textdomain($this->textdomain_name, $this->plugins_dir . $textdomain_dir);
|
109 |
-
}
|
110 |
-
|
111 |
-
// Handles Add/strips slashes to the given array
|
112 |
-
function stripArray($array) {
|
113 |
-
if(!is_array($array))
|
114 |
-
return stripslashes($array);
|
115 |
-
|
116 |
-
foreach($array as $key => $value) {
|
117 |
-
if (!is_array($value))
|
118 |
-
$slashed_array[$key] = stripslashes($value);
|
119 |
-
else
|
120 |
-
$slashed_array[$key] = $this->stripArray($value);
|
121 |
-
}
|
122 |
-
return $slashed_array;
|
123 |
-
}
|
124 |
-
|
125 |
-
// Get Option
|
126 |
-
function getOption($key) {
|
127 |
-
if ($key=='version')
|
128 |
-
return (isset($this->plugin_ver) ? $this->plugin_ver : false);
|
129 |
-
else
|
130 |
-
return (isset($this->options[$key]) ? $this->options[$key] : false);
|
131 |
-
}
|
132 |
-
|
133 |
-
// Get Text
|
134 |
-
function getText($text) {
|
135 |
-
return __($text, $this->textdomain_name);
|
136 |
-
}
|
137 |
-
|
138 |
-
// Get Options
|
139 |
-
function getOptions(){
|
140 |
-
return get_option($this->option_name);
|
141 |
-
}
|
142 |
-
|
143 |
-
// Update Options
|
144 |
-
function updateOptions() {
|
145 |
-
update_option($this->option_name, $this->options);
|
146 |
-
}
|
147 |
-
|
148 |
-
// Delete Options
|
149 |
-
function deleteOptions() {
|
150 |
-
delete_option($this->option_name);
|
151 |
-
}
|
152 |
-
|
153 |
-
// Add Admin Option Page
|
154 |
-
function addOptionPage($page_title, $function, $capability = 'administrator', $menu_title = '', $file = '') {
|
155 |
-
if ($menu_title == '')
|
156 |
-
$menu_title = $page_title;
|
157 |
-
if ($file == '')
|
158 |
-
$file = $this->plugin_file;
|
159 |
-
$this->admin_hook['option'] = add_options_page($page_title, $menu_title, $capability, $file, $function);
|
160 |
-
}
|
161 |
-
|
162 |
-
function addManagementPage($page_title, $function, $capability = 'administrator', $menu_title = '', $file = '') {
|
163 |
-
if ($menu_title == '')
|
164 |
-
$menu_title = $page_title;
|
165 |
-
if ($file == '')
|
166 |
-
$file = $this->plugin_file;
|
167 |
-
$this->admin_hook['management'] = add_management_page($page_title, $menu_title, $capability, $file, $function);
|
168 |
-
}
|
169 |
-
|
170 |
-
function addThemePage($page_title, $function, $capability = 'administrator', $menu_title = '', $file = '') {
|
171 |
-
if ($menu_title == '')
|
172 |
-
$menu_title = $page_title;
|
173 |
-
if ($file == '')
|
174 |
-
$file = $this->plugin_file;
|
175 |
-
$this->admin_hook['theme'] = add_theme_page($page_title, $menu_title, $capability, $file, $function);
|
176 |
-
}
|
177 |
-
|
178 |
-
function addSubmenuPage($parent, $page_title, $function, $capability = 'administrator', $menu_title = '', $file = '') {
|
179 |
-
if ($menu_title == '')
|
180 |
-
$menu_title = $page_title;
|
181 |
-
if ($file == '')
|
182 |
-
$file = $this->plugin_file;
|
183 |
-
$this->admin_hook[$parent] = add_submenu_page($parent, $page_title, $menu_title, $capability, $file, $function);
|
184 |
-
}
|
185 |
-
|
186 |
-
function addMediaPage($page_title, $function, $capability = 'administrator', $menu_title = '', $file = '') {
|
187 |
-
$this->addSubmenuPage(($this->wp27 ? 'upload.php' : 'edit.php'), $page_title, $function, $capability, $menu_title, $file);
|
188 |
-
}
|
189 |
-
|
190 |
-
function addEditPage($page_title, $function, $capability = 'administrator', $menu_title = '', $file = '') {
|
191 |
-
$this->addSubmenuPage('edit.php', $page_title, $function, $capability, $menu_title, $file);
|
192 |
-
}
|
193 |
-
|
194 |
-
function addPluginSettingLinks($links, $file) {
|
195 |
-
$this_plugin = plugin_basename($this->file_path);
|
196 |
-
if ($file == $this_plugin) {
|
197 |
-
$settings_link = '<a href="' . $this->admin_action . '">' . __('Settings') . '</a>';
|
198 |
-
array_unshift($links, $settings_link); // before other links
|
199 |
-
}
|
200 |
-
return $links;
|
201 |
-
}
|
202 |
-
|
203 |
-
// Make Nonce field
|
204 |
-
function makeNonceField($action = -1, $name = "_wpnonce", $referer = true , $echo = true ) {
|
205 |
-
if ( !function_exists('wp_nonce_field') )
|
206 |
-
return;
|
207 |
-
else
|
208 |
-
return wp_nonce_field($action, $name, $referer, $echo);
|
209 |
-
}
|
210 |
-
|
211 |
-
// This Plugin active?
|
212 |
-
function isActive($file = '') {
|
213 |
-
$is_active = false;
|
214 |
-
if ($file == '')
|
215 |
-
$file = $this->plugin_file;
|
216 |
-
foreach ((array) get_option('active_plugins') as $val) {
|
217 |
-
if (preg_match('/'.preg_quote($file).'/i', $val)) {
|
218 |
-
$is_active = true;
|
219 |
-
break;
|
220 |
-
}
|
221 |
-
}
|
222 |
-
return $is_active;
|
223 |
-
}
|
224 |
-
|
225 |
-
// Mobile Access ?
|
226 |
-
function isKtai(){
|
227 |
-
return (
|
228 |
-
(function_exists('is_mobile') && is_mobile()) ||
|
229 |
-
(function_exists('is_ktai') && is_ktai())
|
230 |
-
);
|
231 |
-
}
|
232 |
-
|
233 |
-
// Output Javascript
|
234 |
-
function scriptConcat($js, $place) {
|
235 |
-
return $js . $this->inline_js[$place];
|
236 |
-
}
|
237 |
-
function writeScript($out = '', $place = 'head') {
|
238 |
-
global $wok_script_manager;
|
239 |
-
if ($out == '' || !isset($wok_script_manager))
|
240 |
-
return;
|
241 |
-
$this->inline_js[$place] .= $out;
|
242 |
-
add_filter($place.'_script/manageScripts', array(&$this, "scriptConcat"), 10, 2);
|
243 |
-
}
|
244 |
-
|
245 |
-
// Regist jQuery
|
246 |
-
function addjQuery() {
|
247 |
-
global $wok_script_manager;
|
248 |
-
if (!isset($wok_script_manager))
|
249 |
-
return false;
|
250 |
-
|
251 |
-
if (function_exists('wp_register_script')) {
|
252 |
-
$wok_script_manager->registerScript('jquery', $this->plugin_url.$this->jquery_js, false, $this->jquery_ver);
|
253 |
-
wp_enqueue_script('jquery');
|
254 |
-
add_filter('print_scripts_array', array($this, 'jQueryNoConflict'), 11);
|
255 |
-
return true;
|
256 |
-
} else {
|
257 |
-
return false;
|
258 |
-
}
|
259 |
-
}
|
260 |
-
|
261 |
-
// jQuery noConflict
|
262 |
-
function jQueryNoConflict($args) {
|
263 |
-
if (function_exists('wp_register_script')) {
|
264 |
-
global $wok_script_manager;
|
265 |
-
if (!isset($wok_script_manager))
|
266 |
-
return false;
|
267 |
-
|
268 |
-
$jquerypos = array_search('jquery', $args);
|
269 |
-
if(false !== $jquerypos && in_array('prototype', $args)) {
|
270 |
-
// Need to add a no conflict call after the jquery.
|
271 |
-
wp_register_script('jquery.noconflict', $this->plugin_url.$this->jquery_noconflict_js ,array('jquery'));
|
272 |
-
array_splice( $args, $jquerypos+1, 0, 'jquery.noconflict' );
|
273 |
-
}
|
274 |
-
}
|
275 |
-
return $args;
|
276 |
-
}
|
277 |
-
|
278 |
-
// WP_CONTENT_DIR
|
279 |
-
function wp_content_dir($path = '') {
|
280 |
-
return trailingslashit( trailingslashit( defined('WP_CONTENT_DIR')
|
281 |
-
? WP_CONTENT_DIR
|
282 |
-
: trailingslashit(ABSPATH) . 'wp-content'
|
283 |
-
) . preg_replace('/^\//', '', $path) );
|
284 |
-
}
|
285 |
-
|
286 |
-
// WP_CONTENT_URL
|
287 |
-
function wp_content_url($path = '') {
|
288 |
-
return trailingslashit( trailingslashit( defined('WP_CONTENT_URL')
|
289 |
-
? WP_CONTENT_URL
|
290 |
-
: trailingslashit(get_option('siteurl')) . 'wp-content'
|
291 |
-
) . preg_replace('/^\//', '', $path) );
|
292 |
-
}
|
293 |
-
|
294 |
-
// WP_PLUGIN_DIR
|
295 |
-
function wp_plugin_dir($path = '') {
|
296 |
-
return trailingslashit($this->wp_content_dir( 'plugins/' . preg_replace('/^\//', '', $path) ));
|
297 |
-
}
|
298 |
-
|
299 |
-
// WP_PLUGIN_URL
|
300 |
-
function wp_plugin_url($path = '') {
|
301 |
-
return trailingslashit($this->wp_content_url( 'plugins/' . preg_replace('/^\//', '', $path) ));
|
302 |
-
}
|
303 |
-
|
304 |
-
}
|
305 |
-
endif;
|
306 |
-
|
307 |
-
//**************************************************************************************
|
308 |
-
// JavaScript Manager
|
309 |
-
//**************************************************************************************
|
310 |
-
if (function_exists('wp_register_script') && !class_exists('wokScriptManager')) :
|
311 |
-
class wokScriptManager {
|
312 |
-
/*
|
313 |
-
* Constructor
|
314 |
-
*/
|
315 |
-
function wokScriptManager() {
|
316 |
-
$this->__construct();
|
317 |
-
}
|
318 |
-
function __construct() {
|
319 |
-
// global $wp_scripts;
|
320 |
-
// if (!is_a($wp_scripts, 'WP_Scripts'))
|
321 |
-
// $wp_scripts = new WP_Scripts();
|
322 |
-
|
323 |
-
add_action('admin_head', array($this, 'adminHeadPrintScript'), 11);
|
324 |
-
add_action('wp_head', array($this, 'headPrintScript'), 11);
|
325 |
-
add_action('wp_footer', array($this, 'footerPrintScript'), 11);
|
326 |
-
}
|
327 |
-
|
328 |
-
function registerScript( $handle, $src = '', $deps = false, $ver = false ) {
|
329 |
-
global $wp_scripts, $wp_version;
|
330 |
-
|
331 |
-
if (version_compare($wp_version, "2.6", ">=")) {
|
332 |
-
if (isset($wp_scripts->registered[$handle])) {
|
333 |
-
if (version_compare($wp_scripts->registered[$handle]->ver, $ver, '<')) {
|
334 |
-
if ($src != '')
|
335 |
-
$wp_scripts->registered[$handle]->src = $src;
|
336 |
-
if (is_array($deps))
|
337 |
-
$wp_scripts->registered[$handle]->deps = $deps;
|
338 |
-
if ($ver != false)
|
339 |
-
$wp_scripts->registered[$handle]->ver = $ver;
|
340 |
-
}
|
341 |
-
} else {
|
342 |
-
wp_register_script($handle, $src, $deps, $ver);
|
343 |
-
}
|
344 |
-
} else {
|
345 |
-
if (isset($wp_scripts->scripts[$handle])) {
|
346 |
-
if (version_compare($wp_scripts->scripts[$handle]->ver, $ver, '<')) {
|
347 |
-
if ($src != '')
|
348 |
-
$wp_scripts->scripts[$handle]->src = $src;
|
349 |
-
if (is_array($deps))
|
350 |
-
$wp_scripts->scripts[$handle]->deps = $deps;
|
351 |
-
if ($ver != false)
|
352 |
-
$wp_scripts->scripts[$handle]->ver = $ver;
|
353 |
-
}
|
354 |
-
} else {
|
355 |
-
wp_register_script($handle, $src, $deps, $ver);
|
356 |
-
}
|
357 |
-
}
|
358 |
-
}
|
359 |
-
|
360 |
-
function dequeueScript( $handle ) {
|
361 |
-
global $wp_scripts;
|
362 |
-
$wp_scripts->dequeue( $handle );
|
363 |
-
}
|
364 |
-
|
365 |
-
function printScript($js) {
|
366 |
-
if ($js != '') {
|
367 |
-
echo "<script type=\"text/javascript\">//<![CDATA[\n";
|
368 |
-
echo $js;
|
369 |
-
echo "//]]></script>\n";
|
370 |
-
}
|
371 |
-
}
|
372 |
-
|
373 |
-
function adminHeadPrintScript() {
|
374 |
-
$this->printScript(apply_filters('admin_head_script/manageScripts', '', 'admin_head'));
|
375 |
-
}
|
376 |
-
|
377 |
-
function headPrintScript() {
|
378 |
-
$this->printScript(apply_filters('head_script/manageScripts', '', 'head'));
|
379 |
-
}
|
380 |
-
|
381 |
-
function footerPrintScript() {
|
382 |
-
$this->printScript(apply_filters('footer_script/manageScripts', '', 'footer'));
|
383 |
-
}
|
384 |
-
}
|
385 |
-
endif;
|
1 |
+
<?php
|
2 |
+
//**************************************************************************************
|
3 |
+
// Require wp-load.php or wp-config.php
|
4 |
+
//**************************************************************************************
|
5 |
+
if(!function_exists('get_option')) {
|
6 |
+
$path = (
|
7 |
+
defined('ABSPATH')
|
8 |
+
? ABSPATH
|
9 |
+
: dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/'
|
10 |
+
);
|
11 |
+
require_once(
|
12 |
+
file_exists($path.'wp-load.php')
|
13 |
+
? $path.'wp-load.php'
|
14 |
+
: $path.'wp-config.php'
|
15 |
+
);
|
16 |
+
}
|
17 |
+
|
18 |
+
//**************************************************************************************
|
19 |
+
// Common Controller
|
20 |
+
//**************************************************************************************
|
21 |
+
if (!class_exists('wokController')) :
|
22 |
+
class wokController {
|
23 |
+
var $file_path;
|
24 |
+
var $plugins_dir, $plugin_dir, $plugin_file, $plugin_url;
|
25 |
+
var $textdomain_name;
|
26 |
+
var $options, $option_name;
|
27 |
+
var $admin_option, $admin_action, $admin_hook;
|
28 |
+
var $note, $error;
|
29 |
+
var $charset;
|
30 |
+
var $wp25, $wp26, $wp27, $wp28, $wp29, $wp30, $wp31, $wp32, $wp33, $wp34;
|
31 |
+
var $inline_js;
|
32 |
+
|
33 |
+
var $jquery_js = 'includes/js/jquery-1.4.2.min.js';
|
34 |
+
var $jquery_ver = '1.4.2';
|
35 |
+
|
36 |
+
var $jquery_noconflict_js = 'includes/js/jquery.noconflict.js';
|
37 |
+
|
38 |
+
/*
|
39 |
+
* initialize
|
40 |
+
*/
|
41 |
+
function init($file) {
|
42 |
+
global $wp_version, $wok_script_manager;
|
43 |
+
|
44 |
+
$this->charset = get_option('blog_charset');
|
45 |
+
$this->wp25 = version_compare($wp_version, "2.5", ">=");
|
46 |
+
$this->wp26 = version_compare($wp_version, "2.6", ">=");
|
47 |
+
$this->wp27 = version_compare($wp_version, "2.7", ">=");
|
48 |
+
$this->wp28 = version_compare($wp_version, "2.8", ">=");
|
49 |
+
$this->wp29 = version_compare($wp_version, "2.9", ">=");
|
50 |
+
$this->wp30 = version_compare($wp_version, "3.0", ">=");
|
51 |
+
$this->wp31 = version_compare($wp_version, "3.1", ">=");
|
52 |
+
$this->wp32 = version_compare($wp_version, "3.2", ">=");
|
53 |
+
$this->wp33 = version_compare($wp_version, "3.3", ">=");
|
54 |
+
$this->wp34 = version_compare($wp_version, "3.4", ">=");
|
55 |
+
|
56 |
+
$this->setPluginDir($file);
|
57 |
+
$this->loadTextdomain();
|
58 |
+
|
59 |
+
$this->note = '';
|
60 |
+
$this->error = 0;
|
61 |
+
|
62 |
+
$this->admin_option = $this->plugin_file;
|
63 |
+
$this->admin_action =
|
64 |
+
trailingslashit(get_bloginfo('wpurl')) . 'wp-admin/'
|
65 |
+
. ($this->wp27 ? 'options-general.php' : 'admin.php')
|
66 |
+
. '?page=' . $this->admin_option;
|
67 |
+
$this->admin_hook = array();
|
68 |
+
|
69 |
+
$this->options = array();
|
70 |
+
$this->option_name = (
|
71 |
+
isset($this->plugin_name) && !empty($this->plugin_name)
|
72 |
+
? $this->plugin_name
|
73 |
+
: $this->plugin_dir ) . " Options";
|
74 |
+
|
75 |
+
if (!isset($wok_script_manager) && class_exists('wokScriptManager'))
|
76 |
+
$wok_script_manager = new wokScriptManager();
|
77 |
+
|
78 |
+
$this->inline_js = array(
|
79 |
+
'admin_head' => '',
|
80 |
+
'head' => '',
|
81 |
+
'footer' => '',
|
82 |
+
);
|
83 |
+
}
|
84 |
+
|
85 |
+
function setPluginDir($file) {
|
86 |
+
$this->file_path = $file;
|
87 |
+
$this->plugins_dir = trailingslashit(defined('PLUGINDIR') ? PLUGINDIR : 'wp-content/plugins');
|
88 |
+
$filename = explode("/", $this->file_path);
|
89 |
+
if(count($filename) <= 1) $filename = explode("\\", $this->file_path);
|
90 |
+
$this->plugin_dir = $filename[count($filename) - 2];
|
91 |
+
$this->plugin_file = $filename[count($filename) - 1];
|
92 |
+
$this->plugin_url = $this->wp_plugin_url($this->plugin_dir);
|
93 |
+
unset($filename);
|
94 |
+
}
|
95 |
+
|
96 |
+
function loadTextdomain( $sub_dir = '' ) {
|
97 |
+
$this->textdomain_name = $this->plugin_dir;
|
98 |
+
$abs_plugin_dir = $this->wp_plugin_dir($this->plugin_dir);
|
99 |
+
$sub_dir = (!empty($sub_dir)
|
100 |
+
? preg_replace('/^\//', '', $sub_dir)
|
101 |
+
: (file_exists($abs_plugin_dir.'languages') ? 'languages' : (file_exists($abs_plugin_dir.'language') ? 'language' : (file_exists($abs_plugin_dir.'lang') ? 'lang' : '')))
|
102 |
+
);
|
103 |
+
$textdomain_dir = trailingslashit(trailingslashit($this->plugin_dir) . $sub_dir);
|
104 |
+
|
105 |
+
if ($this->wp26 && defined('WP_PLUGIN_DIR'))
|
106 |
+
load_plugin_textdomain($this->textdomain_name, false, $textdomain_dir);
|
107 |
+
else
|
108 |
+
load_plugin_textdomain($this->textdomain_name, $this->plugins_dir . $textdomain_dir);
|
109 |
+
}
|
110 |
+
|
111 |
+
// Handles Add/strips slashes to the given array
|
112 |
+
function stripArray($array) {
|
113 |
+
if(!is_array($array))
|
114 |
+
return stripslashes($array);
|
115 |
+
|
116 |
+
foreach($array as $key => $value) {
|
117 |
+
if (!is_array($value))
|
118 |
+
$slashed_array[$key] = stripslashes($value);
|
119 |
+
else
|
120 |
+
$slashed_array[$key] = $this->stripArray($value);
|
121 |
+
}
|
122 |
+
return $slashed_array;
|
123 |
+
}
|
124 |
+
|
125 |
+
// Get Option
|
126 |
+
function getOption($key) {
|
127 |
+
if ($key=='version')
|
128 |
+
return (isset($this->plugin_ver) ? $this->plugin_ver : false);
|
129 |
+
else
|
130 |
+
return (isset($this->options[$key]) ? $this->options[$key] : false);
|
131 |
+
}
|
132 |
+
|
133 |
+
// Get Text
|
134 |
+
function getText($text) {
|
135 |
+
return __($text, $this->textdomain_name);
|
136 |
+
}
|
137 |
+
|
138 |
+
// Get Options
|
139 |
+
function getOptions(){
|
140 |
+
return get_option($this->option_name);
|
141 |
+
}
|
142 |
+
|
143 |
+
// Update Options
|
144 |
+
function updateOptions() {
|
145 |
+
update_option($this->option_name, $this->options);
|
146 |
+
}
|
147 |
+
|
148 |
+
// Delete Options
|
149 |
+
function deleteOptions() {
|
150 |
+
delete_option($this->option_name);
|
151 |
+
}
|
152 |
+
|
153 |
+
// Add Admin Option Page
|
154 |
+
function addOptionPage($page_title, $function, $capability = 'administrator', $menu_title = '', $file = '') {
|
155 |
+
if ($menu_title == '')
|
156 |
+
$menu_title = $page_title;
|
157 |
+
if ($file == '')
|
158 |
+
$file = $this->plugin_file;
|
159 |
+
$this->admin_hook['option'] = add_options_page($page_title, $menu_title, $capability, $file, $function);
|
160 |
+
}
|
161 |
+
|
162 |
+
function addManagementPage($page_title, $function, $capability = 'administrator', $menu_title = '', $file = '') {
|
163 |
+
if ($menu_title == '')
|
164 |
+
$menu_title = $page_title;
|
165 |
+
if ($file == '')
|
166 |
+
$file = $this->plugin_file;
|
167 |
+
$this->admin_hook['management'] = add_management_page($page_title, $menu_title, $capability, $file, $function);
|
168 |
+
}
|
169 |
+
|
170 |
+
function addThemePage($page_title, $function, $capability = 'administrator', $menu_title = '', $file = '') {
|
171 |
+
if ($menu_title == '')
|
172 |
+
$menu_title = $page_title;
|
173 |
+
if ($file == '')
|
174 |
+
$file = $this->plugin_file;
|
175 |
+
$this->admin_hook['theme'] = add_theme_page($page_title, $menu_title, $capability, $file, $function);
|
176 |
+
}
|
177 |
+
|
178 |
+
function addSubmenuPage($parent, $page_title, $function, $capability = 'administrator', $menu_title = '', $file = '') {
|
179 |
+
if ($menu_title == '')
|
180 |
+
$menu_title = $page_title;
|
181 |
+
if ($file == '')
|
182 |
+
$file = $this->plugin_file;
|
183 |
+
$this->admin_hook[$parent] = add_submenu_page($parent, $page_title, $menu_title, $capability, $file, $function);
|
184 |
+
}
|
185 |
+
|
186 |
+
function addMediaPage($page_title, $function, $capability = 'administrator', $menu_title = '', $file = '') {
|
187 |
+
$this->addSubmenuPage(($this->wp27 ? 'upload.php' : 'edit.php'), $page_title, $function, $capability, $menu_title, $file);
|
188 |
+
}
|
189 |
+
|
190 |
+
function addEditPage($page_title, $function, $capability = 'administrator', $menu_title = '', $file = '') {
|
191 |
+
$this->addSubmenuPage('edit.php', $page_title, $function, $capability, $menu_title, $file);
|
192 |
+
}
|
193 |
+
|
194 |
+
function addPluginSettingLinks($links, $file) {
|
195 |
+
$this_plugin = plugin_basename($this->file_path);
|
196 |
+
if ($file == $this_plugin) {
|
197 |
+
$settings_link = '<a href="' . $this->admin_action . '">' . __('Settings') . '</a>';
|
198 |
+
array_unshift($links, $settings_link); // before other links
|
199 |
+
}
|
200 |
+
return $links;
|
201 |
+
}
|
202 |
+
|
203 |
+
// Make Nonce field
|
204 |
+
function makeNonceField($action = -1, $name = "_wpnonce", $referer = true , $echo = true ) {
|
205 |
+
if ( !function_exists('wp_nonce_field') )
|
206 |
+
return;
|
207 |
+
else
|
208 |
+
return wp_nonce_field($action, $name, $referer, $echo);
|
209 |
+
}
|
210 |
+
|
211 |
+
// This Plugin active?
|
212 |
+
function isActive($file = '') {
|
213 |
+
$is_active = false;
|
214 |
+
if ($file == '')
|
215 |
+
$file = $this->plugin_file;
|
216 |
+
foreach ((array) get_option('active_plugins') as $val) {
|
217 |
+
if (preg_match('/'.preg_quote($file).'/i', $val)) {
|
218 |
+
$is_active = true;
|
219 |
+
break;
|
220 |
+
}
|
221 |
+
}
|
222 |
+
return $is_active;
|
223 |
+
}
|
224 |
+
|
225 |
+
// Mobile Access ?
|
226 |
+
function isKtai(){
|
227 |
+
return (
|
228 |
+
(function_exists('is_mobile') && is_mobile()) ||
|
229 |
+
(function_exists('is_ktai') && is_ktai())
|
230 |
+
);
|
231 |
+
}
|
232 |
+
|
233 |
+
// Output Javascript
|
234 |
+
function scriptConcat($js, $place) {
|
235 |
+
return $js . $this->inline_js[$place];
|
236 |
+
}
|
237 |
+
function writeScript($out = '', $place = 'head') {
|
238 |
+
global $wok_script_manager;
|
239 |
+
if ($out == '' || !isset($wok_script_manager))
|
240 |
+
return;
|
241 |
+
$this->inline_js[$place] .= $out;
|
242 |
+
add_filter($place.'_script/manageScripts', array(&$this, "scriptConcat"), 10, 2);
|
243 |
+
}
|
244 |
+
|
245 |
+
// Regist jQuery
|
246 |
+
function addjQuery() {
|
247 |
+
global $wok_script_manager;
|
248 |
+
if (!isset($wok_script_manager))
|
249 |
+
return false;
|
250 |
+
|
251 |
+
if (function_exists('wp_register_script')) {
|
252 |
+
$wok_script_manager->registerScript('jquery', $this->plugin_url.$this->jquery_js, false, $this->jquery_ver);
|
253 |
+
wp_enqueue_script('jquery');
|
254 |
+
add_filter('print_scripts_array', array($this, 'jQueryNoConflict'), 11);
|
255 |
+
return true;
|
256 |
+
} else {
|
257 |
+
return false;
|
258 |
+
}
|
259 |
+
}
|
260 |
+
|
261 |
+
// jQuery noConflict
|
262 |
+
function jQueryNoConflict($args) {
|
263 |
+
if (function_exists('wp_register_script')) {
|
264 |
+
global $wok_script_manager;
|
265 |
+
if (!isset($wok_script_manager))
|
266 |
+
return false;
|
267 |
+
|
268 |
+
$jquerypos = array_search('jquery', $args);
|
269 |
+
if(false !== $jquerypos && in_array('prototype', $args)) {
|
270 |
+
// Need to add a no conflict call after the jquery.
|
271 |
+
wp_register_script('jquery.noconflict', $this->plugin_url.$this->jquery_noconflict_js ,array('jquery'));
|
272 |
+
array_splice( $args, $jquerypos+1, 0, 'jquery.noconflict' );
|
273 |
+
}
|
274 |
+
}
|
275 |
+
return $args;
|
276 |
+
}
|
277 |
+
|
278 |
+
// WP_CONTENT_DIR
|
279 |
+
function wp_content_dir($path = '') {
|
280 |
+
return trailingslashit( trailingslashit( defined('WP_CONTENT_DIR')
|
281 |
+
? WP_CONTENT_DIR
|
282 |
+
: trailingslashit(ABSPATH) . 'wp-content'
|
283 |
+
) . preg_replace('/^\//', '', $path) );
|
284 |
+
}
|
285 |
+
|
286 |
+
// WP_CONTENT_URL
|
287 |
+
function wp_content_url($path = '') {
|
288 |
+
return trailingslashit( trailingslashit( defined('WP_CONTENT_URL')
|
289 |
+
? WP_CONTENT_URL
|
290 |
+
: trailingslashit(get_option('siteurl')) . 'wp-content'
|
291 |
+
) . preg_replace('/^\//', '', $path) );
|
292 |
+
}
|
293 |
+
|
294 |
+
// WP_PLUGIN_DIR
|
295 |
+
function wp_plugin_dir($path = '') {
|
296 |
+
return trailingslashit($this->wp_content_dir( 'plugins/' . preg_replace('/^\//', '', $path) ));
|
297 |
+
}
|
298 |
+
|
299 |
+
// WP_PLUGIN_URL
|
300 |
+
function wp_plugin_url($path = '') {
|
301 |
+
return trailingslashit($this->wp_content_url( 'plugins/' . preg_replace('/^\//', '', $path) ));
|
302 |
+
}
|
303 |
+
|
304 |
+
}
|
305 |
+
endif;
|
306 |
+
|
307 |
+
//**************************************************************************************
|
308 |
+
// JavaScript Manager
|
309 |
+
//**************************************************************************************
|
310 |
+
if (function_exists('wp_register_script') && !class_exists('wokScriptManager')) :
|
311 |
+
class wokScriptManager {
|
312 |
+
/*
|
313 |
+
* Constructor
|
314 |
+
*/
|
315 |
+
function wokScriptManager() {
|
316 |
+
$this->__construct();
|
317 |
+
}
|
318 |
+
function __construct() {
|
319 |
+
// global $wp_scripts;
|
320 |
+
// if (!is_a($wp_scripts, 'WP_Scripts'))
|
321 |
+
// $wp_scripts = new WP_Scripts();
|
322 |
+
|
323 |
+
add_action('admin_head', array($this, 'adminHeadPrintScript'), 11);
|
324 |
+
add_action('wp_head', array($this, 'headPrintScript'), 11);
|
325 |
+
add_action('wp_footer', array($this, 'footerPrintScript'), 11);
|
326 |
+
}
|
327 |
+
|
328 |
+
function registerScript( $handle, $src = '', $deps = false, $ver = false ) {
|
329 |
+
global $wp_scripts, $wp_version;
|
330 |
+
|
331 |
+
if (version_compare($wp_version, "2.6", ">=")) {
|
332 |
+
if (isset($wp_scripts->registered[$handle])) {
|
333 |
+
if (version_compare($wp_scripts->registered[$handle]->ver, $ver, '<')) {
|
334 |
+
if ($src != '')
|
335 |
+
$wp_scripts->registered[$handle]->src = $src;
|
336 |
+
if (is_array($deps))
|
337 |
+
$wp_scripts->registered[$handle]->deps = $deps;
|
338 |
+
if ($ver != false)
|
339 |
+
$wp_scripts->registered[$handle]->ver = $ver;
|
340 |
+
}
|
341 |
+
} else {
|
342 |
+
wp_register_script($handle, $src, $deps, $ver);
|
343 |
+
}
|
344 |
+
} else {
|
345 |
+
if (isset($wp_scripts->scripts[$handle])) {
|
346 |
+
if (version_compare($wp_scripts->scripts[$handle]->ver, $ver, '<')) {
|
347 |
+
if ($src != '')
|
348 |
+
$wp_scripts->scripts[$handle]->src = $src;
|
349 |
+
if (is_array($deps))
|
350 |
+
$wp_scripts->scripts[$handle]->deps = $deps;
|
351 |
+
if ($ver != false)
|
352 |
+
$wp_scripts->scripts[$handle]->ver = $ver;
|
353 |
+
}
|
354 |
+
} else {
|
355 |
+
wp_register_script($handle, $src, $deps, $ver);
|
356 |
+
}
|
357 |
+
}
|
358 |
+
}
|
359 |
+
|
360 |
+
function dequeueScript( $handle ) {
|
361 |
+
global $wp_scripts;
|
362 |
+
$wp_scripts->dequeue( $handle );
|
363 |
+
}
|
364 |
+
|
365 |
+
function printScript($js) {
|
366 |
+
if ($js != '') {
|
367 |
+
echo "<script type=\"text/javascript\">//<![CDATA[\n";
|
368 |
+
echo $js;
|
369 |
+
echo "//]]></script>\n";
|
370 |
+
}
|
371 |
+
}
|
372 |
+
|
373 |
+
function adminHeadPrintScript() {
|
374 |
+
$this->printScript(apply_filters('admin_head_script/manageScripts', '', 'admin_head'));
|
375 |
+
}
|
376 |
+
|
377 |
+
function headPrintScript() {
|
378 |
+
$this->printScript(apply_filters('head_script/manageScripts', '', 'head'));
|
379 |
+
}
|
380 |
+
|
381 |
+
function footerPrintScript() {
|
382 |
+
$this->printScript(apply_filters('footer_script/manageScripts', '', 'footer'));
|
383 |
+
}
|
384 |
+
}
|
385 |
+
endif;
|
includes/regist_ajax_libs.php
CHANGED
@@ -29,8 +29,10 @@ if (!defined('AJAX_LIBS_GOOGLE'))
|
|
29 |
if (!defined('AJAX_LIBS_YUI'))
|
30 |
define('AJAX_LIBS_YUI', true);
|
31 |
|
32 |
-
$jquery_ver = '1.
|
33 |
-
if (version_compare($wp_version, "3.
|
|
|
|
|
34 |
$jquery_ver = '1.7.2';
|
35 |
elseif (version_compare($wp_version, "3.3", ">="))
|
36 |
$jquery_ver = '1.7.1';
|
29 |
if (!defined('AJAX_LIBS_YUI'))
|
30 |
define('AJAX_LIBS_YUI', true);
|
31 |
|
32 |
+
$jquery_ver = '1.8.3';
|
33 |
+
if (version_compare($wp_version, "3.5", ">="))
|
34 |
+
$jquery_ver = '1.8.3';
|
35 |
+
elseif (version_compare($wp_version, "3.4.1", ">="))
|
36 |
$jquery_ver = '1.7.2';
|
37 |
elseif (version_compare($wp_version, "3.3", ">="))
|
38 |
$jquery_ver = '1.7.1';
|
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.
|
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.11
|
8 |
|
9 |
Cleaning tags from your WordPress header and footer.
|
10 |
|
screenshot-1.png
DELETED
Binary file
|
screenshot-2.png
DELETED
Binary file
|
uninstall.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if( !defined( 'ABSPATH') && !defined('WP_UNINSTALL_PLUGIN') )
|
4 |
+
exit();
|
5 |
+
|
6 |
+
|
7 |
+
require_once(dirname(__FILE__).'/head-cleaner.php');
|
8 |
+
|
9 |
+
if (!isset($head_cleaner))
|
10 |
+
$head_cleaner = new HeadCleaner(true);
|
11 |
+
$head_cleaner->uninstall();
|