C:\xampp\htdocs\landing\wp-content\updraft\plugins-old\LayerSlider\helpers\admin.ui.tools.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
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
<?php

function lsGetOptionField$type$key$default$attrs = array() ) {

    
$value get_option'ls_'.$key$default );
    
$input '<input type="'.$type.'" name="'.$key.'"';

    if( 
$type === 'checkbox' && $value ) {
        
$input .= ' checked="checked"';

    } else {
        
$input .= ' value="'.$value.'"';
    }

    
// Theme forced settings
    
if( isset( LS_Config::$forced$key ] ) ) {
        
$help sprintf(__('This setting is enforced by <b><i>%s</i></b> in order to maximize compatibility on your site.''LayerSlider'), LS_Config::$forcedBy$key ] );

        
$input .= ' class="locked yellow" data-help-delay="100" data-help="'.$help.'" disabled';
    }

    foreach (
$attrs as $key => $value) {
        
$input .= $key.'="'.$value.'"';
    }

    return 
$input.'>';

}

function 
lsOptionRow$type$default$current$attrs = array(), $trClasses ''$forceOptionVal false) {

    
$wrapperStart '';
    
$wrapperEnd '';
    
$control '';

    
$default['desc'] = ! empty( $default['desc'] ) ? $default['desc'] : '';


    if( ! empty(
$default['advanced']) ) {
        
$trClasses .= ' ls-advanced ls-hidden';
        
$wrapperStart '<div><i class="dashicons dashicons-flag" data-help="'.__('Advanced option''LayerSlider').'"></i>';
        
$wrapperEnd '</div>';

    } else if( ! empty(
$default['premium']) ) {
        if( ! 
LS_Config::isActivatedSite() ) {
            
$trClasses .= ' ls-premium';
            
$wrapperStart '<div><a class="ls-activation-lock dashicons dashicons-lock" target="_blank" href="'.admin_url('admin.php?page=layerslider-addons' ).'" data-help="'.__('This feature requires product activation. Click on the padlock icon to learn more.''LayerSlider').'"></a>';
            
$wrapperEnd '</div>';
        }
    }


    switch(
$type) {
        case 
'input':
            
$control lsGetInput($default$current$attrstrue);
            break;

        case 
'checkbox':
            
$control lsGetCheckbox($default$current$attrstrue);
            break;

        case 
'select':
            
$control lsGetSelect($default$current$attrs$forceOptionValtrue);
            break;
    }

    
$trClasses = ! empty($trClasses) ? ' class="'.$trClasses.'"' '';

    echo 
'<tr'.$trClasses.'>
    <td>'
.$wrapperStart.''.$default['name'].''.$wrapperEnd.'</td>
    <td>'
.$control.'</td>
    <td class="desc">'
.$default['desc'].'</td>
</tr>'
;
}

function 
lsGetInput($default$current$attrs = array(), $return false) {

    
// Markup
    
$el         LayerSlider\PHPQuery\phpQuery::newDocumentHTML('<input>')->children();
    
$attributes = array();

    
$attributes['value'] = $default['value'];
    
$attributes['type']  = is_string($default['value']) ? 'text' 'number';
    
$attributes['name']  = $name is_string($default['keys']) ? $default['keys'] : $default['keys'][0];

    
$attrs = isset($default['attrs']) ? array_merge($default['attrs'], $attrs) : $attrs;
    if( ! empty(
$attrs) && is_array$attrs ) ) {
        
$attributes array_merge($attributes$attrs);
    }

    if(isset(
$default['tooltip'])) {
        
$attributes['data-help'] = $default['tooltip'];
    }

    
// Combo box
    
if( ! empty($attributes['data-options']) ) {
        if( empty(
$attributes['class']) ) { $attributes['class'] = ''; }

        
$attributes['class'] .= ' km-combo-input';
        
// $attributes['autocomplete'] = 'off';
    
}

    
// Override the default
    
if(isset($current[$name]) && $current[$name] !== '') {
        
$attributes['value'] = htmlspecialchars(stripslashes($current[$name]));
    }

    
$attributes['data-value'] = $attributes['value'];
    
$el->attr($attributes);

    
// Product activation check
    
if( ! empty( $default['premium'] ) ) {
        if( ! 
LS_Config::isActivatedSite() ) {
            
$el->addClass('locked');
            
$el->attr('disabled''disabled');
        }
    }

    
$ret = (string) $el;
    
LayerSlider\PHPQuery\phpQuery::unloadDocuments();

    if( 
$return ) { return $ret; } else { echo $ret; }
}



function 
lsGetCheckbox($default$current$attrs = array(), $return false) {

    
// Markup
    
$el         LayerSlider\PHPQuery\phpQuery::newDocumentHTML('<input>')->children();
    
$attributes = array();

    
$attributes['value'] = $default['value'];
    
$attributes['type']  = 'checkbox';
    
$attributes['name']  = $name is_string($default['keys']) ? $default['keys'] : $default['keys'][0];

    
$attrs = isset($default['attrs']) ? array_merge($default['attrs'], $attrs) : $attrs;
    if( ! empty(
$attrs) && is_array$attrs ) ) {
        
$attributes array_merge($attributes$attrs);
    }

    if(isset(
$default['tooltip'])) {
        
$attributes['data-help'] = $default['tooltip'];
    }

    
// Checked?
    
$attributes['data-value'] = false;
    if(
$default['value'] === true && ( ! isset($current[$name]) || count($current) < ) ) {
        
$attributes['checked'] = 'checked';
        
$attributes['data-value'] = 'true';
    } elseif(isset(
$current[$name]) && $current[$name] != false && $current[$name] !== 'false') {
        
$attributes['checked'] = 'checked';
        
$attributes['data-value'] = 'true';
    }

    
$attributes['value'] = $attributes['data-value'];
    
$el->attr($attributes);

    
// Product activation check
    
if( ! empty( $default['premium'] ) ) {
        if( ! 
LS_Config::isActivatedSite() ) {
            
$el->addClass('locked');
            
$el->attr('disabled''disabled');
        }
    }

    
$ret = (string) $el;
    
LayerSlider\PHPQuery\phpQuery::unloadDocuments();

    if( 
$return ) { return $ret; } else { echo $ret; }
}



function 
lsGetSelect($default$current$attrs = array(), $forceOptionVal false$return false ) {

    
// Var to hold data to print
    
$el         LayerSlider\PHPQuery\phpQuery::newDocumentHTML('<select>')->children();
    
$attributes = array();
    
$options     = array();
    
$listItems  = array();

    
$attributes['value'] = $value $default['value'];
    
$attributes['name']  = $name  is_string($default['keys']) ? $default['keys'] : $default['keys'][0];

    
// Attributes
    
$attrs = isset($default['attrs']) ? array_merge($default['attrs'], $attrs) : $attrs;
    if( ! empty(
$attrs) && is_array$attrs ) ) {
        
$attributes array_merge($attributes$attrs);
    }

    
// Get options
    
if(isset($default['options']) && is_array($default['options'])) {
        
$options $default['options'];
    } elseif(isset(
$attrs['options']) && is_array($attrs['options'])) {
        
$options $attrs['options'];
    }

    
// Override the default
    
if(isset($current[$name]) && $current[$name] !== '') {
        
$attributes['value'] = $value $current[$name];
    }

    
// Tooltip
    
if(isset($default['tooltip'])) {
        
$attributes['data-help'] = $default['tooltip'];
    }

    
// Add options
    
foreach($options as $name => $val) {

        
$name = (is_string($name) || $forceOptionVal) ? $name $val;
        
$name = ($name === 'zero') ? $name;


        
$checked = ($name == $value) ? ' selected="selected"' '';
        
$listItems[] = "<option value=\"$name\" $checked>$val</option>";
    }

    
$attributes['data-value'] = $attributes['value'];
    
$el->appendimplode(''$listItems) )->attr($attributes);

    
// Product activation check
    
if( ! empty( $default['premium'] ) ) {
        if( ! 
LS_Config::isActivatedSite() ) {
            
$el->addClass('locked');
            
$el->attr('disabled''disabled');
        }
    }

    
$ret = (string) $el;
    
LayerSlider\PHPQuery\phpQuery::unloadDocuments();

    if( 
$return ) { return $ret; } else { echo $ret; }
}

?>
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586