- 2E195A249E509B946027D0EAFAB56B3C706ADBE329288E5B38084B93D22C4D4C11644DF75DC75D6376A9DB3B2123B6BADC416734638D9BD25F1081C2A2F2E60D
+ 0259B97C471CEA621CC846A3C22AB4E8E160F88D44CFB8720A518FE7813EA79831ECFA85C08A8BCB91915DED8D462C90296940787DA889D2EE8BC8D603A839D5
mp-wp/wp-admin/includes/post.php
(1099 . 251)(1099 . 3)
6841
6842 return $url;
6843 }
6844
6845 /**
6846 * Adds the TinyMCE editor used on the Write and Edit screens.
6847 *
6848 * Has option to output a trimmed down version used in Press This.
6849 *
6850 * @package WordPress
6851 * @since 2.7
6852 */
6853 function wp_tiny_mce( $teeny = false ) {
6854 if ( ! user_can_richedit() )
6855 return;
6856
6857 $baseurl = includes_url('js/tinymce');
6858
6859 $mce_css = $baseurl . '/wordpress.css';
6860 $mce_css = apply_filters('mce_css', $mce_css);
6861
6862 $mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1
6863
6864 /*
6865 The following filter allows localization scripts to change the languages displayed in the spellchecker's drop-down menu.
6866 By default it uses Google's spellchecker API, but can be configured to use PSpell/ASpell if installed on the server.
6867 The + sign marks the default language. More information:
6868 http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker
6869 */
6870 $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');
6871
6872 if ( $teeny ) {
6873 $plugins = apply_filters( 'teeny_mce_plugins', array('safari', 'inlinepopups', 'media', 'autosave', 'fullscreen') );
6874 $ext_plugins = '';
6875 } else {
6876 $plugins = array( 'safari', 'inlinepopups', 'autosave', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen', 'wpeditimage', 'wpgallery' );
6877
6878 /*
6879 The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
6880 It adds the plugin's name to TinyMCE's plugins init and the call to PluginManager to load the plugin.
6881 The url should be absolute and should include the js file name to be loaded. Example:
6882 array( 'myplugin' => 'http://my-site.com/wp-content/plugins/myfolder/mce_plugin.js' )
6883 If the plugin uses a button, it should be added with one of the "$mce_buttons" filters.
6884 */
6885 $mce_external_plugins = apply_filters('mce_external_plugins', array());
6886
6887 $ext_plugins = "\n";
6888 if ( ! empty($mce_external_plugins) ) {
6889
6890 /*
6891 The following filter loads external language files for TinyMCE plugins.
6892 It takes an associative array 'plugin_name' => 'path', where path is the
6893 include path to the file. The language file should follow the same format as
6894 /tinymce/langs/wp-langs.php and should define a variable $strings that
6895 holds all translated strings.
6896 When this filter is not used, the function will try to load {mce_locale}.js.
6897 If that is not found, en.js will be tried next.
6898 */
6899 $mce_external_languages = apply_filters('mce_external_languages', array());
6900
6901 $loaded_langs = array();
6902 $strings = '';
6903
6904 if ( ! empty($mce_external_languages) ) {
6905 foreach ( $mce_external_languages as $name => $path ) {
6906 if ( is_file($path) && is_readable($path) ) {
6907 include_once($path);
6908 $ext_plugins .= $strings;
6909 $loaded_langs[] = $name;
6910 }
6911 }
6912 }
6913
6914 foreach ( $mce_external_plugins as $name => $url ) {
6915
6916 if ( is_ssl() ) $url = str_replace('http://', 'https://', $url);
6917
6918 $plugins[] = '-' . $name;
6919
6920 $plugurl = dirname($url);
6921 $strings = $str1 = $str2 = '';
6922 if ( ! in_array($name, $loaded_langs) ) {
6923 $path = str_replace( WP_PLUGIN_URL, '', $plugurl );
6924 $path = WP_PLUGIN_DIR . $path . '/langs/';
6925
6926 if ( function_exists('realpath') )
6927 $path = trailingslashit( realpath($path) );
6928
6929 if ( is_file($path . $mce_locale . '.js') )
6930 $strings .= @file_get_contents($path . $mce_locale . '.js');
6931
6932 if ( is_file($path . $mce_locale . '_dlg.js') )
6933 $strings .= @file_get_contents($path . $mce_locale . '_dlg.js');
6934
6935 if ( 'en' != $mce_locale && empty($strings) ) {
6936 if ( is_file($path . 'en.js') ) {
6937 $str1 = @file_get_contents($path . 'en.js');
6938 $strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str1, 1 );
6939 }
6940
6941 if ( is_file($path . 'en_dlg.js') ) {
6942 $str2 = @file_get_contents($path . 'en_dlg.js');
6943 $strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str2, 1 );
6944 }
6945 }
6946
6947 if ( ! empty($strings) )
6948 $ext_plugins .= "\n" . $strings . "\n";
6949 }
6950
6951 $ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n";
6952 $ext_plugins .= 'tinymce.PluginManager.load("' . $name . '", "' . $url . '");' . "\n";
6953 }
6954 }
6955 }
6956
6957 $plugins = implode($plugins, ',');
6958
6959 if ( $teeny ) {
6960 $mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold, italic, underline, blockquote, separator, strikethrough, bullist, numlist,justifyleft, justifycenter, justifyright, undo, redo, link, unlink, fullscreen') );
6961 $mce_buttons = implode($mce_buttons, ',');
6962 $mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = '';
6963 } else {
6964 $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', '|', 'bullist', 'numlist', 'blockquote', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'link', 'unlink', 'wp_more', '|', 'spellchecker', 'fullscreen', 'wp_adv' ));
6965 $mce_buttons = implode($mce_buttons, ',');
6966
6967 $mce_buttons_2 = apply_filters('mce_buttons_2', array('formatselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', 'removeformat', '|', 'media', 'charmap', '|', 'outdent', 'indent', '|', 'undo', 'redo', 'wp_help' ));
6968 $mce_buttons_2 = implode($mce_buttons_2, ',');
6969
6970 $mce_buttons_3 = apply_filters('mce_buttons_3', array());
6971 $mce_buttons_3 = implode($mce_buttons_3, ',');
6972
6973 $mce_buttons_4 = apply_filters('mce_buttons_4', array());
6974 $mce_buttons_4 = implode($mce_buttons_4, ',');
6975 }
6976 $no_captions = ( apply_filters( 'disable_captions', '' ) ) ? true : false;
6977
6978 // TinyMCE init settings
6979 $initArray = array (
6980 'mode' => 'none',
6981 'onpageload' => 'switchEditors.edInit',
6982 'width' => '100%',
6983 'theme' => 'advanced',
6984 'skin' => 'wp_theme',
6985 'theme_advanced_buttons1' => "$mce_buttons",
6986 'theme_advanced_buttons2' => "$mce_buttons_2",
6987 'theme_advanced_buttons3' => "$mce_buttons_3",
6988 'theme_advanced_buttons4' => "$mce_buttons_4",
6989 'language' => "$mce_locale",
6990 'spellchecker_languages' => "$mce_spellchecker_languages",
6991 'theme_advanced_toolbar_location' => 'top',
6992 'theme_advanced_toolbar_align' => 'left',
6993 'theme_advanced_statusbar_location' => 'bottom',
6994 'theme_advanced_resizing' => true,
6995 'theme_advanced_resize_horizontal' => false,
6996 'dialog_type' => 'modal',
6997 'relative_urls' => false,
6998 'remove_script_host' => false,
6999 'convert_urls' => false,
7000 'apply_source_formatting' => false,
7001 'remove_linebreaks' => true,
7002 'paste_convert_middot_lists' => true,
7003 'paste_remove_spans' => true,
7004 'paste_remove_styles' => true,
7005 'gecko_spellcheck' => true,
7006 'entities' => '38,amp,60,lt,62,gt',
7007 'accessibility_focus' => true,
7008 'tab_focus' => ':prev,:next',
7009 'content_css' => "$mce_css",
7010 'save_callback' => 'switchEditors.saveCallback',
7011 'wpeditimage_disable_captions' => $no_captions,
7012 'plugins' => "$plugins"
7013 );
7014
7015 // For people who really REALLY know what they're doing with TinyMCE
7016 // You can modify initArray to add, remove, change elements of the config before tinyMCE.init
7017 // Setting "valid_elements", "invalid_elements" and "extended_valid_elements" can be done through "tiny_mce_before_init".
7018 // Best is to use the default cleanup by not specifying valid_elements, as TinyMCE contains full set of XHTML 1.0.
7019 if ( $teeny ) {
7020 $initArray = apply_filters('teeny_mce_before_init', $initArray);
7021 } else {
7022 $initArray = apply_filters('tiny_mce_before_init', $initArray);
7023 }
7024
7025 $language = $initArray['language'];
7026
7027 $ver = apply_filters('tiny_mce_version', '3101');
7028
7029 if ( 'en' != $language )
7030 include_once(ABSPATH . WPINC . '/js/tinymce/langs/wp-langs.php');
7031
7032 $mce_options = '';
7033 foreach ( $initArray as $k => $v )
7034 $mce_options .= $k . ':"' . $v . '", ';
7035
7036 $mce_options = rtrim( trim($mce_options), '\n\r,' ); ?>
7037
7038 <script type="text/javascript">
7039 /* <![CDATA[ */
7040 tinyMCEPreInit = {
7041 base : "<?php echo $baseurl; ?>",
7042 suffix : "",
7043 query : "ver=<?php echo $ver; ?>",
7044 mceInit : {<?php echo $mce_options; ?>},
7045
7046 go : function() {
7047 var t = this, sl = tinymce.ScriptLoader, ln = t.mceInit.language, th = t.mceInit.theme, pl = t.mceInit.plugins;
7048
7049 sl.markDone(t.base + '/langs/' + ln + '.js');
7050
7051 sl.markDone(t.base + '/themes/' + th + '/langs/' + ln + '.js');
7052 sl.markDone(t.base + '/themes/' + th + '/langs/' + ln + '_dlg.js');
7053
7054 tinymce.each(pl.split(','), function(n) {
7055 if (n && n.charAt(0) != '-') {
7056 sl.markDone(t.base + '/plugins/' + n + '/langs/' + ln + '.js');
7057 sl.markDone(t.base + '/plugins/' + n + '/langs/' + ln + '_dlg.js');
7058 }
7059 });
7060 },
7061
7062 load_ext : function(url,lang) {
7063 var sl = tinymce.ScriptLoader;
7064
7065 sl.markDone(url + '/langs/' + lang + '.js');
7066 sl.markDone(url + '/langs/' + lang + '_dlg.js');
7067 }
7068 };
7069 /* ]]> */
7070 </script>
7071 <script type="text/javascript" src="<?php echo $baseurl; ?>/tiny_mce.js?ver=<?php echo $ver; ?>"></script>
7072 <?php if ( 'en' != $language && isset($lang) ) { ?>
7073 <script type="text/javascript">
7074 <?php echo $lang; ?>
7075 </script>
7076 <?php } else { ?>
7077 <script type="text/javascript" src="<?php echo $baseurl; ?>/langs/wp-langs-en.js?ver=<?php echo $ver; ?>"></script>
7078 <?php } ?>
7079 <script type="text/javascript">
7080 <?php if ( $ext_plugins ) echo $ext_plugins; ?>
7081
7082 // Mark translations as done
7083 tinyMCEPreInit.go();
7084
7085 // Init
7086 tinyMCE.init(tinyMCEPreInit.mceInit);
7087 </script>
7088
7089 <?php
7090 }
7091 ?>