Make WordPress Core

Ticket #24789: 24789.2.diff

File 24789.2.diff, 4.4 KB (added by nacin, 10 years ago)
  • wp-includes/class-wp-editor.php

     
    192192                                self::$baseurl = includes_url('js/tinymce');
    193193                                self::$mce_locale = $mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1
    194194                                $no_captions = (bool) apply_filters( 'disable_captions', '' );
    195                                 $plugins = array( 'inlinepopups', 'spellchecker', 'tabfocus', 'paste', 'media', 'fullscreen', 'wordpress', 'wpeditimage', 'wpgallery', 'wplink', 'wpdialogs' );
     195                                $plugins = array( 'inlinepopups', 'tabfocus', 'paste', 'media', 'fullscreen', 'wordpress', 'wpeditimage', 'wpgallery', 'wplink', 'wpdialogs' );
    196196                                $first_run = true;
    197197                                $ext_plugins = '';
    198198
     
    285285                                self::$plugins = $plugins;
    286286                                self::$ext_plugins = $ext_plugins;
    287287
    288                                 /*
    289                                 translators: These languages show up in the spellchecker drop-down menu, in the order specified, and with the first
    290                                 language listed being the default language. They must be comma-separated and take the format of name=code, where name
    291                                 is the language name (which you may internationalize), and code is a valid ISO 639 language code. Please test the
    292                                 spellchecker with your values.
    293                                 */
    294                                 $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' );
     288                                if ( in_array( 'spellchecker', $plugins ) ) {
     289                                        /*
     290                                        translators: These languages show up in the spellchecker drop-down menu, in the order specified, and with the first
     291                                        language listed being the default language. They must be comma-separated and take the format of name=code, where name
     292                                        is the language name (which you may internationalize), and code is a valid ISO 639 language code. Please test the
     293                                        spellchecker with your values.
     294                                        */
     295                                        $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' );
    295296
    296                                 /*
    297                                 The following filter allows localization scripts to change the languages displayed in the spellchecker's drop-down menu.
    298                                 By default it uses Google's spellchecker API, but can be configured to use PSpell/ASpell if installed on the server.
    299                                 The + sign marks the default language. More: http://www.tinymce.com/wiki.php/Plugin:spellchecker.
    300                                 */
    301                                 $mce_spellchecker_languages = apply_filters( 'mce_spellchecker_languages', '+' . $mce_spellchecker_languages );
     297                                        /*
     298                                        The following filter allows localization scripts to change the languages displayed in the spellchecker's drop-down menu.
     299                                        By default it uses Google's spellchecker API, but can be configured to use PSpell/ASpell if installed on the server.
     300                                        The + sign marks the default language. More: http://www.tinymce.com/wiki.php/Plugin:spellchecker.
     301                                        */
     302                                        $mce_spellchecker_languages = apply_filters( 'mce_spellchecker_languages', '+' . $mce_spellchecker_languages );
     303                                }
    302304
    303305                                self::$first_init = array(
    304306                                        'mode' => 'exact',
     
    306308                                        'theme' => 'advanced',
    307309                                        'skin' => 'wp_theme',
    308310                                        'language' => self::$mce_locale,
    309                                         'spellchecker_languages' => $mce_spellchecker_languages,
    310311                                        'theme_advanced_toolbar_location' => 'top',
    311312                                        'theme_advanced_toolbar_align' => 'left',
    312313                                        'theme_advanced_statusbar_location' => 'bottom',
     
    344345                                        'paste_text_use_dialog' => true,
    345346                                        'webkit_fake_resize' => false,
    346347                                        'preview_styles' => 'font-family font-weight text-decoration text-transform',
    347                                         'spellchecker_rpc_url' => self::$baseurl . '/plugins/spellchecker/rpc.php',
    348348                                        'schema' => 'html5',
    349349                                        'wpeditimage_disable_captions' => $no_captions,
    350350                                        'wp_fullscreen_content_css' => self::$baseurl . '/plugins/wpfullscreen/css/wp-fullscreen.css',
     
    351351                                        'plugins' => implode( ',', $plugins )
    352352                                );
    353353
     354                                if ( in_array( 'spellchecker', $plugins ) ) {
     355                                        self::$first_init['spellchecker_rpc_url'] = self::$baseurl . '/plugins/spellchecker/rpc.php';
     356                                        self::$first_init['spellchecker_languages'] = $mce_spellchecker_languages;
     357                                }
     358
    354359                                // load editor_style.css if the current theme supports it
    355360                                if ( ! empty( $GLOBALS['editor_styles'] ) && is_array( $GLOBALS['editor_styles'] ) ) {
    356361                                        $editor_styles = $GLOBALS['editor_styles'];