Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@47122 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-01-29 00:43:23 +00:00
parent bd2cd572aa
commit cfc3b57488
810 changed files with 9893 additions and 8384 deletions
+44 -40
View File
@@ -293,7 +293,7 @@ final class _WP_Editors {
remove_filter( 'the_editor_content', 'format_for_editor' );
}
// Back-compat for the `htmledit_pre` and `richedit_pre` filters
// Back-compat for the `htmledit_pre` and `richedit_pre` filters.
if ( 'html' === $default_editor && has_filter( 'htmledit_pre' ) ) {
/** This filter is documented in wp-includes/deprecated.php */
$content = apply_filters_deprecated( 'htmledit_pre', array( $content ), '4.3.0', 'format_for_editor' );
@@ -514,7 +514,7 @@ final class _WP_Editors {
$plugurl = dirname( $url );
$strings = '';
// Try to load langs/[locale].js and langs/[locale]_dlg.js
// Try to load langs/[locale].js and langs/[locale]_dlg.js.
if ( ! in_array( $name, $loaded_langs, true ) ) {
$path = str_replace( content_url(), '', $plugurl );
$path = WP_CONTENT_DIR . $path . '/langs/';
@@ -568,9 +568,11 @@ final class _WP_Editors {
$mce_css = $settings['content_css'];
// The `editor-style.css` added by the theme is generally intended for the editor instance on the Edit Post screen.
// Plugins that use wp_editor() on the front-end can decide whether to add the theme stylesheet
// by using `get_editor_stylesheets()` and the `mce_css` or `tiny_mce_before_init` filters, see below.
/*
* The `editor-style.css` added by the theme is generally intended for the editor instance on the Edit Post screen.
* Plugins that use wp_editor() on the front-end can decide whether to add the theme stylesheet
* by using `get_editor_stylesheets()` and the `mce_css` or `tiny_mce_before_init` filters, see below.
*/
if ( is_admin() ) {
$editor_styles = get_editor_stylesheets();
@@ -771,7 +773,7 @@ final class _WP_Editors {
'body_class' => $body_class,
);
// Merge with the first part of the init array
// Merge with the first part of the init array.
$mceInit = array_merge( self::$first_init, $mceInit );
if ( is_array( $set['tinymce'] ) ) {
@@ -819,7 +821,7 @@ final class _WP_Editors {
}
self::$mce_settings[ $editor_id ] = $mceInit;
} // end if self::$this_tinymce
} // End if self::$this_tinymce.
}
/**
@@ -913,7 +915,7 @@ final class _WP_Editors {
self::enqueue_scripts( true );
// Also add wp-includes/css/editor.css
// Also add wp-includes/css/editor.css.
wp_enqueue_style( 'editor-buttons' );
if ( is_admin() ) {
@@ -946,9 +948,11 @@ final class _WP_Editors {
$settings['directionality'] = 'rtl';
}
// In production all plugins are loaded (they are in wp-editor.js.gz).
// The 'wpview', 'wpdialogs', and 'media' TinyMCE plugins are not initialized by default.
// Can be added from js by using the 'wp-before-tinymce-init' event.
/*
* In production all plugins are loaded (they are in wp-editor.js.gz).
* The 'wpview', 'wpdialogs', and 'media' TinyMCE plugins are not initialized by default.
* Can be added from js by using the 'wp-before-tinymce-init' event.
*/
$settings['plugins'] = implode(
',',
array(
@@ -1033,7 +1037,7 @@ final class _WP_Editors {
public static function get_mce_locale() {
if ( empty( self::$mce_locale ) ) {
$mce_locale = get_user_locale();
self::$mce_locale = empty( $mce_locale ) ? 'en' : strtolower( substr( $mce_locale, 0, 2 ) ); // ISO 639-1
self::$mce_locale = empty( $mce_locale ) ? 'en' : strtolower( substr( $mce_locale, 0, 2 ) ); // ISO 639-1.
}
return self::$mce_locale;
@@ -1107,7 +1111,7 @@ final class _WP_Editors {
'menubar' => false,
'branding' => false,
// Limit the preview styles in the menu/toolbar
// Limit the preview styles in the menu/toolbar.
'preview_styles' => 'font-family font-size font-weight font-style text-decoration text-transform',
'end_container_on_empty_block' => true,
@@ -1120,7 +1124,7 @@ final class _WP_Editors {
$suffix = SCRIPT_DEBUG ? '' : '.min';
$version = 'ver=' . get_bloginfo( 'version' );
// Default stylesheets
// Default stylesheets.
$settings['content_css'] = includes_url( "css/dashicons$suffix.css?$version" ) . ',' .
includes_url( "js/tinymce/skins/wordpress/wp-content.css?$version" );
@@ -1135,7 +1139,7 @@ final class _WP_Editors {
private static function get_translation() {
if ( empty( self::$translation ) ) {
self::$translation = array(
// Default TinyMCE strings
// Default TinyMCE strings.
'New document' => __( 'New document' ),
'Formats' => _x( 'Formats', 'TinyMCE' ),
@@ -1200,7 +1204,7 @@ final class _WP_Editors {
'Upper Roman' => _x( 'Upper Roman', 'list style' ),
'Lower Roman' => _x( 'Lower Roman', 'list style' ),
// Anchor plugin
// Anchor plugin.
'Name' => _x( 'Name', 'Name of link anchor (TinyMCE)' ),
'Anchor' => _x( 'Anchor', 'Link anchor (TinyMCE)' ),
'Anchors' => _x( 'Anchors', 'Link anchors (TinyMCE)' ),
@@ -1208,7 +1212,7 @@ final class _WP_Editors {
__( 'Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.' ),
'Id' => _x( 'Id', 'Id for link anchor (TinyMCE)' ),
// Fullpage plugin
// Fullpage plugin.
'Document properties' => __( 'Document properties' ),
'Robots' => __( 'Robots' ),
'Title' => __( 'Title' ),
@@ -1217,7 +1221,7 @@ final class _WP_Editors {
'Description' => __( 'Description' ),
'Author' => __( 'Author' ),
// Media, image plugins
// Media, image plugins.
'Image' => __( 'Image' ),
'Insert/edit image' => array( __( 'Insert/edit image' ), 'accessM' ),
'General' => __( 'General' ),
@@ -1243,7 +1247,7 @@ final class _WP_Editors {
'Insert video' => __( 'Insert video' ),
'Embed' => __( 'Embed' ),
// Each of these have a corresponding plugin
// Each of these have a corresponding plugin.
'Special character' => __( 'Special character' ),
'Right to left' => _x( 'Right to left', 'editor button' ),
'Left to right' => _x( 'Left to right', 'editor button' ),
@@ -1261,7 +1265,7 @@ final class _WP_Editors {
'Insert/edit link' => array( __( 'Insert/edit link' ), 'metaK' ),
'Remove link' => array( __( 'Remove link' ), 'accessS' ),
// Link plugin
// Link plugin.
'Link' => __( 'Link' ),
'Insert link' => __( 'Insert link' ),
'Target' => __( 'Target' ),
@@ -1275,13 +1279,13 @@ final class _WP_Editors {
'Color' => __( 'Color' ),
'Custom color' => __( 'Custom color' ),
'Custom...' => _x( 'Custom...', 'label for custom color' ), // no ellipsis
'Custom...' => _x( 'Custom...', 'label for custom color' ), // No ellipsis.
'No color' => __( 'No color' ),
'R' => _x( 'R', 'Short for red in RGB' ),
'G' => _x( 'G', 'Short for green in RGB' ),
'B' => _x( 'B', 'Short for blue in RGB' ),
// Spelling, search/replace plugins
// Spelling, search/replace plugins.
'Could not find the specified string.' => __( 'Could not find the specified string.' ),
'Replace' => _x( 'Replace', 'find/replace' ),
'Next' => _x( 'Next', 'find/replace' ),
@@ -1299,7 +1303,7 @@ final class _WP_Editors {
'Ignore' => _x( 'Ignore', 'spellcheck' ),
'Add to Dictionary' => __( 'Add to Dictionary' ),
// TinyMCE tables
// TinyMCE tables.
'Insert table' => __( 'Insert table' ),
'Delete table' => __( 'Delete table' ),
'Table properties' => __( 'Table properties' ),
@@ -1373,7 +1377,7 @@ final class _WP_Editors {
'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.' ),
// TinyMCE menus
// TinyMCE menus.
'Insert' => _x( 'Insert', 'TinyMCE menu' ),
'File' => _x( 'File', 'TinyMCE menu' ),
'Edit' => _x( 'Edit', 'TinyMCE menu' ),
@@ -1382,23 +1386,23 @@ final class _WP_Editors {
'Table' => _x( 'Table', 'TinyMCE menu' ),
'Format' => _x( 'Format', 'TinyMCE menu' ),
// WordPress strings
// WordPress strings.
'Toolbar Toggle' => array( __( 'Toolbar Toggle' ), 'accessZ' ),
'Insert Read More tag' => array( __( 'Insert Read More tag' ), 'accessT' ),
'Insert Page Break tag' => array( __( 'Insert Page Break tag' ), 'accessP' ),
'Read more...' => __( 'Read more...' ), // Title on the placeholder inside the editor (no ellipsis)
'Read more...' => __( 'Read more...' ), // Title on the placeholder inside the editor (no ellipsis).
'Distraction-free writing mode' => array( __( 'Distraction-free writing mode' ), 'accessW' ),
'No alignment' => __( 'No alignment' ), // Tooltip for the 'alignnone' button in the image toolbar
'Remove' => __( 'Remove' ), // Tooltip for the 'remove' button in the image toolbar
'Edit|button' => __( 'Edit' ), // Tooltip for the 'edit' button in the image toolbar
'Paste URL or type to search' => __( 'Paste URL or type to search' ), // Placeholder for the inline link dialog
'Apply' => __( 'Apply' ), // Tooltip for the 'apply' button in the inline link dialog
'Link options' => __( 'Link options' ), // Tooltip for the 'link options' button in the inline link dialog
'Visual' => _x( 'Visual', 'Name for the Visual editor tab' ), // Editor switch tab label
'Text' => _x( 'Text', 'Name for the Text editor tab (formerly HTML)' ), // Editor switch tab label
'Add Media' => array( __( 'Add Media' ), 'accessM' ), // Tooltip for the 'Add Media' button in the block editor Classic block
'No alignment' => __( 'No alignment' ), // Tooltip for the 'alignnone' button in the image toolbar.
'Remove' => __( 'Remove' ), // Tooltip for the 'remove' button in the image toolbar.
'Edit|button' => __( 'Edit' ), // Tooltip for the 'edit' button in the image toolbar.
'Paste URL or type to search' => __( 'Paste URL or type to search' ), // Placeholder for the inline link dialog.
'Apply' => __( 'Apply' ), // Tooltip for the 'apply' button in the inline link dialog.
'Link options' => __( 'Link options' ), // Tooltip for the 'link options' button in the inline link dialog.
'Visual' => _x( 'Visual', 'Name for the Visual editor tab' ), // Editor switch tab label.
'Text' => _x( 'Text', 'Name for the Text editor tab (formerly HTML)' ), // Editor switch tab label.
'Add Media' => array( __( 'Add Media' ), 'accessM' ), // Tooltip for the 'Add Media' button in the block editor Classic block.
// Shortcuts help modal
// Shortcuts help modal.
'Keyboard Shortcuts' => array( __( 'Keyboard Shortcuts' ), 'accessH' ),
'Classic Block Keyboard Shortcuts' => __( 'Classic Block Keyboard Shortcuts' ),
'Default shortcuts,' => __( 'Default shortcuts,' ),
@@ -1496,7 +1500,7 @@ final class _WP_Editors {
}
}
// Set direction
// Set direction.
if ( is_rtl() ) {
$mce_translation['_dir'] = 'rtl';
}
@@ -1643,7 +1647,7 @@ final class _WP_Editors {
self::print_tinymce_scripts();
if ( self::$ext_plugins ) {
// Load the old-format English strings to prevent unsightly labels in old style popups
// Load the old-format English strings to prevent unsightly labels in old style popups.
echo "<script type='text/javascript' src='{$baseurl}/langs/wp-langs-en.js?$version'></script>\n";
}
}
@@ -1828,14 +1832,14 @@ final class _WP_Editors {
* @since 3.1.0
*/
public static function wp_link_dialog() {
// Run once
// Run once.
if ( self::$link_dialog_printed ) {
return;
}
self::$link_dialog_printed = true;
// display: none is required here, see #WP27605
// `display: none` is required here, see #WP27605.
?>
<div id="wp-link-backdrop" style="display: none"></div>
<div id="wp-link-wrap" class="wp-core-ui" style="display: none" role="dialog" aria-labelledby="link-modal-title">