Trim theme and plugin data. fixes #2943

git-svn-id: https://develop.svn.wordpress.org/trunk@4035 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2006-07-23 19:20:11 +00:00
parent 0932127dbc
commit 7180b478e1
2 changed files with 11 additions and 11 deletions

View File

@ -1612,23 +1612,23 @@ function get_plugin_data($plugin_file) {
preg_match("|Author:(.*)|i", $plugin_data, $author_name); preg_match("|Author:(.*)|i", $plugin_data, $author_name);
preg_match("|Author URI:(.*)|i", $plugin_data, $author_uri); preg_match("|Author URI:(.*)|i", $plugin_data, $author_uri);
if (preg_match("|Version:(.*)|i", $plugin_data, $version)) if (preg_match("|Version:(.*)|i", $plugin_data, $version))
$version = $version[1]; $version = trim($version[1]);
else else
$version = ''; $version = '';
$description = wptexturize($description[1]); $description = wptexturize(trim($description[1]));
$name = $plugin_name[1]; $name = $plugin_name[1];
$name = trim($name); $name = trim($name);
$plugin = $name; $plugin = $name;
if ('' != $plugin_uri[1] && '' != $name) { if ('' != $plugin_uri[1] && '' != $name) {
$plugin = '<a href="'.$plugin_uri[1].'" title="'.__('Visit plugin homepage').'">'.$plugin.'</a>'; $plugin = '<a href="' . trim($plugin_uri[1]) . '" title="'.__('Visit plugin homepage').'">'.$plugin.'</a>';
} }
if ('' == $author_uri[1]) { if ('' == $author_uri[1]) {
$author = $author_name[1]; $author = trim($author_name[1]);
} else { } else {
$author = '<a href="'.$author_uri[1].'" title="'.__('Visit author homepage').'">'.$author_name[1].'</a>'; $author = '<a href="' . trim($author_uri[1]) . '" title="'.__('Visit author homepage').'">' . trim($author_name[1]) . '</a>';
} }
return array ('Name' => $name, 'Title' => $plugin, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template[1]); return array ('Name' => $name, 'Title' => $plugin, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template[1]);

View File

@ -50,24 +50,24 @@ function get_theme_data($theme_file) {
preg_match("|Author URI:(.*)|i", $theme_data, $author_uri); preg_match("|Author URI:(.*)|i", $theme_data, $author_uri);
preg_match("|Template:(.*)|i", $theme_data, $template); preg_match("|Template:(.*)|i", $theme_data, $template);
if ( preg_match("|Version:(.*)|i", $theme_data, $version) ) if ( preg_match("|Version:(.*)|i", $theme_data, $version) )
$version = $version[1]; $version = trim($version[1]);
else else
$version =''; $version ='';
if ( preg_match("|Status:(.*)|i", $theme_data, $status) ) if ( preg_match("|Status:(.*)|i", $theme_data, $status) )
$status = $status[1]; $status = trim($status[1]);
else else
$status ='publish'; $status = 'publish';
$description = wptexturize($description[1]); $description = wptexturize(trim($description[1]));
$name = $theme_name[1]; $name = $theme_name[1];
$name = trim($name); $name = trim($name);
$theme = $name; $theme = $name;
if ( '' == $author_uri[1] ) { if ( '' == $author_uri[1] ) {
$author = $author_name[1]; $author = trim($author_name[1]);
} else { } else {
$author = '<a href="' . $author_uri[1] . '" title="' . __('Visit author homepage') . '">' . $author_name[1] . '</a>'; $author = '<a href="' . trim($author_uri[1]) . '" title="' . __('Visit author homepage') . '">' . trim($author_name[1]) . '</a>';
} }
return array('Name' => $name, 'Title' => $theme, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template[1], 'Status' => $status); return array('Name' => $name, 'Title' => $theme, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template[1], 'Status' => $status);