~canonical-sysadmins/wordpress/4.7.2

« back to all changes in this revision

Viewing changes to wp-includes/kses.php

  • Committer: Haw Loeung
  • Date: 2016-12-13 06:56:21 UTC
  • mfrom: (1.1.20 upstream)
  • Revision ID: haw.loeung@canonical.com-20161213065621-8tcu7u7vlxgs2s81
Merge WP4.7 from upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
527
527
        if ( empty( $allowed_protocols ) )
528
528
                $allowed_protocols = wp_allowed_protocols();
529
529
        $string = wp_kses_no_null( $string, array( 'slash_zero' => 'keep' ) );
530
 
        $string = wp_kses_js_entities($string);
531
530
        $string = wp_kses_normalize_entities($string);
532
531
        $string = wp_kses_hook($string, $allowed_html, $allowed_protocols); // WP changed the order of these funcs and added args to wp_kses_hook
533
532
        return wp_kses_split($string, $allowed_html, $allowed_protocols);
550
549
        $allowed_html = wp_kses_allowed_html( 'post' );
551
550
        $allowed_protocols = wp_allowed_protocols();
552
551
        $string = wp_kses_no_null( $string, array( 'slash_zero' => 'keep' ) );
553
 
        $string = wp_kses_js_entities( $string );
554
552
        
555
553
        // Preserve leading and trailing whitespace.
556
554
        $matches = array();
781
779
        }
782
780
        // Allow HTML comments
783
781
 
784
 
        if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches))
 
782
        if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9-]+)([^>]*)>?$%', $string, $matches))
785
783
                return '';
786
784
        // It's seriously malformed
787
785
 
1296
1294
}
1297
1295
 
1298
1296
/**
1299
 
 * Removes the HTML JavaScript entities found in early versions of Netscape 4.
1300
 
 *
1301
 
 * @since 1.0.0
1302
 
 *
1303
 
 * @param string $string
1304
 
 * @return string
1305
 
 */
1306
 
function wp_kses_js_entities($string) {
1307
 
        return preg_replace('%&\s*\{[^}]*(\}\s*;?|$)%', '', $string);
1308
 
}
1309
 
 
1310
 
/**
1311
1297
 * Handles parsing errors in wp_kses_hair().
1312
1298
 *
1313
1299
 * The general plan is to remove everything to and including some whitespace,