WordPress.org

Make WordPress Core

Changeset 6372


Ignore:
Timestamp:
12/10/2007 08:49:46 PM (10 years ago)
Author:
matt
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment-template.php

    r6368 r6372  
    319319}
    320320
    321 function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {
     321function comments_popup_link( $zero = 'No Comments', $one = '1 Comment', $more = '% Comments', $css_class = '', $none = 'Comments Off' ) {
    322322    global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post;
    323323
     
    325325        return;
    326326
    327     $number = get_comments_number($id);
     327    $number = get_comments_number( $id );
    328328
    329329    if ( 0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status ) {
    330         echo '<span' . ((!empty($CSSclass)) ? ' class="' . $CSSclass . '"' : '') . '>' . $none . '</span>';
     330        echo '<span' . ((!empty($css_class)) ? ' class="' . $css_class . '"' : '') . '>' . $none . '</span>';
    331331        return;
    332332    }
    333333
    334334    if ( !empty($post->post_password) ) { // if there's a password
    335         if ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie
    336             echo(__('Enter your password to view comments'));
     335        if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password ) {  // and it doesn't match the cookie
     336            echo __('Enter your password to view comments');
    337337            return;
    338338        }
    339339    }
    340340
    341     $comments_popup_link = '<a href="';
    342     if ($wpcommentsjavascript) {
    343         if ( empty($wpcommentspopupfile) )
     341    echo '<a href="';
     342    if ( $wpcommentsjavascript ) {
     343        if ( empty( $wpcommentspopupfile ) )
    344344            $home = get_option('home');
    345345        else
    346346            $home = get_option('siteurl');
    347         $comments_popup_link .= $home . '/' . $wpcommentspopupfile.'?comments_popup='.$id;
    348         $comments_popup_link .= '" onclick="wpopen(this.href); return false"';
     347        echo $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id;
     348        echo '" onclick="wpopen(this.href); return false"';
    349349    } else { // if comments_popup_script() is not in the template, display simple comment link
    350350        if ( 0 == $number )
    351             $comments_popup_link .= get_permalink() . '#respond';
     351            echo get_permalink() . '#respond';
    352352        else
    353             $comments_popup_link .=  comments_link();
    354         $comments_popup_link .=   '"';
    355     }
    356 
    357     if (!empty($CSSclass)) {
    358         $comments_popup_link .= ' class="'.$CSSclass.'"';
    359     }
    360     $title = attribute_escape(get_the_title());
    361     $comments_popup_link .= ' title="' . sprintf( __('Comment on %s'), $title ) .'">';
    362     comments_number($zero, $one, $more, $number);
    363     $comments_popup_link .= '</a>';
    364     echo apply_filters('comments_popup_link', $comments_popup_link);
     353            comments_link();
     354        echo '"';
     355    }
     356
     357    if ( !empty( $css_class ) ) {
     358        echo ' class="'.$css_class.'" ';
     359    }
     360    $title = attribute_escape( get_the_title() );
     361   
     362    echo apply_filters( 'comments_popup_link_attributes', '' );
     363
     364    echo ' title="' . sprintf( __('Comment on %s'), $title ) . '">';
     365    comments_number( $zero, $one, $more, $number );
     366    echo '</a>';
    365367}
    366368
Note: See TracChangeset for help on using the changeset viewer.