XOOPS 2.5.6
Final
Main Page
Related Pages
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Pages
ImgRequired.php
Go to the documentation of this file.
1
<?php
2
3
// must be called POST validation
4
11
class
HTMLPurifier_AttrTransform_ImgRequired
extends
HTMLPurifier_AttrTransform
12
{
13
14
public
function
transform
($attr,
$config
, $context) {
15
16
$src =
true
;
17
if
(!isset($attr[
'src'
])) {
18
if
(
$config
->get(
'Core.RemoveInvalidImg'
))
return
$attr;
19
$attr[
'src'
] =
$config
->get(
'Attr.DefaultInvalidImage'
);
20
$src =
false
;
21
}
22
23
if
(!isset($attr[
'alt'
])) {
24
if
($src) {
25
$alt =
$config
->get(
'Attr.DefaultImageAlt'
);
26
if
($alt === null) {
27
// truncate if the alt is too long
28
$attr[
'alt'
] = substr(basename($attr[
'src'
]),0,40);
29
}
else
{
30
$attr[
'alt'
] = $alt;
31
}
32
}
else
{
33
$attr[
'alt'
] =
$config
->get(
'Attr.DefaultInvalidImageAlt'
);
34
}
35
}
36
37
return
$attr;
38
39
}
40
41
}
42
43
// vim: et sw=4 sts=4
L:
0xoops
xoops-2.5.6
htdocs
xoops_lib
modules
protector
library
HTMLPurifier
AttrTransform
ImgRequired.php
Generated on Fri May 10 2013 01:04:29 for XOOPS 2.5.6 by
1.8.3.1