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