Ticket #19320: 19320-2.patch
File 19320-2.patch, 24.4 KB (added by , 13 years ago) |
---|
-
wp-admin/admin-ajax.php
1130 1130 $args['pagenum'] = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1; 1131 1131 1132 1132 require(ABSPATH . WPINC . '/class-wp-editor.php'); 1133 $results = WP_Editor::wp_link_query( $args );1133 $results = _WP_Editors::wp_link_query( $args ); 1134 1134 1135 1135 if ( ! isset( $results ) ) 1136 1136 die( '0' ); -
wp-admin/includes/deprecated.php
711 711 function wp_tiny_mce( $teeny = false, $settings = false ) { 712 712 _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' ); 713 713 714 global $wp_editor;715 714 static $num = 1; 716 715 717 if ( !is_a($wp_editor, 'WP_Editor') ) { 718 if ( !class_exists('WP_Editor') ) 719 require_once( ABSPATH . WPINC . '/class-wp-editor.php' ); 716 if ( ! class_exists('_WP_Editors' ) ) 717 require_once( ABSPATH . WPINC . '/class-wp-editor.php' ); 720 718 721 $wp_editor = new WP_Editor; 722 } 719 $editor_id = 'content' . $num++; 723 720 724 $editor_id = 'content' . $num;725 ++$num;726 727 721 $set = array( 728 722 'teeny' => $teeny, 729 723 'tinymce' => $settings ? $settings : true, 730 724 'quicktags' => false 731 725 ); 732 726 733 $set = $wp_editor->parse_settings($editor_id, $set);734 $wp_editor->editor_settings($editor_id, $set);727 $set = _WP_Editors::parse_settings($editor_id, $set); 728 _WP_Editors::editor_settings($editor_id, $set); 735 729 } 736 730 737 731 /** -
wp-includes/class-wp-editor.php
8 8 * Private, not included by default. See wp_editor() in wp-includes/general-template.php. 9 9 */ 10 10 11 class WP_Editor { 11 final class _WP_Editors { 12 public static $mce_locale; 12 13 13 var $mce_settings = array(); 14 var $qt_settings = array(); 15 var $plugins = array(); 16 var $qt_buttons = array(); 17 var $mce_locale; 18 var $ext_plugins; 19 var $baseurl; 20 var $can_richedit; 21 var $default_editor; 22 var $first_init; 23 var $this_tinymce = false; 24 var $this_quicktags = false; 25 var $has_tinymce = false; 26 var $has_quicktags = false; 27 var $has_medialib = false; 28 var $editor_buttons_css = true; 14 private static $mce_settings = array(); 15 private static $qt_settings = array(); 16 private static $plugins = array(); 17 private static $qt_buttons = array(); 18 private static $ext_plugins; 19 private static $baseurl; 20 private static $first_init; 21 private static $this_tinymce = false; 22 private static $this_quicktags = false; 23 private static $has_tinymce = false; 24 private static $has_quicktags = false; 25 private static $has_medialib = false; 26 private static $editor_buttons_css = true; 29 27 30 function __construct() { 31 $this->can_richedit = user_can_richedit(); 32 $this->default_editor = $this->wp_default_editor(); 33 } 28 private function __construct() {} 34 29 35 function parse_settings($editor_id, $settings) {30 public static function parse_settings($editor_id, $settings) { 36 31 $set = wp_parse_args( $settings, array( 37 32 'wpautop' => true, // use wpautop? 38 33 'media_buttons' => true, // show insert/upload button(s) … … 43 38 'editor_class' => '', // add extra class(es) to the editor textarea 44 39 'teeny' => false, // output the minimal editor config used in Press This 45 40 'dfw' => false, // replace the default fullscreen with DFW (needs specific DOM elements and css) 46 'tinymce' => true, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array()41 'tinymce' => null, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array() 47 42 'quicktags' => true // load Quicktags, can be used to pass settings directly to Quicktags using an array() 48 43 ) ); 49 44 50 $this->this_tinymce = !empty($set['tinymce']) && $this->can_richedit; 51 $this->this_quicktags = !empty($set['quicktags']); 45 if ( null === $set['tinymce'] ) 46 self::$this_tinymce = user_can_richedit(); 47 else 48 self::$this_tinymce = (bool) $set['tinymce']; 52 49 53 if ( $this->this_tinymce ) 54 $this->has_tinymce = true; 50 self::$this_quicktags = (bool) $set['quicktags']; 55 51 56 if ( $this->this_quicktags)57 $this->has_quicktags= true;52 if ( self::$this_tinymce ) 53 self::$has_tinymce = true; 58 54 55 if ( self::$this_quicktags ) 56 self::$has_quicktags = true; 57 59 58 return $set; 60 59 } 61 60 … … 64 63 * 65 64 * @param string $content The initial content of the editor. 66 65 * @param string $editor_id ID for the textarea and TinyMCE and Quicktags instances (can contain only ASCII letters and numbers). 67 * @param array $settings See WP_Editor::_parse_settingsfor description.66 * @param array $settings See the _parse_settings() method for description. 68 67 */ 69 function editor( $content, $editor_id, $settings = array() ) {68 public static function editor( $content, $editor_id, $settings = array() ) { 70 69 71 $set = $this->parse_settings($editor_id, $settings);70 $set = self::parse_settings($editor_id, $settings); 72 71 $editor_class = ' class="' . trim( $set['editor_class'] . ' wp-editor-area' ) . '"'; 73 72 $tabindex = $set['tabindex'] ? ' tabindex="' . (int) $set['tabindex'] . '"' : ''; 74 73 $rows = ' rows="' . (int) $set['textarea_rows'] . '"'; … … 78 77 if ( !current_user_can( 'upload_files' ) ) 79 78 $set['media_buttons'] = false; 80 79 81 if ( $this->this_quicktags && $this->this_tinymce ) {80 if ( self::$this_quicktags && self::$this_tinymce ) { 82 81 $switch_class = 'html-active'; 83 82 84 if ( 'html' == $this->default_editor) {83 if ( 'html' == wp_default_editor() ) { 85 84 add_filter('the_editor_content', 'wp_htmledit_pre'); 86 85 } else { 87 86 add_filter('the_editor_content', 'wp_richedit_pre'); … … 94 93 95 94 echo '<div id="wp-' . $editor_id . '-wrap" class="wp-editor-wrap ' . $switch_class . '">'; 96 95 97 if ( $this->editor_buttons_css ) {96 if ( self::$editor_buttons_css ) { 98 97 wp_print_styles('editor-buttons'); 99 $this->editor_buttons_css = false;98 self::$editor_buttons_css = false; 100 99 } 101 100 102 101 if ( !empty($set['editor_css']) ) … … 107 106 echo $buttons; 108 107 109 108 if ( $set['media_buttons'] ) { 110 $this->has_medialib = true;109 self::$has_medialib = true; 111 110 112 111 if ( !function_exists('media_buttons') ) 113 112 include(ABSPATH . 'wp-admin/includes/media.php'); … … 125 124 printf($the_editor, $content); 126 125 echo "\n</div>\n\n"; 127 126 128 $this->editor_settings($editor_id, $set);127 self::editor_settings($editor_id, $set); 129 128 } 130 129 131 function editor_settings($editor_id, $set) {130 public static function editor_settings($editor_id, $set) { 132 131 global $editor_styles; 133 132 $first_run = false; 134 133 135 if ( empty( $this->first_init) ) {134 if ( empty(self::$first_init) ) { 136 135 if ( is_admin() ) { 137 add_action( 'admin_print_footer_scripts', array( $this, 'editor_js'), 50 );138 add_action( 'admin_footer', array( $this, 'enqueue_scripts'), 1 );136 add_action( 'admin_print_footer_scripts', array( __CLASS__, 'editor_js'), 50 ); 137 add_action( 'admin_footer', array( __CLASS__, 'enqueue_scripts'), 1 ); 139 138 } else { 140 add_action( 'wp_print_footer_scripts', array( $this, 'editor_js'), 50 );141 add_action( 'wp_footer', array( $this, 'enqueue_scripts'), 1 );139 add_action( 'wp_print_footer_scripts', array( __CLASS__, 'editor_js'), 50 ); 140 add_action( 'wp_footer', array( __CLASS__, 'enqueue_scripts'), 1 ); 142 141 } 143 142 } 144 143 145 if ( $this->this_quicktags ) {144 if ( self::$this_quicktags ) { 146 145 147 146 $qtInit = array( 148 147 'id' => $editor_id, … … 159 158 $qtInit['buttons'] .= ',fullscreen'; 160 159 161 160 $qtInit = apply_filters('quicktags_settings', $qtInit, $editor_id); 162 $this->qt_settings[$editor_id] = $qtInit;161 self::$qt_settings[$editor_id] = $qtInit; 163 162 164 $this->qt_buttons = array_merge( $this->qt_buttons, explode(',', $qtInit['buttons']) );163 self::$qt_buttons = array_merge( self::$qt_buttons, explode(',', $qtInit['buttons']) ); 165 164 } 166 165 167 if ( $this->this_tinymce ) {166 if ( self::$this_tinymce ) { 168 167 169 if ( empty( $this->first_init) ) {170 $this->baseurl = includes_url('js/tinymce');171 $this->mce_locale = $mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1168 if ( empty(self::$first_init) ) { 169 self::$baseurl = includes_url('js/tinymce'); 170 self::$mce_locale = $mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1 172 171 $no_captions = (bool) apply_filters( 'disable_captions', '' ); 173 172 $plugins = array( 'inlinepopups', 'spellchecker', 'tabfocus', 'paste', 'media', 'fullscreen', 'wordpress', 'wpeditimage', 'wpgallery', 'wplink', 'wpdialogs' ); 174 173 $first_run = true; 175 174 176 175 if ( $set['teeny'] ) { 177 $this->plugins = $plugins = apply_filters( 'teeny_mce_plugins', array('inlinepopups', 'fullscreen', 'wordpress', 'wplink', 'wpdialogs'), $editor_id );176 self::$plugins = $plugins = apply_filters( 'teeny_mce_plugins', array('inlinepopups', 'fullscreen', 'wordpress', 'wplink', 'wpdialogs'), $editor_id ); 178 177 $ext_plugins = ''; 179 178 } else { 180 179 /* … … 253 252 $ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n"; 254 253 $ext_plugins .= 'tinymce.PluginManager.load("' . $name . '", "' . $url . '");' . "\n"; 255 254 256 $this->ext_plugins .= $ext_plugins;255 self::$ext_plugins .= $ext_plugins; 257 256 } 258 257 } 259 258 … … 263 262 if ( $set['dfw'] ) 264 263 $plugins[] = 'wpfullscreen'; 265 264 266 $this->plugins = $plugins;265 self::$plugins = $plugins; 267 266 268 267 /* 269 268 The following filter allows localization scripts to change the languages displayed in the spellchecker's drop-down menu. … … 273 272 */ 274 273 $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'); 275 274 276 $this->first_init = array(275 self::$first_init = array( 277 276 'mode' => 'exact', 278 277 'width' => '100%', 279 278 'theme' => 'advanced', 280 279 'skin' => 'wp_theme', 281 'language' => $this->mce_locale,280 'language' => self::$mce_locale, 282 281 'spellchecker_languages' => $mce_spellchecker_languages, 283 282 'theme_advanced_toolbar_location' => 'top', 284 283 'theme_advanced_toolbar_align' => 'left', … … 317 316 'paste_text_use_dialog' => true, 318 317 'extended_valid_elements' => 'article[*],aside[*],audio[*],canvas[*],command[*],datalist[*],details[*],embed[*],figcaption[*],figure[*],footer[*],header[*],hgroup[*],keygen[*],mark[*],meter[*],nav[*],output[*],progress[*],section[*],source[*],summary,time[*],video[*],wbr', 319 318 'wpeditimage_disable_captions' => $no_captions, 320 'wp_fullscreen_content_css' => "$this->baseurl/plugins/wpfullscreen/css/wp-fullscreen.css",319 'wp_fullscreen_content_css' => self::$baseurl . '/plugins/wpfullscreen/css/wp-fullscreen.css', 321 320 'plugins' => implode( ',', $plugins ) 322 321 ); 323 322 … … 352 351 $mce_css = trim( apply_filters( 'mce_css', $mce_css ), ' ,' ); 353 352 354 353 if ( ! empty($mce_css) ) 355 $this->first_init['content_css'] = $mce_css;354 self::$first_init['content_css'] = $mce_css; 356 355 } 357 356 358 357 if ( $set['teeny'] ) { … … 389 388 ); 390 389 391 390 if ( $first_run ) 392 $mceInit = array_merge( $this->first_init, $mceInit);391 $mceInit = array_merge(self::$first_init, $mceInit); 393 392 394 393 if ( is_array($set['tinymce']) ) 395 394 $mceInit = array_merge($mceInit, $set['tinymce']); … … 409 408 $mceInit['theme_advanced_buttons4'] = ''; 410 409 } 411 410 412 $this->mce_settings[$editor_id] = $mceInit;413 } // end if $this->this_tinymce411 self::$mce_settings[$editor_id] = $mceInit; 412 } // end if self::$this_tinymce 414 413 } 415 414 416 function _parse_init($init) {415 private static function _parse_init($init) { 417 416 $options = ''; 418 417 419 418 foreach ( $init as $k => $v ) { … … 431 430 return '{' . trim( $options, ' ,' ) . '}'; 432 431 } 433 432 434 /** 435 * Find out which editor should be displayed by default. 436 * 437 * Works out which of the two editors to display as the current editor for a 438 * user. 439 * 440 * @since 2.5.0 441 * 442 * @return string Either 'tinymce', or 'html', or 'test' 443 */ 444 function wp_default_editor() { 445 $r = user_can_richedit() ? 'tinymce' : 'html'; // defaults 446 if ( $user = wp_get_current_user() ) { // look for cookie 447 $ed = get_user_setting('editor', 'tinymce'); 448 $r = ( in_array($ed, array('tinymce', 'html', 'test') ) ) ? $ed : $r; 449 } 450 return apply_filters( 'wp_default_editor', $r ); // filter 451 } 452 453 function enqueue_scripts() { 433 public static function enqueue_scripts() { 454 434 wp_enqueue_script('word-count'); 455 435 456 if ( $this->has_tinymce )436 if ( self::$has_tinymce ) 457 437 wp_enqueue_script('editor'); 458 438 459 if ( $this->has_quicktags )439 if ( self::$has_quicktags ) 460 440 wp_enqueue_script('quicktags'); 461 441 462 if ( in_array('wplink', $this->plugins, true) || in_array('link', $this->qt_buttons, true) ) {442 if ( in_array('wplink', self::$plugins, true) || in_array('link', self::$qt_buttons, true) ) { 463 443 wp_enqueue_script('wplink'); 464 444 wp_enqueue_script('wpdialogs-popup'); 465 445 wp_enqueue_style('wp-jquery-ui-dialog'); 466 446 } 467 447 468 if ( in_array('wpfullscreen', $this->plugins, true) || in_array('fullscreen', $this->qt_buttons, true) )448 if ( in_array('wpfullscreen', self::$plugins, true) || in_array('fullscreen', self::$qt_buttons, true) ) 469 449 wp_enqueue_script('wp-fullscreen'); 470 450 471 if ( $this->has_medialib ) {451 if ( self::$has_medialib ) { 472 452 add_thickbox(); 473 453 wp_enqueue_script('media-upload'); 474 454 } 475 455 } 476 456 477 function editor_js() {457 public static function editor_js() { 478 458 global $tinymce_version, $concatenate_scripts, $compress_scripts; 479 459 480 460 /** … … 485 465 * If the plugin has a popup dialog, a query string can be added to the button action that opens it (in the plugin's code). 486 466 */ 487 467 $version = 'ver=' . $tinymce_version; 488 $tmce_on = !empty( $this->mce_settings);468 $tmce_on = !empty(self::$mce_settings); 489 469 490 470 if ( ! isset($concatenate_scripts) ) 491 471 script_concat_settings(); … … 493 473 $compressed = $compress_scripts && $concatenate_scripts && isset($_SERVER['HTTP_ACCEPT_ENCODING']) 494 474 && false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'); 495 475 496 if ( $tmce_on && 'en' != $this->mce_locale )476 if ( $tmce_on && 'en' != self::$mce_locale ) 497 477 include_once(ABSPATH . WPINC . '/js/tinymce/langs/wp-langs.php'); 498 478 499 479 $mceInit = $qtInit = ''; 500 480 if ( $tmce_on ) { 501 foreach ( $this->mce_settings as $editor_id => $init ) {502 $options = $this->_parse_init( $init );481 foreach ( self::$mce_settings as $editor_id => $init ) { 482 $options = self::_parse_init( $init ); 503 483 $mceInit .= "'$editor_id':{$options},"; 504 484 } 505 485 $mceInit = '{' . trim($mceInit, ',') . '}'; … … 507 487 $mceInit = '{}'; 508 488 } 509 489 510 if ( !empty( $this->qt_settings) ) {511 foreach ( $this->qt_settings as $editor_id => $init ) {512 $options = $this->_parse_init( $init );490 if ( !empty(self::$qt_settings) ) { 491 foreach ( self::$qt_settings as $editor_id => $init ) { 492 $options = self::_parse_init( $init ); 513 493 $qtInit .= "'$editor_id':{$options},"; 514 494 } 515 495 $qtInit = '{' . trim($qtInit, ',') . '}'; … … 518 498 } 519 499 520 500 $ref = array( 521 'plugins' => implode( ',', $this->plugins ),501 'plugins' => implode( ',', self::$plugins ), 522 502 'theme' => 'advanced', 523 'language' => $this->mce_locale503 'language' => self::$mce_locale 524 504 ); 525 505 526 do_action('before_wp_tiny_mce', $this->mce_settings);506 do_action('before_wp_tiny_mce', self::$mce_settings); 527 507 ?> 528 508 529 509 <script type="text/javascript"> 530 510 tinyMCEPreInit = { 531 base : "<?php echo $this->baseurl; ?>",511 base : "<?php echo self::$baseurl; ?>", 532 512 suffix : "", 533 513 query : "<?php echo $version; ?>", 534 514 mceInit : <?php echo $mceInit; ?>, 535 515 qtInit : <?php echo $qtInit; ?>, 536 ref : <?php echo $this->_parse_init( $ref ); ?>,516 ref : <?php echo self::_parse_init( $ref ); ?>, 537 517 load_ext : function(url,lang){var sl=tinymce.ScriptLoader;sl.markDone(url+'/langs/'+lang+'.js');sl.markDone(url+'/langs/'+lang+'_dlg.js');} 538 518 }; 539 519 </script> 540 520 <?php 541 521 522 $url = self::$baseurl; 542 523 if ( $tmce_on ) { 543 524 if ( $compressed ) 544 echo "<script type='text/javascript' src=' $this->baseurl/wp-tinymce.php?c=1&$version'></script>\n";525 echo "<script type='text/javascript' src='{$url}/wp-tinymce.php?c=1&$version'></script>\n"; 545 526 else 546 echo "<script type='text/javascript' src=' $this->baseurl/tiny_mce.js?$version'></script>\n";527 echo "<script type='text/javascript' src='{$url}/tiny_mce.js?$version'></script>\n"; 547 528 548 if ( 'en' != $this->mce_locale && isset($lang) )529 if ( 'en' != self::$mce_locale && isset($lang) ) 549 530 echo "<script type='text/javascript'>\n$lang\n</script>\n"; 550 531 else 551 echo "<script type='text/javascript' src=' $this->baseurl/langs/wp-langs-en.js?$version'></script>\n";532 echo "<script type='text/javascript' src='{$url}/langs/wp-langs-en.js?$version'></script>\n"; 552 533 } 553 534 ?> 554 535 555 536 <script type="text/javascript"> 556 537 (function(){ 557 var init, ed, qt, first_init, mce = <?php echo $this->default_editor== 'tinymce' ? 'true' : 'false'; ?>;538 var init, ed, qt, first_init, mce = <?php echo wp_default_editor() == 'tinymce' ? 'true' : 'false'; ?>; 558 539 559 540 if ( typeof(tinymce) == 'object' ) { 560 541 for ( ed in tinyMCEPreInit.mceInit ) { … … 584 565 585 566 <?php 586 567 587 if ( $this->ext_plugins )588 echo "$this->ext_plugins\n";568 if ( self::$ext_plugins ) 569 echo self::$ext_plugins . "\n"; 589 570 590 571 if ( ! $compressed && $tmce_on ) { 591 572 ?> … … 599 580 </script> 600 581 <?php 601 582 602 if ( in_array('wplink', $this->plugins, true) || in_array('link', $this->qt_buttons, true) )603 $this->wp_link_dialog();583 if ( in_array('wplink', self::$plugins, true) || in_array('link', self::$qt_buttons, true) ) 584 self::wp_link_dialog(); 604 585 605 if ( in_array('wpfullscreen', $this->plugins, true) || in_array('fullscreen', $this->qt_buttons, true) )606 $this->wp_fullscreen_html();586 if ( in_array('wpfullscreen', self::$plugins, true) || in_array('fullscreen', self::$qt_buttons, true) ) 587 self::wp_fullscreen_html(); 607 588 608 do_action('after_wp_tiny_mce', $this->mce_settings);589 do_action('after_wp_tiny_mce', self::$mce_settings); 609 590 } 610 591 611 function wp_fullscreen_html() {592 public static function wp_fullscreen_html() { 612 593 global $content_width, $post; 613 594 614 595 $width = isset($content_width) && 800 > $content_width ? $content_width : 800; … … 705 686 * @param array $args Optional. Accepts 'pagenum' and 's' (search) arguments. 706 687 * @return array Results. 707 688 */ 708 function wp_link_query( $args = array() ) {689 public static function wp_link_query( $args = array() ) { 709 690 $pts = get_post_types( array( 'public' => true ), 'objects' ); 710 691 $pt_names = array_keys( $pts ); 711 692 … … 758 739 * 759 740 * @since 3.1.0 760 741 */ 761 function wp_link_dialog() {742 public static function wp_link_dialog() { 762 743 ?> 763 744 <div style="display:none;"> 764 745 <form id="wp-link" tabindex="-1"> -
wp-includes/deprecated.php
2617 2617 } 2618 2618 2619 2619 /** 2620 * Find out which editor should be displayed2621 *2622 * @see WP_Editor::wp_default_editor()2623 * @since 2.5.02624 * @deprecated 3.52625 *2626 * @return bool2627 */2628 function wp_default_editor() {2629 _deprecated_function( __FUNCTION__, '3.3' );2630 2631 global $wp_editor;2632 if ( !is_a($wp_editor, 'WP_Editor') ) {2633 require_once( ABSPATH . WPINC . '/class-wp-editor.php' );2634 $wp_editor = new WP_Editor;2635 }2636 2637 return $wp_editor->wp_default_editor();2638 }2639 2640 /**2641 2620 * Display editor: TinyMCE, HTML, or both. 2642 2621 * 2643 2622 * @since 2.1.0 -
wp-includes/general-template.php
1766 1766 } 1767 1767 1768 1768 /** 1769 * Loads and initializes WP_Editor class (if needed), passes the settings for an instance of the editor1769 * Find out which editor should be displayed by default. 1770 1770 * 1771 * Works out which of the two editors to display as the current editor for a 1772 * user. 1773 * 1774 * @since 2.5.0 1775 * 1776 * @return string Either 'tinymce', or 'html', or 'test' 1777 */ 1778 function wp_default_editor() { 1779 $r = user_can_richedit() ? 'tinymce' : 'html'; // defaults 1780 if ( $user = wp_get_current_user() ) { // look for cookie 1781 $ed = get_user_setting('editor', 'tinymce'); 1782 $r = ( in_array($ed, array('tinymce', 'html', 'test') ) ) ? $ed : $r; 1783 } 1784 return apply_filters( 'wp_default_editor', $r ); // filter 1785 } 1786 1787 /** 1788 * Renders an editor. 1789 * 1771 1790 * Using this function is the proper way to output all needed components for both TinyMCE and Quicktags. 1772 * WP_Editor shouldn't be instantiated separately as it keeps track of loaded scripts. 1773 * See http://core.trac.wordpress.org/ticket/17144. 1791 * _WP_Editors should not be used directly. See http://core.trac.wordpress.org/ticket/17144. 1774 1792 * 1775 1793 * NOTE: Once initialized the TinyMCE editor cannot be safely moved in the DOM. For that reason 1776 1794 * running wp_editor() inside of a metabox is not a good idea unless only Quicktags is used. … … 1783 1801 * 1784 1802 * @param string $content Initial content for the editor. 1785 1803 * @param string $editor_id HTML ID attribute value for the textarea and TinyMCE. Can only be /[a-z]+/. 1786 * @param array $settings See WP_Editor::editor().1804 * @param array $settings See _WP_Editors::editor(). 1787 1805 */ 1788 1806 function wp_editor( $content, $editor_id, $settings = array() ) { 1789 global $wp_editor; 1790 1791 if ( !is_a($wp_editor, 'WP_Editor') ) { 1807 if ( ! class_exists( '_WP_Editors' ) ) 1792 1808 require( ABSPATH . WPINC . '/class-wp-editor.php' ); 1793 $wp_editor = new WP_Editor;1794 }1795 1809 1796 $wp_editor->editor($content, $editor_id, $settings);1810 _WP_Editors::editor($content, $editor_id, $settings); 1797 1811 } 1798 1812 1799 1813 /** -
wp-includes/js/tinymce/langs/wp-langs.php
1 1 <?php 2 2 3 // escape text only if it needs translating4 3 function mce_escape($text) { 5 global $wp_editor; 6 7 if ( 'en' == $wp_editor->mce_locale ) 8 return $text; 9 else 10 return esc_js($text); 4 return esc_js($text); 11 5 } 12 6 13 $lang = 'tinyMCE.addI18n({' . $this->mce_locale . ':{ 7 if ( ! class_exists( '_WP_Editors' ) ) 8 require( ABSPATH . WPINC . '/class-wp-editor.php' ); 9 10 $lang = 'tinyMCE.addI18n({' . _WP_Editors::$mce_locale . ':{ 14 11 common:{ 15 12 edit_confirm:"' . mce_escape( __('Do you want to use the WYSIWYG mode for this textarea?') ) . '", 16 13 apply:"' . mce_escape( __('Apply') ) . '", … … 232 229 } 233 230 }}); 234 231 235 tinyMCE.addI18n("' . $this->mce_locale . '.advanced",{232 tinyMCE.addI18n("' . _WP_Editors::$mce_locale . '.advanced",{ 236 233 style_select:"' . mce_escape( /* translators: TinyMCE font styles */ _x('Styles', 'TinyMCE font styles') ) . '", 237 234 font_size:"' . mce_escape( __('Font size') ) . '", 238 235 fontdefault:"' . mce_escape( __('Font family') ) . '", … … 298 295 toolbar:"' . mce_escape( __('Toolbar') ) . '" 299 296 }); 300 297 301 tinyMCE.addI18n("' . $this->mce_locale . '.advanced_dlg",{298 tinyMCE.addI18n("' . _WP_Editors::mce_locale . '.advanced_dlg",{ 302 299 about_title:"' . mce_escape( __('About TinyMCE') ) . '", 303 300 about_general:"' . mce_escape( __('About') ) . '", 304 301 about_help:"' . mce_escape( __('Help') ) . '", … … 352 349 accessibility_usage_title:"' . mce_escape( __('General Usage') ) . '" 353 350 }); 354 351 355 tinyMCE.addI18n("' . $this->mce_locale . '.media_dlg",{352 tinyMCE.addI18n("' . _WP_Editors::$mce_locale . '.media_dlg",{ 356 353 title:"' . mce_escape( __('Insert / edit embedded media') ) . '", 357 354 general:"' . mce_escape( __('General') ) . '", 358 355 advanced:"' . mce_escape( __('Advanced') ) . '", … … 462 459 source:"' . mce_escape( __('Source') ) . '" 463 460 }); 464 461 465 tinyMCE.addI18n("' . $this->mce_locale . '.wordpress",{462 tinyMCE.addI18n("' . _WP_Editors::mce_locale . '.wordpress",{ 466 463 wp_adv_desc:"' . mce_escape( __('Show/Hide Kitchen Sink (Alt + Shift + Z)') ) . '", 467 464 wp_more_desc:"' . mce_escape( __('Insert More Tag (Alt + Shift + T)') ) . '", 468 465 wp_page_desc:"' . mce_escape( __('Insert Page break (Alt + Shift + P)') ) . '", … … 477 474 delgallery:"' . mce_escape( __('Delete Gallery') ) . '" 478 475 }); 479 476 480 tinyMCE.addI18n("' . $this->mce_locale . '.wpeditimage",{477 tinyMCE.addI18n("' . _WP_Editors::$mce_locale . '.wpeditimage",{ 481 478 edit_img:"' . mce_escape( __('Edit Image') ) . '", 482 479 del_img:"' . mce_escape( __('Delete Image') ) . '", 483 480 adv_settings:"' . mce_escape( __('Advanced Settings') ) . '",