~canonical-sysadmins/wordpress/4.8.1

« back to all changes in this revision

Viewing changes to wp-includes/class-wp-editor.php

  • Committer: Barry Price
  • Date: 2016-08-17 04:49:28 UTC
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: barry.price@canonical.com-20160817044928-viijiwb4tl8jwzmp
new upstream release 4.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
         *     @type string     $editor_class      Extra classes to add to the editor textarea element. Default empty.
55
55
         *     @type bool       $teeny             Whether to output the minimal editor config. Examples include
56
56
         *                                         Press This and the Comment editor. Default false.
57
 
         *     @type bool       $dfw               Deprecated in 4.1. Since 4.3 used only to enqueue wp-fullscreen-stub.js for backwards compatibility.
 
57
         *     @type bool       $dfw               Deprecated in 4.1. Since 4.3 used only to enqueue wp-fullscreen-stub.js
 
58
         *                                         for backward compatibility.
58
59
         *     @type bool|array $tinymce           Whether to load TinyMCE. Can be used to pass settings directly to
59
60
         *                                         TinyMCE using an array. Default true.
60
61
         *     @type bool|array $quicktags         Whether to load Quicktags. Can be used to pass settings directly to
65
66
        public static function parse_settings( $editor_id, $settings ) {
66
67
 
67
68
                /**
68
 
                 * Filter the wp_editor() settings.
 
69
                 * Filters the wp_editor() settings.
69
70
                 *
70
71
                 * @since 4.0.0
71
72
                 *
99
100
                if ( self::$this_tinymce ) {
100
101
                        if ( false !== strpos( $editor_id, '[' ) ) {
101
102
                                self::$this_tinymce = false;
102
 
                                _deprecated_argument( 'wp_editor()', '3.9', 'TinyMCE editor IDs cannot have brackets.' );
 
103
                                _deprecated_argument( 'wp_editor()', '3.9.0', 'TinyMCE editor IDs cannot have brackets.' );
103
104
                        }
104
105
                }
105
106
 
240
241
                }
241
242
 
242
243
                /**
243
 
                 * Filter the HTML markup output that displays the editor.
 
244
                 * Filters the HTML markup output that displays the editor.
244
245
                 *
245
246
                 * @since 2.1.0
246
247
                 *
257
258
                }
258
259
 
259
260
                /**
260
 
                 * Filter the default editor content.
 
261
                 * Filters the default editor content.
261
262
                 *
262
263
                 * @since 2.1.0
263
264
                 *
332
333
                        }
333
334
 
334
335
                        /**
335
 
                         * Filter the Quicktags settings.
 
336
                         * Filters the Quicktags settings.
336
337
                         *
337
338
                         * @since 3.3.0
338
339
                         *
361
362
                                if ( $set['teeny'] ) {
362
363
 
363
364
                                        /**
364
 
                                         * Filter the list of teenyMCE plugins.
 
365
                                         * Filters the list of teenyMCE plugins.
365
366
                                         *
366
367
                                         * @since 2.7.0
367
368
                                         *
372
373
                                } else {
373
374
 
374
375
                                        /**
375
 
                                         * Filter the list of TinyMCE external plugins.
 
376
                                         * Filters the list of TinyMCE external plugins.
376
377
                                         *
377
378
                                         * The filter takes an associative array of external plugins for
378
379
                                         * TinyMCE in the form 'plugin_name' => 'url'.
417
418
                                        }
418
419
 
419
420
                                        /**
420
 
                                         * Filter the list of default TinyMCE plugins.
 
421
                                         * Filters the list of default TinyMCE plugins.
421
422
                                         *
422
423
                                         * The filter specifies which of the default plugins included
423
424
                                         * in WordPress should be added to the TinyMCE instance.
437
438
                                        if ( ! empty( $mce_external_plugins ) ) {
438
439
 
439
440
                                                /**
440
 
                                                 * Filter the translations loaded for external TinyMCE 3.x plugins.
 
441
                                                 * Filters the translations loaded for external TinyMCE 3.x plugins.
441
442
                                                 *
442
443
                                                 * The filter takes an associative array ('plugin_name' => 'path')
443
444
                                                 * where 'path' is the include path to the file.
575
576
                                }
576
577
 
577
578
                                /**
578
 
                                 * Filter the comma-delimited list of stylesheets to load in TinyMCE.
 
579
                                 * Filters the comma-delimited list of stylesheets to load in TinyMCE.
579
580
                                 *
580
581
                                 * @since 2.1.0
581
582
                                 *
590
591
                        if ( $set['teeny'] ) {
591
592
 
592
593
                                /**
593
 
                                 * Filter the list of teenyMCE buttons (Text tab).
 
594
                                 * Filters the list of teenyMCE buttons (Text tab).
594
595
                                 *
595
596
                                 * @since 2.7.0
596
597
                                 *
613
614
                                $mce_buttons[] = 'wp_adv';
614
615
 
615
616
                                /**
616
 
                                 * Filter the first-row list of TinyMCE buttons (Visual tab).
 
617
                                 * Filters the first-row list of TinyMCE buttons (Visual tab).
617
618
                                 *
618
619
                                 * @since 2.0.0
619
620
                                 *
629
630
                                }
630
631
 
631
632
                                /**
632
 
                                 * Filter the second-row list of TinyMCE buttons (Visual tab).
 
633
                                 * Filters the second-row list of TinyMCE buttons (Visual tab).
633
634
                                 *
634
635
                                 * @since 2.0.0
635
636
                                 *
639
640
                                $mce_buttons_2 = apply_filters( 'mce_buttons_2', $mce_buttons_2, $editor_id );
640
641
 
641
642
                                /**
642
 
                                 * Filter the third-row list of TinyMCE buttons (Visual tab).
 
643
                                 * Filters the third-row list of TinyMCE buttons (Visual tab).
643
644
                                 *
644
645
                                 * @since 2.0.0
645
646
                                 *
649
650
                                $mce_buttons_3 = apply_filters( 'mce_buttons_3', array(), $editor_id );
650
651
 
651
652
                                /**
652
 
                                 * Filter the fourth-row list of TinyMCE buttons (Visual tab).
 
653
                                 * Filters the fourth-row list of TinyMCE buttons (Visual tab).
653
654
                                 *
654
655
                                 * @since 2.5.0
655
656
                                 *
710
711
                        if ( $set['teeny'] ) {
711
712
 
712
713
                                /**
713
 
                                 * Filter the teenyMCE config before init.
 
714
                                 * Filters the teenyMCE config before init.
714
715
                                 *
715
716
                                 * @since 2.7.0
716
717
                                 *
721
722
                        } else {
722
723
 
723
724
                                /**
724
 
                                 * Filter the TinyMCE config before init.
 
725
                                 * Filters the TinyMCE config before init.
725
726
                                 *
726
727
                                 * @since 2.5.0
727
728
                                 *
788
789
 
789
790
                if ( self::$has_medialib ) {
790
791
                        add_thickbox();
791
 
                        wp_enqueue_script('media-upload');
 
792
                        wp_enqueue_script( 'media-upload' );
 
793
                        wp_enqueue_script( 'wp-embed' );
792
794
                }
793
795
 
794
796
                /**
846
848
                        'Clear formatting' => __( 'Clear formatting' ),
847
849
                        'Bold' => __( 'Bold' ),
848
850
                        'Italic' => __( 'Italic' ),
849
 
                        'Code' => _x( 'Code', 'editor button' ),
 
851
                        'Code' => __( 'Code' ),
850
852
                        'Source code' => __( 'Source code' ),
851
853
                        'Font Family' => __( 'Font Family' ),
852
854
                        'Font Sizes' => __( 'Font Sizes' ),
1021
1023
                        /* translators: word count */
1022
1024
                        'Words: {0}' => sprintf( __( 'Words: %s' ), '{0}' ),
1023
1025
                        'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.' => __( 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.' ) . "\n\n" . __( 'If you’re looking to paste rich content from Microsoft Word, try turning this option off. The editor will clean up text pasted from Word automatically.' ),
1024
 
                        'Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help' => __( 'Rich Text Area. Press Alt-Shift-H for help' ),
 
1026
                        'Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help' => __( 'Rich Text Area. Press Alt-Shift-H for help.' ),
 
1027
                        'Rich Text Area. Press Control-Option-H for help.' => __( 'Rich Text Area. Press Control-Option-H for help.' ),
1025
1028
                        'You have unsaved changes are you sure you want to navigate away?' => __( 'The changes you made will be lost if you navigate away from this page.' ),
1026
1029
                        'Your browser doesn\'t support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.' => __( 'Your browser does not support direct access to the clipboard. Please use keyboard shortcuts or your browser’s edit menu instead.' ),
1027
1030
 
1062
1065
                        'Ctrl + letter:' => __( 'Ctrl + letter:' ),
1063
1066
                        'Letter' => __( 'Letter' ),
1064
1067
                        'Action' => __( 'Action' ),
 
1068
                        '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.' ),
1065
1069
                        '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.' =>
1066
1070
                                __( '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.' ),
1067
1071
                        '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.' =>
1088
1092
                }
1089
1093
 
1090
1094
                /**
1091
 
                 * Filter translated strings prepared for TinyMCE.
 
1095
                 * Filters translated strings prepared for TinyMCE.
1092
1096
                 *
1093
1097
                 * @since 3.9.0
1094
1098
                 *
1136
1140
                global $wp_version, $tinymce_version, $concatenate_scripts, $compress_scripts;
1137
1141
 
1138
1142
                /**
1139
 
                 * Filter "tiny_mce_version" is deprecated
 
1143
                 * Filters "tiny_mce_version" is deprecated
1140
1144
                 *
1141
1145
                 * The tiny_mce_version filter is not needed since external plugins are loaded directly by TinyMCE.
1142
1146
                 * These plugins can be refreshed by appending query string to the URL passed to "mce_external_plugins" filter.
1282
1286
                </script>
1283
1287
                <?php
1284
1288
 
1285
 
                if ( in_array( 'wplink', self::$plugins, true ) || in_array( 'link', self::$qt_buttons, true ) )
 
1289
                if ( in_array( 'wplink', self::$plugins, true ) || in_array( 'link', self::$qt_buttons, true ) ) {
1286
1290
                        self::wp_link_dialog();
 
1291
                }
1287
1292
 
1288
1293
                /**
1289
1294
                 * Fires after any core TinyMCE editor instances are created.
1301
1306
         * @global int $content_width
1302
1307
         */
1303
1308
        public static function wp_fullscreen_html() {
1304
 
                _deprecated_function( __FUNCTION__, '4.3' );
 
1309
                _deprecated_function( __FUNCTION__, '4.3.0' );
1305
1310
        }
1306
1311
 
1307
1312
        /**
1334
1339
                $query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] - 1 ) : 0;
1335
1340
 
1336
1341
                /**
1337
 
                 * Filter the link query arguments.
 
1342
                 * Filters the link query arguments.
1338
1343
                 *
1339
1344
                 * Allows modification of the link query arguments before querying.
1340
1345
                 *
1370
1375
                }
1371
1376
 
1372
1377
                /**
1373
 
                 * Filter the link query results.
 
1378
                 * Filters the link query results.
1374
1379
                 *
1375
1380
                 * Allows modification of the returned link query results.
1376
1381
                 *