Make WordPress Core

Changeset 11828


Ignore:
Timestamp:
08/16/2009 05:58:39 AM (15 years ago)
Author:
azaozz
Message:

Do not use lambda functions in wp_kses_decode_entities(), props mdawaffe, fixes #10623

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/kses.php

    r11699 r11828  
    10281028 */
    10291029function wp_kses_decode_entities($string) {
    1030     $string = preg_replace_callback('/&#([0-9]+);/', create_function('$match', 'return chr($match[1]);'), $string);
    1031     $string = preg_replace_callback('/&#[Xx]([0-9A-Fa-f]+);/', create_function('$match', 'return chr(hexdec($match[1]));'), $string);
     1030    $string = preg_replace_callback('/&#([0-9]+);/', '_wp_kses_decode_entities_chr', $string);
     1031    $string = preg_replace_callback('/&#[Xx]([0-9A-Fa-f]+);/', '_wp_kses_decode_entities_chr_hexdec', $string);
    10321032
    10331033    return $string;
     1034}
     1035
     1036/**
     1037 * Regex callback for wp_kses_decode_entities()
     1038 *
     1039 * @param array $match preg match
     1040 * @return string
     1041 */
     1042function _wp_kses_decode_entities_chr( $match ) {
     1043    return chr( $match[1] );
     1044}
     1045
     1046/**
     1047 * Regex callback for wp_kses_decode_entities()
     1048 *
     1049 * @param array $match preg match
     1050 * @return string
     1051 */
     1052function _wp_kses_decode_entities_chr_hexdec( $match ) {
     1053    return chr( hexdec( $match[1] ) );
    10341054}
    10351055
Note: See TracChangeset for help on using the changeset viewer.