From e2513b564358ed8efd0e608489cf9787f633a8e9 Mon Sep 17 00:00:00 2001 From: rob1n Date: Sat, 2 Jun 2007 00:02:06 +0000 Subject: [PATCH] Keep greedy regex's in control. fixes #4165 git-svn-id: https://develop.svn.wordpress.org/trunk@5630 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/plugin.php | 11 ++++++----- wp-admin/includes/theme.php | 7 ++++--- wp-includes/theme.php | 12 ++++++------ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index fa65037250..c97b2db963 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -2,11 +2,12 @@ function get_plugin_data( $plugin_file ) { $plugin_data = implode( '', file( $plugin_file )); - preg_match( "|Plugin Name:(.*)|i", $plugin_data, $plugin_name ); - preg_match( "|Plugin URI:(.*)|i", $plugin_data, $plugin_uri ); - preg_match( "|Description:(.*)|i", $plugin_data, $description ); - preg_match( "|Author:(.*)|i", $plugin_data, $author_name ); - preg_match( "|Author URI:(.*)|i", $plugin_data, $author_uri ); + preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $plugin_name ); + preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $plugin_uri ); + preg_match( '|Description:(.*)$|mi', $plugin_data, $description ); + preg_match( '|Author:(.*)$|mi', $plugin_data, $author_name ); + preg_match( '|Author URI:(.*)$|mi', $plugin_data, $author_uri ); + if ( preg_match( "|Version:(.*)|i", $plugin_data, $version )) $version = trim( $version[1] ); else diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php index c00ac7f9a7..c2329b5e3c 100644 --- a/wp-admin/includes/theme.php +++ b/wp-admin/includes/theme.php @@ -33,13 +33,14 @@ function get_page_templates() { if ( is_array( $templates ) ) { foreach ( $templates as $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]; $description = $description[1]; - if (!empty ( $name ) ) { + if ( !empty( $name ) ) { $page_templates[trim( $name )] = basename( $template ); } } diff --git a/wp-includes/theme.php b/wp-includes/theme.php index eef7b6c224..fd73a5f550 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -73,12 +73,12 @@ function get_theme_data( $theme_file ) { $theme_data = implode( '', file( $theme_file ) ); $theme_data = str_replace ( '\r', '\n', $theme_data ); - preg_match( '|Theme Name:(.*)|i', $theme_data, $theme_name ); - preg_match( '|Theme URI:(.*)|i', $theme_data, $theme_uri ); - preg_match( '|Description:(.*)|i', $theme_data, $description ); - preg_match( '|Author:(.*)|i', $theme_data, $author_name ); - preg_match( '|Author URI:(.*)|i', $theme_data, $author_uri ); - preg_match( '|Template:(.*)|i', $theme_data, $template ); + preg_match( '|Theme Name:(.*)$|mi', $theme_data, $theme_name ); + preg_match( '|Theme URI:(.*)$|mi', $theme_data, $theme_uri ); + preg_match( '|Description:(.*)$|mi', $theme_data, $description ); + preg_match( '|Author:(.*)$|mi', $theme_data, $author_name ); + preg_match( '|Author URI:(.*)$|mi', $theme_data, $author_uri ); + preg_match( '|Template:(.*)$|mi', $theme_data, $template ); if ( preg_match( '|Version:(.*)|i', $theme_data, $version ) ) $version = wp_kses( trim( $version[1] ), $themes_allowed_tags );