@@ -14,7 +14,7 @@ |
||
14 | 14 | public function __construct($label, $attributes) |
15 | 15 | { |
16 | 16 | parent::__construct($label, $attributes); |
17 | - $this->Attributes()->set('type','range'); |
|
17 | + $this->Attributes()->set('type', 'range'); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | } |
21 | 21 | \ No newline at end of file |
@@ -14,7 +14,7 @@ |
||
14 | 14 | public function __construct($label, $attributes = []) |
15 | 15 | { |
16 | 16 | parent::__construct($label, $attributes); |
17 | - $this->Attributes()->set('type','url'); |
|
17 | + $this->Attributes()->set('type', 'url'); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | } |
21 | 21 | \ No newline at end of file |
@@ -113,7 +113,7 @@ |
||
113 | 113 | { |
114 | 114 | $item = new Captcha($label,$attributes); |
115 | 115 | //$this->Request->getSession()->set(md5($item->Attributes()->get('name')), $item->Attributes()->get('capresponse')); |
116 | - // $this->Request->Session->set(md5($item->Attributes()->get('name')),$item->Attributes()->get('capresponse')); |
|
116 | + // $this->Request->Session->set(md5($item->Attributes()->get('name')),$item->Attributes()->get('capresponse')); |
|
117 | 117 | $this->Form->append($item); |
118 | 118 | } |
119 | 119 | return $this; |
@@ -267,8 +267,9 @@ discard block |
||
267 | 267 | { |
268 | 268 | if($this->Form instanceof form) |
269 | 269 | { |
270 | - if($this->Fieldset instanceof fieldsetGenerator) |
|
271 | - $this->Form->append($this->Fieldset->Close()); |
|
270 | + if($this->Fieldset instanceof fieldsetGenerator) { |
|
271 | + $this->Form->append($this->Fieldset->Close()); |
|
272 | + } |
|
272 | 273 | $this->Fieldset = new fieldsetGenerator($attributes); |
273 | 274 | $this->Fieldset->Attributes()->set('name', $this->Form->Attributes()->get('name')); |
274 | 275 | $this->Form->append($this->Fieldset->Open()); |
@@ -316,8 +317,9 @@ discard block |
||
316 | 317 | { |
317 | 318 | if($this->Form instanceof form) |
318 | 319 | { |
319 | - if(gettype($html) === 'string') |
|
320 | - $this->Form->append($html); |
|
320 | + if(gettype($html) === 'string') { |
|
321 | + $this->Form->append($html); |
|
322 | + } |
|
321 | 323 | } |
322 | 324 | return $this; |
323 | 325 | } |
@@ -617,12 +619,14 @@ discard block |
||
617 | 619 | $html = null; |
618 | 620 | if ($this->Form instanceof form) |
619 | 621 | { |
620 | - if($this->Fieldset instanceof fieldsetGenerator) |
|
621 | - $this->Form->append($this->Fieldset->Close()); |
|
622 | + if($this->Fieldset instanceof fieldsetGenerator) { |
|
623 | + $this->Form->append($this->Fieldset->Close()); |
|
624 | + } |
|
622 | 625 | $html = $this->Form->RenderHtml(); |
623 | 626 | $this->Form = null; |
624 | - if($print) |
|
625 | - print_r($html); |
|
627 | + if($print) { |
|
628 | + print_r($html); |
|
629 | + } |
|
626 | 630 | } |
627 | 631 | return $html; |
628 | 632 | } |
@@ -653,8 +657,9 @@ discard block |
||
653 | 657 | $Request = $this->Request->query; |
654 | 658 | break; |
655 | 659 | } |
656 | - if(!$value = $Request->get($name, $default)) |
|
657 | - $value = $element->Attributes()->get('value', $default); |
|
660 | + if(!$value = $Request->get($name, $default)) { |
|
661 | + $value = $element->Attributes()->get('value', $default); |
|
662 | + } |
|
658 | 663 | return $value; |
659 | 664 | } |
660 | 665 | /** |
@@ -663,8 +668,9 @@ discard block |
||
663 | 668 | */ |
664 | 669 | public function Open($attributes = []) |
665 | 670 | { |
666 | - if($this->Form instanceof form) |
|
667 | - $this->Close(); |
|
671 | + if($this->Form instanceof form) { |
|
672 | + $this->Close(); |
|
673 | + } |
|
668 | 674 | $this->Form = new form($attributes); |
669 | 675 | return $this; |
670 | 676 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | public function __construct($App) |
63 | 63 | { |
64 | 64 | $this->Request = $App->Request(); |
65 | - $formErrors = $App->get('errors',[]); |
|
65 | + $formErrors = $App->get('errors', []); |
|
66 | 66 | is_array($formErrors) OR $formErrors = [$formErrors]; |
67 | 67 | $this->Errors = new Collection($formErrors); |
68 | 68 | } |
@@ -72,14 +72,14 @@ discard block |
||
72 | 72 | * @param array $attributes |
73 | 73 | * @return $this |
74 | 74 | */ |
75 | - public function addAudio($label,$attributes=[]) |
|
75 | + public function addAudio($label, $attributes = []) |
|
76 | 76 | { |
77 | - if($this->Form instanceof form) |
|
77 | + if ($this->Form instanceof form) |
|
78 | 78 | { |
79 | - $item = new Audio($label,$attributes); |
|
80 | - $item->Attributes()->set('accept','audio/*'); |
|
79 | + $item = new Audio($label, $attributes); |
|
80 | + $item->Attributes()->set('accept', 'audio/*'); |
|
81 | 81 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
82 | - $this->Form->Attributes()->set('enctype','multipart/form-data'); |
|
82 | + $this->Form->Attributes()->set('enctype', 'multipart/form-data'); |
|
83 | 83 | $this->Form->append($item); |
84 | 84 | } |
85 | 85 | return $this; |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | * @param array $attributes |
91 | 91 | * @return $this |
92 | 92 | */ |
93 | - public function addButton($label,$attributes=[]) |
|
93 | + public function addButton($label, $attributes = []) |
|
94 | 94 | { |
95 | - if($this->Form instanceof form) |
|
95 | + if ($this->Form instanceof form) |
|
96 | 96 | { |
97 | - $item = new Button($label,$attributes); |
|
97 | + $item = new Button($label, $attributes); |
|
98 | 98 | $this->Form->append($item); |
99 | 99 | } |
100 | 100 | return $this; |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | * @param array $attributes |
106 | 106 | * @return $this |
107 | 107 | */ |
108 | - public function addCaptcha($label,$attributes=[]) |
|
108 | + public function addCaptcha($label, $attributes = []) |
|
109 | 109 | { |
110 | - if($this->Form instanceof form) |
|
110 | + if ($this->Form instanceof form) |
|
111 | 111 | { |
112 | - $item = new Captcha($label,$attributes); |
|
112 | + $item = new Captcha($label, $attributes); |
|
113 | 113 | //$this->Request->getSession()->set(md5($item->Attributes()->get('name')), $item->Attributes()->get('capresponse')); |
114 | 114 | // $this->Request->Session->set(md5($item->Attributes()->get('name')),$item->Attributes()->get('capresponse')); |
115 | 115 | $this->Form->append($item); |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | * @param array $attributes |
124 | 124 | * @return $this |
125 | 125 | */ |
126 | - public function addCheckbox($label,$options = [],$attributes=[]) |
|
126 | + public function addCheckbox($label, $options = [], $attributes = []) |
|
127 | 127 | { |
128 | - if($this->Form instanceof form) |
|
128 | + if ($this->Form instanceof form) |
|
129 | 129 | { |
130 | - $item = new Checkbox($label,$options ,$attributes); |
|
130 | + $item = new Checkbox($label, $options, $attributes); |
|
131 | 131 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
132 | 132 | $this->Form->append($item); |
133 | 133 | } |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | * @param array $attributes |
140 | 140 | * @return $this |
141 | 141 | */ |
142 | - public function addColor($label,$attributes=[]) |
|
142 | + public function addColor($label, $attributes = []) |
|
143 | 143 | { |
144 | - if($this->Form instanceof form) |
|
144 | + if ($this->Form instanceof form) |
|
145 | 145 | { |
146 | - $item = new Color($label,$attributes); |
|
146 | + $item = new Color($label, $attributes); |
|
147 | 147 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
148 | 148 | $this->Form->append($item); |
149 | 149 | } |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | * @param array $attributes |
156 | 156 | * @return $this |
157 | 157 | */ |
158 | - public function addCountries($label,$attributes=[]) |
|
158 | + public function addCountries($label, $attributes = []) |
|
159 | 159 | { |
160 | - if($this->Form instanceof form) |
|
160 | + if ($this->Form instanceof form) |
|
161 | 161 | { |
162 | - $item = new Country($label,$attributes); |
|
162 | + $item = new Country($label, $attributes); |
|
163 | 163 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
164 | 164 | $this->Form->append($item); |
165 | 165 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param array $attributes |
171 | 171 | * @return $this |
172 | 172 | */ |
173 | - public function addDatalist($label, $options=[], $attributes = []) |
|
173 | + public function addDatalist($label, $options = [], $attributes = []) |
|
174 | 174 | { |
175 | 175 | if ($this->Form instanceof form) { |
176 | 176 | $item = new Datalist($label, $options, $attributes); |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | * @param array $attributes |
186 | 186 | * @return $this |
187 | 187 | */ |
188 | - public function addDate($label,$attributes=[]) |
|
188 | + public function addDate($label, $attributes = []) |
|
189 | 189 | { |
190 | - if($this->Form instanceof form) |
|
190 | + if ($this->Form instanceof form) |
|
191 | 191 | { |
192 | - $item = new Date($label,$attributes); |
|
192 | + $item = new Date($label, $attributes); |
|
193 | 193 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
194 | 194 | $this->Form->append($item); |
195 | 195 | } |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | * @param array $attributes |
202 | 202 | * @return $this |
203 | 203 | */ |
204 | - public function addDatetime($label,$attributes=[]) |
|
204 | + public function addDatetime($label, $attributes = []) |
|
205 | 205 | { |
206 | - if($this->Form instanceof form) |
|
206 | + if ($this->Form instanceof form) |
|
207 | 207 | { |
208 | - $item = new Datetime($label,$attributes); |
|
208 | + $item = new Datetime($label, $attributes); |
|
209 | 209 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
210 | 210 | $this->Form->append($item); |
211 | 211 | } |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | * @param array $attributes |
218 | 218 | * @return $this |
219 | 219 | */ |
220 | - public function addDatetimeLocal($label,$attributes=[]) |
|
220 | + public function addDatetimeLocal($label, $attributes = []) |
|
221 | 221 | { |
222 | - if($this->Form instanceof form) |
|
222 | + if ($this->Form instanceof form) |
|
223 | 223 | { |
224 | - $item = new DatetimeLocal($label,$attributes); |
|
224 | + $item = new DatetimeLocal($label, $attributes); |
|
225 | 225 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
226 | 226 | $this->Form->append($item); |
227 | 227 | } |
@@ -232,11 +232,11 @@ discard block |
||
232 | 232 | * @param array $attributes |
233 | 233 | * @return $this |
234 | 234 | */ |
235 | - public function addEditor($label,$attributes=[]) |
|
235 | + public function addEditor($label, $attributes = []) |
|
236 | 236 | { |
237 | - if($this->Form instanceof form) |
|
237 | + if ($this->Form instanceof form) |
|
238 | 238 | { |
239 | - $item = new Editor($label,$attributes); |
|
239 | + $item = new Editor($label, $attributes); |
|
240 | 240 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
241 | 241 | $this->Form->append($item); |
242 | 242 | } |
@@ -247,11 +247,11 @@ discard block |
||
247 | 247 | * @param array $attributes |
248 | 248 | * @return $this |
249 | 249 | */ |
250 | - public function addEmail($label,$attributes=[]) |
|
250 | + public function addEmail($label, $attributes = []) |
|
251 | 251 | { |
252 | - if($this->Form instanceof form) |
|
252 | + if ($this->Form instanceof form) |
|
253 | 253 | { |
254 | - $item = new Email($label,$attributes); |
|
254 | + $item = new Email($label, $attributes); |
|
255 | 255 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
256 | 256 | $this->Form->append($item); |
257 | 257 | } |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | * @param array $attributes |
262 | 262 | * @return $this |
263 | 263 | */ |
264 | - public function addFieldset($attributes=[]) |
|
264 | + public function addFieldset($attributes = []) |
|
265 | 265 | { |
266 | - if($this->Form instanceof form) |
|
266 | + if ($this->Form instanceof form) |
|
267 | 267 | { |
268 | - if($this->Fieldset instanceof fieldsetGenerator) |
|
268 | + if ($this->Fieldset instanceof fieldsetGenerator) |
|
269 | 269 | $this->Form->append($this->Fieldset->Close()); |
270 | 270 | $this->Fieldset = new fieldsetGenerator($attributes); |
271 | 271 | $this->Fieldset->Attributes()->set('name', $this->Form->Attributes()->get('name')); |
@@ -278,12 +278,12 @@ discard block |
||
278 | 278 | * @param array $attributes |
279 | 279 | * @return $this |
280 | 280 | */ |
281 | - public function addFile($label,$attributes=[]) |
|
281 | + public function addFile($label, $attributes = []) |
|
282 | 282 | { |
283 | - if($this->Form instanceof form) |
|
283 | + if ($this->Form instanceof form) |
|
284 | 284 | { |
285 | - $item = new File($label,$attributes); |
|
286 | - $this->Form->Attributes()->set('enctype','multipart/form-data'); |
|
285 | + $item = new File($label, $attributes); |
|
286 | + $this->Form->Attributes()->set('enctype', 'multipart/form-data'); |
|
287 | 287 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
288 | 288 | $this->Form->append($item); |
289 | 289 | } |
@@ -295,11 +295,11 @@ discard block |
||
295 | 295 | * @param array $attributes |
296 | 296 | * @return $this |
297 | 297 | */ |
298 | - public function addHidden($label,$attributes=[]) |
|
298 | + public function addHidden($label, $attributes = []) |
|
299 | 299 | { |
300 | - if($this->Form instanceof form) |
|
300 | + if ($this->Form instanceof form) |
|
301 | 301 | { |
302 | - $item = new Hidden($label,$attributes); |
|
302 | + $item = new Hidden($label, $attributes); |
|
303 | 303 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
304 | 304 | $this->Form->append($item); |
305 | 305 | } |
@@ -312,9 +312,9 @@ discard block |
||
312 | 312 | */ |
313 | 313 | public function addHtml($html) |
314 | 314 | { |
315 | - if($this->Form instanceof form) |
|
315 | + if ($this->Form instanceof form) |
|
316 | 316 | { |
317 | - if(gettype($html) === 'string') |
|
317 | + if (gettype($html) === 'string') |
|
318 | 318 | $this->Form->append($html); |
319 | 319 | } |
320 | 320 | return $this; |
@@ -325,12 +325,12 @@ discard block |
||
325 | 325 | * @param array $attributes |
326 | 326 | * @return $this |
327 | 327 | */ |
328 | - public function addImage($label,$attributes=[]) |
|
328 | + public function addImage($label, $attributes = []) |
|
329 | 329 | { |
330 | - if($this->Form instanceof form) |
|
330 | + if ($this->Form instanceof form) |
|
331 | 331 | { |
332 | - $item = new Image($label,$attributes); |
|
333 | - $this->Form->Attributes()->set('enctype','multipart/form-data'); |
|
332 | + $item = new Image($label, $attributes); |
|
333 | + $this->Form->Attributes()->set('enctype', 'multipart/form-data'); |
|
334 | 334 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
335 | 335 | $this->Form->append($item); |
336 | 336 | } |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | * @param array $attributes |
343 | 343 | * @return $this |
344 | 344 | */ |
345 | - public function addMonth($label,$attributes=[]) |
|
345 | + public function addMonth($label, $attributes = []) |
|
346 | 346 | { |
347 | - if($this->Form instanceof form) |
|
347 | + if ($this->Form instanceof form) |
|
348 | 348 | { |
349 | - $item = new Month($label,$attributes); |
|
349 | + $item = new Month($label, $attributes); |
|
350 | 350 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
351 | 351 | $this->Form->append($item); |
352 | 352 | } |
@@ -358,11 +358,11 @@ discard block |
||
358 | 358 | * @param array $attributes |
359 | 359 | * @return $this |
360 | 360 | */ |
361 | - public function addNumber($label,$attributes=[]) |
|
361 | + public function addNumber($label, $attributes = []) |
|
362 | 362 | { |
363 | - if($this->Form instanceof form) |
|
363 | + if ($this->Form instanceof form) |
|
364 | 364 | { |
365 | - $item = new Number($label,$attributes); |
|
365 | + $item = new Number($label, $attributes); |
|
366 | 366 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
367 | 367 | $this->Form->append($item); |
368 | 368 | } |
@@ -373,11 +373,11 @@ discard block |
||
373 | 373 | * @param array $attributes |
374 | 374 | * @return $this |
375 | 375 | */ |
376 | - public function addPassword($label,$attributes=[]) |
|
376 | + public function addPassword($label, $attributes = []) |
|
377 | 377 | { |
378 | - if($this->Form instanceof form) |
|
378 | + if ($this->Form instanceof form) |
|
379 | 379 | { |
380 | - $item = new Password($label,$attributes); |
|
380 | + $item = new Password($label, $attributes); |
|
381 | 381 | $item->Attributes()->set('value', ''); |
382 | 382 | $this->Form->append($item); |
383 | 383 | } |
@@ -389,11 +389,11 @@ discard block |
||
389 | 389 | * @param array $attributes |
390 | 390 | * @return $this |
391 | 391 | */ |
392 | - public function addPhone($label,$attributes=[]) |
|
392 | + public function addPhone($label, $attributes = []) |
|
393 | 393 | { |
394 | - if($this->Form instanceof form) |
|
394 | + if ($this->Form instanceof form) |
|
395 | 395 | { |
396 | - $item = new Phone($label,$attributes); |
|
396 | + $item = new Phone($label, $attributes); |
|
397 | 397 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
398 | 398 | $this->Form->append($item); |
399 | 399 | } |
@@ -406,11 +406,11 @@ discard block |
||
406 | 406 | * @param array $attributes |
407 | 407 | * @return $this |
408 | 408 | */ |
409 | - public function addRadio($label,$options=[],$attributes=[]) |
|
409 | + public function addRadio($label, $options = [], $attributes = []) |
|
410 | 410 | { |
411 | - if($this->Form instanceof form) |
|
411 | + if ($this->Form instanceof form) |
|
412 | 412 | { |
413 | - $item = new Radio($label,$options,$attributes); |
|
413 | + $item = new Radio($label, $options, $attributes); |
|
414 | 414 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
415 | 415 | $this->Form->append($item); |
416 | 416 | } |
@@ -422,11 +422,11 @@ discard block |
||
422 | 422 | * @param array $attributes |
423 | 423 | * @return $this |
424 | 424 | */ |
425 | - public function addRange($label,$attributes=[]) |
|
425 | + public function addRange($label, $attributes = []) |
|
426 | 426 | { |
427 | - if($this->Form instanceof form) |
|
427 | + if ($this->Form instanceof form) |
|
428 | 428 | { |
429 | - $item = new Range($label,$attributes); |
|
429 | + $item = new Range($label, $attributes); |
|
430 | 430 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
431 | 431 | $this->Form->append($item); |
432 | 432 | } |
@@ -438,11 +438,11 @@ discard block |
||
438 | 438 | * @param array $attributes |
439 | 439 | * @return $this |
440 | 440 | */ |
441 | - public function addReset($label,$attributes=[]) |
|
441 | + public function addReset($label, $attributes = []) |
|
442 | 442 | { |
443 | - if($this->Form instanceof form) |
|
443 | + if ($this->Form instanceof form) |
|
444 | 444 | { |
445 | - $item = new Reset($label,$attributes); |
|
445 | + $item = new Reset($label, $attributes); |
|
446 | 446 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
447 | 447 | $this->Form->append($item); |
448 | 448 | } |
@@ -454,11 +454,11 @@ discard block |
||
454 | 454 | * @param array $attributes |
455 | 455 | * @return $this |
456 | 456 | */ |
457 | - public function addSearch($label,$attributes=[]) |
|
457 | + public function addSearch($label, $attributes = []) |
|
458 | 458 | { |
459 | - if($this->Form instanceof form) |
|
459 | + if ($this->Form instanceof form) |
|
460 | 460 | { |
461 | - $item = new Search($label,$attributes); |
|
461 | + $item = new Search($label, $attributes); |
|
462 | 462 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
463 | 463 | $this->Form->append($item); |
464 | 464 | } |
@@ -470,11 +470,11 @@ discard block |
||
470 | 470 | * @param array $attributes |
471 | 471 | * @return $this |
472 | 472 | */ |
473 | - public function addSelect($label,array $options = [],$attributes=[]) |
|
473 | + public function addSelect($label, array $options = [], $attributes = []) |
|
474 | 474 | { |
475 | - if($this->Form instanceof form) |
|
475 | + if ($this->Form instanceof form) |
|
476 | 476 | { |
477 | - $item = new Select($label,$options,$attributes); |
|
477 | + $item = new Select($label, $options, $attributes); |
|
478 | 478 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
479 | 479 | $this->Form->append($item); |
480 | 480 | } |
@@ -485,11 +485,11 @@ discard block |
||
485 | 485 | * @param array $attributes |
486 | 486 | * @return $this |
487 | 487 | */ |
488 | - public function addSubmit($label,$attributes=[]) |
|
488 | + public function addSubmit($label, $attributes = []) |
|
489 | 489 | { |
490 | - if($this->Form instanceof form) |
|
490 | + if ($this->Form instanceof form) |
|
491 | 491 | { |
492 | - $item = new Submit($label,$attributes); |
|
492 | + $item = new Submit($label, $attributes); |
|
493 | 493 | $this->Form->append($item); |
494 | 494 | } |
495 | 495 | return $this; |
@@ -500,11 +500,11 @@ discard block |
||
500 | 500 | * @param array $attributes |
501 | 501 | * @return $this |
502 | 502 | */ |
503 | - public function addText($label,$attributes=[]) |
|
503 | + public function addText($label, $attributes = []) |
|
504 | 504 | { |
505 | - if($this->Form instanceof form) |
|
505 | + if ($this->Form instanceof form) |
|
506 | 506 | { |
507 | - $item = new Text($label,$attributes); |
|
507 | + $item = new Text($label, $attributes); |
|
508 | 508 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
509 | 509 | $this->Form->append($item); |
510 | 510 | } |
@@ -516,11 +516,11 @@ discard block |
||
516 | 516 | * @param array $attributes |
517 | 517 | * @return $this |
518 | 518 | */ |
519 | - public function addTextarea($label,$attributes=[]) |
|
519 | + public function addTextarea($label, $attributes = []) |
|
520 | 520 | { |
521 | - if($this->Form instanceof form) |
|
521 | + if ($this->Form instanceof form) |
|
522 | 522 | { |
523 | - $item = new Textarea($label,$attributes); |
|
523 | + $item = new Textarea($label, $attributes); |
|
524 | 524 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
525 | 525 | $this->Form->append($item); |
526 | 526 | } |
@@ -532,11 +532,11 @@ discard block |
||
532 | 532 | * @param array $attributes |
533 | 533 | * @return $this |
534 | 534 | */ |
535 | - public function addTime($label,$attributes=[]) |
|
535 | + public function addTime($label, $attributes = []) |
|
536 | 536 | { |
537 | - if($this->Form instanceof form) |
|
537 | + if ($this->Form instanceof form) |
|
538 | 538 | { |
539 | - $item = new Time($label,$attributes); |
|
539 | + $item = new Time($label, $attributes); |
|
540 | 540 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
541 | 541 | $this->Form->append($item); |
542 | 542 | } |
@@ -548,11 +548,11 @@ discard block |
||
548 | 548 | * @param array $attributes |
549 | 549 | * @return $this |
550 | 550 | */ |
551 | - public function addUrl($label,$attributes=[]) |
|
551 | + public function addUrl($label, $attributes = []) |
|
552 | 552 | { |
553 | - if($this->Form instanceof form) |
|
553 | + if ($this->Form instanceof form) |
|
554 | 554 | { |
555 | - $item = new Url($label,$attributes); |
|
555 | + $item = new Url($label, $attributes); |
|
556 | 556 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
557 | 557 | $this->Form->append($item); |
558 | 558 | } |
@@ -564,12 +564,12 @@ discard block |
||
564 | 564 | * @param array $attributes |
565 | 565 | * @return $this |
566 | 566 | */ |
567 | - public function addVideo($label,$attributes=[]) |
|
567 | + public function addVideo($label, $attributes = []) |
|
568 | 568 | { |
569 | - if($this->Form instanceof form) |
|
569 | + if ($this->Form instanceof form) |
|
570 | 570 | { |
571 | - $item = new Video($label,$attributes); |
|
572 | - $this->Form->Attributes()->set('enctype','multipart/form-data'); |
|
571 | + $item = new Video($label, $attributes); |
|
572 | + $this->Form->Attributes()->set('enctype', 'multipart/form-data'); |
|
573 | 573 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
574 | 574 | $this->Form->append($item); |
575 | 575 | } |
@@ -580,11 +580,11 @@ discard block |
||
580 | 580 | * @param array $attributes |
581 | 581 | * @return $this |
582 | 582 | */ |
583 | - public function addWeek($label,$attributes=[]) |
|
583 | + public function addWeek($label, $attributes = []) |
|
584 | 584 | { |
585 | - if($this->Form instanceof form) |
|
585 | + if ($this->Form instanceof form) |
|
586 | 586 | { |
587 | - $item = new Week($label,$attributes); |
|
587 | + $item = new Week($label, $attributes); |
|
588 | 588 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
589 | 589 | $this->Form->append($item); |
590 | 590 | } |
@@ -596,11 +596,11 @@ discard block |
||
596 | 596 | * @param array $attributes |
597 | 597 | * @return $this |
598 | 598 | */ |
599 | - public function addYesNo($label,$attributes=[]) |
|
599 | + public function addYesNo($label, $attributes = []) |
|
600 | 600 | { |
601 | - if($this->Form instanceof form) |
|
601 | + if ($this->Form instanceof form) |
|
602 | 602 | { |
603 | - $item = new YesNo($label,$attributes); |
|
603 | + $item = new YesNo($label, $attributes); |
|
604 | 604 | $item->Attributes()->set('value', $this->getDefaultValue($item)); |
605 | 605 | $this->Form->append($item); |
606 | 606 | } |
@@ -610,16 +610,16 @@ discard block |
||
610 | 610 | * @param bool $print |
611 | 611 | * @return null|string |
612 | 612 | */ |
613 | - public function Close($print=true) |
|
613 | + public function Close($print = true) |
|
614 | 614 | { |
615 | 615 | $html = null; |
616 | 616 | if ($this->Form instanceof form) |
617 | 617 | { |
618 | - if($this->Fieldset instanceof fieldsetGenerator) |
|
618 | + if ($this->Fieldset instanceof fieldsetGenerator) |
|
619 | 619 | $this->Form->append($this->Fieldset->Close()); |
620 | 620 | $html = $this->Form->RenderHtml(); |
621 | 621 | $this->Form = null; |
622 | - if($print) |
|
622 | + if ($print) |
|
623 | 623 | print_r($html); |
624 | 624 | } |
625 | 625 | return $html; |
@@ -636,11 +636,11 @@ discard block |
||
636 | 636 | * @param $default |
637 | 637 | * @return mixed |
638 | 638 | */ |
639 | - private function getDefaultValue(FormElement $element,$default=null) |
|
639 | + private function getDefaultValue(FormElement $element, $default = null) |
|
640 | 640 | { |
641 | 641 | $name = $element->Attributes()->get('name'); |
642 | 642 | $method = strtoupper($this->Request->getMethod()); |
643 | - switch($method){ |
|
643 | + switch ($method) { |
|
644 | 644 | case 'POST': |
645 | 645 | case 'PUT': |
646 | 646 | case 'DELETE': |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | $Request = $this->Request->query; |
652 | 652 | break; |
653 | 653 | } |
654 | - if(!$value = $Request->get($name, $default)) |
|
654 | + if (!$value = $Request->get($name, $default)) |
|
655 | 655 | $value = $element->Attributes()->get('value', $default); |
656 | 656 | return $value; |
657 | 657 | } |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | */ |
662 | 662 | public function Open($attributes = []) |
663 | 663 | { |
664 | - if($this->Form instanceof form) |
|
664 | + if ($this->Form instanceof form) |
|
665 | 665 | $this->Close(); |
666 | 666 | $this->Form = new form($attributes); |
667 | 667 | return $this; |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function __construct($attributes) |
27 | 27 | { |
28 | - if(!$attributes instanceof AttributesBuilder) |
|
29 | - $attributes = new AttributesBuilder($attributes); |
|
28 | + if (!$attributes instanceof AttributesBuilder) |
|
29 | + $attributes = new AttributesBuilder($attributes); |
|
30 | 30 | $this->attributes = $attributes; |
31 | - if($this->attributes->has('legend')) |
|
31 | + if ($this->attributes->has('legend')) |
|
32 | 32 | { |
33 | 33 | $this->attributes->Ignore('legend'); |
34 | 34 | $this->legend = $this->attributes->get('legend'); |
35 | - if($this->attributes->has('legend-attributes')) |
|
35 | + if ($this->attributes->has('legend-attributes')) |
|
36 | 36 | { |
37 | 37 | $this->attributes->Ignore('legend-attributes'); |
38 | 38 | $this->legendAttributes = new AttributesBuilder($this->attributes->get('legend-attributes')); |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | $html = '<fieldset'; |
56 | 56 | $html .= $this->attributes->RenderHtml(); |
57 | 57 | $html .= '>'; |
58 | - if($this->legend) |
|
58 | + if ($this->legend) |
|
59 | 59 | { |
60 | 60 | $html .= '<legend'; |
61 | - if($this->legendAttributes instanceof AttributesBuilder) |
|
61 | + if ($this->legendAttributes instanceof AttributesBuilder) |
|
62 | 62 | $html .= $this->legendAttributes->RenderHtml(); |
63 | 63 | $html .= '>'; |
64 | 64 | $html .= $this->legend; |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function Close() |
75 | 75 | { |
76 | - $html = ''; |
|
77 | - if($this->isOpened) |
|
76 | + $html = ''; |
|
77 | + if ($this->isOpened) |
|
78 | 78 | $html .= '</fieldset>'; |
79 | 79 | return $html; |
80 | 80 | } |
@@ -25,8 +25,9 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function __construct($attributes) |
27 | 27 | { |
28 | - if(!$attributes instanceof AttributesBuilder) |
|
29 | - $attributes = new AttributesBuilder($attributes); |
|
28 | + if(!$attributes instanceof AttributesBuilder) { |
|
29 | + $attributes = new AttributesBuilder($attributes); |
|
30 | + } |
|
30 | 31 | $this->attributes = $attributes; |
31 | 32 | if($this->attributes->has('legend')) |
32 | 33 | { |
@@ -58,8 +59,9 @@ discard block |
||
58 | 59 | if($this->legend) |
59 | 60 | { |
60 | 61 | $html .= '<legend'; |
61 | - if($this->legendAttributes instanceof AttributesBuilder) |
|
62 | - $html .= $this->legendAttributes->RenderHtml(); |
|
62 | + if($this->legendAttributes instanceof AttributesBuilder) { |
|
63 | + $html .= $this->legendAttributes->RenderHtml(); |
|
64 | + } |
|
63 | 65 | $html .= '>'; |
64 | 66 | $html .= $this->legend; |
65 | 67 | $html .= '</legend>'; |
@@ -74,8 +76,9 @@ discard block |
||
74 | 76 | public function Close() |
75 | 77 | { |
76 | 78 | $html = ''; |
77 | - if($this->isOpened) |
|
78 | - $html .= '</fieldset>'; |
|
79 | + if($this->isOpened) { |
|
80 | + $html .= '</fieldset>'; |
|
81 | + } |
|
79 | 82 | return $html; |
80 | 83 | } |
81 | 84 |
@@ -24,13 +24,13 @@ discard block |
||
24 | 24 | * @param string $item |
25 | 25 | * @param AttributesBuilder|array $attributes |
26 | 26 | */ |
27 | - public function __construct(string $item, $attributes=[]) |
|
27 | + public function __construct(string $item, $attributes = []) |
|
28 | 28 | { |
29 | 29 | $this->item = $item; |
30 | - if(!$attributes instanceof AttributesBuilder) |
|
31 | - $attributes = new AttributesBuilder($attributes); |
|
30 | + if (!$attributes instanceof AttributesBuilder) |
|
31 | + $attributes = new AttributesBuilder($attributes); |
|
32 | 32 | $this->attributes = $attributes; |
33 | - $this->attributes->set('type','label'); |
|
33 | + $this->attributes->set('type', 'label'); |
|
34 | 34 | return $this; |
35 | 35 | } |
36 | 36 | |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | public function getItemID() |
57 | 57 | { |
58 | 58 | |
59 | - if(!$this->attributes->has('for')) |
|
59 | + if (!$this->attributes->has('for')) |
|
60 | 60 | { |
61 | 61 | $this->attributes->createElementID($this->item); |
62 | 62 | $id = $this->attributes->get('id'); |
63 | - $this->attributes->set('for',$id); |
|
63 | + $this->attributes->set('for', $id); |
|
64 | 64 | return $id; |
65 | 65 | } |
66 | 66 | return $this->attributes->get('for'); |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function RenderHtml() |
72 | 72 | { |
73 | - $this->attributes->Ignore(['id','label','type']); |
|
74 | - $label = null; |
|
73 | + $this->attributes->Ignore(['id', 'label', 'type']); |
|
74 | + $label = null; |
|
75 | 75 | $type = $this->attributes->get('fieldtype'); |
76 | - $this->attributes->set('for',$this->attributes->get('for',$this->attributes->get('id'))); |
|
76 | + $this->attributes->set('for', $this->attributes->get('for', $this->attributes->get('id'))); |
|
77 | 77 | switch ($type): |
78 | 78 | case 'hidden': |
79 | 79 | case 'submit': |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | break; |
83 | 83 | default: |
84 | 84 | $label .= '<label'.$this->attributes->RenderHtml().'>'; |
85 | - $label .= htmlspecialchars(trim($this->item,': '),ENT_COMPAT,'UTF-8'); |
|
85 | + $label .= htmlspecialchars(trim($this->item, ': '), ENT_COMPAT, 'UTF-8'); |
|
86 | 86 | // $label .= $this->RenderErrors($label); |
87 | 87 | $label .= ': </label>'; |
88 | 88 | break; |
@@ -27,8 +27,9 @@ |
||
27 | 27 | public function __construct(string $item, $attributes=[]) |
28 | 28 | { |
29 | 29 | $this->item = $item; |
30 | - if(!$attributes instanceof AttributesBuilder) |
|
31 | - $attributes = new AttributesBuilder($attributes); |
|
30 | + if(!$attributes instanceof AttributesBuilder) { |
|
31 | + $attributes = new AttributesBuilder($attributes); |
|
32 | + } |
|
32 | 33 | $this->attributes = $attributes; |
33 | 34 | $this->attributes->set('type','label'); |
34 | 35 | return $this; |
@@ -11,25 +11,25 @@ discard block |
||
11 | 11 | |
12 | 12 | class AttributesMapper |
13 | 13 | { |
14 | - const COMMON = ['accesskey','class','contenteditable', 'contextmenu','dir','draggable','dropzone','hidden','id','lang','spellcheck','style','tabindex','title','translate']; |
|
15 | - const EVENTS = ['onblur','onchange','oncontextmenu','onfocus','oninput','oninvalid','onreset','onsearch','onselect','onsubmit','onkeydown','onkeypress','onkeyup','onclick','ondblclick','ondrag','ondragend','ondragenter','ondragleave','ondragover','ondragstart','ondrop','onmousedown','onmousemove','onmouseout','onmouseover','onmouseup','onmousewheel','onscroll','onwheel']; |
|
16 | - const BUTTON = ['autofocus','disabled','form','formaction','formenctype','formmethod','formnovalidate','formtarget','framename','name','type','value']; |
|
17 | - const CHECKBOX = ['autofocus','checked','defaultChecked','defaultvalue','disabled','form','indeterminate','name','required','type','value']; |
|
18 | - const COLOR = ['autocomplete','autofocus','defaultvalue','disabled','form','list','name','type','value']; |
|
19 | - const DATE = ['autocomplete','autofocus','defaultvalue','disabled','form','list','max','min','name','readonly','required','step','type','value']; |
|
20 | - const FIELDSET = ['disabled','form','name','legend','legend-attributes']; |
|
21 | - const FILE = ['accept','autofocus','defaultvalue','disabled','files','form','multiple','name','required','type','value', 'data-max-size']; |
|
22 | - const FORM = ['accept','accept-charset','action','autocomplete','enctype','method','name','novalidate','target']; |
|
23 | - const HIDDEN = ['form','name','type','value']; |
|
24 | - const IMAGE = ['alt','autofocus','defaultvalue','disabled','form','formaction','formenctype','formmethod','formnovalidate','formtarget','height','name','src','type','value','width']; |
|
25 | - const LABEL = ['for','form']; |
|
26 | - const OPTGROUP = ['disabled','label']; |
|
27 | - const OPTION = ['disabled','label','value','selected']; |
|
28 | - const RANGE = ['autocomplete','autofocus','defaultvalue','disabled','form','list','max','min','name','step','type','value']; |
|
29 | - const RESET = ['autofocus','defaultvalue','disabled','form','name','type','value']; |
|
30 | - const SELECT = ['autofocus','disabled','form','multiple','name','required','size','selected','optgroup-attributes','option-attributes','value']; |
|
31 | - const TEXT = ['autocomplete','autofocus','defaultvalue','disabled','form','list','minlength','maxlength','name','pattern','placeholder','readonly','required','size','type','value']; |
|
32 | - const TEXTAREA = ['autofocus','cols','dirname','disabled','form','maxlength','name','placeholder','readonly','required','rows','wrap','value']; |
|
14 | + const COMMON = ['accesskey', 'class', 'contenteditable', 'contextmenu', 'dir', 'draggable', 'dropzone', 'hidden', 'id', 'lang', 'spellcheck', 'style', 'tabindex', 'title', 'translate']; |
|
15 | + const EVENTS = ['onblur', 'onchange', 'oncontextmenu', 'onfocus', 'oninput', 'oninvalid', 'onreset', 'onsearch', 'onselect', 'onsubmit', 'onkeydown', 'onkeypress', 'onkeyup', 'onclick', 'ondblclick', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onscroll', 'onwheel']; |
|
16 | + const BUTTON = ['autofocus', 'disabled', 'form', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget', 'framename', 'name', 'type', 'value']; |
|
17 | + const CHECKBOX = ['autofocus', 'checked', 'defaultChecked', 'defaultvalue', 'disabled', 'form', 'indeterminate', 'name', 'required', 'type', 'value']; |
|
18 | + const COLOR = ['autocomplete', 'autofocus', 'defaultvalue', 'disabled', 'form', 'list', 'name', 'type', 'value']; |
|
19 | + const DATE = ['autocomplete', 'autofocus', 'defaultvalue', 'disabled', 'form', 'list', 'max', 'min', 'name', 'readonly', 'required', 'step', 'type', 'value']; |
|
20 | + const FIELDSET = ['disabled', 'form', 'name', 'legend', 'legend-attributes']; |
|
21 | + const FILE = ['accept', 'autofocus', 'defaultvalue', 'disabled', 'files', 'form', 'multiple', 'name', 'required', 'type', 'value', 'data-max-size']; |
|
22 | + const FORM = ['accept', 'accept-charset', 'action', 'autocomplete', 'enctype', 'method', 'name', 'novalidate', 'target']; |
|
23 | + const HIDDEN = ['form', 'name', 'type', 'value']; |
|
24 | + const IMAGE = ['alt', 'autofocus', 'defaultvalue', 'disabled', 'form', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget', 'height', 'name', 'src', 'type', 'value', 'width']; |
|
25 | + const LABEL = ['for', 'form']; |
|
26 | + const OPTGROUP = ['disabled', 'label']; |
|
27 | + const OPTION = ['disabled', 'label', 'value', 'selected']; |
|
28 | + const RANGE = ['autocomplete', 'autofocus', 'defaultvalue', 'disabled', 'form', 'list', 'max', 'min', 'name', 'step', 'type', 'value']; |
|
29 | + const RESET = ['autofocus', 'defaultvalue', 'disabled', 'form', 'name', 'type', 'value']; |
|
30 | + const SELECT = ['autofocus', 'disabled', 'form', 'multiple', 'name', 'required', 'size', 'selected', 'optgroup-attributes', 'option-attributes', 'value']; |
|
31 | + const TEXT = ['autocomplete', 'autofocus', 'defaultvalue', 'disabled', 'form', 'list', 'minlength', 'maxlength', 'name', 'pattern', 'placeholder', 'readonly', 'required', 'size', 'type', 'value']; |
|
32 | + const TEXTAREA = ['autofocus', 'cols', 'dirname', 'disabled', 'form', 'maxlength', 'name', 'placeholder', 'readonly', 'required', 'rows', 'wrap', 'value']; |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * @param AttributesBuilder $Attributes |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public static function filter(AttributesBuilder $Attributes) |
39 | 39 | { |
40 | - $aAttributes = array_change_key_case($Attributes->All(),CASE_LOWER); |
|
41 | - $Type = $Attributes->get('type','text'); |
|
40 | + $aAttributes = array_change_key_case($Attributes->All(), CASE_LOWER); |
|
41 | + $Type = $Attributes->get('type', 'text'); |
|
42 | 42 | $AcceptedAttributes = array_merge(self::EVENTS, self::COMMON); |
43 | 43 | switch ($Type): |
44 | 44 | case 'date': |
@@ -48,28 +48,28 @@ discard block |
||
48 | 48 | case 'number': |
49 | 49 | case 'time': |
50 | 50 | case 'week': |
51 | - if($Type === 'number') $AcceptedAttributes[]='placeholder'; |
|
52 | - $AcceptedAttributes = array_merge($AcceptedAttributes,self::DATE); |
|
51 | + if ($Type === 'number') $AcceptedAttributes[] = 'placeholder'; |
|
52 | + $AcceptedAttributes = array_merge($AcceptedAttributes, self::DATE); |
|
53 | 53 | break; |
54 | 54 | case 'color': |
55 | 55 | $AcceptedAttributes = array_merge($AcceptedAttributes, self::COLOR); |
56 | 56 | break; |
57 | 57 | case 'file': |
58 | - $AcceptedAttributes = array_merge($AcceptedAttributes,self::FILE); |
|
58 | + $AcceptedAttributes = array_merge($AcceptedAttributes, self::FILE); |
|
59 | 59 | break; |
60 | 60 | case 'image': |
61 | 61 | case 'video': |
62 | - $AcceptedAttributes = array_merge($AcceptedAttributes,self::IMAGE); |
|
62 | + $AcceptedAttributes = array_merge($AcceptedAttributes, self::IMAGE); |
|
63 | 63 | break; |
64 | 64 | case 'radio': |
65 | 65 | case 'checkbox': |
66 | - $tmpAttributesList=self::CHECKBOX; |
|
67 | - if($Type === 'radio') |
|
66 | + $tmpAttributesList = self::CHECKBOX; |
|
67 | + if ($Type === 'radio') |
|
68 | 68 | { |
69 | - $bannedIndex = array_search('indeterminate', $tmpAttributesList,true); |
|
70 | - if(isset($tmpAttributesList[$bannedIndex])) unset($tmpAttributesList[$bannedIndex]); |
|
69 | + $bannedIndex = array_search('indeterminate', $tmpAttributesList, true); |
|
70 | + if (isset($tmpAttributesList[$bannedIndex])) unset($tmpAttributesList[$bannedIndex]); |
|
71 | 71 | } |
72 | - $AcceptedAttributes = array_merge($AcceptedAttributes,array_values($tmpAttributesList)); |
|
72 | + $AcceptedAttributes = array_merge($AcceptedAttributes, array_values($tmpAttributesList)); |
|
73 | 73 | break; |
74 | 74 | |
75 | 75 | case 'submit': |
@@ -78,61 +78,61 @@ discard block |
||
78 | 78 | break; |
79 | 79 | |
80 | 80 | case 'reset': |
81 | - $AcceptedAttributes = array_merge($AcceptedAttributes,self::RESET); |
|
81 | + $AcceptedAttributes = array_merge($AcceptedAttributes, self::RESET); |
|
82 | 82 | break; |
83 | 83 | case 'range': |
84 | - $AcceptedAttributes = array_merge($AcceptedAttributes,self::RANGE); |
|
84 | + $AcceptedAttributes = array_merge($AcceptedAttributes, self::RANGE); |
|
85 | 85 | break; |
86 | 86 | case 'textarea': |
87 | - $AcceptedAttributes = array_merge($AcceptedAttributes,self::TEXTAREA); |
|
87 | + $AcceptedAttributes = array_merge($AcceptedAttributes, self::TEXTAREA); |
|
88 | 88 | break; |
89 | 89 | case 'optgroup': |
90 | - $AcceptedAttributes = array_merge($AcceptedAttributes,self::OPTGROUP); |
|
90 | + $AcceptedAttributes = array_merge($AcceptedAttributes, self::OPTGROUP); |
|
91 | 91 | break; |
92 | 92 | case 'option': |
93 | - $AcceptedAttributes = array_merge($AcceptedAttributes,self::OPTION); |
|
93 | + $AcceptedAttributes = array_merge($AcceptedAttributes, self::OPTION); |
|
94 | 94 | break; |
95 | 95 | case 'label': |
96 | - $AcceptedAttributes = array_merge($AcceptedAttributes,self::LABEL); |
|
96 | + $AcceptedAttributes = array_merge($AcceptedAttributes, self::LABEL); |
|
97 | 97 | break; |
98 | 98 | case 'select': |
99 | - $AcceptedAttributes[]='placeholder'; |
|
100 | - $AcceptedAttributes = array_merge($AcceptedAttributes,self::SELECT); |
|
99 | + $AcceptedAttributes[] = 'placeholder'; |
|
100 | + $AcceptedAttributes = array_merge($AcceptedAttributes, self::SELECT); |
|
101 | 101 | break; |
102 | 102 | case 'form': |
103 | - $AcceptedAttributes = array_merge($AcceptedAttributes,self::FORM); |
|
103 | + $AcceptedAttributes = array_merge($AcceptedAttributes, self::FORM); |
|
104 | 104 | break; |
105 | 105 | case 'fieldset': |
106 | - $AcceptedAttributes = array_merge($AcceptedAttributes,self::FIELDSET); |
|
106 | + $AcceptedAttributes = array_merge($AcceptedAttributes, self::FIELDSET); |
|
107 | 107 | break; |
108 | 108 | case 'hidden': |
109 | - $AcceptedAttributes = array_merge($AcceptedAttributes,self::HIDDEN); |
|
109 | + $AcceptedAttributes = array_merge($AcceptedAttributes, self::HIDDEN); |
|
110 | 110 | break; |
111 | 111 | default: |
112 | - if($Type === 'email') $AcceptedAttributes[]='multiple'; |
|
113 | - $AcceptedAttributes = array_merge($AcceptedAttributes,self::TEXT); |
|
112 | + if ($Type === 'email') $AcceptedAttributes[] = 'multiple'; |
|
113 | + $AcceptedAttributes = array_merge($AcceptedAttributes, self::TEXT); |
|
114 | 114 | break; |
115 | 115 | endswitch; |
116 | 116 | |
117 | 117 | $AcceptedAttributes = array_unique($AcceptedAttributes); |
118 | 118 | $attributesKeys = array_keys($aAttributes); |
119 | - $ignore = array_diff($attributesKeys,$AcceptedAttributes); |
|
119 | + $ignore = array_diff($attributesKeys, $AcceptedAttributes); |
|
120 | 120 | foreach ($ignore as $key=>$attribute) |
121 | 121 | { |
122 | - if(is_numeric($attribute)) |
|
122 | + if (is_numeric($attribute)) |
|
123 | 123 | { |
124 | 124 | unset($ignore[$key]); |
125 | 125 | $attribute = $aAttributes[$attribute]; |
126 | 126 | $ignore[$key] = $attribute; |
127 | 127 | } |
128 | - if(substr($attribute,0,5)==='data-') |
|
128 | + if (substr($attribute, 0, 5) === 'data-') |
|
129 | 129 | { |
130 | 130 | $AcceptedAttributes[] += $attribute; |
131 | 131 | unset($ignore[$key]); |
132 | 132 | continue; |
133 | 133 | } |
134 | 134 | } |
135 | - if($ignore) $Attributes->Ignore($ignore); |
|
135 | + if ($ignore) $Attributes->Ignore($ignore); |
|
136 | 136 | return $ignore; |
137 | 137 | } |
138 | 138 | } |
139 | 139 | \ No newline at end of file |
@@ -48,7 +48,9 @@ discard block |
||
48 | 48 | case 'number': |
49 | 49 | case 'time': |
50 | 50 | case 'week': |
51 | - if($Type === 'number') $AcceptedAttributes[]='placeholder'; |
|
51 | + if($Type === 'number') { |
|
52 | + $AcceptedAttributes[]='placeholder'; |
|
53 | + } |
|
52 | 54 | $AcceptedAttributes = array_merge($AcceptedAttributes,self::DATE); |
53 | 55 | break; |
54 | 56 | case 'color': |
@@ -67,7 +69,9 @@ discard block |
||
67 | 69 | if($Type === 'radio') |
68 | 70 | { |
69 | 71 | $bannedIndex = array_search('indeterminate', $tmpAttributesList,true); |
70 | - if(isset($tmpAttributesList[$bannedIndex])) unset($tmpAttributesList[$bannedIndex]); |
|
72 | + if(isset($tmpAttributesList[$bannedIndex])) { |
|
73 | + unset($tmpAttributesList[$bannedIndex]); |
|
74 | + } |
|
71 | 75 | } |
72 | 76 | $AcceptedAttributes = array_merge($AcceptedAttributes,array_values($tmpAttributesList)); |
73 | 77 | break; |
@@ -109,7 +113,9 @@ discard block |
||
109 | 113 | $AcceptedAttributes = array_merge($AcceptedAttributes,self::HIDDEN); |
110 | 114 | break; |
111 | 115 | default: |
112 | - if($Type === 'email') $AcceptedAttributes[]='multiple'; |
|
116 | + if($Type === 'email') { |
|
117 | + $AcceptedAttributes[]='multiple'; |
|
118 | + } |
|
113 | 119 | $AcceptedAttributes = array_merge($AcceptedAttributes,self::TEXT); |
114 | 120 | break; |
115 | 121 | endswitch; |
@@ -132,7 +138,9 @@ discard block |
||
132 | 138 | continue; |
133 | 139 | } |
134 | 140 | } |
135 | - if($ignore) $Attributes->Ignore($ignore); |
|
141 | + if($ignore) { |
|
142 | + $Attributes->Ignore($ignore); |
|
143 | + } |
|
136 | 144 | return $ignore; |
137 | 145 | } |
138 | 146 | } |
139 | 147 | \ No newline at end of file |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | */ |
18 | 18 | private function normalize($keys) |
19 | 19 | { |
20 | - if(is_array($keys)) return false; |
|
21 | - foreach (array(' ', ' ', '\n', '\t', '\r', '"','\'','_') as $strip) |
|
20 | + if (is_array($keys)) return false; |
|
21 | + foreach (array(' ', ' ', '\n', '\t', '\r', '"', '\'', '_') as $strip) |
|
22 | 22 | $keys = str_replace($strip, '', (string) $keys); |
23 | 23 | $keys = trim(preg_replace('/\W+/', '-', $keys), '-'); |
24 | - $keys = strtolower(str_ireplace('input','',$keys)); |
|
24 | + $keys = strtolower(str_ireplace('input', '', $keys)); |
|
25 | 25 | return $keys; |
26 | 26 | } |
27 | 27 | |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | * @param array $array |
31 | 31 | * @return array |
32 | 32 | */ |
33 | - private function array_map_keys (callable $callable, array $array) : array |
|
33 | + private function array_map_keys(callable $callable, array $array) : array |
|
34 | 34 | { |
35 | 35 | $map = []; |
36 | 36 | foreach ($array as $key => $value) |
37 | 37 | { |
38 | - $key = call_user_func($callable,$key); |
|
38 | + $key = call_user_func($callable, $key); |
|
39 | 39 | $map[$key] = $value; |
40 | 40 | } |
41 | 41 | return $map; |
@@ -17,9 +17,12 @@ |
||
17 | 17 | */ |
18 | 18 | private function normalize($keys) |
19 | 19 | { |
20 | - if(is_array($keys)) return false; |
|
21 | - foreach (array(' ', ' ', '\n', '\t', '\r', '"','\'','_') as $strip) |
|
22 | - $keys = str_replace($strip, '', (string) $keys); |
|
20 | + if(is_array($keys)) { |
|
21 | + return false; |
|
22 | + } |
|
23 | + foreach (array(' ', ' ', '\n', '\t', '\r', '"','\'','_') as $strip) { |
|
24 | + $keys = str_replace($strip, '', (string) $keys); |
|
25 | + } |
|
23 | 26 | $keys = trim(preg_replace('/\W+/', '-', $keys), '-'); |
24 | 27 | $keys = strtolower(str_ireplace('input','',$keys)); |
25 | 28 | return $keys; |
@@ -12,40 +12,40 @@ |
||
12 | 12 | interface FormGeneratorInterface |
13 | 13 | { |
14 | 14 | /* COMMON METHODS */ |
15 | - public function Open($attributes=[]); |
|
15 | + public function Open($attributes = []); |
|
16 | 16 | public function Close(); |
17 | - public function addFieldset($attributes=[]); |
|
17 | + public function addFieldset($attributes = []); |
|
18 | 18 | |
19 | 19 | /* INPUT TYPES */ |
20 | - public function addAudio($label,$attributes=[]); |
|
21 | - public function addButton($label,$attributes=[]); |
|
22 | - public function addCaptcha($label,$attributes=[]); |
|
23 | - public function addCheckbox($label,$options=[],$attributes=[]); |
|
24 | - public function addColor($label,$attributes=[]); |
|
25 | - public function addCountry($label,$attributes=[]); |
|
26 | - public function addDate($label,$attributes=[]); |
|
27 | - public function addDatetime($label,$attributes=[]); |
|
28 | - public function addDatetimeLocal($label,$attributes=[]); |
|
29 | - public function addEmail($label,$attributes=[]); |
|
30 | - public function addFile($label,$attributes=[]); |
|
31 | - public function addHidden($label,$attributes=[]); |
|
32 | - public function addImage($label,$attributes=[]); |
|
33 | - public function addMonth($label,$attributes=[]); |
|
34 | - public function addNumber($label,$attributes=[]); |
|
35 | - public function addPassword($label,$attributes=[]); |
|
36 | - public function addPhone($label,$attributes=[]); |
|
37 | - public function addRadio($label,$options=[],$attributes=[]); |
|
38 | - public function addRange($label,$attributes=[]); |
|
39 | - public function addReset($label,$attributes=[]); |
|
40 | - public function addSearch($label,$attributes=[]); |
|
41 | - public function addSelect($label,$options=[],$attributes=[]); |
|
42 | - public function addSubmit($label,$attributes=[]); |
|
43 | - public function addText($label,$attributes=[]); |
|
44 | - public function addTextarea($label,$attributes=[]); |
|
45 | - public function addTextEditor($label,$attributes=[]); |
|
46 | - public function addTime($label,$attributes=[]); |
|
47 | - public function addUrl($label,$attributes=[]); |
|
48 | - public function addVideo($label,$attributes=[]); |
|
49 | - public function addWeek($label,$attributes=[]); |
|
50 | - public function addYesNo($label,$attributes=[]); |
|
20 | + public function addAudio($label, $attributes = []); |
|
21 | + public function addButton($label, $attributes = []); |
|
22 | + public function addCaptcha($label, $attributes = []); |
|
23 | + public function addCheckbox($label, $options = [], $attributes = []); |
|
24 | + public function addColor($label, $attributes = []); |
|
25 | + public function addCountry($label, $attributes = []); |
|
26 | + public function addDate($label, $attributes = []); |
|
27 | + public function addDatetime($label, $attributes = []); |
|
28 | + public function addDatetimeLocal($label, $attributes = []); |
|
29 | + public function addEmail($label, $attributes = []); |
|
30 | + public function addFile($label, $attributes = []); |
|
31 | + public function addHidden($label, $attributes = []); |
|
32 | + public function addImage($label, $attributes = []); |
|
33 | + public function addMonth($label, $attributes = []); |
|
34 | + public function addNumber($label, $attributes = []); |
|
35 | + public function addPassword($label, $attributes = []); |
|
36 | + public function addPhone($label, $attributes = []); |
|
37 | + public function addRadio($label, $options = [], $attributes = []); |
|
38 | + public function addRange($label, $attributes = []); |
|
39 | + public function addReset($label, $attributes = []); |
|
40 | + public function addSearch($label, $attributes = []); |
|
41 | + public function addSelect($label, $options = [], $attributes = []); |
|
42 | + public function addSubmit($label, $attributes = []); |
|
43 | + public function addText($label, $attributes = []); |
|
44 | + public function addTextarea($label, $attributes = []); |
|
45 | + public function addTextEditor($label, $attributes = []); |
|
46 | + public function addTime($label, $attributes = []); |
|
47 | + public function addUrl($label, $attributes = []); |
|
48 | + public function addVideo($label, $attributes = []); |
|
49 | + public function addWeek($label, $attributes = []); |
|
50 | + public function addYesNo($label, $attributes = []); |
|
51 | 51 | } |
52 | 52 | \ No newline at end of file |
@@ -52,7 +52,7 @@ |
||
52 | 52 | * @param $value |
53 | 53 | * @return $this |
54 | 54 | */ |
55 | - public function set($key,$value); |
|
55 | + public function set($key, $value); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * @return array |