]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?#s'; $pre_replace = '\1'; return preg_replace($pre_regex, $pre_replace, $html); } /** * @param string $html * @param HTMLPurifier_Config $config * @param HTMLPurifier_Context $context * @return string */ public function postFilter($html, $config, $context) { $post_regex = '#((?:v|cp)/[A-Za-z0-9\-_=]+)#'; return preg_replace_callback($post_regex, array($this, 'postFilterCallback'), $html); } /** * @param $url * @return string */ protected function armorUrl($url) { return str_replace('--', '--', $url); } /** * @param array $matches * @return string */ protected function postFilterCallback($matches) { $url = $this->armorUrl($matches[1]); return '' . '' . '' . ''; } } // vim: et sw=4 sts=4