wp/wp-includes/class-wp-editor.php
author ymh <ymh.work@gmail.com>
Tue, 09 Jun 2015 03:35:32 +0200
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
permissions -rw-r--r--
upgrade wordpress + plugins
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 * Facilitates adding of the WordPress editor as used on the Write and Edit screens.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * @package WordPress
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 * @since 3.3.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
 * Private, not included by default. See wp_editor() in wp-includes/general-template.php.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
final class _WP_Editors {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
	public static $mce_locale;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
	private static $mce_settings = array();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
	private static $qt_settings = array();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
	private static $plugins = array();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
	private static $qt_buttons = array();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
	private static $ext_plugins;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
	private static $baseurl;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
	private static $first_init;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
	private static $this_tinymce = false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
	private static $this_quicktags = false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
	private static $has_tinymce = false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
	private static $has_quicktags = false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
	private static $has_medialib = false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
	private static $editor_buttons_css = true;
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    27
	private static $drag_drop_upload = false;
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
	private function __construct() {}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    31
	/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    32
	 * Parse default arguments for the editor instance.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    33
	 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    34
	 * @param string $editor_id ID for the current editor instance.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    35
	 * @param array  $settings {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    36
	 *     Array of editor arguments.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    37
	 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    38
	 *     @type bool       $wpautop           Whether to use wpautop(). Default true.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    39
	 *     @type bool       $media_buttons     Whether to show the Add Media/other media buttons.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    40
	 *     @type string     $default_editor    When both TinyMCE and Quicktags are used, set which
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    41
	 *                                         editor is shown on page load. Default empty.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    42
	 *     @type bool       $drag_drop_upload  Whether to enable drag & drop on the editor uploading. Default false.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    43
	 *                                         Requires the media modal.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    44
	 *     @type string     $textarea_name     Give the textarea a unique name here. Square brackets
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    45
	 *                                         can be used here. Default $editor_id.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    46
	 *     @type int        $textarea_rows     Number rows in the editor textarea. Default 20.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    47
	 *     @type string|int $tabindex          Tabindex value to use. Default empty.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    48
	 *     @type string     $tabfocus_elements The previous and next element ID to move the focus to
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    49
	 *                                         when pressing the Tab key in TinyMCE. Defualt ':prev,:next'.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    50
	 *     @type string     $editor_css        Intended for extra styles for both Visual and Text editors.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    51
	 *                                         Should include `<style>` tags, and can use "scoped". Default empty.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    52
	 *     @type string     $editor_class      Extra classes to add to the editor textarea elemen. Default empty.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    53
	 *     @type bool       $teeny             Whether to output the minimal editor config. Examples include
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    54
	 *                                         Press This and the Comment editor. Default false.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    55
	 *     @type bool       $dfw               Whether to replace the default fullscreen with "Distraction Free
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    56
	 *                                         Writing". DFW requires specific DOM elements and css). Default false.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    57
	 *     @type bool|array $tinymce           Whether to load TinyMCE. Can be used to pass settings directly to
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    58
	 *                                         TinyMCE using an array. Default true.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    59
	 *     @type bool|array $quicktags         Whether to load Quicktags. Can be used to pass settings directly to
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    60
	 *                                         Quicktags using an array. Default true.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    61
	 * }
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    62
	 * @return array Parsed arguments array.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    63
	 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    64
	public static function parse_settings( $editor_id, $settings ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    65
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    66
		/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    67
		 * Filter the wp_editor() settings.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    68
		 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    69
		 * @since 4.0.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    70
		 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    71
		 * @see _WP_Editors()::parse_settings()
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    72
		 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    73
		 * @param array  $settings  Array of editor arguments.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    74
		 * @param string $editor_id ID for the current editor instance.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    75
		 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    76
		$settings = apply_filters( 'wp_editor_settings', $settings, $editor_id );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    77
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    78
		$set = wp_parse_args( $settings, array(
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    79
			'wpautop'             => true,
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    80
			'media_buttons'       => true,
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    81
			'default_editor'      => '',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    82
			'drag_drop_upload'    => false,
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    83
			'textarea_name'       => $editor_id,
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    84
			'textarea_rows'       => 20,
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    85
			'tabindex'            => '',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    86
			'tabfocus_elements'   => ':prev,:next',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    87
			'editor_css'          => '',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    88
			'editor_class'        => '',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    89
			'teeny'               => false,
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    90
			'dfw'                 => false,
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    91
			'_content_editor_dfw' => false,
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    92
			'tinymce'             => true,
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    93
			'quicktags'           => true
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    94
		) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
		self::$this_tinymce = ( $set['tinymce'] && user_can_richedit() );
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    97
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    98
		if ( self::$this_tinymce ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    99
			if ( false !== strpos( $editor_id, '[' ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   100
				self::$this_tinymce = false;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   101
				_deprecated_argument( 'wp_editor()', '3.9', 'TinyMCE editor IDs cannot have brackets.' );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   102
			}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   103
		}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   104
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   105
		self::$this_quicktags = (bool) $set['quicktags'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   107
		if ( self::$this_tinymce )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   108
			self::$has_tinymce = true;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
		if ( self::$this_quicktags )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   111
			self::$has_quicktags = true;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   112
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   113
		if ( empty( $set['editor_height'] ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   114
			return $set;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   115
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   116
		if ( 'content' === $editor_id && empty( $set['tinymce']['wp_autoresize_on'] ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   117
			// A cookie (set when a user resizes the editor) overrides the height.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
			$cookie = (int) get_user_setting( 'ed_size' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
			if ( $cookie )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
				$set['editor_height'] = $cookie;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   122
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   124
		if ( $set['editor_height'] < 50 )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   125
			$set['editor_height'] = 50;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   126
		elseif ( $set['editor_height'] > 5000 )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   127
			$set['editor_height'] = 5000;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   128
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   129
		return $set;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   130
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   131
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   132
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   133
	 * Outputs the HTML for a single instance of the editor.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   134
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   135
	 * @param string $content The initial content of the editor.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   136
	 * @param string $editor_id ID for the textarea and TinyMCE and Quicktags instances (can contain only ASCII letters and numbers).
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   137
	 * @param array $settings See the _parse_settings() method for description.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   138
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   139
	public static function editor( $content, $editor_id, $settings = array() ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   140
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   141
		$set = self::parse_settings( $editor_id, $settings );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   142
		$editor_class = ' class="' . trim( $set['editor_class'] . ' wp-editor-area' ) . '"';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   143
		$tabindex = $set['tabindex'] ? ' tabindex="' . (int) $set['tabindex'] . '"' : '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   144
		$switch_class = 'html-active';
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   145
		$toolbar = $buttons = $autocomplete = '';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   146
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   147
		if ( $set['drag_drop_upload'] ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   148
			self::$drag_drop_upload = true;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   149
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   150
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   151
		if ( ! empty( $set['editor_height'] ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   152
			$height = ' style="height: ' . $set['editor_height'] . 'px"';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   153
		else
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   154
			$height = ' rows="' . $set['textarea_rows'] . '"';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   155
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   156
		if ( !current_user_can( 'upload_files' ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   157
			$set['media_buttons'] = false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   158
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   159
		if ( ! self::$this_quicktags && self::$this_tinymce ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   160
			$switch_class = 'tmce-active';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   161
			$autocomplete = ' autocomplete="off"';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   162
		} elseif ( self::$this_quicktags && self::$this_tinymce ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   163
			$default_editor = $set['default_editor'] ? $set['default_editor'] : wp_default_editor();
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   164
			$autocomplete = ' autocomplete="off"';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   165
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   166
			// 'html' is used for the "Text" editor tab.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   167
			if ( 'html' === $default_editor ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   168
				add_filter('the_editor_content', 'wp_htmledit_pre');
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   169
				$switch_class = 'html-active';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   170
			} else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   171
				add_filter('the_editor_content', 'wp_richedit_pre');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   172
				$switch_class = 'tmce-active';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   173
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   174
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   175
			$buttons .= '<button type="button" id="' . $editor_id . '-tmce" class="wp-switch-editor switch-tmce" onclick="switchEditors.switchto(this);">' . __('Visual') . "</button>\n";
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   176
			$buttons .= '<button type="button" id="' . $editor_id . '-html" class="wp-switch-editor switch-html" onclick="switchEditors.switchto(this);">' . _x( 'Text', 'Name for the Text editor tab (formerly HTML)' ) . "</button>\n";
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   177
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   178
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   179
		$wrap_class = 'wp-core-ui wp-editor-wrap ' . $switch_class;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   180
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   181
		if ( $set['_content_editor_dfw'] ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   182
			$wrap_class .= ' has-dfw';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   183
		}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   184
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   185
		echo '<div id="wp-' . $editor_id . '-wrap" class="' . $wrap_class . '">';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   186
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   187
		if ( self::$editor_buttons_css ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   188
			wp_print_styles('editor-buttons');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   189
			self::$editor_buttons_css = false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   190
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   191
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   192
		if ( !empty($set['editor_css']) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   193
			echo $set['editor_css'] . "\n";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   194
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   195
		if ( !empty($buttons) || $set['media_buttons'] ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   196
			echo '<div id="wp-' . $editor_id . '-editor-tools" class="wp-editor-tools hide-if-no-js">';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   197
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   198
			if ( $set['media_buttons'] ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   199
				self::$has_medialib = true;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   200
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   201
				if ( !function_exists('media_buttons') )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   202
					include(ABSPATH . 'wp-admin/includes/media.php');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   203
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   204
				echo '<div id="wp-' . $editor_id . '-media-buttons" class="wp-media-buttons">';
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   205
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   206
				/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   207
				 * Fires after the default media button(s) are displayed.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   208
				 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   209
				 * @since 2.5.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   210
				 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   211
				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   212
				 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   213
				do_action( 'media_buttons', $editor_id );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   214
				echo "</div>\n";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   215
			}
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   216
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   217
			echo '<div class="wp-editor-tabs">' . $buttons . "</div>\n";
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   218
			echo "</div>\n";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   219
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   220
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   221
		/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   222
		 * Filter the HTML markup output that displays the editor.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   223
		 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   224
		 * @since 2.1.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   225
		 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   226
		 * @param string $output Editor's HTML markup.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   227
		 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   228
		$the_editor = apply_filters( 'the_editor', '<div id="wp-' . $editor_id . '-editor-container" class="wp-editor-container">' .
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   229
			'<textarea' . $editor_class . $height . $tabindex . $autocomplete . ' cols="40" name="' . $set['textarea_name'] . '" ' .
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   230
			'id="' . $editor_id . '">%s</textarea></div>' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   231
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   232
		/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   233
		 * Filter the default editor content.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   234
		 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   235
		 * @since 2.1.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   236
		 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   237
		 * @param string $content Default editor content.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   238
		 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   239
		$content = apply_filters( 'the_editor_content', $content );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   240
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   241
		printf( $the_editor, $content );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   242
		echo "\n</div>\n\n";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   243
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   244
		self::editor_settings($editor_id, $set);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   245
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   246
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   247
	/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   248
	 * @param string $editor_id
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   249
	 * @param array  $set
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   250
	 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   251
	public static function editor_settings($editor_id, $set) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   252
		$first_run = false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   253
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   254
		if ( empty(self::$first_init) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   255
			if ( is_admin() ) {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   256
				add_action( 'admin_print_footer_scripts', array( __CLASS__, 'editor_js' ), 50 );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   257
				add_action( 'admin_print_footer_scripts', array( __CLASS__, 'enqueue_scripts' ), 1 );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   258
			} else {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   259
				add_action( 'wp_print_footer_scripts', array( __CLASS__, 'editor_js' ), 50 );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   260
				add_action( 'wp_print_footer_scripts', array( __CLASS__, 'enqueue_scripts' ), 1 );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   261
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   262
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   263
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   264
		if ( self::$this_quicktags ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   265
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   266
			$qtInit = array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   267
				'id' => $editor_id,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   268
				'buttons' => ''
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   269
			);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   270
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   271
			if ( is_array($set['quicktags']) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   272
				$qtInit = array_merge($qtInit, $set['quicktags']);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   273
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   274
			if ( empty($qtInit['buttons']) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   275
				$qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,close';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   276
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   277
			if ( $set['dfw'] )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   278
				$qtInit['buttons'] .= ',fullscreen';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   279
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   280
			if ( $set['_content_editor_dfw'] ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   281
				$qtInit['buttons'] .= ',dfw';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   282
			}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   283
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   284
			/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   285
			 * Filter the Quicktags settings.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   286
			 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   287
			 * @since 3.3.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   288
			 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   289
			 * @param array  $qtInit    Quicktags settings.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   290
			 * @param string $editor_id The unique editor ID, e.g. 'content'.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   291
			 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   292
			$qtInit = apply_filters( 'quicktags_settings', $qtInit, $editor_id );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   293
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   294
			self::$qt_settings[$editor_id] = $qtInit;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   295
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   296
			self::$qt_buttons = array_merge( self::$qt_buttons, explode(',', $qtInit['buttons']) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   297
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   298
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   299
		if ( self::$this_tinymce ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   300
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   301
			if ( empty( self::$first_init ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   302
				self::$baseurl = includes_url( 'js/tinymce' );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   303
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   304
				$mce_locale = get_locale();
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   305
				self::$mce_locale = $mce_locale = empty( $mce_locale ) ? 'en' : strtolower( substr( $mce_locale, 0, 2 ) ); // ISO 639-1
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   306
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   307
				/** This filter is documented in wp-admin/includes/media.php */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   308
				$no_captions = (bool) apply_filters( 'disable_captions', '' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   309
				$first_run = true;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   310
				$ext_plugins = '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   311
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   312
				if ( $set['teeny'] ) {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   313
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   314
					/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   315
					 * Filter the list of teenyMCE plugins.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   316
					 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   317
					 * @since 2.7.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   318
					 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   319
					 * @param array  $plugins   An array of teenyMCE plugins.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   320
					 * @param string $editor_id Unique editor identifier, e.g. 'content'.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   321
					 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   322
					self::$plugins = $plugins = apply_filters( 'teeny_mce_plugins', array( 'colorpicker', 'lists', 'fullscreen', 'image', 'wordpress', 'wpeditimage', 'wplink' ), $editor_id );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   323
				} else {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   324
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   325
					/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   326
					 * Filter the list of TinyMCE external plugins.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   327
					 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   328
					 * The filter takes an associative array of external plugins for
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   329
					 * TinyMCE in the form 'plugin_name' => 'url'.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   330
					 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   331
					 * The url should be absolute, and should include the js filename
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   332
					 * to be loaded. For example:
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   333
					 * 'myplugin' => 'http://mysite.com/wp-content/plugins/myfolder/mce_plugin.js'.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   334
					 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   335
					 * If the external plugin adds a button, it should be added with
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   336
					 * one of the 'mce_buttons' filters.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   337
					 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   338
					 * @since 2.5.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   339
					 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   340
					 * @param array $external_plugins An array of external TinyMCE plugins.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   341
					 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   342
					$mce_external_plugins = apply_filters( 'mce_external_plugins', array() );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   343
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   344
					$plugins = array(
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   345
						'charmap',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   346
						'colorpicker',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   347
						'hr',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   348
						'lists',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   349
						'media',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   350
						'paste',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   351
						'tabfocus',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   352
						'textcolor',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   353
						'fullscreen',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   354
						'wordpress',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   355
						'wpautoresize',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   356
						'wpeditimage',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   357
						'wpemoji',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   358
						'wpgallery',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   359
						'wplink',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   360
						'wpdialogs',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   361
						'wpview',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   362
					);
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   363
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   364
					if ( ! self::$has_medialib ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   365
						$plugins[] = 'image';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   366
					}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   367
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   368
					/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   369
					 * Filter the list of default TinyMCE plugins.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   370
					 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   371
					 * The filter specifies which of the default plugins included
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   372
					 * in WordPress should be added to the TinyMCE instance.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   373
					 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   374
					 * @since 3.3.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   375
					 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   376
					 * @param array $plugins An array of default TinyMCE plugins.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   377
					 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   378
					$plugins = array_unique( apply_filters( 'tiny_mce_plugins', $plugins ) );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   379
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   380
					if ( ( $key = array_search( 'spellchecker', $plugins ) ) !== false ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   381
						// Remove 'spellchecker' from the internal plugins if added with 'tiny_mce_plugins' filter to prevent errors.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   382
						// It can be added with 'mce_external_plugins'.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   383
						unset( $plugins[$key] );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   384
					}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   385
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   386
					if ( ! empty( $mce_external_plugins ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   387
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   388
						/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   389
						 * Filter the translations loaded for external TinyMCE 3.x plugins.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   390
						 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   391
						 * The filter takes an associative array ('plugin_name' => 'path')
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   392
						 * where 'path' is the include path to the file.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   393
						 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   394
						 * The language file should follow the same format as wp_mce_translation(),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   395
						 * and should define a variable ($strings) that holds all translated strings.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   396
						 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   397
						 * @since 2.5.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   398
						 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   399
						 * @param array $translations Translations for external TinyMCE plugins.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   400
						 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   401
						$mce_external_languages = apply_filters( 'mce_external_languages', array() );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   402
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   403
						$loaded_langs = array();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   404
						$strings = '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   405
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   406
						if ( ! empty( $mce_external_languages ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   407
							foreach ( $mce_external_languages as $name => $path ) {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   408
								if ( @is_file( $path ) && @is_readable( $path ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   409
									include_once( $path );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   410
									$ext_plugins .= $strings . "\n";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   411
									$loaded_langs[] = $name;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   412
								}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   413
							}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   414
						}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   415
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   416
						foreach ( $mce_external_plugins as $name => $url ) {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   417
							if ( in_array( $name, $plugins, true ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   418
								unset( $mce_external_plugins[ $name ] );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   419
								continue;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   420
							}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   421
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   422
							$url = set_url_scheme( $url );
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   423
							$mce_external_plugins[ $name ] = $url;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   424
							$plugurl = dirname( $url );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   425
							$strings = '';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   426
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   427
							// Try to load langs/[locale].js and langs/[locale]_dlg.js
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   428
							if ( ! in_array( $name, $loaded_langs, true ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   429
								$path = str_replace( content_url(), '', $plugurl );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   430
								$path = WP_CONTENT_DIR . $path . '/langs/';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   431
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   432
								if ( function_exists('realpath') )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   433
									$path = trailingslashit( realpath($path) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   434
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   435
								if ( @is_file( $path . $mce_locale . '.js' ) )
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   436
									$strings .= @file_get_contents( $path . $mce_locale . '.js' ) . "\n";
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   437
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   438
								if ( @is_file( $path . $mce_locale . '_dlg.js' ) )
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   439
									$strings .= @file_get_contents( $path . $mce_locale . '_dlg.js' ) . "\n";
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   440
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   441
								if ( 'en' != $mce_locale && empty( $strings ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   442
									if ( @is_file( $path . 'en.js' ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   443
										$str1 = @file_get_contents( $path . 'en.js' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   444
										$strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str1, 1 ) . "\n";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   445
									}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   446
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   447
									if ( @is_file( $path . 'en_dlg.js' ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   448
										$str2 = @file_get_contents( $path . 'en_dlg.js' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   449
										$strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str2, 1 ) . "\n";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   450
									}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   451
								}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   452
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   453
								if ( ! empty( $strings ) )
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   454
									$ext_plugins .= "\n" . $strings . "\n";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   455
							}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   456
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   457
							$ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   458
							$ext_plugins .= 'tinymce.PluginManager.load("' . $name . '", "' . $url . '");' . "\n";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   459
						}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   460
					}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   461
				}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   462
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   463
				if ( $set['dfw'] )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   464
					$plugins[] = 'wpfullscreen';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   465
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   466
				self::$plugins = $plugins;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   467
				self::$ext_plugins = $ext_plugins;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   468
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   469
				self::$first_init = array(
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   470
					'theme' => 'modern',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   471
					'skin' => 'lightgray',
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   472
					'language' => self::$mce_locale,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   473
					'formats' => "{
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   474
						alignleft: [
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   475
							{selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: {textAlign:'left'}},
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   476
							{selector: 'img,table,dl.wp-caption', classes: 'alignleft'}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   477
						],
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   478
						aligncenter: [
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   479
							{selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: {textAlign:'center'}},
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   480
							{selector: 'img,table,dl.wp-caption', classes: 'aligncenter'}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   481
						],
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   482
						alignright: [
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   483
							{selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: {textAlign:'right'}},
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   484
							{selector: 'img,table,dl.wp-caption', classes: 'alignright'}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   485
						],
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   486
						strikethrough: {inline: 'del'}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   487
					}",
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   488
					'relative_urls' => false,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   489
					'remove_script_host' => false,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   490
					'convert_urls' => false,
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   491
					'browser_spellcheck' => true,
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   492
					'fix_list_elements' => true,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   493
					'entities' => '38,amp,60,lt,62,gt',
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   494
					'entity_encoding' => 'raw',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   495
					'keep_styles' => false,
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   496
					'cache_suffix' => 'wp-mce-' . $GLOBALS['tinymce_version'],
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   497
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   498
					// Limit the preview styles in the menu/toolbar
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   499
					'preview_styles' => 'font-family font-size font-weight font-style text-decoration text-transform',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   500
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   501
					'end_container_on_empty_block' => true,
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   502
					'wpeditimage_disable_captions' => $no_captions,
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   503
					'wpeditimage_html5_captions' => current_theme_supports( 'html5', 'caption' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   504
					'plugins' => implode( ',', $plugins ),
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   505
				);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   506
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   507
				if ( ! empty( $mce_external_plugins ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   508
					self::$first_init['external_plugins'] = wp_json_encode( $mce_external_plugins );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   509
				}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   510
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   511
				$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   512
				$version = 'ver=' . $GLOBALS['wp_version'];
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   513
				$dashicons = includes_url( "css/dashicons$suffix.css?$version" );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   514
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   515
				// WordPress default stylesheet and dashicons
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   516
				$mce_css = array(
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   517
					$dashicons,
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   518
					self::$baseurl . '/skins/wordpress/wp-content.css?' . $version
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   519
				);
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   520
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   521
				$editor_styles = get_editor_stylesheets();
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   522
				if ( ! empty( $editor_styles ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   523
					foreach ( $editor_styles as $style ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   524
						$mce_css[] = $style;
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   525
					}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   526
				}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   527
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   528
				/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   529
				 * Filter the comma-delimited list of stylesheets to load in TinyMCE.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   530
				 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   531
				 * @since 2.1.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   532
				 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   533
				 * @param array $stylesheets Comma-delimited list of stylesheets.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   534
				 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   535
				$mce_css = trim( apply_filters( 'mce_css', implode( ',', $mce_css ) ), ' ,' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   536
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   537
				if ( ! empty($mce_css) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   538
					self::$first_init['content_css'] = $mce_css;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   539
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   540
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   541
			if ( $set['teeny'] ) {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   542
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   543
				/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   544
				 * Filter the list of teenyMCE buttons (Text tab).
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   545
				 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   546
				 * @since 2.7.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   547
				 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   548
				 * @param array  $buttons   An array of teenyMCE buttons.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   549
				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   550
				 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   551
				$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 );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   552
				$mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = array();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   553
			} else {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   554
				$mce_buttons = array( 'bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'hr', 'alignleft', 'aligncenter', 'alignright', 'link', 'unlink', 'wp_more', 'spellchecker' );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   555
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   556
				if ( $set['_content_editor_dfw'] ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   557
					$mce_buttons[] = 'dfw';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   558
				} else {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   559
					$mce_buttons[] = 'fullscreen';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   560
				}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   561
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   562
				$mce_buttons[] = 'wp_adv';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   563
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   564
				/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   565
				 * Filter the first-row list of TinyMCE buttons (Visual tab).
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   566
				 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   567
				 * @since 2.0.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   568
				 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   569
				 * @param array  $buttons   First-row list of buttons.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   570
				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   571
				 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   572
				$mce_buttons = apply_filters( 'mce_buttons', $mce_buttons, $editor_id );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   573
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   574
				$mce_buttons_2 = array( 'formatselect', 'underline', 'alignjustify', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo' );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   575
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   576
				if ( ! wp_is_mobile() ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   577
					$mce_buttons_2[] = 'wp_help';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   578
				}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   579
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   580
				/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   581
				 * Filter the second-row list of TinyMCE buttons (Visual tab).
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   582
				 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   583
				 * @since 2.0.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   584
				 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   585
				 * @param array  $buttons   Second-row list of buttons.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   586
				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   587
				 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   588
				$mce_buttons_2 = apply_filters( 'mce_buttons_2', $mce_buttons_2, $editor_id );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   589
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   590
				/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   591
				 * Filter the third-row list of TinyMCE buttons (Visual tab).
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   592
				 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   593
				 * @since 2.0.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   594
				 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   595
				 * @param array  $buttons   Third-row list of buttons.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   596
				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   597
				 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   598
				$mce_buttons_3 = apply_filters( 'mce_buttons_3', array(), $editor_id );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   599
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   600
				/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   601
				 * Filter the fourth-row list of TinyMCE buttons (Visual tab).
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   602
				 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   603
				 * @since 2.5.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   604
				 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   605
				 * @param array  $buttons   Fourth-row list of buttons.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   606
				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   607
				 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   608
				$mce_buttons_4 = apply_filters( 'mce_buttons_4', array(), $editor_id );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   609
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   610
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   611
			$body_class = $editor_id;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   612
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   613
			if ( $post = get_post() ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   614
				$body_class .= ' post-type-' . sanitize_html_class( $post->post_type ) . ' post-status-' . sanitize_html_class( $post->post_status );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   615
				if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   616
					$post_format = get_post_format( $post );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   617
					if ( $post_format && ! is_wp_error( $post_format ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   618
						$body_class .= ' post-format-' . sanitize_html_class( $post_format );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   619
					else
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   620
						$body_class .= ' post-format-standard';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   621
				}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   622
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   623
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   624
			$body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   625
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   626
			if ( !empty($set['tinymce']['body_class']) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   627
				$body_class .= ' ' . $set['tinymce']['body_class'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   628
				unset($set['tinymce']['body_class']);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   629
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   630
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   631
			if ( $set['dfw'] ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   632
				// replace the first 'fullscreen' with 'wp_fullscreen'
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   633
				if ( ($key = array_search('fullscreen', $mce_buttons)) !== false )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   634
					$mce_buttons[$key] = 'wp_fullscreen';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   635
				elseif ( ($key = array_search('fullscreen', $mce_buttons_2)) !== false )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   636
					$mce_buttons_2[$key] = 'wp_fullscreen';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   637
				elseif ( ($key = array_search('fullscreen', $mce_buttons_3)) !== false )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   638
					$mce_buttons_3[$key] = 'wp_fullscreen';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   639
				elseif ( ($key = array_search('fullscreen', $mce_buttons_4)) !== false )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   640
					$mce_buttons_4[$key] = 'wp_fullscreen';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   641
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   642
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   643
			$mceInit = array (
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   644
				'selector' => "#$editor_id",
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   645
				'resize' => 'vertical',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   646
				'menubar' => false,
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   647
				'wpautop' => (bool) $set['wpautop'],
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   648
				'indent' => ! $set['wpautop'],
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   649
				'toolbar1' => implode($mce_buttons, ','),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   650
				'toolbar2' => implode($mce_buttons_2, ','),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   651
				'toolbar3' => implode($mce_buttons_3, ','),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   652
				'toolbar4' => implode($mce_buttons_4, ','),
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   653
				'tabfocus_elements' => $set['tabfocus_elements'],
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   654
				'body_class' => $body_class
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   655
			);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   656
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   657
			if ( $first_run )
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   658
				$mceInit = array_merge( self::$first_init, $mceInit );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   659
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   660
			if ( is_array( $set['tinymce'] ) )
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   661
				$mceInit = array_merge( $mceInit, $set['tinymce'] );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   662
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   663
			/*
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   664
			 * For people who really REALLY know what they're doing with TinyMCE
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   665
			 * You can modify $mceInit to add, remove, change elements of the config
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   666
			 * before tinyMCE.init. Setting "valid_elements", "invalid_elements"
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   667
			 * and "extended_valid_elements" can be done through this filter. Best
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   668
			 * is to use the default cleanup by not specifying valid_elements,
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   669
			 * as TinyMCE contains full set of XHTML 1.0.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   670
			 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   671
			if ( $set['teeny'] ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   672
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   673
				/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   674
				 * Filter the teenyMCE config before init.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   675
				 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   676
				 * @since 2.7.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   677
				 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   678
				 * @param array  $mceInit   An array with teenyMCE config.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   679
				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   680
				 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   681
				$mceInit = apply_filters( 'teeny_mce_before_init', $mceInit, $editor_id );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   682
			} else {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   683
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   684
				/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   685
				 * Filter the TinyMCE config before init.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   686
				 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   687
				 * @since 2.5.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   688
				 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   689
				 * @param array  $mceInit   An array with TinyMCE config.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   690
				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   691
				 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   692
				$mceInit = apply_filters( 'tiny_mce_before_init', $mceInit, $editor_id );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   693
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   694
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   695
			if ( empty( $mceInit['toolbar3'] ) && ! empty( $mceInit['toolbar4'] ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   696
				$mceInit['toolbar3'] = $mceInit['toolbar4'];
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   697
				$mceInit['toolbar4'] = '';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   698
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   699
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   700
			self::$mce_settings[$editor_id] = $mceInit;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   701
		} // end if self::$this_tinymce
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   702
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   703
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   704
	private static function _parse_init($init) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   705
		$options = '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   706
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   707
		foreach ( $init as $k => $v ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   708
			if ( is_bool($v) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   709
				$val = $v ? 'true' : 'false';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   710
				$options .= $k . ':' . $val . ',';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   711
				continue;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   712
			} elseif ( !empty($v) && is_string($v) && ( ('{' == $v{0} && '}' == $v{strlen($v) - 1}) || ('[' == $v{0} && ']' == $v{strlen($v) - 1}) || preg_match('/^\(?function ?\(/', $v) ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   713
				$options .= $k . ':' . $v . ',';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   714
				continue;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   715
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   716
			$options .= $k . ':"' . $v . '",';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   717
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   718
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   719
		return '{' . trim( $options, ' ,' ) . '}';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   720
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   721
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   722
	public static function enqueue_scripts() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   723
		wp_enqueue_script('word-count');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   724
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   725
		if ( self::$has_tinymce )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   726
			wp_enqueue_script('editor');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   727
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   728
		if ( self::$has_quicktags ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   729
			wp_enqueue_script( 'quicktags' );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   730
			wp_enqueue_style( 'buttons' );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   731
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   732
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   733
		if ( in_array('wplink', self::$plugins, true) || in_array('link', self::$qt_buttons, true) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   734
			wp_enqueue_script('wplink');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   735
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   736
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   737
		if ( in_array('wpfullscreen', self::$plugins, true) || in_array('fullscreen', self::$qt_buttons, true) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   738
			wp_enqueue_script('wp-fullscreen');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   739
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   740
		if ( self::$has_medialib ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   741
			add_thickbox();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   742
			wp_enqueue_script('media-upload');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   743
		}
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   744
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   745
		/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   746
		 * Fires when scripts and styles are enqueued for the editor.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   747
		 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   748
		 * @since 3.9.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   749
		 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   750
		 * @param array $to_load An array containing boolean values whether TinyMCE
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   751
		 *                       and Quicktags are being loaded.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   752
		 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   753
		do_action( 'wp_enqueue_editor', array(
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   754
			'tinymce'   => self::$has_tinymce,
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   755
			'quicktags' => self::$has_quicktags,
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   756
		) );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   757
	}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   758
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   759
	/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   760
	 * Translates the default TinyMCE strings and returns them as JSON encoded object ready to be loaded with tinymce.addI18n().
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   761
	 * Can be used directly (_WP_Editors::wp_mce_translation()) by passing the same locale as set in the TinyMCE init object.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   762
	 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   763
	 * @param string $mce_locale The locale used for the editor.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   764
	 * @param bool $json_only optional Whether to include the JavaScript calls to tinymce.addI18n() and tinymce.ScriptLoader.markDone().
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   765
	 * @return string Translation object, JSON encoded.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   766
	 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   767
	public static function wp_mce_translation( $mce_locale = '', $json_only = false ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   768
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   769
		$mce_translation = array(
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   770
			// Default TinyMCE strings
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   771
			'New document' => __( 'New document' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   772
			'Formats' => _x( 'Formats', 'TinyMCE' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   773
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   774
			'Headings' => _x( 'Headings', 'TinyMCE' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   775
			'Heading 1' => __( 'Heading 1' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   776
			'Heading 2' => __( 'Heading 2' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   777
			'Heading 3' => __( 'Heading 3' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   778
			'Heading 4' => __( 'Heading 4' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   779
			'Heading 5' => __( 'Heading 5' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   780
			'Heading 6' => __( 'Heading 6' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   781
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   782
			/* translators: block tags */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   783
			'Blocks' => _x( 'Blocks', 'TinyMCE' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   784
			'Paragraph' => __( 'Paragraph' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   785
			'Blockquote' => __( 'Blockquote' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   786
			'Div' => _x( 'Div', 'HTML tag' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   787
			'Pre' => _x( 'Pre', 'HTML tag' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   788
			'Address' => _x( 'Address', 'HTML tag' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   789
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   790
			'Inline' => _x( 'Inline', 'HTML elements' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   791
			'Underline' => __( 'Underline' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   792
			'Strikethrough' => __( 'Strikethrough' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   793
			'Subscript' => __( 'Subscript' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   794
			'Superscript' => __( 'Superscript' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   795
			'Clear formatting' => __( 'Clear formatting' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   796
			'Bold' => __( 'Bold' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   797
			'Italic' => __( 'Italic' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   798
			'Code' => _x( 'Code', 'editor button' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   799
			'Source code' => __( 'Source code' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   800
			'Font Family' => __( 'Font Family' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   801
			'Font Sizes' => __( 'Font Sizes' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   802
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   803
			'Align center' => __( 'Align center' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   804
			'Align right' => __( 'Align right' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   805
			'Align left' => __( 'Align left' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   806
			'Justify' => __( 'Justify' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   807
			'Increase indent' => __( 'Increase indent' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   808
			'Decrease indent' => __( 'Decrease indent' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   809
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   810
			'Cut' => __( 'Cut' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   811
			'Copy' => __( 'Copy' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   812
			'Paste' => __( 'Paste' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   813
			'Select all' => __( 'Select all' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   814
			'Undo' => __( 'Undo' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   815
			'Redo' => __( 'Redo' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   816
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   817
			'Ok' => __( 'OK' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   818
			'Cancel' => __( 'Cancel' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   819
			'Close' => __( 'Close' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   820
			'Visual aids' => __( 'Visual aids' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   821
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   822
			'Bullet list' => __( 'Bulleted list' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   823
			'Numbered list' => __( 'Numbered list' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   824
			'Square' => _x( 'Square', 'list style' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   825
			'Default' => _x( 'Default', 'list style' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   826
			'Circle' => _x( 'Circle', 'list style' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   827
			'Disc' => _x('Disc', 'list style' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   828
			'Lower Greek' => _x( 'Lower Greek', 'list style' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   829
			'Lower Alpha' => _x( 'Lower Alpha', 'list style' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   830
			'Upper Alpha' => _x( 'Upper Alpha', 'list style' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   831
			'Upper Roman' => _x( 'Upper Roman', 'list style' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   832
			'Lower Roman' => _x( 'Lower Roman', 'list style' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   833
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   834
			// Anchor plugin
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   835
			'Name' => _x( 'Name', 'Name of link anchor (TinyMCE)' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   836
			'Anchor' => _x( 'Anchor', 'Link anchor (TinyMCE)' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   837
			'Anchors' => _x( 'Anchors', 'Link anchors (TinyMCE)' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   838
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   839
			// Fullpage plugin
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   840
			'Document properties' => __( 'Document properties' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   841
			'Robots' => __( 'Robots' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   842
			'Title' => __( 'Title' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   843
			'Keywords' => __( 'Keywords' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   844
			'Encoding' => __( 'Encoding' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   845
			'Description' => __( 'Description' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   846
			'Author' => __( 'Author' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   847
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   848
			// Media, image plugins
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   849
			'Insert/edit image' => __( 'Insert/edit image' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   850
			'General' => __( 'General' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   851
			'Advanced' => __( 'Advanced' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   852
			'Source' => __( 'Source' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   853
			'Border' => __( 'Border' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   854
			'Constrain proportions' => __( 'Constrain proportions' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   855
			'Vertical space' => __( 'Vertical space' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   856
			'Image description' => __( 'Image description' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   857
			'Style' => __( 'Style' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   858
			'Dimensions' => __( 'Dimensions' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   859
			'Insert image' => __( 'Insert image' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   860
			'Insert date/time' => __( 'Insert date/time' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   861
			'Insert/edit video' => __( 'Insert/edit video' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   862
			'Poster' => __( 'Poster' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   863
			'Alternative source' => __( 'Alternative source' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   864
			'Paste your embed code below:' => __( 'Paste your embed code below:' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   865
			'Insert video' => __( 'Insert video' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   866
			'Embed' => __( 'Embed' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   867
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   868
			// Each of these have a corresponding plugin
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   869
			'Special character' => __( 'Special character' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   870
			'Right to left' => _x( 'Right to left', 'editor button' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   871
			'Left to right' => _x( 'Left to right', 'editor button' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   872
			'Emoticons' => __( 'Emoticons' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   873
			'Nonbreaking space' => __( 'Nonbreaking space' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   874
			'Page break' => __( 'Page break' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   875
			'Paste as text' => __( 'Paste as text' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   876
			'Preview' => __( 'Preview' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   877
			'Print' => __( 'Print' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   878
			'Save' => __( 'Save' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   879
			'Fullscreen' => __( 'Fullscreen' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   880
			'Horizontal line' => __( 'Horizontal line' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   881
			'Horizontal space' => __( 'Horizontal space' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   882
			'Restore last draft' => __( 'Restore last draft' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   883
			'Insert/edit link' => __( 'Insert/edit link' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   884
			'Remove link' => __( 'Remove link' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   885
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   886
			'Color' => __( 'Color' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   887
			'Custom color' => __( 'Custom color' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   888
			'Custom...' => _x( 'Custom...', 'label for custom color' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   889
			'No color' => __( 'No color' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   890
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   891
			// Spelling, search/replace plugins
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   892
			'Could not find the specified string.' => __( 'Could not find the specified string.' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   893
			'Replace' => _x( 'Replace', 'find/replace' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   894
			'Next' => _x( 'Next', 'find/replace' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   895
			/* translators: previous */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   896
			'Prev' => _x( 'Prev', 'find/replace' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   897
			'Whole words' => _x( 'Whole words', 'find/replace' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   898
			'Find and replace' => __( 'Find and replace' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   899
			'Replace with' => _x('Replace with', 'find/replace' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   900
			'Find' => _x( 'Find', 'find/replace' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   901
			'Replace all' => _x( 'Replace all', 'find/replace' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   902
			'Match case' => __( 'Match case' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   903
			'Spellcheck' => __( 'Check Spelling' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   904
			'Finish' => _x( 'Finish', 'spellcheck' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   905
			'Ignore all' => _x( 'Ignore all', 'spellcheck' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   906
			'Ignore' => _x( 'Ignore', 'spellcheck' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   907
			'Add to Dictionary' => __( 'Add to Dictionary' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   908
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   909
			// TinyMCE tables
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   910
			'Insert table' => __( 'Insert table' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   911
			'Delete table' => __( 'Delete table' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   912
			'Table properties' => __( 'Table properties' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   913
			'Row properties' => __( 'Table row properties' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   914
			'Cell properties' => __( 'Table cell properties' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   915
			'Border color' => __( 'Border color' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   916
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   917
			'Row' => __( 'Row' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   918
			'Rows' => __( 'Rows' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   919
			'Column' => _x( 'Column', 'table column' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   920
			'Cols' => _x( 'Cols', 'table columns' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   921
			'Cell' => _x( 'Cell', 'table cell' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   922
			'Header cell' => __( 'Header cell' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   923
			'Header' => _x( 'Header', 'table header' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   924
			'Body' => _x( 'Body', 'table body' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   925
			'Footer' => _x( 'Footer', 'table footer' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   926
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   927
			'Insert row before' => __( 'Insert row before' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   928
			'Insert row after' => __( 'Insert row after' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   929
			'Insert column before' => __( 'Insert column before' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   930
			'Insert column after' => __( 'Insert column after' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   931
			'Paste row before' => __( 'Paste table row before' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   932
			'Paste row after' => __( 'Paste table row after' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   933
			'Delete row' => __( 'Delete row' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   934
			'Delete column' => __( 'Delete column' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   935
			'Cut row' => __( 'Cut table row' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   936
			'Copy row' => __( 'Copy table row' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   937
			'Merge cells' => __( 'Merge table cells' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   938
			'Split cell' => __( 'Split table cell' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   939
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   940
			'Height' => __( 'Height' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   941
			'Width' => __( 'Width' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   942
			'Caption' => __( 'Caption' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   943
			'Alignment' => __( 'Alignment' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   944
			'H Align' => _x( 'H Align', 'horizontal table cell alignment' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   945
			'Left' => __( 'Left' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   946
			'Center' => __( 'Center' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   947
			'Right' => __( 'Right' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   948
			'None' => _x( 'None', 'table cell alignment attribute' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   949
			'V Align' => _x( 'V Align', 'vertical table cell alignment' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   950
			'Top' => __( 'Top' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   951
			'Middle' => __( 'Middle' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   952
			'Bottom' => __( 'Bottom' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   953
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   954
			'Row group' => __( 'Row group' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   955
			'Column group' => __( 'Column group' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   956
			'Row type' => __( 'Row type' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   957
			'Cell type' => __( 'Cell type' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   958
			'Cell padding' => __( 'Cell padding' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   959
			'Cell spacing' => __( 'Cell spacing' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   960
			'Scope' => _x( 'Scope', 'table cell scope attribute' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   961
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   962
			'Insert template' => _x( 'Insert template', 'TinyMCE' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   963
			'Templates' => _x( 'Templates', 'TinyMCE' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   964
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   965
			'Background color' => __( 'Background color' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   966
			'Text color' => __( 'Text color' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   967
			'Show blocks' => _x( 'Show blocks', 'editor button' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   968
			'Show invisible characters' => __( 'Show invisible characters' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   969
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   970
			/* translators: word count */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   971
			'Words: {0}' => sprintf( __( 'Words: %s' ), '{0}' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   972
			'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.' ) . "\n\n" . __( 'If you&#8217;re looking to paste rich content from Microsoft Word, try turning this option off. The editor will clean up text pasted from Word automatically.' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   973
			'Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help' => __( 'Rich Text Area. Press Alt-Shift-H for help' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   974
			'You have unsaved changes are you sure you want to navigate away?' => __( 'The changes you made will be lost if you navigate away from this page.' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   975
			'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 keyboard shortcuts or your browser&#8217;s edit menu instead.' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   976
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   977
			// TinyMCE menus
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   978
			'Insert' => _x( 'Insert', 'TinyMCE menu' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   979
			'File' => _x( 'File', 'TinyMCE menu' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   980
			'Edit' => _x( 'Edit', 'TinyMCE menu' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   981
			'Tools' => _x( 'Tools', 'TinyMCE menu' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   982
			'View' => _x( 'View', 'TinyMCE menu' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   983
			'Table' => _x( 'Table', 'TinyMCE menu' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   984
			'Format' => _x( 'Format', 'TinyMCE menu' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   985
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   986
			// WordPress strings
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   987
			'Keyboard Shortcuts' => __( 'Keyboard Shortcuts' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   988
			'Toolbar Toggle' => __( 'Toolbar Toggle' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   989
			'Insert Read More tag' => __( 'Insert Read More tag' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   990
			'Read more...' => __( 'Read more...' ), // Title on the placeholder inside the editor
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   991
			'Distraction-free writing mode' => __( 'Distraction-free writing mode' ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   992
			'No alignment' => __( 'No alignment' ), // Tooltip for the 'alignnone' button in the image toolbar
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   993
			'Remove' => __( 'Remove' ), // Tooltip for the 'remove' button in the image toolbar
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   994
			'Edit ' => __( 'Edit' ), // Tooltip for the 'edit' button in the image toolbar
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   995
		);
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   996
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   997
		/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   998
		 * Link plugin (not included):
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   999
		 *	Insert link
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1000
		 *	Target
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1001
		 *	New window
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1002
		 *	Text to display
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1003
		 *	The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1004
		 *	The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1005
		 *	Url
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1006
		 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1007
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1008
		if ( ! $mce_locale ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1009
			$mce_locale = self::$mce_locale;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1010
		}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1011
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1012
		/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1013
		 * Filter translated strings prepared for TinyMCE.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1014
		 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1015
		 * @since 3.9.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1016
		 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1017
		 * @param array  $mce_translation Key/value pairs of strings.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1018
		 * @param string $mce_locale      Locale.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1019
		 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1020
		$mce_translation = apply_filters( 'wp_mce_translation', $mce_translation, $mce_locale );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1021
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1022
		foreach ( $mce_translation as $key => $value ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1023
			// Remove strings that are not translated.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1024
			if ( $key === $value ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1025
				unset( $mce_translation[$key] );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1026
				continue;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1027
			}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1028
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1029
			if ( false !== strpos( $value, '&' ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1030
				$mce_translation[$key] = html_entity_decode( $value, ENT_QUOTES, 'UTF-8' );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1031
			}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1032
		}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1033
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1034
		// Set direction
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1035
		if ( is_rtl() ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1036
			$mce_translation['_dir'] = 'rtl';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1037
		}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1038
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1039
		if ( $json_only ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1040
			return wp_json_encode( $mce_translation );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1041
		}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1042
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1043
		$baseurl = self::$baseurl ? self::$baseurl : includes_url( 'js/tinymce' );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1044
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1045
		return "tinymce.addI18n( '$mce_locale', " . wp_json_encode( $mce_translation ) . ");\n" .
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1046
			"tinymce.ScriptLoader.markDone( '$baseurl/langs/$mce_locale.js' );\n";
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1047
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1048
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1049
	public static function editor_js() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1050
		global $tinymce_version, $concatenate_scripts, $compress_scripts;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1051
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1052
		/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1053
		 * Filter "tiny_mce_version" is deprecated
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1054
		 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1055
		 * The tiny_mce_version filter is not needed since external plugins are loaded directly by TinyMCE.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1056
		 * These plugins can be refreshed by appending query string to the URL passed to "mce_external_plugins" filter.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1057
		 * If the plugin has a popup dialog, a query string can be added to the button action that opens it (in the plugin's code).
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1058
		 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1059
		$version = 'ver=' . $tinymce_version;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1060
		$tmce_on = !empty(self::$mce_settings);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1061
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1062
		if ( ! isset($concatenate_scripts) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1063
			script_concat_settings();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1064
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1065
		$compressed = $compress_scripts && $concatenate_scripts && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1066
			&& false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1067
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1068
		$mceInit = $qtInit = '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1069
		if ( $tmce_on ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1070
			foreach ( self::$mce_settings as $editor_id => $init ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1071
				$options = self::_parse_init( $init );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1072
				$mceInit .= "'$editor_id':{$options},";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1073
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1074
			$mceInit = '{' . trim($mceInit, ',') . '}';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1075
		} else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1076
			$mceInit = '{}';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1077
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1078
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1079
		if ( !empty(self::$qt_settings) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1080
			foreach ( self::$qt_settings as $editor_id => $init ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1081
				$options = self::_parse_init( $init );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1082
				$qtInit .= "'$editor_id':{$options},";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1083
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1084
			$qtInit = '{' . trim($qtInit, ',') . '}';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1085
		} else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1086
			$qtInit = '{}';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1087
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1088
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1089
		$ref = array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1090
			'plugins' => implode( ',', self::$plugins ),
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1091
			'theme' => 'modern',
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1092
			'language' => self::$mce_locale
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1093
		);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1094
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1095
		$suffix = ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ? '' : '.min';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1096
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1097
		/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1098
		 * Fires immediately before the TinyMCE settings are printed.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1099
		 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1100
		 * @since 3.2.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1101
		 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1102
		 * @param array $mce_settings TinyMCE settings array.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1103
		 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1104
		do_action( 'before_wp_tiny_mce', self::$mce_settings );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1105
		?>
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1106
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1107
		<script type="text/javascript">
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1108
		tinyMCEPreInit = {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1109
			baseURL: "<?php echo self::$baseurl; ?>",
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1110
			suffix: "<?php echo $suffix; ?>",
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1111
			<?php
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1112
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1113
			if ( self::$drag_drop_upload ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1114
				echo 'dragDropUpload: true,';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1115
			}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1116
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1117
			?>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1118
			mceInit: <?php echo $mceInit; ?>,
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1119
			qtInit: <?php echo $qtInit; ?>,
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1120
			ref: <?php echo self::_parse_init( $ref ); ?>,
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1121
			load_ext: function(url,lang){var sl=tinymce.ScriptLoader;sl.markDone(url+'/langs/'+lang+'.js');sl.markDone(url+'/langs/'+lang+'_dlg.js');}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1122
		};
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1123
		</script>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1124
		<?php
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1125
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1126
		$baseurl = self::$baseurl;
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1127
		// Load tinymce.js when running from /src, else load wp-tinymce.js.gz (production) or tinymce.min.js (SCRIPT_DEBUG)
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1128
		$mce_suffix = false !== strpos( $GLOBALS['wp_version'], '-src' ) ? '' : '.min';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1129
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1130
		if ( $tmce_on ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1131
			if ( $compressed ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1132
				echo "<script type='text/javascript' src='{$baseurl}/wp-tinymce.php?c=1&amp;$version'></script>\n";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1133
			} else {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1134
				echo "<script type='text/javascript' src='{$baseurl}/tinymce{$mce_suffix}.js?$version'></script>\n";
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1135
				echo "<script type='text/javascript' src='{$baseurl}/plugins/compat3x/plugin{$suffix}.js?$version'></script>\n";
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1136
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1137
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1138
			echo "<script type='text/javascript'>\n" . self::wp_mce_translation() . "</script>\n";
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1139
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1140
			if ( self::$ext_plugins ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1141
				// Load the old-format English strings to prevent unsightly labels in old style popups
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1142
				echo "<script type='text/javascript' src='{$baseurl}/langs/wp-langs-en.js?$version'></script>\n";
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1143
			}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1144
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1145
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1146
		/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1147
		 * Fires after tinymce.js is loaded, but before any TinyMCE editor
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1148
		 * instances are created.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1149
		 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1150
		 * @since 3.9.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1151
		 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1152
		 * @param array $mce_settings TinyMCE settings array.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1153
		 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1154
		do_action( 'wp_tiny_mce_init', self::$mce_settings );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1155
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1156
		?>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1157
		<script type="text/javascript">
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1158
		<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1159
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1160
		if ( self::$ext_plugins )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1161
			echo self::$ext_plugins . "\n";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1162
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1163
		if ( ! is_admin() )
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1164
			echo 'var ajaxurl = "' . admin_url( 'admin-ajax.php', 'relative' ) . '";';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1165
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1166
		?>
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1167
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1168
		( function() {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1169
			var init, edId, qtId, firstInit, wrapper;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1170
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1171
			if ( typeof tinymce !== 'undefined' ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1172
				for ( edId in tinyMCEPreInit.mceInit ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1173
					if ( firstInit ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1174
						init = tinyMCEPreInit.mceInit[edId] = tinymce.extend( {}, firstInit, tinyMCEPreInit.mceInit[edId] );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1175
					} else {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1176
						init = firstInit = tinyMCEPreInit.mceInit[edId];
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1177
					}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1178
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1179
					wrapper = tinymce.DOM.select( '#wp-' + edId + '-wrap' )[0];
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1180
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1181
					if ( ( tinymce.DOM.hasClass( wrapper, 'tmce-active' ) || ! tinyMCEPreInit.qtInit.hasOwnProperty( edId ) ) &&
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1182
						! init.wp_skip_init ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1183
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1184
						try {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1185
							tinymce.init( init );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1186
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1187
							if ( ! window.wpActiveEditor ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1188
								window.wpActiveEditor = edId;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1189
							}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1190
						} catch(e){}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1191
					}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1192
				}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1193
			}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1194
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1195
			if ( typeof quicktags !== 'undefined' ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1196
				for ( qtId in tinyMCEPreInit.qtInit ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1197
					try {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1198
						quicktags( tinyMCEPreInit.qtInit[qtId] );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1199
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1200
						if ( ! window.wpActiveEditor ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1201
							window.wpActiveEditor = qtId;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1202
						}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1203
					} catch(e){};
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1204
				}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1205
			}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1206
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1207
			if ( typeof jQuery !== 'undefined' ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1208
				jQuery('.wp-editor-wrap').on( 'click.wp-editor', function() {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1209
					if ( this.id ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1210
						window.wpActiveEditor = this.id.slice( 3, -5 );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1211
					}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1212
				});
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1213
			} else {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1214
				for ( qtId in tinyMCEPreInit.qtInit ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1215
					document.getElementById( 'wp-' + qtId + '-wrap' ).onclick = function() {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1216
						window.wpActiveEditor = this.id.slice( 3, -5 );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1217
					}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1218
				}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1219
			}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1220
		}());
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1221
		</script>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1222
		<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1223
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1224
		if ( in_array( 'wplink', self::$plugins, true ) || in_array( 'link', self::$qt_buttons, true ) )
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1225
			self::wp_link_dialog();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1226
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1227
		if ( in_array( 'wpfullscreen', self::$plugins, true ) || in_array( 'fullscreen', self::$qt_buttons, true ) )
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1228
			self::wp_fullscreen_html();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1229
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1230
		/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1231
		 * Fires after any core TinyMCE editor instances are created.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1232
		 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1233
		 * @since 3.2.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1234
		 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1235
		 * @param array $mce_settings TinyMCE settings array.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1236
		 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1237
		do_action( 'after_wp_tiny_mce', self::$mce_settings );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1238
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1239
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1240
	public static function wp_fullscreen_html() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1241
		global $content_width;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1242
		$post = get_post();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1243
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1244
		$width = isset( $content_width ) && 800 > $content_width ? $content_width : 800;
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1245
		$width = $width + 22; // compensate for the padding and border
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1246
		$dfw_width = get_user_setting( 'dfw_width', $width );
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1247
		$save = $post && $post->post_status == 'publish' ? __('Update') : __('Save');
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1248
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1249
		?>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1250
		<div id="wp-fullscreen-body" class="wp-core-ui<?php if ( is_rtl() ) echo ' rtl'; ?>" data-theme-width="<?php echo (int) $width; ?>" data-dfw-width="<?php echo (int) $dfw_width; ?>">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1251
		<div id="fullscreen-topbar">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1252
			<div id="wp-fullscreen-toolbar">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1253
			<div id="wp-fullscreen-close"><a href="#" onclick="wp.editor.fullscreen.off();return false;"><?php _e('Exit fullscreen'); ?></a></div>
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1254
			<div id="wp-fullscreen-central-toolbar" style="width:<?php echo $width; ?>px;">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1255
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1256
			<div id="wp-fullscreen-mode-bar">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1257
				<div id="wp-fullscreen-modes" class="button-group">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1258
					<a class="button wp-fullscreen-mode-tinymce" href="#" onclick="wp.editor.fullscreen.switchmode( 'tinymce' ); return false;"><?php _e( 'Visual' ); ?></a>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1259
					<a class="button wp-fullscreen-mode-html" href="#" onclick="wp.editor.fullscreen.switchmode( 'html' ); return false;"><?php _ex( 'Text', 'Name for the Text editor tab (formerly HTML)' ); ?></a>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1260
				</div>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1261
			</div>
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1262
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1263
			<div id="wp-fullscreen-button-bar"><div id="wp-fullscreen-buttons" class="mce-toolbar">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1264
		<?php
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1265
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1266
		$buttons = array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1267
			// format: title, onclick, show in both editors
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1268
			'bold' => array( 'title' => __('Bold (Ctrl + B)'), 'both' => false ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1269
			'italic' => array( 'title' => __('Italic (Ctrl + I)'), 'both' => false ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1270
			'bullist' => array( 'title' => __('Unordered list (Alt + Shift + U)'), 'both' => false ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1271
			'numlist' => array( 'title' => __('Ordered list (Alt + Shift + O)'), 'both' => false ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1272
			'blockquote' => array( 'title' => __('Blockquote (Alt + Shift + Q)'), 'both' => false ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1273
			'wp-media-library' => array( 'title' => __('Media library (Alt + Shift + M)'), 'both' => true ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1274
			'link' => array( 'title' => __('Insert/edit link (Alt + Shift + A)'), 'both' => true ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1275
			'unlink' => array( 'title' => __('Unlink (Alt + Shift + S)'), 'both' => false ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1276
			'help' => array( 'title' => __('Help (Alt + Shift + H)'), 'both' => false ),
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1277
		);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1278
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1279
		/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1280
		 * Filter the list of TinyMCE buttons for the fullscreen
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1281
		 * 'Distraction-Free Writing' editor.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1282
		 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1283
		 * @since 3.2.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1284
		 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1285
		 * @param array $buttons An array of TinyMCE buttons for the DFW editor.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1286
		 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1287
		$buttons = apply_filters( 'wp_fullscreen_buttons', $buttons );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1288
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1289
		foreach ( $buttons as $button => $args ) {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1290
			if ( 'separator' == $args ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1291
				continue;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1292
			}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1293
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1294
			$onclick = ! empty( $args['onclick'] ) ? ' onclick="' . $args['onclick'] . '"' : '';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1295
			$title = esc_attr( $args['title'] );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1296
			?>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1297
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1298
			<div class="mce-widget mce-btn<?php if ( $args['both'] ) { ?> wp-fullscreen-both<?php } ?>">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1299
			<button type="button" aria-label="<?php echo $title; ?>" title="<?php echo $title; ?>"<?php echo $onclick; ?> id="wp_fs_<?php echo $button; ?>">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1300
				<i class="mce-ico mce-i-<?php echo $button; ?>"></i>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1301
			</button>
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1302
			</div>
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1303
			<?php
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1304
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1305
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1306
		?>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1307
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1308
		</div></div>
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1309
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1310
		<div id="wp-fullscreen-save">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1311
			<input type="button" class="button button-primary right" value="<?php echo $save; ?>" onclick="wp.editor.fullscreen.save();" />
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1312
			<span class="wp-fullscreen-saved-message"><?php if ( $post && $post->post_status == 'publish' ) _e('Updated.'); else _e('Saved.'); ?></span>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1313
			<span class="wp-fullscreen-error-message"><?php _e('Save failed.'); ?></span>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1314
			<span class="spinner"></span>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1315
		</div>
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1316
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1317
		</div>
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1318
		</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1319
	</div>
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1320
	<div id="wp-fullscreen-statusbar">
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1321
		<div id="wp-fullscreen-status">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1322
			<div id="wp-fullscreen-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1323
			<div id="wp-fullscreen-tagline"><?php _e('Just write.'); ?></div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1324
		</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1325
	</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1326
	</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1327
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1328
	<div class="fullscreen-overlay" id="fullscreen-overlay"></div>
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1329
	<div class="fullscreen-overlay fullscreen-fader fade-300" id="fullscreen-fader"></div>
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1330
	<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1331
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1332
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1333
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1334
	 * Performs post queries for internal linking.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1335
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1336
	 * @since 3.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1337
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1338
	 * @param array $args Optional. Accepts 'pagenum' and 's' (search) arguments.
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1339
	 * @return false|array Results.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1340
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1341
	public static function wp_link_query( $args = array() ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1342
		$pts = get_post_types( array( 'public' => true ), 'objects' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1343
		$pt_names = array_keys( $pts );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1344
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1345
		$query = array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1346
			'post_type' => $pt_names,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1347
			'suppress_filters' => true,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1348
			'update_post_term_cache' => false,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1349
			'update_post_meta_cache' => false,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1350
			'post_status' => 'publish',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1351
			'posts_per_page' => 20,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1352
		);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1353
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1354
		$args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1355
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1356
		if ( isset( $args['s'] ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1357
			$query['s'] = $args['s'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1358
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1359
		$query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] - 1 ) : 0;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1360
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1361
		/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1362
		 * Filter the link query arguments.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1363
		 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1364
		 * Allows modification of the link query arguments before querying.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1365
		 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1366
		 * @see WP_Query for a full list of arguments
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1367
		 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1368
		 * @since 3.7.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1369
		 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1370
		 * @param array $query An array of WP_Query arguments.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1371
		 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1372
		$query = apply_filters( 'wp_link_query_args', $query );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1373
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1374
		// Do main query.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1375
		$get_posts = new WP_Query;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1376
		$posts = $get_posts->query( $query );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1377
		// Check if any posts were found.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1378
		if ( ! $get_posts->post_count )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1379
			return false;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1380
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1381
		// Build results.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1382
		$results = array();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1383
		foreach ( $posts as $post ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1384
			if ( 'post' == $post->post_type )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1385
				$info = mysql2date( __( 'Y/m/d' ), $post->post_date );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1386
			else
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1387
				$info = $pts[ $post->post_type ]->labels->singular_name;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1388
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1389
			$results[] = array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1390
				'ID' => $post->ID,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1391
				'title' => trim( esc_html( strip_tags( get_the_title( $post ) ) ) ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1392
				'permalink' => get_permalink( $post->ID ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1393
				'info' => $info,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1394
			);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1395
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1396
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1397
		/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1398
		 * Filter the link query results.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1399
		 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1400
		 * Allows modification of the returned link query results.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1401
		 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1402
		 * @since 3.7.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1403
		 *
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1404
		 * @see 'wp_link_query_args' filter
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1405
		 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1406
		 * @param array $results {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1407
		 *     An associative array of query results.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1408
		 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1409
		 *     @type array {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1410
		 *         @type int    $ID        Post ID.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1411
		 *         @type string $title     The trimmed, escaped post title.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1412
		 *         @type string $permalink Post permalink.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1413
		 *         @type string $info      A 'Y/m/d'-formatted date for 'post' post type,
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1414
		 *                                 the 'singular_name' post type label otherwise.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1415
		 *     }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1416
		 * }
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1417
		 * @param array $query  An array of WP_Query arguments.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1418
		 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1419
		return apply_filters( 'wp_link_query', $results, $query );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1420
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1421
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1422
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1423
	 * Dialog for internal linking.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1424
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1425
	 * @since 3.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1426
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1427
	public static function wp_link_dialog() {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1428
		$search_panel_visible = '1' == get_user_setting( 'wplink', '0' ) ? ' search-panel-visible' : '';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1429
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1430
		// display: none is required here, see #WP27605
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1431
		?>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1432
		<div id="wp-link-backdrop" style="display: none"></div>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1433
		<div id="wp-link-wrap" class="wp-core-ui<?php echo $search_panel_visible; ?>" style="display: none">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1434
		<form id="wp-link" tabindex="-1">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1435
		<?php wp_nonce_field( 'internal-linking', '_ajax_linking_nonce', false ); ?>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1436
		<div id="link-modal-title">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1437
			<?php _e( 'Insert/edit link' ) ?>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1438
			<button type="button" id="wp-link-close"><span class="screen-reader-text"><?php _e( 'Close' ); ?></span></button>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1439
	 	</div>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1440
		<div id="link-selector">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1441
			<div id="link-options">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1442
				<p class="howto"><?php _e( 'Enter the destination URL' ); ?></p>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1443
				<div>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1444
					<label><span><?php _e( 'URL' ); ?></span><input id="wp-link-url" type="text" /></label>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1445
				</div>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1446
				<div class="wp-link-text-field">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1447
					<label><span><?php _e( 'Link Text' ); ?></span><input id="wp-link-text" type="text" /></label>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1448
				</div>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1449
				<div class="link-target">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1450
					<label><span>&nbsp;</span><input type="checkbox" id="wp-link-target" /> <?php _e( 'Open link in a new window/tab' ); ?></label>
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1451
				</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1452
			</div>
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1453
			<p class="howto"><a href="#" id="wp-link-search-toggle"><?php _e( 'Or link to existing content' ); ?></a></p>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1454
			<div id="search-panel">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1455
				<div class="link-search-wrapper">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1456
					<label>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1457
						<span class="search-label"><?php _e( 'Search' ); ?></span>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1458
						<input type="search" id="wp-link-search" class="link-search-field" autocomplete="off" />
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1459
						<span class="spinner"></span>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1460
					</label>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1461
				</div>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1462
				<div id="search-results" class="query-results" tabindex="0">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1463
					<ul></ul>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1464
					<div class="river-waiting">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1465
						<span class="spinner"></span>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1466
					</div>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1467
				</div>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1468
				<div id="most-recent-results" class="query-results" tabindex="0">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1469
					<div class="query-notice" id="query-notice-message">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1470
						<em class="query-notice-default"><?php _e( 'No search term specified. Showing recent items.' ); ?></em>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1471
						<em class="query-notice-hint screen-reader-text"><?php _e( 'Search or use up and down arrow keys to select an item.' ); ?></em>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1472
					</div>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1473
					<ul></ul>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1474
					<div class="river-waiting">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1475
						<span class="spinner"></span>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1476
					</div>
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1477
				</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1478
			</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1479
		</div>
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1480
		<div class="submitbox">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1481
			<div id="wp-link-cancel">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1482
				<a class="submitdelete deletion" href="#"><?php _e( 'Cancel' ); ?></a>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1483
			</div>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1484
			<div id="wp-link-update">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1485
				<input type="submit" value="<?php esc_attr_e( 'Add Link' ); ?>" class="button button-primary" id="wp-link-submit" name="wp-link-submit">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1486
			</div>
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1487
		</div>
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1488
		</form>
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1489
		</div>
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
  1490
		<?php
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1491
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1492
}