angelovcom.net

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

class-bulk-plugin-upgrader-skin.php (2065B)


      1 <?php
      2 /**
      3  * Upgrader API: Bulk_Plugin_Upgrader_Skin class
      4  *
      5  * @package WordPress
      6  * @subpackage Upgrader
      7  * @since 4.6.0
      8  */
      9 
     10 /**
     11  * Bulk Plugin Upgrader Skin for WordPress Plugin Upgrades.
     12  *
     13  * @since 3.0.0
     14  * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php.
     15  *
     16  * @see Bulk_Upgrader_Skin
     17  */
     18 class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
     19 	public $plugin_info = array(); // Plugin_Upgrader::bulk_upgrade() will fill this in.
     20 
     21 	public function add_strings() {
     22 		parent::add_strings();
     23 		/* translators: 1: Plugin name, 2: Number of the plugin, 3: Total number of plugins being updated. */
     24 		$this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)' );
     25 	}
     26 
     27 	/**
     28 	 * @param string $title
     29 	 */
     30 	public function before( $title = '' ) {
     31 		parent::before( $this->plugin_info['Title'] );
     32 	}
     33 
     34 	/**
     35 	 * @param string $title
     36 	 */
     37 	public function after( $title = '' ) {
     38 		parent::after( $this->plugin_info['Title'] );
     39 		$this->decrement_update_count( 'plugin' );
     40 	}
     41 
     42 	/**
     43 	 */
     44 	public function bulk_footer() {
     45 		parent::bulk_footer();
     46 
     47 		$update_actions = array(
     48 			'plugins_page' => sprintf(
     49 				'<a href="%s" target="_parent">%s</a>',
     50 				self_admin_url( 'plugins.php' ),
     51 				__( 'Go to Plugins page' )
     52 			),
     53 			'updates_page' => sprintf(
     54 				'<a href="%s" target="_parent">%s</a>',
     55 				self_admin_url( 'update-core.php' ),
     56 				__( 'Go to WordPress Updates page' )
     57 			),
     58 		);
     59 
     60 		if ( ! current_user_can( 'activate_plugins' ) ) {
     61 			unset( $update_actions['plugins_page'] );
     62 		}
     63 
     64 		/**
     65 		 * Filters the list of action links available following bulk plugin updates.
     66 		 *
     67 		 * @since 3.0.0
     68 		 *
     69 		 * @param string[] $update_actions Array of plugin action links.
     70 		 * @param array    $plugin_info    Array of information for the last-updated plugin.
     71 		 */
     72 		$update_actions = apply_filters( 'update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info );
     73 
     74 		if ( ! empty( $update_actions ) ) {
     75 			$this->feedback( implode( ' | ', (array) $update_actions ) );
     76 		}
     77 	}
     78 }