2004-03-25 02:05:52 -05:00
< ? php
2008-08-16 03:27:34 -04:00
/**
* Plugins administration panel .
*
* @ package WordPress
* @ subpackage Administration
*/
/** WordPress Administration Bootstrap */
2020-02-06 01:33:11 -05:00
require_once __DIR__ . '/admin.php' ;
2004-03-25 02:05:52 -05:00
2017-11-30 18:11:00 -05:00
if ( ! current_user_can ( 'activate_plugins' ) ) {
2016-06-29 11:16:29 -04:00
wp_die ( __ ( 'Sorry, you are not allowed to manage plugins for this site.' ) );
2017-11-30 18:11:00 -05:00
}
2010-12-13 16:21:50 -05:00
2017-11-30 18:11:00 -05:00
$wp_list_table = _get_list_table ( 'WP_Plugins_List_Table' );
$pagenum = $wp_list_table -> get_pagenum ();
2009-08-01 17:12:17 -04:00
2010-09-21 20:10:39 -04:00
$action = $wp_list_table -> current_action ();
2008-06-04 14:09:31 -04:00
2017-11-30 18:11:00 -05:00
$plugin = isset ( $_REQUEST [ 'plugin' ] ) ? wp_unslash ( $_REQUEST [ 'plugin' ] ) : '' ;
$s = isset ( $_REQUEST [ 's' ] ) ? urlencode ( wp_unslash ( $_REQUEST [ 's' ] ) ) : '' ;
2008-06-04 14:09:31 -04:00
2010-09-21 20:10:39 -04:00
// Clean up request URI from temporary args for screen options/paging uri's to work as expected.
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
$query_args_to_remove = array (
'error' ,
'deleted' ,
'activate' ,
'activate-multi' ,
'deactivate' ,
'deactivate-multi' ,
'enabled-auto-update' ,
'disabled-auto-update' ,
'enabled-auto-update-multi' ,
'disabled-auto-update-multi' ,
'_error_nonce' ,
);
$_SERVER [ 'REQUEST_URI' ] = remove_query_arg ( $query_args_to_remove , $_SERVER [ 'REQUEST_URI' ] );
2009-05-17 05:39:32 -04:00
2015-02-04 23:19:23 -05:00
wp_enqueue_script ( 'updates' );
Plugin Dependencies: Remove auto-deactivation and bootstrapping logic.
Automatic deactivation of dependents with unmet dependencies requires a write operation to the database. This was performed during Core's bootstrap, which risked the database and cache becoming out-of-sync on sites with heavy traffic.
No longer loading plugins that have unmet requirements has not had a final approach decided core-wide, and is still in discussion in #60491 to be handled in a future release.
The `plugin_data` option, used to persistently store plugin data for detecting unmet dependencies during Core's bootstrap, is no longer needed.
Follow-up to [57545], [57592], [57606], [57617].
Props dd32, azaozz, swissspidy, desrosj, afragen, pbiron, zunaid321, costdev.
Fixes #60457. See #60491, #60510, #60518.
Built from https://develop.svn.wordpress.org/trunk@57658
git-svn-id: http://core.svn.wordpress.org/trunk@57159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-20 02:27:06 -05:00
WP_Plugin_Dependencies :: initialize ();
2010-09-21 20:10:39 -04:00
if ( $action ) {
2010-01-29 16:45:32 -05:00
2009-04-21 15:17:44 -04:00
switch ( $action ) {
2008-06-04 14:09:31 -04:00
case 'activate' :
2017-08-22 10:02:44 -04:00
if ( ! current_user_can ( 'activate_plugin' , $plugin ) ) {
wp_die ( __ ( 'Sorry, you are not allowed to activate this plugin.' ) );
}
2009-08-01 17:12:17 -04:00
2012-11-27 11:08:35 -05:00
if ( is_multisite () && ! is_network_admin () && is_network_only_plugin ( $plugin ) ) {
2017-11-30 18:11:00 -05:00
wp_redirect ( self_admin_url ( " plugins.php?plugin_status= $status &paged= $page &s= $s " ) );
2012-11-27 11:08:35 -05:00
exit ;
}
2017-11-30 18:11:00 -05:00
check_admin_referer ( 'activate-plugin_' . $plugin );
2009-05-28 07:02:16 -04:00
2017-11-30 18:11:00 -05:00
$result = activate_plugin ( $plugin , self_admin_url ( 'plugins.php?error=true&plugin=' . urlencode ( $plugin ) ), is_network_admin () );
2010-02-15 22:44:20 -05:00
if ( is_wp_error ( $result ) ) {
2020-05-16 14:42:12 -04:00
if ( 'unexpected_output' === $result -> get_error_code () ) {
2017-11-30 18:11:00 -05:00
$redirect = self_admin_url ( 'plugins.php?error=true&charsout=' . strlen ( $result -> get_error_data () ) . '&plugin=' . urlencode ( $plugin ) . " &plugin_status= $status &paged= $page &s= $s " );
wp_redirect ( add_query_arg ( '_error_nonce' , wp_create_nonce ( 'plugin-activation-error_' . $plugin ), $redirect ) );
2010-02-15 22:44:20 -05:00
exit ;
} else {
2017-11-30 18:11:00 -05:00
wp_die ( $result );
2010-02-15 22:44:20 -05:00
}
}
2009-05-28 07:02:16 -04:00
2012-04-18 23:41:29 -04:00
if ( ! is_network_admin () ) {
$recent = ( array ) get_option ( 'recently_activated' );
unset ( $recent [ $plugin ] );
update_option ( 'recently_activated' , $recent );
2015-09-25 15:16:27 -04:00
} else {
2015-10-07 13:11:25 -04:00
$recent = ( array ) get_site_option ( 'recently_activated' );
2015-09-25 15:16:27 -04:00
unset ( $recent [ $plugin ] );
2015-10-07 13:11:25 -04:00
update_site_option ( 'recently_activated' , $recent );
2008-06-04 14:09:31 -04:00
}
2012-04-18 23:41:29 -04:00
2020-05-16 14:42:12 -04:00
if ( isset ( $_GET [ 'from' ] ) && 'import' === $_GET [ 'from' ] ) {
2020-01-28 19:45:18 -05:00
// Overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix.
wp_redirect ( self_admin_url ( 'import.php?import=' . str_replace ( '-importer' , '' , dirname ( $plugin ) ) ) );
2020-05-16 14:42:12 -04:00
} elseif ( isset ( $_GET [ 'from' ] ) && 'press-this' === $_GET [ 'from' ] ) {
2017-11-30 18:11:00 -05:00
wp_redirect ( self_admin_url ( 'press-this.php' ) );
2010-05-27 07:04:08 -04:00
} else {
2020-01-28 19:45:18 -05:00
// Overrides the ?error=true one above.
wp_redirect ( self_admin_url ( " plugins.php?activate=true&plugin_status= $status &paged= $page &s= $s " ) );
2010-05-27 07:04:08 -04:00
}
2008-06-04 14:09:31 -04:00
exit ;
2014-05-06 14:13:14 -04:00
2008-06-04 14:09:31 -04:00
case 'activate-selected' :
2017-11-30 18:11:00 -05:00
if ( ! current_user_can ( 'activate_plugins' ) ) {
wp_die ( __ ( 'Sorry, you are not allowed to activate plugins for this site.' ) );
}
2009-09-14 10:03:32 -04:00
2017-11-30 18:11:00 -05:00
check_admin_referer ( 'bulk-plugins' );
2009-05-28 07:02:16 -04:00
2017-09-19 06:11:43 -04:00
$plugins = isset ( $_POST [ 'checked' ] ) ? ( array ) wp_unslash ( $_POST [ 'checked' ] ) : array ();
2010-10-29 15:09:04 -04:00
2012-09-04 16:51:33 -04:00
if ( is_network_admin () ) {
foreach ( $plugins as $i => $plugin ) {
2014-03-05 13:26:15 -05:00
// Only activate plugins which are not already network activated.
if ( is_plugin_active_for_network ( $plugin ) ) {
2012-09-04 16:51:33 -04:00
unset ( $plugins [ $i ] );
2014-03-05 13:26:15 -05:00
}
2012-09-04 16:51:33 -04:00
}
} else {
foreach ( $plugins as $i => $plugin ) {
2014-03-05 13:26:15 -05:00
// Only activate plugins which are not already active and are not network-only when on Multisite.
if ( is_plugin_active ( $plugin ) || ( is_multisite () && is_network_only_plugin ( $plugin ) ) ) {
2012-09-04 16:51:33 -04:00
unset ( $plugins [ $i ] );
2014-03-05 13:26:15 -05:00
}
2017-08-22 10:02:44 -04:00
// Only activate plugins which the user can activate.
if ( ! current_user_can ( 'activate_plugin' , $plugin ) ) {
unset ( $plugins [ $i ] );
}
2012-09-04 16:51:33 -04:00
}
}
2010-10-29 15:09:04 -04:00
2017-11-30 18:11:00 -05:00
if ( empty ( $plugins ) ) {
wp_redirect ( self_admin_url ( " plugins.php?plugin_status= $status &paged= $page &s= $s " ) );
2009-05-28 07:02:16 -04:00
exit ;
}
2017-11-30 18:11:00 -05:00
activate_plugins ( $plugins , self_admin_url ( 'plugins.php?error=true' ), is_network_admin () );
2009-05-28 07:02:16 -04:00
2012-04-18 23:41:29 -04:00
if ( ! is_network_admin () ) {
2017-11-30 18:11:00 -05:00
$recent = ( array ) get_option ( 'recently_activated' );
2015-09-25 15:16:27 -04:00
} else {
2017-11-30 18:11:00 -05:00
$recent = ( array ) get_site_option ( 'recently_activated' );
2015-09-25 15:16:27 -04:00
}
foreach ( $plugins as $plugin ) {
unset ( $recent [ $plugin ] );
}
if ( ! is_network_admin () ) {
2012-04-18 23:41:29 -04:00
update_option ( 'recently_activated' , $recent );
2015-09-25 15:16:27 -04:00
} else {
2015-10-07 13:11:25 -04:00
update_site_option ( 'recently_activated' , $recent );
2012-04-18 23:41:29 -04:00
}
2008-01-09 04:37:27 -05:00
2017-11-30 18:11:00 -05:00
wp_redirect ( self_admin_url ( " plugins.php?activate-multi=true&plugin_status= $status &paged= $page &s= $s " ) );
2008-06-04 14:09:31 -04:00
exit ;
2014-05-06 14:13:14 -04:00
2017-11-30 18:11:00 -05:00
case 'update-selected' :
2010-08-11 17:54:51 -04:00
check_admin_referer ( 'bulk-plugins' );
2010-03-17 12:27:25 -04:00
2017-11-30 18:11:00 -05:00
if ( isset ( $_GET [ 'plugins' ] ) ) {
2017-09-19 06:11:43 -04:00
$plugins = explode ( ',' , wp_unslash ( $_GET [ 'plugins' ] ) );
2017-11-30 18:11:00 -05:00
} elseif ( isset ( $_POST [ 'checked' ] ) ) {
2017-09-19 06:11:43 -04:00
$plugins = ( array ) wp_unslash ( $_POST [ 'checked' ] );
2017-11-30 18:11:00 -05:00
} else {
2010-03-06 03:39:50 -05:00
$plugins = array ();
2017-11-30 18:11:00 -05:00
}
2010-03-17 12:27:25 -04:00
2021-07-22 09:53:00 -04:00
// Used in the HTML title tag.
2017-11-30 18:11:00 -05:00
$title = __ ( 'Update Plugins' );
2010-03-06 03:39:50 -05:00
$parent_file = 'plugins.php' ;
2010-01-26 01:53:47 -05:00
2014-02-26 01:55:14 -05:00
wp_enqueue_script ( 'updates' );
2020-02-06 01:33:11 -05:00
require_once ABSPATH . 'wp-admin/admin-header.php' ;
2010-03-17 12:27:25 -04:00
2010-03-06 03:39:50 -05:00
echo '<div class="wrap">' ;
2015-06-27 11:41:25 -04:00
echo '<h1>' . esc_html ( $title ) . '</h1>' ;
2010-01-26 13:39:12 -05:00
2020-10-18 13:27:06 -04:00
$url = self_admin_url ( 'update.php?action=update-selected&plugins=' . urlencode ( implode ( ',' , $plugins ) ) );
2017-11-30 18:11:00 -05:00
$url = wp_nonce_url ( $url , 'bulk-update-plugins' );
2010-01-26 01:53:47 -05:00
2010-03-06 03:39:50 -05:00
echo " <iframe src=' $url ' style='width: 100%; height:100%; min-height:850px;'></iframe> " ;
echo '</div>' ;
2020-02-06 01:33:11 -05:00
require_once ABSPATH . 'wp-admin/admin-footer.php' ;
2010-01-26 01:53:47 -05:00
exit ;
2014-05-06 14:13:14 -04:00
2008-06-04 14:09:31 -04:00
case 'error_scrape' :
2017-08-22 10:02:44 -04:00
if ( ! current_user_can ( 'activate_plugin' , $plugin ) ) {
wp_die ( __ ( 'Sorry, you are not allowed to activate this plugin.' ) );
}
2009-08-01 17:12:17 -04:00
2017-11-30 18:11:00 -05:00
check_admin_referer ( 'plugin-activation-error_' . $plugin );
2009-05-28 07:02:16 -04:00
2017-11-30 18:11:00 -05:00
$valid = validate_plugin ( $plugin );
if ( is_wp_error ( $valid ) ) {
wp_die ( $valid );
}
2009-05-28 07:02:16 -04:00
2010-02-15 22:44:20 -05:00
if ( ! WP_DEBUG ) {
2011-04-12 05:21:13 -04:00
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 );
2010-02-15 22:44:20 -05:00
}
2009-12-12 04:20:07 -05:00
2020-01-28 19:45:18 -05:00
ini_set ( 'display_errors' , true ); // Ensure that fatal errors are displayed.
// Go back to "sandbox" scope so we get the same errors as before.
2010-02-27 02:24:41 -05:00
plugin_sandbox_scrape ( $plugin );
2014-10-30 14:35:28 -04:00
/** This action is documented in wp-admin/includes/plugin.php */
2013-11-23 18:04:10 -05:00
do_action ( " activate_ { $plugin } " );
2008-06-04 14:09:31 -04:00
exit ;
2014-05-06 14:13:14 -04:00
2008-06-04 14:09:31 -04:00
case 'deactivate' :
2017-08-22 10:02:44 -04:00
if ( ! current_user_can ( 'deactivate_plugin' , $plugin ) ) {
wp_die ( __ ( 'Sorry, you are not allowed to deactivate this plugin.' ) );
}
2009-08-01 17:12:17 -04:00
2017-11-30 18:11:00 -05:00
check_admin_referer ( 'deactivate-plugin_' . $plugin );
2012-04-18 23:41:29 -04:00
2012-04-19 02:38:19 -04:00
if ( ! is_network_admin () && is_plugin_active_for_network ( $plugin ) ) {
2017-11-30 18:11:00 -05:00
wp_redirect ( self_admin_url ( " plugins.php?plugin_status= $status &paged= $page &s= $s " ) );
2012-04-18 23:41:29 -04:00
exit ;
}
deactivate_plugins ( $plugin , false , is_network_admin () );
2015-09-25 15:16:27 -04:00
if ( ! is_network_admin () ) {
2012-04-18 23:41:29 -04:00
update_option ( 'recently_activated' , array ( $plugin => time () ) + ( array ) get_option ( 'recently_activated' ) );
2015-09-25 15:16:27 -04:00
} else {
2015-10-07 13:11:25 -04:00
update_site_option ( 'recently_activated' , array ( $plugin => time () ) + ( array ) get_site_option ( 'recently_activated' ) );
2015-09-25 15:16:27 -04:00
}
2017-11-30 18:11:00 -05:00
if ( headers_sent () ) {
2010-10-04 00:26:58 -04:00
echo " <meta http-equiv='refresh' content=' " . esc_attr ( " 0;url=plugins.php?deactivate=true&plugin_status= $status &paged= $page &s= $s " ) . " ' /> " ;
2017-11-30 18:11:00 -05:00
} else {
wp_redirect ( self_admin_url ( " plugins.php?deactivate=true&plugin_status= $status &paged= $page &s= $s " ) );
}
2008-06-04 14:09:31 -04:00
exit ;
2014-05-06 14:13:14 -04:00
2008-06-04 14:09:31 -04:00
case 'deactivate-selected' :
2017-08-22 10:02:44 -04:00
if ( ! current_user_can ( 'deactivate_plugins' ) ) {
2017-11-30 18:11:00 -05:00
wp_die ( __ ( 'Sorry, you are not allowed to deactivate plugins for this site.' ) );
2017-08-22 10:02:44 -04:00
}
2009-08-01 17:12:17 -04:00
2017-11-30 18:11:00 -05:00
check_admin_referer ( 'bulk-plugins' );
2009-05-28 07:02:16 -04:00
2017-09-19 06:11:43 -04:00
$plugins = isset ( $_POST [ 'checked' ] ) ? ( array ) wp_unslash ( $_POST [ 'checked' ] ) : array ();
2012-04-18 23:41:29 -04:00
// Do not deactivate plugins which are already deactivated.
if ( is_network_admin () ) {
$plugins = array_filter ( $plugins , 'is_plugin_active_for_network' );
} else {
$plugins = array_filter ( $plugins , 'is_plugin_active' );
$plugins = array_diff ( $plugins , array_filter ( $plugins , 'is_plugin_active_for_network' ) );
2017-08-22 10:02:44 -04:00
foreach ( $plugins as $i => $plugin ) {
// Only deactivate plugins which the user can deactivate.
if ( ! current_user_can ( 'deactivate_plugin' , $plugin ) ) {
unset ( $plugins [ $i ] );
}
}
2012-04-18 23:41:29 -04:00
}
2017-11-30 18:11:00 -05:00
if ( empty ( $plugins ) ) {
wp_redirect ( self_admin_url ( " plugins.php?plugin_status= $status &paged= $page &s= $s " ) );
2009-05-28 07:02:16 -04:00
exit ;
}
2012-04-18 23:41:29 -04:00
deactivate_plugins ( $plugins , false , is_network_admin () );
2009-05-28 07:02:16 -04:00
2015-09-25 15:16:27 -04:00
$deactivated = array ();
foreach ( $plugins as $plugin ) {
$deactivated [ $plugin ] = time ();
}
2012-04-18 23:41:29 -04:00
if ( ! is_network_admin () ) {
update_option ( 'recently_activated' , $deactivated + ( array ) get_option ( 'recently_activated' ) );
2015-09-25 15:16:27 -04:00
} else {
2015-10-07 13:11:25 -04:00
update_site_option ( 'recently_activated' , $deactivated + ( array ) get_site_option ( 'recently_activated' ) );
2012-04-18 23:41:29 -04:00
}
2009-05-28 07:02:16 -04:00
2017-11-30 18:11:00 -05:00
wp_redirect ( self_admin_url ( " plugins.php?deactivate-multi=true&plugin_status= $status &paged= $page &s= $s " ) );
2008-06-04 14:09:31 -04:00
exit ;
2014-05-06 14:13:14 -04:00
2008-06-04 14:09:31 -04:00
case 'delete-selected' :
2017-11-30 18:11:00 -05:00
if ( ! current_user_can ( 'delete_plugins' ) ) {
wp_die ( __ ( 'Sorry, you are not allowed to delete plugins for this site.' ) );
2014-10-08 15:05:20 -04:00
}
2008-08-09 01:36:14 -04:00
2017-11-30 18:11:00 -05:00
check_admin_referer ( 'bulk-plugins' );
2008-08-09 01:36:14 -04:00
2020-01-28 19:45:18 -05:00
// $_POST = from the plugin form; $_GET = from the FTP details screen.
2017-09-19 06:11:43 -04:00
$plugins = isset ( $_REQUEST [ 'checked' ] ) ? ( array ) wp_unslash ( $_REQUEST [ 'checked' ] ) : array ();
2010-12-17 16:53:47 -05:00
if ( empty ( $plugins ) ) {
2017-11-30 18:11:00 -05:00
wp_redirect ( self_admin_url ( " plugins.php?plugin_status= $status &paged= $page &s= $s " ) );
2009-05-28 07:02:16 -04:00
exit ;
}
2020-01-28 19:45:18 -05:00
$plugins = array_filter ( $plugins , 'is_plugin_inactive' ); // Do not allow to delete activated plugins.
2010-12-17 16:53:47 -05:00
if ( empty ( $plugins ) ) {
wp_redirect ( self_admin_url ( " plugins.php?error=true&main=true&plugin_status= $status &paged= $page &s= $s " ) );
exit ;
}
2017-03-06 07:55:41 -05:00
// Bail on all if any paths are invalid.
2020-01-28 19:45:18 -05:00
// validate_file() returns truthy for invalid files.
2017-03-06 07:55:41 -05:00
$invalid_plugin_files = array_filter ( $plugins , 'validate_file' );
if ( $invalid_plugin_files ) {
2017-11-30 18:11:00 -05:00
wp_redirect ( self_admin_url ( " plugins.php?plugin_status= $status &paged= $page &s= $s " ) );
2017-03-06 07:55:41 -05:00
exit ;
}
2020-02-06 01:33:11 -05:00
require ABSPATH . 'wp-admin/update.php' ;
2008-06-04 14:09:31 -04:00
$parent_file = 'plugins.php' ;
2008-08-09 01:36:14 -04:00
2017-11-30 18:11:00 -05:00
if ( ! isset ( $_REQUEST [ 'verify-delete' ] ) ) {
wp_enqueue_script ( 'jquery' );
2020-02-06 01:33:11 -05:00
require_once ABSPATH . 'wp-admin/admin-header.php' ;
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
2008-06-16 14:35:48 -04:00
?>
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
< div class = " wrap " >
2008-06-16 14:35:48 -04:00
< ? php
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
$plugin_info = array ();
$have_non_network_plugins = false ;
2017-11-30 18:11:00 -05:00
foreach ( ( array ) $plugins as $plugin ) {
$plugin_slug = dirname ( $plugin );
2020-05-16 14:42:12 -04:00
if ( '.' === $plugin_slug ) {
2019-07-01 08:52:01 -04:00
$data = get_plugin_data ( WP_PLUGIN_DIR . '/' . $plugin );
if ( $data ) {
2017-11-30 18:11:00 -05:00
$plugin_info [ $plugin ] = $data ;
$plugin_info [ $plugin ][ 'is_uninstallable' ] = is_uninstallable_plugin ( $plugin );
if ( ! $plugin_info [ $plugin ][ 'Network' ] ) {
$have_non_network_plugins = true ;
2010-02-27 17:01:22 -05:00
}
2017-11-30 18:11:00 -05:00
}
} else {
// Get plugins list from that folder.
2019-07-01 08:52:01 -04:00
$folder_plugins = get_plugins ( '/' . $plugin_slug );
if ( $folder_plugins ) {
2017-11-30 18:11:00 -05:00
foreach ( $folder_plugins as $plugin_file => $data ) {
$plugin_info [ $plugin_file ] = _get_plugin_data_markup_translate ( $plugin_file , $data );
$plugin_info [ $plugin_file ][ 'is_uninstallable' ] = is_uninstallable_plugin ( $plugin );
if ( ! $plugin_info [ $plugin_file ][ 'Network' ] ) {
$have_non_network_plugins = true ;
2014-10-08 15:05:20 -04:00
}
}
2008-06-16 14:35:48 -04:00
}
}
2017-11-30 18:11:00 -05:00
}
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
$plugins_to_delete = count ( $plugin_info );
2008-06-16 14:35:48 -04:00
?>
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
< ? php if ( 1 === $plugins_to_delete ) : ?>
2015-06-27 11:41:25 -04:00
< h1 >< ? php _e ( 'Delete Plugin' ); ?> </h1>
Administration: Use `wp_admin_notice()` more in `wp-admin/`.
Add additional usage of `wp_admin_notice()` in `wp-admin/` on `.error` and miscellaneous usages previously overlooked.
Follow up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597], [56599].
Props costdev, joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56600
git-svn-id: http://core.svn.wordpress.org/trunk@56112 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-17 11:33:17 -04:00
< ? php
if ( $have_non_network_plugins && is_network_admin () ) :
$maybe_active_plugin = '<strong>' . __ ( 'Caution:' ) . '</strong> ' . __ ( 'This plugin may be active on other sites in the network.' );
wp_admin_notice (
$maybe_active_plugin ,
array (
'additional_classes' => array ( 'error' ),
)
);
endif ;
?>
2015-03-31 14:45:28 -04:00
< p >< ? php _e ( 'You are about to remove the following plugin:' ); ?> </p>
2017-11-30 18:11:00 -05:00
< ? php else : ?>
2015-06-27 11:41:25 -04:00
< h1 >< ? php _e ( 'Delete Plugins' ); ?> </h1>
Administration: Use `wp_admin_notice()` more in `wp-admin/`.
Add additional usage of `wp_admin_notice()` in `wp-admin/` on `.error` and miscellaneous usages previously overlooked.
Follow up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597], [56599].
Props costdev, joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56600
git-svn-id: http://core.svn.wordpress.org/trunk@56112 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-17 11:33:17 -04:00
< ? php
if ( $have_non_network_plugins && is_network_admin () ) :
$maybe_active_plugins = '<strong>' . __ ( 'Caution:' ) . '</strong> ' . __ ( 'These plugins may be active on other sites in the network.' );
wp_admin_notice (
$maybe_active_plugins ,
array (
'additional_classes' => array ( 'error' ),
)
);
endif ;
?>
2015-03-31 14:45:28 -04:00
< p >< ? php _e ( 'You are about to remove the following plugins:' ); ?> </p>
2010-12-17 18:21:15 -05:00
< ? php endif ; ?>
2009-05-16 03:09:03 -04:00
< ul class = " ul-disc " >
2008-08-09 01:36:14 -04:00
< ? php
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
2010-02-27 17:01:22 -05:00
$data_to_delete = false ;
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
2010-02-27 17:01:22 -05:00
foreach ( $plugin_info as $plugin ) {
if ( $plugin [ 'is_uninstallable' ] ) {
2019-09-02 20:41:05 -04:00
/* translators: 1: Plugin name, 2: Plugin author. */
2016-02-23 20:02:25 -05:00
echo '<li>' , sprintf ( __ ( '%1$s by %2$s (will also <strong>delete its data</strong>)' ), '<strong>' . $plugin [ 'Name' ] . '</strong>' , '<em>' . $plugin [ 'AuthorName' ] . '</em>' ), '</li>' ;
2010-02-27 17:01:22 -05:00
$data_to_delete = true ;
} else {
2019-09-02 20:41:05 -04:00
/* translators: 1: Plugin name, 2: Plugin author. */
2017-11-30 18:11:00 -05:00
echo '<li>' , sprintf ( _x ( '%1$s by %2$s' , 'plugin' ), '<strong>' . $plugin [ 'Name' ] . '</strong>' , '<em>' . $plugin [ 'AuthorName' ] ) . '</em>' , '</li>' ;
2010-02-27 17:01:22 -05:00
}
}
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
2008-06-16 14:35:48 -04:00
?>
</ ul >
2017-11-30 18:11:00 -05:00
< p >
< ? php
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
2017-11-30 18:11:00 -05:00
if ( $data_to_delete ) {
2019-07-04 05:56:57 -04:00
_e ( 'Are you sure you want to delete these files and data?' );
2017-11-30 18:11:00 -05:00
} else {
2019-07-04 05:56:57 -04:00
_e ( 'Are you sure you want to delete these files?' );
2017-11-30 18:11:00 -05:00
}
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
2017-11-30 18:11:00 -05:00
?>
</ p >
< form method = " post " action = " <?php echo esc_url( $_SERVER['REQUEST_URI'] ); ?> " style = " display:inline; " >
2008-06-16 14:35:48 -04:00
< input type = " hidden " name = " verify-delete " value = " 1 " />
2009-04-04 07:15:39 -04:00
< input type = " hidden " name = " action " value = " delete-selected " />
2008-06-16 14:35:48 -04:00
< ? php
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
2017-11-30 18:11:00 -05:00
foreach ( ( array ) $plugins as $plugin ) {
echo '<input type="hidden" name="checked[]" value="' . esc_attr ( $plugin ) . '" />' ;
}
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
2008-06-16 14:35:48 -04:00
?>
2017-11-30 18:11:00 -05:00
< ? php wp_nonce_field ( 'bulk-plugins' ); ?>
2016-09-28 15:54:28 -04:00
< ? php submit_button ( $data_to_delete ? __ ( 'Yes, delete these files and data' ) : __ ( 'Yes, delete these files' ), '' , 'submit' , false ); ?>
2008-06-16 14:35:48 -04:00
</ form >
2015-03-08 22:11:28 -04:00
< ? php
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
2015-03-08 22:11:28 -04:00
$referer = wp_get_referer ();
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
2015-03-08 22:11:28 -04:00
?>
< form method = " post " action = " <?php echo $referer ? esc_url( $referer ) : ''; ?> " style = " display:inline; " >
2016-09-28 15:54:28 -04:00
< ? php submit_button ( __ ( 'No, return me to the plugin list' ), '' , 'submit' , false ); ?>
2008-06-16 14:35:48 -04:00
</ form >
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
</ div >
2008-06-16 14:35:48 -04:00
< ? php
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
2020-02-06 01:33:11 -05:00
require_once ABSPATH . 'wp-admin/admin-footer.php' ;
2008-06-16 14:35:48 -04:00
exit ;
2015-09-26 09:11:25 -04:00
} else {
$plugins_to_delete = count ( $plugins );
2020-01-28 19:45:18 -05:00
} // End if verify-delete.
2015-09-26 09:11:25 -04:00
$delete_result = delete_plugins ( $plugins );
2008-06-10 12:57:33 -04:00
2024-02-12 04:37:08 -05:00
// Store the result in an option rather than a URL param due to object type & length.
// Cannot use transient/cache, as that could get flushed if any plugin flushes data on uninstall/delete.
update_option ( 'plugins_delete_result_' . $user_ID , $delete_result , false );
2017-11-30 18:11:00 -05:00
wp_redirect ( self_admin_url ( " plugins.php?deleted= $plugins_to_delete &plugin_status= $status &paged= $page &s= $s " ) );
2009-05-17 05:39:32 -04:00
exit ;
2008-06-30 19:12:18 -04:00
case 'clear-recent-list' :
2015-09-25 15:16:27 -04:00
if ( ! is_network_admin () ) {
2012-04-18 23:41:29 -04:00
update_option ( 'recently_activated' , array () );
2015-09-25 15:16:27 -04:00
} else {
2015-10-07 13:11:25 -04:00
update_site_option ( 'recently_activated' , array () );
2015-09-25 15:16:27 -04:00
}
2016-09-23 16:33:30 -04:00
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
break ;
Bootstrap/Load: Introduce a recovery mode for fixing fatal errors.
Using the new fatal handler introduced in [44962], an email is sent to the admin when a fatal error occurs. This email includes a secret link to enter recovery mode. When clicked, the link will be validated and on success a cookie will be placed on the client, enabling recovery mode for that user. This functionality is executed early before plugins and themes are loaded, in order to be unaffected by potential fatal errors these might be causing.
When in recovery mode, broken plugins and themes will be paused for that client, so that they are able to access the admin backend despite of these errors. They are notified about the broken extensions and the errors caused, and can then decide whether they would like to temporarily deactivate the extension or fix the problem and resume the extension.
A link in the admin bar allows the client to exit recovery mode.
Props timothyblynjacobs, afragen, flixos90, nerrad, miss_jwo, schlessera, spacedmonkey, swissspidy.
Fixes #46130, #44458.
Built from https://develop.svn.wordpress.org/trunk@44973
git-svn-id: http://core.svn.wordpress.org/trunk@44804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 17:53:51 -04:00
case 'resume' :
if ( is_multisite () ) {
return ;
}
if ( ! current_user_can ( 'resume_plugin' , $plugin ) ) {
wp_die ( __ ( 'Sorry, you are not allowed to resume this plugin.' ) );
}
check_admin_referer ( 'resume-plugin_' . $plugin );
$result = resume_plugin ( $plugin , self_admin_url ( " plugins.php?error=resuming&plugin_status= $status &paged= $page &s= $s " ) );
if ( is_wp_error ( $result ) ) {
wp_die ( $result );
}
wp_redirect ( self_admin_url ( " plugins.php?resume=true&plugin_status= $status &paged= $page &s= $s " ) );
exit ;
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
case 'enable-auto-update' :
case 'disable-auto-update' :
case 'enable-auto-update-selected' :
case 'disable-auto-update-selected' :
if ( ! current_user_can ( 'update_plugins' ) || ! wp_is_auto_update_enabled_for_type ( 'plugin' ) ) {
wp_die ( __ ( 'Sorry, you are not allowed to manage plugins automatic updates.' ) );
}
if ( is_multisite () && ! is_network_admin () ) {
wp_die ( __ ( 'Please connect to your network admin to manage plugins automatic updates.' ) );
}
$redirect = self_admin_url ( " plugins.php?plugin_status= { $status } &paged= { $page } &s= { $s } " );
if ( 'enable-auto-update' === $action || 'disable-auto-update' === $action ) {
if ( empty ( $plugin ) ) {
wp_redirect ( $redirect );
exit ;
}
check_admin_referer ( 'updates' );
} else {
if ( empty ( $_POST [ 'checked' ] ) ) {
wp_redirect ( $redirect );
exit ;
}
check_admin_referer ( 'bulk-plugins' );
}
$auto_updates = ( array ) get_site_option ( 'auto_update_plugins' , array () );
if ( 'enable-auto-update' === $action ) {
$auto_updates [] = $plugin ;
$auto_updates = array_unique ( $auto_updates );
$redirect = add_query_arg ( array ( 'enabled-auto-update' => 'true' ), $redirect );
} elseif ( 'disable-auto-update' === $action ) {
$auto_updates = array_diff ( $auto_updates , array ( $plugin ) );
$redirect = add_query_arg ( array ( 'disabled-auto-update' => 'true' ), $redirect );
} else {
$plugins = ( array ) wp_unslash ( $_POST [ 'checked' ] );
if ( 'enable-auto-update-selected' === $action ) {
$new_auto_updates = array_merge ( $auto_updates , $plugins );
$new_auto_updates = array_unique ( $new_auto_updates );
$query_args = array ( 'enabled-auto-update-multi' => 'true' );
} else {
$new_auto_updates = array_diff ( $auto_updates , $plugins );
$query_args = array ( 'disabled-auto-update-multi' => 'true' );
}
// Return early if all selected plugins already have auto-updates enabled or disabled.
// Must use non-strict comparison, so that array order is not treated as significant.
Coding Standards: Upgrade WPCS to version 3.0.0.
This is an important release which makes significant changes to improve the accuracy, performance, stability and maintainability of all sniffs, as well as making WordPressCS much better at handling modern PHP.
WordPressCS 3.0.0 contains breaking changes, both for people using ignore annotations, people maintaining custom rulesets, as well as for sniff developers who maintain a custom PHPCS standard based on WordPressCS.
If you are an end-user or maintain a custom WordPressCS based ruleset, please start by reading the [https://github.com/WordPress/WordPress-Coding-Standards/wiki/Upgrade-Guide-to-WordPressCS-3.0.0-for-ruleset-maintainers Upgrade Guide to WordPressCS 3.0.0 for ruleset maintainers] which lists the most important changes and contains a step by step guide for upgrading.
If you are a maintainer of an external standard based on WordPressCS and any of your custom sniffs are based on or extend WordPressCS sniffs, please read the [https://github.com/WordPress/WordPress-Coding-Standards/wiki/Upgrade-Guide-to-WordPressCS-3.0.0-for-Developers-of-external-standards Upgrade Guide to WordPressCS 3.0.0 for Developers].
In all cases, please read the complete changelog carefully before you upgrade.
This commit:
* Updates the Composer dependencies to use the new version, including updating the underlying PHP_CodeSniffer dependency to the new minimum supported version for WPCS.[[BR]] Note: the Composer PHPCS installer plugin is no longer explicitly required as it is now a dependency of WPCS, so the dependency is inherited automatically.
* Updates the ruleset for WPCS 3.0.0. This includes:
* Raising the memory limit to be on the safe side as WPCS 3.0.0 contains a lot more sniffs.
* Removing explicit inclusions of extra rules, which have now been added to the `WordPress-Core` ruleset..
* Updating property names for select sniffs.
* Updating one exclusion — the `WordPress.CodeAnalysis.AssignmentInCondition` sniff has been (partially) replaced by the `Generic.CodeAnalysis.AssignmentInCondition` sniff.
* Adding one new exclusion.
* Downgrades one new error to a warning.[[BR]] The `Generic.Files.OneObjectStructurePerFile` sniff enforces that there is only one OO structure declaration per file. At this time, this sniff would yield 29 errors. By downgrading the sniff to a ''warning'', the build can pass and the issues can be fixed in due time. For now, the test directory will be excluded until the issues are fixed (as the test directory CS run does not allow for warnings).
* Updates ignore annotations for WPCS 3.0.0.
Reference: [https://github.com/WordPress/WordPress-Coding-Standards/releases/tag/3.0.0 WPCS 3.0.0 release notes].
Follow-up to [43571], [44574], [45600], [47927].
Props jrf, jorbin, desrosj.
See #59161.
Built from https://develop.svn.wordpress.org/trunk@56695
git-svn-id: http://core.svn.wordpress.org/trunk@56207 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 20:27:12 -04:00
if ( $new_auto_updates == $auto_updates ) { // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
wp_redirect ( $redirect );
exit ;
}
$auto_updates = $new_auto_updates ;
$redirect = add_query_arg ( $query_args , $redirect );
}
/** This filter is documented in wp-admin/includes/class-wp-plugins-list-table.php */
$all_items = apply_filters ( 'all_plugins' , get_plugins () );
// Remove plugins that don't exist or have been deleted since the option was last updated.
$auto_updates = array_intersect ( $auto_updates , array_keys ( $all_items ) );
update_site_option ( 'auto_update_plugins' , $auto_updates );
Bootstrap/Load: Introduce a recovery mode for fixing fatal errors.
Using the new fatal handler introduced in [44962], an email is sent to the admin when a fatal error occurs. This email includes a secret link to enter recovery mode. When clicked, the link will be validated and on success a cookie will be placed on the client, enabling recovery mode for that user. This functionality is executed early before plugins and themes are loaded, in order to be unaffected by potential fatal errors these might be causing.
When in recovery mode, broken plugins and themes will be paused for that client, so that they are able to access the admin backend despite of these errors. They are notified about the broken extensions and the errors caused, and can then decide whether they would like to temporarily deactivate the extension or fix the problem and resume the extension.
A link in the admin bar allows the client to exit recovery mode.
Props timothyblynjacobs, afragen, flixos90, nerrad, miss_jwo, schlessera, spacedmonkey, swissspidy.
Fixes #46130, #44458.
Built from https://develop.svn.wordpress.org/trunk@44973
git-svn-id: http://core.svn.wordpress.org/trunk@44804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 17:53:51 -04:00
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
wp_redirect ( $redirect );
exit ;
2016-09-23 16:33:30 -04:00
default :
if ( isset ( $_POST [ 'checked' ] ) ) {
2017-11-30 18:11:00 -05:00
check_admin_referer ( 'bulk-plugins' );
2019-12-03 08:58:05 -05:00
$screen = get_current_screen () -> id ;
2016-09-23 16:33:30 -04:00
$sendback = wp_get_referer ();
2019-12-03 08:58:05 -05:00
$plugins = isset ( $_POST [ 'checked' ] ) ? ( array ) wp_unslash ( $_POST [ 'checked' ] ) : array ();
2016-09-23 16:33:30 -04:00
2019-12-03 08:58:05 -05:00
/** This action is documented in wp-admin/edit.php */
2020-01-28 19:45:18 -05:00
$sendback = apply_filters ( " handle_bulk_actions- { $screen } " , $sendback , $action , $plugins ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
2016-09-23 16:33:30 -04:00
wp_safe_redirect ( $sendback );
exit ;
}
break ;
2008-06-04 14:09:31 -04:00
}
2004-03-25 16:04:36 -05:00
}
2010-08-22 07:22:46 -04:00
$wp_list_table -> prepare_items ();
2010-08-11 17:54:51 -04:00
2017-11-30 18:11:00 -05:00
wp_enqueue_script ( 'plugin-install' );
2008-11-07 17:11:14 -05:00
add_thickbox ();
2008-06-04 14:09:31 -04:00
2015-03-10 11:32:27 -04:00
add_screen_option ( 'per_page' , array ( 'default' => 999 ) );
2011-10-07 00:57:12 -04:00
2017-11-30 18:11:00 -05:00
get_current_screen () -> add_help_tab (
array (
'id' => 'overview' ,
'title' => __ ( 'Overview' ),
'content' =>
2019-07-05 01:21:56 -04:00
'<p>' . __ ( 'Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.' ) . '</p>' .
'<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>' .
2017-11-30 18:11:00 -05:00
'<p>' . sprintf (
2019-09-02 20:41:05 -04:00
/* translators: %s: WordPress Plugin Directory URL. */
2023-09-05 15:26:26 -04:00
__ ( 'If you would like to see more plugins to choose from, click on the “Add New Plugin” 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!' ),
2017-11-30 18:11:00 -05:00
__ ( 'https://wordpress.org/plugins/' )
) . '</p>' ,
)
);
get_current_screen () -> add_help_tab (
array (
'id' => 'compatibility-problems' ,
'title' => __ ( 'Troubleshooting' ),
'content' =>
2019-07-05 01:21:56 -04:00
'<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>' .
2017-11-30 18:11:00 -05:00
'<p>' . sprintf (
2020-01-20 10:43:04 -05:00
/* translators: %s: WP_PLUGIN_DIR constant value. */
Administration: Replace contracted verb forms for better consistency.
This changeset replaces contracted verb forms like `doesn't`, `can't`, or `isn't` with non-contracted forms like `does not`, `cannot`, or `is not`, for better consistency across the WordPress administration. It also updates some corresponding unit tests strings.
Props Presskopp, socalchristina, aandrewdixon, francina, SergeyBiryukov, JeffPaul, audrasjb, hellofromTonya.
Fixes #38913.
See #39176.
Built from https://develop.svn.wordpress.org/trunk@52978
git-svn-id: http://core.svn.wordpress.org/trunk@52567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-22 12:25:03 -04:00
__ ( 'If something goes wrong with a plugin and you cannot use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.' ),
2017-11-30 18:11:00 -05:00
'<code>' . WP_PLUGIN_DIR . '</code>'
) . '</p>' ,
)
);
2011-11-01 23:12:37 -04:00
2020-06-16 13:29:07 -04:00
$help_sidebar_autoupdates = '' ;
2020-06-19 17:14:08 -04:00
2020-06-16 13:29:07 -04:00
if ( current_user_can ( 'update_plugins' ) && wp_is_auto_update_enabled_for_type ( 'plugin' ) ) {
get_current_screen () -> add_help_tab (
array (
'id' => 'plugins-themes-auto-updates' ,
'title' => __ ( 'Auto-updates' ),
'content' =>
'<p>' . __ ( 'Auto-updates can be enabled or disabled for each individual plugin. Plugins with auto-updates enabled will display the estimated date of the next auto-update. Auto-updates depends on the WP-Cron task scheduling system.' ) . '</p>' .
Upgrade/Install: Enhance auto-updates to be disabled for plugins that don't suport updates.
This removes the toggle UI when updates aren't available. When plugins use the filter, the UI is updated to show that they are being controlled via code. And then removed entirely when not available.
See #50798.
Fixes #50280.
Props elrae, pbiron, SergeyBiryukov, audrasjb, azaozz, StephenCronin, whyisjake, dd32, TimothyBlynJacobs, desrosj.
Built from https://develop.svn.wordpress.org/trunk@48669
git-svn-id: http://core.svn.wordpress.org/trunk@48431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-28 12:32:01 -04:00
'<p>' . __ ( 'Auto-updates are only available for plugins recognized by WordPress.org, or that include a compatible update system.' ) . '</p>' .
2020-06-16 13:29:07 -04:00
'<p>' . __ ( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '</p>' ,
)
);
2023-02-23 05:38:21 -05:00
$help_sidebar_autoupdates = '<p>' . __ ( '<a href="https://wordpress.org/documentation/article/plugins-themes-auto-updates/">Documentation on Auto-updates</a>' ) . '</p>' ;
2020-06-16 13:29:07 -04:00
}
2011-11-02 16:14:10 -04:00
get_current_screen () -> set_help_sidebar (
2017-11-30 18:11:00 -05:00
'<p><strong>' . __ ( 'For more information:' ) . '</strong></p>' .
2023-02-23 06:06:19 -05:00
'<p>' . __ ( '<a href="https://wordpress.org/documentation/article/manage-plugins/">Documentation on Managing Plugins</a>' ) . '</p>' .
2020-06-19 17:14:08 -04:00
$help_sidebar_autoupdates .
2023-02-23 05:38:21 -05:00
'<p>' . __ ( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
2010-05-26 16:19:59 -04:00
);
2009-04-18 21:11:13 -04:00
2017-11-30 18:11:00 -05:00
get_current_screen () -> set_screen_reader_content (
array (
'heading_views' => __ ( 'Filter plugins list' ),
'heading_pagination' => __ ( 'Plugins list navigation' ),
'heading_list' => __ ( 'Plugins list' ),
)
);
2015-10-06 21:28:25 -04:00
2021-07-22 09:53:00 -04:00
// Used in the HTML title tag.
2017-11-30 18:11:00 -05:00
$title = __ ( 'Plugins' );
2010-07-30 17:33:39 -04:00
$parent_file = 'plugins.php' ;
2010-05-26 16:19:59 -04:00
2020-02-06 01:33:11 -05:00
require_once ABSPATH . 'wp-admin/admin-header.php' ;
2004-03-25 02:05:52 -05:00
2010-08-11 19:49:30 -04:00
$invalid = validate_active_plugins ();
2015-09-19 23:01:24 -04:00
if ( ! empty ( $invalid ) ) {
foreach ( $invalid as $plugin_file => $error ) {
Administration: Use `wp_admin_notice()` more in `wp-admin/`.
Add additional usage of `wp_admin_notice()` in `wp-admin/` on `.error` and miscellaneous usages previously overlooked.
Follow up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597], [56599].
Props costdev, joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56600
git-svn-id: http://core.svn.wordpress.org/trunk@56112 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-17 11:33:17 -04:00
$deactivated_message = sprintf (
2019-09-02 20:41:05 -04:00
/* translators: 1: Plugin file, 2: Error message. */
2019-05-26 10:36:51 -04:00
__ ( 'The plugin %1$s has been deactivated due to an error: %2$s' ),
2015-09-19 23:01:24 -04:00
'<code>' . esc_html ( $plugin_file ) . '</code>' ,
2022-08-30 11:18:17 -04:00
esc_html ( $error -> get_error_message () )
2017-11-30 18:11:00 -05:00
);
Administration: Use `wp_admin_notice()` more in `wp-admin/`.
Add additional usage of `wp_admin_notice()` in `wp-admin/` on `.error` and miscellaneous usages previously overlooked.
Follow up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597], [56599].
Props costdev, joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56600
git-svn-id: http://core.svn.wordpress.org/trunk@56112 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-17 11:33:17 -04:00
wp_admin_notice (
$deactivated_message ,
array (
'id' => 'message' ,
'additional_classes' => array ( 'error' ),
)
);
2015-09-19 23:01:24 -04:00
}
}
2004-04-14 15:04:14 -04:00
2023-09-14 13:12:20 -04:00
// Used by wp_admin_notice() updated notices.
$updated_notice_args = array (
'id' => 'message' ,
'additional_classes' => array ( 'updated' ),
'dismissible' => true ,
);
2023-09-13 22:15:17 -04:00
if ( isset ( $_GET [ 'error' ] ) ) {
2010-02-15 22:44:20 -05:00
2017-11-30 18:11:00 -05:00
if ( isset ( $_GET [ 'main' ] ) ) {
2010-12-17 16:53:47 -05:00
$errmsg = __ ( 'You cannot delete a plugin while it is active on the main site.' );
2017-11-30 18:11:00 -05:00
} elseif ( isset ( $_GET [ 'charsout' ] ) ) {
I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.
Includes minor code layout fixes.
Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!
Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926
git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 13:13:59 -04:00
$errmsg = sprintf (
2019-09-02 20:41:05 -04:00
/* translators: %d: Number of characters. */
2018-10-02 15:30:23 -04:00
_n (
'The plugin generated %d character of <strong>unexpected output</strong> during activation.' ,
'The plugin generated %d characters of <strong>unexpected output</strong> during activation.' ,
$_GET [ 'charsout' ]
),
$_GET [ 'charsout' ]
);
$errmsg .= ' ' . __ ( 'If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.' );
Bootstrap/Load: Introduce a recovery mode for fixing fatal errors.
Using the new fatal handler introduced in [44962], an email is sent to the admin when a fatal error occurs. This email includes a secret link to enter recovery mode. When clicked, the link will be validated and on success a cookie will be placed on the client, enabling recovery mode for that user. This functionality is executed early before plugins and themes are loaded, in order to be unaffected by potential fatal errors these might be causing.
When in recovery mode, broken plugins and themes will be paused for that client, so that they are able to access the admin backend despite of these errors. They are notified about the broken extensions and the errors caused, and can then decide whether they would like to temporarily deactivate the extension or fix the problem and resume the extension.
A link in the admin bar allows the client to exit recovery mode.
Props timothyblynjacobs, afragen, flixos90, nerrad, miss_jwo, schlessera, spacedmonkey, swissspidy.
Fixes #46130, #44458.
Built from https://develop.svn.wordpress.org/trunk@44973
git-svn-id: http://core.svn.wordpress.org/trunk@44804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 17:53:51 -04:00
} elseif ( 'resuming' === $_GET [ 'error' ] ) {
$errmsg = __ ( 'Plugin could not be resumed because it triggered a <strong>fatal error</strong>.' );
2017-11-30 18:11:00 -05:00
} else {
$errmsg = __ ( 'Plugin could not be activated because it triggered a <strong>fatal error</strong>.' );
}
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
2020-11-23 08:36:07 -05:00
if ( ! isset ( $_GET [ 'main' ] ) && ! isset ( $_GET [ 'charsout' ] )
&& isset ( $_GET [ '_error_nonce' ] ) && wp_verify_nonce ( $_GET [ '_error_nonce' ], 'plugin-activation-error_' . $plugin )
) {
2017-11-30 18:11:00 -05:00
$iframe_url = add_query_arg (
array (
2015-10-12 22:12:24 -04:00
'action' => 'error_scrape' ,
'plugin' => urlencode ( $plugin ),
'_wpnonce' => urlencode ( $_GET [ '_error_nonce' ] ),
2018-08-16 21:51:36 -04:00
),
admin_url ( 'plugins.php' )
2017-11-30 18:11:00 -05:00
);
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
2023-09-13 22:15:17 -04:00
$errmsg .= '<iframe style="border:0" width="100%" height="70px" src="' . esc_url ( $iframe_url ) . '"></iframe>' ;
2017-11-30 18:11:00 -05:00
}
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
2023-09-13 22:15:17 -04:00
wp_admin_notice (
$errmsg ,
array (
'id' => 'message' ,
'additional_classes' => array ( 'error' ),
)
);
} elseif ( isset ( $_GET [ 'deleted' ] ) ) {
2024-02-12 04:37:08 -05:00
$delete_result = get_option ( 'plugins_delete_result_' . $user_ID );
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
// Delete it once we're done.
2024-02-12 04:37:08 -05:00
delete_option ( 'plugins_delete_result_' . $user_ID );
2009-05-17 05:39:32 -04:00
2023-09-13 22:15:17 -04:00
if ( is_wp_error ( $delete_result ) ) {
$plugin_not_deleted_message = sprintf (
/* translators: %s: Error message. */
__ ( 'Plugin could not be deleted due to an error: %s' ),
esc_html ( $delete_result -> get_error_message () )
);
wp_admin_notice (
$plugin_not_deleted_message ,
array (
'id' => 'message' ,
'additional_classes' => array ( 'error' ),
'dismissible' => true ,
)
);
} else {
if ( 1 === ( int ) $_GET [ 'deleted' ] ) {
$plugins_deleted_message = __ ( 'The selected plugin has been deleted.' );
} else {
$plugins_deleted_message = __ ( 'The selected plugins have been deleted.' );
}
2023-09-14 13:12:20 -04:00
wp_admin_notice ( $plugins_deleted_message , $updated_notice_args );
2023-09-13 22:15:17 -04:00
}
} elseif ( isset ( $_GET [ 'activate' ] ) ) {
2023-09-14 13:12:20 -04:00
wp_admin_notice ( __ ( 'Plugin activated.' ), $updated_notice_args );
2023-09-13 22:15:17 -04:00
} elseif ( isset ( $_GET [ 'activate-multi' ] ) ) {
2023-09-14 13:12:20 -04:00
wp_admin_notice ( __ ( 'Selected plugins activated.' ), $updated_notice_args );
2023-09-13 22:15:17 -04:00
} elseif ( isset ( $_GET [ 'deactivate' ] ) ) {
2023-09-14 13:12:20 -04:00
wp_admin_notice ( __ ( 'Plugin deactivated.' ), $updated_notice_args );
2023-09-13 22:15:17 -04:00
} elseif ( isset ( $_GET [ 'deactivate-multi' ] ) ) {
2023-09-14 13:12:20 -04:00
wp_admin_notice ( __ ( 'Selected plugins deactivated.' ), $updated_notice_args );
2023-09-13 22:15:17 -04:00
} elseif ( 'update-selected' === $action ) {
2023-09-14 13:12:20 -04:00
wp_admin_notice ( __ ( 'All selected plugins are up to date.' ), $updated_notice_args );
2023-09-13 22:15:17 -04:00
} elseif ( isset ( $_GET [ 'resume' ] ) ) {
2023-09-14 13:12:20 -04:00
wp_admin_notice ( __ ( 'Plugin resumed.' ), $updated_notice_args );
2023-09-13 22:15:17 -04:00
} elseif ( isset ( $_GET [ 'enabled-auto-update' ] ) ) {
2023-09-14 13:12:20 -04:00
wp_admin_notice ( __ ( 'Plugin will be auto-updated.' ), $updated_notice_args );
2023-09-13 22:15:17 -04:00
} elseif ( isset ( $_GET [ 'disabled-auto-update' ] ) ) {
2023-09-14 13:12:20 -04:00
wp_admin_notice ( __ ( 'Plugin will no longer be auto-updated.' ), $updated_notice_args );
2023-09-13 22:15:17 -04:00
} elseif ( isset ( $_GET [ 'enabled-auto-update-multi' ] ) ) {
2023-09-14 13:12:20 -04:00
wp_admin_notice ( __ ( 'Selected plugins will be auto-updated.' ), $updated_notice_args );
2023-09-13 22:15:17 -04:00
} elseif ( isset ( $_GET [ 'disabled-auto-update-multi' ] ) ) {
2023-09-14 13:12:20 -04:00
wp_admin_notice ( __ ( 'Selected plugins will no longer be auto-updated.' ), $updated_notice_args );
2023-09-13 22:15:17 -04:00
}
?>
2004-04-14 15:04:14 -04:00
Upgrade/Install: Introduce Plugin Dependencies.
Introduces a new "Requires Plugins" plugin header so that plugin developers can list the slugs of the plugins theirs depends on.
This will inform users of the requirements, and provide links to the WordPress.org Plugins Repository that they can click to install and activate the dependencies first.
Plugins whose requirements are not met cannot be installed or activated, and they will be deactivated automatically if their requirements become unmet.
Plugins that others rely on cannot be deactivated or deleted until their dependent plugins are deactivated or deleted.
In memory of Alex Mills and Alex King.
WordPress Remembers.
Props ahoereth, afragen, alanfuller, alexkingorg, amykamala, anonymized_10690803, apeatling, ashfame, atimmer, audrasjb, aristath, azaozz, batmoo, beaulebens, blobaugh, bobbingwide, boonebgorges, brianhenryie, chanthaboune, chrisdavidmiles, coolmann, costdev, courane01, danielbachhuber, davidperez, dd32, Denis-de-Bernardy, dingo_d, DJPaul, dougal, DrewAPicture, ethitter, filosofo, georgestephanis, giuseppemazzapica-1, goldenapples, griffinjt, hellofromTonya, husobj, ideag, jarednova, jbobich, jbrinley, jltallon, joedolson, johnciacia, johnjamesjacoby, joppuyo, jsmoriss, karmatosed, kebbet, knutsp, kraftbj, kraftner, kurtpayne, lkraav, logikal16, luisherranz, man4toman, markjaquith, matt, mbijon, megphillips91, mikeschinkel, mordauk, morehawes, mrwweb, mte90, mukesh27, mzaweb, nacin, norcross, nvwd, nwjames, obliviousharmony, ocean90, oglekler, paaljoachim, pauldewouters, pbaylies, pbiron, peterwilsoncc, Philipp15b, poena, pogidude, retlehs, rmccue, ryan, sabreuse, sc0ttkclark, scribu, sereedmedia, SergeyBiryukov, ShaneF, shidouhikari, soean, spacedmonkey, stephenh1988, swissspidy, taylorde, tazotodua, threadi, TimothyBlynJacobs, TJNowell, tollmanz, toscho, tropicalista, Viper007Bond, westi, whiteshadow, williamsba1, wpsmith, ZaneMatthew.
Fixes #22316.
Built from https://develop.svn.wordpress.org/trunk@57545
git-svn-id: http://core.svn.wordpress.org/trunk@57046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-06 18:46:14 -05:00
< ? php WP_Plugin_Dependencies :: display_admin_notice_for_unmet_dependencies (); ?>
< ? php WP_Plugin_Dependencies :: display_admin_notice_for_circular_dependencies (); ?>
2004-03-25 02:05:52 -05:00
< div class = " wrap " >
2017-11-30 18:11:00 -05:00
< h1 class = " wp-heading-inline " >
< ? php
2016-12-07 13:48:40 -05:00
echo esc_html ( $title );
2017-11-30 18:11:00 -05:00
?>
</ h1 >
2016-12-07 13:48:40 -05:00
< ? php
2017-11-30 18:11:00 -05:00
if ( ( ! is_multisite () || is_network_admin () ) && current_user_can ( 'install_plugins' ) ) {
2018-08-16 21:51:36 -04:00
?>
2023-09-05 15:26:26 -04:00
< a href = " <?php echo esc_url( self_admin_url( 'plugin-install.php' ) ); ?> " class = " page-title-action " >< ? php echo esc_html__ ( 'Add New Plugin' ); ?> </a>
2018-08-16 21:51:36 -04:00
< ? php
2016-01-14 15:06:25 -05:00
}
if ( strlen ( $s ) ) {
2020-10-23 13:19:14 -04:00
echo '<span class="subtitle">' ;
printf (
/* translators: %s: Search query. */
__ ( 'Search results for: %s' ),
'<strong>' . esc_html ( urldecode ( $s ) ) . '</strong>'
);
echo '</span>' ;
2016-01-14 15:06:25 -05:00
}
?>
2016-12-07 13:48:40 -05:00
< hr class = " wp-header-end " >
2009-04-21 02:49:53 -04:00
2013-11-23 18:04:10 -05:00
< ? php
/**
* Fires before the plugins list table is rendered .
*
* This hook also fires before the plugins list table is rendered in the Network Admin .
*
* Please note : The 'active' portion of the hook name does not refer to whether the current
* view is for active plugins , but rather all plugins actively - installed .
*
* @ since 3.0 . 0
*
2018-03-25 14:10:32 -04:00
* @ param array [] $plugins_all An array of arrays containing information on all installed plugins .
2013-11-23 18:04:10 -05:00
*/
do_action ( 'pre_current_active_plugins' , $plugins [ 'all' ] );
?>
2010-12-10 15:22:34 -05:00
< ? php $wp_list_table -> views (); ?>
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
< form class = " search-form search-plugins " method = " get " >
2011-05-14 15:41:42 -04:00
< ? php $wp_list_table -> search_box ( __ ( 'Search Installed Plugins' ), 'plugin' ); ?>
2011-10-18 15:18:08 -04:00
</ form >
2015-02-04 23:19:23 -05:00
< form method = " post " id = " bulk-action-form " >
2010-09-05 17:26:27 -04:00
2017-11-30 18:11:00 -05:00
< input type = " hidden " name = " plugin_status " value = " <?php echo esc_attr( $status ); ?> " />
< input type = " hidden " name = " paged " value = " <?php echo esc_attr( $page ); ?> " />
2008-06-04 14:09:31 -04:00
2010-08-22 07:22:46 -04:00
< ? php $wp_list_table -> display (); ?>
2008-06-04 14:09:31 -04:00
</ form >
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
< span class = " spinner " ></ span >
2004-03-25 02:05:52 -05:00
</ div >
< ? php
2015-03-17 23:18:27 -04:00
wp_print_request_filesystem_credentials_modal ();
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
wp_print_admin_notice_templates ();
wp_print_update_row_templates ();
2015-03-17 23:18:27 -04:00
2020-02-06 01:33:11 -05:00
require_once ABSPATH . 'wp-admin/admin-footer.php' ;