Class IMP_MIME_Viewer_html

Description

The MIME_Viewer_html class renders out HTML text with an effort to remove potentially malicious code.

$Horde: imp/lib/MIME/Viewer/html.php,v 1.75.2.41 2010/06/30 21:55:47 slusarz Exp $

Copyright 1999-2009 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.fsf.org/copyleft/gpl.html.

Located in /lib/MIME/Viewer/html.php (line 21)

MIME_Viewer_html
   |
   --IMP_MIME_Viewer_html
Variable Summary
 string $_img_regex
Method Summary
 string render (array $params)
 string _blockImages (array $matches)
 void _mailtoCallback ( $m)
 void _openLinksInNewWindow (string $data)
Variables
string $_img_regex = '/
# match 1
(
# <img> tags
<img[^>]+?src=
# <input> tags
|<input[^>]+?src=
# "background" attributes
|<body[^>]+?background=|<td[^>]*background=|<table[^>]*background=
# "style" attributes; match 2; quotes: match 3
|(style=\s*("|\')?[^>]*?background(?:-image)?:(?(3)[^"\']|[^>])*?url\s*\()
)
# whitespace
\s*
# opening quotes, parenthesis; match 4
("|\')?
# the image url; match 5
((?(2)
# matched a "style" attribute
(?(4)[^"\')>]*|[^\s)>]*)
# did not match a "style" attribute
|(?(4)[^"\'>]*|[^\s>]*)
))
# closing quotes
(?(4)\\4)
# matched a "style" attribute?
(?(2)
# closing parenthesis
\s*\)
# remainder of the "style" attribute; match 6
((?(3)[^"\'>]*|[^\s>]*))
)
/isx'
(line 29)

The regular expression to catch any tags and attributes that load external images.

Methods
render (line 71)

Render out the currently set contents.

  • return: The rendered text in HTML.
string render (array $params)
  • array $params: An array with a reference to a MIME_Contents object.
_blockImages (line 203)

Called from the image-blocking regexp to construct the new image tags.

  • return: The new image tag.
string _blockImages (array $matches)
  • array $matches
_mailtoCallback (line 188)
void _mailtoCallback ( $m)
  • $m
_openLinksInNewWindow (line 255)

Convert links to open in a new window.

void _openLinksInNewWindow (string $data)
  • string $data: Text to convert.

Documentation generated on Sun, 30 Jan 2011 05:28:12 +0000 by phpDocumentor 1.4.3