Changeset 35848 for trunk/src/wp-includes/comment-template.php
- Timestamp:
- 12/10/2015 03:05:34 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment-template.php
r35748 r35848 1389 1389 1390 1390 /** 1391 * Display the JS popup script to show a comment. 1392 * 1393 * If the $file parameter is empty, then the home page is assumed. The defaults 1394 * for the window are 400px by 400px. 1395 * 1396 * For the comment link popup to work, this function has to be called or the 1397 * normal comment link will be assumed. 1398 * 1399 * @global string $wpcommentspopupfile The URL to use for the popup window. 1400 * @global int $wpcommentsjavascript Whether to use JavaScript. Set when function is called. 1401 * 1402 * @since 0.71 1403 * 1404 * @param int $width Optional. The width of the popup window. Default 400. 1405 * @param int $height Optional. The height of the popup window. Default 400. 1406 * @param string $file Optional. Sets the location of the popup window. 1407 */ 1408 function comments_popup_script( $width = 400, $height = 400, $file = '' ) { 1409 global $wpcommentspopupfile, $wpcommentsjavascript; 1410 1411 if (empty ($file)) { 1412 $wpcommentspopupfile = ''; // Use the index. 1413 } else { 1414 $wpcommentspopupfile = $file; 1415 } 1416 1417 $wpcommentsjavascript = 1; 1418 $javascript = "<script type='text/javascript'>\nfunction wpopen (macagna) {\n window.open(macagna, '_blank', 'width=$width,height=$height,scrollbars=yes,status=yes');\n}\n</script>\n"; 1419 echo $javascript; 1420 } 1421 1422 /** 1423 * Displays the link to the comments popup window for the current post ID. 1424 * 1425 * Is not meant to be displayed on single posts and pages. Should be used 1426 * on the lists of posts 1427 * 1428 * @global string $wpcommentspopupfile The URL to use for the popup window. 1429 * @global int $wpcommentsjavascript Whether to use JavaScript. Set when function is called. 1391 * Displays the link to the comments for the current post ID. 1430 1392 * 1431 1393 * @since 0.71 … … 1441 1403 */ 1442 1404 function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) { 1443 global $wpcommentspopupfile, $wpcommentsjavascript;1444 1445 1405 $id = get_the_ID(); 1446 1406 $title = get_the_title(); … … 1479 1439 1480 1440 echo '<a href="'; 1481 if ( $wpcommentsjavascript ) { 1482 if ( empty( $wpcommentspopupfile ) ) 1483 $home = home_url(); 1484 else 1485 $home = get_option('siteurl'); 1486 echo $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id; 1487 echo '" onclick="wpopen(this.href); return false"'; 1441 if ( 0 == $number ) { 1442 $respond_link = get_permalink() . '#respond'; 1443 /** 1444 * Filter the respond link when a post has no comments. 1445 * 1446 * @since 4.4.0 1447 * 1448 * @param string $respond_link The default response link. 1449 * @param integer $id The post ID. 1450 */ 1451 echo apply_filters( 'respond_link', $respond_link, $id ); 1488 1452 } else { 1489 // if comments_popup_script() is not in the template, display simple comment link 1490 if ( 0 == $number ) { 1491 $respond_link = get_permalink() . '#respond'; 1492 /** 1493 * Filter the respond link when a post has no comments. 1494 * 1495 * @since 4.4.0 1496 * 1497 * @param string $respond_link The default response link. 1498 * @param integer $id The post ID. 1499 */ 1500 echo apply_filters( 'respond_link', $respond_link, $id ); 1501 } else { 1502 comments_link(); 1503 } 1504 echo '"'; 1505 } 1453 comments_link(); 1454 } 1455 echo '"'; 1506 1456 1507 1457 if ( !empty( $css_class ) ) { … … 1511 1461 $attributes = ''; 1512 1462 /** 1513 * Filter the comments popuplink attributes for display.1463 * Filter the comments link attributes for display. 1514 1464 * 1515 1465 * @since 2.5.0 1516 1466 * 1517 * @param string $attributes The comments popuplink attributes. Default empty.1467 * @param string $attributes The comments link attributes. Default empty. 1518 1468 */ 1519 1469 echo apply_filters( 'comments_popup_link_attributes', $attributes );
Note: See TracChangeset
for help on using the changeset viewer.