equal
deleted
inserted
replaced
33 * @return mixed Sanitized data. |
33 * @return mixed Sanitized data. |
34 */ |
34 */ |
35 public function sanitize( $data, $type, $base = '' ) { |
35 public function sanitize( $data, $type, $base = '' ) { |
36 $data = trim( $data ); |
36 $data = trim( $data ); |
37 if ( $type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML ) { |
37 if ( $type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML ) { |
38 if (preg_match('/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>)/', $data)) { |
38 if ( preg_match( '/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>)/', $data ) ) { |
39 $type |= SIMPLEPIE_CONSTRUCT_HTML; |
39 $type |= SIMPLEPIE_CONSTRUCT_HTML; |
40 } |
40 } else { |
41 else { |
|
42 $type |= SIMPLEPIE_CONSTRUCT_TEXT; |
41 $type |= SIMPLEPIE_CONSTRUCT_TEXT; |
43 } |
42 } |
44 } |
43 } |
45 if ( $type & SIMPLEPIE_CONSTRUCT_BASE64 ) { |
44 if ( $type & SIMPLEPIE_CONSTRUCT_BASE64 ) { |
46 $data = base64_decode( $data ); |
45 $data = base64_decode( $data ); |