diff --git a/wp-content/themes/default/comments.php b/wp-content/themes/default/comments.php
index 8a70c2d9cc..6820449c44 100644
--- a/wp-content/themes/default/comments.php
+++ b/wp-content/themes/default/comments.php
@@ -7,41 +7,15 @@
-
+
@@ -59,7 +33,13 @@
comment_status) : ?>
-Leave a Reply
+
+
+
Leave a Reply
+
+
You must be logged in to post a comment.
@@ -90,10 +70,12 @@
+
ID); ?>
+
diff --git a/wp-content/themes/default/header.php b/wp-content/themes/default/header.php
index 582bfe3e02..6fdfdd0047 100644
--- a/wp-content/themes/default/header.php
+++ b/wp-content/themes/default/header.php
@@ -24,6 +24,8 @@ if ( !empty($withcomments) && !is_single() ) {
+
+
diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php
index 8a900f9880..36cf7e21d7 100644
--- a/wp-includes/comment-template.php
+++ b/wp-includes/comment-template.php
@@ -227,9 +227,13 @@ function comment_author_url_link( $linktext = '', $before = '', $after = '' ) {
* @param int $comment_id An optional comment ID
* @param int $post_id An optional post ID
*/
-function comment_class( $class = '', $comment_id = null, $post_id = null ) {
- // Separates classes with a single space, collates classes for post DIV
- echo 'class="' . join( ' ', get_comment_class( $class, $comment_id, $post_id ) ) . '"';
+function comment_class( $class = '', $comment_id = null, $post_id = null, $echo = true ) {
+ // Separates classes with a single space, collates classes for comment DIV
+ $class = 'class="' . join( ' ', get_comment_class( $class, $comment_id, $post_id ) ) . '"';
+ if ( $echo)
+ echo $class;
+ else
+ return $class;
}
/**
@@ -266,10 +270,12 @@ function get_comment_class( $class = '', $comment_id = null, $post_id = null ) {
if ( empty($comment_alt) )
$comment_alt = 0;
- if ( $comment_alt % 2 )
+ if ( $comment_alt % 2 ) {
$classes[] = 'odd';
- else
+ $classes[] = 'alt';
+ } else {
$classes[] = 'even';
+ }
$comment_alt++;
@@ -835,4 +841,129 @@ function comments_popup_link( $zero = 'No Comments', $one = '1 Comment', $more =
echo '';
}
+function comment_reply_link($args = array(), $comment = null, $post = null) {
+ global $user_ID;
+
+ $defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'),
+ 'login_text' => __('Log in to Reply'));
+
+ $args = wp_parse_args($args, $defaults);
+
+ extract($args, EXTR_SKIP);
+
+ $comment = get_comment($comment);
+ $post = get_post($post);
+
+ if ( 'open' != $post->comment_status )
+ return false;
+
+ $link = '';
+
+ if ( get_option('comment_registration') && !$user_ID )
+ $link = '' . $login_text . '';
+ else
+ $link = "$reply_text";
+
+ return $link;
+}
+
+function cancel_comment_reply_link($text = '', $respond_id = 'respond') {
+ if ( empty($text) )
+ $text = __('Click here to cancel reply.');
+ echo '' . $text . '';
+}
+
+class Walker_Comment extends Walker {
+ var $tree_type = 'comment';
+ var $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID');
+
+ function start_lvl(&$output, $depth, $args) {
+ if ( 'div' == $args['style'] )
+ return;
+
+ echo "\n";
+ }
+
+ function end_lvl(&$output, $depth, $args) {
+ if ( 'div' == $args['style'] )
+ return;
+
+ echo "
\n";
+ }
+
+ function start_el(&$output, $comment, $depth, $args) {
+ $depth++;
+
+ if ( !empty($args['callback']) ) {
+ call_user_func($args['callback'], $comment, $args, $depth);
+ return;
+ }
+
+ $GLOBALS['comment'] = $comment;
+ extract($args, EXTR_SKIP);
+
+ if ( 'div' == $args['style'] )
+ $tag = 'div';
+ else
+ $tag = 'li';
+?>
+ < "" id="comment-">
+
+
+\n";
+ else
+ echo "\n";
+ }
+
+}
+
+/**
+ * List comments
+ *
+ * Used in the comments.php template to list comments for a particular post
+ *
+ * @since 2.7
+ * @uses Walker_Comment
+ *
+ * @param $comments array Array of comment object to list
+ * @param $args string|array Additional arguments
+ */
+function wp_list_comments(&$comments, $args = array() ) {
+ $defaults = array('walker' => null, 'depth' => 3, 'style' => 'list', 'callback' => null);
+
+ $r = wp_parse_args( $args, $defaults );
+
+ extract( $r, EXTR_SKIP );
+
+ if ( empty($walker) )
+ $walker = new Walker_Comment;
+
+ $walker->walk($comments, $depth, $r);
+}
+
?>
\ No newline at end of file
diff --git a/wp-includes/js/comment-reply.js b/wp-includes/js/comment-reply.js
new file mode 100644
index 0000000000..2ef8e73f2d
--- /dev/null
+++ b/wp-includes/js/comment-reply.js
@@ -0,0 +1,37 @@
+function moveAddCommentForm(theId, threadId, respondId) {
+ var addComment = document.getElementById(respondId);
+ var comment = document.getElementById(theId);
+ addComment.parentNode.removeChild(addComment);
+
+ comment.appendChild(addComment);
+// if(comment.className.indexOf("alt")>-1) {
+// addComment.className = addComment.className.replace(" alt", "");
+// } else {
+// addComment.className += " alt";
+// }
+ var replyId = document.getElementById("comment-parent");
+ replyId.value = threadId;
+ var reRootElement = document.getElementById("cancel-comment-reply");
+ reRootElement.style.display = "block";
+ var aTags = comment.getElementsByTagName("A");
+ var anc = aTags.item(0).id;
+ //document.location.href = "#"+anc;
+ document.getElementById("comment").focus();
+}
+
+function cancelCommentReply() {
+ var addComment = document.getElementById("respond");
+ var reRootElement = document.getElementById("cancel-comment-reply");
+ reRootElement.style.display = "none";
+ var content = document.getElementById("content-main");
+ if( !content )
+ content = document.getElementById("content");
+ if( content ) {
+ addComment.parentNode.removeChild(addComment);
+ content.appendChild(addComment);
+ }
+// addComment.className = addComment.className.replace(" alt", "");
+ document.location.href = "#respond";
+ document.getElementById("comment").focus();
+ document.getElementById("comment-parent").value = "0";
+}
\ No newline at end of file
diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php
index 5052fb0a1a..4912f2075b 100644
--- a/wp-includes/link-template.php
+++ b/wp-includes/link-template.php
@@ -531,7 +531,7 @@ function get_edit_comment_link( $comment_id = 0 ) {
return apply_filters( 'get_edit_comment_link', $location );
}
-function edit_comment_link( $link = 'Edit This', $before = '', $after = '' ) {
+function edit_comment_link( $link = 'Edit This', $before = '', $after = '', $echo = true ) {
global $comment, $post;
if ( $post->post_type == 'attachment' ) {
@@ -544,7 +544,11 @@ function edit_comment_link( $link = 'Edit This', $before = '', $after = '' ) {
}
$link = '' . $link . '';
- echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after;
+ $link = $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after;
+ if ( $echo )
+ echo $link;
+ else
+ return $link;
}
function get_edit_bookmark_link( $link = 0 ) {
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index 7045de561d..cf8542d505 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -141,6 +141,8 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'jquery-ui-resizable', '/wp-includes/js/jquery/ui.resizable.js', array('jquery-ui-core'), '1.5.2' );
$scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable'), '1.5.2' );
+ $scripts->add( 'comment-reply', '/wp-includes/js/comment-reply.js', false, '20080828');
+
if ( is_admin() ) {
$scripts->add( 'ajaxcat', '/wp-admin/js/cat.js', array( 'wp-lists' ), '20071101' );
$scripts->localize( 'ajaxcat', 'catL10n', array(
- - at - - - -