_WP_Editors::print_tinymce_scripts()

Print (output) the main TinyMCE scripts.


Source

File: wp-includes/class-wp-editor.php

	public static function print_tinymce_scripts() {
		global $tinymce_version, $concatenate_scripts, $compress_scripts;

		if ( self::$tinymce_scripts_printed ) {
			return;
		}

		self::$tinymce_scripts_printed = true;

		if ( ! isset( $concatenate_scripts ) ) {
			script_concat_settings();
		}

		$suffix = SCRIPT_DEBUG ? '' : '.min';
		$version = 'ver=' . $tinymce_version;
		$baseurl = self::get_baseurl();

		$has_custom_theme = false;
		foreach ( self::$mce_settings as $init ) {
			if ( ! empty( $init['theme_url'] ) ) {
				$has_custom_theme = true;
				break;
			}
		}

		$compressed = $compress_scripts && $concatenate_scripts && isset( $_SERVER['HTTP_ACCEPT_ENCODING'] )
			&& false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) && ! $has_custom_theme;

		// Load tinymce.js when running from /src, else load wp-tinymce.js.gz (production) or tinymce.min.js (SCRIPT_DEBUG)
		$mce_suffix = classicpress_is_dev_install() ? '' : '.min';

		if ( $compressed ) {
			echo "<script type='text/javascript' src='{$baseurl}/wp-tinymce.php?c=1&amp;$version'></script>\n";
		} else {
			echo "<script type='text/javascript' src='{$baseurl}/tinymce{$mce_suffix}.js?$version'></script>\n";
			echo "<script type='text/javascript' src='{$baseurl}/plugins/compat3x/plugin{$suffix}.js?$version'></script>\n";
		}

		echo "<script type='text/javascript'>\n" . self::wp_mce_translation() . "</script>\n";
	}


Changelog

Changelog
Version Description
WP-4.8.0 Introduced.