--- a/wp/wp-includes/class-wp-editor.php Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-includes/class-wp-editor.php Tue Dec 15 13:49:49 2020 +0100
@@ -25,7 +25,6 @@
private static $has_medialib = false;
private static $editor_buttons_css = true;
private static $drag_drop_upload = false;
- private static $old_dfw_compat = false;
private static $translation;
private static $tinymce_scripts_printed = false;
private static $link_dialog_printed = false;
@@ -35,7 +34,10 @@
/**
* Parse default arguments for the editor instance.
*
- * @param string $editor_id ID for the current editor instance.
+ * @since 3.3.0
+ *
+ * @param string $editor_id HTML ID for the textarea and TinyMCE and Quicktags instances.
+ * Should not contain square brackets.
* @param array $settings {
* Array of editor arguments.
*
@@ -56,8 +58,7 @@
* @type string $editor_class Extra classes to add to the editor textarea element. Default empty.
* @type bool $teeny Whether to output the minimal editor config. Examples include
* Press This and the Comment editor. Default false.
- * @type bool $dfw Deprecated in 4.1. Since 4.3 used only to enqueue wp-fullscreen-stub.js
- * for backward compatibility.
+ * @type bool $dfw Deprecated in 4.1. Unused.
* @type bool|array $tinymce Whether to load TinyMCE. Can be used to pass settings directly to
* TinyMCE using an array. Default true.
* @type bool|array $quicktags Whether to load Quicktags. Can be used to pass settings directly to
@@ -75,7 +76,8 @@
* @see _WP_Editors::parse_settings()
*
* @param array $settings Array of editor arguments.
- * @param string $editor_id ID for the current editor instance.
+ * @param string $editor_id Unique editor identifier, e.g. 'content'. Accepts 'classic-block'
+ * when called from block editor's Classic block.
*/
$settings = apply_filters( 'wp_editor_settings', $settings, $editor_id );
@@ -94,7 +96,6 @@
'editor_css' => '',
'editor_class' => '',
'teeny' => false,
- 'dfw' => false,
'_content_editor_dfw' => false,
'tinymce' => true,
'quicktags' => true,
@@ -120,10 +121,6 @@
self::$has_quicktags = true;
}
- if ( $set['dfw'] ) {
- self::$old_dfw_compat = true;
- }
-
if ( empty( $set['editor_height'] ) ) {
return $set;
}
@@ -149,16 +146,20 @@
/**
* Outputs the HTML for a single instance of the editor.
*
- * @param string $content The initial content of the editor.
- * @param string $editor_id ID for the textarea and TinyMCE and Quicktags instances (can contain only ASCII letters and numbers).
- * @param array $settings See _WP_Editors::parse_settings() for description.
+ * @since 3.3.0
+ *
+ * @param string $content Initial content for the editor.
+ * @param string $editor_id HTML ID for the textarea and TinyMCE and Quicktags instances.
+ * Should not contain square brackets.
+ * @param array $settings See _WP_Editors::parse_settings() for description.
*/
public static function editor( $content, $editor_id, $settings = array() ) {
$set = self::parse_settings( $editor_id, $settings );
$editor_class = ' class="' . trim( esc_attr( $set['editor_class'] ) . ' wp-editor-area' ) . '"';
$tabindex = $set['tabindex'] ? ' tabindex="' . (int) $set['tabindex'] . '"' : '';
$default_editor = 'html';
- $buttons = $autocomplete = '';
+ $buttons = '';
+ $autocomplete = '';
$editor_id_attr = esc_attr( $editor_id );
if ( $set['drag_drop_upload'] ) {
@@ -219,7 +220,7 @@
self::$has_medialib = true;
if ( ! function_exists( 'media_buttons' ) ) {
- include( ABSPATH . 'wp-admin/includes/media.php' );
+ require ABSPATH . 'wp-admin/includes/media.php';
}
echo '<div id="wp-' . $editor_id_attr . '-media-buttons" class="wp-media-buttons">';
@@ -242,7 +243,7 @@
$quicktags_toolbar = '';
if ( self::$this_quicktags ) {
- if ( 'content' === $editor_id && ! empty( $GLOBALS['current_screen'] ) && $GLOBALS['current_screen']->base === 'post' ) {
+ if ( 'content' === $editor_id && ! empty( $GLOBALS['current_screen'] ) && 'post' === $GLOBALS['current_screen']->base ) {
$toolbar_id = 'ed_toolbar';
} else {
$toolbar_id = 'qt_' . $editor_id_attr . '_toolbar';
@@ -287,7 +288,7 @@
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' );
@@ -307,14 +308,12 @@
}
/**
- * @global string $tinymce_version
+ * @since 3.3.0
*
- * @param string $editor_id
- * @param array $set
+ * @param string $editor_id Unique editor identifier, e.g. 'content'.
+ * @param array $set Array of editor arguments.
*/
public static function editor_settings( $editor_id, $set ) {
- global $tinymce_version;
-
if ( empty( self::$first_init ) ) {
if ( is_admin() ) {
add_action( 'admin_print_footer_scripts', array( __CLASS__, 'editor_js' ), 50 );
@@ -352,7 +351,7 @@
* @since 3.3.0
*
* @param array $qtInit Quicktags settings.
- * @param string $editor_id The unique editor ID, e.g. 'content'.
+ * @param string $editor_id Unique editor identifier, e.g. 'content'.
*/
$qtInit = apply_filters( 'quicktags_settings', $qtInit, $editor_id );
@@ -374,11 +373,24 @@
* Filters the list of teenyMCE plugins.
*
* @since 2.7.0
+ * @since 3.3.0 The `$editor_id` parameter was added.
*
* @param array $plugins An array of teenyMCE plugins.
* @param string $editor_id Unique editor identifier, e.g. 'content'.
*/
- $plugins = apply_filters( 'teeny_mce_plugins', array( 'colorpicker', 'lists', 'fullscreen', 'image', 'wordpress', 'wpeditimage', 'wplink' ), $editor_id );
+ $plugins = apply_filters(
+ 'teeny_mce_plugins',
+ array(
+ 'colorpicker',
+ 'lists',
+ 'fullscreen',
+ 'image',
+ 'wordpress',
+ 'wpeditimage',
+ 'wplink',
+ ),
+ $editor_id
+ );
} else {
/**
@@ -395,10 +407,13 @@
* one of the 'mce_buttons' filters.
*
* @since 2.5.0
+ * @since 5.3.0 The `$editor_id` parameter was added.
*
- * @param array $external_plugins An array of external TinyMCE plugins.
+ * @param array $external_plugins An array of external TinyMCE plugins.
+ * @param string $editor_id Unique editor identifier, e.g. 'content'. Accepts 'classic-block'
+ * when called from block editor's Classic block.
*/
- $mce_external_plugins = apply_filters( 'mce_external_plugins', array() );
+ $mce_external_plugins = apply_filters( 'mce_external_plugins', array(), $editor_id );
$plugins = array(
'charmap',
@@ -432,12 +447,16 @@
* in WordPress should be added to the TinyMCE instance.
*
* @since 3.3.0
+ * @since 5.3.0 The `$editor_id` parameter was added.
*
- * @param array $plugins An array of default TinyMCE plugins.
+ * @param array $plugins An array of default TinyMCE plugins.
+ * @param string $editor_id Unique editor identifier, e.g. 'content'. Accepts 'classic-block'
+ * when called from block editor's Classic block.
*/
- $plugins = array_unique( apply_filters( 'tiny_mce_plugins', $plugins ) );
+ $plugins = array_unique( apply_filters( 'tiny_mce_plugins', $plugins, $editor_id ) );
- if ( ( $key = array_search( 'spellchecker', $plugins ) ) !== false ) {
+ $key = array_search( 'spellchecker', $plugins, true );
+ if ( false !== $key ) {
// Remove 'spellchecker' from the internal plugins if added with 'tiny_mce_plugins' filter to prevent errors.
// It can be added with 'mce_external_plugins'.
unset( $plugins[ $key ] );
@@ -455,10 +474,12 @@
* and should define a variable ($strings) that holds all translated strings.
*
* @since 2.5.0
+ * @since 5.3.0 The `$editor_id` parameter was added.
*
- * @param array $translations Translations for external TinyMCE plugins.
+ * @param array $translations Translations for external TinyMCE plugins.
+ * @param string $editor_id Unique editor identifier, e.g. 'content'.
*/
- $mce_external_languages = apply_filters( 'mce_external_languages', array() );
+ $mce_external_languages = apply_filters( 'mce_external_languages', array(), $editor_id );
$loaded_langs = array();
$strings = '';
@@ -466,7 +487,7 @@
if ( ! empty( $mce_external_languages ) ) {
foreach ( $mce_external_languages as $name => $path ) {
if ( @is_file( $path ) && @is_readable( $path ) ) {
- include_once( $path );
+ include_once $path;
$ext_plugins .= $strings . "\n";
$loaded_langs[] = $name;
}
@@ -484,14 +505,12 @@
$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/';
- if ( function_exists( 'realpath' ) ) {
- $path = trailingslashit( realpath( $path ) );
- }
+ $path = trailingslashit( realpath( $path ) );
if ( @is_file( $path . $mce_locale . '.js' ) ) {
$strings .= @file_get_contents( $path . $mce_locale . '.js' ) . "\n";
@@ -501,7 +520,7 @@
$strings .= @file_get_contents( $path . $mce_locale . '_dlg.js' ) . "\n";
}
- if ( 'en' != $mce_locale && empty( $strings ) ) {
+ if ( 'en' !== $mce_locale && empty( $strings ) ) {
if ( @is_file( $path . 'en.js' ) ) {
$str1 = @file_get_contents( $path . 'en.js' );
$strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str1, 1 ) . "\n";
@@ -538,18 +557,26 @@
$settings['wpeditimage_disable_captions'] = true;
}
- $mce_css = $settings['content_css'];
- $editor_styles = get_editor_stylesheets();
+ $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.
+ */
+ if ( is_admin() ) {
+ $editor_styles = get_editor_stylesheets();
- if ( ! empty( $editor_styles ) ) {
- // Force urlencoding of commas.
- foreach ( $editor_styles as $key => $url ) {
- if ( strpos( $url, ',' ) !== false ) {
- $editor_styles[ $key ] = str_replace( ',', '%2C', $url );
+ if ( ! empty( $editor_styles ) ) {
+ // Force urlencoding of commas.
+ foreach ( $editor_styles as $key => $url ) {
+ if ( strpos( $url, ',' ) !== false ) {
+ $editor_styles[ $key ] = str_replace( ',', '%2C', $url );
+ }
}
+
+ $mce_css .= ',' . implode( ',', $editor_styles );
}
-
- $mce_css .= ',' . implode( ',', $editor_styles );
}
/**
@@ -571,19 +598,51 @@
}
if ( $set['teeny'] ) {
+ $mce_buttons = array(
+ 'bold',
+ 'italic',
+ 'underline',
+ 'blockquote',
+ 'strikethrough',
+ 'bullist',
+ 'numlist',
+ 'alignleft',
+ 'aligncenter',
+ 'alignright',
+ 'undo',
+ 'redo',
+ 'link',
+ 'fullscreen',
+ );
/**
* Filters the list of teenyMCE buttons (Text tab).
*
* @since 2.7.0
+ * @since 3.3.0 The `$editor_id` parameter was added.
*
- * @param array $buttons An array of teenyMCE buttons.
- * @param string $editor_id Unique editor identifier, e.g. 'content'.
+ * @param array $mce_buttons An array of teenyMCE buttons.
+ * @param string $editor_id Unique editor identifier, e.g. 'content'.
*/
- $mce_buttons = apply_filters( 'teeny_mce_buttons', array( 'bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'undo', 'redo', 'link', 'fullscreen' ), $editor_id );
- $mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = array();
+ $mce_buttons = apply_filters( 'teeny_mce_buttons', $mce_buttons, $editor_id );
+ $mce_buttons_2 = array();
+ $mce_buttons_3 = array();
+ $mce_buttons_4 = array();
} else {
- $mce_buttons = array( 'formatselect', 'bold', 'italic', 'bullist', 'numlist', 'blockquote', 'alignleft', 'aligncenter', 'alignright', 'link', 'wp_more', 'spellchecker' );
+ $mce_buttons = array(
+ 'formatselect',
+ 'bold',
+ 'italic',
+ 'bullist',
+ 'numlist',
+ 'blockquote',
+ 'alignleft',
+ 'aligncenter',
+ 'alignright',
+ 'link',
+ 'wp_more',
+ 'spellchecker',
+ );
if ( ! wp_is_mobile() ) {
if ( $set['_content_editor_dfw'] ) {
@@ -601,13 +660,26 @@
* Filters the first-row list of TinyMCE buttons (Visual tab).
*
* @since 2.0.0
+ * @since 3.3.0 The `$editor_id` parameter was added.
*
- * @param array $buttons First-row list of buttons.
- * @param string $editor_id Unique editor identifier, e.g. 'content'.
+ * @param array $mce_buttons First-row list of buttons.
+ * @param string $editor_id Unique editor identifier, e.g. 'content'. Accepts 'classic-block'
+ * when called from block editor's Classic block.
*/
$mce_buttons = apply_filters( 'mce_buttons', $mce_buttons, $editor_id );
- $mce_buttons_2 = array( 'strikethrough', 'hr', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo' );
+ $mce_buttons_2 = array(
+ 'strikethrough',
+ 'hr',
+ 'forecolor',
+ 'pastetext',
+ 'removeformat',
+ 'charmap',
+ 'outdent',
+ 'indent',
+ 'undo',
+ 'redo',
+ );
if ( ! wp_is_mobile() ) {
$mce_buttons_2[] = 'wp_help';
@@ -617,9 +689,11 @@
* Filters the second-row list of TinyMCE buttons (Visual tab).
*
* @since 2.0.0
+ * @since 3.3.0 The `$editor_id` parameter was added.
*
- * @param array $buttons Second-row list of buttons.
- * @param string $editor_id Unique editor identifier, e.g. 'content'.
+ * @param array $mce_buttons_2 Second-row list of buttons.
+ * @param string $editor_id Unique editor identifier, e.g. 'content'. Accepts 'classic-block'
+ * when called from block editor's Classic block.
*/
$mce_buttons_2 = apply_filters( 'mce_buttons_2', $mce_buttons_2, $editor_id );
@@ -627,9 +701,11 @@
* Filters the third-row list of TinyMCE buttons (Visual tab).
*
* @since 2.0.0
+ * @since 3.3.0 The `$editor_id` parameter was added.
*
- * @param array $buttons Third-row list of buttons.
- * @param string $editor_id Unique editor identifier, e.g. 'content'.
+ * @param array $mce_buttons_3 Third-row list of buttons.
+ * @param string $editor_id Unique editor identifier, e.g. 'content'. Accepts 'classic-block'
+ * when called from block editor's Classic block.
*/
$mce_buttons_3 = apply_filters( 'mce_buttons_3', array(), $editor_id );
@@ -637,16 +713,19 @@
* Filters the fourth-row list of TinyMCE buttons (Visual tab).
*
* @since 2.5.0
+ * @since 3.3.0 The `$editor_id` parameter was added.
*
- * @param array $buttons Fourth-row list of buttons.
- * @param string $editor_id Unique editor identifier, e.g. 'content'.
+ * @param array $mce_buttons_4 Fourth-row list of buttons.
+ * @param string $editor_id Unique editor identifier, e.g. 'content'. Accepts 'classic-block'
+ * when called from block editor's Classic block.
*/
$mce_buttons_4 = apply_filters( 'mce_buttons_4', array(), $editor_id );
}
$body_class = $editor_id;
- if ( $post = get_post() ) {
+ $post = get_post();
+ if ( $post ) {
$body_class .= ' post-type-' . sanitize_html_class( $post->post_type ) . ' post-status-' . sanitize_html_class( $post->post_status );
if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
@@ -660,7 +739,7 @@
$page_template = get_page_template_slug( $post );
- if ( $page_template !== false ) {
+ if ( false !== $page_template ) {
$page_template = empty( $page_template ) ? 'default' : str_replace( '.', '-', basename( $page_template, '.php' ) );
$body_class .= ' page-template-' . sanitize_html_class( $page_template );
}
@@ -685,7 +764,7 @@
'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'] ) ) {
@@ -706,6 +785,7 @@
* Filters the teenyMCE config before init.
*
* @since 2.7.0
+ * @since 3.3.0 The `$editor_id` parameter was added.
*
* @param array $mceInit An array with teenyMCE config.
* @param string $editor_id Unique editor identifier, e.g. 'content'.
@@ -717,9 +797,11 @@
* Filters the TinyMCE config before init.
*
* @since 2.5.0
+ * @since 3.3.0 The `$editor_id` parameter was added.
*
* @param array $mceInit An array with TinyMCE config.
- * @param string $editor_id Unique editor identifier, e.g. 'content'.
+ * @param string $editor_id Unique editor identifier, e.g. 'content'. Accepts 'classic-block'
+ * when called from block editor's Classic block.
*/
$mceInit = apply_filters( 'tiny_mce_before_init', $mceInit, $editor_id );
}
@@ -730,10 +812,12 @@
}
self::$mce_settings[ $editor_id ] = $mceInit;
- } // end if self::$this_tinymce
+ } // End if self::$this_tinymce.
}
/**
+ * @since 3.3.0
+ *
* @param array $init
* @return string
*/
@@ -746,8 +830,8 @@
$options .= $key . ':' . $val . ',';
continue;
} elseif ( ! empty( $value ) && is_string( $value ) && (
- ( '{' == $value{0} && '}' == $value{strlen( $value ) - 1} ) ||
- ( '[' == $value{0} && ']' == $value{strlen( $value ) - 1} ) ||
+ ( '{' === $value[0] && '}' === $value[ strlen( $value ) - 1 ] ) ||
+ ( '[' === $value[0] && ']' === $value[ strlen( $value ) - 1 ] ) ||
preg_match( '/^\(?function ?\(/', $value ) ) ) {
$options .= $key . ':' . $value . ',';
@@ -760,8 +844,7 @@
}
/**
- *
- * @static
+ * @since 3.3.0
*
* @param bool $default_scripts Optional. Whether default scripts should be enqueued. Default false.
*/
@@ -780,10 +863,6 @@
wp_enqueue_script( 'jquery-ui-autocomplete' );
}
- if ( self::$old_dfw_compat ) {
- wp_enqueue_script( 'wp-fullscreen-stub' );
- }
-
if ( self::$has_medialib ) {
add_thickbox();
wp_enqueue_script( 'media-upload' );
@@ -823,7 +902,7 @@
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() ) {
@@ -856,9 +935,11 @@
$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(
@@ -933,15 +1014,29 @@
self::wp_link_dialog();
}
+ /**
+ * Returns the TinyMCE locale.
+ *
+ * @since 4.8.0
+ *
+ * @return string
+ */
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;
}
+ /**
+ * Returns the TinyMCE base URL.
+ *
+ * @since 4.8.0
+ *
+ * @return string
+ */
public static function get_baseurl() {
if ( empty( self::$baseurl ) ) {
self::$baseurl = includes_url( 'js/tinymce' );
@@ -954,6 +1049,8 @@
* Returns the default TinyMCE settings.
* Doesn't include plugins, buttons, editor selector.
*
+ * @since 4.8.0
+ *
* @global string $tinymce_version
*
* @return array
@@ -1001,7 +1098,7 @@
'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,
@@ -1014,17 +1111,22 @@
$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" );
return $settings;
}
+ /**
+ * @since 4.7.0
+ *
+ * @return array
+ */
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' ),
@@ -1036,7 +1138,7 @@
'Heading 5' => array( __( 'Heading 5' ), 'access5' ),
'Heading 6' => array( __( 'Heading 6' ), 'access6' ),
- /* translators: block tags */
+ /* translators: Block tags. */
'Blocks' => _x( 'Blocks', 'TinyMCE' ),
'Paragraph' => array( __( 'Paragraph' ), 'access7' ),
'Blockquote' => array( __( 'Blockquote' ), 'accessQ' ),
@@ -1089,7 +1191,7 @@
'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)' ),
@@ -1097,7 +1199,7 @@
__( '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' ),
@@ -1106,7 +1208,7 @@
'Description' => __( 'Description' ),
'Author' => __( 'Author' ),
- // Media, image plugins
+ // Media, image plugins.
'Image' => __( 'Image' ),
'Insert/edit image' => array( __( 'Insert/edit image' ), 'accessM' ),
'General' => __( 'General' ),
@@ -1132,7 +1234,7 @@
'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' ),
@@ -1150,7 +1252,7 @@
'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' ),
@@ -1164,17 +1266,17 @@
'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' ),
- /* translators: previous */
+ /* translators: Previous. */
'Prev' => _x( 'Prev', 'find/replace' ),
'Whole words' => _x( 'Whole words', 'find/replace' ),
'Find and replace' => __( 'Find and replace' ),
@@ -1188,7 +1290,7 @@
'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' ),
@@ -1249,7 +1351,7 @@
'Show blocks' => _x( 'Show blocks', 'editor button' ),
'Show invisible characters' => __( 'Show invisible characters' ),
- /* translators: word count */
+ /* translators: Word count. */
'Words: {0}' => sprintf( __( 'Words: %s' ), '{0}' ),
'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" .
@@ -1262,7 +1364,7 @@
'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' ),
@@ -1271,23 +1373,23 @@
'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,' ),
@@ -1321,13 +1423,13 @@
'Image options' => __( 'Image options' ),
'Back' => __( 'Back' ),
'Invert' => __( 'Invert' ),
- 'Flip horizontally' => __( 'Flip horizontally' ),
- 'Flip vertically' => __( 'Flip vertically' ),
+ 'Flip horizontally' => __( 'Flip horizontal' ),
+ 'Flip vertically' => __( 'Flip vertical' ),
'Crop' => __( 'Crop' ),
'Orientation' => __( 'Orientation' ),
'Resize' => __( 'Resize' ),
- 'Rotate clockwise' => __( 'Rotate clockwise' ),
- 'Rotate counterclockwise' => __( 'Rotate counterclockwise' ),
+ 'Rotate clockwise' => __( 'Rotate right' ),
+ 'Rotate counterclockwise' => __( 'Rotate left' ),
'Sharpen' => __( 'Sharpen' ),
'Brightness' => __( 'Brightness' ),
'Color levels' => __( 'Color levels' ),
@@ -1344,8 +1446,11 @@
* Translates the default TinyMCE strings and returns them as JSON encoded object ready to be loaded with tinymce.addI18n(),
* or as JS snippet that should run after tinymce.js is loaded.
*
+ * @since 3.9.0
+ *
* @param string $mce_locale The locale used for the editor.
- * @param bool $json_only optional Whether to include the JavaScript calls to tinymce.addI18n() and tinymce.ScriptLoader.markDone().
+ * @param bool $json_only Optional. Whether to include the JavaScript calls to tinymce.addI18n() and
+ * tinymce.ScriptLoader.markDone().
* @return string Translation object, JSON encoded.
*/
public static function wp_mce_translation( $mce_locale = '', $json_only = false ) {
@@ -1383,7 +1488,7 @@
}
}
- // Set direction
+ // Set direction.
if ( is_rtl() ) {
$mce_translation['_dir'] = 'rtl';
}
@@ -1404,6 +1509,8 @@
* The compressed TinyMCE file cannot deal with custom themes, so this makes
* sure that we use the uncompressed TinyMCE file if a theme is defined.
* Even if we are on a production environment.
+ *
+ * @since 5.0.0
*/
public static function force_uncompressed_tinymce() {
$has_custom_theme = false;
@@ -1429,9 +1536,7 @@
*
* @since 4.8.0
*
- * @global string $tinymce_version
- * @global bool $concatenate_scripts
- * @global bool $compress_scripts
+ * @global bool $concatenate_scripts
*/
public static function print_tinymce_scripts() {
global $concatenate_scripts;
@@ -1454,13 +1559,16 @@
/**
* Print (output) the TinyMCE configuration and initialization scripts.
*
+ * @since 3.3.0
+ *
* @global string $tinymce_version
*/
public static function editor_js() {
global $tinymce_version;
$tmce_on = ! empty( self::$mce_settings );
- $mceInit = $qtInit = '';
+ $mceInit = '';
+ $qtInit = '';
if ( $tmce_on ) {
foreach ( self::$mce_settings as $editor_id => $init ) {
@@ -1525,7 +1633,7 @@
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";
}
}
@@ -1620,7 +1728,7 @@
* @since 3.1.0
*
* @param array $args Optional. Accepts 'pagenum' and 's' (search) arguments.
- * @return false|array Results.
+ * @return array|false Results.
*/
public static function wp_link_query( $args = array() ) {
$pts = get_post_types( array( 'public' => true ), 'objects' );
@@ -1663,7 +1771,7 @@
// Build results.
$results = array();
foreach ( $posts as $post ) {
- if ( 'post' == $post->post_type ) {
+ if ( 'post' === $post->post_type ) {
$info = mysql2date( __( 'Y/m/d' ), $post->post_date );
} else {
$info = $pts[ $post->post_type ]->labels->singular_name;
@@ -1687,9 +1795,9 @@
* @see 'wp_link_query_args' filter
*
* @param array $results {
- * An associative array of query results.
+ * An array of associative arrays of query results.
*
- * @type array {
+ * @type array ...$0 {
* @type int $ID Post ID.
* @type string $title The trimmed, escaped post title.
* @type string $permalink Post permalink.
@@ -1710,14 +1818,14 @@
* @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">
@@ -1765,8 +1873,8 @@
<div class="river-waiting">
<span class="spinner"></span>
</div>
- </div>
- </div>
+ </div>
+ </div>
</div>
<div class="submitbox">
<div id="wp-link-cancel">