Make WordPress Core


Ignore:
Timestamp:
11/29/2006 11:18:35 PM (19 years ago)
Author:
matt
Message:

Normalization of newlines fixes #1020, also did some minor reformatting.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/theme.php

    r4469 r4546  
    5656}
    5757
    58 function get_theme_data($theme_file) {
    59     $theme_data = implode('', file($theme_file));
    60     preg_match("|Theme Name:(.*)|i", $theme_data, $theme_name);
    61     preg_match("|Theme URI:(.*)|i", $theme_data, $theme_uri);
    62     preg_match("|Description:(.*)|i", $theme_data, $description);
    63     preg_match("|Author:(.*)|i", $theme_data, $author_name);
    64     preg_match("|Author URI:(.*)|i", $theme_data, $author_uri);
    65     preg_match("|Template:(.*)|i", $theme_data, $template);
    66     if ( preg_match("|Version:(.*)|i", $theme_data, $version) )
    67         $version = trim($version[1]);
     58function get_theme_data( $theme_file ) {
     59    $theme_data = implode( '', file( $theme_file ) );
     60    $theme_data = str_replace ( '\r', '\n', $theme_data );
     61    preg_match( '|Theme Name:(.*)|i', $theme_data, $theme_name );
     62    preg_match( '|Theme URI:(.*)|i', $theme_data, $theme_uri );
     63    preg_match( '|Description:(.*)|i', $theme_data, $description );
     64    preg_match( '|Author:(.*)|i', $theme_data, $author_name );
     65    preg_match( '|Author URI:(.*)|i', $theme_data, $author_uri );
     66    preg_match( '|Template:(.*)|i', $theme_data, $template );
     67    if ( preg_match( '|Version:(.*)|i', $theme_data, $version ) )
     68        $version = trim( $version[1] );
    6869    else
    6970        $version ='';
    70     if ( preg_match("|Status:(.*)|i", $theme_data, $status) )
     71    if ( preg_match('|Status:(.*)|i', $theme_data, $status) )
    7172        $status = trim($status[1]);
    7273    else
    7374        $status = 'publish';
    7475
    75     $description = wptexturize(trim($description[1]));
     76    $description = wptexturize( trim( $description[1] ) );
    7677
    7778    $name = $theme_name[1];
    78     $name = trim($name);
     79    $name = trim( $name );
    7980    $theme = $name;
    8081
    8182    if ( '' == $author_uri[1] ) {
    82         $author = trim($author_name[1]);
     83        $author = trim( $author_name[1] );
    8384    } else {
    84         $author = '<a href="' . trim($author_uri[1]) . '" title="' . __('Visit author homepage') . '">' . trim($author_name[1]) . '</a>';
    85     }
    86 
    87     return array('Name' => $name, 'Title' => $theme, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template[1], 'Status' => $status);
     85        $author = '<a href="' . trim( $author_uri[1] ) . '" title="' . __('Visit author homepage') . '">' . trim( $author_name[1] ) . '</a>';
     86    }
     87
     88    return array( 'Name' => $name, 'Title' => $theme, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template[1], 'Status' => $status );
    8889}
    8990
Note: See TracChangeset for help on using the changeset viewer.