Make WordPress Core

Changeset 19420


Ignore:
Timestamp:
11/23/2011 07:06:52 PM (13 years ago)
Author:
nacin
Message:

Move WP_Editor to a _WP_Editors encapsulation.

  • WP_Editor will return in 3.4 as a one true API for editor instances. Stick to wp_editor() for now.
  • TinyMCE can now be forced on with tinymce = true. It defaults to the value for user_can_richedit().
  • Restores wp_default_editor(), wp_link_query(), wp_link_dialog(), wp_fullscreen_html().

fixes #19320.

Location:
trunk
Files:
6 edited

Legend:

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

    r19418 r19420  
    11281128
    11291129    require(ABSPATH . WPINC . '/class-wp-editor.php');
    1130     $results = WP_Editor::wp_link_query( $args );
     1130    $results = _WP_Editors::wp_link_query( $args );
    11311131
    11321132    if ( ! isset( $results ) )
  • trunk/wp-admin/includes/deprecated.php

    r19408 r19420  
    712712    _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
    713713
    714     global $wp_editor;
    715714    static $num = 1;
    716715
    717     if ( !is_a($wp_editor, 'WP_Editor') ) {
    718         if ( !class_exists('WP_Editor') )
    719             require_once( ABSPATH . WPINC . '/class-wp-editor.php' );
    720 
    721         $wp_editor = new WP_Editor;
    722     }
    723 
    724     $editor_id = 'content' . $num;
    725     ++$num;
     716    if ( ! class_exists('_WP_Editors' ) )
     717        require_once( ABSPATH . WPINC . '/class-wp-editor.php' );
     718
     719    $editor_id = 'content' . $num++;
    726720
    727721    $set = array(
     
    731725    );
    732726
    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);
    735729}
    736730
     
    759753 */
    760754function wp_quicktags() {
    761     _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
    762 }
    763 
    764 /**
    765  * @deprecated 3.3.0
    766  * @deprecated Use wp_editor()
    767  * @see wp_editor()
    768  */
    769 function wp_fullscreen_html() {
    770755    _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
    771756}
  • trunk/wp-includes/class-wp-editor.php

    r19408 r19420  
    99 */
    1010
    11 class WP_Editor {
    12 
    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;
    29 
    30     function __construct() {
    31         $this->can_richedit = user_can_richedit();
    32         $this->default_editor = $this->wp_default_editor();
    33     }
    34 
    35     function parse_settings($editor_id, $settings) {
     11final class _WP_Editors {
     12    public static $mce_locale;
     13
     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;
     27
     28    private function __construct() {}
     29
     30    public static function parse_settings($editor_id, $settings) {
    3631        $set = wp_parse_args( $settings,  array(
    3732            'wpautop' => true, // use wpautop?
     
    4439            'teeny' => false, // output the minimal editor config used in Press This
    4540            '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()
    4742            'quicktags' => true // load Quicktags, can be used to pass settings directly to Quicktags using an array()
    4843        ) );
    4944
    50         $this->this_tinymce = !empty($set['tinymce']) && $this->can_richedit;
    51         $this->this_quicktags = !empty($set['quicktags']);
    52 
    53         if ( $this->this_tinymce )
    54             $this->has_tinymce = true;
    55 
    56         if ( $this->this_quicktags )
    57             $this->has_quicktags = true;
     45        if ( null === $set['tinymce'] )
     46            self::$this_tinymce = user_can_richedit();
     47        else
     48            self::$this_tinymce = (bool) $set['tinymce'];
     49
     50        self::$this_quicktags = (bool) $set['quicktags'];
     51
     52        if ( self::$this_tinymce )
     53            self::$has_tinymce = true;
     54
     55        if ( self::$this_quicktags )
     56            self::$has_quicktags = true;
    5857
    5958        return $set;
     
    6564     * @param string $content The initial content of the editor.
    6665     * @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_settings for description.
     66     * @param array $settings See the _parse_settings() method for description.
    6867     */
    69     function editor( $content, $editor_id, $settings = array() ) {
    70 
    71         $set = $this->parse_settings($editor_id, $settings);
     68    public static function editor( $content, $editor_id, $settings = array() ) {
     69
     70        $set = self::parse_settings($editor_id, $settings);
    7271        $editor_class = ' class="' . trim( $set['editor_class'] . ' wp-editor-area' ) . '"';
    7372        $tabindex = $set['tabindex'] ? ' tabindex="' . (int) $set['tabindex'] . '"' : '';
     
    7978            $set['media_buttons'] = false;
    8079
    81         if ( $this->this_quicktags && $this->this_tinymce ) {
     80        if ( self::$this_quicktags && self::$this_tinymce ) {
    8281            $switch_class = 'html-active';
    8382
    84             if ( 'html' == $this->default_editor ) {
     83            if ( 'html' == wp_default_editor() ) {
    8584                add_filter('the_editor_content', 'wp_htmledit_pre');
    8685            } else {
     
    9594        echo '<div id="wp-' . $editor_id . '-wrap" class="wp-editor-wrap ' . $switch_class . '">';
    9695
    97         if ( $this->editor_buttons_css ) {
     96        if ( self::$editor_buttons_css ) {
    9897            wp_print_styles('editor-buttons');
    99             $this->editor_buttons_css = false;
     98            self::$editor_buttons_css = false;
    10099        }
    101100
     
    108107
    109108            if ( $set['media_buttons'] ) {
    110                 $this->has_medialib = true;
     109                self::$has_medialib = true;
    111110
    112111                if ( !function_exists('media_buttons') )
     
    126125        echo "\n</div>\n\n";
    127126
    128         $this->editor_settings($editor_id, $set);
    129     }
    130 
    131     function editor_settings($editor_id, $set) {
     127        self::editor_settings($editor_id, $set);
     128    }
     129
     130    public static function editor_settings($editor_id, $set) {
    132131        global $editor_styles;
    133132        $first_run = false;
    134133
    135         if ( empty($this->first_init) ) {
     134        if ( empty(self::$first_init) ) {
    136135            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 );
    139138            } else {
    140                 add_action( 'wp_print_footer_scripts', array($this, 'editor_js'), 50 );
    141                 add_action( 'wp_footer', array($this, 'enqueue_scripts'), 1 );
    142             }
    143         }
    144 
    145         if ( $this->this_quicktags ) {
     139                add_action( 'wp_print_footer_scripts', array( __CLASS__, 'editor_js'), 50 );
     140                add_action( 'wp_footer', array( __CLASS__, 'enqueue_scripts'), 1 );
     141            }
     142        }
     143
     144        if ( self::$this_quicktags ) {
    146145
    147146            $qtInit = array(
     
    160159
    161160            $qtInit = apply_filters('quicktags_settings', $qtInit, $editor_id);
    162             $this->qt_settings[$editor_id] = $qtInit;
    163 
    164             $this->qt_buttons = array_merge( $this->qt_buttons, explode(',', $qtInit['buttons']) );
    165         }
    166 
    167         if ( $this->this_tinymce ) {
    168 
    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-1
     161            self::$qt_settings[$editor_id] = $qtInit;
     162
     163            self::$qt_buttons = array_merge( self::$qt_buttons, explode(',', $qtInit['buttons']) );
     164        }
     165
     166        if ( self::$this_tinymce ) {
     167
     168            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
    172171                $no_captions = (bool) apply_filters( 'disable_captions', '' );
    173172                $plugins = array( 'inlinepopups', 'spellchecker', 'tabfocus', 'paste', 'media', 'fullscreen', 'wordpress', 'wpeditimage', 'wpgallery', 'wplink', 'wpdialogs' );
     
    175174
    176175                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 );
    178177                    $ext_plugins = '';
    179178                } else {
     
    254253                            $ext_plugins .= 'tinymce.PluginManager.load("' . $name . '", "' . $url . '");' . "\n";
    255254
    256                             $this->ext_plugins .= $ext_plugins;
     255                            self::$ext_plugins .= $ext_plugins;
    257256                        }
    258257                    }
     
    264263                    $plugins[] = 'wpfullscreen';
    265264
    266                 $this->plugins = $plugins;
     265                self::$plugins = $plugins;
    267266
    268267                /*
     
    274273                $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');
    275274
    276                 $this->first_init = array(
     275                self::$first_init = array(
    277276                    'mode' => 'exact',
    278277                    'width' => '100%',
    279278                    'theme' => 'advanced',
    280279                    'skin' => 'wp_theme',
    281                     'language' => $this->mce_locale,
     280                    'language' => self::$mce_locale,
    282281                    'spellchecker_languages' => $mce_spellchecker_languages,
    283282                    'theme_advanced_toolbar_location' => 'top',
     
    318317                    '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',
    319318                    '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',
    321320                    'plugins' => implode( ',', $plugins )
    322321                );
     
    353352
    354353                if ( ! empty($mce_css) )
    355                     $this->first_init['content_css'] = $mce_css;
     354                    self::$first_init['content_css'] = $mce_css;
    356355            }
    357356
     
    390389
    391390            if ( $first_run )
    392                 $mceInit = array_merge($this->first_init, $mceInit);
     391                $mceInit = array_merge(self::$first_init, $mceInit);
    393392
    394393            if ( is_array($set['tinymce']) )
     
    410409            }
    411410
    412             $this->mce_settings[$editor_id] = $mceInit;
    413         } // end if $this->this_tinymce
    414     }
    415 
    416     function _parse_init($init) {
     411            self::$mce_settings[$editor_id] = $mceInit;
     412        } // end if self::$this_tinymce
     413    }
     414
     415    private static function _parse_init($init) {
    417416        $options = '';
    418417
     
    432431    }
    433432
    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() {
    454434        wp_enqueue_script('word-count');
    455435
    456         if ( $this->has_tinymce )
     436        if ( self::$has_tinymce )
    457437            wp_enqueue_script('editor');
    458438
    459         if ( $this->has_quicktags )
     439        if ( self::$has_quicktags )
    460440            wp_enqueue_script('quicktags');
    461441
    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) ) {
    463443            wp_enqueue_script('wplink');
    464444            wp_enqueue_script('wpdialogs-popup');
     
    466446        }
    467447
    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) )
    469449            wp_enqueue_script('wp-fullscreen');
    470450
    471         if ( $this->has_medialib ) {
     451        if ( self::$has_medialib ) {
    472452            add_thickbox();
    473453            wp_enqueue_script('media-upload');
     
    475455    }
    476456
    477     function editor_js() {
     457    public static function editor_js() {
    478458        global $tinymce_version, $concatenate_scripts, $compress_scripts;
    479459
     
    486466         */
    487467        $version = 'ver=' . $tinymce_version;
    488         $tmce_on = !empty($this->mce_settings);
     468        $tmce_on = !empty(self::$mce_settings);
    489469
    490470        if ( ! isset($concatenate_scripts) )
     
    494474            && false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip');
    495475
    496         if ( $tmce_on && 'en' != $this->mce_locale )
     476        if ( $tmce_on && 'en' != self::$mce_locale )
    497477            include_once(ABSPATH . WPINC . '/js/tinymce/langs/wp-langs.php');
    498478
    499479        $mceInit = $qtInit = '';
    500480        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 );
    503483                $mceInit .= "'$editor_id':{$options},";
    504484            }
     
    508488        }
    509489
    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 );
    513493                $qtInit .= "'$editor_id':{$options},";
    514494            }
     
    519499
    520500        $ref = array(
    521             'plugins' => implode( ',', $this->plugins ),
     501            'plugins' => implode( ',', self::$plugins ),
    522502            'theme' => 'advanced',
    523             'language' => $this->mce_locale
     503            'language' => self::$mce_locale
    524504        );
    525505
    526         do_action('before_wp_tiny_mce', $this->mce_settings);
     506        do_action('before_wp_tiny_mce', self::$mce_settings);
    527507?>
    528508
    529509    <script type="text/javascript">
    530510        tinyMCEPreInit = {
    531             base : "<?php echo $this->baseurl; ?>",
     511            base : "<?php echo self::$baseurl; ?>",
    532512            suffix : "",
    533513            query : "<?php echo $version; ?>",
    534514            mceInit : <?php echo $mceInit; ?>,
    535515            qtInit : <?php echo $qtInit; ?>,
    536             ref : <?php echo $this->_parse_init( $ref ); ?>,
     516            ref : <?php echo self::_parse_init( $ref ); ?>,
    537517            load_ext : function(url,lang){var sl=tinymce.ScriptLoader;sl.markDone(url+'/langs/'+lang+'.js');sl.markDone(url+'/langs/'+lang+'_dlg.js');}
    538518        };
     
    540520<?php
    541521
     522        $baseurl = self::$baseurl;
     523
    542524        if ( $tmce_on ) {
    543525            if ( $compressed )
    544                 echo "<script type='text/javascript' src='$this->baseurl/wp-tinymce.php?c=1&amp;$version'></script>\n";
     526                echo "<script type='text/javascript' src='{$baseurl}/wp-tinymce.php?c=1&amp;$version'></script>\n";
    545527            else
    546                 echo "<script type='text/javascript' src='$this->baseurl/tiny_mce.js?$version'></script>\n";
    547 
    548             if ( 'en' != $this->mce_locale && isset($lang) )
     528                echo "<script type='text/javascript' src='{$baseurl}/tiny_mce.js?$version'></script>\n";
     529
     530            if ( 'en' != self::$mce_locale && isset($lang) )
    549531                echo "<script type='text/javascript'>\n$lang\n</script>\n";
    550532            else
    551                 echo "<script type='text/javascript' src='$this->baseurl/langs/wp-langs-en.js?$version'></script>\n";
     533                echo "<script type='text/javascript' src='{$baseurl}/langs/wp-langs-en.js?$version'></script>\n";
    552534        }
    553535?>
     
    555537    <script type="text/javascript">
    556538        (function(){
    557             var init, ed, qt, first_init, mce = <?php echo $this->default_editor == 'tinymce' ? 'true' : 'false'; ?>;
     539            var init, ed, qt, first_init, mce = <?php echo wp_default_editor() == 'tinymce' ? 'true' : 'false'; ?>;
    558540
    559541            if ( typeof(tinymce) == 'object' ) {
     
    585567<?php
    586568
    587         if ( $this->ext_plugins )
    588             echo "$this->ext_plugins\n";
     569        if ( self::$ext_plugins )
     570            echo self::$ext_plugins . "\n";
    589571
    590572        if ( ! $compressed && $tmce_on ) {
     
    600582<?php
    601583
    602         if ( in_array('wplink', $this->plugins, true) || in_array('link', $this->qt_buttons, true) )
    603             $this->wp_link_dialog();
    604 
    605         if ( in_array('wpfullscreen', $this->plugins, true) || in_array('fullscreen', $this->qt_buttons, true) )
    606             $this->wp_fullscreen_html();
    607 
    608         do_action('after_wp_tiny_mce', $this->mce_settings);
    609     }
    610 
    611     function wp_fullscreen_html() {
     584        if ( in_array('wplink', self::$plugins, true) || in_array('link', self::$qt_buttons, true) )
     585            self::wp_link_dialog();
     586
     587        if ( in_array('wpfullscreen', self::$plugins, true) || in_array('fullscreen', self::$qt_buttons, true) )
     588            self::wp_fullscreen_html();
     589
     590        do_action('after_wp_tiny_mce', self::$mce_settings);
     591    }
     592
     593    public static function wp_fullscreen_html() {
    612594        global $content_width, $post;
    613595
     
    706688     * @return array Results.
    707689     */
    708     function wp_link_query( $args = array() ) {
     690    public static function wp_link_query( $args = array() ) {
    709691        $pts = get_post_types( array( 'public' => true ), 'objects' );
    710692        $pt_names = array_keys( $pts );
     
    759741     * @since 3.1.0
    760742     */
    761     function wp_link_dialog() {
     743    public static function wp_link_dialog() {
    762744    ?>
    763745    <div style="display:none;">
  • trunk/wp-includes/deprecated.php

    r19016 r19420  
    26182618
    26192619/**
    2620  * Find out which editor should be displayed
    2621  *
    2622  * @see WP_Editor::wp_default_editor()
    2623  * @since 2.5.0
    2624  * @deprecated 3.5
    2625  *
    2626  * @return bool
    2627  */
    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 /**
    26412620 * Display editor: TinyMCE, HTML, or both.
    26422621 *
  • trunk/wp-includes/general-template.php

    r19406 r19420  
    17671767
    17681768/**
    1769  * Loads and initializes WP_Editor class (if needed), passes the settings for an instance of the editor
     1769 * Find out which editor should be displayed by default.
     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 */
     1778function 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.
    17701789 *
    17711790 * 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.
    17741792 *
    17751793 * NOTE: Once initialized the TinyMCE editor cannot be safely moved in the DOM. For that reason
     
    17841802 * @param string $content Initial content for the editor.
    17851803 * @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().
    17871805 */
    17881806function 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' ) )
    17921808        require( ABSPATH . WPINC . '/class-wp-editor.php' );
    1793         $wp_editor = new WP_Editor;
    1794     }
    1795 
    1796     $wp_editor->editor($content, $editor_id, $settings);
     1809
     1810    _WP_Editors::editor($content, $editor_id, $settings);
    17971811}
    17981812
  • trunk/wp-includes/js/tinymce/langs/wp-langs.php

    r19263 r19420  
    11<?php
    22
    3 // escape text only if it needs translating
    43function 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);
    115}
    126
    13 $lang = 'tinyMCE.addI18n({' . $this->mce_locale . ':{
     7if ( ! class_exists( '_WP_Editors' ) )
     8    require( ABSPATH . WPINC . '/class-wp-editor.php' );
     9
     10$lang = 'tinyMCE.addI18n({' . _WP_Editors::$mce_locale . ':{
    1411common:{
    1512edit_confirm:"' . mce_escape( __('Do you want to use the WYSIWYG mode for this textarea?') ) . '",
     
    233230}});
    234231
    235 tinyMCE.addI18n("' . $this->mce_locale . '.advanced",{
     232tinyMCE.addI18n("' . _WP_Editors::$mce_locale . '.advanced",{
    236233style_select:"' . mce_escape( /* translators: TinyMCE font styles */ _x('Styles', 'TinyMCE font styles') ) . '",
    237234font_size:"' . mce_escape( __('Font size') ) . '",
     
    299296});
    300297
    301 tinyMCE.addI18n("' . $this->mce_locale . '.advanced_dlg",{
     298tinyMCE.addI18n("' . _WP_Editors::$mce_locale . '.advanced_dlg",{
    302299about_title:"' . mce_escape( __('About TinyMCE') ) . '",
    303300about_general:"' . mce_escape( __('About') ) . '",
     
    353350});
    354351
    355 tinyMCE.addI18n("' . $this->mce_locale . '.media_dlg",{
     352tinyMCE.addI18n("' . _WP_Editors::$mce_locale . '.media_dlg",{
    356353title:"' . mce_escape( __('Insert / edit embedded media') ) . '",
    357354general:"' . mce_escape( __('General') ) . '",
     
    463460});
    464461
    465 tinyMCE.addI18n("' . $this->mce_locale . '.wordpress",{
     462tinyMCE.addI18n("' . _WP_Editors::$mce_locale . '.wordpress",{
    466463wp_adv_desc:"' . mce_escape( __('Show/Hide Kitchen Sink (Alt + Shift + Z)') )  . '",
    467464wp_more_desc:"' . mce_escape( __('Insert More Tag (Alt + Shift + T)') ) . '",
     
    478475});
    479476
    480 tinyMCE.addI18n("' . $this->mce_locale . '.wpeditimage",{
     477tinyMCE.addI18n("' . _WP_Editors::$mce_locale . '.wpeditimage",{
    481478edit_img:"' . mce_escape( __('Edit Image') )  . '",
    482479del_img:"' . mce_escape( __('Delete Image') )  . '",
Note: See TracChangeset for help on using the changeset viewer.