author | ymh <ymh.work@gmail.com> |
Mon, 14 Oct 2019 17:39:30 +0200 | |
changeset 7 | cf61fcea0001 |
parent 5 | 5e2f62d02dcd |
child 9 | 177826044cd9 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* Plugins administration panel. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
8 |
||
9 |
/** WordPress Administration Bootstrap */ |
|
10 |
require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 |
||
12 |
if ( ! current_user_can('activate_plugins') ) |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
13 |
wp_die( __( 'Sorry, you are not allowed to manage plugins for this site.' ) ); |
0 | 14 |
|
15 |
$wp_list_table = _get_list_table('WP_Plugins_List_Table'); |
|
16 |
$pagenum = $wp_list_table->get_pagenum(); |
|
17 |
||
18 |
$action = $wp_list_table->current_action(); |
|
19 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
20 |
$plugin = isset($_REQUEST['plugin']) ? wp_unslash( $_REQUEST['plugin'] ) : ''; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
21 |
$s = isset($_REQUEST['s']) ? urlencode( wp_unslash( $_REQUEST['s'] ) ) : ''; |
0 | 22 |
|
23 |
// Clean up request URI from temporary args for screen options/paging uri's to work as expected. |
|
24 |
$_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'), $_SERVER['REQUEST_URI']); |
|
25 |
||
5 | 26 |
wp_enqueue_script( 'updates' ); |
27 |
||
0 | 28 |
if ( $action ) { |
29 |
||
30 |
switch ( $action ) { |
|
31 |
case 'activate': |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
32 |
if ( ! current_user_can( 'activate_plugin', $plugin ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
33 |
wp_die( __( 'Sorry, you are not allowed to activate this plugin.' ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
34 |
} |
0 | 35 |
|
36 |
if ( is_multisite() && ! is_network_admin() && is_network_only_plugin( $plugin ) ) { |
|
37 |
wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
|
38 |
exit; |
|
39 |
} |
|
40 |
||
41 |
check_admin_referer('activate-plugin_' . $plugin); |
|
42 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
43 |
$result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin=' . urlencode( $plugin ) ), is_network_admin() ); |
0 | 44 |
if ( is_wp_error( $result ) ) { |
45 |
if ( 'unexpected_output' == $result->get_error_code() ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
46 |
$redirect = self_admin_url('plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . urlencode( $plugin ) . "&plugin_status=$status&paged=$page&s=$s"); |
0 | 47 |
wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); |
48 |
exit; |
|
49 |
} else { |
|
50 |
wp_die($result); |
|
51 |
} |
|
52 |
} |
|
53 |
||
54 |
if ( ! is_network_admin() ) { |
|
55 |
$recent = (array) get_option( 'recently_activated' ); |
|
56 |
unset( $recent[ $plugin ] ); |
|
57 |
update_option( 'recently_activated', $recent ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
58 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
59 |
$recent = (array) get_site_option( 'recently_activated' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
60 |
unset( $recent[ $plugin ] ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
61 |
update_site_option( 'recently_activated', $recent ); |
0 | 62 |
} |
63 |
||
64 |
if ( isset($_GET['from']) && 'import' == $_GET['from'] ) { |
|
65 |
wp_redirect( self_admin_url("import.php?import=" . str_replace('-importer', '', dirname($plugin))) ); // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
66 |
} else if ( isset($_GET['from']) && 'press-this' == $_GET['from'] ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
67 |
wp_redirect( self_admin_url( "press-this.php") ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
68 |
} else if ( isset( $_GET['from'] ) && 'try-gutenberg' == $_GET['from'] ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
69 |
if ( 'gutenberg/gutenberg.php' === $plugin ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
70 |
wp_redirect( self_admin_url( "admin.php?page=gutenberg" ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
71 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
72 |
wp_redirect( self_admin_url() ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
73 |
} |
0 | 74 |
} else { |
75 |
wp_redirect( self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s") ); // overrides the ?error=true one above |
|
76 |
} |
|
77 |
exit; |
|
5 | 78 |
|
0 | 79 |
case 'activate-selected': |
80 |
if ( ! current_user_can('activate_plugins') ) |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
81 |
wp_die(__('Sorry, you are not allowed to activate plugins for this site.')); |
0 | 82 |
|
83 |
check_admin_referer('bulk-plugins'); |
|
84 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
85 |
$plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array(); |
0 | 86 |
|
87 |
if ( is_network_admin() ) { |
|
88 |
foreach ( $plugins as $i => $plugin ) { |
|
5 | 89 |
// Only activate plugins which are not already network activated. |
90 |
if ( is_plugin_active_for_network( $plugin ) ) { |
|
0 | 91 |
unset( $plugins[ $i ] ); |
5 | 92 |
} |
0 | 93 |
} |
94 |
} else { |
|
95 |
foreach ( $plugins as $i => $plugin ) { |
|
5 | 96 |
// Only activate plugins which are not already active and are not network-only when on Multisite. |
97 |
if ( is_plugin_active( $plugin ) || ( is_multisite() && is_network_only_plugin( $plugin ) ) ) { |
|
0 | 98 |
unset( $plugins[ $i ] ); |
5 | 99 |
} |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
100 |
// Only activate plugins which the user can activate. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
101 |
if ( ! current_user_can( 'activate_plugin', $plugin ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
102 |
unset( $plugins[ $i ] ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
103 |
} |
0 | 104 |
} |
105 |
} |
|
106 |
||
107 |
if ( empty($plugins) ) { |
|
108 |
wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
|
109 |
exit; |
|
110 |
} |
|
111 |
||
112 |
activate_plugins($plugins, self_admin_url('plugins.php?error=true'), is_network_admin() ); |
|
113 |
||
114 |
if ( ! is_network_admin() ) { |
|
115 |
$recent = (array) get_option('recently_activated' ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
116 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
117 |
$recent = (array) get_site_option('recently_activated' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
118 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
119 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
120 |
foreach ( $plugins as $plugin ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
121 |
unset( $recent[ $plugin ] ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
122 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
123 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
124 |
if ( ! is_network_admin() ) { |
0 | 125 |
update_option( 'recently_activated', $recent ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
126 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
127 |
update_site_option( 'recently_activated', $recent ); |
0 | 128 |
} |
129 |
||
130 |
wp_redirect( self_admin_url("plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s") ); |
|
131 |
exit; |
|
5 | 132 |
|
0 | 133 |
case 'update-selected' : |
134 |
||
135 |
check_admin_referer( 'bulk-plugins' ); |
|
136 |
||
137 |
if ( isset( $_GET['plugins'] ) ) |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
138 |
$plugins = explode( ',', wp_unslash( $_GET['plugins'] ) ); |
0 | 139 |
elseif ( isset( $_POST['checked'] ) ) |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
140 |
$plugins = (array) wp_unslash( $_POST['checked'] ); |
0 | 141 |
else |
142 |
$plugins = array(); |
|
143 |
||
144 |
$title = __( 'Update Plugins' ); |
|
145 |
$parent_file = 'plugins.php'; |
|
146 |
||
5 | 147 |
wp_enqueue_script( 'updates' ); |
0 | 148 |
require_once(ABSPATH . 'wp-admin/admin-header.php'); |
149 |
||
150 |
echo '<div class="wrap">'; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
151 |
echo '<h1>' . esc_html( $title ) . '</h1>'; |
0 | 152 |
|
153 |
$url = self_admin_url('update.php?action=update-selected&plugins=' . urlencode( join(',', $plugins) )); |
|
154 |
$url = wp_nonce_url($url, 'bulk-update-plugins'); |
|
155 |
||
156 |
echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>"; |
|
157 |
echo '</div>'; |
|
158 |
require_once(ABSPATH . 'wp-admin/admin-footer.php'); |
|
159 |
exit; |
|
5 | 160 |
|
0 | 161 |
case 'error_scrape': |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
162 |
if ( ! current_user_can( 'activate_plugin', $plugin ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
163 |
wp_die( __( 'Sorry, you are not allowed to activate this plugin.' ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
164 |
} |
0 | 165 |
|
166 |
check_admin_referer('plugin-activation-error_' . $plugin); |
|
167 |
||
168 |
$valid = validate_plugin($plugin); |
|
169 |
if ( is_wp_error($valid) ) |
|
170 |
wp_die($valid); |
|
171 |
||
172 |
if ( ! WP_DEBUG ) { |
|
173 |
error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); |
|
174 |
} |
|
175 |
||
176 |
@ini_set('display_errors', true); //Ensure that Fatal errors are displayed. |
|
177 |
// Go back to "sandbox" scope so we get the same errors as before |
|
178 |
plugin_sandbox_scrape( $plugin ); |
|
5 | 179 |
/** This action is documented in wp-admin/includes/plugin.php */ |
180 |
do_action( "activate_{$plugin}" ); |
|
0 | 181 |
exit; |
5 | 182 |
|
0 | 183 |
case 'deactivate': |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
184 |
if ( ! current_user_can( 'deactivate_plugin', $plugin ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
185 |
wp_die( __( 'Sorry, you are not allowed to deactivate this plugin.' ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
186 |
} |
0 | 187 |
|
188 |
check_admin_referer('deactivate-plugin_' . $plugin); |
|
189 |
||
190 |
if ( ! is_network_admin() && is_plugin_active_for_network( $plugin ) ) { |
|
191 |
wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
|
192 |
exit; |
|
193 |
} |
|
194 |
||
195 |
deactivate_plugins( $plugin, false, is_network_admin() ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
196 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
197 |
if ( ! is_network_admin() ) { |
0 | 198 |
update_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ) ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
199 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
200 |
update_site_option( 'recently_activated', array( $plugin => time() ) + (array) get_site_option( 'recently_activated' ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
201 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
202 |
|
0 | 203 |
if ( headers_sent() ) |
204 |
echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />"; |
|
205 |
else |
|
206 |
wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") ); |
|
207 |
exit; |
|
5 | 208 |
|
0 | 209 |
case 'deactivate-selected': |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
210 |
if ( ! current_user_can( 'deactivate_plugins' ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
211 |
wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.')); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
212 |
} |
0 | 213 |
|
214 |
check_admin_referer('bulk-plugins'); |
|
215 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
216 |
$plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array(); |
0 | 217 |
// Do not deactivate plugins which are already deactivated. |
218 |
if ( is_network_admin() ) { |
|
219 |
$plugins = array_filter( $plugins, 'is_plugin_active_for_network' ); |
|
220 |
} else { |
|
221 |
$plugins = array_filter( $plugins, 'is_plugin_active' ); |
|
222 |
$plugins = array_diff( $plugins, array_filter( $plugins, 'is_plugin_active_for_network' ) ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
223 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
224 |
foreach ( $plugins as $i => $plugin ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
225 |
// Only deactivate plugins which the user can deactivate. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
226 |
if ( ! current_user_can( 'deactivate_plugin', $plugin ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
227 |
unset( $plugins[ $i ] ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
228 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
229 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
230 |
|
0 | 231 |
} |
232 |
if ( empty($plugins) ) { |
|
233 |
wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
|
234 |
exit; |
|
235 |
} |
|
236 |
||
237 |
deactivate_plugins( $plugins, false, is_network_admin() ); |
|
238 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
239 |
$deactivated = array(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
240 |
foreach ( $plugins as $plugin ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
241 |
$deactivated[ $plugin ] = time(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
242 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
243 |
|
0 | 244 |
if ( ! is_network_admin() ) { |
245 |
update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ) ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
246 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
247 |
update_site_option( 'recently_activated', $deactivated + (array) get_site_option( 'recently_activated' ) ); |
0 | 248 |
} |
249 |
||
250 |
wp_redirect( self_admin_url("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s") ); |
|
251 |
exit; |
|
5 | 252 |
|
0 | 253 |
case 'delete-selected': |
5 | 254 |
if ( ! current_user_can('delete_plugins') ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
255 |
wp_die(__('Sorry, you are not allowed to delete plugins for this site.')); |
5 | 256 |
} |
0 | 257 |
|
258 |
check_admin_referer('bulk-plugins'); |
|
259 |
||
260 |
//$_POST = from the plugin form; $_GET = from the FTP details screen. |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
261 |
$plugins = isset( $_REQUEST['checked'] ) ? (array) wp_unslash( $_REQUEST['checked'] ) : array(); |
0 | 262 |
if ( empty( $plugins ) ) { |
263 |
wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
|
264 |
exit; |
|
265 |
} |
|
266 |
||
267 |
$plugins = array_filter($plugins, 'is_plugin_inactive'); // Do not allow to delete Activated plugins. |
|
268 |
if ( empty( $plugins ) ) { |
|
269 |
wp_redirect( self_admin_url( "plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s" ) ); |
|
270 |
exit; |
|
271 |
} |
|
272 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
273 |
// Bail on all if any paths are invalid. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
274 |
// validate_file() returns truthy for invalid files |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
275 |
$invalid_plugin_files = array_filter( $plugins, 'validate_file' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
276 |
if ( $invalid_plugin_files ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
277 |
wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
278 |
exit; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
279 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
280 |
|
0 | 281 |
include(ABSPATH . 'wp-admin/update.php'); |
282 |
||
283 |
$parent_file = 'plugins.php'; |
|
284 |
||
285 |
if ( ! isset($_REQUEST['verify-delete']) ) { |
|
286 |
wp_enqueue_script('jquery'); |
|
287 |
require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
288 |
?> |
|
289 |
<div class="wrap"> |
|
290 |
<?php |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
291 |
$plugin_info = array(); |
0 | 292 |
$have_non_network_plugins = false; |
293 |
foreach ( (array) $plugins as $plugin ) { |
|
5 | 294 |
$plugin_slug = dirname( $plugin ); |
295 |
||
296 |
if ( '.' == $plugin_slug ) { |
|
297 |
if ( $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ) { |
|
0 | 298 |
$plugin_info[ $plugin ] = $data; |
299 |
$plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); |
|
5 | 300 |
if ( ! $plugin_info[ $plugin ]['Network'] ) { |
0 | 301 |
$have_non_network_plugins = true; |
5 | 302 |
} |
0 | 303 |
} |
304 |
} else { |
|
5 | 305 |
// Get plugins list from that folder. |
306 |
if ( $folder_plugins = get_plugins( '/' . $plugin_slug ) ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
307 |
foreach ( $folder_plugins as $plugin_file => $data ) { |
0 | 308 |
$plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data ); |
309 |
$plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); |
|
5 | 310 |
if ( ! $plugin_info[ $plugin_file ]['Network'] ) { |
0 | 311 |
$have_non_network_plugins = true; |
5 | 312 |
} |
313 |
} |
|
314 |
} |
|
0 | 315 |
} |
316 |
} |
|
317 |
$plugins_to_delete = count( $plugin_info ); |
|
318 |
?> |
|
5 | 319 |
<?php if ( 1 == $plugins_to_delete ) : ?> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
320 |
<h1><?php _e( 'Delete Plugin' ); ?></h1> |
5 | 321 |
<?php if ( $have_non_network_plugins && is_network_admin() ) : ?> |
322 |
<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This plugin may be active on other sites in the network.' ); ?></p></div> |
|
323 |
<?php endif; ?> |
|
324 |
<p><?php _e( 'You are about to remove the following plugin:' ); ?></p> |
|
325 |
<?php else: ?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
326 |
<h1><?php _e( 'Delete Plugins' ); ?></h1> |
5 | 327 |
<?php if ( $have_non_network_plugins && is_network_admin() ) : ?> |
328 |
<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These plugins may be active on other sites in the network.' ); ?></p></div> |
|
329 |
<?php endif; ?> |
|
330 |
<p><?php _e( 'You are about to remove the following plugins:' ); ?></p> |
|
0 | 331 |
<?php endif; ?> |
332 |
<ul class="ul-disc"> |
|
333 |
<?php |
|
334 |
$data_to_delete = false; |
|
335 |
foreach ( $plugin_info as $plugin ) { |
|
336 |
if ( $plugin['is_uninstallable'] ) { |
|
337 |
/* translators: 1: plugin name, 2: plugin author */ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
338 |
echo '<li>', sprintf( __( '%1$s by %2$s (will also <strong>delete its data</strong>)' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] . '</em>' ), '</li>'; |
0 | 339 |
$data_to_delete = true; |
340 |
} else { |
|
341 |
/* translators: 1: plugin name, 2: plugin author */ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
342 |
echo '<li>', sprintf( _x('%1$s by %2$s', 'plugin' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] ) . '</em>', '</li>'; |
0 | 343 |
} |
344 |
} |
|
345 |
?> |
|
346 |
</ul> |
|
347 |
<p><?php |
|
348 |
if ( $data_to_delete ) |
|
349 |
_e('Are you sure you wish to delete these files and data?'); |
|
350 |
else |
|
351 |
_e('Are you sure you wish to delete these files?'); |
|
352 |
?></p> |
|
353 |
<form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;"> |
|
354 |
<input type="hidden" name="verify-delete" value="1" /> |
|
355 |
<input type="hidden" name="action" value="delete-selected" /> |
|
356 |
<?php |
|
5 | 357 |
foreach ( (array) $plugins as $plugin ) { |
358 |
echo '<input type="hidden" name="checked[]" value="' . esc_attr( $plugin ) . '" />'; |
|
359 |
} |
|
0 | 360 |
?> |
361 |
<?php wp_nonce_field('bulk-plugins') ?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
362 |
<?php submit_button( $data_to_delete ? __( 'Yes, delete these files and data' ) : __( 'Yes, delete these files' ), '', 'submit', false ); ?> |
0 | 363 |
</form> |
5 | 364 |
<?php |
365 |
$referer = wp_get_referer(); |
|
366 |
?> |
|
367 |
<form method="post" action="<?php echo $referer ? esc_url( $referer ) : ''; ?>" style="display:inline;"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
368 |
<?php submit_button( __( 'No, return me to the plugin list' ), '', 'submit', false ); ?> |
0 | 369 |
</form> |
370 |
</div> |
|
371 |
<?php |
|
372 |
require_once(ABSPATH . 'wp-admin/admin-footer.php'); |
|
373 |
exit; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
374 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
375 |
$plugins_to_delete = count( $plugins ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
376 |
} // endif verify-delete |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
377 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
378 |
$delete_result = delete_plugins( $plugins ); |
0 | 379 |
|
380 |
set_transient('plugins_delete_result_' . $user_ID, $delete_result); //Store the result in a cache rather than a URL param due to object type & length |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
381 |
wp_redirect( self_admin_url("plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s") ); |
0 | 382 |
exit; |
5 | 383 |
|
0 | 384 |
case 'clear-recent-list': |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
385 |
if ( ! is_network_admin() ) { |
0 | 386 |
update_option( 'recently_activated', array() ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
387 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
388 |
update_site_option( 'recently_activated', array() ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
389 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
390 |
break; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
391 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
392 |
default: |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
393 |
if ( isset( $_POST['checked'] ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
394 |
check_admin_referer('bulk-plugins'); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
395 |
$plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
396 |
$sendback = wp_get_referer(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
397 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
398 |
/** This action is documented in wp-admin/edit-comments.php */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
399 |
$sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $action, $plugins ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
400 |
wp_safe_redirect( $sendback ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
401 |
exit; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
402 |
} |
0 | 403 |
break; |
404 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
405 |
|
0 | 406 |
} |
407 |
||
408 |
$wp_list_table->prepare_items(); |
|
409 |
||
410 |
wp_enqueue_script('plugin-install'); |
|
411 |
add_thickbox(); |
|
412 |
||
5 | 413 |
add_screen_option( 'per_page', array( 'default' => 999 ) ); |
0 | 414 |
|
415 |
get_current_screen()->add_help_tab( array( |
|
416 |
'id' => 'overview', |
|
417 |
'title' => __('Overview'), |
|
418 |
'content' => |
|
419 |
'<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>' . |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
420 |
'<p>' . __( 'The search for installed plugins will search for terms in their name, description, or author.' ) . ' <span id="live-search-desc" class="hide-if-no-js">' . __( 'The search results will be updated as you type.' ) . '</span></p>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
421 |
'<p>' . sprintf( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
422 |
/* translators: %s: WordPress Plugin Directory URL */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
423 |
__( 'If you would like to see more plugins to choose from, click on the “Add New” button and you will be able to browse or search for additional plugins from the <a href="%s">WordPress Plugin Directory</a>. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
424 |
__( 'https://wordpress.org/plugins/' ) |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
425 |
) . '</p>' |
0 | 426 |
) ); |
427 |
get_current_screen()->add_help_tab( array( |
|
428 |
'id' => 'compatibility-problems', |
|
429 |
'title' => __('Troubleshooting'), |
|
430 |
'content' => |
|
431 |
'<p>' . __('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin’s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.') . '</p>' . |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
432 |
'<p>' . sprintf( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
433 |
/* translators: WP_PLUGIN_DIR constant value */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
434 |
__( 'If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
435 |
'<code>' . WP_PLUGIN_DIR . '</code>' |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
436 |
) . '</p>' |
0 | 437 |
) ); |
438 |
||
439 |
get_current_screen()->set_help_sidebar( |
|
440 |
'<p><strong>' . __('For more information:') . '</strong></p>' . |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
441 |
'<p>' . __('<a href="https://codex.wordpress.org/Managing_Plugins#Plugin_Management">Documentation on Managing Plugins</a>') . '</p>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
442 |
'<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>' |
0 | 443 |
); |
444 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
445 |
get_current_screen()->set_screen_reader_content( array( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
446 |
'heading_views' => __( 'Filter plugins list' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
447 |
'heading_pagination' => __( 'Plugins list navigation' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
448 |
'heading_list' => __( 'Plugins list' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
449 |
) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
450 |
|
0 | 451 |
$title = __('Plugins'); |
452 |
$parent_file = 'plugins.php'; |
|
453 |
||
454 |
require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
455 |
||
456 |
$invalid = validate_active_plugins(); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
457 |
if ( ! empty( $invalid ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
458 |
foreach ( $invalid as $plugin_file => $error ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
459 |
echo '<div id="message" class="error"><p>'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
460 |
printf( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
461 |
/* translators: 1: plugin file 2: error message */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
462 |
__( 'The plugin %1$s has been <strong>deactivated</strong> due to an error: %2$s' ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
463 |
'<code>' . esc_html( $plugin_file ) . '</code>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
464 |
$error->get_error_message() ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
465 |
echo '</p></div>'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
466 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
467 |
} |
0 | 468 |
?> |
469 |
||
470 |
<?php if ( isset($_GET['error']) ) : |
|
471 |
||
472 |
if ( isset( $_GET['main'] ) ) |
|
473 |
$errmsg = __( 'You cannot delete a plugin while it is active on the main site.' ); |
|
474 |
elseif ( isset($_GET['charsout']) ) |
|
475 |
$errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']); |
|
476 |
else |
|
477 |
$errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.'); |
|
478 |
?> |
|
5 | 479 |
<div id="message" class="error"><p><?php echo $errmsg; ?></p> |
0 | 480 |
<?php |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
481 |
if ( ! isset( $_GET['main'] ) && ! isset( $_GET['charsout'] ) && wp_verify_nonce( $_GET['_error_nonce'], 'plugin-activation-error_' . $plugin ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
482 |
$iframe_url = add_query_arg( array( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
483 |
'action' => 'error_scrape', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
484 |
'plugin' => urlencode( $plugin ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
485 |
'_wpnonce' => urlencode( $_GET['_error_nonce'] ), |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
486 |
), admin_url( 'plugins.php' ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
487 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
488 |
<iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url( $iframe_url ); ?>"></iframe> |
0 | 489 |
<?php |
490 |
} |
|
491 |
?> |
|
492 |
</div> |
|
493 |
<?php elseif ( isset($_GET['deleted']) ) : |
|
5 | 494 |
$delete_result = get_transient( 'plugins_delete_result_' . $user_ID ); |
495 |
// Delete it once we're done. |
|
496 |
delete_transient( 'plugins_delete_result_' . $user_ID ); |
|
0 | 497 |
|
498 |
if ( is_wp_error($delete_result) ) : ?> |
|
5 | 499 |
<div id="message" class="error notice is-dismissible"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div> |
0 | 500 |
<?php else : ?> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
501 |
<div id="message" class="updated notice is-dismissible"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
502 |
<p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
503 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
504 |
if ( 1 == (int) $_GET['deleted'] ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
505 |
_e( 'The selected plugin has been <strong>deleted</strong>.' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
506 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
507 |
_e( 'The selected plugins have been <strong>deleted</strong>.' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
508 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
509 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
510 |
</p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
511 |
</div> |
0 | 512 |
<?php endif; ?> |
513 |
<?php elseif ( isset($_GET['activate']) ) : ?> |
|
5 | 514 |
<div id="message" class="updated notice is-dismissible"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div> |
0 | 515 |
<?php elseif (isset($_GET['activate-multi'])) : ?> |
5 | 516 |
<div id="message" class="updated notice is-dismissible"><p><?php _e('Selected plugins <strong>activated</strong>.'); ?></p></div> |
0 | 517 |
<?php elseif ( isset($_GET['deactivate']) ) : ?> |
5 | 518 |
<div id="message" class="updated notice is-dismissible"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div> |
0 | 519 |
<?php elseif (isset($_GET['deactivate-multi'])) : ?> |
5 | 520 |
<div id="message" class="updated notice is-dismissible"><p><?php _e('Selected plugins <strong>deactivated</strong>.'); ?></p></div> |
0 | 521 |
<?php elseif ( 'update-selected' == $action ) : ?> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
522 |
<div id="message" class="updated notice is-dismissible"><p><?php _e('All selected plugins are up to date.'); ?></p></div> |
0 | 523 |
<?php endif; ?> |
524 |
||
525 |
<div class="wrap"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
526 |
<h1 class="wp-heading-inline"><?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
527 |
echo esc_html( $title ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
528 |
?></h1> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
529 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
530 |
<?php |
0 | 531 |
if ( ( ! is_multisite() || is_network_admin() ) && current_user_can('install_plugins') ) { ?> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
532 |
<a href="<?php echo self_admin_url( 'plugin-install.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'plugin' ); ?></a> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
533 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
534 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
535 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
536 |
if ( strlen( $s ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
537 |
/* translators: %s: search keywords */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
538 |
printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( urldecode( $s ) ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
539 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
540 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
541 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
542 |
<hr class="wp-header-end"> |
0 | 543 |
|
5 | 544 |
<?php |
545 |
/** |
|
546 |
* Fires before the plugins list table is rendered. |
|
547 |
* |
|
548 |
* This hook also fires before the plugins list table is rendered in the Network Admin. |
|
549 |
* |
|
550 |
* Please note: The 'active' portion of the hook name does not refer to whether the current |
|
551 |
* view is for active plugins, but rather all plugins actively-installed. |
|
552 |
* |
|
553 |
* @since 3.0.0 |
|
554 |
* |
|
555 |
* @param array $plugins_all An array containing all installed plugins. |
|
556 |
*/ |
|
557 |
do_action( 'pre_current_active_plugins', $plugins['all'] ); |
|
558 |
?> |
|
0 | 559 |
|
560 |
<?php $wp_list_table->views(); ?> |
|
561 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
562 |
<form class="search-form search-plugins" method="get"> |
0 | 563 |
<?php $wp_list_table->search_box( __( 'Search Installed Plugins' ), 'plugin' ); ?> |
564 |
</form> |
|
565 |
||
5 | 566 |
<form method="post" id="bulk-action-form"> |
0 | 567 |
|
568 |
<input type="hidden" name="plugin_status" value="<?php echo esc_attr($status) ?>" /> |
|
569 |
<input type="hidden" name="paged" value="<?php echo esc_attr($page) ?>" /> |
|
570 |
||
571 |
<?php $wp_list_table->display(); ?> |
|
572 |
</form> |
|
573 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
574 |
<span class="spinner"></span> |
0 | 575 |
</div> |
576 |
||
577 |
<?php |
|
5 | 578 |
wp_print_request_filesystem_credentials_modal(); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
579 |
wp_print_admin_notice_templates(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
580 |
wp_print_update_row_templates(); |
5 | 581 |
|
0 | 582 |
include(ABSPATH . 'wp-admin/admin-footer.php'); |