Post reply API updates. see #8550

git-svn-id: http://svn.automattic.com/wordpress/trunk@10178 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-12-10 21:06:13 +00:00
parent 637d90aa96
commit 7105e62a48
1 changed files with 8 additions and 9 deletions

View File

@ -1004,6 +1004,7 @@ function get_comment_reply_link($args = array(), $comment = null, $post = null)
function comment_reply_link($args = array(), $comment = null, $post = null) { function comment_reply_link($args = array(), $comment = null, $post = null) {
echo get_comment_reply_link($args, $comment, $post); echo get_comment_reply_link($args, $comment, $post);
} }
/** /**
* Retrieve HTML content for reply to post link. * Retrieve HTML content for reply to post link.
* *
@ -1017,22 +1018,20 @@ function comment_reply_link($args = array(), $comment = null, $post = null) {
* @since 2.7.0 * @since 2.7.0
* *
* @param array $args Optional. Override default options. * @param array $args Optional. Override default options.
* @param int $post Optional. Post that the comment is going to be displayed on. * @param int|object $post Optional. Post that the comment is going to be displayed on. Defaults to current post.
* @return string|bool|null Link to show comment form, if successful. False, if comments are closed. * @return string|bool|null Link to show comment form, if successful. False, if comments are closed.
*/ */
function get_post_reply_link($args = array(), $post = null) {
function get_post_comments_link($args = array(), $comment = null, $post = null) {
global $user_ID; global $user_ID;
$defaults = array('add_below' => 'prologue', 'respond_id' => 'respond', 'reply_text' => __('Leave a Comment'), $defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Leave a Comment'),
'login_text' => __('Log in to leave a Comment'), 'before' => '', 'after' => ''); 'login_text' => __('Log in to leave a Comment'), 'before' => '', 'after' => '');
$args = wp_parse_args($args, $defaults); $args = wp_parse_args($args, $defaults);
extract($args, EXTR_SKIP); extract($args, EXTR_SKIP);
$post = get_post($post); $post = get_post($post);
if ( 'open' != $post->comment_status ) if ( !comments_open($post->ID) )
return false; return false;
if ( get_option('comment_registration') && !$user_ID ) { if ( get_option('comment_registration') && !$user_ID ) {
@ -1046,13 +1045,13 @@ function get_post_comments_link($args = array(), $comment = null, $post = null)
/** /**
* Displays the HTML content for reply to post link. * Displays the HTML content for reply to post link.
* @since 2.7.0 * @since 2.7.0
* @see get_post_comments_link() Echoes result * @see get_post_reply_link()
* *
* @param array $args Optional. Override default options. * @param array $args Optional. Override default options.
* @param int $post Optional. Post that the comment is going to be displayed on. * @param int|object $post Optional. Post that the comment is going to be displayed on.
* @return string|bool|null Link to show comment form, if successful. False, if comments are closed. * @return string|bool|null Link to show comment form, if successful. False, if comments are closed.
*/ */
function post_comments_link ($args = array(), $post = null) { function post_reply_link($args = array(), $post = null) {
echo get_post_comments_link($args, $post); echo get_post_comments_link($args, $post);
} }