Hyper Cache - Version 1.0.5

Version Description

Download this release

Release Info

Developer satollo
Plugin Icon wp plugin Hyper Cache
Version 1.0.5
Comparing to
See all releases

Code changes from version 1.0.3 to 1.0.5

advanced-cache.php CHANGED
@@ -1,64 +1,76 @@
1
  <?php
2
- @include(dirname(__FILE__) . '/hyper-cache-config.php');
3
 
4
  // From the config file
5
- if (!$hyper_cache_enabled) return;
 
 
6
 
7
  // Do not cache post request (comments, plugins and so on)
8
- if ($_SERVER["REQUEST_METHOD"] == 'POST') return;
 
 
9
 
10
  // Do not use or cache pages when a wordpress user is logged on
11
- foreach ($_COOKIE as $n=>$v)
12
- {
13
- if (substr($n, 0, 13) == 'wordpressuser') return;
 
 
14
  }
15
 
16
- $hyper_uri = $_SERVER['REQUEST_URI'];
17
 
18
  // Do not cache WP pages, even if those calls typically don't go throught this script
19
- if (strpos($hyper_uri, '?') !== false) return;
20
- if (strpos($hyper_uri, '/wp-admin/') !== false) return;
21
- if (strpos($hyper_uri, '/wp-includes/') !== false) return;
22
- if (strpos($hyper_uri, '/wp-content/') !== false) return;
 
 
 
23
 
24
  // Special blocks: the download manager plugin
25
- if (strpos($hyper_uri, '/download/') !== false) return;
 
 
26
 
27
  // Remove the anchor
28
  $x = strpos($hyper_uri, '#');
29
- if ($x !== false) $hyper_uri = substr($hyper_uri, 0, $x);
30
-
31
-
32
 
33
  $hyper_cache_name = md5($hyper_uri);
34
  $hyper_file = ABSPATH . 'wp-content/hyper-cache/' . $hyper_cache_name . '.dat';
35
 
36
- if (file_exists($hyper_file))
37
- {
38
- $hyper_data = unserialize(file_get_contents($hyper_file));
39
- if ($hyper_cache_timeout == null) $hyper_cache_timeout = 60;
40
- if ($hyper_data != null && ($hyper_data['time'] > time()-($hyper_cache_timeout*60)) && $hyper_data['html'] != '')
41
- {
 
 
 
42
  header('Content-Type: text/html;charset=UTF-8');
43
  echo $hyper_data['html'];
44
- //echo '<!-- -->';
45
  flush();
46
  die();
47
  }
48
  }
49
 
50
- //var_dump($_COOKIE);
51
  // Now we start the caching, but we remove the cookie which stores the comment for data
52
- foreach ($_COOKIE as $n=>$v)
53
- {
54
- if (substr($n, 0, 14) == 'comment_author') unset($_COOKIE[$n]);
 
55
  }
56
- ob_start('hyper_cache_callback');
57
-
58
 
 
59
  function hyper_cache_callback($buffer) {
60
  global $hyper_file;
61
- //$name = md5($_SERVER['REQUEST_URI']);
62
 
63
  $data['uri'] = $_SERVER['REQUEST_URI'];
64
  $data['referer'] = $_SERVER['HTTP_REFERER'];
@@ -71,5 +83,4 @@ function hyper_cache_callback($buffer) {
71
 
72
  return $buffer;
73
  }
74
-
75
- ?>
1
  <?php
2
+ @include( dirname(__FILE__) . '/hyper-cache-config.php' );
3
 
4
  // From the config file
5
+ if (!$hyper_cache_enabled) {
6
+ return false;
7
+ }
8
 
9
  // Do not cache post request (comments, plugins and so on)
10
+ if ($_SERVER["REQUEST_METHOD"] == 'POST') {
11
+ return false;
12
+ }
13
 
14
  // Do not use or cache pages when a wordpress user is logged on
15
+ foreach ( (array) $_COOKIE as $n => $v ) {
16
+ // wp 2.5 and wp 2.3 have different cookie prefix
17
+ if (substr($n, 0, 14) == 'wordpressuser_' || substr($n, 0, 10) == 'wordpress_' ) {
18
+ return false;
19
+ }
20
  }
21
 
22
+ $hyper_uri = stripslashes($_SERVER['REQUEST_URI']);
23
 
24
  // Do not cache WP pages, even if those calls typically don't go throught this script
25
+ if( strpos($hyper_uri, '?') !== false ||
26
+ strpos($hyper_uri, '/wp-admin/') !== false ||
27
+ strpos($hyper_uri, '/wp-includes/') !== false ||
28
+ strpos($hyper_uri, '/wp-content/') !== false ) {
29
+ return false;
30
+ }
31
+
32
 
33
  // Special blocks: the download manager plugin
34
+ if (strpos($hyper_uri, '/download/') !== false) {
35
+ return false;
36
+ }
37
 
38
  // Remove the anchor
39
  $x = strpos($hyper_uri, '#');
40
+ if ($x !== false) {
41
+ $hyper_uri = substr($hyper_uri, 0, $x);
42
+ }
43
 
44
  $hyper_cache_name = md5($hyper_uri);
45
  $hyper_file = ABSPATH . 'wp-content/hyper-cache/' . $hyper_cache_name . '.dat';
46
 
47
+ if ( is_file($hyper_file) ) {
48
+ $hyper_data = unserialize( file_get_contents($hyper_file) );
49
+
50
+ // Default timeout
51
+ if ($hyper_cache_timeout == null) {
52
+ $hyper_cache_timeout = 60;
53
+ }
54
+
55
+ if ($hyper_data != null && ($hyper_data['time'] > time()-($hyper_cache_timeout*60)) && $hyper_data['html'] != '') {
56
  header('Content-Type: text/html;charset=UTF-8');
57
  echo $hyper_data['html'];
58
+ echo '<!-- hyper cache -->';
59
  flush();
60
  die();
61
  }
62
  }
63
 
 
64
  // Now we start the caching, but we remove the cookie which stores the comment for data
65
+ foreach ( (array) $_COOKIE as $n => $v ) {
66
+ if (substr($n, 0, 14) == 'comment_author') {
67
+ unset($_COOKIE[$n]);
68
+ }
69
  }
 
 
70
 
71
+ ob_start('hyper_cache_callback');
72
  function hyper_cache_callback($buffer) {
73
  global $hyper_file;
 
74
 
75
  $data['uri'] = $_SERVER['REQUEST_URI'];
76
  $data['referer'] = $_SERVER['HTTP_REFERER'];
83
 
84
  return $buffer;
85
  }
86
+ ?>
 
hyper-cache-en_US.mo ADDED
Binary file
hyper-cache-en_US.po ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Hyper Cache\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2008-04-13 11:16+0100\n"
6
+ "PO-Revision-Date: 2008-04-14 16:41+0100\n"
7
+ "Last-Translator: Satollo <satollo@gmail.com>\n"
8
+ "Language-Team: \n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e\n"
13
+ "X-Poedit-Basepath: D:\\SVN\\Plugins\\Hyper Cache\\trunk\n"
14
+ "X-Poedit-SearchPath-0: D:\\SVN\\Plugins\\Hyper Cache\\trunk\n"
15
+
16
+ #: D:\SVN\Plugins\Hyper
17
+ #: Cache\trunk/options.php:99
18
+ msgid "not_enbled"
19
+ msgstr "The wordPress cache system is not enabled. Please, activate it adding the line of code below in the file wp-config.php. Thank you!"
20
+
21
+ #: D:\SVN\Plugins\Hyper
22
+ #: Cache\trunk/options.php:105
23
+ msgid "configuration"
24
+ msgstr "Configuration"
25
+
26
+ #: D:\SVN\Plugins\Hyper
27
+ #: Cache\trunk/options.php:108
28
+ msgid "active"
29
+ msgstr "Cache active?"
30
+
31
+ #: D:\SVN\Plugins\Hyper
32
+ #: Cache\trunk/options.php:111
33
+ msgid "expire"
34
+ msgstr "Expire a cached page after"
35
+
36
+ #: D:\SVN\Plugins\Hyper
37
+ #: Cache\trunk/options.php:111
38
+ msgid "minutes"
39
+ msgstr "minutes"
40
+
41
+ #: D:\SVN\Plugins\Hyper
42
+ #: Cache\trunk/options.php:116
43
+ msgid "save"
44
+ msgstr "Save"
45
+
46
+ msgid "clear"
47
+ msgstr "Clear the cache"
48
+
49
+ msgid "count"
50
+ msgstr "Cached pages"
51
+
hyper-cache-fr_FR.mo ADDED
Binary file
hyper-cache-fr_FR.po ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Hyper Cache\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2008-04-13 11:16+0100\n"
6
+ "PO-Revision-Date: 2008-04-14 15:00+0100\n"
7
+ "Last-Translator: Satollo <satollo@gmail.com>\n"
8
+ "Language-Team: \n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e\n"
13
+ "X-Poedit-Basepath: D:\\SVN\\Plugins\\Hyper Cache\\trunk\n"
14
+ "X-Poedit-SearchPath-0: D:\\SVN\\Plugins\\Hyper Cache\\trunk\n"
15
+
16
+ #: D:\SVN\Plugins\Hyper
17
+ #: Cache\trunk/options.php:99
18
+ msgid "not_enbled"
19
+ msgstr "Le cache de WordPress n'est pas activ&eacute;. Merci d'ajouter la ligne suivante dans votre fichier wp-config.php. Merci !"
20
+
21
+ #: D:\SVN\Plugins\Hyper
22
+ #: Cache\trunk/options.php:105
23
+ msgid "configuration"
24
+ msgstr "Configuration"
25
+
26
+ #: D:\SVN\Plugins\Hyper
27
+ #: Cache\trunk/options.php:108
28
+ msgid "active"
29
+ msgstr "Activer le cache ?"
30
+
31
+ #: D:\SVN\Plugins\Hyper
32
+ #: Cache\trunk/options.php:111
33
+ msgid "expire"
34
+ msgstr "Les pages contenues dans le cache expirent apr&egrave;s"
35
+
36
+ #: D:\SVN\Plugins\Hyper
37
+ #: Cache\trunk/options.php:111
38
+ msgid "minutes"
39
+ msgstr "(minutes!)"
40
+
41
+ #: D:\SVN\Plugins\Hyper
42
+ #: Cache\trunk/options.php:116
43
+ msgid "save"
44
+ msgstr "Enregistrer"
45
+
46
+ msgid "clear"
47
+ msgstr "Effacer le cache"
48
+
49
+ msgid "count"
50
+ msgstr "Nombre de pages en cache"
51
+
hyper-cache-it_IT.mo ADDED
Binary file
hyper-cache-it_IT.po ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Hyper Cache\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2008-04-13 11:16+0100\n"
6
+ "PO-Revision-Date: 2008-04-14 15:00+0100\n"
7
+ "Last-Translator: Satollo <satollo@gmail.com>\n"
8
+ "Language-Team: \n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e\n"
13
+ "X-Poedit-Basepath: D:\\SVN\\Plugins\\Hyper Cache\\trunk\n"
14
+ "X-Poedit-SearchPath-0: D:\\SVN\\Plugins\\Hyper Cache\\trunk\n"
15
+
16
+ #: D:\SVN\Plugins\Hyper
17
+ #: Cache\trunk/options.php:99
18
+ msgid "not_enbled"
19
+ msgstr "Il sistema di caching di WordPress non &egrave; attivo. Attivarlo inserendo la riga sotto nel file wp-config.php. Grazie!"
20
+
21
+ #: D:\SVN\Plugins\Hyper
22
+ #: Cache\trunk/options.php:105
23
+ msgid "configuration"
24
+ msgstr "Configurazione"
25
+
26
+ #: D:\SVN\Plugins\Hyper
27
+ #: Cache\trunk/options.php:108
28
+ msgid "active"
29
+ msgstr "Attivare la cache?"
30
+
31
+ #: D:\SVN\Plugins\Hyper
32
+ #: Cache\trunk/options.php:111
33
+ msgid "expire"
34
+ msgstr "La pagine scadono dopo:"
35
+
36
+ #: D:\SVN\Plugins\Hyper
37
+ #: Cache\trunk/options.php:111
38
+ msgid "minutes"
39
+ msgstr "in minuti!"
40
+
41
+ #: D:\SVN\Plugins\Hyper
42
+ #: Cache\trunk/options.php:116
43
+ msgid "save"
44
+ msgstr "Salva"
45
+
46
+ msgid "clear"
47
+ msgstr "Azzera la cache"
48
+
49
+ msgid "count"
50
+ msgstr "Pagine in cache"
51
+
options.php CHANGED
@@ -3,10 +3,16 @@ if (function_exists('load_plugin_textdomain')) {
3
  load_plugin_textdomain('hyper-cache', 'wp-content/plugins/hyper-cache');
4
  }
5
 
6
- function hyper_request($name, $default=null) {
7
- if (!isset($_REQUEST[$name])) return $default;
8
- if (get_magic_quotes_gpc()) return hyper_stripslashes($_REQUEST[$name]);
9
- else return $_REQUEST[$name];
 
 
 
 
 
 
10
  }
11
 
12
  function hyper_stripslashes($value) {
@@ -16,23 +22,23 @@ function hyper_stripslashes($value) {
16
 
17
  function hyper_field_checkbox($name, $label='', $tips='', $attrs='') {
18
  global $options;
19
- echo '<tr><td class="label">';
20
- echo '<label for="options[' . $name . ']">' . $label . '</label></td>';
21
- echo '<td><input type="checkbox" ' . $attrs . ' name="options[' . $name . ']" value="1" ' .
22
- ($options[$name]!= null?'checked':'') . '/>';
23
  echo ' ' . $tips;
24
- echo '</td></tr>';
25
  }
26
 
27
  function hyper_field_text($name, $label='', $tips='', $attrs='') {
28
  global $options;
29
  if (strpos($attrs, 'size') === false) $attrs .= 'size="30"';
30
- echo '<tr><td class="label">';
31
- echo '<label for="options[' . $name . ']">' . $label . '</label></td>';
32
  echo '<td><input type="text" ' . $attrs . ' name="options[' . $name . ']" value="' .
33
  htmlspecialchars($options[$name]) . '"/>';
34
  echo ' ' . $tips;
35
- echo '</td></tr>';
36
  }
37
 
38
  function hyper_field_textarea($name, $label='', $tips='', $attrs='') {
@@ -41,12 +47,16 @@ function hyper_field_textarea($name, $label='', $tips='', $attrs='') {
41
  if (strpos($attrs, 'cols') === false) $attrs .= 'cols="70"';
42
  if (strpos($attrs, 'rows') === false) $attrs .= 'rows="5"';
43
 
44
- echo '<tr><td class="label">';
45
- echo '<label for="options[' . $name . ']">' . $label . '</label></td>';
46
  echo '<td><textarea wrap="off" ' . $attrs . ' name="options[' . $name . ']">' .
47
  htmlspecialchars($options[$name]) . '</textarea>';
48
- echo '<br /> ' . $tips;
49
- echo '</td></tr>';
 
 
 
 
50
  }
51
 
52
  if (isset($_POST['save'])) {
@@ -54,13 +64,14 @@ if (isset($_POST['save'])) {
54
  update_option('hyper', $options);
55
 
56
  // Write the configuration file
57
-
58
- if (!file_exists(ABSPATH . '/wp-content/hyper-cache'))
59
- {
60
  mkdir(ABSPATH . '/wp-content/hyper-cache', 0766);
61
  }
62
 
63
- if (!$options['timeout'] || !is_numeric($options['timeout'])) $options['timeout'] = 60;
 
 
 
64
  $buffer = "<?php\n";
65
  $buffer .= '$hyper_cache_enabled = ' . ($options['cache']?'true':'false') . ";\n";
66
  $buffer .= '$hyper_cache_timeout = ' . $options['timeout'] . ";\n";
@@ -72,38 +83,49 @@ if (isset($_POST['save'])) {
72
  // Write the advanced-cache.php (so we grant it's the correct version)
73
  $buffer = file_get_contents(dirname(__FILE__) . '/advanced-cache.php');
74
  $file = fopen(ABSPATH . 'wp-content/advanced-cache.php', 'w');
 
75
  fwrite($file, $buffer);
76
  fclose($file);
77
- }
78
- else
79
- {
80
  $options = get_option('hyper');
81
- if (!$options['timeout']) $options['timeout'] = 60;
 
 
82
  }
83
  ?>
84
- <style type="text/css">
85
- td.label{width: 150px;vertical-align: top;font-weight: bold;text-align: right;}
86
- td textarea {font-family: monospace;font-size: 11px;}
87
- </style>
88
  <div class="wrap">
89
  <form method="post">
90
- <h2><?php _e('Hyper Cache', 'hyper-cache'); ?></h2>
 
91
  <?php
92
- if (!defined('WP_CACHE')) {
93
- $pre = __("<pre>define('WP_CACHE', true);</pre>", 'hyper-cache');
94
- echo '<p>';
95
- printf(__('The WordPress caching system is not enabled. Please add the line: %s in your wp-config.php file. Thank you.', 'hyper-cache'), $pre);
96
- echo '</p>';
97
  }
98
  ?>
99
 
100
- <h3><?php _e('Configuration', 'hyper-cache'); ?></h3>
101
- <table>
102
- <?php hyper_field_checkbox('cache', __('Cache active?', 'hyper-cache')); ?>
103
- <?php hyper_field_text('timeout', __('Single page cached expire after', 'hyper-cache'), __('(minutes!)', 'hyper-cache')); ?>
 
 
 
 
104
  </table>
105
-
 
 
 
 
 
 
 
106
  <p>
107
- <input class="button" type="submit" name="save" value="<?php _e('Save', 'hyper-cache'); ?>"></p>
 
 
108
  </form>
109
- </div>
3
  load_plugin_textdomain('hyper-cache', 'wp-content/plugins/hyper-cache');
4
  }
5
 
6
+ function hyper_request( $name, $default=null ) {
7
+ if ( !isset($_POST[$name]) ) {
8
+ return $default;
9
+ }
10
+ if ( get_magic_quotes_gpc() ) {
11
+ return hyper_stripslashes($_POST[$name]);
12
+ }
13
+ else {
14
+ return $_POST[$name];
15
+ }
16
  }
17
 
18
  function hyper_stripslashes($value) {
22
 
23
  function hyper_field_checkbox($name, $label='', $tips='', $attrs='') {
24
  global $options;
25
+
26
+ echo '<th scope="row">';
27
+ echo '<label for="options[' . $name . ']">' . $label . '</label></th>';
28
+ echo '<td><input type="checkbox" ' . $attrs . ' name="options[' . $name . ']" value="1" ' . ($options[$name]!= null?'checked':'') . '/>';
29
  echo ' ' . $tips;
30
+ echo '</td>';
31
  }
32
 
33
  function hyper_field_text($name, $label='', $tips='', $attrs='') {
34
  global $options;
35
  if (strpos($attrs, 'size') === false) $attrs .= 'size="30"';
36
+ echo '<th scope="row">';
37
+ echo '<label for="options[' . $name . ']">' . $label . '</label></th>';
38
  echo '<td><input type="text" ' . $attrs . ' name="options[' . $name . ']" value="' .
39
  htmlspecialchars($options[$name]) . '"/>';
40
  echo ' ' . $tips;
41
+ echo '</td>';
42
  }
43
 
44
  function hyper_field_textarea($name, $label='', $tips='', $attrs='') {
47
  if (strpos($attrs, 'cols') === false) $attrs .= 'cols="70"';
48
  if (strpos($attrs, 'rows') === false) $attrs .= 'rows="5"';
49
 
50
+ echo '<th scope="row">';
51
+ echo '<label for="options[' . $name . ']">' . $label . '</label></th>';
52
  echo '<td><textarea wrap="off" ' . $attrs . ' name="options[' . $name . ']">' .
53
  htmlspecialchars($options[$name]) . '</textarea>';
54
+ echo '<br />' . $tips;
55
+ echo '</td>';
56
+ }
57
+
58
+ if (isset($_POST['clear'])) {
59
+ hyper_cache_invalidate();
60
  }
61
 
62
  if (isset($_POST['save'])) {
64
  update_option('hyper', $options);
65
 
66
  // Write the configuration file
67
+ if (!file_exists(ABSPATH . '/wp-content/hyper-cache')) {
 
 
68
  mkdir(ABSPATH . '/wp-content/hyper-cache', 0766);
69
  }
70
 
71
+ if (!$options['timeout'] || !is_numeric($options['timeout'])) {
72
+ $options['timeout'] = 60;
73
+ }
74
+
75
  $buffer = "<?php\n";
76
  $buffer .= '$hyper_cache_enabled = ' . ($options['cache']?'true':'false') . ";\n";
77
  $buffer .= '$hyper_cache_timeout = ' . $options['timeout'] . ";\n";
83
  // Write the advanced-cache.php (so we grant it's the correct version)
84
  $buffer = file_get_contents(dirname(__FILE__) . '/advanced-cache.php');
85
  $file = fopen(ABSPATH . 'wp-content/advanced-cache.php', 'w');
86
+
87
  fwrite($file, $buffer);
88
  fclose($file);
89
+ } else {
 
 
90
  $options = get_option('hyper');
91
+ if (!$options['timeout']) {
92
+ $options['timeout'] = 60;
93
+ }
94
  }
95
  ?>
 
 
 
 
96
  <div class="wrap">
97
  <form method="post">
98
+ <h2>Hyper Cache</h2>
99
+
100
  <?php
101
+ if (!defined('WP_CACHE') ) {
102
+ echo '<div class="alert error" style="margin-top:10px;"><p>';
103
+ _e('not_enabled', 'hyper-cache');
104
+ echo "<pre>define('WP_CACHE', true);</pre>";
105
+ echo '</p></div>';
106
  }
107
  ?>
108
 
109
+ <h3><?php _e('configuration', 'hyper-cache'); ?></h3>
110
+ <table class="form-table">
111
+ <tr valign="top">
112
+ <?php hyper_field_checkbox('cache', __('active', 'hyper-cache')); ?>
113
+ </tr>
114
+ <tr valign="top">
115
+ <?php hyper_field_text('timeout', __('expire', 'hyper-cache'), __('minutes', 'hyper-cache'), 'size="5"'); ?>
116
+ </tr>
117
  </table>
118
+
119
+ <table class="form-table">
120
+ <tr valign="top">
121
+ <th scope="row"><?php _e('count', 'hyper-cache'); ?></th>
122
+ <td><?php echo hyper_count(); ?></td>
123
+ </tr>
124
+ </table>
125
+
126
  <p>
127
+ <input class="button" type="submit" name="save" value="<?php _e('save', 'hyper-cache'); ?>">
128
+ <input class="button" type="submit" name="clear" value="<?php _e('clear', 'hyper-cache'); ?>">
129
+ </p>
130
  </form>
131
+ </div>
plugin.php CHANGED
@@ -3,13 +3,14 @@
3
  Plugin Name: Hyper Cache
4
  Plugin URI: http://www.satollo.com/english/wordpress/hyper-cache
5
  Description: Hyper Cache is an extremely aggressive cache for WordPress.
6
- Version: 1.0.3
7
  Author: Satollo
8
  Author URI: http://www.satollo.com
9
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
10
- */
11
 
12
- /* Copyright 2008 Satollo (email : satollo@gmail.com)
 
 
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License as published by
@@ -24,6 +25,21 @@ GNU General Public License for more details.
24
  You should have received a copy of the GNU General Public License
25
  along with this program; if not, write to the Free Software
26
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  */
28
 
29
  $hyper_options = get_option('hyper');
@@ -36,66 +52,72 @@ function hyper_activate() {
36
 
37
  add_action('deactivate_hyper-cache/plugin.php', 'hyper_deactivate');
38
  function hyper_deactivate() {
39
- unlink(ABSPATH . 'wp-content/advanced-cache.php');
40
- unlink(ABSPATH . 'wp-content/hyper-cache-config.php');
41
-
42
- $path = ABSPATH . 'wp-content/' . time();
43
- rename(ABSPATH . 'wp-content/hyper-cache', $path);
44
-
45
- if ($handle = opendir($path))
46
- {
47
- while ($file = readdir($handle))
48
- {
49
- if ($file != '.' && $file != '..')
50
- {
51
- unlink($path . '/' . $file);
52
- }
53
- }
54
- closedir($handle);
55
- rmdir($path);
56
- }
57
  }
58
 
59
  add_action('admin_head', 'hyper_admin_head');
60
  function hyper_admin_head() {
61
- add_options_page('Hyper Cache', 'Hyper Cache', 'manage_options', 'hyper-cache/options.php');
62
  }
63
 
64
- function hyper_cache_invalidate()
65
- {
66
- $path = ABSPATH . 'wp-content/' . time();
67
- rename(ABSPATH . 'wp-content/hyper-cache', $path);
68
- mkdir(ABSPATH . 'wp-content/hyper-cache', 0766);
69
-
70
- if ($handle = opendir($path))
71
- {
72
- while ($file = readdir($handle))
73
- {
74
- if ($file != '.' && $file != '..')
75
- {
76
- unlink($path . '/' . $file);
77
- }
78
- }
79
- closedir($handle);
80
- rmdir($path);
81
- }
82
  }
83
 
84
- if ($hyper_options['cache'])
85
- {
86
- add_action('publish_post', 'hyper_cache_invalidate', 0);
87
- add_action('edit_post', 'hyper_cache_invalidate', 0);
88
- add_action('delete_post', 'hyper_cache_invalidate', 0);
89
- add_action('publish_phone', 'hyper_cache_invalidate', 0);
90
- // Coment ID is received
91
- add_action('trackback_post', 'hyper_cache_invalidate', 0);
92
- add_action('pingback_post', 'hyper_cache_invalidate', 0);
93
- add_action('comment_post', 'hyper_cache_invalidate', 0);
94
- add_action('edit_comment', 'hyper_cache_invalidate', 0);
95
- add_action('wp_set_comment_status', 'hyper_cache_invalidate', 0);
96
- // No post_id is available
97
- add_action('delete_comment', 'hyper_cache_invalidate', 0);
98
- add_action('switch_theme', 'hyper_cache_invalidate', 0);
99
  }
100
 
101
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  Plugin Name: Hyper Cache
4
  Plugin URI: http://www.satollo.com/english/wordpress/hyper-cache
5
  Description: Hyper Cache is an extremely aggressive cache for WordPress.
6
+ Version: 1.0.5
7
  Author: Satollo
8
  Author URI: http://www.satollo.com
9
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
 
10
 
11
+ ---
12
+ Copyright 2008 Satollo (email : satollo@gmail.com)
13
+ ---
14
 
15
  This program is free software; you can redistribute it and/or modify
16
  it under the terms of the GNU General Public License as published by
25
  You should have received a copy of the GNU General Public License
26
  along with this program; if not, write to the Free Software
27
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
+
29
+ ---
30
+ Changelog
31
+ ---
32
+ Version 1.0.5
33
+ - Add italian translation
34
+ - Add the "clear the cache" button
35
+ - Add the cache page count
36
+
37
+ Version 1.0.4
38
+ - Thank you to Amaury Balmer for this version
39
+ - Add french translation
40
+ - Improve options with WordPress 2.5
41
+ - Fix bug with WP 2.5 cookies
42
+ - Minor changes
43
  */
44
 
45
  $hyper_options = get_option('hyper');
52
 
53
  add_action('deactivate_hyper-cache/plugin.php', 'hyper_deactivate');
54
  function hyper_deactivate() {
55
+ delete_option('hyper');
56
+
57
+ unlink(ABSPATH . 'wp-content/advanced-cache.php');
58
+ unlink(ABSPATH . 'wp-content/hyper-cache-config.php');
59
+
60
+ $path = ABSPATH . 'wp-content/' . time();
61
+ rename(ABSPATH . 'wp-content/hyper-cache', $path);
62
+
63
+ hyper_delete_path( $path );
 
 
 
 
 
 
 
 
 
64
  }
65
 
66
  add_action('admin_head', 'hyper_admin_head');
67
  function hyper_admin_head() {
68
+ add_options_page('Hyper Cache', 'Hyper Cache', 'manage_options', 'hyper-cache/options.php');
69
  }
70
 
71
+ function hyper_cache_invalidate() {
72
+ $path = ABSPATH . 'wp-content/' . time();
73
+ rename(ABSPATH . 'wp-content/hyper-cache', $path);
74
+ mkdir(ABSPATH . 'wp-content/hyper-cache', 0766);
75
+
76
+ hyper_delete_path( $path );
77
+ }
78
+
79
+ function hyper_delete_path( $path = '' ) {
80
+ if ($handle = opendir($path)) {
81
+ while ($file = readdir($handle)) {
82
+ if ($file != '.' && $file != '..') {
83
+ unlink($path . '/' . $file);
84
+ }
85
+ }
86
+ closedir($handle);
87
+ rmdir($path);
88
+ }
89
  }
90
 
91
+ function hyper_count() {
92
+ $count = 0;
93
+ if ($handle = opendir(ABSPATH . 'wp-content/hyper-cache')) {
94
+ while ($file = readdir($handle)) {
95
+ if ($file != '.' && $file != '..') {
96
+ $count++;
97
+ }
98
+ }
99
+ closedir($handle);
100
+ }
101
+ return $count;
 
 
 
 
102
  }
103
 
104
+
105
+ if ( $hyper_options['cache'] ) {
106
+ // Posts
107
+ add_action('publish_post', 'hyper_cache_invalidate', 0);
108
+ add_action('edit_post', 'hyper_cache_invalidate', 0);
109
+ add_action('delete_post', 'hyper_cache_invalidate', 0);
110
+ add_action('publish_phone', 'hyper_cache_invalidate', 0);
111
+
112
+ // Coment ID is received
113
+ add_action('trackback_post', 'hyper_cache_invalidate', 0);
114
+ add_action('pingback_post', 'hyper_cache_invalidate', 0);
115
+ add_action('comment_post', 'hyper_cache_invalidate', 0);
116
+ add_action('edit_comment', 'hyper_cache_invalidate', 0);
117
+ add_action('wp_set_comment_status', 'hyper_cache_invalidate', 0);
118
+
119
+ // No post_id is available
120
+ add_action('delete_comment', 'hyper_cache_invalidate', 0);
121
+ add_action('switch_theme', 'hyper_cache_invalidate', 0);
122
+ }
123
+ ?>
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Tags: cache,chaching
3
  Requires at least: 2.1
4
  Tested up to: 2.5
5
- Stable tag: 1.0.3
6
  Donate link: http://www.satollo.com/english/donate
7
  Contributors: satollo,momo360modena
8
 
2
  Tags: cache,chaching
3
  Requires at least: 2.1
4
  Tested up to: 2.5
5
+ Stable tag: 1.0.5
6
  Donate link: http://www.satollo.com/english/donate
7
  Contributors: satollo,momo360modena
8