Ticket #40143: 40143.diff
File 40143.diff, 24.3 KB (added by , 16 months ago) |
---|
-
src/wp-includes/comment-template.php
24 24 function get_comment_author( $comment_id = 0 ) { 25 25 $comment = get_comment( $comment_id ); 26 26 27 $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : $comment_id;27 $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_id; 28 28 29 if ( empty( $comment->comment_author ) ) { 30 $user = ! empty( $comment->user_id ) ? get_userdata( $comment->user_id ) : false; 31 if ( $user ) { 29 if ( $comment ) { 30 if ( $comment->comment_author ) { 31 $comment_author = $comment->comment_author; 32 } elseif ( ! empty( $comment->user_id ) ) { 33 $user = get_userdata( $comment->user_id ); 32 34 $comment_author = $user->display_name; 33 35 } else { 34 36 $comment_author = __( 'Anonymous' ); 35 37 } 36 38 } else { 37 $comment_author = $comment->comment_author;39 $comment_author = ''; 38 40 } 39 41 40 42 /** … … 43 45 * @since 1.5.0 44 46 * @since 4.1.0 The `$comment_id` and `$comment` parameters were added. 45 47 * 46 * @param string $comment_author The comment author's username.47 * @param string $comment_id The comment ID as a numeric string.48 * @param WP_Comment $comment The comment object.48 * @param string $comment_author The comment author's username. 49 * @param string $comment_id The comment ID as a numeric string. 50 * @param WP_Comment|null $comment The comment object. 49 51 */ 50 52 return apply_filters( 'get_comment_author', $comment_author, $comment_id, $comment ); 51 53 } … … 62 64 function comment_author( $comment_id = 0 ) { 63 65 $comment = get_comment( $comment_id ); 64 66 65 $comment_author = get_comment_author( $comment ); 67 $comment_author = $comment ? get_comment_author( $comment ) : ''; 68 69 $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_id; 66 70 67 71 /** 68 72 * Filters the comment author's name for display. … … 73 77 * @param string $comment_author The comment author's username. 74 78 * @param string $comment_id The comment ID as a numeric string. 75 79 */ 76 echo apply_filters( 'comment_author', $comment_author, $comment ->comment_ID );80 echo apply_filters( 'comment_author', $comment_author, $comment_id ); 77 81 } 78 82 79 83 /** … … 89 93 function get_comment_author_email( $comment_id = 0 ) { 90 94 $comment = get_comment( $comment_id ); 91 95 96 $comment_author_email = $comment ? $comment->comment_author_email : ''; 97 98 $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_id; 99 92 100 /** 93 101 * Filters the comment author's returned email address. 94 102 * 95 103 * @since 1.5.0 96 104 * @since 4.1.0 The `$comment_id` and `$comment` parameters were added. 97 105 * 98 * @param string $comment_author_email The comment author's email address.99 * @param string $comment_id The comment ID as a numeric string.100 * @param WP_Comment $comment The comment object.106 * @param string $comment_author_email The comment author's email address. 107 * @param string $comment_id The comment ID as a numeric string. 108 * @param WP_Comment|null $comment The comment object. 101 109 */ 102 return apply_filters( 'get_comment_author_email', $comment ->comment_author_email, $comment->comment_ID, $comment );110 return apply_filters( 'get_comment_author_email', $comment_author_email, $comment_id, $comment ); 103 111 } 104 112 105 113 /** … … 120 128 function comment_author_email( $comment_id = 0 ) { 121 129 $comment = get_comment( $comment_id ); 122 130 123 $comment_author_email = get_comment_author_email( $comment ); 131 $comment_author_email = $comment ? get_comment_author_email( $comment ) : ''; 132 133 $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_id; 124 134 125 135 /** 126 136 * Filters the comment author's email for display. … … 131 141 * @param string $comment_author_email The comment author's email address. 132 142 * @param string $comment_id The comment ID as a numeric string. 133 143 */ 134 echo apply_filters( 'author_email', $comment_author_email, $comment ->comment_ID );144 echo apply_filters( 'author_email', $comment_author_email, $comment_id ); 135 145 } 136 146 137 147 /** … … 182 192 function get_comment_author_email_link( $link_text = '', $before = '', $after = '', $comment = null ) { 183 193 $comment = get_comment( $comment ); 184 194 195 $comment_author_email = $comment ? $comment->comment_author_email : ''; 196 185 197 /** 186 198 * Filters the comment author's email for display. 187 199 * … … 191 203 * @since 1.2.0 192 204 * @since 4.1.0 The `$comment` parameter was added. 193 205 * 194 * @param string $comment_author_email The comment author's email address.195 * @param WP_Comment $comment The comment object.206 * @param string $comment_author_email The comment author's email address. 207 * @param WP_Comment|null $comment The comment object. 196 208 */ 197 $comment_author_email = apply_filters( 'comment_email', $comment ->comment_author_email, $comment );209 $comment_author_email = apply_filters( 'comment_email', $comment_author_email, $comment ); 198 210 199 if ( ( ! empty( $comment_author_email ) ) && ( '@' !== $comment_author_email ) ) {200 $display = ( '' !== $link_text ) ? $link_text : $comment_author_email;211 if ( $comment_author_email && ( '@' !== $comment_author_email ) ) { 212 $display = $link_text ? $link_text : $comment_author_email; 201 213 202 214 $comment_author_email_link = $before . sprintf( 203 215 '<a href="%1$s">%2$s</a>', … … 229 241 230 242 $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_id; 231 243 232 $comment_author_url = get_comment_author_url( $comment );233 $comment_author = get_comment_author( $comment );244 $comment_author_url = $comment ? get_comment_author_url( $comment ) : ''; 245 $comment_author = $comment ? get_comment_author( $comment ) : ''; 234 246 235 247 if ( empty( $comment_author_url ) || 'http://' === $comment_author_url ) { 236 248 $comment_author_link = $comment_author; … … 248 260 * 249 261 * @since 6.2.0 250 262 * 251 * @param string[] $rel_parts An array of strings representing the rel tags252 * which will be joined into the anchor's rel attribute.253 * @param WP_Comment $comment The comment object.263 * @param string[] $rel_parts An array of strings representing the rel tags 264 * which will be joined into the anchor's rel attribute. 265 * @param WP_Comment|null $comment The comment object. 254 266 */ 255 267 $rel_parts = apply_filters( 'comment_author_link_rel', $rel_parts, $comment ); 256 268 … … 307 319 function get_comment_author_IP( $comment_id = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid 308 320 $comment = get_comment( $comment_id ); 309 321 322 $comment_author_ip = $comment ? $comment->comment_author_IP : ''; 323 324 $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_id; 325 310 326 /** 311 327 * Filters the comment author's returned IP address. 312 328 * 313 329 * @since 1.5.0 314 330 * @since 4.1.0 The `$comment_id` and `$comment` parameters were added. 315 331 * 316 * @param string $comment_author_ip The comment author's IP address, or an empty string if it's not available.317 * @param string $comment_id The comment ID as a numeric string.318 * @param WP_Comment $comment The comment object.332 * @param string $comment_author_ip The comment author's IP address, or an empty string if it's not available. 333 * @param string $comment_id The comment ID as a numeric string. 334 * @param WP_Comment|null $comment The comment object. 319 335 */ 320 return apply_filters( 'get_comment_author_IP', $comment ->comment_author_IP, $comment->comment_ID, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase336 return apply_filters( 'get_comment_author_IP', $comment_author_ip, $comment_id, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase 321 337 } 322 338 323 339 /** … … 346 362 function get_comment_author_url( $comment_id = 0 ) { 347 363 $comment = get_comment( $comment_id ); 348 364 349 $comment_author_url = '';350 $comment_id = 0;351 352 if ( ! empty( $comment ) ){353 $comment_author_url = ( 'http://' === $comment->comment_author_url ) ? '' : $comment->comment_author_url;354 $comment_author_url = esc_url( $comment_author_url, array( 'http', 'https' ) );365 366 if ( $comment && 'http://' !== $comment->comment_author_url ) { 367 $comment_author_url = esc_url( $comment->comment_author_url, array( 'http', 'https' ) ); 368 } else { 369 $comment_author_url = ''; 370 } 355 371 356 $comment_id = $comment->comment_ID; 357 } 372 $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_id; 358 373 359 374 /** 360 375 * Filters the comment author's URL. … … 366 381 * @param string|int $comment_id The comment ID as a numeric string, or 0 if not found. 367 382 * @param WP_Comment|null $comment The comment object, or null if not found. 368 383 */ 369 return apply_filters( 'get_comment_author_url', $comment_author_url, $comment_id, $comment ); 384 return apply_filters( 'get_comment_author_url', $comment_author_url, $comment_id, $comment ); 370 385 } 371 386 372 387 /** … … 381 396 function comment_author_url( $comment_id = 0 ) { 382 397 $comment = get_comment( $comment_id ); 383 398 384 $comment_author_url = get_comment_author_url( $comment ); 399 $comment_author_url = $comment ? get_comment_author_url( $comment ) : ''; 400 401 $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_id; 385 402 386 403 /** 387 404 * Filters the comment author's URL for display. … … 392 409 * @param string $comment_author_url The comment author's URL. 393 410 * @param string $comment_id The comment ID as a numeric string. 394 411 */ 395 echo apply_filters( 'comment_url', $comment_author_url, $comment ->comment_ID );412 echo apply_filters( 'comment_url', $comment_author_url, $comment_id ); 396 413 } 397 414 398 415 /** … … 421 438 function get_comment_author_url_link( $link_text = '', $before = '', $after = '', $comment = 0 ) { 422 439 $comment_author_url = get_comment_author_url( $comment ); 423 440 424 $display = ( '' !== $link_text ) ? $link_text : $comment_author_url;441 $display = $link_text ? $link_text : $comment_author_url; 425 442 $display = str_replace( 'http://www.', '', $display ); 426 443 $display = str_replace( 'http://', '', $display ); 427 444 … … 603 620 604 621 $_format = ! empty( $format ) ? $format : get_option( 'date_format' ); 605 622 606 $comment_date = mysql2date( $_format, $comment->comment_date );623 $comment_date = $comment ? mysql2date( $_format, $comment->comment_date ) : ''; 607 624 608 625 /** 609 626 * Filters the returned comment date. 610 627 * 611 628 * @since 1.5.0 612 629 * 613 * @param string|int $comment_date Formatted date string or Unix timestamp.614 * @param string $format PHP date format.615 * @param WP_Comment $comment The comment object.630 * @param string|int $comment_date Formatted date string or Unix timestamp. 631 * @param string $format PHP date format. 632 * @param WP_Comment|null $comment The comment object. 616 633 */ 617 634 return apply_filters( 'get_comment_date', $comment_date, $format, $comment ); 618 635 } … … 646 663 function get_comment_excerpt( $comment_id = 0 ) { 647 664 $comment = get_comment( $comment_id ); 648 665 666 $comment_text = $comment ? $comment->comment_content : ''; 667 668 $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_id; 669 649 670 if ( ! post_password_required( $comment->comment_post_ID ) ) { 650 $comment_text = strip_tags( str_replace( array( "\n", "\r" ), ' ', $comment ->comment_content ) );671 $comment_text = strip_tags( str_replace( array( "\n", "\r" ), ' ', $comment_text ) ); 651 672 } else { 652 673 $comment_text = __( 'Password protected' ); 653 674 } … … 672 693 * @since 1.5.0 673 694 * @since 4.1.0 The `$comment_id` and `$comment` parameters were added. 674 695 * 675 * @param string $comment_excerpt The comment excerpt text.676 * @param string $comment_id The comment ID as a numeric string.677 * @param WP_Comment $comment The comment object.696 * @param string $comment_excerpt The comment excerpt text. 697 * @param string $comment_id The comment ID as a numeric string. 698 * @param WP_Comment|null $comment The comment object. 678 699 */ 679 return apply_filters( 'get_comment_excerpt', $comment_excerpt, $comment ->comment_ID, $comment );700 return apply_filters( 'get_comment_excerpt', $comment_excerpt, $comment_id, $comment ); 680 701 } 681 702 682 703 /** … … 691 712 function comment_excerpt( $comment_id = 0 ) { 692 713 $comment = get_comment( $comment_id ); 693 714 694 $comment_excerpt = get_comment_excerpt( $comment ); 715 $comment_excerpt = $comment ? get_comment_excerpt( $comment ) : ''; 716 717 $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_id; 695 718 696 719 /** 697 720 * Filters the comment excerpt for display. … … 702 725 * @param string $comment_excerpt The comment excerpt text. 703 726 * @param string $comment_id The comment ID as a numeric string. 704 727 */ 705 echo apply_filters( 'comment_excerpt', $comment_excerpt, $comment ->comment_ID );728 echo apply_filters( 'comment_excerpt', $comment_excerpt, $comment_id ); 706 729 } 707 730 708 731 /** … … 715 738 function get_comment_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid 716 739 $comment = get_comment(); 717 740 718 $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : '0'; 741 $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : '0'; 719 742 720 743 /** 721 744 * Filters the returned comment ID. … … 723 746 * @since 1.5.0 724 747 * @since 4.1.0 The `$comment` parameter was added. 725 748 * 726 * @param string $comment_id The current comment ID as a numeric string.727 * @param WP_Comment $comment The comment object.749 * @param string $comment_id The current comment ID as a numeric string. 750 * @param WP_Comment|null $comment The comment object. 728 751 */ 729 752 return apply_filters( 'get_comment_ID', $comment_id, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase 730 753 } … … 783 806 784 807 $args = wp_parse_args( $args, $defaults ); 785 808 786 $comment_link = get_permalink( $comment->comment_post_ID );809 $comment_link = $comment ? get_permalink( $comment->comment_post_ID ) : ''; 787 810 788 811 // The 'cpage' param takes precedence. 789 812 if ( ! is_null( $args['cpage'] ) ) { … … 807 830 $cpage = get_query_var( 'cpage' ); 808 831 } else { 809 832 // Requires a database hit, so we only do it when we can't figure out from context. 810 $cpage = get_page_of_comment( $comment->comment_ID, $args );833 $cpage = $comment ? get_page_of_comment( $comment->comment_ID, $args ) : 0; 811 834 } 812 835 } 813 836 … … 836 859 $comment_link = user_trailingslashit( $comment_link, 'comment' ); 837 860 } 838 861 839 $comment_link = $comment_link . '#comment-' . $comment->comment_ID;862 $comment_link = ( $comment_link ) ? $comment_link . '#comment-' . $comment->comment_ID : ''; 840 863 841 864 /** 842 865 * Filters the returned single comment permalink. … … 846 869 * 847 870 * @see get_page_of_comment() 848 871 * 849 * @param string $comment_link The comment permalink with '#comment-$id' appended.850 * @param WP_Comment $comment The current comment object.851 * @param array $args An array of arguments to override the defaults.852 * @param int $cpage The calculated 'cpage' value.872 * @param string $comment_link The comment permalink with '#comment-$id' appended. 873 * @param WP_Comment|null $comment The current comment object. 874 * @param array $args An array of arguments to override the defaults. 875 * @param int $cpage The calculated 'cpage' value. 853 876 */ 854 877 return apply_filters( 'get_comment_link', $comment_link, $comment, $args, $cpage ); 855 878 } … … 1021 1044 function get_comment_text( $comment_id = 0, $args = array() ) { 1022 1045 $comment = get_comment( $comment_id ); 1023 1046 1024 $comment_text = $comment ->comment_content;1047 $comment_text = $comment ? $comment->comment_content : ''; 1025 1048 1026 if ( is_comment_feed() && $comment->comment_parent ) {1049 if ( is_comment_feed() && ! empty( $comment->comment_parent ) ) { 1027 1050 $parent = get_comment( $comment->comment_parent ); 1028 1051 if ( $parent ) { 1029 1052 $parent_link = esc_url( get_comment_link( $parent ) ); … … 1044 1067 * 1045 1068 * @see Walker_Comment::comment() 1046 1069 * 1047 * @param string $comment_text Text of the comment.1048 * @param WP_Comment $comment The comment object.1049 * @param array $args An array of arguments.1070 * @param string $comment_text Text of the comment. 1071 * @param WP_Comment|null $comment The comment object. 1072 * @param array $args An array of arguments. 1050 1073 */ 1051 1074 return apply_filters( 'get_comment_text', $comment_text, $comment, $args ); 1052 1075 } … … 1066 1089 function comment_text( $comment_id = 0, $args = array() ) { 1067 1090 $comment = get_comment( $comment_id ); 1068 1091 1069 $comment_text = get_comment_text( $comment, $args );1092 $comment_text = $comment ? get_comment_text( $comment, $args ) : ''; 1070 1093 1071 1094 /** 1072 1095 * Filters the text of a comment to be displayed. … … 1099 1122 function get_comment_time( $format = '', $gmt = false, $translate = true, $comment_id = 0 ) { 1100 1123 $comment = get_comment( $comment_id ); 1101 1124 1102 if ( null === $comment ) { 1103 return ''; 1104 } 1105 1106 $comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date; 1125 1126 if ( $comment ) { 1127 $comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date; 1107 1128 1108 $_format = ! empty( $format ) ? $format : get_option( 'time_format' );1129 $_format = ! empty( $format ) ? $format : get_option( 'time_format' ); 1109 1130 1110 $comment_time = mysql2date( $_format, $comment_date, $translate ); 1131 $comment_time = mysql2date( $_format, $comment_date, $translate ); 1132 } else { 1133 $comment_time = ''; 1134 } 1111 1135 1112 1136 /** 1113 1137 * Filters the returned comment time. 1114 1138 * 1115 1139 * @since 1.5.0 1116 1140 * 1117 * @param string|int $comment_time The comment time, formatted as a date string or Unix timestamp.1118 * @param string $format PHP date format.1119 * @param bool $gmt Whether the GMT date is in use.1120 * @param bool $translate Whether the time is translated.1121 * @param WP_Comment $comment The comment object.1141 * @param string|int $comment_time The comment time, formatted as a date string or Unix timestamp. 1142 * @param string $format PHP date format. 1143 * @param bool $gmt Whether the GMT date is in use. 1144 * @param bool $translate Whether the time is translated. 1145 * @param WP_Comment|null $comment The comment object. 1122 1146 */ 1123 1147 return apply_filters( 'get_comment_time', $comment_time, $format, $gmt, $translate, $comment ); 1124 1148 } … … 1150 1174 function get_comment_type( $comment_id = 0 ) { 1151 1175 $comment = get_comment( $comment_id ); 1152 1176 1153 if ( '' === $comment->comment_type ) { 1154 $comment->comment_type = 'comment'; 1155 } 1177 1178 if ( $comment ) { 1179 $comment_type = $comment->comment_type ? $comment->comment_type : 'comment'; 1180 } else { 1181 $comment_type = ''; 1182 } 1183 1184 $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_id; 1156 1185 1157 1186 /** 1158 1187 * Filters the returned comment type. … … 1160 1189 * @since 1.5.0 1161 1190 * @since 4.1.0 The `$comment_id` and `$comment` parameters were added. 1162 1191 * 1163 * @param string $comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'.1164 * @param string $comment_id The comment ID as a numeric string.1165 * @param WP_Comment $comment The comment object.1192 * @param string $comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'. Empty string for non-existent comment. 1193 * @param string $comment_id The comment ID as a numeric string. 1194 * @param WP_Comment|null $comment The comment object. 1166 1195 */ 1167 return apply_filters( 'get_comment_type', $comment ->comment_type, $comment->comment_ID, $comment );1196 return apply_filters( 'get_comment_type', $comment_type, $comment_id, $comment ); 1168 1197 } 1169 1198 1170 1199 /** … … 1763 1792 1764 1793 $comment = get_comment( $comment ); 1765 1794 1766 if ( empty( $comment ) ) { 1767 return; 1768 } 1769 1770 if ( empty( $post ) ) { 1795 if ( ! $post && $comment ) { 1771 1796 $post = $comment->comment_post_ID; 1772 1797 } 1773 1798 1774 1799 $post = get_post( $post ); 1775 1800 1776 if ( ! comments_open( $post->ID ) ) {1801 if ( $post && ! comments_open( $post->ID ) ) { 1777 1802 return false; 1778 1803 } 1779 1804 1780 if ( get_option( 'page_comments' ) ) {1781 $permalink = str_replace( '#comment-' . $comment->comment_ID, '', get_comment_link( $comment ) );1782 } else {1783 $permalink = get_permalink( $post->ID );1784 }1785 1786 1805 /** 1787 1806 * Filters the comment reply link arguments. 1788 1807 * 1789 1808 * @since 4.1.0 1790 1809 * 1791 * @param array $args Comment reply link arguments. See get_comment_reply_link()1792 * for more information on accepted arguments.1793 * @param WP_Comment $comment The object of the comment being replied to.1794 * @param WP_Post $post The WP_Post object.1810 * @param array $args Comment reply link arguments. See get_comment_reply_link() 1811 * for more information on accepted arguments. 1812 * @param WP_Comment|null $comment The object of the comment being replied to. 1813 * @param WP_Post $post The WP_Post object. 1795 1814 */ 1796 1815 $args = apply_filters( 'comment_reply_link_args', $args, $comment, $post ); 1797 1816 … … 1801 1820 esc_url( wp_login_url( get_permalink() ) ), 1802 1821 $args['login_text'] 1803 1822 ); 1804 } else {1823 } elseif ( $comment ) { 1805 1824 $data_attributes = array( 1806 1825 'commentid' => $comment->comment_ID, 1807 1826 'postid' => $post->ID, … … 1818 1837 1819 1838 $data_attribute_string = trim( $data_attribute_string ); 1820 1839 1840 1841 if ( get_option( 'page_comments' ) ) { 1842 $permalink = str_replace( '#comment-' . $comment->comment_ID, '', get_comment_link( $comment ) ); 1843 } else { 1844 $permalink = $post ? get_permalink( $post->ID ) : ''; 1845 } 1846 1821 1847 $link = sprintf( 1822 1848 "<a rel='nofollow' class='comment-reply-link' href='%s' %s aria-label='%s'>%s</a>", 1823 1849 esc_url( … … 1834 1860 esc_attr( sprintf( $args['reply_to_text'], get_comment_author( $comment ) ) ), 1835 1861 $args['reply_text'] 1836 1862 ); 1837 } 1863 } else { 1864 $link = ''; 1865 } 1838 1866 1839 1867 $comment_reply_link = $args['before'] . $link . $args['after']; 1840 1868 … … 1843 1871 * 1844 1872 * @since 2.7.0 1845 1873 * 1846 * @param string $comment_reply_link The HTML markup for the comment reply link.1847 * @param array $args An array of arguments overriding the defaults.1848 * @param WP_Comment $comment The object of the comment being replied.1849 * @param WP_Post $post The WP_Post object.1874 * @param string $comment_reply_link The HTML markup for the comment reply link. 1875 * @param array $args An array of arguments overriding the defaults. 1876 * @param WP_Comment|null $comment The object of the comment being replied. 1877 * @param WP_Post $post The WP_Post object. 1850 1878 */ 1851 1879 return apply_filters( 'comment_reply_link', $comment_reply_link, $args, $comment, $post ); 1852 1880 } -
tests/phpunit/tests/comment/getCommentExcerpt.php
24 24 $this->assertCount( 20, explode( ' ', $excerpt ) ); 25 25 } 26 26 27 public function test_get_comment_excerpt_with_non_existing_id() { 28 $comment_id = self::factory()->comment->create( array( 29 'comment_content' => self::$bacon_comment 30 ) ); 31 32 $this->assertEquals( '', get_comment_excerpt( -1 ) ); 33 } 34 27 35 public function test_get_comment_excerpt_filtered() { 28 36 $comment_id = self::factory()->comment->create( 29 37 array( -
tests/phpunit/tests/comment/getCommentReplyLink.php
72 72 /** 73 73 * @ticket 41846 74 74 */ 75 public function test_should_return_ null_when_depth_less_than_max_depth_and_comment_null_and_no_current_global_comment() {75 public function test_should_return_empty_string_when_depth_less_than_max_depth_and_comment_null_and_no_current_global_comment() { 76 76 77 77 // Let max depth be greater than depth and depth be non-zero. 78 78 $args = array( … … 85 85 86 86 $actual = get_comment_reply_link( $args ); 87 87 88 $this->assert Null($actual );88 $this->assertEquals( '', $actual ); 89 89 } 90 90 }