. */ function SampleTags($tags) { $tags['img'] = array('src' => array('/(jpg|jpeg|gif|png)$/i'), 'title' => array(), 'alt' => array(), 'class' => array('/^(left|right)$/')); $tags['object'] = array('width' => array(), 'height' => array(), // 'style' => array(), 'class' => array('/^(left|right)$/')); $tags['param'] = array('name' => array(), 'value' => array()); $tags['embed'] = array('src' => array('/^http:\/\/www.youtube.com\/v\/.*/', '/^http:\/\/video.google.com\/googleplayer.swf\?.*/'), // 'style' => array(), 'type' => array('/application\/x-shockwave-flash/'), 'id' => array(), 'flashvars' => array(), 'wmode' => array(), 'width' => array(), 'height' => array()); return $tags; } function FixObjectTag($text) { return preg_replace('/(

)
\\n/', '$1', $text); } function ValidateHTMLTagAttributes($text) { foreach (bb_allowed_tags() as $tag => $args) { if ('br' == $tag) continue; if ($args) foreach ($args as $arg => $limits) if ($limits) { // If set, then need to match one if (preg_match_all('/<(' . $tag . '.+?)' . $arg . '=("|\')(.+?)\\2(.*?)>/i', $text, $matches, PREG_SET_ORDER)) foreach($matches as $match) { $i = 0; while ($i < count($limits)) { if (preg_match($limits[$i], $match[3]) > 0) break; $i++; } // Not found, then remove this attribute if ($i == count($limits)) $text = str_replace($match[0], "<$match[1]$match[4]>", $text); } } } return $text; } add_filter('pre_post', 'ValidateHTMLTagAttributes', 51); add_filter('pre_post', 'FixObjectTag', 61); add_filter('bb_allowed_tags', 'SampleTags'); ?>