bbp_encode_bad( string $content = '' )
Filter the content and encode any bad HTML tags
Description Description
Parameters Parameters
- $content
-
(Optional) Topic and reply content
Default value: ''
Return Return
(string) Partially encoded content
Source Source
File: includes/common/formatting.php
function bbp_encode_bad( $content = '' ) { // Setup variables $content = _wp_specialchars( $content, ENT_NOQUOTES ); $content = preg_split( '@(`[^`]*`)@m', $content, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE ); $allowed = bbp_kses_allowed_tags(); $empty = array( 'br' => true, 'hr' => true, 'img' => true, 'input' => true, 'param' => true, 'area' => true, 'col' => true, 'embed' => true ); // Loop through allowed tags and compare for empty and normal tags foreach ( $allowed as $tag => $args ) { $preg = $args ? "{$tag}(?:\s.*?)?" : $tag; // Which walker to use based on the tag and arguments if ( isset( $empty[ $tag ] ) ) { array_walk( $content, 'bbp_encode_empty_callback', $preg ); } else { array_walk( $content, 'bbp_encode_normal_callback', $preg ); } } // Return the joined content array return implode( '', $content ); }
Changelog Changelog
Version | Description |
---|---|
2.3.0 | Introduced. |