ILIAS
release_4-4 Revision
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
+
Files
File List
+
Globals
+
All
$
(
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
o
p
r
s
t
u
v
w
x
+
Variables
$
(
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
PurifierLinkify.php
Go to the documentation of this file.
1
<?php
2
7
class
HTMLPurifier_Injector_PurifierLinkify
extends
HTMLPurifier_Injector
8
{
9
10
public
$name
=
'PurifierLinkify'
;
11
public
$docURL
;
12
public
$needed
= array(
'a'
=> array(
'href'
));
13
14
public
function
prepare
($config, $context) {
15
$this->docURL = $config->get(
'AutoFormat.PurifierLinkify.DocURL'
);
16
return
parent::prepare($config, $context);
17
}
18
19
public
function
handleText
(&$token) {
20
if
(!$this->
allowsElement
(
'a'
))
return
;
21
if
(strpos($token->data,
'%'
) ===
false
)
return
;
22
23
$bits = preg_split(
'#%([a-z0-9]+\.[a-z0-9]+)#Si'
, $token->data, -1, PREG_SPLIT_DELIM_CAPTURE);
24
$token = array();
25
26
// $i = index
27
// $c = count
28
// $l = is link
29
for
($i = 0, $c = count($bits), $l =
false
; $i < $c; $i++, $l = !$l) {
30
if
(!$l) {
31
if
($bits[$i] ===
''
)
continue
;
32
$token[] =
new
HTMLPurifier_Token_Text
($bits[$i]);
33
}
else
{
34
$token[] =
new
HTMLPurifier_Token_Start
(
'a'
,
35
array(
'href'
=> str_replace(
'%s'
, $bits[$i], $this->docURL)));
36
$token[] =
new
HTMLPurifier_Token_Text
(
'%'
. $bits[$i]);
37
$token[] =
new
HTMLPurifier_Token_End
(
'a'
);
38
}
39
}
40
41
}
42
43
}
44
45
// vim: et sw=4 sts=4
HTMLPurifier_Injector\allowsElement
allowsElement($name)
Tests if the context node allows a certain element.
Definition:
Injector.php:129
HTMLPurifier_Token_End
Concrete end token class.
Definition:
End.php:10
HTMLPurifier_Injector_PurifierLinkify\$docURL
$docURL
Definition:
PurifierLinkify.php:11
HTMLPurifier_Injector_PurifierLinkify\handleText
handleText(&$token)
Definition:
PurifierLinkify.php:19
HTMLPurifier_Injector_PurifierLinkify\prepare
prepare($config, $context)
Definition:
PurifierLinkify.php:14
HTMLPurifier_Token_Start
Concrete start token class.
Definition:
Start.php:6
HTMLPurifier_Injector_PurifierLinkify\$name
$name
Definition:
PurifierLinkify.php:10
HTMLPurifier_Injector_PurifierLinkify
Injector that converts configuration directive syntax Namespace.Directive to links.
Definition:
PurifierLinkify.php:7
HTMLPurifier_Injector
Injects tokens into the document while parsing for well-formedness.
Definition:
Injector.php:16
HTMLPurifier_Injector_PurifierLinkify\$needed
$needed
Definition:
PurifierLinkify.php:12
HTMLPurifier_Token_Text
Concrete text token class.
Definition:
Text.php:12
Services
Html
HtmlPurifier
library
HTMLPurifier
Injector
PurifierLinkify.php
Generated on Mon Dec 21 2020 19:01:16 for ILIAS by
1.8.13 (using
Doxyfile
)