Ticket #30594: enable_themes_function_3.diff
| File enable_themes_function_3.diff, 4.2 KB (added by , 11 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
1264 1264 } 1265 1265 1266 1266 /** 1267 * Enable a theme for a whole network 1268 * 1269 * @param mixed $stylesheet Stylesheet name or array of stylesheets 1270 * @access public 1271 */ 1272 public static function network_enable_theme( $stylesheets ) { 1273 if ( ! is_array( $stylesheets ) ) 1274 $stylesheets = array( $stylesheets ); 1275 1276 $allowed_themes = get_site_option( 'allowedthemes' ); 1277 1278 foreach ( $stylesheets as $stylesheet ) 1279 $allowed_themes[ $stylesheet ] = true; 1280 1281 update_site_option( 'allowedthemes', $allowed_themes ); 1282 } 1283 1284 /** 1285 * Disable a theme for a whole network 1286 * 1287 * @param mixed $stylesheet Stylesheet name or array of stylesheets 1288 * @access public 1289 */ 1290 public static function network_disable_theme( $stylesheets ) { 1291 if ( ! is_array( $stylesheets ) ) 1292 $stylesheets = array( $stylesheets ); 1293 1294 $allowed_themes = get_site_option( 'allowedthemes' ); 1295 1296 foreach ( $stylesheets as $stylesheet ) { 1297 if ( isset( $allowed_themes[ $stylesheet ] ) ) 1298 unset( $allowed_themes[ $stylesheet ] ); 1299 } 1300 1301 update_site_option( 'allowedthemes', $allowed_themes ); 1302 } 1303 1304 /** 1267 1305 * Sort themes by name. 1268 1306 * 1269 1307 * @since 3.4.0 -
src/wp-includes/ms-functions.php
2494 2494 */ 2495 2495 return apply_filters( 'subdirectory_reserved_names', $names ); 2496 2496 } 2497 2498 2499 /** 2500 * Enable a theme for a whole network 2501 * 2502 * @uses WP_Theme::network_enable_theme() 2503 * 2504 * @param mixed $stylesheet Stylesheet name or array of stylesheets 2505 */ 2506 function wp_network_enable_theme( $stylesheets ) { 2507 2508 WP_Theme::network_enable_theme( $stylesheets ); 2509 2510 } 2511 2512 /** 2513 * Disable a theme network wide 2514 * 2515 * @uses WP_Theme::network_disable_theme() 2516 * 2517 * @param mixed $stylesheet Stylesheet name or array of stylesheets 2518 */ 2519 function wp_network_disable_theme( $stylesheets ) { 2520 2521 WP_Theme::network_disable_theme( $stylesheets ); 2522 2523 } 2524 No newline at end of file
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)