XOOPS 2.5.6
Final
Main Page
Related Pages
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Pages
ImgSpace.php
Go to the documentation of this file.
1
<?php
2
6
class
HTMLPurifier_AttrTransform_ImgSpace
extends
HTMLPurifier_AttrTransform
{
7
8
protected
$attr
;
9
protected
$css
= array(
10
'hspace'
=> array(
'left'
,
'right'
),
11
'vspace'
=> array(
'top'
,
'bottom'
)
12
);
13
14
public
function
__construct
(
$attr
) {
15
$this->attr =
$attr
;
16
if
(!isset($this->css[
$attr
])) {
17
trigger_error(htmlspecialchars($attr) .
' is not valid space attribute'
);
18
}
19
}
20
21
public
function
transform
(
$attr
,
$config
, $context) {
22
23
if
(!isset(
$attr
[$this->attr]))
return
$attr
;
24
25
$width = $this->
confiscateAttr
(
$attr
, $this->attr);
26
// some validation could happen here
27
28
if
(!isset($this->css[$this->attr]))
return
$attr
;
29
30
$style =
''
;
31
foreach
($this->css[$this->attr] as $suffix) {
32
$property =
"margin-$suffix"
;
33
$style .=
"$property:{$width}px;"
;
34
}
35
36
$this->
prependCSS
(
$attr
, $style);
37
38
return
$attr
;
39
40
}
41
42
}
43
44
// vim: et sw=4 sts=4
L:
0xoops
xoops-2.5.6
htdocs
xoops_lib
modules
protector
library
HTMLPurifier
AttrTransform
ImgSpace.php
Generated on Fri May 10 2013 01:04:29 for XOOPS 2.5.6 by
1.8.3.1