◆ __construct()
◆ bool()
| ilPDFGenerationRequest::bool |
( |
string |
$parameter, |
|
|
bool |
$cast_null_to_false = true |
|
) |
| |
Definition at line 184 of file class.ilPDFGenerationRequest.php.
184 : bool
185 {
186 $null_to_false = $this->
refinery->custom()->transformation(
static function ($value):
bool {
187 if ($value === null) {
188 return false;
189 }
190
191 throw new ilException(
'Expected null in transformation');
192 });
193
194 $as_bool = $cast_null_to_false ?
195 $this->
refinery->byTrying([$this->
refinery->kindlyTo()->bool(), $null_to_false]) :
196 $this->
refinery->kindlyTo()->bool();
197
198 $bool = false;
199 if ($this->
http->wrapper()->post()->has($parameter)) {
200 $bool = $this->
http->wrapper()->post()->retrieve(
201 $parameter,
202 $as_bool
203 );
204 } elseif ($this->
http->wrapper()->query()->has($parameter)) {
205 $bool = $this->
http->wrapper()->query()->retrieve(
206 $parameter,
207 $as_bool
208 );
209 }
210
211 return $bool;
212 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().
◆ float()
| ilPDFGenerationRequest::float |
( |
string |
$parameter, |
|
|
bool |
$cast_null_to_zero = true |
|
) |
| |
Definition at line 214 of file class.ilPDFGenerationRequest.php.
214 : float
215 {
216 $null_to_zero = $this->
refinery->custom()->transformation(
static function ($value):
float {
217 if ($value === null) {
218 return 0.0;
219 }
220
221 throw new ilException(
'Expected null in transformation');
222 });
223
224 $as_float = $cast_null_to_zero ?
225 $this->
refinery->byTrying([$this->
refinery->kindlyTo()->float(), $null_to_zero]) :
226 $this->
refinery->kindlyTo()->float();
227
228 $float = 0.0;
229 if ($this->
http->wrapper()->post()->has($parameter)) {
230 $float = $this->
http->wrapper()->post()->retrieve(
231 $parameter,
232 $as_float
233 );
234 } elseif ($this->
http->wrapper()->query()->has($parameter)) {
235 $float = $this->
http->wrapper()->query()->retrieve(
236 $parameter,
237 $as_float
238 );
239 }
240
241 return $float;
242 }
References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().
◆ int()
| ilPDFGenerationRequest::int |
( |
string |
$parameter, |
|
|
bool |
$cast_null_to_int = true |
|
) |
| |
Definition at line 154 of file class.ilPDFGenerationRequest.php.
154 : int
155 {
156 $null_to_zero = $this->
refinery->custom()->transformation(
static function ($value):
int {
157 if ($value === null) {
158 return 0;
159 }
160
161 throw new ilException(
'Expected null in transformation');
162 });
163
164 $as_int = $cast_null_to_int ?
165 $this->
refinery->byTrying([$this->
refinery->kindlyTo()->int(), $null_to_zero]) :
167
168 $int = 0;
169 if ($this->
http->wrapper()->post()->has($parameter)) {
170 $int = $this->
http->wrapper()->post()->retrieve(
171 $parameter,
172 $as_int
173 );
174 } elseif ($this->
http->wrapper()->query()->has($parameter)) {
175 $int = $this->
http->wrapper()->query()->retrieve(
176 $parameter,
177 $as_int
178 );
179 }
180
181 return $int;
182 }
References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().
◆ isNotValidSize()
| ilPDFGenerationRequest::isNotValidSize |
( |
array |
$sizes | ) |
|
Definition at line 104 of file class.ilPDFGenerationRequest.php.
104 : bool
105 {
106 foreach ($sizes as $size) {
107 if (is_int($size)) {
108 continue;
109 }
110 if (!preg_match('/(\d)+?(\W)*(cm|mm)$/', $size)) {
111 if ($size !== 0 && $size !== "0" && $size !== null && $size !== "") {
112 return true;
113 }
114 }
115 }
116
117 return false;
118 }
◆ isNotValidText()
| ilPDFGenerationRequest::isNotValidText |
( |
array |
$texts | ) |
|
Definition at line 120 of file class.ilPDFGenerationRequest.php.
120 : bool
121 {
122 foreach ($texts as $text) {
123 if (!preg_match('/[a-zA-Z\d ]+$/', $text)) {
124 if ($text !== '' && $text !== null) {
125 return true;
126 }
127 }
128 }
129
130 return false;
131 }
◆ isPathOrUrlValid()
| ilPDFGenerationRequest::isPathOrUrlValid |
( |
string |
$url | ) |
|
|
protected |
Definition at line 72 of file class.ilPDFGenerationRequest.php.
72 : bool
73 {
74 $is_valid = false;
75 $is_url = filter_var(
$url, FILTER_VALIDATE_URL);
76
77 if ($is_url) {
78 try {
81 $c->setOpt(CURLOPT_CUSTOMREQUEST,
'HEAD');
82 $c->setOpt(CURLOPT_SSL_VERIFYPEER, 0);
83 $c->setOpt(CURLOPT_SSL_VERIFYHOST, 0);
84 $c->setOpt(CURLOPT_RETURNTRANSFER, 1);
85 $c->setOpt(CURLOPT_FOLLOWLOCATION, 0);
86 $c->setOpt(CURLOPT_MAXREDIRS, 0);
87 $c->setOpt(CURLOPT_URL,
$url);
88 $c->setOpt(CURLOPT_HEADER,
true);
89 $c->setOpt(CURLOPT_NOBODY,
true);
90
92 $is_valid =
$c->getInfo(CURLINFO_HTTP_CODE) === 200;
93
95 return false;
96 }
97 } elseif (is_file(
$url)) {
98 $is_valid = true;
99 }
100
101 return $is_valid;
102 }
References $c, Vendor\Package\$e, and $url.
Referenced by validatePathOrUrl().
◆ securedString()
| ilPDFGenerationRequest::securedString |
( |
string |
$parameter, |
|
|
bool |
$cast_null_to_string = true |
|
) |
| |
Definition at line 35 of file class.ilPDFGenerationRequest.php.
35 : string
36 {
37 $as_sanizited_string = $this->
refinery->custom()->transformation(
static function (
string $value):
string {
39 });
40
41 $null_to_empty_string = $this->
refinery->custom()->transformation(
static function ($value):
string {
42 if ($value === null) {
43 return '';
44 }
45
46 throw new ilException(
'Expected null in transformation');
47 });
48
49 $sanizite_as_string = $this->
refinery->in()->series([
50 $cast_null_to_string ?
51 $this->
refinery->byTrying([$this->refinery->kindlyTo()->string(), $null_to_empty_string]) :
52 $this->
refinery->kindlyTo()->string(),
53 $as_sanizited_string
54 ]);
55
56 $string = '';
57 if ($this->
http->wrapper()->post()->has($parameter)) {
58 $string = $this->
http->wrapper()->post()->retrieve(
59 $parameter,
60 $sanizite_as_string
61 );
62 } elseif ($this->
http->wrapper()->query()->has($parameter)) {
63 $string = $this->
http->wrapper()->query()->retrieve(
64 $parameter,
65 $sanizite_as_string
66 );
67 }
68
69 return $string;
70 }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
References ILIAS\FileDelivery\http(), ILIAS\Repository\refinery(), and ilUtil\stripSlashes().
Referenced by validatePathOrUrl().
◆ validatePathOrUrl()
| ilPDFGenerationRequest::validatePathOrUrl |
( |
array |
$parameters | ) |
|
- Parameters
-
- Returns
- bool
Definition at line 137 of file class.ilPDFGenerationRequest.php.
137 : bool
138 {
140 foreach ($parameters as $parameter) {
142 if ($value === '') {
144 } else {
146 }
148 return false;
149 }
150 }
151 return true;
152 }
securedString(string $parameter, bool $cast_null_to_string=true)
isPathOrUrlValid(string $url)
References $valid, isPathOrUrlValid(), and securedString().
◆ $http
| ILIAS HTTP GlobalHttpState ilPDFGenerationRequest::$http |
|
private |
◆ $refinery
| ILIAS Refinery Factory ilPDFGenerationRequest::$refinery |
|
private |
The documentation for this class was generated from the following file: