wppaste
WordPress

Plugin_Installer_Skin

Since
2.8.0, 4.6.0
Source
wp-admin/includes/class-plugin-installer-skin.php:18
Plugin Installer Skin for WordPress Plugin Installer.

Compatibility

WordPress
since 4.6.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Hooks and filters fired · 3

Every hook that fires from inside Plugin_Installer_Skin, in the order it appears in the class, grouped by the method that fires it.

Properties · 5

$apipublic
$typepublic
$urlpublic
$overwritepublic
$is_downgradingprivate

Methods · 5

  • __construct()Constructor.
  • before()Performs an action before installing a plugin.
  • hide_process_failed()Hides the `process_failed` error when updating a plugin by uploading a zip file.
  • after()Performs an action following a plugin install.
  • do_overwrite()Checks if the plugin can be overwritten and outputs the HTML for overwriting a plugin on upload.

Source code

class Plugin_Installer_Skin extends WP_Upgrader_Skin {	public $api;	public $type;	public $url;	public $overwrite; 	private $is_downgrading = false; 	/**	 * Constructor.	 *	 * Sets up the plugin installer skin.	 *	 * @since 2.8.0	 *	 * @param array $args	 */	public function __construct( $args = array() ) {		$defaults = array(			'type'      => 'web',			'url'       => '',			'plugin'    => '',			'nonce'     => '',			'title'     => '',			'overwrite' => '',		);		$args     = wp_parse_args( $args, $defaults ); 		$this->type      = $args['type'];		$this->url       = $args['url'];		$this->api       = isset( $args['api'] ) ? $args['api'] : array();		$this->overwrite = $args['overwrite']; 		parent::__construct( $args );	} 	/**	 * Performs an action before installing a plugin.	 *	 * @since 2.8.0	 */	public function before() {		if ( ! empty( $this->api ) ) {			$this->upgrader->strings['process_success'] = sprintf(				$this->upgrader->strings['process_success_specific'],				$this->api->name,				$this->api->version			);		}	} 	/**	 * Hides the `process_failed` error when updating a plugin by uploading a zip file.	 *	 * @since 5.5.0	 *	 * @param WP_Error $wp_error WP_Error object.	 * @return bool True if the error should be hidden, false otherwise.	 */	public function hide_process_failed( $wp_error ) {		if (			'upload' === $this->type &&			'' === $this->overwrite &&			$wp_error->get_error_code() === 'folder_exists'		) {			return true;		} 		return false;	} 	/**	 * Performs an action following a plugin install.	 *	 * @since 2.8.0	 */	public function after() {		// Check if the plugin can be overwritten and output the HTML.		if ( $this->do_overwrite() ) {			return;

Changelog

Introduced in 2.8.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

4.6.0
Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php.from the docblock
2.8.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-admin/includes/class-plugin-installer-skin.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.