Changeset 1326085
- Timestamp:
- 01/11/2016 09:54:06 PM (10 years ago)
- Location:
- sf-category-menu/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (1 diff)
-
sf-category-menu.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sf-category-menu/trunk/readme.txt
r1319552 r1326085 20 20 * Translation ready 21 21 * Doesn't show empty categories 22 * Caching of the menu 22 23 23 24 = Live demo: = -
sf-category-menu/trunk/sf-category-menu.php
r1277377 r1326085 4 4 * Plugin Name: SF Category Menu Widget 5 5 * Plugin URI: http://studiofreya.com/sf-category-menu/ 6 * Description: Easy treeview menu for WordPress categories .7 * Version: 1. 36 * Description: Easy treeview menu for WordPress categories, with catergory caching 7 * Version: 1.4 8 8 * Author: Studiofreya AS 9 9 * Author URI: http://studiofreya.com … … 110 110 function widget( $args, $instance ) 111 111 { 112 $option_name = "sf_category_menu_cache"; 113 $option_created = "sf_category_menu_cache_created"; 114 $cached_content = get_option($option_name, false); 115 $cached_time = get_option($option_created, 0); 116 $now = time(); 117 118 if (!$cached_content || ($cached_time + 6*3600 < $now)) 119 { 120 ob_start(); 121 $this->do_create_data($args, $instance); 122 $output_content = ob_get_contents(); 123 124 // Save cached content 125 $autoload = true; // Menu is visible on most pages 126 update_option($option_name, $output_content, $autoload); 127 update_option($option_created, $now, $autoload); 128 } 129 else 130 { 131 echo $cached_content; 132 } 133 134 } 135 136 function do_create_data( $args, $instance ) 137 { 112 138 $exclude_categories = $instance['exclude_cat']; 113 139 $exclude_categories_arr = explode(",", $exclude_categories); … … 147 173 </script> 148 174 <?php 149 150 175 } 151 176
Note: See TracChangeset
for help on using the changeset viewer.