diff --git src/wp-includes/comment-template.php src/wp-includes/comment-template.php
index ada53c8..dd6a627 100644
|
|
|
function get_comment_type( $comment_ID = 0 ) { |
| 1029 | 1029 | } |
| 1030 | 1030 | |
| 1031 | 1031 | /** |
| 1032 | | * Display the comment type of the current comment. |
| | 1032 | * Generates a display name for the comment type of the current comment. |
| 1033 | 1033 | * |
| 1034 | 1034 | * @since 0.71 |
| 1035 | 1035 | * |
| 1036 | 1036 | * @param string $commenttxt Optional. String to display for comment type. Default false. |
| 1037 | 1037 | * @param string $trackbacktxt Optional. String to display for trackback type. Default false. |
| 1038 | 1038 | * @param string $pingbacktxt Optional. String to display for pingback type. Default false. |
| | 1039 | * @param bool $echo Optional. Whether to echo or return the output. Default true. |
| | 1040 | * @return string|null Null when echo is truthy (default), a string otherwise |
| 1039 | 1041 | */ |
| 1040 | | function comment_type( $commenttxt = false, $trackbacktxt = false, $pingbacktxt = false ) { |
| 1041 | | if ( false === $commenttxt ) $commenttxt = _x( 'Comment', 'noun' ); |
| 1042 | | if ( false === $trackbacktxt ) $trackbacktxt = __( 'Trackback' ); |
| 1043 | | if ( false === $pingbacktxt ) $pingbacktxt = __( 'Pingback' ); |
| | 1042 | function comment_type( |
| | 1043 | $commenttxt = false, |
| | 1044 | $trackbacktxt = false, |
| | 1045 | $pingbacktxt = false, |
| | 1046 | $echo = true |
| | 1047 | ) { |
| | 1048 | |
| 1044 | 1049 | $type = get_comment_type(); |
| 1045 | 1050 | switch( $type ) { |
| 1046 | 1051 | case 'trackback' : |
| 1047 | | echo $trackbacktxt; |
| | 1052 | if ( false === $trackbacktxt ) { |
| | 1053 | $display_name = __( 'Trackback' ); |
| | 1054 | } else { |
| | 1055 | $display_name = $trackbacktxt; |
| | 1056 | } |
| 1048 | 1057 | break; |
| 1049 | 1058 | case 'pingback' : |
| 1050 | | echo $pingbacktxt; |
| | 1059 | if ( false === $pingbacktxt ) { |
| | 1060 | $display_name = __( 'Pingback' ); |
| | 1061 | } else { |
| | 1062 | $display_name = $pingbacktxt; |
| | 1063 | } |
| 1051 | 1064 | break; |
| 1052 | 1065 | default : |
| 1053 | | echo $commenttxt; |
| | 1066 | if ( false === $commenttxt ) { |
| | 1067 | $display_name = _x( 'Comment', 'noun' ); |
| | 1068 | } else { |
| | 1069 | $display_name = $commenttxt; |
| | 1070 | } |
| | 1071 | } |
| | 1072 | |
| | 1073 | $display_name = apply_filters( 'comment_type_display_name', $display_name ); |
| | 1074 | |
| | 1075 | if ($echo) { |
| | 1076 | echo $display_name; |
| | 1077 | } else { |
| | 1078 | return $display_name; |
| 1054 | 1079 | } |
| 1055 | 1080 | } |
| 1056 | 1081 | |