PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 3.2.4.1
Adminify – White Label, Admin Menu Editor, Login Customizer v3.2.4.1
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
← All changes | Libs/adminify-framework/functions/customize.php +114 -101 4.2.133.2.4.1 View file →
@@ -1,5 +1,6 @@
1 -<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
1 +<?php if ( ! defined( 'ABSPATH' ) ) {
2 + die; } // Cannot access directly.
2 3 /**
3 4 *
4 5 * WP Customize custom panel
5 6 *
@@ -4,14 +5,13 @@
4 5 * WP Customize custom panel
5 6 *
6 7 * @since 1.0.0
7 8 * @version 1.0.0
8 - *
9 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 - }
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 14 }
15 15
16 16 /**
17 17 *
@@ -18,14 +18,13 @@
18 18 * WP Customize custom section
19 19 *
20 20 * @since 1.0.0
21 21 * @version 1.0.0
22 - *
23 22 */
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 - }
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 + }
28 27 }
29 28
30 29 /**
31 30 *
@@ -32,111 +31,125 @@
32 31 * WP Customize custom control
33 32 *
34 33 * @since 1.0.0
35 34 * @version 1.0.0
36 - *
37 35 */
38 -if ( ! class_exists( 'PXLBSAdminify_Customize_Control' ) && class_exists( 'WP_Customize_Control' ) ) {
39 - class PXLBSAdminify_Customize_Control extends WP_Customize_Control {
36 +if ( ! class_exists( 'WP_Customize_Control_ADMINIFY' ) && class_exists( 'WP_Customize_Control' ) ) {
37 + class WP_Customize_Control_ADMINIFY extends WP_Customize_Control {
40 38
41 - public $type = 'adminify';
42 - public $field = '';
43 - public $unique = '';
39 + public $type = 'adminify';
40 + public $field = '';
41 + public $unique = '';
44 42
45 - public function render() {
43 + public function render() {
44 + $depend = '';
45 + $visible = '';
46 46
47 - $depend = '';
48 - $visible = '';
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 = '';
49 54
50 - if ( ! empty( $this->field['dependency'] ) ) {
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 + }
51 68
52 - $dependency = $this->field['dependency'];
53 - $depend_visible = '';
54 - $data_controller = '';
55 - $data_condition = '';
56 - $data_value = '';
57 - $data_global = '';
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"' : '';
58 73
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 - }
74 + $visible = ' adminify-dependency-control';
75 + $visible .= ( ! empty( $depend_visible ) ) ? ' adminify-depend-visible' : ' adminify-depend-hidden';
76 + }
72 77
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"' : '';
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 + }
77 95
78 - $visible = ' adminify-dependency-control';
79 - $visible .= ( ! empty( $depend_visible ) ) ? ' adminify-depend-visible' : ' adminify-depend-hidden';
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 + );
80 124
81 - }
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 ) . '"' : '';
82 130
83 - $id = 'customize-control-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id );
84 - $class = 'customize-control customize-control-'. $this->type . $visible;
131 + if ( ! $is_complex && ! $custom ) {
132 + $this->field['attributes']['data-customize-setting-link'] = $this->settings['default']->id;
133 + }
85 134
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>';
135 + $this->field['name'] = $this->settings['default']->id;
89 136
90 - }
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) . '>';
91 148
92 - public function render_field_content() {
149 + ADMINIFY::field( $this->field, $this->value(), $this->unique, 'customize' );
93 150
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 - ) );
151 + echo '</div>';
152 + }
118 153
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 - }
154 + }
142 155 }