Ticket #28617: 28617.diff
File 28617.diff, 20.8 KB (added by , 10 years ago) |
---|
-
src/wp-admin/includes/file.php
16 16 'editor-style-rtl.css' => __( 'Visual Editor RTL Stylesheet' ), 17 17 'rtl.css' => __( 'RTL Stylesheet' ), 18 18 'comments.php' => __( 'Comments' ), 19 'comments-popup.php' => __( 'Popup Comments' ),20 19 'footer.php' => __( 'Footer' ), 21 20 'header.php' => __( 'Header' ), 22 21 'sidebar.php' => __( 'Sidebar' ), … … 42 41 'wp-layout.css' => __( 'Stylesheet' ), 43 42 'wp-comments.php' => __( 'Comments Template' ), 44 43 'wp-comments-popup.php' => __( 'Popup Comments Template' ), 44 'comments-popup.php' => __( 'Popup Comments' ), 45 45 ); 46 46 47 47 /** -
src/wp-admin/includes/update-core.php
699 699 'wp-admin/js/wp-fullscreen.min.js', 700 700 'wp-includes/js/tinymce/wp-mce-help.php', 701 701 'wp-includes/js/tinymce/plugins/wpfullscreen', 702 // 4.4 703 'wp-includes/theme-compat/comments-popup.php', 702 704 ); 703 705 704 706 /** -
src/wp-includes/canonical.php
17 17 * prevents penalty for duplicate content by redirecting all incoming links to 18 18 * one or the other. 19 19 * 20 * Prevents redirection for feeds, trackbacks, searches, comment popup,and20 * Prevents redirection for feeds, trackbacks, searches, and 21 21 * admin URLs. Does not redirect on non-pretty-permalink-supporting IIS 7+, 22 22 * page/post previews, WP admin, Trackbacks, robots.txt, searches, or on POST 23 23 * requests. … … 55 55 } 56 56 } 57 57 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() ) ) { 59 59 return; 60 60 } 61 61 -
src/wp-includes/class-wp.php
15 15 * @access public 16 16 * @var array 17 17 */ 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'); 19 19 20 20 /** 21 21 * Private query variables. -
src/wp-includes/comment-template.php
1235 1235 } 1236 1236 1237 1237 /** 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. 1277 1239 * 1278 1240 * @since 0.71 1279 1241 * … … 1287 1249 * Default false. 1288 1250 */ 1289 1251 function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) { 1290 global $wpcommentspopupfile, $wpcommentsjavascript;1291 1292 1252 $id = get_the_ID(); 1293 1253 $title = get_the_title(); 1294 1254 $number = get_comments_number( $id ); … … 1325 1285 } 1326 1286 1327 1287 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(); 1341 1292 } 1293 echo '"'; 1342 1294 1343 1295 if ( !empty( $css_class ) ) { 1344 1296 echo ' class="'.$css_class.'" '; … … 1346 1298 1347 1299 $attributes = ''; 1348 1300 /** 1349 * Filter the comments popuplink attributes for display.1301 * Filter the comments link attributes for display. 1350 1302 * 1351 1303 * @since 2.5.0 1352 1304 * 1353 * @param string $attributes The comments popuplink attributes. Default empty.1305 * @param string $attributes The comments link attributes. Default empty. 1354 1306 */ 1355 1307 echo apply_filters( 'comments_popup_link_attributes', $attributes ); 1356 1308 -
src/wp-includes/deprecated.php
3561 3561 return get_permalink( $post_id ); 3562 3562 } 3563 3563 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 */ 3572 function 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 */ 3586 function 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 */ 3598 function 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 */ 3611 function 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
2598 2598 } 2599 2599 2600 2600 /** 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's2604 * a moderately dumb function, ideally it would detect whether a target or rel2605 * attribute was already there and adjust its actions accordingly.2606 *2607 * @since 0.712608 *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 /**2618 2601 * Strips out all characters that are not allowable in an email. 2619 2602 * 2620 2603 * @since 1.5.0 -
src/wp-includes/query.php
293 293 } 294 294 295 295 /** 296 * Whether the current URL is within the comments popup window.297 *298 * @since 1.5.0299 *300 * @global WP_Query $wp_query301 *302 * @return bool303 */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 /**316 296 * Is the query for an existing date archive? 317 297 * 318 298 * @since 1.5.0 … … 832 812 * @link https://codex.wordpress.org/Function_Reference/WP_Query Codex page. 833 813 * 834 814 * @since 1.5.0 815 * @since 4.4.0 Removed the `$comments_popup` property. 835 816 */ 836 817 class WP_Query { 837 818 … … 1191 1172 public $is_404 = false; 1192 1173 1193 1174 /** 1194 * Set if query is within comments popup window.1195 *1196 * @since 1.5.01197 * @access public1198 * @var bool1199 */1200 public $is_comments_popup = false;1201 1202 /**1203 1175 * Set if query is paged 1204 1176 * 1205 1177 * @since 1.5.0 … … 1341 1313 $this->is_trackback = false; 1342 1314 $this->is_home = false; 1343 1315 $this->is_404 = false; 1344 $this->is_comments_popup = false;1345 1316 $this->is_paged = false; 1346 1317 $this->is_admin = false; 1347 1318 $this->is_attachment = false; … … 1393 1364 * Fills in the query variables, which do not exist within the parameter. 1394 1365 * 1395 1366 * @since 2.1.0 1367 * @since 4.4.0 Removed the `comments_popup` public query variable. 1396 1368 * @access public 1397 1369 * 1398 1370 * @param array $array Defined query variables. … … 1428 1400 , 'feed' 1429 1401 , 'tb' 1430 1402 , 'paged' 1431 , 'comments_popup'1432 1403 , 'meta_key' 1433 1404 , 'meta_value' 1434 1405 , 'preview' … … 1462 1433 * @since 4.2.0 Introduced the ability to order by specific clauses of a `$meta_query`, by passing the clause's 1463 1434 * array key to `$orderby`. 1464 1435 * @since 4.4.0 Introduced `$post_name__in` and `$title` parameters. 1436 * @since 4.4.0 Removed the `$comments_popup` parameter. 1465 1437 * @access public 1466 1438 * 1467 1439 * @param string|array $query { … … 1480 1452 * @type string $category_name Use category slug (not name, this or any children). 1481 1453 * @type int $comments_per_page The number of comments to return per page. 1482 1454 * Default 'comments_per_page' option. 1483 * @type int|string $comments_popup Whether the query is within the comments popup. Default empty.1484 1455 * @type array $date_query An associative array of WP_Date_Query arguments. 1485 1456 * {@see WP_Date_Query::__construct()} 1486 1457 * @type int $day Day of the month. Default empty. Accepts numbers 1-31. … … 1741 1712 if ( '' != $qv['paged'] && ( intval($qv['paged']) > 1 ) ) 1742 1713 $this->is_paged = true; 1743 1714 1744 if ( '' != $qv['comments_popup'] )1745 $this->is_comments_popup = true;1746 1747 1715 // if we're previewing inside the write screen 1748 1716 if ( '' != $qv['preview'] ) 1749 1717 $this->is_preview = true; … … 1761 1729 if ( $this->is_feed && ( !empty($qv['withcomments']) || ( empty($qv['withoutcomments']) && $this->is_singular ) ) ) 1762 1730 $this->is_comment_feed = true; 1763 1731 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 ) ) 1765 1733 $this->is_home = true; 1766 1734 1767 1735 // Correct is_* for page_on_front and page_for_posts … … 2681 2649 $where .= " AND $wpdb->posts.post_name IN ('" . implode( "' ,'", $q['post_name__in'] ) . "')"; 2682 2650 } 2683 2651 2684 if ( intval($q['comments_popup']) )2685 $q['p'] = absint($q['comments_popup']);2686 2687 2652 // If an attachment is requested by number, let it supersede any post number. 2688 2653 if ( $q['attachment_id'] ) 2689 2654 $q['p'] = absint($q['attachment_id']); … … 4278 4243 * Whether the current URL is within the comments popup window. 4279 4244 * 4280 4245 * @since 3.1.0 4246 * @deprecated 4.4.0 4281 4247 * 4282 4248 * @return bool 4283 4249 */ 4284 4250 public function is_comments_popup() { 4285 return (bool) $this->is_comments_popup; 4251 _deprecated_function( __FUNCTION__, '4.4' ); 4252 4253 return false; 4286 4254 } 4287 4255 4288 4256 /** -
src/wp-includes/template-loader.php
59 59 elseif ( is_author() && $template = get_author_template() ) : 60 60 elseif ( is_date() && $template = get_date_template() ) : 61 61 elseif ( is_archive() && $template = get_archive_template() ) : 62 elseif ( is_comments_popup() && $template = get_comments_popup_template() ) :63 62 elseif ( is_paged() && $template = get_paged_template() ) : 64 63 else : 65 64 $template = get_index_template(); -
src/wp-includes/template.php
459 459 } 460 460 461 461 /** 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 the465 * 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.0471 *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 /**487 462 * Retrieve the name of the highest priority template file that exists. 488 463 * 489 464 * Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which -
src/wp-includes/theme-compat/comments-popup.php
1 <?php2 /**3 * @package WordPress4 * @subpackage Theme_Compat5 * @deprecated 3.06 *7 * This file is here for Backwards compatibility with old themes and will be removed in a future version8 *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 <?php28 /* 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 <?php42 // 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 cookie47 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 — %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 »</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 <?php100 /** 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 check108 ?>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 head113 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>