Changeset 18228
- Timestamp:
- 06/10/2011 06:31:39 AM (14 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/dashboard.php
r18150 r18228 1032 1032 function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) { 1033 1033 $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>'; 1034 $doing_ajax = ( defined('DOING_AJAX') && DOING_AJAX ); 1034 1035 1035 1036 if ( empty($check_urls) ) { 1036 1037 $widgets = get_option( 'dashboard_widget_options' ); 1037 if ( empty($widgets[$widget_id]['url']) ) {1038 if ( empty($widgets[$widget_id]['url']) && ! $doing_ajax ) { 1038 1039 echo $loading; 1039 1040 return false; … … 1042 1043 } 1043 1044 1044 include_once ABSPATH . WPINC . '/class-feed.php'; 1045 foreach ( $check_urls as $check_url ) { 1046 $cache = new WP_Feed_Cache_Transient('', md5($check_url), ''); 1047 if ( ! $cache->load() ) { 1048 echo $loading; 1049 return false; 1050 } 1045 $cache_key = 'dash_' . md5( $callback . implode(',', $check_urls) ); 1046 if ( false !== ( $output = get_transient( $cache_key ) ) ) { 1047 echo $output; 1048 return true; 1049 } 1050 1051 if ( ! $doing_ajax ) { 1052 echo $loading; 1053 return false; 1051 1054 } 1052 1055 … … 1054 1057 $args = array_slice( func_get_args(), 2 ); 1055 1058 array_unshift( $args, $widget_id ); 1059 ob_start(); 1056 1060 call_user_func_array( $callback, $args ); 1061 set_transient( $cache_key, ob_get_flush(), 43200); // Default lifetime in cache of 12 hours (same as the feeds) 1057 1062 } 1058 1063 -
trunk/wp-admin/index-extra.php
r17743 r18228 6 6 * @subpackage Administration 7 7 */ 8 9 define('DOING_AJAX', true); 8 10 9 11 /** Load WordPress Bootstrap */ … … 19 21 20 22 case 'dashboard_incoming_links' : 21 wp_dashboard_incoming_links _output();23 wp_dashboard_incoming_links(); 22 24 break; 23 25 24 26 case 'dashboard_primary' : 25 wp_dashboard_ rss_output( 'dashboard_primary');27 wp_dashboard_primary(); 26 28 break; 27 29 28 30 case 'dashboard_secondary' : 29 wp_dashboard_secondary _output();31 wp_dashboard_secondary(); 30 32 break; 31 33 32 34 case 'dashboard_plugins' : 33 wp_dashboard_plugins _output();35 wp_dashboard_plugins(); 34 36 break; 35 37
Note: See TracChangeset
for help on using the changeset viewer.