Make WordPress Core


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

    r41584 r42343  
    2121
    2222        /**
    23          *
    2423         * @param array $args
    2524         */
    26         public function __construct($args = array()) {
    27                 $defaults = array( 'type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '' );
    28                 $args = wp_parse_args($args, $defaults);
     25        public function __construct( $args = array() ) {
     26                $defaults = array(
     27                        'type'   => 'web',
     28                        'url'    => '',
     29                        'plugin' => '',
     30                        'nonce'  => '',
     31                        'title'  => '',
     32                );
     33                $args     = wp_parse_args( $args, $defaults );
    2934
    3035                $this->type = $args['type'];
    31                 $this->api = isset($args['api']) ? $args['api'] : array();
     36                $this->api  = isset( $args['api'] ) ? $args['api'] : array();
    3237
    33                 parent::__construct($args);
     38                parent::__construct( $args );
    3439        }
    3540
    … …  
    3742         */
    3843        public function before() {
    39                 if ( !empty($this->api) )
    40                         $this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the plugin <strong>%s %s</strong>.'), $this->api->name, $this->api->version);
     44                if ( ! empty( $this->api ) ) {
     45                        $this->upgrader->strings['process_success'] = sprintf( __( 'Successfully installed the plugin <strong>%1$s %2$s</strong>.' ), $this->api->name, $this->api->version );
     46                }
    4147        }
    4248
    … …  
    4854                $install_actions = array();
    4955
    50                 $from = isset($_GET['from']) ? wp_unslash( $_GET['from'] ) : 'plugins';
     56                $from = isset( $_GET['from'] ) ? wp_unslash( $_GET['from'] ) : 'plugins';
    5157
    5258                if ( 'import' == $from ) {
    5359                        $install_actions['activate_plugin'] = '<a class="button button-primary" href="' . wp_nonce_url( 'plugins.php?action=activate&amp;from=import&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Activate Plugin &amp; Run Importer' ) . '</a>';
    54                 } else if ( 'press-this' == $from ) {
     60                } elseif ( 'press-this' == $from ) {
    5561                        $install_actions['activate_plugin'] = '<a class="button button-primary" href="' . wp_nonce_url( 'plugins.php?action=activate&amp;from=press-this&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Activate Plugin &amp; Return to Press This' ) . '</a>';
    5662                } else {
    … …  
    7379                }
    7480
    75                 if ( ! $this->result || is_wp_error($this->result) ) {
     81                if ( ! $this->result || is_wp_error( $this->result ) ) {
    7682                        unset( $install_actions['activate_plugin'], $install_actions['network_activate'] );
    7783                } elseif ( ! current_user_can( 'activate_plugin', $plugin_file ) ) {
Note: See TracChangeset for help on using the changeset viewer.