XOOPS 2.5.6
Final
Main Page
Related Pages
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Pages
LinkTypes.php
Go to the documentation of this file.
1
<?php
2
9
class
HTMLPurifier_AttrDef_HTML_LinkTypes
extends
HTMLPurifier_AttrDef
10
{
11
13
protected
$name
;
14
15
public
function
__construct
(
$name
) {
16
$configLookup = array(
17
'rel'
=>
'AllowedRel'
,
18
'rev'
=>
'AllowedRev'
19
);
20
if
(!isset($configLookup[
$name
])) {
21
trigger_error(
'Unrecognized attribute name for link '
.
22
'relationship.'
, E_USER_ERROR);
23
return
;
24
}
25
$this->name = $configLookup[
$name
];
26
}
27
28
public
function
validate
($string,
$config
, $context) {
29
30
$allowed
=
$config
->get(
'Attr.'
. $this->name);
31
if
(empty(
$allowed
))
return
false
;
32
33
$string = $this->
parseCDATA
($string);
34
$parts = explode(
' '
, $string);
35
36
// lookup to prevent duplicates
37
$ret_lookup = array();
38
foreach
($parts as $part) {
39
$part = strtolower(trim($part));
40
if
(!isset(
$allowed
[$part]))
continue
;
41
$ret_lookup[$part] =
true
;
42
}
43
44
if
(empty($ret_lookup))
return
false
;
45
$string = implode(
' '
, array_keys($ret_lookup));
46
47
return
$string;
48
49
}
50
51
}
52
53
// vim: et sw=4 sts=4
L:
0xoops
xoops-2.5.6
htdocs
xoops_lib
modules
protector
library
HTMLPurifier
AttrDef
HTML
LinkTypes.php
Generated on Fri May 10 2013 01:04:29 for XOOPS 2.5.6 by
1.8.3.1