Version Description
- `zlib.output_compression
Download this release
Release Info
| Developer | sergej.mueller |
| Plugin | |
| Version | 1.5.1 |
| Comparing to | |
| See all releases | |
Version 1.5.1
- apc/proxy.php +18 -0
- cachify.php +1274 -0
- css/style.css +1 -0
- css/style.dev.css +47 -0
- img/icon.png +0 -0
- img/icon16.png +0 -0
- img/icon32.png +0 -0
- readme.txt +109 -0
- screenshot-1.png +0 -0
apc/proxy.php
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
if (
|
| 3 |
+
extension_loaded('apc')
|
| 4 |
+
&& ( !empty($_SERVER['PHP_SELF']) && strpos($_SERVER['PHP_SELF'], '/wp-admin/') === false )
|
| 5 |
+
&& ( !empty($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false )
|
| 6 |
+
&& ( $cache = apc_fetch('cachify_' .md5($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) )
|
| 7 |
+
) {
|
| 8 |
+
ini_set('zlib.output_compression', 'Off');
|
| 9 |
+
|
| 10 |
+
header('Vary: Accept-Encoding');
|
| 11 |
+
header('X-Powered-By: Cachify');
|
| 12 |
+
header('Content-Encoding: gzip');
|
| 13 |
+
header('Content-Length: '.strlen($cache));
|
| 14 |
+
header('Content-Type: text/html; charset=utf-8');
|
| 15 |
+
|
| 16 |
+
echo $cache;
|
| 17 |
+
exit;
|
| 18 |
+
}
|
cachify.php
ADDED
|
@@ -0,0 +1,1274 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
Plugin Name: Cachify
|
| 4 |
+
Description: Smarter Cache für WordPress. Reduziert die Anzahl der Datenbankabfragen und dynamischer Anweisungen. Minimiert Ladezeiten der Blogseiten.
|
| 5 |
+
Author: Sergej Müller
|
| 6 |
+
Author URI: http://wpseo.de
|
| 7 |
+
Plugin URI: http://playground.ebiene.de/cachify-wordpress-cache/
|
| 8 |
+
Version: 1.5.1
|
| 9 |
+
*/
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
/* Sicherheitsabfrage */
|
| 13 |
+
if ( !class_exists('WP') ) {
|
| 14 |
+
die();
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
/**
|
| 19 |
+
* Cachify
|
| 20 |
+
*/
|
| 21 |
+
|
| 22 |
+
final class Cachify {
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
/* Plugin Base */
|
| 26 |
+
private static $base;
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* "Konstruktor" der Klasse
|
| 31 |
+
*
|
| 32 |
+
* @since 1.0
|
| 33 |
+
* @change 1.2
|
| 34 |
+
*/
|
| 35 |
+
|
| 36 |
+
public static function init()
|
| 37 |
+
{
|
| 38 |
+
/* Autosave? */
|
| 39 |
+
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) {
|
| 40 |
+
return;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
/* Plugin-Base */
|
| 44 |
+
self::$base = plugin_basename(__FILE__);
|
| 45 |
+
|
| 46 |
+
/* Publish post */
|
| 47 |
+
add_action(
|
| 48 |
+
'publish_post',
|
| 49 |
+
array(
|
| 50 |
+
__CLASS__,
|
| 51 |
+
'publish_post'
|
| 52 |
+
)
|
| 53 |
+
);
|
| 54 |
+
|
| 55 |
+
/* Publish page */
|
| 56 |
+
add_action(
|
| 57 |
+
'publish_page',
|
| 58 |
+
array(
|
| 59 |
+
__CLASS__,
|
| 60 |
+
'publish_page'
|
| 61 |
+
)
|
| 62 |
+
);
|
| 63 |
+
|
| 64 |
+
/* Backend */
|
| 65 |
+
if ( is_admin() ) {
|
| 66 |
+
add_action(
|
| 67 |
+
'wpmu_new_blog',
|
| 68 |
+
array(
|
| 69 |
+
__CLASS__,
|
| 70 |
+
'install_later'
|
| 71 |
+
)
|
| 72 |
+
);
|
| 73 |
+
add_action(
|
| 74 |
+
'delete_blog',
|
| 75 |
+
array(
|
| 76 |
+
__CLASS__,
|
| 77 |
+
'uninstall_later'
|
| 78 |
+
)
|
| 79 |
+
);
|
| 80 |
+
|
| 81 |
+
add_action(
|
| 82 |
+
'admin_init',
|
| 83 |
+
array(
|
| 84 |
+
__CLASS__,
|
| 85 |
+
'register_settings'
|
| 86 |
+
)
|
| 87 |
+
);
|
| 88 |
+
add_action(
|
| 89 |
+
'admin_init',
|
| 90 |
+
array(
|
| 91 |
+
__CLASS__,
|
| 92 |
+
'receive_flush'
|
| 93 |
+
)
|
| 94 |
+
);
|
| 95 |
+
add_action(
|
| 96 |
+
'admin_menu',
|
| 97 |
+
array(
|
| 98 |
+
__CLASS__,
|
| 99 |
+
'add_page'
|
| 100 |
+
)
|
| 101 |
+
);
|
| 102 |
+
add_action(
|
| 103 |
+
'admin_print_styles',
|
| 104 |
+
array(
|
| 105 |
+
__CLASS__,
|
| 106 |
+
'add_css'
|
| 107 |
+
)
|
| 108 |
+
);
|
| 109 |
+
|
| 110 |
+
add_action(
|
| 111 |
+
'transition_comment_status',
|
| 112 |
+
array(
|
| 113 |
+
__CLASS__,
|
| 114 |
+
'touch_comment'
|
| 115 |
+
),
|
| 116 |
+
10,
|
| 117 |
+
3
|
| 118 |
+
);
|
| 119 |
+
add_action(
|
| 120 |
+
'edit_comment',
|
| 121 |
+
array(
|
| 122 |
+
__CLASS__,
|
| 123 |
+
'edit_comment'
|
| 124 |
+
)
|
| 125 |
+
);
|
| 126 |
+
add_action(
|
| 127 |
+
'admin_bar_menu',
|
| 128 |
+
array(
|
| 129 |
+
__CLASS__,
|
| 130 |
+
'add_menu'
|
| 131 |
+
),
|
| 132 |
+
90
|
| 133 |
+
);
|
| 134 |
+
|
| 135 |
+
add_filter(
|
| 136 |
+
'plugin_row_meta',
|
| 137 |
+
array(
|
| 138 |
+
__CLASS__,
|
| 139 |
+
'row_meta'
|
| 140 |
+
),
|
| 141 |
+
10,
|
| 142 |
+
2
|
| 143 |
+
);
|
| 144 |
+
add_filter(
|
| 145 |
+
'plugin_action_links_' .self::$base,
|
| 146 |
+
array(
|
| 147 |
+
__CLASS__,
|
| 148 |
+
'action_links'
|
| 149 |
+
)
|
| 150 |
+
);
|
| 151 |
+
|
| 152 |
+
/* Frontend */
|
| 153 |
+
} else {
|
| 154 |
+
add_action(
|
| 155 |
+
'preprocess_comment',
|
| 156 |
+
array(
|
| 157 |
+
__CLASS__,
|
| 158 |
+
'add_comment'
|
| 159 |
+
),
|
| 160 |
+
1
|
| 161 |
+
);
|
| 162 |
+
add_action(
|
| 163 |
+
'template_redirect',
|
| 164 |
+
array(
|
| 165 |
+
__CLASS__,
|
| 166 |
+
'manage_cache'
|
| 167 |
+
),
|
| 168 |
+
99
|
| 169 |
+
);
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
/**
|
| 175 |
+
* Plugin-Installation für MU-Blogs
|
| 176 |
+
*
|
| 177 |
+
* @since 1.0
|
| 178 |
+
* @change 1.0
|
| 179 |
+
*/
|
| 180 |
+
|
| 181 |
+
public static function install()
|
| 182 |
+
{
|
| 183 |
+
/* Multisite & Network */
|
| 184 |
+
if ( is_multisite() && !empty($_GET['networkwide']) ) {
|
| 185 |
+
/* Blog-IDs */
|
| 186 |
+
$ids = self::_get_blog_ids();
|
| 187 |
+
|
| 188 |
+
/* Loopen */
|
| 189 |
+
foreach ($ids as $id) {
|
| 190 |
+
switch_to_blog( (int)$id );
|
| 191 |
+
self::_install_backend();
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
/* Wechsel zurück */
|
| 195 |
+
restore_current_blog();
|
| 196 |
+
|
| 197 |
+
} else {
|
| 198 |
+
self::_install_backend();
|
| 199 |
+
}
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
/**
|
| 204 |
+
* Plugin-Installation bei neuen MU-Blogs
|
| 205 |
+
*
|
| 206 |
+
* @since 1.0
|
| 207 |
+
* @change 1.0
|
| 208 |
+
*/
|
| 209 |
+
|
| 210 |
+
public static function install_later($id) {
|
| 211 |
+
/* Kein Netzwerk-Plugin */
|
| 212 |
+
if ( !is_plugin_active_for_network(self::$base) ) {
|
| 213 |
+
return;
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
/* Wechsel */
|
| 217 |
+
switch_to_blog( (int)$id );
|
| 218 |
+
|
| 219 |
+
/* Installieren */
|
| 220 |
+
self::_install_backend();
|
| 221 |
+
|
| 222 |
+
/* Wechsel zurück */
|
| 223 |
+
restore_current_blog();
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
/**
|
| 228 |
+
* Eigentliche Installation der Optionen
|
| 229 |
+
*
|
| 230 |
+
* @since 1.0
|
| 231 |
+
* @change 1.3
|
| 232 |
+
*/
|
| 233 |
+
|
| 234 |
+
private static function _install_backend()
|
| 235 |
+
{
|
| 236 |
+
add_option(
|
| 237 |
+
'cachify',
|
| 238 |
+
array(
|
| 239 |
+
'only_guests' => 1,
|
| 240 |
+
'compress_html' => 0,
|
| 241 |
+
'cache_expires' => 12,
|
| 242 |
+
'without_ids' => '',
|
| 243 |
+
'without_agents' => '',
|
| 244 |
+
'use_apc' => 0
|
| 245 |
+
)
|
| 246 |
+
);
|
| 247 |
+
|
| 248 |
+
/* Flush */
|
| 249 |
+
self::flush_cache();
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
|
| 253 |
+
/**
|
| 254 |
+
* Deinstallation des Plugins pro MU-Blog
|
| 255 |
+
*
|
| 256 |
+
* @since 1.0
|
| 257 |
+
* @change 1.0
|
| 258 |
+
*/
|
| 259 |
+
|
| 260 |
+
public static function uninstall()
|
| 261 |
+
{
|
| 262 |
+
/* Global */
|
| 263 |
+
global $wpdb;
|
| 264 |
+
|
| 265 |
+
/* Multisite & Network */
|
| 266 |
+
if ( is_multisite() && !empty($_GET['networkwide']) ) {
|
| 267 |
+
/* Alter Blog */
|
| 268 |
+
$old = $wpdb->blogid;
|
| 269 |
+
|
| 270 |
+
/* Blog-IDs */
|
| 271 |
+
$ids = self::_get_blog_ids();
|
| 272 |
+
|
| 273 |
+
/* Loopen */
|
| 274 |
+
foreach ($ids as $id) {
|
| 275 |
+
switch_to_blog($id);
|
| 276 |
+
self::_uninstall_backend();
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
/* Wechsel zurück */
|
| 280 |
+
switch_to_blog($old);
|
| 281 |
+
} else {
|
| 282 |
+
self::_uninstall_backend();
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
/**
|
| 288 |
+
* Deinstallation des Plugins bei MU & Network
|
| 289 |
+
*
|
| 290 |
+
* @since 1.0
|
| 291 |
+
* @change 1.0
|
| 292 |
+
*/
|
| 293 |
+
|
| 294 |
+
public static function uninstall_later($id)
|
| 295 |
+
{
|
| 296 |
+
/* Kein Netzwerk-Plugin */
|
| 297 |
+
if ( !is_plugin_active_for_network(self::$base) ) {
|
| 298 |
+
return;
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
/* Wechsel */
|
| 302 |
+
switch_to_blog( (int)$id );
|
| 303 |
+
|
| 304 |
+
/* Installieren */
|
| 305 |
+
self::_uninstall_backend();
|
| 306 |
+
|
| 307 |
+
/* Wechsel zurück */
|
| 308 |
+
restore_current_blog();
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
|
| 312 |
+
/**
|
| 313 |
+
* Eigentliche Deinstallation des Plugins
|
| 314 |
+
*
|
| 315 |
+
* @since 1.0
|
| 316 |
+
* @change 1.0
|
| 317 |
+
*/
|
| 318 |
+
|
| 319 |
+
private static function _uninstall_backend()
|
| 320 |
+
{
|
| 321 |
+
/* Option */
|
| 322 |
+
delete_option('cachify');
|
| 323 |
+
|
| 324 |
+
/* Cache leeren */
|
| 325 |
+
self::flush_cache();
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
|
| 329 |
+
/**
|
| 330 |
+
* Update des Plugins
|
| 331 |
+
*
|
| 332 |
+
* @since 1.0
|
| 333 |
+
* @change 1.0
|
| 334 |
+
*/
|
| 335 |
+
|
| 336 |
+
public static function update()
|
| 337 |
+
{
|
| 338 |
+
/* Updaten */
|
| 339 |
+
self::_update_backend();
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
|
| 343 |
+
/**
|
| 344 |
+
* Eigentlicher Update des Plugins
|
| 345 |
+
*
|
| 346 |
+
* @since 1.0
|
| 347 |
+
* @change 1.0
|
| 348 |
+
*/
|
| 349 |
+
|
| 350 |
+
private static function _update_backend()
|
| 351 |
+
{
|
| 352 |
+
/* Cache leeren */
|
| 353 |
+
self::flush_cache();
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
/**
|
| 358 |
+
* Rückgabe der IDs installierter Blogs
|
| 359 |
+
*
|
| 360 |
+
* @since 1.0
|
| 361 |
+
* @change 1.0
|
| 362 |
+
*
|
| 363 |
+
* @return array Blog-IDs
|
| 364 |
+
*/
|
| 365 |
+
|
| 366 |
+
private static function _get_blog_ids()
|
| 367 |
+
{
|
| 368 |
+
/* Global */
|
| 369 |
+
global $wpdb;
|
| 370 |
+
|
| 371 |
+
return $wpdb->get_col(
|
| 372 |
+
$wpdb->prepare("SELECT blog_id FROM `$wpdb->blogs`")
|
| 373 |
+
);
|
| 374 |
+
}
|
| 375 |
+
|
| 376 |
+
|
| 377 |
+
/**
|
| 378 |
+
* Hinzufügen der Action-Links
|
| 379 |
+
*
|
| 380 |
+
* @since 1.0
|
| 381 |
+
* @change 1.0
|
| 382 |
+
*
|
| 383 |
+
* @param array $data Bereits existente Links
|
| 384 |
+
* @return array $data Erweitertes Array mit Links
|
| 385 |
+
*/
|
| 386 |
+
|
| 387 |
+
public static function action_links($data)
|
| 388 |
+
{
|
| 389 |
+
/* Rechte? */
|
| 390 |
+
if ( !current_user_can('manage_options') ) {
|
| 391 |
+
return $data;
|
| 392 |
+
}
|
| 393 |
+
|
| 394 |
+
return array_merge(
|
| 395 |
+
$data,
|
| 396 |
+
array(
|
| 397 |
+
sprintf(
|
| 398 |
+
'<a href="%s">%s</a>',
|
| 399 |
+
add_query_arg(
|
| 400 |
+
array(
|
| 401 |
+
'page' => 'cachify'
|
| 402 |
+
),
|
| 403 |
+
admin_url('options-general.php')
|
| 404 |
+
),
|
| 405 |
+
__('Settings')
|
| 406 |
+
)
|
| 407 |
+
)
|
| 408 |
+
);
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
|
| 412 |
+
/**
|
| 413 |
+
* Meta-Links des Plugins
|
| 414 |
+
*
|
| 415 |
+
* @since 0.5
|
| 416 |
+
* @change 1.3
|
| 417 |
+
*
|
| 418 |
+
* @param array $data Bereits vorhandene Links
|
| 419 |
+
* @param string $page Aktuelle Seite
|
| 420 |
+
* @return array $data Modifizierte Links
|
| 421 |
+
*/
|
| 422 |
+
|
| 423 |
+
public static function row_meta($data, $page)
|
| 424 |
+
{
|
| 425 |
+
/* Rechte */
|
| 426 |
+
if ( $page != self::$base ) {
|
| 427 |
+
return $data;
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
return array_merge(
|
| 431 |
+
$data,
|
| 432 |
+
array(
|
| 433 |
+
'<a href="http://flattr.com/profile/sergej.mueller" target="_blank">Plugin flattern</a>',
|
| 434 |
+
'<a href="https://plus.google.com/110569673423509816572" target="_blank">Auf Google+ folgen</a>'
|
| 435 |
+
)
|
| 436 |
+
);
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
|
| 440 |
+
/**
|
| 441 |
+
* Hinzufügen eines Admin-Bar-Menüs
|
| 442 |
+
*
|
| 443 |
+
* @since 1.2
|
| 444 |
+
* @change 1.2.1
|
| 445 |
+
*
|
| 446 |
+
* @param object Objekt mit Menü-Eigenschaften
|
| 447 |
+
*/
|
| 448 |
+
|
| 449 |
+
public static function add_menu($wp_admin_bar)
|
| 450 |
+
{
|
| 451 |
+
/* Aussteigen */
|
| 452 |
+
if ( !function_exists('is_admin_bar_showing') or !is_admin_bar_showing() or !is_super_admin() ) {
|
| 453 |
+
return;
|
| 454 |
+
}
|
| 455 |
+
|
| 456 |
+
/* Hinzufügen */
|
| 457 |
+
$wp_admin_bar->add_menu(
|
| 458 |
+
array(
|
| 459 |
+
'id' => 'cachify',
|
| 460 |
+
'title' => '<span class="ab-icon" title="Cache leeren"></span>',
|
| 461 |
+
'href' => add_query_arg('_cachify', 'flush'),
|
| 462 |
+
'parent' => 'top-secondary'
|
| 463 |
+
)
|
| 464 |
+
);
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
|
| 468 |
+
/**
|
| 469 |
+
* Verarbeitung der Plugin-Meta-Aktionen
|
| 470 |
+
*
|
| 471 |
+
* @since 0.5
|
| 472 |
+
* @change 1.2
|
| 473 |
+
*
|
| 474 |
+
* @param array $data Metadaten der Plugins
|
| 475 |
+
*/
|
| 476 |
+
|
| 477 |
+
public static function receive_flush($data)
|
| 478 |
+
{
|
| 479 |
+
/* Leer? */
|
| 480 |
+
if ( empty($_GET['_cachify']) or $_GET['_cachify'] !== 'flush' ) {
|
| 481 |
+
return;
|
| 482 |
+
}
|
| 483 |
+
|
| 484 |
+
/* Global */
|
| 485 |
+
global $wpdb;
|
| 486 |
+
|
| 487 |
+
/* Multisite & Network */
|
| 488 |
+
if ( is_multisite() && is_plugin_active_for_network(self::$base) ) {
|
| 489 |
+
/* Alter Blog */
|
| 490 |
+
$old = $wpdb->blogid;
|
| 491 |
+
|
| 492 |
+
/* Blog-IDs */
|
| 493 |
+
$ids = self::_get_blog_ids();
|
| 494 |
+
|
| 495 |
+
/* Loopen */
|
| 496 |
+
foreach ($ids as $id) {
|
| 497 |
+
switch_to_blog($id);
|
| 498 |
+
self::flush_cache();
|
| 499 |
+
}
|
| 500 |
+
|
| 501 |
+
/* Wechsel zurück */
|
| 502 |
+
switch_to_blog($old);
|
| 503 |
+
|
| 504 |
+
/* Notiz */
|
| 505 |
+
add_action(
|
| 506 |
+
'network_admin_notices',
|
| 507 |
+
array(
|
| 508 |
+
__CLASS__,
|
| 509 |
+
'flush_notice'
|
| 510 |
+
)
|
| 511 |
+
);
|
| 512 |
+
} else {
|
| 513 |
+
/* Leeren */
|
| 514 |
+
self::flush_cache();
|
| 515 |
+
|
| 516 |
+
/* Notiz */
|
| 517 |
+
add_action(
|
| 518 |
+
'admin_notices',
|
| 519 |
+
array(
|
| 520 |
+
__CLASS__,
|
| 521 |
+
'flush_notice'
|
| 522 |
+
)
|
| 523 |
+
);
|
| 524 |
+
}
|
| 525 |
+
}
|
| 526 |
+
|
| 527 |
+
|
| 528 |
+
/**
|
| 529 |
+
* Hinweis nach erfolgreichem Cache-Leeren
|
| 530 |
+
*
|
| 531 |
+
* @since 1.2
|
| 532 |
+
* @change 1.2
|
| 533 |
+
*/
|
| 534 |
+
|
| 535 |
+
public static function flush_notice()
|
| 536 |
+
{
|
| 537 |
+
/* Kein Admin */
|
| 538 |
+
if ( !is_super_admin() ) {
|
| 539 |
+
return false;
|
| 540 |
+
}
|
| 541 |
+
|
| 542 |
+
echo '<div id="message" class="updated"><p><strong>Cachify-Cache geleert.</strong></p></div>';
|
| 543 |
+
}
|
| 544 |
+
|
| 545 |
+
|
| 546 |
+
/**
|
| 547 |
+
* Löschung des Cache beim Kommentar-Editieren
|
| 548 |
+
*
|
| 549 |
+
* @since 0.1
|
| 550 |
+
* @change 0.4
|
| 551 |
+
*
|
| 552 |
+
* @param integer $id ID des Kommentars
|
| 553 |
+
*/
|
| 554 |
+
|
| 555 |
+
public static function edit_comment($id)
|
| 556 |
+
{
|
| 557 |
+
self::_delete_cache(
|
| 558 |
+
get_permalink(
|
| 559 |
+
get_comment($id)->comment_post_ID
|
| 560 |
+
)
|
| 561 |
+
);
|
| 562 |
+
}
|
| 563 |
+
|
| 564 |
+
|
| 565 |
+
/**
|
| 566 |
+
* Löschung des Cache beim neuen Kommentar
|
| 567 |
+
*
|
| 568 |
+
* @since 0.1
|
| 569 |
+
* @change 0.1
|
| 570 |
+
*
|
| 571 |
+
* @param array $comment Array mit Eigenschaften
|
| 572 |
+
* @return array $comment Array mit Eigenschaften
|
| 573 |
+
*/
|
| 574 |
+
|
| 575 |
+
public static function add_comment($comment)
|
| 576 |
+
{
|
| 577 |
+
self::_delete_cache(
|
| 578 |
+
get_permalink($comment['comment_post_ID'])
|
| 579 |
+
);
|
| 580 |
+
|
| 581 |
+
return $comment;
|
| 582 |
+
}
|
| 583 |
+
|
| 584 |
+
|
| 585 |
+
/**
|
| 586 |
+
* Löschung des Cache beim Editieren der Kommentare
|
| 587 |
+
*
|
| 588 |
+
* @since 0.1
|
| 589 |
+
* @change 0.4
|
| 590 |
+
*
|
| 591 |
+
* @param string $new_status Neuer Status
|
| 592 |
+
* @param string $old_status Alter Status
|
| 593 |
+
* @param object $comment Array mit Eigenschaften
|
| 594 |
+
*/
|
| 595 |
+
|
| 596 |
+
public static function touch_comment($new_status, $old_status, $comment)
|
| 597 |
+
{
|
| 598 |
+
if ( $new_status != $old_status ) {
|
| 599 |
+
self::_delete_cache(
|
| 600 |
+
get_permalink($comment->comment_post_ID)
|
| 601 |
+
);
|
| 602 |
+
}
|
| 603 |
+
}
|
| 604 |
+
|
| 605 |
+
|
| 606 |
+
/**
|
| 607 |
+
* Leerung des Cache bei neuen Beiträgen
|
| 608 |
+
*
|
| 609 |
+
* @since 0.1
|
| 610 |
+
* @change 0.9.1
|
| 611 |
+
*
|
| 612 |
+
* @param intval $id ID des Beitrags
|
| 613 |
+
*/
|
| 614 |
+
|
| 615 |
+
public static function publish_post($id)
|
| 616 |
+
{
|
| 617 |
+
/* Post */
|
| 618 |
+
$post = get_post($id);
|
| 619 |
+
|
| 620 |
+
/* Löschen */
|
| 621 |
+
if ( in_array( $post->post_status, array('publish', 'future') ) ) {
|
| 622 |
+
self::flush_cache();
|
| 623 |
+
}
|
| 624 |
+
}
|
| 625 |
+
|
| 626 |
+
|
| 627 |
+
/**
|
| 628 |
+
* Leerung des Cache bei neuen Beiträgen
|
| 629 |
+
*
|
| 630 |
+
* @since 1.0
|
| 631 |
+
* @change 1.0
|
| 632 |
+
*
|
| 633 |
+
* @param intval $id ID des Beitrags
|
| 634 |
+
*/
|
| 635 |
+
|
| 636 |
+
public static function publish_page($id)
|
| 637 |
+
{
|
| 638 |
+
/* Page */
|
| 639 |
+
$page = get_page($id);
|
| 640 |
+
|
| 641 |
+
/* Löschen */
|
| 642 |
+
if ( $page->post_status == 'publish' ) {
|
| 643 |
+
self::flush_cache();
|
| 644 |
+
}
|
| 645 |
+
}
|
| 646 |
+
|
| 647 |
+
|
| 648 |
+
/**
|
| 649 |
+
* Rückgabe des Cache-Hash-Wertes
|
| 650 |
+
*
|
| 651 |
+
* @since 0.1
|
| 652 |
+
* @change 1.3
|
| 653 |
+
*
|
| 654 |
+
* @param string $url URL für den Hash-Wert [optional]
|
| 655 |
+
* @return string Cachify-Hash-Wert
|
| 656 |
+
*/
|
| 657 |
+
|
| 658 |
+
private static function _cache_hash($url = '')
|
| 659 |
+
{
|
| 660 |
+
return 'cachify_' .md5(
|
| 661 |
+
empty($url) ? ( $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ) : ( parse_url($url, PHP_URL_HOST) . parse_url($url, PHP_URL_PATH) )
|
| 662 |
+
);
|
| 663 |
+
}
|
| 664 |
+
|
| 665 |
+
|
| 666 |
+
/**
|
| 667 |
+
* Rückgabe der Query-Anzahl
|
| 668 |
+
*
|
| 669 |
+
* @since 0.1
|
| 670 |
+
* @change 1.0
|
| 671 |
+
*
|
| 672 |
+
* @return intval Query-Anzahl
|
| 673 |
+
*/
|
| 674 |
+
|
| 675 |
+
private static function _page_queries()
|
| 676 |
+
{
|
| 677 |
+
return $GLOBALS['wpdb']->num_queries;
|
| 678 |
+
}
|
| 679 |
+
|
| 680 |
+
|
| 681 |
+
/**
|
| 682 |
+
* Rückgabe der Ausführungszeit
|
| 683 |
+
*
|
| 684 |
+
* @since 0.1
|
| 685 |
+
* @change 1.0
|
| 686 |
+
*
|
| 687 |
+
* @return intval Anzahl der Sekunden
|
| 688 |
+
*/
|
| 689 |
+
|
| 690 |
+
private static function _page_timer()
|
| 691 |
+
{
|
| 692 |
+
return timer_stop(0, 2);
|
| 693 |
+
}
|
| 694 |
+
|
| 695 |
+
|
| 696 |
+
/**
|
| 697 |
+
* Rückgabe des Speicherverbrauchs
|
| 698 |
+
*
|
| 699 |
+
* @since 0.7
|
| 700 |
+
* @change 1.0
|
| 701 |
+
*
|
| 702 |
+
* @return string Konvertierter Größenwert
|
| 703 |
+
*/
|
| 704 |
+
|
| 705 |
+
private static function _memory_usage()
|
| 706 |
+
{
|
| 707 |
+
return ( function_exists('memory_get_usage') ? size_format(memory_get_usage(), 2) : 0 );
|
| 708 |
+
}
|
| 709 |
+
|
| 710 |
+
|
| 711 |
+
/**
|
| 712 |
+
* Splittung nach Komma
|
| 713 |
+
*
|
| 714 |
+
* @since 0.9.1
|
| 715 |
+
* @change 1.0
|
| 716 |
+
*
|
| 717 |
+
* @param string $input Zu splittende Zeichenkette
|
| 718 |
+
* @return array Konvertierter Array
|
| 719 |
+
*/
|
| 720 |
+
|
| 721 |
+
private static function _preg_split($input)
|
| 722 |
+
{
|
| 723 |
+
return (array)preg_split('/,/', $input, -1, PREG_SPLIT_NO_EMPTY);
|
| 724 |
+
}
|
| 725 |
+
|
| 726 |
+
|
| 727 |
+
/**
|
| 728 |
+
* Prüfung auf Index
|
| 729 |
+
*
|
| 730 |
+
* @since 0.6
|
| 731 |
+
* @change 1.0
|
| 732 |
+
*
|
| 733 |
+
* @return boolean TRUE bei Index
|
| 734 |
+
*/
|
| 735 |
+
|
| 736 |
+
private static function _is_index()
|
| 737 |
+
{
|
| 738 |
+
return basename($_SERVER['SCRIPT_NAME']) != 'index.php';
|
| 739 |
+
}
|
| 740 |
+
|
| 741 |
+
|
| 742 |
+
/**
|
| 743 |
+
* Prüfung auf Mobile Devices
|
| 744 |
+
*
|
| 745 |
+
* @since 0.9.1
|
| 746 |
+
* @change 1.0
|
| 747 |
+
*
|
| 748 |
+
* @return boolean TRUE bei Mobile
|
| 749 |
+
*/
|
| 750 |
+
|
| 751 |
+
private static function _is_mobile()
|
| 752 |
+
{
|
| 753 |
+
return ( strpos(TEMPLATEPATH, 'wptouch') or strpos(TEMPLATEPATH, 'carrington') );
|
| 754 |
+
}
|
| 755 |
+
|
| 756 |
+
|
| 757 |
+
/**
|
| 758 |
+
* Definition der Ausnahmen für den Cache
|
| 759 |
+
*
|
| 760 |
+
* @since 0.2
|
| 761 |
+
* @change 1.0
|
| 762 |
+
*
|
| 763 |
+
* @return boolean TRUE bei Ausnahmen
|
| 764 |
+
*/
|
| 765 |
+
|
| 766 |
+
private static function _skip_cache()
|
| 767 |
+
{
|
| 768 |
+
/* Optionen */
|
| 769 |
+
$options = get_option('cachify');
|
| 770 |
+
|
| 771 |
+
/* Filter */
|
| 772 |
+
if ( self::_is_index() or is_feed() or is_trackback() or is_robots() or is_preview() or post_password_required() or ( $options['only_guests'] && is_user_logged_in() ) ) {
|
| 773 |
+
return true;
|
| 774 |
+
}
|
| 775 |
+
|
| 776 |
+
/* WP Touch */
|
| 777 |
+
if ( self::_is_mobile() ) {
|
| 778 |
+
return true;
|
| 779 |
+
}
|
| 780 |
+
|
| 781 |
+
/* Post IDs */
|
| 782 |
+
if ( $options['without_ids'] && is_singular() ) {
|
| 783 |
+
if ( in_array( $GLOBALS['wp_query']->get_queried_object_id(), self::_preg_split($options['without_ids']) ) ) {
|
| 784 |
+
return true;
|
| 785 |
+
}
|
| 786 |
+
}
|
| 787 |
+
|
| 788 |
+
/* User Agents */
|
| 789 |
+
if ( $options['without_agents'] && isset($_SERVER['HTTP_USER_AGENT']) ) {
|
| 790 |
+
if ( array_filter( self::_preg_split($options['without_agents']), create_function('$a', 'return strpos($_SERVER["HTTP_USER_AGENT"], $a);') ) ) {
|
| 791 |
+
return true;
|
| 792 |
+
}
|
| 793 |
+
}
|
| 794 |
+
|
| 795 |
+
return false;
|
| 796 |
+
}
|
| 797 |
+
|
| 798 |
+
|
| 799 |
+
/**
|
| 800 |
+
* Komprimierung des HTML-Codes
|
| 801 |
+
*
|
| 802 |
+
* @since 0.9.2
|
| 803 |
+
* @change 1.2.1
|
| 804 |
+
*
|
| 805 |
+
* @param string $data Zu komprimierende Datensatz
|
| 806 |
+
* @return string $data Komprimierter Datensatz
|
| 807 |
+
*/
|
| 808 |
+
|
| 809 |
+
private static function _sanitize_cache($data) {
|
| 810 |
+
/* Optionen */
|
| 811 |
+
$options = get_option('cachify');
|
| 812 |
+
|
| 813 |
+
/* Komprimieren? */
|
| 814 |
+
if ( !$options['compress_html'] ) {
|
| 815 |
+
return($data);
|
| 816 |
+
}
|
| 817 |
+
|
| 818 |
+
/* Verkleinern */
|
| 819 |
+
$cleaned = preg_replace(
|
| 820 |
+
array(
|
| 821 |
+
'/<!--[^\[><](.*?)-->/s',
|
| 822 |
+
'#(?ix)(?>[^\S ]\s*|\s{2,})(?=(?:(?:[^<]++|<(?!/?(?:textarea|pre)\b))*+)(?:<(?>textarea|pre)\b|\z))#'
|
| 823 |
+
),
|
| 824 |
+
array(
|
| 825 |
+
'',
|
| 826 |
+
' '
|
| 827 |
+
),
|
| 828 |
+
(string) $data
|
| 829 |
+
);
|
| 830 |
+
|
| 831 |
+
/* Fehlerhaft? */
|
| 832 |
+
if ( strlen($cleaned) <= 1 ) {
|
| 833 |
+
return($data);
|
| 834 |
+
}
|
| 835 |
+
|
| 836 |
+
return($cleaned);
|
| 837 |
+
}
|
| 838 |
+
|
| 839 |
+
|
| 840 |
+
/**
|
| 841 |
+
* Löschung des Cache für eine URL
|
| 842 |
+
*
|
| 843 |
+
* @since 0.1
|
| 844 |
+
* @change 1.3
|
| 845 |
+
*
|
| 846 |
+
* @param string $url URL für den Hash-Wert
|
| 847 |
+
*/
|
| 848 |
+
|
| 849 |
+
private static function _delete_cache($url)
|
| 850 |
+
{
|
| 851 |
+
/* Hash */
|
| 852 |
+
$hash = self::_cache_hash($url);
|
| 853 |
+
|
| 854 |
+
/* Löschen */
|
| 855 |
+
if ( self::_apc_active() ) {
|
| 856 |
+
apc_delete($hash);
|
| 857 |
+
} else {
|
| 858 |
+
delete_transient($hash);
|
| 859 |
+
}
|
| 860 |
+
}
|
| 861 |
+
|
| 862 |
+
|
| 863 |
+
/**
|
| 864 |
+
* Zurücksetzen des kompletten Cache
|
| 865 |
+
*
|
| 866 |
+
* @since 0.1
|
| 867 |
+
* @change 1.3
|
| 868 |
+
*/
|
| 869 |
+
|
| 870 |
+
public static function flush_cache()
|
| 871 |
+
{
|
| 872 |
+
/* DB */
|
| 873 |
+
$GLOBALS['wpdb']->query("DELETE FROM `" .$GLOBALS['wpdb']->options. "` WHERE `option_name` LIKE ('_transient%_cachify_%')");
|
| 874 |
+
$GLOBALS['wpdb']->query("OPTIMIZE TABLE `" .$GLOBALS['wpdb']->options. "`");
|
| 875 |
+
|
| 876 |
+
/* APC */
|
| 877 |
+
if ( self::_apc_active() ) {
|
| 878 |
+
apc_clear_cache('user');
|
| 879 |
+
}
|
| 880 |
+
}
|
| 881 |
+
|
| 882 |
+
|
| 883 |
+
/**
|
| 884 |
+
* Zuweisung des Cache
|
| 885 |
+
*
|
| 886 |
+
* @since 0.1
|
| 887 |
+
* @change 1.0
|
| 888 |
+
*
|
| 889 |
+
* @param string $data Inhalt der Seite
|
| 890 |
+
* @return string $data Inhalt der Seite
|
| 891 |
+
*/
|
| 892 |
+
|
| 893 |
+
public static function set_cache($data)
|
| 894 |
+
{
|
| 895 |
+
/* Leer */
|
| 896 |
+
if ( empty($data) ) {
|
| 897 |
+
return '';
|
| 898 |
+
}
|
| 899 |
+
|
| 900 |
+
/* Optionen */
|
| 901 |
+
$options = get_option('cachify');
|
| 902 |
+
|
| 903 |
+
/* Lifetime */
|
| 904 |
+
$lifetime = 60 * 60 * (int)$options['cache_expires'];
|
| 905 |
+
|
| 906 |
+
/* Hash */
|
| 907 |
+
$hash = self::_cache_hash();
|
| 908 |
+
|
| 909 |
+
/* APC */
|
| 910 |
+
if ( self::_apc_active() ) {
|
| 911 |
+
apc_store(
|
| 912 |
+
$hash,
|
| 913 |
+
gzencode( self::_sanitize_cache($data) . self::_apc_signatur(), 9 ),
|
| 914 |
+
$lifetime
|
| 915 |
+
);
|
| 916 |
+
|
| 917 |
+
return $data;
|
| 918 |
+
}
|
| 919 |
+
|
| 920 |
+
/* Default (DB) */
|
| 921 |
+
set_transient(
|
| 922 |
+
$hash,
|
| 923 |
+
array(
|
| 924 |
+
'data' => self::_sanitize_cache($data),
|
| 925 |
+
'queries' => self::_page_queries(),
|
| 926 |
+
'timer' => self::_page_timer(),
|
| 927 |
+
'memory' => self::_memory_usage(),
|
| 928 |
+
'time' => current_time('timestamp')
|
| 929 |
+
),
|
| 930 |
+
$lifetime
|
| 931 |
+
);
|
| 932 |
+
|
| 933 |
+
return $data;
|
| 934 |
+
}
|
| 935 |
+
|
| 936 |
+
|
| 937 |
+
/**
|
| 938 |
+
* Verwaltung des Cache
|
| 939 |
+
*
|
| 940 |
+
* @since 0.1
|
| 941 |
+
* @change 1.3
|
| 942 |
+
*/
|
| 943 |
+
|
| 944 |
+
public static function manage_cache()
|
| 945 |
+
{
|
| 946 |
+
/* Kein Cache? */
|
| 947 |
+
if ( self::_skip_cache() ) {
|
| 948 |
+
return;
|
| 949 |
+
}
|
| 950 |
+
|
| 951 |
+
/* Init */
|
| 952 |
+
$hash = self::_cache_hash();
|
| 953 |
+
|
| 954 |
+
/* APC */
|
| 955 |
+
if ( self::_apc_active() ) {
|
| 956 |
+
if ( !apc_exists($hash) ) {
|
| 957 |
+
ob_start('Cachify::set_cache');
|
| 958 |
+
}
|
| 959 |
+
|
| 960 |
+
return;
|
| 961 |
+
}
|
| 962 |
+
|
| 963 |
+
/* DB-Cache */
|
| 964 |
+
if ( $cache = get_transient($hash) ) {
|
| 965 |
+
if ( !empty($cache['data']) ) {
|
| 966 |
+
/* Content */
|
| 967 |
+
echo $cache['data'];
|
| 968 |
+
|
| 969 |
+
/* Signatur */
|
| 970 |
+
echo sprintf(
|
| 971 |
+
"\n\n<!--\n%s\n%s\n%s\n%s\n-->",
|
| 972 |
+
'Cachify für WordPress | http://bit.ly/cachify',
|
| 973 |
+
sprintf(
|
| 974 |
+
'Ohne Cachify: %d DB-Anfragen, %s Sekunden, %s',
|
| 975 |
+
$cache['queries'],
|
| 976 |
+
$cache['timer'],
|
| 977 |
+
$cache['memory']
|
| 978 |
+
),
|
| 979 |
+
sprintf(
|
| 980 |
+
'Mit Cachify: %d DB-Anfragen, %s Sekunden, %s',
|
| 981 |
+
self::_page_queries(),
|
| 982 |
+
self::_page_timer(),
|
| 983 |
+
self::_memory_usage()
|
| 984 |
+
),
|
| 985 |
+
sprintf(
|
| 986 |
+
'Generiert: %s zuvor',
|
| 987 |
+
human_time_diff($cache['time'], current_time('timestamp'))
|
| 988 |
+
)
|
| 989 |
+
);
|
| 990 |
+
|
| 991 |
+
exit;
|
| 992 |
+
}
|
| 993 |
+
}
|
| 994 |
+
|
| 995 |
+
/* Cachen */
|
| 996 |
+
ob_start('Cachify::set_cache');
|
| 997 |
+
}
|
| 998 |
+
|
| 999 |
+
|
| 1000 |
+
/**
|
| 1001 |
+
* Prüfung auf aktiviertes APC
|
| 1002 |
+
*
|
| 1003 |
+
* @since 1.3
|
| 1004 |
+
* @change 1.3
|
| 1005 |
+
*
|
| 1006 |
+
* @param boolean TRUE bei aktiviertem APC
|
| 1007 |
+
*/
|
| 1008 |
+
|
| 1009 |
+
private static function _apc_active()
|
| 1010 |
+
{
|
| 1011 |
+
/* Optionen */
|
| 1012 |
+
$options = get_option('cachify');
|
| 1013 |
+
|
| 1014 |
+
return ( !empty($options['use_apc']) && extension_loaded('apc') );
|
| 1015 |
+
}
|
| 1016 |
+
|
| 1017 |
+
|
| 1018 |
+
/**
|
| 1019 |
+
* Rückgabe der Signatur für APC
|
| 1020 |
+
*
|
| 1021 |
+
* @since 1.3
|
| 1022 |
+
* @change 1.3
|
| 1023 |
+
*
|
| 1024 |
+
* @param string Konvertierte Signatur
|
| 1025 |
+
*/
|
| 1026 |
+
|
| 1027 |
+
private static function _apc_signatur()
|
| 1028 |
+
{
|
| 1029 |
+
return sprintf(
|
| 1030 |
+
"\n\n<!-- %s\n%s %s -->",
|
| 1031 |
+
'Cachify | http://bit.ly/cachify',
|
| 1032 |
+
'APC Cache @',
|
| 1033 |
+
date_i18n('d.m.Y H:i:s', (current_time('timestamp')))
|
| 1034 |
+
);
|
| 1035 |
+
}
|
| 1036 |
+
|
| 1037 |
+
|
| 1038 |
+
/**
|
| 1039 |
+
* Einbindung von CSS
|
| 1040 |
+
*
|
| 1041 |
+
* @since 1.0
|
| 1042 |
+
* @change 1.1
|
| 1043 |
+
*/
|
| 1044 |
+
|
| 1045 |
+
public static function add_css()
|
| 1046 |
+
{
|
| 1047 |
+
/* Infos auslesen */
|
| 1048 |
+
$data = get_plugin_data(__FILE__);
|
| 1049 |
+
|
| 1050 |
+
/* CSS registrieren */
|
| 1051 |
+
wp_register_style(
|
| 1052 |
+
'cachify_css',
|
| 1053 |
+
plugins_url('css/style.css', __FILE__),
|
| 1054 |
+
array(),
|
| 1055 |
+
$data['Version']
|
| 1056 |
+
);
|
| 1057 |
+
|
| 1058 |
+
/* CSS einbinden */
|
| 1059 |
+
wp_enqueue_style('cachify_css');
|
| 1060 |
+
}
|
| 1061 |
+
|
| 1062 |
+
|
| 1063 |
+
/**
|
| 1064 |
+
* Einfügen der Optionsseite
|
| 1065 |
+
*
|
| 1066 |
+
* @since 1.0
|
| 1067 |
+
* @change 1.5
|
| 1068 |
+
*/
|
| 1069 |
+
|
| 1070 |
+
public static function add_page()
|
| 1071 |
+
{
|
| 1072 |
+
add_options_page(
|
| 1073 |
+
'Cachify',
|
| 1074 |
+
'<span id="cachify_sidebar_icon"></span>Cachify',
|
| 1075 |
+
'manage_options',
|
| 1076 |
+
'cachify',
|
| 1077 |
+
array(
|
| 1078 |
+
__CLASS__,
|
| 1079 |
+
'options_page'
|
| 1080 |
+
)
|
| 1081 |
+
);
|
| 1082 |
+
}
|
| 1083 |
+
|
| 1084 |
+
|
| 1085 |
+
/**
|
| 1086 |
+
* Anzeige des Hilfe-Links
|
| 1087 |
+
*
|
| 1088 |
+
* @since 1.1
|
| 1089 |
+
* @change 1.3
|
| 1090 |
+
*
|
| 1091 |
+
* @param string $anchor Anker in die Hilfe
|
| 1092 |
+
*/
|
| 1093 |
+
|
| 1094 |
+
private static function _help_link($anchor)
|
| 1095 |
+
{
|
| 1096 |
+
echo sprintf(
|
| 1097 |
+
'<span>[<a href="http://playground.ebiene.de/cachify-wordpress-cache/#%s" target="_blank">?</a>]</span>',
|
| 1098 |
+
$anchor
|
| 1099 |
+
);
|
| 1100 |
+
}
|
| 1101 |
+
|
| 1102 |
+
|
| 1103 |
+
/**
|
| 1104 |
+
* Registrierung der Settings
|
| 1105 |
+
*
|
| 1106 |
+
* @since 1.0
|
| 1107 |
+
* @change 1.0
|
| 1108 |
+
*/
|
| 1109 |
+
|
| 1110 |
+
public static function register_settings()
|
| 1111 |
+
{
|
| 1112 |
+
register_setting(
|
| 1113 |
+
'cachify',
|
| 1114 |
+
'cachify',
|
| 1115 |
+
array(
|
| 1116 |
+
__CLASS__,
|
| 1117 |
+
'validate_options'
|
| 1118 |
+
)
|
| 1119 |
+
);
|
| 1120 |
+
}
|
| 1121 |
+
|
| 1122 |
+
|
| 1123 |
+
/**
|
| 1124 |
+
* Valisierung der Optionsseite
|
| 1125 |
+
*
|
| 1126 |
+
* @since 1.0
|
| 1127 |
+
* @change 1.3
|
| 1128 |
+
*
|
| 1129 |
+
* @param array $data Array mit Formularwerten
|
| 1130 |
+
* @return array Array mit geprüften Werten
|
| 1131 |
+
*/
|
| 1132 |
+
|
| 1133 |
+
public static function validate_options($data)
|
| 1134 |
+
{
|
| 1135 |
+
/* Cache leeren */
|
| 1136 |
+
self::flush_cache();
|
| 1137 |
+
|
| 1138 |
+
return array(
|
| 1139 |
+
'only_guests' => (int)(!empty($data['only_guests'])),
|
| 1140 |
+
'compress_html' => (int)(!empty($data['compress_html'])),
|
| 1141 |
+
'cache_expires' => (int)(@$data['cache_expires']),
|
| 1142 |
+
'without_ids' => (string)sanitize_text_field(@$data['without_ids']),
|
| 1143 |
+
'without_agents' => (string)sanitize_text_field(@$data['without_agents']),
|
| 1144 |
+
'use_apc' => (int)(!empty($data['use_apc']))
|
| 1145 |
+
);
|
| 1146 |
+
}
|
| 1147 |
+
|
| 1148 |
+
|
| 1149 |
+
/**
|
| 1150 |
+
* Darstellung der Optionsseite
|
| 1151 |
+
*
|
| 1152 |
+
* @since 1.0
|
| 1153 |
+
* @change 1.3
|
| 1154 |
+
*/
|
| 1155 |
+
|
| 1156 |
+
public static function options_page()
|
| 1157 |
+
{ ?>
|
| 1158 |
+
<div class="wrap" id="cachify_main">
|
| 1159 |
+
<?php screen_icon('cachify') ?>
|
| 1160 |
+
|
| 1161 |
+
<h2>
|
| 1162 |
+
Cachify
|
| 1163 |
+
</h2>
|
| 1164 |
+
|
| 1165 |
+
<form method="post" action="options.php">
|
| 1166 |
+
<?php settings_fields('cachify') ?>
|
| 1167 |
+
|
| 1168 |
+
<?php $options = get_option('cachify') ?>
|
| 1169 |
+
|
| 1170 |
+
<table class="form-table">
|
| 1171 |
+
<tr>
|
| 1172 |
+
<th>
|
| 1173 |
+
Cache-Gültigkeit in Stunden <?php self::_help_link('cache_expires') ?>
|
| 1174 |
+
</th>
|
| 1175 |
+
<td>
|
| 1176 |
+
<input type="text" name="cachify[cache_expires]" value="<?php echo $options['cache_expires'] ?>" />
|
| 1177 |
+
</td>
|
| 1178 |
+
</tr>
|
| 1179 |
+
|
| 1180 |
+
<tr>
|
| 1181 |
+
<th>
|
| 1182 |
+
Ausnahme für (Post/Pages) IDs <?php self::_help_link('without_ids') ?>
|
| 1183 |
+
</th>
|
| 1184 |
+
<td>
|
| 1185 |
+
<input type="text" name="cachify[without_ids]" value="<?php echo $options['without_ids'] ?>" />
|
| 1186 |
+
</td>
|
| 1187 |
+
</tr>
|
| 1188 |
+
|
| 1189 |
+
<tr>
|
| 1190 |
+
<th>
|
| 1191 |
+
Ausnahme für User Agents <?php self::_help_link('without_agents') ?>
|
| 1192 |
+
</th>
|
| 1193 |
+
<td>
|
| 1194 |
+
<input type="text" name="cachify[without_agents]" value="<?php echo $options['without_agents'] ?>" />
|
| 1195 |
+
</td>
|
| 1196 |
+
</tr>
|
| 1197 |
+
|
| 1198 |
+
<tr>
|
| 1199 |
+
<th>
|
| 1200 |
+
Komprimierung der Ausgabe <?php self::_help_link('compress_html') ?>
|
| 1201 |
+
</th>
|
| 1202 |
+
<td>
|
| 1203 |
+
<input type="checkbox" name="cachify[compress_html]" value="1" <?php checked('1', $options['compress_html']); ?> />
|
| 1204 |
+
</td>
|
| 1205 |
+
</tr>
|
| 1206 |
+
|
| 1207 |
+
<tr>
|
| 1208 |
+
<th>
|
| 1209 |
+
Nur für nicht eingeloggte Nutzer <?php self::_help_link('only_guests') ?>
|
| 1210 |
+
</th>
|
| 1211 |
+
<td>
|
| 1212 |
+
<input type="checkbox" name="cachify[only_guests]" value="1" <?php checked('1', $options['only_guests']); ?> />
|
| 1213 |
+
</td>
|
| 1214 |
+
</tr>
|
| 1215 |
+
|
| 1216 |
+
<?php if ( function_exists('apc_fetch') ) { ?>
|
| 1217 |
+
<tr>
|
| 1218 |
+
<th>
|
| 1219 |
+
APC (Alternative PHP Cache) nutzen <?php self::_help_link('use_apc') ?>
|
| 1220 |
+
</th>
|
| 1221 |
+
<td>
|
| 1222 |
+
<input type="checkbox" name="cachify[use_apc]" value="1" <?php checked('1', $options['use_apc']); ?> />
|
| 1223 |
+
</td>
|
| 1224 |
+
</tr>
|
| 1225 |
+
<?php } ?>
|
| 1226 |
+
</table>
|
| 1227 |
+
|
| 1228 |
+
<p class="submit">
|
| 1229 |
+
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
| 1230 |
+
</p>
|
| 1231 |
+
</form>
|
| 1232 |
+
</div><?php
|
| 1233 |
+
}
|
| 1234 |
+
}
|
| 1235 |
+
|
| 1236 |
+
|
| 1237 |
+
/* Fire */
|
| 1238 |
+
add_action(
|
| 1239 |
+
'plugins_loaded',
|
| 1240 |
+
array(
|
| 1241 |
+
'Cachify',
|
| 1242 |
+
'init'
|
| 1243 |
+
),
|
| 1244 |
+
99
|
| 1245 |
+
);
|
| 1246 |
+
|
| 1247 |
+
/* Install */
|
| 1248 |
+
register_activation_hook(
|
| 1249 |
+
__FILE__,
|
| 1250 |
+
array(
|
| 1251 |
+
'Cachify',
|
| 1252 |
+
'install'
|
| 1253 |
+
)
|
| 1254 |
+
);
|
| 1255 |
+
|
| 1256 |
+
/* Uninstall */
|
| 1257 |
+
register_uninstall_hook(
|
| 1258 |
+
__FILE__,
|
| 1259 |
+
array(
|
| 1260 |
+
'Cachify',
|
| 1261 |
+
'uninstall'
|
| 1262 |
+
)
|
| 1263 |
+
);
|
| 1264 |
+
|
| 1265 |
+
/* Updaten */
|
| 1266 |
+
if ( function_exists('register_update_hook') ) {
|
| 1267 |
+
register_update_hook(
|
| 1268 |
+
__FILE__,
|
| 1269 |
+
array(
|
| 1270 |
+
'Cachify',
|
| 1271 |
+
'update'
|
| 1272 |
+
)
|
| 1273 |
+
);
|
| 1274 |
+
}
|
css/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
| 1 |
+
#cachify_sidebar_icon{width:11px;height:9px;border:0;display:inline-block;background:url(../img/icon.png) no-repeat;}#wp-admin-bar-cachify .ab-icon{position:relative;float:left;width:16px;height:16px;margin-top:6px;background:url(../img/icon16.png) no-repeat 0 -1px;}#icon-cachify{background:url(../img/icon32.png) no-repeat;}#cachify_main .form-table th{width:220px;line-height:26px;}#cachify_main .form-table th span{font-size:11px;white-space:nowrap;}#cachify_main .form-table th span a{padding:0 1px;text-decoration:none;}
|
css/style.dev.css
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* @group Sidebar */
|
| 2 |
+
|
| 3 |
+
#cachify_sidebar_icon {
|
| 4 |
+
width: 11px;
|
| 5 |
+
height: 9px;
|
| 6 |
+
border: 0;
|
| 7 |
+
display: inline-block;
|
| 8 |
+
background: url(../img/icon.png) no-repeat;
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
/* @end group */
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
/* @group Adminbar */
|
| 15 |
+
|
| 16 |
+
#wp-admin-bar-cachify .ab-icon {
|
| 17 |
+
position: relative;
|
| 18 |
+
float: left;
|
| 19 |
+
width: 16px;
|
| 20 |
+
height: 16px;
|
| 21 |
+
margin-top: 6px;
|
| 22 |
+
background: url(../img/icon16.png) no-repeat 0 -1px;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
/* @end group */
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
/* @group GUI */
|
| 29 |
+
|
| 30 |
+
#icon-cachify {
|
| 31 |
+
background: url(../img/icon32.png) no-repeat;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
#cachify_main .form-table th {
|
| 35 |
+
width: 220px;
|
| 36 |
+
line-height: 26px;
|
| 37 |
+
}
|
| 38 |
+
#cachify_main .form-table th span {
|
| 39 |
+
font-size: 11px;
|
| 40 |
+
white-space: nowrap;
|
| 41 |
+
}
|
| 42 |
+
#cachify_main .form-table th span a {
|
| 43 |
+
padding: 0 1px;
|
| 44 |
+
text-decoration: none;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
/* @end group */
|
img/icon.png
ADDED
|
Binary file
|
img/icon16.png
ADDED
|
Binary file
|
img/icon32.png
ADDED
|
Binary file
|
readme.txt
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
=== Cachify ===
|
| 2 |
+
Contributors: sergej.mueller
|
| 3 |
+
Tags: apc, cache, caching, performance
|
| 4 |
+
Donate link: http://flattr.com/profile/sergej.mueller
|
| 5 |
+
Requires at least: 3.0
|
| 6 |
+
Tested up to: 3.3
|
| 7 |
+
Stable tag: trunk
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
Smarte, aber effiziente Cache-Lösung für WordPress. Mit der Konzentration aufs Wesentliche. Empfehlenswert für CMS-Seiten.
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
== Description ==
|
| 16 |
+
|
| 17 |
+
= Unkompliziert und ausbaufähig =
|
| 18 |
+
*Cachify* optimiert Ladezeit der Blogseiten, indem Seiteninhalte in statischer Form in der Datenbank abgelegt und beim Seitenaufruf direkt ausgegeben werden. Die Anzahl der DB-Anfragen und PHP-Anweisungen reduziert sich um ein Vielfaches.
|
| 19 |
+
|
| 20 |
+
= Stärken =
|
| 21 |
+
* Unterstützung für APC (Alternative PHP Cache)
|
| 22 |
+
* "Cache leeren" in der Admin Bar
|
| 23 |
+
* Triviale Installation begleitet vom Online-Handbuch
|
| 24 |
+
* Optionale Komprimierung der HTML-Ausgabe
|
| 25 |
+
* Ausnahmelisten für Beiträge und User Agents
|
| 26 |
+
* Bis zu 80 % weniger DB-Anfragen
|
| 27 |
+
* Bis zu 60 % schnellere Ausführungszeiten
|
| 28 |
+
* Manueller und automatischer Cache-Reset
|
| 29 |
+
* Ausgabe der "davor, danach" Informationen im Quelltext
|
| 30 |
+
|
| 31 |
+
= Dokumentation =
|
| 32 |
+
* [Cachify WordPress Cache](http://playground.ebiene.de/cachify-wordpress-cache/ "Cachify WordPress Cache")
|
| 33 |
+
|
| 34 |
+
= Autor =
|
| 35 |
+
* [Google+](https://plus.google.com/110569673423509816572 "Google+")
|
| 36 |
+
* [Portfolio](http://ebiene.de "Portfolio")
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
== Changelog ==
|
| 41 |
+
|
| 42 |
+
= 1.5.1 =
|
| 43 |
+
* `zlib.output_compression = Off` für Apache Webserver
|
| 44 |
+
|
| 45 |
+
= 1.5 =
|
| 46 |
+
* Überarbeitung des Regexp für HTML-Minify
|
| 47 |
+
* Reduzierung des Toolbar-Buttons auf das Icon
|
| 48 |
+
* Formatierung und Kommentierung des Quelltextes
|
| 49 |
+
|
| 50 |
+
= 1.4 =
|
| 51 |
+
* Xmas Edition
|
| 52 |
+
|
| 53 |
+
= 1.3 =
|
| 54 |
+
* Unterstützung für APC (Alternative PHP Cache)
|
| 55 |
+
* Umpositionierung des Admin Bar Buttons
|
| 56 |
+
|
| 57 |
+
= 1.2.1 =
|
| 58 |
+
* Icon für die "Cache leeren" Schaltfläche in der Admin Bar
|
| 59 |
+
|
| 60 |
+
= 1.2 =
|
| 61 |
+
* Schaltfläche "Cache leeren" in der Adminbar (ab WordPress 3.1)
|
| 62 |
+
* `flush_cache` auf public gesetzt, um von [wpSEO](http://wpseo.de "WordPress SEO Plugin") ansprechen zu können
|
| 63 |
+
* Ausführliche Tests unter WordPress 3.3
|
| 64 |
+
|
| 65 |
+
= 1.1 =
|
| 66 |
+
* Interne Prüfung auf fehlerhafte Cache-Generierung
|
| 67 |
+
* Anpassungen an der Code-Struktur
|
| 68 |
+
* Entfernung der Inline-Hilfe
|
| 69 |
+
* Verknüpfung der Online-Hilfe mit Optionen
|
| 70 |
+
|
| 71 |
+
= 1.0 =
|
| 72 |
+
* Leerung des Cache beim Aktualisieren von statischen Seiten
|
| 73 |
+
* Seite mit Plugin-Einstellungen
|
| 74 |
+
* Inline-Dokumentation in der Optionsseite
|
| 75 |
+
* Ausschluss von Passwort-geschützten Seiten
|
| 76 |
+
* WordPress 3.2 Support
|
| 77 |
+
* Unterstützung der WordPress Multisite Blogs
|
| 78 |
+
* Umstellung auf den template_redirect-Hook (Plugin-Kompatibilität)
|
| 79 |
+
* Interne Code-Bereinigung
|
| 80 |
+
|
| 81 |
+
= 0.9.2 =
|
| 82 |
+
* HTML-Kompression
|
| 83 |
+
* Flattr-Link
|
| 84 |
+
|
| 85 |
+
= 0.9.1 =
|
| 86 |
+
* Cache-Reset bei geplanten Beiträgen
|
| 87 |
+
* Unterstützung für das Carrington-Mobile Theme
|
| 88 |
+
|
| 89 |
+
= 0.9 =
|
| 90 |
+
* Workaround für Redirects
|
| 91 |
+
|
| 92 |
+
= 0.8 =
|
| 93 |
+
* Blacklist für PostIDs
|
| 94 |
+
* Blacklist für UserAgents
|
| 95 |
+
* Ausnahme für WP Touch
|
| 96 |
+
* Ausgabe des Zeitpunktes der Generierung
|
| 97 |
+
* Umbenennung der Konstanten
|
| 98 |
+
|
| 99 |
+
= 0.7 =
|
| 100 |
+
* Ausgabe des Speicherverbrauchs
|
| 101 |
+
|
| 102 |
+
= 0.6 =
|
| 103 |
+
* Live auf wordpress.org
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
== Screenshots ==
|
| 108 |
+
|
| 109 |
+
1. Cachify Optionen
|
screenshot-1.png
ADDED
|
Binary file
|
