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