PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 3.2.3
Adminify – White Label, Admin Menu Editor, Login Customizer v3.2.3
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 3.2.3, at Libs/adminify-framework/functions/customize.php

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