-
Notifications
You must be signed in to change notification settings - Fork 3
/
tonjoo-library.php
92 lines (61 loc) · 2.19 KB
/
tonjoo-library.php
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
<?php
if ( ! function_exists( 'tjl_lf_print_select_option' ) ) :
function tjl_lf_print_select_option($options){
$r = '';
$p = '';
foreach($options['select_array'] as $select) {
$label = $select['label'];
$options['attr'] = isset($options['attr']) ? $options['attr'] : '';
$options['description'] = isset($options['description']) ? $options['description'] : '';
if ($options['value'] == $select['value']) // Make default first in list
$p = "<option selected='selected' value='" . esc_attr($select['value']) . "'>$label</option>";
else $r.= "<option value='" . esc_attr($select['value']) . "'>$label</option>";
}
// backward compability with id options
if (isset($options['id'])) $options['attr'].= " id='{$options['id']}'";
$print_select = "<tr valign='top' {$options['attr']}>
<td scope='row'>{$options['label']}</td>
<td>
<select name='{$options['name']}'>
{$p}{$r}
</select>
<label class='description' >{$options['description']}</label>
</td>
</tr>
";
echo $print_select;
}
endif;
if ( ! function_exists( 'tjl_lf_print_text_option' ) ) :
function tjl_lf_print_text_option($options){
$options['attr'] = isset($options['attr']) ? $options['attr'] : '';
$options['description'] = isset($options['description']) ? $options['description'] : '';
if (isset($options['id'])) $options['attr'].= " id='{$options['id']}'";
if (!isset($options['name'])) $options['name'] = '';
$print_select = "<tr valign='top' {$options['attr']} >
<td scope='row'>{$options['label']}</td>
<td>
<input type='text' name='{$options['name']}' value='{$options['value']}'>
<label class='description'>{$options['description']}</label>
</td>
</tr>
";
echo $print_select;
}
endif;
if ( ! function_exists( 'tjl_lf_print_text_area_option' ) ) :
function tjl_lf_print_text_area_option($options){
if(!$options['row'])
$options['row']=4;
if(!$options['column'])
$options['column']=50;
$print_select= "<tr valign='top' id='{$options['id']}' >
<th scope='row'>{$options['label']}</th>
<td>
<textarea name='{$options['name']}' rows='{$options['row']}' cols='{$options['column']}'>{$options['value']}</textarea>
</td>
</tr>
";
echo $print_select;
}
endif;