Make WordPress Core

Ticket #21990: 21990-subclass.diff

File 21990-subclass.diff, 1.3 KB (added by markjaquith, 11 years ago)

First attempt at subclassing SimplePie_Sanitize

  • new file wp-includes/class-simplepie-kses.php

    diff --git a/wp-includes/class-simplepie-kses.php b/wp-includes/class-simplepie-kses.php
    new file mode 100644
    index 0000000..6a892ab
    - +  
     1<?php
     2
     3class WP_SimplePie_Sanitize_KSES extends SimplePie_Sanitize {
     4        public function sanitize( $data, $type, $base = '' ) {
     5                if ( $type & ( SIMPLEPIE_CONSTRUCT_HTML | SIMPLEPIE_CONSTRUCT_XHTML ) ) {
     6                        return wp_kses_post( $data );
     7                } else {
     8                        return parent::sanitize( $data, $type, $base );
     9                }
     10        }
     11}
  • wp-includes/class-simplepie.php

    diff --git a/wp-includes/class-simplepie.php b/wp-includes/class-simplepie.php
    index ba6f28d..666dd51 100644
    a b require ABSPATH . WPINC . '/SimplePie/Parser.php'; 
    1515require ABSPATH . WPINC . '/SimplePie/Item.php';
    1616require ABSPATH . WPINC . '/SimplePie/Parse/Date.php';
    1717require ABSPATH . WPINC . '/SimplePie/Author.php';
     18require ABSPATH . WPINC . '/class-simplepie-kses.php';
    1819
    1920/**
    2021 * WordPress autoloader for SimplePie.
    class SimplePie 
    691692                }
    692693
    693694                // Other objects, instances created here so we can set options on them
    694                 $this->sanitize = new SimplePie_Sanitize();
     695                $this->sanitize = new WP_SimplePie_Sanitize_KSES();
    695696                $this->registry = new SimplePie_Registry();
    696697
    697698                if (func_num_args() > 0)