mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Support single line Template Name comment blocks for theme Templates and apply same cleanup to all header lines. Fixes #8497 props DD32 and Denis-de-Bernardy.
git-svn-id: https://develop.svn.wordpress.org/trunk@11168 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
+10
-10
@@ -180,50 +180,50 @@ function get_theme_data( $theme_file ) {
|
||||
$theme_data = implode( '', file( $theme_file ) );
|
||||
$theme_data = str_replace ( '\r', '\n', $theme_data );
|
||||
if ( preg_match( '|Theme Name:(.*)$|mi', $theme_data, $theme_name ) )
|
||||
$name = $theme = wp_kses( trim( $theme_name[1] ), $themes_allowed_tags );
|
||||
$name = $theme = wp_kses( _cleanup_header_comment($theme_name[1]), $themes_allowed_tags );
|
||||
else
|
||||
$name = $theme = '';
|
||||
|
||||
if ( preg_match( '|Theme URI:(.*)$|mi', $theme_data, $theme_uri ) )
|
||||
$theme_uri = clean_url( trim( $theme_uri[1] ) );
|
||||
$theme_uri = clean_url( _cleanup_header_comment($theme_uri[1]) );
|
||||
else
|
||||
$theme_uri = '';
|
||||
|
||||
if ( preg_match( '|Description:(.*)$|mi', $theme_data, $description ) )
|
||||
$description = wptexturize( wp_kses( trim( $description[1] ), $themes_allowed_tags ) );
|
||||
$description = wptexturize( wp_kses( _cleanup_header_comment($description[1]), $themes_allowed_tags ) );
|
||||
else
|
||||
$description = '';
|
||||
|
||||
if ( preg_match( '|Author URI:(.*)$|mi', $theme_data, $author_uri ) )
|
||||
$author_uri = clean_url( trim( $author_uri[1]) );
|
||||
$author_uri = clean_url( _cleanup_header_comment($author_uri[1]) );
|
||||
else
|
||||
$author_uri = '';
|
||||
|
||||
if ( preg_match( '|Template:(.*)$|mi', $theme_data, $template ) )
|
||||
$template = wp_kses( trim( $template[1] ), $themes_allowed_tags );
|
||||
$template = wp_kses( _cleanup_header_comment($template[1]), $themes_allowed_tags );
|
||||
else
|
||||
$template = '';
|
||||
|
||||
if ( preg_match( '|Version:(.*)|i', $theme_data, $version ) )
|
||||
$version = wp_kses( trim( $version[1] ), $themes_allowed_tags );
|
||||
$version = wp_kses( _cleanup_header_comment($version[1]), $themes_allowed_tags );
|
||||
else
|
||||
$version = '';
|
||||
|
||||
if ( preg_match('|Status:(.*)|i', $theme_data, $status) )
|
||||
$status = wp_kses( trim( $status[1] ), $themes_allowed_tags );
|
||||
$status = wp_kses( _cleanup_header_comment($status[1]), $themes_allowed_tags );
|
||||
else
|
||||
$status = 'publish';
|
||||
|
||||
if ( preg_match('|Tags:(.*)|i', $theme_data, $tags) )
|
||||
$tags = array_map( 'trim', explode( ',', wp_kses( trim( $tags[1] ), array() ) ) );
|
||||
$tags = array_map( 'trim', explode( ',', wp_kses( _cleanup_header_comment($tags[1]), array() ) ) );
|
||||
else
|
||||
$tags = array();
|
||||
|
||||
if ( preg_match( '|Author:(.*)$|mi', $theme_data, $author_name ) ) {
|
||||
if ( empty( $author_uri ) ) {
|
||||
$author = wp_kses( trim( $author_name[1] ), $themes_allowed_tags );
|
||||
$author = wp_kses( _cleanup_header_comment($author_name[1]), $themes_allowed_tags );
|
||||
} else {
|
||||
$author = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $author_uri, __( 'Visit author homepage' ), wp_kses( trim( $author_name[1] ), $themes_allowed_tags ) );
|
||||
$author = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $author_uri, __( 'Visit author homepage' ), wp_kses( _cleanup_header_comment($author_name[1]), $themes_allowed_tags ) );
|
||||
}
|
||||
} else {
|
||||
$author = __('Anonymous');
|
||||
|
||||
Reference in New Issue
Block a user