Changeset 9353 for trunk/wp-admin/includes/post.php
- Timestamp:
- 10/26/2008 07:32:58 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/post.php
r9119 r9353 1038 1038 include path to the file. The language file should follow the same format as 1039 1039 /tinymce/langs/wp-langs.php and should define a variable $strings that 1040 holds all translated strings. Example: 1041 $strings = 'tinyMCE.addI18n("' . $mce_locale . '.mypluginname_dlg",{tab_general:"General", ... })'; 1040 holds all translated strings. 1041 When this filter is not used, the function will try to load {mce_locale}.js. 1042 If that is not found, en.js will be tried next. 1042 1043 */ 1043 1044 $mce_external_languages = apply_filters('mce_external_languages', array()); … … 1062 1063 $plugins[] = '-' . $name; 1063 1064 1064 if ( in_array($name, $loaded_langs) ) { 1065 $plugurl = dirname($url); 1066 $ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n"; 1065 $plugurl = dirname($url); 1066 $strings = ''; 1067 if ( ! in_array($name, $loaded_langs) ) { 1068 $plugpath = str_replace( WP_PLUGIN_URL, '', $plugurl ); 1069 $plugpath = WP_PLUGIN_DIR . $plugpath; 1070 1071 if ( function_exists('realpath') ) 1072 $plugpath = realpath($plugpath); 1073 1074 $path = $plugpath . '/langs/' . $mce_locale . '.js'; 1075 $path2 = $plugpath . '/langs/en.js'; 1076 1077 if ( is_file($path) && is_readable($path) ) { 1078 $strings = @file_get_contents($path); 1079 } elseif ( 'en' != $mce_locale && is_file($path2) && is_readable($path2) ) { 1080 $strings = @file_get_contents($path2); 1081 $strings = preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $strings, 1 ); 1082 } 1083 1084 if ( $strings ) 1085 $ext_plugins .= "\n" . $strings . "\n"; 1067 1086 } 1087 1088 $ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n"; 1068 1089 $ext_plugins .= 'tinymce.PluginManager.load("' . $name . '", "' . $url . '");' . "\n"; 1069 1090 } 1070 1091 } 1071 1092 } 1072 1093 1073 1094 $plugins = implode($plugins, ','); 1074 1095 … … 1126 1147 'save_callback' => 'switchEditors.saveCallback', 1127 1148 'wpeditimage_disable_captions' => $no_captions, 1128 'plugins' => "$plugins", 1129 'strict_loading_mode' => true 1149 'plugins' => "$plugins" 1130 1150 ); 1131 1151 … … 1142 1162 $language = $initArray['language']; 1143 1163 1144 $ver = apply_filters('tiny_mce_version', '200'); 1145 /* 1146 foreach ( $initArray as $v ) 1147 $ver .= $v; 1148 1149 if ( ! empty($mce_external_plugins) ) { 1150 foreach ( $mce_external_plugins as $n => $v ) 1151 $ver .= $n; 1152 } 1153 1154 $ver = md5( $ver ); 1155 1156 1157 // Use cached translations file if exists 1158 $langs_file = ABSPATH . WPINC . '/js/tinymce/langs/wp-langs-' . $language . '.js'; 1159 1160 if ( is_file($langs_file) && is_readable($langs_file) ) { 1161 if ( $ver != get_option('mce_refresh_check') ) { 1162 @unlink($langs_file); 1163 update_option('mce_refresh_check', $ver); 1164 } else { 1165 $lang = false; 1166 } 1167 } 1168 */ 1164 $ver = apply_filters('tiny_mce_version', '3101'); 1165 1169 1166 if ( 'en' != $language ) 1170 1167 include_once(ABSPATH . WPINC . '/js/tinymce/langs/wp-langs.php'); … … 1210 1207 <script type="text/javascript" src="<?php echo $baseurl; ?>/tiny_mce.js?ver=<?php echo $ver; ?>"></script> 1211 1208 <?php if ( 'en' == $language ) { ?> 1212 <script type="text/javascript" src="<?php echo $baseurl; ?>/langs/wp-langs- <?php echo $language; ?>.js?ver=<?php echo $ver; ?>"></script>1209 <script type="text/javascript" src="<?php echo $baseurl; ?>/langs/wp-langs-en.js?ver=<?php echo $ver; ?>"></script> 1213 1210 <?php } ?> 1214 1211 <script type="text/javascript"> 1215 1216 1212 <?php if ( 'en' != $language && isset($lang) ) echo $lang; ?> 1213 1217 1214 <?php if ( $ext_plugins ) echo $ext_plugins; ?> 1218 1215
Note: See TracChangeset
for help on using the changeset viewer.