WordPress.org

Plugin Directory

Changeset 637271


Ignore:
Timestamp:
12/11/12 20:35:44 (16 months ago)
Author:
nacin
Message:

Hotfix for Twenty Twelve upgrade issues. See http://core.trac.wordpress.org/ticket/22856.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • hotfix/trunk/hotfix.php

    r595988 r637271  
    3535 
    3636    switch ( $wp_version ) { 
     37        case '3.5' : 
     38            $hotfixes = array( '350_twentytwelve' ); 
     39            break; 
    3740        case '3.4.2' : 
    3841            $hotfixes = array( '342_custom_fields' ); 
     
    152155    <?php 
    153156} 
     157 
     158function wp_hotfix_350_twentytwelve() { 
     159    add_action( 'pre_http_request', 'wp_hotfix_350_twentytwelve_pre_http_request', 10, 3 ); 
     160} 
     161 
     162function wp_hotfix_350_twentytwelve_pre_http_request( $return, $args, $url ) { 
     163    if ( $url != 'http://api.wordpress.org/themes/update-check/1.0/' ) 
     164        return $return; 
     165 
     166    if ( ! empty( $args['_twentytwelve_hijack'] ) ) 
     167        return $return; 
     168 
     169    $theme = wp_get_theme('twentytwelve'); 
     170    if ( ! $theme->exists() || ! $theme->errors() ) 
     171        return $return; 
     172 
     173    $args['_twentytwelve_hijack'] = true; 
     174 
     175    $themes = unserialize( $args['body']['themes'] ); 
     176    $themes['twentytwelve'] = array( 
     177        'Name'       => 'Twenty Twelve', 
     178        'Title'      => 'Twenty Twelve', 
     179        'Version'    => '1.1', 
     180        'Author'     => 'the WordPress team', 
     181        'Author URI' => 'http://wordpress.org/', 
     182        'Template'   => 'twentytwelve', 
     183        'Stylesheet' => 'twentytwelve', 
     184    ); 
     185    $args['body']['themes'] = serialize( $themes ); 
     186    return wp_remote_post( $url, $args ); 
     187} 
     188 
Note: See TracChangeset for help on using the changeset viewer.