Head Cleaner - Version 1.3.10

Version Description

Download this release

Release Info

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

Code changes from version 1.3.9 to 1.3.10

head-cleaner.php CHANGED
@@ -1,2267 +1,2271 @@
1
- <?php
2
- /*
3
- Plugin Name: Head Cleaner
4
- Version: 1.3.9
5
- Plugin URI: http://wppluginsj.sourceforge.jp/head-cleaner/
6
- Description: Cleaning tags from your WordPress header and footer.
7
- Author: wokamoto
8
- Author URI: http://dogmap.jp/
9
- Text Domain: head-cleaner
10
- Domain Path: /languages/
11
-
12
- License:
13
- Released under the GPL license
14
- http://www.gnu.org/copyleft/gpl.html
15
-
16
- Copyright 2009 - 2010 wokamoto (email : wokamoto1973@gmail.com)
17
-
18
- This program is free software; you can redistribute it and/or modify
19
- it under the terms of the GNU General Public License as published by
20
- the Free Software Foundation; either version 2 of the License, or
21
- (at your option) any later version.
22
-
23
- This program is distributed in the hope that it will be useful,
24
- but WITHOUT ANY WARRANTY; without even the implied warranty of
25
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
- GNU General Public License for more details.
27
-
28
- You should have received a copy of the GNU General Public License
29
- along with this program; if not, write to the Free Software
30
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31
-
32
- Includes:
33
- PHP Simple HTML DOM Parser Ver.1.11
34
- http://sourceforge.net/projects/simplehtmldom/
35
- Licensed under The MIT License
36
-
37
- jsmin.php - PHP implementation of Douglas Crockford's JSMin. Ver.1.1.1 (2008-03-02)
38
- Copyright (c) 2002 Douglas Crockford <douglas@crockford.com> (jsmin.c)
39
- Copyright (c) 2008 Ryan Grove <ryan@wonko.com> (PHP port)
40
- License http://opensource.org/licenses/mit-license.php MIT License
41
-
42
- CSSTidy - CSS Parser and Optimiser Ver.1.3
43
- @author Florian Schmitz (floele at gmail dot com) 2005-2006
44
- @license http://opensource.org/licenses/gpl-license.php GNU Public License
45
- */
46
-
47
- if (version_compare(phpversion(), "5.0.0", "<"))
48
- return false;
49
-
50
- //**************************************************************************************
51
- // Defines
52
- //**************************************************************************************
53
- if (!defined('HC_PRIORITY'))
54
- define('HC_PRIORITY', 10000);
55
- if (!define('HC_ANALYZE_EXPIRED'))
56
- define('HC_ANALYZE_EXPIRED', 604800); // 60 * 60 * 24 * 7 [sec.]
57
- if (!define('HC_XMLNS'))
58
- define('HC_XMLNS', 'http://www.w3.org/1999/xhtml');
59
- if (!define('HC_CACHE_DIR'))
60
- define('HC_CACHE_DIR', 'cache/head-cleaner');
61
-
62
- //**************************************************************************************
63
- if (!defined('ABSPATH') && strstr($_SERVER['PHP_SELF'], '/head-cleaner.php')) {
64
- define('HC_EXPIRED_JS_CSS', 2592000); // 60 * 60 * 24 * 30 [sec.]
65
-
66
- $error = false;
67
- if (isset($_GET['f']) && isset($_GET['t'])) {
68
- $cache_dir = realpath(dirname(__FILE__) . '/../../' . HC_CACHE_DIR) . '/';
69
- $filename_hash = trim(stripslashes($_GET['f']));
70
- $type = trim(stripslashes($_GET['t']));
71
-
72
- if (strlen($filename_hash) == 32 && ($type == 'js' || $type == 'css')) {
73
- $is_gzip = (strpos(strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') !== FALSE);
74
- $ob_gzip = false;
75
-
76
- $filename = "{$cache_dir}{$type}/{$filename_hash}.{$type}";
77
- if ($is_gzip && file_exists($filename.'.gz'))
78
- $filename .= '.gz';
79
- else
80
- $ob_gzip = $is_gzip;
81
-
82
- if (file_exists($filename)) {
83
- $offset = (!defined('HC_EXPIRED_JS_CSS') ? HC_EXPIRED_JS_CSS : 60 * 60 * 24 * 30);
84
- $content_type = 'text/' . ($type == 'js' ? 'javascript' : $type);
85
-
86
- header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($filename)).' GMT');
87
- header('Expires: '.gmdate('D, d M Y H:i:s', time() + $offset).' GMT');
88
- header("Content-type: $content_type");
89
-
90
- if ($is_gzip)
91
- header('Content-Encoding: gzip');
92
-
93
- if ($ob_gzip)
94
- ob_start("ob_gzhandler");
95
-
96
- readfile($filename);
97
-
98
- if ($ob_gzip)
99
- ob_end_flush();
100
-
101
- $error = false;
102
- } else {
103
- $error = 404;
104
- }
105
- } else {
106
- $error = 403;
107
- }
108
- } else {
109
- $error = 403;
110
- }
111
-
112
- if ( $error === FALSE ) {
113
- exit();
114
- } else {
115
- if(!function_exists('get_option')) {
116
- $path = (defined('ABSPATH') ? ABSPATH : dirname(dirname(dirname(dirname(__FILE__)))) . '/');
117
- require_once(file_exists($path.'wp-load.php') ? $path.'wp-load.php' : $path.'wp-config.php');
118
- }
119
-
120
- $err_msg = "Unknown Error";
121
- switch ($error) {
122
- case 403:
123
- header("HTTP/1.0 403 Forbidden");
124
- $err_msg = "403 : Forbidden";
125
- break;
126
- case 404:
127
- header('HTTP/1.1 404 Not Found');
128
- $err_msg = "404 : Not Found";
129
- break;
130
- default:
131
- break;
132
- }
133
-
134
- if (function_exists('wp_die')) {
135
- wp_die($err_msg);
136
- } else {
137
- echo $err_msg;
138
- die();
139
- }
140
- }
141
- }
142
-
143
- //**************************************************************************************
144
- // Require
145
- //**************************************************************************************
146
- if (!class_exists('wokController') || !class_exists('wokScriptManager'))
147
- require(dirname(__FILE__).'/includes/common-controller.php');
148
-
149
- //**************************************************************************************
150
- // Head Cleaner
151
- //**************************************************************************************
152
- class HeadCleaner extends wokController {
153
- public $plugin_name = 'head-cleaner';
154
- public $plugin_ver = '1.3.9';
155
-
156
- // Deafault Options
157
- private $options_default = array(
158
- 'foot_js' => false ,
159
- 'dynamic' => false ,
160
- 'js_move_foot' => false ,
161
- 'cache_enabled' => false ,
162
- 'combined_css' => false ,
163
- 'combined_js' => false ,
164
- 'js_minify' => false ,
165
- 'css_optimise' => false ,
166
- 'csstidy_option' => array(
167
- 'optimise_shorthands' => 1 ,
168
- 'compress_colors' => true ,
169
- 'compress_font_weight' => true ,
170
- 'remove_bslash' => true ,
171
- 'template' => 1 ,
172
- ) ,
173
- 'default_media' => 'all' ,
174
- 'debug_mode' => false ,
175
- 'filters' => array('wp_head' => array(), 'wp_footer' => array()) ,
176
- 'priority' => array('wp_head' => array(), 'wp_footer' => array()) ,
177
- 'head_js' => array() ,
178
- 'remove_js' => array() ,
179
- 'analyze_expired'=> 0 ,
180
- 'xml_declaration'=> false ,
181
- 'ie_conditional' => false ,
182
- 'canonical_tag' => true ,
183
- 'gzip_on' => false ,
184
- 'use_ajax_libs' => false ,
185
- );
186
- private $csstidy_template = array(
187
- 'low_compression' ,
188
- 'default' ,
189
- 'high_compression' ,
190
- 'highest_compression' ,
191
- );
192
-
193
- private $wp_url = '';
194
- private $self_url = '';
195
- private $cache_path = '';
196
- private $cache_url = '';
197
-
198
- private $lang;
199
- private $foot_js_src;
200
-
201
- private $mtime_start;
202
-
203
- private $filters;
204
- private $head_js;
205
- private $no_conflict = array(
206
- 'comment_quicktags' , // Comment Quicktags
207
- 'stats_footer' , // WordPress.com Stats
208
- 'uga_wp_footer_track' , // Ultimate Google Analytics
209
- 'tam_google_analytics::insert_tracking_code' , // TaM Google Analytics
210
- 'Ktai_Entry::add_check_messages' , // Ktai Entry
211
- );
212
-
213
- private $default_head_filters = array(
214
- 'HeadCleaner::.*' ,
215
- 'noindex' ,
216
- 'lambda_[\d]+' ,
217
- 'rsd_link' ,
218
- 'wlwmanifest_link' ,
219
- 'wp_generator' ,
220
- );
221
-
222
- private $ob_handlers = array(
223
- 'All_in_One_SEO_Pack::output_callback_for_title' => false ,
224
- 'wpSEO::exe_modify_content' => false ,
225
- );
226
-
227
-
228
- /**********************************************************
229
- * Constructor
230
- ***********************************************************/
231
- public function HeadCleaner() {
232
- $this->__construct();
233
- }
234
- public function __construct() {
235
- $this->init(__FILE__);
236
- $this->options = $this->_init_options($this->getOptions());
237
- $this->filters = $this->options['filters'];
238
- $this->head_js = $this->options['head_js'];
239
-
240
- $this->wp_url = trailingslashit(get_bloginfo('wpurl'));
241
- $this->self_url = str_replace(ABSPATH, $this->wp_url, __FILE__);
242
- $this->lang = (defined('WPLANG') ? WPLANG : 'ja');
243
- $this->charset = get_option('blog_charset');
244
- $this->_get_filters('wp_head');
245
- $this->_get_filters('wp_footer');
246
-
247
- // Create Directory for Cache
248
- if ( $this->options['cache_enabled'] ) {
249
- $this->cache_path = $this->_create_cache_dir();
250
- if ($this->cache_path !== FALSE) {
251
- $this->cache_url = str_replace(ABSPATH, $this->wp_url, $this->cache_path);
252
- } else {
253
- $this->options['cache_enabled'] = false;
254
-
255
- $this->options['combined_css'] = false;
256
- $this->options['combined_js'] = false;
257
-
258
- $this->options['js_minify'] = false;
259
- $this->options['css_optimise'] = false;
260
- }
261
- }
262
-
263
- if (is_admin()) {
264
- add_action('admin_menu', array(&$this, 'admin_menu'));
265
- add_filter('plugin_action_links', array(&$this, 'plugin_setting_links'), 10, 2 );
266
-
267
- } else {
268
- // Require PHP Libraries
269
- $this->_require_libraries();
270
-
271
- add_action('get_header', array(&$this, 'head_start'));
272
- add_action('wp_footer', array(&$this, 'filters_save'), 11);
273
-
274
- // remove_filter('the_content', 'wpautop');
275
- // remove_filter('the_content', 'wptexturize');
276
- // add_filter('the_content', array(&$head_cleaner, 'raw_formatter'), 99);
277
-
278
- // remove_filter('the_excerpt', 'wpautop');
279
- // remove_filter('the_excerpt', 'wptexturize');
280
- // add_filter('the_excerpt', array(&$head_cleaner, 'raw_formatter'), 99);
281
- }
282
- }
283
-
284
- /**********************************************************
285
- * Init Options
286
- ***********************************************************/
287
- private function _init_options($wk_options = '') {
288
- if (!is_array($wk_options))
289
- $wk_options = array();
290
-
291
- foreach ($this->options_default as $key => $val) {
292
- $wk_options[$key] = (isset($wk_options[$key]) ? $wk_options[$key] : $val);
293
- }
294
-
295
- if (time() > $wk_options['analyze_expired']) {
296
- $filters = $this->options_default['filters'];
297
-
298
- $priority = $this->options_default['priority'];
299
- foreach ($wk_options['priority'] as $tag => $filters) {
300
- foreach ((array) $filters as $key => $val) {
301
- if ($val <= 0 || $val > HC_PRIORITY)
302
- $priority[$tag][$key] = $val;
303
- }
304
- }
305
- unset($filters);
306
-
307
- $head_js = $this->options_default['head_js'];
308
- foreach ((array) $wk_options['head_js'] as $key => $val) {
309
- if ($val === FALSE)
310
- $head_js[$key] = $val;
311
- }
312
-
313
- $wk_options['filters'] = $filters;
314
- $wk_options['priority'] = $priority;
315
- $wk_options['head_js'] = $head_js;
316
- $wk_options['analyze_expired'] = time() + HC_ANALYZE_EXPIRED;
317
- }
318
- return $wk_options;
319
- }
320
-
321
- /**********************************************************
322
- * Require Libraries
323
- ***********************************************************/
324
- private function _require_libraries(){
325
- $includes = dirname(__FILE__) . '/includes/';
326
-
327
- // PHP Simple HTML DOM Parser
328
- if (!function_exists('str_get_html'))
329
- require($includes . 'simple_html_dom.php' );
330
-
331
- // jsmin.php - PHP implementation of Douglas Crockford's JSMin.
332
- if ($this->options['js_minify'] && !class_exists('JSMin')) {
333
- require($includes . 'JSMin.php');
334
- $this->options['js_minify'] = class_exists('JSMin') && $this->options['js_minify'];
335
- }
336
-
337
- // // CSSTidy - CSS Parser and Optimiser
338
- // if ($this->options['css_optimise'] && !class_exists('csstidy')) {
339
- // require($includes . 'csstidy-1.3/class.csstidy.php');
340
- // $this->options['css_optimise'] = class_exists('csstidy') && $this->options['css_optimise'];
341
- // }
342
- if ($this->options['css_optimise'] && !class_exists('Minify_CSS')) {
343
- require($includes . 'CSSMin.php');
344
- $this->options['css_optimise'] = class_exists('Minify_CSS') && $this->options['css_optimise'];
345
- }
346
-
347
- // Use Google Ajax Libraries
348
- if ($this->options['use_ajax_libs'])
349
- require($includes . 'regist_ajax_libs.php');
350
- }
351
-
352
- //**************************************************************************************
353
- // plugin activation
354
- //**************************************************************************************
355
- public function activation(){
356
- $cache_dir = $this->_create_cache_dir();
357
- if ( $cache_dir !== FALSE )
358
- $this->_create_htaccess($cache_dir);
359
- }
360
-
361
- //**************************************************************************************
362
- // plugin deactivation
363
- //**************************************************************************************
364
- public function deactivation(){
365
- // $this->_remove_cache_file();
366
- }
367
-
368
- //**************************************************************************************
369
- // ob_start for Header
370
- //**************************************************************************************
371
- public function head_start(){
372
- if (! $this->_is_mobile() ) {
373
- $ob_handlers = (array) ob_list_handlers();
374
- if ( count($ob_handlers) > 0 ) {
375
- foreach ( $ob_handlers as $ob_handler ) {
376
- if ( isset($this->ob_handlers[$ob_handler]) ) {
377
- $this->ob_handlers[$ob_handler] = true;
378
- ob_end_flush();
379
- }
380
- }
381
- }
382
-
383
- ob_start(array(&$this, 'head_cleaner'));
384
- $this->mtime_start = microtime();
385
-
386
- if ( function_exists('rel_canonical') && !$this->options['canonical_tag'] )
387
- remove_action( 'wp_head', 'rel_canonical' );
388
-
389
- add_action('wp_head', array(&$this, 'end'), HC_PRIORITY);
390
- $this->_get_filters('wp_head');
391
- $this->_change_filters_priority('wp_head');
392
-
393
- if ($this->options['foot_js'])
394
- add_action('wp_footer', array(&$this, 'footer_start'), 1);
395
- }
396
- }
397
-
398
- //**************************************************************************************
399
- // ob_start for footer
400
- //**************************************************************************************
401
- public function footer_start(){
402
- if (! $this->_is_mobile() && $this->options['foot_js'] ) {
403
- $ob_handlers = (array) ob_list_handlers();
404
- if ( count($ob_handlers) > 0 ) {
405
- foreach ( $ob_handlers as $ob_handler ) {
406
- if ( isset($this->ob_handlers[$ob_handler]) ) {
407
- $this->ob_handlers[$ob_handler] = true;
408
- ob_end_flush();
409
- }
410
- }
411
- }
412
-
413
- ob_start(array(&$this, 'footer_cleaner'));
414
- $this->mtime_start = microtime();
415
-
416
- add_action('wp_footer', array(&$this, 'end'), HC_PRIORITY);
417
- $this->_get_filters('wp_footer');
418
- $this->_change_filters_priority('wp_footer');
419
- }
420
- }
421
-
422
- //**************************************************************************************
423
- // ob_handler
424
- //**************************************************************************************
425
- private function ob_handler($content){
426
- foreach ( $this->ob_handlers as $ob_handler => $enable ) {
427
- if ( $enable ) {
428
- switch ($ob_handler) {
429
- case 'All_in_One_SEO_Pack::output_callback_for_title':
430
- global $aiosp;
431
- if ( isset($aiosp) )
432
- $content = $aiosp->rewrite_title($content);
433
- break;
434
- case 'wpSEO::exe_modify_content':
435
- if ( isset($GLOBALS['wpSEO']) ) {
436
- $wpSEO = $GLOBALS['wpSEO'];
437
- $content = $wpSEO->exe_modify_content($content);
438
- }
439
- break;
440
- default :
441
- break;
442
- }
443
- $this->ob_handlers[$ob_handler] = false;
444
- }
445
- }
446
-
447
- return $content;
448
- }
449
-
450
- //**************************************************************************************
451
- // ob_end_flush
452
- //**************************************************************************************
453
- public function end(){
454
- ob_end_flush();
455
- }
456
-
457
- //**************************************************************************************
458
- // filters info save
459
- //**************************************************************************************
460
- public function filters_save(){
461
- if ($this->_chk_filters_update()) {
462
- if ( $this->options['filters'] != $this->filters || $this->options['head_js'] != $this->head_js ) {
463
- $this->options['filters'] = $this->filters;
464
- $this->options['head_js'] = $this->head_js;
465
- if (time() > $this->options['analyze_expired'])
466
- $this->options['analyze_expired'] = time() + HC_ANALYZE_EXPIRED;
467
- $this->updateOptions();
468
- }
469
- }
470
- }
471
-
472
- //**************************************************************************************
473
- // head cleaner
474
- //**************************************************************************************
475
- public function head_cleaner($buffer) {
476
- if (!function_exists('str_get_html'))
477
- return trim($buffer) . "\n";
478
-
479
- $buffer = $this->ob_handler($buffer);
480
-
481
- $url = $this->_get_permalink();
482
-
483
- $xml_head = "<?xml version=\"1.0\" encoding=\"{$this->charset}\"?>\n";
484
- $html_tag = "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"{$this->lang}\" lang=\"{$this->lang}\">\n";
485
- $head_tag = "<head profile=\"http://gmpg.org/xfn/11\">\n";
486
- $head_txt = trim($buffer);
487
-
488
- $ret_val = '';
489
- $meta_tag = ''; $title_tag = ''; $base_tag = '';
490
- $link_tag = ''; $object_tag = ''; $other_tag = '';
491
- $css_tag = ''; $inline_css = '';
492
- $script_tag = ''; $inline_js = '';
493
-
494
- // for IE conditional tag
495
- $IE_conditional_tag_pattern = '/<\!-+[ \t]*\[if[ \t]+%sIE%s[ \t]*?\][ \t]*>(.*?)<\![ \t]*\[endif\][ \t]*-+>/ism';
496
- $IE_conditional_tags = array();
497
- if ($this->options['ie_conditional']) {
498
- $ua = trim(strtolower($_SERVER['HTTP_USER_AGENT']));
499
- $ie = (strpos($ua, 'msie') !== false)
500
- && (! preg_match('/(gecko|applewebkit|opera|sleipnir|chrome)/i', $ua));
501
- $ie_ver = ($ie ? preg_replace('/^.*msie +([\d\.]+);.*$/i', '$1', $ua) : false);
502
- $ie6 = ($ie ? version_compare($ie_ver, '7.0', '<') : false);
503
- if ($ie) {
504
- $head_txt = preg_replace(sprintf($IE_conditional_tag_pattern, '', ''), '$1', $head_txt);
505
-
506
- $replace_patterns = array();
507
- if (version_compare($ie_ver, '5.5', '<')) { // IE 5
508
- $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)', ' 5\.?0?'); // >= 5, <= 5, = 5
509
- $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)', ' 5\.5'); // < 5.5, <= 5.5
510
- $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)', ' [678]\.?0?'); // < 6 - 8, <= 6 - 8
511
- } elseif (version_compare($ie_ver, '6.0', '<')) { // IE 5.5
512
- $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)', ' 5\.5'); // >= 5.5, <= 5.5, = 5.5
513
- $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)', ' [678]\.?0?'); // < 6 - 8, <= 6 - 8
514
- $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' 5\.?0?'); // > 5, >= 5
515
- } elseif (version_compare($ie_ver, '7.0', '<')) { // IE 6
516
- $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)', ' 6\.?0?'); // >= 6, <= 6, = 6
517
- $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)', ' [78]\.?0?'); // < 7 - 8, <= 7 - 8
518
- $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' 5\.?0?'); // > 5, >= 5
519
- $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' 5\.5'); // > 5.5, >= 5.5
520
- } elseif (version_compare($ie_ver, '8.0', '<')) { // IE 7
521
- $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)', ' 7\.?0?'); // >= 7, <= 7, = 7
522
- $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)', ' 8\.?0?'); // < 8, <= 8
523
- $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' [56]\.?0?'); // > 5 - 6, >= 5 - 6
524
- $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' 5\.5'); // > 5.5, >= 5.5
525
- } elseif (version_compare($ie_ver, '9.0', '<')) { // IE 8
526
- $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)', ' 8\.?0?'); // >= 8, <= 8, = 8
527
- $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' [567]\.?0?'); // > 5 - 7, >= 5 - 7
528
- $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' 5\.5'); // > 5.5, >= 5.5
529
- }
530
-
531
- if (count($replace_patterns) > 0)
532
- $head_txt = preg_replace($replace_patterns, '$2', $head_txt);
533
- unset($replace_patterns);
534
- }
535
- } else {
536
- $search_pattern = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*)?', '([ \t]+[05678\.]*)?');
537
- preg_match_all($search_pattern, $head_txt, $IE_conditional_tags, PREG_PATTERN_ORDER);
538
- $head_txt = preg_replace($search_pattern, '', $head_txt);
539
- }
540
-
541
- if (preg_match('/^(.*)(<html[^>]*>[^<]*)(<head[^>]*>[^<]*)(.*)$/ism', $head_txt, $matches)) {
542
- $ret_val = trim($matches[1]) . "\n";
543
- $html_tag = trim($matches[2]) . "\n";
544
- $head_tag = trim($matches[3]) . "\n";
545
- $head_txt = trim($matches[4]) . "\n";
546
- }
547
- unset($matches);
548
- $html_txt = $xml_head . $html_tag . $head_tag
549
- . $head_txt
550
- . '</head><body></body></html>';
551
-
552
- // Get Simple DOM Object
553
- $dom = str_get_html($html_txt);
554
- if ($dom === false)
555
- return (trim($buffer)."\n");
556
-
557
- $xmlns = (defined('HC_XMLNS') ? HC_XMLNS : 'http://www.w3.org/1999/xhtml');
558
- $xml_lang = $this->lang;
559
- $lang = $this->lang;
560
- if (preg_match_all('/ +([^ ]*)=[\'"]([^\'"]*)[\'"]/', $html_tag, $mathes, PREG_SET_ORDER)) {
561
- foreach ((array) $matches as $match) {
562
- switch ($match[1]){
563
- case 'xmlns': $xmlns = $match[2]; break;
564
- case 'xml:lang': $xml_lang = $match[2]; break;
565
- case 'lang': $lang = $match[2]; break;
566
- }
567
- }
568
- unset($match);
569
- }
570
- unset($matches);
571
- $html_tag = "<html xmlns=\"{$xmlns}\" xml:lang=\"{$xml_lang}\" lang=\"{$lang}\">\n";
572
-
573
- $meta_tag = $this->_dom_to_html($dom->find("meta"));
574
- $title_tag = $this->_dom_to_html($dom->find("title"), 1);
575
- $base_tag = $this->_dom_to_html($dom->find("base"), 1);
576
- $link_tag = $this->_dom_to_html($dom->find("link[rel!='stylesheet']"));
577
- if (count($dom->find("link[rel='canonical']")) <= 0 && $this->options['canonical_tag'])
578
- $link_tag .= '<link rel="canonical" href="' . htmlspecialchars($url, ENT_QUOTES) . '" />'."\n";
579
-
580
- $css_tag = ''; $css_tag_with_id = ''; $inner_css = ''; $css_src = array();
581
- $elements = $dom->find("link[rel='stylesheet']");
582
- foreach ((array) $elements as $element) {
583
- $tag = trim($element->outertext);
584
- if (strpos($css_tag, $tag) === FALSE) {
585
- if (strpos($element->href, $this->wp_url) === FALSE) {
586
- $css_tag .= trim($tag) . "\n";
587
- } elseif ( isset($element->id) && !empty($element->id) ) {
588
- $css_tag_with_id .= trim($tag) . "\n";
589
- } else {
590
- $media = trim( isset($element->media) ? $element->media : $this->options['default_media'] );
591
- $media = ( empty($media) || is_null($media) || $media === FALSE ? $this->options['default_media'] : $media );
592
- $inner_css .= trim($tag) . "\n";
593
- $css_src[$media][] = $element->href;
594
- }
595
- }
596
- }
597
- unset($element); unset($elements);
598
-
599
- $elements = $dom->find("style");
600
- $wk_inline_css = array();
601
- foreach ((array) $elements as $element) {
602
- $media = trim( isset($element->media) ? $element->media : $this->options['default_media'] );
603
- $media = ( empty($media) || is_null($media) || $media === FALSE ? $this->options['default_media'] : $media );
604
- $wk_text = $this->_remove_comment($element->innertext, 'css');
605
- if ( preg_match_all('/@import[\s]+url[\s]*\([\s\'"]*([^\)\'"]*?)[\s\'"]*\);/i', $wk_text, $wk_matches, PREG_SET_ORDER) ) {
606
- foreach ($wk_matches as $val) {
607
- $wk_text = trim(str_replace( $val[0], '', $wk_text));
608
- $href = trim($val[1]);
609
- $tag = "<link rel=\"stylesheet\" href=\"{$href}\" type=\"text/css\" media=\"{$media}\" />";
610
- if (strpos( $href, $this->wp_url) === FALSE) {
611
- $css_tag .= $tag . "\n";
612
- } else {
613
- $inner_css .= $tag . "\n";
614
- $css_src[$media][] = $href;
615
- }
616
- }
617
- }
618
- unset($wk_matches);
619
- if ( !empty($wk_text) )
620
- $wk_inline_css[$media] .= trim($wk_text) . "\n";
621
- }
622
- $inline_css = '';
623
- if ($this->options['cache_enabled']) {
624
- if ($this->options['combined_css']) {
625
- $css_tag = trim($css_tag) . "\n";
626
- foreach ($css_src as $key => $val) {
627
- $inner_css = $this->_combined_css($val, trim(isset($wk_inline_css[$key]) ? $wk_inline_css[$key] : '' ), $key);
628
- $css_tag .= trim($inner_css) . "\n" . trim($css_tag_with_id) . "\n";
629
- if (isset($wk_inline_css[$key])) $wk_inline_css[$key] = '';
630
- }
631
- foreach ($wk_inline_css as $key => $val) {
632
- $val = trim($val);
633
- if (!empty($val)) {
634
- $inner_css = $this->_combined_css(array(), $val, $key);
635
- $css_tag .= trim($inner_css) . "\n";
636
- }
637
- }
638
- } else {
639
- $css_tag = trim($css_tag) . "\n" . trim($inner_css) . "\n" . trim($css_tag_with_id) . "\n";
640
- foreach ($wk_inline_css as $key => $val) {
641
- $val = trim($val);
642
- if (!empty($val)) {
643
- $inner_css = $this->_combined_inline_css(trim($val), $key);
644
- $inline_css .= trim($inner_css) . "\n";
645
- }
646
- }
647
- }
648
- } else {
649
- $css_tag = trim($css_tag) . "\n" . trim($inner_css) . "\n" . trim($css_tag_with_id) . "\n";
650
- foreach ($wk_inline_css as $key => $val) {
651
- $val = trim($val);
652
- if (!empty($val)) {
653
- $inline_css .=
654
- '<style type="text/css"' . (!empty($media) ? " media=\"{$media}\"" : '') . ">/*<![CDATA[ */\n" .
655
- $val .
656
- "\n/* ]]>*/</style>\n";
657
- }
658
- }
659
- }
660
- $css_tag = trim($css_tag) . (!empty($css_tag) ? "\n" : '');
661
- $inner_css = trim($inner_css) . (!empty($inner_css) ? "\n" : '');
662
- $inline_css = trim($inline_css) . (!empty($inline_css) ? "\n" : '');
663
- unset($wk_inline_css);
664
- unset($element); unset($elements);
665
-
666
- $inner_js = '';
667
- $foot_js = '';
668
- $js_src = array();
669
- $js_libs = array();
670
- $elements = $dom->find("script");
671
- foreach ((array) $elements as $element) {
672
- if (!isset($element->src)) {
673
- $inline_js .= $this->_remove_comment($element->innertext, 'js');
674
- } else {
675
- $src = trim($element->src);
676
- if (!isset($this->head_js[$src]))
677
- $this->head_js[$src] = true;
678
-
679
- if (array_search( $src, (array) $this->options['remove_js']) === FALSE) {
680
- $find = FALSE;
681
- if (preg_match('/\/((prototype|jquery|mootools)\.js)\?ver=([\.\d]+)[^\?]*$/i', $src, $matches)) {
682
- list($find, $filename, $product, $version) = $matches;
683
- } elseif (preg_match('/\/((prototype|jquery|mootools)[\-\.](min|[\.\d]+)[^\/]*\.js)\?[^\?]*$/i', $src, $matches)) {
684
- list($find, $filename, $product, $version) = $matches;
685
- } elseif (preg_match('/\/scriptaculous\/((builder|controls|dragdrop|effects|wp\-scriptaculous|scriptaculous|slider|sound|unittest)\.js)\?ver\=([\.\d]+)[^\?]*$/i', $src, $matches)) {
686
- list($find, $filename, $product, $version) = $matches;
687
- $product = (strpos($product, 'scriptaculous') === FALSE
688
- ? 'scriptaculous/' . $product
689
- : 'scriptaculous/scriptaculous');
690
- }
691
- unset($matches);
692
-
693
- if ($find !== FALSE) {
694
- $version = trim(substr($version, -1) === '.' ? substr($version, 0, -1) : $version);
695
- if (empty($version))
696
- $version = preg_replace('/^.*\/([\.\d]+)\/.*$/', '$1', $src);
697
- if (!preg_match('/^[\.\d]*\d$/', $version))
698
- $version = '1';
699
- $js_libs[$product][$version] = $src;
700
- } elseif ($this->head_js[$src] === FALSE) {
701
- $foot_js .= trim($element->outertext) . "\n";
702
- } elseif (strpos($src, $this->wp_url) === FALSE) {
703
- $script_tag .= trim($element->outertext) . "\n";
704
- } else {
705
- $inner_js .= trim($element->outertext) . "\n";
706
- $js_src[] = $element->src;
707
- }
708
- }
709
- }
710
- }
711
- unset($element); unset($elements);
712
-
713
- // JavaScript FrameWork (Prototype.js > jQuery > mootools)
714
- if (count($js_libs) > 0) {
715
- list($js_libs_src, $wk_inner_js, $wk_outer_js) = $this->_js_framework($js_libs);
716
-
717
- if (count($js_libs_src) > 0)
718
- $js_src = array_merge($js_libs_src, $js_src);
719
-
720
- $script_tag = trim($script_tag) . "\n" . $wk_outer_js;
721
- $inner_js = $wk_inner_js . $inner_js;
722
-
723
- unset($js_libs_src); unset($js_libs);
724
- }
725
-
726
- $inline_js = trim($inline_js);
727
- if ($this->options['cache_enabled']) {
728
- if ($this->options['combined_js']) {
729
- $inner_js = $this->_combined_javascript($js_src, trim($inline_js));
730
- $script_tag = trim(trim($script_tag) . "\n" . $inner_js) . "\n";
731
- $inline_js = '';
732
- } else {
733
- $script_tag = trim(trim($script_tag) . "\n" . $inner_js) . "\n";
734
- $inline_js = $this->_combined_inline_javascript(trim($inline_js));
735
- }
736
- } else {
737
- $script_tag = trim(trim($script_tag) . "\n" . $inner_js) . "\n";
738
- $inline_js = (!empty($inline_js) ? "<script type=\"text/javascript\">//<![CDATA[\n{$inline_js}\n//]]></script>\n" : '');
739
- }
740
- $script_tag = trim($script_tag) . (!empty($script_tag) ? "\n" : '');
741
- $inner_js = trim($inner_js) . (!empty($inner_js) ? "\n" : '');
742
- $inline_js = trim($inline_js) . (!empty($inline_js) ? "\n" : '');
743
- $foot_js = trim($foot_js) . (!empty($foot_js) ? "\n" : '');
744
-
745
- $object_tag = $this->_dom_to_html($dom->find("object"));
746
-
747
- $dom->clear(); unset($dom);
748
-
749
- // for IE conditional tag
750
- if (!$this->options['ie_conditional'] && count($IE_conditional_tags) > 0) {
751
- $IE_conditional_tag_pattern = '/(<\!-+[ \t]*\[if[ \t]+.*IE.*[ \t]*?\][ \t]*>)[ \t\r\n]*(.*?)[ \t\r\n]*(<\![ \t]*\[endif\][ \t]*-+>)/ism';
752
- foreach ((array) $IE_conditional_tags as $IE_conditional_tag) {
753
- if (preg_match($IE_conditional_tag_pattern, $IE_conditional_tag[0])) {
754
- $IE_tag = trim(preg_replace($IE_conditional_tag_pattern, "$1\n$2\n$3", $IE_conditional_tag[0])) . "\n";
755
- if ( strpos(strtolower($IE_tag), '<link') !== false )
756
- $css_tag = trim($css_tag) . "\n" . $IE_tag;
757
- elseif ( strpos(strtolower($IE_tag), '<style') !== false )
758
- $inline_css = trim($inline_css) . "\n" . $IE_tag;
759
- elseif ( strpos(strtolower($IE_tag), '<script') !== false )
760
- $inline_js = trim($inline_js) . "\n" . $IE_tag;
761
- else
762
- $object_tag = trim($object_tag) . "\n" . $IE_tag;
763
- }
764
- }
765
- }
766
- unset($IE_conditional_tag);
767
-
768
- $ret_val .=
769
- $html_tag
770
- . $head_tag
771
- . $meta_tag
772
- . $title_tag
773
- . $base_tag
774
- . $link_tag
775
- . $css_tag
776
- . $inline_css
777
- . (!$this->options['js_move_foot'] ? $script_tag : '')
778
- . (!$this->options['js_move_foot'] ? $inline_js : '')
779
- . $object_tag
780
- ;
781
- //$ret_val = str_replace('\'', '"', $ret_val);
782
- $ret_val = preg_replace(
783
- array( "/[\s]+([^\=]+)\='([^']*)'/i", '/[\n\r]+/i', '/(<\/[^>]+>)[ \t]*(<[^>]+)/i' ) ,
784
- array( ' $1="$2"', "\n", "$1\n$2" ),
785
- $ret_val
786
- );
787
-
788
- if ($this->options['js_move_foot'] || !empty($foot_js))
789
- $this->foot_js_src = trim(
790
- $foot_js
791
- . ($this->options['js_move_foot'] ? $script_tag : '')
792
- . ($this->options['js_move_foot'] ? $inline_js : '')
793
- );
794
- if (!empty($this->foot_js_src)) {
795
- $this->foot_js_src .= "\n";
796
- add_action('wp_footer', array(&$this, 'footer'), 9);
797
- }
798
-
799
- if ($this->options['dynamic']) {
800
- $ret_val = preg_replace(
801
- '/' . preg_quote($this->cache_url, '/') . '(js|css)\/([^\.]*)\.(js|css)/i' ,
802
- $this->self_url . "?f=$2&amp;t=$3" ,
803
- $ret_val
804
- );
805
- }
806
-
807
- $ret_val = ($ie6 || !$this->options['xml_declaration']
808
- ? preg_replace('/^<\?xml[^>]*>/i', '', $ret_val)
809
- : (strpos($ret_val, '<?xml') === false ? $xml_head : '') . $ret_val
810
- );
811
- $ret_val = trim($ret_val) . "\n";
812
-
813
- if ($this->options['debug_mode'])
814
- $ret_val .= $this->_get_debug_info($buffer);
815
-
816
- return $ret_val;
817
- }
818
-
819
- //**************************************************************************************
820
- // JavaScript Moved bottom
821
- //**************************************************************************************
822
- public function footer(){
823
- echo $this->foot_js_src;
824
- }
825
-
826
- //**************************************************************************************
827
- // footer cleaner
828
- //**************************************************************************************
829
- public function footer_cleaner($buffer) {
830
- if (!function_exists('str_get_html'))
831
- return trim($buffer) . "\n";
832
-
833
- $buffer = $this->ob_handler($buffer);
834
-
835
- $ret_val = '';
836
- $script_tag = ''; $inline_js = '';
837
- $other_tag = '';
838
-
839
- $html_txt = '<html><head></head><body>'
840
- . '<div id="footer">' . trim($buffer) . '</div>'
841
- . '</body></html>';
842
-
843
- // Get Simple DOM Object
844
- $dom = str_get_html($html_txt);
845
- if ($dom === false)
846
- return (trim($buffer)."\n");
847
-
848
- $inner_js = ''; $js_src = array();
849
- $elements = $dom->find("div#footer *");
850
- foreach ((array) $elements as $element) {
851
- switch ($element->tag) {
852
- case 'script':
853
- if (!isset($element->src)) {
854
- $inline_js .= $this->_remove_comment($element->innertext, 'js');
855
- } else {
856
- $src = $element->src;
857
- if (array_search( $src, (array) $this->options['remove_js']) === FALSE) {
858
- if (strpos($src, $this->wp_url) === FALSE) {
859
- $script_tag .= trim($element->outertext) . "\n";
860
- } else {
861
- $inner_js .= trim($element->outertext) . "\n";
862
- $js_src[] = preg_replace('/\.gz$/i', '', $src);
863
- }
864
- }
865
- }
866
- break;
867
- default:
868
- $tag = trim($element->outertext);
869
- if (strpos($other_tag, $tag) === FALSE && ! preg_match('/^<\!\-+/', $tag))
870
- $other_tag .= $tag . "\n";
871
- break;
872
- }
873
- }
874
- unset($element); unset($elements);
875
-
876
- $inline_js = trim($inline_js);
877
- if ($this->options['cache_enabled']) {
878
- if ($this->options['combined_js']) {
879
- $inner_js = $this->_combined_javascript($js_src, trim($inline_js));
880
- $script_tag = trim(trim($script_tag) . "\n" . $inner_js) . "\n";
881
- $inline_js = '';
882
- } else {
883
- $script_tag = trim(trim($script_tag) . "\n" . $inner_js) . "\n";
884
- $inline_js = $this->_combined_inline_javascript(trim($inline_js));
885
- }
886
- } else {
887
- $script_tag = trim(trim($script_tag) . "\n" . $inner_js) . "\n";
888
- $inline_js = (!empty($inline_js) ? "<script type=\"text/javascript\">//<![CDATA[\n{$inline_js}\n//]]></script>\n" : '');
889
- }
890
-
891
- $dom->clear(); unset($dom);
892
-
893
- $ret_val .=
894
- $other_tag
895
- . $script_tag
896
- . $inline_js
897
- ;
898
-
899
- if ($this->options['dynamic']) {
900
- $ret_val = preg_replace(
901
- '/' . preg_quote($this->cache_url, '/') . '(js|css)\/([^\.]*)\.(js|css)/i' ,
902
- $this->self_url . "?f=$2&amp;t=$3" ,
903
- $ret_val
904
- );
905
- }
906
-
907
- //$ret_val = str_replace('\'', '"', $ret_val);
908
- $ret_val = trim(preg_replace(
909
- array( "/[\s]+([^\=]+)\='([^']*)'/i", '/[\n\r]+/i', '/(<\/[^>]+>)[ \t]*(<[^>]+)/i' ) ,
910
- array( ' $1="$2"', "\n", "$1\n$2" ),
911
- $ret_val
912
- )) . "\n";
913
-
914
- if ($this->options['debug_mode'])
915
- $ret_val .= $this->_get_debug_info($buffer);
916
-
917
- return $ret_val;
918
- }
919
-
920
- //**************************************************************************************
921
- // WP_CONTENT_DIR
922
- //**************************************************************************************
923
- private function _wp_content_dir($path = '') {
924
- return (!defined('WP_CONTENT_DIR')
925
- ? WP_CONTENT_DIR
926
- : ABSPATH . 'wp-content'
927
- ) . $path;
928
- }
929
-
930
- //**************************************************************************************
931
- // is login?
932
- //**************************************************************************************
933
- private function _is_user_logged_in() {
934
- if (function_exists('is_user_logged_in')) {
935
- return is_user_logged_in();
936
- } else {
937
- global $user;
938
- if (!isset($user)) $user = wp_get_current_user();
939
- return (!empty($user->ID));
940
- }
941
- }
942
-
943
- //**************************************************************************************
944
- // Is mobile ?
945
- //**************************************************************************************
946
- private function _is_mobile() {
947
- $is_mobile = $this->isKtai();
948
-
949
- if ( !$is_mobile && function_exists('bnc_is_iphone') ) {
950
- global $wptouch_plugin;
951
-
952
- $is_mobile = bnc_is_iphone();
953
- if ( $is_mobile && isset($wptouch_plugin) ) {
954
- $is_mobile = isset($wptouch_plugin->desired_view)
955
- ? $wptouch_plugin->desired_view == 'mobile'
956
- : true;
957
- }
958
- }
959
-
960
- return ($is_mobile);
961
- }
962
-
963
- //**************************************************************************************
964
- // Get permalink
965
- //**************************************************************************************
966
- private function _get_permalink() {
967
- $url = get_bloginfo('url');
968
- if (! preg_match('|^(https?://[^/]*)|', $url, $host))
969
- $host[1] = (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') ? 'http://' : 'https://' . $_SERVER['SERVER_NAME'];
970
- $url = preg_replace( '/\?[^s].*$/i', '', $host[1] . $_SERVER['REQUEST_URI']);
971
- unset($host);
972
- return ($url);
973
- }
974
-
975
- //**************************************************************************************
976
- // DOM Element -> html tag
977
- //**************************************************************************************
978
- private function _dom_to_html($elements, $limit = false) {
979
- $html = ''; $count = 0;
980
- $type = '';
981
- $tags = array();
982
- foreach ((array) $elements as $element) {
983
- $tag = trim($element->outertext);
984
- $type = strtolower($element->tag);
985
- if (strpos($html, $tag) === FALSE) {
986
- switch($type) {
987
- case 'meta':
988
- if (isset($element->name)) {
989
- $name = strtolower($element->name);
990
-
991
- $content = trim(isset($tags[$type][$name]) && isset($tags[$type][$name]['content'])
992
- ? $tags[$type][$name]['content']
993
- : '');
994
- // $content = trim($content
995
- // . (!empty($content) ? ', ' : '')
996
- // . (isset($element->content) ? $element->content : '')
997
- // );
998
- $contents = ( !empty($content) ? explode( ',', $content ) : array() );
999
- if ( isset($element->content) )
1000
- $contents = array_merge( $contents, explode(',', $element->content) );
1001
- $content = implode( ',', $contents );
1002
- unset( $contents );
1003
-
1004
- $tags[$type][$name] = array(
1005
- 'name' => $name
1006
- ,'content' => $content
1007
- );
1008
- } else {
1009
- $html .= $tag . "\n";
1010
- }
1011
- break;
1012
- case 'link':
1013
- if (isset($element->rel)) {
1014
- $name = strtolower($element->rel);
1015
- $content = (isset($tags[$type][$name]) && isset($tags[$type][$name]['content'])
1016
- ? $tags[$type][$name]['content']
1017
- : '');
1018
- $content .= $tag . "\n";
1019
-
1020
- $tags[$type][$name] = array(
1021
- 'name' => $name
1022
- ,'content' => $content
1023
- );
1024
- } else {
1025
- $html .= $tag . "\n";
1026
- }
1027
- break;
1028
- default:
1029
- $html .= $tag . "\n";
1030
- break;
1031
- }
1032
- }
1033
- if ($limit !== false && $count++ >= $limit) break;
1034
- }
1035
- unset($element); unset($elements);
1036
-
1037
- foreach ((array) $tags as $tag_type => $contents) {
1038
- switch($tag_type) {
1039
- case 'meta':
1040
- ksort( $contents );
1041
- foreach ((array) $contents as $tag) {
1042
- $html .= "<$type";
1043
- foreach((array) $tag as $key => $val) {
1044
- $html .= " $key=\"$val\"";
1045
- }
1046
- $html .= " />\n";
1047
- }
1048
- unset($tag);
1049
- break;
1050
- case 'link':
1051
- default:
1052
- foreach ((array) $contents as $tag) {
1053
- $html .= $tag['content'];
1054
- }
1055
- unset($tag);
1056
- break;
1057
- }
1058
- }
1059
- unset($tags); unset($tag_types);
1060
-
1061
- $html = trim($html);
1062
-
1063
- return $html . (!empty($html) ? "\n" : '');
1064
- }
1065
-
1066
- //**************************************************************************************
1067
- // Get absolute url
1068
- //**************************************************************************************
1069
- private function _abs_url($path, $base_path = ''){
1070
- if (preg_match('/^https?:\/\//i', $base_path))
1071
- $base_path = str_replace($this->wp_url, ABSPATH, $base_path);
1072
-
1073
- $absolute_path = realpath($base_path . '/' . $path);
1074
- if ( $absolute_path === FALSE )
1075
- $absolute_path = $base_path . '/' . $path;
1076
-
1077
- $url = str_replace(ABSPATH, $this->wp_url, $absolute_path);
1078
- $url = str_replace('/./', '/', $url);
1079
- $url = preg_replace('/(\/[^\/]*\/)\.\.(\/[^\/]*\/)/', '$2', $url);
1080
-
1081
- return $url;
1082
- }
1083
-
1084
- private function _css_url_edit($content, $filename) {
1085
- if (preg_match_all('/url[ \t]*\([\'"]?([^\)]*)[\'"]?\)/i', $content, $matches, PREG_SET_ORDER)) {
1086
- $base_path = dirname($filename);
1087
- $search = array(); $replace = array();
1088
- foreach ((array) $matches as $match) {
1089
- if (! preg_match('/^https?:\/\//i', trim($match[1]))) {
1090
- $abs_url = $this->_abs_url(trim($match[1]), $base_path);
1091
- $search[] = $match[0];
1092
- $replace[] = str_replace(trim($match[1]), $abs_url, $match[0]);
1093
- }
1094
- }
1095
- $content = str_replace($search, $replace, $content);
1096
- unset($match); unset($search); unset($replace);
1097
- }
1098
- unset ($matches);
1099
- return $content;
1100
- }
1101
-
1102
- //**************************************************************************************
1103
- // Read file
1104
- //**************************************************************************************
1105
- private function _file_read($filename) {
1106
- $content = false;
1107
- if (preg_match('/^https?:\/\//i', $filename)) {
1108
- $content = file_get_contents($filename);
1109
- } else {
1110
- $filename = realpath($filename);
1111
- if ($filename !== FALSE && file_exists($filename)) {
1112
- $handle = @fopen($filename, 'r');
1113
- $content = trim(@fread($handle, filesize($filename)));
1114
- @fclose($handle);
1115
- }
1116
- }
1117
-
1118
- return $content;
1119
- }
1120
-
1121
- //**************************************************************************************
1122
- // Read files
1123
- //**************************************************************************************
1124
- private function _files_read($files, $type = 'js') {
1125
- $text = '';
1126
- foreach ((array) $files as $filename) {
1127
- $content = trim($this->_file_read($filename));
1128
- switch ($type) {
1129
- case 'css':
1130
- $content = $this->_css_url_edit($content, $filename);
1131
- break;
1132
- case 'js':
1133
- // $content = 'try{'
1134
- // . trim($content . (substr($content, -1) !== ';' ? ';' : '')) . "\n"
1135
- // . ($this->options['debug_mode']
1136
- // ? '}catch(e){alert("error(' . basename($filename) . '): " + e.toString());}'
1137
- // : '}finally{};');
1138
- break;
1139
- }
1140
- // $text .= "/***** ".str_replace(ABSPATH, $this->wp_url,$filename)." *****/\n"
1141
- // . $content . "\n\n";
1142
- $text .= $content . "\n\n";
1143
- }
1144
- unset($filename);
1145
- $text = trim($text);
1146
-
1147
- return $text . (!empty($text) ? "\n" : '');
1148
- }
1149
-
1150
- //**************************************************************************************
1151
- // Write file
1152
- //**************************************************************************************
1153
- private function _file_write($filename, $content = '', $gzip = true) {
1154
- if (!empty($content)) {
1155
- $handle = @fopen($filename, 'w');
1156
- @fwrite($handle, $content);
1157
- @fclose($handle);
1158
-
1159
- return ($gzip
1160
- ? $this->_file_gzip($filename, $content)
1161
- : file_exists($filename)
1162
- );
1163
- } else {
1164
- return false;
1165
- }
1166
- }
1167
-
1168
- //**************************************************************************************
1169
- // Write gzip file
1170
- //**************************************************************************************
1171
- private function _file_gzip($filename, $content = '') {
1172
- if (file_exists($filename) && file_exists($filename . '.gz'))
1173
- if (filemtime($filename) < filemtime($filename . '.gz'))
1174
- return true;
1175
-
1176
- if (function_exists('gzopen')) {
1177
- if (empty($content)) {
1178
- $handle = @fopen($filename, 'r');
1179
- $content = @fread($handle, filesize($filename));
1180
- @fclose($handle);
1181
- }
1182
-
1183
- if (!empty($content)) {
1184
- $handle = @gzopen($filename . '.gz', 'w9');
1185
- @gzwrite($handle, $content);
1186
- @gzclose($handle);
1187
- }
1188
-
1189
- return (file_exists($filename . '.gz'));
1190
- } else {
1191
- return false;
1192
- }
1193
- }
1194
-
1195
- //**************************************************************************************
1196
- // JavaScript FrameWork (Prototype.js > scriptaculous > jQuery > jQuery.noConflict > mootools)
1197
- //**************************************************************************************
1198
- private function _js_framework($js_libs) {
1199
- $prototype = isset($js_libs['prototype']);
1200
- $jquery = isset($js_libs['jquery']);
1201
- $mootools = isset($js_libs['mootools']);
1202
- $js_libs_src = array();
1203
- $wk_inner_js = '';
1204
- $wk_outer_js = '';
1205
-
1206
- // Prototype.js 1.6.0.3
1207
- if ($prototype) {
1208
- list($src, $ver) = $this->_newer_version_src($js_libs['prototype']);
1209
- if (!empty($src)) {
1210
- if (version_compare($ver, '1.6.0.3', '<='))
1211
- $src = $this->plugin_url . 'includes/js/prototype-1.6.0.3.min.js';
1212
-
1213
- $wk_outer_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
1214
- }
1215
- }
1216
-
1217
- // scriptaculous 1.8.2
1218
- if (isset($js_libs['scriptaculous/scriptaculous'])) {
1219
- if (!$prototype) {
1220
- $prototype = true;
1221
- $src = $this->plugin_url . 'includes/js/prototype-1.6.0.3.min.js';
1222
- $wk_outer_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
1223
- }
1224
- $scriptaculous = array(
1225
- 'scriptaculous/scriptaculous'
1226
- , 'scriptaculous/controls'
1227
- , 'scriptaculous/dragdrop'
1228
- , 'scriptaculous/effects'
1229
- , 'scriptaculous/slider'
1230
- , 'scriptaculous/sound'
1231
- , 'scriptaculous/unittest'
1232
- );
1233
- foreach ($scriptaculous as $product) {
1234
- if (isset($js_libs[$product])) {
1235
- list($src, $ver) = $this->_newer_version_src($js_libs[$product]);
1236
- if (!empty($src)) {
1237
- if (version_compare($ver, '1.8.2', '<='))
1238
- $src = $this->plugin_url . 'includes/js/' . $product . '.min.js';
1239
-
1240
- $wk_outer_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
1241
- }
1242
- }
1243
- }
1244
- unset ($scriptaculous);
1245
- }
1246
-
1247
- // jQuery 1.2.6 or 1.3.2
1248
- if ($jquery) {
1249
- list($src, $ver) = $this->_newer_version_src($js_libs['jquery']);
1250
- if (!empty($src)) {
1251
- if ($prototype)
1252
- $src = $this->plugin_url . 'includes/js/jquery-1.2.6.min.js';
1253
- elseif (version_compare($ver, '1.3.2', '<='))
1254
- $src = $this->plugin_url . 'includes/js/jquery-1.3.2.min.js';
1255
-
1256
- if ($prototype || $mootools || strpos($src, $this->wp_url) === FALSE) {
1257
- $wk_outer_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
1258
- } else {
1259
- $js_libs_src[] = $src;
1260
- $wk_inner_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
1261
- }
1262
-
1263
- // jQuery noConflict
1264
- if ($prototype || $mootools) {
1265
- $src = $this->plugin_url . 'includes/js/jquery.noconflict.js';
1266
- if (strpos($src, $this->wp_url) === FALSE) {
1267
- $wk_outer_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
1268
- } else {
1269
- $js_libs_src[] = $src;
1270
- $wk_inner_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
1271
- }
1272
- }
1273
- }
1274
- }
1275
-
1276
- // mootools 1.2.1
1277
- if ($mootools) {
1278
- list($src, $ver) = $this->_newer_version_src($js_libs['mootools']);
1279
- if (!empty($src)) {
1280
- if (version_compare($ver, '1.2.1', '<='))
1281
- $src = $this->plugin_url . 'includes/js/mootools-1.2.1-core-yc.js';
1282
-
1283
- if ($prototype || $jquery || strpos($src, $this->wp_url) === FALSE) {
1284
- $wk_outer_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
1285
- } else {
1286
- $js_libs_src[] = $src;
1287
- $wk_inner_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
1288
- }
1289
- }
1290
- }
1291
-
1292
- return array($js_libs_src, $wk_inner_js, $wk_outer_js);
1293
- }
1294
-
1295
- //**************************************************************************************
1296
- // Combined CSS
1297
- //**************************************************************************************
1298
- private function _combined_css($styles, $css = '', $media = 'all') {
1299
- $html = '';
1300
- $longfilename = ''; $files = array();
1301
-
1302
- if (empty($media))
1303
- $media = 'all';
1304
-
1305
- foreach ((array) $styles as $style) {
1306
- $src = trim(preg_replace('/(\.css|\.php)(\?[^\?]*)$/i', '$1', str_replace($this->wp_url, ABSPATH, $style)));
1307
- if (file_exists($src)) {
1308
- $filename = (preg_match('/\.css$/i', $src) ? $src : $style);
1309
- $longfilename .= $filename . filemtime($src);
1310
- $files[] = $filename;
1311
- } else {
1312
- $html .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$style}\" media=\"{$media}\" />\n";
1313
- }
1314
- }
1315
-
1316
- $md5_filename = md5($longfilename . $css);
1317
- $longfilename = 'css/' . $md5_filename . '.css';
1318
- $filename = $this->cache_path . $longfilename;
1319
- if (! file_exists($filename) ) {
1320
- if (count($files) > 0 && !empty($longfilename))
1321
- $css = $this->_files_read($files, 'css') . "\n\n" . $css;
1322
-
1323
- // Optimise CSS
1324
- $css = $this->_css_optimise($css);
1325
-
1326
- if (!empty($css))
1327
- $this->_file_write($filename, $css, $this->options['gzip_on']);
1328
- }
1329
-
1330
- $fileurl = ($this->options['dynamic']
1331
- ? $this->self_url . '?f=' . $md5_filename . '&amp;t=css'
1332
- : $this->cache_url . $longfilename
1333
- );
1334
- if (file_exists($filename))
1335
- $html .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$fileurl}\" media=\"{$media}\" />\n";
1336
-
1337
- return $html;
1338
- }
1339
-
1340
- //**************************************************************************************
1341
- // Combined inline CSS
1342
- //**************************************************************************************
1343
- private function _combined_inline_css($css, $media = 'all') {
1344
- if (empty($css))
1345
- return '';
1346
-
1347
- if (empty($media))
1348
- $media = 'all';
1349
-
1350
- $html = '';
1351
- $md5_filename = md5($css);
1352
- $longfilename = 'css/'. $md5_filename . '.css';
1353
-
1354
- // Optimise CSS
1355
- $css = $this->_css_optimise($css);
1356
-
1357
- $filename = $this->cache_path . $longfilename;
1358
- if (!file_exists($filename) && !empty($css))
1359
- $this->_file_write($filename, $css, $this->options['gzip_on']);
1360
-
1361
- $fileurl = ($this->options['dynamic']
1362
- ? $this->self_url . '?f=' . $md5_filename . '&amp;t=css'
1363
- : $this->cache_url . $longfilename
1364
- );
1365
- if (file_exists($filename))
1366
- $html .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$fileurl}\" media=\"{$media}\" />\n";
1367
-
1368
- return $html;
1369
- }
1370
-
1371
- //**************************************************************************************
1372
- // Combined JavaScript
1373
- //**************************************************************************************
1374
- private function _combined_javascript($javascripts, $script = '') {
1375
- $html = '';
1376
- $longfilename = ''; $files = array();
1377
-
1378
- foreach ((array) $javascripts as $javascript) {
1379
- $src = trim(preg_replace('/(\.js|\.php)(\?[^\?]*)$/i', '$1', str_replace($this->wp_url, ABSPATH, $javascript)));
1380
- if (file_exists($src)) {
1381
- $filename = (preg_match('/\.js$/i', $src) ? $src : $javascript);
1382
- $longfilename .= $filename . filemtime($src);
1383
- $files[] = $filename;
1384
- } else {
1385
- $html .= "<script type=\"text/javascript\" src=\"{$javascript}\"></script>\n";
1386
- }
1387
- }
1388
-
1389
- $md5_filename = md5($longfilename . $script);
1390
- $longfilename = 'js/' . $md5_filename . '.js';
1391
- $filename = $this->cache_path . $longfilename;
1392
- if (! file_exists($filename) ) {
1393
- if (count($files) > 0 && !empty($longfilename))
1394
- $script = $this->_files_read($files, 'js') . "\n\n" . $script;
1395
-
1396
- // Minified JavaScript
1397
- $script = $this->_js_minify($script);
1398
-
1399
- if (!empty($script))
1400
- $this->_file_write($filename, $script, $this->options['gzip_on']);
1401
- }
1402
-
1403
- $fileurl = $this->cache_url . $longfilename;
1404
- // $fileurl = ($this->options['dynamic']
1405
- // ? $this->self_url . '?f=' . $md5_filename . '&amp;t=js'
1406
- // : $this->cache_url . $longfilename
1407
- // );
1408
- if (file_exists($filename))
1409
- $html .= "<script type=\"text/javascript\" src=\"{$fileurl}\"></script>\n";
1410
-
1411
- return $html;
1412
- }
1413
-
1414
- //**************************************************************************************
1415
- // Combined inline JavaScript
1416
- //**************************************************************************************
1417
- private function _combined_inline_javascript($script) {
1418
- if (empty($script))
1419
- return '';
1420
-
1421
- $html = '';
1422
- $md5_filename = md5($script);
1423
- $longfilename = 'js/' . $md5_filename . '.js';
1424
-
1425
- // Minified JavaScript
1426
- $script = $this->_js_minify($script);
1427
-
1428
- $filename = $this->cache_path . $longfilename;
1429
- if (!file_exists($filename) && !empty($script) )
1430
- $this->_file_write($filename, $script, $this->options['gzip_on']);
1431
-
1432
- $fileurl = $this->cache_url . $longfilename;
1433
- // $fileurl = ($this->options['dynamic']
1434
- // ? $this->self_url . '?f=' . $md5_filename . '&amp;t=js'
1435
- // : $this->cache_url . $longfilename
1436
- // );
1437
- if (file_exists($filename))
1438
- $html .= "<script type=\"text/javascript\" src=\"{$fileurl}\"></script>\n";
1439
-
1440
- return $html;
1441
- }
1442
-
1443
- //**************************************************************************************
1444
- // Remove comment
1445
- //**************************************************************************************
1446
- private function _remove_comment($text, $type) {
1447
- $text = trim($text);
1448
-
1449
- $comment_pattern = '/^[ \t]*\/(?:\*(?:.|\n)*?\*\/|\/.*)/m';
1450
-
1451
- switch ($type) {
1452
- case 'css': // inline CSS
1453
- $text = trim(preg_replace(
1454
- array($comment_pattern, '/^[ \t]+/m', '/[ \t]+$/m') ,
1455
- array('', '', '') ,
1456
- $text)
1457
- );
1458
- break;
1459
-
1460
- case 'js': // inline JavaScript
1461
- $text = trim(preg_replace(
1462
- array($comment_pattern, '/^[ \t]+/m', '/[ \t]+$/m', '/^<\!\-+/', '/-+>$/') ,
1463
- array('', '', '', '', '') ,
1464
- $text)
1465
- );
1466
- // $text = 'try{'
1467
- // . $text . (substr($text, -1) !== ';' ? ';' : '') . "\n"
1468
- // . ($this->options['debug_mode']
1469
- // ? '}catch(e){alert("error: " + e.toString());}'
1470
- // : '}finally{};')
1471
- // ;
1472
- break;
1473
- }
1474
-
1475
- return ($text . "\n\n");
1476
- }
1477
-
1478
- //**************************************************************************************
1479
- // Get Newer version
1480
- //**************************************************************************************
1481
- private function _newer_version_src($js_libs, $limit_ver = '') {
1482
- $src = ''; $ver = '0.0';
1483
- foreach ((array) $js_libs as $key => $val) {
1484
- if ( version_compare( $key, $ver, '>') ) {
1485
- $src = $val; $ver = $key;
1486
- }
1487
- }
1488
-
1489
- return array($src, $ver);
1490
- }
1491
-
1492
- //**************************************************************************************
1493
- // Minified JavaScript
1494
- //**************************************************************************************
1495
- private function _js_minify($buffer) {
1496
- $js = trim($buffer . "\n");
1497
- if ($this->options['js_minify']) {
1498
- if ( class_exists('JSMin') ) {
1499
- $js = JSMin::minify($js);
1500
- } else if( class_exists('JSMinPlus') ) {
1501
- $js = JSMinPlus::minify($js);
1502
- }
1503
- }
1504
- $js = trim($js);
1505
-
1506
- return $js . (!empty($js) ? "\n" : '');
1507
- }
1508
-
1509
- //**************************************************************************************
1510
- // Optimise CSS
1511
- //**************************************************************************************
1512
- private function _css_import($css) {
1513
- if (preg_match_all('/@import[ \t]*url[ \t]*\([\'"]?([^\)\'"]*)[\'"]?\);?/i', $css, $matches, PREG_SET_ORDER)) {
1514
- $search = array(); $replace = array();
1515
- foreach ((array) $matches as $match) {
1516
- $filename = str_replace($this->wp_url, ABSPATH, trim($match[1]));
1517
- $content = $this->_file_read(file_exists($filename) ? $filename : $match[1]);
1518
- $content = $this->_css_url_edit($content, $filename);
1519
- if ($this->options['css_optimise'])
1520
- $content = $this->_css_optimise($content, false);
1521
- if (preg_match('/@import[ \t]*url[ \t]*\([\'"]?[^\)\'"]*[\'"]?\);?/i', $content))
1522
- $content = $this->_css_import($content);
1523
- $search[] = $match[0];
1524
- $replace[] = $content;
1525
- }
1526
- $css = str_replace($search, $replace, $css);
1527
- unset($match); unset($search); unset($replace);
1528
- }
1529
- unset($matches);
1530
-
1531
- return $css;
1532
- }
1533
-
1534
- private function _css_optimise($buffer, $merge = true) {
1535
- $css = trim($buffer . "\n");
1536
-
1537
- if ($this->options['css_optimise']) {
1538
- if ( class_exists('Minify_CSS') ) {
1539
- $css = Minify_CSS::minify($css);
1540
- } else if ( class_exists('csstidy') ) {
1541
- $csstidy = new csstidy();
1542
- $csstidy->set_cfg('optimise_shorthands', $this->options['csstidy_option']['optimise_shorthands']);
1543
- $csstidy->set_cfg('compress_colors', $this->options['csstidy_option']['compress_colors']);
1544
- $csstidy->set_cfg('compress_font-weight', $this->options['csstidy_option']['compress_font_weight']);
1545
- $csstidy->set_cfg('remove_bslash', $this->options['csstidy_option']['remove_bslash']);
1546
- $csstidy->load_template($this->csstidy_template[$this->options['csstidy_option']['template']]);
1547
- $csstidy->parse($css);
1548
- $css = $csstidy->print->plain();
1549
- unset($csstidy);
1550
- }
1551
- }
1552
- if ( $merge )
1553
- $css = str_replace("\n\n", "\n", $this->_css_import($css));
1554
- $css = trim($css);
1555
-
1556
- return $css . (!empty($css) ? "\n" : '');
1557
- }
1558
-
1559
- //**************************************************************************************
1560
- // Create cache dir
1561
- //**************************************************************************************
1562
- private function _create_cache_dir($cache_dir = '') {
1563
- if (empty($cache_dir)) $cache_dir = HC_CACHE_DIR;
1564
- $cache_dir = $this->_wp_content_dir('/' . trailingslashit($cache_dir) );
1565
-
1566
- $mode = 0777;
1567
- if( !file_exists(dirname($cache_dir)) )
1568
- @mkdir(dirname($cache_dir), $mode);
1569
- if( !file_exists($cache_dir) )
1570
- @mkdir($cache_dir, $mode);
1571
- if( !file_exists($cache_dir) . '/css/' )
1572
- @mkdir($cache_dir . '/css/', $mode);
1573
- if( !file_exists($cache_dir) . '/js/' )
1574
- @mkdir($cache_dir . '/js/', $mode);
1575
-
1576
- return (file_exists($cache_dir) ? $cache_dir : FALSE);
1577
- }
1578
-
1579
- //**************************************************************************************
1580
- // Remove cache file
1581
- //**************************************************************************************
1582
- private function _remove_cache_file($cache = 'cache', $plugin = 'head-cleaner') {
1583
- $cache_dir = ( !empty($this->cache_path)
1584
- ? $this->cache_path
1585
- : $this->_wp_content_dir("/$cache/$plugin/")
1586
- );
1587
- $this->_remove_all_file($cache_dir . 'css');
1588
- $this->_remove_all_file($cache_dir . 'js');
1589
- }
1590
-
1591
- //**************************************************************************************
1592
- // Remove files
1593
- //**************************************************************************************
1594
- private function _remove_all_file($dir, $rmdir = false) {
1595
- if(file_exists($dir)) {
1596
- if($objs = glob($dir."/*")) {
1597
- foreach((array) $objs as $obj) {
1598
- is_dir($obj)
1599
- ? $this->_remove_all_file($obj, true)
1600
- : @unlink($obj);
1601
- }
1602
- unset($objs);
1603
- }
1604
- if ($rmdir) rmdir($dir);
1605
- }
1606
- }
1607
-
1608
- //**************************************************************************************
1609
- // Create .htaccess
1610
- //**************************************************************************************
1611
- private function _create_htaccess($dir) {
1612
- if (!file_exists($dir))
1613
- return FALSE;
1614
-
1615
- $rewrite_base = trailingslashit(str_replace(ABS_PATH, '/', $dir));
1616
-
1617
- $text = '# BEGIN Head Cleaner' . "\n"
1618
- . '<IfModule mod_rewrite.c>' . "\n"
1619
- . 'RewriteEngine On' . "\n"
1620
- . 'RewriteBase ' . $rewrite_base . "\n"
1621
- . 'RewriteCond %{HTTP:Accept-Encoding} gzip' . "\n"
1622
- . 'RewriteCond %{REQUEST_FILENAME} "\.(css|js)$"' . "\n"
1623
- . 'RewriteCond %{REQUEST_FILENAME} !"\.gz$"' . "\n"
1624
- . 'RewriteCond %{REQUEST_FILENAME}.gz -s' . "\n"
1625
- . 'RewriteRule .+ %{REQUEST_URI}.gz [L]' . "\n"
1626
- . '</IfModule>' . "\n"
1627
- . '# END Head Cleaner' . "\n";
1628
- $filename = trailingslashit($dir) . '.htaccess';
1629
-
1630
- if ( $this->options['gzip_on'] ) {
1631
- if (!file_exists($filename)) {
1632
- return $this->_file_write($filename, $text, false);
1633
- } else {
1634
- $content = $this->_file_read($filename);
1635
- if ($content !== FALSE) {
1636
- if (strpos($content, '# BEGIN Head Cleaner') === FALSE && strpos($content, 'RewriteRule .+ %{REQUEST_URI}.gz') === FALSE) {
1637
- $text = $content . "\n" . $text;
1638
- return $this->_file_write($filename, $text, false);
1639
- } else {
1640
- return TRUE;
1641
- }
1642
- } else {
1643
- return FALSE;
1644
- }
1645
- }
1646
- } else {
1647
- if ( file_exists($filename) ) {
1648
- $content = trim($this->_file_read($filename));
1649
- if ($content !== FALSE) {
1650
- $content = trim(preg_replace('/# BEGIN Head Cleaner.*# END Head Cleaner/ism', '', $content));
1651
- if ( $text === $content || $content === '') {
1652
- @unlink($filename);
1653
- return TRUE;
1654
- } else {
1655
- return $this->_file_write($filename, $content . "\n", false);
1656
- }
1657
- } else {
1658
- return FALSE;
1659
- }
1660
- } else {
1661
- return TRUE;
1662
- }
1663
- }
1664
- }
1665
-
1666
- //**************************************************************************************
1667
- // Add Admin Menu
1668
- //**************************************************************************************
1669
- public function admin_menu() {
1670
- $this->addOptionPage(__('Head Cleaner'), array($this, 'option_page'));
1671
- }
1672
-
1673
- public function plugin_setting_links($links, $file) {
1674
- if (method_exists($this, 'addPluginSettingLinks')) {
1675
- $links = $this->addPluginSettingLinks($links, $file);
1676
- } else {
1677
- $this_plugin = plugin_basename(__FILE__);
1678
- if ($file == $this_plugin) {
1679
- $settings_link = '<a href="' . $this->admin_action . '">' . __('Settings') . '</a>';
1680
- array_unshift($links, $settings_link); // before other links
1681
- }
1682
- }
1683
- return $links;
1684
- }
1685
-
1686
- //**************************************************************************************
1687
- // Show Option Page
1688
- //**************************************************************************************
1689
- public function option_page() {
1690
- if ($this->_chk_filters_update()) {
1691
- $this->options['filters'] = $this->filters;
1692
- $this->options['head_js'] = $this->head_js;
1693
- }
1694
-
1695
- if (isset($_POST['options_update'])) {
1696
- if ($this->wp25)
1697
- check_admin_referer("update_options", "_wpnonce_update_options");
1698
-
1699
- // strip slashes array
1700
- $head_js = $this->stripArray(isset($_POST['head_js']) ? $_POST['head_js'] : array());
1701
- $remove_js = $this->stripArray(isset($_POST['remove_js']) ? $_POST['remove_js'] : array());
1702
- $head_filters = $this->stripArray(isset($_POST['head_filters']) ? $_POST['head_filters'] : array());
1703
- $head_remove = $this->stripArray(isset($_POST['head_remove']) ? $_POST['head_remove'] : array());
1704
- $foot_filters = $this->stripArray(isset($_POST['foot_filters']) ? $_POST['foot_filters'] : array());
1705
- $foot_remove = $this->stripArray(isset($_POST['foot_remove']) ? $_POST['foot_remove'] : array());
1706
- $_POST = $this->stripArray($_POST);
1707
-
1708
- // get options
1709
- $this->options['xml_declaration'] = (isset($_POST['xml_declaration']) && $_POST['xml_declaration'] == 'on' ? true : false);
1710
- $this->options['ie_conditional']= (isset($_POST['ie_conditional']) && $_POST['ie_conditional'] == 'on' ? true : false);
1711
- $this->options['canonical_tag'] = (isset($_POST['canonical_tag']) && $_POST['canonical_tag'] == 'on' ? true : false);
1712
- $this->options['foot_js'] = (isset($_POST['foot_js']) && $_POST['foot_js'] == 'on' ? true : false);
1713
- $this->options['dynamic'] = (isset($_POST['dynamic']) && $_POST['dynamic'] == 'on' ? true : false);
1714
- $this->options['js_move_foot'] = (isset($_POST['js_move_foot']) && $_POST['js_move_foot'] == 'on' ? true : false);
1715
- $this->options['cache_enabled'] = (isset($_POST['cache_enabled']) && $_POST['cache_enabled'] == 'on' ? true : false);
1716
- $this->options['combined_css'] = (isset($_POST['combined_css']) && $_POST['combined_css'] == 'on' ? true : false);
1717
- $this->options['combined_js'] = (isset($_POST['combined_js']) && $_POST['combined_js'] == 'on' ? true : false);
1718
- $this->options['js_minify'] = (isset($_POST['js_minify']) && $_POST['js_minify'] == 'on' ? true : false);
1719
- $this->options['css_optimise'] = (isset($_POST['css_optimise']) && $_POST['css_optimise'] == 'on' ? true : false);
1720
- $this->options['default_media'] = trim($_POST['default_media']);
1721
- $this->options['gzip_on'] = (isset($_POST['gzip_on']) && $_POST['gzip_on'] == 'on' ? true : false);
1722
- $this->options['use_ajax_libs'] = (isset($_POST['use_ajax_libs']) && $_POST['use_ajax_libs'] == 'on' ? true : false);
1723
- $this->options['debug_mode'] = (isset($_POST['debug_mode']) && $_POST['debug_mode'] == 'on' ? true : false);
1724
- $this->options['csstidy_option']['template'] = (int) $_POST['template'];
1725
- $this->options['csstidy_option']['optimise_shorthands'] = (int) $_POST['optimise_shorthands'];
1726
- $this->options['csstidy_option']['compress_colors'] = (isset($_POST['compress_colors']) && $_POST['compress_colors'] == 'on' ? true : false);
1727
- $this->options['csstidy_option']['compress_font_weight'] = (isset($_POST['compress_font_weight']) && $_POST['compress_font_weight'] == 'on' ? true : false);
1728
- $this->options['csstidy_option']['remove_bslash'] = (isset($_POST['remove_bslash']) && $_POST['remove_bslash'] == 'on' ? true : false);
1729
-
1730
- $rm_generator = (isset($_POST['rm_generator']) && $_POST['rm_generator'] == 'on' ? true : false);
1731
- $rm_rsd_link = (isset($_POST['rm_rsd_link']) && $_POST['rm_rsd_link'] == 'on' ? true : false);
1732
- $rm_manifest = (isset($_POST['rm_manifest']) && $_POST['rm_manifest'] == 'on' ? true : false);
1733
-
1734
- $this->options['remove_js'] = array();
1735
- foreach ((array) $this->options['head_js'] as $javascript => $value) {
1736
- if (count($head_js) > 0 && array_search($javascript, $head_js) !== FALSE)
1737
- $this->options['head_js'][$javascript] = FALSE;
1738
- else
1739
- $this->options['head_js'][$javascript] = TRUE;
1740
- if (array_search($javascript, (array) $remove_js) !== FALSE)
1741
- $this->options['remove_js'][] = $javascript;
1742
- }
1743
- unset($head_js);
1744
- unset($remove_js);
1745
-
1746
- $tag = 'wp_head';
1747
-
1748
- foreach ((array) $this->options['filters'][$tag] as $function_name => $priority) {
1749
- if (count($head_filters) > 0 && array_search($function_name, $head_filters) !== FALSE)
1750
- $this->options['priority'][$tag][$function_name] = HC_PRIORITY + 1;
1751
- elseif (count($head_remove) > 0 && array_search($function_name, $head_remove) !== FALSE)
1752
- $this->options['priority'][$tag][$function_name] = -1;
1753
- elseif (isset($this->options['priority'][$tag][$function_name]))
1754
- $this->options['priority'][$tag][$function_name] = $priority;
1755
- }
1756
- $this->options['priority'][$tag]['wp_generator'] = ($rm_generator ? -1 : $this->options['filters'][$tag]['wp_generator']);
1757
- $this->options['priority'][$tag]['rsd_link'] = ($rm_rsd_link ? -1 : $this->options['filters'][$tag]['rsd_link']);
1758
- $this->options['priority'][$tag]['wlwmanifest_link'] = ($rm_manifest ? -1 : $this->options['filters'][$tag]['wlwmanifest_link']);
1759
- unset($head_filters);
1760
-
1761
- $tag = 'wp_footer';
1762
- foreach ((array) $this->options['filters'][$tag] as $function_name => $priority) {
1763
- if (count($foot_filters) > 0 && array_search($function_name, $foot_filters) !== FALSE)
1764
- $this->options['priority'][$tag][$function_name] = HC_PRIORITY + 1;
1765
- elseif (count($foot_remove) > 0 && array_search($function_name, $foot_remove) !== FALSE)
1766
- $this->options['priority'][$tag][$function_name] = -1;
1767
- elseif (isset($this->options['priority'][$tag][$function_name]))
1768
- $this->options['priority'][$tag][$function_name] = $priority;
1769
- }
1770
- unset($foot_filters);
1771
-
1772
- // options update
1773
- $this->updateOptions();
1774
-
1775
- // create .htaccess file
1776
- $cache_dir = $this->_create_cache_dir();
1777
- if ( $cache_dir !== FALSE )
1778
- $this->_create_htaccess($cache_dir);
1779
-
1780
- // Done!
1781
- $this->note .= "<strong>".__('Done!', $this->textdomain_name)."</strong>";
1782
-
1783
- } elseif(isset($_POST['remove_cache'])) {
1784
- if ($this->wp25)
1785
- check_admin_referer("remove_cache", "_wpnonce_remove_cache");
1786
-
1787
- // Remove all cache files
1788
- $this->_remove_cache_file();
1789
-
1790
- // Done!
1791
- $this->note .= "<strong>".__('Done!', $this->textdomain_name)."</strong>";
1792
-
1793
- } elseif(isset($_POST['options_delete'])) {
1794
- if ($this->wp25)
1795
- check_admin_referer("delete_options", "_wpnonce_delete_options");
1796
-
1797
- // options delete
1798
- $this->_delete_settings();
1799
-
1800
- // Done!
1801
- $this->note .= "<strong>".__('Done!', $this->textdomain_name)."</strong>";
1802
- $this->error++;
1803
-
1804
- } else {
1805
- $this->activation();
1806
- }
1807
-
1808
- $out = '';
1809
-
1810
- // Add Options
1811
- $out .= "<div class=\"wrap\">\n";
1812
- $out .= "<form method=\"post\" id=\"update_options\" action=\"".$this->admin_action."\">\n";
1813
- $out .= "<h2>".__('Head Cleaner Options', $this->textdomain_name)."</h2><br />\n";
1814
- if ($this->wp25) $out .= $this->makeNonceField("update_options", "_wpnonce_update_options", true, false);
1815
-
1816
- $out .= "<table class=\"optiontable form-table\" style=\"margin-top:0;\"><tbody>\n";
1817
-
1818
- $out .= "<tr>";
1819
- $out .= "<td>";
1820
- $out .= "<input type=\"checkbox\" name=\"cache_enabled\" id=\"cache_enabled\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['cache_enabled'] === true ? " checked=\"true\"" : "")." />";
1821
- $out .= __('CSS and JavaScript are cached on the server.', $this->textdomain_name);
1822
- $out .= "</td>";
1823
- $out .= "<td>";
1824
- $out .= "<input type=\"checkbox\" name=\"js_move_foot\" id=\"js_move_foot\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['js_move_foot'] === true ? " checked=\"true\"" : "")." />";
1825
- $out .= __('Put JavaScripts at the Bottom.', $this->textdomain_name);
1826
- $out .= "</td>";
1827
- $out .= "<td>";
1828
- $out .= "<input type=\"checkbox\" name=\"dynamic\" id=\"dynamic\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['dynamic'] === true ? " checked=\"true\"" : "")." />";
1829
- $out .= __('CSS and JS are dynamically generated.', $this->textdomain_name);
1830
- $out .= "</td>";
1831
- $out .= "</tr>\n";
1832
-
1833
- if ($this->options['cache_enabled']) {
1834
- $out .= "<tr>";
1835
- $out .= "<td>";
1836
- $out .= "<input type=\"checkbox\" name=\"combined_css\" id=\"combined_css\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['combined_css'] === true ? " checked=\"true\"" : "")." />";
1837
- $out .= __('Two or more CSS is combined.', $this->textdomain_name);
1838
- $out .= "</td>";
1839
- $out .= "<td>";
1840
- $out .= "<input type=\"checkbox\" name=\"css_optimise\" id=\"css_optimise\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['css_optimise'] === true ? " checked=\"true\"" : "")." />";
1841
- $out .= __('CSS is optimized.', $this->textdomain_name);
1842
- $out .= "</td>";
1843
- $out .= "<td>";
1844
- $out .= __('Default media attribute applied to CSS.', $this->textdomain_name);
1845
- $out .= "<input type=\"text\" name=\"default_media\" id=\"default_media\" value=\"{$this->options['default_media']}\" style=\"margin-left:0.5em;\" />";
1846
- $out .= "</td>";
1847
- $out .= "<td>";
1848
- $out .= "</tr>\n";
1849
-
1850
- $out .= "<tr>";
1851
- $out .= "<td>";
1852
- $out .= "<input type=\"checkbox\" name=\"combined_js\" id=\"combined_js\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['combined_js'] === true ? " checked=\"true\"" : "")." />";
1853
- $out .= __('Two or more JavaScript is combined.', $this->textdomain_name);
1854
- $out .= "</td>";
1855
- $out .= "<td>";
1856
- $out .= "<input type=\"checkbox\" name=\"js_minify\" id=\"js_minify\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['js_minify'] === true ? " checked=\"true\"" : "")." />";
1857
- $out .= __('JavaScript is minified.', $this->textdomain_name);
1858
- $out .= "</td>";
1859
- $out .= "<td>";
1860
- $out .= "<input type=\"checkbox\" name=\"foot_js\" id=\"foot_js\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['foot_js'] === true ? " checked=\"true\"" : "")." />";
1861
- $out .= __('Bottom JavaScript is combined, too.', $this->textdomain_name);
1862
- $out .= "</td>";
1863
- $out .= "</tr>\n";
1864
- }
1865
- $out .= "<tr>";
1866
- // $out .= "<td>";
1867
- // $out .= "<input type=\"checkbox\" name=\"gzip_on\" id=\"gzip_on\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['gzip_on'] === true ? " checked=\"true\"" : "")." />";
1868
- // $out .= __('gzip compress to CSS and JS.', $this->textdomain_name);
1869
- // $out .= "</td>";
1870
- $out .= "<td>";
1871
- $out .= "<input type=\"checkbox\" name=\"use_ajax_libs\" id=\"use_ajax_libs\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['use_ajax_libs'] === true ? " checked=\"true\"" : "")." />";
1872
- $out .= __('Use Google Ajax Libraries.', $this->textdomain_name);
1873
- $out .= "</td>";
1874
- $out .= "<td>";
1875
- $out .= "<input type=\"checkbox\" name=\"ie_conditional\" id=\"ie_conditional\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['ie_conditional'] === true ? " checked=\"true\"" : "")." />";
1876
- $out .= __('Remove IE Conditional Tag.', $this->textdomain_name);
1877
- $out .= "</td>";
1878
- $out .= "<td>";
1879
- $out .= "</td>";
1880
- $out .= "</tr>\n";
1881
-
1882
- $out .= "<tr>";
1883
- $out .= "<td>";
1884
- $out .= "<input type=\"checkbox\" name=\"xml_declaration\" id=\"xml_declaration\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['xml_declaration'] === true ? " checked=\"true\"" : "")." />";
1885
- $out .= __('Add XML Declaration.', $this->textdomain_name);
1886
- $out .= "</td>";
1887
- $out .= "<td>";
1888
- $out .= "<input type=\"checkbox\" name=\"canonical_tag\" id=\"canonical_tag\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['canonical_tag'] === true ? " checked=\"true\"" : "")." />";
1889
- $out .= __('Add canonical tag.', $this->textdomain_name);
1890
- $out .= "</td>";
1891
- $out .= "<td>";
1892
- $out .= "</td>";
1893
- $out .= "</tr>\n";
1894
-
1895
- $out .= "<tr>";
1896
- $out .= "<td>";
1897
- $out .= "<input type=\"checkbox\" name=\"rm_generator\" id=\"rm_generator\" value=\"on\" style=\"margin-right:0.5em;\"".(isset($this->options['priority']['wp_head']['wp_generator']) && $this->options['priority']['wp_head']['wp_generator'] <= 0 ? " checked=\"true\"" : "")." />";
1898
- $out .= __('Remove generator tag.', $this->textdomain_name);
1899
- $out .= "</td>";
1900
- $out .= "<td>";
1901
- $out .= "<input type=\"checkbox\" name=\"rm_rsd_link\" id=\"rm_rsd_link\" value=\"on\" style=\"margin-right:0.5em;\"".(isset($this->options['priority']['wp_head']['rsd_link']) && $this->options['priority']['wp_head']['rsd_link'] <= 0 ? " checked=\"true\"" : "")." />";
1902
- $out .= __('Remove RSD link tag.', $this->textdomain_name);
1903
- $out .= "</td>";
1904
- $out .= "<td>";
1905
- $out .= "<input type=\"checkbox\" name=\"rm_manifest\" id=\"rm_manifest\" value=\"on\" style=\"margin-right:0.5em;\"".(isset($this->options['priority']['wp_head']['wlwmanifest_link']) && $this->options['priority']['wp_head']['wlwmanifest_link'] <= 0 ? " checked=\"true\"" : "")." />";
1906
- $out .= __('Remove wlwmanifest link tag.', $this->textdomain_name);
1907
- $out .= "</td>";
1908
- $out .= "</tr>\n";
1909
-
1910
- $out .= "<tr>";
1911
- $out .= "<td>";
1912
- $out .= "<input type=\"checkbox\" name=\"debug_mode\" id=\"debug_mode\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['debug_mode'] === true ? " checked=\"true\"" : "")." />";
1913
- $out .= __('Debug mode', $this->textdomain_name);
1914
- $out .= "</td>";
1915
- $out .= "<td>";
1916
- $out .= "</td>";
1917
- $out .= "<td>";
1918
- $out .= "</td>";
1919
- $out .= "</tr>\n";
1920
-
1921
- $out .= "</tbody></table>";
1922
-
1923
- // CSS Tidy Options
1924
- if ($this->options['css_optimise'] && class_exists('csstidy')) {
1925
- $out .= "<div style=\"margin-top:2em;\" id=\"csstidy_option\">\n";
1926
- $out .= "<h3>" . __('The CSS optimization settings', $this->textdomain_name) . "</h3>" ;
1927
-
1928
- $out .= __('Compression (code layout):', $this->textdomain_name) . '&nbsp;&nbsp;';
1929
- $out .= '<select name="template" id="template">';
1930
- $out .= '<option value="3"' . ($this->options['csstidy_option']['template']==3 ? ' selected="selected"' : '') . '>' . __('Highest (no readability, smallest size)', $this->textdomain_name) .'</option>';
1931
- $out .= '<option value="2"' . ($this->options['csstidy_option']['template']==2 ? ' selected="selected"' : '') . '>' . __('High (moderate readability, smaller size)', $this->textdomain_name) .')</option>';
1932
- $out .= '<option value="1"' . ($this->options['csstidy_option']['template']==1 ? ' selected="selected"' : '') . '>' . __('Standard (balance between readability and size)', $this->textdomain_name) .'</option>';
1933
- $out .= '<option value="0"' . ($this->options['csstidy_option']['template']==0 ? ' selected="selected"' : '') . '>' . __('Low (higher readability)', $this->textdomain_name) .'</option>';
1934
- $out .= '</select>';
1935
- $out .= '&nbsp;&nbsp;&nbsp;&nbsp;';
1936
- $out .= __('Optimise shorthands', $this->textdomain_name) . '&nbsp;&nbsp;';
1937
- $out .= '<select name="optimise_shorthands" id="optimise_shorthands">';
1938
- $out .= '<option value="2"' . ($this->options['csstidy_option']['optimise_shorthands']==2 ? ' selected="selected"' : '') . '>' . __('All optimisations', $this->textdomain_name) .')</option>';
1939
- $out .= '<option value="1"' . ($this->options['csstidy_option']['optimise_shorthands']==1 ? ' selected="selected"' : '') . '>' . __('Safe optimisations', $this->textdomain_name) .'</option>';
1940
- $out .= '<option value="0"' . ($this->options['csstidy_option']['optimise_shorthands']==0 ? ' selected="selected"' : '') . '>' . __("Don't optimise", $this->textdomain_name) .'</option>';
1941
- $out .= '</select>';
1942
- $out .= "<br />\n";
1943
-
1944
- $out .= "<input type=\"checkbox\" name=\"compress_colors\" id=\"compress_colors\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['csstidy_option']['compress_colors'] === true ? " checked=\"true\"" : "")." />";
1945
- $out .= __('Compress colors', $this->textdomain_name);
1946
- $out .= '&nbsp;&nbsp;&nbsp;&nbsp;';
1947
- $out .= "<input type=\"checkbox\" name=\"compress_font_weight\" id=\"compress_font_weight\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['csstidy_option']['compress_font_weight'] === true ? " checked=\"true\"" : "")." />";
1948
- $out .= __('Compress font-weight', $this->textdomain_name);
1949
- $out .= '&nbsp;&nbsp;&nbsp;&nbsp;';
1950
- $out .= "<input type=\"checkbox\" name=\"remove_bslash\" id=\"remove_bslash\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['csstidy_option']['remove_bslash'] === true ? " checked=\"true\"" : "")." />";
1951
- $out .= __('Remove unnecessary backslashes', $this->textdomain_name);
1952
- $out .= "<br />\n";
1953
-
1954
- $out .= "</div>\n";
1955
- }
1956
-
1957
- // Active Filters
1958
- $out .= "<div style=\"margin-top:2em;\" id=\"active_filters\">\n";
1959
- $out .= "<h3>" . __('Active Filters', $this->textdomain_name) . "</h3>" ;
1960
- $out .= "<table><tbody>\n";
1961
- $out .= "<tr>";
1962
- $out .= '<th style="padding:0 .5em;">' . __("Don't process!", $this->textdomain_name) . "</th>\n";
1963
- $out .= '<th style="padding:0 .5em;">' . __('Remove', $this->textdomain_name) . "</th>\n";
1964
- $out .= "<th>" . __('Head filters', $this->textdomain_name) . "</th>\n";
1965
- if ($this->options['debug_mode'])
1966
- $out .= "<th>" . __('Priority', $this->textdomain_name) . "</th>\n";
1967
- $out .= "</tr>\n";
1968
- $head_filters = array();
1969
- foreach ((array) $this->options['filters']['wp_head'] as $function_name => $priority) {
1970
- if ($priority < HC_PRIORITY) {
1971
- if (isset($this->options['priority']['wp_head'][$function_name]))
1972
- $priority = (int) $this->options['priority']['wp_head'][$function_name];
1973
- if (!isset($head_filters[$priority]))
1974
- $head_filters[$priority] = array();
1975
- $head_filters[$priority][] = $function_name;
1976
- }
1977
- }
1978
- ksort($head_filters, SORT_NUMERIC);
1979
- $i = 0;
1980
- foreach ($head_filters as $priority => $filters) {
1981
- foreach ($filters as $function_name){
1982
- if ( ! preg_match('/^(' . implode('|', $this->default_head_filters) . ')$/i', $function_name)) {
1983
- $out .= "<tr>";
1984
- $out .= "<th><input type=\"checkbox\" name=\"head_filters[$i]\" value=\"$function_name\"".($priority > HC_PRIORITY ? " checked=\"true\"" : "")." /></th>";
1985
- $out .= "<th><input type=\"checkbox\" name=\"head_remove[$i]\" value=\"$function_name\"".($priority <= 0 ? " checked=\"true\"" : "")." /></th>";
1986
- $out .= "<td>$function_name</td>";
1987
- if ($this->options['debug_mode'])
1988
- $out .= "<td>( $priority )</td>";
1989
- $out .= "</tr>\n";
1990
- $i++;
1991
- }
1992
- }
1993
- }
1994
- unset($filters); unset($head_filters);
1995
-
1996
- if ($this->options['foot_js'] === true) {
1997
- $out .= "<tr><td colspan='3'>&nbsp;</td></tr>\n";
1998
- $out .= "<tr>";
1999
- $out .= '<th style="padding:0 .5em;">' . __("Don't process!", $this->textdomain_name) . "</th>\n";
2000
- $out .= '<th style="padding:0 .5em;">' . __('Remove', $this->textdomain_name) . "</th>\n";
2001
- $out .= "<th>" . __('Bottom filters', $this->textdomain_name) . "</th>\n";
2002
- if ($this->options['debug_mode'])
2003
- $out .= "<th>" . __('Priority', $this->textdomain_name) . "</th>\n";
2004
- $out .= "</tr>\n";
2005
- $footer_filters = array();
2006
- foreach ((array) $this->options['filters']['wp_footer'] as $function_name => $priority) {
2007
- if ($priority < HC_PRIORITY) {
2008
- if (isset($this->options['priority']['wp_footer'][$function_name]))
2009
- $priority = (int) $this->options['priority']['wp_footer'][$function_name];
2010
- if (!isset($footer_filters[$priority]))
2011
- $footer_filters[$priority] = array();
2012
- $footer_filters[$priority][] = $function_name;
2013
- }
2014
- }
2015
- ksort($footer_filters, SORT_NUMERIC);
2016
- $i = 0;
2017
- foreach ($footer_filters as $priority => $filters) {
2018
- foreach ($filters as $function_name){
2019
- if ( ! preg_match('/^(' . implode('|', $this->default_head_filters) . ')$/i', $function_name)) {
2020
- $out .= "<tr>";
2021
- $out .= "<th><input type=\"checkbox\" name=\"foot_filters[$i]\" value=\"$function_name\"".($priority > HC_PRIORITY ? " checked=\"true\"" : "")." /></th>";
2022
- $out .= "<th><input type=\"checkbox\" name=\"foot_remove[$i]\" value=\"$function_name\"".($priority <= 0 ? " checked=\"true\"" : "")." /></th>";
2023
- $out .= "<td>$function_name</td>";
2024
- if ($this->options['debug_mode'])
2025
- $out .= "<td>( $priority )</td>";
2026
- $out .= "</tr>\n";
2027
- $i++;
2028
- }
2029
- }
2030
- }
2031
- unset($filters); unset($footer_filters);
2032
- }
2033
- $out .= "</tbody></table>";
2034
- $out .= "</div>\n";
2035
-
2036
- // Active JavaScripts
2037
- $out .= "<div style=\"margin-top:2em;\" id=\"active_javascripts\">\n";
2038
- $out .= "<h3>" . __('Active JavaScripts', $this->textdomain_name) . "</h3>" ;
2039
- $out .= "<table><tbody>\n";
2040
- $out .= "<tr>";
2041
- $out .= '<th style="padding:0 .5em;">' . __('Move to footer', $this->textdomain_name) . "</th>\n";
2042
- $out .= '<th style="padding:0 .5em;">' . __('Remove', $this->textdomain_name) . "</th>\n";
2043
- $out .= "<th>" . __('JavaScripts', $this->textdomain_name) . "</th>\n";
2044
- foreach ($this->options['head_js'] as $javascript => $value) {
2045
- $remove = (array_search( $javascript, (array)$this->options["remove_js"] ) !== FALSE);
2046
- $out .= "<tr>";
2047
- $out .= "<th><input type=\"checkbox\" name=\"head_js[$i]\" value=\"$javascript\"".($value === FALSE ? " checked=\"true\"" : "")." /></th>";
2048
- $out .= "<th><input type=\"checkbox\" name=\"remove_js[$i]\" value=\"$javascript\"".($remove !== FALSE ? " checked=\"true\"" : "")." /></th>";
2049
- $out .= "<td>$javascript</td>";
2050
- $i++;
2051
- }
2052
- $out .= "</tbody></table>";
2053
- $out .= "</div>\n";
2054
-
2055
- // Add Update Button
2056
- $out .= "<p style=\"margin-top:1em\"><input type=\"submit\" name=\"options_update\" class=\"button-primary\" value=\"".__('Update Options', $this->textdomain_name)." &raquo;\" class=\"button\" /></p>";
2057
- $out .= "</form></div>\n";
2058
-
2059
- // Cache Delete
2060
- $out .= "<div class=\"wrap\" style=\"margin-top:2em;\">\n";
2061
- $out .= "<h2>" . __('Remove all cache files', $this->textdomain_name) . "</h2><br />\n";
2062
- $out .= "<form method=\"post\" id=\"remove_cache\" action=\"".$this->admin_action."\">\n";
2063
- if ($this->wp25) $out .= $this->makeNonceField("remove_cache", "_wpnonce_remove_cache", true, false);
2064
- $out .= "<p>" . __('All cache files are removed.', $this->textdomain_name) . "</p>";
2065
- $out .= "<input type=\"submit\" name=\"remove_cache\" class=\"button-primary\" value=\"".__('Remove All Cache Files', $this->textdomain_name)." &raquo;\" class=\"button\" />";
2066
- $out .= "</form></div>\n";
2067
-
2068
- // Options Delete
2069
- $out .= "<div class=\"wrap\" style=\"margin-top:2em;\">\n";
2070
- $out .= "<h2>" . __('Uninstall', $this->textdomain_name) . "</h2><br />\n";
2071
- $out .= "<form method=\"post\" id=\"delete_options\" action=\"".$this->admin_action."\">\n";
2072
- if ($this->wp25) $out .= $this->makeNonceField("delete_options", "_wpnonce_delete_options", true, false);
2073
- $out .= "<p>" . __('All the settings of &quot;Head Cleaner&quot; are deleted.', $this->textdomain_name) . "</p>";
2074
- $out .= "<input type=\"submit\" name=\"options_delete\" class=\"button-primary\" value=\"".__('Delete Options', $this->textdomain_name)." &raquo;\" class=\"button\" />";
2075
- $out .= "</form></div>\n";
2076
-
2077
- // Output
2078
- echo (!empty($this->note) ? "<div id=\"message\" class=\"updated fade\"><p>{$this->note}</p></div>\n" : '') . "\n";
2079
- echo ($this->error == 0 ? $out : '') . "\n";
2080
-
2081
- }
2082
-
2083
- //**************************************************************************************
2084
- // Delete Settings
2085
- //**************************************************************************************
2086
- private function _delete_settings() {
2087
- $this->deleteOptions();
2088
- $this->_remove_cache_file();
2089
- $this->options = $this->_init_options();
2090
- }
2091
-
2092
- //**************************************************************************************
2093
- // Get function name
2094
- //**************************************************************************************
2095
- private function _get_function_name($function) {
2096
- return (is_array($function)
2097
- ? (get_class($function[0]) !== FALSE ? get_class($function[0]) : $function[0]) . '::' . $function[1]
2098
- : $function
2099
- );
2100
- }
2101
-
2102
- //**************************************************************************************
2103
- // Get Filters
2104
- //**************************************************************************************
2105
- private function _get_filters($tag = '') {
2106
- global $wp_filter;
2107
-
2108
- if (empty($tag) && function_exists('current_filter'))
2109
- $tag = current_filter();
2110
-
2111
- if (!isset($this->filters[$tag]))
2112
- $this->filters[$tag] = array();
2113
-
2114
- $active_filters = (isset($wp_filter[$tag])
2115
- ? (array) $wp_filter[$tag]
2116
- : array());
2117
- foreach ($active_filters as $priority => $filters) {
2118
- foreach ($filters as $filter) {
2119
- $function_name = $this->_get_function_name($filter['function']);
2120
- $this->filters[$tag][$function_name] = $priority;
2121
- }
2122
- }
2123
- unset($active_filters);
2124
-
2125
- return $this->filters;
2126
- }
2127
-
2128
- //**************************************************************************************
2129
- // Filters update Check
2130
- //**************************************************************************************
2131
- private function _chk_filters_update(){
2132
- $retval = false;
2133
- foreach ( $this->filters as $tag => $filters ) {
2134
- if ( isset($this->options['filters'][$tag]) ) {
2135
- foreach ( $filters as $function_name => $priority) {
2136
- $retval = ( !isset($this->options['filters'][$tag][$function_name]) );
2137
- if ($retval) break;
2138
- }
2139
- } else {
2140
- $retval = true; break;
2141
- }
2142
- }
2143
- unset ($filters);
2144
-
2145
- foreach ( $this->head_js as $key => $val ) {
2146
- if ( !isset($this->options['head_js'][$key]) ) {
2147
- $retval = true; break;
2148
- }
2149
- }
2150
-
2151
- return $retval;
2152
- }
2153
-
2154
- //**************************************************************************************
2155
- // Filters priority change
2156
- //**************************************************************************************
2157
- private function _change_filters_priority($tag = ''){
2158
- global $wp_filter;
2159
-
2160
- if (empty($tag) && function_exists('current_filter'))
2161
- $tag = current_filter();
2162
-
2163
- $active_filters = (isset($wp_filter[$tag])
2164
- ? $wp_filter[$tag]
2165
- : array());
2166
- $custom_priority = (isset($this->options['priority'][$tag])
2167
- ? $this->options['priority'][$tag]
2168
- : array());
2169
- foreach ($this->no_conflict as $function_name) {
2170
- $custom_priority[$function_name] = HC_PRIORITY + 1;
2171
- }
2172
- foreach ($active_filters as $priority => $filters) {
2173
- foreach ($filters as $filter) {
2174
- $function_name = $this->_get_function_name($filter['function']);
2175
- if ( isset($custom_priority[$function_name]) && $custom_priority[$function_name] != $priority) {
2176
- remove_filter( $tag, $filter['function'], $priority);
2177
- if ($custom_priority[$function_name] > 0)
2178
- add_filter( $tag, $filter['function'], $custom_priority[$function_name]);
2179
- }
2180
- }
2181
- }
2182
- unset($custom_priority);
2183
- unset($active_filters);
2184
- }
2185
-
2186
- //**************************************************************************************
2187
- // raw shortcode
2188
- //**************************************************************************************
2189
- function raw_formatter($content) {
2190
- $new_content = '';
2191
- $pattern_full = '{(\[raw\].*?\[/raw\])}is';
2192
- $pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
2193
- $pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);
2194
-
2195
- foreach ($pieces as $piece) {
2196
- if (preg_match($pattern_contents, $piece, $matches)) {
2197
- $new_content .= $matches[1];
2198
- } else {
2199
- $new_content .= wptexturize(wpautop($piece));
2200
- }
2201
- }
2202
-
2203
- return $new_content;
2204
- }
2205
-
2206
- //**************************************************************************************
2207
- // Debug Information
2208
- //**************************************************************************************
2209
- private function _microtime_diff($start, $end=NULL) {
2210
- if( !$end )
2211
- $end= microtime();
2212
- list($start_usec, $start_sec) = explode(" ", $start);
2213
- list($end_usec, $end_sec) = explode(" ", $end);
2214
- $diff_sec= intval($end_sec) - intval($start_sec);
2215
- $diff_usec= floatval($end_usec) - floatval($start_usec);
2216
- return floatval( $diff_sec ) + $diff_usec;
2217
- }
2218
-
2219
- private function _get_debug_info($buffer, $tag = '') {
2220
- $ret_val = "<!--\n";
2221
-
2222
- $ret_val .= "***** Processing time ****************************\n"
2223
- . $this->_microtime_diff($this->mtime_start) . " seconds\n"
2224
- . "**************************************************\n\n";
2225
- $this->mtime_start = microtime();
2226
-
2227
- $ret_val .= "***** Original ***********************************\n"
2228
- . str_replace(array('<', '>'), array('<', '>'), $buffer) . "\n"
2229
- . "**************************************************\n\n";
2230
-
2231
- $ret_val .= "***** Filters ************************************\n";
2232
- if (empty($tag) && function_exists('current_filter'))
2233
- $tag = current_filter();
2234
- $active_filters = (isset($this->filters[$tag])
2235
- ? $this->filters[$tag]
2236
- : array());
2237
- foreach ($active_filters as $function_name => $priority) {
2238
- if (strpos($function_name, 'HeadCleaner') === FALSE && strpos($function_name, 'noindex') === FALSE)
2239
- $ret_val .= " ($priority) : $function_name\n";
2240
- }
2241
- $ret_val .= "**************************************************\n\n";
2242
-
2243
- $ret_val .= "***** ob_list_handlers ***************************\n";
2244
- if (function_exists('ob_list_handlers')) {
2245
- $active_handlers = ob_list_handlers();
2246
- foreach ($active_handlers as $handler) {
2247
- $ret_val .= " $handler\n";
2248
- }
2249
- unset($active_handlers);
2250
- }
2251
- $ret_val .= "**************************************************\n\n";
2252
-
2253
- $ret_val .= "--> \n";
2254
-
2255
- return $ret_val;
2256
- }
2257
- }
2258
-
2259
- global $head_cleaner;
2260
-
2261
- $head_cleaner = new HeadCleaner();
2262
-
2263
- if (function_exists('register_activation_hook'))
2264
- register_activation_hook(__FILE__, array(&$head_cleaner, 'activation'));
2265
- if (function_exists('register_deactivation_hook'))
2266
- register_deactivation_hook(__FILE__, array(&$head_cleaner, 'deactivation'));
2267
- ?>
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Head Cleaner
4
+ Version: 1.3.10
5
+ Plugin URI: http://wppluginsj.sourceforge.jp/head-cleaner/
6
+ Description: Cleaning tags from your WordPress header and footer.
7
+ Author: wokamoto
8
+ Author URI: http://dogmap.jp/
9
+ Text Domain: head-cleaner
10
+ Domain Path: /languages/
11
+
12
+ License:
13
+ Released under the GPL license
14
+ http://www.gnu.org/copyleft/gpl.html
15
+
16
+ Copyright 2009 - 2010 wokamoto (email : wokamoto1973@gmail.com)
17
+
18
+ This program is free software; you can redistribute it and/or modify
19
+ it under the terms of the GNU General Public License as published by
20
+ the Free Software Foundation; either version 2 of the License, or
21
+ (at your option) any later version.
22
+
23
+ This program is distributed in the hope that it will be useful,
24
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
25
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
+ GNU General Public License for more details.
27
+
28
+ You should have received a copy of the GNU General Public License
29
+ along with this program; if not, write to the Free Software
30
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31
+
32
+ Includes:
33
+ PHP Simple HTML DOM Parser Ver.1.11
34
+ http://sourceforge.net/projects/simplehtmldom/
35
+ Licensed under The MIT License
36
+
37
+ jsmin.php - PHP implementation of Douglas Crockford's JSMin. Ver.1.1.1 (2008-03-02)
38
+ Copyright (c) 2002 Douglas Crockford <douglas@crockford.com> (jsmin.c)
39
+ Copyright (c) 2008 Ryan Grove <ryan@wonko.com> (PHP port)
40
+ License http://opensource.org/licenses/mit-license.php MIT License
41
+
42
+ CSSTidy - CSS Parser and Optimiser Ver.1.3
43
+ @author Florian Schmitz (floele at gmail dot com) 2005-2006
44
+ @license http://opensource.org/licenses/gpl-license.php GNU Public License
45
+ */
46
+
47
+ if (version_compare(phpversion(), "5.0.0", "<"))
48
+ return false;
49
+
50
+ //**************************************************************************************
51
+ // Defines
52
+ //**************************************************************************************
53
+ if (!defined('HC_PRIORITY'))
54
+ define('HC_PRIORITY', 10000);
55
+ if (!defined('HC_ANALYZE_EXPIRED'))
56
+ define('HC_ANALYZE_EXPIRED', 604800); // 60 * 60 * 24 * 7 [sec.]
57
+ if (!defined('HC_XMLNS'))
58
+ define('HC_XMLNS', 'http://www.w3.org/1999/xhtml');
59
+ if (!defined('HC_CACHE_DIR'))
60
+ define('HC_CACHE_DIR', 'cache/head-cleaner');
61
+ if (!defined('HC_MAKE_GZ_FILE'))
62
+ define('HC_MAKE_GZ_FILE', false);
63
+
64
+ //**************************************************************************************
65
+ if (!defined('ABSPATH') && strstr($_SERVER['PHP_SELF'], '/head-cleaner.php')) {
66
+ define('HC_EXPIRED_JS_CSS', 2592000); // 60 * 60 * 24 * 30 [sec.]
67
+
68
+ $error = false;
69
+ if (isset($_GET['f']) && isset($_GET['t'])) {
70
+ $cache_dir = realpath(dirname(__FILE__) . '/../../' . HC_CACHE_DIR) . '/';
71
+ $filename_hash = trim(stripslashes($_GET['f']));
72
+ $type = trim(stripslashes($_GET['t']));
73
+
74
+ if (strlen($filename_hash) == 32 && ($type == 'js' || $type == 'css')) {
75
+ $is_gzip = (strpos(strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') !== FALSE);
76
+ $ob_gzip = false;
77
+
78
+ $filename = "{$cache_dir}{$type}/{$filename_hash}.{$type}";
79
+ if ($is_gzip && file_exists($filename.'.gz'))
80
+ $filename .= '.gz';
81
+ else
82
+ $ob_gzip = $is_gzip;
83
+
84
+ if (file_exists($filename)) {
85
+ $offset = (!defined('HC_EXPIRED_JS_CSS') ? HC_EXPIRED_JS_CSS : 60 * 60 * 24 * 30);
86
+ $content_type = 'text/' . ($type == 'js' ? 'javascript' : $type);
87
+
88
+ header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($filename)).' GMT');
89
+ header('Expires: '.gmdate('D, d M Y H:i:s', time() + $offset).' GMT');
90
+ header("Content-type: $content_type");
91
+
92
+ if ($is_gzip)
93
+ header('Content-Encoding: gzip');
94
+
95
+ if ($ob_gzip)
96
+ ob_start("ob_gzhandler");
97
+
98
+ readfile($filename);
99
+
100
+ if ($ob_gzip)
101
+ ob_end_flush();
102
+
103
+ $error = false;
104
+ } else {
105
+ $error = 404;
106
+ }
107
+ } else {
108
+ $error = 403;
109
+ }
110
+ } else {
111
+ $error = 403;
112
+ }
113
+
114
+ if ( $error === FALSE ) {
115
+ exit();
116
+ } else {
117
+ if(!function_exists('get_option')) {
118
+ $path = (defined('ABSPATH') ? ABSPATH : dirname(dirname(dirname(dirname(__FILE__)))) . '/');
119
+ require_once(file_exists($path.'wp-load.php') ? $path.'wp-load.php' : $path.'wp-config.php');
120
+ }
121
+
122
+ $err_msg = "Unknown Error";
123
+ switch ($error) {
124
+ case 403:
125
+ header("HTTP/1.0 403 Forbidden");
126
+ $err_msg = "403 : Forbidden";
127
+ break;
128
+ case 404:
129
+ header('HTTP/1.1 404 Not Found');
130
+ $err_msg = "404 : Not Found";
131
+ break;
132
+ default:
133
+ break;
134
+ }
135
+
136
+ if (function_exists('wp_die')) {
137
+ wp_die($err_msg);
138
+ } else {
139
+ echo $err_msg;
140
+ die();
141
+ }
142
+ }
143
+ }
144
+
145
+ //**************************************************************************************
146
+ // Require
147
+ //**************************************************************************************
148
+ if (!class_exists('wokController') || !class_exists('wokScriptManager'))
149
+ require(dirname(__FILE__).'/includes/common-controller.php');
150
+
151
+ //**************************************************************************************
152
+ // Head Cleaner
153
+ //**************************************************************************************
154
+ class HeadCleaner extends wokController {
155
+ public $plugin_name = 'head-cleaner';
156
+ public $plugin_ver = '1.3.9';
157
+
158
+ // Deafault Options
159
+ private $options_default = array(
160
+ 'foot_js' => false ,
161
+ 'dynamic' => false ,
162
+ 'js_move_foot' => false ,
163
+ 'cache_enabled' => false ,
164
+ 'combined_css' => false ,
165
+ 'combined_js' => false ,
166
+ 'js_minify' => false ,
167
+ 'css_optimise' => false ,
168
+ 'csstidy_option' => array(
169
+ 'optimise_shorthands' => 1 ,
170
+ 'compress_colors' => true ,
171
+ 'compress_font_weight' => true ,
172
+ 'remove_bslash' => true ,
173
+ 'template' => 1 ,
174
+ ) ,
175
+ 'default_media' => 'all' ,
176
+ 'debug_mode' => false ,
177
+ 'filters' => array('wp_head' => array(), 'wp_footer' => array()) ,
178
+ 'priority' => array('wp_head' => array(), 'wp_footer' => array()) ,
179
+ 'head_js' => array() ,
180
+ 'remove_js' => array() ,
181
+ 'analyze_expired'=> 0 ,
182
+ 'xml_declaration'=> false ,
183
+ 'ie_conditional' => false ,
184
+ 'canonical_tag' => true ,
185
+ 'gzip_on' => false ,
186
+ 'use_ajax_libs' => false ,
187
+ );
188
+ private $csstidy_template = array(
189
+ 'low_compression' ,
190
+ 'default' ,
191
+ 'high_compression' ,
192
+ 'highest_compression' ,
193
+ );
194
+
195
+ private $wp_url = '';
196
+ private $self_url = '';
197
+ private $cache_path = '';
198
+ private $cache_url = '';
199
+
200
+ private $lang;
201
+ private $foot_js_src;
202
+
203
+ private $mtime_start;
204
+
205
+ private $filters;
206
+ private $head_js;
207
+ private $no_conflict = array(
208
+ 'comment_quicktags' , // Comment Quicktags
209
+ 'stats_footer' , // WordPress.com Stats
210
+ 'uga_wp_footer_track' , // Ultimate Google Analytics
211
+ 'tam_google_analytics::insert_tracking_code' , // TaM Google Analytics
212
+ 'Ktai_Entry::add_check_messages' , // Ktai Entry
213
+ );
214
+
215
+ private $default_head_filters = array(
216
+ 'HeadCleaner::.*' ,
217
+ 'noindex' ,
218
+ 'lambda_[\d]+' ,
219
+ 'rsd_link' ,
220
+ 'wlwmanifest_link' ,
221
+ 'wp_generator' ,
222
+ );
223
+
224
+ private $ob_handlers = array(
225
+ 'All_in_One_SEO_Pack::output_callback_for_title' => false ,
226
+ 'wpSEO::exe_modify_content' => false ,
227
+ );
228
+
229
+
230
+ /**********************************************************
231
+ * Constructor
232
+ ***********************************************************/
233
+ public function HeadCleaner() {
234
+ $this->__construct();
235
+ }
236
+ public function __construct() {
237
+ $this->init(__FILE__);
238
+ $this->options = $this->_init_options($this->getOptions());
239
+ $this->filters = $this->options['filters'];
240
+ $this->head_js = $this->options['head_js'];
241
+
242
+ $this->wp_url = trailingslashit(get_bloginfo('wpurl'));
243
+ $this->self_url = str_replace(ABSPATH, $this->wp_url, __FILE__);
244
+ $this->lang = (defined('WPLANG') ? WPLANG : 'ja');
245
+ $this->charset = get_option('blog_charset');
246
+ $this->_get_filters('wp_head');
247
+ $this->_get_filters('wp_footer');
248
+
249
+ // Create Directory for Cache
250
+ if ( $this->options['cache_enabled'] ) {
251
+ $this->cache_path = $this->_create_cache_dir();
252
+ if ($this->cache_path !== FALSE) {
253
+ $this->cache_url = str_replace(ABSPATH, $this->wp_url, $this->cache_path);
254
+ } else {
255
+ $this->options['cache_enabled'] = false;
256
+
257
+ $this->options['combined_css'] = false;
258
+ $this->options['combined_js'] = false;
259
+
260
+ $this->options['js_minify'] = false;
261
+ $this->options['css_optimise'] = false;
262
+ }
263
+ }
264
+
265
+ if (is_admin()) {
266
+ add_action('admin_menu', array(&$this, 'admin_menu'));
267
+ add_filter('plugin_action_links', array(&$this, 'plugin_setting_links'), 10, 2 );
268
+
269
+ } else {
270
+ // Require PHP Libraries
271
+ $this->_require_libraries();
272
+
273
+ add_action('get_header', array(&$this, 'head_start'));
274
+ add_action('wp_footer', array(&$this, 'filters_save'), 11);
275
+
276
+ // remove_filter('the_content', 'wpautop');
277
+ // remove_filter('the_content', 'wptexturize');
278
+ // add_filter('the_content', array(&$head_cleaner, 'raw_formatter'), 99);
279
+
280
+ // remove_filter('the_excerpt', 'wpautop');
281
+ // remove_filter('the_excerpt', 'wptexturize');
282
+ // add_filter('the_excerpt', array(&$head_cleaner, 'raw_formatter'), 99);
283
+ }
284
+ }
285
+
286
+ /**********************************************************
287
+ * Init Options
288
+ ***********************************************************/
289
+ private function _init_options($wk_options = '') {
290
+ if (!is_array($wk_options))
291
+ $wk_options = array();
292
+
293
+ foreach ($this->options_default as $key => $val) {
294
+ $wk_options[$key] = (isset($wk_options[$key]) ? $wk_options[$key] : $val);
295
+ }
296
+
297
+ if (time() > $wk_options['analyze_expired']) {
298
+ $filters = $this->options_default['filters'];
299
+
300
+ $priority = $this->options_default['priority'];
301
+ foreach ($wk_options['priority'] as $tag => $filters) {
302
+ foreach ((array) $filters as $key => $val) {
303
+ if ($val <= 0 || $val > HC_PRIORITY)
304
+ $priority[$tag][$key] = $val;
305
+ }
306
+ }
307
+ unset($filters);
308
+
309
+ $head_js = $this->options_default['head_js'];
310
+ foreach ((array) $wk_options['head_js'] as $key => $val) {
311
+ if ($val === FALSE)
312
+ $head_js[$key] = $val;
313
+ }
314
+
315
+ $wk_options['filters'] = $filters;
316
+ $wk_options['priority'] = $priority;
317
+ $wk_options['head_js'] = $head_js;
318
+ $wk_options['analyze_expired'] = time() + HC_ANALYZE_EXPIRED;
319
+ }
320
+ return $wk_options;
321
+ }
322
+
323
+ /**********************************************************
324
+ * Require Libraries
325
+ ***********************************************************/
326
+ private function _require_libraries(){
327
+ $includes = dirname(__FILE__) . '/includes/';
328
+
329
+ // PHP Simple HTML DOM Parser
330
+ if (!function_exists('str_get_html'))
331
+ require($includes . 'simple_html_dom.php' );
332
+
333
+ // jsmin.php - PHP implementation of Douglas Crockford's JSMin.
334
+ if ($this->options['js_minify'] && !class_exists('JSMin')) {
335
+ require($includes . 'JSMin.php');
336
+ $this->options['js_minify'] = class_exists('JSMin') && $this->options['js_minify'];
337
+ }
338
+
339
+ // // CSSTidy - CSS Parser and Optimiser
340
+ // if ($this->options['css_optimise'] && !class_exists('csstidy')) {
341
+ // require($includes . 'csstidy-1.3/class.csstidy.php');
342
+ // $this->options['css_optimise'] = class_exists('csstidy') && $this->options['css_optimise'];
343
+ // }
344
+ if ($this->options['css_optimise'] && !class_exists('Minify_CSS')) {
345
+ require($includes . 'CSSMin.php');
346
+ $this->options['css_optimise'] = class_exists('Minify_CSS') && $this->options['css_optimise'];
347
+ }
348
+
349
+ // Use Google Ajax Libraries
350
+ if ($this->options['use_ajax_libs'])
351
+ require($includes . 'regist_ajax_libs.php');
352
+ }
353
+
354
+ //**************************************************************************************
355
+ // plugin activation
356
+ //**************************************************************************************
357
+ public function activation(){
358
+ $cache_dir = $this->_create_cache_dir();
359
+ if ( $cache_dir !== FALSE )
360
+ $this->_create_htaccess($cache_dir);
361
+ }
362
+
363
+ //**************************************************************************************
364
+ // plugin deactivation
365
+ //**************************************************************************************
366
+ public function deactivation(){
367
+ // $this->_remove_cache_file();
368
+ }
369
+
370
+ //**************************************************************************************
371
+ // ob_start for Header
372
+ //**************************************************************************************
373
+ public function head_start(){
374
+ if (! $this->_is_mobile() ) {
375
+ $ob_handlers = (array) ob_list_handlers();
376
+ if ( count($ob_handlers) > 0 ) {
377
+ foreach ( $ob_handlers as $ob_handler ) {
378
+ if ( isset($this->ob_handlers[$ob_handler]) ) {
379
+ $this->ob_handlers[$ob_handler] = true;
380
+ ob_end_flush();
381
+ }
382
+ }
383
+ }
384
+
385
+ ob_start(array(&$this, 'head_cleaner'));
386
+ $this->mtime_start = microtime();
387
+
388
+ if ( function_exists('rel_canonical') && !$this->options['canonical_tag'] )
389
+ remove_action( 'wp_head', 'rel_canonical' );
390
+
391
+ add_action('wp_head', array(&$this, 'end'), HC_PRIORITY);
392
+ $this->_get_filters('wp_head');
393
+ $this->_change_filters_priority('wp_head');
394
+
395
+ if ($this->options['foot_js'])
396
+ add_action('wp_footer', array(&$this, 'footer_start'), 1);
397
+ }
398
+ }
399
+
400
+ //**************************************************************************************
401
+ // ob_start for footer
402
+ //**************************************************************************************
403
+ public function footer_start(){
404
+ if (! $this->_is_mobile() && $this->options['foot_js'] ) {
405
+ $ob_handlers = (array) ob_list_handlers();
406
+ if ( count($ob_handlers) > 0 ) {
407
+ foreach ( $ob_handlers as $ob_handler ) {
408
+ if ( isset($this->ob_handlers[$ob_handler]) ) {
409
+ $this->ob_handlers[$ob_handler] = true;
410
+ ob_end_flush();
411
+ }
412
+ }
413
+ }
414
+
415
+ ob_start(array(&$this, 'footer_cleaner'));
416
+ $this->mtime_start = microtime();
417
+
418
+ add_action('wp_footer', array(&$this, 'end'), HC_PRIORITY);
419
+ $this->_get_filters('wp_footer');
420
+ $this->_change_filters_priority('wp_footer');
421
+ }
422
+ }
423
+
424
+ //**************************************************************************************
425
+ // ob_handler
426
+ //**************************************************************************************
427
+ private function ob_handler($content){
428
+ foreach ( $this->ob_handlers as $ob_handler => $enable ) {
429
+ if ( $enable ) {
430
+ switch ($ob_handler) {
431
+ case 'All_in_One_SEO_Pack::output_callback_for_title':
432
+ global $aiosp;
433
+ if ( isset($aiosp) )
434
+ $content = $aiosp->rewrite_title($content);
435
+ break;
436
+ case 'wpSEO::exe_modify_content':
437
+ if ( isset($GLOBALS['wpSEO']) ) {
438
+ $wpSEO = $GLOBALS['wpSEO'];
439
+ $content = $wpSEO->exe_modify_content($content);
440
+ }
441
+ break;
442
+ default :
443
+ break;
444
+ }
445
+ $this->ob_handlers[$ob_handler] = false;
446
+ }
447
+ }
448
+
449
+ return $content;
450
+ }
451
+
452
+ //**************************************************************************************
453
+ // ob_end_flush
454
+ //**************************************************************************************
455
+ public function end(){
456
+ ob_end_flush();
457
+ }
458
+
459
+ //**************************************************************************************
460
+ // filters info save
461
+ //**************************************************************************************
462
+ public function filters_save(){
463
+ if ($this->_chk_filters_update()) {
464
+ if ( $this->options['filters'] != $this->filters || $this->options['head_js'] != $this->head_js ) {
465
+ $this->options['filters'] = $this->filters;
466
+ $this->options['head_js'] = $this->head_js;
467
+ if (time() > $this->options['analyze_expired'])
468
+ $this->options['analyze_expired'] = time() + HC_ANALYZE_EXPIRED;
469
+ $this->updateOptions();
470
+ }
471
+ }
472
+ }
473
+
474
+ //**************************************************************************************
475
+ // head cleaner
476
+ //**************************************************************************************
477
+ public function head_cleaner($buffer) {
478
+ if (!function_exists('str_get_html'))
479
+ return trim($buffer) . "\n";
480
+
481
+ $buffer = $this->ob_handler($buffer);
482
+
483
+ $url = $this->_get_permalink();
484
+
485
+ $xml_head = "<?xml version=\"1.0\" encoding=\"{$this->charset}\"?>\n";
486
+ $html_tag = "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"{$this->lang}\" lang=\"{$this->lang}\">\n";
487
+ $head_tag = "<head profile=\"http://gmpg.org/xfn/11\">\n";
488
+ $head_txt = trim($buffer);
489
+
490
+ $ret_val = '';
491
+ $meta_tag = ''; $title_tag = ''; $base_tag = '';
492
+ $link_tag = ''; $object_tag = ''; $other_tag = '';
493
+ $css_tag = ''; $inline_css = '';
494
+ $script_tag = ''; $inline_js = '';
495
+
496
+ // for IE conditional tag
497
+ $IE_conditional_tag_pattern = '/<\!-+[ \t]*\[if[ \t]+%sIE%s[ \t]*?\][ \t]*>(.*?)<\![ \t]*\[endif\][ \t]*-+>/ism';
498
+ $IE_conditional_tags = array();
499
+ if ($this->options['ie_conditional']) {
500
+ $ua = trim(strtolower($_SERVER['HTTP_USER_AGENT']));
501
+ $ie = (strpos($ua, 'msie') !== false)
502
+ && (! preg_match('/(gecko|applewebkit|opera|sleipnir|chrome)/i', $ua));
503
+ $ie_ver = ($ie ? preg_replace('/^.*msie +([\d\.]+);.*$/i', '$1', $ua) : false);
504
+ $ie6 = ($ie ? version_compare($ie_ver, '7.0', '<') : false);
505
+ if ($ie) {
506
+ $head_txt = preg_replace(sprintf($IE_conditional_tag_pattern, '', ''), '$1', $head_txt);
507
+
508
+ $replace_patterns = array();
509
+ if (version_compare($ie_ver, '5.5', '<')) { // IE 5
510
+ $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)', ' 5\.?0?'); // >= 5, <= 5, = 5
511
+ $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)', ' 5\.5'); // < 5.5, <= 5.5
512
+ $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)', ' [678]\.?0?'); // < 6 - 8, <= 6 - 8
513
+ } elseif (version_compare($ie_ver, '6.0', '<')) { // IE 5.5
514
+ $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)', ' 5\.5'); // >= 5.5, <= 5.5, = 5.5
515
+ $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)', ' [678]\.?0?'); // < 6 - 8, <= 6 - 8
516
+ $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' 5\.?0?'); // > 5, >= 5
517
+ } elseif (version_compare($ie_ver, '7.0', '<')) { // IE 6
518
+ $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)', ' 6\.?0?'); // >= 6, <= 6, = 6
519
+ $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)', ' [78]\.?0?'); // < 7 - 8, <= 7 - 8
520
+ $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' 5\.?0?'); // > 5, >= 5
521
+ $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' 5\.5'); // > 5.5, >= 5.5
522
+ } elseif (version_compare($ie_ver, '8.0', '<')) { // IE 7
523
+ $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)', ' 7\.?0?'); // >= 7, <= 7, = 7
524
+ $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(lte?[ \t]*)', ' 8\.?0?'); // < 8, <= 8
525
+ $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' [56]\.?0?'); // > 5 - 6, >= 5 - 6
526
+ $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' 5\.5'); // > 5.5, >= 5.5
527
+ } elseif (version_compare($ie_ver, '9.0', '<')) { // IE 8
528
+ $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*|[ \t]*)', ' 8\.?0?'); // >= 8, <= 8, = 8
529
+ $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' [567]\.?0?'); // > 5 - 7, >= 5 - 7
530
+ $replace_patterns[] = sprintf($IE_conditional_tag_pattern, '(gte?[ \t]*)', ' 5\.5'); // > 5.5, >= 5.5
531
+ }
532
+
533
+ if (count($replace_patterns) > 0)
534
+ $head_txt = preg_replace($replace_patterns, '$2', $head_txt);
535
+ unset($replace_patterns);
536
+ }
537
+ } else {
538
+ $search_pattern = sprintf($IE_conditional_tag_pattern, '([lg]te[ \t]*)?', '([ \t]+[05678\.]*)?');
539
+ preg_match_all($search_pattern, $head_txt, $IE_conditional_tags, PREG_PATTERN_ORDER);
540
+ $head_txt = preg_replace($search_pattern, '', $head_txt);
541
+ }
542
+
543
+ if (preg_match('/^(.*)(<html[^>]*>[^<]*)(<head[^>]*>[^<]*)(.*)$/ism', $head_txt, $matches)) {
544
+ $ret_val = trim($matches[1]) . "\n";
545
+ $html_tag = trim($matches[2]) . "\n";
546
+ $head_tag = trim($matches[3]) . "\n";
547
+ $head_txt = trim($matches[4]) . "\n";
548
+ }
549
+ unset($matches);
550
+ $html_txt = $xml_head . $html_tag . $head_tag
551
+ . $head_txt
552
+ . '</head><body></body></html>';
553
+
554
+ // Get Simple DOM Object
555
+ $dom = str_get_html($html_txt);
556
+ if ($dom === false)
557
+ return (trim($buffer)."\n");
558
+
559
+ $xmlns = (defined('HC_XMLNS') ? HC_XMLNS : 'http://www.w3.org/1999/xhtml');
560
+ $xml_lang = $this->lang;
561
+ $lang = $this->lang;
562
+ if (preg_match_all('/ +([^ ]*)=[\'"]([^\'"]*)[\'"]/', $html_tag, $mathes, PREG_SET_ORDER)) {
563
+ foreach ((array) $matches as $match) {
564
+ switch ($match[1]){
565
+ case 'xmlns': $xmlns = $match[2]; break;
566
+ case 'xml:lang': $xml_lang = $match[2]; break;
567
+ case 'lang': $lang = $match[2]; break;
568
+ }
569
+ }
570
+ unset($match);
571
+ }
572
+ unset($matches);
573
+ $html_tag = "<html xmlns=\"{$xmlns}\" xml:lang=\"{$xml_lang}\" lang=\"{$lang}\">\n";
574
+
575
+ $meta_tag = $this->_dom_to_html($dom->find("meta"));
576
+ $title_tag = $this->_dom_to_html($dom->find("title"), 1);
577
+ $base_tag = $this->_dom_to_html($dom->find("base"), 1);
578
+ $link_tag = $this->_dom_to_html($dom->find("link[rel!='stylesheet']"));
579
+ if (count($dom->find("link[rel='canonical']")) <= 0 && $this->options['canonical_tag'])
580
+ $link_tag .= '<link rel="canonical" href="' . htmlspecialchars($url, ENT_QUOTES) . '" />'."\n";
581
+
582
+ $css_tag = ''; $css_tag_with_id = ''; $inner_css = ''; $css_src = array();
583
+ $elements = $dom->find("link[rel='stylesheet']");
584
+ foreach ((array) $elements as $element) {
585
+ $tag = trim($element->outertext);
586
+ if (strpos($css_tag, $tag) === FALSE) {
587
+ if (strpos($element->href, $this->wp_url) === FALSE) {
588
+ $css_tag .= trim($tag) . "\n";
589
+ } elseif ( isset($element->id) && !empty($element->id) ) {
590
+ $css_tag_with_id .= trim($tag) . "\n";
591
+ } else {
592
+ $media = trim( isset($element->media) ? $element->media : $this->options['default_media'] );
593
+ $media = ( empty($media) || is_null($media) || $media === FALSE ? $this->options['default_media'] : $media );
594
+ $inner_css .= trim($tag) . "\n";
595
+ $css_src[$media][] = $element->href;
596
+ }
597
+ }
598
+ }
599
+ unset($element); unset($elements);
600
+
601
+ $elements = $dom->find("style");
602
+ $wk_inline_css = array();
603
+ foreach ((array) $elements as $element) {
604
+ $media = trim( isset($element->media) ? $element->media : $this->options['default_media'] );
605
+ $media = ( empty($media) || is_null($media) || $media === FALSE ? $this->options['default_media'] : $media );
606
+ $wk_text = $this->_remove_comment($element->innertext, 'css');
607
+ if ( preg_match_all('/@import[\s]+url[\s]*\([\s\'"]*([^\)\'"]*?)[\s\'"]*\);/i', $wk_text, $wk_matches, PREG_SET_ORDER) ) {
608
+ foreach ($wk_matches as $val) {
609
+ $wk_text = trim(str_replace( $val[0], '', $wk_text));
610
+ $href = trim($val[1]);
611
+ $tag = "<link rel=\"stylesheet\" href=\"{$href}\" type=\"text/css\" media=\"{$media}\" />";
612
+ if (strpos( $href, $this->wp_url) === FALSE) {
613
+ $css_tag .= $tag . "\n";
614
+ } else {
615
+ $inner_css .= $tag . "\n";
616
+ $css_src[$media][] = $href;
617
+ }
618
+ }
619
+ }
620
+ unset($wk_matches);
621
+ if ( !empty($wk_text) )
622
+ $wk_inline_css[$media] .= trim($wk_text) . "\n";
623
+ }
624
+ $inline_css = '';
625
+ if ($this->options['cache_enabled']) {
626
+ if ($this->options['combined_css']) {
627
+ $css_tag = trim($css_tag) . "\n";
628
+ foreach ($css_src as $key => $val) {
629
+ $inner_css = $this->_combined_css($val, trim(isset($wk_inline_css[$key]) ? $wk_inline_css[$key] : '' ), $key);
630
+ $css_tag .= trim($inner_css) . "\n" . trim($css_tag_with_id) . "\n";
631
+ if (isset($wk_inline_css[$key])) $wk_inline_css[$key] = '';
632
+ }
633
+ foreach ($wk_inline_css as $key => $val) {
634
+ $val = trim($val);
635
+ if (!empty($val)) {
636
+ $inner_css = $this->_combined_css(array(), $val, $key);
637
+ $css_tag .= trim($inner_css) . "\n";
638
+ }
639
+ }
640
+ } else {
641
+ $css_tag = trim($css_tag) . "\n" . trim($inner_css) . "\n" . trim($css_tag_with_id) . "\n";
642
+ foreach ($wk_inline_css as $key => $val) {
643
+ $val = trim($val);
644
+ if (!empty($val)) {
645
+ $inner_css = $this->_combined_inline_css(trim($val), $key);
646
+ $inline_css .= trim($inner_css) . "\n";
647
+ }
648
+ }
649
+ }
650
+ } else {
651
+ $css_tag = trim($css_tag) . "\n" . trim($inner_css) . "\n" . trim($css_tag_with_id) . "\n";
652
+ foreach ($wk_inline_css as $key => $val) {
653
+ $val = trim($val);
654
+ if (!empty($val)) {
655
+ $inline_css .=
656
+ '<style type="text/css"' . (!empty($media) ? " media=\"{$media}\"" : '') . ">/*<![CDATA[ */\n" .
657
+ $val .
658
+ "\n/* ]]>*/</style>\n";
659
+ }
660
+ }
661
+ }
662
+ $css_tag = trim($css_tag) . (!empty($css_tag) ? "\n" : '');
663
+ $inner_css = trim($inner_css) . (!empty($inner_css) ? "\n" : '');
664
+ $inline_css = trim($inline_css) . (!empty($inline_css) ? "\n" : '');
665
+ unset($wk_inline_css);
666
+ unset($element); unset($elements);
667
+
668
+ $inner_js = '';
669
+ $foot_js = '';
670
+ $js_src = array();
671
+ $js_libs = array();
672
+ $elements = $dom->find("script");
673
+ foreach ((array) $elements as $element) {
674
+ if (!isset($element->src)) {
675
+ $inline_js .= $this->_remove_comment($element->innertext, 'js');
676
+ } else {
677
+ $src = trim($element->src);
678
+ if (!isset($this->head_js[$src]))
679
+ $this->head_js[$src] = true;
680
+
681
+ if (array_search( $src, (array) $this->options['remove_js']) === FALSE) {
682
+ $find = FALSE;
683
+ if (preg_match('/\/((prototype|jquery|mootools)\.js)\?ver=([\.\d]+)[^\?]*$/i', $src, $matches)) {
684
+ list($find, $filename, $product, $version) = $matches;
685
+ } elseif (preg_match('/\/((prototype|jquery|mootools)[\-\.](min|[\.\d]+)[^\/]*\.js)\?[^\?]*$/i', $src, $matches)) {
686
+ list($find, $filename, $product, $version) = $matches;
687
+ } elseif (preg_match('/\/scriptaculous\/((builder|controls|dragdrop|effects|wp\-scriptaculous|scriptaculous|slider|sound|unittest)\.js)\?ver\=([\.\d]+)[^\?]*$/i', $src, $matches)) {
688
+ list($find, $filename, $product, $version) = $matches;
689
+ $product = (strpos($product, 'scriptaculous') === FALSE
690
+ ? 'scriptaculous/' . $product
691
+ : 'scriptaculous/scriptaculous');
692
+ }
693
+ unset($matches);
694
+
695
+ if ($find !== FALSE) {
696
+ $version = trim(substr($version, -1) === '.' ? substr($version, 0, -1) : $version);
697
+ if (empty($version))
698
+ $version = preg_replace('/^.*\/([\.\d]+)\/.*$/', '$1', $src);
699
+ if (!preg_match('/^[\.\d]*\d$/', $version))
700
+ $version = '1';
701
+ $js_libs[$product][$version] = $src;
702
+ } elseif ($this->head_js[$src] === FALSE) {
703
+ $foot_js .= trim($element->outertext) . "\n";
704
+ } elseif (strpos($src, $this->wp_url) === FALSE) {
705
+ $script_tag .= trim($element->outertext) . "\n";
706
+ } else {
707
+ $inner_js .= trim($element->outertext) . "\n";
708
+ $js_src[] = $element->src;
709
+ }
710
+ }
711
+ }
712
+ }
713
+ unset($element); unset($elements);
714
+
715
+ // JavaScript FrameWork (Prototype.js > jQuery > mootools)
716
+ if (count($js_libs) > 0) {
717
+ list($js_libs_src, $wk_inner_js, $wk_outer_js) = $this->_js_framework($js_libs);
718
+
719
+ if (count($js_libs_src) > 0)
720
+ $js_src = array_merge($js_libs_src, $js_src);
721
+
722
+ $script_tag = trim($script_tag) . "\n" . $wk_outer_js;
723
+ $inner_js = $wk_inner_js . $inner_js;
724
+
725
+ unset($js_libs_src); unset($js_libs);
726
+ }
727
+
728
+ $inline_js = trim($inline_js);
729
+ if ($this->options['cache_enabled']) {
730
+ if ($this->options['combined_js']) {
731
+ $inner_js = $this->_combined_javascript($js_src, trim($inline_js));
732
+ $script_tag = trim(trim($script_tag) . "\n" . $inner_js) . "\n";
733
+ $inline_js = '';
734
+ } else {
735
+ $script_tag = trim(trim($script_tag) . "\n" . $inner_js) . "\n";
736
+ $inline_js = $this->_combined_inline_javascript(trim($inline_js));
737
+ }
738
+ } else {
739
+ $script_tag = trim(trim($script_tag) . "\n" . $inner_js) . "\n";
740
+ $inline_js = (!empty($inline_js) ? "<script type=\"text/javascript\">//<![CDATA[\n{$inline_js}\n//]]></script>\n" : '');
741
+ }
742
+ $script_tag = trim($script_tag) . (!empty($script_tag) ? "\n" : '');
743
+ $inner_js = trim($inner_js) . (!empty($inner_js) ? "\n" : '');
744
+ $inline_js = trim($inline_js) . (!empty($inline_js) ? "\n" : '');
745
+ $foot_js = trim($foot_js) . (!empty($foot_js) ? "\n" : '');
746
+
747
+ $object_tag = $this->_dom_to_html($dom->find("object"));
748
+
749
+ $dom->clear(); unset($dom);
750
+
751
+ // for IE conditional tag
752
+ if (!$this->options['ie_conditional'] && count($IE_conditional_tags) > 0) {
753
+ $IE_conditional_tag_pattern = '/(<\!-+[ \t]*\[if[ \t]+.*IE.*[ \t]*?\][ \t]*>)[ \t\r\n]*(.*?)[ \t\r\n]*(<\![ \t]*\[endif\][ \t]*-+>)/ism';
754
+ foreach ((array) $IE_conditional_tags as $IE_conditional_tag) {
755
+ if (preg_match($IE_conditional_tag_pattern, $IE_conditional_tag[0])) {
756
+ $IE_tag = trim(preg_replace($IE_conditional_tag_pattern, "$1\n$2\n$3", $IE_conditional_tag[0])) . "\n";
757
+ if ( strpos(strtolower($IE_tag), '<link') !== false )
758
+ $css_tag = trim($css_tag) . "\n" . $IE_tag;
759
+ elseif ( strpos(strtolower($IE_tag), '<style') !== false )
760
+ $inline_css = trim($inline_css) . "\n" . $IE_tag;
761
+ elseif ( strpos(strtolower($IE_tag), '<script') !== false )
762
+ $inline_js = trim($inline_js) . "\n" . $IE_tag;
763
+ else
764
+ $object_tag = trim($object_tag) . "\n" . $IE_tag;
765
+ }
766
+ }
767
+ }
768
+ unset($IE_conditional_tag);
769
+
770
+ $ret_val .=
771
+ $html_tag
772
+ . $head_tag
773
+ . $meta_tag
774
+ . $title_tag
775
+ . $base_tag
776
+ . $link_tag
777
+ . $css_tag
778
+ . $inline_css
779
+ . (!$this->options['js_move_foot'] ? $script_tag : '')
780
+ . (!$this->options['js_move_foot'] ? $inline_js : '')
781
+ . $object_tag
782
+ ;
783
+ //$ret_val = str_replace('\'', '"', $ret_val);
784
+ $ret_val = preg_replace(
785
+ array( "/[\s]+([^\=]+)\='([^']*)'/i", '/[\n\r]+/i', '/(<\/[^>]+>)[ \t]*(<[^>]+)/i' ) ,
786
+ array( ' $1="$2"', "\n", "$1\n$2" ),
787
+ $ret_val
788
+ );
789
+
790
+ if ($this->options['js_move_foot'] || !empty($foot_js))
791
+ $this->foot_js_src = trim(
792
+ $foot_js
793
+ . ($this->options['js_move_foot'] ? $script_tag : '')
794
+ . ($this->options['js_move_foot'] ? $inline_js : '')
795
+ );
796
+ if (!empty($this->foot_js_src)) {
797
+ $this->foot_js_src .= "\n";
798
+ add_action('wp_footer', array(&$this, 'footer'), 9);
799
+ }
800
+
801
+ if ($this->options['dynamic']) {
802
+ $ret_val = preg_replace(
803
+ '/' . preg_quote($this->cache_url, '/') . '(js|css)\/([^\.]*)\.(js|css)/i' ,
804
+ $this->self_url . "?f=$2&amp;t=$3" ,
805
+ $ret_val
806
+ );
807
+ }
808
+
809
+ $ret_val = ($ie6 || !$this->options['xml_declaration']
810
+ ? preg_replace('/^<\?xml[^>]*>/i', '', $ret_val)
811
+ : (strpos($ret_val, '<?xml') === false ? $xml_head : '') . $ret_val
812
+ );
813
+ $ret_val = trim($ret_val) . "\n";
814
+
815
+ if ($this->options['debug_mode'])
816
+ $ret_val .= $this->_get_debug_info($buffer);
817
+
818
+ return $ret_val;
819
+ }
820
+
821
+ //**************************************************************************************
822
+ // JavaScript Moved bottom
823
+ //**************************************************************************************
824
+ public function footer(){
825
+ echo $this->foot_js_src;
826
+ }
827
+
828
+ //**************************************************************************************
829
+ // footer cleaner
830
+ //**************************************************************************************
831
+ public function footer_cleaner($buffer) {
832
+ if (!function_exists('str_get_html'))
833
+ return trim($buffer) . "\n";
834
+
835
+ $buffer = $this->ob_handler($buffer);
836
+
837
+ $ret_val = '';
838
+ $script_tag = ''; $inline_js = '';
839
+ $other_tag = '';
840
+
841
+ $html_txt = '<html><head></head><body>'
842
+ . '<div id="footer">' . trim($buffer) . '</div>'
843
+ . '</body></html>';
844
+
845
+ // Get Simple DOM Object
846
+ $dom = str_get_html($html_txt);
847
+ if ($dom === false)
848
+ return (trim($buffer)."\n");
849
+
850
+ $inner_js = ''; $js_src = array();
851
+ $elements = $dom->find("div#footer *");
852
+ foreach ((array) $elements as $element) {
853
+ switch ($element->tag) {
854
+ case 'script':
855
+ if (!isset($element->src)) {
856
+ $inline_js .= $this->_remove_comment($element->innertext, 'js');
857
+ } else {
858
+ $src = $element->src;
859
+ if (array_search( $src, (array) $this->options['remove_js']) === FALSE) {
860
+ if (strpos($src, $this->wp_url) === FALSE) {
861
+ $script_tag .= trim($element->outertext) . "\n";
862
+ } else {
863
+ $inner_js .= trim($element->outertext) . "\n";
864
+ $js_src[] = preg_replace('/\.gz$/i', '', $src);
865
+ }
866
+ }
867
+ }
868
+ break;
869
+ default:
870
+ $tag = trim($element->outertext);
871
+ if (strpos($other_tag, $tag) === FALSE && ! preg_match('/^<\!\-+/', $tag))
872
+ $other_tag .= $tag . "\n";
873
+ break;
874
+ }
875
+ }
876
+ unset($element); unset($elements);
877
+
878
+ $inline_js = trim($inline_js);
879
+ if ($this->options['cache_enabled']) {
880
+ if ($this->options['combined_js']) {
881
+ $inner_js = $this->_combined_javascript($js_src, trim($inline_js));
882
+ $script_tag = trim(trim($script_tag) . "\n" . $inner_js) . "\n";
883
+ $inline_js = '';
884
+ } else {
885
+ $script_tag = trim(trim($script_tag) . "\n" . $inner_js) . "\n";
886
+ $inline_js = $this->_combined_inline_javascript(trim($inline_js));
887
+ }
888
+ } else {
889
+ $script_tag = trim(trim($script_tag) . "\n" . $inner_js) . "\n";
890
+ $inline_js = (!empty($inline_js) ? "<script type=\"text/javascript\">//<![CDATA[\n{$inline_js}\n//]]></script>\n" : '');
891
+ }
892
+
893
+ $dom->clear(); unset($dom);
894
+
895
+ $ret_val .=
896
+ $other_tag
897
+ . $script_tag
898
+ . $inline_js
899
+ ;
900
+
901
+ if ($this->options['dynamic']) {
902
+ $ret_val = preg_replace(
903
+ '/' . preg_quote($this->cache_url, '/') . '(js|css)\/([^\.]*)\.(js|css)/i' ,
904
+ $this->self_url . "?f=$2&amp;t=$3" ,
905
+ $ret_val
906
+ );
907
+ }
908
+
909
+ //$ret_val = str_replace('\'', '"', $ret_val);
910
+ $ret_val = trim(preg_replace(
911
+ array( "/[\s]+([^\=]+)\='([^']*)'/i", '/[\n\r]+/i', '/(<\/[^>]+>)[ \t]*(<[^>]+)/i' ) ,
912
+ array( ' $1="$2"', "\n", "$1\n$2" ),
913
+ $ret_val
914
+ )) . "\n";
915
+
916
+ if ($this->options['debug_mode'])
917
+ $ret_val .= $this->_get_debug_info($buffer);
918
+
919
+ return $ret_val;
920
+ }
921
+
922
+ //**************************************************************************************
923
+ // WP_CONTENT_DIR
924
+ //**************************************************************************************
925
+ private function _wp_content_dir($path = '') {
926
+ return (!defined('WP_CONTENT_DIR')
927
+ ? WP_CONTENT_DIR
928
+ : ABSPATH . 'wp-content'
929
+ ) . $path;
930
+ }
931
+
932
+ //**************************************************************************************
933
+ // is login?
934
+ //**************************************************************************************
935
+ private function _is_user_logged_in() {
936
+ if (function_exists('is_user_logged_in')) {
937
+ return is_user_logged_in();
938
+ } else {
939
+ global $user;
940
+ if (!isset($user)) $user = wp_get_current_user();
941
+ return (!empty($user->ID));
942
+ }
943
+ }
944
+
945
+ //**************************************************************************************
946
+ // Is mobile ?
947
+ //**************************************************************************************
948
+ private function _is_mobile() {
949
+ $is_mobile = $this->isKtai();
950
+
951
+ if ( !$is_mobile && function_exists('bnc_is_iphone') ) {
952
+ global $wptouch_plugin;
953
+
954
+ $is_mobile = bnc_is_iphone();
955
+ if ( $is_mobile && isset($wptouch_plugin) ) {
956
+ $is_mobile = isset($wptouch_plugin->desired_view)
957
+ ? $wptouch_plugin->desired_view == 'mobile'
958
+ : true;
959
+ }
960
+ }
961
+
962
+ return ($is_mobile);
963
+ }
964
+
965
+ //**************************************************************************************
966
+ // Get permalink
967
+ //**************************************************************************************
968
+ private function _get_permalink() {
969
+ $url = get_bloginfo('url');
970
+ if (! preg_match('|^(https?://[^/]*)|', $url, $host))
971
+ $host[1] = (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') ? 'http://' : 'https://' . $_SERVER['SERVER_NAME'];
972
+ $url = preg_replace( '/\?[^s].*$/i', '', $host[1] . $_SERVER['REQUEST_URI']);
973
+ unset($host);
974
+ return ($url);
975
+ }
976
+
977
+ //**************************************************************************************
978
+ // DOM Element -> html tag
979
+ //**************************************************************************************
980
+ private function _dom_to_html($elements, $limit = false) {
981
+ $html = ''; $count = 0;
982
+ $type = '';
983
+ $tags = array();
984
+ foreach ((array) $elements as $element) {
985
+ $tag = trim($element->outertext);
986
+ $type = strtolower($element->tag);
987
+ if (strpos($html, $tag) === FALSE) {
988
+ switch($type) {
989
+ case 'meta':
990
+ if (isset($element->name)) {
991
+ $name = strtolower($element->name);
992
+
993
+ $content = trim(isset($tags[$type][$name]) && isset($tags[$type][$name]['content'])
994
+ ? $tags[$type][$name]['content']
995
+ : '');
996
+ // $content = trim($content
997
+ // . (!empty($content) ? ', ' : '')
998
+ // . (isset($element->content) ? $element->content : '')
999
+ // );
1000
+ $contents = ( !empty($content) ? explode( ',', $content ) : array() );
1001
+ if ( isset($element->content) )
1002
+ $contents = array_merge( $contents, explode(',', $element->content) );
1003
+ $content = implode( ',', $contents );
1004
+ unset( $contents );
1005
+
1006
+ $tags[$type][$name] = array(
1007
+ 'name' => $name
1008
+ ,'content' => $content
1009
+ );
1010
+ } else {
1011
+ $html .= $tag . "\n";
1012
+ }
1013
+ break;
1014
+ case 'link':
1015
+ if (isset($element->rel)) {
1016
+ $name = strtolower($element->rel);
1017
+ $content = (isset($tags[$type][$name]) && isset($tags[$type][$name]['content'])
1018
+ ? $tags[$type][$name]['content']
1019
+ : '');
1020
+ $content .= $tag . "\n";
1021
+
1022
+ $tags[$type][$name] = array(
1023
+ 'name' => $name
1024
+ ,'content' => $content
1025
+ );
1026
+ } else {
1027
+ $html .= $tag . "\n";
1028
+ }
1029
+ break;
1030
+ default:
1031
+ $html .= $tag . "\n";
1032
+ break;
1033
+ }
1034
+ }
1035
+ if ($limit !== false && $count++ >= $limit) break;
1036
+ }
1037
+ unset($element); unset($elements);
1038
+
1039
+ foreach ((array) $tags as $tag_type => $contents) {
1040
+ switch($tag_type) {
1041
+ case 'meta':
1042
+ ksort( $contents );
1043
+ foreach ((array) $contents as $tag) {
1044
+ $html .= "<$type";
1045
+ foreach((array) $tag as $key => $val) {
1046
+ $html .= " $key=\"$val\"";
1047
+ }
1048
+ $html .= " />\n";
1049
+ }
1050
+ unset($tag);
1051
+ break;
1052
+ case 'link':
1053
+ default:
1054
+ foreach ((array) $contents as $tag) {
1055
+ $html .= $tag['content'];
1056
+ }
1057
+ unset($tag);
1058
+ break;
1059
+ }
1060
+ }
1061
+ unset($tags); unset($tag_types);
1062
+
1063
+ $html = trim($html);
1064
+
1065
+ return $html . (!empty($html) ? "\n" : '');
1066
+ }
1067
+
1068
+ //**************************************************************************************
1069
+ // Get absolute url
1070
+ //**************************************************************************************
1071
+ private function _abs_url($path, $base_path = ''){
1072
+ if (preg_match('/^https?:\/\//i', $base_path))
1073
+ $base_path = str_replace($this->wp_url, ABSPATH, $base_path);
1074
+
1075
+ $absolute_path = realpath($base_path . '/' . $path);
1076
+ if ( $absolute_path === FALSE )
1077
+ $absolute_path = $base_path . '/' . $path;
1078
+
1079
+ $url = str_replace(ABSPATH, $this->wp_url, $absolute_path);
1080
+ $url = str_replace('/./', '/', $url);
1081
+ $url = preg_replace('/(\/[^\/]*\/)\.\.(\/[^\/]*\/)/', '$2', $url);
1082
+
1083
+ return $url;
1084
+ }
1085
+
1086
+ private function _css_url_edit($content, $filename) {
1087
+ if (preg_match_all('/url[ \t]*\([\'"]?([^\)]*)[\'"]?\)/i', $content, $matches, PREG_SET_ORDER)) {
1088
+ $base_path = dirname($filename);
1089
+ $search = array(); $replace = array();
1090
+ foreach ((array) $matches as $match) {
1091
+ if (! preg_match('/^https?:\/\//i', trim($match[1]))) {
1092
+ $abs_url = $this->_abs_url(trim($match[1]), $base_path);
1093
+ $search[] = $match[0];
1094
+ $replace[] = str_replace(trim($match[1]), $abs_url, $match[0]);
1095
+ }
1096
+ }
1097
+ $content = str_replace($search, $replace, $content);
1098
+ unset($match); unset($search); unset($replace);
1099
+ }
1100
+ unset ($matches);
1101
+ return $content;
1102
+ }
1103
+
1104
+ //**************************************************************************************
1105
+ // Read file
1106
+ //**************************************************************************************
1107
+ private function _file_read($filename) {
1108
+ $content = false;
1109
+ if (preg_match('/^https?:\/\//i', $filename)) {
1110
+ $content = file_get_contents($filename);
1111
+ } else {
1112
+ $filename = realpath($filename);
1113
+ if ($filename !== FALSE && file_exists($filename)) {
1114
+ $handle = @fopen($filename, 'r');
1115
+ $content = trim(@fread($handle, filesize($filename)));
1116
+ @fclose($handle);
1117
+ }
1118
+ }
1119
+
1120
+ return $content;
1121
+ }
1122
+
1123
+ //**************************************************************************************
1124
+ // Read files
1125
+ //**************************************************************************************
1126
+ private function _files_read($files, $type = 'js') {
1127
+ $text = '';
1128
+ foreach ((array) $files as $filename) {
1129
+ $content = trim($this->_file_read($filename));
1130
+ switch ($type) {
1131
+ case 'css':
1132
+ $content = $this->_css_url_edit($content, $filename);
1133
+ break;
1134
+ case 'js':
1135
+ // $content = 'try{'
1136
+ // . trim($content . (substr($content, -1) !== ';' ? ';' : '')) . "\n"
1137
+ // . ($this->options['debug_mode']
1138
+ // ? '}catch(e){alert("error(' . basename($filename) . '): " + e.toString());}'
1139
+ // : '}finally{};');
1140
+ break;
1141
+ }
1142
+ // $text .= "/***** ".str_replace(ABSPATH, $this->wp_url,$filename)." *****/\n"
1143
+ // . $content . "\n\n";
1144
+ $text .= $content . "\n\n";
1145
+ }
1146
+ unset($filename);
1147
+ $text = trim($text);
1148
+
1149
+ return $text . (!empty($text) ? "\n" : '');
1150
+ }
1151
+
1152
+ //**************************************************************************************
1153
+ // Write file
1154
+ //**************************************************************************************
1155
+ private function _file_write($filename, $content = '', $gzip = true) {
1156
+ if (!empty($content)) {
1157
+ $handle = @fopen($filename, 'w');
1158
+ @fwrite($handle, $content);
1159
+ @fclose($handle);
1160
+
1161
+ return ($gzip
1162
+ ? $this->_file_gzip($filename, $content)
1163
+ : file_exists($filename)
1164
+ );
1165
+ } else {
1166
+ return false;
1167
+ }
1168
+ }
1169
+
1170
+ //**************************************************************************************
1171
+ // Write gzip file
1172
+ //**************************************************************************************
1173
+ private function _file_gzip($filename, $content = '') {
1174
+ if (file_exists($filename) && file_exists($filename . '.gz'))
1175
+ if (filemtime($filename) < filemtime($filename . '.gz'))
1176
+ return true;
1177
+
1178
+ if (function_exists('gzopen')) {
1179
+ if (empty($content)) {
1180
+ $handle = @fopen($filename, 'r');
1181
+ $content = @fread($handle, filesize($filename));
1182
+ @fclose($handle);
1183
+ }
1184
+
1185
+ if (!empty($content)) {
1186
+ $handle = @gzopen($filename . '.gz', 'w9');
1187
+ @gzwrite($handle, $content);
1188
+ @gzclose($handle);
1189
+ }
1190
+
1191
+ return (file_exists($filename . '.gz'));
1192
+ } else {
1193
+ return false;
1194
+ }
1195
+ }
1196
+
1197
+ //**************************************************************************************
1198
+ // JavaScript FrameWork (Prototype.js > scriptaculous > jQuery > jQuery.noConflict > mootools)
1199
+ //**************************************************************************************
1200
+ private function _js_framework($js_libs) {
1201
+ $prototype = isset($js_libs['prototype']);
1202
+ $jquery = isset($js_libs['jquery']);
1203
+ $mootools = isset($js_libs['mootools']);
1204
+ $js_libs_src = array();
1205
+ $wk_inner_js = '';
1206
+ $wk_outer_js = '';
1207
+
1208
+ // Prototype.js 1.6.0.3
1209
+ if ($prototype) {
1210
+ list($src, $ver) = $this->_newer_version_src($js_libs['prototype']);
1211
+ if (!empty($src)) {
1212
+ if (version_compare($ver, '1.6.0.3', '<='))
1213
+ $src = $this->plugin_url . 'includes/js/prototype-1.6.0.3.min.js';
1214
+
1215
+ $wk_outer_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
1216
+ }
1217
+ }
1218
+
1219
+ // scriptaculous 1.8.2
1220
+ if (isset($js_libs['scriptaculous/scriptaculous'])) {
1221
+ if (!$prototype) {
1222
+ $prototype = true;
1223
+ $src = $this->plugin_url . 'includes/js/prototype-1.6.0.3.min.js';
1224
+ $wk_outer_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
1225
+ }
1226
+ $scriptaculous = array(
1227
+ 'scriptaculous/scriptaculous'
1228
+ , 'scriptaculous/controls'
1229
+ , 'scriptaculous/dragdrop'
1230
+ , 'scriptaculous/effects'
1231
+ , 'scriptaculous/slider'
1232
+ , 'scriptaculous/sound'
1233
+ , 'scriptaculous/unittest'
1234
+ );
1235
+ foreach ($scriptaculous as $product) {
1236
+ if (isset($js_libs[$product])) {
1237
+ list($src, $ver) = $this->_newer_version_src($js_libs[$product]);
1238
+ if (!empty($src)) {
1239
+ if (version_compare($ver, '1.8.2', '<='))
1240
+ $src = $this->plugin_url . 'includes/js/' . $product . '.min.js';
1241
+
1242
+ $wk_outer_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
1243
+ }
1244
+ }
1245
+ }
1246
+ unset ($scriptaculous);
1247
+ }
1248
+
1249
+ // jQuery 1.2.6 or 1.3.2
1250
+ if ($jquery) {
1251
+ list($src, $ver) = $this->_newer_version_src($js_libs['jquery']);
1252
+ if (!empty($src)) {
1253
+ if ($prototype)
1254
+ $src = $this->plugin_url . 'includes/js/jquery-1.2.6.min.js';
1255
+ elseif (version_compare($ver, '1.3.2', '<='))
1256
+ $src = $this->plugin_url . 'includes/js/jquery-1.3.2.min.js';
1257
+
1258
+ if ($prototype || $mootools || strpos($src, $this->wp_url) === FALSE) {
1259
+ $wk_outer_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
1260
+ } else {
1261
+ $js_libs_src[] = $src;
1262
+ $wk_inner_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
1263
+ }
1264
+
1265
+ // jQuery noConflict
1266
+ if ($prototype || $mootools) {
1267
+ $src = $this->plugin_url . 'includes/js/jquery.noconflict.js';
1268
+ if (strpos($src, $this->wp_url) === FALSE) {
1269
+ $wk_outer_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
1270
+ } else {
1271
+ $js_libs_src[] = $src;
1272
+ $wk_inner_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
1273
+ }
1274
+ }
1275
+ }
1276
+ }
1277
+
1278
+ // mootools 1.2.1
1279
+ if ($mootools) {
1280
+ list($src, $ver) = $this->_newer_version_src($js_libs['mootools']);
1281
+ if (!empty($src)) {
1282
+ if (version_compare($ver, '1.2.1', '<='))
1283
+ $src = $this->plugin_url . 'includes/js/mootools-1.2.1-core-yc.js';
1284
+
1285
+ if ($prototype || $jquery || strpos($src, $this->wp_url) === FALSE) {
1286
+ $wk_outer_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
1287
+ } else {
1288
+ $js_libs_src[] = $src;
1289
+ $wk_inner_js .= "<script type=\"text/javascript\" src=\"$src\"></script>\n";
1290
+ }
1291
+ }
1292
+ }
1293
+
1294
+ return array($js_libs_src, $wk_inner_js, $wk_outer_js);
1295
+ }
1296
+
1297
+ //**************************************************************************************
1298
+ // Combined CSS
1299
+ //**************************************************************************************
1300
+ private function _combined_css($styles, $css = '', $media = 'all') {
1301
+ $html = '';
1302
+ $longfilename = ''; $files = array();
1303
+
1304
+ if (empty($media))
1305
+ $media = 'all';
1306
+
1307
+ foreach ((array) $styles as $style) {
1308
+ $src = trim(preg_replace('/(\.css|\.php)(\?[^\?]*)$/i', '$1', str_replace($this->wp_url, ABSPATH, $style)));
1309
+ if (file_exists($src)) {
1310
+ $filename = (preg_match('/\.css$/i', $src) ? $src : $style);
1311
+ $longfilename .= $filename . filemtime($src);
1312
+ $files[] = $filename;
1313
+ } else {
1314
+ $html .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$style}\" media=\"{$media}\" />\n";
1315
+ }
1316
+ }
1317
+
1318
+ $md5_filename = md5($longfilename . $css);
1319
+ $longfilename = 'css/' . $md5_filename . '.css';
1320
+ $filename = $this->cache_path . $longfilename;
1321
+ if (! file_exists($filename) ) {
1322
+ if (count($files) > 0 && !empty($longfilename))
1323
+ $css = $this->_files_read($files, 'css') . "\n\n" . $css;
1324
+
1325
+ // Optimise CSS
1326
+ $css = $this->_css_optimise($css);
1327
+
1328
+ if (!empty($css))
1329
+ $this->_file_write($filename, $css, $this->options['gzip_on'] || HC_MAKE_GZ_FILE );
1330
+ }
1331
+
1332
+ $fileurl = ($this->options['dynamic']
1333
+ ? $this->self_url . '?f=' . $md5_filename . '&amp;t=css'
1334
+ : $this->cache_url . $longfilename
1335
+ );
1336
+ if (file_exists($filename))
1337
+ $html .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$fileurl}\" media=\"{$media}\" />\n";
1338
+
1339
+ return $html;
1340
+ }
1341
+
1342
+ //**************************************************************************************
1343
+ // Combined inline CSS
1344
+ //**************************************************************************************
1345
+ private function _combined_inline_css($css, $media = 'all') {
1346
+ if (empty($css))
1347
+ return '';
1348
+
1349
+ if (empty($media))
1350
+ $media = 'all';
1351
+
1352
+ $html = '';
1353
+ $md5_filename = md5($css);
1354
+ $longfilename = 'css/'. $md5_filename . '.css';
1355
+
1356
+ // Optimise CSS
1357
+ $css = $this->_css_optimise($css);
1358
+
1359
+ $filename = $this->cache_path . $longfilename;
1360
+ if (!file_exists($filename) && !empty($css))
1361
+ $this->_file_write($filename, $css, $this->options['gzip_on'] || HC_MAKE_GZ_FILE);
1362
+
1363
+ $fileurl = ($this->options['dynamic']
1364
+ ? $this->self_url . '?f=' . $md5_filename . '&amp;t=css'
1365
+ : $this->cache_url . $longfilename
1366
+ );
1367
+ if (file_exists($filename))
1368
+ $html .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$fileurl}\" media=\"{$media}\" />\n";
1369
+
1370
+ return $html;
1371
+ }
1372
+
1373
+ //**************************************************************************************
1374
+ // Combined JavaScript
1375
+ //**************************************************************************************
1376
+ private function _combined_javascript($javascripts, $script = '') {
1377
+ $html = '';
1378
+ $longfilename = ''; $files = array();
1379
+
1380
+ foreach ((array) $javascripts as $javascript) {
1381
+ $src = trim(preg_replace('/(\.js|\.php)(\?[^\?]*)$/i', '$1', str_replace($this->wp_url, ABSPATH, $javascript)));
1382
+ if (file_exists($src)) {
1383
+ $filename = (preg_match('/\.js$/i', $src) ? $src : $javascript);
1384
+ $longfilename .= $filename . filemtime($src);
1385
+ $files[] = $filename;
1386
+ } else {
1387
+ $html .= "<script type=\"text/javascript\" src=\"{$javascript}\"></script>\n";
1388
+ }
1389
+ }
1390
+
1391
+ $md5_filename = md5($longfilename . $script);
1392
+ $longfilename = 'js/' . $md5_filename . '.js';
1393
+ $filename = $this->cache_path . $longfilename;
1394
+ if (! file_exists($filename) ) {
1395
+ if (count($files) > 0 && !empty($longfilename))
1396
+ $script = $this->_files_read($files, 'js') . "\n\n" . $script;
1397
+
1398
+ // Minified JavaScript
1399
+ $script = $this->_js_minify($script);
1400
+
1401
+ if (!empty($script))
1402
+ $this->_file_write($filename, $script, $this->options['gzip_on'] || HC_MAKE_GZ_FILE);
1403
+ }
1404
+
1405
+ $fileurl = $this->cache_url . $longfilename;
1406
+ // $fileurl = ($this->options['dynamic']
1407
+ // ? $this->self_url . '?f=' . $md5_filename . '&amp;t=js'
1408
+ // : $this->cache_url . $longfilename
1409
+ // );
1410
+ if (file_exists($filename))
1411
+ $html .= "<script type=\"text/javascript\" src=\"{$fileurl}\"></script>\n";
1412
+
1413
+ return $html;
1414
+ }
1415
+
1416
+ //**************************************************************************************
1417
+ // Combined inline JavaScript
1418
+ //**************************************************************************************
1419
+ private function _combined_inline_javascript($script) {
1420
+ if (empty($script))
1421
+ return '';
1422
+
1423
+ $html = '';
1424
+ $md5_filename = md5($script);
1425
+ $longfilename = 'js/' . $md5_filename . '.js';
1426
+
1427
+ // Minified JavaScript
1428
+ $script = $this->_js_minify($script);
1429
+
1430
+ $filename = $this->cache_path . $longfilename;
1431
+ if (!file_exists($filename) && !empty($script) )
1432
+ $this->_file_write($filename, $script, $this->options['gzip_on'] || HC_MAKE_GZ_FILE);
1433
+
1434
+ $fileurl = $this->cache_url . $longfilename;
1435
+ // $fileurl = ($this->options['dynamic']
1436
+ // ? $this->self_url . '?f=' . $md5_filename . '&amp;t=js'
1437
+ // : $this->cache_url . $longfilename
1438
+ // );
1439
+ if (file_exists($filename))
1440
+ $html .= "<script type=\"text/javascript\" src=\"{$fileurl}\"></script>\n";
1441
+
1442
+ return $html;
1443
+ }
1444
+
1445
+ //**************************************************************************************
1446
+ // Remove comment
1447
+ //**************************************************************************************
1448
+ private function _remove_comment($text, $type) {
1449
+ $text = trim($text);
1450
+
1451
+ $comment_pattern = '/^[ \t]*\/(?:\*(?:.|\n)*?\*\/|\/.*)/m';
1452
+
1453
+ switch ($type) {
1454
+ case 'css': // inline CSS
1455
+ $text = trim(preg_replace(
1456
+ array($comment_pattern, '/^[ \t]+/m', '/[ \t]+$/m') ,
1457
+ array('', '', '') ,
1458
+ $text)
1459
+ );
1460
+ break;
1461
+
1462
+ case 'js': // inline JavaScript
1463
+ $text = trim(preg_replace(
1464
+ array($comment_pattern, '/^[ \t]+/m', '/[ \t]+$/m', '/^<\!\-+/', '/-+>$/') ,
1465
+ array('', '', '', '', '') ,
1466
+ $text)
1467
+ );
1468
+ // $text = 'try{'
1469
+ // . $text . (substr($text, -1) !== ';' ? ';' : '') . "\n"
1470
+ // . ($this->options['debug_mode']
1471
+ // ? '}catch(e){alert("error: " + e.toString());}'
1472
+ // : '}finally{};')
1473
+ // ;
1474
+ break;
1475
+ }
1476
+
1477
+ return ($text . "\n\n");
1478
+ }
1479
+
1480
+ //**************************************************************************************
1481
+ // Get Newer version
1482
+ //**************************************************************************************
1483
+ private function _newer_version_src($js_libs, $limit_ver = '') {
1484
+ $src = ''; $ver = '0.0';
1485
+ foreach ((array) $js_libs as $key => $val) {
1486
+ if ( version_compare( $key, $ver, '>') ) {
1487
+ $src = $val; $ver = $key;
1488
+ }
1489
+ }
1490
+
1491
+ return array($src, $ver);
1492
+ }
1493
+
1494
+ //**************************************************************************************
1495
+ // Minified JavaScript
1496
+ //**************************************************************************************
1497
+ private function _js_minify($buffer) {
1498
+ $js = trim($buffer . "\n");
1499
+ if ($this->options['js_minify']) {
1500
+ if ( class_exists('JSMin') ) {
1501
+ $js = JSMin::minify($js);
1502
+ } else if( class_exists('JSMinPlus') ) {
1503
+ $js = JSMinPlus::minify($js);
1504
+ }
1505
+ }
1506
+ $js = trim($js);
1507
+
1508
+ return $js . (!empty($js) ? "\n" : '');
1509
+ }
1510
+
1511
+ //**************************************************************************************
1512
+ // Optimise CSS
1513
+ //**************************************************************************************
1514
+ private function _css_import($css) {
1515
+ if (preg_match_all('/@import[ \t]*url[ \t]*\([\'"]?([^\)\'"]*)[\'"]?\);?/i', $css, $matches, PREG_SET_ORDER)) {
1516
+ $search = array(); $replace = array();
1517
+ foreach ((array) $matches as $match) {
1518
+ $filename = str_replace($this->wp_url, ABSPATH, trim($match[1]));
1519
+ $content = $this->_file_read(file_exists($filename) ? $filename : $match[1]);
1520
+ $content = $this->_css_url_edit($content, $filename);
1521
+ if ($this->options['css_optimise'])
1522
+ $content = $this->_css_optimise($content, false);
1523
+ if (preg_match('/@import[ \t]*url[ \t]*\([\'"]?[^\)\'"]*[\'"]?\);?/i', $content))
1524
+ $content = $this->_css_import($content);
1525
+ $search[] = $match[0];
1526
+ $replace[] = $content;
1527
+ }
1528
+ $css = str_replace($search, $replace, $css);
1529
+ unset($match); unset($search); unset($replace);
1530
+ }
1531
+ unset($matches);
1532
+
1533
+ return $css;
1534
+ }
1535
+
1536
+ private function _css_optimise($buffer, $merge = true) {
1537
+ $css = trim($buffer . "\n");
1538
+
1539
+ if ($this->options['css_optimise']) {
1540
+ if ( class_exists('Minify_CSS') ) {
1541
+ $css = Minify_CSS::minify($css);
1542
+ } else if ( class_exists('csstidy') ) {
1543
+ $csstidy = new csstidy();
1544
+ $csstidy->set_cfg('optimise_shorthands', $this->options['csstidy_option']['optimise_shorthands']);
1545
+ $csstidy->set_cfg('compress_colors', $this->options['csstidy_option']['compress_colors']);
1546
+ $csstidy->set_cfg('compress_font-weight', $this->options['csstidy_option']['compress_font_weight']);
1547
+ $csstidy->set_cfg('remove_bslash', $this->options['csstidy_option']['remove_bslash']);
1548
+ $csstidy->load_template($this->csstidy_template[$this->options['csstidy_option']['template']]);
1549
+ $csstidy->parse($css);
1550
+ $css = $csstidy->print->plain();
1551
+ unset($csstidy);
1552
+ }
1553
+ }
1554
+ if ( $merge )
1555
+ $css = str_replace("\n\n", "\n", $this->_css_import($css));
1556
+ $css = trim($css);
1557
+
1558
+ return $css . (!empty($css) ? "\n" : '');
1559
+ }
1560
+
1561
+ //**************************************************************************************
1562
+ // Create cache dir
1563
+ //**************************************************************************************
1564
+ private function _create_cache_dir($cache_dir = '') {
1565
+ if (empty($cache_dir)) $cache_dir = HC_CACHE_DIR;
1566
+ $cache_dir = $this->_wp_content_dir('/' . trailingslashit($cache_dir) );
1567
+
1568
+ $mode = 0777;
1569
+ if( !file_exists(dirname($cache_dir)) )
1570
+ @mkdir(dirname($cache_dir), $mode);
1571
+ if( !file_exists($cache_dir) )
1572
+ @mkdir($cache_dir, $mode);
1573
+ if( !file_exists($cache_dir) . '/css/' )
1574
+ @mkdir($cache_dir . '/css/', $mode);
1575
+ if( !file_exists($cache_dir) . '/js/' )
1576
+ @mkdir($cache_dir . '/js/', $mode);
1577
+
1578
+ return (file_exists($cache_dir) ? $cache_dir : FALSE);
1579
+ }
1580
+
1581
+ //**************************************************************************************
1582
+ // Remove cache file
1583
+ //**************************************************************************************
1584
+ private function _remove_cache_file($cache = 'cache', $plugin = 'head-cleaner') {
1585
+ $cache_dir = ( !empty($this->cache_path)
1586
+ ? $this->cache_path
1587
+ : $this->_wp_content_dir("/$cache/$plugin/")
1588
+ );
1589
+ $this->_remove_all_file($cache_dir . 'css');
1590
+ $this->_remove_all_file($cache_dir . 'js');
1591
+ }
1592
+
1593
+ //**************************************************************************************
1594
+ // Remove files
1595
+ //**************************************************************************************
1596
+ private function _remove_all_file($dir, $rmdir = false) {
1597
+ if(file_exists($dir)) {
1598
+ if($objs = glob($dir."/*")) {
1599
+ foreach((array) $objs as $obj) {
1600
+ is_dir($obj)
1601
+ ? $this->_remove_all_file($obj, true)
1602
+ : @unlink($obj);
1603
+ }
1604
+ unset($objs);
1605
+ }
1606
+ if ($rmdir) rmdir($dir);
1607
+ }
1608
+ }
1609
+
1610
+ //**************************************************************************************
1611
+ // Create .htaccess
1612
+ //**************************************************************************************
1613
+ private function _create_htaccess($dir) {
1614
+ if (!file_exists($dir))
1615
+ return FALSE;
1616
+
1617
+ $rewrite_base = trailingslashit(str_replace(ABS_PATH, '/', $dir));
1618
+
1619
+ $text = '# BEGIN Head Cleaner' . "\n"
1620
+ . '<IfModule mod_rewrite.c>' . "\n"
1621
+ . 'RewriteEngine On' . "\n"
1622
+ . 'RewriteBase ' . $rewrite_base . "\n"
1623
+ . 'RewriteCond %{HTTP:Accept-Encoding} gzip' . "\n"
1624
+ . 'RewriteCond %{REQUEST_FILENAME} "\.(css|js)$"' . "\n"
1625
+ . 'RewriteCond %{REQUEST_FILENAME} !"\.gz$"' . "\n"
1626
+ . 'RewriteCond %{REQUEST_FILENAME}.gz -s' . "\n"
1627
+ . 'RewriteRule .+ %{REQUEST_URI}.gz [L]' . "\n"
1628
+ . '</IfModule>' . "\n"
1629
+ . '# END Head Cleaner' . "\n";
1630
+ $filename = trailingslashit($dir) . '.htaccess';
1631
+
1632
+ if ( $this->options['gzip_on'] ) {
1633
+ if (!file_exists($filename)) {
1634
+ return $this->_file_write($filename, $text, false);
1635
+ } else {
1636
+ $content = $this->_file_read($filename);
1637
+ if ($content !== FALSE) {
1638
+ if (strpos($content, '# BEGIN Head Cleaner') === FALSE && strpos($content, 'RewriteRule .+ %{REQUEST_URI}.gz') === FALSE) {
1639
+ $text = $content . "\n" . $text;
1640
+ return $this->_file_write($filename, $text, false);
1641
+ } else {
1642
+ return TRUE;
1643
+ }
1644
+ } else {
1645
+ return FALSE;
1646
+ }
1647
+ }
1648
+ } else {
1649
+ if ( file_exists($filename) ) {
1650
+ $content = trim($this->_file_read($filename));
1651
+ if ($content !== FALSE) {
1652
+ $content = trim(preg_replace('/# BEGIN Head Cleaner.*# END Head Cleaner/ism', '', $content));
1653
+ if ( $text === $content || $content === '') {
1654
+ @unlink($filename);
1655
+ return TRUE;
1656
+ } else {
1657
+ return $this->_file_write($filename, $content . "\n", false);
1658
+ }
1659
+ } else {
1660
+ return FALSE;
1661
+ }
1662
+ } else {
1663
+ return TRUE;
1664
+ }
1665
+ }
1666
+ }
1667
+
1668
+ //**************************************************************************************
1669
+ // Add Admin Menu
1670
+ //**************************************************************************************
1671
+ public function admin_menu() {
1672
+ $this->addOptionPage(__('Head Cleaner'), array($this, 'option_page'));
1673
+ }
1674
+
1675
+ public function plugin_setting_links($links, $file) {
1676
+ if (method_exists($this, 'addPluginSettingLinks')) {
1677
+ $links = $this->addPluginSettingLinks($links, $file);
1678
+ } else {
1679
+ $this_plugin = plugin_basename(__FILE__);
1680
+ if ($file == $this_plugin) {
1681
+ $settings_link = '<a href="' . $this->admin_action . '">' . __('Settings') . '</a>';
1682
+ array_unshift($links, $settings_link); // before other links
1683
+ }
1684
+ }
1685
+ return $links;
1686
+ }
1687
+
1688
+ //**************************************************************************************
1689
+ // Show Option Page
1690
+ //**************************************************************************************
1691
+ public function option_page() {
1692
+ if ($this->_chk_filters_update()) {
1693
+ $this->options['filters'] = $this->filters;
1694
+ $this->options['head_js'] = $this->head_js;
1695
+ }
1696
+
1697
+ if (isset($_POST['options_update'])) {
1698
+ if ($this->wp25)
1699
+ check_admin_referer("update_options", "_wpnonce_update_options");
1700
+
1701
+ // strip slashes array
1702
+ $head_js = $this->stripArray(isset($_POST['head_js']) ? $_POST['head_js'] : array());
1703
+ $remove_js = $this->stripArray(isset($_POST['remove_js']) ? $_POST['remove_js'] : array());
1704
+ $head_filters = $this->stripArray(isset($_POST['head_filters']) ? $_POST['head_filters'] : array());
1705
+ $head_remove = $this->stripArray(isset($_POST['head_remove']) ? $_POST['head_remove'] : array());
1706
+ $foot_filters = $this->stripArray(isset($_POST['foot_filters']) ? $_POST['foot_filters'] : array());
1707
+ $foot_remove = $this->stripArray(isset($_POST['foot_remove']) ? $_POST['foot_remove'] : array());
1708
+ $_POST = $this->stripArray($_POST);
1709
+
1710
+ // get options
1711
+ $this->options['xml_declaration'] = (isset($_POST['xml_declaration']) && $_POST['xml_declaration'] == 'on' ? true : false);
1712
+ $this->options['ie_conditional']= (isset($_POST['ie_conditional']) && $_POST['ie_conditional'] == 'on' ? true : false);
1713
+ $this->options['canonical_tag'] = (isset($_POST['canonical_tag']) && $_POST['canonical_tag'] == 'on' ? true : false);
1714
+ $this->options['foot_js'] = (isset($_POST['foot_js']) && $_POST['foot_js'] == 'on' ? true : false);
1715
+ $this->options['dynamic'] = (isset($_POST['dynamic']) && $_POST['dynamic'] == 'on' ? true : false);
1716
+ $this->options['js_move_foot'] = (isset($_POST['js_move_foot']) && $_POST['js_move_foot'] == 'on' ? true : false);
1717
+ $this->options['cache_enabled'] = (isset($_POST['cache_enabled']) && $_POST['cache_enabled'] == 'on' ? true : false);
1718
+ $this->options['combined_css'] = (isset($_POST['combined_css']) && $_POST['combined_css'] == 'on' ? true : false);
1719
+ $this->options['combined_js'] = (isset($_POST['combined_js']) && $_POST['combined_js'] == 'on' ? true : false);
1720
+ $this->options['js_minify'] = (isset($_POST['js_minify']) && $_POST['js_minify'] == 'on' ? true : false);
1721
+ $this->options['css_optimise'] = (isset($_POST['css_optimise']) && $_POST['css_optimise'] == 'on' ? true : false);
1722
+ $this->options['default_media'] = trim($_POST['default_media']);
1723
+ $this->options['gzip_on'] = (isset($_POST['gzip_on']) && $_POST['gzip_on'] == 'on' ? true : false);
1724
+ $this->options['use_ajax_libs'] = (isset($_POST['use_ajax_libs']) && $_POST['use_ajax_libs'] == 'on' ? true : false);
1725
+ $this->options['debug_mode'] = (isset($_POST['debug_mode']) && $_POST['debug_mode'] == 'on' ? true : false);
1726
+ $this->options['csstidy_option']['template'] = (int) $_POST['template'];
1727
+ $this->options['csstidy_option']['optimise_shorthands'] = (int) $_POST['optimise_shorthands'];
1728
+ $this->options['csstidy_option']['compress_colors'] = (isset($_POST['compress_colors']) && $_POST['compress_colors'] == 'on' ? true : false);
1729
+ $this->options['csstidy_option']['compress_font_weight'] = (isset($_POST['compress_font_weight']) && $_POST['compress_font_weight'] == 'on' ? true : false);
1730
+ $this->options['csstidy_option']['remove_bslash'] = (isset($_POST['remove_bslash']) && $_POST['remove_bslash'] == 'on' ? true : false);
1731
+
1732
+ $rm_generator = (isset($_POST['rm_generator']) && $_POST['rm_generator'] == 'on' ? true : false);
1733
+ $rm_rsd_link = (isset($_POST['rm_rsd_link']) && $_POST['rm_rsd_link'] == 'on' ? true : false);
1734
+ $rm_manifest = (isset($_POST['rm_manifest']) && $_POST['rm_manifest'] == 'on' ? true : false);
1735
+
1736
+ $this->options['remove_js'] = array();
1737
+ foreach ((array) $this->options['head_js'] as $javascript => $value) {
1738
+ if (count($head_js) > 0 && array_search($javascript, $head_js) !== FALSE)
1739
+ $this->options['head_js'][$javascript] = FALSE;
1740
+ else
1741
+ $this->options['head_js'][$javascript] = TRUE;
1742
+ if (array_search($javascript, (array) $remove_js) !== FALSE)
1743
+ $this->options['remove_js'][] = $javascript;
1744
+ }
1745
+ unset($head_js);
1746
+ unset($remove_js);
1747
+
1748
+ $tag = 'wp_head';
1749
+
1750
+ foreach ((array) $this->options['filters'][$tag] as $function_name => $priority) {
1751
+ if (count($head_filters) > 0 && array_search($function_name, $head_filters) !== FALSE)
1752
+ $this->options['priority'][$tag][$function_name] = HC_PRIORITY + 1;
1753
+ elseif (count($head_remove) > 0 && array_search($function_name, $head_remove) !== FALSE)
1754
+ $this->options['priority'][$tag][$function_name] = -1;
1755
+ elseif (isset($this->options['priority'][$tag][$function_name]))
1756
+ $this->options['priority'][$tag][$function_name] = $priority;
1757
+ }
1758
+ $this->options['priority'][$tag]['wp_generator'] = ($rm_generator ? -1 : $this->options['filters'][$tag]['wp_generator']);
1759
+ $this->options['priority'][$tag]['rsd_link'] = ($rm_rsd_link ? -1 : $this->options['filters'][$tag]['rsd_link']);
1760
+ $this->options['priority'][$tag]['wlwmanifest_link'] = ($rm_manifest ? -1 : $this->options['filters'][$tag]['wlwmanifest_link']);
1761
+ unset($head_filters);
1762
+
1763
+ $tag = 'wp_footer';
1764
+ foreach ((array) $this->options['filters'][$tag] as $function_name => $priority) {
1765
+ if (count($foot_filters) > 0 && array_search($function_name, $foot_filters) !== FALSE)
1766
+ $this->options['priority'][$tag][$function_name] = HC_PRIORITY + 1;
1767
+ elseif (count($foot_remove) > 0 && array_search($function_name, $foot_remove) !== FALSE)
1768
+ $this->options['priority'][$tag][$function_name] = -1;
1769
+ elseif (isset($this->options['priority'][$tag][$function_name]))
1770
+ $this->options['priority'][$tag][$function_name] = $priority;
1771
+ }
1772
+ unset($foot_filters);
1773
+
1774
+ // options update
1775
+ $this->updateOptions();
1776
+
1777
+ // create .htaccess file
1778
+ $cache_dir = $this->_create_cache_dir();
1779
+ if ( $cache_dir !== FALSE )
1780
+ $this->_create_htaccess($cache_dir);
1781
+
1782
+ // Done!
1783
+ $this->note .= "<strong>".__('Done!', $this->textdomain_name)."</strong>";
1784
+
1785
+ } elseif(isset($_POST['remove_cache'])) {
1786
+ if ($this->wp25)
1787
+ check_admin_referer("remove_cache", "_wpnonce_remove_cache");
1788
+
1789
+ // Remove all cache files
1790
+ $this->_remove_cache_file();
1791
+
1792
+ // Done!
1793
+ $this->note .= "<strong>".__('Done!', $this->textdomain_name)."</strong>";
1794
+
1795
+ } elseif(isset($_POST['options_delete'])) {
1796
+ if ($this->wp25)
1797
+ check_admin_referer("delete_options", "_wpnonce_delete_options");
1798
+
1799
+ // options delete
1800
+ $this->_delete_settings();
1801
+
1802
+ // Done!
1803
+ $this->note .= "<strong>".__('Done!', $this->textdomain_name)."</strong>";
1804
+ $this->error++;
1805
+
1806
+ } else {
1807
+ $this->activation();
1808
+ }
1809
+
1810
+ $out = '';
1811
+
1812
+ // Add Options
1813
+ $out .= "<div class=\"wrap\">\n";
1814
+ $out .= "<form method=\"post\" id=\"update_options\" action=\"".$this->admin_action."\">\n";
1815
+ $out .= "<h2>".__('Head Cleaner Options', $this->textdomain_name)."</h2><br />\n";
1816
+ if ($this->wp25) $out .= $this->makeNonceField("update_options", "_wpnonce_update_options", true, false);
1817
+
1818
+ $out .= "<table class=\"optiontable form-table\" style=\"margin-top:0;\"><tbody>\n";
1819
+
1820
+ $out .= "<tr>";
1821
+ $out .= "<td>";
1822
+ $out .= "<input type=\"checkbox\" name=\"cache_enabled\" id=\"cache_enabled\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['cache_enabled'] === true ? " checked=\"true\"" : "")." />";
1823
+ $out .= __('CSS and JavaScript are cached on the server.', $this->textdomain_name);
1824
+ $out .= "</td>";
1825
+ $out .= "<td>";
1826
+ $out .= "<input type=\"checkbox\" name=\"js_move_foot\" id=\"js_move_foot\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['js_move_foot'] === true ? " checked=\"true\"" : "")." />";
1827
+ $out .= __('Put JavaScripts at the Bottom.', $this->textdomain_name);
1828
+ $out .= "</td>";
1829
+ $out .= "<td>";
1830
+ if ($this->options['cache_enabled']) {
1831
+ $out .= "<input type=\"checkbox\" name=\"dynamic\" id=\"dynamic\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['dynamic'] === true ? " checked=\"true\"" : "")." />";
1832
+ $out .= __('CSS and JS are dynamically generated.', $this->textdomain_name);
1833
+ }
1834
+ $out .= "</td>";
1835
+ $out .= "</tr>\n";
1836
+
1837
+ if ($this->options['cache_enabled']) {
1838
+ $out .= "<tr>";
1839
+ $out .= "<td>";
1840
+ $out .= "<input type=\"checkbox\" name=\"combined_css\" id=\"combined_css\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['combined_css'] === true ? " checked=\"true\"" : "")." />";
1841
+ $out .= __('Two or more CSS is combined.', $this->textdomain_name);
1842
+ $out .= "</td>";
1843
+ $out .= "<td>";
1844
+ $out .= "<input type=\"checkbox\" name=\"css_optimise\" id=\"css_optimise\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['css_optimise'] === true ? " checked=\"true\"" : "")." />";
1845
+ $out .= __('CSS is optimized.', $this->textdomain_name);
1846
+ $out .= "</td>";
1847
+ $out .= "<td>";
1848
+ $out .= __('Default media attribute applied to CSS.', $this->textdomain_name);
1849
+ $out .= "<input type=\"text\" name=\"default_media\" id=\"default_media\" value=\"{$this->options['default_media']}\" style=\"margin-left:0.5em;\" />";
1850
+ $out .= "</td>";
1851
+ $out .= "<td>";
1852
+ $out .= "</tr>\n";
1853
+
1854
+ $out .= "<tr>";
1855
+ $out .= "<td>";
1856
+ $out .= "<input type=\"checkbox\" name=\"combined_js\" id=\"combined_js\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['combined_js'] === true ? " checked=\"true\"" : "")." />";
1857
+ $out .= __('Two or more JavaScript is combined.', $this->textdomain_name);
1858
+ $out .= "</td>";
1859
+ $out .= "<td>";
1860
+ $out .= "<input type=\"checkbox\" name=\"js_minify\" id=\"js_minify\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['js_minify'] === true ? " checked=\"true\"" : "")." />";
1861
+ $out .= __('JavaScript is minified.', $this->textdomain_name);
1862
+ $out .= "</td>";
1863
+ $out .= "<td>";
1864
+ $out .= "<input type=\"checkbox\" name=\"foot_js\" id=\"foot_js\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['foot_js'] === true ? " checked=\"true\"" : "")." />";
1865
+ $out .= __('Bottom JavaScript is combined, too.', $this->textdomain_name);
1866
+ $out .= "</td>";
1867
+ $out .= "</tr>\n";
1868
+ }
1869
+ $out .= "<tr>";
1870
+ // $out .= "<td>";
1871
+ // $out .= "<input type=\"checkbox\" name=\"gzip_on\" id=\"gzip_on\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['gzip_on'] === true ? " checked=\"true\"" : "")." />";
1872
+ // $out .= __('gzip compress to CSS and JS.', $this->textdomain_name);
1873
+ // $out .= "</td>";
1874
+ $out .= "<td>";
1875
+ $out .= "<input type=\"checkbox\" name=\"use_ajax_libs\" id=\"use_ajax_libs\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['use_ajax_libs'] === true ? " checked=\"true\"" : "")." />";
1876
+ $out .= __('Use Google Ajax Libraries.', $this->textdomain_name);
1877
+ $out .= "</td>";
1878
+ $out .= "<td>";
1879
+ $out .= "<input type=\"checkbox\" name=\"ie_conditional\" id=\"ie_conditional\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['ie_conditional'] === true ? " checked=\"true\"" : "")." />";
1880
+ $out .= __('Remove IE Conditional Tag.', $this->textdomain_name);
1881
+ $out .= "</td>";
1882
+ $out .= "<td>";
1883
+ $out .= "</td>";
1884
+ $out .= "</tr>\n";
1885
+
1886
+ $out .= "<tr>";
1887
+ $out .= "<td>";
1888
+ $out .= "<input type=\"checkbox\" name=\"xml_declaration\" id=\"xml_declaration\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['xml_declaration'] === true ? " checked=\"true\"" : "")." />";
1889
+ $out .= __('Add XML Declaration.', $this->textdomain_name);
1890
+ $out .= "</td>";
1891
+ $out .= "<td>";
1892
+ $out .= "<input type=\"checkbox\" name=\"canonical_tag\" id=\"canonical_tag\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['canonical_tag'] === true ? " checked=\"true\"" : "")." />";
1893
+ $out .= __('Add canonical tag.', $this->textdomain_name);
1894
+ $out .= "</td>";
1895
+ $out .= "<td>";
1896
+ $out .= "</td>";
1897
+ $out .= "</tr>\n";
1898
+
1899
+ $out .= "<tr>";
1900
+ $out .= "<td>";
1901
+ $out .= "<input type=\"checkbox\" name=\"rm_generator\" id=\"rm_generator\" value=\"on\" style=\"margin-right:0.5em;\"".(isset($this->options['priority']['wp_head']['wp_generator']) && $this->options['priority']['wp_head']['wp_generator'] <= 0 ? " checked=\"true\"" : "")." />";
1902
+ $out .= __('Remove generator tag.', $this->textdomain_name);
1903
+ $out .= "</td>";
1904
+ $out .= "<td>";
1905
+ $out .= "<input type=\"checkbox\" name=\"rm_rsd_link\" id=\"rm_rsd_link\" value=\"on\" style=\"margin-right:0.5em;\"".(isset($this->options['priority']['wp_head']['rsd_link']) && $this->options['priority']['wp_head']['rsd_link'] <= 0 ? " checked=\"true\"" : "")." />";
1906
+ $out .= __('Remove RSD link tag.', $this->textdomain_name);
1907
+ $out .= "</td>";
1908
+ $out .= "<td>";
1909
+ $out .= "<input type=\"checkbox\" name=\"rm_manifest\" id=\"rm_manifest\" value=\"on\" style=\"margin-right:0.5em;\"".(isset($this->options['priority']['wp_head']['wlwmanifest_link']) && $this->options['priority']['wp_head']['wlwmanifest_link'] <= 0 ? " checked=\"true\"" : "")." />";
1910
+ $out .= __('Remove wlwmanifest link tag.', $this->textdomain_name);
1911
+ $out .= "</td>";
1912
+ $out .= "</tr>\n";
1913
+
1914
+ $out .= "<tr>";
1915
+ $out .= "<td>";
1916
+ $out .= "<input type=\"checkbox\" name=\"debug_mode\" id=\"debug_mode\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['debug_mode'] === true ? " checked=\"true\"" : "")." />";
1917
+ $out .= __('Debug mode', $this->textdomain_name);
1918
+ $out .= "</td>";
1919
+ $out .= "<td>";
1920
+ $out .= "</td>";
1921
+ $out .= "<td>";
1922
+ $out .= "</td>";
1923
+ $out .= "</tr>\n";
1924
+
1925
+ $out .= "</tbody></table>";
1926
+
1927
+ // CSS Tidy Options
1928
+ if ($this->options['css_optimise'] && class_exists('csstidy')) {
1929
+ $out .= "<div style=\"margin-top:2em;\" id=\"csstidy_option\">\n";
1930
+ $out .= "<h3>" . __('The CSS optimization settings', $this->textdomain_name) . "</h3>" ;
1931
+
1932
+ $out .= __('Compression (code layout):', $this->textdomain_name) . '&nbsp;&nbsp;';
1933
+ $out .= '<select name="template" id="template">';
1934
+ $out .= '<option value="3"' . ($this->options['csstidy_option']['template']==3 ? ' selected="selected"' : '') . '>' . __('Highest (no readability, smallest size)', $this->textdomain_name) .'</option>';
1935
+ $out .= '<option value="2"' . ($this->options['csstidy_option']['template']==2 ? ' selected="selected"' : '') . '>' . __('High (moderate readability, smaller size)', $this->textdomain_name) .')</option>';
1936
+ $out .= '<option value="1"' . ($this->options['csstidy_option']['template']==1 ? ' selected="selected"' : '') . '>' . __('Standard (balance between readability and size)', $this->textdomain_name) .'</option>';
1937
+ $out .= '<option value="0"' . ($this->options['csstidy_option']['template']==0 ? ' selected="selected"' : '') . '>' . __('Low (higher readability)', $this->textdomain_name) .'</option>';
1938
+ $out .= '</select>';
1939
+ $out .= '&nbsp;&nbsp;&nbsp;&nbsp;';
1940
+ $out .= __('Optimise shorthands', $this->textdomain_name) . '&nbsp;&nbsp;';
1941
+ $out .= '<select name="optimise_shorthands" id="optimise_shorthands">';
1942
+ $out .= '<option value="2"' . ($this->options['csstidy_option']['optimise_shorthands']==2 ? ' selected="selected"' : '') . '>' . __('All optimisations', $this->textdomain_name) .')</option>';
1943
+ $out .= '<option value="1"' . ($this->options['csstidy_option']['optimise_shorthands']==1 ? ' selected="selected"' : '') . '>' . __('Safe optimisations', $this->textdomain_name) .'</option>';
1944
+ $out .= '<option value="0"' . ($this->options['csstidy_option']['optimise_shorthands']==0 ? ' selected="selected"' : '') . '>' . __("Don't optimise", $this->textdomain_name) .'</option>';
1945
+ $out .= '</select>';
1946
+ $out .= "<br />\n";
1947
+
1948
+ $out .= "<input type=\"checkbox\" name=\"compress_colors\" id=\"compress_colors\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['csstidy_option']['compress_colors'] === true ? " checked=\"true\"" : "")." />";
1949
+ $out .= __('Compress colors', $this->textdomain_name);
1950
+ $out .= '&nbsp;&nbsp;&nbsp;&nbsp;';
1951
+ $out .= "<input type=\"checkbox\" name=\"compress_font_weight\" id=\"compress_font_weight\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['csstidy_option']['compress_font_weight'] === true ? " checked=\"true\"" : "")." />";
1952
+ $out .= __('Compress font-weight', $this->textdomain_name);
1953
+ $out .= '&nbsp;&nbsp;&nbsp;&nbsp;';
1954
+ $out .= "<input type=\"checkbox\" name=\"remove_bslash\" id=\"remove_bslash\" value=\"on\" style=\"margin-right:0.5em;\"".($this->options['csstidy_option']['remove_bslash'] === true ? " checked=\"true\"" : "")." />";
1955
+ $out .= __('Remove unnecessary backslashes', $this->textdomain_name);
1956
+ $out .= "<br />\n";
1957
+
1958
+ $out .= "</div>\n";
1959
+ }
1960
+
1961
+ // Active Filters
1962
+ $out .= "<div style=\"margin-top:2em;\" id=\"active_filters\">\n";
1963
+ $out .= "<h3>" . __('Active Filters', $this->textdomain_name) . "</h3>" ;
1964
+ $out .= "<table><tbody>\n";
1965
+ $out .= "<tr>";
1966
+ $out .= '<th style="padding:0 .5em;">' . __("Don't process!", $this->textdomain_name) . "</th>\n";
1967
+ $out .= '<th style="padding:0 .5em;">' . __('Remove', $this->textdomain_name) . "</th>\n";
1968
+ $out .= "<th>" . __('Head filters', $this->textdomain_name) . "</th>\n";
1969
+ if ($this->options['debug_mode'])
1970
+ $out .= "<th>" . __('Priority', $this->textdomain_name) . "</th>\n";
1971
+ $out .= "</tr>\n";
1972
+ $head_filters = array();
1973
+ foreach ((array) $this->options['filters']['wp_head'] as $function_name => $priority) {
1974
+ if ($priority < HC_PRIORITY) {
1975
+ if (isset($this->options['priority']['wp_head'][$function_name]))
1976
+ $priority = (int) $this->options['priority']['wp_head'][$function_name];
1977
+ if (!isset($head_filters[$priority]))
1978
+ $head_filters[$priority] = array();
1979
+ $head_filters[$priority][] = $function_name;
1980
+ }
1981
+ }
1982
+ ksort($head_filters, SORT_NUMERIC);
1983
+ $i = 0;
1984
+ foreach ($head_filters as $priority => $filters) {
1985
+ foreach ($filters as $function_name){
1986
+ if ( ! preg_match('/^(' . implode('|', $this->default_head_filters) . ')$/i', $function_name)) {
1987
+ $out .= "<tr>";
1988
+ $out .= "<th><input type=\"checkbox\" name=\"head_filters[$i]\" value=\"$function_name\"".($priority > HC_PRIORITY ? " checked=\"true\"" : "")." /></th>";
1989
+ $out .= "<th><input type=\"checkbox\" name=\"head_remove[$i]\" value=\"$function_name\"".($priority <= 0 ? " checked=\"true\"" : "")." /></th>";
1990
+ $out .= "<td>$function_name</td>";
1991
+ if ($this->options['debug_mode'])
1992
+ $out .= "<td>( $priority )</td>";
1993
+ $out .= "</tr>\n";
1994
+ $i++;
1995
+ }
1996
+ }
1997
+ }
1998
+ unset($filters); unset($head_filters);
1999
+
2000
+ if ($this->options['foot_js'] === true) {
2001
+ $out .= "<tr><td colspan='3'>&nbsp;</td></tr>\n";
2002
+ $out .= "<tr>";
2003
+ $out .= '<th style="padding:0 .5em;">' . __("Don't process!", $this->textdomain_name) . "</th>\n";
2004
+ $out .= '<th style="padding:0 .5em;">' . __('Remove', $this->textdomain_name) . "</th>\n";
2005
+ $out .= "<th>" . __('Bottom filters', $this->textdomain_name) . "</th>\n";
2006
+ if ($this->options['debug_mode'])
2007
+ $out .= "<th>" . __('Priority', $this->textdomain_name) . "</th>\n";
2008
+ $out .= "</tr>\n";
2009
+ $footer_filters = array();
2010
+ foreach ((array) $this->options['filters']['wp_footer'] as $function_name => $priority) {
2011
+ if ($priority < HC_PRIORITY) {
2012
+ if (isset($this->options['priority']['wp_footer'][$function_name]))
2013
+ $priority = (int) $this->options['priority']['wp_footer'][$function_name];
2014
+ if (!isset($footer_filters[$priority]))
2015
+ $footer_filters[$priority] = array();
2016
+ $footer_filters[$priority][] = $function_name;
2017
+ }
2018
+ }
2019
+ ksort($footer_filters, SORT_NUMERIC);
2020
+ $i = 0;
2021
+ foreach ($footer_filters as $priority => $filters) {
2022
+ foreach ($filters as $function_name){
2023
+ if ( ! preg_match('/^(' . implode('|', $this->default_head_filters) . ')$/i', $function_name)) {
2024
+ $out .= "<tr>";
2025
+ $out .= "<th><input type=\"checkbox\" name=\"foot_filters[$i]\" value=\"$function_name\"".($priority > HC_PRIORITY ? " checked=\"true\"" : "")." /></th>";
2026
+ $out .= "<th><input type=\"checkbox\" name=\"foot_remove[$i]\" value=\"$function_name\"".($priority <= 0 ? " checked=\"true\"" : "")." /></th>";
2027
+ $out .= "<td>$function_name</td>";
2028
+ if ($this->options['debug_mode'])
2029
+ $out .= "<td>( $priority )</td>";
2030
+ $out .= "</tr>\n";
2031
+ $i++;
2032
+ }
2033
+ }
2034
+ }
2035
+ unset($filters); unset($footer_filters);
2036
+ }
2037
+ $out .= "</tbody></table>";
2038
+ $out .= "</div>\n";
2039
+
2040
+ // Active JavaScripts
2041
+ $out .= "<div style=\"margin-top:2em;\" id=\"active_javascripts\">\n";
2042
+ $out .= "<h3>" . __('Active JavaScripts', $this->textdomain_name) . "</h3>" ;
2043
+ $out .= "<table><tbody>\n";
2044
+ $out .= "<tr>";
2045
+ $out .= '<th style="padding:0 .5em;">' . __('Move to footer', $this->textdomain_name) . "</th>\n";
2046
+ $out .= '<th style="padding:0 .5em;">' . __('Remove', $this->textdomain_name) . "</th>\n";
2047
+ $out .= "<th>" . __('JavaScripts', $this->textdomain_name) . "</th>\n";
2048
+ foreach ($this->options['head_js'] as $javascript => $value) {
2049
+ $remove = (array_search( $javascript, (array)$this->options["remove_js"] ) !== FALSE);
2050
+ $out .= "<tr>";
2051
+ $out .= "<th><input type=\"checkbox\" name=\"head_js[$i]\" value=\"$javascript\"".($value === FALSE ? " checked=\"true\"" : "")." /></th>";
2052
+ $out .= "<th><input type=\"checkbox\" name=\"remove_js[$i]\" value=\"$javascript\"".($remove !== FALSE ? " checked=\"true\"" : "")." /></th>";
2053
+ $out .= "<td>$javascript</td>";
2054
+ $i++;
2055
+ }
2056
+ $out .= "</tbody></table>";
2057
+ $out .= "</div>\n";
2058
+
2059
+ // Add Update Button
2060
+ $out .= "<p style=\"margin-top:1em\"><input type=\"submit\" name=\"options_update\" class=\"button-primary\" value=\"".__('Update Options', $this->textdomain_name)." &raquo;\" class=\"button\" /></p>";
2061
+ $out .= "</form></div>\n";
2062
+
2063
+ // Cache Delete
2064
+ $out .= "<div class=\"wrap\" style=\"margin-top:2em;\">\n";
2065
+ $out .= "<h2>" . __('Remove all cache files', $this->textdomain_name) . "</h2><br />\n";
2066
+ $out .= "<form method=\"post\" id=\"remove_cache\" action=\"".$this->admin_action."\">\n";
2067
+ if ($this->wp25) $out .= $this->makeNonceField("remove_cache", "_wpnonce_remove_cache", true, false);
2068
+ $out .= "<p>" . __('All cache files are removed.', $this->textdomain_name) . "</p>";
2069
+ $out .= "<input type=\"submit\" name=\"remove_cache\" class=\"button-primary\" value=\"".__('Remove All Cache Files', $this->textdomain_name)." &raquo;\" class=\"button\" />";
2070
+ $out .= "</form></div>\n";
2071
+
2072
+ // Options Delete
2073
+ $out .= "<div class=\"wrap\" style=\"margin-top:2em;\">\n";
2074
+ $out .= "<h2>" . __('Uninstall', $this->textdomain_name) . "</h2><br />\n";
2075
+ $out .= "<form method=\"post\" id=\"delete_options\" action=\"".$this->admin_action."\">\n";
2076
+ if ($this->wp25) $out .= $this->makeNonceField("delete_options", "_wpnonce_delete_options", true, false);
2077
+ $out .= "<p>" . __('All the settings of &quot;Head Cleaner&quot; are deleted.', $this->textdomain_name) . "</p>";
2078
+ $out .= "<input type=\"submit\" name=\"options_delete\" class=\"button-primary\" value=\"".__('Delete Options', $this->textdomain_name)." &raquo;\" class=\"button\" />";
2079
+ $out .= "</form></div>\n";
2080
+
2081
+ // Output
2082
+ echo (!empty($this->note) ? "<div id=\"message\" class=\"updated fade\"><p>{$this->note}</p></div>\n" : '') . "\n";
2083
+ echo ($this->error == 0 ? $out : '') . "\n";
2084
+
2085
+ }
2086
+
2087
+ //**************************************************************************************
2088
+ // Delete Settings
2089
+ //**************************************************************************************
2090
+ private function _delete_settings() {
2091
+ $this->deleteOptions();
2092
+ $this->_remove_cache_file();
2093
+ $this->options = $this->_init_options();
2094
+ }
2095
+
2096
+ //**************************************************************************************
2097
+ // Get function name
2098
+ //**************************************************************************************
2099
+ private function _get_function_name($function) {
2100
+ return (is_array($function)
2101
+ ? (get_class($function[0]) !== FALSE ? get_class($function[0]) : $function[0]) . '::' . $function[1]
2102
+ : $function
2103
+ );
2104
+ }
2105
+
2106
+ //**************************************************************************************
2107
+ // Get Filters
2108
+ //**************************************************************************************
2109
+ private function _get_filters($tag = '') {
2110
+ global $wp_filter;
2111
+
2112
+ if (empty($tag) && function_exists('current_filter'))
2113
+ $tag = current_filter();
2114
+
2115
+ if (!isset($this->filters[$tag]))
2116
+ $this->filters[$tag] = array();
2117
+
2118
+ $active_filters = (isset($wp_filter[$tag])
2119
+ ? (array) $wp_filter[$tag]
2120
+ : array());
2121
+ foreach ($active_filters as $priority => $filters) {
2122
+ foreach ($filters as $filter) {
2123
+ $function_name = $this->_get_function_name($filter['function']);
2124
+ $this->filters[$tag][$function_name] = $priority;
2125
+ }
2126
+ }
2127
+ unset($active_filters);
2128
+
2129
+ return $this->filters;
2130
+ }
2131
+
2132
+ //**************************************************************************************
2133
+ // Filters update Check
2134
+ //**************************************************************************************
2135
+ private function _chk_filters_update(){
2136
+ $retval = false;
2137
+ foreach ( $this->filters as $tag => $filters ) {
2138
+ if ( isset($this->options['filters'][$tag]) ) {
2139
+ foreach ( $filters as $function_name => $priority) {
2140
+ $retval = ( !isset($this->options['filters'][$tag][$function_name]) );
2141
+ if ($retval) break;
2142
+ }
2143
+ } else {
2144
+ $retval = true; break;
2145
+ }
2146
+ }
2147
+ unset ($filters);
2148
+
2149
+ foreach ( $this->head_js as $key => $val ) {
2150
+ if ( !isset($this->options['head_js'][$key]) ) {
2151
+ $retval = true; break;
2152
+ }
2153
+ }
2154
+
2155
+ return $retval;
2156
+ }
2157
+
2158
+ //**************************************************************************************
2159
+ // Filters priority change
2160
+ //**************************************************************************************
2161
+ private function _change_filters_priority($tag = ''){
2162
+ global $wp_filter;
2163
+
2164
+ if (empty($tag) && function_exists('current_filter'))
2165
+ $tag = current_filter();
2166
+
2167
+ $active_filters = (isset($wp_filter[$tag])
2168
+ ? $wp_filter[$tag]
2169
+ : array());
2170
+ $custom_priority = (isset($this->options['priority'][$tag])
2171
+ ? $this->options['priority'][$tag]
2172
+ : array());
2173
+ foreach ($this->no_conflict as $function_name) {
2174
+ $custom_priority[$function_name] = HC_PRIORITY + 1;
2175
+ }
2176
+ foreach ($active_filters as $priority => $filters) {
2177
+ foreach ($filters as $filter) {
2178
+ $function_name = $this->_get_function_name($filter['function']);
2179
+ if ( isset($custom_priority[$function_name]) && $custom_priority[$function_name] != $priority) {
2180
+ remove_filter( $tag, $filter['function'], $priority);
2181
+ if ($custom_priority[$function_name] > 0)
2182
+ add_filter( $tag, $filter['function'], $custom_priority[$function_name]);
2183
+ }
2184
+ }
2185
+ }
2186
+ unset($custom_priority);
2187
+ unset($active_filters);
2188
+ }
2189
+
2190
+ //**************************************************************************************
2191
+ // raw shortcode
2192
+ //**************************************************************************************
2193
+ function raw_formatter($content) {
2194
+ $new_content = '';
2195
+ $pattern_full = '{(\[raw\].*?\[/raw\])}is';
2196
+ $pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
2197
+ $pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);
2198
+
2199
+ foreach ($pieces as $piece) {
2200
+ if (preg_match($pattern_contents, $piece, $matches)) {
2201
+ $new_content .= $matches[1];
2202
+ } else {
2203
+ $new_content .= wptexturize(wpautop($piece));
2204
+ }
2205
+ }
2206
+
2207
+ return $new_content;
2208
+ }
2209
+
2210
+ //**************************************************************************************
2211
+ // Debug Information
2212
+ //**************************************************************************************
2213
+ private function _microtime_diff($start, $end=NULL) {
2214
+ if( !$end )
2215
+ $end= microtime();
2216
+ list($start_usec, $start_sec) = explode(" ", $start);
2217
+ list($end_usec, $end_sec) = explode(" ", $end);
2218
+ $diff_sec= intval($end_sec) - intval($start_sec);
2219
+ $diff_usec= floatval($end_usec) - floatval($start_usec);
2220
+ return floatval( $diff_sec ) + $diff_usec;
2221
+ }
2222
+
2223
+ private function _get_debug_info($buffer, $tag = '') {
2224
+ $ret_val = "<!--\n";
2225
+
2226
+ $ret_val .= "***** Processing time ****************************\n"
2227
+ . $this->_microtime_diff($this->mtime_start) . " seconds\n"
2228
+ . "**************************************************\n\n";
2229
+ $this->mtime_start = microtime();
2230
+
2231
+ $ret_val .= "***** Original ***********************************\n"
2232
+ . str_replace(array('<', '>'), array('', '>'), $buffer) . "\n"
2233
+ . "**************************************************\n\n";
2234
+
2235
+ $ret_val .= "***** Filters ************************************\n";
2236
+ if (empty($tag) && function_exists('current_filter'))
2237
+ $tag = current_filter();
2238
+ $active_filters = (isset($this->filters[$tag])
2239
+ ? $this->filters[$tag]
2240
+ : array());
2241
+ foreach ($active_filters as $function_name => $priority) {
2242
+ if (strpos($function_name, 'HeadCleaner') === FALSE && strpos($function_name, 'noindex') === FALSE)
2243
+ $ret_val .= " ($priority) : $function_name\n";
2244
+ }
2245
+ $ret_val .= "**************************************************\n\n";
2246
+
2247
+ $ret_val .= "***** ob_list_handlers ***************************\n";
2248
+ if (function_exists('ob_list_handlers')) {
2249
+ $active_handlers = ob_list_handlers();
2250
+ foreach ($active_handlers as $handler) {
2251
+ $ret_val .= " $handler\n";
2252
+ }
2253
+ unset($active_handlers);
2254
+ }
2255
+ $ret_val .= "**************************************************\n\n";
2256
+
2257
+ $ret_val .= "--> \n";
2258
+
2259
+ return $ret_val;
2260
+ }
2261
+ }
2262
+
2263
+ global $head_cleaner;
2264
+
2265
+ $head_cleaner = new HeadCleaner();
2266
+
2267
+ if (function_exists('register_activation_hook'))
2268
+ register_activation_hook(__FILE__, array(&$head_cleaner, 'activation'));
2269
+ if (function_exists('register_deactivation_hook'))
2270
+ register_deactivation_hook(__FILE__, array(&$head_cleaner, 'deactivation'));
2271
+ ?>
includes/common-controller.php CHANGED
@@ -3,8 +3,16 @@
3
  // Require wp-load.php or wp-config.php
4
  //**************************************************************************************
5
  if(!function_exists('get_option')) {
6
- $path = (defined('ABSPATH') ? ABSPATH : dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/');
7
- require_once(file_exists($path.'wp-load.php') ? $path.'wp-load.php' : $path.'wp-config.php');
 
 
 
 
 
 
 
 
8
  }
9
 
10
  //**************************************************************************************
@@ -19,13 +27,12 @@ class wokController {
19
  var $admin_option, $admin_action, $admin_hook;
20
  var $note, $error;
21
  var $charset;
22
- var $wp25, $wp26, $wp27, $wp28, $wp29;
23
 
24
- var $jquery_js = 'includes/js/jquery-1.3.2.min.js';
25
- var $jquery_ver = '1.3.2';
26
 
27
  var $jquery_noconflict_js = 'includes/js/jquery.noconflict.js';
28
- var $forChrome_js = 'includes/js/jquery.browser.chrome.min.js';
29
 
30
  /*
31
  * initialize
@@ -39,6 +46,7 @@ class wokController {
39
  $this->wp27 = version_compare($wp_version, "2.7", ">=");
40
  $this->wp28 = version_compare($wp_version, "2.8", ">=");
41
  $this->wp29 = version_compare($wp_version, "2.9", ">=");
 
42
 
43
  $this->setPluginDir($file);
44
  $this->loadTextdomain();
@@ -133,26 +141,34 @@ class wokController {
133
 
134
  // Add Admin Option Page
135
  function addOptionPage($page_title, $function, $capability = 9, $menu_title = '', $file = '') {
136
- if ($menu_title == '') $menu_title = $page_title;
137
- if ($file == '') $file = $this->plugin_file;
 
 
138
  $this->admin_hook['option'] = add_options_page($page_title, $menu_title, $capability, $file, $function);
139
  }
140
 
141
  function addManagementPage($page_title, $function, $capability = 9, $menu_title = '', $file = '') {
142
- if ($menu_title == '') $menu_title = $page_title;
143
- if ($file == '') $file = $this->plugin_file;
 
 
144
  $this->admin_hook['management'] = add_management_page($page_title, $menu_title, $capability, $file, $function);
145
  }
146
 
147
  function addThemePage($page_title, $function, $capability = 9, $menu_title = '', $file = '') {
148
- if ($menu_title == '') $menu_title = $page_title;
149
- if ($file == '') $file = $this->plugin_file;
 
 
150
  $this->admin_hook['theme'] = add_theme_page($page_title, $menu_title, $capability, $file, $function);
151
  }
152
 
153
  function addSubmenuPage($parent, $page_title, $function, $capability = 9, $menu_title = '', $file = '') {
154
- if ($menu_title == '') $menu_title = $page_title;
155
- if ($file == '') $file = $this->plugin_file;
 
 
156
  $this->admin_hook[$parent] = add_submenu_page($parent, $page_title, $menu_title, $capability, $file, $function);
157
  }
158
 
@@ -195,7 +211,7 @@ class wokController {
195
  return $is_active;
196
  }
197
 
198
- // Is Ktai Access ?
199
  function isKtai(){
200
  return (
201
  (function_exists('is_mobile') && is_mobile()) ||
@@ -203,41 +219,23 @@ class wokController {
203
  );
204
  }
205
 
206
- // Is mobile access?
207
- function isMobile() {
208
- $is_mobile = $this->isKtai();
209
-
210
- if ( !$is_mobile && function_exists('bnc_is_iphone') ) {
211
- global $wptouch_plugin;
212
-
213
- $is_mobile = bnc_is_iphone();
214
- if ( $is_mobile && isset($wptouch_plugin) ) {
215
- $is_mobile = isset($wptouch_plugin->desired_view)
216
- ? $wptouch_plugin->desired_view == 'mobile'
217
- : true;
218
- }
219
- }
220
-
221
- return ($is_mobile);
222
- }
223
-
224
  // Output Javascript
225
  function writeScript($out = '', $place = 'head') {
226
  global $wok_script_manager;
227
- if ($out == '' || !isset($wok_script_manager)) return;
 
228
  add_filter($place.'_script/manageScripts', create_function('$js', 'return $js . "'.addcslashes($out,'"').'";'));
229
  }
230
 
231
  // Regist jQuery
232
  function addjQuery() {
233
- if (function_exists('wp_register_script')) {
234
- global $wok_script_manager;
235
- if (!isset($wok_script_manager)) return false;
236
 
 
237
  $wok_script_manager->registerScript('jquery', $this->plugin_url.$this->jquery_js, false, $this->jquery_ver);
238
  wp_enqueue_script('jquery');
239
- if (eregi("chrome", $_SERVER['HTTP_USER_AGENT']))
240
- wp_enqueue_script('jquery.chrome', $this->plugin_url.$this->forChrome_js, array('jquery'), $this->jquery_ver);
241
  add_filter('print_scripts_array', array($this, 'jQueryNoConflict'), 11);
242
  return true;
243
  } else {
@@ -249,7 +247,8 @@ class wokController {
249
  function jQueryNoConflict($args) {
250
  if (function_exists('wp_register_script')) {
251
  global $wok_script_manager;
252
- if (!isset($wok_script_manager)) return false;
 
253
 
254
  $jquerypos = array_search('jquery', $args);
255
  if(false !== $jquerypos && in_array('prototype', $args)) {
@@ -303,7 +302,9 @@ class wokScriptManager {
303
  }
304
  function __construct() {
305
  global $wp_scripts;
306
- if (!is_a($wp_scripts, 'WP_Scripts')) $wp_scripts = new WP_Scripts();
 
 
307
  add_action('admin_head', array($this, 'adminHeadPrintScript'), 11);
308
  add_action('wp_head', array($this, 'headPrintScript'), 11);
309
  add_action('wp_footer', array($this, 'footerPrintScript'), 11);
@@ -315,9 +316,12 @@ class wokScriptManager {
315
  if (version_compare($wp_version, "2.6", ">=")) {
316
  if (isset($wp_scripts->registered[$handle])) {
317
  if (version_compare($wp_scripts->registered[$handle]->ver, $ver, '<')) {
318
- if ($src != '') $wp_scripts->registered[$handle]->src = $src;
319
- if (is_array($deps)) $wp_scripts->registered[$handle]->deps = $deps;
320
- if ($ver != false) $wp_scripts->registered[$handle]->ver = $ver;
 
 
 
321
  }
322
  } else {
323
  wp_register_script($handle, $src, $deps, $ver);
@@ -325,9 +329,12 @@ class wokScriptManager {
325
  } else {
326
  if (isset($wp_scripts->scripts[$handle])) {
327
  if (version_compare($wp_scripts->scripts[$handle]->ver, $ver, '<')) {
328
- if ($src != '') $wp_scripts->scripts[$handle]->src = $src;
329
- if (is_array($deps)) $wp_scripts->scripts[$handle]->deps = $deps;
330
- if ($ver != false) $wp_scripts->scripts[$handle]->ver = $ver;
 
 
 
331
  }
332
  } else {
333
  wp_register_script($handle, $src, $deps, $ver);
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
  //**************************************************************************************
27
  var $admin_option, $admin_action, $admin_hook;
28
  var $note, $error;
29
  var $charset;
30
+ var $wp25, $wp26, $wp27, $wp28, $wp29, $wp30;
31
 
32
+ var $jquery_js = 'includes/js/jquery-1.4.2.min.js';
33
+ var $jquery_ver = '1.4.2';
34
 
35
  var $jquery_noconflict_js = 'includes/js/jquery.noconflict.js';
 
36
 
37
  /*
38
  * initialize
46
  $this->wp27 = version_compare($wp_version, "2.7", ">=");
47
  $this->wp28 = version_compare($wp_version, "2.8", ">=");
48
  $this->wp29 = version_compare($wp_version, "2.9", ">=");
49
+ $this->wp30 = version_compare($wp_version, "3.0", ">=");
50
 
51
  $this->setPluginDir($file);
52
  $this->loadTextdomain();
141
 
142
  // Add Admin Option Page
143
  function addOptionPage($page_title, $function, $capability = 9, $menu_title = '', $file = '') {
144
+ if ($menu_title == '')
145
+ $menu_title = $page_title;
146
+ if ($file == '')
147
+ $file = $this->plugin_file;
148
  $this->admin_hook['option'] = add_options_page($page_title, $menu_title, $capability, $file, $function);
149
  }
150
 
151
  function addManagementPage($page_title, $function, $capability = 9, $menu_title = '', $file = '') {
152
+ if ($menu_title == '')
153
+ $menu_title = $page_title;
154
+ if ($file == '')
155
+ $file = $this->plugin_file;
156
  $this->admin_hook['management'] = add_management_page($page_title, $menu_title, $capability, $file, $function);
157
  }
158
 
159
  function addThemePage($page_title, $function, $capability = 9, $menu_title = '', $file = '') {
160
+ if ($menu_title == '')
161
+ $menu_title = $page_title;
162
+ if ($file == '')
163
+ $file = $this->plugin_file;
164
  $this->admin_hook['theme'] = add_theme_page($page_title, $menu_title, $capability, $file, $function);
165
  }
166
 
167
  function addSubmenuPage($parent, $page_title, $function, $capability = 9, $menu_title = '', $file = '') {
168
+ if ($menu_title == '')
169
+ $menu_title = $page_title;
170
+ if ($file == '')
171
+ $file = $this->plugin_file;
172
  $this->admin_hook[$parent] = add_submenu_page($parent, $page_title, $menu_title, $capability, $file, $function);
173
  }
174
 
211
  return $is_active;
212
  }
213
 
214
+ // Mobile Access ?
215
  function isKtai(){
216
  return (
217
  (function_exists('is_mobile') && is_mobile()) ||
219
  );
220
  }
221
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
  // Output Javascript
223
  function writeScript($out = '', $place = 'head') {
224
  global $wok_script_manager;
225
+ if ($out == '' || !isset($wok_script_manager))
226
+ return;
227
  add_filter($place.'_script/manageScripts', create_function('$js', 'return $js . "'.addcslashes($out,'"').'";'));
228
  }
229
 
230
  // Regist jQuery
231
  function addjQuery() {
232
+ global $wok_script_manager;
233
+ if (!isset($wok_script_manager))
234
+ return false;
235
 
236
+ if (function_exists('wp_register_script')) {
237
  $wok_script_manager->registerScript('jquery', $this->plugin_url.$this->jquery_js, false, $this->jquery_ver);
238
  wp_enqueue_script('jquery');
 
 
239
  add_filter('print_scripts_array', array($this, 'jQueryNoConflict'), 11);
240
  return true;
241
  } else {
247
  function jQueryNoConflict($args) {
248
  if (function_exists('wp_register_script')) {
249
  global $wok_script_manager;
250
+ if (!isset($wok_script_manager))
251
+ return false;
252
 
253
  $jquerypos = array_search('jquery', $args);
254
  if(false !== $jquerypos && in_array('prototype', $args)) {
302
  }
303
  function __construct() {
304
  global $wp_scripts;
305
+ if (!is_a($wp_scripts, 'WP_Scripts'))
306
+ $wp_scripts = new WP_Scripts();
307
+
308
  add_action('admin_head', array($this, 'adminHeadPrintScript'), 11);
309
  add_action('wp_head', array($this, 'headPrintScript'), 11);
310
  add_action('wp_footer', array($this, 'footerPrintScript'), 11);
316
  if (version_compare($wp_version, "2.6", ">=")) {
317
  if (isset($wp_scripts->registered[$handle])) {
318
  if (version_compare($wp_scripts->registered[$handle]->ver, $ver, '<')) {
319
+ if ($src != '')
320
+ $wp_scripts->registered[$handle]->src = $src;
321
+ if (is_array($deps))
322
+ $wp_scripts->registered[$handle]->deps = $deps;
323
+ if ($ver != false)
324
+ $wp_scripts->registered[$handle]->ver = $ver;
325
  }
326
  } else {
327
  wp_register_script($handle, $src, $deps, $ver);
329
  } else {
330
  if (isset($wp_scripts->scripts[$handle])) {
331
  if (version_compare($wp_scripts->scripts[$handle]->ver, $ver, '<')) {
332
+ if ($src != '')
333
+ $wp_scripts->scripts[$handle]->src = $src;
334
+ if (is_array($deps))
335
+ $wp_scripts->scripts[$handle]->deps = $deps;
336
+ if ($ver != false)
337
+ $wp_scripts->scripts[$handle]->ver = $ver;
338
  }
339
  } else {
340
  wp_register_script($handle, $src, $deps, $ver);
includes/js/jquery-1.3.2.min.js DELETED
@@ -1,19 +0,0 @@
1
- /*
2
- * jQuery JavaScript Library v1.3.2
3
- * http://jquery.com/
4
- *
5
- * Copyright (c) 2009 John Resig
6
- * Dual licensed under the MIT and GPL licenses.
7
- * http://docs.jquery.com/License
8
- *
9
- * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
10
- * Revision: 6246
11
- */
12
- (function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
13
- /*
14
- * Sizzle CSS Selector Engine - v0.9.3
15
- * Copyright 2009, The Dojo Foundation
16
- * Released under the MIT, BSD, and GPL Licenses.
17
- * More information: http://sizzlejs.com/
18
- */
19
- (function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/js/jquery-1.4.2.min.js ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery JavaScript Library v1.4.2
3
+ * http://jquery.com/
4
+ *
5
+ * Copyright 2010, John Resig
6
+ * Dual licensed under the MIT or GPL Version 2 licenses.
7
+ * http://jquery.org/license
8
+ *
9
+ * Includes Sizzle.js
10
+ * http://sizzlejs.com/
11
+ * Copyright 2010, The Dojo Foundation
12
+ * Released under the MIT, BSD, and GPL Licenses.
13
+ *
14
+ * Date: Sat Feb 13 22:33:48 2010 -0500
15
+ */
16
+ (function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?
17
+ e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=
18
+ j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,
19
+ "&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=
20
+ true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
21
+ Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
22
+ (d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
23
+ a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
24
+ "find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
25
+ function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||
26
+ c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",
27
+ L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,
28
+ "isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+
29
+ a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
30
+ d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===
31
+ a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&
32
+ !c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=
33
+ true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
34
+ var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,
35
+ parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=
36
+ false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=
37
+ s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,
38
+ applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];
39
+ else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,
40
+ a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===
41
+ w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,
42
+ cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ",
43
+ i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ",
44
+ " ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=
45
+ this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i=
46
+ e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=
47
+ c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
48
+ a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,
49
+ function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");
50
+ k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),
51
+ C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!=
52
+ null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=
53
+ e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&
54
+ f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;
55
+ if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
56
+ fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
57
+ d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this,
58
+ "events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=
59
+ a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,
60
+ isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit=
61
+ {setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
62
+ if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",
63
+ e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,
64
+ "_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,
65
+ d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&
66
+ !a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},
67
+ toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector,
68
+ u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),
69
+ function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];
70
+ if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
71
+ e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();
72
+ t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||
73
+ g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[];
74
+ for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-
75
+ 1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
76
+ CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},
77
+ relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]=
78
+ l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[];
79
+ h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},
80
+ CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,
81
+ g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},
82
+ text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},
83
+ setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=
84
+ h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m=
85
+ m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===
86
+ "="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,
87
+ h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition||
88
+ !h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m=
89
+ h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&
90
+ q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>";
91
+ if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();
92
+ (function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:
93
+ function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,
94
+ gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;
95
+ c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j=
96
+ {},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a===
97
+ "string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",
98
+ d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?
99
+ a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===
100
+ 1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?
101
+ a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
102
+ c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
103
+ wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
104
+ prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
105
+ this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
106
+ return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,
107
+ ""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&
108
+ this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]||
109
+ u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length===
110
+ 1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);
111
+ return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",
112
+ ""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=
113
+ c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?
114
+ c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=
115
+ function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=
116
+ Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,
117
+ "border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=
118
+ a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=
119
+ a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!==
120
+ "string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this},
121
+ serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),
122
+ function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,
123
+ global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&
124
+ e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)?
125
+ "&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===
126
+ false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B=
127
+ false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",
128
+ c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E||
129
+ d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x);
130
+ g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===
131
+ 1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b===
132
+ "json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional;
133
+ if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");
134
+ this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],
135
+ "olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},
136
+ animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing=
137
+ j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);
138
+ this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration===
139
+ "number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||
140
+ c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;
141
+ this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
142
+ this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,
143
+ e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||
144
+ c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?
145
+ function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=
146
+ this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle;
147
+ k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&
148
+ f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
149
+ a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b);
150
+ c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,
151
+ d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-
152
+ f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":
153
+ "pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in
154
+ e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);
includes/js/jquery.browser.chrome.min.js DELETED
@@ -1 +0,0 @@
1
- (function(C){var B=navigator.userAgent.toLowerCase();C.browser=C.extend(C.browser,{version:((!/chrome/.test(B)?B.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/):B.match(/.+chrome\/([\d.]+)/))||[])[1],safari:/webkit/.test(B)&&!/chrome/.test(B),chrome:/chrome/.test(B)});if(C.browser.chrome){C.fn.extend({ready:function(E){A();if(C.isReady){E.call(document,C)}else{C.readyList.push(function(){return E.call(this,C)})}return this}});var D=false;function A(){if(D){return }D=true;var E;(function(){if(C.isReady){return }if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return }if(E===undefined){E=C("style, link[rel=stylesheet]").length}if(document.styleSheets.length!=E){setTimeout(arguments.callee,0);return }C.ready()})();C.event.add(window,"load",C.ready)}}})(jQuery);
 
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
5
  Requires at least: 2.5
6
  Tested up to: 3.0
7
- Stable tag: 1.3.9
8
 
9
  Cleaning tags from your WordPress header and footer.
10
 
4
  Tags: head, header, footer, javascript, css, optimization, minified, performance
5
  Requires at least: 2.5
6
  Tested up to: 3.0
7
+ Stable tag: 1.3.10
8
 
9
  Cleaning tags from your WordPress header and footer.
10
 
readme_ja.txt CHANGED
@@ -1,94 +1,94 @@
1
- === Head Cleaner ===
2
- Contributors: wokamoto
3
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=9S8AJCY7XB8F4&lc=JP&item_name=WordPress%20Plugins&item_number=wp%2dplugins&currency_code=JPY&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
4
- Tags: head optimization, javascript, css, optimization, minified, performance
5
- Requires at least: 2.5
6
- Tested up to: 3.0
7
- Stable tag: 1.3.9
8
-
9
- Head �� footer �����|�����܂��B
10
-
11
- == Description ==
12
-
13
- WordPress �T�C�g�� `<head>` �̒��g�ƁA�t�b�^�̈�𐮌`���Ȃ����܂��B
14
- **PHP5 �ȍ~�̂ݑΉ��ł��B**
15
-
16
- = Features =
17
-
18
- * IE6 �ȊO�̎��͐擪�� xml �錾��t�^�B
19
- * �d���^�O��A�s�v�ȃ^�O�A�R�����g�A�󔒂��폜�B
20
- * `<meta name="description" />` �^�O����������ꍇ�A��‚ɂ܂Ƃ߂�
21
- * `<meta name="keyword" />` �^�O����������ꍇ�A��‚ɂ܂Ƃ߂�
22
- * �b��� `<link rel="canonical" />` �^�O��lj��B
23
- * IE �R���f�B�V���i���^�O�𔻒肵�āA�u���E�U�� IE �̎������Ώۃ^�O��\���B
24
- * CSS, JavaScript �́A�u���E�U���Ή����Ă���� gzip ���k�]���B
25
- * �������� CSS �� media �������ƂɌ������Ĉ�t�@�C���ɂ܂Ƃ߂�B
26
- �������A���̃t�@�C���ɂ� �C�����C�� CSS ���܂܂��B
27
- * [CSSTidy](http://csstidy.sourceforge.net/ "CSSTidy") ���g�p���� CSS ���œK������B
28
- * CSSTidy �̍œK���I�v�V�������Ǘ���ʂŎw��ł���B
29
- * �������� JavaScript �����ׂČ������Ĉ�t�@�C���ɂ܂Ƃ߂�B
30
- �������A���̃t�@�C���ɂ� �C�����C�� JavaScript ���܂܂��B
31
- * [JSMin](http://code.google.com/p/jsmin-php/ "JSMin") �ŁAJavaScript �̃\�[�X�R�[�h�����k����B
32
- * JavaScript ���t�b�^�̈�Ɉړ����邱�Ƃ��ł���B
33
- * �t�b�^�̈�� JavaScript �����l�Ɍ������Ĉ�t�@�C���ɂ܂Ƃ߂�B
34
- * Prototype.js, script.aculo.us, jQuery, mootools �������ǂݍ��܂�Ă���ꍇ�A�P�񂾂��ǂݍ��ނ悤�ɂ���B
35
- * Prototype.js, script.aculo.us, jQuery, mootools �̓ǂݍ��ݏ����C�����āA�ł��邾���R���t���N�g���������Ȃ��悤�ɂ���B
36
-
37
- = Localization =
38
- "Head Cleaner" ���e����ɖ|�󂵂Ă������������X�Ɋ��ӂ����߂āB
39
-
40
- * Belorussian (by) - [Marcis Gasuns](http://www.comfi.com/ "Marcis Gasuns")
41
- * Dutch (nl_NL) - [Rene](http://wpwebshop.com/blog "WPWebshop Blog")
42
- * German (de) - Carsten
43
- * Japanese (ja) - [OKAMOTO Wataru](http://dogmap.jp/ "dogmap.jp") (plugin author)
44
- * Spanish (es) - [Franz Hartmann](http://tolingo.com/ "tolingo.com - Franz Hartmann")
45
- * Russian (ru) - [ilyuha](http://antsar.info/ "ilyuha")
46
-
47
-
48
- == Installation ==
49
-
50
- 1. `/wp-content/plugins/` �f�B���N�g���� `head-cleaner` �f�B���N�g�����쐬���A���̒��Ƀv���O�C���t�@�C�����i�[���Ă��������B
51
- �@��ʓI�ɂ� .zip ����W�J���ꂽ head-cleaner �t�H���_�����̂܂܃A�b�v���[�h����� OK �ł��B
52
- 2. `/wp-content/` �f�B���N�g���ȉ��� `cache/head-cleaner` �Ƃ����f�B���N�g�����쐬���A����ɂ��̒��� `js`, `css` �Ƃ����Q�‚̃f�B���N�g�����쐬���āA�������݌�����^���Ă��������B
53
- 3. WordPress �� "�v���O�C��" ���j���[���� "Head Cleaner" ��L���������������B
54
-
55
- Head Cleaner �̃I�v�V�����ݒ�� "�ݒ� > Head Cleaner" �ōs���܂��B
56
-
57
-
58
- **�g�p���Ă���PHP���C�u���� [Simple HTML DOM Parser](http://simplehtmldom.sourceforge.net/ "Simple HTML DOM Parser") �� [JSMin](http://code.google.com/p/jsmin-php/ "JSMin") �̐�����APHP5 �ȍ~�̂ݑΉ��ł��B**
59
-
60
- == Frequently Asked Questions ==
61
-
62
- ����̃v���O�C���������o���R�[�h�𐮌`�ΏۊO�ɂ������ꍇ�́A�ݒ��ʂ́u�A�N�e�B�u�ȃt�B���^�v����A�ΏۊO�ɂ������t�B���^����I�����Ă��������B
63
-
64
-
65
- �e�[�}���̓���̋L�q�𐮌`�ΏۊO�ɂ������ꍇ�� `header.php` ���C������K�v������܂��B
66
- ��̓I�ɂ́A���`�ΏۊO�ɂ����������� `<?php wp_head(); ?>` ��艺�ɋL�q���Ă��������B
67
-
68
-
69
- �����Ɏg�p���Ă���v���O�C���E�e�[�}�ɂ���Ă͐���ɓ��삵�܂���B
70
- ����ɓ��삵�Ȃ��ꍇ�́A���̃v���O�C���ȊO�̂��ׂẴv���O�C�����~������A��ˆ�—L�������āA�ǂ̃v���O�C���Ƌ������邩�m���߂Ă݂Ă��������B
71
- ��������v���O�C�������������ꍇ�A��҂܂ŘA������������Ɣ��ɏ�����܂��B
72
- [http://dogmap.jp/2009/02/20/head-cleaner/](http://dogmap.jp/2009/02/20/head-cleaner/ "http://dogmap.jp/2009/02/20/head-cleaner/")
73
-
74
-
75
- ���݁A�ȉ��̃v���O�C���Ɠ����Ɏg�p����ƁA����ɓ��삵�Ȃ����Ƃ��񍐂���Ă��܂��B
76
-
77
- **[All in One SEO Pack](http://wordpress.org/extend/plugins/all-in-one-seo-pack/ "All in One SEO Pack")**
78
- �@�ꕔ�‹��Łu�^�C�g���̏��������v�I�v�V�������L���ɂȂ��Ă���ƁA���̃v���O�C�������퓮�삵�Ȃ��Ƃ����񍐂�����܂����B
79
- �@�ʏ�͖�肪����܂��񂪁A��肪���������ꍇ�́u�^�C�g���̏��������v���I�t�ɂ��āA�^�C�g���̏��������͕ʃv���O�C�����g�p����悤�ɂ��Ă��������B
80
- ( Ver.1.3.4 �ŏC�� )
81
-
82
- = CSS, JavaScript �̃L���b�V���t�@�C�����쐬����܂��� =
83
-
84
- �ȉ��̓�‚̃f�B���N�g���� CSS, JavaScript ���L���b�V�����܂��B
85
- �L���b�V����L���ɂ������ꍇ�́A���ꂼ��̃t�H���_���쐬���Ă��������B
86
-
87
- * `wp-content/cache/head-cleaner/css/`
88
- * `wp-content/cache/head-cleaner/js/`
89
-
90
- = ���[�j���O���\������܂��uget_browser(): browscap ini directive not set in �`�v =
91
-
92
- ���̊֐�������ɋ@�\���邽�߂ɂ́Aphp.ini �� browscap �ݒ肪�A�V�X�e����� browscap.ini �̐��m�Ȉʒu�� �w���Ă���K�v������܂��B
93
- �Q�ƁF[PHP: get_browser](http://jp.php.net/manual/ja/function.get-browser.php "PHP: get_browser - Manual")
94
-
1
+ === Head Cleaner ===
2
+ Contributors: wokamoto
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=9S8AJCY7XB8F4&lc=JP&item_name=WordPress%20Plugins&item_number=wp%2dplugins&currency_code=JPY&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
4
+ Tags: head optimization, javascript, css, optimization, minified, performance
5
+ Requires at least: 2.5
6
+ Tested up to: 3.0
7
+ Stable tag: 1.3.10
8
+
9
+ Head �� footer �����|�����܂��B
10
+
11
+ == Description ==
12
+
13
+ WordPress �T�C�g�� `<head>` �̒��g�ƁA�t�b�^�̈�𐮌`���Ȃ����܂��B
14
+ **PHP5 �ȍ~�̂ݑΉ��ł��B**
15
+
16
+ = Features =
17
+
18
+ * IE6 �ȊO�̎��͐擪�� xml �錾��t�^�B
19
+ * �d���^�O��A�s�v�ȃ^�O�A�R�����g�A�󔒂��폜�B
20
+ * `<meta name="description" />` �^�O����������ꍇ�A��‚ɂ܂Ƃ߂�
21
+ * `<meta name="keyword" />` �^�O����������ꍇ�A��‚ɂ܂Ƃ߂�
22
+ * �b��� `<link rel="canonical" />` �^�O��lj��B
23
+ * IE �R���f�B�V���i���^�O�𔻒肵�āA�u���E�U�� IE �̎������Ώۃ^�O��\���B
24
+ * CSS, JavaScript �́A�u���E�U���Ή����Ă���� gzip ���k�]���B
25
+ * �������� CSS �� media �������ƂɌ������Ĉ�t�@�C���ɂ܂Ƃ߂�B
26
+ �������A���̃t�@�C���ɂ� �C�����C�� CSS ���܂܂��B
27
+ * [CSSTidy](http://csstidy.sourceforge.net/ "CSSTidy") ���g�p���� CSS ���œK������B
28
+ * CSSTidy �̍œK���I�v�V�������Ǘ���ʂŎw��ł���B
29
+ * �������� JavaScript �����ׂČ������Ĉ�t�@�C���ɂ܂Ƃ߂�B
30
+ �������A���̃t�@�C���ɂ� �C�����C�� JavaScript ���܂܂��B
31
+ * [JSMin](http://code.google.com/p/jsmin-php/ "JSMin") �ŁAJavaScript �̃\�[�X�R�[�h�����k����B
32
+ * JavaScript ���t�b�^�̈�Ɉړ����邱�Ƃ��ł���B
33
+ * �t�b�^�̈�� JavaScript �����l�Ɍ������Ĉ�t�@�C���ɂ܂Ƃ߂�B
34
+ * Prototype.js, script.aculo.us, jQuery, mootools �������ǂݍ��܂�Ă���ꍇ�A�P�񂾂��ǂݍ��ނ悤�ɂ���B
35
+ * Prototype.js, script.aculo.us, jQuery, mootools �̓ǂݍ��ݏ����C�����āA�ł��邾���R���t���N�g���������Ȃ��悤�ɂ���B
36
+
37
+ = Localization =
38
+ "Head Cleaner" ���e����ɖ|�󂵂Ă������������X�Ɋ��ӂ����߂āB
39
+
40
+ * Belorussian (by) - [Marcis Gasuns](http://www.comfi.com/ "Marcis Gasuns")
41
+ * Dutch (nl_NL) - [Rene](http://wpwebshop.com/blog "WPWebshop Blog")
42
+ * German (de) - Carsten
43
+ * Japanese (ja) - [OKAMOTO Wataru](http://dogmap.jp/ "dogmap.jp") (plugin author)
44
+ * Spanish (es) - [Franz Hartmann](http://tolingo.com/ "tolingo.com - Franz Hartmann")
45
+ * Russian (ru) - [ilyuha](http://antsar.info/ "ilyuha")
46
+
47
+
48
+ == Installation ==
49
+
50
+ 1. `/wp-content/plugins/` �f�B���N�g���� `head-cleaner` �f�B���N�g�����쐬���A���̒��Ƀv���O�C���t�@�C�����i�[���Ă��������B
51
+ �@��ʓI�ɂ� .zip ����W�J���ꂽ head-cleaner �t�H���_�����̂܂܃A�b�v���[�h����� OK �ł��B
52
+ 2. `/wp-content/` �f�B���N�g���ȉ��� `cache/head-cleaner` �Ƃ����f�B���N�g�����쐬���A����ɂ��̒��� `js`, `css` �Ƃ����Q�‚̃f�B���N�g�����쐬���āA�������݌�����^���Ă��������B
53
+ 3. WordPress �� "�v���O�C��" ���j���[���� "Head Cleaner" ��L���������������B
54
+
55
+ Head Cleaner �̃I�v�V�����ݒ�� "�ݒ� > Head Cleaner" �ōs���܂��B
56
+
57
+
58
+ **�g�p���Ă���PHP���C�u���� [Simple HTML DOM Parser](http://simplehtmldom.sourceforge.net/ "Simple HTML DOM Parser") �� [JSMin](http://code.google.com/p/jsmin-php/ "JSMin") �̐�����APHP5 �ȍ~�̂ݑΉ��ł��B**
59
+
60
+ == Frequently Asked Questions ==
61
+
62
+ ����̃v���O�C���������o���R�[�h�𐮌`�ΏۊO�ɂ������ꍇ�́A�ݒ��ʂ́u�A�N�e�B�u�ȃt�B���^�v����A�ΏۊO�ɂ������t�B���^����I�����Ă��������B
63
+
64
+
65
+ �e�[�}���̓���̋L�q�𐮌`�ΏۊO�ɂ������ꍇ�� `header.php` ���C������K�v������܂��B
66
+ ��̓I�ɂ́A���`�ΏۊO�ɂ����������� `<?php wp_head(); ?>` ��艺�ɋL�q���Ă��������B
67
+
68
+
69
+ �����Ɏg�p���Ă���v���O�C���E�e�[�}�ɂ���Ă͐���ɓ��삵�܂���B
70
+ ����ɓ��삵�Ȃ��ꍇ�́A���̃v���O�C���ȊO�̂��ׂẴv���O�C�����~������A��ˆ�—L�������āA�ǂ̃v���O�C���Ƌ������邩�m���߂Ă݂Ă��������B
71
+ ��������v���O�C�������������ꍇ�A��҂܂ŘA������������Ɣ��ɏ�����܂��B
72
+ [http://dogmap.jp/2009/02/20/head-cleaner/](http://dogmap.jp/2009/02/20/head-cleaner/ "http://dogmap.jp/2009/02/20/head-cleaner/")
73
+
74
+
75
+ ���݁A�ȉ��̃v���O�C���Ɠ����Ɏg�p����ƁA����ɓ��삵�Ȃ����Ƃ��񍐂���Ă��܂��B
76
+
77
+ **[All in One SEO Pack](http://wordpress.org/extend/plugins/all-in-one-seo-pack/ "All in One SEO Pack")**
78
+ �@�ꕔ�‹��Łu�^�C�g���̏��������v�I�v�V�������L���ɂȂ��Ă���ƁA���̃v���O�C�������퓮�삵�Ȃ��Ƃ����񍐂�����܂����B
79
+ �@�ʏ�͖�肪����܂��񂪁A��肪���������ꍇ�́u�^�C�g���̏��������v���I�t�ɂ��āA�^�C�g���̏��������͕ʃv���O�C�����g�p����悤�ɂ��Ă��������B
80
+ ( Ver.1.3.4 �ŏC�� )
81
+
82
+ = CSS, JavaScript �̃L���b�V���t�@�C�����쐬����܂��� =
83
+
84
+ �ȉ��̓�‚̃f�B���N�g���� CSS, JavaScript ���L���b�V�����܂��B
85
+ �L���b�V����L���ɂ������ꍇ�́A���ꂼ��̃t�H���_���쐬���Ă��������B
86
+
87
+ * `wp-content/cache/head-cleaner/css/`
88
+ * `wp-content/cache/head-cleaner/js/`
89
+
90
+ = ���[�j���O���\������܂��uget_browser(): browscap ini directive not set in �`�v =
91
+
92
+ ���̊֐�������ɋ@�\���邽�߂ɂ́Aphp.ini �� browscap �ݒ肪�A�V�X�e����� browscap.ini �̐��m�Ȉʒu�� �w���Ă���K�v������܂��B
93
+ �Q�ƁF[PHP: get_browser](http://jp.php.net/manual/ja/function.get-browser.php "PHP: get_browser - Manual")
94
+