Make WordPress Core


Ignore:
Timestamp:
12/10/2015 03:05:34 AM (10 years ago)
Author:
johnbillion
Message:

Comments: The year is 2003. Permalinks are a new thing and everyone's using Blogger. It's a time when opening a modal window in JavaScript to view a section of a website is not a completely weird thing, although many users get annoyed by it. b2 has recently become WordPress, and with it comes a bunch of functionality that will become stale over the next decade, remnants of simpler times.

Twelve years later, after no fewer than three themes have intentionally implemented popup comments in their functionality, before being abandoned for at least the last six years, we've reached a time where we can put this era behind us. A time when we can remove comment popup functionality from WordPress.

If this breaks the internet, I'll eat my hat.

Fixes #28617

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment-template.php

    r35748 r35848  
    13891389
    13901390/**
    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.
    14301392 *
    14311393 * @since 0.71
     
    14411403 */
    14421404function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
    1443     global $wpcommentspopupfile, $wpcommentsjavascript;
    1444 
    14451405    $id = get_the_ID();
    14461406    $title = get_the_title();
     
    14791439
    14801440    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 );
    14881452    } 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 '"';
    15061456
    15071457    if ( !empty( $css_class ) ) {
     
    15111461    $attributes = '';
    15121462    /**
    1513      * Filter the comments popup link attributes for display.
     1463     * Filter the comments link attributes for display.
    15141464     *
    15151465     * @since 2.5.0
    15161466     *
    1517      * @param string $attributes The comments popup link attributes. Default empty.
     1467     * @param string $attributes The comments link attributes. Default empty.
    15181468     */
    15191469    echo apply_filters( 'comments_popup_link_attributes', $attributes );
Note: See TracChangeset for help on using the changeset viewer.