Changeset 26876 for trunk/src/wp-includes/class-wp-editor.php
- Timestamp:
- 12/28/2013 11:52:04 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/class-wp-editor.php (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-editor.php
r26315 r26876 190 190 if ( self::$this_tinymce ) { 191 191 192 if ( empty(self::$first_init) ) { 193 self::$baseurl = includes_url('js/tinymce'); 194 self::$mce_locale = $mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1 192 if ( empty( self::$first_init ) ) { 193 self::$baseurl = includes_url( 'js/tinymce' ); 194 $mce_locale = get_locale(); 195 196 if ( empty( $mce_locale ) || 'en' == substr( $mce_locale, 0, 2 ) ) { 197 $mce_locale = 'en'; 198 } 199 200 self::$mce_locale = $mce_locale; 195 201 $no_captions = (bool) apply_filters( 'disable_captions', '' ); 196 $plugins = array( 'inlinepopups', 'tabfocus', 'paste', 'media', 'fullscreen', 'wordpress', 'wpeditimage', 'wpgallery', 'wplink', 'wpdialogs' );197 202 $first_run = true; 198 203 $ext_plugins = ''; 199 204 200 205 if ( $set['teeny'] ) { 201 self::$plugins = $plugins = apply_filters( 'teeny_mce_plugins', array( 'inlinepopups', 'fullscreen', 'wordpress', 'wplink', 'wpdialogs' ), $editor_id );206 self::$plugins = $plugins = apply_filters( 'teeny_mce_plugins', array( 'fullscreen', 'link', 'image', 'wordpress', 'wplink' ), $editor_id ); 202 207 } else { 203 /* 204 The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'. 205 It adds the plugin's name to TinyMCE's plugins init and the call to PluginManager to load the plugin. 206 The url should be absolute and should include the js file name to be loaded. Example: 207 array( 'myplugin' => 'http://my-site.com/wp-content/plugins/myfolder/mce_plugin.js' ) 208 If the plugin uses a button, it should be added with one of the "$mce_buttons" filters. 209 */ 210 $mce_external_plugins = apply_filters('mce_external_plugins', array()); 211 212 if ( ! empty($mce_external_plugins) ) { 213 214 /* 215 The following filter loads external language files for TinyMCE plugins. 216 It takes an associative array 'plugin_name' => 'path', where path is the 217 include path to the file. The language file should follow the same format as 218 /tinymce/langs/wp-langs.php and should define a variable $strings that 219 holds all translated strings. 220 When this filter is not used, the function will try to load {mce_locale}.js. 221 If that is not found, en.js will be tried next. 222 */ 223 $mce_external_languages = apply_filters('mce_external_languages', array()); 208 /** 209 * TinyMCE external plugins filter 210 * 211 * Takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'. 212 * The url should be absolute and should include the js file name to be loaded. 213 * Example: 'myplugin' => 'http://my-site.com/wp-content/plugins/myfolder/mce_plugin.js'. 214 * If the plugin adds a button, it should be added with one of the "$mce_buttons" filters. 215 */ 216 $mce_external_plugins = apply_filters( 'mce_external_plugins', array() ); 217 218 /** 219 * TinyMCE default plugins filter 220 * 221 * Specifies which of the default plugins that are included in WordPress should be added to 222 * the TinyMCE instance. 223 */ 224 $plugins = array_unique( apply_filters( 'tiny_mce_plugins', array( 225 'charmap', 226 'link', 227 'media', 228 'paste', 229 'tabfocus', 230 'textcolor', 231 'image', 232 'fullscreen', 233 'wordpress', 234 'wpeditimage', 235 'wpgallery', 236 'wplink', 237 ) ) ); 238 239 if ( ! empty( $mce_external_plugins ) ) { 240 /** 241 * This filter loads translations for external TinyMCE 3.x plugins. 242 * 243 * Takes an associative array 'plugin_name' => 'path', where path is the 244 * include path to the file. The language file should follow the same format as 245 * wp_mce_translation() and should define a variable $strings that 246 * holds all translated strings. 247 */ 248 $mce_external_languages = apply_filters( 'mce_external_languages', array() ); 224 249 225 250 $loaded_langs = array(); 226 251 $strings = ''; 227 252 228 if ( ! empty( $mce_external_languages) ) {253 if ( ! empty( $mce_external_languages ) ) { 229 254 foreach ( $mce_external_languages as $name => $path ) { 230 if ( @is_file( $path) && @is_readable($path) ) {231 include_once( $path);255 if ( @is_file( $path ) && @is_readable( $path ) ) { 256 include_once( $path ); 232 257 $ext_plugins .= $strings . "\n"; 233 258 $loaded_langs[] = $name; … … 237 262 238 263 foreach ( $mce_external_plugins as $name => $url ) { 264 if ( in_array( $name, $plugins, true ) ) { 265 unset( $mce_external_plugins[ $name ] ); 266 continue; 267 } 239 268 240 269 $url = set_url_scheme( $url ); 241 242 $plugins[] = '-' . $name; 243 244 $plugurl = dirname($url); 245 $strings = $str1 = $str2 = ''; 246 if ( ! in_array($name, $loaded_langs) ) { 247 $path = str_replace( content_url(), '', $plugurl ); 248 $path = WP_CONTENT_DIR . $path . '/langs/'; 249 250 if ( function_exists('realpath') ) 251 $path = trailingslashit( realpath($path) ); 252 253 if ( @is_file($path . $mce_locale . '.js') ) 254 $strings .= @file_get_contents($path . $mce_locale . '.js') . "\n"; 255 256 if ( @is_file($path . $mce_locale . '_dlg.js') ) 257 $strings .= @file_get_contents($path . $mce_locale . '_dlg.js') . "\n"; 258 259 if ( 'en' != $mce_locale && empty($strings) ) { 260 if ( @is_file($path . 'en.js') ) { 261 $str1 = @file_get_contents($path . 'en.js'); 262 $strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str1, 1 ) . "\n"; 263 } 264 265 if ( @is_file($path . 'en_dlg.js') ) { 266 $str2 = @file_get_contents($path . 'en_dlg.js'); 267 $strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str2, 1 ) . "\n"; 268 } 269 } 270 271 if ( ! empty($strings) ) 272 $ext_plugins .= "\n" . $strings . "\n"; 270 $mce_external_plugins[ $name ] = $url; 271 $plugurl = dirname( $url ); 272 273 if ( in_array( $name, $loaded_langs ) ) { 274 $ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n"; 273 275 } 274 275 $ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n";276 $ext_plugins .= 'tinymce.PluginManager.load("' . $name . '", "' . $url . '");' . "\n";277 276 } 278 277 } 279 280 $plugins = array_unique( apply_filters('tiny_mce_plugins', $plugins) );281 278 } 282 279 … … 287 284 self::$ext_plugins = $ext_plugins; 288 285 289 if ( in_array( 'spellchecker', $plugins ) ) {290 /*291 translators: These languages show up in the spellchecker drop-down menu, in the order specified, and with the first292 language listed being the default language. They must be comma-separated and take the format of name=code, where name293 is the language name (which you may internationalize), and code is a valid ISO 639 language code. Please test the294 spellchecker with your values.295 */296 $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' );297 298 /*299 The following filter allows localization scripts to change the languages displayed in the spellchecker's drop-down menu.300 By default it uses Google's spellchecker API, but can be configured to use PSpell/ASpell if installed on the server.301 The + sign marks the default language. More: http://www.tinymce.com/wiki.php/Plugin:spellchecker.302 */303 $mce_spellchecker_languages = apply_filters( 'mce_spellchecker_languages', '+' . $mce_spellchecker_languages );304 }305 306 286 self::$first_init = array( 307 'mode' => 'exact', 308 'width' => '100%', 309 'theme' => 'advanced', 310 'skin' => 'wp_theme', 287 'theme' => 'modern', 288 'skin' => 'lightgray', 311 289 'language' => self::$mce_locale, 312 'theme_advanced_toolbar_location' => 'top', 313 'theme_advanced_toolbar_align' => 'left', 314 'theme_advanced_statusbar_location' => 'bottom', 315 'theme_advanced_resizing' => true, 316 'theme_advanced_resize_horizontal' => false, 317 'dialog_type' => 'modal', 290 'resize' => 'vertical', 318 291 'formats' => "{ 319 alignleft : [320 {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign :'left'}},321 {selector : 'img,table', classes: 'alignleft'}292 alignleft: [ 293 {selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: {textAlign:'left'}}, 294 {selector: 'img,table,dl.wp-caption', classes: 'alignleft'} 322 295 ], 323 aligncenter : [324 {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign :'center'}},325 {selector : 'img,table', classes: 'aligncenter'}296 aligncenter: [ 297 {selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: {textAlign:'center'}}, 298 {selector: 'img,table,dl.wp-caption', classes: 'aligncenter'} 326 299 ], 327 alignright : [328 {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign :'right'}},329 {selector : 'img,table', classes: 'alignright'}300 alignright: [ 301 {selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: {textAlign:'right'}}, 302 {selector: 'img,table,dl.wp-caption', classes: 'alignright'} 330 303 ], 331 strikethrough : {inline: 'del'}304 strikethrough: {inline: 'del'} 332 305 }", 333 306 'relative_urls' => false, 334 307 'remove_script_host' => false, 335 308 'convert_urls' => false, 336 'remove_linebreaks' => true, 337 'gecko_spellcheck' => true, 309 'browser_spellcheck' => true, 338 310 'fix_list_elements' => true, 311 'entities' => '38,amp,60,lt,62,gt', 312 'entity_encoding' => 'raw', 313 'menubar' => false, 314 'object_resizing' => false, 339 315 'keep_styles' => false, 340 'entities' => '38,amp,60,lt,62,gt',341 'accessibility_focus' => true,342 'media_strict' => false,343 316 'paste_remove_styles' => true, 344 'paste_remove_spans' => true, 345 'paste_strip_class_attributes' => 'all', 346 'paste_text_use_dialog' => true, 347 'webkit_fake_resize' => false, 348 'preview_styles' => 'font-family font-weight text-decoration text-transform', 349 'schema' => 'html5', 317 318 // limit the preview styles in the menu/toolbar 319 // 'preview_styles' => 'font-family font-weight font-style text-decoration text-transform color background-color border', 320 350 321 'wpeditimage_disable_captions' => $no_captions, 351 'wp_fullscreen_content_css' => self::$baseurl . '/plugins/wpfullscreen/css/wp-fullscreen.css', 352 'plugins' => implode( ',', $plugins ) 322 'plugins' => implode( ',', $plugins ), 353 323 ); 354 324 355 if ( in_array( 'spellchecker', $plugins ) ) { 325 if ( ! empty( $mce_external_plugins ) ) { 326 self::$first_init['external_plugins'] = json_encode( $mce_external_plugins ); 327 } 328 329 if ( in_array( 'spellchecker', $plugins, true ) ) { 356 330 self::$first_init['spellchecker_rpc_url'] = self::$baseurl . '/plugins/spellchecker/rpc.php'; 357 self::$first_init['spellchecker_language s'] = $mce_spellchecker_languages;331 self::$first_init['spellchecker_language'] = self::$mce_locale; 358 332 } 333 334 // WordPress default stylesheet 335 $mce_css = array( self::$baseurl . '/skins/wordpress/wp-content.css' ); 359 336 360 337 // load editor_style.css if the current theme supports it … … 362 339 $editor_styles = $GLOBALS['editor_styles']; 363 340 364 $mce_css = array();365 341 $editor_styles = array_unique( array_filter( $editor_styles ) ); 366 342 $style_uri = get_stylesheet_directory_uri(); … … 390 366 $mce_css[] = "$style_uri/$file"; 391 367 } 392 393 $mce_css = implode( ',', $mce_css );394 } else {395 $mce_css = '';396 368 } 397 369 398 $mce_css = trim( apply_filters( 'mce_css', $mce_css), ' ,' );370 $mce_css = trim( apply_filters( 'mce_css', implode( ',', $mce_css ) ), ' ,' ); 399 371 400 372 if ( ! empty($mce_css) ) … … 403 375 404 376 if ( $set['teeny'] ) { 405 $mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', ' justifyleft', 'justifycenter', 'justifyright', 'undo', 'redo', 'link', 'unlink', 'fullscreen'), $editor_id );377 $mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'undo', 'redo', 'link', 'unlink', 'fullscreen'), $editor_id ); 406 378 $mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = array(); 407 379 } else { 408 $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', ' justifyleft', 'justifycenter', 'justifyright', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv' ), $editor_id);409 $mce_buttons_2 = apply_filters('mce_buttons_2', array( 'formatselect', 'underline', ' justifyfull', 'forecolor', 'pastetext', 'pasteword', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' ), $editor_id);380 $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'alignleft', 'aligncenter', 'alignright', 'image', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv' ), $editor_id); 381 $mce_buttons_2 = apply_filters('mce_buttons_2', array( 'formatselect', 'underline', 'alignjustify', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' ), $editor_id); 410 382 $mce_buttons_3 = apply_filters('mce_buttons_3', array(), $editor_id); 411 383 $mce_buttons_4 = apply_filters('mce_buttons_4', array(), $editor_id); … … 443 415 444 416 $mceInit = array ( 445 ' elements' => $editor_id,417 'selector' => "#$editor_id", 446 418 'wpautop' => (bool) $set['wpautop'], 447 'remove_linebreaks' => (bool) $set['wpautop'], 448 'apply_source_formatting' => (bool) !$set['wpautop'], 449 'theme_advanced_buttons1' => implode($mce_buttons, ','), 450 'theme_advanced_buttons2' => implode($mce_buttons_2, ','), 451 'theme_advanced_buttons3' => implode($mce_buttons_3, ','), 452 'theme_advanced_buttons4' => implode($mce_buttons_4, ','), 419 'indent' => ! $set['wpautop'], 420 'toolbar1' => implode($mce_buttons, ','), 421 'toolbar2' => implode($mce_buttons_2, ','), 422 'toolbar3' => implode($mce_buttons_3, ','), 423 'toolbar4' => implode($mce_buttons_4, ','), 453 424 'tabfocus_elements' => $set['tabfocus_elements'], 454 425 'body_class' => $body_class 455 426 ); 456 427 457 // The main editor doesn't use the TinyMCE resizing cookie.458 $mceInit['theme_advanced_resizing_use_cookie'] = 'content' !== $editor_id || empty( $set['editor_height'] );459 460 428 if ( $first_run ) 461 $mceInit = array_merge( self::$first_init, $mceInit);462 463 if ( is_array( $set['tinymce']) )464 $mceInit = array_merge( $mceInit, $set['tinymce']);429 $mceInit = array_merge( self::$first_init, $mceInit ); 430 431 if ( is_array( $set['tinymce'] ) ) 432 $mceInit = array_merge( $mceInit, $set['tinymce'] ); 465 433 466 434 // For people who really REALLY know what they're doing with TinyMCE … … 469 437 // Best is to use the default cleanup by not specifying valid_elements, as TinyMCE contains full set of XHTML 1.0. 470 438 if ( $set['teeny'] ) { 471 $mceInit = apply_filters( 'teeny_mce_before_init', $mceInit, $editor_id);439 $mceInit = apply_filters( 'teeny_mce_before_init', $mceInit, $editor_id ); 472 440 } else { 473 $mceInit = apply_filters( 'tiny_mce_before_init', $mceInit, $editor_id);474 } 475 476 if ( empty( $mceInit['theme_advanced_buttons3']) && !empty($mceInit['theme_advanced_buttons4']) ) {477 $mceInit['t heme_advanced_buttons3'] = $mceInit['theme_advanced_buttons4'];478 $mceInit['t heme_advanced_buttons4'] = '';441 $mceInit = apply_filters( 'tiny_mce_before_init', $mceInit, $editor_id ); 442 } 443 444 if ( empty( $mceInit['toolbar3'] ) && ! empty( $mceInit['toolbar4'] ) ) { 445 $mceInit['toolbar3'] = $mceInit['toolbar4']; 446 $mceInit['toolbar4'] = ''; 479 447 } 480 448 … … 512 480 if ( in_array('wplink', self::$plugins, true) || in_array('link', self::$qt_buttons, true) ) { 513 481 wp_enqueue_script('wplink'); 514 wp_enqueue_script('wpdialogs -popup');482 wp_enqueue_script('wpdialogs'); 515 483 wp_enqueue_style('wp-jquery-ui-dialog'); 516 484 } … … 520 488 521 489 if ( self::$has_medialib ) { 522 add_thickbox();490 // add_thickbox(); // ? 523 491 wp_enqueue_script('media-upload'); 524 492 } 493 } 494 495 public static function wp_mce_translation() { 496 497 $mce_translation = array( 498 // Default TinyMCE strings 499 'Cut' => __('Cut'), 500 'Header 2' => __('Header 2'), 501 'Your browser doesn\'t support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.' => __('Your browser does not support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.'), 502 'Div' => __('Div'), 503 'Paste' => __('Paste'), 504 'Close' => __('Close'), 505 'Pre' => __('Pre'), 506 'Align right' => __('Align right'), 507 'New document' => __('New document'), 508 'Blockquote' => __('Blockquote'), 509 'Numbered list' => __('Numbered list'), 510 'Increase indent' => __('Increase indent'), 511 'Formats' => __('Formats'), 512 'Headers' => __('Headers'), 513 'Select all' => __('Select all'), 514 'Header 3' => __('Header 3'), 515 'Blocks' => __('Blocks'), 516 'Undo' => __('Undo'), 517 'Strikethrough' => __('Strikethrough'), 518 'Bullet list' => __('Bullet list'), 519 'Header 1' => __('Header 1'), 520 'Superscript' => __('Superscript'), 521 'Clear formatting' => __('Clear formatting'), 522 'Subscript' => __('Subscript'), 523 'Header 6' => __('Header 6'), 524 'Redo' => __('Redo'), 525 'Paragraph' => __('Paragraph'), 526 'Ok' => __('Ok'), 527 'Bold' => __('Bold'), 528 'Code' => __('Code'), 529 'Italic' => __('Italic'), 530 'Align center' => __('Align center'), 531 'Header 5' => __('Header 5'), 532 'Decrease indent' => __('Decrease indent'), 533 'Header 4' => __('Header 4'), 534 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.' => __('Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.'), 535 'Underline' => __('Underline'), 536 'Cancel' => __('Cancel'), 537 'Justify' => __('Justify'), 538 'Inline' => __('Inline'), 539 'Copy' => __('Copy'), 540 'Align left' => __('Align left'), 541 'Visual aids' => __('Visual aids'), 542 'Lower Greek' => __('Lower Greek'), 543 'Square' => __('Square'), 544 'Default' => __('Default'), 545 'Lower Alpha' => __('Lower Alpha'), 546 'Circle' => __('Circle'), 547 'Disc' => __('Disc'), 548 'Upper Alpha' => __('Upper Alpha'), 549 'Upper Roman' => __('Upper Roman'), 550 'Lower Roman' => __('Lower Roman'), 551 'Name' => __('Name'), 552 'Anchor' => __('Anchor'), 553 'You have unsaved changes are you sure you want to navigate away?' => __('You have unsaved changes are you sure you want to navigate away?'), 554 'Restore last draft' => __('Restore last draft'), 555 'Special character' => __('Special character'), 556 'Source code' => __('Source code'), 557 'Right to left' => __('Right to left'), 558 'Left to right' => __('Left to right'), 559 'Emoticons' => __('Emoticons'), 560 'Robots' => __('Robots'), 561 'Document properties' => __('Document properties'), 562 'Title' => __('Title'), 563 'Keywords' => __('Keywords'), 564 'Encoding' => __('Encoding'), 565 'Description' => __('Description'), 566 'Author' => __('Author'), 567 'Fullscreen' => __('Fullscreen'), 568 'Horizontal line' => __('Horizontal line'), 569 'Horizontal space' => __('Horizontal space'), 570 'Insert/edit image' => __('Insert/edit image'), 571 'General' => __('General'), 572 'Advanced' => __('Advanced'), 573 'Source' => __('Source'), 574 'Border' => __('Border'), 575 'Constrain proportions' => __('Constrain proportions'), 576 'Vertical space' => __('Vertical space'), 577 'Image description' => __('Image description'), 578 'Style' => __('Style'), 579 'Dimensions' => __('Dimensions'), 580 'Insert image' => __('Insert image'), 581 'Insert date/time' => __('Insert date/time'), 582 'Remove link' => __('Remove link'), 583 'Url' => __('Url'), 584 'Text to display' => __('Text to display'), 585 'Anchors' => __('Anchors'), 586 'Insert link' => __('Insert link'), 587 'New window' => __('New window'), 588 'None' => __('None'), 589 'Target' => __('Target'), 590 'Insert/edit link' => __('Insert/edit link'), 591 'Insert/edit video' => __('Insert/edit video'), 592 'Poster' => __('Poster'), 593 'Alternative source' => __('Alternative source'), 594 'Paste your embed code below:' => __('Paste your embed code below:'), 595 'Insert video' => __('Insert video'), 596 'Embed' => __('Embed'), 597 'Nonbreaking space' => __('Nonbreaking space'), 598 'Page break' => __('Page break'), 599 'Paste as text' => __('Paste as text'), 600 'Preview' => __('Preview'), 601 'Print' => __('Print'), 602 'Save' => __('Save'), 603 'Could not find the specified string.' => __('Could not find the specified string.'), 604 'Replace' => __('Replace'), 605 'Next' => __('Next'), 606 'Whole words' => __('Whole words'), 607 'Find and replace' => __('Find and replace'), 608 'Replace with' => __('Replace with'), 609 'Find' => __('Find'), 610 'Replace all' => __('Replace all'), 611 'Match case' => __('Match case'), 612 'Prev' => __('Prev'), 613 'Spellcheck' => __('Spellcheck'), 614 'Finish' => __('Finish'), 615 'Ignore all' => __('Ignore all'), 616 'Ignore' => __('Ignore'), 617 'Insert row before' => __('Insert row before'), 618 'Rows' => __('Rows'), 619 'Height' => __('Height'), 620 'Paste row after' => __('Paste row after'), 621 'Alignment' => __('Alignment'), 622 'Column group' => __('Column group'), 623 'Row' => __('Row'), 624 'Insert column before' => __('Insert column before'), 625 'Split cell' => __('Split cell'), 626 'Cell padding' => __('Cell padding'), 627 'Cell spacing' => __('Cell spacing'), 628 'Row type' => __('Row type'), 629 'Insert table' => __('Insert table'), 630 'Body' => __('Body'), 631 'Caption' => __('Caption'), 632 'Footer' => __('Footer'), 633 'Delete row' => __('Delete row'), 634 'Paste row before' => __('Paste row before'), 635 'Scope' => __('Scope'), 636 'Delete table' => __('Delete table'), 637 'Header cell' => __('Header cell'), 638 'Column' => __('Column'), 639 'Cell' => __('Cell'), 640 'Header' => __('Header'), 641 'Cell type' => __('Cell type'), 642 'Copy row' => __('Copy row'), 643 'Row properties' => __('Row properties'), 644 'Table properties' => __('Table properties'), 645 'Row group' => __('Row group'), 646 'Right' => __('Right'), 647 'Insert column after' => __('Insert column after'), 648 'Cols' => __('Cols'), 649 'Insert row after' => __('Insert row after'), 650 'Width' => __('Width'), 651 'Cell properties' => __('Cell properties'), 652 'Left' => __('Left'), 653 'Cut row' => __('Cut row'), 654 'Delete column' => __('Delete column'), 655 'Center' => __('Center'), 656 'Merge cells' => __('Merge cells'), 657 'Insert template' => __('Insert template'), 658 'Templates' => __('Templates'), 659 'Background color' => __('Background color'), 660 'Text color' => __('Text color'), 661 'Show blocks' => __('Show blocks'), 662 'Show invisible characters' => __('Show invisible characters'), 663 'Words: {0}' => __('Words: {0}'), 664 'Insert' => __('Insert'), 665 'File' => __('File'), 666 'Edit' => __('Edit'), 667 'Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help' => __('Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help'), 668 'Tools' => __('Tools'), 669 'View' => __('View'), 670 'Table' => __('Table'), 671 'Format' => __('Format'), 672 673 // WordPress strings 674 'Help' => __('Help'), 675 'Toolbar Toggle' => __('Toolbar Toggle'), 676 'Insert Read More tag' => __('Insert Read More tag'), 677 'Distraction Free Writing' => __('Distraction Free Writing'), 678 ); 679 680 $baseurl = self::$baseurl; 681 $mce_locale = self::$mce_locale; 682 683 $mce_translation = apply_filters( 'wp_mce_translation', $mce_translation, $mce_locale ); 684 685 foreach ( $mce_translation as $key => $value ) { 686 if ( strpos( $value, '&' ) !== false ) 687 $mce_translation[$key] = html_entity_decode( $value, ENT_QUOTES ); 688 } 689 690 return "tinymce.addI18n( '$mce_locale', " . json_encode( $mce_translation ) . ");\n" . 691 "tinymce.ScriptLoader.markDone( '$baseurl/langs/$mce_locale.js' );\n"; 525 692 } 526 693 … … 544 711 && false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'); 545 712 546 if ( $tmce_on && 'en' != self::$mce_locale )547 include_once(ABSPATH . WPINC . '/js/tinymce/langs/wp-langs.php');548 549 713 $mceInit = $qtInit = ''; 550 714 if ( $tmce_on ) { … … 570 734 $ref = array( 571 735 'plugins' => implode( ',', self::$plugins ), 572 'theme' => ' advanced',736 'theme' => 'modern', 573 737 'language' => self::$mce_locale 574 738 ); 575 739 576 $suffix = ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ? ' _src' : '';577 578 do_action( 'before_wp_tiny_mce', self::$mce_settings);579 ?>580 581 <script type="text/javascript">740 $suffix = ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ? '' : '.min'; 741 742 do_action( 'before_wp_tiny_mce', self::$mce_settings ); 743 ?> 744 745 <script type="text/javascript"> 582 746 tinyMCEPreInit = { 583 base : "<?php echo self::$baseurl; ?>", 584 suffix : "<?php echo $suffix; ?>", 585 query : "<?php echo $version; ?>", 586 mceInit : <?php echo $mceInit; ?>, 587 qtInit : <?php echo $qtInit; ?>, 588 ref : <?php echo self::_parse_init( $ref ); ?>, 589 load_ext : function(url,lang){var sl=tinymce.ScriptLoader;sl.markDone(url+'/langs/'+lang+'.js');sl.markDone(url+'/langs/'+lang+'_dlg.js');} 747 baseURL: "<?php echo self::$baseurl; ?>", 748 suffix: "<?php echo $suffix; ?>", 749 mceInit: <?php echo $mceInit; ?>, 750 qtInit: <?php echo $qtInit; ?>, 751 ref: <?php echo self::_parse_init( $ref ); ?>, 752 load_ext: function(url,lang){var sl=tinymce.ScriptLoader;sl.markDone(url+'/langs/'+lang+'.js');sl.markDone(url+'/langs/'+lang+'_dlg.js');} 590 753 }; 591 </script>592 <?php754 </script> 755 <?php 593 756 594 757 $baseurl = self::$baseurl; … … 598 761 echo "<script type='text/javascript' src='{$baseurl}/wp-tinymce.php?c=1&$version'></script>\n"; 599 762 } else { 600 echo "<script type='text/javascript' src='{$baseurl}/tiny_mce.js?$version'></script>\n"; 601 echo "<script type='text/javascript' src='{$baseurl}/wp-tinymce-schema.js?$version'></script>\n"; 602 } 603 604 if ( 'en' != self::$mce_locale && isset($lang) ) 605 echo "<script type='text/javascript'>\n$lang\n</script>\n"; 606 else 763 echo "<script type='text/javascript' src='{$baseurl}/tinymce.js?$version'></script>\n"; 764 echo "<script type='text/javascript' src='{$baseurl}/plugins/compat3x/plugin{$suffix}.js?$version'></script>\n"; 765 } 766 767 if ( 'en' != self::$mce_locale ) 768 echo "<script type='text/javascript'>\n" . self::wp_mce_translation() . "</script>\n"; 769 770 if ( self::$ext_plugins ) { 771 // Load the old-format English strings to prevent unsightly labels in old style popups 607 772 echo "<script type='text/javascript' src='{$baseurl}/langs/wp-langs-en.js?$version'></script>\n"; 608 } 609 610 $mce = ( self::$has_tinymce && wp_default_editor() == 'tinymce' ) || ! self::$has_quicktags; 611 ?> 612 613 <script type="text/javascript"> 614 var wpActiveEditor; 615 616 (function(){ 617 var init, ed, qt, first_init, DOM, el, i, mce = <?php echo (int) $mce; ?>; 618 619 if ( typeof(tinymce) == 'object' ) { 620 DOM = tinymce.DOM; 621 // mark wp_theme/ui.css as loaded 622 DOM.files[tinymce.baseURI.getURI() + '/themes/advanced/skins/wp_theme/ui.css'] = true; 623 624 DOM.events.add( DOM.select('.wp-editor-wrap'), 'mousedown', function(e){ 625 if ( this.id ) 626 wpActiveEditor = this.id.slice(3, -5); 627 }); 628 629 for ( ed in tinyMCEPreInit.mceInit ) { 630 if ( first_init ) { 631 init = tinyMCEPreInit.mceInit[ed] = tinymce.extend( {}, first_init, tinyMCEPreInit.mceInit[ed] ); 773 } 774 } 775 776 // Allow scripts to be added after tinymce.js has been loaded but before any editor instances are created. 777 do_action( 'wp_tiny_mce_init', self::$mce_settings ); 778 779 ?> 780 <script type="text/javascript"> 781 <?php 782 783 if ( self::$ext_plugins ) 784 echo self::$ext_plugins . "\n"; 785 786 if ( ! is_admin() ) 787 echo 'var ajaxurl = "' . admin_url( 'admin-ajax.php', 'relative' ) . '";'; 788 789 ?> 790 791 ( function() { 792 var init, edId, qtId, firstInit, 793 loadMCE = typeof getUserSetting !== 'undefined' ? getUserSetting( 'editor' ) === 'tinymce' : true; 794 795 if ( typeof quicktags !== 'undefined' ) { 796 for ( qtId in tinyMCEPreInit.qtInit ) { 797 try { quicktags( tinyMCEPreInit.qtInit[qtId] ); } catch(e){}; 798 } 799 } 800 801 if ( typeof tinymce !== 'undefined' ) { 802 for ( edId in tinyMCEPreInit.mceInit ) { 803 if ( firstInit ) { 804 init = tinyMCEPreInit.mceInit[edId] = tinymce.extend( {}, firstInit, tinyMCEPreInit.mceInit[edId] ); 632 805 } else { 633 init = first _init = tinyMCEPreInit.mceInit[ed];806 init = firstInit = tinyMCEPreInit.mceInit[edId]; 634 807 } 635 808 636 if ( mce ) 637 try { tinymce.init(init); } catch(e){} 638 } 639 } else { 640 if ( tinyMCEPreInit.qtInit ) { 641 for ( i in tinyMCEPreInit.qtInit ) { 642 el = tinyMCEPreInit.qtInit[i].id; 643 if ( el ) 644 document.getElementById('wp-'+el+'-wrap').onmousedown = function(){ wpActiveEditor = this.id.slice(3, -5); } 809 if ( ( loadMCE || ! tinyMCEPreInit.qtInit.hasOwnProperty( edId ) ) && ! init.wp_skip_init ) { 810 try { tinymce.init( init ); } catch(e){} 645 811 } 646 812 } 647 813 } 648 649 if ( typeof(QTags) == 'function' ) { 650 for ( qt in tinyMCEPreInit.qtInit ) { 651 try { quicktags( tinyMCEPreInit.qtInit[qt] ); } catch(e){} 652 } 653 } 654 })(); 655 <?php 656 657 if ( self::$ext_plugins ) 658 echo self::$ext_plugins . "\n"; 659 660 if ( ! $compressed && $tmce_on ) { 661 ?> 662 (function(){var t=tinyMCEPreInit,sl=tinymce.ScriptLoader,ln=t.ref.language,th=t.ref.theme,pl=t.ref.plugins;sl.markDone(t.base+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'_dlg.js');sl.markDone(t.base+'/themes/advanced/skins/wp_theme/ui.css');tinymce.each(pl.split(','),function(n){if(n&&n.charAt(0)!='-'){sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'.js');sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'_dlg.js');}});})(); 663 <?php 664 } 665 666 if ( !is_admin() ) 667 echo 'var ajaxurl = "' . admin_url( 'admin-ajax.php', 'relative' ) . '";'; 668 669 ?> 814 }()); 815 670 816 </script> 671 817 <?php … … 677 823 self::wp_fullscreen_html(); 678 824 679 do_action( 'after_wp_tiny_mce', self::$mce_settings);825 do_action( 'after_wp_tiny_mce', self::$mce_settings ); 680 826 } 681 827 … … 684 830 $post = get_post(); 685 831 686 $width = isset( $content_width) && 800 > $content_width ? $content_width : 800;832 $width = isset( $content_width ) && 800 > $content_width ? $content_width : 800; 687 833 $width = $width + 22; // compensate for the padding and border 688 834 $dfw_width = get_user_setting( 'dfw_width', $width ); 689 $save = isset($post->post_status) && $post->post_status == 'publish' ? __('Update') : __('Save'); 690 ?> 691 <div id="wp-fullscreen-body"<?php if ( is_rtl() ) echo ' class="rtl"'; ?>> 692 <div id="fullscreen-topbar"> 693 <div id="wp-fullscreen-toolbar"> 694 <div id="wp-fullscreen-close"><a href="#" onclick="fullscreen.off();return false;"><?php _e('Exit fullscreen'); ?></a></div> 835 $save = isset( $post->post_status ) && $post->post_status == 'publish' ? __('Update') : __('Save'); 836 837 ?> 838 <div id="wp-fullscreen-body"<?php if ( is_rtl() ) echo ' class="rtl"'; ?> data-theme-width="<?php echo (int) $width; ?>" data-dfw-width="<?php echo (int) $dfw_width; ?>"> 839 <div id="fullscreen-topbar"> 840 <div id="wp-fullscreen-toolbar"> 841 <div id="wp-fullscreen-close"><a href="#" onclick="wp.editor.fullscreen.off();return false;"><?php _e('Exit fullscreen'); ?></a></div> 695 842 <div id="wp-fullscreen-central-toolbar" style="width:<?php echo $width; ?>px;"> 696 843 697 844 <div id="wp-fullscreen-mode-bar"><div id="wp-fullscreen-modes"> 698 <a href="#" onclick=" fullscreen.switchmode('tinymce');return false;"><?php _e( 'Visual' ); ?></a>699 <a href="#" onclick=" fullscreen.switchmode('html');return false;"><?php _ex( 'Text', 'Name for the Text editor tab (formerly HTML)' ); ?></a>845 <a href="#" onclick="wp.editor.fullscreen.switchmode('tinymce');return false;"><?php _e( 'Visual' ); ?></a> 846 <a href="#" onclick="wp.editor.fullscreen.switchmode('html');return false;"><?php _ex( 'Text', 'Name for the Text editor tab (formerly HTML)' ); ?></a> 700 847 </div></div> 701 848 702 <div id="wp-fullscreen-button-bar"><div id="wp-fullscreen-buttons" class=" wp_themeSkin">703 <?php849 <div id="wp-fullscreen-button-bar"><div id="wp-fullscreen-buttons" class="mce-toolbar"> 850 <?php 704 851 705 852 $buttons = array( 706 853 // format: title, onclick, show in both editors 707 'bold' => array( 'title' => __('Bold (Ctrl + B)'), 'onclick' => 'fullscreen.b();', 'both' => false ), 708 'italic' => array( 'title' => __('Italic (Ctrl + I)'), 'onclick' => 'fullscreen.i();', 'both' => false ), 709 '0' => 'separator', 710 'bullist' => array( 'title' => __('Unordered list (Alt + Shift + U)'), 'onclick' => 'fullscreen.ul();', 'both' => false ), 711 'numlist' => array( 'title' => __('Ordered list (Alt + Shift + O)'), 'onclick' => 'fullscreen.ol();', 'both' => false ), 712 '1' => 'separator', 713 'blockquote' => array( 'title' => __('Blockquote (Alt + Shift + Q)'), 'onclick' => 'fullscreen.blockquote();', 'both' => false ), 714 'image' => array( 'title' => __('Insert/edit image (Alt + Shift + M)'), 'onclick' => "fullscreen.medialib();", 'both' => true ), 715 '2' => 'separator', 716 'link' => array( 'title' => __('Insert/edit link (Alt + Shift + A)'), 'onclick' => 'fullscreen.link();', 'both' => true ), 717 'unlink' => array( 'title' => __('Unlink (Alt + Shift + S)'), 'onclick' => 'fullscreen.unlink();', 'both' => false ), 718 '3' => 'separator', 719 'help' => array( 'title' => __('Help (Alt + Shift + H)'), 'onclick' => 'fullscreen.help();', 'both' => false ) 854 'bold' => array( 'title' => __('Bold (Ctrl + B)'), 'both' => false ), 855 'italic' => array( 'title' => __('Italic (Ctrl + I)'), 'both' => false ), 856 'bullist' => array( 'title' => __('Unordered list (Alt + Shift + U)'), 'both' => false ), 857 'numlist' => array( 'title' => __('Ordered list (Alt + Shift + O)'), 'both' => false ), 858 'blockquote' => array( 'title' => __('Blockquote (Alt + Shift + Q)'), 'both' => false ), 859 'wp-media-library' => array( 'title' => __('Media library (Alt + Shift + M)'), 'both' => true ), 860 'image' => array( 'title' => __('Insert/edit image'), 'both' => false ), 861 'link' => array( 'title' => __('Insert/edit link (Alt + Shift + A)'), 'both' => true ), 862 'unlink' => array( 'title' => __('Unlink (Alt + Shift + S)'), 'both' => false ), 863 'help' => array( 'title' => __('Help (Alt + Shift + H)'), 'both' => false ), 720 864 ); 721 865 … … 723 867 724 868 foreach ( $buttons as $button => $args ) { 725 if ( 'separator' == $args ) { ?> 726 <div><span aria-orientation="vertical" role="separator" class="mceSeparator"></span></div> 727 <?php continue; 728 } ?> 729 730 <div<?php if ( $args['both'] ) { ?> class="wp-fullscreen-both"<?php } ?>> 731 <a title="<?php echo $args['title']; ?>" onclick="<?php echo $args['onclick']; ?>return false;" class="mceButton mceButtonEnabled mce_<?php echo $button; ?>" href="#" id="wp_fs_<?php echo $button; ?>" role="button" aria-pressed="false"> 732 <span class="mceIcon mce_<?php echo $button; ?>"></span> 733 </a> 869 if ( 'separator' == $args ) { 870 continue; 871 } 872 873 $onclick = ! empty( $args['onclick'] ) ? ' onclick="' . $args['onclick'] . '"' : ''; 874 ?> 875 876 <div class="mce-widget mce-btn<?php if ( $args['both'] ) { ?> wp-fullscreen-both<?php } ?>"> 877 <button type="button" role="presentation" title="<?php echo $args['title']; ?>"<?php echo $onclick; ?> id="wp_fs_<?php echo $button; ?>"> 878 <i class="mce-ico mce-i-<?php echo $button; ?>"></i> 879 </button> 734 880 </div> 735 <?php 736 } ?> 737 738 </div></div> 739 740 <div id="wp-fullscreen-save"> 741 <input type="button" class="button-primary right" value="<?php echo $save; ?>" onclick="fullscreen.save();" /> 742 <span class="spinner"></span> 743 <span class="fs-saved"><?php if ( $post->post_status == 'publish' ) _e('Updated.'); else _e('Saved.'); ?></span> 744 </div> 745 746 </div> 881 <?php 882 } 883 884 ?> 885 886 </div></div> 887 888 <div id="wp-fullscreen-save"> 889 <input type="button" class="button-primary right" value="<?php echo $save; ?>" onclick="wp.editor.fullscreen.save();" /> 890 <span class="spinner"></span> 891 <span class="wp-fullscreen-saved-message"><?php if ( $post->post_status == 'publish' ) _e('Updated.'); else _e('Saved.'); ?></span> 892 <span class="wp-fullscreen-error-message"><?php _e('Save failed.'); ?></span> 893 </div> 894 895 </div> 747 896 </div> 748 897 </div> 749 750 <div id="wp-fullscreen-wrap" style="width:<?php echo $dfw_width; ?>px;"> 751 <?php if ( post_type_supports($post->post_type, 'title') ) { ?> 752 <label id="wp-fullscreen-title-prompt-text" for="wp-fullscreen-title"><?php echo apply_filters( 'enter_title_here', __( 'Enter title here' ), $post ); ?></label> 753 <input type="text" id="wp-fullscreen-title" value="" autocomplete="off" /> 754 <?php } ?> 755 756 <div id="wp-fullscreen-container"> 757 <textarea id="wp_mce_fullscreen"></textarea> 758 </div> 759 760 <div id="wp-fullscreen-status"> 761 <div id="wp-fullscreen-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></div> 762 <div id="wp-fullscreen-tagline"><?php _e('Just write.'); ?></div> 763 </div> 898 <div id="wp-fullscreen-status"> 899 <div id="wp-fullscreen-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></div> 900 <div id="wp-fullscreen-tagline"><?php _e('Just write.'); ?></div> 764 901 </div> 765 902 </div>
Note: See TracChangeset
for help on using the changeset viewer.