PluginProbe
Easy Hotel – Powerful Hotel Booking / trunk
Easy Hotel – Powerful Hotel Booking vtrunk
2.0.8 2.0.7 2.0.6 2.0.5 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 1.9.9 1.9.8 1.9.7 1.9.6 1.9.5 1.9.4 1.9.3 1.9.2 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 All 110 releases
easy-hotel / admin / includes / framework / functions / customize.php

customize.php in Easy Hotel – Powerful Hotel Booking trunk, at admin/includes/framework/functions/customize.php

143 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2 /**
3 *
4 * WP Customize custom panel
5 *
6 * @since 1.0.0
7 * @version 1.0.0
8 *
9 */
10 if ( ! class_exists( 'ESHB_Customize_Panel_CSF' ) && class_exists( 'WP_Customize_Panel' ) ) {
11 class ESHB_Customize_Panel_CSF extends WP_Customize_Panel {
12 public $type = 'easy-hotel';
13 }
14 }
15
16 /**
17 *
18 * WP Customize custom section
19 *
20 * @since 1.0.0
21 * @version 1.0.0
22 *
23 */
24 if ( ! class_exists( 'ESHB_Customize_Section_CSF' ) && class_exists( 'WP_Customize_Section' ) ) {
25 class ESHB_Customize_Section_CSF extends WP_Customize_Section {
26 public $type = 'easy-hotel';
27 }
28 }
29
30 /**
31 *
32 * WP Customize custom control
33 *
34 * @since 1.0.0
35 * @version 1.0.0
36 *
37 */
38 if ( ! class_exists( 'ESHB_Customize_Control_CSF' ) && class_exists( 'WP_Customize_Control' ) ) {
39 class ESHB_Customize_Control_CSF extends WP_Customize_Control {
40
41 public $type = 'easy-hotel';
42 public $field = '';
43 public $unique = '';
44
45 public function render() {
46
47 $depend = '';
48 $visible = '';
49
50 if ( ! empty( $this->field['dependency'] ) ) {
51
52 $dependency = $this->field['dependency'];
53 $depend_visible = '';
54 $data_controller = '';
55 $data_condition = '';
56 $data_value = '';
57 $data_global = '';
58
59 if ( is_array( $dependency[0] ) ) {
60 $data_controller = implode( '|', array_column( $dependency, 0 ) );
61 $data_condition = implode( '|', array_column( $dependency, 1 ) );
62 $data_value = implode( '|', array_column( $dependency, 2 ) );
63 $data_global = implode( '|', array_column( $dependency, 3 ) );
64 $depend_visible = implode( '|', array_column( $dependency, 4 ) );
65 } else {
66 $data_controller = ( ! empty( $dependency[0] ) ) ? $dependency[0] : '';
67 $data_condition = ( ! empty( $dependency[1] ) ) ? $dependency[1] : '';
68 $data_value = ( ! empty( $dependency[2] ) ) ? $dependency[2] : '';
69 $data_global = ( ! empty( $dependency[3] ) ) ? $dependency[3] : '';
70 $depend_visible = ( ! empty( $dependency[4] ) ) ? $dependency[4] : '';
71 }
72
73 $depend .= ' data-controller="'. esc_attr( $data_controller ) .'"';
74 $depend .= ' data-condition="'. esc_attr( $data_condition ) .'"';
75 $depend .= ' data-value="'. esc_attr( $data_value ) .'"';
76 $depend .= ( ! empty( $data_global ) ) ? ' data-depend-global="true"' : '';
77
78 $visible = ' csf-dependency-control';
79 $visible .= ( ! empty( $depend_visible ) ) ? ' csf-depend-visible' : ' csf-depend-hidden';
80
81 }
82
83 $id = 'customize-control-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id );
84 $class = 'customize-control customize-control-'. $this->type . $visible;
85
86 echo '<li id="'. esc_attr( $id ) .'" class="'. esc_attr( $class ) .'"'. esc_attr($depend) .'>';
87 $this->render_field_content();
88 echo '</li>';
89
90 }
91
92 public function render_field_content() {
93
94 $complex = apply_filters( 'eshb_customize_complex_fields', array(
95 'accordion',
96 'background',
97 'border',
98 'button_set',
99 'checkbox',
100 'color_group',
101 'date',
102 'dimensions',
103 'fieldset',
104 'group',
105 'image_select',
106 'link',
107 'link_color',
108 'media',
109 'palette',
110 'repeater',
111 'sortable',
112 'sorter',
113 'spacing',
114 'switcher',
115 'tabbed',
116 'typography'
117 ) );
118
119 $field_id = ( ! empty( $this->field['id'] ) ) ? $this->field['id'] : '';
120 $custom = ( ! empty( $this->field['customizer'] ) ) ? true : false;
121 $is_complex = ( in_array( $this->field['type'], $complex ) ) ? true : false;
122 $class = ( $is_complex || $custom ) ? ' csf-customize-complex' : '';
123 $atts = ( $is_complex || $custom ) ? ' data-unique-id="'. esc_attr( $this->unique ) .'" data-option-id="'. esc_attr( $field_id ) .'"' : '';
124
125 if ( ! $is_complex && ! $custom ) {
126 $this->field['attributes']['data-customize-setting-link'] = $this->settings['default']->id;
127 }
128
129 $this->field['name'] = $this->settings['default']->id;
130
131 $this->field['dependency'] = array();
132
133 echo '<div class="csf-customize-field'. esc_attr( $class ) .'"'. esc_attr($atts) .'>';
134
135 ESHB::field( $this->field, $this->value(), $this->unique, 'customize' );
136
137 echo '</div>';
138
139 }
140
141 }
142 }
143