XOOPS 2.5.6
Final
Main Page
Related Pages
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Pages
TargetBlank.php
Go to the documentation of this file.
1
<?php
2
3
// must be called POST validation
4
10
class
HTMLPurifier_AttrTransform_TargetBlank
extends
HTMLPurifier_AttrTransform
11
{
12
private
$parser
;
13
14
public
function
__construct
() {
15
$this->parser =
new
HTMLPurifier_URIParser
();
16
}
17
18
public
function
transform
($attr,
$config
, $context) {
19
20
if
(!isset($attr[
'href'
])) {
21
return
$attr;
22
}
23
24
// XXX Kind of inefficient
25
$url
= $this->parser->parse($attr[
'href'
]);
26
$scheme =
$url
->getSchemeObj(
$config
, $context);
27
28
if
($scheme->browsable && !
$url
->isBenign(
$config
, $context)) {
29
$attr[
'target'
] =
'blank'
;
30
}
31
32
return
$attr;
33
34
}
35
36
}
37
38
// vim: et sw=4 sts=4
L:
0xoops
xoops-2.5.6
htdocs
xoops_lib
modules
protector
library
HTMLPurifier
AttrTransform
TargetBlank.php
Generated on Fri May 10 2013 01:04:30 for XOOPS 2.5.6 by
1.8.3.1