array('href'),
'img' => array('src'),
'link' => array('href'),
'script' => array('src'),
'embed' => array('src'),
'frame' => array('src'),
);
var $_tag_list_link = array(
'a' => array('href'),
'area' => array('href'),
);
var $_tag_list_form = array(
'form' => array('action'),
);
var $_tag_list_frame = array(
'frame' => array('src'),
'iframe' => array('src'),
);
function process_attr(&$list, $tag_name, $attr, $reverse)
{
if($reverse){
$to = $this->_options['FILTER_HTTPS_FROM'];
$from = $this->_options['FILTER_HTTPS_TO'];
} else {
$from = $this->_options['FILTER_HTTPS_FROM'];
$to = $this->_options['FILTER_HTTPS_TO'];
}
if($from && $to){
$tag_name = strtolower($tag_name);
$attr_list = $list[$tag_name];
if($attr_list){
foreach($attr as $name => $value){
if(in_array(strtolower($name), $attr_list) && $value !== NULL){
if($reverse && strpos($value, $to) === false && !preg_match('/^\w+\:\/\//', $value))
$value = $to . (substr($to, -1) == '/'? '': '/') . $value;
$attr[$name] = str_replace($from, $to, $value);
}
}
}
}
return $attr;
}
function doOpenTag(&$Parser, $TagName, $Attr, $Empty)
{
$Attr = $this->process_attr($this->_tag_list, $TagName, $Attr, false);
$Attr = $this->process_attr($this->_tag_list_link, $TagName, $Attr, !((bool)$this->_options['FILTER_HTTPS_LINK']));
$Attr = $this->process_attr($this->_tag_list_form, $TagName, $Attr, !((bool)$this->_options['FILTER_HTTPS_FORM']));
$Attr = $this->process_attr($this->_tag_list_frame, $TagName, $Attr, !((bool)$this->_options['FILTER_HTTPS_FRAME']));
parent::doOpenTag($Parser, $TagName, $Attr, $Empty);
}
}
?>