-
-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathtxplib_forms.php
More file actions
800 lines (682 loc) · 22.7 KB
/
txplib_forms.php
File metadata and controls
800 lines (682 loc) · 22.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
<?php
/*
* Textpattern Content Management System
* https://textpattern.com/
*
* Copyright (C) 2026 The Textpattern Development Team
*
* This file is part of Textpattern.
*
* Textpattern is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, version 2.
*
* Textpattern is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Textpattern. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Collection of HTML form widgets.
*
* @package Form
*/
/**
* Generates a radio button toggle.
*
* @param array $values The values as an array
* @param string $field The field name
* @param string $checked The checked button, takes a value from $vals
* @param int $tabindex The HTML tabindex
* @param string $id The HTML id
* @return string A HTML radio button set
* @example
* echo radioSet(array(
* 'value1' => 'Label1',
* 'value2' => 'Label2',
* ), 'myInput', 'value1');
*/
function radioSet($values, $field, $checked = '', $tabindex = 0, $id = '')
{
if ($id) {
$id .= '-'.$field;
} else {
$id = $field;
}
$out = array();
foreach ((array) $values as $value => $label) {
$out[] = radio($field, $value, (string) $value === (string) $checked, $id.'-'.$value, $tabindex);
$out[] = n.tag($label, 'label', array('for' => $id.'-'.$value));
}
return join('', $out);
}
/**
* Generates a Yes/No radio button toggle.
*
* These buttons are booleans. 'Yes' will have a value of 1 and 'No' is 0.
*
* @param string $field The field name
* @param string $checked The checked button, either '1', '0'
* @param int $tabindex The HTML tabindex
* @param string $id The HTML id
* @return string HTML
* @see radioSet()
* @example
* echo form(
* 'Is this an example?'.
* yesnoRadio('is_example', 1)
* );
*/
function yesnoRadio($field, $checked = '', $tabindex = 0, $id = '')
{
$vals = array(
'0' => gTxt('no'),
'1' => gTxt('yes'),
);
return radioSet($vals, $field, $checked, $tabindex, $id);
}
/**
* Generates an On/Off radio button toggle.
*
* @param string $field The field name
* @param string $checked The checked button, either '1', '0'
* @param int $tabindex The HTML tabindex
* @param string $id The HTML id
* @return string HTML
* @see radioSet()
*/
function onoffRadio($field, $checked = '', $tabindex = 0, $id = '')
{
$vals = array(
'0' => gTxt('off'),
'1' => gTxt('on'),
);
return radioSet($vals, $field, $checked, $tabindex, $id);
}
/**
* Generates a select field.
*
* @param string $name The field
* @param array $array The values as an array array( 'value' => 'label' )
* @param mixed $value The selected option(s). If an array, renders the select multiple
* @param bool $blank_first If TRUE, prepends an empty option to the list
* @param mixed $onchange If TRUE submits the form when an option is changed. If a string, inserts it to the select tag
* @param string $select_id The HTML id
* @param bool $check_type Type-agnostic comparison
* @param bool $disabled If TRUE renders the select disabled
* @return string HTML
* @example
* echo selectInput('myInput', array(
* 'value1' => 'Label1',
* 'value2' => 'Label2',
* ));
*/
function selectInput($name = '', $array = array(), $value = '', $blank_first = false, $onchange = '', $select_id = '', $check_type = false, $disabled = false)
{
$out = array();
$selected = 0;
if (is_array($disabled)) {
$disable = $disabled;
$disabled = false;
} else {
$disable = array();
}
if ($blank_first) {
$array = (is_array($blank_first) ? $blank_first : array('' => ' ')) + $array;
}
if (!($multiple = is_array($value))) {
$value = ((string) $value === '' && !isset($array['']) ? array() : array((string) $value));
}
foreach ($array as $avalue => $alabel) {
$atts = array('value' => $avalue, 'dir' => 'auto', 'disabled' => in_array($avalue, $disable));
if (in_array((string) $avalue, $value)) {
$atts['selected'] = true;
$selected++;
}
if (is_array($alabel)) {
$atts = $alabel + $atts;
$alabel = isset($atts['title']) ? $atts['title'] : $avalue;
unset($atts['title']);
}
$atts = join_atts($atts, TEXTPATTERN_STRIP_NONE);
$out[] = '<option'.$atts.'>'.txpspecialchars($alabel).'</option>';
}
if (txpinterface === 'admin' && $selected < count($value)) {
foreach (array_diff($value, $array) as $v) {
$atts = join_atts(array('value' => $v, 'dir' => 'auto', 'selected' => true, 'disabled' => true), TEXTPATTERN_STRIP_NONE);
$out[] = '<option'.$atts.'>'.txpspecialchars(gTxt('invalid_argument')).'</option>';
}
}
$name_m = (is_array($name) ? $name['name'] : $name).($multiple ? '[]' : '');
$atts = join_atts((is_array($name) ? $name : array(
'name' => $name_m
)) + array(
'id' => $select_id,
'disabled' => (bool) $disabled,
'multiple' => $multiple
), TEXTPATTERN_STRIP_EMPTY);
if ((string) $onchange === '1') {
$atts .= ' data-submit-on="change"';
} elseif ($onchange) {
$atts .= ' '.trim($onchange);
}
return n.'<select'.$atts.'>'.n.join(n, $out).n.'</select>'.n
.($multiple ? hInput($name_m, '').n : ''); // TODO: use jQuery UI selectmenu?
}
/**
* Generates a tree structured select field.
*
* This field takes a NSTREE structure as an associative array. This is mainly
* used for categories.
*
* @param string $select_name The field
* @param array $array The values as an array
* @param string $value The selected option. Takes a value from $value
* @param string $select_id The HTML id
* @param int $truncate Truncate labels to certain length. Disabled if set <4.
* @return string HTML
* @see getTree()
*/
function treeSelectInput($select_name = '', $array = array(), $value = '', $select_id = '', $truncate = 0, $atts = array())
{
$out = array();
$doctype = get_pref('doctype');
$selected = false;
foreach ($array as $a) {
if ($a['name'] == 'root') {
continue;
}
if ((string) $a['name'] === (string) $value) {
$sel = ' selected="selected"';
$selected = true;
} else {
$sel = '';
}
$sp = str_repeat(sp.sp, $a['level']);
if (($truncate > 3) && (Txp::get('\Textpattern\Type\StringType', $a['title'])->getLength() > $truncate)) {
$htmltitle = ' title="'.txpspecialchars($a['title']).'"';
$a['title'] = preg_replace('/^(.{0,'.($truncate - 3).'}).*$/su', '$1', $a['title']);
$hellip = '…';
} else {
$htmltitle = $hellip = '';
}
$data_level = '';
if ($doctype !== 'xhtml') {
$data_level = ' data-level="'.$a['level'].'"';
}
$out[] = '<option value="'.txpspecialchars($a['name']).'"'.$htmltitle.$sel.$data_level.' dir="auto">'.$sp.txpspecialchars($a['title']).$hellip.'</option>';
}
array_unshift($out, '<option value=""'.($selected === false ? ' selected="selected"' : '').'> </option>');
return n.tag(n.join(n, $out).n, 'select', array(
'id' => $select_id,
'name' => $select_name,
) + $atts);
}
/**
* Render HTML <select> element for choosing a timezone.
*
* @param string $name Element name
* @param string $value Selected timezone
* @param bool $blank_first Add empty first option
* @param bool|string $onchange
* @param string $select_id HTML id attribute
* @return string HTML markup
* @since 4.7.0
* @todo Might be a better way of doing this, perhaps introducing optgroup to selectInput()
*/
function timezoneSelectInput($name = '', $value = '', $blank_first = '', $onchange = '', $select_id = '')
{
if ($details = Txp::get('\Textpattern\Date\Timezone')->getTimeZones()) {
$thiscontinent = false;
$selected = false;
foreach ($details as $timezone_id => $tz) {
extract($tz);
if ($value == $timezone_id) {
$selected = true;
}
if ($continent !== $thiscontinent) {
if ($thiscontinent !== false) {
$out[] = n.'</optgroup>';
}
$out[] = n.'<optgroup label="'.gTxt($continent ? $continent : 'Universal').'">';
$thiscontinent = $continent;
}
$where = gTxt(str_replace('_', ' ', $city))
.(!empty($subcity) ? '/'.gTxt(str_replace('_', ' ', $subcity)) : '')
/*."($abbr)"*/
or $where = $timezone_id;
$out[] = n.'<option value="'.txpspecialchars($timezone_id).'"'.($value == $timezone_id ? ' selected="selected"' : '').' dir="auto">'.$where.t.'</option>';
}
$out[] = n.'</optgroup>';
return n.'<select'.($select_id ? ' id="'.$select_id.'"' : '').' name="'.$name.'"'.
($onchange == 1 ? ' onchange="submit(this.form);"' : $onchange).
'>'.
($blank_first ? n.'<option value=""'.($selected == false ? ' selected="selected"' : '').'> </option>' : '').
join('', $out).
n.'</select>';
}
return '';
}
/**
* Generic form input.
*
* @param string $type The input type
* @param string $name The input name
* @param string $value The value
* @param string $class The HTML class
* @param string $title The tooltip
* @param string $onClick Inline JavaScript attached to the click event
* @param int $size The input size
* @param int $tab The HTML tabindex
* @param string $id The HTML id
* @param bool $disabled If TRUE renders the input disabled
* @param bool $required If TRUE the field is marked as required
* @param string $placeholder The placeholder value displayed when the field is empty
* @return string HTML input
* @example
* echo fInput('text', 'myInput', 'My example value');
*/
function fInput($type, $name, $value, $class = '', $title = '', $onClick = '', $size = 0, $tab = 0, $id = '', $disabled = false, $required = false, $placeholder = null)
{
$atts = (is_array($name) ? $name : array('name' => $name)) + array(
'class' => $class,
'id' => $id,
'type' => $type,
'size' => (int) $size,
'title' => $title,
'onclick' => $onClick,
'tabindex' => (int) $tab,
'disabled' => (bool) $disabled,
'required' => (bool) $required,
'placeholder' => $placeholder,
);
if ($atts['required'] && !isset($atts['placeholder'])
&& in_array($atts['type'], array('email', 'password', 'search', 'tel', 'text', 'url'))
) {
$atts['placeholder'] = gTxt('required');
}
$atts = join_atts($atts, TEXTPATTERN_STRIP_EMPTY);
if ($type != 'file' && $type != 'image') {
$atts .= join_atts(array('value' => (string) $value), TEXTPATTERN_STRIP_NONE);
}
return n.tag_void('input', $atts);
}
/**
* Hidden form input.
*
* @param string/array $name The name
* @param string $value The value
* @return string HTML input
* @example
* echo hInput('myInput', 'hidden value');
*/
function hInput($name, $value = null, $glue = ',')
{
if (!is_array($name)) {
return fInput('hidden', $name, $value);
}
return array_walk($name, function (&$v, $n, $glue) {
$v = fInput('hidden', $n, is_array($v) ? implode($glue, $v) : $v);
}, $glue) ? implode($name) : false;
}
/**
* Hidden step input.
*
* @param string $step The step
* @return string HTML input
* @see form()
* @see eInput()
* @example
* echo form(
* eInput('event').
* sInput('step')
* );
*/
function sInput($step)
{
return hInput('step', $step);
}
/**
* Hidden event input.
*
* @param string $event The event
* @return string HTML input
* @see form()
* @see sInput()
* @example
* echo form(
* eInput('event').
* sInput('step')
* );
*/
function eInput($event)
{
return hInput('event', $event);
}
/**
* Hidden form token input.
*
* @return string A hidden HTML input containing a CSRF token
* @see bouncer()
* @see form_token()
*/
function tInput()
{
return hInput('_txp_token', form_token());
}
/**
* A checkbox.
*
* @param string $name The field
* @param string $value The value
* @param bool $checked If TRUE the box is checked
* @param int $tabindex The HTML tabindex
* @param string $id The HTML id
* @param string $form The HTML form id to associate
* @return string HTML input
* @example
* echo checkbox('name', 'value', true);
*/
function checkbox($name, $value, $checked = true, $tabindex = 0, $id = '', $form = '')
{
$class = 'checkbox';
if ($checked) {
$class .= ' active';
}
$atts = join_atts(array(
'class' => $class,
'id' => $id,
'name' => $name,
'type' => 'checkbox',
'form' => $form,
'checked' => (bool) $checked,
'tabindex' => (int) $tabindex,
), TEXTPATTERN_STRIP_EMPTY);
$atts .= join_atts(array('value' => (string) $value), TEXTPATTERN_STRIP_NONE);
return n.tag_void('input', $atts);
}
/**
* A checkbox without an option to set the value.
*
* @param string $name The field
* @param bool $value If TRUE the box is checked
* @param int $tabindex The HTML tabindex
* @param string $id The HTML id
* @param string $form The HTML form id to associate
* @return string HTML input
* @access private
* @see checkbox()
*/
function checkbox2($name, $value, $tabindex = 0, $id = '', $form = '')
{
return checkbox($name, 1, $value, $tabindex, $id, $form);
}
/**
* A single radio button.
*
* @param string $name The field
* @param string $value The value
* @param bool $checked If TRUE, the button is selected
* @param string $id The HTML id
* @param int $tabindex The HTML tabindex
* @return string HTML input
*/
function radio($name, $value, $checked = true, $id = '', $tabindex = 0)
{
$class = 'radio';
if ($checked) {
$class .= ' active';
}
$atts = join_atts(array(
'class' => $class,
'id' => $id,
'name' => $name,
'type' => 'radio',
'checked' => (bool) $checked,
'tabindex' => (int) $tabindex,
), TEXTPATTERN_STRIP_EMPTY);
$atts .= join_atts(array('value' => (string) $value), TEXTPATTERN_STRIP_NONE);
return n.tag_void('input', $atts);
}
/**
* Generates a form element.
*
* This form will contain a CSRF token if called on an authenticated page.
*
* @param string $contents The form contents
* @param string $style Inline styles added to the form
* @param string $onsubmit JavaScript run when the form is sent
* @param string $method The form method, e.g. "post", "get"
* @param string $class The HTML class
* @param string $fragment A URL fragment added to the form target
* @param string $id The HTML id
* @param string $role ARIA role name
* @param bool $allow_autocomplete If FALSE, the form is set to autocomplete="off"
* @param string $aria_label ARIA label attribute
* @return string HTML form element
*/
function form($contents, $style = '', $onsubmit = '', $method = 'post', $class = '', $fragment = '', $id = '', $role = '', $allow_autocomplete = true, $aria_label = '')
{
$action = 'index.php';
$autocomplete = '';
if ($onsubmit) {
$onsubmit = 'return '.$onsubmit;
}
if ($fragment) {
$action .= '#'.$fragment;
}
if ($allow_autocomplete === false) {
$autocomplete = 'off';
}
return n.tag($contents.tInput().n, 'form', array(
'class' => $class,
'id' => $id,
'method' => $method,
'action' => $action,
'onsubmit' => $onsubmit,
'role' => $role,
'autocomplete' => $autocomplete,
'style' => $style,
'aria-label' => $aria_label,
));
}
/**
* Gets and sanitises a field from a prefixed core database table.
*
* @param string $name The field
* @param string $event The table
* @param string $identifier The field used for selecting
* @param string $id The value used for selecting
* @return string HTML
* @access private
* @see fetch()
* @see txpspecialchars()
*/
function fetch_editable($name, $event, $identifier, $id)
{
$q = fetch($name, 'txp_'.$event, $identifier, $id);
return txpspecialchars($q);
}
/**
* A textarea.
*
* @param string $name The field
* @param int $h The field height in pixels
* @param int $w The field width in pixels
* @param string $thing The value
* @param string $id The HTML id
* @param int $rows Rows
* @param int $cols Columns
* @param string $placeholder The placeholder value displayed when the field is empty
* @param bool $required If TRUE the field is marked as required
* @return string HTML
*/
function text_area($name, $h = 0, $w = 0, $thing = '', $id = '', $rows = 5, $cols = 40, $placeholder = null, $required = false)
{
$style = '';
if ($w) {
$style .= 'width:'.intval($w).'px;';
}
if ($h) {
$style .= 'height:'.intval($h).'px;';
}
if ((string) $thing === '') {
$thing = null;
} else {
$thing = txpspecialchars($thing);
}
if (!intval($rows)) {
$rows = 5;
}
if (!intval($cols)) {
$cols = 40;
}
$atts = (is_array($name) ? $name : array('name' => $name)) + array(
'id' => $id,
'rows' => (int) $rows,
'cols' => (int) $cols,
'style' => $style,
'required' => (bool) $required,
'placeholder' => $placeholder,
);
if (!isset($atts['placeholder'])) {
$atts['placeholder'] = $atts['required'] ? gTxt('required') : false;
}
return n.tag($thing, 'textarea', $atts);
}
/**
* Generates a select field with a name "type".
*
* @param array $options
* @return string
* @access private
* @see selectInput()
*/
function type_select($options)
{
return n.'<select name="type">'.type_options($options).'</select>';
}
/**
* Generates a list of options for use in a select field.
*
* @param array $array
* @return string
* @access private
* @see selectInput()
*/
function type_options($array)
{
foreach ($array as $a => $b) {
$out[] = n.'<option value="'.$a.'">'.gTxt($b).'</option>';
}
return join('', $out);
}
/**
* Generates a list of radio buttons wrapped in an unordered list.
*
* @param string $name The field
* @param array $values The values as an array array( $value => $label )
* @param string $current_val The selected option. Takes a value from $value
* @param string $hilight_val The highlighted list item
* @param string|array $atts HTML attributes
* @return string HTML
*/
function radio_list($name, $values, $current_val = '', $hilight_val = '', $atts = array('class' => 'plain-list'))
{
foreach ($values as $value => $label) {
$id = $name.'-'.$value;
$class = 'status-'.$value;
if ((string) $value === (string) $hilight_val) {
$label = strong($label);
$class .= ' active';
}
$out[] = tag(
radio($name, $value, ((string) $current_val === (string) $value), $id).
n.tag($label, 'label', array('for' => $id)),
'li',
array('class' => $class)
);
}
return tag(n.join(n, $out).n, 'ul', $atts);
}
/**
* Generates a field used to store and set a date.
*
* @param string $name The field
* @param string $datevar The strftime format the date is displayed
* @param int $time The displayed date as a UNIX timestamp
* @param int $tab The HTML tabindex
* @param string $id The HTML id
* @return string HTML
* @access private
* @example
* echo tsi('year', '%Y', 1200000000);
*/
function tsi($name, $datevar, $time, $tab = 0, $id = '')
{
static $placeholders = array(
'%Y' => 'yyyy',
'%m' => 'mm',
'%d' => 'dd',
'%H' => 'hh',
'%M' => 'mn',
'%S' => 'ss',
);
$value = $placeholder = '';
$size = INPUT_TINY;
$pattern = '([0-5][0-9])';
if ((int) $time) {
$value = safe_strftime($datevar, (int) $time);
}
if (isset($placeholders[$datevar])) {
$placeholder = gTxt($placeholders[$datevar]);
}
if ($datevar == '%Y' || $name == 'year' || $name == 'exp_year') {
$class = 'input-year';
$pattern = '[0-9]{4}';
$size = INPUT_XSMALL;
$title = 'input_year';
}
if ($datevar == '%m' || $name == 'month' || $name == 'exp_month') {
$class = 'input-month';
$pattern = '(0[1-9]|1[012])';
$title = 'input_month';
}
if ($datevar == '%d' || $name == 'day' || $name == 'exp_day') {
$class = 'input-day';
$pattern = '(0[1-9]|[12][0-9]|3[01])';
$title = 'input_day';
}
if ($datevar == '%H' || $name == 'hour' || $name == 'exp_hour') {
$class = 'input-hour';
$pattern = '([0-1][0-9]|2[0-3])';
$title = 'input_hour';
}
if ($datevar == '%M' || $name == 'minute' || $name == 'exp_minute') {
$class = 'input-minute';
$pattern = '([0-5][0-9])';
$title = 'input_minute';
}
if ($datevar == '%S' || $name == 'second' || $name == 'exp_second') {
$class = 'input-second';
$pattern = '([0-5][0-9])';
$title = 'input_second';
}
return n.tag_void('input', array(
'class' => $class,
'id' => $id,
'name' => $name,
'type' => 'text',
'inputmode' => 'numeric',
'pattern' => $pattern,
'size' => (int) $size,
'maxlength' => $size,
'title' => gTxt($title),
'placeholder' => $placeholder,
'tabindex' => (int) $tab,
'value' => $value,
));
}