~canonical-sysadmins/wordpress/3.9.x

« back to all changes in this revision

Viewing changes to wp-admin/includes/post.php

  • Committer: Chris Jones
  • Date: 2010-01-19 13:17:33 UTC
  • Revision ID: cmsj@tenshu.net-20100119131733-rf31jv9k1v0xzo2h
[CJ] Import wordpress 2.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
236
236
                        wp_die( __('You are not allowed to edit posts.') );
237
237
        }
238
238
 
 
239
        if ( -1 == $post_data['_status'] ) {
 
240
                $post_data['post_status'] = null;
 
241
                unset($post_data['post_status']);
 
242
        } else {
 
243
                $post_data['post_status'] = $post_data['_status'];
 
244
        }
 
245
        unset($post_data['_status']);
 
246
 
239
247
        $post_IDs = array_map( 'intval', (array) $post_data['post'] );
240
248
 
241
249
        $reset = array( 'post_author', 'post_status', 'post_password', 'post_parent', 'page_template', 'comment_status', 'ping_status', 'keep_private', 'tags_input', 'post_category', 'sticky' );
298
306
                $post_data['ID'] = $post_ID;
299
307
                $updated[] = wp_update_post( $post_data );
300
308
 
301
 
                if ( current_user_can( 'edit_others_posts' ) && isset( $post_data['sticky'] ) ) {
 
309
                if ( isset( $post_data['sticky'] ) && current_user_can( 'edit_others_posts' ) ) {
302
310
                        if ( 'sticky' == $post_data['sticky'] )
303
311
                                stick_post( $post_ID );
304
312
                        else
318
326
 * @return unknown
319
327
 */
320
328
function get_default_post_to_edit() {
 
329
 
 
330
        $post_title = '';
321
331
        if ( !empty( $_REQUEST['post_title'] ) )
322
332
                $post_title = esc_html( stripslashes( $_REQUEST['post_title'] ));
323
 
        else if ( !empty( $_REQUEST['popuptitle'] ) ) {
324
 
                $post_title = esc_html( stripslashes( $_REQUEST['popuptitle'] ));
325
 
                $post_title = funky_javascript_fix( $post_title );
326
 
        } else {
327
 
                $post_title = '';
328
 
        }
329
333
 
330
334
        $post_content = '';
331
335
        if ( !empty( $_REQUEST['content'] ) )
332
336
                $post_content = esc_html( stripslashes( $_REQUEST['content'] ));
333
 
        else if ( !empty( $post_title ) ) {
334
 
                $text       = esc_html( stripslashes( urldecode( $_REQUEST['text'] ) ) );
335
 
                $text       = funky_javascript_fix( $text);
336
 
                $popupurl   = esc_url($_REQUEST['popupurl']);
337
 
                $post_content = '<a href="'.$popupurl.'">'.$post_title.'</a>'."\n$text";
338
 
        }
339
337
 
 
338
        $post_excerpt = '';
340
339
        if ( !empty( $_REQUEST['excerpt'] ) )
341
340
                $post_excerpt = esc_html( stripslashes( $_REQUEST['excerpt'] ));
342
 
        else
343
 
                $post_excerpt = '';
344
341
 
345
342
        $post->ID = 0;
346
343
        $post->post_name = '';
562
559
 
563
560
        $metakeyselect = isset($_POST['metakeyselect']) ? stripslashes( trim( $_POST['metakeyselect'] ) ) : '';
564
561
        $metakeyinput = isset($_POST['metakeyinput']) ? stripslashes( trim( $_POST['metakeyinput'] ) ) : '';
565
 
        $metavalue = isset($_POST['metavalue']) ? maybe_serialize( stripslashes( trim( $_POST['metavalue'] ) ) ) : '';
 
562
        $metavalue = isset($_POST['metavalue']) ? maybe_serialize( stripslashes_deep( $_POST['metavalue'] ) ) : '';
 
563
        if ( is_string($metavalue) )
 
564
                $metavalue = trim( $metavalue );
566
565
 
567
566
        if ( ('0' === $metavalue || !empty ( $metavalue ) ) && ((('#NONE#' != $metakeyselect) && !empty ( $metakeyselect) ) || !empty ( $metakeyinput) ) ) {
568
567
                // We have a key/value pair. If both the select and the
580
579
                wp_cache_delete($post_ID, 'post_meta');
581
580
 
582
581
                $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->postmeta (post_id,meta_key,meta_value ) VALUES (%s, %s, %s)", $post_ID, $metakey, $metavalue) );
 
582
                do_action( 'added_postmeta', $wpdb->insert_id, $post_ID, $metakey, $metavalue );
 
583
 
583
584
                return $wpdb->insert_id;
584
585
        }
585
586
        return false;
598
599
        $mid = (int) $mid;
599
600
 
600
601
        $post_id = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
 
602
 
 
603
        do_action( 'delete_postmeta', $mid );
601
604
        wp_cache_delete($post_id, 'post_meta');
 
605
        $rval = $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
 
606
        do_action( 'deleted_postmeta', $mid );
602
607
 
603
 
        return $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
 
608
        return $rval;
604
609
}
605
610
 
606
611
/**
681
686
                return false;
682
687
 
683
688
        $post_id = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = %d", $meta_id) );
684
 
        wp_cache_delete($post_id, 'post_meta');
685
689
 
686
 
        $meta_value = maybe_serialize( stripslashes( $meta_value ) );
 
690
        $meta_value = maybe_serialize( stripslashes_deep( $meta_value ) );
687
691
        $meta_id = (int) $meta_id;
688
692
 
689
693
        $data  = compact( 'meta_key', 'meta_value' );
690
694
        $where = compact( 'meta_id' );
691
695
 
692
 
        return $wpdb->update( $wpdb->postmeta, $data, $where );
 
696
        do_action( 'update_postmeta', $meta_id, $post_id, $meta_key, $meta_value );
 
697
        $rval = $wpdb->update( $wpdb->postmeta, $data, $where );
 
698
        wp_cache_delete($post_id, 'post_meta');
 
699
        do_action( 'updated_postmeta', $meta_id, $post_id, $meta_key, $meta_value );
 
700
 
 
701
        return $rval;
693
702
}
694
703
 
695
704
//
706
715
 * @return unknown
707
716
 */
708
717
function _fix_attachment_links( $post_ID ) {
 
718
        global $_fix_attachment_link_id;
709
719
 
710
720
        $post = & get_post( $post_ID, ARRAY_A );
711
721
 
733
743
                }
734
744
 
735
745
                $post_search[$i] = $anchor;
736
 
                $post_replace[$i] = preg_replace( "#href=(\"|')[^'\"]*\\1#e", "stripslashes( 'href=\\1' ).get_attachment_link( $id ).stripslashes( '\\1' )", $anchor );
 
746
                 $_fix_attachment_link_id = $id;
 
747
                $post_replace[$i] = preg_replace_callback( "#href=(\"|')[^'\"]*\\1#", '_fix_attachment_links_replace_cb', $anchor );
737
748
                ++$i;
738
749
        }
739
750
 
745
756
        return wp_update_post( $post);
746
757
}
747
758
 
 
759
function _fix_attachment_links_replace_cb($match) {
 
760
        global $_fix_attachment_link_id;
 
761
        return stripslashes( 'href='.$match[1] ).get_attachment_link( $_fix_attachment_link_id ).stripslashes( $match[1] );
 
762
}
 
763
 
748
764
/**
749
765
 * Move child posts to a new parent.
750
766
 *
759
775
        global $wpdb;
760
776
        $old_ID = (int) $old_ID;
761
777
        $new_ID = (int) $new_ID;
762
 
        return $wpdb->update($wpdb->posts, array('post_parent' => $new_ID), array('post_parent' => $old_ID) );
 
778
 
 
779
        $children = $wpdb->get_col( $wpdb->prepare("
 
780
                SELECT post_id
 
781
                FROM $wpdb->postmeta
 
782
                WHERE meta_key = '_wp_attachment_temp_parent'
 
783
                AND meta_value = %d", $old_ID) );
 
784
 
 
785
        foreach ( $children as $child_id ) {
 
786
                $wpdb->update($wpdb->posts, array('post_parent' => $new_ID), array('ID' => $child_id) );
 
787
                delete_post_meta($child_id, '_wp_attachment_temp_parent');
 
788
        }
763
789
}
764
790
 
765
791
/**
795
821
                                'pending' => array(_x('Pending Review', 'post'), __('Pending posts'), _n_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>')),
796
822
                                'draft' => array(_x('Draft', 'post'), _x('Drafts', 'manage posts header'), _n_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>')),
797
823
                                'private' => array(_x('Private', 'post'), __('Private posts'), _n_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>')),
 
824
                                'trash' => array(_x('Trash', 'post'), __('Trash posts'), _n_noop('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>')),
798
825
                        );
799
826
 
800
827
        $post_stati = apply_filters('post_stati', $post_stati);
818
845
                $orderby = 'date';
819
846
        }
820
847
 
821
 
        $posts_per_page = get_user_option('edit_per_page');
822
 
        if ( empty($posts_per_page) )
 
848
        $posts_per_page = (int) get_user_option( 'edit_per_page', 0, false );
 
849
        if ( empty( $posts_per_page ) || $posts_per_page < 1 )
823
850
                $posts_per_page = 15;
824
 
        $posts_per_page = apply_filters('edit_posts_per_page', $posts_per_page);
 
851
        $posts_per_page = apply_filters( 'edit_posts_per_page', $posts_per_page );
825
852
 
826
853
        wp("post_type=post&$post_status_q&posts_per_page=$posts_per_page&order=$order&orderby=$orderby");
827
854
 
829
856
}
830
857
 
831
858
/**
 
859
 * Get default post mime types
 
860
 *
 
861
 * @since 2.9.0
 
862
 *
 
863
 * @return array
 
864
 */
 
865
function get_post_mime_types() {
 
866
        $post_mime_types = array(       //      array( adj, noun )
 
867
                'image' => array(__('Images'), __('Manage Images'), _n_noop('Image <span class="count">(%s)</span>', 'Images <span class="count">(%s)</span>')),
 
868
                'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio <span class="count">(%s)</span>', 'Audio <span class="count">(%s)</span>')),
 
869
                'video' => array(__('Video'), __('Manage Video'), _n_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')),
 
870
        );
 
871
 
 
872
        return apply_filters('post_mime_types', $post_mime_types);
 
873
}
 
874
 
 
875
/**
832
876
 * {@internal Missing Short Description}}
833
877
 *
834
878
 * @since unknown
858
902
        $q['m']   = isset( $q['m'] ) ? (int) $q['m'] : 0;
859
903
        $q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0;
860
904
        $q['post_type'] = 'attachment';
861
 
        $q['post_status'] = 'any';
862
 
        $media_per_page = get_user_option('upload_per_page');
863
 
        if ( empty($media_per_page) )
 
905
        $q['post_status'] = isset( $q['status'] ) && 'trash' == $q['status'] ? 'trash' : 'inherit';
 
906
        $media_per_page = (int) get_user_option( 'upload_per_page', 0, false );
 
907
        if ( empty( $media_per_page ) || $media_per_page < 1 )
864
908
                $media_per_page = 20;
865
 
        $q['posts_per_page'] = $media_per_page;
866
 
        $post_mime_types = array(       //      array( adj, noun )
867
 
                                'image' => array(__('Images'), __('Manage Images'), _n_noop('Image <span class="count">(%s)</span>', 'Images <span class="count">(%s)</span>')),
868
 
                                'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio <span class="count">(%s)</span>', 'Audio <span class="count">(%s)</span>')),
869
 
                                'video' => array(__('Video'), __('Manage Video'), _n_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')),
870
 
                        );
871
 
        $post_mime_types = apply_filters('post_mime_types', $post_mime_types);
 
909
        $q['posts_per_page'] = apply_filters( 'upload_per_page', $media_per_page );
872
910
 
 
911
        $post_mime_types = get_post_mime_types();
873
912
        $avail_post_mime_types = get_available_post_mime_types('attachment');
874
913
 
875
914
        if ( isset($q['post_mime_type']) && !array_intersect( (array) $q['post_mime_type'], array_keys($post_mime_types) ) )
906
945
 *
907
946
 * @since unknown
908
947
 *
909
 
 * @param unknown_type $id
910
 
 * @param unknown_type $title
911
 
 * @param unknown_type $name
912
 
 * @return unknown
 
948
 * @param int|object $id    Post ID or post object. 
 
949
 * @param string $title (optional) Title 
 
950
 * @param string $name (optional) Name 
 
951
 * @return array With two entries of type string 
913
952
 */
914
 
function get_sample_permalink($id, $title=null, $name = null) {
 
953
function get_sample_permalink($id, $title = null, $name = null) {
915
954
        $post = &get_post($id);
916
955
        if (!$post->ID) {
917
956
                return array('', '');
924
963
        // drafts, so we will fake, that our post is published
925
964
        if (in_array($post->post_status, array('draft', 'pending'))) {
926
965
                $post->post_status = 'publish';
927
 
                $post->post_name = sanitize_title($post->post_name? $post->post_name : $post->post_title, $post->ID);
 
966
                $post->post_name = sanitize_title($post->post_name ? $post->post_name : $post->post_title, $post->ID);
928
967
        }
929
968
 
930
969
        $post->post_name = wp_unique_post_slug($post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent);
932
971
        // If the user wants to set a new name -- override the current one
933
972
        // Note: if empty name is supplied -- use the title instead, see #6072
934
973
        if (!is_null($name)) {
935
 
                $post->post_name = sanitize_title($name? $name : $title, $post->ID);
 
974
                $post->post_name = sanitize_title($name ? $name : $title, $post->ID);
936
975
        }
937
976
 
938
977
        $post->filter = 'sample';
960
999
}
961
1000
 
962
1001
/**
963
 
 * {@internal Missing Short Description}}
 
1002
 * sample permalink html
964
1003
 *
 
1004
 * intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor.
 
1005
 * 
965
1006
 * @since unknown
966
1007
 *
967
 
 * @param unknown_type $id
968
 
 * @param unknown_type $new_title
969
 
 * @param unknown_type $new_slug
970
 
 * @return unknown
 
1008
 * @param int|object $id Post ID or post object. 
 
1009
 * @param string $new_title (optional) New title  
 
1010
 * @param string $new_slug (optional) New slug 
 
1011
 * @return string intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor. 
971
1012
 */
972
1013
function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
973
1014
        $post = &get_post($id);
974
1015
        list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
975
 
        if ( 'publish' == $post->post_status )
 
1016
 
 
1017
        if ( 'publish' == $post->post_status ) {
976
1018
                $view_post = 'post' == $post->post_type ? __('View Post') : __('View Page');
 
1019
                $title = __('Click to edit this part of the permalink');
 
1020
        } else {
 
1021
                $title = __('Temporary permalink. Click to edit this part.');
 
1022
        }
977
1023
 
978
1024
        if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) {
979
1025
                $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $permalink . "</span>\n";
980
 
                if ( current_user_can( 'manage_options' ) )
 
1026
                if ( current_user_can( 'manage_options' ) && !( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) )
981
1027
                        $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
982
1028
                if ( isset($view_post) )
983
1029
                        $return .= "<span id='view-post-btn'><a href='$permalink' class='button' target='_blank'>$view_post</a></span>\n";
984
1030
 
 
1031
                $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
 
1032
 
985
1033
                return $return;
986
1034
        }
987
1035
 
988
 
        $title = __('Click to edit this part of the permalink');
989
 
        if (function_exists('mb_strlen')) {
990
 
                if (mb_strlen($post_name) > 30) {
 
1036
        if ( function_exists('mb_strlen') ) {
 
1037
                if ( mb_strlen($post_name) > 30 ) {
991
1038
                        $post_name_abridged = mb_substr($post_name, 0, 14). '&hellip;' . mb_substr($post_name, -14);
992
1039
                } else {
993
1040
                        $post_name_abridged = $post_name;
994
1041
                }
995
1042
        } else {
996
 
                if (strlen($post_name) > 30) {
 
1043
                if ( strlen($post_name) > 30 ) {
997
1044
                        $post_name_abridged = substr($post_name, 0, 14). '&hellip;' . substr($post_name, -14);
998
1045
                } else {
999
1046
                        $post_name_abridged = $post_name;
1004
1051
        $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink);
1005
1052
        $view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink);
1006
1053
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $display_link . "</span>\n";
1007
 
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button hide-if-no-js" onclick="edit_permalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
 
1054
        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
1008
1055
        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
1009
1056
        if ( isset($view_post) )
1010
1057
                $return .= "<span id='view-post-btn'><a href='$view_link' class='button' target='_blank'>$view_post</a></span>\n";
1011
1058
 
 
1059
        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
 
1060
 
1012
1061
        return $return;
1013
1062
}
1014
1063
 
1015
1064
/**
1016
 
 * {@internal Missing Short Description}}
1017
 
 *
1018
 
 * @since unknown
1019
 
 *
1020
 
 * @param unknown_type $post_id
 
1065
 * Output HTML for the post thumbnail meta-box.
 
1066
 *
 
1067
 * @since 2.9.0
 
1068
 *
 
1069
 * @param int $thumbnail_id ID of the attachment used for thumbnail
 
1070
 * @return string html
 
1071
 */
 
1072
function _wp_post_thumbnail_html( $thumbnail_id = NULL ) {
 
1073
        global $content_width, $_wp_additional_image_sizes;
 
1074
        $content = '<p class="hide-if-no-js"><a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . esc_html__( 'Set thumbnail' ) . '</a></p>';
 
1075
 
 
1076
        if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
 
1077
                $old_content_width = $content_width;
 
1078
                $content_width = 266;
 
1079
                if ( !isset( $_wp_additional_image_sizes['post-thumbnail'] ) )
 
1080
                        $thumbnail_html = wp_get_attachment_image( $thumbnail_id, array( $content_width, $content_width ) );
 
1081
                else
 
1082
                        $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-thumbnail' );
 
1083
                if ( !empty( $thumbnail_html ) ) {
 
1084
                        $content = '<a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . $thumbnail_html . '</a>';
 
1085
                        $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail();return false;">' . esc_html__( 'Remove thumbnail' ) . '</a></p>';
 
1086
                }
 
1087
                $content_width = $old_content_width;
 
1088
        }
 
1089
 
 
1090
        return apply_filters( 'admin_post_thumbnail_html', $content );
 
1091
}
 
1092
 
 
1093
/**
 
1094
 * Check to see if the post is currently being edited by another user.
 
1095
 *
 
1096
 * @since 2.5.0
 
1097
 *
 
1098
 * @param int $post_id ID of the post to check for editing
1021
1099
 * @return bool|int False: not locked or locked by current user. Int: user ID of user with lock.
1022
1100
 */
1023
1101
function wp_check_post_lock( $post_id ) {
1037
1115
}
1038
1116
 
1039
1117
/**
1040
 
 * {@internal Missing Short Description}}
1041
 
 *
1042
 
 * @since unknown
1043
 
 *
1044
 
 * @param unknown_type $post_id
1045
 
 * @return unknown
 
1118
 * Mark the post as currently being edited by the current user
 
1119
 *
 
1120
 * @since 2.5.0
 
1121
 *
 
1122
 * @param int $post_id ID of the post to being edited
 
1123
 * @return bool Returns false if the post doesn't exist of there is no current user
1046
1124
 */
1047
1125
function wp_set_post_lock( $post_id ) {
1048
1126
        global $current_user;
1061
1139
 
1062
1140
/**
1063
1141
 * Outputs the notice message to say that someone else is editing this post at the moment.
1064
 
 * 
 
1142
 *
1065
1143
 * @since 2.8.5
1066
1144
 * @return none
1067
1145
 */
1069
1147
        global $post;
1070
1148
        $last_user = get_userdata( get_post_meta( $post->ID, '_edit_last', true ) );
1071
1149
        $last_user_name = $last_user ? $last_user->display_name : __('Somebody');
1072
 
        
 
1150
 
1073
1151
        switch ($post->post_type) {
1074
1152
                case 'post':
1075
1153
                        $message = __( 'Warning: %s is currently editing this post' );
1080
1158
                default:
1081
1159
                        $message = __( 'Warning: %s is currently editing this.' );
1082
1160
        }
1083
 
        
 
1161
 
1084
1162
        $message = sprintf( $message, esc_html( $last_user_name ) );
1085
 
        echo "<div class='error'><p>$message</p></div>";        
 
1163
        echo "<div class='error'><p>$message</p></div>";
1086
1164
}
1087
1165
 
1088
1166
/**
1104
1182
        if ( $old_autosave = wp_get_post_autosave( $post_id ) ) {
1105
1183
                $new_autosave = _wp_post_revision_fields( $_POST, true );
1106
1184
                $new_autosave['ID'] = $old_autosave->ID;
 
1185
                $current_user = wp_get_current_user();
 
1186
                $new_autosave['post_author'] = $current_user->ID;
1107
1187
                return wp_update_post( $new_autosave );
1108
1188
        }
1109
1189
 
1187
1267
 * to the URL when queueing them with the mce_external_plugins filter.
1188
1268
 *
1189
1269
 * @param bool $teeny optional Output a trimmed down version used in Press This.
 
1270
 * @param mixed $settings optional An array that can add to or overwrite the default TinyMCE settings.
1190
1271
 */
1191
 
function wp_tiny_mce( $teeny = false ) {
 
1272
function wp_tiny_mce( $teeny = false, $settings = false ) {
1192
1273
        global $concatenate_scripts, $compress_scripts, $tinymce_version;
1193
1274
 
1194
1275
        if ( ! user_can_richedit() )
1207
1288
        $mce_spellchecker_languages = apply_filters('mce_spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv');
1208
1289
 
1209
1290
        if ( $teeny ) {
1210
 
                $plugins = apply_filters( 'teeny_mce_plugins', array('safari', 'inlinepopups', 'media', 'autosave', 'fullscreen') );
 
1291
                $plugins = apply_filters( 'teeny_mce_plugins', array('safari', 'inlinepopups', 'media', 'fullscreen', 'wordpress') );
1211
1292
                $ext_plugins = '';
1212
1293
        } else {
1213
1294
                $plugins = array( 'safari', 'inlinepopups', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen', 'wpeditimage', 'wpgallery', 'tabfocus' );
1341
1422
                'accessibility_focus' => true,
1342
1423
                'tabfocus_elements' => 'major-publishing-actions',
1343
1424
                'media_strict' => false,
1344
 
                'save_callback' => 'switchEditors.saveCallback',
 
1425
                'paste_remove_styles' => true,
 
1426
                'paste_remove_spans' => true,
 
1427
                'paste_strip_class_attributes' => 'all',
1345
1428
                'wpeditimage_disable_captions' => $no_captions,
1346
1429
                'plugins' => "$plugins"
1347
1430
        );
1351
1434
        if ( ! empty($mce_css) )
1352
1435
                $initArray['content_css'] = "$mce_css";
1353
1436
 
 
1437
        if ( is_array($settings) )
 
1438
                $initArray = array_merge($initArray, $settings);
 
1439
 
1354
1440
        // For people who really REALLY know what they're doing with TinyMCE
1355
1441
        // You can modify initArray to add, remove, change elements of the config before tinyMCE.init
1356
1442
        // Setting "valid_elements", "invalid_elements" and "extended_valid_elements" can be done through "tiny_mce_before_init".