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