[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-admin/includes/ -> class-bulk-plugin-upgrader-skin.php (source)

   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  
  20      /**
  21       * Plugin info.
  22       *
  23       * The Plugin_Upgrader::bulk_upgrade() method will fill this in
  24       * with info retrieved from the get_plugin_data() function.
  25       *
  26       * @since 3.0.0
  27       * @var array Plugin data. Values will be empty if not supplied by the plugin.
  28       */
  29      public $plugin_info = array();
  30  
  31      /**
  32       * Sets up the strings used in the update process.
  33       *
  34       * @since 3.0.0
  35       */
  36  	public function add_strings() {
  37          parent::add_strings();
  38          /* translators: 1: Plugin name, 2: Number of the plugin, 3: Total number of plugins being updated. */
  39          $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)' );
  40      }
  41  
  42      /**
  43       * Performs an action before a bulk plugin update.
  44       *
  45       * @since 3.0.0
  46       *
  47       * @param string $title
  48       */
  49  	public function before( $title = '' ) {
  50          parent::before( $this->plugin_info['Title'] );
  51      }
  52  
  53      /**
  54       * Performs an action following a bulk plugin update.
  55       *
  56       * @since 3.0.0
  57       *
  58       * @param string $title
  59       */
  60  	public function after( $title = '' ) {
  61          parent::after( $this->plugin_info['Title'] );
  62          $this->decrement_update_count( 'plugin' );
  63      }
  64  
  65      /**
  66       * Displays the footer following the bulk update process.
  67       *
  68       * @since 3.0.0
  69       */
  70  	public function bulk_footer() {
  71          parent::bulk_footer();
  72  
  73          $update_actions = array(
  74              'plugins_page' => sprintf(
  75                  '<a href="%s" target="_parent">%s</a>',
  76                  self_admin_url( 'plugins.php' ),
  77                  __( 'Go to Plugins page' )
  78              ),
  79              'updates_page' => sprintf(
  80                  '<a href="%s" target="_parent">%s</a>',
  81                  self_admin_url( 'update-core.php' ),
  82                  __( 'Go to WordPress Updates page' )
  83              ),
  84          );
  85  
  86          if ( ! current_user_can( 'activate_plugins' ) ) {
  87              unset( $update_actions['plugins_page'] );
  88          }
  89  
  90          /**
  91           * Filters the list of action links available following bulk plugin updates.
  92           *
  93           * @since 3.0.0
  94           *
  95           * @param string[] $update_actions Array of plugin action links.
  96           * @param array    $plugin_info    Array of information for the last-updated plugin.
  97           */
  98          $update_actions = apply_filters( 'update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info );
  99  
 100          if ( ! empty( $update_actions ) ) {
 101              $this->feedback( implode( ' | ', (array) $update_actions ) );
 102          }
 103      }
 104  }


Generated : Fri May 10 08:20:01 2024 Cross-referenced by PHPXref