Revert [6368]. Fixes #5448, fixes #5247 by adding a new filter to hook in specifically to add attributes, rather than filtering the whole thing. Minor formatting cleanup of comments_popup_link.
git-svn-id: http://svn.automattic.com/wordpress/trunk@6372 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c5dc5fb56e
commit
fa98e055e8
|
@ -318,7 +318,7 @@ function comments_popup_script($width=400, $height=400, $file='') {
|
||||||
echo $javascript;
|
echo $javascript;
|
||||||
}
|
}
|
||||||
|
|
||||||
function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {
|
function comments_popup_link( $zero = 'No Comments', $one = '1 Comment', $more = '% Comments', $css_class = '', $none = 'Comments Off' ) {
|
||||||
global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post;
|
global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post;
|
||||||
|
|
||||||
if ( is_single() || is_page() )
|
if ( is_single() || is_page() )
|
||||||
|
@ -327,41 +327,43 @@ function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Com
|
||||||
$number = get_comments_number( $id );
|
$number = get_comments_number( $id );
|
||||||
|
|
||||||
if ( 0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status ) {
|
if ( 0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status ) {
|
||||||
echo '<span' . ((!empty($CSSclass)) ? ' class="' . $CSSclass . '"' : '') . '>' . $none . '</span>';
|
echo '<span' . ((!empty($css_class)) ? ' class="' . $css_class . '"' : '') . '>' . $none . '</span>';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($post->post_password) ) { // if there's a password
|
if ( !empty($post->post_password) ) { // if there's a password
|
||||||
if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password ) { // and it doesn't match the cookie
|
if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password ) { // and it doesn't match the cookie
|
||||||
echo(__('Enter your password to view comments'));
|
echo __('Enter your password to view comments');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$comments_popup_link = '<a href="';
|
echo '<a href="';
|
||||||
if ( $wpcommentsjavascript ) {
|
if ( $wpcommentsjavascript ) {
|
||||||
if ( empty( $wpcommentspopupfile ) )
|
if ( empty( $wpcommentspopupfile ) )
|
||||||
$home = get_option('home');
|
$home = get_option('home');
|
||||||
else
|
else
|
||||||
$home = get_option('siteurl');
|
$home = get_option('siteurl');
|
||||||
$comments_popup_link .= $home . '/' . $wpcommentspopupfile.'?comments_popup='.$id;
|
echo $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id;
|
||||||
$comments_popup_link .= '" onclick="wpopen(this.href); return false"';
|
echo '" onclick="wpopen(this.href); return false"';
|
||||||
} else { // if comments_popup_script() is not in the template, display simple comment link
|
} else { // if comments_popup_script() is not in the template, display simple comment link
|
||||||
if ( 0 == $number )
|
if ( 0 == $number )
|
||||||
$comments_popup_link .= get_permalink() . '#respond';
|
echo get_permalink() . '#respond';
|
||||||
else
|
else
|
||||||
$comments_popup_link .= comments_link();
|
comments_link();
|
||||||
$comments_popup_link .= '"';
|
echo '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($CSSclass)) {
|
if ( !empty( $css_class ) ) {
|
||||||
$comments_popup_link .= ' class="'.$CSSclass.'"';
|
echo ' class="'.$css_class.'" ';
|
||||||
}
|
}
|
||||||
$title = attribute_escape( get_the_title() );
|
$title = attribute_escape( get_the_title() );
|
||||||
$comments_popup_link .= ' title="' . sprintf( __('Comment on %s'), $title ) .'">';
|
|
||||||
|
echo apply_filters( 'comments_popup_link_attributes', '' );
|
||||||
|
|
||||||
|
echo ' title="' . sprintf( __('Comment on %s'), $title ) . '">';
|
||||||
comments_number( $zero, $one, $more, $number );
|
comments_number( $zero, $one, $more, $number );
|
||||||
$comments_popup_link .= '</a>';
|
echo '</a>';
|
||||||
echo apply_filters('comments_popup_link', $comments_popup_link);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue