Changeset 18228 for trunk/wp-admin/includes/dashboard.php
- Timestamp:
- 06/10/2011 06:31:39 AM (15 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/dashboard.php (modified) (3 diffs)
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
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)