[Bb-trac] Re: [bbPress] #795: posts re-saved with non-ending html
tags are improperly handled (has fix)
bbPress
bb-trac at lists.bbpress.org
Thu Feb 28 19:47:36 GMT 2008
#795: posts re-saved with non-ending html tags are improperly handled (has fix)
-----------------------+----------------------------------------------------
Reporter: _ck_ | Owner: mdawaffe
Type: defect | Status: assigned
Priority: high | Milestone: 0.8.4
Component: Back-end | Version: 0.8.3.1
Severity: normal | Resolution:
Keywords: has-patch |
-----------------------+----------------------------------------------------
Changes (by mdawaffe):
* keywords: => has-patch
* owner: => mdawaffe
* version: => 0.8.3.1
* status: new => assigned
* severity: major => normal
Comment:
That converts all image tags to {{{<img />}}} (stripping the src, alt,
etc.).
How does this look to you?
{{{
function bb_encode_bad( $text ) {
$text = wp_specialchars( $text );
$allowed = bb_allowed_tags();
$empty = array( 'br' => true, 'hr' => true, 'img' => true, 'input'
=> true, 'param' => true, 'area' => true, 'col' => true );
foreach ( $allowed as $tag => $args ) {
if ( $args )
$tag = "$tag.*?";
if ( isset( $empty[$tag] ) ) {
$text = preg_replace("|<($tag)\s*?/*?>|",
'<$1 />', $text);
continue;
}
$text = preg_replace("|<(/?$tag)>|", '<$1>', $text);
}
return $text;
}
}}}
--
Ticket URL: <http://trac.bbpress.org/ticket/795#comment:2>
bbPress <http://bbpress.org/>
Innovative forum development
More information about the Bb-trac
mailing list