ILIAS
Release_5_0_x_branch Revision 61816
◀ ilDoc Overview
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Groups
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
20
public
function
transform
($attr, $config, $context)
21
{
22
$src =
true
;
23
if
(!isset($attr[
'src'
])) {
24
if
($config->get(
'Core.RemoveInvalidImg'
)) {
25
return
$attr;
26
}
27
$attr[
'src'
] = $config->get(
'Attr.DefaultInvalidImage'
);
28
$src =
false
;
29
}
30
31
if
(!isset($attr[
'alt'
])) {
32
if
($src) {
33
$alt = $config->get(
'Attr.DefaultImageAlt'
);
34
if
($alt === null) {
35
// truncate if the alt is too long
36
$attr[
'alt'
] = substr(basename($attr[
'src'
]), 0, 40);
37
}
else
{
38
$attr[
'alt'
] = $alt;
39
}
40
}
else
{
41
$attr[
'alt'
] = $config->get(
'Attr.DefaultInvalidImageAlt'
);
42
}
43
}
44
return
$attr;
45
}
46
}
47
48
// vim: et sw=4 sts=4
Services
Html
HtmlPurifier
library
HTMLPurifier
AttrTransform
ImgRequired.php
Generated on Wed Apr 27 2016 21:01:40 for ILIAS by
1.8.1.2 (using
Doxyfile
)