Make WordPress Core


Ignore:
Timestamp:
04/15/2014 01:15:43 AM (12 years ago)
Author:
nacin
Message:

Theme Installer: Revert to proxying through PHP for WordPress.org API requests.

This is to ensure we have valid installation nonces, though we've run into this as a problem previously (see #27639, #27581, #27055).

A tad slower, but we gained speed in 3.9 by simplifying the request made to the API.

props ocean90.
fixes #27798.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/theme-install.php

    r28123 r28126  
    4747        'canInstall'    => current_user_can( 'install_themes' ),
    4848        'installURI'    => current_user_can( 'install_themes' ) ? self_admin_url( 'theme-install.php' ) : null,
    49         'adminUrl'      => parse_url( self_admin_url(), PHP_URL_PATH ),
    50         'updateURI'     => self_admin_url( 'update.php' ),
    51         '_nonceInstall' => wp_create_nonce( 'install-theme' )
     49        'adminUrl'      => parse_url( self_admin_url(), PHP_URL_PATH )
    5250    ),
    5351    'l10n' => array(
     
    5755        'upload' => __( 'Upload Theme' ),
    5856        'back'   => __( 'Back' ),
    59         'error'  => sprintf( __( 'An unexpected error occurred and we can&#8127;t reach WordPress.org. If you continue to have problems, please try the <a href="%s">support forums</a>.' ), __( 'https://wordpress.org/support/' ) )
     57        'error'  => __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' )
    6058    ),
    6159    'installedThemes' => array_keys( $installed_themes ),
     
    200198
    201199    <div class="theme-actions">
    202         <a class="button button-primary" href="{{ data.installURI }}"><?php esc_html_e( 'Install' ); ?></a>
     200        <a class="button button-primary" href="{{ data.install_url }}"><?php esc_html_e( 'Install' ); ?></a>
    203201        <a class="button button-secondary preview install-theme-preview" href="#"><?php esc_html_e( 'Preview' ); ?></a>
    204202    </div>
     
    216214            <a href="#" class="button button-primary theme-install disabled"><?php _e( 'Installed' ); ?></a>
    217215        <# } else { #>
    218             <a href="{{ data.installURI }}" class="button button-primary theme-install"><?php _e( 'Install' ); ?></a>
     216            <a href="{{ data.install_url }}" class="button button-primary theme-install"><?php _e( 'Install' ); ?></a>
    219217        <# } #>
    220218        </div>
     
    234232                        <span class="five"></span>
    235233                    <# if ( data.num_ratings ) { #>
    236                         <p class="ratings">({{ data.num_ratings }})</p>
     234                        <p class="ratings">{{ data.num_ratings }}</p>
    237235                    <# } else { #>
    238236                        <p class="ratings"><?php _e( 'No ratings.' ); ?></p>
Note: See TracChangeset for help on using the changeset viewer.