Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-inclu...
File: comment-template.php
*
[1000] Fix | Delete
* @since 1.5.0
[1001] Fix | Delete
*
[1002] Fix | Delete
* @see _n()
[1003] Fix | Delete
*
[1004] Fix | Delete
* @param string $comments_number_text A translatable string formatted based on whether the count
[1005] Fix | Delete
* is equal to 0, 1, or 1+.
[1006] Fix | Delete
* @param int $comments_number The number of post comments.
[1007] Fix | Delete
*/
[1008] Fix | Delete
return apply_filters( 'comments_number', $comments_number_text, $comments_number );
[1009] Fix | Delete
}
[1010] Fix | Delete
[1011] Fix | Delete
/**
[1012] Fix | Delete
* Retrieves the text of the current comment.
[1013] Fix | Delete
*
[1014] Fix | Delete
* @since 1.5.0
[1015] Fix | Delete
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
[1016] Fix | Delete
* @since 5.4.0 Added 'In reply to %s.' prefix to child comments in comments feed.
[1017] Fix | Delete
*
[1018] Fix | Delete
* @see Walker_Comment::comment()
[1019] Fix | Delete
*
[1020] Fix | Delete
* @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the text.
[1021] Fix | Delete
* Default current comment.
[1022] Fix | Delete
* @param array $args Optional. An array of arguments. Default empty array.
[1023] Fix | Delete
* @return string The comment content.
[1024] Fix | Delete
*/
[1025] Fix | Delete
function get_comment_text( $comment_id = 0, $args = array() ) {
[1026] Fix | Delete
$comment = get_comment( $comment_id );
[1027] Fix | Delete
[1028] Fix | Delete
$comment_text = $comment->comment_content;
[1029] Fix | Delete
[1030] Fix | Delete
if ( is_comment_feed() && $comment->comment_parent ) {
[1031] Fix | Delete
$parent = get_comment( $comment->comment_parent );
[1032] Fix | Delete
if ( $parent ) {
[1033] Fix | Delete
$parent_link = esc_url( get_comment_link( $parent ) );
[1034] Fix | Delete
$name = get_comment_author( $parent );
[1035] Fix | Delete
[1036] Fix | Delete
$comment_text = sprintf(
[1037] Fix | Delete
/* translators: %s: Comment link. */
[1038] Fix | Delete
ent2ncr( __( 'In reply to %s.' ) ),
[1039] Fix | Delete
'<a href="' . $parent_link . '">' . $name . '</a>'
[1040] Fix | Delete
) . "\n\n" . $comment_text;
[1041] Fix | Delete
}
[1042] Fix | Delete
}
[1043] Fix | Delete
[1044] Fix | Delete
/**
[1045] Fix | Delete
* Filters the text of a comment.
[1046] Fix | Delete
*
[1047] Fix | Delete
* @since 1.5.0
[1048] Fix | Delete
*
[1049] Fix | Delete
* @see Walker_Comment::comment()
[1050] Fix | Delete
*
[1051] Fix | Delete
* @param string $comment_text Text of the comment.
[1052] Fix | Delete
* @param WP_Comment $comment The comment object.
[1053] Fix | Delete
* @param array $args An array of arguments.
[1054] Fix | Delete
*/
[1055] Fix | Delete
return apply_filters( 'get_comment_text', $comment_text, $comment, $args );
[1056] Fix | Delete
}
[1057] Fix | Delete
[1058] Fix | Delete
/**
[1059] Fix | Delete
* Displays the text of the current comment.
[1060] Fix | Delete
*
[1061] Fix | Delete
* @since 0.71
[1062] Fix | Delete
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
[1063] Fix | Delete
*
[1064] Fix | Delete
* @see Walker_Comment::comment()
[1065] Fix | Delete
*
[1066] Fix | Delete
* @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to print the text.
[1067] Fix | Delete
* Default current comment.
[1068] Fix | Delete
* @param array $args Optional. An array of arguments. Default empty array.
[1069] Fix | Delete
*/
[1070] Fix | Delete
function comment_text( $comment_id = 0, $args = array() ) {
[1071] Fix | Delete
$comment = get_comment( $comment_id );
[1072] Fix | Delete
[1073] Fix | Delete
$comment_text = get_comment_text( $comment, $args );
[1074] Fix | Delete
[1075] Fix | Delete
/**
[1076] Fix | Delete
* Filters the text of a comment to be displayed.
[1077] Fix | Delete
*
[1078] Fix | Delete
* @since 1.2.0
[1079] Fix | Delete
*
[1080] Fix | Delete
* @see Walker_Comment::comment()
[1081] Fix | Delete
*
[1082] Fix | Delete
* @param string $comment_text Text of the comment.
[1083] Fix | Delete
* @param WP_Comment|null $comment The comment object. Null if not found.
[1084] Fix | Delete
* @param array $args An array of arguments.
[1085] Fix | Delete
*/
[1086] Fix | Delete
echo apply_filters( 'comment_text', $comment_text, $comment, $args );
[1087] Fix | Delete
}
[1088] Fix | Delete
[1089] Fix | Delete
/**
[1090] Fix | Delete
* Retrieves the comment time of the current comment.
[1091] Fix | Delete
*
[1092] Fix | Delete
* @since 1.5.0
[1093] Fix | Delete
* @since 6.2.0 Added the `$comment_id` parameter.
[1094] Fix | Delete
*
[1095] Fix | Delete
* @param string $format Optional. PHP date format. Defaults to the 'time_format' option.
[1096] Fix | Delete
* @param bool $gmt Optional. Whether to use the GMT date. Default false.
[1097] Fix | Delete
* @param bool $translate Optional. Whether to translate the time (for use in feeds).
[1098] Fix | Delete
* Default true.
[1099] Fix | Delete
* @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the time.
[1100] Fix | Delete
* Default current comment.
[1101] Fix | Delete
* @return string The formatted time.
[1102] Fix | Delete
*/
[1103] Fix | Delete
function get_comment_time( $format = '', $gmt = false, $translate = true, $comment_id = 0 ) {
[1104] Fix | Delete
$comment = get_comment( $comment_id );
[1105] Fix | Delete
[1106] Fix | Delete
if ( null === $comment ) {
[1107] Fix | Delete
return '';
[1108] Fix | Delete
}
[1109] Fix | Delete
[1110] Fix | Delete
$comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date;
[1111] Fix | Delete
[1112] Fix | Delete
$_format = ! empty( $format ) ? $format : get_option( 'time_format' );
[1113] Fix | Delete
[1114] Fix | Delete
$comment_time = mysql2date( $_format, $comment_date, $translate );
[1115] Fix | Delete
[1116] Fix | Delete
/**
[1117] Fix | Delete
* Filters the returned comment time.
[1118] Fix | Delete
*
[1119] Fix | Delete
* @since 1.5.0
[1120] Fix | Delete
*
[1121] Fix | Delete
* @param string|int $comment_time The comment time, formatted as a date string or Unix timestamp.
[1122] Fix | Delete
* @param string $format PHP date format.
[1123] Fix | Delete
* @param bool $gmt Whether the GMT date is in use.
[1124] Fix | Delete
* @param bool $translate Whether the time is translated.
[1125] Fix | Delete
* @param WP_Comment $comment The comment object.
[1126] Fix | Delete
*/
[1127] Fix | Delete
return apply_filters( 'get_comment_time', $comment_time, $format, $gmt, $translate, $comment );
[1128] Fix | Delete
}
[1129] Fix | Delete
[1130] Fix | Delete
/**
[1131] Fix | Delete
* Displays the comment time of the current comment.
[1132] Fix | Delete
*
[1133] Fix | Delete
* @since 0.71
[1134] Fix | Delete
* @since 6.2.0 Added the `$comment_id` parameter.
[1135] Fix | Delete
*
[1136] Fix | Delete
* @param string $format Optional. PHP time format. Defaults to the 'time_format' option.
[1137] Fix | Delete
* @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to print the time.
[1138] Fix | Delete
* Default current comment.
[1139] Fix | Delete
*/
[1140] Fix | Delete
function comment_time( $format = '', $comment_id = 0 ) {
[1141] Fix | Delete
echo get_comment_time( $format, false, true, $comment_id );
[1142] Fix | Delete
}
[1143] Fix | Delete
[1144] Fix | Delete
/**
[1145] Fix | Delete
* Retrieves the comment type of the current comment.
[1146] Fix | Delete
*
[1147] Fix | Delete
* @since 1.5.0
[1148] Fix | Delete
* @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object.
[1149] Fix | Delete
*
[1150] Fix | Delete
* @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the type.
[1151] Fix | Delete
* Default current comment.
[1152] Fix | Delete
* @return string The comment type.
[1153] Fix | Delete
*/
[1154] Fix | Delete
function get_comment_type( $comment_id = 0 ) {
[1155] Fix | Delete
$comment = get_comment( $comment_id );
[1156] Fix | Delete
[1157] Fix | Delete
if ( '' === $comment->comment_type ) {
[1158] Fix | Delete
$comment->comment_type = 'comment';
[1159] Fix | Delete
}
[1160] Fix | Delete
[1161] Fix | Delete
/**
[1162] Fix | Delete
* Filters the returned comment type.
[1163] Fix | Delete
*
[1164] Fix | Delete
* @since 1.5.0
[1165] Fix | Delete
* @since 4.1.0 The `$comment_id` and `$comment` parameters were added.
[1166] Fix | Delete
*
[1167] Fix | Delete
* @param string $comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'.
[1168] Fix | Delete
* @param string $comment_id The comment ID as a numeric string.
[1169] Fix | Delete
* @param WP_Comment $comment The comment object.
[1170] Fix | Delete
*/
[1171] Fix | Delete
return apply_filters( 'get_comment_type', $comment->comment_type, $comment->comment_ID, $comment );
[1172] Fix | Delete
}
[1173] Fix | Delete
[1174] Fix | Delete
/**
[1175] Fix | Delete
* Displays the comment type of the current comment.
[1176] Fix | Delete
*
[1177] Fix | Delete
* @since 0.71
[1178] Fix | Delete
*
[1179] Fix | Delete
* @param string|false $commenttxt Optional. String to display for comment type. Default false.
[1180] Fix | Delete
* @param string|false $trackbacktxt Optional. String to display for trackback type. Default false.
[1181] Fix | Delete
* @param string|false $pingbacktxt Optional. String to display for pingback type. Default false.
[1182] Fix | Delete
*/
[1183] Fix | Delete
function comment_type( $commenttxt = false, $trackbacktxt = false, $pingbacktxt = false ) {
[1184] Fix | Delete
if ( false === $commenttxt ) {
[1185] Fix | Delete
$commenttxt = _x( 'Comment', 'noun' );
[1186] Fix | Delete
}
[1187] Fix | Delete
if ( false === $trackbacktxt ) {
[1188] Fix | Delete
$trackbacktxt = __( 'Trackback' );
[1189] Fix | Delete
}
[1190] Fix | Delete
if ( false === $pingbacktxt ) {
[1191] Fix | Delete
$pingbacktxt = __( 'Pingback' );
[1192] Fix | Delete
}
[1193] Fix | Delete
$type = get_comment_type();
[1194] Fix | Delete
switch ( $type ) {
[1195] Fix | Delete
case 'trackback':
[1196] Fix | Delete
echo $trackbacktxt;
[1197] Fix | Delete
break;
[1198] Fix | Delete
case 'pingback':
[1199] Fix | Delete
echo $pingbacktxt;
[1200] Fix | Delete
break;
[1201] Fix | Delete
default:
[1202] Fix | Delete
echo $commenttxt;
[1203] Fix | Delete
}
[1204] Fix | Delete
}
[1205] Fix | Delete
[1206] Fix | Delete
/**
[1207] Fix | Delete
* Retrieves the current post's trackback URL.
[1208] Fix | Delete
*
[1209] Fix | Delete
* There is a check to see if permalink's have been enabled and if so, will
[1210] Fix | Delete
* retrieve the pretty path. If permalinks weren't enabled, the ID of the
[1211] Fix | Delete
* current post is used and appended to the correct page to go to.
[1212] Fix | Delete
*
[1213] Fix | Delete
* @since 1.5.0
[1214] Fix | Delete
*
[1215] Fix | Delete
* @return string The trackback URL after being filtered.
[1216] Fix | Delete
*/
[1217] Fix | Delete
function get_trackback_url() {
[1218] Fix | Delete
if ( get_option( 'permalink_structure' ) ) {
[1219] Fix | Delete
$trackback_url = trailingslashit( get_permalink() ) . user_trailingslashit( 'trackback', 'single_trackback' );
[1220] Fix | Delete
} else {
[1221] Fix | Delete
$trackback_url = get_option( 'siteurl' ) . '/wp-trackback.php?p=' . get_the_ID();
[1222] Fix | Delete
}
[1223] Fix | Delete
[1224] Fix | Delete
/**
[1225] Fix | Delete
* Filters the returned trackback URL.
[1226] Fix | Delete
*
[1227] Fix | Delete
* @since 2.2.0
[1228] Fix | Delete
*
[1229] Fix | Delete
* @param string $trackback_url The trackback URL.
[1230] Fix | Delete
*/
[1231] Fix | Delete
return apply_filters( 'trackback_url', $trackback_url );
[1232] Fix | Delete
}
[1233] Fix | Delete
[1234] Fix | Delete
/**
[1235] Fix | Delete
* Displays the current post's trackback URL.
[1236] Fix | Delete
*
[1237] Fix | Delete
* @since 0.71
[1238] Fix | Delete
*
[1239] Fix | Delete
* @param bool $deprecated_echo Not used.
[1240] Fix | Delete
* @return void|string Should only be used to echo the trackback URL, use get_trackback_url()
[1241] Fix | Delete
* for the result instead.
[1242] Fix | Delete
*/
[1243] Fix | Delete
function trackback_url( $deprecated_echo = true ) {
[1244] Fix | Delete
if ( true !== $deprecated_echo ) {
[1245] Fix | Delete
_deprecated_argument(
[1246] Fix | Delete
__FUNCTION__,
[1247] Fix | Delete
'2.5.0',
[1248] Fix | Delete
sprintf(
[1249] Fix | Delete
/* translators: %s: get_trackback_url() */
[1250] Fix | Delete
__( 'Use %s instead if you do not want the value echoed.' ),
[1251] Fix | Delete
'<code>get_trackback_url()</code>'
[1252] Fix | Delete
)
[1253] Fix | Delete
);
[1254] Fix | Delete
}
[1255] Fix | Delete
[1256] Fix | Delete
if ( $deprecated_echo ) {
[1257] Fix | Delete
echo get_trackback_url();
[1258] Fix | Delete
} else {
[1259] Fix | Delete
return get_trackback_url();
[1260] Fix | Delete
}
[1261] Fix | Delete
}
[1262] Fix | Delete
[1263] Fix | Delete
/**
[1264] Fix | Delete
* Generates and displays the RDF for the trackback information of current post.
[1265] Fix | Delete
*
[1266] Fix | Delete
* Deprecated in 3.0.0, and restored in 3.0.1.
[1267] Fix | Delete
*
[1268] Fix | Delete
* @since 0.71
[1269] Fix | Delete
*
[1270] Fix | Delete
* @param int|string $deprecated Not used (Was $timezone = 0).
[1271] Fix | Delete
*/
[1272] Fix | Delete
function trackback_rdf( $deprecated = '' ) {
[1273] Fix | Delete
if ( ! empty( $deprecated ) ) {
[1274] Fix | Delete
_deprecated_argument( __FUNCTION__, '2.5.0' );
[1275] Fix | Delete
}
[1276] Fix | Delete
[1277] Fix | Delete
if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && false !== stripos( $_SERVER['HTTP_USER_AGENT'], 'W3C_Validator' ) ) {
[1278] Fix | Delete
return;
[1279] Fix | Delete
}
[1280] Fix | Delete
[1281] Fix | Delete
echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
[1282] Fix | Delete
xmlns:dc="http://purl.org/dc/elements/1.1/"
[1283] Fix | Delete
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
[1284] Fix | Delete
<rdf:Description rdf:about="';
[1285] Fix | Delete
the_permalink();
[1286] Fix | Delete
echo '"' . "\n";
[1287] Fix | Delete
echo ' dc:identifier="';
[1288] Fix | Delete
the_permalink();
[1289] Fix | Delete
echo '"' . "\n";
[1290] Fix | Delete
echo ' dc:title="' . str_replace( '--', '&#x2d;&#x2d;', wptexturize( strip_tags( get_the_title() ) ) ) . '"' . "\n";
[1291] Fix | Delete
echo ' trackback:ping="' . get_trackback_url() . '"' . " />\n";
[1292] Fix | Delete
echo '</rdf:RDF>';
[1293] Fix | Delete
}
[1294] Fix | Delete
[1295] Fix | Delete
/**
[1296] Fix | Delete
* Determines whether the current post is open for comments.
[1297] Fix | Delete
*
[1298] Fix | Delete
* For more information on this and similar theme functions, check out
[1299] Fix | Delete
* the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
[1300] Fix | Delete
* Conditional Tags} article in the Theme Developer Handbook.
[1301] Fix | Delete
*
[1302] Fix | Delete
* @since 1.5.0
[1303] Fix | Delete
*
[1304] Fix | Delete
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post.
[1305] Fix | Delete
* @return bool True if the comments are open.
[1306] Fix | Delete
*/
[1307] Fix | Delete
function comments_open( $post = null ) {
[1308] Fix | Delete
$_post = get_post( $post );
[1309] Fix | Delete
[1310] Fix | Delete
$post_id = $_post ? $_post->ID : 0;
[1311] Fix | Delete
$comments_open = ( $_post && ( 'open' === $_post->comment_status ) );
[1312] Fix | Delete
[1313] Fix | Delete
/**
[1314] Fix | Delete
* Filters whether the current post is open for comments.
[1315] Fix | Delete
*
[1316] Fix | Delete
* @since 2.5.0
[1317] Fix | Delete
*
[1318] Fix | Delete
* @param bool $comments_open Whether the current post is open for comments.
[1319] Fix | Delete
* @param int $post_id The post ID.
[1320] Fix | Delete
*/
[1321] Fix | Delete
return apply_filters( 'comments_open', $comments_open, $post_id );
[1322] Fix | Delete
}
[1323] Fix | Delete
[1324] Fix | Delete
/**
[1325] Fix | Delete
* Determines whether the current post is open for pings.
[1326] Fix | Delete
*
[1327] Fix | Delete
* For more information on this and similar theme functions, check out
[1328] Fix | Delete
* the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
[1329] Fix | Delete
* Conditional Tags} article in the Theme Developer Handbook.
[1330] Fix | Delete
*
[1331] Fix | Delete
* @since 1.5.0
[1332] Fix | Delete
*
[1333] Fix | Delete
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post.
[1334] Fix | Delete
* @return bool True if pings are accepted
[1335] Fix | Delete
*/
[1336] Fix | Delete
function pings_open( $post = null ) {
[1337] Fix | Delete
$_post = get_post( $post );
[1338] Fix | Delete
[1339] Fix | Delete
$post_id = $_post ? $_post->ID : 0;
[1340] Fix | Delete
$pings_open = ( $_post && ( 'open' === $_post->ping_status ) );
[1341] Fix | Delete
[1342] Fix | Delete
/**
[1343] Fix | Delete
* Filters whether the current post is open for pings.
[1344] Fix | Delete
*
[1345] Fix | Delete
* @since 2.5.0
[1346] Fix | Delete
*
[1347] Fix | Delete
* @param bool $pings_open Whether the current post is open for pings.
[1348] Fix | Delete
* @param int $post_id The post ID.
[1349] Fix | Delete
*/
[1350] Fix | Delete
return apply_filters( 'pings_open', $pings_open, $post_id );
[1351] Fix | Delete
}
[1352] Fix | Delete
[1353] Fix | Delete
/**
[1354] Fix | Delete
* Displays form token for unfiltered comments.
[1355] Fix | Delete
*
[1356] Fix | Delete
* Will only display nonce token if the current user has permissions for
[1357] Fix | Delete
* unfiltered html. Won't display the token for other users.
[1358] Fix | Delete
*
[1359] Fix | Delete
* The function was backported to 2.0.10 and was added to versions 2.1.3 and
[1360] Fix | Delete
* above. Does not exist in versions prior to 2.0.10 in the 2.0 branch and in
[1361] Fix | Delete
* the 2.1 branch, prior to 2.1.3. Technically added in 2.2.0.
[1362] Fix | Delete
*
[1363] Fix | Delete
* Backported to 2.0.10.
[1364] Fix | Delete
*
[1365] Fix | Delete
* @since 2.1.3
[1366] Fix | Delete
*/
[1367] Fix | Delete
function wp_comment_form_unfiltered_html_nonce() {
[1368] Fix | Delete
$post = get_post();
[1369] Fix | Delete
$post_id = $post ? $post->ID : 0;
[1370] Fix | Delete
[1371] Fix | Delete
if ( current_user_can( 'unfiltered_html' ) ) {
[1372] Fix | Delete
wp_nonce_field( 'unfiltered-html-comment_' . $post_id, '_wp_unfiltered_html_comment_disabled', false );
[1373] Fix | Delete
wp_print_inline_script_tag( "(function(){if(window===window.parent){document.getElementById('_wp_unfiltered_html_comment_disabled').name='_wp_unfiltered_html_comment';}})();" );
[1374] Fix | Delete
}
[1375] Fix | Delete
}
[1376] Fix | Delete
[1377] Fix | Delete
/**
[1378] Fix | Delete
* Loads the comment template specified in $file.
[1379] Fix | Delete
*
[1380] Fix | Delete
* Will not display the comments template if not on single post or page, or if
[1381] Fix | Delete
* the post does not have comments.
[1382] Fix | Delete
*
[1383] Fix | Delete
* Uses the WordPress database object to query for the comments. The comments
[1384] Fix | Delete
* are passed through the {@see 'comments_array'} filter hook with the list of comments
[1385] Fix | Delete
* and the post ID respectively.
[1386] Fix | Delete
*
[1387] Fix | Delete
* The `$file` path is passed through a filter hook called {@see 'comments_template'},
[1388] Fix | Delete
* which includes the template directory and $file combined. Tries the $filtered path
[1389] Fix | Delete
* first and if it fails it will require the default comment template from the
[1390] Fix | Delete
* default theme. If either does not exist, then the WordPress process will be
[1391] Fix | Delete
* halted. It is advised for that reason, that the default theme is not deleted.
[1392] Fix | Delete
*
[1393] Fix | Delete
* Will not try to get the comments if the post has none.
[1394] Fix | Delete
*
[1395] Fix | Delete
* @since 1.5.0
[1396] Fix | Delete
*
[1397] Fix | Delete
* @global WP_Query $wp_query WordPress Query object.
[1398] Fix | Delete
* @global WP_Post $post Global post object.
[1399] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[1400] Fix | Delete
* @global int $id
[1401] Fix | Delete
* @global WP_Comment $comment Global comment object.
[1402] Fix | Delete
* @global string $user_login
[1403] Fix | Delete
* @global string $user_identity
[1404] Fix | Delete
* @global bool $overridden_cpage
[1405] Fix | Delete
* @global bool $withcomments
[1406] Fix | Delete
* @global string $wp_stylesheet_path Path to current theme's stylesheet directory.
[1407] Fix | Delete
* @global string $wp_template_path Path to current theme's template directory.
[1408] Fix | Delete
*
[1409] Fix | Delete
* @param string $file Optional. The file to load. Default '/comments.php'.
[1410] Fix | Delete
* @param bool $separate_comments Optional. Whether to separate the comments by comment type.
[1411] Fix | Delete
* Default false.
[1412] Fix | Delete
*/
[1413] Fix | Delete
function comments_template( $file = '/comments.php', $separate_comments = false ) {
[1414] Fix | Delete
global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_identity, $overridden_cpage, $wp_stylesheet_path, $wp_template_path;
[1415] Fix | Delete
[1416] Fix | Delete
if ( ! ( is_single() || is_page() || $withcomments ) || empty( $post ) ) {
[1417] Fix | Delete
return;
[1418] Fix | Delete
}
[1419] Fix | Delete
[1420] Fix | Delete
if ( empty( $file ) ) {
[1421] Fix | Delete
$file = '/comments.php';
[1422] Fix | Delete
}
[1423] Fix | Delete
[1424] Fix | Delete
$req = get_option( 'require_name_email' );
[1425] Fix | Delete
[1426] Fix | Delete
/*
[1427] Fix | Delete
* Comment author information fetched from the comment cookies.
[1428] Fix | Delete
*/
[1429] Fix | Delete
$commenter = wp_get_current_commenter();
[1430] Fix | Delete
[1431] Fix | Delete
/*
[1432] Fix | Delete
* The name of the current comment author escaped for use in attributes.
[1433] Fix | Delete
* Escaped by sanitize_comment_cookies().
[1434] Fix | Delete
*/
[1435] Fix | Delete
$comment_author = $commenter['comment_author'];
[1436] Fix | Delete
[1437] Fix | Delete
/*
[1438] Fix | Delete
* The email address of the current comment author escaped for use in attributes.
[1439] Fix | Delete
* Escaped by sanitize_comment_cookies().
[1440] Fix | Delete
*/
[1441] Fix | Delete
$comment_author_email = $commenter['comment_author_email'];
[1442] Fix | Delete
[1443] Fix | Delete
/*
[1444] Fix | Delete
* The URL of the current comment author escaped for use in attributes.
[1445] Fix | Delete
*/
[1446] Fix | Delete
$comment_author_url = esc_url( $commenter['comment_author_url'] );
[1447] Fix | Delete
[1448] Fix | Delete
$comment_args = array(
[1449] Fix | Delete
'orderby' => 'comment_date_gmt',
[1450] Fix | Delete
'order' => 'ASC',
[1451] Fix | Delete
'status' => 'approve',
[1452] Fix | Delete
'post_id' => $post->ID,
[1453] Fix | Delete
'no_found_rows' => false,
[1454] Fix | Delete
);
[1455] Fix | Delete
[1456] Fix | Delete
if ( get_option( 'thread_comments' ) ) {
[1457] Fix | Delete
$comment_args['hierarchical'] = 'threaded';
[1458] Fix | Delete
} else {
[1459] Fix | Delete
$comment_args['hierarchical'] = false;
[1460] Fix | Delete
}
[1461] Fix | Delete
[1462] Fix | Delete
if ( is_user_logged_in() ) {
[1463] Fix | Delete
$comment_args['include_unapproved'] = array( get_current_user_id() );
[1464] Fix | Delete
} else {
[1465] Fix | Delete
$unapproved_email = wp_get_unapproved_comment_author_email();
[1466] Fix | Delete
[1467] Fix | Delete
if ( $unapproved_email ) {
[1468] Fix | Delete
$comment_args['include_unapproved'] = array( $unapproved_email );
[1469] Fix | Delete
}
[1470] Fix | Delete
}
[1471] Fix | Delete
[1472] Fix | Delete
$per_page = 0;
[1473] Fix | Delete
if ( get_option( 'page_comments' ) ) {
[1474] Fix | Delete
$per_page = (int) get_query_var( 'comments_per_page' );
[1475] Fix | Delete
if ( 0 === $per_page ) {
[1476] Fix | Delete
$per_page = (int) get_option( 'comments_per_page' );
[1477] Fix | Delete
}
[1478] Fix | Delete
[1479] Fix | Delete
$comment_args['number'] = $per_page;
[1480] Fix | Delete
$page = (int) get_query_var( 'cpage' );
[1481] Fix | Delete
[1482] Fix | Delete
if ( $page ) {
[1483] Fix | Delete
$comment_args['offset'] = ( $page - 1 ) * $per_page;
[1484] Fix | Delete
} elseif ( 'oldest' === get_option( 'default_comments_page' ) ) {
[1485] Fix | Delete
$comment_args['offset'] = 0;
[1486] Fix | Delete
} else {
[1487] Fix | Delete
// If fetching the first page of 'newest', we need a top-level comment count.
[1488] Fix | Delete
$top_level_query = new WP_Comment_Query();
[1489] Fix | Delete
$top_level_args = array(
[1490] Fix | Delete
'count' => true,
[1491] Fix | Delete
'orderby' => false,
[1492] Fix | Delete
'post_id' => $post->ID,
[1493] Fix | Delete
'status' => 'approve',
[1494] Fix | Delete
);
[1495] Fix | Delete
[1496] Fix | Delete
if ( $comment_args['hierarchical'] ) {
[1497] Fix | Delete
$top_level_args['parent'] = 0;
[1498] Fix | Delete
}
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function