Make WordPress Core

Changeset 8720


Ignore:
Timestamp:
08/24/2008 06:56:22 AM (18 years ago)
Author:
azaozz
Message:

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

Location:
trunk
Files:
4 added
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r8712 r8720  
    423423                ) );
    424424        }
     425        $x->send();
     426        break;
     427case 'replyto-comment' :
     428        check_ajax_referer( $action );
     429
     430        $comment_post_ID = (int) $_POST['comment_post_ID'];
     431        if ( !current_user_can( 'edit_post', $comment_post_ID ) )
     432                die('-1');
     433
     434        $status = $wpdb->get_var( $wpdb->prepare("SELECT post_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) );
     435
     436        if ( empty($status) )
     437                die('1');
     438        elseif ( in_array($status->post_status, array('draft', 'pending') ) )
     439                die( __('Error: you are replying to comment on a draft post.') );
     440
     441        $user = wp_get_current_user();
     442        if ( $user->ID ) {
     443                $comment_author       = $wpdb->escape($user->display_name);
     444                $comment_author_email = $wpdb->escape($user->user_email);
     445                $comment_author_url   = $wpdb->escape($user->user_url);
     446                $comment_content      = trim($_POST['comment']);
     447                if ( current_user_can('unfiltered_html') ) {
     448                        if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) {
     449                                kses_remove_filters(); // start with a clean slate
     450                                kses_init_filters(); // set up the filters
     451                        }
     452                }
     453        } else {
     454                die( __('Sorry, you must be logged in to reply to a comment.') );
     455        }
     456
     457        if ( '' == $comment_content )
     458                die( __('Error: please type a comment.') );
     459
     460        $comment_parent = absint($_POST['comment_ID']);
     461        $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');
     462
     463        $comment_id = wp_new_comment( $commentdata );
     464        $comment = get_comment($comment_id);
     465        if ( ! $comment ) die('1');
     466
     467        $mode = ( isset($_POST['mode']) && 'single' == $_POST['mode'] ) ? 'single' : 'detail';
     468        $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
     469        $checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
     470
     471        if ( get_option('show_avatars') && 'single' != $mode )
     472                add_filter( 'comment_author', 'floated_admin_avatar' );
     473
     474        $x = new WP_Ajax_Response();
     475
     476        ob_start();
     477                _wp_comment_row( $comment->comment_ID, $mode, false, $checkbox );
     478                $comment_list_item = ob_get_contents();
     479        ob_end_clean();
     480
     481        $x->add( array(
     482                'what' => 'comment',
     483                'id' => $comment->comment_ID,
     484                'data' => $comment_list_item,
     485                'position' => $position
     486        ));
     487
    425488        $x->send();
    426489        break;
  • trunk/wp-admin/admin-footer.php

    r8697 r8720  
    1111</div><!-- wpbody -->
    1212</div><!-- wpcontent -->
    13 </div><!-- wpwrap -->
     13<br class="clear" /></div><!-- wpwrap -->
    1414<div id="footer">
    1515<p><?php
  • trunk/wp-admin/css/colors-classic.css

    r8691 r8720  
    5555
    5656li.widget-list-control-item, div.nav, .tablenav, #dashboard-widgets p.dashboard-widget-links,
    57 ul.view-switch li.current, .form-table tr, #poststuff h3,
     57ul.view-switch li.current, .form-table tr, #poststuff h3, #replyhandle,
    5858.login form, h3.info-box-title, #post-status-info {
    5959        background-color: #cfebf7;
    … …  
    7171#post-body ul#category-tabs li.ui-tabs-selected, .button-secondary,
    7272#quicktags, #login form .submit input, #post-search .button,
    73 #post-search-prep .button {
     73#post-search-prep .button, #ed_reply_toolbar {
    7474        background-color: #8ebddc !important;
    7575}
    … …  
    377377}
    378378
    379 #ed_toolbar input {
     379#ed_toolbar input, #ed_reply_toolbar input {
    380380        background: url( ../images/fade-butt.png ) #fff repeat-x 0 -2px;
    381381}
  • trunk/wp-admin/css/colors-fresh.css

    r8691 r8720  
    5555
    5656li.widget-list-control-item, div.nav, .tablenav, #dashboard-widgets p.dashboard-widget-links,
    57 ul.view-switch li.current, .form-table tr, #poststuff h3,
     57ul.view-switch li.current, .form-table tr, #poststuff h3, #replyhandle,
    5858.login form, h3.info-box-title, #post-status-info {
    5959        background-color: #eaf3fa;
    … …  
    7171#post-body ul#category-tabs li.ui-tabs-selected, .button-secondary,
    7272#quicktags, #login form .submit input, #post-search .button,
    73 #post-search-prep .button {
     73#post-search-prep .button, #ed_reply_toolbar {
    7474        background-color: #cee1ef !important;
    7575}
    … …  
    366366}
    367367
    368 #ed_toolbar input {
     368#ed_toolbar input, #ed_reply_toolbar input {
    369369        background: url( ../images/fade-butt.png ) #fff repeat-x 0 -2px;
    370370}
  • trunk/wp-admin/edit-comments.php

    r8710 r8720  
    1212$title = __('Edit Comments');
    1313wp_enqueue_script( 'admin-comments' );
    14 wp_enqueue_script('admin-forms');
     14wp_enqueue_script( 'admin-forms' );
     15wp_enqueue_script( 'quicktags' );
    1516
    1617if ( !empty( $_REQUEST['delete_comments'] ) && isset($_REQUEST['action']) ) {
    … …  
    5455require_once('admin-header.php');
    5556
    56 if ( empty($_GET['mode']) )
    57         $mode = 'detail';
    58 else
    59         $mode = attribute_escape($_GET['mode']);
    60 
    61 if ( isset($_GET['comment_status']) )
    62         $comment_status = attribute_escape($_GET['comment_status']);
    63 else
    64         $comment_status = '';
    65 
    66 if ( isset($_GET['s']) )
    67         $search_dirty = $_GET['s'];
    68 else
    69         $search_dirty = '';
     57$mode = ( ! isset($_GET['mode']) || empty($_GET['mode']) ) ? 'detail' : attribute_escape($_GET['mode']);
     58
     59$comment_status = isset($_GET['comment_status']) ? attribute_escape($_GET['comment_status']) : '';
     60
     61$search_dirty = ( isset($_GET['s']) ) ? $_GET['s'] : '';
    7062$search = attribute_escape( $search_dirty );
    7163?>
    … …  
    216208    <th scope="col" class="comment-column"><?php _e('Comment') ?></th>
    217209        <th scope="col" class="author-column"><?php _e('Author') ?></th>
    218     <th scope="col" class="date-column"><?php _e('Comment Submitted') ?></th>
     210    <th scope="col" class="date-column"><?php _e('Submitted') ?></th>
    219211    <th scope="col" class="response-column"><?php _e('In Response To This Post') ?></th>
    220212  </tr>
    … …  
    270262</div>
    271263
    272 <?php include('admin-footer.php'); ?>
     264<?php
     265wp_comment_reply('-1', true, 'detail');
     266include('admin-footer.php'); ?>
  • trunk/wp-admin/edit-form-advanced.php

    r8712 r8720  
    326326</table>
    327327
    328 
    329 <?php
    330 
    331 
    332 
     328<?php
    333329}
    334330add_meta_box('commentstatusdiv', __('Comments on this Post'), 'post_comment_status_meta_box', 'post', 'normal', 'core');
    … …  
    542538</form>
    543539
     540<?php wp_comment_reply(); ?>
     541
    544542<?php if ((isset($post->post_title) && '' == $post->post_title) || (isset($_GET['message']) && 2 > $_GET['message'])) : ?>
    545543<script type="text/javascript">
  • trunk/wp-admin/edit-pages.php

    r8682 r8720  
    6969if ( is_singular() )
    7070        wp_enqueue_script( 'admin-comments' );
     71
    7172require_once('admin-header.php');
    7273
    … …  
    241242
    242243<?php
    243 
     244wp_comment_reply();
    244245endif; // comments
    245246endif; // posts;
  • trunk/wp-admin/edit.php

    r8694 r8720  
    5454list($post_stati, $avail_post_stati) = wp_edit_posts_query();
    5555
    56 if ( 1 == count($posts) && is_singular() )
     56if ( 1 == count($posts) && is_singular() ) {
    5757        wp_enqueue_script( 'admin-comments' );
     58        wp_enqueue_script( 'quicktags' );
     59}
     60
    5861require_once('admin-header.php');
    5962
    … …  
    268271
    269272<?php
    270 
     273wp_comment_reply();
    271274endif; // comments
    272275endif; // posts;
  • trunk/wp-admin/gears-manifest.php

    r8618 r8720  
    136136{
    137137"betaManifestVersion" : 1,
    138 "version" : "<?php echo $man_version; ?>_20080731",
     138"version" : "<?php echo $man_version; ?>_20080823",
    139139"entries" : [
    140140<?php echo $defaults; ?>
    … …  
    174174{ "url" : "images/no.png" },
    175175{ "url" : "images/yes.png" },
     176{ "url" : "images/se.png" },
    176177
    177178<?php if ( is_file('../wp-includes/js/tinymce/tiny_mce.js') ) { ?>
  • trunk/wp-admin/includes/template.php

    r8715 r8720  
    800800
    801801        if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
    802                 $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> | ';
    803                 $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> | ';
     802                $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> | ";
     803                $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> | ";
    804804                $actions['edit']      = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a> | ';
    805                 $actions['flag']      = "<a href='#' class='no-crazy'>Flag for Follow-up</a> | ";
    806                 $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> | ';
     805                if ( 'spam' != $the_comment_status )
     806                        $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> | ';
    807807                $actions['delete']    = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete'>" . __('Delete') . '</a>';
    808808
    … …  
    817817                }
    818818
    819                 if ( 'spam' == $the_comment_status )
    820                         unset($actions['spam']);
     819                if ( 'spam' != $the_comment_status )
     820                        $actions['reply'] = ' | <a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\',this);return false;" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
    821821
    822822                $actions = apply_filters( 'comment_row_actions', $actions, $comment );
    823823
    824824                foreach ( $actions as $action => $link )
    825                         echo "<span class='$action'>$link</span>";
     825                        echo "<span class='$action'>$link</span>\n";
    826826        }
    827827        ?>
    … …  
    842842<?php if ( 'single' !== $mode ) : ?>
    843843    <td class="response-column">
    844     "<?php echo $post_link ?>" <?php echo sprintf('(%s comments)', $post->comment_count); ?><br/>
     844    "<?php echo $post_link ?>" <?php echo sprintf('(%s comments)', $post->comment_count); ?><br />
    845845    <?php echo get_the_time(__('Y/m/d \a\t g:ia')); ?>
    846846    </td>
    … …  
    848848  </tr>
    849849        <?php
     850}
     851
     852function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single') {
     853        global $current_user;
     854
     855        // allow plugin to replace the popup content
     856        $content = apply_filters( 'wp_comment_reply', '' );
     857       
     858        if ( ! empty($content) ) {
     859                echo $content;
     860                return;
     861        }
     862?>
     863        <div id="replyerror" style="display:none;">
     864        <img src="images/logo.gif" />
     865        <h3 class="info-box-title"><?php _e('Comment Reply Error'); ?></h3>
     866        <p id="replyerrtext"></p>
     867        <p class="submit"><button id="close-button" onclick="commentReply.close();" class="button"><?php _e('Close'); ?></button></p>
     868        </div>
     869       
     870        <div id="replydiv" style="display:none;">
     871        <p id="replyhandle"><?php _e('Reply'); ?></p>
     872        <form action="" method="post" id="replyform">
     873        <input type="hidden" name="user_ID" id="user_ID" value="<?php echo $current_user->ID; ?>" />
     874        <input type="hidden" name="action" value="replyto-comment" />
     875        <input type="hidden" name="comment_ID" id="comment_ID" value="" />
     876        <input type="hidden" name="comment_post_ID" id="comment_post_ID" value="" />
     877        <input type="hidden" name="position" id="position" value="<?php echo $position; ?>" />
     878        <input type="hidden" name="checkbox" id="checkbox" value="<?php echo $checkbox ? 1 : 0; ?>" />
     879        <input type="hidden" name="mode" id="mode" value="<?php echo $mode; ?>" />
     880        <?php wp_nonce_field( 'replyto-comment', '_ajax_nonce', false ); ?>
     881        <?php wp_comment_form_unfiltered_html_nonce(); ?>
     882
     883        <div id="replycontainer"><textarea rows="5" cols="50" name="replycontent" tabindex="10" id="replycontent"></textarea></div>
     884
     885        <p id="replysubmit"><input type="button" onclick="commentReply.close();" class="button" value="<?php _e('Cancel'); ?>" />
     886        <input type="button" onclick="commentReply.send();" class="button" value="<?php _e('Submit Reply'); ?>" /></p>
     887        </form>
     888        </div>
     889<?php
    850890}
    851891
  • trunk/wp-admin/js/edit-comments.js

    r8691 r8720  
    7979theList = $('#the-comment-list').wpList( { alt: '', dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } );
    8080
    81 } );
     81});
     82
     83(function($){
     84
     85commentReply = {
     86
     87        open : function(c, p) {
     88                var d = $('#comment-'+c).offset(), H = $('#replydiv').height(), top = 200, left = 100, h = 120;
     89
     90                if ( d && H ) {
     91                        top = (d.top - H) < 10 ? 10 : d.top - H - 5;
     92                        left = d.left;
     93                }
     94
     95                $('#replydiv').show();
     96                $('#replydiv #comment_post_ID').val(p);
     97                $('#replydiv #comment_ID').val(c);
     98
     99                $('#replydiv').draggable({
     100                        handle : '#replyhandle',
     101                        containment : '#wpwrap'
     102                });
     103
     104                $('#replydiv').resizable({
     105                        handles : 'se',
     106                        minHeight : 200,
     107                        minWidth : 400,
     108                        containment : '#wpwrap',
     109                        resize : function(e,o) {
     110                                h = o.size.height - 80 - $('#ed_reply_qtags').height();
     111                                $('#replycontainer').height(h);
     112                        },
     113                        stop : function(e,o) {
     114                                if ( $.browser.msie )
     115                                        $('#replycontent').height(h);
     116                        }
     117                });
     118
     119                $('.ui-resizable-se').css({
     120                        border: '0 none',
     121                        width: '11px',
     122                        height: '12px',
     123                        background: 'transparent url(images/se.png) no-repeat scroll 0 0'
     124                });
     125
     126                $('#replydiv').css({
     127                        'position' : 'absolute',
     128                        'top' : top,
     129                        'left' : left
     130                });
     131
     132                $('#replycontent').focus().keyup(function(e){
     133                        if (e.which == 27) commentReply.close(); // close on Escape
     134                });
     135               
     136                // emulate the Safari/Opera scrollIntoView
     137                var to = $('#replydiv').offset();
     138                var scr = document.documentElement.scrollTop ? document.documentElement.scrollTop : 0;
     139
     140                if ( scr - 20 > to.top )
     141                        window.scroll(0, to.top - 100);
     142        },
     143
     144        close : function() {
     145                $('#replycontent').val('');
     146                $('#replyerror').hide();
     147
     148                $('#replydiv').draggable('destroy').resizable('destroy').css('position','relative');
     149                $('#replydiv').hide();
     150                return false;
     151        },
     152
     153        send : function() {
     154                var post = {};
     155
     156                $('#replyform input').each(function() {
     157                        post[ $(this).attr('name') ] = $(this).val();
     158                });
     159
     160                post.comment = $('#replycontent').val();
     161                post.id = post.comment_post_ID;
     162
     163                $.ajax({
     164                        type : 'POST',
     165                        url : wpListL10n.url,
     166                        data : post,
     167                        success : function(x) { commentReply.show(x); },
     168                        error : function(r) { commentReply.error(r); }
     169                });
     170        },
     171
     172        show : function(xml) {
     173
     174                if ( typeof(xml) == 'string' ) {
     175                        this.error({'responseText': xml});
     176                        return;
     177                }
     178
     179                var r = wpAjax.parseAjaxResponse(xml);
     180                if ( r.errors )
     181                        this.error({'responseText': wpAjax.broken});
     182
     183                r = r.responses[0];
     184                this.close();
     185//              var scr1 = $('#the-comment-list').offset(), scr2 = $('#the-comment-list').height();
     186
     187                if ( r.position == -1 ) {
     188//                      window.scroll(0, scr1.top - 100); // Scroll to the new comment? Seems annoing..
     189                        $('#the-comment-list').prepend(r.data);
     190                } else {
     191//                      window.scroll(0, scr1.top + scr2 + 200);
     192                        $('#the-comment-list').append(r.data);
     193                }
     194
     195                $('#comment-'+r.id)
     196                        .animate( { backgroundColor:"#CFEBF7" }, 600 )
     197                        .animate( { backgroundColor:"transparent" }, 600 );
     198        },
     199
     200        error : function(r) {
     201                var er = r.statusText;
     202
     203                if ( r.responseText )
     204                        er = r.responseText.replace( /<.[^<>]*?>/g, '' );
     205
     206                if ( er ) {
     207                        var o = $('#replydiv').offset();
     208                        $('#replydiv').hide();
     209
     210                        $('#replyerror').css({
     211                                'top' : o.top + 60 + 'px',
     212                                'left' : o.left + 'px'
     213                        }).show().draggable();
     214
     215                        $('#replyerrtext').html(er)
     216                        $('#close-button').css('outline','none').focus().keyup(function(e) {
     217                                if (e.which == 27) commentReply.close(); // close on Escape
     218                        });
     219                }
     220        }
     221}
     222
     223$(document).ready(function(){
     224        if ( typeof QTags != 'undefined' )
     225                ed_reply = new QTags('ed_reply', 'replycontent', 'replycontainer', 'more');
     226});
     227
     228})(jQuery);
  • trunk/wp-admin/js/editor.js

    r8600 r8720  
    11wpEditorInit = function() {
    2     // Activate tinyMCE if it's the user's default editor
    3     if ( ( 'undefined' == typeof wpTinyMCEConfig ) || 'tinymce' == wpTinyMCEConfig.defaultEditor ) {
    4         document.getElementById('editorcontainer').style.padding = '0px';
    5         tinyMCE.execCommand("mceAddControl", false, "content");
     2        var H;
     3
     4        // Activate tinyMCE if it's the user's default editor
     5        if ( ( 'undefined' == typeof wpTinyMCEConfig ) || 'tinymce' == wpTinyMCEConfig.defaultEditor ) {
     6                try { document.getElementById('editorcontainer').style.padding = '0px'; } catch(e){};
     7                try { document.getElementById("quicktags").style.display = "none"; } catch(e){};
     8                tinyMCE.execCommand("mceAddControl", false, "content");
    69        } else {
    7         var H;
    8         if ( H = tinymce.util.Cookie.getHash("TinyMCE_content_size") )
    9             document.getElementById('content').style.height = H.ch - 30 + 'px';
    10     }
     10                if ( H = tinymce.util.Cookie.getHash("TinyMCE_content_size") )
     11                        try { document.getElementById('content').style.height = H.ch - 30 + 'px'; } catch(e){};
     12        }
    1113};
    1214
    1315switchEditors = {
    1416
    15     saveCallback : function(el, content, body) {
     17        saveCallback : function(el, content, body) {
    1618
    17         document.getElementById(el).style.color = '#fff';
    18         if ( tinyMCE.activeEditor.isHidden() )
    19             content = document.getElementById(el).value;
    20         else
    21             content = this.pre_wpautop(content);
     19                document.getElementById(el).style.color = '#fff';
     20                if ( tinyMCE.activeEditor.isHidden() )
     21                        content = document.getElementById(el).value;
     22                else
     23                        content = this.pre_wpautop(content);
    2224
    23         return content;
    24     },
     25                return content;
     26        },
    2527
    26     pre_wpautop : function(content) {
    27         // We have a TON of cleanup to do. Line breaks are already stripped.
     28        pre_wpautop : function(content) {
     29                // We have a TON of cleanup to do. Line breaks are already stripped.
    2830
    29         // Protect pre|script tags
    30         content = content.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
    31             a = a.replace(/<br ?\/?>[\r\n]*/g, '<wp_temp>');
    32             return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '<wp_temp>');
    33         });
     31                // Protect pre|script tags
     32                content = content.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
     33                        a = a.replace(/<br ?\/?>[\r\n]*/g, '<wp_temp>');
     34                        return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '<wp_temp>');
     35                });
    3436
    35         // Pretty it up for the source editor
    36         var blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6]|p';
    37         content = content.replace(new RegExp('\\s*</('+blocklist1+')>\\s*', 'mg'), '</$1>\n');
    38         content = content.replace(new RegExp('\\s*<(('+blocklist1+')[^>]*)>', 'mg'), '\n<$1>');
     37                // Pretty it up for the source editor
     38                var blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6]|p';
     39                content = content.replace(new RegExp('\\s*</('+blocklist1+')>\\s*', 'mg'), '</$1>\n');
     40                content = content.replace(new RegExp('\\s*<(('+blocklist1+')[^>]*)>', 'mg'), '\n<$1>');
    3941
    40         // Mark </p> if it has any attributes.
    41         content = content.replace(new RegExp('(<p [^>]+>.*?)</p>', 'mg'), '$1</p#>');
     42                // Mark </p> if it has any attributes.
     43                content = content.replace(new RegExp('(<p [^>]+>.*?)</p>', 'mg'), '$1</p#>');
    4244
    43         // Sepatate <div> containing <p>
    44         content = content.replace(new RegExp('<div([^>]*)>\\s*<p>', 'mgi'), '<div$1>\n\n');
     45                // Sepatate <div> containing <p>
     46                content = content.replace(new RegExp('<div([^>]*)>\\s*<p>', 'mgi'), '<div$1>\n\n');
    4547
    46         // Remove <p> and <br />
    47         content = content.replace(new RegExp('\\s*<p>', 'mgi'), '');
    48         content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n');
    49         content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n');
    50         content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');
     48                // Remove <p> and <br />
     49                content = content.replace(new RegExp('\\s*<p>', 'mgi'), '');
     50                content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n');
     51                content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n');
     52                content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');
    5153
    52         // Fix some block element newline issues
    53         content = content.replace(new RegExp('\\s*<div', 'mg'), '\n<div');
    54         content = content.replace(new RegExp('</div>\\s*', 'mg'), '</div>\n');
     54                // Fix some block element newline issues
     55                content = content.replace(new RegExp('\\s*<div', 'mg'), '\n<div');
     56                content = content.replace(new RegExp('</div>\\s*', 'mg'), '</div>\n');
    5557                content = content.replace(new RegExp('\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*', 'gi'), '\n\n[caption$1[/caption]\n\n');
    5658                content = content.replace(new RegExp('caption\\]\\n\\n+\\[caption', 'g'), 'caption]\n\n[caption');
    5759
    58         var blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre';
    59         content = content.replace(new RegExp('\\s*<(('+blocklist2+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
    60         content = content.replace(new RegExp('\\s*</('+blocklist2+')>\\s*', 'mg'), '</$1>\n');
    61         content = content.replace(new RegExp('<li([^>]*)>', 'g'), '\t<li$1>');
     60                var blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre';
     61                content = content.replace(new RegExp('\\s*<(('+blocklist2+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
     62                content = content.replace(new RegExp('\\s*</('+blocklist2+')>\\s*', 'mg'), '</$1>\n');
     63                content = content.replace(new RegExp('<li([^>]*)>', 'g'), '\t<li$1>');
    6264
    63         if ( content.indexOf('<object') != -1 ) {
    64             content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'mg'), "<param$1>");
    65             content = content.replace(new RegExp('\\s*</embed>\\s*', 'mg'), '</embed>');
    66         }
     65                if ( content.indexOf('<object') != -1 ) {
     66                        content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'mg'), "<param$1>");
     67                        content = content.replace(new RegExp('\\s*</embed>\\s*', 'mg'), '</embed>');
     68                }
    6769
    68         // Unmark special paragraph closing tags
    69         content = content.replace(new RegExp('</p#>', 'g'), '</p>\n');
    70         content = content.replace(new RegExp('\\s*(<p [^>]+>.*</p>)', 'mg'), '\n$1');
     70                // Unmark special paragraph closing tags
     71                content = content.replace(new RegExp('</p#>', 'g'), '</p>\n');
     72                content = content.replace(new RegExp('\\s*(<p [^>]+>.*</p>)', 'mg'), '\n$1');
    7173
    72         // Trim whitespace
    73         content = content.replace(new RegExp('^\\s*', ''), '');
    74         content = content.replace(new RegExp('[\\s\\u00a0]*$', ''), '');
     74                // Trim whitespace
     75                content = content.replace(new RegExp('^\\s*', ''), '');
     76                content = content.replace(new RegExp('[\\s\\u00a0]*$', ''), '');
    7577
    76         // put back the line breaks in pre|script
    77         content = content.replace(/<wp_temp>/g, '\n');
     78                // put back the line breaks in pre|script
     79                content = content.replace(/<wp_temp>/g, '\n');
    7880
    79         // Hope.
    80         return content;
    81     },
     81                // Hope.
     82                return content;
     83        },
    8284
    83     go : function(id) {
    84         var ed = tinyMCE.get(id);
    85         var qt = document.getElementById('quicktags');
    86         var H = document.getElementById('edButtonHTML');
    87         var P = document.getElementById('edButtonPreview');
    88         var ta = document.getElementById(id);
    89         var ec = document.getElementById('editorcontainer');
     85        go : function(id) {
     86                var ed = tinyMCE.get(id);
     87                var qt = document.getElementById('quicktags');
     88                var H = document.getElementById('edButtonHTML');
     89                var P = document.getElementById('edButtonPreview');
     90                var ta = document.getElementById(id);
     91                var ec = document.getElementById('editorcontainer');
    9092
    91         if ( ! ed || ed.isHidden() ) {
    92             ta.style.color = '#fff';
     93                if ( ! ed || ed.isHidden() ) {
     94                        ta.style.color = '#fff';
    9395
    94             this.edToggle(P, H);
    95             edCloseAllTags(); // :-(
     96                        this.edToggle(P, H);
     97                        edCloseAllTags(); // :-(
    9698
    97             qt.style.display = 'none';
    98             ec.style.padding = '0px';
    99             ta.style.padding = '0px';
     99                        qt.style.display = 'none';
     100                        ec.style.padding = '0px';
     101                        ta.style.padding = '0px';
    100102
    101             ta.value = this.wpautop(ta.value);
     103                        ta.value = this.wpautop(ta.value);
    102104
    103             if ( ed ) ed.show();
    104             else tinyMCE.execCommand("mceAddControl", false, id);
     105                        if ( ed ) ed.show();
     106                        else tinyMCE.execCommand("mceAddControl", false, id);
    105107
    106             this.wpSetDefaultEditor('tinymce');
    107         } else {
    108             this.edToggle(H, P);
    109             ta.style.height = ed.getContentAreaContainer().offsetHeight + 6 + 'px';
     108                        this.wpSetDefaultEditor('tinymce');
     109                } else {
     110                        this.edToggle(H, P);
     111                        ta.style.height = ed.getContentAreaContainer().offsetHeight + 6 + 'px';
    110112
    111             ed.hide();
    112             qt.style.display = 'block';
     113                        ed.hide();
     114                        qt.style.display = 'block';
    113115
    114             if ( tinymce.isIE6 ) {
     116                        if ( tinymce.isIE6 ) {
    115117                                ta.style.width = '98%';
    116118                                ec.style.padding = '0px';
    … …  
    119121                                ta.style.width = '100%';
    120122                                ec.style.padding = '6px';
    121             }
     123                        }
    122124
    123             ta.style.color = '';
    124             this.wpSetDefaultEditor('html');
    125         }
    126     },
     125                        ta.style.color = '';
     126                        this.wpSetDefaultEditor('html');
     127                }
     128        },
    127129
    128     edToggle : function(A, B) {
    129         A.className = 'active';
    130         B.className = '';
     130        edToggle : function(A, B) {
     131                A.className = 'active';
     132                B.className = '';
    131133
    132         B.onclick = A.onclick;
    133         A.onclick = null;
    134     },
     134                B.onclick = A.onclick;
     135                A.onclick = null;
     136        },
    135137
    136     wpSetDefaultEditor : function(editor) {
    137         try {
    138             editor = escape( editor.toString() );
    139         } catch(err) {
    140             editor = 'tinymce';
    141         }
     138        wpSetDefaultEditor : function(editor) {
     139                try {
     140                        editor = escape( editor.toString() );
     141                } catch(err) {
     142                        editor = 'tinymce';
     143                }
    142144
    143         var userID = document.getElementById('user-id');
    144         var date = new Date();
    145         date.setTime(date.getTime()+(10*365*24*60*60*1000));
    146         document.cookie = "wordpress_editor_" + userID.value + "=" + editor + "; expires=" + date.toGMTString();
    147     },
     145                var userID = document.getElementById('user-id');
     146                var date = new Date();
     147                date.setTime(date.getTime()+(10*365*24*60*60*1000));
     148                document.cookie = "wordpress_editor_" + userID.value + "=" + editor + "; expires=" + date.toGMTString();
     149        },
    148150
    149     wpautop : function(pee) {
    150         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]';
     151        wpautop : function(pee) {
     152                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]';
    151153
    152         pee = pee + "\n\n";
    153         pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n");
    154         pee = pee.replace(new RegExp('(<(?:'+blocklist+')[^>]*>)', 'gi'), "\n$1");
    155         pee = pee.replace(new RegExp('(</(?:'+blocklist+')>)', 'gi'), "$1\n\n");
    156         pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n");
    157         pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n");
    158         pee = pee.replace(new RegExp('([\\s\\S]+?)\\n\\n', 'mg'), "<p>$1</p>\n");
    159         pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), '');
    160         pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
    161         pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1");
    162         pee = pee.replace(new RegExp('<p>\\s*<blockquote([^>]*)>', 'gi'), "<blockquote$1><p>");
    163         pee = pee.replace(new RegExp('</blockquote>\\s*</p>', 'gi'), '</p></blockquote>');
    164         pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)', 'gi'), "$1");
    165         pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
    166         pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n");
    167         pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1");
    168         pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1');
    169         pee = pee.replace(new RegExp('(?:<p>|<br ?/?>)*\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*(?:</p>|<br ?/?>)*', 'gi'), '[caption$1[/caption]');
    170         // pee = pee.replace(new RegExp('^((?:&nbsp;)*)\\s', 'mg'), '$1&nbsp;');
     154                pee = pee + "\n\n";
     155                pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n");
     156                pee = pee.replace(new RegExp('(<(?:'+blocklist+')[^>]*>)', 'gi'), "\n$1");
     157                pee = pee.replace(new RegExp('(</(?:'+blocklist+')>)', 'gi'), "$1\n\n");
     158                pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n");
     159                pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n");
     160                pee = pee.replace(new RegExp('([\\s\\S]+?)\\n\\n', 'mg'), "<p>$1</p>\n");
     161                pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), '');
     162                pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
     163                pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1");
     164                pee = pee.replace(new RegExp('<p>\\s*<blockquote([^>]*)>', 'gi'), "<blockquote$1><p>");
     165                pee = pee.replace(new RegExp('</blockquote>\\s*</p>', 'gi'), '</p></blockquote>');
     166                pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)', 'gi'), "$1");
     167                pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
     168                pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n");
     169                pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1");
     170                pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1');
     171                pee = pee.replace(new RegExp('(?:<p>|<br ?/?>)*\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*(?:</p>|<br ?/?>)*', 'gi'), '[caption$1[/caption]');
     172                // pee = pee.replace(new RegExp('^((?:&nbsp;)*)\\s', 'mg'), '$1&nbsp;');
    171173
    172         // Fix the pre|script tags
    173         pee = pee.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
     174                // Fix the pre|script tags
     175                pee = pee.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
    174176                        a = a.replace(/<br ?\/?>[\r\n]*/g, '\n');
    175177                        return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '\n');
    176         });
     178                });
    177179
    178             return pee;
    179     }
     180                return pee;
     181        }
    180182}
  • trunk/wp-admin/post.php

    r8691 r8720  
    131131        wp_enqueue_script('media-upload');
    132132        wp_enqueue_script('word-count');
     133        wp_enqueue_script( 'admin-comments' );
    133134
    134135        if ( current_user_can('edit_post', $post_ID) ) {
  • trunk/wp-admin/upload.php

    r8682 r8720  
    1010require_once('admin.php');
    1111add_thickbox();
    12 wp_enqueue_script('media-upload');
     12wp_enqueue_script( 'media-upload' );
     13wp_enqueue_script( 'quicktags' );
    1314
    1415if (!current_user_can('upload_files'))
    … …  
    264265</div>
    265266
    266 <?php include('admin-footer.php'); ?>
     267<?php
     268wp_comment_reply();
     269include('admin-footer.php');
     270?>
  • trunk/wp-admin/wp-admin.css

    r8700 r8720  
    321321}
    322322
    323 #ed_toolbar input {
     323#ed_toolbar input,
     324#ed_reply_toolbar input {
    324325        margin: 3px 2px 2px;
    325326        padding: 2px 4px;
    … …  
    328329}
    329330
    330 #quicktags #ed_strong {
     331#quicktags #ed_strong,
     332#ed_reply_toolbar #ed_reply_strong {
    331333        font-weight: bold;
    332334}
    333335
    334 #quicktags #ed_link {
     336#quicktags #ed_link,
     337#ed_reply_toolbar #ed_reply_link {
    335338        text-decoration: underline;
    336339}
    337340
    338 #quicktags #ed_del {
     341#quicktags #ed_del,
     342#ed_reply_toolbar #ed_reply_del {
    339343        text-decoration: line-through;
    340344}
    341345
    342 #quicktags #ed_em {
     346#quicktags #ed_em,
     347#ed_reply_toolbar #ed_reply_em {
    343348        font-style: italic;
    344349}
    345350
    346 #quicktags #ed_code {
     351#quicktags #ed_code,
     352#ed_reply_toolbar #ed_reply_code {
    347353        font-family: "Courier New", Courier, mono;
    348354        font-size: 1.1em;
    … …  
    503509}
    504510
     511.comment-column p {
     512        margin-top: 0;
     513}
     514
    505515.comment-column {
    506516        width: 50%;
    507 }
    508 
    509 .comment-column p {
    510         margin-top: 0;
    511517}
    512518
    … …  
    17611767        line-height: 2;
    17621768        margin: 0;
    1763         padding: 0 7px;
     1769        padding: 4px 8px;
     1770        font: 18px Georgia, "Times New Roman", Times, serif;
    17641771}
    17651772
    … …  
    18101817}
    18111818
    1812 
    1813 /* fixed bottom bar */
    1814 .postarea h3 label {
    1815 
    1816 }
    1817 
    1818 #footer {
    1819         z-index: -1;
    1820 }
    1821 
    1822 #fixedbar {
    1823         bottom:0pt;
    1824         height:80px;
    1825         position:fixed;
    1826         width:100%;
    1827         z-index: 100;
    1828 }
    1829 
    1830 #fixedbar #submitpost {
    1831        
    1832 }
    1833 
    1834 #fixedbar .submit {
    1835         padding-top: 10px;
    1836 }
    1837 
    1838 #fixedbar .button {
    1839         border: none;
    1840         -moz-border-radius: 6px;
    1841         -khtml-border-radius: 6px;
    1842         -webkit-border-radius: 6px;
    1843         border-radius: 6px;
    1844 }
    1845 
    1846 #fixedbar .button:hover {
    1847         background: #fff;
    1848 }
    1849 
    1850 #fixedbar #publish {
    1851         font-weight:bold;
    1852         width:160px;
    1853 }
    1854 
    1855 #fixedbar #save-post {
    1856         width:80px;
    1857         font-weight:normal;
    1858 }
    1859 
    1860 #fixedbar .submitbox {
    1861         padding: 14px 18px;
    1862         border-left: 1px solid #aaa;
    1863         width: 690px;
    1864 }
    1865 
    1866 #fixedbar #post-time-info,
    1867 #fixedbar #comment-time-info {
    1868         margin-top: 16px;
    1869 }
    1870 
    1871 #fixedbar #timestampdiv input,
    1872 #fixedbar #timestampdiv select {
    1873         background-color:#464646;
    1874         border:1px solid #777777;
    1875         color:#CCCCCC;
    1876         padding:2px;
    1877 }
    1878 
    1879 #fixedbar-wrap {
    1880         width: 100%;
    1881 }
    1882 
    1883 #preview-link {
    1884         text-align: right;
    1885 }
    1886 
    1887 #preview-link a {
    1888         padding-right:10px;
    1889 }
    1890 
    18911819p#post-search-prep {
    1892         margin:0pt;
    1893         position:absolute;
    1894         right:20px;
    1895         top:50px;
     1820        margin: 0;
     1821        position: absolute;
     1822        right: 20px;
     1823        top: 50px;
    18961824}
    18971825
    … …  
    19161844
    19171845/* media popup 0819 */
    1918 
    19191846#sidemenu {
    19201847        margin: -30px 15px 0 315px;
    … …  
    20011928        width:200px;
    20021929}
     1930
     1931/* reply to comments */
     1932#replydiv {
     1933        width: 700px;
     1934        border-color: #EBEBEB #CCCCCC #CCCCCC #EBEBEB;
     1935        border-width: 1px;
     1936        border-style: solid;
     1937        padding: 2px;
     1938        background-color: #fff;
     1939        left: 20px;
     1940        top: 300px;
     1941}
     1942
     1943#replydiv #editorcontainer {
     1944        border: 0 none;
     1945}
     1946
     1947#replysubmit {
     1948        margin: 0;
     1949        padding: 3px 5px;
     1950        background-color: #EAF3FA;
     1951        border-top: 1px solid #ddd;
     1952}
     1953
     1954#replydiv #editor-toolbar {
     1955        display: none;
     1956}
     1957
     1958#replydiv #replyhandle {
     1959        cursor: move;
     1960        margin: 0;
     1961        font-size: 14px;
     1962        font-weight: bold;
     1963        padding: 7px;
     1964}
     1965
     1966#replycontainer {
     1967        padding: 6px;
     1968        border: 0 none;
     1969        height: 100%;
     1970        overflow: hidden;
     1971}
     1972
     1973#replycontent {
     1974        resize: none;
     1975        margin: 0;
     1976        width: 100%;
     1977        height: 100%;
     1978        padding: 0;
     1979        line-height: 150%;
     1980        border: 0 none;
     1981        outline: none;
     1982}
     1983
     1984#ed_reply_toolbar {
     1985        margin: 0;
     1986        padding: 2px 4px;
     1987}
     1988
     1989#replyerror {
     1990        border: 5px solid #ddd;
     1991        background-color: #f8f8f8;
     1992        position: absolute;
     1993        padding: 15px 15px 10px;
     1994        width: 500px;
     1995        z-index: 1000;
     1996        display: none;
     1997}
     1998
     1999#replyerror img {
     2000        float: right;
     2001        margin: 15px;
     2002}
     2003
     2004#replyerror p.submit {
     2005        padding: 10px 0 0;
     2006}
     2007
     2008#replyerror .error {
     2009        margin: 15px 0 0;
     2010}
  • trunk/wp-comments-post.php

    r8149 r8720  
    6767        wp_die( __('Error: please type a comment.') );
    6868
    69 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'user_ID');
     69$comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0;
     70
     71$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');
    7072
    7173$comment_id = wp_new_comment( $commentdata );
  • trunk/wp-includes/comment.php

    r8622 r8720  
    392392                $dupe .= "OR comment_author_email = '$comment_author_email' ";
    393393        $dupe .= ") AND comment_content = '$comment_content' LIMIT 1";
    394         if ( $wpdb->get_var($dupe) )
     394        if ( $wpdb->get_var($dupe) ) {
     395                if ( defined('DOING_AJAX') )
     396                        die( __('Duplicate comment detected; it looks as though you\'ve already said that!') );
     397
    395398                wp_die( __('Duplicate comment detected; it looks as though you\'ve already said that!') );
     399        }
    396400
    397401        do_action( 'check_comment_flood', $comment_author_IP, $comment_author_email, $comment_date_gmt );
    … …  
    444448                if ( $flood_die ) {
    445449                        do_action('comment_flood_trigger', $time_lastcomment, $time_newcomment);
     450
     451                        if ( defined('DOING_AJAX') )
     452                                die( __('You are posting comments too quickly.  Slow down.') );
     453
    446454                        wp_die( __('You are posting comments too quickly.  Slow down.') );
    447455                }
    … …  
    753761        $commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
    754762        $commentdata['user_ID']         = (int) $commentdata['user_ID'];
     763
     764        $commentdata['comment_parent'] = absint($commentdata['comment_parent']);
     765        $parent_status = ( 0 < $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : '';
     766        $commentdata['comment_parent'] = ( 'approved' == $parent_status || 'unapproved' == $parent_status ) ? $commentdata['comment_parent'] : 0;
    755767
    756768        $commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '',$_SERVER['REMOTE_ADDR'] );
  • trunk/wp-includes/general-template.php

    r8691 r8720  
    956956        $rows = "rows='$rows'"; ?>
    957957        <div id="editor-toolbar">
    958         <?php if ( user_can_richedit() ) {
     958        <?php if ( user_can_richedit() && $media_buttons ) {
    959959                $wp_default_editor = wp_default_editor(); ?>
    960960                <div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('<?php echo $id; ?>')" /></div>
    … …  
    968968                        <a id="edButtonPreview" onclick="switchEditors.go('<?php echo $id; ?>');"><?php _e('Visual'); ?></a>
    969969                <?php }
    970         }
     970        } else
     971                add_filter('the_editor_content', 'wp_htmledit_pre');
    971972
    972973/*      if ( $media_buttons ) { ?>
    … …  
    982983        </div>
    983984
    984     <?php if ( 'html' != $wp_default_editor ) : ?>
    985     <script type="text/javascript">
    986     // <![CDATA[
    987         if ( typeof tinyMCE != "undefined" )
    988             document.getElementById("quicktags").style.display="none";
    989     // ]]>
    990     </script>
    991     <?php endif; // 'html' != $wp_default_editor
    992 
    993         $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");
     985        <?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");
    994986        $the_editor_content = apply_filters('the_editor_content', $content);
    995987
    … …  
    997989
    998990        ?>
    999     <script type="text/javascript">
    1000     // <![CDATA[
    1001     edCanvas = document.getElementById('<?php echo $id; ?>');
    1002     <?php if ( $prev_id && user_can_richedit() ) : ?>
    1003     // If tinyMCE is defined.
    1004     if ( typeof tinyMCE != 'undefined' ) {
    1005     // This code is meant to allow tabbing from Title to Post (TinyMCE).
    1006         document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e) {
    1007             e = e || window.event;
    1008             if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
    1009                 if ( tinyMCE.activeEditor ) {
    1010                     if ( (jQuery("#post_ID").val() < 1) && (jQuery("#title").val().length > 0) ) { autosave(); }
    1011                     e = null;
    1012                     if ( tinyMCE.activeEditor.isHidden() ) return true;
    1013                     tinyMCE.activeEditor.focus();
    1014                     return false;
    1015                 }
    1016                 return true;
    1017             }
    1018         }
    1019     }
    1020     <?php endif; ?>
    1021     // ]]>
    1022     </script>
    1023     <?php
     991        <script type="text/javascript">
     992        // <![CDATA[
     993        edCanvas = document.getElementById('<?php echo $id; ?>');
     994        <?php if ( user_can_richedit() && $prev_id ) { ?>
     995        // If tinyMCE is defined.
     996        if ( typeof tinyMCE != 'undefined' ) {
     997                // This code is meant to allow tabbing from Title to Post (TinyMCE).
     998                document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e) {
     999                        e = e || window.event;
     1000                        if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
     1001                                if ( tinyMCE.activeEditor ) {
     1002                                        if ( (jQuery("#post_ID").val() < 1) && (jQuery("#title").val().length > 0) ) { autosave(); }
     1003                                        e = null;
     1004                                        if ( tinyMCE.activeEditor.isHidden() ) return true;
     1005                                        tinyMCE.activeEditor.focus();
     1006                                        return false;
     1007                                }
     1008                                return true;
     1009                        }
     1010                }
     1011        }
     1012        <?php } ?>
     1013        // ]]>
     1014        </script>
     1015        <?php
    10241016}
    10251017
  • trunk/wp-includes/js/quicktags.js

    r7130 r8720  
    388388        }
    389389}
     390
     391
     392// Allow multiple instances.
     393// Name = unique value, id = textarea id, container = container div.
     394// Can disable some buttons by passing comma delimited string as 4th param.
     395var QTags = function(name, id, container, disabled) {
     396        var t = this;
     397
     398        t.Buttons = [];
     399        t.Links = [];
     400        t.OpenTags = [];
     401        t.Canvas = document.getElementById(id);
     402
     403        disabled = ( typeof disabled != 'undefined' ) ? ','+disabled+',' : '';
     404
     405        t.edShowButton = function(button, i) {
     406                if ( disabled && (disabled.indexOf(','+button.display+',') != -1) )
     407                        return '';
     408                else if ( button.id == name+'_img' )
     409                        return '<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertImage('+name+'.Canvas);" value="' + button.display + '" />';
     410                else if (button.id == name+'_link')
     411                        return '<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="'+name+'.edInsertLink('+i+');" value="'+button.display+'" />';
     412                else
     413                        return '<input type="button" id="' + button.id + '" accesskey="'+button.access+'" class="ed_button" onclick="'+name+'.edInsertTag('+i+');" value="'+button.display+'" />';
     414        };
     415
     416        t.edAddTag = function(button) {
     417                if ( t.Buttons[button].tagEnd != '' ) {
     418                        t.OpenTags[t.OpenTags.length] = button;
     419                        document.getElementById(t.Buttons[button].id).value = '/' + document.getElementById(t.Buttons[button].id).value;
     420                }
     421        };
     422
     423        t.edRemoveTag = function(button) {
     424                for ( var i = 0; i < t.OpenTags.length; i++ ) {
     425                        if ( t.OpenTags[i] == button ) {
     426                                t.OpenTags.splice(i, 1);
     427                                document.getElementById(t.Buttons[button].id).value = document.getElementById(t.Buttons[button].id).value.replace('/', '');
     428                        }
     429                }
     430        };
     431
     432        t.edCheckOpenTags = function(button) {
     433                var tag = 0;
     434                for ( var i = 0; i < t.OpenTags.length; i++ ) {
     435                        if ( t.OpenTags[i] == button )
     436                                tag++;
     437                }
     438                if ( tag > 0 ) return true; // tag found
     439                else return false; // tag not found
     440        };
     441
     442        this.edCloseAllTags = function() {
     443                var count = t.OpenTags.length;
     444                for ( var o = 0; o < count; o++ )
     445                        t.edInsertTag(t.OpenTags[t.OpenTags.length - 1]);
     446        };
     447
     448        this.edQuickLink = function(i, thisSelect) {
     449                if ( i > -1 ) {
     450                        var newWin = '';
     451                        if ( Links[i].newWin == 1 ) {
     452                                newWin = ' target="_blank"';
     453                        }
     454                        var tempStr = '<a href="' + Links[i].URL + '"' + newWin + '>'
     455                                    + Links[i].display
     456                                    + '</a>';
     457                        thisSelect.selectedIndex = 0;
     458                        edInsertContent(t.Canvas, tempStr);
     459                } else {
     460                        thisSelect.selectedIndex = 0;
     461                }
     462        };
     463
     464        // insertion code
     465        t.edInsertTag = function(i) {
     466                //IE support
     467                if ( document.selection ) {
     468                        t.Canvas.focus();
     469                    sel = document.selection.createRange();
     470                        if ( sel.text.length > 0 ) {
     471                                sel.text = t.Buttons[i].tagStart + sel.text + t.Buttons[i].tagEnd;
     472                        } else {
     473                                if ( ! t.edCheckOpenTags(i) || t.Buttons[i].tagEnd == '' ) {
     474                                        sel.text = t.Buttons[i].tagStart;
     475                                        t.edAddTag(i);
     476                                } else {
     477                                        sel.text = t.Buttons[i].tagEnd;
     478                                        t.edRemoveTag(i);
     479                                }
     480                        }
     481                        t.Canvas.focus();
     482                } else if ( t.Canvas.selectionStart || t.Canvas.selectionStart == '0' ) { //MOZILLA/NETSCAPE support
     483                        var startPos = t.Canvas.selectionStart;
     484                        var endPos = t.Canvas.selectionEnd;
     485                        var cursorPos = endPos;
     486                        var scrollTop = t.Canvas.scrollTop;
     487
     488                        if ( startPos != endPos ) {
     489                                t.Canvas.value = t.Canvas.value.substring(0, startPos)
     490                                              + t.Buttons[i].tagStart
     491                                              + t.Canvas.value.substring(startPos, endPos)
     492                                              + t.Buttons[i].tagEnd
     493                                              + t.Canvas.value.substring(endPos, t.Canvas.value.length);
     494                                cursorPos += t.Buttons[i].tagStart.length + t.Buttons[i].tagEnd.length;
     495                        } else {
     496                                if ( !t.edCheckOpenTags(i) || t.Buttons[i].tagEnd == '' ) {
     497                                        t.Canvas.value = t.Canvas.value.substring(0, startPos)
     498                                                      + t.Buttons[i].tagStart
     499                                                      + t.Canvas.value.substring(endPos, t.Canvas.value.length);
     500                                        t.edAddTag(i);
     501                                        cursorPos = startPos + t.Buttons[i].tagStart.length;
     502                                } else {
     503                                        t.Canvas.value = t.Canvas.value.substring(0, startPos)
     504                                                      + t.Buttons[i].tagEnd
     505                                                      + t.Canvas.value.substring(endPos, t.Canvas.value.length);
     506                                        t.edRemoveTag(i);
     507                                        cursorPos = startPos + t.Buttons[i].tagEnd.length;
     508                                }
     509                        }
     510                        t.Canvas.focus();
     511                        t.Canvas.selectionStart = cursorPos;
     512                        t.Canvas.selectionEnd = cursorPos;
     513                        t.Canvas.scrollTop = scrollTop;
     514                } else {
     515                        if ( ! t.edCheckOpenTags(i) || t.Buttons[i].tagEnd == '' ) {
     516                                t.Canvas.value += Buttons[i].tagStart;
     517                                t.edAddTag(i);
     518                        } else {
     519                                t.Canvas.value += Buttons[i].tagEnd;
     520                                t.edRemoveTag(i);
     521                        }
     522                        t.Canvas.focus();
     523                }
     524        };
     525
     526        this.edInsertLink = function(i, defaultValue) {
     527                if ( ! defaultValue )
     528                        defaultValue = 'http://';
     529
     530                if ( ! t.edCheckOpenTags(i) ) {
     531                        var URL = prompt(quicktagsL10n.enterURL, defaultValue);
     532                        if ( URL ) {
     533                                t.Buttons[i].tagStart = '<a href="' + URL + '">';
     534                                t.edInsertTag(i);
     535                        }
     536                } else {
     537                        t.edInsertTag(i);
     538                }
     539        };
     540
     541        this.edInsertImage = function() {
     542                var myValue = prompt(quicktagsL10n.enterImageURL, 'http://');
     543                if ( myValue ) {
     544                        myValue = '<img src="'
     545                                        + myValue
     546                                        + '" alt="' + prompt(quicktagsL10n.enterImageDescription, '')
     547                                        + '" />';
     548                        edInsertContent(t.Canvas, myValue);
     549                }
     550        };
     551
     552        t.Buttons[t.Buttons.length] = new edButton(name+'_strong','b','<strong>','</strong>','b');
     553        t.Buttons[t.Buttons.length] = new edButton(name+'_em','i','<em>','</em>','i');
     554        t.Buttons[t.Buttons.length] = new edButton(name+'_link','link','','</a>','a'); // special case
     555        t.Buttons[t.Buttons.length] = new edButton(name+'_block','b-quote','\n\n<blockquote>','</blockquote>\n\n','q');
     556        t.Buttons[t.Buttons.length] = new edButton(name+'_del','del','<del datetime="' + datetime + '">','</del>','d');
     557        t.Buttons[t.Buttons.length] = new edButton(name+'_ins','ins','<ins datetime="' + datetime + '">','</ins>','s');
     558        t.Buttons[t.Buttons.length] = new edButton(name+'_img','img','','','m',-1); // special case
     559        t.Buttons[t.Buttons.length] = new edButton(name+'_ul','ul','<ul>\n','</ul>\n\n','u');
     560        t.Buttons[t.Buttons.length] = new edButton(name+'_ol','ol','<ol>\n','</ol>\n\n','o');
     561        t.Buttons[t.Buttons.length] = new edButton(name+'_li','li','\t<li>','</li>\n','l');
     562        t.Buttons[t.Buttons.length] = new edButton(name+'_code','code','<code>','</code>','c');
     563        t.Buttons[t.Buttons.length] = new edButton(name+'_more','more','<!--more-->','','t',-1);
     564//      t.Buttons[t.Buttons.length] = new edButton(name+'_next','page','<!--nextpage-->','','p',-1);
     565
     566        var tb = document.createElement('div');
     567        tb.id = name+'_qtags';
     568
     569        var html = '<div id="'+name+'_toolbar">';
     570        for (var i = 0; i < t.Buttons.length; i++)
     571                html += t.edShowButton(t.Buttons[i], i);
     572
     573        html += '<input type="button" id="'+name+'_ed_spell" class="ed_button" onclick="edSpell('+name+'.Canvas);" title="' + quicktagsL10n.dictionaryLookup + '" value="' + quicktagsL10n.lookup + '" />';
     574        html += '<input type="button" id="'+name+'_ed_close" class="ed_button" onclick="'+name+'.edCloseAllTags();" title="' + quicktagsL10n.closeAllOpenTags + '" value="' + quicktagsL10n.closeTags + '" /></div>';
     575
     576        tb.innerHTML = html;
     577        var cont = document.getElementById(container);
     578        cont.parentNode.insertBefore(tb, cont);
     579
     580};
  • trunk/wp-includes/script-loader.php

    r8691 r8720  
    1616        $scripts->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' );
    1717
    18         $scripts->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '3958' );
     18        $scripts->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '20080823' );
    1919        $scripts->localize( 'quicktags', 'quicktagsL10n', array(
    2020                'quickLinks' => __('(Quick Links)'),
    … …  
    3535        $scripts->add( 'editor', false, $visual_editor, '20080321' );
    3636
    37         $scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080710' );
     37        $scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080823' );
    3838
    3939        // Modify this version when tinyMCE plugins are changed.
    … …  
    104104        $scripts->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery-ui-core'), '1.5.2' );
    105105        $scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core'), '1.5.2' );
     106        $scripts->add( 'jquery-ui-draggable', '/wp-includes/js/jquery/ui.draggable.js', array('jquery-ui-core'), '1.5.2' );
     107        $scripts->add( 'jquery-ui-resizable', '/wp-includes/js/jquery/ui.resizable.js', array('jquery-ui-core'), '1.5.2' );
     108        $scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable'), '1.5.2' );
    106109
    107110        if ( is_admin() ) {
    … …  
    121124                        'strong' => __('Strong')
    122125                ) );
    123                 $scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20080311' );
     126                $scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-draggable', 'jquery-ui-resizable'), '20080821' );
    124127                $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
    125128                        'pending' => __('%i% pending') // must look like: "# blah blah"
  • trunk/xmlrpc.php

    r8698 r8720  
    10891089                        }
    10901090                }
     1091
     1092                $comment['comment_parent'] = isset($content_struct['comment_parent']) ? absint($content_struct['comment_parent']) : 0;
    10911093
    10921094                $comment['comment_content'] = $content_struct['content'];
Note: See TracChangeset for help on using the changeset viewer.