Ticket #30594: enable_themes_function_2.diff
| File enable_themes_function_2.diff, 4.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_theme( $_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_theme( $_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_theme( (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_theme( (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/class-wp-theme.php
1195 1195 } 1196 1196 1197 1197 /** 1198 * Enable a theme for a whole network 1199 * 1200 * @param mixed $stylesheet Stylesheet name or array of stylesheets 1201 * @access public 1202 */ 1203 public static function network_enable_theme( $stylesheets ) { 1204 1205 if ( ! is_array( $stylesheets ) ) 1206 $stylesheets = array( $stylesheets ); 1207 1208 $allowed_themes = get_site_option( 'allowedthemes' ); 1209 1210 foreach ( $stylesheets as $stylesheet ) 1211 $allowed_themes[ $stylesheet ] = true; 1212 1213 update_site_option( 'allowedthemes', $allowed_themes ); 1214 } 1215 1216 /** 1217 * Disable a theme for a whole network 1218 * 1219 * @param mixed $stylesheet Stylesheet name or array of stylesheets 1220 * @access public 1221 */ 1222 public static function network_disable_theme( $stylesheets ) { 1223 if ( ! is_array( $stylesheets ) ) 1224 $stylesheets = array( $stylesheets ); 1225 1226 $allowed_themes = get_site_option( 'allowedthemes' ); 1227 1228 foreach ( $stylesheets as $stylesheet ) { 1229 if ( isset( $allowed_themes[ $stylesheet ] ) ) 1230 unset( $allowed_themes[ $stylesheet ] ); 1231 } 1232 1233 update_site_option( 'allowedthemes', $allowed_themes ); 1234 } 1235 1236 /** 1198 1237 * Sort themes by name. 1199 1238 * 1200 1239 * @since 3.4.0 -
src/wp-includes/ms-functions.php
2431 2431 2432 2432 return $site_results; 2433 2433 } 2434 2435 /** 2436 * Enable a theme for a whole network 2437 * 2438 * @uses WP_Theme::network_enable_theme() 2439 * 2440 * @param mixed $stylesheet Stylesheet name or array of stylesheets 2441 */ 2442 function wp_network_enable_theme( $stylesheets ) { 2443 2444 WP_Theme::network_enable_theme( $stylesheets ); 2445 2446 } 2447 2448 /** 2449 * Disable a theme network wide 2450 * 2451 * @uses WP_Theme::network_disable_theme() 2452 * 2453 * @param mixed $stylesheet Stylesheet name or array of stylesheets 2454 */ 2455 function wp_network_disable_theme( $stylesheets ) { 2456 2457 WP_Theme::network_disable_theme( $stylesheets ); 2458 2459 }
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)