Cachify - Version 1.4

Version Description

  • Xmas Edition
Download this release

Release Info

Developer sergej.mueller
Plugin Icon 128x128 Cachify
Version 1.4
Comparing to
See all releases

Version 1.4

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