Ticket #30594: enable_themes_function.diff
| File enable_themes_function.diff, 3.1 KB (added by , 12 years ago) |
|---|
-
src/wp-admin/network/themes.php
29 29 $referer = remove_query_arg( $temp_args, wp_get_referer() ); 30 30 31 31 if ( $action ) { 32 $allowed_themes = get_site_option( 'allowedthemes' );33 32 switch ( $action ) { 34 33 case 'enable': 35 34 check_admin_referer('enable-theme_' . $_GET['theme']); 36 $allowed_themes[ $_GET['theme'] ] = true; 37 update_site_option( 'allowedthemes', $allowed_themes ); 35 wp_network_enable_themes( $_GET['theme'] ); 38 36 if ( false === strpos( $referer, '/network/themes.php' ) ) 39 37 wp_redirect( network_admin_url( 'themes.php?enabled=1' ) ); 40 38 else … … 42 40 exit; 43 41 case 'disable': 44 42 check_admin_referer('disable-theme_' . $_GET['theme']); 45 unset( $allowed_themes[ $_GET['theme'] ] ); 46 update_site_option( 'allowedthemes', $allowed_themes ); 43 wp_network_disable_themes( $_GET['theme'] ); 47 44 wp_safe_redirect( add_query_arg( 'disabled', '1', $referer ) ); 48 45 exit; 49 46 case 'enable-selected': … … 53 50 wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); 54 51 exit; 55 52 } 56 foreach( (array) $themes as $theme ) 57 $allowed_themes[ $theme ] = true; 58 update_site_option( 'allowedthemes', $allowed_themes ); 53 wp_network_enable_themes( (array) $themes ); 59 54 wp_safe_redirect( add_query_arg( 'enabled', count( $themes ), $referer ) ); 60 55 exit; 61 56 case 'disable-selected': … … 65 60 wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); 66 61 exit; 67 62 } 68 foreach( (array) $themes as $theme ) 69 unset( $allowed_themes[ $theme ] ); 70 update_site_option( 'allowedthemes', $allowed_themes ); 63 wp_network_disable_themes( (array) $themes ); 71 64 wp_safe_redirect( add_query_arg( 'disabled', count( $themes ), $referer ) ); 72 65 exit; 73 66 case 'update-selected' : -
src/wp-includes/ms-functions.php
2434 2434 2435 2435 return $site_results; 2436 2436 } 2437 2438 /** 2439 * Enable a theme network widly 2440 * 2441 * @param string $stylesheet Stylesheet name 2442 */ 2443 function wp_network_enable_themes( $stylesheets ) { 2444 2445 if ( ! is_array( $stylesheets ) ) 2446 $stylesheets = array( $stylesheets ); 2447 2448 $allowed_themes = get_site_option( 'allowedthemes' ); 2449 2450 foreach ( $stylesheets as $stylesheet ) 2451 $allowed_themes[ $stylesheet ] = true; 2452 2453 update_site_option( 'allowedthemes', $allowed_themes ); 2454 } 2455 2456 /** 2457 * Disable a theme network widly 2458 * 2459 * @param string $stylesheet Stylesheet name 2460 */ 2461 function wp_network_disable_themes( $stylesheets ) { 2462 2463 if ( ! is_array( $stylesheets ) ) 2464 $stylesheets = array( $stylesheets ); 2465 2466 $allowed_themes = get_site_option( 'allowedthemes' ); 2467 2468 foreach ( $stylesheets as $stylesheet ) { 2469 if ( isset( $allowed_themes[ $stylesheet ] ) ) 2470 unset( $allowed_themes[ $stylesheet ] ); 2471 } 2472 2473 update_site_option( 'allowedthemes', $allowed_themes ); 2474 }
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)