Keep greedy regex's in control. fixes #4165
git-svn-id: http://svn.automattic.com/wordpress/trunk@5630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
168c858844
commit
c927ae3f37
|
@ -2,11 +2,12 @@
|
||||||
|
|
||||||
function get_plugin_data( $plugin_file ) {
|
function get_plugin_data( $plugin_file ) {
|
||||||
$plugin_data = implode( '', file( $plugin_file ));
|
$plugin_data = implode( '', file( $plugin_file ));
|
||||||
preg_match( "|Plugin Name:(.*)|i", $plugin_data, $plugin_name );
|
preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $plugin_name );
|
||||||
preg_match( "|Plugin URI:(.*)|i", $plugin_data, $plugin_uri );
|
preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $plugin_uri );
|
||||||
preg_match( "|Description:(.*)|i", $plugin_data, $description );
|
preg_match( '|Description:(.*)$|mi', $plugin_data, $description );
|
||||||
preg_match( "|Author:(.*)|i", $plugin_data, $author_name );
|
preg_match( '|Author:(.*)$|mi', $plugin_data, $author_name );
|
||||||
preg_match( "|Author URI:(.*)|i", $plugin_data, $author_uri );
|
preg_match( '|Author URI:(.*)$|mi', $plugin_data, $author_uri );
|
||||||
|
|
||||||
if ( preg_match( "|Version:(.*)|i", $plugin_data, $version ))
|
if ( preg_match( "|Version:(.*)|i", $plugin_data, $version ))
|
||||||
$version = trim( $version[1] );
|
$version = trim( $version[1] );
|
||||||
else
|
else
|
||||||
|
|
|
@ -33,13 +33,14 @@ function get_page_templates() {
|
||||||
if ( is_array( $templates ) ) {
|
if ( is_array( $templates ) ) {
|
||||||
foreach ( $templates as $template ) {
|
foreach ( $templates as $template ) {
|
||||||
$template_data = implode( '', file( ABSPATH.$template ));
|
$template_data = implode( '', file( ABSPATH.$template ));
|
||||||
preg_match( "|Template Name:(.*)|i", $template_data, $name );
|
|
||||||
preg_match( "|Description:(.*)|i", $template_data, $description );
|
preg_match( '|Template Name:(.*)$|mi', $template_data, $name );
|
||||||
|
preg_match( '|Description:(.*)$|mi', $template_data, $description );
|
||||||
|
|
||||||
$name = $name[1];
|
$name = $name[1];
|
||||||
$description = $description[1];
|
$description = $description[1];
|
||||||
|
|
||||||
if (!empty ( $name ) ) {
|
if ( !empty( $name ) ) {
|
||||||
$page_templates[trim( $name )] = basename( $template );
|
$page_templates[trim( $name )] = basename( $template );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,12 +73,12 @@ function get_theme_data( $theme_file ) {
|
||||||
|
|
||||||
$theme_data = implode( '', file( $theme_file ) );
|
$theme_data = implode( '', file( $theme_file ) );
|
||||||
$theme_data = str_replace ( '\r', '\n', $theme_data );
|
$theme_data = str_replace ( '\r', '\n', $theme_data );
|
||||||
preg_match( '|Theme Name:(.*)|i', $theme_data, $theme_name );
|
preg_match( '|Theme Name:(.*)$|mi', $theme_data, $theme_name );
|
||||||
preg_match( '|Theme URI:(.*)|i', $theme_data, $theme_uri );
|
preg_match( '|Theme URI:(.*)$|mi', $theme_data, $theme_uri );
|
||||||
preg_match( '|Description:(.*)|i', $theme_data, $description );
|
preg_match( '|Description:(.*)$|mi', $theme_data, $description );
|
||||||
preg_match( '|Author:(.*)|i', $theme_data, $author_name );
|
preg_match( '|Author:(.*)$|mi', $theme_data, $author_name );
|
||||||
preg_match( '|Author URI:(.*)|i', $theme_data, $author_uri );
|
preg_match( '|Author URI:(.*)$|mi', $theme_data, $author_uri );
|
||||||
preg_match( '|Template:(.*)|i', $theme_data, $template );
|
preg_match( '|Template:(.*)$|mi', $theme_data, $template );
|
||||||
|
|
||||||
if ( preg_match( '|Version:(.*)|i', $theme_data, $version ) )
|
if ( preg_match( '|Version:(.*)|i', $theme_data, $version ) )
|
||||||
$version = wp_kses( trim( $version[1] ), $themes_allowed_tags );
|
$version = wp_kses( trim( $version[1] ), $themes_allowed_tags );
|
||||||
|
|
Loading…
Reference in New Issue