Changeset 8869
- Timestamp:
- 09/11/2008 07:25:50 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
-
wp-content/themes/default/comments.php (modified) (3 diffs)
-
wp-content/themes/default/header.php (modified) (1 diff)
-
wp-includes/comment-template.php (modified) (3 diffs)
-
wp-includes/js/comment-reply.js (added)
-
wp-includes/link-template.php (modified) (2 diffs)
-
wp-includes/script-loader.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/default/comments.php
r8800 r8869 8 8 return; 9 9 } 10 11 /* This variable is for alternating comment background */12 $oddcomment = 'alt';13 10 ?> 14 11 15 12 <!-- You can start editing here. --> 16 13 17 <?php if ( $comments) : ?>14 <?php if ( have_comments() ) : ?> 18 15 <h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3> 19 16 20 17 <ol class="commentlist"> 21 22 <?php foreach ($comments as $comment) : ?> 23 24 <li <?php comment_class($oddcomment) ?> id="comment-<?php comment_ID() ?>"> 25 <?php echo get_avatar( $comment, 32 ); ?> 26 <cite><?php comment_author_link() ?></cite> Says: 27 <?php if ($comment->comment_approved == '0') : ?> 28 <em>Your comment is awaiting moderation.</em> 29 <?php endif; ?> 30 <br /> 31 32 <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> 33 34 <?php comment_text() ?> 35 36 </li> 37 38 <?php 39 /* Changes every other comment to a different class */ 40 $oddcomment = ( empty( $oddcomment ) ) ? 'alt' : ''; 41 ?> 42 43 <?php endforeach; /* end for each comment */ ?> 44 18 <?php wp_list_comments($comments); ?> 45 19 </ol> 46 20 … … 60 34 <?php if ('open' == $post->comment_status) : ?> 61 35 62 <h3 id="respond">Leave a Reply</h3> 36 <div id="respond"> 37 38 <h3>Leave a Reply</h3> 39 40 <div id="cancel-comment-reply" style="display: none;"> 41 <small><?php echo cancel_comment_reply_link() ?></small> 42 </div> 63 43 64 44 <?php if ( get_option('comment_registration') && !$user_ID ) : ?> … … 91 71 <p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" /> 92 72 <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /> 73 <input type="hidden" name="comment_parent" id="comment-parent" value="0" /> 93 74 </p> 94 75 <?php do_action('comment_form', $post->ID); ?> 95 76 96 77 </form> 78 </div> 97 79 98 80 <?php endif; // If registration required and not logged in ?> -
trunk/wp-content/themes/default/header.php
r8408 r8869 25 25 </style> 26 26 27 <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?> 28 27 29 <?php wp_head(); ?> 28 30 </head> -
trunk/wp-includes/comment-template.php
r8800 r8869 228 228 * @param int $post_id An optional post ID 229 229 */ 230 function comment_class( $class = '', $comment_id = null, $post_id = null ) { 231 // Separates classes with a single space, collates classes for post DIV 232 echo 'class="' . join( ' ', get_comment_class( $class, $comment_id, $post_id ) ) . '"'; 230 function comment_class( $class = '', $comment_id = null, $post_id = null, $echo = true ) { 231 // Separates classes with a single space, collates classes for comment DIV 232 $class = 'class="' . join( ' ', get_comment_class( $class, $comment_id, $post_id ) ) . '"'; 233 if ( $echo) 234 echo $class; 235 else 236 return $class; 233 237 } 234 238 … … 267 271 $comment_alt = 0; 268 272 269 if ( $comment_alt % 2 ) 273 if ( $comment_alt % 2 ) { 270 274 $classes[] = 'odd'; 271 else 275 $classes[] = 'alt'; 276 } else { 272 277 $classes[] = 'even'; 278 } 273 279 274 280 $comment_alt++; … … 836 842 } 837 843 844 function comment_reply_link($args = array(), $comment = null, $post = null) { 845 global $user_ID; 846 847 $defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'), 848 'login_text' => __('Log in to Reply')); 849 850 $args = wp_parse_args($args, $defaults); 851 852 extract($args, EXTR_SKIP); 853 854 $comment = get_comment($comment); 855 $post = get_post($post); 856 857 if ( 'open' != $post->comment_status ) 858 return false; 859 860 $link = ''; 861 862 if ( get_option('comment_registration') && !$user_ID ) 863 $link = '<a href="' . site_url('wp-login.php?redirect_to=' . get_permalink()) . '">' . $login_text . '</a>'; 864 else 865 $link = "<a href='#' onclick='moveAddCommentForm(\"$add_below-$comment->comment_ID\", $comment->comment_ID, \"$respond_id\"); return false;'>$reply_text</a>"; 866 867 return $link; 868 } 869 870 function cancel_comment_reply_link($text = '', $respond_id = 'respond') { 871 if ( empty($text) ) 872 $text = __('Click here to cancel reply.'); 873 echo '<a href="#" onclick="cancelCommentReply(\'' . $respond_id . '\'); return false;">' . $text . '</a>'; 874 } 875 876 class Walker_Comment extends Walker { 877 var $tree_type = 'comment'; 878 var $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID'); 879 880 function start_lvl(&$output, $depth, $args) { 881 if ( 'div' == $args['style'] ) 882 return; 883 884 echo "<ul class='children'>\n"; 885 } 886 887 function end_lvl(&$output, $depth, $args) { 888 if ( 'div' == $args['style'] ) 889 return; 890 891 echo "</ul>\n"; 892 } 893 894 function start_el(&$output, $comment, $depth, $args) { 895 $depth++; 896 897 if ( !empty($args['callback']) ) { 898 call_user_func($args['callback'], $comment, $args, $depth); 899 return; 900 } 901 902 $GLOBALS['comment'] = $comment; 903 extract($args, EXTR_SKIP); 904 905 if ( 'div' == $args['style'] ) 906 $tag = 'div'; 907 else 908 $tag = 'li'; 838 909 ?> 910 <<?php echo $tag ?> "<?php comment_class() ?>" id="comment-<?php comment_ID() ?>"> 911 <?php if ( 'list' == $args['style'] ) : ?> 912 <div id="div-comment-<?php comment_ID() ?>"> 913 <?php endif; ?> 914 <div class="comment-author vcard"> 915 <?php echo get_avatar( $comment, 32 ) ?> 916 <?php printf(__('<cite>%s</cite> Says:'), get_comment_author_link()) ?> 917 </div> 918 <?php if ($comment->comment_approved == '0') : ?> 919 <em><?php _e('Your comment is awaiting moderation.') ?></em> 920 <br /> 921 <?php endif; ?> 922 923 <div class="comment-meta commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?php printf(__('%1$s at %2$s'), get_comment_date('F jS, Y'), get_comment_time()) ?></a><?php edit_comment_link('edit',' ','') ?></div> 924 925 <?php echo apply_filters('comment_text', get_comment_text()) ?> 926 927 <div class='reply'> 928 <?php if ( $depth < $args['depth'] ) echo comment_reply_link(array('add_below' => 'div-comment')) ?> 929 <?php if ( 'list' == $args['style'] ) : ?> 930 </div> 931 <?php endif; ?> 932 </div> 933 <?php 934 } 935 936 function end_el(&$output, $comment, $depth, $args) { 937 if ( 'div' == $args['style'] ) 938 echo "</div>\n"; 939 else 940 echo "</li>\n"; 941 } 942 943 } 944 945 /** 946 * List comments 947 * 948 * Used in the comments.php template to list comments for a particular post 949 * 950 * @since 2.7 951 * @uses Walker_Comment 952 * 953 * @param $comments array Array of comment object to list 954 * @param $args string|array Additional arguments 955 */ 956 function wp_list_comments(&$comments, $args = array() ) { 957 $defaults = array('walker' => null, 'depth' => 3, 'style' => 'list', 'callback' => null); 958 959 $r = wp_parse_args( $args, $defaults ); 960 961 extract( $r, EXTR_SKIP ); 962 963 if ( empty($walker) ) 964 $walker = new Walker_Comment; 965 966 $walker->walk($comments, $depth, $r); 967 } 968 969 ?> -
trunk/wp-includes/link-template.php
r8758 r8869 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 … … 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 -
trunk/wp-includes/script-loader.php
r8860 r8869 141 141 $scripts->add( 'jquery-ui-resizable', '/wp-includes/js/jquery/ui.resizable.js', array('jquery-ui-core'), '1.5.2' ); 142 142 $scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable'), '1.5.2' ); 143 144 $scripts->add( 'comment-reply', '/wp-includes/js/comment-reply.js', false, '20080828'); 143 145 144 146 if ( is_admin() ) {
Note: See TracChangeset
for help on using the changeset viewer.