WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (4 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-plugin-upgrader-skin.php

    r41290 r42343  
    1717 */
    1818class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
    19     public $plugin = '';
    20     public $plugin_active = false;
     19    public $plugin                = '';
     20    public $plugin_active         = false;
    2121    public $plugin_network_active = false;
    2222
    2323    /**
    24      *
    2524     * @param array $args
    2625     */
    2726    public function __construct( $args = array() ) {
    28         $defaults = array( 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => __('Update Plugin') );
    29         $args = wp_parse_args($args, $defaults);
     27        $defaults = array(
     28            'url'    => '',
     29            'plugin' => '',
     30            'nonce'  => '',
     31            'title'  => __( 'Update Plugin' ),
     32        );
     33        $args     = wp_parse_args( $args, $defaults );
    3034
    3135        $this->plugin = $args['plugin'];
    3236
    33         $this->plugin_active = is_plugin_active( $this->plugin );
     37        $this->plugin_active         = is_plugin_active( $this->plugin );
    3438        $this->plugin_network_active = is_plugin_active_for_network( $this->plugin );
    3539
    36         parent::__construct($args);
     40        parent::__construct( $args );
    3741    }
    3842
     
    4145    public function after() {
    4246        $this->plugin = $this->upgrader->plugin_info();
    43         if ( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){
     47        if ( ! empty( $this->plugin ) && ! is_wp_error( $this->result ) && $this->plugin_active ) {
    4448            // Currently used only when JS is off for a single plugin update?
    4549            echo '<iframe title="' . esc_attr__( 'Update progress' ) . '" style="border:0;overflow:hidden" width="100%" height="170" src="' . wp_nonce_url( 'update.php?action=activate-plugin&networkwide=' . $this->plugin_network_active . '&plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin ) . '"></iframe>';
     
    4852        $this->decrement_update_count( 'plugin' );
    4953
    50         $update_actions =  array(
    51             'activate_plugin' => '<a href="' . wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin) . '" target="_parent">' . __( 'Activate Plugin' ) . '</a>',
    52             'plugins_page' => '<a href="' . self_admin_url( 'plugins.php' ) . '" target="_parent">' . __( 'Return to Plugins page' ) . '</a>'
     54        $update_actions = array(
     55            'activate_plugin' => '<a href="' . wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin ) . '" target="_parent">' . __( 'Activate Plugin' ) . '</a>',
     56            'plugins_page'    => '<a href="' . self_admin_url( 'plugins.php' ) . '" target="_parent">' . __( 'Return to Plugins page' ) . '</a>',
    5357        );
    54         if ( $this->plugin_active || ! $this->result || is_wp_error( $this->result ) || ! current_user_can( 'activate_plugin', $this->plugin ) )
     58        if ( $this->plugin_active || ! $this->result || is_wp_error( $this->result ) || ! current_user_can( 'activate_plugin', $this->plugin ) ) {
    5559            unset( $update_actions['activate_plugin'] );
     60        }
    5661
    5762        /**
     
    6570        $update_actions = apply_filters( 'update_plugin_complete_actions', $update_actions, $this->plugin );
    6671
    67         if ( ! empty($update_actions) )
    68             $this->feedback(implode(' | ', (array)$update_actions));
     72        if ( ! empty( $update_actions ) ) {
     73            $this->feedback( implode( ' | ', (array) $update_actions ) );
     74        }
    6975    }
    7076}
Note: See TracChangeset for help on using the changeset viewer.