-function wpmu_get_blog_allowedthemes( $blog_id = 0 ) {
- $themes = get_themes();
-
- if ( $blog_id != 0 )
- switch_to_blog( $blog_id );
-
- $blog_allowed_themes = get_option( 'allowedthemes' );
- if ( !is_array( $blog_allowed_themes ) || empty( $blog_allowed_themes ) ) { // convert old allowed_themes to new allowedthemes
- $blog_allowed_themes = get_option( 'allowed_themes' );
-
- if ( is_array( $blog_allowed_themes ) ) {
- foreach( (array) $themes as $key => $theme ) {
- $theme_key = esc_html( $theme['Stylesheet'] );
- if ( isset( $blog_allowed_themes[$key] ) == true ) {
- $blog_allowedthemes[$theme_key] = 1;
- }
- }
- $blog_allowed_themes = $blog_allowedthemes;
- add_option( 'allowedthemes', $blog_allowed_themes );
- delete_option( 'allowed_themes' );
- }
- }
-
- if ( $blog_id != 0 )
- restore_current_blog();
-
- return $blog_allowed_themes;
-}
-