Ticket #7635: 7635.diff
| File 7635.diff, 8.7 KB (added by ryan, 4 years ago) |
|---|
-
wp-includes/js/comment-reply.js
1 function moveAddCommentForm(theId, threadId) { 2 var addComment = document.getElementById("respond"); 3 var comment = document.getElementById(theId); 4 addComment.parentNode.removeChild(addComment); 5 6 comment.appendChild(addComment); 7 // if(comment.className.indexOf("alt")>-1) { 8 // addComment.className = addComment.className.replace(" alt", ""); 9 // } else { 10 // addComment.className += " alt"; 11 // } 12 var replyId = document.getElementById("comment-parent"); 13 replyId.value = threadId; 14 var reRootElement = document.getElementById("cancel-comment-reply"); 15 reRootElement.style.display = "block"; 16 var aTags = comment.getElementsByTagName("A"); 17 var anc = aTags.item(0).id; 18 //document.location.href = "#"+anc; 19 document.getElementById("comment").focus(); 20 } 21 22 function cancelCommentReply() { 23 var addComment = document.getElementById("respond"); 24 var reRootElement = document.getElementById("cancel-comment-reply"); 25 reRootElement.style.display = "none"; 26 var content = document.getElementById("content-main"); 27 if( !content ) 28 content = document.getElementById("content"); 29 if( content ) { 30 addComment.parentNode.removeChild(addComment); 31 content.appendChild(addComment); 32 } 33 // addComment.className = addComment.className.replace(" alt", ""); 34 document.location.href = "#respond"; 35 document.getElementById("comment").focus(); 36 document.getElementById("comment-parent").value = "0"; 37 } 38 No newline at end of file -
wp-includes/comment-template.php
837 837 echo '</a>'; 838 838 } 839 839 840 function comment_reply_link($comment = null, $post = null, $add_below = 'comment') { 841 global $user_ID; 842 843 $comment = get_comment($comment); 844 $post = get_post($post); 845 846 if ( 'open' != $post->comment_status ) 847 return; 848 849 $link = ''; 850 851 if ( get_option('comment_registration') && !$user_ID ) 852 $link = '<a href="' . site_url('wp-login.php?redirect_to=' . get_permalink()) . '">' . __('Log in to Reply') . '</a>'; 853 else 854 $link = "<a href='#' onclick='moveAddCommentForm(\"$add_below-$comment->comment_ID\", $comment->comment_ID); return false;'>" . __('Reply to this comment') . '</a>'; 855 856 return $link; 857 } 858 859 class Walker_Comment extends Walker { 860 var $tree_type = 'comment'; 861 var $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID'); 862 863 function start_lvl(&$output, $depth, $args) { 864 $indent = str_repeat("\t", $depth); 865 $output .= "$indent<ul class='children'>\n"; 866 } 867 868 function end_lvl(&$output, $depth, $args) { 869 $indent = str_repeat("\t", $depth); 870 $output .= "$indent</ul>\n"; 871 } 872 873 function start_el(&$output, $comment, $depth, $args) { 874 $GLOBALS['comment'] = $comment; 875 extract($args); 876 877 $output .= "<li " . get_comment_class() . " id=\"comment-" . get_comment_ID() . '">' . "\n"; 878 $output .= '<div class="comment-author vcard">' . "\n"; 879 $output .= get_avatar( $comment, 32 ) . "\n"; 880 $output .= sprintf(__('<cite>%s</cite> Says:'), get_comment_author_link()) . "\n"; 881 $output .= '</div>' . "\n"; 882 883 if ($comment->comment_approved == '0') 884 $output .= '<em>' . __('Your comment is awaiting moderation.') . '</em>' . "\n"; 885 $output .= '<br />' . "\n"; 886 887 $output .= '<div class="comment-meta commentmetadata"><a href="#comment-' . get_comment_ID() . '" title="">' . sprintf(__('%1$s at %2$s'), get_comment_date('F jS, Y'), get_comment_time()) . '</a>' . edit_comment_link('edit',' ','', false) . '</div>' . "\n"; 888 889 $output .= apply_filters('comment_text', get_comment_text()); 890 891 $output .= "<div class='reply'>"; 892 $output .= comment_reply_link(); 893 $output .= '</div>'; 894 } 895 896 function end_el(&$output, $comment, $depth, $args) { 897 $output .= "</li>\n"; 898 } 899 900 } 901 902 function wp_list_comments(&$comments, $args = array() ) { 903 $defaults = array('walker' => '', 'depth' => 3, 'echo' => true); 904 905 $r = wp_parse_args( $args, $defaults ); 906 907 extract( $r ); 908 909 if ( empty($walker) ) 910 $walker = new Walker_Comment; 911 912 $output = ''; 913 $output .= $walker->walk($comments, $depth, $r); 914 915 if ( $echo ) 916 echo $output; 917 else 918 return $output; 919 } 920 840 921 ?> 922 No newline at end of file -
wp-includes/link-template.php
531 531 return apply_filters( 'get_edit_comment_link', $location ); 532 532 } 533 533 534 function edit_comment_link( $link = 'Edit This', $before = '', $after = '' ) {534 function edit_comment_link( $link = 'Edit This', $before = '', $after = '', $echo = true ) { 535 535 global $comment, $post; 536 536 537 537 if ( $post->post_type == 'attachment' ) { … … 544 544 } 545 545 546 546 $link = '<a href="' . get_edit_comment_link( $comment->comment_ID ) . '" title="' . __( 'Edit comment' ) . '">' . $link . '</a>'; 547 echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after; 547 $link = $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after; 548 if ( $echo ) 549 echo $link; 550 else 551 return $link; 548 552 } 549 553 550 554 function get_edit_bookmark_link( $link = 0 ) { -
wp-includes/script-loader.php
107 107 $scripts->add( 'jquery-ui-resizable', '/wp-includes/js/jquery/ui.resizable.js', array('jquery-ui-core'), '1.5.2' ); 108 108 $scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable'), '1.5.2' ); 109 109 110 $scripts->add( 'comment-reply', '/wp-includes/js/comment-reply.js', false, '20080828'); 111 110 112 if ( is_admin() ) { 111 113 $scripts->add( 'ajaxcat', '/wp-admin/js/cat.js', array( 'wp-lists' ), '20071101' ); 112 114 $scripts->localize( 'ajaxcat', 'catL10n', array( -
wp-content/themes/default/comments.php
23 23 <h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3> 24 24 25 25 <ol class="commentlist"> 26 27 <?php foreach ($comments as $comment) : ?> 28 29 <li <?php comment_class($oddcomment) ?> id="comment-<?php comment_ID() ?>"> 30 <?php echo get_avatar( $comment, 32 ); ?> 31 <cite><?php comment_author_link() ?></cite> Says: 32 <?php if ($comment->comment_approved == '0') : ?> 33 <em>Your comment is awaiting moderation.</em> 34 <?php endif; ?> 35 <br /> 36 37 <small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?></a> <?php edit_comment_link('edit',' ',''); ?></small> 38 39 <?php comment_text() ?> 40 41 </li> 42 43 <?php 44 /* Changes every other comment to a different class */ 45 $oddcomment = ( empty( $oddcomment ) ) ? 'alt' : ''; 46 ?> 47 48 <?php endforeach; /* end for each comment */ ?> 49 26 <?php wp_list_comments($comments); ?> 50 27 </ol> 51 28 52 29 <?php else : // this is displayed if there are no comments so far ?> … … 64 41 65 42 <?php if ('open' == $post->comment_status) : ?> 66 43 67 < h3 id="respond">Leave a Reply</h3>44 <div id="respond"> 68 45 46 <div id="cancel-comment-reply" style="display: none;"> 47 <small><a href="#" onclick="cancelCommentReply(); return false;"><?php _e('Click here to cancel "reply".') ?></a></small> 48 </div> 49 <h3>Leave a Reply</h3> 50 69 51 <?php if ( get_option('comment_registration') && !$user_ID ) : ?> 70 52 <p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">logged in</a> to post a comment.</p> 71 53 <?php else : ?> … … 95 77 96 78 <p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" /> 97 79 <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /> 80 <input type="hidden" name="comment_parent" id="comment-parent" value="0" /> 98 81 </p> 99 82 <?php do_action('comment_form', $post->ID); ?> 100 83 101 84 </form> 85 </div> 102 86 103 87 <?php endif; // If registration required and not logged in ?> 104 88 -
wp-content/themes/default/header.php
24 24 25 25 </style> 26 26 27 <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?> 28 27 29 <?php wp_head(); ?> 28 30 </head> 29 31 <body>
