Ticket #12986: comments_popup_link.patch
| File comments_popup_link.patch, 3.4 KB (added by zeo, 3 years ago) |
|---|
-
wp-includes/comment-template.php
943 943 * @param string $none The string to display when comments have been turned off 944 944 * @return null Returns null on single posts and pages. 945 945 */ 946 function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {946 function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false, $password = false ) { 947 947 global $id, $wpcommentspopupfile, $wpcommentsjavascript; 948 948 949 if ( false === $zero ) $zero = __( 'No Comments' ); 950 if ( false === $one ) $one = __( '1 Comment' ); 951 if ( false === $more ) $more = __( '% Comments' ); 952 if ( false === $none ) $none = __( 'Comments Off' ); 953 949 if ( false === $zero ) $zero = __( 'No Comments' ); 950 if ( false === $one ) $one = __( '1 Comment' ); 951 if ( false === $more ) $more = __( '% Comments' ); 952 if ( false === $none ) $none = __( 'Comments Off' ); 953 if ( false === $password ) $password = __( 'Enter your password to view comments.' ); 954 954 955 $number = get_comments_number( $id ); 955 956 957 if ( !empty($css_class) || post_password_required() ) { 958 $class = ' class="'; 959 960 if ( !empty($css_class) ) 961 $class .= esc_attr($css_class); 962 963 if ( post_password_required() ) 964 $class .= ' enter-password'; 965 966 $class .= '"'; 967 } 968 956 969 if ( 0 == $number && !comments_open() && !pings_open() ) { 957 echo '<span' . ((!empty($css_class)) ? ' class="' . esc_attr( $css_class ) . '"' : ''). '>' . $none . '</span>';970 echo '<span' . $class . '>' . $none . '</span>'; 958 971 return; 959 972 } 960 973 961 974 if ( post_password_required() ) { 962 echo __('Enter your password to view comments.');975 echo '<span' . $class . '>' . $password . '</span>'; 963 976 return; 964 977 } 965 978 966 979 echo '<a href="'; 967 if ( $wpcommentsjavascript ) {968 if ( empty( $wpcommentspopupfile ) )969 $home = home_url();970 else971 $home = get_option('siteurl');972 echo $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id;973 echo '" onclick="wpopen(this.href); return false"';974 } else { // if comments_popup_script() is not in the template, display simple comment link975 if ( 0 == $number )976 echo get_permalink() . '#respond';977 else978 comments_link();979 echo '"';980 }980 if ( $wpcommentsjavascript ) { 981 if ( empty( $wpcommentspopupfile ) ) 982 $home = home_url(); 983 else 984 $home = get_option('siteurl'); 985 echo $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id; 986 echo '" onclick="wpopen(this.href); return false"'; 987 } else { // if comments_popup_script() is not in the template, display simple comment link 988 if ( 0 == $number ) 989 echo get_permalink() . '#respond'; 990 else 991 comments_link(); 992 echo '"'; 993 } 981 994 982 if ( !empty( $css_class ) ) { 983 echo ' class="'.$css_class.'" '; 984 } 985 $title = the_title_attribute( array('echo' => 0 ) ); 995 echo $class; 996 997 $title = the_title_attribute( array('echo' => 0 ) ); 986 998 987 echo apply_filters( 'comments_popup_link_attributes', '' );999 echo apply_filters( 'comments_popup_link_attributes', '' ); 988 1000 989 echo ' title="' . esc_attr( sprintf( __('Comment on %s'), $title ) ) . '">';990 comments_number( $zero, $one, $more );1001 echo ' title="' . esc_attr( sprintf( __('Comment on %s'), $title ) ) . '">'; 1002 comments_number( $zero, $one, $more ); 991 1003 echo '</a>'; 992 1004 } 993 1005
