Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-editor.php

    r47060 r47122  
    294294        }
    295295
    296         // Back-compat for the `htmledit_pre` and `richedit_pre` filters
     296        // Back-compat for the `htmledit_pre` and `richedit_pre` filters.
    297297        if ( 'html' === $default_editor && has_filter( 'htmledit_pre' ) ) {
    298298            /** This filter is documented in wp-includes/deprecated.php */
     
    515515                            $strings                       = '';
    516516
    517                             // Try to load langs/[locale].js and langs/[locale]_dlg.js
     517                            // Try to load langs/[locale].js and langs/[locale]_dlg.js.
    518518                            if ( ! in_array( $name, $loaded_langs, true ) ) {
    519519                                $path = str_replace( content_url(), '', $plugurl );
     
    569569                $mce_css = $settings['content_css'];
    570570
    571                 // The `editor-style.css` added by the theme is generally intended for the editor instance on the Edit Post screen.
    572                 // Plugins that use wp_editor() on the front-end can decide whether to add the theme stylesheet
    573                 // by using `get_editor_stylesheets()` and the `mce_css` or `tiny_mce_before_init` filters, see below.
     571                /*
     572                 * The `editor-style.css` added by the theme is generally intended for the editor instance on the Edit Post screen.
     573                 * Plugins that use wp_editor() on the front-end can decide whether to add the theme stylesheet
     574                 * by using `get_editor_stylesheets()` and the `mce_css` or `tiny_mce_before_init` filters, see below.
     575                 */
    574576                if ( is_admin() ) {
    575577                    $editor_styles = get_editor_stylesheets();
     
    772774            );
    773775
    774             // Merge with the first part of the init array
     776            // Merge with the first part of the init array.
    775777            $mceInit = array_merge( self::$first_init, $mceInit );
    776778
     
    820822
    821823            self::$mce_settings[ $editor_id ] = $mceInit;
    822         } // end if self::$this_tinymce
     824        } // End if self::$this_tinymce.
    823825    }
    824826
     
    914916        self::enqueue_scripts( true );
    915917
    916         // Also add wp-includes/css/editor.css
     918        // Also add wp-includes/css/editor.css.
    917919        wp_enqueue_style( 'editor-buttons' );
    918920
     
    947949            }
    948950
    949             // In production all plugins are loaded (they are in wp-editor.js.gz).
    950             // The 'wpview', 'wpdialogs', and 'media' TinyMCE plugins are not initialized by default.
    951             // Can be added from js by using the 'wp-before-tinymce-init' event.
     951            /*
     952             * In production all plugins are loaded (they are in wp-editor.js.gz).
     953             * The 'wpview', 'wpdialogs', and 'media' TinyMCE plugins are not initialized by default.
     954             * Can be added from js by using the 'wp-before-tinymce-init' event.
     955             */
    952956            $settings['plugins'] = implode(
    953957                ',',
     
    10341038        if ( empty( self::$mce_locale ) ) {
    10351039            $mce_locale       = get_user_locale();
    1036             self::$mce_locale = empty( $mce_locale ) ? 'en' : strtolower( substr( $mce_locale, 0, 2 ) ); // ISO 639-1
     1040            self::$mce_locale = empty( $mce_locale ) ? 'en' : strtolower( substr( $mce_locale, 0, 2 ) ); // ISO 639-1.
    10371041        }
    10381042
     
    11081112            'branding'                     => false,
    11091113
    1110             // Limit the preview styles in the menu/toolbar
     1114            // Limit the preview styles in the menu/toolbar.
    11111115            'preview_styles'               => 'font-family font-size font-weight font-style text-decoration text-transform',
    11121116
     
    11211125        $version = 'ver=' . get_bloginfo( 'version' );
    11221126
    1123         // Default stylesheets
     1127        // Default stylesheets.
    11241128        $settings['content_css'] = includes_url( "css/dashicons$suffix.css?$version" ) . ',' .
    11251129            includes_url( "js/tinymce/skins/wordpress/wp-content.css?$version" );
     
    11361140        if ( empty( self::$translation ) ) {
    11371141            self::$translation = array(
    1138                 // Default TinyMCE strings
     1142                // Default TinyMCE strings.
    11391143                'New document'                         => __( 'New document' ),
    11401144                'Formats'                              => _x( 'Formats', 'TinyMCE' ),
     
    12011205                'Lower Roman'                          => _x( 'Lower Roman', 'list style' ),
    12021206
    1203                 // Anchor plugin
     1207                // Anchor plugin.
    12041208                'Name'                                 => _x( 'Name', 'Name of link anchor (TinyMCE)' ),
    12051209                'Anchor'                               => _x( 'Anchor', 'Link anchor (TinyMCE)' ),
     
    12091213                'Id'                                   => _x( 'Id', 'Id for link anchor (TinyMCE)' ),
    12101214
    1211                 // Fullpage plugin
     1215                // Fullpage plugin.
    12121216                'Document properties'                  => __( 'Document properties' ),
    12131217                'Robots'                               => __( 'Robots' ),
     
    12181222                'Author'                               => __( 'Author' ),
    12191223
    1220                 // Media, image plugins
     1224                // Media, image plugins.
    12211225                'Image'                                => __( 'Image' ),
    12221226                'Insert/edit image'                    => array( __( 'Insert/edit image' ), 'accessM' ),
     
    12441248                'Embed'                                => __( 'Embed' ),
    12451249
    1246                 // Each of these have a corresponding plugin
     1250                // Each of these have a corresponding plugin.
    12471251                'Special character'                    => __( 'Special character' ),
    12481252                'Right to left'                        => _x( 'Right to left', 'editor button' ),
     
    12621266                'Remove link'                          => array( __( 'Remove link' ), 'accessS' ),
    12631267
    1264                 // Link plugin
     1268                // Link plugin.
    12651269                'Link'                                 => __( 'Link' ),
    12661270                'Insert link'                          => __( 'Insert link' ),
     
    12761280                'Color'                                => __( 'Color' ),
    12771281                'Custom color'                         => __( 'Custom color' ),
    1278                 'Custom...'                            => _x( 'Custom...', 'label for custom color' ), // no ellipsis
     1282                'Custom...'                            => _x( 'Custom...', 'label for custom color' ), // No ellipsis.
    12791283                'No color'                             => __( 'No color' ),
    12801284                'R'                                    => _x( 'R', 'Short for red in RGB' ),
     
    12821286                'B'                                    => _x( 'B', 'Short for blue in RGB' ),
    12831287
    1284                 // Spelling, search/replace plugins
     1288                // Spelling, search/replace plugins.
    12851289                'Could not find the specified string.' => __( 'Could not find the specified string.' ),
    12861290                'Replace'                              => _x( 'Replace', 'find/replace' ),
     
    13001304                'Add to Dictionary'                    => __( 'Add to Dictionary' ),
    13011305
    1302                 // TinyMCE tables
     1306                // TinyMCE tables.
    13031307                'Insert table'                         => __( 'Insert table' ),
    13041308                'Delete table'                         => __( 'Delete table' ),
     
    13741378                    __( 'Your browser does not support direct access to the clipboard. Please use keyboard shortcuts or your browser’s edit menu instead.' ),
    13751379
    1376                 // TinyMCE menus
     1380                // TinyMCE menus.
    13771381                'Insert'                               => _x( 'Insert', 'TinyMCE menu' ),
    13781382                'File'                                 => _x( 'File', 'TinyMCE menu' ),
     
    13831387                'Format'                               => _x( 'Format', 'TinyMCE menu' ),
    13841388
    1385                 // WordPress strings
     1389                // WordPress strings.
    13861390                'Toolbar Toggle'                       => array( __( 'Toolbar Toggle' ), 'accessZ' ),
    13871391                'Insert Read More tag'                 => array( __( 'Insert Read More tag' ), 'accessT' ),
    13881392                'Insert Page Break tag'                => array( __( 'Insert Page Break tag' ), 'accessP' ),
    1389                 'Read more...'                         => __( 'Read more...' ), // Title on the placeholder inside the editor (no ellipsis)
     1393                'Read more...'                         => __( 'Read more...' ), // Title on the placeholder inside the editor (no ellipsis).
    13901394                'Distraction-free writing mode'        => array( __( 'Distraction-free writing mode' ), 'accessW' ),
    1391                 'No alignment'                         => __( 'No alignment' ), // Tooltip for the 'alignnone' button in the image toolbar
    1392                 'Remove'                               => __( 'Remove' ), // Tooltip for the 'remove' button in the image toolbar
    1393                 'Edit|button'                          => __( 'Edit' ), // Tooltip for the 'edit' button in the image toolbar
    1394                 'Paste URL or type to search'          => __( 'Paste URL or type to search' ), // Placeholder for the inline link dialog
    1395                 'Apply'                                => __( 'Apply' ), // Tooltip for the 'apply' button in the inline link dialog
    1396                 'Link options'                         => __( 'Link options' ), // Tooltip for the 'link options' button in the inline link dialog
    1397                 'Visual'                               => _x( 'Visual', 'Name for the Visual editor tab' ), // Editor switch tab label
    1398                 'Text'                                 => _x( 'Text', 'Name for the Text editor tab (formerly HTML)' ), // Editor switch tab label
    1399                 'Add Media'                            => array( __( 'Add Media' ), 'accessM' ), // Tooltip for the 'Add Media' button in the block editor Classic block
    1400 
    1401                 // Shortcuts help modal
     1395                'No alignment'                         => __( 'No alignment' ), // Tooltip for the 'alignnone' button in the image toolbar.
     1396                'Remove'                               => __( 'Remove' ),       // Tooltip for the 'remove' button in the image toolbar.
     1397                'Edit|button'                          => __( 'Edit' ),         // Tooltip for the 'edit' button in the image toolbar.
     1398                'Paste URL or type to search'          => __( 'Paste URL or type to search' ), // Placeholder for the inline link dialog.
     1399                'Apply'                                => __( 'Apply' ),        // Tooltip for the 'apply' button in the inline link dialog.
     1400                'Link options'                         => __( 'Link options' ), // Tooltip for the 'link options' button in the inline link dialog.
     1401                'Visual'                               => _x( 'Visual', 'Name for the Visual editor tab' ),             // Editor switch tab label.
     1402                'Text'                                 => _x( 'Text', 'Name for the Text editor tab (formerly HTML)' ), // Editor switch tab label.
     1403                'Add Media'                            => array( __( 'Add Media' ), 'accessM' ), // Tooltip for the 'Add Media' button in the block editor Classic block.
     1404
     1405                // Shortcuts help modal.
    14021406                'Keyboard Shortcuts'                   => array( __( 'Keyboard Shortcuts' ), 'accessH' ),
    14031407                'Classic Block Keyboard Shortcuts'     => __( 'Classic Block Keyboard Shortcuts' ),
     
    14971501        }
    14981502
    1499         // Set direction
     1503        // Set direction.
    15001504        if ( is_rtl() ) {
    15011505            $mce_translation['_dir'] = 'rtl';
     
    16441648
    16451649            if ( self::$ext_plugins ) {
    1646                 // Load the old-format English strings to prevent unsightly labels in old style popups
     1650                // Load the old-format English strings to prevent unsightly labels in old style popups.
    16471651                echo "<script type='text/javascript' src='{$baseurl}/langs/wp-langs-en.js?$version'></script>\n";
    16481652            }
     
    18291833     */
    18301834    public static function wp_link_dialog() {
    1831         // Run once
     1835        // Run once.
    18321836        if ( self::$link_dialog_printed ) {
    18331837            return;
     
    18361840        self::$link_dialog_printed = true;
    18371841
    1838         // display: none is required here, see #WP27605
     1842        // `display: none` is required here, see #WP27605.
    18391843        ?>
    18401844        <div id="wp-link-backdrop" style="display: none"></div>
Note: See TracChangeset for help on using the changeset viewer.