Changeset 862895
- Timestamp:
- 02/22/2014 05:30:10 AM (12 years ago)
- Location:
- voce-widget-cache/trunk
- Files:
-
- 1 added
- 3 edited
-
. (modified) (1 prop)
-
README.mdown (added)
-
readme.txt (modified) (4 diffs)
-
voce-widget-cache.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
voce-widget-cache/trunk
- Property svn:ignore
-
old new 1 deploy.sh 1 wpsvn-deploy 2 2 README.md 3 test 4 tests 3 5 .git 4 6 .gitignore
-
- Property svn:ignore
-
voce-widget-cache/trunk/readme.txt
r631819 r862895 1 === Plugin Name ===1 === Voce Widget Cache === 2 2 Contributors: johnciacia, markparolisi, voceplatforms 3 3 Tags: widget 4 4 Requires at least: 3.3 5 5 Tested up to: 3.4 6 Stable tag: 1. 16 Stable tag: 1.3 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 9 10 Cache widget output for better performance.10 Easily cache widget output for better performance. 11 11 12 12 == Description == … … 18 18 $widget_cache = Voce_Widget_Cache::GetInstance(); 19 19 $widget_cache->cache_widget( 'Archive_Links_Widget', array( 'save_post' ) ); 20 $widget_cache->cache_widget( 'WP_Widget_Recent_Posts' ); 20 21 ` 21 22 22 23 23 == Installation == 24 24 25 25 1. Upload `voce-widget-cache` to the `/wp-content/plugins/` directory 26 1. Activate the plugin through the 'Plugins' menu in WordPress27 1. Usage:28 26 2. Activate the plugin through the 'Plugins' menu in WordPress 27 3. Usage: 28 ` 29 29 $widget_cache = Voce_Widget_Cache::GetInstance(); 30 30 $widget_cache->cache_widget( 'Archive_Links_Widget', array( 'save_post' ) ); 31 31 $widget_cache->cache_widget( 'WP_Widget_Recent_Posts' ); 32 ` 32 33 33 34 == Frequently Asked Questions == … … 36 37 37 38 The caching is not automatic. Refer to the documentation to see how to implement caching on widgets. 38 39 39 40 40 = How can I verify my widgets are being cached? = … … 46 46 == Changelog == 47 47 48 = 1.3 = 49 Fix PHP Warning is widget array is not set. 50 51 = 1.2 = 52 Hooks to clear a widget's cache are now optional. 53 48 54 = 1.1 = 49 55 Updated documentation. -
voce-widget-cache/trunk/voce-widget-cache.php
r631819 r862895 4 4 Plugin URI: http://voceconnect.com 5 5 Description: Serve cached WordPress Widgets. 6 Version: 1. 16 Version: 1.3 7 7 Author: John Ciacia, Mark Parolisi 8 8 License: GPL2 … … 75 75 * @param $hooks an array of hooks to clear the widget from the cache 76 76 */ 77 public function cache_widget( $widget_class, array $hooks ) {77 public function cache_widget( $widget_class, array $hooks = array() ) { 78 78 $this->widget_classes[] = $widget_class; 79 foreach( $hooks as $hook ){ 80 add_action( "$hook", create_function( '', "Voce_Widget_Cache::GetInstance()->delete_cached_widgets('$widget_class');" ) ); 79 if ( ! empty( $hooks ) ) { 80 foreach( $hooks as $hook ){ 81 add_action( "$hook", create_function( '', "Voce_Widget_Cache::GetInstance()->delete_cached_widgets('$widget_class');" ) ); 82 } 81 83 } 82 84 return $this; … … 123 125 */ 124 126 public function delete_cached_widgets( $widget_class ) { 125 foreach( $this->widget_ids[$widget_class] as $widget ){ 126 $this->delete( $widget ); 127 if( is_array( $this->widget_ids[$widget_class] ) ){ 128 foreach( $this->widget_ids[$widget_class] as $widget ){ 129 $this->delete( $widget ); 130 } 127 131 } 128 132 }
Note: See TracChangeset
for help on using the changeset viewer.