Cachify - Version 2.2.2

Version Description

  • Fix: Parameter-Rckgabe beim Filter dashboard_glance_items
  • Grozgige Anwendung des Filters esc_html
Download this release

Release Info

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

Code changes from version 2.2.1 to 2.2.2

Files changed (3) hide show
  1. cachify.php +2 -2
  2. inc/cachify.class.php +57 -41
  3. readme.txt +5 -1
cachify.php CHANGED
@@ -8,11 +8,11 @@ Author: Sergej Müller
8
  Author URI: http://wpcoder.de
9
  Plugin URI: http://cachify.de
10
  License: GPLv2 or later
11
- Version: 2.2.1
12
  */
13
 
14
  /*
15
- Copyright (C) 2011-2014 Sergej Müller
16
 
17
  This program is free software; you can redistribute it and/or modify
18
  it under the terms of the GNU General Public License as published by
8
  Author URI: http://wpcoder.de
9
  Plugin URI: http://cachify.de
10
  License: GPLv2 or later
11
+ Version: 2.2.2
12
  */
13
 
14
  /*
15
+ Copyright (C) 2011-2015 Sergej Müller
16
 
17
  This program is free software; you can redistribute it and/or modify
18
  it under the terms of the GNU General Public License as published by
inc/cachify.class.php CHANGED
@@ -74,7 +74,7 @@ final class Cachify {
74
  * Konstruktor der Klasse
75
  *
76
  * @since 1.0.0
77
- * @change 2.2.0
78
  *
79
  * @param void
80
  * @return void
@@ -124,6 +124,13 @@ final class Cachify {
124
  'flush_total_cache'
125
  )
126
  );
 
 
 
 
 
 
 
127
 
128
  /* Flush icon */
129
  add_action(
@@ -206,7 +213,7 @@ final class Cachify {
206
  )
207
  );
208
 
209
- add_action(
210
  'dashboard_glance_items',
211
  array(
212
  __CLASS__,
@@ -604,11 +611,19 @@ final class Cachify {
604
  * Anzeige des Spam-Counters auf dem Dashboard
605
  *
606
  * @since 2.0.0
607
- * @change 2.1.3
 
 
 
608
  */
609
 
610
- public static function add_dashboard_count()
611
  {
 
 
 
 
 
612
  /* Cache size */
613
  $size = self::get_cache_size();
614
 
@@ -620,13 +635,9 @@ final class Cachify {
620
  )
621
  );
622
 
623
- /* Print the link */
624
- echo sprintf(
625
- '<li>
626
- <a href="%s" class="cachify-icon cachify-icon--%s" title="%s: %s">
627
- %s Cache
628
- </a>
629
- </li>',
630
  add_query_arg(
631
  array(
632
  'page' => 'cachify'
@@ -634,10 +645,12 @@ final class Cachify {
634
  admin_url('options-general.php')
635
  ),
636
  esc_attr(strtolower($method)),
637
- __('Caching method', 'cachify'),
638
  esc_attr($method),
639
- ( empty($size) ? __('Empty', 'cachify') : size_format($size) )
640
  );
 
 
641
  }
642
 
643
 
@@ -677,7 +690,7 @@ final class Cachify {
677
  * Hinzufügen eines Admin-Bar-Menüs
678
  *
679
  * @since 1.2
680
- * @change 2.2.0
681
  *
682
  * @hook mixed cachify_user_can_flush_cache
683
  *
@@ -701,7 +714,7 @@ final class Cachify {
701
  'href' => wp_nonce_url( add_query_arg('_cachify', 'flush'), '_cachify_flush_nonce'),
702
  'parent' => 'top-secondary',
703
  'title' => '<span class="ab-icon dashicons"></span>',
704
- 'meta' => array( 'title' => __('Flush the cachify cache', 'cachify') )
705
  )
706
  );
707
  }
@@ -800,7 +813,7 @@ final class Cachify {
800
  * Hinweis nach erfolgreichem Cache-Leeren
801
  *
802
  * @since 1.2
803
- * @change 2.2.0
804
  *
805
  * @hook mixed cachify_user_can_flush_cache
806
  */
@@ -814,7 +827,7 @@ final class Cachify {
814
 
815
  echo sprintf(
816
  '<div id="message" class="updated"><p><strong>%s</strong></p></div>',
817
- __('Cachify cache is flushed.', 'cachify')
818
  );
819
  }
820
 
@@ -1104,14 +1117,14 @@ final class Cachify {
1104
  * Prüfung auf Mobile Devices
1105
  *
1106
  * @since 0.9.1
1107
- * @change 2.0.7
1108
  *
1109
  * @return boolean TRUE bei Mobile
1110
  */
1111
 
1112
  private static function _is_mobile()
1113
  {
1114
- return ( strpos(TEMPLATEPATH, 'wptouch') or strpos(TEMPLATEPATH, 'carrington') or strpos(TEMPLATEPATH, 'jetpack') or strpos(TEMPLATEPATH, 'handheld') );
1115
  }
1116
 
1117
 
@@ -1423,7 +1436,7 @@ final class Cachify {
1423
  * Display a combo select on post publish box
1424
  *
1425
  * @since 2.1.3
1426
- * @change 2.1.7
1427
  */
1428
 
1429
  public static function print_flush_dropdown()
@@ -1455,7 +1468,10 @@ final class Cachify {
1455
 
1456
  /* Init vars */
1457
  $dropdown_options = '';
1458
- $available_options = array(__('Total cache', 'cachify'), __('Page cache', 'cachify'));
 
 
 
1459
 
1460
  /* Select options */
1461
  foreach( $available_options as $key => $value ) {
@@ -1484,12 +1500,12 @@ final class Cachify {
1484
  <a href="#" class="cancel-cachify-status hide-if-no-js button-cancel">%6$s</a>
1485
  </div>
1486
  </div>',
1487
- __('Remove', 'cachify'),
1488
  $available_options[$current_action],
1489
- __('Edit'),
1490
  $dropdown_options,
1491
- __('OK'),
1492
- __('Cancel')
1493
  );
1494
  }
1495
 
@@ -1498,12 +1514,12 @@ final class Cachify {
1498
  * Einfügen der Optionsseite
1499
  *
1500
  * @since 1.0
1501
- * @change 2.0.2
1502
  */
1503
 
1504
  public static function add_page()
1505
  {
1506
- $page = add_options_page(
1507
  'Cachify',
1508
  'Cachify',
1509
  'manage_options',
@@ -1529,9 +1545,9 @@ final class Cachify {
1529
  {
1530
  /* Defaults */
1531
  $methods = array(
1532
- self::METHOD_DB => __('Database', 'cachify'),
1533
  self::METHOD_APC => 'APC',
1534
- self::METHOD_HDD => __('Hard disk', 'cachify'),
1535
  self::METHOD_MMC => 'Memcached'
1536
  );
1537
 
@@ -1566,7 +1582,7 @@ final class Cachify {
1566
  private static function _minify_select()
1567
  {
1568
  return array(
1569
- self::MINIFY_DISABLED => __('No minify', 'cachify'),
1570
  self::MINIFY_HTML_ONLY => 'HTML',
1571
  self::MINIFY_HTML_JS => 'HTML + Inline JavaScript'
1572
  );
@@ -1632,7 +1648,7 @@ final class Cachify {
1632
  'cachify_method_tip',
1633
  sprintf(
1634
  '%s [<a href="http://playground.ebiene.de/cachify-wordpress-cache/" target="_blank">?</a>]',
1635
- __('The server configuration file (e.g. .htaccess) needs to be adjusted', 'cachify')
1636
  ),
1637
  'updated'
1638
  );
@@ -1655,7 +1671,7 @@ final class Cachify {
1655
  * Darstellung der Optionsseite
1656
  *
1657
  * @since 1.0
1658
- * @change 2.1.9
1659
  */
1660
 
1661
  public static function options_page()
@@ -1680,7 +1696,7 @@ final class Cachify {
1680
  <table class="form-table">
1681
  <tr valign="top">
1682
  <th scope="row">
1683
- <?php _e('Cache method', 'cachify') ?>
1684
  </th>
1685
  <td>
1686
  <label for="cachify_cache_method">
@@ -1695,32 +1711,32 @@ final class Cachify {
1695
 
1696
  <tr valign="top">
1697
  <th scope="row">
1698
- <?php _e('Cache expiration', 'cachify') ?>
1699
  </th>
1700
  <td>
1701
  <label for="cachify_cache_expires">
1702
  <input type="number" min="0" step="1" name="cachify[cache_expires]" id="cachify_cache_expires" value="<?php echo esc_attr($options['cache_expires']) ?>" class="small-text" />
1703
- <?php _e('Hours', 'cachify') ?>
1704
  </label>
1705
  </td>
1706
  </tr>
1707
 
1708
  <tr valign="top">
1709
  <th scope="row">
1710
- <?php _e('Cache generation', 'cachify') ?>
1711
  </th>
1712
  <td>
1713
  <fieldset>
1714
  <label for="cachify_only_guests">
1715
  <input type="checkbox" name="cachify[only_guests]" id="cachify_only_guests" value="1" <?php checked('1', $options['only_guests']); ?> />
1716
- <?php _e('No cache generation by logged in users', 'cachify') ?>
1717
  </label>
1718
 
1719
  <br />
1720
 
1721
  <label for="cachify_reset_on_comment">
1722
  <input type="checkbox" name="cachify[reset_on_comment]" id="cachify_reset_on_comment" value="1" <?php checked('1', $options['reset_on_comment']); ?> />
1723
- <?php _e('Flush the cache at new comments', 'cachify') ?>
1724
  </label>
1725
  </fieldset>
1726
  </td>
@@ -1728,7 +1744,7 @@ final class Cachify {
1728
 
1729
  <tr valign="top">
1730
  <th scope="row">
1731
- <?php _e('Cache exceptions', 'cachify') ?>
1732
  </th>
1733
  <td>
1734
  <fieldset>
@@ -1749,7 +1765,7 @@ final class Cachify {
1749
 
1750
  <tr valign="top">
1751
  <th scope="row">
1752
- <?php _e('Cache minify', 'cachify') ?>
1753
  </th>
1754
  <td>
1755
  <label for="cachify_compress_html">
@@ -1769,7 +1785,7 @@ final class Cachify {
1769
  <?php submit_button() ?>
1770
  </th>
1771
  <td>
1772
- <a href="http://playground.ebiene.de/cachify-wordpress-cache/" target="_blank"><?php _e('Manual', 'cachify') ?></a> &bull; <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=ZAQUT9RLPW8QN" target="_blank">PayPal</a> &bull; <a href="https://flattr.com/t/1327625" target="_blank">Flattr</a> &bull; <a href="https://www.amazon.de/registry/wishlist/2U5I7F9649LOJ/" target="_blank">Wishlist</a>
1773
  </td>
1774
  </tr>
1775
  </table>
74
  * Konstruktor der Klasse
75
  *
76
  * @since 1.0.0
77
+ * @change 2.2.2
78
  *
79
  * @param void
80
  * @return void
124
  'flush_total_cache'
125
  )
126
  );
127
+ add_action(
128
+ 'wp_trash_post',
129
+ array(
130
+ __CLASS__,
131
+ 'flush_total_cache'
132
+ )
133
+ );
134
 
135
  /* Flush icon */
136
  add_action(
213
  )
214
  );
215
 
216
+ add_filter(
217
  'dashboard_glance_items',
218
  array(
219
  __CLASS__,
611
  * Anzeige des Spam-Counters auf dem Dashboard
612
  *
613
  * @since 2.0.0
614
+ * @change 2.2.2
615
+ *
616
+ * @param array $items Initial array with dashboard items
617
+ * @return array $items Merged array with dashboard items
618
  */
619
 
620
+ public static function add_dashboard_count( $items = array() )
621
  {
622
+ /* Skip */
623
+ if ( ! current_user_can('manage_options') ) {
624
+ return $items;
625
+ }
626
+
627
  /* Cache size */
628
  $size = self::get_cache_size();
629
 
635
  )
636
  );
637
 
638
+ /* Right now item */
639
+ $items[] = sprintf(
640
+ '<a href="%s" class="cachify-icon cachify-icon--%s" title="%s: %s">%s Cache</a>',
 
 
 
 
641
  add_query_arg(
642
  array(
643
  'page' => 'cachify'
645
  admin_url('options-general.php')
646
  ),
647
  esc_attr(strtolower($method)),
648
+ esc_html__('Caching method', 'cachify'),
649
  esc_attr($method),
650
+ ( empty($size) ? esc_html__('Empty', 'cachify') : size_format($size) )
651
  );
652
+
653
+ return $items;
654
  }
655
 
656
 
690
  * Hinzufügen eines Admin-Bar-Menüs
691
  *
692
  * @since 1.2
693
+ * @change 2.2.2
694
  *
695
  * @hook mixed cachify_user_can_flush_cache
696
  *
714
  'href' => wp_nonce_url( add_query_arg('_cachify', 'flush'), '_cachify_flush_nonce'),
715
  'parent' => 'top-secondary',
716
  'title' => '<span class="ab-icon dashicons"></span>',
717
+ 'meta' => array( 'title' => esc_html__('Flush the cachify cache', 'cachify') )
718
  )
719
  );
720
  }
813
  * Hinweis nach erfolgreichem Cache-Leeren
814
  *
815
  * @since 1.2
816
+ * @change 2.2.2
817
  *
818
  * @hook mixed cachify_user_can_flush_cache
819
  */
827
 
828
  echo sprintf(
829
  '<div id="message" class="updated"><p><strong>%s</strong></p></div>',
830
+ esc_html__('Cachify cache is flushed.', 'cachify')
831
  );
832
  }
833
 
1117
  * Prüfung auf Mobile Devices
1118
  *
1119
  * @since 0.9.1
1120
+ * @change 2.2.2
1121
  *
1122
  * @return boolean TRUE bei Mobile
1123
  */
1124
 
1125
  private static function _is_mobile()
1126
  {
1127
+ return ( strpos(TEMPLATEPATH, 'wptouch') OR strpos(TEMPLATEPATH, 'carrington') OR strpos(TEMPLATEPATH, 'jetpack') OR strpos(TEMPLATEPATH, 'handheld') );
1128
  }
1129
 
1130
 
1436
  * Display a combo select on post publish box
1437
  *
1438
  * @since 2.1.3
1439
+ * @change 2.2.2
1440
  */
1441
 
1442
  public static function print_flush_dropdown()
1468
 
1469
  /* Init vars */
1470
  $dropdown_options = '';
1471
+ $available_options = array(
1472
+ esc_html__('Total cache', 'cachify'),
1473
+ esc_html__('Page cache', 'cachify')
1474
+ );
1475
 
1476
  /* Select options */
1477
  foreach( $available_options as $key => $value ) {
1500
  <a href="#" class="cancel-cachify-status hide-if-no-js button-cancel">%6$s</a>
1501
  </div>
1502
  </div>',
1503
+ esc_html__('Remove', 'cachify'),
1504
  $available_options[$current_action],
1505
+ esc_html__('Edit'),
1506
  $dropdown_options,
1507
+ esc_html__('OK'),
1508
+ esc_html__('Cancel')
1509
  );
1510
  }
1511
 
1514
  * Einfügen der Optionsseite
1515
  *
1516
  * @since 1.0
1517
+ * @change 2.2.2
1518
  */
1519
 
1520
  public static function add_page()
1521
  {
1522
+ add_options_page(
1523
  'Cachify',
1524
  'Cachify',
1525
  'manage_options',
1545
  {
1546
  /* Defaults */
1547
  $methods = array(
1548
+ self::METHOD_DB => esc_html__('Database', 'cachify'),
1549
  self::METHOD_APC => 'APC',
1550
+ self::METHOD_HDD => esc_html__('Hard disk', 'cachify'),
1551
  self::METHOD_MMC => 'Memcached'
1552
  );
1553
 
1582
  private static function _minify_select()
1583
  {
1584
  return array(
1585
+ self::MINIFY_DISABLED => esc_html__('No minify', 'cachify'),
1586
  self::MINIFY_HTML_ONLY => 'HTML',
1587
  self::MINIFY_HTML_JS => 'HTML + Inline JavaScript'
1588
  );
1648
  'cachify_method_tip',
1649
  sprintf(
1650
  '%s [<a href="http://playground.ebiene.de/cachify-wordpress-cache/" target="_blank">?</a>]',
1651
+ esc_html__('The server configuration file (e.g. .htaccess) needs to be adjusted', 'cachify')
1652
  ),
1653
  'updated'
1654
  );
1671
  * Darstellung der Optionsseite
1672
  *
1673
  * @since 1.0
1674
+ * @change 2.2.2
1675
  */
1676
 
1677
  public static function options_page()
1696
  <table class="form-table">
1697
  <tr valign="top">
1698
  <th scope="row">
1699
+ <?php esc_html_e('Cache method', 'cachify') ?>
1700
  </th>
1701
  <td>
1702
  <label for="cachify_cache_method">
1711
 
1712
  <tr valign="top">
1713
  <th scope="row">
1714
+ <?php esc_html_e('Cache expiration', 'cachify') ?>
1715
  </th>
1716
  <td>
1717
  <label for="cachify_cache_expires">
1718
  <input type="number" min="0" step="1" name="cachify[cache_expires]" id="cachify_cache_expires" value="<?php echo esc_attr($options['cache_expires']) ?>" class="small-text" />
1719
+ <?php esc_html_e('Hours', 'cachify') ?>
1720
  </label>
1721
  </td>
1722
  </tr>
1723
 
1724
  <tr valign="top">
1725
  <th scope="row">
1726
+ <?php esc_html_e('Cache generation', 'cachify') ?>
1727
  </th>
1728
  <td>
1729
  <fieldset>
1730
  <label for="cachify_only_guests">
1731
  <input type="checkbox" name="cachify[only_guests]" id="cachify_only_guests" value="1" <?php checked('1', $options['only_guests']); ?> />
1732
+ <?php esc_html_e('No cache generation by logged in users', 'cachify') ?>
1733
  </label>
1734
 
1735
  <br />
1736
 
1737
  <label for="cachify_reset_on_comment">
1738
  <input type="checkbox" name="cachify[reset_on_comment]" id="cachify_reset_on_comment" value="1" <?php checked('1', $options['reset_on_comment']); ?> />
1739
+ <?php esc_html_e('Flush the cache at new comments', 'cachify') ?>
1740
  </label>
1741
  </fieldset>
1742
  </td>
1744
 
1745
  <tr valign="top">
1746
  <th scope="row">
1747
+ <?php esc_html_e('Cache exceptions', 'cachify') ?>
1748
  </th>
1749
  <td>
1750
  <fieldset>
1765
 
1766
  <tr valign="top">
1767
  <th scope="row">
1768
+ <?php esc_html_e('Cache minify', 'cachify') ?>
1769
  </th>
1770
  <td>
1771
  <label for="cachify_compress_html">
1785
  <?php submit_button() ?>
1786
  </th>
1787
  <td>
1788
+ <a href="http://playground.ebiene.de/cachify-wordpress-cache/" target="_blank"><?php esc_html_e('Manual', 'cachify') ?></a> &bull; <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=ZAQUT9RLPW8QN" target="_blank">PayPal</a> &bull; <a href="https://flattr.com/t/1327625" target="_blank">Flattr</a> &bull; <a href="https://www.amazon.de/registry/wishlist/2U5I7F9649LOJ/" target="_blank">Wishlist</a>
1789
  </td>
1790
  </tr>
1791
  </table>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: sergej.mueller
3
  Tags: apc, cache, caching, performance
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZAQUT9RLPW8QN
5
  Requires at least: 3.8
6
- Tested up to: 4.1
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -77,6 +77,10 @@ Fragen rund ums Plugin werden gern per E-Mail beantwortet. Beachtet auch die [Gu
77
 
78
  == Changelog ==
79
 
 
 
 
 
80
  = 2.2.1 =
81
  * Fix für die Meldung "Call to undefined function is_plugin_active_for_network" in WordPress-Multisite
82
 
3
  Tags: apc, cache, caching, performance
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZAQUT9RLPW8QN
5
  Requires at least: 3.8
6
+ Tested up to: 4.1.1
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
77
 
78
  == Changelog ==
79
 
80
+ = 2.2.2 =
81
+ * Fix: Parameter-Rückgabe beim Filter `dashboard_glance_items`
82
+ * Großzügige Anwendung des Filters `esc_html`
83
+
84
  = 2.2.1 =
85
  * Fix für die Meldung "Call to undefined function is_plugin_active_for_network" in WordPress-Multisite
86