Changeset 43738 for branches/5.0/src/wp-includes/class-wp-editor.php
- Timestamp:
- 10/17/2018 03:28:33 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0/src/wp-includes/class-wp-editor.php
r43482 r43738 310 310 if ( is_admin() ) { 311 311 add_action( 'admin_print_footer_scripts', array( __CLASS__, 'editor_js' ), 50 ); 312 add_action( 'admin_print_footer_scripts', array( __CLASS__, 'force_uncompressed_tinymce' ), 1 ); 312 313 add_action( 'admin_print_footer_scripts', array( __CLASS__, 'enqueue_scripts' ), 1 ); 313 314 } else { 314 315 add_action( 'wp_print_footer_scripts', array( __CLASS__, 'editor_js' ), 50 ); 316 add_action( 'wp_print_footer_scripts', array( __CLASS__, 'force_uncompressed_tinymce' ), 1 ); 315 317 add_action( 'wp_print_footer_scripts', array( __CLASS__, 'enqueue_scripts' ), 1 ); 316 318 } … … 744 746 * 745 747 * @static 746 * 748 * 747 749 * @param bool $default_scripts Optional. Whether default scripts should be enqueued. Default false. 748 750 */ … … 806 808 807 809 if ( is_admin() ) { 810 add_action( 'admin_print_footer_scripts', array( __CLASS__, 'force_uncompressed_tinymce' ), 1 ); 808 811 add_action( 'admin_print_footer_scripts', array( __CLASS__, 'print_default_editor_scripts' ), 45 ); 809 812 } else { 813 add_action( 'wp_print_footer_scripts', array( __CLASS__, 'force_uncompressed_tinymce' ), 1 ); 810 814 add_action( 'wp_print_footer_scripts', array( __CLASS__, 'print_default_editor_scripts' ), 45 ); 811 815 } … … 1374 1378 1375 1379 /** 1380 * Force uncompressed TinyMCE when a custom theme has been defined. 1381 * 1382 * The compressed TinyMCE file cannot deal with custom themes, so this makes 1383 * sure that we use the uncompressed TinyMCE file if a theme is defined. 1384 * Even if we are on a production environment. 1385 */ 1386 public static function force_uncompressed_tinymce() { 1387 $has_custom_theme = false; 1388 foreach ( self::$mce_settings as $init ) { 1389 if ( ! empty( $init['theme_url'] ) ) { 1390 $has_custom_theme = true; 1391 break; 1392 } 1393 } 1394 1395 if ( ! $has_custom_theme ) { 1396 return; 1397 } 1398 1399 $wp_scripts = wp_scripts(); 1400 1401 $wp_scripts->remove( 'wp-tinymce' ); 1402 wp_register_tinymce_scripts( $wp_scripts, true ); 1403 } 1404 1405 /** 1376 1406 * Print (output) the main TinyMCE scripts. 1377 1407 * … … 1384 1414 */ 1385 1415 public static function print_tinymce_scripts() { 1386 global $ tinymce_version, $concatenate_scripts, $compress_scripts;1416 global $concatenate_scripts; 1387 1417 1388 1418 if ( self::$tinymce_scripts_printed ) { … … 1394 1424 if ( ! isset( $concatenate_scripts ) ) { 1395 1425 script_concat_settings(); 1396 }1397 1398 $suffix = SCRIPT_DEBUG ? '' : '.min';1399 $version = 'ver=' . $tinymce_version;1400 $baseurl = self::get_baseurl();1401 1402 $has_custom_theme = false;1403 foreach ( self::$mce_settings as $init ) {1404 if ( ! empty( $init['theme_url'] ) ) {1405 $has_custom_theme = true;1406 break;1407 }1408 }1409 1410 $compressed = $compress_scripts && $concatenate_scripts && isset( $_SERVER['HTTP_ACCEPT_ENCODING'] )1411 && false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) && ! $has_custom_theme;1412 1413 // Load tinymce.js when running from /src, else load wp-tinymce.js.gz (production) or tinymce.min.js (SCRIPT_DEBUG)1414 $mce_suffix = false !== strpos( get_bloginfo( 'version' ), '-src' ) ? '' : '.min';1415 1416 if ( $compressed ) {1417 echo "<script type='text/javascript' src='{$baseurl}/wp-tinymce.php?c=1&$version'></script>\n";1418 } else {1419 echo "<script type='text/javascript' src='{$baseurl}/tinymce{$mce_suffix}.js?$version'></script>\n";1420 echo "<script type='text/javascript' src='{$baseurl}/plugins/compat3x/plugin{$suffix}.js?$version'></script>\n";1421 1426 } 1422 1427
Note: See TracChangeset
for help on using the changeset viewer.