Make WordPress Core

Changeset 17765


Ignore:
Timestamp:
04/29/2011 02:44:43 PM (14 years ago)
Author:
nacin
Message:

Update the self-referential destruction sequence in WP_Widget_RSS to account for trailing slashes. TODO: Strengthen our validation here.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/dashboard.php

    r17764 r17765  
    926926 */
    927927function wp_dashboard_plugins_output() {
    928     $popular = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/popular/' );
    929     $new     = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/new/' );
    930     $updated = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/updated/' );
     928    ob_start();
     929    $check_urls = array(
     930        'http://wordpress.org/extend/plugins/rss/browse/popular/',
     931        'http://wordpress.org/extend/plugins/rss/browse/new/',
     932        'http://wordpress.org/extend/plugins/rss/browse/updated/'
     933    );
     934    $transient_key = __FUNCTION__ . serialize( '' ) . implode( '|', $check_urls );
     935
     936    $popular = fetch_feed( $check_urls[0] );
     937    $new     = fetch_feed( $check_urls[1] );
     938    $updated = fetch_feed( $check_urls[2] );
    931939
    932940    if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) {
     
    9991007        unset($$feed);
    10001008    }
     1009    set_transient( $transient_key, ob_get_flush() );
    10011010}
    10021011
     
    10191028    $loading = '<p class="widget-loading">' . __( 'Loading&#8230;' ) . '</p>';
    10201029
     1030    $widgets = get_option( 'dashboard_widget_options' );
     1031    $output_cache = 'dashboard_' . md5( $callback . serialize( isset( $widgets[$widget_id] ) ? $widgets[$widget_id] : '' ) . implode( '|', $check_urls ) );
     1032
    10211033    if ( empty($check_urls) ) {
    1022         $widgets = get_option( 'dashboard_widget_options' );
    10231034        if ( empty($widgets[$widget_id]['url']) ) {
    10241035            echo $loading;
     1036            delete_transient( $output_cache );
    10251037            return false;
    10261038        }
     
    10331045        if ( ! $cache->load() ) {
    10341046            echo $loading;
     1047            delete_transient( $output_cache );
    10351048            return false;
    10361049        }
    10371050    }
    10381051
     1052    if ( false === $cache = get_transient( $output_cache ) ) {
     1053        echo $loading;
     1054        return false;
     1055    }
     1056
     1057    echo $cache;
     1058    return true;
     1059    /*     
    10391060    if ( $callback && is_callable( $callback ) ) {
    10401061        $args = array_slice( func_get_args(), 2 );
     
    10441065
    10451066    return true;
     1067    */
    10461068}
    10471069
  • trunk/wp-includes/default-widgets.php

    r17667 r17765  
    714714
    715715        // self-url destruction sequence
    716         if ( $url == site_url() || $url == home_url() )
     716        if ( in_array( untrailingslashit( $url ), array( site_url(), home_url() ) ) )
    717717            return;
    718718
Note: See TracChangeset for help on using the changeset viewer.