Fix for empty comment bug.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2004-04-23 04:03:10 +00:00
parent 6da74edda9
commit b6a13bf8ab
1 changed files with 7 additions and 11 deletions

View File

@ -21,7 +21,7 @@ add_filter('comment_excerpt', 'remove_slashes', 5);
add_filter('comment_excerpt', 'convert_chars'); add_filter('comment_excerpt', 'convert_chars');
function clean_url($url) { function clean_url($url) {
$url = str_replace('http://url', '', $url); if ('' == $url) return $url;
$url = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $url); $url = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $url);
$url = str_replace(';//', '://', $url); $url = str_replace(';//', '://', $url);
$url = (!strstr($url, '://')) ? 'http://'.$url : $url; $url = (!strstr($url, '://')) ? 'http://'.$url : $url;
@ -122,17 +122,13 @@ function comment_author_link() {
global $comment; global $comment;
$url = apply_filters('comment_url', $comment->comment_author_url); $url = apply_filters('comment_url', $comment->comment_author_url);
$author = apply_filters('comment_author', $comment->comment_author); $author = apply_filters('comment_author', $comment->comment_author);
if (!$author) $author = 'Anonymous';
if (empty($url) && empty($email)) { if (empty($url)) :
echo 'Anonymous'; echo $author;
return; else:
} echo "<a href='$url' rel='external'>$author</a>";
endif;
echo '<a href="';
if ($url) {
echo $url;
}
echo '" rel="external">' . $author . '</a>';
} }
function comment_type($commenttxt = 'Comment', $trackbacktxt = 'Trackback', $pingbacktxt = 'Pingback') { function comment_type($commenttxt = 'Comment', $trackbacktxt = 'Trackback', $pingbacktxt = 'Pingback') {