PluginProbe
QuadMenu – Mega Menu / 3.3.8
QuadMenu – Mega Menu v3.3.8
3.3.8 3.3.7 3.3.6 trunk 1.8.4 1.8.5 1.8.7 1.8.8 1.8.9 1.9.0 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 88 releases
quadmenu / redux / ReduxCore / inc / fields / text / field_text.php

field_text.php in QuadMenu – Mega Menu 3.3.8, at redux/ReduxCore/inc/fields/text/field_text.php

98 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Exit if accessed directly
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 if ( ! class_exists( 'ReduxFrameworkLegacy_text' ) ) {
9 class ReduxFrameworkLegacy_text {
10
11 public $parent;
12 public $field;
13 public $value;
14
15 /**
16 * Field Constructor.
17 * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
18 *
19 * @since ReduxFrameworkLegacy 1.0.0
20 */
21 function __construct( $field = array(), $value = '', $parent = null ) {
22 $this->parent = $parent;
23 $this->field = $field;
24 $this->value = $value;
25 }
26
27 /**
28 * Field Render Function.
29 * Takes the vars and outputs the HTML for the field in the settings
30 *
31 * @since ReduxFrameworkLegacy 1.0.0
32 */
33 function render() {
34 if ( ! empty( $this->field['data'] ) && empty( $this->field['options'] ) ) {
35 if ( empty( $this->field['args'] ) ) {
36 $this->field['args'] = array();
37 }
38
39 $this->field['options'] = $this->parent->get_wordpress_data( $this->field['data'], $this->field['args'] );
40 $this->field['class'] .= ' hasOptions ';
41 }
42
43 if ( empty( $this->value ) && ! empty( $this->field['data'] ) && ! empty( $this->field['options'] ) ) {
44 $this->value = $this->field['options'];
45 }
46
47 // if (isset($this->field['text_hint']) && is_array($this->field['text_hint'])) {
48 $qtip_title = isset( $this->field['text_hint']['title'] ) ? 'qtip-title="' . $this->field['text_hint']['title'] . '" ' : '';
49 $qtip_text = isset( $this->field['text_hint']['content'] ) ? 'qtip-content="' . $this->field['text_hint']['content'] . '" ' : '';
50 // }
51
52 $readonly = ( isset( $this->field['readonly'] ) && $this->field['readonly'] ) ? ' readonly="readonly"' : '';
53 $autocomplete = ( isset( $this->field['autocomplete'] ) && $this->field['autocomplete'] == false ) ? ' autocomplete="off"' : '';
54
55 if ( isset( $this->field['options'] ) && ! empty( $this->field['options'] ) ) {
56
57 $placeholder = '';
58 if ( isset( $this->field['placeholder'] ) ) {
59 $placeholder = $this->field['placeholder'];
60 }
61
62 foreach ( $this->field['options'] as $k => $v ) {
63 if ( ! empty( $placeholder ) ) {
64 $placeholder = ( is_array( $this->field['placeholder'] ) && isset( $this->field['placeholder'][ $k ] ) ) ? ' placeholder="' . esc_attr( $this->field['placeholder'][ $k ] ) . '" ' : '';
65 }
66
67 echo '<div class="input_wrapper">';
68 echo '<label for="' . $this->field['id'] . '-text-' . $k . '">' . $v . '</label> ';
69 echo '<input ' . $qtip_title . $qtip_text . 'type="text" id="' . $this->field['id'] . '-text-' . $k . '" name="' . $this->field['name'] . $this->field['name_suffix'] . '[' . $k . ']' . '" ' . $placeholder . 'value="' . esc_attr( $this->value[ $k ] ) . '" class="regular-text ' . $this->field['class'] . '"' . $readonly . $autocomplete . ' /><br />';
70 echo '</div>';
71 }
72 // foreach
73 } else {
74 $placeholder = ( isset( $this->field['placeholder'] ) && ! is_array( $this->field['placeholder'] ) ) ? ' placeholder="' . esc_attr( $this->field['placeholder'] ) . '" ' : '';
75 echo '<input ' . $qtip_title . $qtip_text . 'type="text" id="' . $this->field['id'] . '" name="' . $this->field['name'] . $this->field['name_suffix'] . '" ' . $placeholder . 'value="' . esc_attr( $this->value ) . '" class="regular-text ' . $this->field['class'] . '"' . $readonly . $autocomplete . ' />';
76 }
77 }
78
79 /**
80 * Enqueue Function.
81 * If this field requires any scripts, or css define this function and register/enqueue the scripts/css
82 *
83 * @since ReduxFrameworkLegacy 3.0.0
84 */
85 function enqueue() {
86 if ( $this->parent->args['dev_mode'] ) {
87 wp_enqueue_style(
88 'redux-field-text-css',
89 ReduxFrameworkLegacy::$_url . 'inc/fields/text/field_text.css',
90 array(),
91 time(),
92 'all'
93 );
94 }
95 }
96 }
97 }
98