WordPress.org

Make WordPress Core

Ticket #16059: 16059.3.patch

File 16059.3.patch, 2.7 KB (added by hakre, 3 years ago)

Phpdocs moved.

  • wp-includes/kses.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress
     
    551551 * @return string Content with fixed HTML tags 
    552552 */ 
    553553function wp_kses_split($string, $allowed_html, $allowed_protocols) { 
    554         global $pass_allowed_html, $pass_allowed_protocols; 
    555         $pass_allowed_html = $allowed_html; 
    556         $pass_allowed_protocols = $allowed_protocols; 
     554        $GLOBALS['pass_allowed'] = array( $allowed_html, $allowed_protocols ); 
    557555        return preg_replace_callback( '%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%', '_wp_kses_split_callback', $string ); 
    558556} 
    559557 
    560558/** 
    561  * Callback for wp_kses_split. 
    562  * 
    563  * @since 3.1.0 
    564  * @access private 
    565  */ 
    566 function _wp_kses_split_callback( $match ) { 
    567         global $pass_allowed_html, $pass_allowed_protocols; 
    568         return wp_kses_split2( $match[1], $pass_allowed_html, $pass_allowed_protocols ); 
    569 } 
    570  
    571 /** 
    572559 * Callback for wp_kses_split for fixing malformed HTML tags. 
    573560 * 
    574561 * This function does a lot of work. It rejects some very malformed things like 
     
    580567 * through another filter which will remove illegal attributes and once that is 
    581568 * completed, will be returned. 
    582569 * 
     570 * @since 3.1.0 
    583571 * @access private 
    584  * @since 1.0.0 
    585572 * @uses wp_kses_attr() 
    586  * 
    587  * @param string $string Content to filter 
    588  * @param array $allowed_html Allowed HTML elements 
    589  * @param array $allowed_protocols Allowed protocols to keep 
     573 * @param array $match matches as of preg_match_callback() 
    590574 * @return string Fixed HTML element 
    591575 */ 
    592 function wp_kses_split2($string, $allowed_html, $allowed_protocols) { 
    593         $string = wp_kses_stripslashes($string); 
     576function _wp_kses_split_callback( $match ) { 
     577        list( $allowed_html, $allowed_protocols ) = $GLOBALS['pass_allowed']; 
     578        $string = wp_kses_stripslashes( $match[1] ); 
    594579 
    595580        if (substr($string, 0, 1) != '<') 
    596581                return '&gt;'; 
     
    630615} 
    631616 
    632617/** 
     618 * deprecated function 
     619 *  
     620 * @see _wp_kses_split_callback() 
     621 *  
     622 * @access private 
     623 * @since 1.0.0 
     624 * 
     625 * @param string $string Content to filter 
     626 * @param array $allowed_html Allowed HTML elements 
     627 * @param array $allowed_protocols Allowed protocols to keep 
     628 * @return string Fixed HTML element 
     629 */ 
     630function wp_kses_split2($string, $allowed_html, $allowed_protocols) { 
     631        $GLOBALS['pass_allowed'] = array( $allowed_html, $allowed_protocols ); 
     632        $match = array( 1 => $string); 
     633        _deprecated_function( 'wp_kses_split2', '3.0' ); 
     634        return _wp_kses_split_callback( $match ); 
     635} 
     636 
     637/** 
    633638 * Removes all attributes, if none are allowed for this element. 
    634639 * 
    635640 * If some are allowed it calls wp_kses_hair() to split them further, and then