wp/wp-admin/includes/class-plugin-installer-skin.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
--- a/wp/wp-admin/includes/class-plugin-installer-skin.php	Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-admin/includes/class-plugin-installer-skin.php	Mon Oct 14 18:28:13 2019 +0200
@@ -20,24 +20,31 @@
 	public $type;
 
 	/**
-	 *
 	 * @param array $args
 	 */
-	public function __construct($args = array()) {
-		$defaults = array( 'type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '' );
-		$args = wp_parse_args($args, $defaults);
+	public function __construct( $args = array() ) {
+		$defaults = array(
+			'type'   => 'web',
+			'url'    => '',
+			'plugin' => '',
+			'nonce'  => '',
+			'title'  => '',
+		);
+		$args     = wp_parse_args( $args, $defaults );
 
 		$this->type = $args['type'];
-		$this->api = isset($args['api']) ? $args['api'] : array();
+		$this->api  = isset( $args['api'] ) ? $args['api'] : array();
 
-		parent::__construct($args);
+		parent::__construct( $args );
 	}
 
 	/**
 	 */
 	public function before() {
-		if ( !empty($this->api) )
-			$this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the plugin <strong>%s %s</strong>.'), $this->api->name, $this->api->version);
+		if ( ! empty( $this->api ) ) {
+			/* translators: 1: name of API, 2: version of API */
+			$this->upgrader->strings['process_success'] = sprintf( __( 'Successfully installed the plugin <strong>%1$s %2$s</strong>.' ), $this->api->name, $this->api->version );
+		}
 	}
 
 	/**
@@ -47,11 +54,11 @@
 
 		$install_actions = array();
 
-		$from = isset($_GET['from']) ? wp_unslash( $_GET['from'] ) : 'plugins';
+		$from = isset( $_GET['from'] ) ? wp_unslash( $_GET['from'] ) : 'plugins';
 
 		if ( 'import' == $from ) {
 			$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>';
-		} else if ( 'press-this' == $from ) {
+		} elseif ( 'press-this' == $from ) {
 			$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>';
 		} else {
 			$install_actions['activate_plugin'] = '<a class="button button-primary" href="' . wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Activate Plugin' ) . '</a>';
@@ -72,7 +79,7 @@
 			$install_actions['plugins_page'] = '<a href="' . self_admin_url( 'plugins.php' ) . '" target="_parent">' . __( 'Return to Plugins page' ) . '</a>';
 		}
 
-		if ( ! $this->result || is_wp_error($this->result) ) {
+		if ( ! $this->result || is_wp_error( $this->result ) ) {
 			unset( $install_actions['activate_plugin'], $install_actions['network_activate'] );
 		} elseif ( ! current_user_can( 'activate_plugin', $plugin_file ) ) {
 			unset( $install_actions['activate_plugin'] );
@@ -83,11 +90,11 @@
 		 *
 		 * @since 2.7.0
 		 *
-		 * @param array  $install_actions Array of plugin action links.
-		 * @param object $api             Object containing WordPress.org API plugin data. Empty
-		 *                                for non-API installs, such as when a plugin is installed
-		 *                                via upload.
-		 * @param string $plugin_file     Path to the plugin file.
+		 * @param string[] $install_actions Array of plugin action links.
+		 * @param object   $api             Object containing WordPress.org API plugin data. Empty
+		 *                                  for non-API installs, such as when a plugin is installed
+		 *                                  via upload.
+		 * @param string   $plugin_file     Path to the plugin file relative to the plugins directory.
 		 */
 		$install_actions = apply_filters( 'install_plugin_complete_actions', $install_actions, $this->api, $plugin_file );