PluginProbe ʕ •ᴥ•ʔ
Advanced Editor Tools / 5.9.0
Advanced Editor Tools v5.9.0
trunk 1.0 1.0.1 2.0 2.2 3.0 3.0.1 3.1 3.2 3.2.4 3.2.7 3.3.9 3.3.9.1 3.3.9.2 3.4.2 3.4.2.1 3.4.5 3.4.5.1 3.4.9 3.5.8 3.5.9 3.5.9.1 4.0 4.0.1 4.0.2 4.1 4.1.1 4.1.7 4.1.9 4.2.3 4.2.3.1 4.2.5 4.2.8 4.3.10 4.3.10.1 4.3.8 4.4.1 4.4.3 4.5.6 4.6.3 4.6.7 4.7.11 4.8.0 4.8.1 4.8.2 5.0.0 5.0.1 5.1.0 5.2 5.2.1 5.3 5.4.0 5.5.0 5.5.1 5.6.0 5.9.0 5.9.1 5.9.2
tinymce-advanced / tadv_admin.php
tinymce-advanced Last commit date
block-editor 3 years ago mce 3 years ago plugin-assets 3 years ago readme.txt 3 years ago tadv_admin.php 3 years ago tinymce-advanced.php 3 years ago uninstall.php 5 years ago
tadv_admin.php
755 lines
1 <?php
2 /**
3 * User and admin settings UI.
4 * @package advanced-editor-tools
5 */
6
7 if ( ! defined( 'TADV_ADMIN_PAGE' ) ) {
8 exit;
9 }
10
11 // TODO
12 if ( ! current_user_can( 'manage_options' ) ) {
13 wp_die( 'Invalid request' );
14 }
15
16 $message = '';
17 $tadv_options_updated = false;
18 $settings = $admin_settings = array();
19 $images_url = plugins_url( 'plugin-assets/images', __FILE__ );
20 $form_action = esc_url( remove_query_arg( array( 'tadv-import-file-complete' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
21
22 if ( isset( $_POST['tadv-save'] ) ) {
23 check_admin_referer( 'tadv-save-buttons-order' );
24 $this->save_settings();
25 } elseif ( isset( $_POST['tadv-restore-defaults'] ) ) {
26 check_admin_referer( 'tadv-save-buttons-order' );
27
28 // TODO: only for admin || SA
29 $this->admin_settings = $this->get_default_admin_settings();
30 update_option( 'tadv_admin_settings', $this->get_default_admin_settings() );
31
32 // TODO: all users that can have settings
33 $this->user_settings = $this->get_default_user_settings();
34 update_option( 'tadv_settings', $this->get_default_user_settings() );
35
36 $message = '<div class="updated notice notice-success is-dismissible"><p>' . __( 'Default settings restored.', 'tinymce-advanced' ) . '</p></div>';
37 } elseif ( isset( $_POST['tadv-import-settings'] ) ) {
38 check_admin_referer( 'tadv-save-buttons-order' );
39
40 // TODO: all users
41 ?>
42 <div class="wrap advanced-editor-tools">
43 <h2><?php _e( 'Advanced Editor Tools Settings Import', 'tinymce-advanced' ); ?></h2>
44
45 <div class="tadv-import-export">
46 <form action="" method="post" enctype="multipart/form-data" class="import-file">
47 <p><?php _e( 'The settings are imported from a previously exported settings file.', 'tinymce-advanced' ); ?></p>
48 <p><input type="file" name="tadv-import"></p>
49 <p><input type="submit" class="button button-primary" name="tadv-import-file" value="<?php _e( 'Import settings', 'tinymce-advanced' ); ?>" /></p>
50 <?php wp_nonce_field( 'tadv-import-settings', 'tadv-import-settings-nonce', false ); ?>
51 </form>
52 <hr>
53 <form action="<?php echo $form_action; ?>" method="post">
54 <p><?php _e( 'Alternatively the settings can be imported from a JSON encoded string. Please paste the exported string in the text area below.', 'tinymce-advanced' ); ?></p>
55 <p><textarea id="tadv-import" name="tadv-import"></textarea></p>
56 <p>
57 <button type="button" class="button" id="tadv-import-verify"><?php _e( 'Verify', 'tinymce-advanced' ); ?></button>
58 <input type="submit" class="button button-primary alignright" name="tadv-import-submit" value="<?php _e( 'Import settings from string', 'tinymce-advanced' ); ?>" />
59 </p>
60 <?php wp_nonce_field( 'tadv-import-settings', 'tadv-import-settings-nonce', false ); ?>
61 <p id="tadv-import-error"></p>
62 </form>
63 <p><a href=""><?php _e( 'Back to Editor Settings', 'tinymce-advanced' ); ?></a></p>
64 </div>
65 </div>
66 <?php
67
68 return;
69 } elseif ( isset( $_POST['tadv-import-submit'] ) && ! empty( $_POST['tadv-import'] ) && is_string( $_POST['tadv-import'] ) ) {
70 check_admin_referer( 'tadv-import-settings', 'tadv-import-settings-nonce' );
71
72 // TODO: all users that can have settings
73 $import = json_decode( trim( wp_unslash( $_POST['tadv-import'] ) ), true );
74
75 if ( ! is_array( $import ) ) {
76 $message = '<div class="error notice is-dismissible"><p>' . __( 'Importing of settings failed.', 'tinymce-advanced' ) . '</p></div>';
77 } else {
78 $this->save_settings( $import );
79 $message = '<div class="updated notice notice-success is-dismissible"><p>' . __( 'Settings imported successfully.', 'tinymce-advanced' ) . '</p></div>';
80 }
81 } elseif ( isset( $_GET['tadv-import-file-complete'] ) ) {
82 $err = (int) $_GET['tadv-import-file-complete'];
83
84 switch( $err ) {
85 case 1:
86 $message = __( 'Importing of settings failed. Please import a valid settings file.', 'tinymce-advanced' );
87 break;
88 case 2:
89 $message = __( 'Importing of settings failed. The imported file is empty.', 'tinymce-advanced' );
90 break;
91 case 3:
92 $message = __( 'Importing of settings failed. The imported file is invalid.', 'tinymce-advanced' );
93 break;
94 }
95
96 if ( empty( $message ) ) {
97 $message = '<div class="updated notice notice-success is-dismissible"><p>' . __( 'Settings imported successfully.', 'tinymce-advanced' ) . '</p></div>';
98 } else {
99 $message = '<div class="error notice is-dismissible"><p>' . $message . '</p></div>';
100 }
101 }
102
103 $this->load_settings();
104
105 if ( empty( $this->toolbar_1 ) && empty( $this->toolbar_2 ) && empty( $this->toolbar_3 ) && empty( $this->toolbar_4 ) ) {
106 $message = '<div class="error"><p>' . __( 'ERROR: All toolbars are empty. Default settings loaded.', 'tinymce-advanced' ) . '</p></div>';
107
108 $this->admin_settings = $this->get_default_admin_settings();
109 $this->user_settings = $this->get_default_user_settings();
110 $this->load_settings();
111 }
112
113 $all_buttons = $this->get_all_buttons();
114
115 ?>
116 <div class="wrap tinymce-advanced block-active<?php if ( is_rtl() ) echo ' mce-rtl'; ?>" id="contain">
117 <h2><?php _e( 'Advanced Editor Tools', 'tinymce-advanced' ); ?></h2>
118 <?php
119
120 // TODO admin || SA
121 $this->warn_if_unsupported();
122
123 if ( isset( $_POST['tadv-save'] ) && empty( $message ) ) {
124 ?><div class="updated notice notice-success is-dismissible"><p><?php _e( 'Settings saved.', 'tinymce-advanced' ); ?></p></div><?php
125 } else {
126 echo $message;
127 }
128
129 $dashicons_arrow = is_rtl() ? 'dashicons-arrow-left' : 'dashicons-arrow-right';
130
131 ?>
132 <form id="tadvadmin" method="post" action="<?php echo $form_action; ?>">
133
134 <div class="toggle">
135 <p class="tadv-submit tadv-submit-top">
136 <input class="button-primary button-large top-button" type="submit" name="tadv-save" value="<?php _e( 'Save Changes', 'tinymce-advanced' ); ?>" />
137 </p>
138 <h3 class="settings-toggle block" tabindex="0">
139 <span class="dashicons dashicons-arrow-down"></span>
140 <span class="dashicons arrow-open <?php echo $dashicons_arrow; ?>"></span>
141 <?php _e( 'Block Editor (Gutenberg)', 'tinymce-advanced' ); ?>
142 </h3>
143 <h3 class="settings-toggle classic" tabindex="0">
144 <span class="dashicons dashicons-arrow-down"></span>
145 <span class="dashicons arrow-open <?php echo $dashicons_arrow; ?>"></span>
146 <?php _e( 'Classic Editor (TinyMCE)', 'tinymce-advanced' ); ?>
147 </h3>
148 </div>
149
150 <div id="block-editor">
151 <h4><?php _e( 'Additional buttons for the Rich-Text toolbar', 'tinymce-advanced' ); ?></h4>
152 <div class="block-toolbars yes-no-wrap">
153 <div class="yes-no-text">
154 <p>
155 <?php _e( 'The <b>Mark</b> button will wrap the selected text in a plain &lt;mark&gt; HTML element. The appearance would depend on your theme and usually resembles highlighted text.', 'tinymce-advanced' ); ?>
156 </p>
157 <p>
158 <?php _e( 'The <b>Clear formatting</b> button will remove text formatting from the selected text, or from the whole paragraph if there is no selection. This includes femoval of most text styling like bold, italic, underline, background and foreground color, etc.', 'tinymce-advanced' ); ?>
159 </p>
160 </div>
161 <div class="yes-no-buttons">
162 <div>
163 <input type="radio" name="richtext_buttons" id="richtext_buttons_yes" value="yes"<?php if ( ! $this->check_user_setting( 'disable_richtext_buttons' ) ) echo ' checked'; ?>>
164 <label for="richtext_buttons_yes"><?php _e( 'Enable', 'tinymce-advanced' ); ?></label>
165 </div>
166 <div>
167 <input type="radio" name="richtext_buttons" id="richtext_buttons_no" value="no"<?php if ( $this->check_user_setting( 'disable_richtext_buttons' ) ) echo ' checked'; ?>>
168 <label for="richtext_buttons_no"><?php _e( 'Disable', 'tinymce-advanced' ); ?></label>
169 </div>
170 </div>
171 </div>
172
173 <h4 class="classic-blocks-title-h4"><?php _e( 'Toolbars for the Classic Paragraph and Classic blocks', 'tinymce-advanced' ); ?></h4>
174
175 <p>
176 <?php _e( 'The toolbars in the Classic Paragraph and Classic blocks are narrower and show on focus.', 'tinymce-advanced' ); ?>
177 <?php _e( 'For best results enable the menu and add only essential buttons.', 'tinymce-advanced' ); ?>
178 <?php _e( 'The buttons will wrap around depending on the width of the toolbar.', 'tinymce-advanced' ); ?>
179 </p>
180
181 <p>
182 <input type="checkbox" name="options[]" id="menubar_block" value="menubar_block" <?php if ( $this->check_user_setting( 'menubar_block' ) ) { echo ' checked'; } ?>>
183 <label for="menubar_block"><?php _e( 'Enable the editor menu (recommended).', 'tinymce-advanced' ); ?></label>
184 </p>
185
186 <div class="tadv-block-editor-toolbars-wrap">
187 <div class="tadv-mce-menu tadv-block-editor mce-container mce-menubar mce-toolbar mce-first mce-stack-layout-item
188 <?php if ( $this->check_user_setting( 'menubar_block' ) ) { echo ' enabled'; } ?>">
189 <div class="mce-container-body mce-flow-layout">
190 <div class="mce-widget mce-btn mce-menubtn mce-first mce-flow-layout-item">
191 <button type="button">
192 <span class="tadv-translate">File</span>
193 <i class="mce-caret"></i>
194 </button>
195 </div>
196 <div class="mce-widget mce-btn mce-menubtn mce-flow-layout-item">
197 <button type="button">
198 <span class="tadv-translate">Edit</span>
199 <i class="mce-caret"></i>
200 </button>
201 </div>
202 <div class="mce-widget mce-btn mce-menubtn mce-flow-layout-item">
203 <button type="button">
204 <span class="tadv-translate">Insert</span>
205 <i class="mce-caret"></i>
206 </button>
207 </div>
208 <div class="mce-widget mce-btn mce-menubtn mce-flow-layout-item mce-toolbar-item">
209 <button type="button">
210 <span class="tadv-translate">View</span>
211 <i class="mce-caret"></i>
212 </button>
213 </div>
214 <div class="mce-widget mce-btn mce-menubtn mce-flow-layout-item">
215 <button type="button">
216 <span class="tadv-translate">Format</span>
217 <i class="mce-caret"></i>
218 </button>
219 </div>
220 <div class="mce-widget mce-btn mce-menubtn mce-flow-layout-item">
221 <button type="button">
222 <span class="tadv-translate">Table</span>
223 <i class="mce-caret"></i>
224 </button>
225 </div>
226 <div class="mce-widget mce-btn mce-menubtn mce-last mce-flow-layout-item">
227 <button type="button">
228 <span class="tadv-translate">Tools</span>
229 <i class="mce-caret"></i>
230 </button>
231 </div>
232 </div>
233 </div>
234
235 <div class="tadvdropzone tadv-block-editor mce-toolbar">
236 <ul id="toolbar_classic_block" class="container-classic-block">
237 <?php
238
239 $mce_text_buttons = array( 'styleselect', 'formatselect', 'fontselect', 'fontsizeselect' );
240 $all_buttons_block = $all_buttons;
241
242 // Remove the toolbar-toggle
243 unset( $all_buttons_block['wp_adv'] );
244
245 foreach( $this->toolbar_classic_block as $button_id ) {
246 $name = '';
247
248 if ( strpos( $button_id, 'separator' ) !== false || in_array( $button_id, array( 'moveforward', 'movebackward', 'absolute' ) ) ) {
249 continue;
250 }
251
252 if ( isset( $all_buttons_block[ $button_id ] ) ) {
253 $name = $all_buttons_block[ $button_id ];
254 unset( $all_buttons_block[ $button_id ] );
255 } else {
256 continue;
257 }
258
259 ?>
260 <li class="tadvmodule" id="<?php echo $button_id; ?>">
261 <?php
262
263 if ( in_array( $button_id, $mce_text_buttons, true ) ) {
264 ?>
265 <div class="tadvitem mce-widget mce-btn mce-menubtn mce-fixed-width mce-listbox">
266 <div class="the-button">
267 <span class="descr"><?php echo $name; ?></span>
268 <i class="mce-caret"></i>
269 <input type="hidden" class="tadv-button" name="toolbar_classic_block[]" value="<?php echo $button_id; ?>" />
270 </div>
271 </div>
272 <?php
273 } else {
274 ?>
275 <div class="tadvitem">
276 <i class="mce-ico mce-i-<?php echo $button_id; ?>" title="<?php echo $name; ?>"></i>
277 <span class="descr"><?php echo $name; ?></span>
278 <input type="hidden" class="tadv-button" name="toolbar_classic_block[]" value="<?php echo $button_id; ?>" />
279 </div>
280 <?php
281 }
282
283 ?>
284 </li>
285 <?php
286 }
287
288 ?>
289 </ul>
290 </div>
291 </div>
292
293 <p><?php _e( 'Drop buttons in the toolbars, or drag the buttons to rearrange them.', 'tinymce-advanced' ); ?></p>
294
295 <div class="unuseddiv">
296 <p><strong><?php _e( 'Unused Buttons for the Classic Paragraph and Classic blocks toolbars', 'tinymce-advanced' ); ?></strong></p>
297 <div>
298 <ul id="unused-classic-block" class="unused container-classic-block">
299 <?php
300
301 foreach( $all_buttons_block as $button_id => $name ) {
302 if ( strpos( $button_id, 'separator' ) !== false ) {
303 continue;
304 }
305
306 ?>
307 <li class="tadvmodule" id="<?php echo $button_id; ?>">
308 <?php
309
310 if ( in_array( $button_id, $mce_text_buttons, true ) ) {
311 ?>
312 <div class="tadvitem mce-widget mce-btn mce-menubtn mce-fixed-width mce-listbox">
313 <div class="the-button">
314 <span class="descr"><?php echo $name; ?></span>
315 <i class="mce-caret"></i>
316 <input type="hidden" class="tadv-button" name="unused-classic-block[]" value="<?php echo $button_id; ?>" />
317 </div>
318 </div>
319 <?php
320 } else {
321 ?>
322 <div class="tadvitem">
323 <i class="mce-ico mce-i-<?php echo $button_id; ?>" title="<?php echo $name; ?>"></i>
324 <span class="descr"><?php echo $name; ?></span>
325 <input type="hidden" class="tadv-button" name="unused-classic-block[]" value="<?php echo $button_id; ?>" />
326 </div>
327 <?php
328 }
329
330 ?>
331 </li>
332 <?php
333 }
334
335 ?>
336 </ul>
337 </div><!-- /highlight -->
338 </div><!-- /unuseddiv -->
339 </div><!-- /block-editor -->
340
341 <div id="classic-editor">
342 <h4><?php _e( 'Toolbars for the Classic Editor', 'tinymce-advanced' ); ?></h4>
343
344 <div class="tadvzones">
345 <p>
346 <input type="checkbox" name="options[]" id="menubar" value="menubar" <?php if ( $this->check_user_setting( 'menubar' ) ) { echo ' checked="checked"'; } ?>>
347 <label for="menubar"><?php _e( 'Enable the editor menu.', 'tinymce-advanced' ); ?></label>
348 </p>
349
350 <div class="tadv-mce-menu tadv-classic-editor mce-container mce-menubar mce-toolbar mce-first mce-stack-layout-item
351 <?php if ( $this->check_user_setting( 'menubar' ) ) { echo ' enabled'; } ?>">
352 <div class="mce-container-body mce-flow-layout">
353 <div class="mce-widget mce-btn mce-menubtn mce-first mce-flow-layout-item">
354 <button type="button">
355 <span class="tadv-translate">File</span>
356 <i class="mce-caret"></i>
357 </button>
358 </div>
359 <div class="mce-widget mce-btn mce-menubtn mce-flow-layout-item">
360 <button type="button">
361 <span class="tadv-translate">Edit</span>
362 <i class="mce-caret"></i>
363 </button>
364 </div>
365 <div class="mce-widget mce-btn mce-menubtn mce-flow-layout-item">
366 <button type="button">
367 <span class="tadv-translate">Insert</span>
368 <i class="mce-caret"></i>
369 </button>
370 </div>
371 <div class="mce-widget mce-btn mce-menubtn mce-flow-layout-item mce-toolbar-item">
372 <button type="button">
373 <span class="tadv-translate">View</span>
374 <i class="mce-caret"></i>
375 </button>
376 </div>
377 <div class="mce-widget mce-btn mce-menubtn mce-flow-layout-item">
378 <button type="button">
379 <span class="tadv-translate">Format</span>
380 <i class="mce-caret"></i>
381 </button>
382 </div>
383 <div class="mce-widget mce-btn mce-menubtn mce-flow-layout-item">
384 <button type="button">
385 <span class="tadv-translate">Table</span>
386 <i class="mce-caret"></i>
387 </button>
388 </div>
389 <div class="mce-widget mce-btn mce-menubtn mce-last mce-flow-layout-item">
390 <button type="button">
391 <span class="tadv-translate">Tools</span>
392 <i class="mce-caret"></i>
393 </button>
394 </div>
395 </div>
396 </div>
397
398 <?php
399
400 $all_buttons_classic = $all_buttons;
401 $button_id = '';
402
403 for ( $i = 1; $i < 5; $i++ ) {
404 $toolbar = "toolbar_$i";
405
406 ?>
407 <div class="tadvdropzone mce-toolbar">
408 <ul id="toolbar_<?php echo $i; ?>" class="container">
409 <?php
410
411 foreach( $this->$toolbar as $button_id ) {
412 if ( strpos( $button_id, 'separator' ) !== false || in_array( $button_id, array( 'moveforward', 'movebackward', 'absolute' ) ) ) {
413 continue;
414 }
415
416 if ( isset( $all_buttons_classic[ $button_id ] ) ) {
417 $name = $all_buttons_classic[ $button_id ];
418 unset( $all_buttons_classic[ $button_id ] );
419 } else {
420 continue;
421 }
422
423 ?>
424 <li class="tadvmodule" id="<?php echo $button_id; ?>">
425 <?php
426
427 if ( in_array( $button_id, $mce_text_buttons, true ) ) {
428 ?>
429 <div class="tadvitem mce-widget mce-btn mce-menubtn mce-fixed-width mce-listbox">
430 <div class="the-button">
431 <span class="descr"><?php echo $name; ?></span>
432 <i class="mce-caret"></i>
433 <input type="hidden" class="tadv-button" name="toolbar_<?php echo $i; ?>[]" value="<?php echo $button_id; ?>" />
434 </div>
435 </div>
436 <?php
437 } else {
438 ?>
439 <div class="tadvitem">
440 <i class="mce-ico mce-i-<?php echo $button_id; ?>" title="<?php echo $name; ?>"></i>
441 <span class="descr"><?php echo $name; ?></span>
442 <input type="hidden" class="tadv-button" name="toolbar_<?php echo $i; ?>[]" value="<?php echo $button_id; ?>" />
443 </div>
444 <?php
445 }
446
447 ?>
448 </li>
449 <?php
450
451 }
452
453 ?>
454 </ul></div>
455 <?php
456 }
457
458 ?>
459 </div>
460
461 <p><?php _e( 'Drop buttons in the toolbars, or drag the buttons to rearrange them.', 'tinymce-advanced' ); ?></p>
462
463 <div class="unuseddiv">
464 <h4><?php _e( 'Unused Buttons', 'tinymce-advanced' ); ?></h4>
465 <div>
466 <ul id="unused" class="unused container">
467 <?php
468
469 foreach( $all_buttons_classic as $button_id => $name ) {
470 if ( strpos( $button_id, 'separator' ) !== false ) {
471 continue;
472 }
473
474 ?>
475 <li class="tadvmodule" id="<?php echo $button_id; ?>">
476 <?php
477
478 if ( in_array( $button_id, $mce_text_buttons, true ) ) {
479 ?>
480 <div class="tadvitem mce-widget mce-btn mce-menubtn mce-fixed-width mce-listbox">
481 <div class="the-button">
482 <span class="descr"><?php echo $name; ?></span>
483 <i class="mce-caret"></i>
484 <input type="hidden" class="tadv-button" name="unused[]" value="<?php echo $button_id; ?>" />
485 </div>
486 </div>
487 <?php
488 } else {
489 ?>
490 <div class="tadvitem">
491 <i class="mce-ico mce-i-<?php echo $button_id; ?>" title="<?php echo $name; ?>"></i>
492 <span class="descr"><?php echo $name; ?></span>
493 <input type="hidden" class="tadv-button" name="unused[]" value="<?php echo $button_id; ?>" />
494 </div>
495 <?php
496 }
497
498 ?>
499 </li>
500 <?php
501 }
502
503 ?>
504 </ul>
505 </div><!-- /highlighted -->
506 </div>
507 </div><!-- /classic-editor -->
508
509 <div class="advanced-options">
510 <h3><?php _e( 'Options', 'tinymce-advanced' ); ?></h3>
511
512 <div>
513 <input type="checkbox" name="options[]" value="merge_toolbars" id="merge_toolbars" <?php if ( $this->check_user_setting( 'merge_toolbars' ) ) echo ' checked'; ?> />
514 <label for="merge_toolbars"><?php _e( 'Append all buttons to the top toolbar in the Classic Paragraph and Classic blocks.', 'tinymce-advanced' ); ?></label>
515 <p><?php _e( 'This affects buttons that are added by other plugins. These buttons will be appended to the top toolbar row instead of forming second, third, and forth rows.', 'tinymce-advanced' ); ?></p>
516 </div>
517
518 <div>
519 <input type="checkbox" name="options[]" value="advlist" id="advlist" <?php if ( $this->check_user_setting('advlist') ) echo ' checked'; ?> />
520 <label for="advlist"><?php _e( 'List Style Options', 'tinymce-advanced' ); ?></label>
521 <p>
522 <?php _e( 'Enable more list options: upper or lower case letters for ordered lists, disk or square for unordered lists, etc.', 'tinymce-advanced' ); ?>
523 </p>
524 </div>
525
526 <div>
527 <input type="checkbox" name="options[]" value="contextmenu" id="contextmenu" <?php if ( $this->check_user_setting('contextmenu') ) echo ' checked'; ?> />
528 <label for="contextmenu"><?php _e( 'Context Menu', 'tinymce-advanced' ); ?></label>
529 <p><?php _e( 'Replace the browser context (right-click) menu.', 'tinymce-advanced' ); ?></p>
530 </div>
531
532 <div>
533 <input type="checkbox" name="options[]" value="advlink" id="advlink" <?php if ( $this->check_user_setting('advlink') ) echo ' checked'; ?> />
534 <label for="advlink"><?php _e( 'Alternative link dialog', 'tinymce-advanced' ); ?></label>
535 <p><?php _e( 'Open the TinyMCE link dialog when using the link button on the toolbar or the link menu item.', 'tinymce-advanced' ); ?></p>
536 </div>
537
538 <div>
539 <input type="checkbox" name="options[]" value="fontsize_formats" id="fontsize_formats" <?php if ( $this->check_user_setting( 'fontsize_formats' ) ) echo ' checked="checked"'; ?> />
540 <label for="fontsize_formats"><?php _e( 'Font sizes', 'tinymce-advanced' ); ?></label>
541 <p><?php printf( __( 'Replace the size setting available for fonts with: %s.', 'tinymce-advanced' ), $this->fontsize_formats ); ?></p>
542 </div>
543 </div>
544 <?php
545
546 if ( ! is_multisite() || current_user_can( 'manage_sites' ) ) {
547 ?>
548 <div class="advanced-options">
549 <h3><?php _e( 'Advanced Options', 'tinymce-advanced' ); ?></h3>
550 <div>
551 <input type="checkbox" name="admin_options[]" value="classic_paragraph_block" id="classic_paragraph_block" <?php if ( $this->check_admin_setting( 'classic_paragraph_block' ) ) echo ' checked'; ?> />
552 <label for="classic_paragraph_block"><?php _e( 'Add Classic Paragraph block', 'tinymce-advanced' ); ?></label>
553 <p>
554 <?php _e( 'The Classic Paragraph block includes the familiar TinyMCE editor and is an extended and enhanced Classic block.', 'tinymce-advanced' ); ?>
555 <?php _e( 'You can add multiple paragraphs, tables, galleries, embed video, set fonts and colors, and generally use everything that is available in the Classic Editor.', 'tinymce-advanced' ); ?>
556 <?php _e( 'Also, like the Classic block, most existing TinyMCE plugins and add-ons will continue to work.', 'tinymce-advanced' ); ?>
557 <?php _e( 'This makes the Block Editor more familiar, easier to use, easier to get used to, and more compatible with your existing workflow.', 'tinymce-advanced' ); ?>
558 </p>
559 <p>
560 <?php _e( 'In addition most default blocks can be transformed into classic paragraphs, and a Classic Paragraph can be converted to multiple blocks.', 'tinymce-advanced' ); ?>
561 <?php _e( 'It can be used everywhere instead of the Paragraph block including in columns, when creating reusable blocks, etc.', 'tinymce-advanced' ); ?>
562 </p>
563 </div>
564
565 <div>
566 <input type="checkbox" name="admin_options[]" value="hybrid_mode" id="hybrid_mode" <?php if ( $this->check_admin_setting( 'hybrid_mode' ) ) echo ' checked'; ?> />
567 <label for="hybrid_mode"><?php _e( 'Make the Classic Paragraph or Classic block the default block (hybrid mode)', 'tinymce-advanced' ); ?></label>
568 <p>
569 <?php _e( 'The default block is inserted on pressing Enter in the title, or clicking under the last block.', 'tinymce-advanced' ); ?>
570 <?php _e( 'Selecting this option also adds some improvements and fixes for the Classic block.', 'tinymce-advanced' ); ?>
571 </p>
572 </div>
573
574 <div>
575 <?php
576
577 if ( function_exists( 'is_plugin_active' ) && ! is_plugin_active( 'classic-editor/classic-editor.php' ) ) {
578
579 ?>
580 <input type="checkbox" name="admin_options[]" value="replace_block_editor" id="replace_block_editor" <?php if ( $this->check_admin_setting( 'replace_block_editor' ) ) echo ' checked'; ?> />
581 <label for="replace_block_editor"><?php _e( 'Replace the Block Editor with the Classic Editor', 'tinymce-advanced' ); ?></label>
582 <p>
583 <?php _e( 'Selecting this option will restore the previous (&#8220;classic&#8221;) editor and the previous Edit Post screen.', 'tinymce-advanced' ); ?>
584 <?php _e( 'It will allow you to use other plugins that enhance that editor, add old-style Meta Boxes, or in some way depend on the previous Edit Post screen.', 'tinymce-advanced' ); ?>
585 </p>
586 <p>
587 <?php
588
589 $text = __( 'If you prefer to use both editors side by side, do not enable this option. It is better to install the %1$sClassic Editor plugin%2$s.', 'tinymce-advanced' );
590 /* translators: URL to (localised) Classic Editor plugin. */
591 $url = __( 'https://wordpress.org/plugins/classic-editor/', 'tinymce-advanced' );
592 printf( $text, '<a href="' . esc_url( $url ) . '">', '</a>' );
593
594 ?>
595 </p>
596 <?php
597 }
598
599 ?>
600 </div>
601 <div>
602 <input type="checkbox" name="admin_options[]" value="no_autop" id="no_autop" <?php if ( $this->check_admin_setting( 'no_autop' ) ) echo ' checked'; ?> />
603 <label for="no_autop"><?php _e( 'Keep paragraph tags in the Classic block and the Classic Editor', 'tinymce-advanced' ); ?></label>
604 <p>
605 <?php _e( 'Stop removing &lt;p&gt; and &lt;br&gt; tags in the Classic Editor and show them in the Text tab.', 'tinymce-advanced' ); ?>
606 <?php _e( 'This will make it possible to use more advanced coding in the Text tab without the back-end filtering affecting it much.', 'tinymce-advanced' ); ?>
607 <?php _e( 'However it may behave unexpectedly in rare cases, so test it thoroughly before enabling it permanently.', 'tinymce-advanced' ); ?>
608 <?php _e( 'Line breaks in the Text tab in the Classic Editor would still affect the output, in particular do not use empty lines, line breaks inside HTML tags or multiple &lt;br&gt; tags.', 'tinymce-advanced' ); ?>
609 </p>
610 </div>
611 <?php
612
613 $has_editor_style = $this->has_editor_style();
614 $disabled = ' disabled';
615
616 if ( $has_editor_style === false ) {
617 add_editor_style();
618 $has_editor_style = $this->has_editor_style();
619 }
620
621 if ( $has_editor_style ) {
622 $disabled = '';
623 }
624
625 ?>
626 <div>
627 <input type="checkbox" name="admin_options[]" value="importcss" id="importcss" <?php if ( ! $disabled && $this->check_admin_setting( 'importcss' ) ) echo ' checked'; echo $disabled; ?> />
628 <label for="importcss"><?php _e( 'Create CSS classes menu', 'tinymce-advanced' ); ?></label>
629 <p>
630 <?php _e( 'Load the CSS classes used in editor-style.css and replace the Formats menu.', 'tinymce-advanced' ); ?>
631 </p>
632 <?php
633
634 if ( $disabled ) {
635 ?>
636 <p>
637 <span class="tadv-error"><?php _e( 'Disabled:', 'tinymce-advanced' ); ?></span>
638 <?php _e( 'A stylesheet file named editor-style.css was not added by your theme.', 'tinymce-advanced' ); ?>
639 <br>
640 <?php
641 }
642
643 ?>
644 </p>
645 </div>
646 <div class="advanced-table-options">
647 <h4><?php _e( 'Advanced options for tables', 'tinymce-advanced' ); ?></h4>
648 <div>
649 <input type="checkbox" name="admin_options[]" value="table_resize_bars" id="table_resize_bars" <?php if ( $this->check_admin_setting( 'table_resize_bars' ) ) echo ' checked'; ?> />
650 <label for="table_resize_bars"><?php _e( 'Enable resizing of tables, rows, and columns by dragging with the mouse', 'tinymce-advanced' ); ?></label>
651 <p>
652 <?php _e( 'When enabled the whole table, rows, and columns can be resized by dragging but the sizes are set with inline CSS styles.', 'tinymce-advanced' ); ?>
653 <?php _e( 'This may override some styles that are set by your theme and usually makes the table non-responsive when viewed on a small screen like a smartphone.', 'tinymce-advanced' ); ?>
654 <?php _e( 'When a row or a column is resized the inline styles are updated on all table rows and cells.', 'tinymce-advanced' ); ?>
655 </p>
656 <p>
657 <?php _e( 'Disabling this option will stop the editor from adding inline CSS styles and will produce cleaner HTML code.', 'tinymce-advanced' ); ?>
658 <?php _e( 'Then the table, the rows and the cells can be resized by typing the size values in the advanced options tabs.', 'tinymce-advanced' ); ?>
659 </p>
660 <p>
661 <span class="dashicons dashicons-info"></span>
662 <?php _e( 'This option does not affect inline styles on tables in existing posts. To reset table size or remove all formatting for the whole table please see the two buttons at the bottom of the Format menu.', 'tinymce-advanced' ); ?>
663 </p>
664 </div>
665 <div>
666 <input type="checkbox" name="admin_options[]" value="table_default_attributes" id="table_default_attributes" <?php if ( $this->check_admin_setting( 'table_default_attributes' ) ) echo ' checked'; ?> />
667 <label for="table_default_attributes"><?php _e( 'When inserting a table set the HTML border attribute to 1', 'tinymce-advanced' ); ?></label>
668 <p>
669 <?php _e( 'This will add a border around the table unless it is overriden by your theme.', 'tinymce-advanced' ); ?>
670 </p>
671 </div>
672 <div>
673 <input type="checkbox" name="admin_options[]" value="table_grid" id="table_grid" <?php if ( $this->check_admin_setting( 'table_grid' ) ) echo ' checked'; ?> />
674 <label for="table_grid"><?php _e( 'When inserting a table show a grid where the number of rows and columns can be selected by dragging with the mouse', 'tinymce-advanced' ); ?></label>
675 <p>
676 <?php _e( 'If the grid is disabled the number of rows and columns can be typed in the Insert Table dialog.', 'tinymce-advanced' ); ?>
677 </p>
678 </div>
679 <div>
680 <input type="checkbox" name="admin_options[]" value="table_tab_navigation" id="table_tab_navigation" <?php if ( $this->check_admin_setting( 'table_tab_navigation' ) ) echo ' checked'; ?> />
681 <label for="table_tab_navigation"><?php _e( 'Jump to the next cell when pressing the tab key while editing a table', 'tinymce-advanced' ); ?></label>
682 <p>
683 <?php _e( 'When disabled, pressing the tab key will jump outside the editor area.', 'tinymce-advanced' ); ?>
684 </p>
685 </div>
686 <div>
687 <input type="checkbox" name="admin_options[]" value="table_advtab" id="table_advtab" <?php if ( $this->check_admin_setting( 'table_advtab' ) ) echo ' checked'; ?> />
688 <label for="table_advtab"><?php _e( 'Show the advanced tabs in the table properties dialogs', 'tinymce-advanced' ); ?></label>
689 <p>
690 <?php _e( 'The advanced tabs allow setting of inline CSS styles on the table, each row, and each cell. They have fields for easier setting of border, border color and background color styles.', 'tinymce-advanced' ); ?>
691 </p>
692 <p>
693 <span class="dashicons dashicons-warning"></span>
694 <?php _e( 'To keep the table more responsive please use percentage values when setting widths.', 'tinymce-advanced' ); ?>
695 </p>
696 </div>
697 </div>
698 </div>
699
700 <div class="advanced-options">
701 <h3><?php _e( 'Administration', 'tinymce-advanced' ); ?></h3>
702 <div>
703 <h4><?php _e( 'Settings import and export', 'tinymce-advanced' ); ?></h4>
704 <p>
705 <?php _e( 'The settings are exported as a JSON encoded file.', 'tinymce-advanced' ); ?>
706 <?php _e( 'It is important that the exported file is not edited in any way.', 'tinymce-advanced' ); ?>
707 </p>
708 <p>
709 <?php wp_nonce_field( 'tadv-export-settings', 'tadv-export-settings-nonce', false ); ?>
710 <input type="submit" class="button" name="tadv-export-settings" value="<?php _e( 'Export Settings', 'tinymce-advanced' ); ?>" /> &nbsp;
711 <input type="submit" class="button" name="tadv-import-settings" value="<?php _e( 'Import Settings', 'tinymce-advanced' ); ?>" />
712 </p>
713 </div>
714 <div>
715 <h4><?php _e( 'Enable the editor enhancements for:', 'tinymce-advanced' ); ?></h4>
716 <p>
717 <input type="checkbox" id="tadv_enable_1" name="tadv_enable_at[]" value="edit_post_screen" <?php if ( $this->check_admin_setting( 'enable_edit_post_screen' ) ) echo ' checked'; ?> />
718 <label for="tadv_enable_1"><?php _e( 'The Classic Editor (Add New and Edit posts and pages)', 'tinymce-advanced' ); ?></label>
719 </p>
720 <p>
721 <input type="checkbox" id="tadv_enable_2" name="tadv_enable_at[]" value="rest_of_wpadmin" <?php if ( $this->check_admin_setting( 'enable_rest_of_wpadmin' ) ) echo ' checked'; ?> />
722 <label for="tadv_enable_2"><?php _e( 'Other instances of the Classic (TinyMCE) editor in wp-admin', 'tinymce-advanced' ); ?></label>
723 </p>
724 <p>
725 <input type="checkbox" id="tadv_enable_3" name="tadv_enable_at[]" value="on_front_end" <?php if ( $this->check_admin_setting( 'enable_on_front_end' ) ) echo ' checked'; ?> />
726 <label for="tadv_enable_3"><?php _e( 'Instances of the Classic editor on the front end of the site', 'tinymce-advanced' ); ?></label>
727 </p>
728 </div>
729 </div>
730 <?php
731
732 }
733
734
735 // Add a notice that the plugin was renamed.
736 ?>
737 <p>
738 <span class="dashicons dashicons-info" style="color: #777;"></span>
739 <?php _e( 'Please note: This plugin was renamed from "TinyMCE Advanced" to "Advanced Editor Tools". The plugin functionality remains the same.', 'tinymce-advanced' ); ?>
740 </p>
741
742 <hr>
743
744 <p class="tadv-submit">
745 <?php wp_nonce_field( 'tadv-save-buttons-order' ); ?>
746 <input class="button" type="submit" name="tadv-restore-defaults" value="<?php _e( 'Restore Default Settings', 'tinymce-advanced' ); ?>" />
747 <input class="button-primary button-large" type="submit" name="tadv-save" value="<?php _e( 'Save Changes', 'tinymce-advanced' ); ?>" />
748 </p>
749 </form>
750
751 <div id="wp-adv-error-message" class="tadv-error">
752 <?php _e( 'The [Toolbar toggle] button shows or hides the second, third, and forth button rows. It will only work when it is in the first row and there are buttons in the second row.', 'tinymce-advanced' ); ?>
753 </div>
754 </div><?php // .wrap.tinymce-advanced end ?>
755