Make WordPress Core

Ticket #9336: missing_theme_lines.9336.diff

File missing_theme_lines.9336.diff, 1.6 KB (added by filosofo, 16 years ago)
  • wp-includes/theme.php

     
    179179
    180180        $theme_data = implode( '', file( $theme_file ) );
    181181        $theme_data = str_replace ( '\r', '\n', $theme_data );
    182         preg_match( '|Theme Name:(.*)$|mi', $theme_data, $theme_name );
    183         preg_match( '|Theme URI:(.*)$|mi', $theme_data, $theme_uri );
    184         preg_match( '|Description:(.*)$|mi', $theme_data, $description );
     182        if ( preg_match( '|Theme Name:(.*)$|mi', $theme_data, $theme_name ) )
     183                $name = $theme = wp_kses( trim( $theme_name[1] ), $themes_allowed_tags );
     184        else
     185                $name = $theme = '';
    185186
     187        if ( preg_match( '|Theme URI:(.*)$|mi', $theme_data, $theme_uri ) )
     188                $theme_uri = clean_url( trim( $theme_uri[1] ) );
     189        else
     190                $theme_uri = '';
     191               
     192        if ( preg_match( '|Description:(.*)$|mi', $theme_data, $description ) )
     193                $description = wptexturize( wp_kses( trim( $description[1] ), $themes_allowed_tags ) );
     194        else
     195                $description = '';
     196
    186197        if ( preg_match( '|Author URI:(.*)$|mi', $theme_data, $author_uri ) )
    187198                $author_uri = clean_url( trim( $author_uri[1]) );
    188199        else
     
    208219        else
    209220                $tags = array();
    210221
    211         $name = $theme = wp_kses( trim( $theme_name[1] ), $themes_allowed_tags );
    212         $theme_uri = clean_url( trim( $theme_uri[1] ) );
    213         $description = wptexturize( wp_kses( trim( $description[1] ), $themes_allowed_tags ) );
    214 
    215222        if ( preg_match( '|Author:(.*)$|mi', $theme_data, $author_name ) ) {
    216223                if ( empty( $author_uri ) ) {
    217224                        $author = wp_kses( trim( $author_name[1] ), $themes_allowed_tags );