From b51ae91b9a0de8aae8b138f8381a963ef2bdb706 Mon Sep 17 00:00:00 2001 From: saxmatt Date: Thu, 16 Dec 2004 03:08:07 +0000 Subject: [PATCH] Let's get_ down git-svn-id: http://svn.automattic.com/wordpress/trunk@1965 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-functions.php | 83 ++++++++++++++----------------- wp-includes/vars.php | 3 ++ 2 files changed, 39 insertions(+), 47 deletions(-) diff --git a/wp-includes/comment-functions.php b/wp-includes/comment-functions.php index 29f262d5e5..82b5a13f3e 100644 --- a/wp-includes/comment-functions.php +++ b/wp-includes/comment-functions.php @@ -61,8 +61,11 @@ function get_comments_link() { } function comments_link( $file = '', $echo = true ) { - if (!$echo) return get_permalink() . '#comments'; - else echo ; + echo get_comments_link(); +} + +function comment_link_rss() { + echo get_comments_link(); } function comments_popup_script($width=400, $height=400, $file='') { @@ -148,6 +151,11 @@ function comment_author() { echo $author; } +function comment_author_rss() { + $author = apply_filters('comment_author_rss', get_comment_author() ); + echo $author; +} + function get_comment_author_email() { global $comment; return apply_filters('get_comment_author_email', $comment->comment_author_email); @@ -244,6 +252,12 @@ function comment_text() { echo apply_filters('comment_text', get_comment_text() ); } +function comment_text_rss() { + $comment_text = get_comment_text(); + $comment_text = apply_filters('comment_text_rss', $comment_text); + echo $comment_text; +} + function get_comment_excerpt() { global $comment; $comment_text = str_replace('', '', $comment->comment_content); @@ -312,50 +326,21 @@ function comments_rss($commentsrssfilename = 'wp-commentsrss2.php') { return $url; } -function comment_author_rss() { - global $comment; - if (empty($comment->comment_author)) { - echo 'Anonymous'; - } else { - echo wp_specialchars(apply_filters('comment_author', $comment->comment_author)); - } -} - -function comment_text_rss() { - global $comment; - $comment_text = str_replace('', '', $comment->comment_content); - $comment_text = str_replace('', '', $comment_text); - $comment_text = apply_filters('comment_text', $comment_text); - $comment_text = strip_tags($comment_text); - $comment_text = wp_specialchars($comment_text); - echo $comment_text; -} - -function comment_link_rss() { - global $comment; - echo get_permalink($comment->comment_post_ID).'#comments'; -} - -function permalink_comments_rss() { - global $comment; - echo get_permalink($comment->comment_post_ID); -} - -function trackback_url($display = true) { +function get_trackback_url() { global $id; $tb_url = get_settings('siteurl') . '/wp-trackback.php/' . $id; - - if ('' != get_settings('permalink_structure')) { - $tb_url = trailingslashit(get_permalink()) . 'trackback/'; - } - - if ($display) { - echo $tb_url; - } else { - return $tb_url; - } -} + if ( '' != get_settings('permalink_structure') ) + $tb_url = trailingslashit(get_permalink()) . 'trackback/'; + + return $tb_url; +} +function trackback_url( $display = true ) { + if ( $display) + echo get_trackback_url(); + else + return get_trackback_url(); +} function trackback_rdf($timezone = 0) { global $id; @@ -377,14 +362,18 @@ function trackback_rdf($timezone = 0) { function comments_open() { global $post; - if ('open' == $post->comment_status) return true; - else return false; + if ( 'open' == $post->comment_status ) + return true; + else + return false; } function pings_open() { global $post; - if ('open' == $post->ping_status) return true; - else return false; + if ( 'open' == $post->ping_status ) + return true; + else + return false; } // Non-template functions diff --git a/wp-includes/vars.php b/wp-includes/vars.php index 451ef56a22..5cb0700ff4 100644 --- a/wp-includes/vars.php +++ b/wp-includes/vars.php @@ -212,6 +212,7 @@ add_filter('pre_comment_content', 'balanceTags', 30); // Default filters for these functions add_filter('comment_author', 'wptexturize'); add_filter('comment_author', 'convert_chars'); +add_filter('comment_author', 'wp_specialchars'); add_filter('comment_email', 'antispambot'); @@ -222,6 +223,8 @@ add_filter('comment_text', 'make_clickable'); add_filter('comment_text', 'wpautop', 30); add_filter('comment_text', 'convert_smilies', 20); +add_filter('comment_text_rss', 'htmlspecialchars'); + add_filter('comment_excerpt', 'convert_chars'); // Places to balance tags on input