PluginProbe ʕ •ᴥ•ʔ
Hustle – Email Marketing, Lead Generation, Optins, Popups / trunk
Hustle – Email Marketing, Lead Generation, Optins, Popups vtrunk
7.8.13 7.8.13.1 trunk 3.0 3.1 3.1.1 3.1.2 3.1.3 3.1.4 4.3.2 4.4.4 4.4.5 4.4.5.1 4.4.5.4 4.6 4.6.1.1 4.6.1.4 4.7.0.2 4.7.0.3 4.7.0.7 4.7.0.9 4.7.1.0 4.7.1.1 4.8.0.0 5.0.0 5.0.1 5.0.1.1 5.0.1.2 5.1 5.1.1 5.1.2 5.1.3 5.1.3.1 5.1.3.2 5.1.4 5.1.5 6.0 6.0.1 6.0.2 6.0.3 6.0.4.2 6.0.5 6.0.6.1 6.0.7 6.0.8.1 6.0.9 7.0.0.1 7.0.2 7.0.3 7.0.4 7.1.0 7.1.1 7.2.0 7.2.1 7.3.0 7.3.1 7.3.3 7.3.5 7.3.6 7.3.7 7.4.0 7.4.1 7.4.11 7.4.13 7.4.13.1 7.4.2 7.4.3 7.4.4 7.4.5 7.4.5.1 7.4.5.2 7.4.6 7.4.7 7.5.0 7.6.0 7.6.1 7.6.3 7.6.4 7.6.6 7.7.0 7.7.1 7.8.0 7.8.1 7.8.10 7.8.10.1 7.8.10.2 7.8.11 7.8.12 7.8.12.1 7.8.2 7.8.3 7.8.4 7.8.5 7.8.6 7.8.7 7.8.8 7.8.9 7.8.9.1 7.8.9.2 7.8.9.3
wordpress-popup / views / general / option.php
wordpress-popup / views / general Last commit date
option.php 5 months ago policy-text.php 2 years ago unsubscribe-form.php 5 months ago
option.php
464 lines
1 <?php
2 /**
3 * Template for rendering some markup elements.
4 *
5 * @package Hustle
6 * @since 4.0.0
7 */
8
9 $element_type = strtolower( $type );
10 $type_class = 'optin_' . $element_type . '_' . $element_type . ' ' . $element_type;
11 $for = ( isset( $for ) ) ? $for : '';
12 $attributes = isset( $attributes ) ? $attributes : array();
13
14 // FIELD TYPE: Label.
15 if ( 'label' === $element_type ) { ?>
16 <label
17 <?php echo isset( $for ) ? 'for="' . esc_attr( $for ) . '"' : ''; ?>
18 class="<?php echo isset( $class ) ? esc_attr( $class ) : 'sui-label'; ?>"
19 <?php $this->render_attributes( isset( $attributes ) ? $attributes : array() ); ?>
20 >
21 <?php echo wp_kses_post( $value ); ?>
22 <?php if ( isset( $note ) && ! empty( $note ) ) { ?>
23 <span class="sui-label-note"><?php echo esc_html( $note ); ?></span>
24 <?php } ?>
25 </label>
26
27 <?php
28 // FIELD TYPE: Description.
29 } elseif ( 'description' === $element_type ) {
30 ?>
31 <span class="sui-description"><?php echo wp_kses_post( $value ); ?></span>
32
33 <?php
34 // FIELD TYPE: Notice.
35 } elseif ( 'notice' === $element_type ) {
36 ?>
37
38 <div
39 <?php echo ! empty( $id ) ? 'id="' . esc_attr( $id ) . '"' : ''; ?>
40 class="sui-notice <?php echo isset( $class ) ? esc_attr( $class ) : ''; ?>"
41 <?php $this->render_attributes( $attributes ); ?>
42 >
43
44 <div class="sui-notice-content">
45
46 <div class="sui-notice-message">
47
48 <?php if ( ! empty( $icon ) ) : ?>
49 <span class="sui-notice-icon sui-icon-<?php echo esc_attr( $icon ); ?> sui-md" aria-hidden="true"></span>
50 <?php endif; ?>
51 <p><?php echo wp_kses_post( $value ); ?></p>
52
53 </div>
54
55 </div>
56
57 </div>
58
59 <?php
60 // FIELD TYPE: Textarea.
61 } elseif ( 'textarea' === $element_type ) {
62 ?>
63 <textarea <?php $this->render_attributes( isset( $attributes ) ? $attributes : array() ); ?>
64 name="<?php echo esc_attr( $name ); ?>"
65 id="<?php echo esc_attr( $id ); ?>"
66 cols="30" rows="10"><?php echo esc_textarea( $value ? $value : $default ); ?></textarea>
67
68 <?php
69 // FIELD TYPE: Select.
70 } elseif ( 'select' === $element_type ) {
71 ?>
72 <select
73 <?php echo empty( $name ) ? '' : 'name="' . esc_attr( $name ) . '"'; ?>
74 <?php echo empty( $id ) ? '' : 'id="' . esc_attr( $id ) . '"'; ?>
75 <?php echo empty( $class ) ? '' : 'class="' . esc_attr( $class ) . '"'; ?>
76 <?php echo empty( $nonce ) ? '' : 'data-nonce="' . esc_attr( $nonce ) . '"'; ?>
77 <?php $this->render_attributes( isset( $attributes ) ? $attributes : array() ); ?>
78 >
79 <?php
80 foreach ( $options as $value => $label ) :
81 $label = ! empty( $label ) ? $label : '&#8205;';
82 $_selected = is_array( $selected ) && empty( $selected ) ? '' : $selected;
83 ?>
84 <option <?php selected( $_selected, $value ); ?> value="<?php echo esc_attr( $value ); ?>"><?php echo esc_attr( $label ); ?></option>
85 <?php endforeach; ?>
86 </select>
87
88 <?php
89 // FIELD TYPE: Multiple Select.
90 } elseif ( 'multiselect' === $element_type ) {
91 ?>
92 <select
93 <?php echo empty( $name ) ? '' : 'name="' . esc_attr( $name ) . '"'; ?>
94 <?php echo empty( $id ) ? '' : 'id="' . esc_attr( $id ) . '"'; ?>
95 <?php echo empty( $class ) ? '' : 'class="' . esc_attr( $class ) . '"'; ?>
96 <?php $this->render_attributes( isset( $attributes ) ? $attributes : array() ); ?>
97 >
98 <?php
99 $_selected = empty( $selected ) ? array() : $selected;
100 foreach ( $options as $value => $label ) :
101 $label = ! empty( $label ) ? $label : '&#8205;';
102 $selected = is_array( $_selected ) && in_array( absint( $value ), $_selected, true ) ? 'selected' : '';
103 ?>
104 <option <?php echo esc_attr( $selected ); ?> value="<?php echo esc_attr( $value ); ?>"><?php echo esc_attr( $label ); ?></option>
105 <?php endforeach; ?>
106 </select>
107 <?php
108 // FIELD TYPE: Link.
109 } elseif ( 'link' === $element_type ) {
110 ?>
111 <a <?php $this->render_attributes( isset( $attributes ) ? $attributes : array() ); ?>
112 href="<?php echo esc_url( $href ); ?>"
113 target="<?php echo isset( $target ) ? esc_attr( $target ) : '_self'; ?>"
114 id="<?php echo isset( $id ) ? esc_attr( $id ) : ''; ?>"
115 class="<?php echo esc_attr( $type_class ); ?> <?php echo isset( $class ) ? esc_attr( $class ) : ''; ?>"
116 <?php echo isset( $style ) ? 'style="' . esc_attr( $style ) . '"' : ''; ?>><?php echo esc_html( $text ); ?></a>
117
118 <?php
119 // FIELD TYPE: Wrapper.
120 } elseif ( 'wrapper' === $element_type ) {
121 ?>
122 <div
123 <?php $this->render_attributes( isset( $attributes ) ? $attributes : array() ); ?>
124 <?php echo isset( $id ) ? 'id="' . esc_attr( $id ) . '"' : ''; ?>
125 class="
126 <?php
127 if ( empty( $is_not_field_wrapper ) ) {
128 echo 'sui-form-field ';}
129 ?>
130 <?php
131 if ( isset( $class ) ) {
132 echo esc_attr( $class );}
133 ?>
134 "
135 <?php echo isset( $style ) ? 'style="' . esc_attr( $style ) . '"' : ''; ?>
136 >
137 <?php
138 foreach ( (array) $elements as $element ) {
139 static $previous_id;
140 if ( ! empty( $previous_id ) ) {
141 $element['previous_id'] = $previous_id;
142 }
143 $this->render( 'general/option', $element );
144 if ( ! empty( $element['id'] ) ) {
145 $previous_id = $element['id'];
146 }
147 }
148 ?>
149 </div>
150
151 <?php
152 // FIELD TYPE: Radio (Group).
153 } elseif ( 'radios' === $element_type ) {
154 $_selected = -1;
155
156 if ( isset( $default ) ) {
157 $_selected = $default;
158 }
159
160 if ( isset( $selected ) ) {
161 $_selected = $selected;
162 }
163
164 if ( is_array( $_selected ) && empty( $_selected ) ) {
165 $_selected = '';
166 }
167
168 foreach ( $options as $value => $label ) {
169 $label_before = isset( $label_before ) ? $label_before : false;
170 ?>
171
172 <label
173 <?php echo isset( $field_id ) ? 'for="' . esc_attr( $field_id ) . '"' : ''; ?>
174 class="sui-radio<?php echo isset( $class ) ? ' ' . esc_attr( $class ) : ''; ?>"
175 >
176
177 <input
178 type="radio"
179 <?php echo isset( $name ) ? 'name="' . esc_attr( $name ) . '"' : ''; ?>
180 <?php echo 'value="' . esc_attr( $value ) . '"'; ?>
181 <?php echo isset( $field_id ) ? 'id="' . esc_attr( $field_id . '-' . str_replace( ' ', '-', strtolower( $value ) ) ) . '"' : ''; ?>
182 <?php $this->render_attributes( isset( $item_attributes ) ? $item_attributes : array() ); ?>
183 <?php selected( $_selected, $value ); ?>
184 />
185
186 <span aria-hidden="true"></span>
187
188 <?php echo ! empty( $label ) ? '<span>' . esc_html( $label ) . '</span>' : ''; ?>
189
190 </label>
191
192 <?php } ?>
193
194 <?php
195 // FIELD TYPE: Radio.
196 } elseif ( 'radio' === $element_type ) {
197 ?>
198
199 <label
200 <?php echo isset( $id ) ? 'for="' . esc_attr( $id ) . '"' : ''; ?>
201 class="sui-radio<?php echo isset( $class ) ? ' ' . esc_attr( $class ) : ''; ?>"
202 >
203 <input
204 type="radio"
205 <?php echo isset( $name ) ? 'name="' . esc_attr( $name ) . '"' : ''; ?>
206 <?php echo isset( $value ) ? 'value="' . esc_attr( $value ) . '"' : ''; ?>
207 <?php echo isset( $id ) ? 'id="' . esc_attr( $id ) . '"' : ''; ?>
208 <?php $this->render_attributes( isset( $attributes ) ? $attributes : array() ); ?>
209 />
210 <span aria-hidden="true"></span>
211 <?php echo isset( $label ) ? '<span>' . esc_html( $label ) . '</span>' : ''; ?>
212 </label>
213
214 <?php
215 // FIELD TYPE: Checkbox (Group).
216 } elseif ( 'checkboxes' === $element_type ) {
217
218 $_selected = -1;
219
220 if ( isset( $default ) ) {
221 $_selected = $default;
222 }
223
224 if ( isset( $selected ) ) {
225 $_selected = $selected;
226 }
227
228 foreach ( $options as $value => $label ) {
229
230 $id = esc_attr( $id . '-' . str_replace( ' ', '-', strtolower( $value ) ) );// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
231 $checked = is_array( $_selected ) ? in_array( $value, $_selected ) ? checked( true, true, false ) : '' : checked( $_selected, $value, false );// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
232 ?>
233
234 <label
235 <?php echo isset( $id ) ? 'for="' . esc_attr( $id ) . '"' : ''; ?>
236 class="sui-checkbox<?php echo isset( $class ) ? ' ' . esc_attr( $class ) : ''; ?>"
237 >
238
239 <input
240 type="checkbox"
241 <?php echo isset( $name ) ? 'name="' . esc_attr( $name ) . '"' : ''; ?>
242 <?php echo 'value="' . esc_attr( $value ) . '"'; ?>
243 <?php echo isset( $id ) ? 'id="' . esc_attr( $id ) . '"' : ''; ?>
244 <?php $this->render_attributes( isset( $item_attributes ) ? $item_attributes : array() ); ?>
245 <?php echo esc_html( $checked ); ?>
246 />
247
248 <span aria-hidden="true"></span>
249
250 <?php echo ! empty( $label ) ? '<span>' . esc_html( $label ) . '</span>' : ''; ?>
251
252 </label>
253
254 <?php } ?>
255
256 <?php
257 // FIELD TYPE: Checkbox.
258 } elseif ( 'checkbox' === $element_type ) {
259 ?>
260
261 <label
262 <?php echo isset( $id ) ? 'for="' . esc_attr( $id ) . '"' : ''; ?>
263 class="sui-checkbox<?php echo isset( $class ) ? ' ' . esc_attr( $class ) : ''; ?>"
264 >
265 <input
266 type="checkbox"
267 <?php echo isset( $name ) ? 'name="' . esc_attr( $name ) . '"' : ''; ?>
268 <?php echo isset( $value ) ? 'value="' . esc_attr( $value ) . '"' : ''; ?>
269 <?php echo isset( $id ) ? 'id="' . esc_attr( $id ) . '"' : ''; ?>
270 <?php $this->render_attributes( isset( $attributes ) ? $attributes : array() ); ?>
271 />
272 <span aria-hidden="true"></span>
273 <?php echo isset( $label ) ? '<span>' . esc_html( $label ) . '</span>' : ''; ?>
274 </label>
275
276 <?php
277 // FIELD TYPE: Checkbox (Toggle).
278 } elseif ( 'checkbox_toggle' === $element_type ) {
279 ?>
280 <label
281 <?php echo isset( $id ) ? 'for="' . esc_attr( $id ) . '"' : ''; ?>
282 class="sui-toggle"
283 >
284 <input
285 type="checkbox"
286 name="<?php echo esc_attr( $name ); ?>"
287 value="<?php echo esc_attr( $value ); ?>"
288 <?php echo ( ! empty( $id ) && ! empty( $label ) ? 'aria-labelledby="' . esc_attr( $label ) . '-label"' : '' ); ?>
289 <?php echo ( ! empty( $id ) && ! empty( $description ) ? 'aria-describedby="' . esc_attr( $description ) . '-label"' : '' ); ?>
290 <?php echo isset( $id ) ? 'id="' . esc_attr( $id ) . '"' : ''; ?>
291 <?php $this->render_attributes( isset( $attributes ) ? $attributes : array() ); ?>
292 />
293 <span class="sui-toggle-slider" aria-hidden="true"></span>
294
295 <?php if ( isset( $label ) && '' !== $label ) { ?>
296 <span <?php echo isset( $id ) ? 'id="' . esc_attr( $id ) . '-label" ' : ''; ?>class="sui-toggle-label"><?php echo esc_html( $label ); ?></span>
297 <?php } ?>
298 <?php if ( isset( $description ) && '' !== $description ) { ?>
299 <span <?php echo isset( $id ) ? 'id="' . esc_attr( $id ) . '-description" ' : ''; ?>class="sui-description"><?php echo esc_html( $description ); ?></span>
300 <?php } ?>
301 </label>
302
303 <?php
304 // FIELD TYPE: Checkbox (Toggle).
305 } elseif ( 'sui_tabs' === $element_type ) {
306 ?>
307
308 <?php echo ! empty( $label ) ? '<span>' . esc_html( $label ) . '</span>' : ''; ?>
309
310 <div class="sui-side-tabs" style="margin-top: 5px;">
311
312 <div class="sui-tabs-menu">
313 <?php
314 foreach ( $options as $key => $option_title ) {
315
316 $field_id = esc_attr( $name . '-' . str_replace( ' ', '-', strtolower( $key ) ) );
317 ?>
318 <label for="hustle-<?php echo esc_html( $field_id ); ?>"
319 class="sui-tab-item <?php echo $key === $value ? 'active' : ''; ?>"
320 >
321 <input
322 type="radio"
323 name="<?php echo esc_html( $name ); ?>"
324 value="<?php echo esc_html( $key ); ?>"
325 id="hustle-<?php echo esc_html( $field_id ); ?>"
326 <?php checked( $key, $value ); ?>
327 />
328 <?php echo esc_html( $option_title ); ?>
329 </label>
330
331 <?php } ?>
332
333 </div>
334
335 <?php if ( ! empty( $description ) ) { ?>
336 <span class="sui-description"><?php echo esc_html( $description ); ?></span>
337 <?php } ?>
338
339 </div>
340
341
342 <?php
343 // TAG TYPE: Small.
344 } elseif ( 'small' === $element_type ) {
345 ?>
346 <p><small <?php $this->render_attributes( isset( $attributes ) ? $attributes : array() ); ?> for="<?php echo esc_attr( $for ); ?>">
347 <?php echo esc_html( $value ); ?>
348 </small></p>
349
350 <?php
351 // FIELD TYPE: Error label.
352 } elseif ( 'error' === $element_type ) {
353 $error_id = isset( $id ) ? $id : ( ! empty( $previous_id ) ? $previous_id . '-error' : '' );
354 ?>
355 <span
356 <?php $this->render_attributes( isset( $attributes ) ? $attributes : array() ); ?>
357 <?php echo ( ! empty( $error_id ) ? 'id="' . esc_attr( $error_id ) . '"' : '' ); ?>
358 role="alert"
359 class="sui-error-message<?php echo isset( $class ) ? ' ' . esc_attr( $class ) : ''; ?>"
360 >
361 <?php echo wp_kses_post( $value ); ?>
362 </span>
363
364 <?php
365 // FIELD TYPE: Ajax button.
366 // This button is not an input submit.
367 } elseif ( 'button' === $element_type ) {
368 ?>
369 <button
370 <?php echo isset( $name ) ? 'name="' . esc_attr( $name ) . '"' : ''; ?>
371 <?php echo ( isset( $id ) ? 'id="' . esc_attr( $id ) . '"' : '' ); ?>
372 class="sui-button sui-button-ghost <?php echo esc_attr( $type_class ); ?> <?php echo isset( $class ) ? esc_attr( $class ) : ''; ?>"
373 <?php $this->render_attributes( isset( $attributes ) ? $attributes : array() ); ?>
374 >
375 <?php echo esc_html( $value ); ?>
376 </button>
377
378 <?php
379 // FIELD TYPE: Ajax button.
380 // This button is not an input submit.
381 } elseif ( 'ajax_button' === $element_type ) {
382 ?>
383 <button <?php $this->render_attributes( isset( $attributes ) ? $attributes : array() ); ?> <?php echo ( isset( $id ) ? 'id="' . esc_attr( $id ) . '"' : '' ); ?> class="hustle-onload-icon-action sui-button <?php echo isset( $class ) ? esc_attr( $class ) : ''; ?>">
384 <span class="sui-loading-text"><?php echo esc_html( $value ); ?></span><span class="sui-icon-loader sui-loading" aria-hidden="true"></span>
385 </button>
386
387 <?php
388 // FIELD TYPE: Button.
389 } elseif ( 'submit_button' === $element_type ) {
390 ?>
391 <button type="submit"<?php $this->render_attributes( isset( $attributes ) ? $attributes : array() ); ?> <?php echo ( isset( $id ) ? 'id="' . esc_attr( $id ) . '"' : '' ); ?> class="sui-button <?php echo isset( $class ) ? esc_attr( $class ) : ''; ?>">
392 <?php echo esc_html( $value ); ?>
393 </button>
394
395 <?php
396 // FIELD TYPE: Password.
397 } elseif ( 'password-reset' === $element_type ) {
398 ?>
399 <div class="sui-with-button sui-with-button-icon">
400
401 <input
402 <?php $this->render_attributes( isset( $attributes ) ? $attributes : array() ); ?>
403 type="password"
404 <?php echo isset( $name ) ? 'name="' . esc_attr( $name ) . '"' : ''; ?>
405 value="<?php echo isset( $value ) ? esc_attr( $value ) : ''; ?>"
406 <?php echo isset( $placeholder ) ? 'placeholder="' . esc_attr( $placeholder ) . '"' : ''; ?>
407 id="<?php echo isset( $id ) ? esc_attr( $id ) : ''; ?>"
408 class="sui-form-control <?php echo esc_attr( $type_class ); ?> <?php echo isset( $class ) ? esc_attr( $class ) : ''; ?>"
409 />
410
411 <button class="sui-button-icon">
412 <span aria-hidden="true" class="sui-icon-eye"></span>
413 <span class="sui-password-text sui-screen-reader-text"><?php esc_html_e( 'Show Password', 'hustle' ); ?></span>
414 <span class="sui-password-text sui-screen-reader-text sui-hidden"><?php esc_html_e( 'Hide Password', 'hustle' ); ?></span>
415 </button>
416
417 </div>
418 <?php
419 // FIELD TYPE: Raw.
420 } elseif ( 'raw' === $element_type ) {
421 ?>
422 <?php echo wp_kses_post( $value ); ?>
423 <?php
424 } elseif ( 'readonly' === $element_type ) {
425 ?>
426 <div class="sui-with-button sui-with-button-inside">
427 <input
428 <?php $this->render_attributes( isset( $attributes ) ? $attributes : array() ); ?>
429 type="text"
430 <?php echo isset( $name ) ? 'name="' . esc_attr( $name ) . '"' : ''; ?>
431 value="<?php echo isset( $value ) ? esc_attr( $value ) : ''; ?>"
432 id="<?php echo isset( $id ) ? esc_attr( $id ) : ''; ?>"
433 class="sui-form-control <?php echo esc_attr( $type_class ); ?> <?php echo isset( $class ) ? esc_attr( $class ) : ''; ?>"
434 readonly
435 />
436 <button class="sui-button-icon sui-copy-button hustle-copy-shortcode-button" type="button" aria-label="<?php esc_attr_e( 'Copy to clipboard', 'hustle' ); ?>">
437 <span class="sui-icon-copy" aria-hidden="true"></span>
438 <span class="sui-screen-reader-text"><?php esc_html_e( 'Copy to clipboard', 'hustle' ); ?></span>
439 </button>
440 </div>
441 <?php } else { ?>
442 <?php echo isset( $icon ) ? '<div class="sui-control-with-icon">' : ''; ?>
443 <?php if ( empty( $describedby ) && ! empty( $id ) ) { ?>
444 <?php $describedby = $id . '-error'; ?>
445 <?php } ?>
446
447 <input
448 <?php $this->render_attributes( isset( $attributes ) ? $attributes : array() ); ?>
449 type="<?php echo esc_attr( $element_type ); ?>"
450 <?php echo isset( $name ) ? 'name="' . esc_attr( $name ) . '"' : ''; ?>
451 value="<?php echo isset( $value ) ? esc_attr( $value ) : ''; ?>"
452 <?php echo isset( $placeholder ) ? 'placeholder="' . esc_attr( $placeholder ) . '"' : ''; ?>
453 <?php echo ! empty( $labelledby ) ? 'aria-labelledby="' . esc_attr( $labelledby ) . '"' : ''; ?>
454 <?php echo ! empty( $describedby ) ? 'aria-describedby="' . esc_attr( $describedby ) . '"' : ''; ?>
455 id="<?php echo isset( $id ) ? esc_attr( $id ) : ''; ?>"
456 class="sui-form-control <?php echo esc_attr( $type_class ); ?> <?php echo isset( $class ) ? esc_attr( $class ) : ''; ?>"
457 />
458
459 <?php echo isset( $icon ) ? '<span class="sui-icon-' . esc_attr( $icon ) . '" aria-hidden="true"></span>' : ''; ?>
460
461 <?php echo isset( $icon ) ? '</div>' : ''; ?>
462 <?php
463 }
464