Reply to comments from admin, first run, see #7435

git-svn-id: http://svn.automattic.com/wordpress/trunk@8720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2008-08-24 06:56:22 +00:00
parent f2af4b9b6d
commit 95fa29a208
26 changed files with 776 additions and 309 deletions

View File

@ -422,6 +422,69 @@ case 'add-comment' :
'data' => $comment_list_item
) );
}
$x->send();
break;
case 'replyto-comment' :
check_ajax_referer( $action );
$comment_post_ID = (int) $_POST['comment_post_ID'];
if ( !current_user_can( 'edit_post', $comment_post_ID ) )
die('-1');
$status = $wpdb->get_var( $wpdb->prepare("SELECT post_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) );
if ( empty($status) )
die('1');
elseif ( in_array($status->post_status, array('draft', 'pending') ) )
die( __('Error: you are replying to comment on a draft post.') );
$user = wp_get_current_user();
if ( $user->ID ) {
$comment_author = $wpdb->escape($user->display_name);
$comment_author_email = $wpdb->escape($user->user_email);
$comment_author_url = $wpdb->escape($user->user_url);
$comment_content = trim($_POST['comment']);
if ( current_user_can('unfiltered_html') ) {
if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) {
kses_remove_filters(); // start with a clean slate
kses_init_filters(); // set up the filters
}
}
} else {
die( __('Sorry, you must be logged in to reply to a comment.') );
}
if ( '' == $comment_content )
die( __('Error: please type a comment.') );
$comment_parent = absint($_POST['comment_ID']);
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');
$comment_id = wp_new_comment( $commentdata );
$comment = get_comment($comment_id);
if ( ! $comment ) die('1');
$mode = ( isset($_POST['mode']) && 'single' == $_POST['mode'] ) ? 'single' : 'detail';
$position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
$checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
if ( get_option('show_avatars') && 'single' != $mode )
add_filter( 'comment_author', 'floated_admin_avatar' );
$x = new WP_Ajax_Response();
ob_start();
_wp_comment_row( $comment->comment_ID, $mode, false, $checkbox );
$comment_list_item = ob_get_contents();
ob_end_clean();
$x->add( array(
'what' => 'comment',
'id' => $comment->comment_ID,
'data' => $comment_list_item,
'position' => $position
));
$x->send();
break;
case 'add-meta' :

View File

@ -10,7 +10,7 @@
<br class="clear" /></div><!-- wpbody-content -->
</div><!-- wpbody -->
</div><!-- wpcontent -->
</div><!-- wpwrap -->
<br class="clear" /></div><!-- wpwrap -->
<div id="footer">
<p><?php
do_action('in_admin_footer', '');

View File

@ -54,7 +54,7 @@ li.widget-list-control-item h4.widget-title a,
}
li.widget-list-control-item, div.nav, .tablenav, #dashboard-widgets p.dashboard-widget-links,
ul.view-switch li.current, .form-table tr, #poststuff h3,
ul.view-switch li.current, .form-table tr, #poststuff h3, #replyhandle,
.login form, h3.info-box-title, #post-status-info {
background-color: #cfebf7;
}
@ -70,7 +70,7 @@ strong .post-com-count span {
#post-body ul#category-tabs li.ui-tabs-selected, .button-secondary,
#quicktags, #login form .submit input, #post-search .button,
#post-search-prep .button {
#post-search-prep .button, #ed_reply_toolbar {
background-color: #8ebddc !important;
}
@ -376,7 +376,7 @@ input.readonly {
color: #fff;
}
#ed_toolbar input {
#ed_toolbar input, #ed_reply_toolbar input {
background: url( ../images/fade-butt.png ) #fff repeat-x 0 -2px;
}

View File

@ -54,7 +54,7 @@ li.widget-list-control-item h4.widget-title a,
}
li.widget-list-control-item, div.nav, .tablenav, #dashboard-widgets p.dashboard-widget-links,
ul.view-switch li.current, .form-table tr, #poststuff h3,
ul.view-switch li.current, .form-table tr, #poststuff h3, #replyhandle,
.login form, h3.info-box-title, #post-status-info {
background-color: #eaf3fa;
}
@ -70,7 +70,7 @@ strong .post-com-count span {
#post-body ul#category-tabs li.ui-tabs-selected, .button-secondary,
#quicktags, #login form .submit input, #post-search .button,
#post-search-prep .button {
#post-search-prep .button, #ed_reply_toolbar {
background-color: #cee1ef !important;
}
@ -365,7 +365,7 @@ input.readonly {
color: #fff;
}
#ed_toolbar input {
#ed_toolbar input, #ed_reply_toolbar input {
background: url( ../images/fade-butt.png ) #fff repeat-x 0 -2px;
}

View File

@ -11,7 +11,8 @@ require_once('admin.php');
$title = __('Edit Comments');
wp_enqueue_script( 'admin-comments' );
wp_enqueue_script('admin-forms');
wp_enqueue_script( 'admin-forms' );
wp_enqueue_script( 'quicktags' );
if ( !empty( $_REQUEST['delete_comments'] ) && isset($_REQUEST['action']) ) {
check_admin_referer('bulk-comments');
@ -53,20 +54,11 @@ if ( !empty( $_REQUEST['delete_comments'] ) && isset($_REQUEST['action']) ) {
require_once('admin-header.php');
if ( empty($_GET['mode']) )
$mode = 'detail';
else
$mode = attribute_escape($_GET['mode']);
$mode = ( ! isset($_GET['mode']) || empty($_GET['mode']) ) ? 'detail' : attribute_escape($_GET['mode']);
if ( isset($_GET['comment_status']) )
$comment_status = attribute_escape($_GET['comment_status']);
else
$comment_status = '';
$comment_status = isset($_GET['comment_status']) ? attribute_escape($_GET['comment_status']) : '';
if ( isset($_GET['s']) )
$search_dirty = $_GET['s'];
else
$search_dirty = '';
$search_dirty = ( isset($_GET['s']) ) ? $_GET['s'] : '';
$search = attribute_escape( $search_dirty );
?>
<?php
@ -215,7 +207,7 @@ if ($comments) {
<th scope="col" class="check-column"><input type="checkbox" /></th>
<th scope="col" class="comment-column"><?php _e('Comment') ?></th>
<th scope="col" class="author-column"><?php _e('Author') ?></th>
<th scope="col" class="date-column"><?php _e('Comment Submitted') ?></th>
<th scope="col" class="date-column"><?php _e('Submitted') ?></th>
<th scope="col" class="response-column"><?php _e('In Response To This Post') ?></th>
</tr>
</thead>
@ -269,4 +261,6 @@ if ( $page_links )
</div>
<?php include('admin-footer.php'); ?>
<?php
wp_comment_reply('-1', true, 'detail');
include('admin-footer.php'); ?>

View File

@ -325,11 +325,7 @@ function post_comment_status_meta_box($post) {
</tbody>
</table>
<?php
}
add_meta_box('commentstatusdiv', __('Comments on this Post'), 'post_comment_status_meta_box', 'post', 'normal', 'core');
@ -541,6 +537,8 @@ do_action('dbx_post_sidebar');
</div>
</form>
<?php wp_comment_reply(); ?>
<?php if ((isset($post->post_title) && '' == $post->post_title) || (isset($_GET['message']) && 2 > $_GET['message'])) : ?>
<script type="text/javascript">
try{document.post.title.focus();}catch(e){}

View File

@ -68,6 +68,7 @@ wp($query_str);
if ( is_singular() )
wp_enqueue_script( 'admin-comments' );
require_once('admin-header.php');
?>
@ -240,7 +241,7 @@ if ( 1 == count($posts) && is_singular() ) :
</table>
<?php
wp_comment_reply();
endif; // comments
endif; // posts;

View File

@ -53,8 +53,11 @@ wp_enqueue_script('admin-forms');
list($post_stati, $avail_post_stati) = wp_edit_posts_query();
if ( 1 == count($posts) && is_singular() )
if ( 1 == count($posts) && is_singular() ) {
wp_enqueue_script( 'admin-comments' );
wp_enqueue_script( 'quicktags' );
}
require_once('admin-header.php');
if ( !isset( $_GET['paged'] ) )
@ -267,7 +270,7 @@ if ( 1 == count($posts) && is_singular() ) :
</table>
<?php
wp_comment_reply();
endif; // comments
endif; // posts;

View File

@ -135,7 +135,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
?>
{
"betaManifestVersion" : 1,
"version" : "<?php echo $man_version; ?>_20080731",
"version" : "<?php echo $man_version; ?>_20080823",
"entries" : [
<?php echo $defaults; ?>
@ -173,6 +173,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
{ "url" : "images/required.gif" },
{ "url" : "images/no.png" },
{ "url" : "images/yes.png" },
{ "url" : "images/se.png" },
<?php if ( is_file('../wp-includes/js/tinymce/tiny_mce.js') ) { ?>
{ "url" : "../wp-includes/js/tinymce/tiny_mce_popup.js?ver=311b" },

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
wp-admin/images/se.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

View File

@ -799,11 +799,11 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
$actions = array();
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
$actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
$actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | ';
$actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . "</a> | ";
$actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . "</a> | ";
$actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a> | ';
$actions['flag'] = "<a href='#' class='no-crazy'>Flag for Follow-up</a> | ";
$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a> | ';
if ( 'spam' != $the_comment_status )
$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a> | ';
$actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete'>" . __('Delete') . '</a>';
if ( $comment_status ) { // not looking at all comments
@ -816,13 +816,13 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
}
}
if ( 'spam' == $the_comment_status )
unset($actions['spam']);
if ( 'spam' != $the_comment_status )
$actions['reply'] = ' | <a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\',this);return false;" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
$actions = apply_filters( 'comment_row_actions', $actions, $comment );
foreach ( $actions as $action => $link )
echo "<span class='$action'>$link</span>";
echo "<span class='$action'>$link</span>\n";
}
?>
</td>
@ -841,7 +841,7 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
<td class="date-column"><?php comment_date(__('Y/m/d \a\t g:ia')); ?></td>
<?php if ( 'single' !== $mode ) : ?>
<td class="response-column">
"<?php echo $post_link ?>" <?php echo sprintf('(%s comments)', $post->comment_count); ?><br/>
"<?php echo $post_link ?>" <?php echo sprintf('(%s comments)', $post->comment_count); ?><br />
<?php echo get_the_time(__('Y/m/d \a\t g:ia')); ?>
</td>
<?php endif; ?>
@ -849,6 +849,46 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
<?php
}
function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single') {
global $current_user;
// allow plugin to replace the popup content
$content = apply_filters( 'wp_comment_reply', '' );
if ( ! empty($content) ) {
echo $content;
return;
}
?>
<div id="replyerror" style="display:none;">
<img src="images/logo.gif" />
<h3 class="info-box-title"><?php _e('Comment Reply Error'); ?></h3>
<p id="replyerrtext"></p>
<p class="submit"><button id="close-button" onclick="commentReply.close();" class="button"><?php _e('Close'); ?></button></p>
</div>
<div id="replydiv" style="display:none;">
<p id="replyhandle"><?php _e('Reply'); ?></p>
<form action="" method="post" id="replyform">
<input type="hidden" name="user_ID" id="user_ID" value="<?php echo $current_user->ID; ?>" />
<input type="hidden" name="action" value="replyto-comment" />
<input type="hidden" name="comment_ID" id="comment_ID" value="" />
<input type="hidden" name="comment_post_ID" id="comment_post_ID" value="" />
<input type="hidden" name="position" id="position" value="<?php echo $position; ?>" />
<input type="hidden" name="checkbox" id="checkbox" value="<?php echo $checkbox ? 1 : 0; ?>" />
<input type="hidden" name="mode" id="mode" value="<?php echo $mode; ?>" />
<?php wp_nonce_field( 'replyto-comment', '_ajax_nonce', false ); ?>
<?php wp_comment_form_unfiltered_html_nonce(); ?>
<div id="replycontainer"><textarea rows="5" cols="50" name="replycontent" tabindex="10" id="replycontent"></textarea></div>
<p id="replysubmit"><input type="button" onclick="commentReply.close();" class="button" value="<?php _e('Cancel'); ?>" />
<input type="button" onclick="commentReply.send();" class="button" value="<?php _e('Submit Reply'); ?>" /></p>
</form>
</div>
<?php
}
function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
if (!$categories )
$categories = get_categories( array('hide_empty' => 0) );

View File

@ -78,4 +78,151 @@ var delAfter = function( r, settings ) {
theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
theList = $('#the-comment-list').wpList( { alt: '', dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } );
} );
});
(function($){
commentReply = {
open : function(c, p) {
var d = $('#comment-'+c).offset(), H = $('#replydiv').height(), top = 200, left = 100, h = 120;
if ( d && H ) {
top = (d.top - H) < 10 ? 10 : d.top - H - 5;
left = d.left;
}
$('#replydiv').show();
$('#replydiv #comment_post_ID').val(p);
$('#replydiv #comment_ID').val(c);
$('#replydiv').draggable({
handle : '#replyhandle',
containment : '#wpwrap'
});
$('#replydiv').resizable({
handles : 'se',
minHeight : 200,
minWidth : 400,
containment : '#wpwrap',
resize : function(e,o) {
h = o.size.height - 80 - $('#ed_reply_qtags').height();
$('#replycontainer').height(h);
},
stop : function(e,o) {
if ( $.browser.msie )
$('#replycontent').height(h);
}
});
$('.ui-resizable-se').css({
border: '0 none',
width: '11px',
height: '12px',
background: 'transparent url(images/se.png) no-repeat scroll 0 0'
});
$('#replydiv').css({
'position' : 'absolute',
'top' : top,
'left' : left
});
$('#replycontent').focus().keyup(function(e){
if (e.which == 27) commentReply.close(); // close on Escape
});
// emulate the Safari/Opera scrollIntoView
var to = $('#replydiv').offset();
var scr = document.documentElement.scrollTop ? document.documentElement.scrollTop : 0;
if ( scr - 20 > to.top )
window.scroll(0, to.top - 100);
},
close : function() {
$('#replycontent').val('');
$('#replyerror').hide();
$('#replydiv').draggable('destroy').resizable('destroy').css('position','relative');
$('#replydiv').hide();
return false;
},
send : function() {
var post = {};
$('#replyform input').each(function() {
post[ $(this).attr('name') ] = $(this).val();
});
post.comment = $('#replycontent').val();
post.id = post.comment_post_ID;
$.ajax({
type : 'POST',
url : wpListL10n.url,
data : post,
success : function(x) { commentReply.show(x); },
error : function(r) { commentReply.error(r); }
});
},
show : function(xml) {
if ( typeof(xml) == 'string' ) {
this.error({'responseText': xml});
return;
}
var r = wpAjax.parseAjaxResponse(xml);
if ( r.errors )
this.error({'responseText': wpAjax.broken});
r = r.responses[0];
this.close();
// var scr1 = $('#the-comment-list').offset(), scr2 = $('#the-comment-list').height();
if ( r.position == -1 ) {
// window.scroll(0, scr1.top - 100); // Scroll to the new comment? Seems annoing..
$('#the-comment-list').prepend(r.data);
} else {
// window.scroll(0, scr1.top + scr2 + 200);
$('#the-comment-list').append(r.data);
}
$('#comment-'+r.id)
.animate( { backgroundColor:"#CFEBF7" }, 600 )
.animate( { backgroundColor:"transparent" }, 600 );
},
error : function(r) {
var er = r.statusText;
if ( r.responseText )
er = r.responseText.replace( /<.[^<>]*?>/g, '' );
if ( er ) {
var o = $('#replydiv').offset();
$('#replydiv').hide();
$('#replyerror').css({
'top' : o.top + 60 + 'px',
'left' : o.left + 'px'
}).show().draggable();
$('#replyerrtext').html(er)
$('#close-button').css('outline','none').focus().keyup(function(e) {
if (e.which == 27) commentReply.close(); // close on Escape
});
}
}
}
$(document).ready(function(){
if ( typeof QTags != 'undefined' )
ed_reply = new QTags('ed_reply', 'replycontent', 'replycontainer', 'more');
});
})(jQuery);

View File

@ -1,180 +1,182 @@
wpEditorInit = function() {
// Activate tinyMCE if it's the user's default editor
if ( ( 'undefined' == typeof wpTinyMCEConfig ) || 'tinymce' == wpTinyMCEConfig.defaultEditor ) {
document.getElementById('editorcontainer').style.padding = '0px';
tinyMCE.execCommand("mceAddControl", false, "content");
var H;
// Activate tinyMCE if it's the user's default editor
if ( ( 'undefined' == typeof wpTinyMCEConfig ) || 'tinymce' == wpTinyMCEConfig.defaultEditor ) {
try { document.getElementById('editorcontainer').style.padding = '0px'; } catch(e){};
try { document.getElementById("quicktags").style.display = "none"; } catch(e){};
tinyMCE.execCommand("mceAddControl", false, "content");
} else {
var H;
if ( H = tinymce.util.Cookie.getHash("TinyMCE_content_size") )
document.getElementById('content').style.height = H.ch - 30 + 'px';
}
if ( H = tinymce.util.Cookie.getHash("TinyMCE_content_size") )
try { document.getElementById('content').style.height = H.ch - 30 + 'px'; } catch(e){};
}
};
switchEditors = {
saveCallback : function(el, content, body) {
saveCallback : function(el, content, body) {
document.getElementById(el).style.color = '#fff';
if ( tinyMCE.activeEditor.isHidden() )
content = document.getElementById(el).value;
else
content = this.pre_wpautop(content);
document.getElementById(el).style.color = '#fff';
if ( tinyMCE.activeEditor.isHidden() )
content = document.getElementById(el).value;
else
content = this.pre_wpautop(content);
return content;
},
return content;
},
pre_wpautop : function(content) {
// We have a TON of cleanup to do. Line breaks are already stripped.
pre_wpautop : function(content) {
// We have a TON of cleanup to do. Line breaks are already stripped.
// Protect pre|script tags
content = content.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
a = a.replace(/<br ?\/?>[\r\n]*/g, '<wp_temp>');
return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '<wp_temp>');
});
// Protect pre|script tags
content = content.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
a = a.replace(/<br ?\/?>[\r\n]*/g, '<wp_temp>');
return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '<wp_temp>');
});
// Pretty it up for the source editor
var blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6]|p';
content = content.replace(new RegExp('\\s*</('+blocklist1+')>\\s*', 'mg'), '</$1>\n');
content = content.replace(new RegExp('\\s*<(('+blocklist1+')[^>]*)>', 'mg'), '\n<$1>');
// Pretty it up for the source editor
var blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6]|p';
content = content.replace(new RegExp('\\s*</('+blocklist1+')>\\s*', 'mg'), '</$1>\n');
content = content.replace(new RegExp('\\s*<(('+blocklist1+')[^>]*)>', 'mg'), '\n<$1>');
// Mark </p> if it has any attributes.
content = content.replace(new RegExp('(<p [^>]+>.*?)</p>', 'mg'), '$1</p#>');
// Mark </p> if it has any attributes.
content = content.replace(new RegExp('(<p [^>]+>.*?)</p>', 'mg'), '$1</p#>');
// Sepatate <div> containing <p>
content = content.replace(new RegExp('<div([^>]*)>\\s*<p>', 'mgi'), '<div$1>\n\n');
// Sepatate <div> containing <p>
content = content.replace(new RegExp('<div([^>]*)>\\s*<p>', 'mgi'), '<div$1>\n\n');
// Remove <p> and <br />
content = content.replace(new RegExp('\\s*<p>', 'mgi'), '');
content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n');
content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n');
content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');
// Remove <p> and <br />
content = content.replace(new RegExp('\\s*<p>', 'mgi'), '');
content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n');
content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n');
content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');
// Fix some block element newline issues
content = content.replace(new RegExp('\\s*<div', 'mg'), '\n<div');
content = content.replace(new RegExp('</div>\\s*', 'mg'), '</div>\n');
// Fix some block element newline issues
content = content.replace(new RegExp('\\s*<div', 'mg'), '\n<div');
content = content.replace(new RegExp('</div>\\s*', 'mg'), '</div>\n');
content = content.replace(new RegExp('\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*', 'gi'), '\n\n[caption$1[/caption]\n\n');
content = content.replace(new RegExp('caption\\]\\n\\n+\\[caption', 'g'), 'caption]\n\n[caption');
var blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre';
content = content.replace(new RegExp('\\s*<(('+blocklist2+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
content = content.replace(new RegExp('\\s*</('+blocklist2+')>\\s*', 'mg'), '</$1>\n');
content = content.replace(new RegExp('<li([^>]*)>', 'g'), '\t<li$1>');
var blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre';
content = content.replace(new RegExp('\\s*<(('+blocklist2+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
content = content.replace(new RegExp('\\s*</('+blocklist2+')>\\s*', 'mg'), '</$1>\n');
content = content.replace(new RegExp('<li([^>]*)>', 'g'), '\t<li$1>');
if ( content.indexOf('<object') != -1 ) {
content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'mg'), "<param$1>");
content = content.replace(new RegExp('\\s*</embed>\\s*', 'mg'), '</embed>');
}
if ( content.indexOf('<object') != -1 ) {
content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'mg'), "<param$1>");
content = content.replace(new RegExp('\\s*</embed>\\s*', 'mg'), '</embed>');
}
// Unmark special paragraph closing tags
content = content.replace(new RegExp('</p#>', 'g'), '</p>\n');
content = content.replace(new RegExp('\\s*(<p [^>]+>.*</p>)', 'mg'), '\n$1');
// Unmark special paragraph closing tags
content = content.replace(new RegExp('</p#>', 'g'), '</p>\n');
content = content.replace(new RegExp('\\s*(<p [^>]+>.*</p>)', 'mg'), '\n$1');
// Trim whitespace
content = content.replace(new RegExp('^\\s*', ''), '');
content = content.replace(new RegExp('[\\s\\u00a0]*$', ''), '');
// Trim whitespace
content = content.replace(new RegExp('^\\s*', ''), '');
content = content.replace(new RegExp('[\\s\\u00a0]*$', ''), '');
// put back the line breaks in pre|script
content = content.replace(/<wp_temp>/g, '\n');
// put back the line breaks in pre|script
content = content.replace(/<wp_temp>/g, '\n');
// Hope.
return content;
},
// Hope.
return content;
},
go : function(id) {
var ed = tinyMCE.get(id);
var qt = document.getElementById('quicktags');
var H = document.getElementById('edButtonHTML');
var P = document.getElementById('edButtonPreview');
var ta = document.getElementById(id);
var ec = document.getElementById('editorcontainer');
go : function(id) {
var ed = tinyMCE.get(id);
var qt = document.getElementById('quicktags');
var H = document.getElementById('edButtonHTML');
var P = document.getElementById('edButtonPreview');
var ta = document.getElementById(id);
var ec = document.getElementById('editorcontainer');
if ( ! ed || ed.isHidden() ) {
ta.style.color = '#fff';
if ( ! ed || ed.isHidden() ) {
ta.style.color = '#fff';
this.edToggle(P, H);
edCloseAllTags(); // :-(
this.edToggle(P, H);
edCloseAllTags(); // :-(
qt.style.display = 'none';
ec.style.padding = '0px';
ta.style.padding = '0px';
qt.style.display = 'none';
ec.style.padding = '0px';
ta.style.padding = '0px';
ta.value = this.wpautop(ta.value);
ta.value = this.wpautop(ta.value);
if ( ed ) ed.show();
else tinyMCE.execCommand("mceAddControl", false, id);
if ( ed ) ed.show();
else tinyMCE.execCommand("mceAddControl", false, id);
this.wpSetDefaultEditor('tinymce');
} else {
this.edToggle(H, P);
ta.style.height = ed.getContentAreaContainer().offsetHeight + 6 + 'px';
this.wpSetDefaultEditor('tinymce');
} else {
this.edToggle(H, P);
ta.style.height = ed.getContentAreaContainer().offsetHeight + 6 + 'px';
ed.hide();
qt.style.display = 'block';
ed.hide();
qt.style.display = 'block';
if ( tinymce.isIE6 ) {
if ( tinymce.isIE6 ) {
ta.style.width = '98%';
ec.style.padding = '0px';
ta.style.padding = '6px';
} else {
ta.style.width = '100%';
ec.style.padding = '6px';
}
}
ta.style.color = '';
this.wpSetDefaultEditor('html');
}
},
ta.style.color = '';
this.wpSetDefaultEditor('html');
}
},
edToggle : function(A, B) {
A.className = 'active';
B.className = '';
edToggle : function(A, B) {
A.className = 'active';
B.className = '';
B.onclick = A.onclick;
A.onclick = null;
},
B.onclick = A.onclick;
A.onclick = null;
},
wpSetDefaultEditor : function(editor) {
try {
editor = escape( editor.toString() );
} catch(err) {
editor = 'tinymce';
}
wpSetDefaultEditor : function(editor) {
try {
editor = escape( editor.toString() );
} catch(err) {
editor = 'tinymce';
}
var userID = document.getElementById('user-id');
var date = new Date();
date.setTime(date.getTime()+(10*365*24*60*60*1000));
document.cookie = "wordpress_editor_" + userID.value + "=" + editor + "; expires=" + date.toGMTString();
},
var userID = document.getElementById('user-id');
var date = new Date();
date.setTime(date.getTime()+(10*365*24*60*60*1000));
document.cookie = "wordpress_editor_" + userID.value + "=" + editor + "; expires=" + date.toGMTString();
},
wpautop : function(pee) {
var blocklist = 'table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]';
wpautop : function(pee) {
var blocklist = 'table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]';
pee = pee + "\n\n";
pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n");
pee = pee.replace(new RegExp('(<(?:'+blocklist+')[^>]*>)', 'gi'), "\n$1");
pee = pee.replace(new RegExp('(</(?:'+blocklist+')>)', 'gi'), "$1\n\n");
pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n");
pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n");
pee = pee.replace(new RegExp('([\\s\\S]+?)\\n\\n', 'mg'), "<p>$1</p>\n");
pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), '');
pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1");
pee = pee.replace(new RegExp('<p>\\s*<blockquote([^>]*)>', 'gi'), "<blockquote$1><p>");
pee = pee.replace(new RegExp('</blockquote>\\s*</p>', 'gi'), '</p></blockquote>');
pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)', 'gi'), "$1");
pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n");
pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1");
pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1');
pee = pee.replace(new RegExp('(?:<p>|<br ?/?>)*\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*(?:</p>|<br ?/?>)*', 'gi'), '[caption$1[/caption]');
// pee = pee.replace(new RegExp('^((?:&nbsp;)*)\\s', 'mg'), '$1&nbsp;');
pee = pee + "\n\n";
pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n");
pee = pee.replace(new RegExp('(<(?:'+blocklist+')[^>]*>)', 'gi'), "\n$1");
pee = pee.replace(new RegExp('(</(?:'+blocklist+')>)', 'gi'), "$1\n\n");
pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n");
pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n");
pee = pee.replace(new RegExp('([\\s\\S]+?)\\n\\n', 'mg'), "<p>$1</p>\n");
pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), '');
pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1");
pee = pee.replace(new RegExp('<p>\\s*<blockquote([^>]*)>', 'gi'), "<blockquote$1><p>");
pee = pee.replace(new RegExp('</blockquote>\\s*</p>', 'gi'), '</p></blockquote>');
pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)', 'gi'), "$1");
pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n");
pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1");
pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1');
pee = pee.replace(new RegExp('(?:<p>|<br ?/?>)*\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*(?:</p>|<br ?/?>)*', 'gi'), '[caption$1[/caption]');
// pee = pee.replace(new RegExp('^((?:&nbsp;)*)\\s', 'mg'), '$1&nbsp;');
// Fix the pre|script tags
pee = pee.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
// Fix the pre|script tags
pee = pee.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
a = a.replace(/<br ?\/?>[\r\n]*/g, '\n');
return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '\n');
});
});
return pee;
}
return pee;
}
}

View File

@ -130,6 +130,7 @@ case 'edit':
add_thickbox();
wp_enqueue_script('media-upload');
wp_enqueue_script('word-count');
wp_enqueue_script( 'admin-comments' );
if ( current_user_can('edit_post', $post_ID) ) {
if ( $last = wp_check_post_lock( $post->ID ) ) {

View File

@ -9,7 +9,8 @@
/** WordPress Administration Bootstrap */
require_once('admin.php');
add_thickbox();
wp_enqueue_script('media-upload');
wp_enqueue_script( 'media-upload' );
wp_enqueue_script( 'quicktags' );
if (!current_user_can('upload_files'))
wp_die(__('You do not have permission to upload files.'));
@ -263,4 +264,7 @@ endif; // posts;
</div>
<?php include('admin-footer.php'); ?>
<?php
wp_comment_reply();
include('admin-footer.php');
?>

View File

@ -320,30 +320,36 @@ textarea.all-options, input.all-options {
padding: 2px 4px;
}
#ed_toolbar input {
#ed_toolbar input,
#ed_reply_toolbar input {
margin: 3px 2px 2px;
padding: 2px 4px;
line-height: 18px;
display: inline-block;
}
#quicktags #ed_strong {
#quicktags #ed_strong,
#ed_reply_toolbar #ed_reply_strong {
font-weight: bold;
}
#quicktags #ed_link {
#quicktags #ed_link,
#ed_reply_toolbar #ed_reply_link {
text-decoration: underline;
}
#quicktags #ed_del {
#quicktags #ed_del,
#ed_reply_toolbar #ed_reply_del {
text-decoration: line-through;
}
#quicktags #ed_em {
#quicktags #ed_em,
#ed_reply_toolbar #ed_reply_em {
font-style: italic;
}
#quicktags #ed_code {
#quicktags #ed_code,
#ed_reply_toolbar #ed_reply_code {
font-family: "Courier New", Courier, mono;
font-size: 1.1em;
vertical-align: top;
@ -502,14 +508,14 @@ p.pagenav {
font-weight: bold;
}
.comment-column {
width: 50%;
}
.comment-column p {
margin-top: 0;
}
.comment-column {
width: 50%;
}
.author-column {
width: 20%;
}
@ -1760,7 +1766,8 @@ fieldset {
.info-box-title {
line-height: 2;
margin: 0;
padding: 0 7px;
padding: 4px 8px;
font: 18px Georgia, "Times New Roman", Times, serif;
}
#wp_editbtns {
@ -1809,90 +1816,11 @@ a.togbox {
cursor: pointer;
}
/* fixed bottom bar */
.postarea h3 label {
}
#footer {
z-index: -1;
}
#fixedbar {
bottom:0pt;
height:80px;
position:fixed;
width:100%;
z-index: 100;
}
#fixedbar #submitpost {
}
#fixedbar .submit {
padding-top: 10px;
}
#fixedbar .button {
border: none;
-moz-border-radius: 6px;
-khtml-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
}
#fixedbar .button:hover {
background: #fff;
}
#fixedbar #publish {
font-weight:bold;
width:160px;
}
#fixedbar #save-post {
width:80px;
font-weight:normal;
}
#fixedbar .submitbox {
padding: 14px 18px;
border-left: 1px solid #aaa;
width: 690px;
}
#fixedbar #post-time-info,
#fixedbar #comment-time-info {
margin-top: 16px;
}
#fixedbar #timestampdiv input,
#fixedbar #timestampdiv select {
background-color:#464646;
border:1px solid #777777;
color:#CCCCCC;
padding:2px;
}
#fixedbar-wrap {
width: 100%;
}
#preview-link {
text-align: right;
}
#preview-link a {
padding-right:10px;
}
p#post-search-prep {
margin:0pt;
position:absolute;
right:20px;
top:50px;
margin: 0;
position: absolute;
right: 20px;
top: 50px;
}
#jj, #hh, #mn {
@ -1915,7 +1843,6 @@ p#post-search-prep {
}
/* media popup 0819 */
#sidemenu {
margin: -30px 15px 0 315px;
list-style: none;
@ -2000,3 +1927,84 @@ p#post-search-prep {
text-decoration:none;
width:200px;
}
/* reply to comments */
#replydiv {
width: 700px;
border-color: #EBEBEB #CCCCCC #CCCCCC #EBEBEB;
border-width: 1px;
border-style: solid;
padding: 2px;
background-color: #fff;
left: 20px;
top: 300px;
}
#replydiv #editorcontainer {
border: 0 none;
}
#replysubmit {
margin: 0;
padding: 3px 5px;
background-color: #EAF3FA;
border-top: 1px solid #ddd;
}
#replydiv #editor-toolbar {
display: none;
}
#replydiv #replyhandle {
cursor: move;
margin: 0;
font-size: 14px;
font-weight: bold;
padding: 7px;
}
#replycontainer {
padding: 6px;
border: 0 none;
height: 100%;
overflow: hidden;
}
#replycontent {
resize: none;
margin: 0;
width: 100%;
height: 100%;
padding: 0;
line-height: 150%;
border: 0 none;
outline: none;
}
#ed_reply_toolbar {
margin: 0;
padding: 2px 4px;
}
#replyerror {
border: 5px solid #ddd;
background-color: #f8f8f8;
position: absolute;
padding: 15px 15px 10px;
width: 500px;
z-index: 1000;
display: none;
}
#replyerror img {
float: right;
margin: 15px;
}
#replyerror p.submit {
padding: 10px 0 0;
}
#replyerror .error {
margin: 15px 0 0;
}

View File

@ -66,7 +66,9 @@ if ( get_option('require_name_email') && !$user->ID ) {
if ( '' == $comment_content )
wp_die( __('Error: please type a comment.') );
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'user_ID');
$comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0;
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');
$comment_id = wp_new_comment( $commentdata );

View File

@ -391,8 +391,12 @@ function wp_allow_comment($commentdata) {
if ( $comment_author_email )
$dupe .= "OR comment_author_email = '$comment_author_email' ";
$dupe .= ") AND comment_content = '$comment_content' LIMIT 1";
if ( $wpdb->get_var($dupe) )
if ( $wpdb->get_var($dupe) ) {
if ( defined('DOING_AJAX') )
die( __('Duplicate comment detected; it looks as though you\'ve already said that!') );
wp_die( __('Duplicate comment detected; it looks as though you\'ve already said that!') );
}
do_action( 'check_comment_flood', $comment_author_IP, $comment_author_email, $comment_date_gmt );
@ -443,6 +447,10 @@ function check_comment_flood_db( $ip, $email, $date ) {
$flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment);
if ( $flood_die ) {
do_action('comment_flood_trigger', $time_lastcomment, $time_newcomment);
if ( defined('DOING_AJAX') )
die( __('You are posting comments too quickly. Slow down.') );
wp_die( __('You are posting comments too quickly. Slow down.') );
}
}
@ -753,6 +761,10 @@ function wp_new_comment( $commentdata ) {
$commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
$commentdata['user_ID'] = (int) $commentdata['user_ID'];
$commentdata['comment_parent'] = absint($commentdata['comment_parent']);
$parent_status = ( 0 < $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : '';
$commentdata['comment_parent'] = ( 'approved' == $parent_status || 'unapproved' == $parent_status ) ? $commentdata['comment_parent'] : 0;
$commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '',$_SERVER['REMOTE_ADDR'] );
$commentdata['comment_agent'] = $_SERVER['HTTP_USER_AGENT'];

View File

@ -955,7 +955,7 @@ function the_editor($content, $id = 'content', $prev_id = 'title', $media_button
$rows = "rows='$rows'"; ?>
<div id="editor-toolbar">
<?php if ( user_can_richedit() ) {
<?php if ( user_can_richedit() && $media_buttons ) {
$wp_default_editor = wp_default_editor(); ?>
<div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('<?php echo $id; ?>')" /></div>
<?php if ( 'tinymce' == $wp_default_editor ) {
@ -967,7 +967,8 @@ function the_editor($content, $id = 'content', $prev_id = 'title', $media_button
<a id="edButtonHTML" class="active"><?php _e('HTML'); ?></a>
<a id="edButtonPreview" onclick="switchEditors.go('<?php echo $id; ?>');"><?php _e('Visual'); ?></a>
<?php }
}
} else
add_filter('the_editor_content', 'wp_htmledit_pre');
/* if ( $media_buttons ) { ?>
<div id="media-buttons" class="hide-if-no-js">
@ -981,46 +982,37 @@ function the_editor($content, $id = 'content', $prev_id = 'title', $media_button
<script type="text/javascript">edToolbar()</script>
</div>
<?php if ( 'html' != $wp_default_editor ) : ?>
<script type="text/javascript">
// <![CDATA[
if ( typeof tinyMCE != "undefined" )
document.getElementById("quicktags").style.display="none";
// ]]>
</script>
<?php endif; // 'html' != $wp_default_editor
$the_editor = apply_filters('the_editor', "<div id='editorcontainer'><textarea class='' $rows cols='40' name='$id' tabindex='$tab_index' id='$id'>%s</textarea></div>\n");
<?php $the_editor = apply_filters('the_editor', "<div id='editorcontainer'><textarea $rows cols='40' name='$id' tabindex='$tab_index' id='$id'>%s</textarea></div>\n");
$the_editor_content = apply_filters('the_editor_content', $content);
printf($the_editor, $the_editor_content);
?>
<script type="text/javascript">
// <![CDATA[
edCanvas = document.getElementById('<?php echo $id; ?>');
<?php if ( $prev_id && user_can_richedit() ) : ?>
// If tinyMCE is defined.
if ( typeof tinyMCE != 'undefined' ) {
// This code is meant to allow tabbing from Title to Post (TinyMCE).
document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e) {
e = e || window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
if ( tinyMCE.activeEditor ) {
if ( (jQuery("#post_ID").val() < 1) && (jQuery("#title").val().length > 0) ) { autosave(); }
e = null;
if ( tinyMCE.activeEditor.isHidden() ) return true;
tinyMCE.activeEditor.focus();
return false;
}
return true;
}
}
}
<?php endif; ?>
// ]]>
</script>
<?php
<script type="text/javascript">
// <![CDATA[
edCanvas = document.getElementById('<?php echo $id; ?>');
<?php if ( user_can_richedit() && $prev_id ) { ?>
// If tinyMCE is defined.
if ( typeof tinyMCE != 'undefined' ) {
// This code is meant to allow tabbing from Title to Post (TinyMCE).
document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e) {
e = e || window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
if ( tinyMCE.activeEditor ) {
if ( (jQuery("#post_ID").val() < 1) && (jQuery("#title").val().length > 0) ) { autosave(); }
e = null;
if ( tinyMCE.activeEditor.isHidden() ) return true;
tinyMCE.activeEditor.focus();
return false;
}
return true;
}
}
}
<?php } ?>
// ]]>
</script>
<?php
}
function get_search_query() {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -387,3 +387,194 @@ function edInsertImage(myField) {
edInsertContent(myField, myValue);
}
}
// Allow multiple instances.
// Name = unique value, id = textarea id, container = container div.
// Can disable some buttons by passing comma delimited string as 4th param.
var QTags = function(name, id, container, disabled) {
var t = this;
t.Buttons = [];
t.Links = [];
t.OpenTags = [];
t.Canvas = document.getElementById(id);
disabled = ( typeof disabled != 'undefined' ) ? ','+disabled+',' : '';
t.edShowButton = function(button, i) {
if ( disabled && (disabled.indexOf(','+button.display+',') != -1) )
return '';
else if ( button.id == name+'_img' )
return '<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertImage('+name+'.Canvas);" value="' + button.display + '" />';
else if (button.id == name+'_link')
return '<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="'+name+'.edInsertLink('+i+');" value="'+button.display+'" />';
else
return '<input type="button" id="' + button.id + '" accesskey="'+button.access+'" class="ed_button" onclick="'+name+'.edInsertTag('+i+');" value="'+button.display+'" />';
};
t.edAddTag = function(button) {
if ( t.Buttons[button].tagEnd != '' ) {
t.OpenTags[t.OpenTags.length] = button;
document.getElementById(t.Buttons[button].id).value = '/' + document.getElementById(t.Buttons[button].id).value;
}
};
t.edRemoveTag = function(button) {
for ( var i = 0; i < t.OpenTags.length; i++ ) {
if ( t.OpenTags[i] == button ) {
t.OpenTags.splice(i, 1);
document.getElementById(t.Buttons[button].id).value = document.getElementById(t.Buttons[button].id).value.replace('/', '');
}
}
};
t.edCheckOpenTags = function(button) {
var tag = 0;
for ( var i = 0; i < t.OpenTags.length; i++ ) {
if ( t.OpenTags[i] == button )
tag++;
}
if ( tag > 0 ) return true; // tag found
else return false; // tag not found
};
this.edCloseAllTags = function() {
var count = t.OpenTags.length;
for ( var o = 0; o < count; o++ )
t.edInsertTag(t.OpenTags[t.OpenTags.length - 1]);
};
this.edQuickLink = function(i, thisSelect) {
if ( i > -1 ) {
var newWin = '';
if ( Links[i].newWin == 1 ) {
newWin = ' target="_blank"';
}
var tempStr = '<a href="' + Links[i].URL + '"' + newWin + '>'
+ Links[i].display
+ '</a>';
thisSelect.selectedIndex = 0;
edInsertContent(t.Canvas, tempStr);
} else {
thisSelect.selectedIndex = 0;
}
};
// insertion code
t.edInsertTag = function(i) {
//IE support
if ( document.selection ) {
t.Canvas.focus();
sel = document.selection.createRange();
if ( sel.text.length > 0 ) {
sel.text = t.Buttons[i].tagStart + sel.text + t.Buttons[i].tagEnd;
} else {
if ( ! t.edCheckOpenTags(i) || t.Buttons[i].tagEnd == '' ) {
sel.text = t.Buttons[i].tagStart;
t.edAddTag(i);
} else {
sel.text = t.Buttons[i].tagEnd;
t.edRemoveTag(i);
}
}
t.Canvas.focus();
} else if ( t.Canvas.selectionStart || t.Canvas.selectionStart == '0' ) { //MOZILLA/NETSCAPE support
var startPos = t.Canvas.selectionStart;
var endPos = t.Canvas.selectionEnd;
var cursorPos = endPos;
var scrollTop = t.Canvas.scrollTop;
if ( startPos != endPos ) {
t.Canvas.value = t.Canvas.value.substring(0, startPos)
+ t.Buttons[i].tagStart
+ t.Canvas.value.substring(startPos, endPos)
+ t.Buttons[i].tagEnd
+ t.Canvas.value.substring(endPos, t.Canvas.value.length);
cursorPos += t.Buttons[i].tagStart.length + t.Buttons[i].tagEnd.length;
} else {
if ( !t.edCheckOpenTags(i) || t.Buttons[i].tagEnd == '' ) {
t.Canvas.value = t.Canvas.value.substring(0, startPos)
+ t.Buttons[i].tagStart
+ t.Canvas.value.substring(endPos, t.Canvas.value.length);
t.edAddTag(i);
cursorPos = startPos + t.Buttons[i].tagStart.length;
} else {
t.Canvas.value = t.Canvas.value.substring(0, startPos)
+ t.Buttons[i].tagEnd
+ t.Canvas.value.substring(endPos, t.Canvas.value.length);
t.edRemoveTag(i);
cursorPos = startPos + t.Buttons[i].tagEnd.length;
}
}
t.Canvas.focus();
t.Canvas.selectionStart = cursorPos;
t.Canvas.selectionEnd = cursorPos;
t.Canvas.scrollTop = scrollTop;
} else {
if ( ! t.edCheckOpenTags(i) || t.Buttons[i].tagEnd == '' ) {
t.Canvas.value += Buttons[i].tagStart;
t.edAddTag(i);
} else {
t.Canvas.value += Buttons[i].tagEnd;
t.edRemoveTag(i);
}
t.Canvas.focus();
}
};
this.edInsertLink = function(i, defaultValue) {
if ( ! defaultValue )
defaultValue = 'http://';
if ( ! t.edCheckOpenTags(i) ) {
var URL = prompt(quicktagsL10n.enterURL, defaultValue);
if ( URL ) {
t.Buttons[i].tagStart = '<a href="' + URL + '">';
t.edInsertTag(i);
}
} else {
t.edInsertTag(i);
}
};
this.edInsertImage = function() {
var myValue = prompt(quicktagsL10n.enterImageURL, 'http://');
if ( myValue ) {
myValue = '<img src="'
+ myValue
+ '" alt="' + prompt(quicktagsL10n.enterImageDescription, '')
+ '" />';
edInsertContent(t.Canvas, myValue);
}
};
t.Buttons[t.Buttons.length] = new edButton(name+'_strong','b','<strong>','</strong>','b');
t.Buttons[t.Buttons.length] = new edButton(name+'_em','i','<em>','</em>','i');
t.Buttons[t.Buttons.length] = new edButton(name+'_link','link','','</a>','a'); // special case
t.Buttons[t.Buttons.length] = new edButton(name+'_block','b-quote','\n\n<blockquote>','</blockquote>\n\n','q');
t.Buttons[t.Buttons.length] = new edButton(name+'_del','del','<del datetime="' + datetime + '">','</del>','d');
t.Buttons[t.Buttons.length] = new edButton(name+'_ins','ins','<ins datetime="' + datetime + '">','</ins>','s');
t.Buttons[t.Buttons.length] = new edButton(name+'_img','img','','','m',-1); // special case
t.Buttons[t.Buttons.length] = new edButton(name+'_ul','ul','<ul>\n','</ul>\n\n','u');
t.Buttons[t.Buttons.length] = new edButton(name+'_ol','ol','<ol>\n','</ol>\n\n','o');
t.Buttons[t.Buttons.length] = new edButton(name+'_li','li','\t<li>','</li>\n','l');
t.Buttons[t.Buttons.length] = new edButton(name+'_code','code','<code>','</code>','c');
t.Buttons[t.Buttons.length] = new edButton(name+'_more','more','<!--more-->','','t',-1);
// t.Buttons[t.Buttons.length] = new edButton(name+'_next','page','<!--nextpage-->','','p',-1);
var tb = document.createElement('div');
tb.id = name+'_qtags';
var html = '<div id="'+name+'_toolbar">';
for (var i = 0; i < t.Buttons.length; i++)
html += t.edShowButton(t.Buttons[i], i);
html += '<input type="button" id="'+name+'_ed_spell" class="ed_button" onclick="edSpell('+name+'.Canvas);" title="' + quicktagsL10n.dictionaryLookup + '" value="' + quicktagsL10n.lookup + '" />';
html += '<input type="button" id="'+name+'_ed_close" class="ed_button" onclick="'+name+'.edCloseAllTags();" title="' + quicktagsL10n.closeAllOpenTags + '" value="' + quicktagsL10n.closeTags + '" /></div>';
tb.innerHTML = html;
var cont = document.getElementById(container);
cont.parentNode.insertBefore(tb, cont);
};

View File

@ -15,7 +15,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'common', '/wp-admin/js/common.js', array('jquery'), '20080318' );
$scripts->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' );
$scripts->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '3958' );
$scripts->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '20080823' );
$scripts->localize( 'quicktags', 'quicktagsL10n', array(
'quickLinks' => __('(Quick Links)'),
'wordLookup' => __('Enter a word to look up:'),
@ -34,7 +34,7 @@ function wp_default_scripts( &$scripts ) {
$visual_editor = apply_filters('visual_editor', array('tiny_mce'));
$scripts->add( 'editor', false, $visual_editor, '20080321' );
$scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080710' );
$scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080823' );
// Modify this version when tinyMCE plugins are changed.
$mce_version = apply_filters('tiny_mce_version', '20080730');
@ -103,6 +103,9 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.5.2' );
$scripts->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery-ui-core'), '1.5.2' );
$scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core'), '1.5.2' );
$scripts->add( 'jquery-ui-draggable', '/wp-includes/js/jquery/ui.draggable.js', array('jquery-ui-core'), '1.5.2' );
$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' );
if ( is_admin() ) {
$scripts->add( 'ajaxcat', '/wp-admin/js/cat.js', array( 'wp-lists' ), '20071101' );
@ -120,7 +123,7 @@ function wp_default_scripts( &$scripts ) {
'good' => __('Good'),
'strong' => __('Strong')
) );
$scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20080311' );
$scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-draggable', 'jquery-ui-resizable'), '20080821' );
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
'pending' => __('%i% pending') // must look like: "# blah blah"
) );

View File

@ -1089,6 +1089,8 @@ class wp_xmlrpc_server extends IXR_Server {
}
}
$comment['comment_parent'] = isset($content_struct['comment_parent']) ? absint($content_struct['comment_parent']) : 0;
$comment['comment_content'] = $content_struct['content'];
do_action('xmlrpc_call', 'wp.newComment');