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:
parent
f2af4b9b6d
commit
95fa29a208
|
@ -422,6 +422,69 @@ case 'add-comment' :
|
||||||
'data' => $comment_list_item
|
'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();
|
$x->send();
|
||||||
break;
|
break;
|
||||||
case 'add-meta' :
|
case 'add-meta' :
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<br class="clear" /></div><!-- wpbody-content -->
|
<br class="clear" /></div><!-- wpbody-content -->
|
||||||
</div><!-- wpbody -->
|
</div><!-- wpbody -->
|
||||||
</div><!-- wpcontent -->
|
</div><!-- wpcontent -->
|
||||||
</div><!-- wpwrap -->
|
<br class="clear" /></div><!-- wpwrap -->
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
<p><?php
|
<p><?php
|
||||||
do_action('in_admin_footer', '');
|
do_action('in_admin_footer', '');
|
||||||
|
|
|
@ -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,
|
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 {
|
.login form, h3.info-box-title, #post-status-info {
|
||||||
background-color: #cfebf7;
|
background-color: #cfebf7;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ strong .post-com-count span {
|
||||||
|
|
||||||
#post-body ul#category-tabs li.ui-tabs-selected, .button-secondary,
|
#post-body ul#category-tabs li.ui-tabs-selected, .button-secondary,
|
||||||
#quicktags, #login form .submit input, #post-search .button,
|
#quicktags, #login form .submit input, #post-search .button,
|
||||||
#post-search-prep .button {
|
#post-search-prep .button, #ed_reply_toolbar {
|
||||||
background-color: #8ebddc !important;
|
background-color: #8ebddc !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ input.readonly {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ed_toolbar input {
|
#ed_toolbar input, #ed_reply_toolbar input {
|
||||||
background: url( ../images/fade-butt.png ) #fff repeat-x 0 -2px;
|
background: url( ../images/fade-butt.png ) #fff repeat-x 0 -2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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,
|
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 {
|
.login form, h3.info-box-title, #post-status-info {
|
||||||
background-color: #eaf3fa;
|
background-color: #eaf3fa;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ strong .post-com-count span {
|
||||||
|
|
||||||
#post-body ul#category-tabs li.ui-tabs-selected, .button-secondary,
|
#post-body ul#category-tabs li.ui-tabs-selected, .button-secondary,
|
||||||
#quicktags, #login form .submit input, #post-search .button,
|
#quicktags, #login form .submit input, #post-search .button,
|
||||||
#post-search-prep .button {
|
#post-search-prep .button, #ed_reply_toolbar {
|
||||||
background-color: #cee1ef !important;
|
background-color: #cee1ef !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ input.readonly {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ed_toolbar input {
|
#ed_toolbar input, #ed_reply_toolbar input {
|
||||||
background: url( ../images/fade-butt.png ) #fff repeat-x 0 -2px;
|
background: url( ../images/fade-butt.png ) #fff repeat-x 0 -2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,8 @@ require_once('admin.php');
|
||||||
|
|
||||||
$title = __('Edit Comments');
|
$title = __('Edit Comments');
|
||||||
wp_enqueue_script( 'admin-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']) ) {
|
if ( !empty( $_REQUEST['delete_comments'] ) && isset($_REQUEST['action']) ) {
|
||||||
check_admin_referer('bulk-comments');
|
check_admin_referer('bulk-comments');
|
||||||
|
@ -53,20 +54,11 @@ if ( !empty( $_REQUEST['delete_comments'] ) && isset($_REQUEST['action']) ) {
|
||||||
|
|
||||||
require_once('admin-header.php');
|
require_once('admin-header.php');
|
||||||
|
|
||||||
if ( empty($_GET['mode']) )
|
$mode = ( ! isset($_GET['mode']) || empty($_GET['mode']) ) ? 'detail' : attribute_escape($_GET['mode']);
|
||||||
$mode = 'detail';
|
|
||||||
else
|
|
||||||
$mode = attribute_escape($_GET['mode']);
|
|
||||||
|
|
||||||
if ( isset($_GET['comment_status']) )
|
$comment_status = isset($_GET['comment_status']) ? attribute_escape($_GET['comment_status']) : '';
|
||||||
$comment_status = attribute_escape($_GET['comment_status']);
|
|
||||||
else
|
|
||||||
$comment_status = '';
|
|
||||||
|
|
||||||
if ( isset($_GET['s']) )
|
$search_dirty = ( isset($_GET['s']) ) ? $_GET['s'] : '';
|
||||||
$search_dirty = $_GET['s'];
|
|
||||||
else
|
|
||||||
$search_dirty = '';
|
|
||||||
$search = attribute_escape( $search_dirty );
|
$search = attribute_escape( $search_dirty );
|
||||||
?>
|
?>
|
||||||
<?php
|
<?php
|
||||||
|
@ -215,7 +207,7 @@ if ($comments) {
|
||||||
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
||||||
<th scope="col" class="comment-column"><?php _e('Comment') ?></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="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>
|
<th scope="col" class="response-column"><?php _e('In Response To This Post') ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -269,4 +261,6 @@ if ( $page_links )
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php include('admin-footer.php'); ?>
|
<?php
|
||||||
|
wp_comment_reply('-1', true, 'detail');
|
||||||
|
include('admin-footer.php'); ?>
|
|
@ -325,11 +325,7 @@ function post_comment_status_meta_box($post) {
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
add_meta_box('commentstatusdiv', __('Comments on this Post'), 'post_comment_status_meta_box', 'post', 'normal', 'core');
|
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>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<?php wp_comment_reply(); ?>
|
||||||
|
|
||||||
<?php if ((isset($post->post_title) && '' == $post->post_title) || (isset($_GET['message']) && 2 > $_GET['message'])) : ?>
|
<?php if ((isset($post->post_title) && '' == $post->post_title) || (isset($_GET['message']) && 2 > $_GET['message'])) : ?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
try{document.post.title.focus();}catch(e){}
|
try{document.post.title.focus();}catch(e){}
|
||||||
|
|
|
@ -68,6 +68,7 @@ wp($query_str);
|
||||||
|
|
||||||
if ( is_singular() )
|
if ( is_singular() )
|
||||||
wp_enqueue_script( 'admin-comments' );
|
wp_enqueue_script( 'admin-comments' );
|
||||||
|
|
||||||
require_once('admin-header.php');
|
require_once('admin-header.php');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -240,7 +241,7 @@ if ( 1 == count($posts) && is_singular() ) :
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
wp_comment_reply();
|
||||||
endif; // comments
|
endif; // comments
|
||||||
endif; // posts;
|
endif; // posts;
|
||||||
|
|
||||||
|
@ -248,4 +249,4 @@ endif; // posts;
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php include('admin-footer.php'); ?>
|
<?php include('admin-footer.php'); ?>
|
|
@ -53,8 +53,11 @@ wp_enqueue_script('admin-forms');
|
||||||
|
|
||||||
list($post_stati, $avail_post_stati) = wp_edit_posts_query();
|
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( 'admin-comments' );
|
||||||
|
wp_enqueue_script( 'quicktags' );
|
||||||
|
}
|
||||||
|
|
||||||
require_once('admin-header.php');
|
require_once('admin-header.php');
|
||||||
|
|
||||||
if ( !isset( $_GET['paged'] ) )
|
if ( !isset( $_GET['paged'] ) )
|
||||||
|
@ -267,7 +270,7 @@ if ( 1 == count($posts) && is_singular() ) :
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
wp_comment_reply();
|
||||||
endif; // comments
|
endif; // comments
|
||||||
endif; // posts;
|
endif; // posts;
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
|
||||||
?>
|
?>
|
||||||
{
|
{
|
||||||
"betaManifestVersion" : 1,
|
"betaManifestVersion" : 1,
|
||||||
"version" : "<?php echo $man_version; ?>_20080731",
|
"version" : "<?php echo $man_version; ?>_20080823",
|
||||||
"entries" : [
|
"entries" : [
|
||||||
<?php echo $defaults; ?>
|
<?php echo $defaults; ?>
|
||||||
|
|
||||||
|
@ -173,6 +173,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
|
||||||
{ "url" : "images/required.gif" },
|
{ "url" : "images/required.gif" },
|
||||||
{ "url" : "images/no.png" },
|
{ "url" : "images/no.png" },
|
||||||
{ "url" : "images/yes.png" },
|
{ "url" : "images/yes.png" },
|
||||||
|
{ "url" : "images/se.png" },
|
||||||
|
|
||||||
<?php if ( is_file('../wp-includes/js/tinymce/tiny_mce.js') ) { ?>
|
<?php if ( is_file('../wp-includes/js/tinymce/tiny_mce.js') ) { ?>
|
||||||
{ "url" : "../wp-includes/js/tinymce/tiny_mce_popup.js?ver=311b" },
|
{ "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 |
Binary file not shown.
After Width: | Height: | Size: 127 B |
|
@ -799,11 +799,11 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
|
||||||
$actions = array();
|
$actions = array();
|
||||||
|
|
||||||
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
|
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['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['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&c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a> | ';
|
$actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a> | ';
|
||||||
$actions['flag'] = "<a href='#' class='no-crazy'>Flag for Follow-up</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['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>';
|
$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
|
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 )
|
if ( 'spam' != $the_comment_status )
|
||||||
unset($actions['spam']);
|
$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 );
|
$actions = apply_filters( 'comment_row_actions', $actions, $comment );
|
||||||
|
|
||||||
foreach ( $actions as $action => $link )
|
foreach ( $actions as $action => $link )
|
||||||
echo "<span class='$action'>$link</span>";
|
echo "<span class='$action'>$link</span>\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</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>
|
<td class="date-column"><?php comment_date(__('Y/m/d \a\t g:ia')); ?></td>
|
||||||
<?php if ( 'single' !== $mode ) : ?>
|
<?php if ( 'single' !== $mode ) : ?>
|
||||||
<td class="response-column">
|
<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')); ?>
|
<?php echo get_the_time(__('Y/m/d \a\t g:ia')); ?>
|
||||||
</td>
|
</td>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -849,6 +849,46 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
|
||||||
<?php
|
<?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 ) {
|
function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
|
||||||
if (!$categories )
|
if (!$categories )
|
||||||
$categories = get_categories( array('hide_empty' => 0) );
|
$categories = get_categories( array('hide_empty' => 0) );
|
||||||
|
|
|
@ -78,4 +78,151 @@ var delAfter = function( r, settings ) {
|
||||||
theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
|
theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
|
||||||
theList = $('#the-comment-list').wpList( { alt: '', dimAfter: dimAfter, delAfter: delAfter, 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);
|
||||||
|
|
|
@ -1,180 +1,182 @@
|
||||||
wpEditorInit = function() {
|
wpEditorInit = function() {
|
||||||
// Activate tinyMCE if it's the user's default editor
|
var H;
|
||||||
if ( ( 'undefined' == typeof wpTinyMCEConfig ) || 'tinymce' == wpTinyMCEConfig.defaultEditor ) {
|
|
||||||
document.getElementById('editorcontainer').style.padding = '0px';
|
// Activate tinyMCE if it's the user's default editor
|
||||||
tinyMCE.execCommand("mceAddControl", false, "content");
|
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 {
|
} else {
|
||||||
var H;
|
if ( H = tinymce.util.Cookie.getHash("TinyMCE_content_size") )
|
||||||
if ( H = tinymce.util.Cookie.getHash("TinyMCE_content_size") )
|
try { document.getElementById('content').style.height = H.ch - 30 + 'px'; } catch(e){};
|
||||||
document.getElementById('content').style.height = H.ch - 30 + 'px';
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
switchEditors = {
|
switchEditors = {
|
||||||
|
|
||||||
saveCallback : function(el, content, body) {
|
saveCallback : function(el, content, body) {
|
||||||
|
|
||||||
document.getElementById(el).style.color = '#fff';
|
document.getElementById(el).style.color = '#fff';
|
||||||
if ( tinyMCE.activeEditor.isHidden() )
|
if ( tinyMCE.activeEditor.isHidden() )
|
||||||
content = document.getElementById(el).value;
|
content = document.getElementById(el).value;
|
||||||
else
|
else
|
||||||
content = this.pre_wpautop(content);
|
content = this.pre_wpautop(content);
|
||||||
|
|
||||||
return content;
|
return content;
|
||||||
},
|
},
|
||||||
|
|
||||||
pre_wpautop : function(content) {
|
pre_wpautop : function(content) {
|
||||||
// We have a TON of cleanup to do. Line breaks are already stripped.
|
// We have a TON of cleanup to do. Line breaks are already stripped.
|
||||||
|
|
||||||
// Protect pre|script tags
|
// Protect pre|script tags
|
||||||
content = content.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
|
content = content.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
|
||||||
a = a.replace(/<br ?\/?>[\r\n]*/g, '<wp_temp>');
|
a = a.replace(/<br ?\/?>[\r\n]*/g, '<wp_temp>');
|
||||||
return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '<wp_temp>');
|
return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '<wp_temp>');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Pretty it up for the source editor
|
// Pretty it up for the source editor
|
||||||
var blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6]|p';
|
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+')>\\s*', 'mg'), '</$1>\n');
|
||||||
content = content.replace(new RegExp('\\s*<(('+blocklist1+')[^>]*)>', 'mg'), '\n<$1>');
|
content = content.replace(new RegExp('\\s*<(('+blocklist1+')[^>]*)>', 'mg'), '\n<$1>');
|
||||||
|
|
||||||
// Mark </p> if it has any attributes.
|
// Mark </p> if it has any attributes.
|
||||||
content = content.replace(new RegExp('(<p [^>]+>.*?)</p>', 'mg'), '$1</p#>');
|
content = content.replace(new RegExp('(<p [^>]+>.*?)</p>', 'mg'), '$1</p#>');
|
||||||
|
|
||||||
// Sepatate <div> containing <p>
|
// Sepatate <div> containing <p>
|
||||||
content = content.replace(new RegExp('<div([^>]*)>\\s*<p>', 'mgi'), '<div$1>\n\n');
|
content = content.replace(new RegExp('<div([^>]*)>\\s*<p>', 'mgi'), '<div$1>\n\n');
|
||||||
|
|
||||||
// Remove <p> and <br />
|
// Remove <p> and <br />
|
||||||
content = content.replace(new RegExp('\\s*<p>', 'mgi'), '');
|
content = content.replace(new RegExp('\\s*<p>', 'mgi'), '');
|
||||||
content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n');
|
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('\\n\\s*\\n', 'mgi'), '\n\n');
|
||||||
content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');
|
content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');
|
||||||
|
|
||||||
// Fix some block element newline issues
|
// Fix some block element newline issues
|
||||||
content = content.replace(new RegExp('\\s*<div', 'mg'), '\n<div');
|
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('</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('\\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');
|
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';
|
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'), '\n<$1>');
|
||||||
content = content.replace(new RegExp('\\s*</('+blocklist2+')>\\s*', 'mg'), '</$1>\n');
|
content = content.replace(new RegExp('\\s*</('+blocklist2+')>\\s*', 'mg'), '</$1>\n');
|
||||||
content = content.replace(new RegExp('<li([^>]*)>', 'g'), '\t<li$1>');
|
content = content.replace(new RegExp('<li([^>]*)>', 'g'), '\t<li$1>');
|
||||||
|
|
||||||
if ( content.indexOf('<object') != -1 ) {
|
if ( content.indexOf('<object') != -1 ) {
|
||||||
content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'mg'), "<param$1>");
|
content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'mg'), "<param$1>");
|
||||||
content = content.replace(new RegExp('\\s*</embed>\\s*', 'mg'), '</embed>');
|
content = content.replace(new RegExp('\\s*</embed>\\s*', 'mg'), '</embed>');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unmark special paragraph closing tags
|
// Unmark special paragraph closing tags
|
||||||
content = content.replace(new RegExp('</p#>', 'g'), '</p>\n');
|
content = content.replace(new RegExp('</p#>', 'g'), '</p>\n');
|
||||||
content = content.replace(new RegExp('\\s*(<p [^>]+>.*</p>)', 'mg'), '\n$1');
|
content = content.replace(new RegExp('\\s*(<p [^>]+>.*</p>)', 'mg'), '\n$1');
|
||||||
|
|
||||||
// Trim whitespace
|
// Trim whitespace
|
||||||
content = content.replace(new RegExp('^\\s*', ''), '');
|
content = content.replace(new RegExp('^\\s*', ''), '');
|
||||||
content = content.replace(new RegExp('[\\s\\u00a0]*$', ''), '');
|
content = content.replace(new RegExp('[\\s\\u00a0]*$', ''), '');
|
||||||
|
|
||||||
// put back the line breaks in pre|script
|
// put back the line breaks in pre|script
|
||||||
content = content.replace(/<wp_temp>/g, '\n');
|
content = content.replace(/<wp_temp>/g, '\n');
|
||||||
|
|
||||||
// Hope.
|
// Hope.
|
||||||
return content;
|
return content;
|
||||||
},
|
},
|
||||||
|
|
||||||
go : function(id) {
|
go : function(id) {
|
||||||
var ed = tinyMCE.get(id);
|
var ed = tinyMCE.get(id);
|
||||||
var qt = document.getElementById('quicktags');
|
var qt = document.getElementById('quicktags');
|
||||||
var H = document.getElementById('edButtonHTML');
|
var H = document.getElementById('edButtonHTML');
|
||||||
var P = document.getElementById('edButtonPreview');
|
var P = document.getElementById('edButtonPreview');
|
||||||
var ta = document.getElementById(id);
|
var ta = document.getElementById(id);
|
||||||
var ec = document.getElementById('editorcontainer');
|
var ec = document.getElementById('editorcontainer');
|
||||||
|
|
||||||
if ( ! ed || ed.isHidden() ) {
|
if ( ! ed || ed.isHidden() ) {
|
||||||
ta.style.color = '#fff';
|
ta.style.color = '#fff';
|
||||||
|
|
||||||
this.edToggle(P, H);
|
this.edToggle(P, H);
|
||||||
edCloseAllTags(); // :-(
|
edCloseAllTags(); // :-(
|
||||||
|
|
||||||
qt.style.display = 'none';
|
qt.style.display = 'none';
|
||||||
ec.style.padding = '0px';
|
ec.style.padding = '0px';
|
||||||
ta.style.padding = '0px';
|
ta.style.padding = '0px';
|
||||||
|
|
||||||
ta.value = this.wpautop(ta.value);
|
ta.value = this.wpautop(ta.value);
|
||||||
|
|
||||||
if ( ed ) ed.show();
|
if ( ed ) ed.show();
|
||||||
else tinyMCE.execCommand("mceAddControl", false, id);
|
else tinyMCE.execCommand("mceAddControl", false, id);
|
||||||
|
|
||||||
this.wpSetDefaultEditor('tinymce');
|
this.wpSetDefaultEditor('tinymce');
|
||||||
} else {
|
} else {
|
||||||
this.edToggle(H, P);
|
this.edToggle(H, P);
|
||||||
ta.style.height = ed.getContentAreaContainer().offsetHeight + 6 + 'px';
|
ta.style.height = ed.getContentAreaContainer().offsetHeight + 6 + 'px';
|
||||||
|
|
||||||
ed.hide();
|
ed.hide();
|
||||||
qt.style.display = 'block';
|
qt.style.display = 'block';
|
||||||
|
|
||||||
if ( tinymce.isIE6 ) {
|
if ( tinymce.isIE6 ) {
|
||||||
ta.style.width = '98%';
|
ta.style.width = '98%';
|
||||||
ec.style.padding = '0px';
|
ec.style.padding = '0px';
|
||||||
ta.style.padding = '6px';
|
ta.style.padding = '6px';
|
||||||
} else {
|
} else {
|
||||||
ta.style.width = '100%';
|
ta.style.width = '100%';
|
||||||
ec.style.padding = '6px';
|
ec.style.padding = '6px';
|
||||||
}
|
}
|
||||||
|
|
||||||
ta.style.color = '';
|
ta.style.color = '';
|
||||||
this.wpSetDefaultEditor('html');
|
this.wpSetDefaultEditor('html');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
edToggle : function(A, B) {
|
edToggle : function(A, B) {
|
||||||
A.className = 'active';
|
A.className = 'active';
|
||||||
B.className = '';
|
B.className = '';
|
||||||
|
|
||||||
B.onclick = A.onclick;
|
B.onclick = A.onclick;
|
||||||
A.onclick = null;
|
A.onclick = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
wpSetDefaultEditor : function(editor) {
|
wpSetDefaultEditor : function(editor) {
|
||||||
try {
|
try {
|
||||||
editor = escape( editor.toString() );
|
editor = escape( editor.toString() );
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
editor = 'tinymce';
|
editor = 'tinymce';
|
||||||
}
|
}
|
||||||
|
|
||||||
var userID = document.getElementById('user-id');
|
var userID = document.getElementById('user-id');
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
date.setTime(date.getTime()+(10*365*24*60*60*1000));
|
date.setTime(date.getTime()+(10*365*24*60*60*1000));
|
||||||
document.cookie = "wordpress_editor_" + userID.value + "=" + editor + "; expires=" + date.toGMTString();
|
document.cookie = "wordpress_editor_" + userID.value + "=" + editor + "; expires=" + date.toGMTString();
|
||||||
},
|
},
|
||||||
|
|
||||||
wpautop : function(pee) {
|
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]';
|
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 + "\n\n";
|
||||||
pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\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'), "\n$1");
|
||||||
pee = pee.replace(new RegExp('(</(?:'+blocklist+')>)', 'gi'), "$1\n\n");
|
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("\\r\\n|\\r", 'g'), "\n");
|
||||||
pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\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('([\\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*?</p>', 'gi'), '');
|
||||||
pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
|
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>(<li.+?)</p>", 'gi'), "$1");
|
||||||
pee = pee.replace(new RegExp('<p>\\s*<blockquote([^>]*)>', 'gi'), "<blockquote$1><p>");
|
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('</blockquote>\\s*</p>', 'gi'), '</p></blockquote>');
|
||||||
pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)', 'gi'), "$1");
|
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('(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
|
||||||
pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n");
|
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('(</?(?:'+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('<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('(?:<p>|<br ?/?>)*\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*(?:</p>|<br ?/?>)*', 'gi'), '[caption$1[/caption]');
|
||||||
// pee = pee.replace(new RegExp('^((?: )*)\\s', 'mg'), '$1 ');
|
// pee = pee.replace(new RegExp('^((?: )*)\\s', 'mg'), '$1 ');
|
||||||
|
|
||||||
// Fix the pre|script tags
|
// Fix the pre|script tags
|
||||||
pee = pee.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
|
pee = pee.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
|
||||||
a = a.replace(/<br ?\/?>[\r\n]*/g, '\n');
|
a = a.replace(/<br ?\/?>[\r\n]*/g, '\n');
|
||||||
return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '\n');
|
return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '\n');
|
||||||
});
|
});
|
||||||
|
|
||||||
return pee;
|
return pee;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,6 +130,7 @@ case 'edit':
|
||||||
add_thickbox();
|
add_thickbox();
|
||||||
wp_enqueue_script('media-upload');
|
wp_enqueue_script('media-upload');
|
||||||
wp_enqueue_script('word-count');
|
wp_enqueue_script('word-count');
|
||||||
|
wp_enqueue_script( 'admin-comments' );
|
||||||
|
|
||||||
if ( current_user_can('edit_post', $post_ID) ) {
|
if ( current_user_can('edit_post', $post_ID) ) {
|
||||||
if ( $last = wp_check_post_lock( $post->ID ) ) {
|
if ( $last = wp_check_post_lock( $post->ID ) ) {
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
/** WordPress Administration Bootstrap */
|
/** WordPress Administration Bootstrap */
|
||||||
require_once('admin.php');
|
require_once('admin.php');
|
||||||
add_thickbox();
|
add_thickbox();
|
||||||
wp_enqueue_script('media-upload');
|
wp_enqueue_script( 'media-upload' );
|
||||||
|
wp_enqueue_script( 'quicktags' );
|
||||||
|
|
||||||
if (!current_user_can('upload_files'))
|
if (!current_user_can('upload_files'))
|
||||||
wp_die(__('You do not have permission to upload files.'));
|
wp_die(__('You do not have permission to upload files.'));
|
||||||
|
@ -263,4 +264,7 @@ endif; // posts;
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php include('admin-footer.php'); ?>
|
<?php
|
||||||
|
wp_comment_reply();
|
||||||
|
include('admin-footer.php');
|
||||||
|
?>
|
|
@ -320,30 +320,36 @@ textarea.all-options, input.all-options {
|
||||||
padding: 2px 4px;
|
padding: 2px 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ed_toolbar input {
|
#ed_toolbar input,
|
||||||
|
#ed_reply_toolbar input {
|
||||||
margin: 3px 2px 2px;
|
margin: 3px 2px 2px;
|
||||||
padding: 2px 4px;
|
padding: 2px 4px;
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
#quicktags #ed_strong {
|
#quicktags #ed_strong,
|
||||||
|
#ed_reply_toolbar #ed_reply_strong {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
#quicktags #ed_link {
|
#quicktags #ed_link,
|
||||||
|
#ed_reply_toolbar #ed_reply_link {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
#quicktags #ed_del {
|
#quicktags #ed_del,
|
||||||
|
#ed_reply_toolbar #ed_reply_del {
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
}
|
}
|
||||||
|
|
||||||
#quicktags #ed_em {
|
#quicktags #ed_em,
|
||||||
|
#ed_reply_toolbar #ed_reply_em {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
#quicktags #ed_code {
|
#quicktags #ed_code,
|
||||||
|
#ed_reply_toolbar #ed_reply_code {
|
||||||
font-family: "Courier New", Courier, mono;
|
font-family: "Courier New", Courier, mono;
|
||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
|
@ -502,14 +508,14 @@ p.pagenav {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment-column {
|
|
||||||
width: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comment-column p {
|
.comment-column p {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.comment-column {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
.author-column {
|
.author-column {
|
||||||
width: 20%;
|
width: 20%;
|
||||||
}
|
}
|
||||||
|
@ -1760,7 +1766,8 @@ fieldset {
|
||||||
.info-box-title {
|
.info-box-title {
|
||||||
line-height: 2;
|
line-height: 2;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0 7px;
|
padding: 4px 8px;
|
||||||
|
font: 18px Georgia, "Times New Roman", Times, serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
#wp_editbtns {
|
#wp_editbtns {
|
||||||
|
@ -1809,90 +1816,11 @@ a.togbox {
|
||||||
cursor: pointer;
|
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 {
|
p#post-search-prep {
|
||||||
margin:0pt;
|
margin: 0;
|
||||||
position:absolute;
|
position: absolute;
|
||||||
right:20px;
|
right: 20px;
|
||||||
top:50px;
|
top: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#jj, #hh, #mn {
|
#jj, #hh, #mn {
|
||||||
|
@ -1915,7 +1843,6 @@ p#post-search-prep {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* media popup 0819 */
|
/* media popup 0819 */
|
||||||
|
|
||||||
#sidemenu {
|
#sidemenu {
|
||||||
margin: -30px 15px 0 315px;
|
margin: -30px 15px 0 315px;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
@ -2000,3 +1927,84 @@ p#post-search-prep {
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
width:200px;
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -66,7 +66,9 @@ if ( get_option('require_name_email') && !$user->ID ) {
|
||||||
if ( '' == $comment_content )
|
if ( '' == $comment_content )
|
||||||
wp_die( __('Error: please type a comment.') );
|
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 );
|
$comment_id = wp_new_comment( $commentdata );
|
||||||
|
|
||||||
|
|
|
@ -391,8 +391,12 @@ function wp_allow_comment($commentdata) {
|
||||||
if ( $comment_author_email )
|
if ( $comment_author_email )
|
||||||
$dupe .= "OR comment_author_email = '$comment_author_email' ";
|
$dupe .= "OR comment_author_email = '$comment_author_email' ";
|
||||||
$dupe .= ") AND comment_content = '$comment_content' LIMIT 1";
|
$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!') );
|
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 );
|
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);
|
$flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment);
|
||||||
if ( $flood_die ) {
|
if ( $flood_die ) {
|
||||||
do_action('comment_flood_trigger', $time_lastcomment, $time_newcomment);
|
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.') );
|
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['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
|
||||||
$commentdata['user_ID'] = (int) $commentdata['user_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_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '',$_SERVER['REMOTE_ADDR'] );
|
||||||
$commentdata['comment_agent'] = $_SERVER['HTTP_USER_AGENT'];
|
$commentdata['comment_agent'] = $_SERVER['HTTP_USER_AGENT'];
|
||||||
|
|
||||||
|
|
|
@ -955,7 +955,7 @@ function the_editor($content, $id = 'content', $prev_id = 'title', $media_button
|
||||||
|
|
||||||
$rows = "rows='$rows'"; ?>
|
$rows = "rows='$rows'"; ?>
|
||||||
<div id="editor-toolbar">
|
<div id="editor-toolbar">
|
||||||
<?php if ( user_can_richedit() ) {
|
<?php if ( user_can_richedit() && $media_buttons ) {
|
||||||
$wp_default_editor = wp_default_editor(); ?>
|
$wp_default_editor = wp_default_editor(); ?>
|
||||||
<div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('<?php echo $id; ?>')" /></div>
|
<div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('<?php echo $id; ?>')" /></div>
|
||||||
<?php if ( 'tinymce' == $wp_default_editor ) {
|
<?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="edButtonHTML" class="active"><?php _e('HTML'); ?></a>
|
||||||
<a id="edButtonPreview" onclick="switchEditors.go('<?php echo $id; ?>');"><?php _e('Visual'); ?></a>
|
<a id="edButtonPreview" onclick="switchEditors.go('<?php echo $id; ?>');"><?php _e('Visual'); ?></a>
|
||||||
<?php }
|
<?php }
|
||||||
}
|
} else
|
||||||
|
add_filter('the_editor_content', 'wp_htmledit_pre');
|
||||||
|
|
||||||
/* if ( $media_buttons ) { ?>
|
/* if ( $media_buttons ) { ?>
|
||||||
<div id="media-buttons" class="hide-if-no-js">
|
<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>
|
<script type="text/javascript">edToolbar()</script>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ( 'html' != $wp_default_editor ) : ?>
|
<?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");
|
||||||
<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");
|
|
||||||
$the_editor_content = apply_filters('the_editor_content', $content);
|
$the_editor_content = apply_filters('the_editor_content', $content);
|
||||||
|
|
||||||
printf($the_editor, $the_editor_content);
|
printf($the_editor, $the_editor_content);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// <![CDATA[
|
// <![CDATA[
|
||||||
edCanvas = document.getElementById('<?php echo $id; ?>');
|
edCanvas = document.getElementById('<?php echo $id; ?>');
|
||||||
<?php if ( $prev_id && user_can_richedit() ) : ?>
|
<?php if ( user_can_richedit() && $prev_id ) { ?>
|
||||||
// If tinyMCE is defined.
|
// If tinyMCE is defined.
|
||||||
if ( typeof tinyMCE != 'undefined' ) {
|
if ( typeof tinyMCE != 'undefined' ) {
|
||||||
// This code is meant to allow tabbing from Title to Post (TinyMCE).
|
// This code is meant to allow tabbing from Title to Post (TinyMCE).
|
||||||
document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e) {
|
document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e) {
|
||||||
e = e || window.event;
|
e = e || window.event;
|
||||||
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
|
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
|
||||||
if ( tinyMCE.activeEditor ) {
|
if ( tinyMCE.activeEditor ) {
|
||||||
if ( (jQuery("#post_ID").val() < 1) && (jQuery("#title").val().length > 0) ) { autosave(); }
|
if ( (jQuery("#post_ID").val() < 1) && (jQuery("#title").val().length > 0) ) { autosave(); }
|
||||||
e = null;
|
e = null;
|
||||||
if ( tinyMCE.activeEditor.isHidden() ) return true;
|
if ( tinyMCE.activeEditor.isHidden() ) return true;
|
||||||
tinyMCE.activeEditor.focus();
|
tinyMCE.activeEditor.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<?php endif; ?>
|
<?php } ?>
|
||||||
// ]]>
|
// ]]>
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_search_query() {
|
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
|
@ -387,3 +387,194 @@ function edInsertImage(myField) {
|
||||||
edInsertContent(myField, myValue);
|
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);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
|
@ -15,7 +15,7 @@ function wp_default_scripts( &$scripts ) {
|
||||||
$scripts->add( 'common', '/wp-admin/js/common.js', array('jquery'), '20080318' );
|
$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( '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(
|
$scripts->localize( 'quicktags', 'quicktagsL10n', array(
|
||||||
'quickLinks' => __('(Quick Links)'),
|
'quickLinks' => __('(Quick Links)'),
|
||||||
'wordLookup' => __('Enter a word to look up:'),
|
'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'));
|
$visual_editor = apply_filters('visual_editor', array('tiny_mce'));
|
||||||
$scripts->add( 'editor', false, $visual_editor, '20080321' );
|
$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.
|
// Modify this version when tinyMCE plugins are changed.
|
||||||
$mce_version = apply_filters('tiny_mce_version', '20080730');
|
$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-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-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-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() ) {
|
if ( is_admin() ) {
|
||||||
$scripts->add( 'ajaxcat', '/wp-admin/js/cat.js', array( 'wp-lists' ), '20071101' );
|
$scripts->add( 'ajaxcat', '/wp-admin/js/cat.js', array( 'wp-lists' ), '20071101' );
|
||||||
|
@ -120,7 +123,7 @@ function wp_default_scripts( &$scripts ) {
|
||||||
'good' => __('Good'),
|
'good' => __('Good'),
|
||||||
'strong' => __('Strong')
|
'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(
|
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
|
||||||
'pending' => __('%i% pending') // must look like: "# blah blah"
|
'pending' => __('%i% pending') // must look like: "# blah blah"
|
||||||
) );
|
) );
|
||||||
|
|
|
@ -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'];
|
$comment['comment_content'] = $content_struct['content'];
|
||||||
|
|
||||||
do_action('xmlrpc_call', 'wp.newComment');
|
do_action('xmlrpc_call', 'wp.newComment');
|
||||||
|
|
Loading…
Reference in New Issue