Make WordPress Core

Changeset 41990


Ignore:
Timestamp:
10/24/2017 01:24:43 PM (9 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

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

    r41983 r41990  
    50785078        if ( empty( $protocols ) ) {
    50795079                $protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp', 'webcal', 'urn' );
    5080 
     5080        }
     5081
     5082        if ( ! did_action( 'wp_loaded' ) ) {
    50815083                /**
    50825084                 * Filters the list of protocols allowed in HTML attributes.
     
    50865088                 * @param array $protocols Array of allowed protocols e.g. 'http', 'ftp', 'tel', and more.
    50875089                 */
    5088                 $protocols = apply_filters( 'kses_allowed_protocols', $protocols );
     5090                $protocols = array_unique( (array) apply_filters( 'kses_allowed_protocols', $protocols ) );
    50895091        }
    50905092
Note: See TracChangeset for help on using the changeset viewer.