WordPress.org

Make WordPress Core

Changeset 35848


Ignore:
Timestamp:
12/10/2015 03:05:34 AM (4 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

Location:
trunk/src
Files:
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/file.php

    r35796 r35848  
    2020    'rtl.css' => __( 'RTL Stylesheet' ),
    2121    'comments.php' => __( 'Comments' ),
    22     'comments-popup.php' => __( 'Popup Comments' ),
    2322    'footer.php' => __( 'Theme Footer' ),
    2423    'header.php' => __( 'Theme Header' ),
     
    4645    'wp-comments.php' => __( 'Comments Template' ),
    4746    'wp-comments-popup.php' => __( 'Popup Comments Template' ),
     47    'comments-popup.php' => __( 'Popup Comments' ),
    4848);
    4949
  • trunk/src/wp-admin/includes/update-core.php

    r35738 r35848  
    701701'wp-includes/js/tinymce/wp-mce-help.php',
    702702'wp-includes/js/tinymce/plugins/wpfullscreen',
     703// 4.5
     704'wp-includes/theme-compat/comments-popup.php',
    703705);
    704706
  • trunk/src/wp-includes/canonical.php

    r35770 r35848  
    1818 * one or the other.
    1919 *
    20  * Prevents redirection for feeds, trackbacks, searches, comment popup, and
     20 * Prevents redirection for feeds, trackbacks, searches, and
    2121 * admin URLs. Does not redirect on non-pretty-permalink-supporting IIS 7+,
    2222 * page/post previews, WP admin, Trackbacks, robots.txt, searches, or on POST
     
    5656    }
    5757
    58     if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || is_preview() || is_robots() || ( $is_IIS && !iis7_supports_permalinks() ) ) {
     58    if ( is_trackback() || is_search() || is_admin() || is_preview() || is_robots() || ( $is_IIS && !iis7_supports_permalinks() ) ) {
    5959        return;
    6060    }
  • trunk/src/wp-includes/class-wp.php

    r35436 r35848  
    1616     * @var array
    1717     */
    18     public $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage', 'post_type', 'title', 'embed' );
     18    public $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage', 'post_type', 'title', 'embed' );
    1919
    2020    /**
  • 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 );
  • trunk/src/wp-includes/deprecated.php

    r35624 r35848  
    36363636    return force_ssl_admin( $force );
    36373637}
     3638
     3639/**
     3640 * Retrieve path of comment popup template in current or parent template.
     3641 *
     3642 * @since 1.5.0
     3643 * @deprecated 4.5.0
     3644 *
     3645 * @return string Full path to comments popup template file.
     3646 */
     3647function get_comments_popup_template() {
     3648    _deprecated_function( __FUNCTION__, '4.5' );
     3649
     3650    return '';
     3651}
     3652
     3653/**
     3654 * Whether the current URL is within the comments popup window.
     3655 *
     3656 * @since 1.5.0
     3657 * @deprecated 4.5.0
     3658 *
     3659 * @return bool
     3660 */
     3661function is_comments_popup() {
     3662    _deprecated_function( __FUNCTION__, '4.5' );
     3663
     3664    return false;
     3665}
     3666
     3667/**
     3668 * Display the JS popup script to show a comment.
     3669 *
     3670 * @since 0.71
     3671 * @deprecated 4.5.0
     3672 */
     3673function comments_popup_script() {
     3674    _deprecated_function( __FUNCTION__, '4.5' );
     3675}
     3676
     3677/**
     3678 * Adds element attributes to open links in new windows.
     3679 *
     3680 * @since 0.71
     3681 * @deprecated 4.5.0
     3682 *
     3683 * @param string $text Content to replace links to open in a new window.
     3684 * @return string Content that has filtered links.
     3685 */
     3686function popuplinks( $text ) {
     3687    _deprecated_function( __FUNCTION__, '4.5' );
     3688    $text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text);
     3689    return $text;
     3690}
  • trunk/src/wp-includes/formatting.php

    r35847 r35848  
    26902690        return preg_replace('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', '$1-$2-$3 $4:$5:$6', $date_string);
    26912691    }
    2692 }
    2693 
    2694 /**
    2695  * Adds a element attributes to open links in new windows.
    2696  *
    2697  * Comment text in popup windows should be filtered through this. Right now it's
    2698  * a moderately dumb function, ideally it would detect whether a target or rel
    2699  * attribute was already there and adjust its actions accordingly.
    2700  *
    2701  * @since 0.71
    2702  *
    2703  * @param string $text Content to replace links to open in a new window.
    2704  * @return string Content that has filtered links.
    2705  */
    2706 function popuplinks( $text ) {
    2707     $text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text);
    2708     return $text;
    27092692}
    27102693
  • trunk/src/wp-includes/query.php

    r35690 r35848  
    295295
    296296    return $wp_query->is_tax( $taxonomy, $term );
    297 }
    298 
    299 /**
    300  * Whether the current URL is within the comments popup window.
    301  *
    302  * @since 1.5.0
    303  *
    304  * @global WP_Query $wp_query Global WP_Query instance.
    305  *
    306  * @return bool
    307  */
    308 function is_comments_popup() {
    309     global $wp_query;
    310 
    311     if ( ! isset( $wp_query ) ) {
    312         _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
    313         return false;
    314     }
    315 
    316     return $wp_query->is_comments_popup();
    317297}
    318298
     
    863843 *
    864844 * @since 1.5.0
     845 * @since 4.5.0 Removed the `$comments_popup` property.
    865846 */
    866847class WP_Query {
     
    12291210     */
    12301211    public $is_embed = false;
    1231 
    1232     /**
    1233      * Set if query is within comments popup window.
    1234      *
    1235      * @since 1.5.0
    1236      * @access public
    1237      * @var bool
    1238      */
    1239     public $is_comments_popup = false;
    12401212
    12411213    /**
     
    13901362        $this->is_home = false;
    13911363        $this->is_404 = false;
    1392         $this->is_comments_popup = false;
    13931364        $this->is_paged = false;
    13941365        $this->is_admin = false;
     
    14421413     *
    14431414     * @since 2.1.0
     1415     * @since 4.4.0 Removed the `comments_popup` public query variable.
    14441416     * @access public
    14451417     *
     
    14771449            , 'tb'
    14781450            , 'paged'
    1479             , 'comments_popup'
    14801451            , 'meta_key'
    14811452            , 'meta_value'
     
    15121483     * @since 4.4.0 Introduced `$post_name__in` and `$title` parameters. `$s` was updated to support excluded
    15131484     *              search terms, by prepending a hyphen.
     1485     * @since 4.5.0 Removed the `$comments_popup` parameter.
    15141486     * @access public
    15151487     *
     
    15301502     *     @type int          $comments_per_page       The number of comments to return per page.
    15311503     *                                                 Default 'comments_per_page' option.
    1532      *     @type int|string   $comments_popup          Whether the query is within the comments popup. Default empty.
    15331504     *     @type array        $date_query              An associative array of WP_Date_Query arguments.
    15341505     *                                                 {@see WP_Date_Query::__construct()}
     
    17921763            $this->is_paged = true;
    17931764
    1794         if ( '' != $qv['comments_popup'] )
    1795             $this->is_comments_popup = true;
    1796 
    17971765        // if we're previewing inside the write screen
    17981766        if ( '' != $qv['preview'] )
     
    18121780            $this->is_comment_feed = true;
    18131781
    1814         if ( !( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup || $this->is_robots ) )
     1782        if ( !( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_robots ) )
    18151783            $this->is_home = true;
    18161784
     
    27722740        }
    27732741
    2774         if ( intval($q['comments_popup']) )
    2775             $q['p'] = absint($q['comments_popup']);
    2776 
    27772742        // If an attachment is requested by number, let it supersede any post number.
    27782743        if ( $q['attachment_id'] )
     
    43854350     *
    43864351     * @since 3.1.0
     4352     * @deprecated 4.5.0
    43874353     *
    43884354     * @return bool
    43894355     */
    43904356    public function is_comments_popup() {
    4391         return (bool) $this->is_comments_popup;
     4357        _deprecated_function( __FUNCTION__, '4.5' );
     4358
     4359        return false;
    43924360    }
    43934361
  • trunk/src/wp-includes/template-loader.php

    r34903 r35848  
    7474    elseif ( is_date()           && $template = get_date_template()           ) :
    7575    elseif ( is_archive()        && $template = get_archive_template()        ) :
    76     elseif ( is_comments_popup() && $template = get_comments_popup_template() ) :
    7776    elseif ( is_paged()          && $template = get_paged_template()          ) :
    7877    else :
  • trunk/src/wp-includes/template.php

    r35413 r35848  
    467467
    468468/**
    469  * Retrieve path of comment popup template in current or parent template.
    470  *
    471  * Checks for comment popup template in current template, if it exists or in the
    472  * parent template.
    473  *
    474  * The template path is filterable via the dynamic {@see '$type_template'} hook,
    475  * e.g. 'commentspopup_template'.
    476  *
    477  * @since 1.5.0
    478  *
    479  * @see get_query_template()
    480  *
    481  * @return string Full path to comments popup template file.
    482  */
    483 function get_comments_popup_template() {
    484     $template = get_query_template( 'comments_popup', array( 'comments-popup.php' ) );
    485 
    486     // Backward compat code will be removed in a future release.
    487     if ('' == $template)
    488         $template = ABSPATH . WPINC . '/theme-compat/comments-popup.php';
    489 
    490     return $template;
    491 }
    492 
    493 /**
    494469 * Retrieve the name of the highest priority template file that exists.
    495470 *
Note: See TracChangeset for help on using the changeset viewer.