Remove fix_actve_plugins(). Props hakre. fixes #11750
git-svn-id: http://svn.automattic.com/wordpress/trunk@12848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3ffb57a4f8
commit
5d2365a499
|
@ -258,8 +258,8 @@ function get_plugins($plugin_folder = '') {
|
|||
* @param string $plugin Base plugin path from plugins directory.
|
||||
* @return bool True, if in the active plugins list. False, not in the list.
|
||||
*/
|
||||
function is_plugin_active($plugin) {
|
||||
return in_array( $plugin, apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) );
|
||||
function is_plugin_active( $plugin ) {
|
||||
return in_array( $plugin, apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -286,9 +286,9 @@ function is_plugin_active($plugin) {
|
|||
* @param string $redirect Optional. URL to redirect to.
|
||||
* @return WP_Error|null WP_Error on invalid file or null on success.
|
||||
*/
|
||||
function activate_plugin($plugin, $redirect = '') {
|
||||
$current = get_option('active_plugins');
|
||||
$plugin = plugin_basename(trim($plugin));
|
||||
function activate_plugin( $plugin, $redirect = '' ) {
|
||||
$current = get_option( 'active_plugins', array() );
|
||||
$plugin = plugin_basename( trim( $plugin ) );
|
||||
|
||||
$valid = validate_plugin($plugin);
|
||||
if ( is_wp_error($valid) )
|
||||
|
@ -322,13 +322,10 @@ function activate_plugin($plugin, $redirect = '') {
|
|||
* @param string|array $plugins Single plugin or list of plugins to deactivate.
|
||||
* @param bool $silent Optional, default is false. Prevent calling deactivate hook.
|
||||
*/
|
||||
function deactivate_plugins($plugins, $silent= false) {
|
||||
$current = get_option('active_plugins');
|
||||
function deactivate_plugins( $plugins, $silent = false ) {
|
||||
$current = get_option( 'active_plugins', array() );
|
||||
|
||||
if ( !is_array($plugins) )
|
||||
$plugins = array($plugins);
|
||||
|
||||
foreach ( $plugins as $plugin ) {
|
||||
foreach ( (array) $plugins as $plugin ) {
|
||||
$plugin = plugin_basename($plugin);
|
||||
if ( ! is_plugin_active($plugin) )
|
||||
continue;
|
||||
|
@ -475,26 +472,32 @@ function delete_plugins($plugins, $redirect = '' ) {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate active plugins
|
||||
*
|
||||
* validate all active plugins, deactivates invalid and
|
||||
* returns an array of deactived ones.
|
||||
*
|
||||
* @since unknown
|
||||
* @return array invalid plugins, plugin as key, error as value
|
||||
*/
|
||||
function validate_active_plugins() {
|
||||
$check_plugins = apply_filters( 'active_plugins', get_option('active_plugins') );
|
||||
$plugins = apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) );
|
||||
|
||||
// Sanity check. If the active plugin list is not an array, make it an
|
||||
// empty array.
|
||||
if ( !is_array($check_plugins) ) {
|
||||
// validate vartype: array
|
||||
if ( !is_array( $plugins ) ) {
|
||||
update_option('active_plugins', array());
|
||||
return;
|
||||
}
|
||||
|
||||
//Invalid is any plugin that is deactivated due to error.
|
||||
$invalid = array();
|
||||
|
||||
// If a plugin file does not exist, remove it from the list of active
|
||||
// plugins.
|
||||
foreach ( $check_plugins as $check_plugin ) {
|
||||
$result = validate_plugin($check_plugin);
|
||||
// invalid plugins get deactivated
|
||||
foreach ( $plugins as $plugin ) {
|
||||
$result = validate_plugin( $plugin );
|
||||
if ( is_wp_error( $result ) ) {
|
||||
$invalid[$check_plugin] = $result;
|
||||
deactivate_plugins( $check_plugin, true);
|
||||
$invalid[$plugin] = $result;
|
||||
deactivate_plugins( $plugin, true );
|
||||
}
|
||||
}
|
||||
return $invalid;
|
||||
|
|
|
@ -208,7 +208,7 @@ foreach ( $plugin_files as $plugin_file ) :
|
|||
<div id="documentation"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Lookup' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode( get_locale() ) ?>&version=<?php echo urlencode( $wp_version ) ?>&redirect=true'); }" /></div>
|
||||
<?php endif; ?>
|
||||
<?php if ( is_writeable($real_file) ) : ?>
|
||||
<?php if ( in_array($file, (array) get_option('active_plugins')) ) { ?>
|
||||
<?php if ( in_array( $file, (array) get_option( 'active_plugins', array() ) ) ) { ?>
|
||||
<p><?php _e('<strong>Warning:</strong> Making changes to active plugins is not recommended. If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?></p>
|
||||
<?php } ?>
|
||||
<p class="submit">
|
||||
|
|
|
@ -113,7 +113,7 @@ if ( !empty($action) ) {
|
|||
|
||||
require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
|
||||
require_once( 'admin-header.php' );
|
||||
|
||||
|
||||
$url = 'plugins.php?action=upgrade-selected&plugins=' . urlencode( join( ',', $plugins ) );
|
||||
$title = __( 'Upgrade Plugins' );
|
||||
$nonce = 'bulk-manage-plugins';
|
||||
|
@ -283,9 +283,9 @@ add_contextual_help($current_screen, $help);
|
|||
|
||||
if ( is_multisite() && is_super_admin() ) {
|
||||
$menu_perms = get_site_option('menu_items', array());
|
||||
if ( !$menu_perms['plugins'] ) {
|
||||
if ( empty($menu_perms['plugins']) )
|
||||
add_action( 'admin_notices', '_admin_notice_multisite_activate_plugins_page' );
|
||||
}
|
||||
unset($menu_perms);
|
||||
}
|
||||
|
||||
$title = __('Manage Plugins');
|
||||
|
|
|
@ -404,7 +404,7 @@ function wp_plugins_to_load() {
|
|||
if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) )
|
||||
$plugins[] = ABSPATH . 'my-hacks.php';
|
||||
|
||||
$active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
|
||||
$active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) );
|
||||
if ( !is_array( $active_plugins ) || defined( 'WP_INSTALLING' ) )
|
||||
return $plugins;
|
||||
foreach ( $active_plugins as $plugin ) {
|
||||
|
|
|
@ -110,4 +110,11 @@ function get_user_details( $username ) {
|
|||
return get_user_by('login', $username);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0
|
||||
*/
|
||||
function clear_global_post_cache( $post_id ) {
|
||||
_deprecated_function( __FUNCTION__, '3.0', 'clean_post_cache' );
|
||||
}
|
||||
|
||||
?>
|
|
@ -725,11 +725,6 @@ function get_blog_post( $blog_id, $post_id ) {
|
|||
return $post;
|
||||
}
|
||||
|
||||
// deprecated, see clean_post_cache()
|
||||
function clear_global_post_cache( $post_id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
function add_user_to_blog( $blog_id, $user_id, $role ) {
|
||||
switch_to_blog($blog_id);
|
||||
|
||||
|
@ -1986,13 +1981,6 @@ function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function fix_active_plugins( $value ) {
|
||||
if ( false == is_array( $value ) )
|
||||
$value = array();
|
||||
return $value;
|
||||
}
|
||||
add_filter( "option_active_plugins", "fix_active_plugins" );
|
||||
|
||||
if ( !function_exists('rss_gc') ) :
|
||||
function rss_gc() {
|
||||
global $wpdb;
|
||||
|
|
|
@ -112,7 +112,7 @@ function wp_update_plugins() {
|
|||
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
||||
|
||||
$plugins = get_plugins();
|
||||
$active = get_option( 'active_plugins' );
|
||||
$active = get_option( 'active_plugins', array() );
|
||||
$current = get_site_transient( 'update_plugins' );
|
||||
if ( ! is_object($current) )
|
||||
$current = new stdClass;
|
||||
|
@ -147,7 +147,7 @@ function wp_update_plugins() {
|
|||
$current->last_checked = time();
|
||||
set_site_transient( 'update_plugins', $current );
|
||||
|
||||
$to_send = (object)compact('plugins', 'active');
|
||||
$to_send = (object) compact('plugins', 'active');
|
||||
|
||||
$options = array(
|
||||
'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3),
|
||||
|
|
Loading…
Reference in New Issue