mangle @ in blockquote cite attribute

This commit is contained in:
Klaus Leithoff 2012-06-13 11:11:29 +00:00
parent 3bd50e3e99
commit 78d4c235c5

View File

@ -114,6 +114,7 @@ class egw_htmLawed
* function to provide individual checks for element attribute pairs * function to provide individual checks for element attribute pairs
* implemented so far: img checking for alt attribute == image; set this to empty * implemented so far: img checking for alt attribute == image; set this to empty
* a checking for title, replacing @ * a checking for title, replacing @
* blockquote checking for cite, replacing @
*/ */
function hl_my_tag_transform($element, $attribute_array=0) function hl_my_tag_transform($element, $attribute_array=0)
{ {
@ -134,6 +135,13 @@ function hl_my_tag_transform($element, $attribute_array=0)
{ {
if (strpos($attribute_array['title'],'@')!==false) $attribute_array['title']=str_replace('@','(at)',$attribute_array['title']); if (strpos($attribute_array['title'],'@')!==false) $attribute_array['title']=str_replace('@','(at)',$attribute_array['title']);
} }
if ($element == 'blockquote')
{
if (isset($attribute_array['cite']))
{
if (strpos($attribute_array['cite'],'@')!==false) $attribute_array['cite']=str_replace('@','(at)',$attribute_array['cite']);
}
}
/* /*
// Elements other than 'span' or 'span' without a 'style' attribute are returned unchanged // Elements other than 'span' or 'span' without a 'style' attribute are returned unchanged
if($element == 'span' && isset($attribute_array['style'])) if($element == 'span' && isset($attribute_array['style']))
@ -183,6 +191,7 @@ function hl_my_tag_transform($element, $attribute_array=0)
* -control for/on external Images and src-length * -control for/on external Images and src-length
* a -checking for title and href, replacing @ accordingly * a -checking for title and href, replacing @ accordingly
* -navigate to local anchors without reloading the page * -navigate to local anchors without reloading the page
* blockquote -checking for cite, replacing @
*/ */
function hl_email_tag_transform($element, $attribute_array=0) function hl_email_tag_transform($element, $attribute_array=0)
{ {
@ -222,6 +231,13 @@ function hl_email_tag_transform($element, $attribute_array=0)
{ {
if (strpos($attribute_array['title'],'@')!==false) $attribute_array['title']=str_replace('@','(at)',$attribute_array['title']); if (strpos($attribute_array['title'],'@')!==false) $attribute_array['title']=str_replace('@','(at)',$attribute_array['title']);
} }
if ($element == 'blockquote')
{
if (isset($attribute_array['cite']))
{
if (strpos($attribute_array['cite'],'@')!==false) $attribute_array['cite']=str_replace('@','(at)',$attribute_array['cite']);
}
}
if($element == 'a') if($element == 'a')
{ {
if (isset($attribute_array['name']) && isset($attribute_array['id'])) $attribute_array['id'] = $attribute_array['name']; if (isset($attribute_array['name']) && isset($attribute_array['id'])) $attribute_array['id'] = $attribute_array['name'];