ILIAS
release_4-3 Revision
◀ ilDoc Overview
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Groups
Pages
StringHashParser.php
Go to the documentation of this file.
1
<?php
2
28
class
HTMLPurifier_StringHashParser
29
{
30
31
public
$default
=
'ID'
;
32
36
public
function
parseFile
(
$file
) {
37
if
(!file_exists(
$file
))
return
false
;
38
$fh = fopen(
$file
,
'r'
);
39
if
(!$fh)
return
false
;
40
$ret
= $this->
parseHandle
($fh);
41
fclose($fh);
42
return
$ret
;
43
}
44
48
public
function
parseMultiFile
(
$file
) {
49
if
(!file_exists(
$file
))
return
false
;
50
$ret
= array();
51
$fh = fopen(
$file
,
'r'
);
52
if
(!$fh)
return
false
;
53
while
(!feof($fh)) {
54
$ret
[] = $this->
parseHandle
($fh);
55
}
56
fclose($fh);
57
return
$ret
;
58
}
59
68
protected
function
parseHandle
($fh) {
69
$state =
false
;
70
$single =
false
;
71
$ret
= array();
72
do
{
73
$line = fgets($fh);
74
if
($line ===
false
)
break
;
75
$line = rtrim($line,
"\n\r"
);
76
if
(!$state && $line ===
''
)
continue
;
77
if
($line ===
'----'
)
break
;
78
if
(strncmp(
'--#'
, $line, 3) === 0) {
79
// Comment
80
continue
;
81
} elseif (strncmp(
'--'
, $line, 2) === 0) {
82
// Multiline declaration
83
$state = trim($line,
'- '
);
84
if
(!isset(
$ret
[$state]))
$ret
[$state] =
''
;
85
continue
;
86
} elseif (!$state) {
87
$single =
true
;
88
if
(strpos($line,
':'
) !==
false
) {
89
// Single-line declaration
90
list($state, $line) = explode(
':'
, $line, 2);
91
$line = trim($line);
92
}
else
{
93
// Use default declaration
94
$state =
$this->default
;
95
}
96
}
97
if
($single) {
98
$ret
[$state] = $line;
99
$single =
false
;
100
$state =
false
;
101
}
else
{
102
$ret
[$state] .=
"$line\n"
;
103
}
104
}
while
(!feof($fh));
105
return
$ret
;
106
}
107
108
}
109
110
// vim: et sw=4 sts=4
Services
Html
HtmlPurifier
library
HTMLPurifier
StringHashParser.php
Generated on Sat Apr 30 2016 19:01:01 for ILIAS by
1.8.1.2 (using
Doxyfile
)