Changeset 12848
- Timestamp:
- 01/26/2010 06:39:12 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
wp-admin/includes/plugin.php (modified) (4 diffs)
-
wp-admin/plugin-editor.php (modified) (1 diff)
-
wp-admin/plugins.php (modified) (2 diffs)
-
wp-includes/load.php (modified) (1 diff)
-
wp-includes/ms-deprecated.php (modified) (1 diff)
-
wp-includes/ms-functions.php (modified) (2 diffs)
-
wp-includes/update.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/plugin.php
r12825 r12848 259 259 * @return bool True, if in the active plugins list. False, not in the list. 260 260 */ 261 function is_plugin_active( $plugin) {262 return in_array( $plugin, apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) );261 function is_plugin_active( $plugin ) { 262 return in_array( $plugin, apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) ) ); 263 263 } 264 264 … … 287 287 * @return WP_Error|null WP_Error on invalid file or null on success. 288 288 */ 289 function activate_plugin( $plugin, $redirect = '') {290 $current = get_option( 'active_plugins');291 $plugin = plugin_basename(trim($plugin));289 function activate_plugin( $plugin, $redirect = '' ) { 290 $current = get_option( 'active_plugins', array() ); 291 $plugin = plugin_basename( trim( $plugin ) ); 292 292 293 293 $valid = validate_plugin($plugin); … … 323 323 * @param bool $silent Optional, default is false. Prevent calling deactivate hook. 324 324 */ 325 function deactivate_plugins($plugins, $silent= false) { 326 $current = get_option('active_plugins'); 327 328 if ( !is_array($plugins) ) 329 $plugins = array($plugins); 330 331 foreach ( $plugins as $plugin ) { 325 function deactivate_plugins( $plugins, $silent = false ) { 326 $current = get_option( 'active_plugins', array() ); 327 328 foreach ( (array) $plugins as $plugin ) { 332 329 $plugin = plugin_basename($plugin); 333 330 if ( ! is_plugin_active($plugin) ) … … 476 473 } 477 474 475 /** 476 * validate active plugins 477 * 478 * validate all active plugins, deactivates invalid and 479 * returns an array of deactived ones. 480 * 481 * @since unknown 482 * @return array invalid plugins, plugin as key, error as value 483 */ 478 484 function validate_active_plugins() { 479 $check_plugins = apply_filters( 'active_plugins', get_option('active_plugins') ); 480 481 // Sanity check. If the active plugin list is not an array, make it an 482 // empty array. 483 if ( !is_array($check_plugins) ) { 485 $plugins = apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) ); 486 487 // validate vartype: array 488 if ( !is_array( $plugins ) ) { 484 489 update_option('active_plugins', array()); 485 490 return; 486 491 } 487 492 488 //Invalid is any plugin that is deactivated due to error.489 493 $invalid = array(); 490 494 491 // If a plugin file does not exist, remove it from the list of active 492 // plugins. 493 foreach ( $check_plugins as $check_plugin ) { 494 $result = validate_plugin($check_plugin); 495 // invalid plugins get deactivated 496 foreach ( $plugins as $plugin ) { 497 $result = validate_plugin( $plugin ); 495 498 if ( is_wp_error( $result ) ) { 496 $invalid[$ check_plugin] = $result;497 deactivate_plugins( $ check_plugin, true);499 $invalid[$plugin] = $result; 500 deactivate_plugins( $plugin, true ); 498 501 } 499 502 } -
trunk/wp-admin/plugin-editor.php
r12546 r12848 209 209 <?php endif; ?> 210 210 <?php if ( is_writeable($real_file) ) : ?> 211 <?php if ( in_array( $file, (array) get_option('active_plugins')) ) { ?>211 <?php if ( in_array( $file, (array) get_option( 'active_plugins', array() ) ) ) { ?> 212 212 <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> 213 213 <?php } ?> -
trunk/wp-admin/plugins.php
r12832 r12848 114 114 require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); 115 115 require_once( 'admin-header.php' ); 116 116 117 117 $url = 'plugins.php?action=upgrade-selected&plugins=' . urlencode( join( ',', $plugins ) ); 118 118 $title = __( 'Upgrade Plugins' ); … … 284 284 if ( is_multisite() && is_super_admin() ) { 285 285 $menu_perms = get_site_option('menu_items', array()); 286 if ( !$menu_perms['plugins'] ) {286 if ( empty($menu_perms['plugins']) ) 287 287 add_action( 'admin_notices', '_admin_notice_multisite_activate_plugins_page' ); 288 }288 unset($menu_perms); 289 289 } 290 290 -
trunk/wp-includes/load.php
r12762 r12848 405 405 $plugins[] = ABSPATH . 'my-hacks.php'; 406 406 407 $active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );407 $active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) ); 408 408 if ( !is_array( $active_plugins ) || defined( 'WP_INSTALLING' ) ) 409 409 return $plugins; -
trunk/wp-includes/ms-deprecated.php
r12839 r12848 111 111 } 112 112 113 /** 114 * @deprecated 3.0 115 */ 116 function clear_global_post_cache( $post_id ) { 117 _deprecated_function( __FUNCTION__, '3.0', 'clean_post_cache' ); 118 } 119 113 120 ?> -
trunk/wp-includes/ms-functions.php
r12840 r12848 726 726 } 727 727 728 // deprecated, see clean_post_cache()729 function clear_global_post_cache( $post_id ) {730 return;731 }732 733 728 function add_user_to_blog( $blog_id, $user_id, $role ) { 734 729 switch_to_blog($blog_id); … … 1987 1982 } 1988 1983 1989 function fix_active_plugins( $value ) {1990 if ( false == is_array( $value ) )1991 $value = array();1992 return $value;1993 }1994 add_filter( "option_active_plugins", "fix_active_plugins" );1995 1996 1984 if ( !function_exists('rss_gc') ) : 1997 1985 function rss_gc() { -
trunk/wp-includes/update.php
r12673 r12848 113 113 114 114 $plugins = get_plugins(); 115 $active = get_option( 'active_plugins' );115 $active = get_option( 'active_plugins', array() ); 116 116 $current = get_site_transient( 'update_plugins' ); 117 117 if ( ! is_object($current) ) … … 148 148 set_site_transient( 'update_plugins', $current ); 149 149 150 $to_send = (object) compact('plugins', 'active');150 $to_send = (object) compact('plugins', 'active'); 151 151 152 152 $options = array(
Note: See TracChangeset
for help on using the changeset viewer.