| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
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 /** 20 * The upgrader instance. 21 * 22 * @since 2.8.0 23 * @var Plugin_Upgrader 24 */ 25 public $upgrader; 26 27 /** 28 * Holds the plugin slug in the Plugin Directory. 29 * 30 * @since 2.8.0 31 * 32 * @var string 33 */ 34 public $plugin = ''; 35 36 /** 37 * Whether the plugin is active. 38 * 39 * @since 2.8.0 40 * 41 * @var bool 42 */ 43 public $plugin_active = false; 44 45 /** 46 * Whether the plugin is active for the entire network. 47 * 48 * @since 2.8.0 49 * 50 * @var bool 51 */ 52 public $plugin_network_active = false; 53 54 /** 55 * Constructor. 56 * 57 * Sets up the plugin upgrader skin. 58 * 59 * @since 2.8.0 60 * 61 * @param array $args Optional. The plugin upgrader skin arguments to 62 * override default options. Default empty array. 63 */ 64 public function __construct( $args = array() ) { 65 $defaults = array( 66 'url' => '', 67 'plugin' => '', 68 'nonce' => '', 69 'title' => __( 'Update Plugin' ), 70 ); 71 $args = wp_parse_args( $args, $defaults ); 72 73 $this->plugin = $args['plugin']; 74 75 $this->plugin_active = is_plugin_active( $this->plugin ); 76 $this->plugin_network_active = is_plugin_active_for_network( $this->plugin ); 77 78 parent::__construct( $args ); 79 } 80 81 /** 82 * Performs an action following a single plugin update. 83 * 84 * @since 2.8.0 85 */ 86 public function after() { 87 $this->plugin = $this->upgrader->plugin_info(); 88 if ( ! empty( $this->plugin ) && ! is_wp_error( $this->result ) && $this->plugin_active ) { 89 // Currently used only when JS is off for a single plugin update? 90 printf( 91 '<iframe title="%s" style="border:0;overflow:hidden" width="100%%" height="170" src="%s"></iframe>', 92 esc_attr__( 'Update progress' ), 93 wp_nonce_url( 'update.php?action=activate-plugin&networkwide=' . $this->plugin_network_active . '&plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin ) 94 ); 95 } 96 97 $this->decrement_update_count( 'plugin' ); 98 99 $update_actions = array( 100 'activate_plugin' => sprintf( 101 '<a href="%s" target="_parent">%s</a>', 102 wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin ), 103 __( 'Activate Plugin' ) 104 ), 105 'plugins_page' => sprintf( 106 '<a href="%s" target="_parent">%s</a>', 107 self_admin_url( 'plugins.php' ), 108 __( 'Go to Plugins page' ) 109 ), 110 ); 111 112 if ( $this->plugin_active || ! $this->result || is_wp_error( $this->result ) || ! current_user_can( 'activate_plugin', $this->plugin ) ) { 113 unset( $update_actions['activate_plugin'] ); 114 } 115 116 /** 117 * Filters the list of action links available following a single plugin update. 118 * 119 * @since 2.7.0 120 * 121 * @param string[] $update_actions Array of plugin action links. 122 * @param string $plugin Path to the plugin file relative to the plugins directory. 123 */ 124 $update_actions = apply_filters( 'update_plugin_complete_actions', $update_actions, $this->plugin ); 125 126 if ( ! empty( $update_actions ) ) { 127 $this->feedback( implode( ' | ', (array) $update_actions ) ); 128 } 129 } 130 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Fri Sep 4 08:20:24 2026 | Cross-referenced by PHPXref |