Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (7 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-theme-upgrader-skin.php

    r41797 r42343  
    2020
    2121    /**
    22      *
    2322     * @param array $args
    2423     */
    25     public function __construct($args = array()) {
    26         $defaults = array( 'url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Update Theme') );
    27         $args = wp_parse_args($args, $defaults);
     24    public function __construct( $args = array() ) {
     25        $defaults = array(
     26            'url'   => '',
     27            'theme' => '',
     28            'nonce' => '',
     29            'title' => __( 'Update Theme' ),
     30        );
     31        $args     = wp_parse_args( $args, $defaults );
    2832
    2933        $this->theme = $args['theme'];
    3034
    31         parent::__construct($args);
     35        parent::__construct( $args );
    3236    }
    3337
     
    3943        $update_actions = array();
    4044        if ( ! empty( $this->upgrader->result['destination_name'] ) && $theme_info = $this->upgrader->theme_info() ) {
    41             $name       = $theme_info->display('Name');
     45            $name       = $theme_info->display( 'Name' );
    4246            $stylesheet = $this->upgrader->result['destination_name'];
    4347            $template   = $theme_info->get_template();
    4448
    45             $activate_link = add_query_arg( array(
    46                 'action'     => 'activate',
    47                 'template'   => urlencode( $template ),
    48                 'stylesheet' => urlencode( $stylesheet ),
    49             ), admin_url('themes.php') );
     49            $activate_link = add_query_arg(
     50                array(
     51                    'action'     => 'activate',
     52                    'template'   => urlencode( $template ),
     53                    'stylesheet' => urlencode( $stylesheet ),
     54                ), admin_url( 'themes.php' )
     55            );
    5056            $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );
    5157
    5258            $customize_url = add_query_arg(
    5359                array(
    54                     'theme' => urlencode( $stylesheet ),
     60                    'theme'  => urlencode( $stylesheet ),
    5561                    'return' => urlencode( admin_url( 'themes.php' ) ),
    5662                ),
     
    5965            if ( get_stylesheet() == $stylesheet ) {
    6066                if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
    61                     $update_actions['preview']  = '<a href="' . esc_url( $customize_url ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Customize' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Customize &#8220;%s&#8221;' ), $name ) . '</span></a>';
     67                    $update_actions['preview'] = '<a href="' . esc_url( $customize_url ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Customize' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Customize &#8220;%s&#8221;' ), $name ) . '</span></a>';
    6268                }
    6369            } elseif ( current_user_can( 'switch_themes' ) ) {
     
    6874            }
    6975
    70             if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() )
     76            if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() ) {
    7177                unset( $update_actions['preview'], $update_actions['activate'] );
     78            }
    7279        }
    7380
     
    8491        $update_actions = apply_filters( 'update_theme_complete_actions', $update_actions, $this->theme );
    8592
    86         if ( ! empty($update_actions) )
    87             $this->feedback(implode(' | ', (array)$update_actions));
     93        if ( ! empty( $update_actions ) ) {
     94            $this->feedback( implode( ' | ', (array) $update_actions ) );
     95        }
    8896    }
    8997}
Note: See TracChangeset for help on using the changeset viewer.