WordPress.org

Make WordPress Core

Ticket #22856: 22856.diff

File 22856.diff, 1.2 KB (added by nacin, 3 years ago)
  • trunk/hotfix.php

     
    157157 
    158158function wp_hotfix_350_twentytwelve() { 
    159159        add_action( 'pre_http_request', 'wp_hotfix_350_twentytwelve_pre_http_request', 10, 3 ); 
     160        add_action( 'load-themes.php', 'wp_hotfix_350_twentytwelve_themes_php' ); 
    160161} 
    161162 
     163function wp_hotfix_350_twentytwelve_themes_php() { 
     164        $theme = wp_get_theme('twentytwelve'); 
     165        if ( ! $theme->exists() || ! $theme->errors() ) 
     166                return; 
     167 
     168        // Non-English installs weren't affected. Save us a translation! 
     169        if ( 'en_US' != get_locale() ) 
     170                return; 
     171 
     172        if ( current_user_can( 'update_themes' ) ) 
     173                add_action( 'admin_notices', 'wp_hotfix_350_twentytwelve_notice' ); 
     174} 
     175 
     176function wp_hotfix_350_twentytwelve_notice() { 
     177        printf( '<div class="error"><p>Looking for Twenty Twelve? You will need to first update it at <a href="%s">Dashboard &rarr; Updates</a>.', 
     178                self_admin_url( 'update-core.php' ) ); 
     179} 
     180 
    162181function wp_hotfix_350_twentytwelve_pre_http_request( $return, $args, $url ) { 
    163182        if ( $url != 'http://api.wordpress.org/themes/update-check/1.0/' ) 
    164183                return $return;