PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 3.0.2
Adminify – White Label, Admin Menu Editor, Login Customizer v3.0.2
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 / lib / adminify-framework / classes / abstract.class.php

abstract.class.php in Adminify – White Label, Admin Menu Editor, Login Customizer 3.0.2, at lib/adminify-framework/classes/abstract.class.php

133 lines 4.1 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 * Abstract Class
5 *
6 * @since 1.0.0
7 * @version 1.0.0
8 *
9 */
10 if ( ! class_exists( 'ADMINIFY_Abstract' ) ) {
11 abstract class ADMINIFY_Abstract {
12
13 public $abstract = '';
14 public $output_css = '';
15
16 public function __construct() {
17
18 // Collect output css and typography
19 if ( ! empty( $this->args['output_css'] ) || ! empty( $this->args['enqueue_webfont'] ) ) {
20 add_action( 'wp_enqueue_scripts', array( $this, 'collect_output_css_and_typography' ), 10 );
21 ADMINIFY::$css = apply_filters( "adminify_{$this->unique}_output_css", ADMINIFY::$css, $this );
22 }
23
24 }
25
26 public function collect_output_css_and_typography() {
27 $this->recursive_output_css( $this->pre_fields );
28 }
29
30 public function recursive_output_css( $fields = array(), $combine_field = array() ) {
31
32 if ( ! empty( $fields ) ) {
33
34 foreach ( $fields as $field ) {
35
36 $field_id = ( ! empty( $field['id'] ) ) ? $field['id'] : '';
37 $field_type = ( ! empty( $field['type'] ) ) ? $field['type'] : '';
38 $field_output = ( ! empty( $field['output'] ) ) ? $field['output'] : '';
39 $field_check = ( $field_type === 'typography' || $field_output ) ? true : false;
40 $field_class = 'ADMINIFY_Field_' . $field_type;
41
42 if ( $field_type && $field_id ) {
43
44
45 if( $field_type === 'fieldset' ) {
46 if ( ! empty( $field['fields'] ) ) {
47 $this->recursive_output_css( $field['fields'], $field );
48 }
49 }
50
51 if( $field_type === 'accordion' ) {
52 if ( ! empty( $field['accordions'] ) ) {
53 foreach ( $field['accordions'] as $accordion ) {
54 $this->recursive_output_css( $accordion['fields'], $field );
55 }
56 }
57 }
58
59 if( $field_type === 'tabbed' ) {
60 if ( ! empty( $field['tabs'] ) ) {
61 foreach ( $field['tabs'] as $accordion ) {
62 $this->recursive_output_css( $accordion['fields'], $field );
63 }
64 }
65 }
66
67 if ( class_exists( $field_class ) ) {
68
69 if ( method_exists( $field_class, 'output' ) || method_exists( $field_class, 'enqueue_google_fonts' ) ) {
70
71 $field_value = '';
72
73 if ( $field_check && ( $this->abstract === 'options' || $this->abstract === 'customize' ) ) {
74
75 if( ! empty( $combine_field ) ) {
76
77 $field_value = ( isset( $this->options[$combine_field['id']][$field_id] ) ) ? $this->options[$combine_field['id']][$field_id] : '';
78
79 } else {
80
81 $field_value = ( isset( $this->options[$field_id] ) ) ? $this->options[$field_id] : '';
82
83 }
84
85 } else if ( $field_check && ( $this->abstract === 'metabox' && is_singular() || $this->abstract === 'taxonomy' && is_archive() ) ) {
86
87 if( ! empty( $combine_field ) ) {
88
89 $meta_value = $this->get_meta_value( $combine_field );
90 $field_value = ( isset( $meta_value[$field_id] ) ) ? $meta_value[$field_id] : '';
91
92 } else {
93
94 $meta_value = $this->get_meta_value( $field );
95 $field_value = ( isset( $meta_value ) ) ? $meta_value : '';
96
97 }
98
99 }
100
101 $instance = new $field_class( $field, $field_value, $this->unique, 'wp/enqueue', $this );
102
103 // typography enqueue and embed google web fonts
104 if ( $field_type === 'typography' && $this->args['enqueue_webfont'] && ! empty( $field_value['font-family'] ) ) {
105
106 $method = ( ! empty( $this->args['async_webfont'] ) ) ? 'async' : 'enqueue';
107
108 $instance->enqueue_google_fonts( $method );
109
110 }
111
112 // output css
113 if ( $field_output && $this->args['output_css'] ) {
114 ADMINIFY::$css .= $instance->output();
115 }
116
117 unset( $instance );
118
119 }
120
121 }
122
123 }
124
125 }
126
127 }
128
129 }
130
131 }
132 }
133