Formatting: Make sure `wp_allowed_protocols()` is filterable until `wp_loaded` has fired.

Fixes the issue with plugins not being able to use the `kses_allowed_protocols` filter if `esc_url()` was called too early.

Props turtlepod, SergeyBiryukov.
Fixes #36033.
Built from https://develop.svn.wordpress.org/trunk@41990


git-svn-id: http://core.svn.wordpress.org/trunk@41824 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2017-10-24 13:25:55 +00:00
parent 2623caf8b0
commit bcdedf7f4a
2 changed files with 4 additions and 2 deletions

View File

@ -5077,7 +5077,9 @@ function wp_allowed_protocols() {
if ( empty( $protocols ) ) { if ( empty( $protocols ) ) {
$protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp', 'webcal', 'urn' ); $protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp', 'webcal', 'urn' );
}
if ( ! did_action( 'wp_loaded' ) ) {
/** /**
* Filters the list of protocols allowed in HTML attributes. * Filters the list of protocols allowed in HTML attributes.
* *
@ -5085,7 +5087,7 @@ function wp_allowed_protocols() {
* *
* @param array $protocols Array of allowed protocols e.g. 'http', 'ftp', 'tel', and more. * @param array $protocols Array of allowed protocols e.g. 'http', 'ftp', 'tel', and more.
*/ */
$protocols = apply_filters( 'kses_allowed_protocols', $protocols ); $protocols = array_unique( (array) apply_filters( 'kses_allowed_protocols', $protocols ) );
} }
return $protocols; return $protocols;

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.9-beta3-41989'; $wp_version = '4.9-beta3-41990';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.