[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

title

Body

[close]

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

   1  <?php
   2  /**
   3   * Upgrader API: Plugin_Upgrader_Skin class
   4   *
   5   * @package WordPress
   6   * @subpackage Upgrader
   7   * @since 4.6.0
   8   */
   9  
  10  /**
  11   * Plugin Upgrader Skin for WordPress Plugin Upgrades.
  12   *
  13   * @since 2.8.0
  14   * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php.
  15   *
  16   * @see WP_Upgrader_Skin
  17   */
  18  class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
  19      public $plugin                = '';
  20      public $plugin_active         = false;
  21      public $plugin_network_active = false;
  22  
  23      /**
  24       * @param array $args
  25       */
  26  	public function __construct( $args = array() ) {
  27          $defaults = array(
  28              'url'    => '',
  29              'plugin' => '',
  30              'nonce'  => '',
  31              'title'  => __( 'Update Plugin' ),
  32          );
  33          $args     = wp_parse_args( $args, $defaults );
  34  
  35          $this->plugin = $args['plugin'];
  36  
  37          $this->plugin_active         = is_plugin_active( $this->plugin );
  38          $this->plugin_network_active = is_plugin_active_for_network( $this->plugin );
  39  
  40          parent::__construct( $args );
  41      }
  42  
  43      /**
  44       */
  45  	public function after() {
  46          $this->plugin = $this->upgrader->plugin_info();
  47          if ( ! empty( $this->plugin ) && ! is_wp_error( $this->result ) && $this->plugin_active ) {
  48              // Currently used only when JS is off for a single plugin update?
  49              printf(
  50                  '<iframe title="%s" style="border:0;overflow:hidden" width="100%%" height="170" src="%s"></iframe>',
  51                  esc_attr__( 'Update progress' ),
  52                  wp_nonce_url( 'update.php?action=activate-plugin&networkwide=' . $this->plugin_network_active . '&plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin )
  53              );
  54          }
  55  
  56          $this->decrement_update_count( 'plugin' );
  57  
  58          $update_actions = array(
  59              'activate_plugin' => sprintf(
  60                  '<a href="%s" target="_parent">%s</a>',
  61                  wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin ),
  62                  __( 'Activate Plugin' )
  63              ),
  64              'plugins_page'    => sprintf(
  65                  '<a href="%s" target="_parent">%s</a>',
  66                  self_admin_url( 'plugins.php' ),
  67                  __( 'Return to Plugins page' )
  68              ),
  69          );
  70  
  71          if ( $this->plugin_active || ! $this->result || is_wp_error( $this->result ) || ! current_user_can( 'activate_plugin', $this->plugin ) ) {
  72              unset( $update_actions['activate_plugin'] );
  73          }
  74  
  75          /**
  76           * Filters the list of action links available following a single plugin update.
  77           *
  78           * @since 2.7.0
  79           *
  80           * @param string[] $update_actions Array of plugin action links.
  81           * @param string   $plugin         Path to the plugin file relative to the plugins directory.
  82           */
  83          $update_actions = apply_filters( 'update_plugin_complete_actions', $update_actions, $this->plugin );
  84  
  85          if ( ! empty( $update_actions ) ) {
  86              $this->feedback( implode( ' | ', (array) $update_actions ) );
  87          }
  88      }
  89  }


Generated: Sat Nov 23 20:47:33 2019 Cross-referenced by PHPXref 0.7