Editor: Use apply_filters_deprecated() for some deprecated filters.

The `htmledit_pre` and `richedit_pre` filters have been deprecated since 4.3.0, since before `apply_filters_deprecated()` existed. They're now correctly run using `apply_filters_deprecated()`.

Props sebastienthivinfocom, lbenicio, ianbelanger.
Fixes #44341.



git-svn-id: https://develop.svn.wordpress.org/trunk@43464 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast 2018-07-17 07:37:29 +00:00
parent 98fd60fc67
commit 93af027510

View File

@ -286,12 +286,11 @@ final class _WP_Editors {
// 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' ) ) { if ( 'html' === $default_editor && has_filter( 'htmledit_pre' ) ) {
// TODO: needs _deprecated_filter(), use _deprecated_function() as substitute for now /** This filter is documented in wp-includes/deprecated.php */
_deprecated_function( 'add_filter( htmledit_pre )', '4.3.0', 'add_filter( format_for_editor )' ); $content = apply_filters_deprecated( 'htmledit_pre', array( $content ), '4.3.0', 'format_for_editor' );
$content = apply_filters( 'htmledit_pre', $content );
} elseif ( 'tinymce' === $default_editor && has_filter( 'richedit_pre' ) ) { } elseif ( 'tinymce' === $default_editor && has_filter( 'richedit_pre' ) ) {
_deprecated_function( 'add_filter( richedit_pre )', '4.3.0', 'add_filter( format_for_editor )' ); /** This filter is documented in wp-includes/deprecated.php */
$content = apply_filters( 'richedit_pre', $content ); $content = apply_filters_deprecated( 'richedit_pre', array( $content ), '4.3.0', 'format_for_editor' );
} }
if ( false !== stripos( $content, 'textarea' ) ) { if ( false !== stripos( $content, 'textarea' ) ) {