PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.2.7
Adminify – White Label, Admin Menu Editor, Login Customizer v4.2.7
4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.1.17 All 164 releases
adminify / Libs / adminify-framework / functions / customize.php

customize.php in Adminify – White Label, Admin Menu Editor, Login Customizer 4.2.7, at Libs/adminify-framework/functions/customize.php

143 lines 4.6 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( 'PXLBSAdminify_Customize_Panel' ) && class_exists( 'WP_Customize_Panel' ) ) {
11 class PXLBSAdminify_Customize_Panel extends WP_Customize_Panel {
12 public $type = 'adminify';
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( 'PXLBSAdminify_Customize_Section' ) && class_exists( 'WP_Customize_Section' ) ) {
25 class PXLBSAdminify_Customize_Section extends WP_Customize_Section {
26 public $type = 'adminify';
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( 'PXLBSAdminify_Customize_Control' ) && class_exists( 'WP_Customize_Control' ) ) {
39 class PXLBSAdminify_Customize_Control extends WP_Customize_Control {
40
41 public $type = 'adminify';
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 = ' adminify-dependency-control';
79 $visible .= ( ! empty( $depend_visible ) ) ? ' adminify-depend-visible' : ' adminify-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 ) .'"'. $depend .'>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- value pre-escaped where built.
87 $this->render_field_content();
88 echo '</li>';
89
90 }
91
92 public function render_field_content() {
93
94 $complex = apply_filters( 'adminify_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 ) ? ' adminify-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="adminify-customize-field'. esc_attr( $class ) .'"'. $atts .'>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- value pre-escaped where built.
134
135 ADMINIFY::field( $this->field, $this->value(), $this->unique, 'customize' );
136
137 echo '</div>';
138
139 }
140
141 }
142 }
143