Make WordPress Core

Ticket #28617: 28617.diff

File 28617.diff, 20.8 KB (added by johnbillion, 9 years ago)
  • src/wp-admin/includes/file.php

     
    1616        'editor-style-rtl.css' => __( 'Visual Editor RTL Stylesheet' ),
    1717        'rtl.css' => __( 'RTL Stylesheet' ),
    1818        'comments.php' => __( 'Comments' ),
    19         'comments-popup.php' => __( 'Popup Comments' ),
    2019        'footer.php' => __( 'Footer' ),
    2120        'header.php' => __( 'Header' ),
    2221        'sidebar.php' => __( 'Sidebar' ),
     
    4241        'wp-layout.css' => __( 'Stylesheet' ),
    4342        'wp-comments.php' => __( 'Comments Template' ),
    4443        'wp-comments-popup.php' => __( 'Popup Comments Template' ),
     44        'comments-popup.php' => __( 'Popup Comments' ),
    4545);
    4646
    4747/**
  • src/wp-admin/includes/update-core.php

     
    699699'wp-admin/js/wp-fullscreen.min.js',
    700700'wp-includes/js/tinymce/wp-mce-help.php',
    701701'wp-includes/js/tinymce/plugins/wpfullscreen',
     702// 4.4
     703'wp-includes/theme-compat/comments-popup.php',
    702704);
    703705
    704706/**
  • src/wp-includes/canonical.php

     
    1717 * prevents penalty for duplicate content by redirecting all incoming links to
    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
    2323 * requests.
     
    5555                }
    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        }
    6161
  • src/wp-includes/class-wp.php

     
    1515         * @access public
    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');
     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');
    1919
    2020        /**
    2121         * Private query variables.
  • src/wp-includes/comment-template.php

     
    12351235}
    12361236
    12371237/**
    1238  * Display the JS popup script to show a comment.
    1239  *
    1240  * If the $file parameter is empty, then the home page is assumed. The defaults
    1241  * for the window are 400px by 400px.
    1242  *
    1243  * For the comment link popup to work, this function has to be called or the
    1244  * normal comment link will be assumed.
    1245  *
    1246  * @global string $wpcommentspopupfile  The URL to use for the popup window.
    1247  * @global int    $wpcommentsjavascript Whether to use JavaScript. Set when function is called.
    1248  *
    1249  * @since 0.71
    1250  *
    1251  * @param int $width  Optional. The width of the popup window. Default 400.
    1252  * @param int $height Optional. The height of the popup window. Default 400.
    1253  * @param string $file Optional. Sets the location of the popup window.
    1254  */
    1255 function comments_popup_script( $width = 400, $height = 400, $file = '' ) {
    1256         global $wpcommentspopupfile, $wpcommentsjavascript;
    1257 
    1258         if (empty ($file)) {
    1259                 $wpcommentspopupfile = '';  // Use the index.
    1260         } else {
    1261                 $wpcommentspopupfile = $file;
    1262         }
    1263 
    1264         $wpcommentsjavascript = 1;
    1265         $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";
    1266         echo $javascript;
    1267 }
    1268 
    1269 /**
    1270  * Displays the link to the comments popup window for the current post ID.
    1271  *
    1272  * Is not meant to be displayed on single posts and pages. Should be used
    1273  * on the lists of posts
    1274  *
    1275  * @global string $wpcommentspopupfile  The URL to use for the popup window.
    1276  * @global int    $wpcommentsjavascript Whether to use JavaScript. Set when function is called.
     1238 * Displays the link to the comments for the current post ID.
    12771239 *
    12781240 * @since 0.71
    12791241 *
     
    12871249 *                          Default false.
    12881250 */
    12891251function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
    1290         global $wpcommentspopupfile, $wpcommentsjavascript;
    1291 
    12921252        $id = get_the_ID();
    12931253        $title = get_the_title();
    12941254        $number = get_comments_number( $id );
     
    13251285        }
    13261286
    13271287        echo '<a href="';
    1328         if ( $wpcommentsjavascript ) {
    1329                 if ( empty( $wpcommentspopupfile ) )
    1330                         $home = home_url();
    1331                 else
    1332                         $home = get_option('siteurl');
    1333                 echo $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id;
    1334                 echo '" onclick="wpopen(this.href); return false"';
    1335         } else { // if comments_popup_script() is not in the template, display simple comment link
    1336                 if ( 0 == $number )
    1337                         echo get_permalink() . '#respond';
    1338                 else
    1339                         comments_link();
    1340                 echo '"';
     1288        if ( 0 == $number ) {
     1289                echo get_permalink() . '#respond';
     1290        } else {
     1291                comments_link();
    13411292        }
     1293        echo '"';
    13421294
    13431295        if ( !empty( $css_class ) ) {
    13441296                echo ' class="'.$css_class.'" ';
     
    13461298
    13471299        $attributes = '';
    13481300        /**
    1349          * Filter the comments popup link attributes for display.
     1301         * Filter the comments link attributes for display.
    13501302         *
    13511303         * @since 2.5.0
    13521304         *
    1353          * @param string $attributes The comments popup link attributes. Default empty.
     1305         * @param string $attributes The comments link attributes. Default empty.
    13541306         */
    13551307        echo apply_filters( 'comments_popup_link_attributes', $attributes );
    13561308
  • src/wp-includes/deprecated.php

     
    35613561        return get_permalink( $post_id );
    35623562}
    35633563
     3564/**
     3565 * Retrieve path of comment popup template in current or parent template.
     3566 *
     3567 * @since 1.5.0
     3568 * @deprecated 4.4.0
     3569 *
     3570 * @return string Full path to comments popup template file.
     3571 */
     3572function get_comments_popup_template() {
     3573        _deprecated_function( __FUNCTION__, '4.4' );
     3574
     3575        return '';
     3576}
     3577
     3578/**
     3579 * Whether the current URL is within the comments popup window.
     3580 *
     3581 * @since 1.5.0
     3582 * @deprecated 4.4.0
     3583 *
     3584 * @return bool
     3585 */
     3586function is_comments_popup() {
     3587        _deprecated_function( __FUNCTION__, '4.4' );
     3588
     3589        return false;
     3590}
     3591
     3592/**
     3593 * Display the JS popup script to show a comment.
     3594 *
     3595 * @since 0.71
     3596 * @deprecated 4.4.0
     3597 */
     3598function comments_popup_script() {
     3599        _deprecated_function( __FUNCTION__, '4.4' );
     3600}
     3601
     3602/**
     3603 * Adds element attributes to open links in new windows.
     3604 *
     3605 * @since 0.71
     3606 * @deprecated 4.4.0
     3607 *
     3608 * @param string $text Content to replace links to open in a new window.
     3609 * @return string Content that has filtered links.
     3610 */
     3611function popuplinks( $text ) {
     3612        _deprecated_function( __FUNCTION__, '4.4' );
     3613        $text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text);
     3614        return $text;
     3615}
  • src/wp-includes/formatting.php

     
    25982598}
    25992599
    26002600/**
    2601  * Adds a element attributes to open links in new windows.
    2602  *
    2603  * Comment text in popup windows should be filtered through this. Right now it's
    2604  * a moderately dumb function, ideally it would detect whether a target or rel
    2605  * attribute was already there and adjust its actions accordingly.
    2606  *
    2607  * @since 0.71
    2608  *
    2609  * @param string $text Content to replace links to open in a new window.
    2610  * @return string Content that has filtered links.
    2611  */
    2612 function popuplinks( $text ) {
    2613         $text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text);
    2614         return $text;
    2615 }
    2616 
    2617 /**
    26182601 * Strips out all characters that are not allowable in an email.
    26192602 *
    26202603 * @since 1.5.0
  • src/wp-includes/query.php

     
    293293}
    294294
    295295/**
    296  * Whether the current URL is within the comments popup window.
    297  *
    298  * @since 1.5.0
    299  *
    300  * @global WP_Query $wp_query
    301  *
    302  * @return bool
    303  */
    304 function is_comments_popup() {
    305         global $wp_query;
    306 
    307         if ( ! isset( $wp_query ) ) {
    308                 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
    309                 return false;
    310         }
    311 
    312         return $wp_query->is_comments_popup();
    313 }
    314 
    315 /**
    316296 * Is the query for an existing date archive?
    317297 *
    318298 * @since 1.5.0
     
    832812 * @link https://codex.wordpress.org/Function_Reference/WP_Query Codex page.
    833813 *
    834814 * @since 1.5.0
     815 * @since 4.4.0 Removed the `$comments_popup` property.
    835816 */
    836817class WP_Query {
    837818
     
    11911172        public $is_404 = false;
    11921173
    11931174        /**
    1194          * Set if query is within comments popup window.
    1195          *
    1196          * @since 1.5.0
    1197          * @access public
    1198          * @var bool
    1199          */
    1200         public $is_comments_popup = false;
    1201 
    1202         /**
    12031175         * Set if query is paged
    12041176         *
    12051177         * @since 1.5.0
     
    13411313                $this->is_trackback = false;
    13421314                $this->is_home = false;
    13431315                $this->is_404 = false;
    1344                 $this->is_comments_popup = false;
    13451316                $this->is_paged = false;
    13461317                $this->is_admin = false;
    13471318                $this->is_attachment = false;
     
    13931364         * Fills in the query variables, which do not exist within the parameter.
    13941365         *
    13951366         * @since 2.1.0
     1367         * @since 4.4.0 Removed the `comments_popup` public query variable.
    13961368         * @access public
    13971369         *
    13981370         * @param array $array Defined query variables.
     
    14281400                        , 'feed'
    14291401                        , 'tb'
    14301402                        , 'paged'
    1431                         , 'comments_popup'
    14321403                        , 'meta_key'
    14331404                        , 'meta_value'
    14341405                        , 'preview'
     
    14621433         * @since 4.2.0 Introduced the ability to order by specific clauses of a `$meta_query`, by passing the clause's
    14631434         *              array key to `$orderby`.
    14641435         * @since 4.4.0 Introduced `$post_name__in` and `$title` parameters.
     1436         * @since 4.4.0 Removed the `$comments_popup` parameter.
    14651437         * @access public
    14661438         *
    14671439         * @param string|array $query {
     
    14801452         *     @type string       $category_name           Use category slug (not name, this or any children).
    14811453         *     @type int          $comments_per_page       The number of comments to return per page.
    14821454         *                                                 Default 'comments_per_page' option.
    1483          *     @type int|string   $comments_popup          Whether the query is within the comments popup. Default empty.
    14841455         *     @type array        $date_query              An associative array of WP_Date_Query arguments.
    14851456         *                                                 {@see WP_Date_Query::__construct()}
    14861457         *     @type int          $day                     Day of the month. Default empty. Accepts numbers 1-31.
     
    17411712                if ( '' != $qv['paged'] && ( intval($qv['paged']) > 1 ) )
    17421713                        $this->is_paged = true;
    17431714
    1744                 if ( '' != $qv['comments_popup'] )
    1745                         $this->is_comments_popup = true;
    1746 
    17471715                // if we're previewing inside the write screen
    17481716                if ( '' != $qv['preview'] )
    17491717                        $this->is_preview = true;
     
    17611729                if ( $this->is_feed && ( !empty($qv['withcomments']) || ( empty($qv['withoutcomments']) && $this->is_singular ) ) )
    17621730                        $this->is_comment_feed = true;
    17631731
    1764                 if ( !( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup || $this->is_robots ) )
     1732                if ( !( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_robots ) )
    17651733                        $this->is_home = true;
    17661734
    17671735                // Correct is_* for page_on_front and page_for_posts
     
    26812649                        $where .= " AND $wpdb->posts.post_name IN ('" . implode( "' ,'", $q['post_name__in'] ) . "')";
    26822650                }
    26832651
    2684                 if ( intval($q['comments_popup']) )
    2685                         $q['p'] = absint($q['comments_popup']);
    2686 
    26872652                // If an attachment is requested by number, let it supersede any post number.
    26882653                if ( $q['attachment_id'] )
    26892654                        $q['p'] = absint($q['attachment_id']);
     
    42784243         * Whether the current URL is within the comments popup window.
    42794244         *
    42804245         * @since 3.1.0
     4246         * @deprecated 4.4.0
    42814247         *
    42824248         * @return bool
    42834249         */
    42844250        public function is_comments_popup() {
    4285                 return (bool) $this->is_comments_popup;
     4251                _deprecated_function( __FUNCTION__, '4.4' );
     4252
     4253                return false;
    42864254        }
    42874255
    42884256        /**
  • src/wp-includes/template-loader.php

     
    5959        elseif ( is_author()         && $template = get_author_template()         ) :
    6060        elseif ( is_date()           && $template = get_date_template()           ) :
    6161        elseif ( is_archive()        && $template = get_archive_template()        ) :
    62         elseif ( is_comments_popup() && $template = get_comments_popup_template() ) :
    6362        elseif ( is_paged()          && $template = get_paged_template()          ) :
    6463        else :
    6564                $template = get_index_template();
  • src/wp-includes/template.php

     
    459459}
    460460
    461461/**
    462  * Retrieve path of comment popup template in current or parent template.
    463  *
    464  * Checks for comment popup template in current template, if it exists or in the
    465  * parent template.
    466  *
    467  * The template path is filterable via the dynamic {@see '$type_template'} hook,
    468  * e.g. 'commentspopup_template'.
    469  *
    470  * @since 1.5.0
    471  *
    472  * @see get_query_template()
    473  *
    474  * @return string Full path to comments popup template file.
    475  */
    476 function get_comments_popup_template() {
    477         $template = get_query_template( 'comments_popup', array( 'comments-popup.php' ) );
    478 
    479         // Backward compat code will be removed in a future release.
    480         if ('' == $template)
    481                 $template = ABSPATH . WPINC . '/theme-compat/comments-popup.php';
    482 
    483         return $template;
    484 }
    485 
    486 /**
    487462 * Retrieve the name of the highest priority template file that exists.
    488463 *
    489464 * Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which
  • src/wp-includes/theme-compat/comments-popup.php

     
    1 <?php
    2 /**
    3  * @package WordPress
    4  * @subpackage Theme_Compat
    5  * @deprecated 3.0
    6  *
    7  * This file is here for Backwards compatibility with old themes and will be removed in a future version
    8  *
    9  */
    10 _deprecated_file( sprintf( __( 'Theme without %1$s' ), basename(__FILE__) ), '3.0', null, sprintf( __('Please include a %1$s template in your theme.'), basename(__FILE__) ) );
    11 ?><!DOCTYPE html>
    12 <html xmlns="http://www.w3.org/1999/xhtml">
    13 <head>
    14      <title><?php printf(__('%1$s - Comments on %2$s'), get_option('blogname'), the_title('','',false)); ?></title>
    15 
    16         <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
    17         <style type="text/css" media="screen">
    18                 @import url( <?php bloginfo('stylesheet_url'); ?> );
    19                 body { margin: 3px; }
    20         </style>
    21 
    22 </head>
    23 <body id="commentspopup">
    24 
    25 <h1 id="header"><a href="" title="<?php echo get_option('blogname'); ?>"><?php echo get_option('blogname'); ?></a></h1>
    26 
    27 <?php
    28 /* Don't remove these lines. */
    29 add_filter('comment_text', 'popuplinks');
    30 if ( have_posts() ) :
    31 while( have_posts()) : the_post();
    32 ?>
    33 <h2 id="comments"><?php _e('Comments'); ?></h2>
    34 
    35 <p><a href="<?php echo esc_url( get_post_comments_feed_link($post->ID) ); ?>"><?php _e('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.'); ?></a></p>
    36 
    37 <?php if ( pings_open() ) { ?>
    38 <p><?php printf(__('The <abbr title="Universal Resource Locator">URL</abbr> to TrackBack this entry is: <em>%s</em>'), get_trackback_url()); ?></p>
    39 <?php } ?>
    40 
    41 <?php
    42 // this line is WordPress' motor, do not delete it.
    43 $commenter = wp_get_current_commenter();
    44 $comments = get_approved_comments($id);
    45 $post = get_post($id);
    46 if ( post_password_required($post) ) {  // and it doesn't match the cookie
    47         echo(get_the_password_form());
    48 } else { ?>
    49 
    50 <?php if ($comments) { ?>
    51 <ol id="commentlist">
    52 <?php foreach ($comments as $comment) { ?>
    53         <li id="comment-<?php comment_ID() ?>">
    54         <?php comment_text() ?>
    55         <p><cite><?php comment_type(); ?> <?php printf(__('by %1$s &#8212; %2$s @ <a href="#comment-%3$s">%4$s</a>'), get_comment_author_link(), get_comment_date(), get_comment_ID(), get_comment_time()); ?></cite></p>
    56         </li>
    57 
    58 <?php } // end for each comment ?>
    59 </ol>
    60 <?php } else { // this is displayed if there are no comments so far ?>
    61         <p><?php _e('No comments yet.'); ?></p>
    62 <?php } ?>
    63 
    64 <?php if ( comments_open() ) { ?>
    65 <h2><?php _e('Leave a comment'); ?></h2>
    66 <p><?php printf(__('Line and paragraph breaks automatic, email address never displayed, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <code>%s</code>'), allowed_tags()); ?></p>
    67 
    68 <form action="<?php echo site_url(); ?>/wp-comments-post.php" method="post" id="commentform">
    69 <?php if ( $user_ID ) : ?>
    70         <p><?php printf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out &raquo;</a>'), get_edit_user_link(), $user_identity, wp_logout_url(get_permalink())); ?></p>
    71 <?php else : ?>
    72         <p>
    73           <input type="text" name="author" id="author" class="textarea" value="<?php echo esc_attr( $commenter['comment_author'] ); ?>" size="28" tabindex="1" />
    74            <label for="author"><?php _e('Name'); ?></label>
    75         </p>
    76 
    77         <p>
    78           <input type="text" name="email" id="email" value="<?php echo esc_attr( $commenter['comment_author_email'] ); ?>" size="28" tabindex="2" />
    79            <label for="email"><?php _e('Email'); ?></label>
    80         </p>
    81 
    82         <p>
    83           <input type="text" name="url" id="url" value="<?php echo esc_attr( $commenter['comment_author_url'] ); ?>" size="28" tabindex="3" />
    84            <label for="url"><?php _e('<abbr title="Universal Resource Locator">URL</abbr>'); ?></label>
    85         </p>
    86 <?php endif; ?>
    87 
    88         <p>
    89           <label for="comment"><?php _e('Your Comment'); ?></label>
    90         <br />
    91           <textarea name="comment" id="comment" cols="70" rows="4" tabindex="4"></textarea>
    92         </p>
    93 
    94         <p>
    95           <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
    96           <input type="hidden" name="redirect_to" value="<?php echo esc_attr($_SERVER["REQUEST_URI"]); ?>" />
    97           <input name="submit" type="submit" tabindex="5" value="<?php esc_attr_e('Say It!' ); ?>" />
    98         </p>
    99         <?php
    100         /** This filter is documented in wp-includes/comment-template.php */
    101         do_action( 'comment_form', $post->ID );
    102         ?>
    103 </form>
    104 <?php } else { // comments are closed ?>
    105 <p><?php _e('Sorry, the comment form is closed at this time.'); ?></p>
    106 <?php }
    107 } // end password check
    108 ?>
    109 
    110 <div><strong><a href="javascript:window.close()"><?php _e('Close this window.'); ?></a></strong></div>
    111 
    112 <?php // if you delete this the sky will fall on your head
    113 endwhile; // have_posts()
    114 else: // have_posts()
    115 ?>
    116 <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    117 <?php endif; ?>
    118 <!-- // this is just the end of the motor - don't touch that line either :) -->
    119 <?php //} ?>
    120 <p class="credit"><?php timer_stop(1); ?> <cite><?php printf(__('Powered by <a href="%s" title="Powered by WordPress, state-of-the-art semantic personal publishing platform"><strong>WordPress</strong></a>'), 'https://wordpress.org/'); ?></cite></p>
    121 <?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
    122 <script type="text/javascript">
    123 <!--
    124 document.onkeypress = function esc(e) {
    125         if(typeof(e) == "undefined") { e=event; }
    126         if (e.keyCode == 27) { self.close(); }
    127 }
    128 // -->
    129 </script>
    130 </body>
    131 </html>