Cachify - Version 1.3

Version Description

  • Untersttzung von APC (Alternative PHP Cache)
  • Umpositionierung des Admin Bar Buttons
Download this release

Release Info

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

Version 1.3

apc/proxy.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( function_exists('apc_fetch') && !empty($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false ) {
3
+ if ( $cache = apc_fetch('cachify_' .md5($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) ) {
4
+ header('Vary: Accept-Encoding');
5
+ header('X-Powered-By: Cachify');
6
+ header('Content-Encoding: gzip');
7
+ header('Content-Length: '.strlen($cache));
8
+
9
+ echo $cache;
10
+ exit;
11
+ }
12
+ }
13
+ ?>
cachify.original.php ADDED
@@ -0,0 +1,1285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.3
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 = (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 ? $lifetime * 60 : 0 )
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
+ 60 * 60 * $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
+ /* APC */
967
+ if ( self::_apc_active() ) {
968
+ ob_start('Cachify::set_cache');
969
+
970
+ return;
971
+ }
972
+
973
+ /* DB-Cache */
974
+ if ( $cache = get_transient(self::_cache_hash()) ) {
975
+ if ( !empty($cache['data']) ) {
976
+ /* Content */
977
+ echo $cache['data'];
978
+
979
+ /* Signatur */
980
+ echo sprintf(
981
+ "\n\n<!--\n%s\n%s\n%s\n%s\n-->",
982
+ 'Cachify für WordPress | http://bit.ly/cachify',
983
+ sprintf(
984
+ 'Ohne Cachify: %d DB-Anfragen, %s Sekunden, %s',
985
+ $cache['queries'],
986
+ $cache['timer'],
987
+ $cache['memory']
988
+ ),
989
+ sprintf(
990
+ 'Mit Cachify: %d DB-Anfragen, %s Sekunden, %s',
991
+ self::_page_queries(),
992
+ self::_page_timer(),
993
+ self::_memory_usage()
994
+ ),
995
+ sprintf(
996
+ 'Generiert: %s zuvor',
997
+ human_time_diff($cache['time'], current_time('timestamp'))
998
+ )
999
+ );
1000
+
1001
+ exit;
1002
+ }
1003
+ }
1004
+
1005
+ /* Cachen */
1006
+ ob_start('Cachify::set_cache');
1007
+ }
1008
+
1009
+
1010
+ /**
1011
+ * Prüfung auf aktiviertes APC
1012
+ *
1013
+ * @since 1.3
1014
+ * @change 1.3
1015
+ *
1016
+ * @param boolean TRUE bei aktiviertem APC
1017
+ */
1018
+
1019
+ private static function _apc_active()
1020
+ {
1021
+ /* Optionen */
1022
+ $options = get_option('cachify');
1023
+
1024
+ return ( !empty($options['use_apc']) && function_exists('apc_fetch') );
1025
+ }
1026
+
1027
+
1028
+ /**
1029
+ * Rückgabe der Signatur für APC
1030
+ *
1031
+ * @since 1.3
1032
+ * @change 1.3
1033
+ *
1034
+ * @param string Konvertierte Signatur
1035
+ */
1036
+
1037
+ private static function _apc_signatur()
1038
+ {
1039
+ return sprintf(
1040
+ "\n\n<!-- %s\n%s %s -->",
1041
+ 'Cachify für WordPress | http://bit.ly/cachify',
1042
+ 'Methode: APC | Generiert:',
1043
+ date_i18n('d.m.Y H:i:s', (current_time('timestamp')))
1044
+ );
1045
+ }
1046
+
1047
+
1048
+ /**
1049
+ * Einbindung von CSS
1050
+ *
1051
+ * @since 1.0
1052
+ * @change 1.1
1053
+ */
1054
+
1055
+ public static function add_css()
1056
+ {
1057
+ /* Infos auslesen */
1058
+ $data = get_plugin_data(__FILE__);
1059
+
1060
+ /* CSS registrieren */
1061
+ wp_register_style(
1062
+ 'cachify_css',
1063
+ plugins_url('css/style.css', __FILE__),
1064
+ array(),
1065
+ $data['Version']
1066
+ );
1067
+
1068
+ /* CSS einbinden */
1069
+ wp_enqueue_style('cachify_css');
1070
+ }
1071
+
1072
+
1073
+ /**
1074
+ * Einfüger der Optionsseite
1075
+ *
1076
+ * @since 1.0
1077
+ * @change 1.2.1
1078
+ */
1079
+
1080
+ public static function add_page()
1081
+ {
1082
+ add_options_page(
1083
+ 'Cachify',
1084
+ '<span id="cachify_sidebar_icon"></span>Cachify',
1085
+ 'manage_options',
1086
+ 'cachify',
1087
+ array(
1088
+ __CLASS__,
1089
+ 'options_page'
1090
+ )
1091
+ );
1092
+ }
1093
+
1094
+
1095
+ /**
1096
+ * Anzeige des Hilfe-Links
1097
+ *
1098
+ * @since 1.1
1099
+ * @change 1.3
1100
+ *
1101
+ * @param string $anchor Anker in die Hilfe
1102
+ */
1103
+
1104
+ private static function _help_link($anchor)
1105
+ {
1106
+ echo sprintf(
1107
+ '<span>[<a href="http://playground.ebiene.de/cachify-wordpress-cache/#%s" target="_blank">?</a>]</span>',
1108
+ $anchor
1109
+ );
1110
+ }
1111
+
1112
+
1113
+ /**
1114
+ * Registrierung der Settings
1115
+ *
1116
+ * @since 1.0
1117
+ * @change 1.0
1118
+ */
1119
+
1120
+ public static function register_settings()
1121
+ {
1122
+ register_setting(
1123
+ 'cachify',
1124
+ 'cachify',
1125
+ array(
1126
+ __CLASS__,
1127
+ 'validate_options'
1128
+ )
1129
+ );
1130
+ }
1131
+
1132
+
1133
+ /**
1134
+ * Valisierung der Optionsseite
1135
+ *
1136
+ * @since 1.0
1137
+ * @change 1.3
1138
+ *
1139
+ * @param array $data Array mit Formularwerten
1140
+ * @return array Array mit geprüften Werten
1141
+ */
1142
+
1143
+ public static function validate_options($data)
1144
+ {
1145
+ /* Cache leeren */
1146
+ self::flush_cache();
1147
+
1148
+ return array(
1149
+ 'only_guests' => (int)(!empty($data['only_guests'])),
1150
+ 'compress_html' => (int)(!empty($data['compress_html'])),
1151
+ 'cache_expires' => (int)(@$data['cache_expires']),
1152
+ 'without_ids' => (string)sanitize_text_field(@$data['without_ids']),
1153
+ 'without_agents' => (string)sanitize_text_field(@$data['without_agents']),
1154
+ 'use_apc' => (int)(!empty($data['use_apc']))
1155
+ );
1156
+ }
1157
+
1158
+
1159
+ /**
1160
+ * Darstellung der Optionsseite
1161
+ *
1162
+ * @since 1.0
1163
+ * @change 1.3
1164
+ */
1165
+
1166
+ public static function options_page()
1167
+ { ?>
1168
+ <div class="wrap" id="cachify_main">
1169
+ <?php screen_icon('cachify') ?>
1170
+
1171
+ <h2>
1172
+ Cachify
1173
+ </h2>
1174
+
1175
+ <form method="post" action="options.php">
1176
+ <?php settings_fields('cachify') ?>
1177
+
1178
+ <?php $options = get_option('cachify') ?>
1179
+
1180
+ <table class="form-table">
1181
+ <tr>
1182
+ <th>
1183
+ Cache-Gültigkeit in Stunden <?php self::_help_link('cache_expires') ?>
1184
+ </th>
1185
+ <td>
1186
+ <input type="text" name="cachify[cache_expires]" value="<?php echo $options['cache_expires'] ?>" />
1187
+ </td>
1188
+ </tr>
1189
+
1190
+ <tr>
1191
+ <th>
1192
+ Ausnahme für (Post/Pages) IDs <?php self::_help_link('without_ids') ?>
1193
+ </th>
1194
+ <td>
1195
+ <input type="text" name="cachify[without_ids]" value="<?php echo $options['without_ids'] ?>" />
1196
+ </td>
1197
+ </tr>
1198
+
1199
+ <tr>
1200
+ <th>
1201
+ Ausnahme für User Agents <?php self::_help_link('without_agents') ?>
1202
+ </th>
1203
+ <td>
1204
+ <input type="text" name="cachify[without_agents]" value="<?php echo $options['without_agents'] ?>" />
1205
+ </td>
1206
+ </tr>
1207
+
1208
+ <tr>
1209
+ <th>
1210
+ Komprimierung der Ausgabe <?php self::_help_link('compress_html') ?>
1211
+ </th>
1212
+ <td>
1213
+ <input type="checkbox" name="cachify[compress_html]" value="1" <?php checked('1', $options['compress_html']); ?> />
1214
+ </td>
1215
+ </tr>
1216
+
1217
+ <tr>
1218
+ <th>
1219
+ Nur für nicht eingeloggte Nutzer <?php self::_help_link('only_guests') ?>
1220
+ </th>
1221
+ <td>
1222
+ <input type="checkbox" name="cachify[only_guests]" value="1" <?php checked('1', $options['only_guests']); ?> />
1223
+ </td>
1224
+ </tr>
1225
+
1226
+ <?php if ( function_exists('apc_fetch') ) { ?>
1227
+ <tr>
1228
+ <th>
1229
+ APC (Alternative PHP Cache) nutzen <?php self::_help_link('use_apc') ?>
1230
+ </th>
1231
+ <td>
1232
+ <input type="checkbox" name="cachify[use_apc]" value="1" <?php checked('1', $options['use_apc']); ?> />
1233
+ </td>
1234
+ </tr>
1235
+ <?php } ?>
1236
+ </table>
1237
+
1238
+ <p class="submit">
1239
+ <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
1240
+ </p>
1241
+ </form>
1242
+ </div><?php
1243
+ }
1244
+ }
1245
+
1246
+
1247
+ /* Fire */
1248
+ add_action(
1249
+ 'plugins_loaded',
1250
+ array(
1251
+ 'Cachify',
1252
+ 'init'
1253
+ ),
1254
+ 99
1255
+ );
1256
+
1257
+
1258
+ /* Install */
1259
+ register_activation_hook(
1260
+ __FILE__,
1261
+ array(
1262
+ 'Cachify',
1263
+ 'install'
1264
+ )
1265
+ );
1266
+
1267
+ /* Uninstall */
1268
+ register_uninstall_hook(
1269
+ __FILE__,
1270
+ array(
1271
+ 'Cachify',
1272
+ 'uninstall'
1273
+ )
1274
+ );
1275
+
1276
+ /* Updaten */
1277
+ if ( function_exists('register_update_hook') ) {
1278
+ register_update_hook(
1279
+ __FILE__,
1280
+ array(
1281
+ 'Cachify',
1282
+ 'update'
1283
+ )
1284
+ );
1285
+ }
cachify.php ADDED
@@ -0,0 +1,681 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.3
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 = (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 ? $lifetime * 60 : 0 )
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
+ 60 * 60 * $lifetime
474
+ );
475
+ return $data;
476
+ }
477
+ public static function manage_cache()
478
+ {
479
+ if ( self::_skip_cache() ) {
480
+ return;
481
+ }
482
+ if ( self::_apc_active() ) {
483
+ ob_start('Cachify::set_cache');
484
+ return;
485
+ }
486
+ if ( $cache = get_transient(self::_cache_hash()) ) {
487
+ if ( !empty($cache['data']) ) {
488
+ echo $cache['data'];
489
+ echo sprintf(
490
+ "\n\n<!--\n%s\n%s\n%s\n%s\n-->",
491
+ 'Cachify für WordPress | http://bit.ly/cachify',
492
+ sprintf(
493
+ 'Ohne Cachify: %d DB-Anfragen, %s Sekunden, %s',
494
+ $cache['queries'],
495
+ $cache['timer'],
496
+ $cache['memory']
497
+ ),
498
+ sprintf(
499
+ 'Mit Cachify: %d DB-Anfragen, %s Sekunden, %s',
500
+ self::_page_queries(),
501
+ self::_page_timer(),
502
+ self::_memory_usage()
503
+ ),
504
+ sprintf(
505
+ 'Generiert: %s zuvor',
506
+ human_time_diff($cache['time'], current_time('timestamp'))
507
+ )
508
+ );
509
+ exit;
510
+ }
511
+ }
512
+ ob_start('Cachify::set_cache');
513
+ }
514
+ private static function _apc_active()
515
+ {
516
+ $options = get_option('cachify');
517
+ return ( !empty($options['use_apc']) && function_exists('apc_fetch') );
518
+ }
519
+ private static function _apc_signatur()
520
+ {
521
+ return sprintf(
522
+ "\n\n<!-- %s\n%s %s -->",
523
+ 'Cachify für WordPress | http://bit.ly/cachify',
524
+ 'Methode: APC | Generiert:',
525
+ date_i18n('d.m.Y H:i:s', (current_time('timestamp')))
526
+ );
527
+ }
528
+ public static function add_css()
529
+ {
530
+ $data = get_plugin_data(__FILE__);
531
+ wp_register_style(
532
+ 'cachify_css',
533
+ plugins_url('css/style.css', __FILE__),
534
+ array(),
535
+ $data['Version']
536
+ );
537
+ wp_enqueue_style('cachify_css');
538
+ }
539
+ public static function add_page()
540
+ {
541
+ add_options_page(
542
+ 'Cachify',
543
+ '<span id="cachify_sidebar_icon"></span>Cachify',
544
+ 'manage_options',
545
+ 'cachify',
546
+ array(
547
+ __CLASS__,
548
+ 'options_page'
549
+ )
550
+ );
551
+ }
552
+ private static function _help_link($anchor)
553
+ {
554
+ echo sprintf(
555
+ '<span>[<a href="http://playground.ebiene.de/cachify-wordpress-cache/#%s" target="_blank">?</a>]</span>',
556
+ $anchor
557
+ );
558
+ }
559
+ public static function register_settings()
560
+ {
561
+ register_setting(
562
+ 'cachify',
563
+ 'cachify',
564
+ array(
565
+ __CLASS__,
566
+ 'validate_options'
567
+ )
568
+ );
569
+ }
570
+ public static function validate_options($data)
571
+ {
572
+ self::flush_cache();
573
+ return array(
574
+ 'only_guests'=> (int)(!empty($data['only_guests'])),
575
+ 'compress_html'=> (int)(!empty($data['compress_html'])),
576
+ 'cache_expires'=> (int)(@$data['cache_expires']),
577
+ 'without_ids'=> (string)sanitize_text_field(@$data['without_ids']),
578
+ 'without_agents' => (string)sanitize_text_field(@$data['without_agents']),
579
+ 'use_apc'=> (int)(!empty($data['use_apc']))
580
+ );
581
+ }
582
+ public static function options_page()
583
+ { ?>
584
+ <div class="wrap" id="cachify_main">
585
+ <?php screen_icon('cachify') ?>
586
+ <h2>
587
+ Cachify
588
+ </h2>
589
+ <form method="post" action="options.php">
590
+ <?php settings_fields('cachify') ?>
591
+ <?php $options = get_option('cachify') ?>
592
+ <table class="form-table">
593
+ <tr>
594
+ <th>
595
+ Cache-Gültigkeit in Stunden <?php self::_help_link('cache_expires') ?>
596
+ </th>
597
+ <td>
598
+ <input type="text" name="cachify[cache_expires]" value="<?php echo $options['cache_expires'] ?>" />
599
+ </td>
600
+ </tr>
601
+ <tr>
602
+ <th>
603
+ Ausnahme für (Post/Pages) IDs <?php self::_help_link('without_ids') ?>
604
+ </th>
605
+ <td>
606
+ <input type="text" name="cachify[without_ids]" value="<?php echo $options['without_ids'] ?>" />
607
+ </td>
608
+ </tr>
609
+ <tr>
610
+ <th>
611
+ Ausnahme für User Agents <?php self::_help_link('without_agents') ?>
612
+ </th>
613
+ <td>
614
+ <input type="text" name="cachify[without_agents]" value="<?php echo $options['without_agents'] ?>" />
615
+ </td>
616
+ </tr>
617
+ <tr>
618
+ <th>
619
+ Komprimierung der Ausgabe <?php self::_help_link('compress_html') ?>
620
+ </th>
621
+ <td>
622
+ <input type="checkbox" name="cachify[compress_html]" value="1" <?php checked('1', $options['compress_html']); ?> />
623
+ </td>
624
+ </tr>
625
+ <tr>
626
+ <th>
627
+ Nur für nicht eingeloggte Nutzer <?php self::_help_link('only_guests') ?>
628
+ </th>
629
+ <td>
630
+ <input type="checkbox" name="cachify[only_guests]" value="1" <?php checked('1', $options['only_guests']); ?> />
631
+ </td>
632
+ </tr>
633
+ <?php if ( function_exists('apc_fetch') ) { ?>
634
+ <tr>
635
+ <th>
636
+ APC (Alternative PHP Cache) nutzen <?php self::_help_link('use_apc') ?>
637
+ </th>
638
+ <td>
639
+ <input type="checkbox" name="cachify[use_apc]" value="1" <?php checked('1', $options['use_apc']); ?> />
640
+ </td>
641
+ </tr>
642
+ <?php } ?>
643
+ </table>
644
+ <p class="submit">
645
+ <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
646
+ </p>
647
+ </form>
648
+ </div><?php
649
+ }
650
+ }
651
+ add_action(
652
+ 'plugins_loaded',
653
+ array(
654
+ 'Cachify',
655
+ 'init'
656
+ ),
657
+ 99
658
+ );
659
+ register_activation_hook(
660
+ __FILE__,
661
+ array(
662
+ 'Cachify',
663
+ 'install'
664
+ )
665
+ );
666
+ register_uninstall_hook(
667
+ __FILE__,
668
+ array(
669
+ 'Cachify',
670
+ 'uninstall'
671
+ )
672
+ );
673
+ if ( function_exists('register_update_hook') ) {
674
+ register_update_hook(
675
+ __FILE__,
676
+ array(
677
+ 'Cachify',
678
+ 'update'
679
+ )
680
+ );
681
+ }
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,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Cachify ===
2
+ Contributors: sergej.mueller
3
+ Tags: performance,caching,cache
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
+ Simple und effiziente Cache-Lösung für WordPress.
10
+
11
+
12
+ == Description ==
13
+ = Unkompliziert und ausbaufähig =
14
+ Cachify optimiert die Ladezeit der Blogseiten, indem Seiteninhalte in statischer Form in der Datenbank abgelegt und beim Seitenaufruf direkt ausgegeben werden. Dabei wird die Anzahl der DB-Anfragen und PHP-Anweisungen reduziert.
15
+
16
+ = Einige Stärken =
17
+ * NEU: APC-Support für perfekten Cache
18
+ * Adminbar-Schaltfläche "Cache leeren"
19
+ * Einfache Installation: Aktivieren, fertig
20
+ * Übersichtliche Optionsseite mit verknüpfter Online-Hilfe
21
+ * Optionale Komprimierung der HTML-Ausgabe
22
+ * Ausnahmelisten für PostIDs und User Agents
23
+ * Bis zu 80 % weniger DB-Anfragen
24
+ * Bis zu 60 % schnellere Ausführungszeiten
25
+ * Manueller und automatischer Cache-Reset
26
+ * Ausgabe der "davor, danach" Informationen im Quelltext
27
+
28
+ = Wichtige Information =
29
+ Vor der Inbetriebnahme des Plugins ist die [Dokumentation](http://playground.ebiene.de/cachify-wordpress-cache/ "Cachify WordPress Cache") durchzulesen, um eine inkorrekte Funktionsweise und negative Auswirkungen des Cache-Tools zu vermeiden!
30
+
31
+ = Weiterführende Links =
32
+ * [Google+](https://plus.google.com/110569673423509816572 "Google+")
33
+ * [Other plugins](http://wordpress.org/extend/plugins/profile/sergejmueller "Other plugins")
34
+
35
+
36
+ == Changelog ==
37
+
38
+ = 1.3 =
39
+ * Unterstützung von APC (Alternative PHP Cache)
40
+ * Umpositionierung des Admin Bar Buttons
41
+
42
+
43
+ = 1.2.1 =
44
+ * Icon für die "Cache leeren" Schaltfläche in der Admin Bar
45
+
46
+ = 1.2 =
47
+ * Schaltfläche "Cache leeren" in der Adminbar (ab WordPress 3.1)
48
+ * `flush_cache` auf public gesetzt, um von [wpSEO](http://wpseo.de "WordPress SEO Plugin") ansprechen zu können
49
+ * Ausführliche Tests unter WordPress 3.3
50
+
51
+ = 1.1 =
52
+ * Interne Prüfung auf fehlerhafte Cache-Generierung
53
+ * Anpassungen an der Code-Struktur
54
+ * Entfernung der Inline-Hilfe
55
+ * Verknüpfung der Online-Hilfe mit Optionen
56
+
57
+ = 1.0 =
58
+ * Leerung des Cache beim Aktualisieren von statischen Seiten
59
+ * Seite mit Plugin-Einstellungen
60
+ * Inline-Dokumentation in der Optionsseite
61
+ * Ausschluss von Passwort-geschützten Seiten
62
+ * WordPress 3.2 Support
63
+ * Unterstützung der WordPress Multisite Blogs
64
+ * Umstellung auf den template_redirect-Hook (Plugin-Kompatibilität)
65
+ * Interne Code-Bereinigung
66
+
67
+ = 0.9.2 =
68
+ * HTML-Kompression
69
+ * Flattr-Link
70
+
71
+ = 0.9.1 =
72
+ * Cache-Reset bei geplanten Beiträgen
73
+ * Unterstützung für das Carrington-Mobile Theme
74
+
75
+ = 0.9 =
76
+ * Workaround für Redirects
77
+
78
+ = 0.8 =
79
+ * Blacklist für PostIDs
80
+ * Blacklist für UserAgents
81
+ * Ausnahme für WP Touch
82
+ * Ausgabe des Zeitpunktes der Generierung
83
+ * Umbenennung der Konstanten
84
+
85
+ = 0.7 =
86
+ * Ausgabe des Speicherverbrauchs
87
+
88
+ = 0.6 =
89
+ * Live auf wordpress.org
90
+
91
+
92
+ == Screenshots ==
93
+
94
+ 1. Cachify Optionsseite
95
+
96
+
97
+ == Installation ==
98
+ 1. *Cachify* installieren
99
+ 1. [Dokumentation](http://playground.ebiene.de/cachify-wordpress-cache/ "Cachify WordPress Cache") beachten
100
+ 1. Einstellungen vornehmen
screenshot-1.png ADDED
Binary file