Passed
Push — master ( de7162...f256de )
by Brian
739:27 queued 623:54
created
vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -7,40 +7,40 @@
 block discarded – undo
7 7
  * Bail if we are not in WP.
8 8
  */
9 9
 if ( ! defined( 'ABSPATH' ) ) {
10
-	exit;
10
+    exit;
11 11
 }
12 12
 
13 13
 /**
14 14
  * Set the version only if its the current newest while loading.
15 15
  */
16 16
 add_action('after_setup_theme', function () {
17
-	global $ayecode_ui_version,$ayecode_ui_file_key;
18
-	$this_version = "0.1.11";
19
-	if(version_compare($this_version , $ayecode_ui_version, '>')){
20
-		$ayecode_ui_version = $this_version ;
21
-		$ayecode_ui_file_key = wp_hash( __FILE__ );
22
-	}
17
+    global $ayecode_ui_version,$ayecode_ui_file_key;
18
+    $this_version = "0.1.11";
19
+    if(version_compare($this_version , $ayecode_ui_version, '>')){
20
+        $ayecode_ui_version = $this_version ;
21
+        $ayecode_ui_file_key = wp_hash( __FILE__ );
22
+    }
23 23
 },0);
24 24
 
25 25
 /**
26 26
  * Load this version of WP Bootstrap Settings only if the file hash is the current one.
27 27
  */
28 28
 add_action('after_setup_theme', function () {
29
-	global $ayecode_ui_file_key;
30
-	if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){
31
-		include_once( dirname( __FILE__ ) . '/includes/class-aui.php' );
32
-		include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' );
33
-	}
29
+    global $ayecode_ui_file_key;
30
+    if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){
31
+        include_once( dirname( __FILE__ ) . '/includes/class-aui.php' );
32
+        include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' );
33
+    }
34 34
 },1);
35 35
 
36 36
 /**
37 37
  * Add the function that calls the class.
38 38
  */
39 39
 if(!function_exists('aui')){
40
-	function aui(){
41
-		if(!class_exists("AUI",false)){
42
-			return false;
43
-		}
44
-		return AUI::instance();
45
-	}
40
+    function aui(){
41
+        if(!class_exists("AUI",false)){
42
+            return false;
43
+        }
44
+        return AUI::instance();
45
+    }
46 46
 }
47 47
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,39 +6,39 @@
 block discarded – undo
6 6
 /**
7 7
  * Bail if we are not in WP.
8 8
  */
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if (!defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
13 13
 /**
14 14
  * Set the version only if its the current newest while loading.
15 15
  */
16
-add_action('after_setup_theme', function () {
17
-	global $ayecode_ui_version,$ayecode_ui_file_key;
16
+add_action('after_setup_theme', function() {
17
+	global $ayecode_ui_version, $ayecode_ui_file_key;
18 18
 	$this_version = "0.1.11";
19
-	if(version_compare($this_version , $ayecode_ui_version, '>')){
20
-		$ayecode_ui_version = $this_version ;
21
-		$ayecode_ui_file_key = wp_hash( __FILE__ );
19
+	if (version_compare($this_version, $ayecode_ui_version, '>')) {
20
+		$ayecode_ui_version = $this_version;
21
+		$ayecode_ui_file_key = wp_hash(__FILE__);
22 22
 	}
23 23
 },0);
24 24
 
25 25
 /**
26 26
  * Load this version of WP Bootstrap Settings only if the file hash is the current one.
27 27
  */
28
-add_action('after_setup_theme', function () {
28
+add_action('after_setup_theme', function() {
29 29
 	global $ayecode_ui_file_key;
30
-	if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){
31
-		include_once( dirname( __FILE__ ) . '/includes/class-aui.php' );
32
-		include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' );
30
+	if ($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash(__FILE__)) {
31
+		include_once(dirname(__FILE__) . '/includes/class-aui.php');
32
+		include_once(dirname(__FILE__) . '/includes/ayecode-ui-settings.php');
33 33
 	}
34 34
 },1);
35 35
 
36 36
 /**
37 37
  * Add the function that calls the class.
38 38
  */
39
-if(!function_exists('aui')){
40
-	function aui(){
41
-		if(!class_exists("AUI",false)){
39
+if (!function_exists('aui')) {
40
+	function aui() {
41
+		if (!class_exists("AUI", false)) {
42 42
 			return false;
43 43
 		}
44 44
 		return AUI::instance();
Please login to merge, or discard this patch.
ayecode/wp-ayecode-ui/includes/components/class-aui-component-input.php 3 patches
Indentation   +564 added lines, -564 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if ( ! defined( 'ABSPATH' ) ) {
4
-	exit; // Exit if accessed directly
4
+    exit; // Exit if accessed directly
5 5
 }
6 6
 
7 7
 /**
@@ -11,604 +11,604 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class AUI_Component_Input {
13 13
 
14
-	/**
15
-	 * Build the component.
16
-	 *
17
-	 * @param array $args
18
-	 *
19
-	 * @return string The rendered component.
20
-	 */
21
-	public static function input($args = array()){
22
-		$defaults = array(
23
-			'type'       => 'text',
24
-			'name'       => '',
25
-			'class'      => '',
26
-			'id'         => '',
27
-			'placeholder'=> '',
28
-			'title'      => '',
29
-			'value'      => '',
30
-			'required'   => false,
31
-			'label'      => '',
32
-			'label_after'=> false,
33
-			'label_class'=> '',
34
-			'validation_text'   => '',
35
-			'validation_pattern' => '',
36
-			'no_wrap'    => false,
37
-			'input_group_right' => '',
38
-			'input_group_left' => '',
39
-			'input_group_right_inside' => false, // forces the input group inside the input
40
-			'input_group_left_inside' => false, // forces the input group inside the input
41
-			'step'       => '',
42
-			'switch'     => false, // to show checkbox as a switch
43
-			'checked'   => false, // set a checkbox or radio as selected
44
-			'password_toggle' => true, // toggle view/hide password
45
-			'extra_attributes'  => array() // an array of extra attributes
46
-		);
47
-
48
-		/**
49
-		 * Parse incoming $args into an array and merge it with $defaults
50
-		 */
51
-		$args   = wp_parse_args( $args, $defaults );
52
-		$output = '';
53
-		if ( ! empty( $args['type'] ) ) {
54
-			$type = sanitize_html_class( $args['type'] );
55
-			$label_args = array('title'=>$args['label'],'for'=>$args['id'],'class' => $args['label_class']." ");
14
+    /**
15
+     * Build the component.
16
+     *
17
+     * @param array $args
18
+     *
19
+     * @return string The rendered component.
20
+     */
21
+    public static function input($args = array()){
22
+        $defaults = array(
23
+            'type'       => 'text',
24
+            'name'       => '',
25
+            'class'      => '',
26
+            'id'         => '',
27
+            'placeholder'=> '',
28
+            'title'      => '',
29
+            'value'      => '',
30
+            'required'   => false,
31
+            'label'      => '',
32
+            'label_after'=> false,
33
+            'label_class'=> '',
34
+            'validation_text'   => '',
35
+            'validation_pattern' => '',
36
+            'no_wrap'    => false,
37
+            'input_group_right' => '',
38
+            'input_group_left' => '',
39
+            'input_group_right_inside' => false, // forces the input group inside the input
40
+            'input_group_left_inside' => false, // forces the input group inside the input
41
+            'step'       => '',
42
+            'switch'     => false, // to show checkbox as a switch
43
+            'checked'   => false, // set a checkbox or radio as selected
44
+            'password_toggle' => true, // toggle view/hide password
45
+            'extra_attributes'  => array() // an array of extra attributes
46
+        );
47
+
48
+        /**
49
+         * Parse incoming $args into an array and merge it with $defaults
50
+         */
51
+        $args   = wp_parse_args( $args, $defaults );
52
+        $output = '';
53
+        if ( ! empty( $args['type'] ) ) {
54
+            $type = sanitize_html_class( $args['type'] );
55
+            $label_args = array('title'=>$args['label'],'for'=>$args['id'],'class' => $args['label_class']." ");
56 56
 			
57
-			// Some special sauce for files
58
-			if($type=='file' ){
59
-				$args['label_after'] = true; // if type file we need the label after
60
-				$args['class'] .= ' custom-file-input ';
61
-			}elseif($type=='checkbox'){
62
-				$args['label_after'] = true; // if type file we need the label after
63
-				$args['class'] .= ' custom-control-input ';
64
-			}
65
-
66
-
67
-			// label before
68
-			if(!empty($args['label']) && !$args['label_after']){
69
-				if($type == 'file'){$label_args['class'] .= 'custom-file-label';}
70
-				$output .= self::label( $label_args, $type );
71
-			}
72
-
73
-			// open/type
74
-			$output .= '<input type="' . $type . '" ';
75
-
76
-			// name
77
-			if(!empty($args['name'])){
78
-				$output .= ' name="'.sanitize_html_class($args['name']).'" ';
79
-			}
80
-
81
-			// id
82
-			if(!empty($args['id'])){
83
-				$output .= ' id="'.sanitize_html_class($args['id']).'" ';
84
-			}
85
-
86
-			// placeholder
87
-			if(!empty($args['placeholder'])){
88
-				$output .= ' placeholder="'.esc_attr($args['placeholder']).'" ';
89
-			}
90
-
91
-			// title
92
-			if(!empty($args['title'])){
93
-				$output .= ' title="'.esc_attr($args['title']).'" ';
94
-			}
95
-
96
-			// value
97
-			if(!empty($args['value'])){
98
-				$output .= ' value="'.sanitize_text_field($args['value']).'" ';
99
-			}
100
-
101
-			// checked, for radio and checkboxes
102
-			if( ( $type == 'checkbox' || $type == 'radio' ) && $args['checked'] ){
103
-				$output .= ' checked ';
104
-			}
105
-
106
-			// validation text
107
-			if(!empty($args['validation_text'])){
108
-				$output .= ' oninvalid="setCustomValidity(\''.esc_attr($args['validation_text']).'\')" ';
109
-				$output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
110
-			}
111
-
112
-			// validation_pattern
113
-			if(!empty($args['validation_pattern'])){
114
-				$output .= ' pattern="'.$args['validation_pattern'].'" ';
115
-			}
116
-
117
-			// step (for numbers)
118
-			if(!empty($args['step'])){
119
-				$output .= ' step="'.$args['step'].'" ';
120
-			}
121
-
122
-			// required
123
-			if(!empty($args['required'])){
124
-				$output .= ' required ';
125
-			}
126
-
127
-			// class
128
-			$class = !empty($args['class']) ? $args['class'] : '';
129
-			$output .= ' class="form-control '.$class.'" ';
130
-
131
-			// data-attributes
132
-			$output .= AUI_Component_Helper::data_attributes($args);
133
-
134
-			// extra attributes
135
-			if(!empty($args['extra_attributes'])){
136
-				$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
137
-			}
138
-
139
-			// close
140
-			$output .= ' >';
141
-
142
-			// label after
143
-			if(!empty($args['label']) && $args['label_after']){
144
-				if($type == 'file'){$label_args['class'] .= 'custom-file-label';}
145
-				elseif($type == 'checkbox'){$label_args['class'] .= 'custom-control-label';}
146
-				$output .= self::label( $label_args, $type );
147
-			}
57
+            // Some special sauce for files
58
+            if($type=='file' ){
59
+                $args['label_after'] = true; // if type file we need the label after
60
+                $args['class'] .= ' custom-file-input ';
61
+            }elseif($type=='checkbox'){
62
+                $args['label_after'] = true; // if type file we need the label after
63
+                $args['class'] .= ' custom-control-input ';
64
+            }
65
+
66
+
67
+            // label before
68
+            if(!empty($args['label']) && !$args['label_after']){
69
+                if($type == 'file'){$label_args['class'] .= 'custom-file-label';}
70
+                $output .= self::label( $label_args, $type );
71
+            }
72
+
73
+            // open/type
74
+            $output .= '<input type="' . $type . '" ';
75
+
76
+            // name
77
+            if(!empty($args['name'])){
78
+                $output .= ' name="'.sanitize_html_class($args['name']).'" ';
79
+            }
80
+
81
+            // id
82
+            if(!empty($args['id'])){
83
+                $output .= ' id="'.sanitize_html_class($args['id']).'" ';
84
+            }
85
+
86
+            // placeholder
87
+            if(!empty($args['placeholder'])){
88
+                $output .= ' placeholder="'.esc_attr($args['placeholder']).'" ';
89
+            }
90
+
91
+            // title
92
+            if(!empty($args['title'])){
93
+                $output .= ' title="'.esc_attr($args['title']).'" ';
94
+            }
95
+
96
+            // value
97
+            if(!empty($args['value'])){
98
+                $output .= ' value="'.sanitize_text_field($args['value']).'" ';
99
+            }
100
+
101
+            // checked, for radio and checkboxes
102
+            if( ( $type == 'checkbox' || $type == 'radio' ) && $args['checked'] ){
103
+                $output .= ' checked ';
104
+            }
105
+
106
+            // validation text
107
+            if(!empty($args['validation_text'])){
108
+                $output .= ' oninvalid="setCustomValidity(\''.esc_attr($args['validation_text']).'\')" ';
109
+                $output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
110
+            }
111
+
112
+            // validation_pattern
113
+            if(!empty($args['validation_pattern'])){
114
+                $output .= ' pattern="'.$args['validation_pattern'].'" ';
115
+            }
116
+
117
+            // step (for numbers)
118
+            if(!empty($args['step'])){
119
+                $output .= ' step="'.$args['step'].'" ';
120
+            }
121
+
122
+            // required
123
+            if(!empty($args['required'])){
124
+                $output .= ' required ';
125
+            }
126
+
127
+            // class
128
+            $class = !empty($args['class']) ? $args['class'] : '';
129
+            $output .= ' class="form-control '.$class.'" ';
130
+
131
+            // data-attributes
132
+            $output .= AUI_Component_Helper::data_attributes($args);
133
+
134
+            // extra attributes
135
+            if(!empty($args['extra_attributes'])){
136
+                $output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
137
+            }
138
+
139
+            // close
140
+            $output .= ' >';
141
+
142
+            // label after
143
+            if(!empty($args['label']) && $args['label_after']){
144
+                if($type == 'file'){$label_args['class'] .= 'custom-file-label';}
145
+                elseif($type == 'checkbox'){$label_args['class'] .= 'custom-control-label';}
146
+                $output .= self::label( $label_args, $type );
147
+            }
148 148
 
149 149
 			
150
-			// some input types need a separate wrap
151
-			if($type == 'file') {
152
-				$output = self::wrap( array(
153
-					'content' => $output,
154
-					'class'   => 'form-group custom-file'
155
-				) );
156
-			}elseif($type == 'checkbox'){
157
-				$wrap_class = $args['switch'] ? 'custom-switch' : 'custom-checkbox';
158
-				$output = self::wrap( array(
159
-					'content' => $output,
160
-					'class'   => 'custom-control '.$wrap_class
161
-				) );
162
-			}elseif($type == 'password' && $args['password_toggle'] && !$args['input_group_right']){
163
-
164
-
165
-				// allow password field to toggle view
166
-				$args['input_group_right'] = '<span class="input-group-text c-pointer px-3" 
150
+            // some input types need a separate wrap
151
+            if($type == 'file') {
152
+                $output = self::wrap( array(
153
+                    'content' => $output,
154
+                    'class'   => 'form-group custom-file'
155
+                ) );
156
+            }elseif($type == 'checkbox'){
157
+                $wrap_class = $args['switch'] ? 'custom-switch' : 'custom-checkbox';
158
+                $output = self::wrap( array(
159
+                    'content' => $output,
160
+                    'class'   => 'custom-control '.$wrap_class
161
+                ) );
162
+            }elseif($type == 'password' && $args['password_toggle'] && !$args['input_group_right']){
163
+
164
+
165
+                // allow password field to toggle view
166
+                $args['input_group_right'] = '<span class="input-group-text c-pointer px-3" 
167 167
 onclick="var $el = jQuery(this).find(\'i\');$el.toggleClass(\'fa-eye fa-eye-slash\');
168 168
 var $eli = jQuery(this).parent().parent().find(\'input\');
169 169
 if($el.hasClass(\'fa-eye\'))
170 170
 {$eli.attr(\'type\',\'text\');}
171 171
 else{$eli.attr(\'type\',\'password\');}"
172 172
 ><i class="far fa-fw fa-eye-slash"></i></span>';
173
-			}
174
-
175
-			// input group wraps
176
-			if($args['input_group_left'] || $args['input_group_right']){
177
-				$w100 = strpos($args['class'], 'w-100') !== false ? ' w-100' : '';
178
-				if($args['input_group_left']){
179
-					$output = self::wrap( array(
180
-						'content' => $output,
181
-						'class'   => $args['input_group_left_inside'] ? 'input-group-inside'.$w100  : 'input-group',
182
-						'input_group_left' => $args['input_group_left'],
183
-						'input_group_left_inside'    => $args['input_group_left_inside']
184
-					) );
185
-				}
186
-				if($args['input_group_right']){
187
-					$output = self::wrap( array(
188
-						'content' => $output,
189
-						'class'   => $args['input_group_right_inside'] ? 'input-group-inside'.$w100 : 'input-group',
190
-						'input_group_right' => $args['input_group_right'],
191
-						'input_group_right_inside'    => $args['input_group_right_inside']
192
-					) );
193
-				}
194
-
195
-				// Labels need to be on the outside of the wrap
196
-				$label = self::label( $label_args, $type );
197
-				$output = $label . str_replace($label,"",$output);
198
-			}
199
-
200
-			// wrap
201
-			if(!$args['no_wrap']){
202
-				$output = self::wrap(array(
203
-					'content' => $output,
204
-				));
205
-			}
206
-
207
-
208
-
209
-		}
210
-
211
-		return $output;
212
-	}
213
-
214
-	/**
215
-	 * Build the component.
216
-	 *
217
-	 * @param array $args
218
-	 *
219
-	 * @return string The rendered component.
220
-	 */
221
-	public static function textarea($args = array()){
222
-		$defaults = array(
223
-			'name'       => '',
224
-			'class'      => '',
225
-			'id'         => '',
226
-			'placeholder'=> '',
227
-			'title'      => '',
228
-			'value'      => '',
229
-			'required'   => false,
230
-			'label'      => '',
231
-			'validation_text'   => '',
232
-			'validation_pattern' => '',
233
-			'no_wrap'    => false,
234
-			'rows'      => '',
235
-			'wysiwyg'   => false,
236
-		);
237
-
238
-		/**
239
-		 * Parse incoming $args into an array and merge it with $defaults
240
-		 */
241
-		$args   = wp_parse_args( $args, $defaults );
242
-		$output = '';
243
-
244
-		// label
245
-		if(!empty($args['label']) && is_array($args['label'])){
246
-		}elseif(!empty($args['label'])){
247
-			$output .= self::label(array('title'=>$args['label'],'for'=>$args['id']));
248
-		}
249
-
250
-		if(!empty($args['wysiwyg'])){
251
-			ob_start();
252
-			$content = $args['value'];
253
-			$editor_id = !empty($args['id']) ? sanitize_html_class($args['id']) : 'wp_editor';
254
-			$settings = array(
255
-				'textarea_rows' => !empty(absint($args['rows'])) ? absint($args['rows']) : 4,
256
-				'quicktags'     => false,
257
-				'media_buttons' => false,
258
-				'editor_class'  => 'form-control',
259
-				'textarea_name' => !empty($args['name']) ? sanitize_html_class($args['name']) : sanitize_html_class($args['id']),
260
-				'teeny'         => true,
261
-			);
262
-
263
-			// maybe set settings if array
264
-			if(is_array($args['wysiwyg'])){
265
-				$settings  = wp_parse_args( $args['wysiwyg'], $settings );
266
-			}
267
-
268
-			wp_editor( $content, $editor_id, $settings );
269
-			$output .= ob_get_clean();
270
-		}else{
271
-
272
-			// open
273
-			$output .= '<textarea ';
274
-
275
-			// name
276
-			if(!empty($args['name'])){
277
-				$output .= ' name="'.sanitize_html_class($args['name']).'" ';
278
-			}
279
-
280
-			// id
281
-			if(!empty($args['id'])){
282
-				$output .= ' id="'.sanitize_html_class($args['id']).'" ';
283
-			}
284
-
285
-			// placeholder
286
-			if(!empty($args['placeholder'])){
287
-				$output .= ' placeholder="'.esc_attr($args['placeholder']).'" ';
288
-			}
289
-
290
-			// title
291
-			if(!empty($args['title'])){
292
-				$output .= ' title="'.esc_attr($args['title']).'" ';
293
-			}
294
-
295
-			// validation text
296
-			if(!empty($args['validation_text'])){
297
-				$output .= ' oninvalid="setCustomValidity(\''.esc_attr($args['validation_text']).'\')" ';
298
-				$output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
299
-			}
300
-
301
-			// validation_pattern
302
-			if(!empty($args['validation_pattern'])){
303
-				$output .= ' pattern="'.$args['validation_pattern'].'" ';
304
-			}
173
+            }
174
+
175
+            // input group wraps
176
+            if($args['input_group_left'] || $args['input_group_right']){
177
+                $w100 = strpos($args['class'], 'w-100') !== false ? ' w-100' : '';
178
+                if($args['input_group_left']){
179
+                    $output = self::wrap( array(
180
+                        'content' => $output,
181
+                        'class'   => $args['input_group_left_inside'] ? 'input-group-inside'.$w100  : 'input-group',
182
+                        'input_group_left' => $args['input_group_left'],
183
+                        'input_group_left_inside'    => $args['input_group_left_inside']
184
+                    ) );
185
+                }
186
+                if($args['input_group_right']){
187
+                    $output = self::wrap( array(
188
+                        'content' => $output,
189
+                        'class'   => $args['input_group_right_inside'] ? 'input-group-inside'.$w100 : 'input-group',
190
+                        'input_group_right' => $args['input_group_right'],
191
+                        'input_group_right_inside'    => $args['input_group_right_inside']
192
+                    ) );
193
+                }
194
+
195
+                // Labels need to be on the outside of the wrap
196
+                $label = self::label( $label_args, $type );
197
+                $output = $label . str_replace($label,"",$output);
198
+            }
199
+
200
+            // wrap
201
+            if(!$args['no_wrap']){
202
+                $output = self::wrap(array(
203
+                    'content' => $output,
204
+                ));
205
+            }
206
+
207
+
208
+
209
+        }
210
+
211
+        return $output;
212
+    }
213
+
214
+    /**
215
+     * Build the component.
216
+     *
217
+     * @param array $args
218
+     *
219
+     * @return string The rendered component.
220
+     */
221
+    public static function textarea($args = array()){
222
+        $defaults = array(
223
+            'name'       => '',
224
+            'class'      => '',
225
+            'id'         => '',
226
+            'placeholder'=> '',
227
+            'title'      => '',
228
+            'value'      => '',
229
+            'required'   => false,
230
+            'label'      => '',
231
+            'validation_text'   => '',
232
+            'validation_pattern' => '',
233
+            'no_wrap'    => false,
234
+            'rows'      => '',
235
+            'wysiwyg'   => false,
236
+        );
237
+
238
+        /**
239
+         * Parse incoming $args into an array and merge it with $defaults
240
+         */
241
+        $args   = wp_parse_args( $args, $defaults );
242
+        $output = '';
243
+
244
+        // label
245
+        if(!empty($args['label']) && is_array($args['label'])){
246
+        }elseif(!empty($args['label'])){
247
+            $output .= self::label(array('title'=>$args['label'],'for'=>$args['id']));
248
+        }
249
+
250
+        if(!empty($args['wysiwyg'])){
251
+            ob_start();
252
+            $content = $args['value'];
253
+            $editor_id = !empty($args['id']) ? sanitize_html_class($args['id']) : 'wp_editor';
254
+            $settings = array(
255
+                'textarea_rows' => !empty(absint($args['rows'])) ? absint($args['rows']) : 4,
256
+                'quicktags'     => false,
257
+                'media_buttons' => false,
258
+                'editor_class'  => 'form-control',
259
+                'textarea_name' => !empty($args['name']) ? sanitize_html_class($args['name']) : sanitize_html_class($args['id']),
260
+                'teeny'         => true,
261
+            );
262
+
263
+            // maybe set settings if array
264
+            if(is_array($args['wysiwyg'])){
265
+                $settings  = wp_parse_args( $args['wysiwyg'], $settings );
266
+            }
267
+
268
+            wp_editor( $content, $editor_id, $settings );
269
+            $output .= ob_get_clean();
270
+        }else{
271
+
272
+            // open
273
+            $output .= '<textarea ';
274
+
275
+            // name
276
+            if(!empty($args['name'])){
277
+                $output .= ' name="'.sanitize_html_class($args['name']).'" ';
278
+            }
279
+
280
+            // id
281
+            if(!empty($args['id'])){
282
+                $output .= ' id="'.sanitize_html_class($args['id']).'" ';
283
+            }
284
+
285
+            // placeholder
286
+            if(!empty($args['placeholder'])){
287
+                $output .= ' placeholder="'.esc_attr($args['placeholder']).'" ';
288
+            }
289
+
290
+            // title
291
+            if(!empty($args['title'])){
292
+                $output .= ' title="'.esc_attr($args['title']).'" ';
293
+            }
294
+
295
+            // validation text
296
+            if(!empty($args['validation_text'])){
297
+                $output .= ' oninvalid="setCustomValidity(\''.esc_attr($args['validation_text']).'\')" ';
298
+                $output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
299
+            }
300
+
301
+            // validation_pattern
302
+            if(!empty($args['validation_pattern'])){
303
+                $output .= ' pattern="'.$args['validation_pattern'].'" ';
304
+            }
305 305
 
306
-			// required
307
-			if(!empty($args['required'])){
308
-				$output .= ' required ';
309
-			}
310
-
311
-			// rows
312
-			if(!empty($args['rows'])){
313
-				$output .= ' rows="'.absint($args['rows']).'" ';
314
-			}
315
-
316
-
317
-			// class
318
-			$class = !empty($args['class']) ? $args['class'] : '';
319
-			$output .= ' class="form-control '.$class.'" ';
320
-
321
-
322
-			// close tag
323
-			$output .= ' >';
324
-
325
-			// value
326
-			if(!empty($args['value'])){
327
-				$output .= sanitize_textarea_field($args['value']);
328
-			}
329
-
330
-			// closing tag
331
-			$output .= '</textarea>';
306
+            // required
307
+            if(!empty($args['required'])){
308
+                $output .= ' required ';
309
+            }
310
+
311
+            // rows
312
+            if(!empty($args['rows'])){
313
+                $output .= ' rows="'.absint($args['rows']).'" ';
314
+            }
315
+
316
+
317
+            // class
318
+            $class = !empty($args['class']) ? $args['class'] : '';
319
+            $output .= ' class="form-control '.$class.'" ';
320
+
321
+
322
+            // close tag
323
+            $output .= ' >';
324
+
325
+            // value
326
+            if(!empty($args['value'])){
327
+                $output .= sanitize_textarea_field($args['value']);
328
+            }
329
+
330
+            // closing tag
331
+            $output .= '</textarea>';
332 332
 
333
-		}
333
+        }
334 334
 
335 335
 
336
-		// wrap
337
-		if(!$args['no_wrap']){
338
-			$output = self::wrap(array(
339
-				'content' => $output,
340
-			));
341
-		}
336
+        // wrap
337
+        if(!$args['no_wrap']){
338
+            $output = self::wrap(array(
339
+                'content' => $output,
340
+            ));
341
+        }
342 342
 
343 343
 
344 344
 
345 345
 
346 346
 
347
-		return $output;
348
-	}
347
+        return $output;
348
+    }
349 349
 
350
-	public static function label($args = array(), $type = ''){
351
-		//<label for="exampleInputEmail1">Email address</label>
352
-		$defaults = array(
353
-			'title'       => 'div',
354
-			'for'      => '',
355
-			'class'      => '',
356
-		);
350
+    public static function label($args = array(), $type = ''){
351
+        //<label for="exampleInputEmail1">Email address</label>
352
+        $defaults = array(
353
+            'title'       => 'div',
354
+            'for'      => '',
355
+            'class'      => '',
356
+        );
357 357
 
358
-		/**
359
-		 * Parse incoming $args into an array and merge it with $defaults
360
-		 */
361
-		$args   = wp_parse_args( $args, $defaults );
362
-		$output = '';
358
+        /**
359
+         * Parse incoming $args into an array and merge it with $defaults
360
+         */
361
+        $args   = wp_parse_args( $args, $defaults );
362
+        $output = '';
363 363
 
364
-		if($args['title']){
364
+        if($args['title']){
365 365
 
366
-			// maybe hide labels //@todo set a global option for visibility class
367
-			if($type == 'file' || $type == 'checkbox'){
368
-				$class = $args['class'];
369
-			}else{
370
-				$class = 'sr-only '.$args['class'];
371
-			}
366
+            // maybe hide labels //@todo set a global option for visibility class
367
+            if($type == 'file' || $type == 'checkbox'){
368
+                $class = $args['class'];
369
+            }else{
370
+                $class = 'sr-only '.$args['class'];
371
+            }
372 372
 
373 373
 
374
-			// open
375
-			$output .= '<label ';
374
+            // open
375
+            $output .= '<label ';
376 376
 
377
-			// for
378
-			if(!empty($args['for'])){
379
-				$output .= ' for="'.sanitize_text_field($args['for']).'" ';
380
-			}
377
+            // for
378
+            if(!empty($args['for'])){
379
+                $output .= ' for="'.sanitize_text_field($args['for']).'" ';
380
+            }
381 381
 
382
-			// class
383
-			$output .= ' class="'.$class.'" ';
382
+            // class
383
+            $output .= ' class="'.$class.'" ';
384 384
 
385
-			// close
386
-			$output .= '>';
385
+            // close
386
+            $output .= '>';
387 387
 
388 388
 
389
-			// title
390
-			if(!empty($args['title'])){
391
-				$output .= esc_attr($args['title']);
392
-			}
389
+            // title
390
+            if(!empty($args['title'])){
391
+                $output .= esc_attr($args['title']);
392
+            }
393 393
 
394
-			// close wrap
395
-			$output .= '</label>';
394
+            // close wrap
395
+            $output .= '</label>';
396 396
 
397 397
 
398
-		}
398
+        }
399 399
 
400 400
 
401
-		return $output;
402
-	}
401
+        return $output;
402
+    }
403 403
 
404
-	public static function wrap($args = array()){
405
-		$defaults = array(
406
-			'type'       => 'div',
407
-			'class'      => 'form-group',
408
-			'content'   => '',
409
-			'input_group_left' => '',
410
-			'input_group_right' => '',
411
-			'input_group_left_inside' => false,
412
-			'input_group_right_inside' => false,
413
-		);
404
+    public static function wrap($args = array()){
405
+        $defaults = array(
406
+            'type'       => 'div',
407
+            'class'      => 'form-group',
408
+            'content'   => '',
409
+            'input_group_left' => '',
410
+            'input_group_right' => '',
411
+            'input_group_left_inside' => false,
412
+            'input_group_right_inside' => false,
413
+        );
414 414
 
415
-		/**
416
-		 * Parse incoming $args into an array and merge it with $defaults
417
-		 */
418
-		$args   = wp_parse_args( $args, $defaults );
419
-		$output = '';
420
-		if($args['type']){
421
-
422
-			// open
423
-			$output .= '<'.sanitize_html_class($args['type']);
424
-
425
-			// class
426
-			$class = !empty($args['class']) ? $args['class'] : '';
427
-			$output .= ' class="'.$class.'" ';
428
-
429
-			// close wrap
430
-			$output .= ' >';
431
-
432
-
433
-			// Input group left
434
-			if(!empty($args['input_group_left'])){
435
-				$position_class = !empty($args['input_group_left_inside']) ? 'position-absolute' : '';
436
-				$input_group_left = strpos($args['input_group_left'], '<') !== false ? $args['input_group_left'] : '<span class="input-group-text">'.$args['input_group_left'].'</span>';
437
-				$output .= '<div class="input-group-prepend '.$position_class.'">'.$input_group_left.'</div>';
438
-			}
439
-
440
-			// content
441
-			$output .= $args['content'];
442
-
443
-			// Input group right
444
-			if(!empty($args['input_group_right'])){
445
-				$position_class = !empty($args['input_group_left_inside']) ? 'position-absolute' : '';
446
-				$input_group_right = strpos($args['input_group_right'], '<') !== false ? $args['input_group_right'] : '<span class="input-group-text">'.$args['input_group_right'].'</span>';
447
-				$output .= '<div class="input-group-append '.$position_class.'">'.$input_group_right.'</div>';
448
-			}
449
-
450
-
451
-			// close wrap
452
-			$output .= '</'.sanitize_html_class($args['type']).'>';
453
-
454
-
455
-		}else{
456
-			$output = $args['content'];
457
-		}
458
-
459
-		return $output;
460
-	}
461
-
462
-	/**
463
-	 * Build the component.
464
-	 *
465
-	 * @param array $args
466
-	 *
467
-	 * @return string The rendered component.
468
-	 */
469
-	public static function select($args = array()){
470
-		$defaults = array(
471
-			'class'      => '',
472
-			'id'         => '',
473
-			'title'      => '',
474
-			'value'      => '', // can be an array or a string
475
-			'required'   => false,
476
-			'label'      => '',
477
-			'placeholder'=> '',
478
-			'options'    => array(),
479
-			'icon'       => '',
480
-			'multiple'   => false,
481
-			'select2'    => false,
482
-			'no_wrap'    => false,
483
-		);
484
-
485
-		/**
486
-		 * Parse incoming $args into an array and merge it with $defaults
487
-		 */
488
-		$args   = wp_parse_args( $args, $defaults );
489
-		$output = '';
490
-
491
-		// Maybe setup select2
492
-		$is_select2 = false;
493
-		if(!empty($args['select2'])){
494
-			$args['class'] .= ' aui-select2';
495
-			$is_select2 = true;
496
-		}elseif( strpos($args['class'], 'aui-select2') !== false){
497
-			$is_select2 = true;
498
-		}
499
-
500
-		// select2 tags
501
-		if( !empty($args['select2']) && $args['select2'] === 'tags'){ // triple equlas needed here for some reason
502
-			$args['data-tags'] = 'true';
503
-			$args['data-token-separators'] = "[',']";
504
-			$args['multiple'] = true;
505
-		}
506
-
507
-		// select2 placeholder
508
-		if($is_select2 && !empty($args['placeholder']) && empty($args['data-placeholder'])){
509
-			$args['data-placeholder'] = esc_attr($args['placeholder']);
510
-			$args['data-allow-clear'] = empty($args['data-allow-clear']) ? true : esc_attr($args['data-allow-clear']);
511
-		}
512
-
513
-		// label
514
-		if(!empty($args['label']) && is_array($args['label'])){
515
-		}elseif(!empty($args['label'])){
516
-			$output .= self::label(array('title'=>$args['label'],'for'=>$args['id']));
517
-		}
518
-
519
-		// open/type
520
-		$output .= '<select ';
521
-
522
-		// class
523
-		$class = !empty($args['class']) ? $args['class'] : '';
524
-		$output .= AUI_Component_Helper::class_attr('custom-select '.$class);
525
-
526
-		// name
527
-		if(!empty($args['name'])){
528
-			$output .= AUI_Component_Helper::name($args['name'],$args['multiple']);
529
-		}
530
-
531
-		// id
532
-		if(!empty($args['id'])){
533
-			$output .= AUI_Component_Helper::id($args['id']);
534
-		}
535
-
536
-		// title
537
-		if(!empty($args['title'])){
538
-			$output .= AUI_Component_Helper::title($args['title']);
539
-		}
540
-
541
-		// data-attributes
542
-		$output .= AUI_Component_Helper::data_attributes($args);
543
-
544
-		// aria-attributes
545
-		$output .= AUI_Component_Helper::aria_attributes($args);
546
-
547
-		// required
548
-		if(!empty($args['required'])){
549
-			$output .= ' required ';
550
-		}
551
-
552
-		// multiple
553
-		if(!empty($args['multiple'])){
554
-			$output .= ' multiple ';
555
-		}
556
-
557
-		// close opening tag
558
-		$output .= ' >';
559
-
560
-		// placeholder
561
-		if(!empty($args['placeholder']) && !$is_select2){
562
-			$output .= '<option value="" disabled selected hidden>'.esc_attr($args['placeholder']).'</option>';
563
-		}
564
-
565
-		// Options
566
-		if(!empty($args['options'])){
567
-			foreach($args['options'] as $val => $name){
568
-				if(is_array($name)){
569
-					if (isset($name['optgroup']) && ($name['optgroup'] == 'start' || $name['optgroup'] == 'end')) {
570
-						$option_label = isset($name['label']) ? $name['label'] : '';
571
-
572
-						$output .= $name['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
573
-					} else {
574
-						$option_label = isset($name['label']) ? $name['label'] : '';
575
-						$option_value = isset($name['value']) ? $name['value'] : '';
576
-
577
-						if(!empty($args['multiple']) && !empty($args['value'])){
578
-							$selected = in_array($option_value, stripslashes_deep($args['value'])) ? "selected" : "";
579
-						} else {
580
-							$selected = selected($option_value,stripslashes_deep($args['value']), false);
581
-						}
582
-
583
-						$output .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
584
-					}
585
-				}else{
586
-					$selected = '';
587
-					if(!empty($args['value'])){
588
-						if(is_array($args['value'])){
589
-							$selected = in_array($val,$args['value']) ? 'selected="selected"' : '';
590
-						}else{
591
-							$selected = selected( $args['value'], $val, false);
592
-						}
593
-					}
594
-					$output .= '<option value="'.esc_attr($val).'" '.$selected.'>'.esc_attr($name).'</option>';	
595
-				}
596
-			}
597
-
598
-		}
599
-
600
-		// closing tag
601
-		$output .= '</select>';
602
-
603
-		// wrap
604
-		if(!$args['no_wrap']){
605
-			$output = self::wrap(array(
606
-				'content' => $output,
607
-			));
608
-		}
609
-
610
-
611
-		return $output;
612
-	}
415
+        /**
416
+         * Parse incoming $args into an array and merge it with $defaults
417
+         */
418
+        $args   = wp_parse_args( $args, $defaults );
419
+        $output = '';
420
+        if($args['type']){
421
+
422
+            // open
423
+            $output .= '<'.sanitize_html_class($args['type']);
424
+
425
+            // class
426
+            $class = !empty($args['class']) ? $args['class'] : '';
427
+            $output .= ' class="'.$class.'" ';
428
+
429
+            // close wrap
430
+            $output .= ' >';
431
+
432
+
433
+            // Input group left
434
+            if(!empty($args['input_group_left'])){
435
+                $position_class = !empty($args['input_group_left_inside']) ? 'position-absolute' : '';
436
+                $input_group_left = strpos($args['input_group_left'], '<') !== false ? $args['input_group_left'] : '<span class="input-group-text">'.$args['input_group_left'].'</span>';
437
+                $output .= '<div class="input-group-prepend '.$position_class.'">'.$input_group_left.'</div>';
438
+            }
439
+
440
+            // content
441
+            $output .= $args['content'];
442
+
443
+            // Input group right
444
+            if(!empty($args['input_group_right'])){
445
+                $position_class = !empty($args['input_group_left_inside']) ? 'position-absolute' : '';
446
+                $input_group_right = strpos($args['input_group_right'], '<') !== false ? $args['input_group_right'] : '<span class="input-group-text">'.$args['input_group_right'].'</span>';
447
+                $output .= '<div class="input-group-append '.$position_class.'">'.$input_group_right.'</div>';
448
+            }
449
+
450
+
451
+            // close wrap
452
+            $output .= '</'.sanitize_html_class($args['type']).'>';
453
+
454
+
455
+        }else{
456
+            $output = $args['content'];
457
+        }
458
+
459
+        return $output;
460
+    }
461
+
462
+    /**
463
+     * Build the component.
464
+     *
465
+     * @param array $args
466
+     *
467
+     * @return string The rendered component.
468
+     */
469
+    public static function select($args = array()){
470
+        $defaults = array(
471
+            'class'      => '',
472
+            'id'         => '',
473
+            'title'      => '',
474
+            'value'      => '', // can be an array or a string
475
+            'required'   => false,
476
+            'label'      => '',
477
+            'placeholder'=> '',
478
+            'options'    => array(),
479
+            'icon'       => '',
480
+            'multiple'   => false,
481
+            'select2'    => false,
482
+            'no_wrap'    => false,
483
+        );
484
+
485
+        /**
486
+         * Parse incoming $args into an array and merge it with $defaults
487
+         */
488
+        $args   = wp_parse_args( $args, $defaults );
489
+        $output = '';
490
+
491
+        // Maybe setup select2
492
+        $is_select2 = false;
493
+        if(!empty($args['select2'])){
494
+            $args['class'] .= ' aui-select2';
495
+            $is_select2 = true;
496
+        }elseif( strpos($args['class'], 'aui-select2') !== false){
497
+            $is_select2 = true;
498
+        }
499
+
500
+        // select2 tags
501
+        if( !empty($args['select2']) && $args['select2'] === 'tags'){ // triple equlas needed here for some reason
502
+            $args['data-tags'] = 'true';
503
+            $args['data-token-separators'] = "[',']";
504
+            $args['multiple'] = true;
505
+        }
506
+
507
+        // select2 placeholder
508
+        if($is_select2 && !empty($args['placeholder']) && empty($args['data-placeholder'])){
509
+            $args['data-placeholder'] = esc_attr($args['placeholder']);
510
+            $args['data-allow-clear'] = empty($args['data-allow-clear']) ? true : esc_attr($args['data-allow-clear']);
511
+        }
512
+
513
+        // label
514
+        if(!empty($args['label']) && is_array($args['label'])){
515
+        }elseif(!empty($args['label'])){
516
+            $output .= self::label(array('title'=>$args['label'],'for'=>$args['id']));
517
+        }
518
+
519
+        // open/type
520
+        $output .= '<select ';
521
+
522
+        // class
523
+        $class = !empty($args['class']) ? $args['class'] : '';
524
+        $output .= AUI_Component_Helper::class_attr('custom-select '.$class);
525
+
526
+        // name
527
+        if(!empty($args['name'])){
528
+            $output .= AUI_Component_Helper::name($args['name'],$args['multiple']);
529
+        }
530
+
531
+        // id
532
+        if(!empty($args['id'])){
533
+            $output .= AUI_Component_Helper::id($args['id']);
534
+        }
535
+
536
+        // title
537
+        if(!empty($args['title'])){
538
+            $output .= AUI_Component_Helper::title($args['title']);
539
+        }
540
+
541
+        // data-attributes
542
+        $output .= AUI_Component_Helper::data_attributes($args);
543
+
544
+        // aria-attributes
545
+        $output .= AUI_Component_Helper::aria_attributes($args);
546
+
547
+        // required
548
+        if(!empty($args['required'])){
549
+            $output .= ' required ';
550
+        }
551
+
552
+        // multiple
553
+        if(!empty($args['multiple'])){
554
+            $output .= ' multiple ';
555
+        }
556
+
557
+        // close opening tag
558
+        $output .= ' >';
559
+
560
+        // placeholder
561
+        if(!empty($args['placeholder']) && !$is_select2){
562
+            $output .= '<option value="" disabled selected hidden>'.esc_attr($args['placeholder']).'</option>';
563
+        }
564
+
565
+        // Options
566
+        if(!empty($args['options'])){
567
+            foreach($args['options'] as $val => $name){
568
+                if(is_array($name)){
569
+                    if (isset($name['optgroup']) && ($name['optgroup'] == 'start' || $name['optgroup'] == 'end')) {
570
+                        $option_label = isset($name['label']) ? $name['label'] : '';
571
+
572
+                        $output .= $name['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
573
+                    } else {
574
+                        $option_label = isset($name['label']) ? $name['label'] : '';
575
+                        $option_value = isset($name['value']) ? $name['value'] : '';
576
+
577
+                        if(!empty($args['multiple']) && !empty($args['value'])){
578
+                            $selected = in_array($option_value, stripslashes_deep($args['value'])) ? "selected" : "";
579
+                        } else {
580
+                            $selected = selected($option_value,stripslashes_deep($args['value']), false);
581
+                        }
582
+
583
+                        $output .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
584
+                    }
585
+                }else{
586
+                    $selected = '';
587
+                    if(!empty($args['value'])){
588
+                        if(is_array($args['value'])){
589
+                            $selected = in_array($val,$args['value']) ? 'selected="selected"' : '';
590
+                        }else{
591
+                            $selected = selected( $args['value'], $val, false);
592
+                        }
593
+                    }
594
+                    $output .= '<option value="'.esc_attr($val).'" '.$selected.'>'.esc_attr($name).'</option>';	
595
+                }
596
+            }
597
+
598
+        }
599
+
600
+        // closing tag
601
+        $output .= '</select>';
602
+
603
+        // wrap
604
+        if(!$args['no_wrap']){
605
+            $output = self::wrap(array(
606
+                'content' => $output,
607
+            ));
608
+        }
609
+
610
+
611
+        return $output;
612
+    }
613 613
 
614 614
 }
615 615
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
 	exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @return string The rendered component.
20 20
 	 */
21
-	public static function input($args = array()){
21
+	public static function input($args = array()) {
22 22
 		$defaults = array(
23 23
 			'type'       => 'text',
24 24
 			'name'       => '',
@@ -48,91 +48,91 @@  discard block
 block discarded – undo
48 48
 		/**
49 49
 		 * Parse incoming $args into an array and merge it with $defaults
50 50
 		 */
51
-		$args   = wp_parse_args( $args, $defaults );
51
+		$args   = wp_parse_args($args, $defaults);
52 52
 		$output = '';
53
-		if ( ! empty( $args['type'] ) ) {
54
-			$type = sanitize_html_class( $args['type'] );
55
-			$label_args = array('title'=>$args['label'],'for'=>$args['id'],'class' => $args['label_class']." ");
53
+		if (!empty($args['type'])) {
54
+			$type = sanitize_html_class($args['type']);
55
+			$label_args = array('title'=>$args['label'], 'for'=>$args['id'], 'class' => $args['label_class'] . " ");
56 56
 			
57 57
 			// Some special sauce for files
58
-			if($type=='file' ){
58
+			if ($type == 'file') {
59 59
 				$args['label_after'] = true; // if type file we need the label after
60 60
 				$args['class'] .= ' custom-file-input ';
61
-			}elseif($type=='checkbox'){
61
+			}elseif ($type == 'checkbox') {
62 62
 				$args['label_after'] = true; // if type file we need the label after
63 63
 				$args['class'] .= ' custom-control-input ';
64 64
 			}
65 65
 
66 66
 
67 67
 			// label before
68
-			if(!empty($args['label']) && !$args['label_after']){
69
-				if($type == 'file'){$label_args['class'] .= 'custom-file-label';}
70
-				$output .= self::label( $label_args, $type );
68
+			if (!empty($args['label']) && !$args['label_after']) {
69
+				if ($type == 'file') {$label_args['class'] .= 'custom-file-label'; }
70
+				$output .= self::label($label_args, $type);
71 71
 			}
72 72
 
73 73
 			// open/type
74 74
 			$output .= '<input type="' . $type . '" ';
75 75
 
76 76
 			// name
77
-			if(!empty($args['name'])){
78
-				$output .= ' name="'.sanitize_html_class($args['name']).'" ';
77
+			if (!empty($args['name'])) {
78
+				$output .= ' name="' . sanitize_html_class($args['name']) . '" ';
79 79
 			}
80 80
 
81 81
 			// id
82
-			if(!empty($args['id'])){
83
-				$output .= ' id="'.sanitize_html_class($args['id']).'" ';
82
+			if (!empty($args['id'])) {
83
+				$output .= ' id="' . sanitize_html_class($args['id']) . '" ';
84 84
 			}
85 85
 
86 86
 			// placeholder
87
-			if(!empty($args['placeholder'])){
88
-				$output .= ' placeholder="'.esc_attr($args['placeholder']).'" ';
87
+			if (!empty($args['placeholder'])) {
88
+				$output .= ' placeholder="' . esc_attr($args['placeholder']) . '" ';
89 89
 			}
90 90
 
91 91
 			// title
92
-			if(!empty($args['title'])){
93
-				$output .= ' title="'.esc_attr($args['title']).'" ';
92
+			if (!empty($args['title'])) {
93
+				$output .= ' title="' . esc_attr($args['title']) . '" ';
94 94
 			}
95 95
 
96 96
 			// value
97
-			if(!empty($args['value'])){
98
-				$output .= ' value="'.sanitize_text_field($args['value']).'" ';
97
+			if (!empty($args['value'])) {
98
+				$output .= ' value="' . sanitize_text_field($args['value']) . '" ';
99 99
 			}
100 100
 
101 101
 			// checked, for radio and checkboxes
102
-			if( ( $type == 'checkbox' || $type == 'radio' ) && $args['checked'] ){
102
+			if (($type == 'checkbox' || $type == 'radio') && $args['checked']) {
103 103
 				$output .= ' checked ';
104 104
 			}
105 105
 
106 106
 			// validation text
107
-			if(!empty($args['validation_text'])){
108
-				$output .= ' oninvalid="setCustomValidity(\''.esc_attr($args['validation_text']).'\')" ';
107
+			if (!empty($args['validation_text'])) {
108
+				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr($args['validation_text']) . '\')" ';
109 109
 				$output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
110 110
 			}
111 111
 
112 112
 			// validation_pattern
113
-			if(!empty($args['validation_pattern'])){
114
-				$output .= ' pattern="'.$args['validation_pattern'].'" ';
113
+			if (!empty($args['validation_pattern'])) {
114
+				$output .= ' pattern="' . $args['validation_pattern'] . '" ';
115 115
 			}
116 116
 
117 117
 			// step (for numbers)
118
-			if(!empty($args['step'])){
119
-				$output .= ' step="'.$args['step'].'" ';
118
+			if (!empty($args['step'])) {
119
+				$output .= ' step="' . $args['step'] . '" ';
120 120
 			}
121 121
 
122 122
 			// required
123
-			if(!empty($args['required'])){
123
+			if (!empty($args['required'])) {
124 124
 				$output .= ' required ';
125 125
 			}
126 126
 
127 127
 			// class
128 128
 			$class = !empty($args['class']) ? $args['class'] : '';
129
-			$output .= ' class="form-control '.$class.'" ';
129
+			$output .= ' class="form-control ' . $class . '" ';
130 130
 
131 131
 			// data-attributes
132 132
 			$output .= AUI_Component_Helper::data_attributes($args);
133 133
 
134 134
 			// extra attributes
135
-			if(!empty($args['extra_attributes'])){
135
+			if (!empty($args['extra_attributes'])) {
136 136
 				$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
137 137
 			}
138 138
 
@@ -140,26 +140,26 @@  discard block
 block discarded – undo
140 140
 			$output .= ' >';
141 141
 
142 142
 			// label after
143
-			if(!empty($args['label']) && $args['label_after']){
144
-				if($type == 'file'){$label_args['class'] .= 'custom-file-label';}
145
-				elseif($type == 'checkbox'){$label_args['class'] .= 'custom-control-label';}
146
-				$output .= self::label( $label_args, $type );
143
+			if (!empty($args['label']) && $args['label_after']) {
144
+				if ($type == 'file') {$label_args['class'] .= 'custom-file-label'; }
145
+				elseif ($type == 'checkbox') {$label_args['class'] .= 'custom-control-label'; }
146
+				$output .= self::label($label_args, $type);
147 147
 			}
148 148
 
149 149
 			
150 150
 			// some input types need a separate wrap
151
-			if($type == 'file') {
152
-				$output = self::wrap( array(
151
+			if ($type == 'file') {
152
+				$output = self::wrap(array(
153 153
 					'content' => $output,
154 154
 					'class'   => 'form-group custom-file'
155
-				) );
156
-			}elseif($type == 'checkbox'){
155
+				));
156
+			}elseif ($type == 'checkbox') {
157 157
 				$wrap_class = $args['switch'] ? 'custom-switch' : 'custom-checkbox';
158
-				$output = self::wrap( array(
158
+				$output = self::wrap(array(
159 159
 					'content' => $output,
160
-					'class'   => 'custom-control '.$wrap_class
161
-				) );
162
-			}elseif($type == 'password' && $args['password_toggle'] && !$args['input_group_right']){
160
+					'class'   => 'custom-control ' . $wrap_class
161
+				));
162
+			}elseif ($type == 'password' && $args['password_toggle'] && !$args['input_group_right']) {
163 163
 
164 164
 
165 165
 				// allow password field to toggle view
@@ -173,32 +173,32 @@  discard block
 block discarded – undo
173 173
 			}
174 174
 
175 175
 			// input group wraps
176
-			if($args['input_group_left'] || $args['input_group_right']){
176
+			if ($args['input_group_left'] || $args['input_group_right']) {
177 177
 				$w100 = strpos($args['class'], 'w-100') !== false ? ' w-100' : '';
178
-				if($args['input_group_left']){
179
-					$output = self::wrap( array(
178
+				if ($args['input_group_left']) {
179
+					$output = self::wrap(array(
180 180
 						'content' => $output,
181
-						'class'   => $args['input_group_left_inside'] ? 'input-group-inside'.$w100  : 'input-group',
181
+						'class'   => $args['input_group_left_inside'] ? 'input-group-inside' . $w100 : 'input-group',
182 182
 						'input_group_left' => $args['input_group_left'],
183 183
 						'input_group_left_inside'    => $args['input_group_left_inside']
184
-					) );
184
+					));
185 185
 				}
186
-				if($args['input_group_right']){
187
-					$output = self::wrap( array(
186
+				if ($args['input_group_right']) {
187
+					$output = self::wrap(array(
188 188
 						'content' => $output,
189
-						'class'   => $args['input_group_right_inside'] ? 'input-group-inside'.$w100 : 'input-group',
189
+						'class'   => $args['input_group_right_inside'] ? 'input-group-inside' . $w100 : 'input-group',
190 190
 						'input_group_right' => $args['input_group_right'],
191 191
 						'input_group_right_inside'    => $args['input_group_right_inside']
192
-					) );
192
+					));
193 193
 				}
194 194
 
195 195
 				// Labels need to be on the outside of the wrap
196
-				$label = self::label( $label_args, $type );
197
-				$output = $label . str_replace($label,"",$output);
196
+				$label = self::label($label_args, $type);
197
+				$output = $label . str_replace($label, "", $output);
198 198
 			}
199 199
 
200 200
 			// wrap
201
-			if(!$args['no_wrap']){
201
+			if (!$args['no_wrap']) {
202 202
 				$output = self::wrap(array(
203 203
 					'content' => $output,
204 204
 				));
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 *
219 219
 	 * @return string The rendered component.
220 220
 	 */
221
-	public static function textarea($args = array()){
221
+	public static function textarea($args = array()) {
222 222
 		$defaults = array(
223 223
 			'name'       => '',
224 224
 			'class'      => '',
@@ -238,16 +238,16 @@  discard block
 block discarded – undo
238 238
 		/**
239 239
 		 * Parse incoming $args into an array and merge it with $defaults
240 240
 		 */
241
-		$args   = wp_parse_args( $args, $defaults );
241
+		$args   = wp_parse_args($args, $defaults);
242 242
 		$output = '';
243 243
 
244 244
 		// label
245
-		if(!empty($args['label']) && is_array($args['label'])){
246
-		}elseif(!empty($args['label'])){
247
-			$output .= self::label(array('title'=>$args['label'],'for'=>$args['id']));
245
+		if (!empty($args['label']) && is_array($args['label'])) {
246
+		}elseif (!empty($args['label'])) {
247
+			$output .= self::label(array('title'=>$args['label'], 'for'=>$args['id']));
248 248
 		}
249 249
 
250
-		if(!empty($args['wysiwyg'])){
250
+		if (!empty($args['wysiwyg'])) {
251 251
 			ob_start();
252 252
 			$content = $args['value'];
253 253
 			$editor_id = !empty($args['id']) ? sanitize_html_class($args['id']) : 'wp_editor';
@@ -261,69 +261,69 @@  discard block
 block discarded – undo
261 261
 			);
262 262
 
263 263
 			// maybe set settings if array
264
-			if(is_array($args['wysiwyg'])){
265
-				$settings  = wp_parse_args( $args['wysiwyg'], $settings );
264
+			if (is_array($args['wysiwyg'])) {
265
+				$settings = wp_parse_args($args['wysiwyg'], $settings);
266 266
 			}
267 267
 
268
-			wp_editor( $content, $editor_id, $settings );
268
+			wp_editor($content, $editor_id, $settings);
269 269
 			$output .= ob_get_clean();
270
-		}else{
270
+		} else {
271 271
 
272 272
 			// open
273 273
 			$output .= '<textarea ';
274 274
 
275 275
 			// name
276
-			if(!empty($args['name'])){
277
-				$output .= ' name="'.sanitize_html_class($args['name']).'" ';
276
+			if (!empty($args['name'])) {
277
+				$output .= ' name="' . sanitize_html_class($args['name']) . '" ';
278 278
 			}
279 279
 
280 280
 			// id
281
-			if(!empty($args['id'])){
282
-				$output .= ' id="'.sanitize_html_class($args['id']).'" ';
281
+			if (!empty($args['id'])) {
282
+				$output .= ' id="' . sanitize_html_class($args['id']) . '" ';
283 283
 			}
284 284
 
285 285
 			// placeholder
286
-			if(!empty($args['placeholder'])){
287
-				$output .= ' placeholder="'.esc_attr($args['placeholder']).'" ';
286
+			if (!empty($args['placeholder'])) {
287
+				$output .= ' placeholder="' . esc_attr($args['placeholder']) . '" ';
288 288
 			}
289 289
 
290 290
 			// title
291
-			if(!empty($args['title'])){
292
-				$output .= ' title="'.esc_attr($args['title']).'" ';
291
+			if (!empty($args['title'])) {
292
+				$output .= ' title="' . esc_attr($args['title']) . '" ';
293 293
 			}
294 294
 
295 295
 			// validation text
296
-			if(!empty($args['validation_text'])){
297
-				$output .= ' oninvalid="setCustomValidity(\''.esc_attr($args['validation_text']).'\')" ';
296
+			if (!empty($args['validation_text'])) {
297
+				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr($args['validation_text']) . '\')" ';
298 298
 				$output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
299 299
 			}
300 300
 
301 301
 			// validation_pattern
302
-			if(!empty($args['validation_pattern'])){
303
-				$output .= ' pattern="'.$args['validation_pattern'].'" ';
302
+			if (!empty($args['validation_pattern'])) {
303
+				$output .= ' pattern="' . $args['validation_pattern'] . '" ';
304 304
 			}
305 305
 
306 306
 			// required
307
-			if(!empty($args['required'])){
307
+			if (!empty($args['required'])) {
308 308
 				$output .= ' required ';
309 309
 			}
310 310
 
311 311
 			// rows
312
-			if(!empty($args['rows'])){
313
-				$output .= ' rows="'.absint($args['rows']).'" ';
312
+			if (!empty($args['rows'])) {
313
+				$output .= ' rows="' . absint($args['rows']) . '" ';
314 314
 			}
315 315
 
316 316
 
317 317
 			// class
318 318
 			$class = !empty($args['class']) ? $args['class'] : '';
319
-			$output .= ' class="form-control '.$class.'" ';
319
+			$output .= ' class="form-control ' . $class . '" ';
320 320
 
321 321
 
322 322
 			// close tag
323 323
 			$output .= ' >';
324 324
 
325 325
 			// value
326
-			if(!empty($args['value'])){
326
+			if (!empty($args['value'])) {
327 327
 				$output .= sanitize_textarea_field($args['value']);
328 328
 			}
329 329
 
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 
335 335
 
336 336
 		// wrap
337
-		if(!$args['no_wrap']){
337
+		if (!$args['no_wrap']) {
338 338
 			$output = self::wrap(array(
339 339
 				'content' => $output,
340 340
 			));
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 		return $output;
348 348
 	}
349 349
 
350
-	public static function label($args = array(), $type = ''){
350
+	public static function label($args = array(), $type = '') {
351 351
 		//<label for="exampleInputEmail1">Email address</label>
352 352
 		$defaults = array(
353 353
 			'title'       => 'div',
@@ -358,16 +358,16 @@  discard block
 block discarded – undo
358 358
 		/**
359 359
 		 * Parse incoming $args into an array and merge it with $defaults
360 360
 		 */
361
-		$args   = wp_parse_args( $args, $defaults );
361
+		$args   = wp_parse_args($args, $defaults);
362 362
 		$output = '';
363 363
 
364
-		if($args['title']){
364
+		if ($args['title']) {
365 365
 
366 366
 			// maybe hide labels //@todo set a global option for visibility class
367
-			if($type == 'file' || $type == 'checkbox'){
367
+			if ($type == 'file' || $type == 'checkbox') {
368 368
 				$class = $args['class'];
369
-			}else{
370
-				$class = 'sr-only '.$args['class'];
369
+			} else {
370
+				$class = 'sr-only ' . $args['class'];
371 371
 			}
372 372
 
373 373
 
@@ -375,19 +375,19 @@  discard block
 block discarded – undo
375 375
 			$output .= '<label ';
376 376
 
377 377
 			// for
378
-			if(!empty($args['for'])){
379
-				$output .= ' for="'.sanitize_text_field($args['for']).'" ';
378
+			if (!empty($args['for'])) {
379
+				$output .= ' for="' . sanitize_text_field($args['for']) . '" ';
380 380
 			}
381 381
 
382 382
 			// class
383
-			$output .= ' class="'.$class.'" ';
383
+			$output .= ' class="' . $class . '" ';
384 384
 
385 385
 			// close
386 386
 			$output .= '>';
387 387
 
388 388
 
389 389
 			// title
390
-			if(!empty($args['title'])){
390
+			if (!empty($args['title'])) {
391 391
 				$output .= esc_attr($args['title']);
392 392
 			}
393 393
 
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 		return $output;
402 402
 	}
403 403
 
404
-	public static function wrap($args = array()){
404
+	public static function wrap($args = array()) {
405 405
 		$defaults = array(
406 406
 			'type'       => 'div',
407 407
 			'class'      => 'form-group',
@@ -415,44 +415,44 @@  discard block
 block discarded – undo
415 415
 		/**
416 416
 		 * Parse incoming $args into an array and merge it with $defaults
417 417
 		 */
418
-		$args   = wp_parse_args( $args, $defaults );
418
+		$args   = wp_parse_args($args, $defaults);
419 419
 		$output = '';
420
-		if($args['type']){
420
+		if ($args['type']) {
421 421
 
422 422
 			// open
423
-			$output .= '<'.sanitize_html_class($args['type']);
423
+			$output .= '<' . sanitize_html_class($args['type']);
424 424
 
425 425
 			// class
426 426
 			$class = !empty($args['class']) ? $args['class'] : '';
427
-			$output .= ' class="'.$class.'" ';
427
+			$output .= ' class="' . $class . '" ';
428 428
 
429 429
 			// close wrap
430 430
 			$output .= ' >';
431 431
 
432 432
 
433 433
 			// Input group left
434
-			if(!empty($args['input_group_left'])){
434
+			if (!empty($args['input_group_left'])) {
435 435
 				$position_class = !empty($args['input_group_left_inside']) ? 'position-absolute' : '';
436
-				$input_group_left = strpos($args['input_group_left'], '<') !== false ? $args['input_group_left'] : '<span class="input-group-text">'.$args['input_group_left'].'</span>';
437
-				$output .= '<div class="input-group-prepend '.$position_class.'">'.$input_group_left.'</div>';
436
+				$input_group_left = strpos($args['input_group_left'], '<') !== false ? $args['input_group_left'] : '<span class="input-group-text">' . $args['input_group_left'] . '</span>';
437
+				$output .= '<div class="input-group-prepend ' . $position_class . '">' . $input_group_left . '</div>';
438 438
 			}
439 439
 
440 440
 			// content
441 441
 			$output .= $args['content'];
442 442
 
443 443
 			// Input group right
444
-			if(!empty($args['input_group_right'])){
444
+			if (!empty($args['input_group_right'])) {
445 445
 				$position_class = !empty($args['input_group_left_inside']) ? 'position-absolute' : '';
446
-				$input_group_right = strpos($args['input_group_right'], '<') !== false ? $args['input_group_right'] : '<span class="input-group-text">'.$args['input_group_right'].'</span>';
447
-				$output .= '<div class="input-group-append '.$position_class.'">'.$input_group_right.'</div>';
446
+				$input_group_right = strpos($args['input_group_right'], '<') !== false ? $args['input_group_right'] : '<span class="input-group-text">' . $args['input_group_right'] . '</span>';
447
+				$output .= '<div class="input-group-append ' . $position_class . '">' . $input_group_right . '</div>';
448 448
 			}
449 449
 
450 450
 
451 451
 			// close wrap
452
-			$output .= '</'.sanitize_html_class($args['type']).'>';
452
+			$output .= '</' . sanitize_html_class($args['type']) . '>';
453 453
 
454 454
 
455
-		}else{
455
+		} else {
456 456
 			$output = $args['content'];
457 457
 		}
458 458
 
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 	 *
467 467
 	 * @return string The rendered component.
468 468
 	 */
469
-	public static function select($args = array()){
469
+	public static function select($args = array()) {
470 470
 		$defaults = array(
471 471
 			'class'      => '',
472 472
 			'id'         => '',
@@ -485,35 +485,35 @@  discard block
 block discarded – undo
485 485
 		/**
486 486
 		 * Parse incoming $args into an array and merge it with $defaults
487 487
 		 */
488
-		$args   = wp_parse_args( $args, $defaults );
488
+		$args   = wp_parse_args($args, $defaults);
489 489
 		$output = '';
490 490
 
491 491
 		// Maybe setup select2
492 492
 		$is_select2 = false;
493
-		if(!empty($args['select2'])){
493
+		if (!empty($args['select2'])) {
494 494
 			$args['class'] .= ' aui-select2';
495 495
 			$is_select2 = true;
496
-		}elseif( strpos($args['class'], 'aui-select2') !== false){
496
+		}elseif (strpos($args['class'], 'aui-select2') !== false) {
497 497
 			$is_select2 = true;
498 498
 		}
499 499
 
500 500
 		// select2 tags
501
-		if( !empty($args['select2']) && $args['select2'] === 'tags'){ // triple equlas needed here for some reason
501
+		if (!empty($args['select2']) && $args['select2'] === 'tags') { // triple equlas needed here for some reason
502 502
 			$args['data-tags'] = 'true';
503 503
 			$args['data-token-separators'] = "[',']";
504 504
 			$args['multiple'] = true;
505 505
 		}
506 506
 
507 507
 		// select2 placeholder
508
-		if($is_select2 && !empty($args['placeholder']) && empty($args['data-placeholder'])){
508
+		if ($is_select2 && !empty($args['placeholder']) && empty($args['data-placeholder'])) {
509 509
 			$args['data-placeholder'] = esc_attr($args['placeholder']);
510 510
 			$args['data-allow-clear'] = empty($args['data-allow-clear']) ? true : esc_attr($args['data-allow-clear']);
511 511
 		}
512 512
 
513 513
 		// label
514
-		if(!empty($args['label']) && is_array($args['label'])){
515
-		}elseif(!empty($args['label'])){
516
-			$output .= self::label(array('title'=>$args['label'],'for'=>$args['id']));
514
+		if (!empty($args['label']) && is_array($args['label'])) {
515
+		}elseif (!empty($args['label'])) {
516
+			$output .= self::label(array('title'=>$args['label'], 'for'=>$args['id']));
517 517
 		}
518 518
 
519 519
 		// open/type
@@ -521,20 +521,20 @@  discard block
 block discarded – undo
521 521
 
522 522
 		// class
523 523
 		$class = !empty($args['class']) ? $args['class'] : '';
524
-		$output .= AUI_Component_Helper::class_attr('custom-select '.$class);
524
+		$output .= AUI_Component_Helper::class_attr('custom-select ' . $class);
525 525
 
526 526
 		// name
527
-		if(!empty($args['name'])){
528
-			$output .= AUI_Component_Helper::name($args['name'],$args['multiple']);
527
+		if (!empty($args['name'])) {
528
+			$output .= AUI_Component_Helper::name($args['name'], $args['multiple']);
529 529
 		}
530 530
 
531 531
 		// id
532
-		if(!empty($args['id'])){
532
+		if (!empty($args['id'])) {
533 533
 			$output .= AUI_Component_Helper::id($args['id']);
534 534
 		}
535 535
 
536 536
 		// title
537
-		if(!empty($args['title'])){
537
+		if (!empty($args['title'])) {
538 538
 			$output .= AUI_Component_Helper::title($args['title']);
539 539
 		}
540 540
 
@@ -545,12 +545,12 @@  discard block
 block discarded – undo
545 545
 		$output .= AUI_Component_Helper::aria_attributes($args);
546 546
 
547 547
 		// required
548
-		if(!empty($args['required'])){
548
+		if (!empty($args['required'])) {
549 549
 			$output .= ' required ';
550 550
 		}
551 551
 
552 552
 		// multiple
553
-		if(!empty($args['multiple'])){
553
+		if (!empty($args['multiple'])) {
554 554
 			$output .= ' multiple ';
555 555
 		}
556 556
 
@@ -558,14 +558,14 @@  discard block
 block discarded – undo
558 558
 		$output .= ' >';
559 559
 
560 560
 		// placeholder
561
-		if(!empty($args['placeholder']) && !$is_select2){
562
-			$output .= '<option value="" disabled selected hidden>'.esc_attr($args['placeholder']).'</option>';
561
+		if (!empty($args['placeholder']) && !$is_select2) {
562
+			$output .= '<option value="" disabled selected hidden>' . esc_attr($args['placeholder']) . '</option>';
563 563
 		}
564 564
 
565 565
 		// Options
566
-		if(!empty($args['options'])){
567
-			foreach($args['options'] as $val => $name){
568
-				if(is_array($name)){
566
+		if (!empty($args['options'])) {
567
+			foreach ($args['options'] as $val => $name) {
568
+				if (is_array($name)) {
569 569
 					if (isset($name['optgroup']) && ($name['optgroup'] == 'start' || $name['optgroup'] == 'end')) {
570 570
 						$option_label = isset($name['label']) ? $name['label'] : '';
571 571
 
@@ -574,24 +574,24 @@  discard block
 block discarded – undo
574 574
 						$option_label = isset($name['label']) ? $name['label'] : '';
575 575
 						$option_value = isset($name['value']) ? $name['value'] : '';
576 576
 
577
-						if(!empty($args['multiple']) && !empty($args['value'])){
577
+						if (!empty($args['multiple']) && !empty($args['value'])) {
578 578
 							$selected = in_array($option_value, stripslashes_deep($args['value'])) ? "selected" : "";
579 579
 						} else {
580
-							$selected = selected($option_value,stripslashes_deep($args['value']), false);
580
+							$selected = selected($option_value, stripslashes_deep($args['value']), false);
581 581
 						}
582 582
 
583 583
 						$output .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
584 584
 					}
585
-				}else{
585
+				} else {
586 586
 					$selected = '';
587
-					if(!empty($args['value'])){
588
-						if(is_array($args['value'])){
589
-							$selected = in_array($val,$args['value']) ? 'selected="selected"' : '';
590
-						}else{
591
-							$selected = selected( $args['value'], $val, false);
587
+					if (!empty($args['value'])) {
588
+						if (is_array($args['value'])) {
589
+							$selected = in_array($val, $args['value']) ? 'selected="selected"' : '';
590
+						} else {
591
+							$selected = selected($args['value'], $val, false);
592 592
 						}
593 593
 					}
594
-					$output .= '<option value="'.esc_attr($val).'" '.$selected.'>'.esc_attr($name).'</option>';	
594
+					$output .= '<option value="' . esc_attr($val) . '" ' . $selected . '>' . esc_attr($name) . '</option>';	
595 595
 				}
596 596
 			}
597 597
 
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 		$output .= '</select>';
602 602
 
603 603
 		// wrap
604
-		if(!$args['no_wrap']){
604
+		if (!$args['no_wrap']) {
605 605
 			$output = self::wrap(array(
606 606
 				'content' => $output,
607 607
 			));
Please login to merge, or discard this patch.
Braces   +12 added lines, -13 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 			if($type=='file' ){
59 59
 				$args['label_after'] = true; // if type file we need the label after
60 60
 				$args['class'] .= ' custom-file-input ';
61
-			}elseif($type=='checkbox'){
61
+			} elseif($type=='checkbox'){
62 62
 				$args['label_after'] = true; // if type file we need the label after
63 63
 				$args['class'] .= ' custom-control-input ';
64 64
 			}
@@ -141,8 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
 			// label after
143 143
 			if(!empty($args['label']) && $args['label_after']){
144
-				if($type == 'file'){$label_args['class'] .= 'custom-file-label';}
145
-				elseif($type == 'checkbox'){$label_args['class'] .= 'custom-control-label';}
144
+				if($type == 'file'){$label_args['class'] .= 'custom-file-label';} elseif($type == 'checkbox'){$label_args['class'] .= 'custom-control-label';}
146 145
 				$output .= self::label( $label_args, $type );
147 146
 			}
148 147
 
@@ -153,13 +152,13 @@  discard block
 block discarded – undo
153 152
 					'content' => $output,
154 153
 					'class'   => 'form-group custom-file'
155 154
 				) );
156
-			}elseif($type == 'checkbox'){
155
+			} elseif($type == 'checkbox'){
157 156
 				$wrap_class = $args['switch'] ? 'custom-switch' : 'custom-checkbox';
158 157
 				$output = self::wrap( array(
159 158
 					'content' => $output,
160 159
 					'class'   => 'custom-control '.$wrap_class
161 160
 				) );
162
-			}elseif($type == 'password' && $args['password_toggle'] && !$args['input_group_right']){
161
+			} elseif($type == 'password' && $args['password_toggle'] && !$args['input_group_right']){
163 162
 
164 163
 
165 164
 				// allow password field to toggle view
@@ -243,7 +242,7 @@  discard block
 block discarded – undo
243 242
 
244 243
 		// label
245 244
 		if(!empty($args['label']) && is_array($args['label'])){
246
-		}elseif(!empty($args['label'])){
245
+		} elseif(!empty($args['label'])){
247 246
 			$output .= self::label(array('title'=>$args['label'],'for'=>$args['id']));
248 247
 		}
249 248
 
@@ -267,7 +266,7 @@  discard block
 block discarded – undo
267 266
 
268 267
 			wp_editor( $content, $editor_id, $settings );
269 268
 			$output .= ob_get_clean();
270
-		}else{
269
+		} else{
271 270
 
272 271
 			// open
273 272
 			$output .= '<textarea ';
@@ -366,7 +365,7 @@  discard block
 block discarded – undo
366 365
 			// maybe hide labels //@todo set a global option for visibility class
367 366
 			if($type == 'file' || $type == 'checkbox'){
368 367
 				$class = $args['class'];
369
-			}else{
368
+			} else{
370 369
 				$class = 'sr-only '.$args['class'];
371 370
 			}
372 371
 
@@ -452,7 +451,7 @@  discard block
 block discarded – undo
452 451
 			$output .= '</'.sanitize_html_class($args['type']).'>';
453 452
 
454 453
 
455
-		}else{
454
+		} else{
456 455
 			$output = $args['content'];
457 456
 		}
458 457
 
@@ -493,7 +492,7 @@  discard block
 block discarded – undo
493 492
 		if(!empty($args['select2'])){
494 493
 			$args['class'] .= ' aui-select2';
495 494
 			$is_select2 = true;
496
-		}elseif( strpos($args['class'], 'aui-select2') !== false){
495
+		} elseif( strpos($args['class'], 'aui-select2') !== false){
497 496
 			$is_select2 = true;
498 497
 		}
499 498
 
@@ -512,7 +511,7 @@  discard block
 block discarded – undo
512 511
 
513 512
 		// label
514 513
 		if(!empty($args['label']) && is_array($args['label'])){
515
-		}elseif(!empty($args['label'])){
514
+		} elseif(!empty($args['label'])){
516 515
 			$output .= self::label(array('title'=>$args['label'],'for'=>$args['id']));
517 516
 		}
518 517
 
@@ -582,12 +581,12 @@  discard block
 block discarded – undo
582 581
 
583 582
 						$output .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
584 583
 					}
585
-				}else{
584
+				} else{
586 585
 					$selected = '';
587 586
 					if(!empty($args['value'])){
588 587
 						if(is_array($args['value'])){
589 588
 							$selected = in_array($val,$args['value']) ? 'selected="selected"' : '';
590
-						}else{
589
+						} else{
591 590
 							$selected = selected( $args['value'], $val, false);
592 591
 						}
593 592
 					}
Please login to merge, or discard this patch.
ayecode/wp-ayecode-ui/includes/components/class-aui-component-button.php 3 patches
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if ( ! defined( 'ABSPATH' ) ) {
4
-	exit; // Exit if accessed directly
4
+    exit; // Exit if accessed directly
5 5
 }
6 6
 
7 7
 /**
@@ -11,136 +11,136 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class AUI_Component_Button {
13 13
 
14
-	/**
15
-	 * Build the component.
16
-	 *
17
-	 * @param array $args
18
-	 *
19
-	 * @return string The rendered component.
20
-	 */
21
-	public static function get($args = array()){
22
-		$defaults = array(
23
-			'type'       => 'a', // a, button, badge
24
-			'href'       => '#',
25
-			'new_window' => false,
26
-			'class'      => 'btn btn-primary',
27
-			'id'         => '',
28
-			'title'      => '',
29
-			'value'      => '',
30
-			'content'    => '',
31
-			'icon'       => '',
32
-			'hover_content' => '',
33
-			'hover_icon'    => '',
34
-			'new_line_after' => true,
35
-			'no_wrap'    => true,
36
-			'onclick'    => '',
37
-			'style'  => '',
38
-		);
39
-
40
-		/**
41
-		 * Parse incoming $args into an array and merge it with $defaults
42
-		 */
43
-		$args   = wp_parse_args( $args, $defaults );
44
-		$output = '';
45
-		if ( ! empty( $args['type'] ) ) {
46
-			$type = $args['type'] != 'a' ? esc_attr($args['type']) : 'a';
47
-
48
-			// open/type
49
-			if($type=='a'){
50
-				$new_window = !empty($args['new_window']) ? ' target="_blank" ' : '';
51
-				$output .= '<a href="' . $args['href'] . '"'.$new_window;
52
-			}elseif($type=='badge'){
53
-				$output .= '<span ';
54
-			}else{
55
-				$output .= '<button type="' . $type . '" ';
56
-			}
57
-
58
-			// name
59
-			if(!empty($args['name'])){
60
-				$output .= AUI_Component_Helper::name($args['name']);
61
-			}
62
-
63
-			// id
64
-			if(!empty($args['id'])){
65
-				$output .= AUI_Component_Helper::id($args['id']);
66
-			}
67
-
68
-			// title
69
-			if(!empty($args['title'])){
70
-				$output .= AUI_Component_Helper::title($args['title']);
71
-			}
72
-
73
-			// value
74
-			if(!empty($args['value'])){
75
-				$output .= AUI_Component_Helper::value($args['value']);
76
-			}
77
-
78
-			// class
79
-			$class = !empty($args['class']) ? $args['class'] : '';
80
-			$output .= AUI_Component_Helper::class_attr($class);
14
+    /**
15
+     * Build the component.
16
+     *
17
+     * @param array $args
18
+     *
19
+     * @return string The rendered component.
20
+     */
21
+    public static function get($args = array()){
22
+        $defaults = array(
23
+            'type'       => 'a', // a, button, badge
24
+            'href'       => '#',
25
+            'new_window' => false,
26
+            'class'      => 'btn btn-primary',
27
+            'id'         => '',
28
+            'title'      => '',
29
+            'value'      => '',
30
+            'content'    => '',
31
+            'icon'       => '',
32
+            'hover_content' => '',
33
+            'hover_icon'    => '',
34
+            'new_line_after' => true,
35
+            'no_wrap'    => true,
36
+            'onclick'    => '',
37
+            'style'  => '',
38
+        );
39
+
40
+        /**
41
+         * Parse incoming $args into an array and merge it with $defaults
42
+         */
43
+        $args   = wp_parse_args( $args, $defaults );
44
+        $output = '';
45
+        if ( ! empty( $args['type'] ) ) {
46
+            $type = $args['type'] != 'a' ? esc_attr($args['type']) : 'a';
47
+
48
+            // open/type
49
+            if($type=='a'){
50
+                $new_window = !empty($args['new_window']) ? ' target="_blank" ' : '';
51
+                $output .= '<a href="' . $args['href'] . '"'.$new_window;
52
+            }elseif($type=='badge'){
53
+                $output .= '<span ';
54
+            }else{
55
+                $output .= '<button type="' . $type . '" ';
56
+            }
57
+
58
+            // name
59
+            if(!empty($args['name'])){
60
+                $output .= AUI_Component_Helper::name($args['name']);
61
+            }
62
+
63
+            // id
64
+            if(!empty($args['id'])){
65
+                $output .= AUI_Component_Helper::id($args['id']);
66
+            }
67
+
68
+            // title
69
+            if(!empty($args['title'])){
70
+                $output .= AUI_Component_Helper::title($args['title']);
71
+            }
72
+
73
+            // value
74
+            if(!empty($args['value'])){
75
+                $output .= AUI_Component_Helper::value($args['value']);
76
+            }
77
+
78
+            // class
79
+            $class = !empty($args['class']) ? $args['class'] : '';
80
+            $output .= AUI_Component_Helper::class_attr($class);
81 81
 			
82
-			// data-attributes
83
-			$output .= AUI_Component_Helper::data_attributes($args);
82
+            // data-attributes
83
+            $output .= AUI_Component_Helper::data_attributes($args);
84 84
 
85
-			// aria-attributes
86
-			$output .= AUI_Component_Helper::aria_attributes($args);
85
+            // aria-attributes
86
+            $output .= AUI_Component_Helper::aria_attributes($args);
87 87
 
88
-			// onclick, we don't escape this
89
-			if(!empty($args['onclick'])){
90
-				$output .= ' onclick="'.$args['onclick'].'" ';
91
-			}
88
+            // onclick, we don't escape this
89
+            if(!empty($args['onclick'])){
90
+                $output .= ' onclick="'.$args['onclick'].'" ';
91
+            }
92 92
 
93
-			// style, we don't escape this
94
-			if(!empty($args['style'])){
95
-				$output .= ' style="'.$args['style'].'" ';
96
-			}
93
+            // style, we don't escape this
94
+            if(!empty($args['style'])){
95
+                $output .= ' style="'.$args['style'].'" ';
96
+            }
97 97
 
98
-			// close opening tag
99
-			$output .= ' >';
98
+            // close opening tag
99
+            $output .= ' >';
100 100
 
101 101
 
102
-			// hover content
103
-			$hover_content = false;
104
-			if(!empty($args['hover_content']) || !empty($args['hover_icon'])){
105
-				$output .= "<span class='hover-content'>".AUI_Component_Helper::icon($args['hover_icon'],$args['hover_content']).$args['hover_content']."</span>";
106
-				$hover_content = true;
107
-			}
102
+            // hover content
103
+            $hover_content = false;
104
+            if(!empty($args['hover_content']) || !empty($args['hover_icon'])){
105
+                $output .= "<span class='hover-content'>".AUI_Component_Helper::icon($args['hover_icon'],$args['hover_content']).$args['hover_content']."</span>";
106
+                $hover_content = true;
107
+            }
108 108
 			
109
-			// content
110
-			if($hover_content){$output .= "<span class='hover-content-original'>";}
111
-			if(!empty($args['content']) || !empty($args['icon'])){
112
-				$output .= AUI_Component_Helper::icon($args['icon'],$args['content']).$args['content'];
113
-			}
114
-			if($hover_content){$output .= "</span>";}
109
+            // content
110
+            if($hover_content){$output .= "<span class='hover-content-original'>";}
111
+            if(!empty($args['content']) || !empty($args['icon'])){
112
+                $output .= AUI_Component_Helper::icon($args['icon'],$args['content']).$args['content'];
113
+            }
114
+            if($hover_content){$output .= "</span>";}
115 115
 					
116 116
 
117 117
 
118
-			// close
119
-			if($type=='a'){
120
-				$output .= '</a>';
121
-			}elseif($type=='badge'){
122
-				$output .= '</span>';
123
-			}else{
124
-				$output .= '</button>';
125
-			}
118
+            // close
119
+            if($type=='a'){
120
+                $output .= '</a>';
121
+            }elseif($type=='badge'){
122
+                $output .= '</span>';
123
+            }else{
124
+                $output .= '</button>';
125
+            }
126 126
 
127
-			// maybe new line after?  This adds better spacing between buttons.
128
-			if(!empty($args['new_line_after'])){
129
-				$output .= PHP_EOL;
130
-			}
127
+            // maybe new line after?  This adds better spacing between buttons.
128
+            if(!empty($args['new_line_after'])){
129
+                $output .= PHP_EOL;
130
+            }
131 131
 
132 132
 
133
-			// wrap
134
-			if(!$args['no_wrap']){
135
-				$output = AUI_Component_Input::wrap(array(
136
-					'content' => $output,
137
-				));
138
-			}
133
+            // wrap
134
+            if(!$args['no_wrap']){
135
+                $output = AUI_Component_Input::wrap(array(
136
+                    'content' => $output,
137
+                ));
138
+            }
139 139
 
140 140
 
141
-		}
141
+        }
142 142
 
143
-		return $output;
144
-	}
143
+        return $output;
144
+    }
145 145
 
146 146
 }
147 147
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
 	exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @return string The rendered component.
20 20
 	 */
21
-	public static function get($args = array()){
21
+	public static function get($args = array()) {
22 22
 		$defaults = array(
23 23
 			'type'       => 'a', // a, button, badge
24 24
 			'href'       => '#',
@@ -40,38 +40,38 @@  discard block
 block discarded – undo
40 40
 		/**
41 41
 		 * Parse incoming $args into an array and merge it with $defaults
42 42
 		 */
43
-		$args   = wp_parse_args( $args, $defaults );
43
+		$args   = wp_parse_args($args, $defaults);
44 44
 		$output = '';
45
-		if ( ! empty( $args['type'] ) ) {
45
+		if (!empty($args['type'])) {
46 46
 			$type = $args['type'] != 'a' ? esc_attr($args['type']) : 'a';
47 47
 
48 48
 			// open/type
49
-			if($type=='a'){
49
+			if ($type == 'a') {
50 50
 				$new_window = !empty($args['new_window']) ? ' target="_blank" ' : '';
51
-				$output .= '<a href="' . $args['href'] . '"'.$new_window;
52
-			}elseif($type=='badge'){
51
+				$output .= '<a href="' . $args['href'] . '"' . $new_window;
52
+			}elseif ($type == 'badge') {
53 53
 				$output .= '<span ';
54
-			}else{
54
+			} else {
55 55
 				$output .= '<button type="' . $type . '" ';
56 56
 			}
57 57
 
58 58
 			// name
59
-			if(!empty($args['name'])){
59
+			if (!empty($args['name'])) {
60 60
 				$output .= AUI_Component_Helper::name($args['name']);
61 61
 			}
62 62
 
63 63
 			// id
64
-			if(!empty($args['id'])){
64
+			if (!empty($args['id'])) {
65 65
 				$output .= AUI_Component_Helper::id($args['id']);
66 66
 			}
67 67
 
68 68
 			// title
69
-			if(!empty($args['title'])){
69
+			if (!empty($args['title'])) {
70 70
 				$output .= AUI_Component_Helper::title($args['title']);
71 71
 			}
72 72
 
73 73
 			// value
74
-			if(!empty($args['value'])){
74
+			if (!empty($args['value'])) {
75 75
 				$output .= AUI_Component_Helper::value($args['value']);
76 76
 			}
77 77
 
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
 			$output .= AUI_Component_Helper::aria_attributes($args);
87 87
 
88 88
 			// onclick, we don't escape this
89
-			if(!empty($args['onclick'])){
90
-				$output .= ' onclick="'.$args['onclick'].'" ';
89
+			if (!empty($args['onclick'])) {
90
+				$output .= ' onclick="' . $args['onclick'] . '" ';
91 91
 			}
92 92
 
93 93
 			// style, we don't escape this
94
-			if(!empty($args['style'])){
95
-				$output .= ' style="'.$args['style'].'" ';
94
+			if (!empty($args['style'])) {
95
+				$output .= ' style="' . $args['style'] . '" ';
96 96
 			}
97 97
 
98 98
 			// close opening tag
@@ -101,37 +101,37 @@  discard block
 block discarded – undo
101 101
 
102 102
 			// hover content
103 103
 			$hover_content = false;
104
-			if(!empty($args['hover_content']) || !empty($args['hover_icon'])){
105
-				$output .= "<span class='hover-content'>".AUI_Component_Helper::icon($args['hover_icon'],$args['hover_content']).$args['hover_content']."</span>";
104
+			if (!empty($args['hover_content']) || !empty($args['hover_icon'])) {
105
+				$output .= "<span class='hover-content'>" . AUI_Component_Helper::icon($args['hover_icon'], $args['hover_content']) . $args['hover_content'] . "</span>";
106 106
 				$hover_content = true;
107 107
 			}
108 108
 			
109 109
 			// content
110
-			if($hover_content){$output .= "<span class='hover-content-original'>";}
111
-			if(!empty($args['content']) || !empty($args['icon'])){
112
-				$output .= AUI_Component_Helper::icon($args['icon'],$args['content']).$args['content'];
110
+			if ($hover_content) {$output .= "<span class='hover-content-original'>"; }
111
+			if (!empty($args['content']) || !empty($args['icon'])) {
112
+				$output .= AUI_Component_Helper::icon($args['icon'], $args['content']) . $args['content'];
113 113
 			}
114
-			if($hover_content){$output .= "</span>";}
114
+			if ($hover_content) {$output .= "</span>"; }
115 115
 					
116 116
 
117 117
 
118 118
 			// close
119
-			if($type=='a'){
119
+			if ($type == 'a') {
120 120
 				$output .= '</a>';
121
-			}elseif($type=='badge'){
121
+			}elseif ($type == 'badge') {
122 122
 				$output .= '</span>';
123
-			}else{
123
+			} else {
124 124
 				$output .= '</button>';
125 125
 			}
126 126
 
127 127
 			// maybe new line after?  This adds better spacing between buttons.
128
-			if(!empty($args['new_line_after'])){
128
+			if (!empty($args['new_line_after'])) {
129 129
 				$output .= PHP_EOL;
130 130
 			}
131 131
 
132 132
 
133 133
 			// wrap
134
-			if(!$args['no_wrap']){
134
+			if (!$args['no_wrap']) {
135 135
 				$output = AUI_Component_Input::wrap(array(
136 136
 					'content' => $output,
137 137
 				));
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 			if($type=='a'){
50 50
 				$new_window = !empty($args['new_window']) ? ' target="_blank" ' : '';
51 51
 				$output .= '<a href="' . $args['href'] . '"'.$new_window;
52
-			}elseif($type=='badge'){
52
+			} elseif($type=='badge'){
53 53
 				$output .= '<span ';
54
-			}else{
54
+			} else{
55 55
 				$output .= '<button type="' . $type . '" ';
56 56
 			}
57 57
 
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 			// close
119 119
 			if($type=='a'){
120 120
 				$output .= '</a>';
121
-			}elseif($type=='badge'){
121
+			} elseif($type=='badge'){
122 122
 				$output .= '</span>';
123
-			}else{
123
+			} else{
124 124
 				$output .= '</button>';
125 125
 			}
126 126
 
Please login to merge, or discard this patch.
ayecode/wp-ayecode-ui/includes/components/class-aui-component-helper.php 2 patches
Indentation   +194 added lines, -194 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if ( ! defined( 'ABSPATH' ) ) {
4
-	exit; // Exit if accessed directly
4
+    exit; // Exit if accessed directly
5 5
 }
6 6
 
7 7
 /**
@@ -11,198 +11,198 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class AUI_Component_Helper {
13 13
 
14
-	/**
15
-	 * A component helper for generating a input name.
16
-	 *
17
-	 * @param $text
18
-	 *
19
-	 * @return string
20
-	 */
21
-	public static function name($text,$multiple = false){
22
-		$output = '';
23
-
24
-		if($text){
25
-			$is_multiple = $multiple ? '[]' : '';
26
-			$output = ' name="'.sanitize_html_class($text).$is_multiple.'" ';
27
-		}
28
-
29
-		return $output;
30
-	}
31
-
32
-	/**
33
-	 * A component helper for generating a item id.
34
-	 *
35
-	 * @param $text string The text to be used as the value.
36
-	 *
37
-	 * @return string The sanitized item.
38
-	 */
39
-	public static function id($text){
40
-		$output = '';
41
-
42
-		if($text){
43
-			$output = ' id="'.sanitize_html_class($text).'" ';
44
-		}
45
-
46
-		return $output;
47
-	}
48
-
49
-	/**
50
-	 * A component helper for generating a item title.
51
-	 *
52
-	 * @param $text string The text to be used as the value.
53
-	 *
54
-	 * @return string The sanitized item.
55
-	 */
56
-	public static function title($text){
57
-		$output = '';
58
-
59
-		if($text){
60
-			$output = ' title="'.esc_attr($text).'" ';
61
-		}
62
-
63
-		return $output;
64
-	}
65
-
66
-	/**
67
-	 * A component helper for generating a item value.
68
-	 *
69
-	 * @param $text string The text to be used as the value.
70
-	 *
71
-	 * @return string The sanitized item.
72
-	 */
73
-	public static function value($text){
74
-		$output = '';
75
-
76
-		if($text){
77
-			$output = ' value="'.sanitize_text_field($text).'" ';
78
-		}
79
-
80
-		return $output;
81
-	}
82
-
83
-	/**
84
-	 * A component helper for generating a item class attribute.
85
-	 *
86
-	 * @param $text string The text to be used as the value.
87
-	 *
88
-	 * @return string The sanitized item.
89
-	 */
90
-	public static function class_attr($text){
91
-		$output = '';
92
-
93
-		if($text){
94
-			$classes = self::esc_classes($text);
95
-			if(!empty($classes)){
96
-				$output = ' class="'.$classes.'" ';
97
-			}
98
-		}
99
-
100
-		return $output;
101
-	}
102
-
103
-	/**
104
-	 * Escape a string of classes.
105
-	 *
106
-	 * @param $text
107
-	 *
108
-	 * @return string
109
-	 */
110
-	public static function esc_classes($text){
111
-		$output = '';
112
-
113
-		if($text){
114
-			$classes = explode(" ",$text);
115
-			$classes = array_map("trim",$classes);
116
-			$classes = array_map("sanitize_html_class",$classes);
117
-			if(!empty($classes)){
118
-				$output = implode(" ",$classes);
119
-			}
120
-		}
121
-
122
-		return $output;
123
-
124
-	}
125
-
126
-	/**
127
-	 * @param $args
128
-	 *
129
-	 * @return string
130
-	 */
131
-	public static function data_attributes($args){
132
-		$output = '';
133
-
134
-		if(!empty($args)){
135
-
136
-			foreach($args as $key => $val){
137
-				if(substr( $key, 0, 5 ) === "data-"){
138
-					$output .= ' '.sanitize_html_class($key).'="'.esc_attr($val).'" ';
139
-				}
140
-			}
141
-		}
142
-
143
-		return $output;
144
-	}
145
-
146
-	/**
147
-	 * @param $args
148
-	 *
149
-	 * @return string
150
-	 */
151
-	public static function aria_attributes($args){
152
-		$output = '';
153
-
154
-		if(!empty($args)){
155
-
156
-			foreach($args as $key => $val){
157
-				if(substr( $key, 0, 5 ) === "aria-"){
158
-					$output .= ' '.sanitize_html_class($key).'="'.esc_attr($val).'" ';
159
-				}
160
-			}
161
-		}
162
-
163
-		return $output;
164
-	}
165
-
166
-	/**
167
-	 * Build a font awesome icon from a class.
168
-	 * 
169
-	 * @param $class
170
-	 * @param bool $space_after
171
-	 *
172
-	 * @return string
173
-	 */
174
-	public static function icon($class,$space_after = false){
175
-		$output = '';
176
-
177
-		if($class){
178
-			$classes = self::esc_classes($class);
179
-			if(!empty($classes)){
180
-				$output = '<i class="'.$classes.'" ></i>';
181
-				if($space_after){
182
-					$output .= " ";
183
-				}
184
-			}
185
-		}
186
-
187
-		return $output;
188
-	}
189
-
190
-	/**
191
-	 * @param $args
192
-	 *
193
-	 * @return string
194
-	 */
195
-	public static function extra_attributes($args){
196
-		$output = '';
197
-
198
-		if(!empty($args) && is_array($args) ){
199
-
200
-			foreach($args as $key => $val){
201
-				$output .= ' '.sanitize_html_class($key).'="'.esc_attr($val).'" ';
202
-			}
203
-		}
204
-
205
-		return $output;
206
-	}
14
+    /**
15
+     * A component helper for generating a input name.
16
+     *
17
+     * @param $text
18
+     *
19
+     * @return string
20
+     */
21
+    public static function name($text,$multiple = false){
22
+        $output = '';
23
+
24
+        if($text){
25
+            $is_multiple = $multiple ? '[]' : '';
26
+            $output = ' name="'.sanitize_html_class($text).$is_multiple.'" ';
27
+        }
28
+
29
+        return $output;
30
+    }
31
+
32
+    /**
33
+     * A component helper for generating a item id.
34
+     *
35
+     * @param $text string The text to be used as the value.
36
+     *
37
+     * @return string The sanitized item.
38
+     */
39
+    public static function id($text){
40
+        $output = '';
41
+
42
+        if($text){
43
+            $output = ' id="'.sanitize_html_class($text).'" ';
44
+        }
45
+
46
+        return $output;
47
+    }
48
+
49
+    /**
50
+     * A component helper for generating a item title.
51
+     *
52
+     * @param $text string The text to be used as the value.
53
+     *
54
+     * @return string The sanitized item.
55
+     */
56
+    public static function title($text){
57
+        $output = '';
58
+
59
+        if($text){
60
+            $output = ' title="'.esc_attr($text).'" ';
61
+        }
62
+
63
+        return $output;
64
+    }
65
+
66
+    /**
67
+     * A component helper for generating a item value.
68
+     *
69
+     * @param $text string The text to be used as the value.
70
+     *
71
+     * @return string The sanitized item.
72
+     */
73
+    public static function value($text){
74
+        $output = '';
75
+
76
+        if($text){
77
+            $output = ' value="'.sanitize_text_field($text).'" ';
78
+        }
79
+
80
+        return $output;
81
+    }
82
+
83
+    /**
84
+     * A component helper for generating a item class attribute.
85
+     *
86
+     * @param $text string The text to be used as the value.
87
+     *
88
+     * @return string The sanitized item.
89
+     */
90
+    public static function class_attr($text){
91
+        $output = '';
92
+
93
+        if($text){
94
+            $classes = self::esc_classes($text);
95
+            if(!empty($classes)){
96
+                $output = ' class="'.$classes.'" ';
97
+            }
98
+        }
99
+
100
+        return $output;
101
+    }
102
+
103
+    /**
104
+     * Escape a string of classes.
105
+     *
106
+     * @param $text
107
+     *
108
+     * @return string
109
+     */
110
+    public static function esc_classes($text){
111
+        $output = '';
112
+
113
+        if($text){
114
+            $classes = explode(" ",$text);
115
+            $classes = array_map("trim",$classes);
116
+            $classes = array_map("sanitize_html_class",$classes);
117
+            if(!empty($classes)){
118
+                $output = implode(" ",$classes);
119
+            }
120
+        }
121
+
122
+        return $output;
123
+
124
+    }
125
+
126
+    /**
127
+     * @param $args
128
+     *
129
+     * @return string
130
+     */
131
+    public static function data_attributes($args){
132
+        $output = '';
133
+
134
+        if(!empty($args)){
135
+
136
+            foreach($args as $key => $val){
137
+                if(substr( $key, 0, 5 ) === "data-"){
138
+                    $output .= ' '.sanitize_html_class($key).'="'.esc_attr($val).'" ';
139
+                }
140
+            }
141
+        }
142
+
143
+        return $output;
144
+    }
145
+
146
+    /**
147
+     * @param $args
148
+     *
149
+     * @return string
150
+     */
151
+    public static function aria_attributes($args){
152
+        $output = '';
153
+
154
+        if(!empty($args)){
155
+
156
+            foreach($args as $key => $val){
157
+                if(substr( $key, 0, 5 ) === "aria-"){
158
+                    $output .= ' '.sanitize_html_class($key).'="'.esc_attr($val).'" ';
159
+                }
160
+            }
161
+        }
162
+
163
+        return $output;
164
+    }
165
+
166
+    /**
167
+     * Build a font awesome icon from a class.
168
+     * 
169
+     * @param $class
170
+     * @param bool $space_after
171
+     *
172
+     * @return string
173
+     */
174
+    public static function icon($class,$space_after = false){
175
+        $output = '';
176
+
177
+        if($class){
178
+            $classes = self::esc_classes($class);
179
+            if(!empty($classes)){
180
+                $output = '<i class="'.$classes.'" ></i>';
181
+                if($space_after){
182
+                    $output .= " ";
183
+                }
184
+            }
185
+        }
186
+
187
+        return $output;
188
+    }
189
+
190
+    /**
191
+     * @param $args
192
+     *
193
+     * @return string
194
+     */
195
+    public static function extra_attributes($args){
196
+        $output = '';
197
+
198
+        if(!empty($args) && is_array($args) ){
199
+
200
+            foreach($args as $key => $val){
201
+                $output .= ' '.sanitize_html_class($key).'="'.esc_attr($val).'" ';
202
+            }
203
+        }
204
+
205
+        return $output;
206
+    }
207 207
 
208 208
 }
209 209
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
 	exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @return string
20 20
 	 */
21
-	public static function name($text,$multiple = false){
21
+	public static function name($text, $multiple = false) {
22 22
 		$output = '';
23 23
 
24
-		if($text){
24
+		if ($text) {
25 25
 			$is_multiple = $multiple ? '[]' : '';
26
-			$output = ' name="'.sanitize_html_class($text).$is_multiple.'" ';
26
+			$output = ' name="' . sanitize_html_class($text) . $is_multiple . '" ';
27 27
 		}
28 28
 
29 29
 		return $output;
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
 	 *
37 37
 	 * @return string The sanitized item.
38 38
 	 */
39
-	public static function id($text){
39
+	public static function id($text) {
40 40
 		$output = '';
41 41
 
42
-		if($text){
43
-			$output = ' id="'.sanitize_html_class($text).'" ';
42
+		if ($text) {
43
+			$output = ' id="' . sanitize_html_class($text) . '" ';
44 44
 		}
45 45
 
46 46
 		return $output;
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @return string The sanitized item.
55 55
 	 */
56
-	public static function title($text){
56
+	public static function title($text) {
57 57
 		$output = '';
58 58
 
59
-		if($text){
60
-			$output = ' title="'.esc_attr($text).'" ';
59
+		if ($text) {
60
+			$output = ' title="' . esc_attr($text) . '" ';
61 61
 		}
62 62
 
63 63
 		return $output;
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @return string The sanitized item.
72 72
 	 */
73
-	public static function value($text){
73
+	public static function value($text) {
74 74
 		$output = '';
75 75
 
76
-		if($text){
77
-			$output = ' value="'.sanitize_text_field($text).'" ';
76
+		if ($text) {
77
+			$output = ' value="' . sanitize_text_field($text) . '" ';
78 78
 		}
79 79
 
80 80
 		return $output;
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return string The sanitized item.
89 89
 	 */
90
-	public static function class_attr($text){
90
+	public static function class_attr($text) {
91 91
 		$output = '';
92 92
 
93
-		if($text){
93
+		if ($text) {
94 94
 			$classes = self::esc_classes($text);
95
-			if(!empty($classes)){
96
-				$output = ' class="'.$classes.'" ';
95
+			if (!empty($classes)) {
96
+				$output = ' class="' . $classes . '" ';
97 97
 			}
98 98
 		}
99 99
 
@@ -107,15 +107,15 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @return string
109 109
 	 */
110
-	public static function esc_classes($text){
110
+	public static function esc_classes($text) {
111 111
 		$output = '';
112 112
 
113
-		if($text){
114
-			$classes = explode(" ",$text);
115
-			$classes = array_map("trim",$classes);
116
-			$classes = array_map("sanitize_html_class",$classes);
117
-			if(!empty($classes)){
118
-				$output = implode(" ",$classes);
113
+		if ($text) {
114
+			$classes = explode(" ", $text);
115
+			$classes = array_map("trim", $classes);
116
+			$classes = array_map("sanitize_html_class", $classes);
117
+			if (!empty($classes)) {
118
+				$output = implode(" ", $classes);
119 119
 			}
120 120
 		}
121 121
 
@@ -128,14 +128,14 @@  discard block
 block discarded – undo
128 128
 	 *
129 129
 	 * @return string
130 130
 	 */
131
-	public static function data_attributes($args){
131
+	public static function data_attributes($args) {
132 132
 		$output = '';
133 133
 
134
-		if(!empty($args)){
134
+		if (!empty($args)) {
135 135
 
136
-			foreach($args as $key => $val){
137
-				if(substr( $key, 0, 5 ) === "data-"){
138
-					$output .= ' '.sanitize_html_class($key).'="'.esc_attr($val).'" ';
136
+			foreach ($args as $key => $val) {
137
+				if (substr($key, 0, 5) === "data-") {
138
+					$output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" ';
139 139
 				}
140 140
 			}
141 141
 		}
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
 	 *
149 149
 	 * @return string
150 150
 	 */
151
-	public static function aria_attributes($args){
151
+	public static function aria_attributes($args) {
152 152
 		$output = '';
153 153
 
154
-		if(!empty($args)){
154
+		if (!empty($args)) {
155 155
 
156
-			foreach($args as $key => $val){
157
-				if(substr( $key, 0, 5 ) === "aria-"){
158
-					$output .= ' '.sanitize_html_class($key).'="'.esc_attr($val).'" ';
156
+			foreach ($args as $key => $val) {
157
+				if (substr($key, 0, 5) === "aria-") {
158
+					$output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" ';
159 159
 				}
160 160
 			}
161 161
 		}
@@ -171,14 +171,14 @@  discard block
 block discarded – undo
171 171
 	 *
172 172
 	 * @return string
173 173
 	 */
174
-	public static function icon($class,$space_after = false){
174
+	public static function icon($class, $space_after = false) {
175 175
 		$output = '';
176 176
 
177
-		if($class){
177
+		if ($class) {
178 178
 			$classes = self::esc_classes($class);
179
-			if(!empty($classes)){
180
-				$output = '<i class="'.$classes.'" ></i>';
181
-				if($space_after){
179
+			if (!empty($classes)) {
180
+				$output = '<i class="' . $classes . '" ></i>';
181
+				if ($space_after) {
182 182
 					$output .= " ";
183 183
 				}
184 184
 			}
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @return string
194 194
 	 */
195
-	public static function extra_attributes($args){
195
+	public static function extra_attributes($args) {
196 196
 		$output = '';
197 197
 
198
-		if(!empty($args) && is_array($args) ){
198
+		if (!empty($args) && is_array($args)) {
199 199
 
200
-			foreach($args as $key => $val){
201
-				$output .= ' '.sanitize_html_class($key).'="'.esc_attr($val).'" ';
200
+			foreach ($args as $key => $val) {
201
+				$output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" ';
202 202
 			}
203 203
 		}
204 204
 
Please login to merge, or discard this patch.
ayecode/wp-ayecode-ui/includes/components/class-aui-component-alert.php 3 patches
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if ( ! defined( 'ABSPATH' ) ) {
4
-	exit; // Exit if accessed directly
4
+    exit; // Exit if accessed directly
5 5
 }
6 6
 
7 7
 /**
@@ -11,81 +11,81 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class AUI_Component_Alert {
13 13
 
14
-	/**
15
-	 * Build the component.
16
-	 * 
17
-	 * @param array $args
18
-	 *
19
-	 * @return string The rendered component.
20
-	 */
21
-	public static function get($args = array()){
22
-		$defaults = array(
23
-			'type'       => 'info',
24
-			'class'      => '',
25
-			'icon' => '',
26
-			'heading'    => '',
27
-			'content'    => '',
28
-			'footer'     => '',
29
-			'dismissible'=> false,
30
-			'data'       => '',
31
-		);
14
+    /**
15
+     * Build the component.
16
+     * 
17
+     * @param array $args
18
+     *
19
+     * @return string The rendered component.
20
+     */
21
+    public static function get($args = array()){
22
+        $defaults = array(
23
+            'type'       => 'info',
24
+            'class'      => '',
25
+            'icon' => '',
26
+            'heading'    => '',
27
+            'content'    => '',
28
+            'footer'     => '',
29
+            'dismissible'=> false,
30
+            'data'       => '',
31
+        );
32 32
 
33
-		/**
34
-		 * Parse incoming $args into an array and merge it with $defaults
35
-		 */
36
-		$args   = wp_parse_args( $args, $defaults );
37
-		$output = '';
38
-		if ( ! empty( $args['content'] ) ) {
39
-			$type = sanitize_html_class( $args['type'] );
40
-			if($type=='error'){$type='danger';}
41
-			$icon = !empty($args['icon']) ? "<i class='".esc_attr($args['icon'])."'></i>" : '';
33
+        /**
34
+         * Parse incoming $args into an array and merge it with $defaults
35
+         */
36
+        $args   = wp_parse_args( $args, $defaults );
37
+        $output = '';
38
+        if ( ! empty( $args['content'] ) ) {
39
+            $type = sanitize_html_class( $args['type'] );
40
+            if($type=='error'){$type='danger';}
41
+            $icon = !empty($args['icon']) ? "<i class='".esc_attr($args['icon'])."'></i>" : '';
42 42
 
43
-			// set default icon
44
-			if(!$icon && $args['icon']!==false && $type){
45
-				if($type=='danger'){$icon = '<i class="fas fa-exclamation-circle"></i>';}
46
-				elseif($type=='warning'){$icon = '<i class="fas fa-exclamation-triangle"></i>';}
47
-				elseif($type=='success'){$icon = '<i class="fas fa-check-circle"></i>';}
48
-				elseif($type=='info'){$icon = '<i class="fas fa-info-circle"></i>';}
49
-			}
43
+            // set default icon
44
+            if(!$icon && $args['icon']!==false && $type){
45
+                if($type=='danger'){$icon = '<i class="fas fa-exclamation-circle"></i>';}
46
+                elseif($type=='warning'){$icon = '<i class="fas fa-exclamation-triangle"></i>';}
47
+                elseif($type=='success'){$icon = '<i class="fas fa-check-circle"></i>';}
48
+                elseif($type=='info'){$icon = '<i class="fas fa-info-circle"></i>';}
49
+            }
50 50
 
51
-			$data = '';
52
-			$class = !empty($args['class']) ? esc_attr($args['class']) : '';
53
-			if($args['dismissible']){$class .= " alert-dismissible fade show";}
51
+            $data = '';
52
+            $class = !empty($args['class']) ? esc_attr($args['class']) : '';
53
+            if($args['dismissible']){$class .= " alert-dismissible fade show";}
54 54
 
55
-			// open
56
-			$output .= '<div class="alert alert-' . $type . ' '.$class.'" role="alert" '.$data.'>';
55
+            // open
56
+            $output .= '<div class="alert alert-' . $type . ' '.$class.'" role="alert" '.$data.'>';
57 57
 
58
-			// heading
59
-			if ( ! empty( $args['heading'] ) ) {
60
-				$output .= '<h4 class="alert-heading">' . $args['heading'] . '</h4>';
61
-			}
58
+            // heading
59
+            if ( ! empty( $args['heading'] ) ) {
60
+                $output .= '<h4 class="alert-heading">' . $args['heading'] . '</h4>';
61
+            }
62 62
 
63
-			// icon
64
-			if ( ! empty( $icon) ) {
65
-				$output .= $icon." ";
66
-			}
63
+            // icon
64
+            if ( ! empty( $icon) ) {
65
+                $output .= $icon." ";
66
+            }
67 67
 
68
-			// content
69
-			$output .= $args['content'];
68
+            // content
69
+            $output .= $args['content'];
70 70
 
71
-			// dismissible
72
-			if($args['dismissible']){
73
-				$output .= '<button type="button" class="close" data-dismiss="alert" aria-label="Close">';
74
-				$output .= '<span aria-hidden="true">&times;</span>';
75
-				$output .= '</button>';
76
-			}
71
+            // dismissible
72
+            if($args['dismissible']){
73
+                $output .= '<button type="button" class="close" data-dismiss="alert" aria-label="Close">';
74
+                $output .= '<span aria-hidden="true">&times;</span>';
75
+                $output .= '</button>';
76
+            }
77 77
 
78
-			// footer
79
-			if ( ! empty( $args['footer'] ) ) {
80
-				$output .= '<hr>';
81
-				$output .= '<p class="mb-0">' . $args['footer'] . '</p>';
82
-			}
78
+            // footer
79
+            if ( ! empty( $args['footer'] ) ) {
80
+                $output .= '<hr>';
81
+                $output .= '<p class="mb-0">' . $args['footer'] . '</p>';
82
+            }
83 83
 
84
-			// close
85
-			$output .= '</div>';
86
-		}
84
+            // close
85
+            $output .= '</div>';
86
+        }
87 87
 
88
-		return $output;
89
-	}
88
+        return $output;
89
+    }
90 90
 
91 91
 }
92 92
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
 	exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @return string The rendered component.
20 20
 	 */
21
-	public static function get($args = array()){
21
+	public static function get($args = array()) {
22 22
 		$defaults = array(
23 23
 			'type'       => 'info',
24 24
 			'class'      => '',
@@ -33,50 +33,50 @@  discard block
 block discarded – undo
33 33
 		/**
34 34
 		 * Parse incoming $args into an array and merge it with $defaults
35 35
 		 */
36
-		$args   = wp_parse_args( $args, $defaults );
36
+		$args   = wp_parse_args($args, $defaults);
37 37
 		$output = '';
38
-		if ( ! empty( $args['content'] ) ) {
39
-			$type = sanitize_html_class( $args['type'] );
40
-			if($type=='error'){$type='danger';}
41
-			$icon = !empty($args['icon']) ? "<i class='".esc_attr($args['icon'])."'></i>" : '';
38
+		if (!empty($args['content'])) {
39
+			$type = sanitize_html_class($args['type']);
40
+			if ($type == 'error') {$type = 'danger'; }
41
+			$icon = !empty($args['icon']) ? "<i class='" . esc_attr($args['icon']) . "'></i>" : '';
42 42
 
43 43
 			// set default icon
44
-			if(!$icon && $args['icon']!==false && $type){
45
-				if($type=='danger'){$icon = '<i class="fas fa-exclamation-circle"></i>';}
46
-				elseif($type=='warning'){$icon = '<i class="fas fa-exclamation-triangle"></i>';}
47
-				elseif($type=='success'){$icon = '<i class="fas fa-check-circle"></i>';}
48
-				elseif($type=='info'){$icon = '<i class="fas fa-info-circle"></i>';}
44
+			if (!$icon && $args['icon'] !== false && $type) {
45
+				if ($type == 'danger') {$icon = '<i class="fas fa-exclamation-circle"></i>'; }
46
+				elseif ($type == 'warning') {$icon = '<i class="fas fa-exclamation-triangle"></i>'; }
47
+				elseif ($type == 'success') {$icon = '<i class="fas fa-check-circle"></i>'; }
48
+				elseif ($type == 'info') {$icon = '<i class="fas fa-info-circle"></i>'; }
49 49
 			}
50 50
 
51 51
 			$data = '';
52 52
 			$class = !empty($args['class']) ? esc_attr($args['class']) : '';
53
-			if($args['dismissible']){$class .= " alert-dismissible fade show";}
53
+			if ($args['dismissible']) {$class .= " alert-dismissible fade show"; }
54 54
 
55 55
 			// open
56
-			$output .= '<div class="alert alert-' . $type . ' '.$class.'" role="alert" '.$data.'>';
56
+			$output .= '<div class="alert alert-' . $type . ' ' . $class . '" role="alert" ' . $data . '>';
57 57
 
58 58
 			// heading
59
-			if ( ! empty( $args['heading'] ) ) {
59
+			if (!empty($args['heading'])) {
60 60
 				$output .= '<h4 class="alert-heading">' . $args['heading'] . '</h4>';
61 61
 			}
62 62
 
63 63
 			// icon
64
-			if ( ! empty( $icon) ) {
65
-				$output .= $icon." ";
64
+			if (!empty($icon)) {
65
+				$output .= $icon . " ";
66 66
 			}
67 67
 
68 68
 			// content
69 69
 			$output .= $args['content'];
70 70
 
71 71
 			// dismissible
72
-			if($args['dismissible']){
72
+			if ($args['dismissible']) {
73 73
 				$output .= '<button type="button" class="close" data-dismiss="alert" aria-label="Close">';
74 74
 				$output .= '<span aria-hidden="true">&times;</span>';
75 75
 				$output .= '</button>';
76 76
 			}
77 77
 
78 78
 			// footer
79
-			if ( ! empty( $args['footer'] ) ) {
79
+			if (!empty($args['footer'])) {
80 80
 				$output .= '<hr>';
81 81
 				$output .= '<p class="mb-0">' . $args['footer'] . '</p>';
82 82
 			}
Please login to merge, or discard this patch.
Braces   +1 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,10 +42,7 @@
 block discarded – undo
42 42
 
43 43
 			// set default icon
44 44
 			if(!$icon && $args['icon']!==false && $type){
45
-				if($type=='danger'){$icon = '<i class="fas fa-exclamation-circle"></i>';}
46
-				elseif($type=='warning'){$icon = '<i class="fas fa-exclamation-triangle"></i>';}
47
-				elseif($type=='success'){$icon = '<i class="fas fa-check-circle"></i>';}
48
-				elseif($type=='info'){$icon = '<i class="fas fa-info-circle"></i>';}
45
+				if($type=='danger'){$icon = '<i class="fas fa-exclamation-circle"></i>';} elseif($type=='warning'){$icon = '<i class="fas fa-exclamation-triangle"></i>';} elseif($type=='success'){$icon = '<i class="fas fa-check-circle"></i>';} elseif($type=='info'){$icon = '<i class="fas fa-info-circle"></i>';}
49 46
 			}
50 47
 
51 48
 			$data = '';
Please login to merge, or discard this patch.
ayecode/wp-ayecode-ui/includes/components/class-aui-component-dropdown.php 3 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if ( ! defined( 'ABSPATH' ) ) {
4
-	exit; // Exit if accessed directly
4
+    exit; // Exit if accessed directly
5 5
 }
6 6
 
7 7
 /**
@@ -11,62 +11,62 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class AUI_Component_Dropdown {
13 13
 
14
-	/**
15
-	 * Build the component.
16
-	 *
17
-	 * @param array $args
18
-	 *
19
-	 * @return string The rendered component.
20
-	 */
21
-	public static function get($args = array()){
22
-		$defaults = array(
23
-			'type'       => 'button',
24
-			'href'       => '#',
25
-			'class'      => 'btn btn-primary dropdown-toggle',
26
-			'wrapper_class' => '',
27
-			'dropdown_menu_class' => '',
28
-			'id'         => '',
29
-			'title'      => '',
30
-			'value'      => '',
31
-			'content'    => '',
32
-			'icon'       => '',
33
-			'hover_content' => '',
34
-			'hover_icon'    => '',
35
-			'data-toggle'   => 'dropdown',
36
-			'aria-haspopup' => 'true',
37
-			'aria-expanded' => 'false',
38
-			'dropdown_menu'          => '', // unescaped html menu (non-preferred way)
39
-			'dropdown_items'          => array(), // array of AUI calls
14
+    /**
15
+     * Build the component.
16
+     *
17
+     * @param array $args
18
+     *
19
+     * @return string The rendered component.
20
+     */
21
+    public static function get($args = array()){
22
+        $defaults = array(
23
+            'type'       => 'button',
24
+            'href'       => '#',
25
+            'class'      => 'btn btn-primary dropdown-toggle',
26
+            'wrapper_class' => '',
27
+            'dropdown_menu_class' => '',
28
+            'id'         => '',
29
+            'title'      => '',
30
+            'value'      => '',
31
+            'content'    => '',
32
+            'icon'       => '',
33
+            'hover_content' => '',
34
+            'hover_icon'    => '',
35
+            'data-toggle'   => 'dropdown',
36
+            'aria-haspopup' => 'true',
37
+            'aria-expanded' => 'false',
38
+            'dropdown_menu'          => '', // unescaped html menu (non-preferred way)
39
+            'dropdown_items'          => array(), // array of AUI calls
40 40
 
41
-		);
41
+        );
42 42
 
43
-		/**
44
-		 * Parse incoming $args into an array and merge it with $defaults
45
-		 */
46
-		$args   = wp_parse_args( $args, $defaults );
47
-		$output = '';
48
-		if ( ! empty( $args['type'] ) ) {
49
-			// wrapper open
50
-			$output .= '<div class="dropdown '.AUI_Component_Helper::esc_classes($args['wrapper_class']).'">';
43
+        /**
44
+         * Parse incoming $args into an array and merge it with $defaults
45
+         */
46
+        $args   = wp_parse_args( $args, $defaults );
47
+        $output = '';
48
+        if ( ! empty( $args['type'] ) ) {
49
+            // wrapper open
50
+            $output .= '<div class="dropdown '.AUI_Component_Helper::esc_classes($args['wrapper_class']).'">';
51 51
 
52
-			// button part
53
-			$output .= aui()->button($args);
52
+            // button part
53
+            $output .= aui()->button($args);
54 54
 
55
-			// dropdown-menu
56
-			if(!empty($args['dropdown_menu'])){
57
-				$output .= $args['dropdown_menu'];
58
-			}elseif(!empty($args['dropdown_items'])){
59
-				$output .= '<div class="dropdown-menu '.AUI_Component_Helper::esc_classes($args['dropdown_menu_class']).'" aria-labelledby="'.sanitize_html_class($args['id']).'">';
60
-				$output .= aui()->render($args['dropdown_items']);
61
-				$output .= '</div>';
62
-			}
55
+            // dropdown-menu
56
+            if(!empty($args['dropdown_menu'])){
57
+                $output .= $args['dropdown_menu'];
58
+            }elseif(!empty($args['dropdown_items'])){
59
+                $output .= '<div class="dropdown-menu '.AUI_Component_Helper::esc_classes($args['dropdown_menu_class']).'" aria-labelledby="'.sanitize_html_class($args['id']).'">';
60
+                $output .= aui()->render($args['dropdown_items']);
61
+                $output .= '</div>';
62
+            }
63 63
 
64
-			// wrapper close
65
-			$output .= '</div>';
64
+            // wrapper close
65
+            $output .= '</div>';
66 66
 
67
-		}
67
+        }
68 68
 
69
-		return $output;
70
-	}
69
+        return $output;
70
+    }
71 71
 
72 72
 }
73 73
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
 	exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @return string The rendered component.
20 20
 	 */
21
-	public static function get($args = array()){
21
+	public static function get($args = array()) {
22 22
 		$defaults = array(
23 23
 			'type'       => 'button',
24 24
 			'href'       => '#',
@@ -43,20 +43,20 @@  discard block
 block discarded – undo
43 43
 		/**
44 44
 		 * Parse incoming $args into an array and merge it with $defaults
45 45
 		 */
46
-		$args   = wp_parse_args( $args, $defaults );
46
+		$args   = wp_parse_args($args, $defaults);
47 47
 		$output = '';
48
-		if ( ! empty( $args['type'] ) ) {
48
+		if (!empty($args['type'])) {
49 49
 			// wrapper open
50
-			$output .= '<div class="dropdown '.AUI_Component_Helper::esc_classes($args['wrapper_class']).'">';
50
+			$output .= '<div class="dropdown ' . AUI_Component_Helper::esc_classes($args['wrapper_class']) . '">';
51 51
 
52 52
 			// button part
53 53
 			$output .= aui()->button($args);
54 54
 
55 55
 			// dropdown-menu
56
-			if(!empty($args['dropdown_menu'])){
56
+			if (!empty($args['dropdown_menu'])) {
57 57
 				$output .= $args['dropdown_menu'];
58
-			}elseif(!empty($args['dropdown_items'])){
59
-				$output .= '<div class="dropdown-menu '.AUI_Component_Helper::esc_classes($args['dropdown_menu_class']).'" aria-labelledby="'.sanitize_html_class($args['id']).'">';
58
+			}elseif (!empty($args['dropdown_items'])) {
59
+				$output .= '<div class="dropdown-menu ' . AUI_Component_Helper::esc_classes($args['dropdown_menu_class']) . '" aria-labelledby="' . sanitize_html_class($args['id']) . '">';
60 60
 				$output .= aui()->render($args['dropdown_items']);
61 61
 				$output .= '</div>';
62 62
 			}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 			// dropdown-menu
56 56
 			if(!empty($args['dropdown_menu'])){
57 57
 				$output .= $args['dropdown_menu'];
58
-			}elseif(!empty($args['dropdown_items'])){
58
+			} elseif(!empty($args['dropdown_items'])){
59 59
 				$output .= '<div class="dropdown-menu '.AUI_Component_Helper::esc_classes($args['dropdown_menu_class']).'" aria-labelledby="'.sanitize_html_class($args['id']).'">';
60 60
 				$output .= aui()->render($args['dropdown_items']);
61 61
 				$output .= '</div>';
Please login to merge, or discard this patch.
wp-ayecode-ui/includes/components/class-aui-component-pagination.php 2 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if ( ! defined( 'ABSPATH' ) ) {
4
-	exit; // Exit if accessed directly
4
+    exit; // Exit if accessed directly
5 5
 }
6 6
 
7 7
 /**
@@ -11,73 +11,73 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class AUI_Component_Pagination {
13 13
 
14
-	/**
15
-	 * Build the component.
16
-	 *
17
-	 * @param array $args
18
-	 *
19
-	 * @return string The rendered component.
20
-	 */
21
-	public static function get( $args = array() ) {
22
-		global $wp_query;
14
+    /**
15
+     * Build the component.
16
+     *
17
+     * @param array $args
18
+     *
19
+     * @return string The rendered component.
20
+     */
21
+    public static function get( $args = array() ) {
22
+        global $wp_query;
23 23
 
24
-		$defaults = array(
25
-			'mid_size'           => 2,
26
-			'prev_text'          => '<i class="fas fa-chevron-left"></i>',
27
-			'next_text'          => '<i class="fas fa-chevron-right"></i>',
28
-			'screen_reader_text' => __( 'Posts navigation' ),
29
-			'before_page_number' => '',
30
-			'after_page_number'  => '',
31
-			'type'               => 'array',
32
-			'total'              => isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1
33
-		);
24
+        $defaults = array(
25
+            'mid_size'           => 2,
26
+            'prev_text'          => '<i class="fas fa-chevron-left"></i>',
27
+            'next_text'          => '<i class="fas fa-chevron-right"></i>',
28
+            'screen_reader_text' => __( 'Posts navigation' ),
29
+            'before_page_number' => '',
30
+            'after_page_number'  => '',
31
+            'type'               => 'array',
32
+            'total'              => isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1
33
+        );
34 34
 
35
-		/**
36
-		 * Parse incoming $args into an array and merge it with $defaults
37
-		 */
38
-		$args = wp_parse_args( $args, $defaults );
35
+        /**
36
+         * Parse incoming $args into an array and merge it with $defaults
37
+         */
38
+        $args = wp_parse_args( $args, $defaults );
39 39
 
40
-		$output = '';
40
+        $output = '';
41 41
 
42
-		// Don't print empty markup if there's only one page.
43
-		if ( $args['total'] > 1 ) {
42
+        // Don't print empty markup if there's only one page.
43
+        if ( $args['total'] > 1 ) {
44 44
 
45
-			// Set up paginated links.
46
-			$links = paginate_links( $args );
45
+            // Set up paginated links.
46
+            $links = paginate_links( $args );
47 47
 
48
-			// make the output bootstrap ready
49
-			$links_html = "<ul class='pagination m-0 p-0'>";
50
-			if ( ! empty( $links ) ) {
51
-				foreach ( $links as $link ) {
52
-					$active = strpos( $link, 'current' ) !== false ? 'active' : '';
53
-					$links_html .= "<li class='page-item $active'>";
54
-					$links_html .= str_replace( "page-numbers", "page-link", $link );
55
-					$links_html .= "</li>";
56
-				}
57
-			}
58
-			$links_html .= "</ul>";
48
+            // make the output bootstrap ready
49
+            $links_html = "<ul class='pagination m-0 p-0'>";
50
+            if ( ! empty( $links ) ) {
51
+                foreach ( $links as $link ) {
52
+                    $active = strpos( $link, 'current' ) !== false ? 'active' : '';
53
+                    $links_html .= "<li class='page-item $active'>";
54
+                    $links_html .= str_replace( "page-numbers", "page-link", $link );
55
+                    $links_html .= "</li>";
56
+                }
57
+            }
58
+            $links_html .= "</ul>";
59 59
 
60
-			if ( $links ) {
61
-				$output .= '<section class="px-0 py-2 w-100">';
62
-				$output .= _navigation_markup( $links_html, 'aui-pagination', $args['screen_reader_text'] );
63
-				$output .= '</section>';
64
-			}
60
+            if ( $links ) {
61
+                $output .= '<section class="px-0 py-2 w-100">';
62
+                $output .= _navigation_markup( $links_html, 'aui-pagination', $args['screen_reader_text'] );
63
+                $output .= '</section>';
64
+            }
65 65
 
66
-			$output = str_replace( "screen-reader-text", "screen-reader-text sr-only", $output );
67
-			$output = str_replace( "nav-links", "aui-nav-links", $output );
68
-		}
66
+            $output = str_replace( "screen-reader-text", "screen-reader-text sr-only", $output );
67
+            $output = str_replace( "nav-links", "aui-nav-links", $output );
68
+        }
69 69
 
70
-		if ( $output ) {
71
-			if ( ! empty( $args['before_paging'] ) ) {
72
-				$output = $args['before_paging'] . $output;
73
-			}
70
+        if ( $output ) {
71
+            if ( ! empty( $args['before_paging'] ) ) {
72
+                $output = $args['before_paging'] . $output;
73
+            }
74 74
 
75
-			if ( ! empty( $args['after_paging'] ) ) {
76
-				$output = $output . $args['after_paging'];
77
-			}
78
-		}
75
+            if ( ! empty( $args['after_paging'] ) ) {
76
+                $output = $output . $args['after_paging'];
77
+            }
78
+        }
79 79
 
80
-		return $output;
81
-	}
80
+        return $output;
81
+    }
82 82
 
83 83
 }
84 84
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
 	exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -18,61 +18,61 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @return string The rendered component.
20 20
 	 */
21
-	public static function get( $args = array() ) {
21
+	public static function get($args = array()) {
22 22
 		global $wp_query;
23 23
 
24 24
 		$defaults = array(
25 25
 			'mid_size'           => 2,
26 26
 			'prev_text'          => '<i class="fas fa-chevron-left"></i>',
27 27
 			'next_text'          => '<i class="fas fa-chevron-right"></i>',
28
-			'screen_reader_text' => __( 'Posts navigation' ),
28
+			'screen_reader_text' => __('Posts navigation'),
29 29
 			'before_page_number' => '',
30 30
 			'after_page_number'  => '',
31 31
 			'type'               => 'array',
32
-			'total'              => isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1
32
+			'total'              => isset($wp_query->max_num_pages) ? $wp_query->max_num_pages : 1
33 33
 		);
34 34
 
35 35
 		/**
36 36
 		 * Parse incoming $args into an array and merge it with $defaults
37 37
 		 */
38
-		$args = wp_parse_args( $args, $defaults );
38
+		$args = wp_parse_args($args, $defaults);
39 39
 
40 40
 		$output = '';
41 41
 
42 42
 		// Don't print empty markup if there's only one page.
43
-		if ( $args['total'] > 1 ) {
43
+		if ($args['total'] > 1) {
44 44
 
45 45
 			// Set up paginated links.
46
-			$links = paginate_links( $args );
46
+			$links = paginate_links($args);
47 47
 
48 48
 			// make the output bootstrap ready
49 49
 			$links_html = "<ul class='pagination m-0 p-0'>";
50
-			if ( ! empty( $links ) ) {
51
-				foreach ( $links as $link ) {
52
-					$active = strpos( $link, 'current' ) !== false ? 'active' : '';
50
+			if (!empty($links)) {
51
+				foreach ($links as $link) {
52
+					$active = strpos($link, 'current') !== false ? 'active' : '';
53 53
 					$links_html .= "<li class='page-item $active'>";
54
-					$links_html .= str_replace( "page-numbers", "page-link", $link );
54
+					$links_html .= str_replace("page-numbers", "page-link", $link);
55 55
 					$links_html .= "</li>";
56 56
 				}
57 57
 			}
58 58
 			$links_html .= "</ul>";
59 59
 
60
-			if ( $links ) {
60
+			if ($links) {
61 61
 				$output .= '<section class="px-0 py-2 w-100">';
62
-				$output .= _navigation_markup( $links_html, 'aui-pagination', $args['screen_reader_text'] );
62
+				$output .= _navigation_markup($links_html, 'aui-pagination', $args['screen_reader_text']);
63 63
 				$output .= '</section>';
64 64
 			}
65 65
 
66
-			$output = str_replace( "screen-reader-text", "screen-reader-text sr-only", $output );
67
-			$output = str_replace( "nav-links", "aui-nav-links", $output );
66
+			$output = str_replace("screen-reader-text", "screen-reader-text sr-only", $output);
67
+			$output = str_replace("nav-links", "aui-nav-links", $output);
68 68
 		}
69 69
 
70
-		if ( $output ) {
71
-			if ( ! empty( $args['before_paging'] ) ) {
70
+		if ($output) {
71
+			if (!empty($args['before_paging'])) {
72 72
 				$output = $args['before_paging'] . $output;
73 73
 			}
74 74
 
75
-			if ( ! empty( $args['after_paging'] ) ) {
75
+			if (!empty($args['after_paging'])) {
76 76
 				$output = $output . $args['after_paging'];
77 77
 			}
78 78
 		}
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/ayecode-ui-settings.php 3 patches
Indentation   +802 added lines, -802 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * Bail if we are not in WP.
14 14
  */
15 15
 if ( ! defined( 'ABSPATH' ) ) {
16
-	exit;
16
+    exit;
17 17
 }
18 18
 
19 19
 /**
@@ -21,164 +21,164 @@  discard block
 block discarded – undo
21 21
  */
22 22
 if ( ! class_exists( 'AyeCode_UI_Settings' ) ) {
23 23
 
24
-	/**
25
-	 * A Class to be able to change settings for Font Awesome.
26
-	 *
27
-	 * Class AyeCode_UI_Settings
28
-	 * @ver 1.0.0
29
-	 * @todo decide how to implement textdomain
30
-	 */
31
-	class AyeCode_UI_Settings {
32
-
33
-		/**
34
-		 * Class version version.
35
-		 *
36
-		 * @var string
37
-		 */
38
-		public $version = '1.0.1';
39
-
40
-		/**
41
-		 * Class textdomain.
42
-		 *
43
-		 * @var string
44
-		 */
45
-		public $textdomain = 'aui';
46
-
47
-		/**
48
-		 * Latest version of Bootstrap at time of publish published.
49
-		 *
50
-		 * @var string
51
-		 */
52
-		public $latest = "4.3.1";
53
-
54
-		/**
55
-		 * Current version of select2 being used.
56
-		 *
57
-		 * @var string
58
-		 */
59
-		public $select2_version = "4.0.11";
60
-
61
-		/**
62
-		 * The title.
63
-		 *
64
-		 * @var string
65
-		 */
66
-		public $name = 'AyeCode UI';
67
-
68
-		/**
69
-		 * The relative url to the assets.
70
-		 *
71
-		 * @var string
72
-		 */
73
-		public $url = '';
74
-
75
-		/**
76
-		 * Holds the settings values.
77
-		 *
78
-		 * @var array
79
-		 */
80
-		private $settings;
81
-
82
-		/**
83
-		 * AyeCode_UI_Settings instance.
84
-		 *
85
-		 * @access private
86
-		 * @since  1.0.0
87
-		 * @var    AyeCode_UI_Settings There can be only one!
88
-		 */
89
-		private static $instance = null;
90
-
91
-		/**
92
-		 * Main AyeCode_UI_Settings Instance.
93
-		 *
94
-		 * Ensures only one instance of AyeCode_UI_Settings is loaded or can be loaded.
95
-		 *
96
-		 * @since 1.0.0
97
-		 * @static
98
-		 * @return AyeCode_UI_Settings - Main instance.
99
-		 */
100
-		public static function instance() {
101
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) {
102
-				self::$instance = new AyeCode_UI_Settings;
103
-
104
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
105
-
106
-				if ( is_admin() ) {
107
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
108
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
109
-
110
-					// Maybe show example page
111
-					add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
112
-				}
113
-
114
-				add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
115
-
116
-				do_action( 'ayecode_ui_settings_loaded' );
117
-			}
118
-
119
-			return self::$instance;
120
-		}
121
-
122
-		/**
123
-		 * Initiate the settings and add the required action hooks.
124
-		 */
125
-		public function init() {
126
-			$this->settings = $this->get_settings();
127
-			$this->url = $this->get_url();
24
+    /**
25
+     * A Class to be able to change settings for Font Awesome.
26
+     *
27
+     * Class AyeCode_UI_Settings
28
+     * @ver 1.0.0
29
+     * @todo decide how to implement textdomain
30
+     */
31
+    class AyeCode_UI_Settings {
32
+
33
+        /**
34
+         * Class version version.
35
+         *
36
+         * @var string
37
+         */
38
+        public $version = '1.0.1';
39
+
40
+        /**
41
+         * Class textdomain.
42
+         *
43
+         * @var string
44
+         */
45
+        public $textdomain = 'aui';
46
+
47
+        /**
48
+         * Latest version of Bootstrap at time of publish published.
49
+         *
50
+         * @var string
51
+         */
52
+        public $latest = "4.3.1";
53
+
54
+        /**
55
+         * Current version of select2 being used.
56
+         *
57
+         * @var string
58
+         */
59
+        public $select2_version = "4.0.11";
60
+
61
+        /**
62
+         * The title.
63
+         *
64
+         * @var string
65
+         */
66
+        public $name = 'AyeCode UI';
67
+
68
+        /**
69
+         * The relative url to the assets.
70
+         *
71
+         * @var string
72
+         */
73
+        public $url = '';
74
+
75
+        /**
76
+         * Holds the settings values.
77
+         *
78
+         * @var array
79
+         */
80
+        private $settings;
81
+
82
+        /**
83
+         * AyeCode_UI_Settings instance.
84
+         *
85
+         * @access private
86
+         * @since  1.0.0
87
+         * @var    AyeCode_UI_Settings There can be only one!
88
+         */
89
+        private static $instance = null;
90
+
91
+        /**
92
+         * Main AyeCode_UI_Settings Instance.
93
+         *
94
+         * Ensures only one instance of AyeCode_UI_Settings is loaded or can be loaded.
95
+         *
96
+         * @since 1.0.0
97
+         * @static
98
+         * @return AyeCode_UI_Settings - Main instance.
99
+         */
100
+        public static function instance() {
101
+            if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) {
102
+                self::$instance = new AyeCode_UI_Settings;
103
+
104
+                add_action( 'init', array( self::$instance, 'init' ) ); // set settings
105
+
106
+                if ( is_admin() ) {
107
+                    add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
108
+                    add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
109
+
110
+                    // Maybe show example page
111
+                    add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
112
+                }
128 113
 
129
-			/**
130
-			 * Maybe load CSS
131
-			 *
132
-			 * We load super early in case there is a theme version that might change the colors
133
-			 */
134
-			if ( $this->settings['css'] ) {
135
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
136
-			}
137
-			if ( $this->settings['css_backend'] ) {
138
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
139
-			}
140
-
141
-			// maybe load JS
142
-			if ( $this->settings['js'] ) {
143
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
144
-			}
145
-			if ( $this->settings['js_backend'] ) {
146
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
147
-			}
148
-
149
-			// Maybe set the HTML font size
150
-			if ( $this->settings['html_font_size'] ) {
151
-				add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
152
-			}
153
-
154
-
155
-		}
156
-
157
-		/**
158
-		 * Add a html font size to the footer.
159
-		 */
160
-		public function html_font_size(){
161
-			$this->settings = $this->get_settings();
162
-			echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
163
-		}
164
-
165
-		/**
166
-		 * Adds the Font Awesome styles.
167
-		 */
168
-		public function enqueue_style() {
114
+                add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
115
+
116
+                do_action( 'ayecode_ui_settings_loaded' );
117
+            }
118
+
119
+            return self::$instance;
120
+        }
121
+
122
+        /**
123
+         * Initiate the settings and add the required action hooks.
124
+         */
125
+        public function init() {
126
+            $this->settings = $this->get_settings();
127
+            $this->url = $this->get_url();
128
+
129
+            /**
130
+             * Maybe load CSS
131
+             *
132
+             * We load super early in case there is a theme version that might change the colors
133
+             */
134
+            if ( $this->settings['css'] ) {
135
+                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
136
+            }
137
+            if ( $this->settings['css_backend'] ) {
138
+                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
139
+            }
140
+
141
+            // maybe load JS
142
+            if ( $this->settings['js'] ) {
143
+                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
144
+            }
145
+            if ( $this->settings['js_backend'] ) {
146
+                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
147
+            }
148
+
149
+            // Maybe set the HTML font size
150
+            if ( $this->settings['html_font_size'] ) {
151
+                add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
152
+            }
153
+
154
+
155
+        }
156
+
157
+        /**
158
+         * Add a html font size to the footer.
159
+         */
160
+        public function html_font_size(){
161
+            $this->settings = $this->get_settings();
162
+            echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
163
+        }
164
+
165
+        /**
166
+         * Adds the Font Awesome styles.
167
+         */
168
+        public function enqueue_style() {
169 169
 			
170
-			$css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
170
+            $css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
171 171
 
172
-			if($this->settings[$css_setting]){
173
-				$compatibility = $this->settings[$css_setting]=='core' ? false : true;
174
-				$url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui.css' : $this->url.'assets/css/ayecode-ui-compatibility.css';
175
-				wp_register_style( 'ayecode-ui', $url, array(), $this->latest );
176
-				wp_enqueue_style( 'ayecode-ui' );
172
+            if($this->settings[$css_setting]){
173
+                $compatibility = $this->settings[$css_setting]=='core' ? false : true;
174
+                $url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui.css' : $this->url.'assets/css/ayecode-ui-compatibility.css';
175
+                wp_register_style( 'ayecode-ui', $url, array(), $this->latest );
176
+                wp_enqueue_style( 'ayecode-ui' );
177 177
 
178 178
 
179
-				// fix some wp-admin issues
180
-				if(is_admin()){
181
-					$custom_css = "
179
+                // fix some wp-admin issues
180
+                if(is_admin()){
181
+                    $custom_css = "
182 182
                 body{
183 183
                     background-color: #f1f1f1;
184 184
                     font-family: -apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif;
@@ -213,23 +213,23 @@  discard block
 block discarded – undo
213 213
 				    margin: 1em 0
214 214
 				}
215 215
                 ";
216
-					wp_add_inline_style( 'ayecode-ui', $custom_css );
217
-				}
216
+                    wp_add_inline_style( 'ayecode-ui', $custom_css );
217
+                }
218 218
 
219
-				// custom changes
220
-				wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
219
+                // custom changes
220
+                wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
221 221
 
222
-			}
223
-		}
222
+            }
223
+        }
224 224
 
225
-		/**
226
-		 * Get inline script used if bootstrap enqueued
227
-		 *
228
-		 * If this remains small then its best to use this than to add another JS file.
229
-		 */
230
-		public function inline_script(){
231
-			ob_start();
232
-			?>
225
+        /**
226
+         * Get inline script used if bootstrap enqueued
227
+         *
228
+         * If this remains small then its best to use this than to add another JS file.
229
+         */
230
+        public function inline_script(){
231
+            ob_start();
232
+            ?>
233 233
 			<script>
234 234
 
235 235
 				/**
@@ -413,25 +413,25 @@  discard block
 block discarded – undo
413 413
 				});
414 414
 			</script>
415 415
 			<?php
416
-			$output = ob_get_clean();
416
+            $output = ob_get_clean();
417 417
 
418
-			/*
418
+            /*
419 419
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
420 420
 			 */
421
-			return str_replace( array(
422
-				'<script>',
423
-				'</script>'
424
-			), '', $output );
425
-		}
426
-
427
-		/**
428
-		 * Get inline script used if bootstrap file browser enqueued.
429
-		 *
430
-		 * If this remains small then its best to use this than to add another JS file.
431
-		 */
432
-		public function inline_script_file_browser(){
433
-			ob_start();
434
-			?>
421
+            return str_replace( array(
422
+                '<script>',
423
+                '</script>'
424
+            ), '', $output );
425
+        }
426
+
427
+        /**
428
+         * Get inline script used if bootstrap file browser enqueued.
429
+         *
430
+         * If this remains small then its best to use this than to add another JS file.
431
+         */
432
+        public function inline_script_file_browser(){
433
+            ob_start();
434
+            ?>
435 435
 			<script>
436 436
 				// run on doc ready
437 437
 				jQuery(document).ready(function () {
@@ -439,172 +439,172 @@  discard block
 block discarded – undo
439 439
 				});
440 440
 			</script>
441 441
 			<?php
442
-			$output = ob_get_clean();
442
+            $output = ob_get_clean();
443 443
 
444
-			/*
444
+            /*
445 445
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
446 446
 			 */
447
-			return str_replace( array(
448
-				'<script>',
449
-				'</script>'
450
-			), '', $output );
451
-		}
452
-
453
-		/**
454
-		 * Adds the Font Awesome JS.
455
-		 */
456
-		public function enqueue_scripts() {
457
-
458
-			$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
447
+            return str_replace( array(
448
+                '<script>',
449
+                '</script>'
450
+            ), '', $output );
451
+        }
452
+
453
+        /**
454
+         * Adds the Font Awesome JS.
455
+         */
456
+        public function enqueue_scripts() {
457
+
458
+            $js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
459 459
 			
460
-			// select2
461
-			wp_register_script( 'select2', $this->url.'assets/js/select2.min.js', array('jquery'), $this->select2_version );
462
-
463
-			// Bootstrap file browser
464
-			wp_register_script( 'aui-custom-file-input', $url = $this->url.'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version );
465
-			wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
466
-
467
-			$load_inline = false;
468
-
469
-			if($this->settings[$js_setting]=='core-popper'){
470
-				// Bootstrap bundle
471
-				$url = $this->url.'assets/js/bootstrap.bundle.min.js';
472
-				wp_register_script( 'bootstrap-js-bundle', $url, array('select2','jquery'), $this->latest );
473
-				wp_enqueue_script( 'bootstrap-js-bundle' );
474
-				$script = $this->inline_script();
475
-				wp_add_inline_script( 'bootstrap-js-bundle', $script );
476
-			}elseif($this->settings[$js_setting]=='popper'){
477
-				$url = $this->url.'assets/js/popper.min.js';
478
-				wp_register_script( 'bootstrap-js-popper', $url, array('jquery'), $this->latest );
479
-				wp_enqueue_script( 'bootstrap-js-popper' );
480
-				$load_inline = true;
481
-			}else{
482
-				$load_inline = true;
483
-			}
484
-
485
-			// Load needed inline scripts by faking the loading of a script if the main script is not being loaded
486
-			if($load_inline){
487
-				wp_register_script( 'bootstrap-dummy', '',array('jquery') );
488
-				wp_enqueue_script( 'bootstrap-dummy' );
489
-				$script = $this->inline_script();
490
-				wp_add_inline_script( 'bootstrap-dummy', $script  );
491
-			}
460
+            // select2
461
+            wp_register_script( 'select2', $this->url.'assets/js/select2.min.js', array('jquery'), $this->select2_version );
462
+
463
+            // Bootstrap file browser
464
+            wp_register_script( 'aui-custom-file-input', $url = $this->url.'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version );
465
+            wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
466
+
467
+            $load_inline = false;
468
+
469
+            if($this->settings[$js_setting]=='core-popper'){
470
+                // Bootstrap bundle
471
+                $url = $this->url.'assets/js/bootstrap.bundle.min.js';
472
+                wp_register_script( 'bootstrap-js-bundle', $url, array('select2','jquery'), $this->latest );
473
+                wp_enqueue_script( 'bootstrap-js-bundle' );
474
+                $script = $this->inline_script();
475
+                wp_add_inline_script( 'bootstrap-js-bundle', $script );
476
+            }elseif($this->settings[$js_setting]=='popper'){
477
+                $url = $this->url.'assets/js/popper.min.js';
478
+                wp_register_script( 'bootstrap-js-popper', $url, array('jquery'), $this->latest );
479
+                wp_enqueue_script( 'bootstrap-js-popper' );
480
+                $load_inline = true;
481
+            }else{
482
+                $load_inline = true;
483
+            }
484
+
485
+            // Load needed inline scripts by faking the loading of a script if the main script is not being loaded
486
+            if($load_inline){
487
+                wp_register_script( 'bootstrap-dummy', '',array('jquery') );
488
+                wp_enqueue_script( 'bootstrap-dummy' );
489
+                $script = $this->inline_script();
490
+                wp_add_inline_script( 'bootstrap-dummy', $script  );
491
+            }
492 492
 			
493
-		}
494
-
495
-		/**
496
-		 * Get the url path to the current folder.
497
-		 *
498
-		 * @return string
499
-		 */
500
-		public function get_url() {
501
-
502
-			$url = '';
503
-			// check if we are inside a plugin
504
-			$file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
505
-
506
-			// add check in-case user has changed wp-content dir name.
507
-			$wp_content_folder_name = basename(WP_CONTENT_DIR);
508
-			$dir_parts = explode("/$wp_content_folder_name/",$file_dir);
509
-			$url_parts = explode("/$wp_content_folder_name/",plugins_url());
510
-
511
-			if(!empty($url_parts[0]) && !empty($dir_parts[1])){
512
-				$url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
513
-			}
514
-
515
-			return $url;
516
-		}
517
-
518
-		/**
519
-		 * Register the database settings with WordPress.
520
-		 */
521
-		public function register_settings() {
522
-			register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
523
-		}
524
-
525
-		/**
526
-		 * Add the WordPress settings menu item.
527
-		 * @since 1.0.10 Calling function name direct will fail theme check so we don't.
528
-		 */
529
-		public function menu_item() {
530
-			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
531
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
532
-				$this,
533
-				'settings_page'
534
-			) );
535
-		}
536
-
537
-		/**
538
-		 * Get a list of themes and their default JS settings.
539
-		 * 
540
-		 * @return array
541
-		 */
542
-		public function theme_js_settings(){
543
-			return array(
544
-				'ayetheme' => 'popper',
545
-				'listimia' => 'required',
546
-				'listimia_backend' => 'core-popper',
547
-				'avada'    => 'required',
548
-			);
549
-		}
550
-
551
-		/**
552
-		 * Get the current Font Awesome output settings.
553
-		 *
554
-		 * @return array The array of settings.
555
-		 */
556
-		public function get_settings() {
557
-
558
-			$db_settings = get_option( 'ayecode-ui-settings' );
559
-			$js_default = 'core-popper';
560
-			$js_default_backend = $js_default;
561
-
562
-			// maybe set defaults (if no settings set)
563
-			if(empty($db_settings)){
564
-				$active_theme = strtolower( get_template() ); // active parent theme.
565
-				$theme_js_settings = self::theme_js_settings();
566
-				if(isset($theme_js_settings[$active_theme])){
567
-					$js_default = $theme_js_settings[$active_theme];
568
-					$js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
569
-				}
570
-			}
571
-
572
-			$defaults = array(
573
-				'css'       => 'compatibility', // core, compatibility
574
-				'js'        => $js_default, // js to load, core-popper, popper
575
-				'html_font_size'        => '16', // js to load, core-popper, popper
576
-				'css_backend'       => 'compatibility', // core, compatibility
577
-				'js_backend'        => $js_default_backend, // js to load, core-popper, popper
578
-
579
-			);
580
-
581
-			$settings = wp_parse_args( $db_settings, $defaults );
582
-
583
-			/**
584
-			 * Filter the Bootstrap settings.
585
-			 *
586
-			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
587
-			 */
588
-			return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
589
-		}
590
-
591
-
592
-		/**
593
-		 * The settings page html output.
594
-		 */
595
-		public function settings_page() {
596
-			if ( ! current_user_can( 'manage_options' ) ) {
597
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
598
-			}
599
-			?>
493
+        }
494
+
495
+        /**
496
+         * Get the url path to the current folder.
497
+         *
498
+         * @return string
499
+         */
500
+        public function get_url() {
501
+
502
+            $url = '';
503
+            // check if we are inside a plugin
504
+            $file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
505
+
506
+            // add check in-case user has changed wp-content dir name.
507
+            $wp_content_folder_name = basename(WP_CONTENT_DIR);
508
+            $dir_parts = explode("/$wp_content_folder_name/",$file_dir);
509
+            $url_parts = explode("/$wp_content_folder_name/",plugins_url());
510
+
511
+            if(!empty($url_parts[0]) && !empty($dir_parts[1])){
512
+                $url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
513
+            }
514
+
515
+            return $url;
516
+        }
517
+
518
+        /**
519
+         * Register the database settings with WordPress.
520
+         */
521
+        public function register_settings() {
522
+            register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
523
+        }
524
+
525
+        /**
526
+         * Add the WordPress settings menu item.
527
+         * @since 1.0.10 Calling function name direct will fail theme check so we don't.
528
+         */
529
+        public function menu_item() {
530
+            $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
531
+            call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
532
+                $this,
533
+                'settings_page'
534
+            ) );
535
+        }
536
+
537
+        /**
538
+         * Get a list of themes and their default JS settings.
539
+         * 
540
+         * @return array
541
+         */
542
+        public function theme_js_settings(){
543
+            return array(
544
+                'ayetheme' => 'popper',
545
+                'listimia' => 'required',
546
+                'listimia_backend' => 'core-popper',
547
+                'avada'    => 'required',
548
+            );
549
+        }
550
+
551
+        /**
552
+         * Get the current Font Awesome output settings.
553
+         *
554
+         * @return array The array of settings.
555
+         */
556
+        public function get_settings() {
557
+
558
+            $db_settings = get_option( 'ayecode-ui-settings' );
559
+            $js_default = 'core-popper';
560
+            $js_default_backend = $js_default;
561
+
562
+            // maybe set defaults (if no settings set)
563
+            if(empty($db_settings)){
564
+                $active_theme = strtolower( get_template() ); // active parent theme.
565
+                $theme_js_settings = self::theme_js_settings();
566
+                if(isset($theme_js_settings[$active_theme])){
567
+                    $js_default = $theme_js_settings[$active_theme];
568
+                    $js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
569
+                }
570
+            }
571
+
572
+            $defaults = array(
573
+                'css'       => 'compatibility', // core, compatibility
574
+                'js'        => $js_default, // js to load, core-popper, popper
575
+                'html_font_size'        => '16', // js to load, core-popper, popper
576
+                'css_backend'       => 'compatibility', // core, compatibility
577
+                'js_backend'        => $js_default_backend, // js to load, core-popper, popper
578
+
579
+            );
580
+
581
+            $settings = wp_parse_args( $db_settings, $defaults );
582
+
583
+            /**
584
+             * Filter the Bootstrap settings.
585
+             *
586
+             * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
587
+             */
588
+            return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
589
+        }
590
+
591
+
592
+        /**
593
+         * The settings page html output.
594
+         */
595
+        public function settings_page() {
596
+            if ( ! current_user_can( 'manage_options' ) ) {
597
+                wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
598
+            }
599
+            ?>
600 600
 			<div class="wrap">
601 601
 				<h1><?php echo $this->name; ?></h1>
602 602
 				<p><?php _e("Here you can adjust settings if you are having compatibility issues.","aui");?></p>
603 603
 				<form method="post" action="options.php">
604 604
 					<?php
605
-					settings_fields( 'ayecode-ui-settings' );
606
-					do_settings_sections( 'ayecode-ui-settings' );
607
-					?>
605
+                    settings_fields( 'ayecode-ui-settings' );
606
+                    do_settings_sections( 'ayecode-ui-settings' );
607
+                    ?>
608 608
 
609 609
 					<h2><?php _e( 'Frontend', 'aui' ); ?></h2>
610 610
 					<table class="form-table wpbs-table-settings">
@@ -674,485 +674,485 @@  discard block
 block discarded – undo
674 674
 					</table>
675 675
 
676 676
 					<?php
677
-					submit_button();
678
-					?>
677
+                    submit_button();
678
+                    ?>
679 679
 				</form>
680 680
 
681 681
 				<div id="wpbs-version"><?php echo $this->version; ?></div>
682 682
 			</div>
683 683
 
684 684
 			<?php
685
-		}
686
-
687
-		public function customizer_settings($wp_customize){
688
-			$wp_customize->add_section('aui_settings', array(
689
-				'title'    => __('AyeCode UI'),
690
-				'priority' => 120,
691
-			));
692
-
693
-			//  =============================
694
-			//  = Color Picker              =
695
-			//  =============================
696
-			$wp_customize->add_setting('aui_options[color_primary]', array(
697
-				'default'           => '#1e73be',
698
-				'sanitize_callback' => 'sanitize_hex_color',
699
-				'capability'        => 'edit_theme_options',
700
-				'type'              => 'option',
701
-				'transport'         => 'refresh',
702
-			));
703
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
704
-				'label'    => __('Primary Color'),
705
-				'section'  => 'aui_settings',
706
-				'settings' => 'aui_options[color_primary]',
707
-			)));
708
-
709
-			$wp_customize->add_setting('aui_options[color_secondary]', array(
710
-				'default'           => '#6c757d',
711
-				'sanitize_callback' => 'sanitize_hex_color',
712
-				'capability'        => 'edit_theme_options',
713
-				'type'              => 'option',
714
-				'transport'         => 'refresh',
715
-			));
716
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
717
-				'label'    => __('Secondary Color'),
718
-				'section'  => 'aui_settings',
719
-				'settings' => 'aui_options[color_secondary]',
720
-			)));
721
-		}
722
-
723
-
724
-		public static function custom_css($compatibility = true) {
725
-			$settings = get_option('aui_options');
726
-
727
-			ob_start();
728
-			?>
685
+        }
686
+
687
+        public function customizer_settings($wp_customize){
688
+            $wp_customize->add_section('aui_settings', array(
689
+                'title'    => __('AyeCode UI'),
690
+                'priority' => 120,
691
+            ));
692
+
693
+            //  =============================
694
+            //  = Color Picker              =
695
+            //  =============================
696
+            $wp_customize->add_setting('aui_options[color_primary]', array(
697
+                'default'           => '#1e73be',
698
+                'sanitize_callback' => 'sanitize_hex_color',
699
+                'capability'        => 'edit_theme_options',
700
+                'type'              => 'option',
701
+                'transport'         => 'refresh',
702
+            ));
703
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
704
+                'label'    => __('Primary Color'),
705
+                'section'  => 'aui_settings',
706
+                'settings' => 'aui_options[color_primary]',
707
+            )));
708
+
709
+            $wp_customize->add_setting('aui_options[color_secondary]', array(
710
+                'default'           => '#6c757d',
711
+                'sanitize_callback' => 'sanitize_hex_color',
712
+                'capability'        => 'edit_theme_options',
713
+                'type'              => 'option',
714
+                'transport'         => 'refresh',
715
+            ));
716
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
717
+                'label'    => __('Secondary Color'),
718
+                'section'  => 'aui_settings',
719
+                'settings' => 'aui_options[color_secondary]',
720
+            )));
721
+        }
722
+
723
+
724
+        public static function custom_css($compatibility = true) {
725
+            $settings = get_option('aui_options');
726
+
727
+            ob_start();
728
+            ?>
729 729
 			<style>
730 730
 				<?php
731
-					if(!empty($settings['color_primary']) && $settings['color_primary'] != "#1e73be"){
732
-						echo self::css_primary($settings['color_primary'],$compatibility);
733
-					}
731
+                    if(!empty($settings['color_primary']) && $settings['color_primary'] != "#1e73be"){
732
+                        echo self::css_primary($settings['color_primary'],$compatibility);
733
+                    }
734 734
 
735
-					if(!empty($settings['color_secondary']) && $settings['color_secondary'] != "#6c757d"){
736
-						echo self::css_secondary($settings['color_secondary'],$compatibility);
737
-					}
735
+                    if(!empty($settings['color_secondary']) && $settings['color_secondary'] != "#6c757d"){
736
+                        echo self::css_secondary($settings['color_secondary'],$compatibility);
737
+                    }
738 738
                 ?>
739 739
 			</style>
740 740
 			<?php
741 741
 
742 742
 
743
-			/*
743
+            /*
744 744
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
745 745
 			 */
746
-			return str_replace( array(
747
-				'<style>',
748
-				'</style>'
749
-			), '', ob_get_clean());
750
-		}
751
-
752
-		public static function css_primary($color_code,$compatibility){;
753
-			$color_code = sanitize_hex_color($color_code);
754
-			if(!$color_code){return '';}
755
-			/**
756
-			 * c = color, b = background color, o = border-color, f = fill
757
-			 */
758
-			$selectors = array(
759
-				'a' => array('c'),
760
-				'.btn-primary' => array('b','o'),
761
-				'.btn-primary.disabled' => array('b','o'),
762
-				'.btn-primary:disabled' => array('b','o'),
763
-				'.btn-outline-primary' => array('c','o'),
764
-				'.btn-outline-primary:hover' => array('b','o'),
765
-				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
766
-				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
767
-				'.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
768
-				'.btn-link' => array('c'),
769
-				'.dropdown-item.active' => array('b'),
770
-				'.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
771
-				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
746
+            return str_replace( array(
747
+                '<style>',
748
+                '</style>'
749
+            ), '', ob_get_clean());
750
+        }
751
+
752
+        public static function css_primary($color_code,$compatibility){;
753
+            $color_code = sanitize_hex_color($color_code);
754
+            if(!$color_code){return '';}
755
+            /**
756
+             * c = color, b = background color, o = border-color, f = fill
757
+             */
758
+            $selectors = array(
759
+                'a' => array('c'),
760
+                '.btn-primary' => array('b','o'),
761
+                '.btn-primary.disabled' => array('b','o'),
762
+                '.btn-primary:disabled' => array('b','o'),
763
+                '.btn-outline-primary' => array('c','o'),
764
+                '.btn-outline-primary:hover' => array('b','o'),
765
+                '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
766
+                '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
767
+                '.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
768
+                '.btn-link' => array('c'),
769
+                '.dropdown-item.active' => array('b'),
770
+                '.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
771
+                '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
772 772
 //				'.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
773 773
 //				'.custom-range::-moz-range-thumb' => array('b'),
774 774
 //				'.custom-range::-ms-thumb' => array('b'),
775
-				'.nav-pills .nav-link.active' => array('b'),
776
-				'.nav-pills .show>.nav-link' => array('b'),
777
-				'.page-link' => array('c'),
778
-				'.page-item.active .page-link' => array('b','o'),
779
-				'.badge-primary' => array('b'),
780
-				'.alert-primary' => array('b','o'),
781
-				'.progress-bar' => array('b'),
782
-				'.list-group-item.active' => array('b','o'),
783
-				'.bg-primary' => array('b','f'),
784
-				'.btn-link.btn-primary' => array('c'),
785
-				'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
786
-			);
787
-
788
-			$important_selectors = array(
789
-				'.bg-primary' => array('b','f'),
790
-				'.border-primary' => array('o'),
791
-				'.text-primary' => array('c'),
792
-			);
793
-
794
-			$color = array();
795
-			$color_i = array();
796
-			$background = array();
797
-			$background_i = array();
798
-			$border = array();
799
-			$border_i = array();
800
-			$fill = array();
801
-			$fill_i = array();
802
-
803
-			$output = '';
804
-
805
-			// build rules into each type
806
-			foreach($selectors as $selector => $types){
807
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
808
-				$types = array_combine($types,$types);
809
-				if(isset($types['c'])){$color[] = $selector;}
810
-				if(isset($types['b'])){$background[] = $selector;}
811
-				if(isset($types['o'])){$border[] = $selector;}
812
-				if(isset($types['f'])){$fill[] = $selector;}
813
-			}
814
-
815
-			// build rules into each type
816
-			foreach($important_selectors as $selector => $types){
817
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
818
-				$types = array_combine($types,$types);
819
-				if(isset($types['c'])){$color_i[] = $selector;}
820
-				if(isset($types['b'])){$background_i[] = $selector;}
821
-				if(isset($types['o'])){$border_i[] = $selector;}
822
-				if(isset($types['f'])){$fill_i[] = $selector;}
823
-			}
824
-
825
-			// add any color rules
826
-			if(!empty($color)){
827
-				$output .= implode(",",$color) . "{color: $color_code;} ";
828
-			}
829
-			if(!empty($color_i)){
830
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
831
-			}
832
-
833
-			// add any background color rules
834
-			if(!empty($background)){
835
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
836
-			}
837
-			if(!empty($background_i)){
838
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
839
-			}
840
-
841
-			// add any border color rules
842
-			if(!empty($border)){
843
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
844
-			}
845
-			if(!empty($border_i)){
846
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
847
-			}
848
-
849
-			// add any fill color rules
850
-			if(!empty($fill)){
851
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
852
-			}
853
-			if(!empty($fill_i)){
854
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
855
-			}
856
-
857
-
858
-			$prefix = $compatibility ? ".bsui " : "";
859
-
860
-			// darken
861
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
862
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
863
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
864
-
865
-			// lighten
866
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
867
-
868
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
869
-			$op_25 = $color_code."40"; // 25% opacity
870
-
871
-
872
-			// button states
873
-			$output .= $prefix ." .btn-primary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
874
-			$output .= $prefix ." .btn-outline-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-primary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
875
-			$output .= $prefix ." .btn-primary:not(:disabled):not(.disabled):active, $prefix .btn-primary:not(:disabled):not(.disabled).active, .show>$prefix .btn-primary.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
876
-			$output .= $prefix ." .btn-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-primary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
877
-
878
-
879
-			// dropdown's
880
-			$output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
881
-
882
-
883
-			// input states
884
-			$output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
885
-
886
-			// page link
887
-			$output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
888
-
889
-			return $output;
890
-		}
891
-
892
-		public static function css_secondary($color_code,$compatibility){;
893
-			$color_code = sanitize_hex_color($color_code);
894
-			if(!$color_code){return '';}
895
-			/**
896
-			 * c = color, b = background color, o = border-color, f = fill
897
-			 */
898
-			$selectors = array(
899
-				'.btn-secondary' => array('b','o'),
900
-				'.btn-secondary.disabled' => array('b','o'),
901
-				'.btn-secondary:disabled' => array('b','o'),
902
-				'.btn-outline-secondary' => array('c','o'),
903
-				'.btn-outline-secondary:hover' => array('b','o'),
904
-				'.btn-outline-secondary.disabled' => array('c'),
905
-				'.btn-outline-secondary:disabled' => array('c'),
906
-				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
907
-				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
908
-				'.btn-outline-secondary.dropdown-toggle' => array('b','o'),
909
-				'.badge-secondary' => array('b'),
910
-				'.alert-secondary' => array('b','o'),
911
-				'.btn-link.btn-secondary' => array('c'),
912
-				);
913
-
914
-			$important_selectors = array(
915
-				'.bg-secondary' => array('b','f'),
916
-				'.border-secondary' => array('o'),
917
-				'.text-secondary' => array('c'),
918
-			);
919
-
920
-			$color = array();
921
-			$color_i = array();
922
-			$background = array();
923
-			$background_i = array();
924
-			$border = array();
925
-			$border_i = array();
926
-			$fill = array();
927
-			$fill_i = array();
928
-
929
-			$output = '';
930
-
931
-			// build rules into each type
932
-			foreach($selectors as $selector => $types){
933
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
934
-				$types = array_combine($types,$types);
935
-				if(isset($types['c'])){$color[] = $selector;}
936
-				if(isset($types['b'])){$background[] = $selector;}
937
-				if(isset($types['o'])){$border[] = $selector;}
938
-				if(isset($types['f'])){$fill[] = $selector;}
939
-			}
940
-
941
-			// build rules into each type
942
-			foreach($important_selectors as $selector => $types){
943
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
944
-				$types = array_combine($types,$types);
945
-				if(isset($types['c'])){$color_i[] = $selector;}
946
-				if(isset($types['b'])){$background_i[] = $selector;}
947
-				if(isset($types['o'])){$border_i[] = $selector;}
948
-				if(isset($types['f'])){$fill_i[] = $selector;}
949
-			}
950
-
951
-			// add any color rules
952
-			if(!empty($color)){
953
-				$output .= implode(",",$color) . "{color: $color_code;} ";
954
-			}
955
-			if(!empty($color_i)){
956
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
957
-			}
958
-
959
-			// add any background color rules
960
-			if(!empty($background)){
961
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
962
-			}
963
-			if(!empty($background_i)){
964
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
965
-			}
966
-
967
-			// add any border color rules
968
-			if(!empty($border)){
969
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
970
-			}
971
-			if(!empty($border_i)){
972
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
973
-			}
974
-
975
-			// add any fill color rules
976
-			if(!empty($fill)){
977
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
978
-			}
979
-			if(!empty($fill_i)){
980
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
981
-			}
982
-
983
-
984
-			$prefix = $compatibility ? ".bsui " : "";
985
-
986
-			// darken
987
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
988
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
989
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
990
-
991
-			// lighten
992
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
993
-
994
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
995
-			$op_25 = $color_code."40"; // 25% opacity
996
-
997
-
998
-			// button states
999
-			$output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1000
-			$output .= $prefix ." .btn-outline-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-secondary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1001
-			$output .= $prefix ." .btn-secondary:not(:disabled):not(.disabled):active, $prefix .btn-secondary:not(:disabled):not(.disabled).active, .show>$prefix .btn-secondary.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
1002
-			$output .= $prefix ." .btn-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-secondary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1003
-
1004
-
1005
-			return $output;
1006
-		}
1007
-
1008
-		/**
1009
-		 * Increases or decreases the brightness of a color by a percentage of the current brightness.
1010
-		 *
1011
-		 * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
1012
-		 * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
1013
-		 *
1014
-		 * @return  string
1015
-		 */
1016
-		public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
1017
-			$hexCode = ltrim($hexCode, '#');
1018
-
1019
-			if (strlen($hexCode) == 3) {
1020
-				$hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
1021
-			}
1022
-
1023
-			$hexCode = array_map('hexdec', str_split($hexCode, 2));
1024
-
1025
-			foreach ($hexCode as & $color) {
1026
-				$adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
1027
-				$adjustAmount = ceil($adjustableLimit * $adjustPercent);
1028
-
1029
-				$color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
1030
-			}
1031
-
1032
-			return '#' . implode($hexCode);
1033
-		}
1034
-
1035
-		/**
1036
-		 * Check if we should display examples.
1037
-		 */
1038
-		public function maybe_show_examples(){
1039
-			if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
1040
-				echo "<head>";
1041
-				wp_head();
1042
-				echo "</head>";
1043
-				echo "<body>";
1044
-				echo $this->get_examples();
1045
-				echo "</body>";
1046
-				exit;
1047
-			}
1048
-		}
1049
-
1050
-		/**
1051
-		 * Get developer examples.
1052
-		 * 
1053
-		 * @return string
1054
-		 */
1055
-		public function get_examples(){
1056
-			$output = '';
1057
-
1058
-
1059
-			// open form
1060
-			$output .= "<form class='p-5 m-5 border rounded'>";
1061
-
1062
-			// input example
1063
-			$output .= aui()->input(array(
1064
-				'type'  =>  'text',
1065
-				'id'    =>  'text-example',
1066
-				'name'    =>  'text-example',
1067
-				'placeholder'   => 'text placeholder',
1068
-				'title'   => 'Text input example',
1069
-				'value' =>  '',
1070
-				'required'  => false,
1071
-				'help_text' => 'help text',
1072
-				'label' => 'Text input example label'
1073
-			));
1074
-
1075
-			// input example
1076
-			$output .= aui()->input(array(
1077
-				'type'  =>  'url',
1078
-				'id'    =>  'text-example2',
1079
-				'name'    =>  'text-example',
1080
-				'placeholder'   => 'url placeholder',
1081
-				'title'   => 'Text input example',
1082
-				'value' =>  '',
1083
-				'required'  => false,
1084
-				'help_text' => 'help text',
1085
-				'label' => 'Text input example label'
1086
-			));
1087
-
1088
-			// checkbox example
1089
-			$output .= aui()->input(array(
1090
-				'type'  =>  'checkbox',
1091
-				'id'    =>  'checkbox-example',
1092
-				'name'    =>  'checkbox-example',
1093
-				'placeholder'   => 'checkbox-example',
1094
-				'title'   => 'Checkbox example',
1095
-				'value' =>  '1',
1096
-				'checked'   => true,
1097
-				'required'  => false,
1098
-				'help_text' => 'help text',
1099
-				'label' => 'Checkbox checked'
1100
-			));
1101
-
1102
-			// checkbox example
1103
-			$output .= aui()->input(array(
1104
-				'type'  =>  'checkbox',
1105
-				'id'    =>  'checkbox-example2',
1106
-				'name'    =>  'checkbox-example2',
1107
-				'placeholder'   => 'checkbox-example',
1108
-				'title'   => 'Checkbox example',
1109
-				'value' =>  '1',
1110
-				'checked'   => false,
1111
-				'required'  => false,
1112
-				'help_text' => 'help text',
1113
-				'label' => 'Checkbox un-checked'
1114
-			));
1115
-
1116
-			// switch example
1117
-			$output .= aui()->input(array(
1118
-				'type'  =>  'checkbox',
1119
-				'id'    =>  'switch-example',
1120
-				'name'    =>  'switch-example',
1121
-				'placeholder'   => 'checkbox-example',
1122
-				'title'   => 'Switch example',
1123
-				'value' =>  '1',
1124
-				'checked'   => true,
1125
-				'switch'    => true,
1126
-				'required'  => false,
1127
-				'help_text' => 'help text',
1128
-				'label' => 'Switch on'
1129
-			));
1130
-
1131
-			// switch example
1132
-			$output .= aui()->input(array(
1133
-				'type'  =>  'checkbox',
1134
-				'id'    =>  'switch-example2',
1135
-				'name'    =>  'switch-example2',
1136
-				'placeholder'   => 'checkbox-example',
1137
-				'title'   => 'Switch example',
1138
-				'value' =>  '1',
1139
-				'checked'   => false,
1140
-				'switch'    => true,
1141
-				'required'  => false,
1142
-				'help_text' => 'help text',
1143
-				'label' => 'Switch off'
1144
-			));
1145
-
1146
-			// close form
1147
-			$output .= "</form>";
1148
-
1149
-			return $output;
1150
-		}
1151
-
1152
-	}
1153
-
1154
-	/**
1155
-	 * Run the class if found.
1156
-	 */
1157
-	AyeCode_UI_Settings::instance();
775
+                '.nav-pills .nav-link.active' => array('b'),
776
+                '.nav-pills .show>.nav-link' => array('b'),
777
+                '.page-link' => array('c'),
778
+                '.page-item.active .page-link' => array('b','o'),
779
+                '.badge-primary' => array('b'),
780
+                '.alert-primary' => array('b','o'),
781
+                '.progress-bar' => array('b'),
782
+                '.list-group-item.active' => array('b','o'),
783
+                '.bg-primary' => array('b','f'),
784
+                '.btn-link.btn-primary' => array('c'),
785
+                '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
786
+            );
787
+
788
+            $important_selectors = array(
789
+                '.bg-primary' => array('b','f'),
790
+                '.border-primary' => array('o'),
791
+                '.text-primary' => array('c'),
792
+            );
793
+
794
+            $color = array();
795
+            $color_i = array();
796
+            $background = array();
797
+            $background_i = array();
798
+            $border = array();
799
+            $border_i = array();
800
+            $fill = array();
801
+            $fill_i = array();
802
+
803
+            $output = '';
804
+
805
+            // build rules into each type
806
+            foreach($selectors as $selector => $types){
807
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
808
+                $types = array_combine($types,$types);
809
+                if(isset($types['c'])){$color[] = $selector;}
810
+                if(isset($types['b'])){$background[] = $selector;}
811
+                if(isset($types['o'])){$border[] = $selector;}
812
+                if(isset($types['f'])){$fill[] = $selector;}
813
+            }
814
+
815
+            // build rules into each type
816
+            foreach($important_selectors as $selector => $types){
817
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
818
+                $types = array_combine($types,$types);
819
+                if(isset($types['c'])){$color_i[] = $selector;}
820
+                if(isset($types['b'])){$background_i[] = $selector;}
821
+                if(isset($types['o'])){$border_i[] = $selector;}
822
+                if(isset($types['f'])){$fill_i[] = $selector;}
823
+            }
824
+
825
+            // add any color rules
826
+            if(!empty($color)){
827
+                $output .= implode(",",$color) . "{color: $color_code;} ";
828
+            }
829
+            if(!empty($color_i)){
830
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
831
+            }
832
+
833
+            // add any background color rules
834
+            if(!empty($background)){
835
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
836
+            }
837
+            if(!empty($background_i)){
838
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
839
+            }
840
+
841
+            // add any border color rules
842
+            if(!empty($border)){
843
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
844
+            }
845
+            if(!empty($border_i)){
846
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
847
+            }
848
+
849
+            // add any fill color rules
850
+            if(!empty($fill)){
851
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
852
+            }
853
+            if(!empty($fill_i)){
854
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
855
+            }
856
+
857
+
858
+            $prefix = $compatibility ? ".bsui " : "";
859
+
860
+            // darken
861
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
862
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
863
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
864
+
865
+            // lighten
866
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
867
+
868
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
869
+            $op_25 = $color_code."40"; // 25% opacity
870
+
871
+
872
+            // button states
873
+            $output .= $prefix ." .btn-primary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
874
+            $output .= $prefix ." .btn-outline-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-primary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
875
+            $output .= $prefix ." .btn-primary:not(:disabled):not(.disabled):active, $prefix .btn-primary:not(:disabled):not(.disabled).active, .show>$prefix .btn-primary.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
876
+            $output .= $prefix ." .btn-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-primary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
877
+
878
+
879
+            // dropdown's
880
+            $output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
881
+
882
+
883
+            // input states
884
+            $output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
885
+
886
+            // page link
887
+            $output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
888
+
889
+            return $output;
890
+        }
891
+
892
+        public static function css_secondary($color_code,$compatibility){;
893
+            $color_code = sanitize_hex_color($color_code);
894
+            if(!$color_code){return '';}
895
+            /**
896
+             * c = color, b = background color, o = border-color, f = fill
897
+             */
898
+            $selectors = array(
899
+                '.btn-secondary' => array('b','o'),
900
+                '.btn-secondary.disabled' => array('b','o'),
901
+                '.btn-secondary:disabled' => array('b','o'),
902
+                '.btn-outline-secondary' => array('c','o'),
903
+                '.btn-outline-secondary:hover' => array('b','o'),
904
+                '.btn-outline-secondary.disabled' => array('c'),
905
+                '.btn-outline-secondary:disabled' => array('c'),
906
+                '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
907
+                '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
908
+                '.btn-outline-secondary.dropdown-toggle' => array('b','o'),
909
+                '.badge-secondary' => array('b'),
910
+                '.alert-secondary' => array('b','o'),
911
+                '.btn-link.btn-secondary' => array('c'),
912
+                );
913
+
914
+            $important_selectors = array(
915
+                '.bg-secondary' => array('b','f'),
916
+                '.border-secondary' => array('o'),
917
+                '.text-secondary' => array('c'),
918
+            );
919
+
920
+            $color = array();
921
+            $color_i = array();
922
+            $background = array();
923
+            $background_i = array();
924
+            $border = array();
925
+            $border_i = array();
926
+            $fill = array();
927
+            $fill_i = array();
928
+
929
+            $output = '';
930
+
931
+            // build rules into each type
932
+            foreach($selectors as $selector => $types){
933
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
934
+                $types = array_combine($types,$types);
935
+                if(isset($types['c'])){$color[] = $selector;}
936
+                if(isset($types['b'])){$background[] = $selector;}
937
+                if(isset($types['o'])){$border[] = $selector;}
938
+                if(isset($types['f'])){$fill[] = $selector;}
939
+            }
940
+
941
+            // build rules into each type
942
+            foreach($important_selectors as $selector => $types){
943
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
944
+                $types = array_combine($types,$types);
945
+                if(isset($types['c'])){$color_i[] = $selector;}
946
+                if(isset($types['b'])){$background_i[] = $selector;}
947
+                if(isset($types['o'])){$border_i[] = $selector;}
948
+                if(isset($types['f'])){$fill_i[] = $selector;}
949
+            }
950
+
951
+            // add any color rules
952
+            if(!empty($color)){
953
+                $output .= implode(",",$color) . "{color: $color_code;} ";
954
+            }
955
+            if(!empty($color_i)){
956
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
957
+            }
958
+
959
+            // add any background color rules
960
+            if(!empty($background)){
961
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
962
+            }
963
+            if(!empty($background_i)){
964
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
965
+            }
966
+
967
+            // add any border color rules
968
+            if(!empty($border)){
969
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
970
+            }
971
+            if(!empty($border_i)){
972
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
973
+            }
974
+
975
+            // add any fill color rules
976
+            if(!empty($fill)){
977
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
978
+            }
979
+            if(!empty($fill_i)){
980
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
981
+            }
982
+
983
+
984
+            $prefix = $compatibility ? ".bsui " : "";
985
+
986
+            // darken
987
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
988
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
989
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
990
+
991
+            // lighten
992
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
993
+
994
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
995
+            $op_25 = $color_code."40"; // 25% opacity
996
+
997
+
998
+            // button states
999
+            $output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1000
+            $output .= $prefix ." .btn-outline-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-secondary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1001
+            $output .= $prefix ." .btn-secondary:not(:disabled):not(.disabled):active, $prefix .btn-secondary:not(:disabled):not(.disabled).active, .show>$prefix .btn-secondary.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
1002
+            $output .= $prefix ." .btn-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-secondary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1003
+
1004
+
1005
+            return $output;
1006
+        }
1007
+
1008
+        /**
1009
+         * Increases or decreases the brightness of a color by a percentage of the current brightness.
1010
+         *
1011
+         * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
1012
+         * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
1013
+         *
1014
+         * @return  string
1015
+         */
1016
+        public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
1017
+            $hexCode = ltrim($hexCode, '#');
1018
+
1019
+            if (strlen($hexCode) == 3) {
1020
+                $hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
1021
+            }
1022
+
1023
+            $hexCode = array_map('hexdec', str_split($hexCode, 2));
1024
+
1025
+            foreach ($hexCode as & $color) {
1026
+                $adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
1027
+                $adjustAmount = ceil($adjustableLimit * $adjustPercent);
1028
+
1029
+                $color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
1030
+            }
1031
+
1032
+            return '#' . implode($hexCode);
1033
+        }
1034
+
1035
+        /**
1036
+         * Check if we should display examples.
1037
+         */
1038
+        public function maybe_show_examples(){
1039
+            if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
1040
+                echo "<head>";
1041
+                wp_head();
1042
+                echo "</head>";
1043
+                echo "<body>";
1044
+                echo $this->get_examples();
1045
+                echo "</body>";
1046
+                exit;
1047
+            }
1048
+        }
1049
+
1050
+        /**
1051
+         * Get developer examples.
1052
+         * 
1053
+         * @return string
1054
+         */
1055
+        public function get_examples(){
1056
+            $output = '';
1057
+
1058
+
1059
+            // open form
1060
+            $output .= "<form class='p-5 m-5 border rounded'>";
1061
+
1062
+            // input example
1063
+            $output .= aui()->input(array(
1064
+                'type'  =>  'text',
1065
+                'id'    =>  'text-example',
1066
+                'name'    =>  'text-example',
1067
+                'placeholder'   => 'text placeholder',
1068
+                'title'   => 'Text input example',
1069
+                'value' =>  '',
1070
+                'required'  => false,
1071
+                'help_text' => 'help text',
1072
+                'label' => 'Text input example label'
1073
+            ));
1074
+
1075
+            // input example
1076
+            $output .= aui()->input(array(
1077
+                'type'  =>  'url',
1078
+                'id'    =>  'text-example2',
1079
+                'name'    =>  'text-example',
1080
+                'placeholder'   => 'url placeholder',
1081
+                'title'   => 'Text input example',
1082
+                'value' =>  '',
1083
+                'required'  => false,
1084
+                'help_text' => 'help text',
1085
+                'label' => 'Text input example label'
1086
+            ));
1087
+
1088
+            // checkbox example
1089
+            $output .= aui()->input(array(
1090
+                'type'  =>  'checkbox',
1091
+                'id'    =>  'checkbox-example',
1092
+                'name'    =>  'checkbox-example',
1093
+                'placeholder'   => 'checkbox-example',
1094
+                'title'   => 'Checkbox example',
1095
+                'value' =>  '1',
1096
+                'checked'   => true,
1097
+                'required'  => false,
1098
+                'help_text' => 'help text',
1099
+                'label' => 'Checkbox checked'
1100
+            ));
1101
+
1102
+            // checkbox example
1103
+            $output .= aui()->input(array(
1104
+                'type'  =>  'checkbox',
1105
+                'id'    =>  'checkbox-example2',
1106
+                'name'    =>  'checkbox-example2',
1107
+                'placeholder'   => 'checkbox-example',
1108
+                'title'   => 'Checkbox example',
1109
+                'value' =>  '1',
1110
+                'checked'   => false,
1111
+                'required'  => false,
1112
+                'help_text' => 'help text',
1113
+                'label' => 'Checkbox un-checked'
1114
+            ));
1115
+
1116
+            // switch example
1117
+            $output .= aui()->input(array(
1118
+                'type'  =>  'checkbox',
1119
+                'id'    =>  'switch-example',
1120
+                'name'    =>  'switch-example',
1121
+                'placeholder'   => 'checkbox-example',
1122
+                'title'   => 'Switch example',
1123
+                'value' =>  '1',
1124
+                'checked'   => true,
1125
+                'switch'    => true,
1126
+                'required'  => false,
1127
+                'help_text' => 'help text',
1128
+                'label' => 'Switch on'
1129
+            ));
1130
+
1131
+            // switch example
1132
+            $output .= aui()->input(array(
1133
+                'type'  =>  'checkbox',
1134
+                'id'    =>  'switch-example2',
1135
+                'name'    =>  'switch-example2',
1136
+                'placeholder'   => 'checkbox-example',
1137
+                'title'   => 'Switch example',
1138
+                'value' =>  '1',
1139
+                'checked'   => false,
1140
+                'switch'    => true,
1141
+                'required'  => false,
1142
+                'help_text' => 'help text',
1143
+                'label' => 'Switch off'
1144
+            ));
1145
+
1146
+            // close form
1147
+            $output .= "</form>";
1148
+
1149
+            return $output;
1150
+        }
1151
+
1152
+    }
1153
+
1154
+    /**
1155
+     * Run the class if found.
1156
+     */
1157
+    AyeCode_UI_Settings::instance();
1158 1158
 }
1159 1159
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +218 added lines, -218 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
 /**
13 13
  * Bail if we are not in WP.
14 14
  */
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if (!defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
19 19
 /**
20 20
  * Only add if the class does not already exist.
21 21
  */
22
-if ( ! class_exists( 'AyeCode_UI_Settings' ) ) {
22
+if (!class_exists('AyeCode_UI_Settings')) {
23 23
 
24 24
 	/**
25 25
 	 * A Class to be able to change settings for Font Awesome.
@@ -98,22 +98,22 @@  discard block
 block discarded – undo
98 98
 		 * @return AyeCode_UI_Settings - Main instance.
99 99
 		 */
100 100
 		public static function instance() {
101
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) {
101
+			if (!isset(self::$instance) && !(self::$instance instanceof AyeCode_UI_Settings)) {
102 102
 				self::$instance = new AyeCode_UI_Settings;
103 103
 
104
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
104
+				add_action('init', array(self::$instance, 'init')); // set settings
105 105
 
106
-				if ( is_admin() ) {
107
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
108
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
106
+				if (is_admin()) {
107
+					add_action('admin_menu', array(self::$instance, 'menu_item'));
108
+					add_action('admin_init', array(self::$instance, 'register_settings'));
109 109
 
110 110
 					// Maybe show example page
111
-					add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
111
+					add_action('template_redirect', array(self::$instance, 'maybe_show_examples'));
112 112
 				}
113 113
 
114
-				add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
114
+				add_action('customize_register', array(self::$instance, 'customizer_settings'));
115 115
 
116
-				do_action( 'ayecode_ui_settings_loaded' );
116
+				do_action('ayecode_ui_settings_loaded');
117 117
 			}
118 118
 
119 119
 			return self::$instance;
@@ -131,24 +131,24 @@  discard block
 block discarded – undo
131 131
 			 *
132 132
 			 * We load super early in case there is a theme version that might change the colors
133 133
 			 */
134
-			if ( $this->settings['css'] ) {
135
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
134
+			if ($this->settings['css']) {
135
+				add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), 1);
136 136
 			}
137
-			if ( $this->settings['css_backend'] ) {
138
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
137
+			if ($this->settings['css_backend']) {
138
+				add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 1);
139 139
 			}
140 140
 
141 141
 			// maybe load JS
142
-			if ( $this->settings['js'] ) {
143
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
142
+			if ($this->settings['js']) {
143
+				add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 1);
144 144
 			}
145
-			if ( $this->settings['js_backend'] ) {
146
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
145
+			if ($this->settings['js_backend']) {
146
+				add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 1);
147 147
 			}
148 148
 
149 149
 			// Maybe set the HTML font size
150
-			if ( $this->settings['html_font_size'] ) {
151
-				add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
150
+			if ($this->settings['html_font_size']) {
151
+				add_action('wp_footer', array($this, 'html_font_size'), 10);
152 152
 			}
153 153
 
154 154
 
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 		/**
158 158
 		 * Add a html font size to the footer.
159 159
 		 */
160
-		public function html_font_size(){
160
+		public function html_font_size() {
161 161
 			$this->settings = $this->get_settings();
162
-			echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
162
+			echo "<style>html{font-size:" . absint($this->settings['html_font_size']) . "px;}</style>";
163 163
 		}
164 164
 
165 165
 		/**
@@ -169,15 +169,15 @@  discard block
 block discarded – undo
169 169
 			
170 170
 			$css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
171 171
 
172
-			if($this->settings[$css_setting]){
173
-				$compatibility = $this->settings[$css_setting]=='core' ? false : true;
174
-				$url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui.css' : $this->url.'assets/css/ayecode-ui-compatibility.css';
175
-				wp_register_style( 'ayecode-ui', $url, array(), $this->latest );
176
-				wp_enqueue_style( 'ayecode-ui' );
172
+			if ($this->settings[$css_setting]) {
173
+				$compatibility = $this->settings[$css_setting] == 'core' ? false : true;
174
+				$url = $this->settings[$css_setting] == 'core' ? $this->url . 'assets/css/ayecode-ui.css' : $this->url . 'assets/css/ayecode-ui-compatibility.css';
175
+				wp_register_style('ayecode-ui', $url, array(), $this->latest);
176
+				wp_enqueue_style('ayecode-ui');
177 177
 
178 178
 
179 179
 				// fix some wp-admin issues
180
-				if(is_admin()){
180
+				if (is_admin()) {
181 181
 					$custom_css = "
182 182
                 body{
183 183
                     background-color: #f1f1f1;
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
 				    margin: 1em 0
214 214
 				}
215 215
                 ";
216
-					wp_add_inline_style( 'ayecode-ui', $custom_css );
216
+					wp_add_inline_style('ayecode-ui', $custom_css);
217 217
 				}
218 218
 
219 219
 				// custom changes
220
-				wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
220
+				wp_add_inline_style('ayecode-ui', self::custom_css($compatibility));
221 221
 
222 222
 			}
223 223
 		}
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 		 *
228 228
 		 * If this remains small then its best to use this than to add another JS file.
229 229
 		 */
230
-		public function inline_script(){
230
+		public function inline_script() {
231 231
 			ob_start();
232 232
 			?>
233 233
 			<script>
@@ -418,10 +418,10 @@  discard block
 block discarded – undo
418 418
 			/*
419 419
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
420 420
 			 */
421
-			return str_replace( array(
421
+			return str_replace(array(
422 422
 				'<script>',
423 423
 				'</script>'
424
-			), '', $output );
424
+			), '', $output);
425 425
 		}
426 426
 
427 427
 		/**
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 		 *
430 430
 		 * If this remains small then its best to use this than to add another JS file.
431 431
 		 */
432
-		public function inline_script_file_browser(){
432
+		public function inline_script_file_browser() {
433 433
 			ob_start();
434 434
 			?>
435 435
 			<script>
@@ -444,10 +444,10 @@  discard block
 block discarded – undo
444 444
 			/*
445 445
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
446 446
 			 */
447
-			return str_replace( array(
447
+			return str_replace(array(
448 448
 				'<script>',
449 449
 				'</script>'
450
-			), '', $output );
450
+			), '', $output);
451 451
 		}
452 452
 
453 453
 		/**
@@ -458,36 +458,36 @@  discard block
 block discarded – undo
458 458
 			$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
459 459
 			
460 460
 			// select2
461
-			wp_register_script( 'select2', $this->url.'assets/js/select2.min.js', array('jquery'), $this->select2_version );
461
+			wp_register_script('select2', $this->url . 'assets/js/select2.min.js', array('jquery'), $this->select2_version);
462 462
 
463 463
 			// Bootstrap file browser
464
-			wp_register_script( 'aui-custom-file-input', $url = $this->url.'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version );
465
-			wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
464
+			wp_register_script('aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version);
465
+			wp_add_inline_script('aui-custom-file-input', $this->inline_script_file_browser());
466 466
 
467 467
 			$load_inline = false;
468 468
 
469
-			if($this->settings[$js_setting]=='core-popper'){
469
+			if ($this->settings[$js_setting] == 'core-popper') {
470 470
 				// Bootstrap bundle
471
-				$url = $this->url.'assets/js/bootstrap.bundle.min.js';
472
-				wp_register_script( 'bootstrap-js-bundle', $url, array('select2','jquery'), $this->latest );
473
-				wp_enqueue_script( 'bootstrap-js-bundle' );
471
+				$url = $this->url . 'assets/js/bootstrap.bundle.min.js';
472
+				wp_register_script('bootstrap-js-bundle', $url, array('select2', 'jquery'), $this->latest);
473
+				wp_enqueue_script('bootstrap-js-bundle');
474 474
 				$script = $this->inline_script();
475
-				wp_add_inline_script( 'bootstrap-js-bundle', $script );
476
-			}elseif($this->settings[$js_setting]=='popper'){
477
-				$url = $this->url.'assets/js/popper.min.js';
478
-				wp_register_script( 'bootstrap-js-popper', $url, array('jquery'), $this->latest );
479
-				wp_enqueue_script( 'bootstrap-js-popper' );
475
+				wp_add_inline_script('bootstrap-js-bundle', $script);
476
+			}elseif ($this->settings[$js_setting] == 'popper') {
477
+				$url = $this->url . 'assets/js/popper.min.js';
478
+				wp_register_script('bootstrap-js-popper', $url, array('jquery'), $this->latest);
479
+				wp_enqueue_script('bootstrap-js-popper');
480 480
 				$load_inline = true;
481
-			}else{
481
+			} else {
482 482
 				$load_inline = true;
483 483
 			}
484 484
 
485 485
 			// Load needed inline scripts by faking the loading of a script if the main script is not being loaded
486
-			if($load_inline){
487
-				wp_register_script( 'bootstrap-dummy', '',array('jquery') );
488
-				wp_enqueue_script( 'bootstrap-dummy' );
486
+			if ($load_inline) {
487
+				wp_register_script('bootstrap-dummy', '', array('jquery'));
488
+				wp_enqueue_script('bootstrap-dummy');
489 489
 				$script = $this->inline_script();
490
-				wp_add_inline_script( 'bootstrap-dummy', $script  );
490
+				wp_add_inline_script('bootstrap-dummy', $script);
491 491
 			}
492 492
 			
493 493
 		}
@@ -501,15 +501,15 @@  discard block
 block discarded – undo
501 501
 
502 502
 			$url = '';
503 503
 			// check if we are inside a plugin
504
-			$file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
504
+			$file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__)));
505 505
 
506 506
 			// add check in-case user has changed wp-content dir name.
507 507
 			$wp_content_folder_name = basename(WP_CONTENT_DIR);
508
-			$dir_parts = explode("/$wp_content_folder_name/",$file_dir);
509
-			$url_parts = explode("/$wp_content_folder_name/",plugins_url());
508
+			$dir_parts = explode("/$wp_content_folder_name/", $file_dir);
509
+			$url_parts = explode("/$wp_content_folder_name/", plugins_url());
510 510
 
511
-			if(!empty($url_parts[0]) && !empty($dir_parts[1])){
512
-				$url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
511
+			if (!empty($url_parts[0]) && !empty($dir_parts[1])) {
512
+				$url = trailingslashit($url_parts[0] . "/$wp_content_folder_name/" . $dir_parts[1]);
513 513
 			}
514 514
 
515 515
 			return $url;
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 		 * Register the database settings with WordPress.
520 520
 		 */
521 521
 		public function register_settings() {
522
-			register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
522
+			register_setting('ayecode-ui-settings', 'ayecode-ui-settings');
523 523
 		}
524 524
 
525 525
 		/**
@@ -528,10 +528,10 @@  discard block
 block discarded – undo
528 528
 		 */
529 529
 		public function menu_item() {
530 530
 			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
531
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
531
+			call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
532 532
 				$this,
533 533
 				'settings_page'
534
-			) );
534
+			));
535 535
 		}
536 536
 
537 537
 		/**
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 		 * 
540 540
 		 * @return array
541 541
 		 */
542
-		public function theme_js_settings(){
542
+		public function theme_js_settings() {
543 543
 			return array(
544 544
 				'ayetheme' => 'popper',
545 545
 				'listimia' => 'required',
@@ -555,17 +555,17 @@  discard block
 block discarded – undo
555 555
 		 */
556 556
 		public function get_settings() {
557 557
 
558
-			$db_settings = get_option( 'ayecode-ui-settings' );
558
+			$db_settings = get_option('ayecode-ui-settings');
559 559
 			$js_default = 'core-popper';
560 560
 			$js_default_backend = $js_default;
561 561
 
562 562
 			// maybe set defaults (if no settings set)
563
-			if(empty($db_settings)){
564
-				$active_theme = strtolower( get_template() ); // active parent theme.
563
+			if (empty($db_settings)) {
564
+				$active_theme = strtolower(get_template()); // active parent theme.
565 565
 				$theme_js_settings = self::theme_js_settings();
566
-				if(isset($theme_js_settings[$active_theme])){
566
+				if (isset($theme_js_settings[$active_theme])) {
567 567
 					$js_default = $theme_js_settings[$active_theme];
568
-					$js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
568
+					$js_default_backend = isset($theme_js_settings[$active_theme . "_backend"]) ? $theme_js_settings[$active_theme . "_backend"] : $js_default;
569 569
 				}
570 570
 			}
571 571
 
@@ -578,14 +578,14 @@  discard block
 block discarded – undo
578 578
 
579 579
 			);
580 580
 
581
-			$settings = wp_parse_args( $db_settings, $defaults );
581
+			$settings = wp_parse_args($db_settings, $defaults);
582 582
 
583 583
 			/**
584 584
 			 * Filter the Bootstrap settings.
585 585
 			 *
586 586
 			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
587 587
 			 */
588
-			return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
588
+			return $this->settings = apply_filters('ayecode-ui-settings', $settings, $db_settings, $defaults);
589 589
 		}
590 590
 
591 591
 
@@ -593,80 +593,80 @@  discard block
 block discarded – undo
593 593
 		 * The settings page html output.
594 594
 		 */
595 595
 		public function settings_page() {
596
-			if ( ! current_user_can( 'manage_options' ) ) {
597
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
596
+			if (!current_user_can('manage_options')) {
597
+				wp_die(__('You do not have sufficient permissions to access this page.', 'aui'));
598 598
 			}
599 599
 			?>
600 600
 			<div class="wrap">
601 601
 				<h1><?php echo $this->name; ?></h1>
602
-				<p><?php _e("Here you can adjust settings if you are having compatibility issues.","aui");?></p>
602
+				<p><?php _e("Here you can adjust settings if you are having compatibility issues.", "aui"); ?></p>
603 603
 				<form method="post" action="options.php">
604 604
 					<?php
605
-					settings_fields( 'ayecode-ui-settings' );
606
-					do_settings_sections( 'ayecode-ui-settings' );
605
+					settings_fields('ayecode-ui-settings');
606
+					do_settings_sections('ayecode-ui-settings');
607 607
 					?>
608 608
 
609
-					<h2><?php _e( 'Frontend', 'aui' ); ?></h2>
609
+					<h2><?php _e('Frontend', 'aui'); ?></h2>
610 610
 					<table class="form-table wpbs-table-settings">
611 611
 						<tr valign="top">
612 612
 							<th scope="row"><label
613
-									for="wpbs-css"><?php _e( 'Load CSS', 'aui' ); ?></label></th>
613
+									for="wpbs-css"><?php _e('Load CSS', 'aui'); ?></label></th>
614 614
 							<td>
615 615
 								<select name="ayecode-ui-settings[css]" id="wpbs-css">
616
-									<option	value="compatibility" <?php selected( $this->settings['css'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode', 'aui' ); ?></option>
617
-									<option value="core" <?php selected( $this->settings['css'], 'core' ); ?>><?php _e( 'Full Mode', 'aui' ); ?></option>
618
-									<option	value="" <?php selected( $this->settings['css'], '' ); ?>><?php _e( 'Disabled', 'aui' ); ?></option>
616
+									<option	value="compatibility" <?php selected($this->settings['css'], 'compatibility'); ?>><?php _e('Compatibility Mode', 'aui'); ?></option>
617
+									<option value="core" <?php selected($this->settings['css'], 'core'); ?>><?php _e('Full Mode', 'aui'); ?></option>
618
+									<option	value="" <?php selected($this->settings['css'], ''); ?>><?php _e('Disabled', 'aui'); ?></option>
619 619
 								</select>
620 620
 							</td>
621 621
 						</tr>
622 622
 
623 623
 						<tr valign="top">
624 624
 							<th scope="row"><label
625
-									for="wpbs-js"><?php _e( 'Load JS', 'aui' ); ?></label></th>
625
+									for="wpbs-js"><?php _e('Load JS', 'aui'); ?></label></th>
626 626
 							<td>
627 627
 								<select name="ayecode-ui-settings[js]" id="wpbs-js">
628
-									<option	value="core-popper" <?php selected( $this->settings['js'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'aui' ); ?></option>
629
-									<option value="popper" <?php selected( $this->settings['js'], 'popper' ); ?>><?php _e( 'Popper', 'aui' ); ?></option>
630
-									<option value="required" <?php selected( $this->settings['js'], 'required' ); ?>><?php _e( 'Required functions only', 'aui' ); ?></option>
631
-									<option	value="" <?php selected( $this->settings['js'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'aui' ); ?></option>
628
+									<option	value="core-popper" <?php selected($this->settings['js'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'aui'); ?></option>
629
+									<option value="popper" <?php selected($this->settings['js'], 'popper'); ?>><?php _e('Popper', 'aui'); ?></option>
630
+									<option value="required" <?php selected($this->settings['js'], 'required'); ?>><?php _e('Required functions only', 'aui'); ?></option>
631
+									<option	value="" <?php selected($this->settings['js'], ''); ?>><?php _e('Disabled (not recommended)', 'aui'); ?></option>
632 632
 								</select>
633 633
 							</td>
634 634
 						</tr>
635 635
 
636 636
 						<tr valign="top">
637 637
 							<th scope="row"><label
638
-									for="wpbs-font_size"><?php _e( 'HTML Font Size (px)', 'aui' ); ?></label></th>
638
+									for="wpbs-font_size"><?php _e('HTML Font Size (px)', 'aui'); ?></label></th>
639 639
 							<td>
640
-								<input type="number" name="ayecode-ui-settings[html_font_size]" id="wpbs-font_size" value="<?php echo absint( $this->settings['html_font_size']); ?>" placeholder="16" />
641
-								<p class="description" ><?php _e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.","aui");?></p>
640
+								<input type="number" name="ayecode-ui-settings[html_font_size]" id="wpbs-font_size" value="<?php echo absint($this->settings['html_font_size']); ?>" placeholder="16" />
641
+								<p class="description" ><?php _e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.", "aui"); ?></p>
642 642
 							</td>
643 643
 						</tr>
644 644
 
645 645
 					</table>
646 646
 
647
-					<h2><?php _e( 'Backend', 'aui' ); ?> (wp-admin)</h2>
647
+					<h2><?php _e('Backend', 'aui'); ?> (wp-admin)</h2>
648 648
 					<table class="form-table wpbs-table-settings">
649 649
 						<tr valign="top">
650 650
 							<th scope="row"><label
651
-									for="wpbs-css"><?php _e( 'Load CSS', 'aui' ); ?></label></th>
651
+									for="wpbs-css"><?php _e('Load CSS', 'aui'); ?></label></th>
652 652
 							<td>
653 653
 								<select name="ayecode-ui-settings[css_backend]" id="wpbs-css">
654
-									<option	value="compatibility" <?php selected( $this->settings['css_backend'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode', 'aui' ); ?></option>
655
-									<option value="core" <?php selected( $this->settings['css_backend'], 'core' ); ?>><?php _e( 'Full Mode', 'aui' ); ?></option>
656
-									<option	value="" <?php selected( $this->settings['css_backend'], '' ); ?>><?php _e( 'Disabled', 'aui' ); ?></option>
654
+									<option	value="compatibility" <?php selected($this->settings['css_backend'], 'compatibility'); ?>><?php _e('Compatibility Mode', 'aui'); ?></option>
655
+									<option value="core" <?php selected($this->settings['css_backend'], 'core'); ?>><?php _e('Full Mode', 'aui'); ?></option>
656
+									<option	value="" <?php selected($this->settings['css_backend'], ''); ?>><?php _e('Disabled', 'aui'); ?></option>
657 657
 								</select>
658 658
 							</td>
659 659
 						</tr>
660 660
 
661 661
 						<tr valign="top">
662 662
 							<th scope="row"><label
663
-									for="wpbs-js"><?php _e( 'Load JS', 'aui' ); ?></label></th>
663
+									for="wpbs-js"><?php _e('Load JS', 'aui'); ?></label></th>
664 664
 							<td>
665 665
 								<select name="ayecode-ui-settings[js_backend]" id="wpbs-js">
666
-									<option	value="core-popper" <?php selected( $this->settings['js_backend'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'aui' ); ?></option>
667
-									<option value="popper" <?php selected( $this->settings['js_backend'], 'popper' ); ?>><?php _e( 'Popper', 'aui' ); ?></option>
668
-									<option value="required" <?php selected( $this->settings['js_backend'], 'required' ); ?>><?php _e( 'Required functions only', 'aui' ); ?></option>
669
-									<option	value="" <?php selected( $this->settings['js_backend'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'aui' ); ?></option>
666
+									<option	value="core-popper" <?php selected($this->settings['js_backend'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'aui'); ?></option>
667
+									<option value="popper" <?php selected($this->settings['js_backend'], 'popper'); ?>><?php _e('Popper', 'aui'); ?></option>
668
+									<option value="required" <?php selected($this->settings['js_backend'], 'required'); ?>><?php _e('Required functions only', 'aui'); ?></option>
669
+									<option	value="" <?php selected($this->settings['js_backend'], ''); ?>><?php _e('Disabled (not recommended)', 'aui'); ?></option>
670 670
 								</select>
671 671
 							</td>
672 672
 						</tr>
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 			<?php
685 685
 		}
686 686
 
687
-		public function customizer_settings($wp_customize){
687
+		public function customizer_settings($wp_customize) {
688 688
 			$wp_customize->add_section('aui_settings', array(
689 689
 				'title'    => __('AyeCode UI'),
690 690
 				'priority' => 120,
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 				'type'              => 'option',
701 701
 				'transport'         => 'refresh',
702 702
 			));
703
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
703
+			$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
704 704
 				'label'    => __('Primary Color'),
705 705
 				'section'  => 'aui_settings',
706 706
 				'settings' => 'aui_options[color_primary]',
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 				'type'              => 'option',
714 714
 				'transport'         => 'refresh',
715 715
 			));
716
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
716
+			$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
717 717
 				'label'    => __('Secondary Color'),
718 718
 				'section'  => 'aui_settings',
719 719
 				'settings' => 'aui_options[color_secondary]',
@@ -728,12 +728,12 @@  discard block
 block discarded – undo
728 728
 			?>
729 729
 			<style>
730 730
 				<?php
731
-					if(!empty($settings['color_primary']) && $settings['color_primary'] != "#1e73be"){
732
-						echo self::css_primary($settings['color_primary'],$compatibility);
731
+					if (!empty($settings['color_primary']) && $settings['color_primary'] != "#1e73be") {
732
+						echo self::css_primary($settings['color_primary'], $compatibility);
733 733
 					}
734 734
 
735
-					if(!empty($settings['color_secondary']) && $settings['color_secondary'] != "#6c757d"){
736
-						echo self::css_secondary($settings['color_secondary'],$compatibility);
735
+					if (!empty($settings['color_secondary']) && $settings['color_secondary'] != "#6c757d") {
736
+						echo self::css_secondary($settings['color_secondary'], $compatibility);
737 737
 					}
738 738
                 ?>
739 739
 			</style>
@@ -743,50 +743,50 @@  discard block
 block discarded – undo
743 743
 			/*
744 744
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
745 745
 			 */
746
-			return str_replace( array(
746
+			return str_replace(array(
747 747
 				'<style>',
748 748
 				'</style>'
749 749
 			), '', ob_get_clean());
750 750
 		}
751 751
 
752
-		public static function css_primary($color_code,$compatibility){;
752
+		public static function css_primary($color_code, $compatibility) {;
753 753
 			$color_code = sanitize_hex_color($color_code);
754
-			if(!$color_code){return '';}
754
+			if (!$color_code) {return ''; }
755 755
 			/**
756 756
 			 * c = color, b = background color, o = border-color, f = fill
757 757
 			 */
758 758
 			$selectors = array(
759 759
 				'a' => array('c'),
760
-				'.btn-primary' => array('b','o'),
761
-				'.btn-primary.disabled' => array('b','o'),
762
-				'.btn-primary:disabled' => array('b','o'),
763
-				'.btn-outline-primary' => array('c','o'),
764
-				'.btn-outline-primary:hover' => array('b','o'),
765
-				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
766
-				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
767
-				'.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
760
+				'.btn-primary' => array('b', 'o'),
761
+				'.btn-primary.disabled' => array('b', 'o'),
762
+				'.btn-primary:disabled' => array('b', 'o'),
763
+				'.btn-outline-primary' => array('c', 'o'),
764
+				'.btn-outline-primary:hover' => array('b', 'o'),
765
+				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b', 'o'),
766
+				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b', 'o'),
767
+				'.show>.btn-outline-primary.dropdown-toggle' => array('b', 'o'),
768 768
 				'.btn-link' => array('c'),
769 769
 				'.dropdown-item.active' => array('b'),
770
-				'.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
771
-				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
770
+				'.custom-control-input:checked~.custom-control-label::before' => array('b', 'o'),
771
+				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b', 'o'),
772 772
 //				'.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
773 773
 //				'.custom-range::-moz-range-thumb' => array('b'),
774 774
 //				'.custom-range::-ms-thumb' => array('b'),
775 775
 				'.nav-pills .nav-link.active' => array('b'),
776 776
 				'.nav-pills .show>.nav-link' => array('b'),
777 777
 				'.page-link' => array('c'),
778
-				'.page-item.active .page-link' => array('b','o'),
778
+				'.page-item.active .page-link' => array('b', 'o'),
779 779
 				'.badge-primary' => array('b'),
780
-				'.alert-primary' => array('b','o'),
780
+				'.alert-primary' => array('b', 'o'),
781 781
 				'.progress-bar' => array('b'),
782
-				'.list-group-item.active' => array('b','o'),
783
-				'.bg-primary' => array('b','f'),
782
+				'.list-group-item.active' => array('b', 'o'),
783
+				'.bg-primary' => array('b', 'f'),
784 784
 				'.btn-link.btn-primary' => array('c'),
785 785
 				'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
786 786
 			);
787 787
 
788 788
 			$important_selectors = array(
789
-				'.bg-primary' => array('b','f'),
789
+				'.bg-primary' => array('b', 'f'),
790 790
 				'.border-primary' => array('o'),
791 791
 				'.text-primary' => array('c'),
792 792
 			);
@@ -803,116 +803,116 @@  discard block
 block discarded – undo
803 803
 			$output = '';
804 804
 
805 805
 			// build rules into each type
806
-			foreach($selectors as $selector => $types){
807
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
808
-				$types = array_combine($types,$types);
809
-				if(isset($types['c'])){$color[] = $selector;}
810
-				if(isset($types['b'])){$background[] = $selector;}
811
-				if(isset($types['o'])){$border[] = $selector;}
812
-				if(isset($types['f'])){$fill[] = $selector;}
806
+			foreach ($selectors as $selector => $types) {
807
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
808
+				$types = array_combine($types, $types);
809
+				if (isset($types['c'])) {$color[] = $selector; }
810
+				if (isset($types['b'])) {$background[] = $selector; }
811
+				if (isset($types['o'])) {$border[] = $selector; }
812
+				if (isset($types['f'])) {$fill[] = $selector; }
813 813
 			}
814 814
 
815 815
 			// build rules into each type
816
-			foreach($important_selectors as $selector => $types){
817
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
818
-				$types = array_combine($types,$types);
819
-				if(isset($types['c'])){$color_i[] = $selector;}
820
-				if(isset($types['b'])){$background_i[] = $selector;}
821
-				if(isset($types['o'])){$border_i[] = $selector;}
822
-				if(isset($types['f'])){$fill_i[] = $selector;}
816
+			foreach ($important_selectors as $selector => $types) {
817
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
818
+				$types = array_combine($types, $types);
819
+				if (isset($types['c'])) {$color_i[] = $selector; }
820
+				if (isset($types['b'])) {$background_i[] = $selector; }
821
+				if (isset($types['o'])) {$border_i[] = $selector; }
822
+				if (isset($types['f'])) {$fill_i[] = $selector; }
823 823
 			}
824 824
 
825 825
 			// add any color rules
826
-			if(!empty($color)){
827
-				$output .= implode(",",$color) . "{color: $color_code;} ";
826
+			if (!empty($color)) {
827
+				$output .= implode(",", $color) . "{color: $color_code;} ";
828 828
 			}
829
-			if(!empty($color_i)){
830
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
829
+			if (!empty($color_i)) {
830
+				$output .= implode(",", $color_i) . "{color: $color_code !important;} ";
831 831
 			}
832 832
 
833 833
 			// add any background color rules
834
-			if(!empty($background)){
835
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
834
+			if (!empty($background)) {
835
+				$output .= implode(",", $background) . "{background-color: $color_code;} ";
836 836
 			}
837
-			if(!empty($background_i)){
838
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
837
+			if (!empty($background_i)) {
838
+				$output .= implode(",", $background_i) . "{background-color: $color_code !important;} ";
839 839
 			}
840 840
 
841 841
 			// add any border color rules
842
-			if(!empty($border)){
843
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
842
+			if (!empty($border)) {
843
+				$output .= implode(",", $border) . "{border-color: $color_code;} ";
844 844
 			}
845
-			if(!empty($border_i)){
846
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
845
+			if (!empty($border_i)) {
846
+				$output .= implode(",", $border_i) . "{border-color: $color_code !important;} ";
847 847
 			}
848 848
 
849 849
 			// add any fill color rules
850
-			if(!empty($fill)){
851
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
850
+			if (!empty($fill)) {
851
+				$output .= implode(",", $fill) . "{fill: $color_code;} ";
852 852
 			}
853
-			if(!empty($fill_i)){
854
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
853
+			if (!empty($fill_i)) {
854
+				$output .= implode(",", $fill_i) . "{fill: $color_code !important;} ";
855 855
 			}
856 856
 
857 857
 
858 858
 			$prefix = $compatibility ? ".bsui " : "";
859 859
 
860 860
 			// darken
861
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
862
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
863
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
861
+			$darker_075 = self::css_hex_lighten_darken($color_code, "-0.075");
862
+			$darker_10 = self::css_hex_lighten_darken($color_code, "-0.10");
863
+			$darker_125 = self::css_hex_lighten_darken($color_code, "-0.125");
864 864
 
865 865
 			// lighten
866
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
866
+			$lighten_25 = self::css_hex_lighten_darken($color_code, "0.25");
867 867
 
868 868
 			// opacity see https://css-tricks.com/8-digit-hex-codes/
869
-			$op_25 = $color_code."40"; // 25% opacity
869
+			$op_25 = $color_code . "40"; // 25% opacity
870 870
 
871 871
 
872 872
 			// button states
873
-			$output .= $prefix ." .btn-primary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
874
-			$output .= $prefix ." .btn-outline-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-primary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
875
-			$output .= $prefix ." .btn-primary:not(:disabled):not(.disabled):active, $prefix .btn-primary:not(:disabled):not(.disabled).active, .show>$prefix .btn-primary.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
876
-			$output .= $prefix ." .btn-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-primary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
873
+			$output .= $prefix . " .btn-primary:hover{background-color: " . $darker_075 . ";    border-color: " . $darker_10 . ";} ";
874
+			$output .= $prefix . " .btn-outline-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-primary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
875
+			$output .= $prefix . " .btn-primary:not(:disabled):not(.disabled):active, $prefix .btn-primary:not(:disabled):not(.disabled).active, .show>$prefix .btn-primary.dropdown-toggle{background-color: " . $darker_10 . ";    border-color: " . $darker_125 . ";} ";
876
+			$output .= $prefix . " .btn-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-primary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
877 877
 
878 878
 
879 879
 			// dropdown's
880
-			$output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
880
+			$output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
881 881
 
882 882
 
883 883
 			// input states
884
-			$output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
884
+			$output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
885 885
 
886 886
 			// page link
887
-			$output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
887
+			$output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
888 888
 
889 889
 			return $output;
890 890
 		}
891 891
 
892
-		public static function css_secondary($color_code,$compatibility){;
892
+		public static function css_secondary($color_code, $compatibility) {;
893 893
 			$color_code = sanitize_hex_color($color_code);
894
-			if(!$color_code){return '';}
894
+			if (!$color_code) {return ''; }
895 895
 			/**
896 896
 			 * c = color, b = background color, o = border-color, f = fill
897 897
 			 */
898 898
 			$selectors = array(
899
-				'.btn-secondary' => array('b','o'),
900
-				'.btn-secondary.disabled' => array('b','o'),
901
-				'.btn-secondary:disabled' => array('b','o'),
902
-				'.btn-outline-secondary' => array('c','o'),
903
-				'.btn-outline-secondary:hover' => array('b','o'),
899
+				'.btn-secondary' => array('b', 'o'),
900
+				'.btn-secondary.disabled' => array('b', 'o'),
901
+				'.btn-secondary:disabled' => array('b', 'o'),
902
+				'.btn-outline-secondary' => array('c', 'o'),
903
+				'.btn-outline-secondary:hover' => array('b', 'o'),
904 904
 				'.btn-outline-secondary.disabled' => array('c'),
905 905
 				'.btn-outline-secondary:disabled' => array('c'),
906
-				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
907
-				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
908
-				'.btn-outline-secondary.dropdown-toggle' => array('b','o'),
906
+				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b', 'o'),
907
+				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b', 'o'),
908
+				'.btn-outline-secondary.dropdown-toggle' => array('b', 'o'),
909 909
 				'.badge-secondary' => array('b'),
910
-				'.alert-secondary' => array('b','o'),
910
+				'.alert-secondary' => array('b', 'o'),
911 911
 				'.btn-link.btn-secondary' => array('c'),
912 912
 				);
913 913
 
914 914
 			$important_selectors = array(
915
-				'.bg-secondary' => array('b','f'),
915
+				'.bg-secondary' => array('b', 'f'),
916 916
 				'.border-secondary' => array('o'),
917 917
 				'.text-secondary' => array('c'),
918 918
 			);
@@ -929,77 +929,77 @@  discard block
 block discarded – undo
929 929
 			$output = '';
930 930
 
931 931
 			// build rules into each type
932
-			foreach($selectors as $selector => $types){
933
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
934
-				$types = array_combine($types,$types);
935
-				if(isset($types['c'])){$color[] = $selector;}
936
-				if(isset($types['b'])){$background[] = $selector;}
937
-				if(isset($types['o'])){$border[] = $selector;}
938
-				if(isset($types['f'])){$fill[] = $selector;}
932
+			foreach ($selectors as $selector => $types) {
933
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
934
+				$types = array_combine($types, $types);
935
+				if (isset($types['c'])) {$color[] = $selector; }
936
+				if (isset($types['b'])) {$background[] = $selector; }
937
+				if (isset($types['o'])) {$border[] = $selector; }
938
+				if (isset($types['f'])) {$fill[] = $selector; }
939 939
 			}
940 940
 
941 941
 			// build rules into each type
942
-			foreach($important_selectors as $selector => $types){
943
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
944
-				$types = array_combine($types,$types);
945
-				if(isset($types['c'])){$color_i[] = $selector;}
946
-				if(isset($types['b'])){$background_i[] = $selector;}
947
-				if(isset($types['o'])){$border_i[] = $selector;}
948
-				if(isset($types['f'])){$fill_i[] = $selector;}
942
+			foreach ($important_selectors as $selector => $types) {
943
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
944
+				$types = array_combine($types, $types);
945
+				if (isset($types['c'])) {$color_i[] = $selector; }
946
+				if (isset($types['b'])) {$background_i[] = $selector; }
947
+				if (isset($types['o'])) {$border_i[] = $selector; }
948
+				if (isset($types['f'])) {$fill_i[] = $selector; }
949 949
 			}
950 950
 
951 951
 			// add any color rules
952
-			if(!empty($color)){
953
-				$output .= implode(",",$color) . "{color: $color_code;} ";
952
+			if (!empty($color)) {
953
+				$output .= implode(",", $color) . "{color: $color_code;} ";
954 954
 			}
955
-			if(!empty($color_i)){
956
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
955
+			if (!empty($color_i)) {
956
+				$output .= implode(",", $color_i) . "{color: $color_code !important;} ";
957 957
 			}
958 958
 
959 959
 			// add any background color rules
960
-			if(!empty($background)){
961
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
960
+			if (!empty($background)) {
961
+				$output .= implode(",", $background) . "{background-color: $color_code;} ";
962 962
 			}
963
-			if(!empty($background_i)){
964
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
963
+			if (!empty($background_i)) {
964
+				$output .= implode(",", $background_i) . "{background-color: $color_code !important;} ";
965 965
 			}
966 966
 
967 967
 			// add any border color rules
968
-			if(!empty($border)){
969
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
968
+			if (!empty($border)) {
969
+				$output .= implode(",", $border) . "{border-color: $color_code;} ";
970 970
 			}
971
-			if(!empty($border_i)){
972
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
971
+			if (!empty($border_i)) {
972
+				$output .= implode(",", $border_i) . "{border-color: $color_code !important;} ";
973 973
 			}
974 974
 
975 975
 			// add any fill color rules
976
-			if(!empty($fill)){
977
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
976
+			if (!empty($fill)) {
977
+				$output .= implode(",", $fill) . "{fill: $color_code;} ";
978 978
 			}
979
-			if(!empty($fill_i)){
980
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
979
+			if (!empty($fill_i)) {
980
+				$output .= implode(",", $fill_i) . "{fill: $color_code !important;} ";
981 981
 			}
982 982
 
983 983
 
984 984
 			$prefix = $compatibility ? ".bsui " : "";
985 985
 
986 986
 			// darken
987
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
988
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
989
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
987
+			$darker_075 = self::css_hex_lighten_darken($color_code, "-0.075");
988
+			$darker_10 = self::css_hex_lighten_darken($color_code, "-0.10");
989
+			$darker_125 = self::css_hex_lighten_darken($color_code, "-0.125");
990 990
 
991 991
 			// lighten
992
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
992
+			$lighten_25 = self::css_hex_lighten_darken($color_code, "0.25");
993 993
 
994 994
 			// opacity see https://css-tricks.com/8-digit-hex-codes/
995
-			$op_25 = $color_code."40"; // 25% opacity
995
+			$op_25 = $color_code . "40"; // 25% opacity
996 996
 
997 997
 
998 998
 			// button states
999
-			$output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1000
-			$output .= $prefix ." .btn-outline-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-secondary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1001
-			$output .= $prefix ." .btn-secondary:not(:disabled):not(.disabled):active, $prefix .btn-secondary:not(:disabled):not(.disabled).active, .show>$prefix .btn-secondary.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
1002
-			$output .= $prefix ." .btn-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-secondary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
999
+			$output .= $prefix . " .btn-secondary:hover{background-color: " . $darker_075 . ";    border-color: " . $darker_10 . ";} ";
1000
+			$output .= $prefix . " .btn-outline-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-secondary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1001
+			$output .= $prefix . " .btn-secondary:not(:disabled):not(.disabled):active, $prefix .btn-secondary:not(:disabled):not(.disabled).active, .show>$prefix .btn-secondary.dropdown-toggle{background-color: " . $darker_10 . ";    border-color: " . $darker_125 . ";} ";
1002
+			$output .= $prefix . " .btn-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-secondary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1003 1003
 
1004 1004
 
1005 1005
 			return $output;
@@ -1035,8 +1035,8 @@  discard block
 block discarded – undo
1035 1035
 		/**
1036 1036
 		 * Check if we should display examples.
1037 1037
 		 */
1038
-		public function maybe_show_examples(){
1039
-			if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
1038
+		public function maybe_show_examples() {
1039
+			if (current_user_can('manage_options') && isset($_REQUEST['preview-aui'])) {
1040 1040
 				echo "<head>";
1041 1041
 				wp_head();
1042 1042
 				echo "</head>";
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
 		 * 
1053 1053
 		 * @return string
1054 1054
 		 */
1055
-		public function get_examples(){
1055
+		public function get_examples() {
1056 1056
 			$output = '';
1057 1057
 
1058 1058
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -473,12 +473,12 @@
 block discarded – undo
473 473
 				wp_enqueue_script( 'bootstrap-js-bundle' );
474 474
 				$script = $this->inline_script();
475 475
 				wp_add_inline_script( 'bootstrap-js-bundle', $script );
476
-			}elseif($this->settings[$js_setting]=='popper'){
476
+			} elseif($this->settings[$js_setting]=='popper'){
477 477
 				$url = $this->url.'assets/js/popper.min.js';
478 478
 				wp_register_script( 'bootstrap-js-popper', $url, array('jquery'), $this->latest );
479 479
 				wp_enqueue_script( 'bootstrap-js-popper' );
480 480
 				$load_inline = true;
481
-			}else{
481
+			} else{
482 482
 				$load_inline = true;
483 483
 			}
484 484
 
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/class-aui.php 2 patches
Indentation   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if ( ! defined( 'ABSPATH' ) ) {
4
-	exit; // Exit if accessed directly
4
+    exit; // Exit if accessed directly
5 5
 }
6 6
 
7 7
 /**
@@ -11,193 +11,193 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class AUI {
13 13
 
14
-	/**
15
-	 * Holds the class instance.
16
-	 *
17
-	 * @since 1.0.0
18
-	 * @var null
19
-	 */
20
-	private static $instance = null;
21
-
22
-	/**
23
-	 * Holds the current AUI version number.
24
-	 *
25
-	 * @var string $ver The current version number.
26
-	 */
27
-	public static $ver = '0.1.11';
28
-
29
-	/**
30
-	 * There can be only one.
31
-	 *
32
-	 * @since 1.0.0
33
-	 * @return AUI|null
34
-	 */
35
-	public static function instance() {
36
-		if ( self::$instance == null ) {
37
-			self::$instance = new AUI();
38
-		}
39
-
40
-		return self::$instance;
41
-	}
42
-
43
-	/**
44
-	 * AUI constructor.
45
-	 *
46
-	 * @since 1.0.0
47
-	 */
48
-	private function __construct() {
49
-		if ( function_exists( "__autoload" ) ) {
50
-			spl_autoload_register( "__autoload" );
51
-		}
52
-		spl_autoload_register( array( $this, 'autoload' ) );
53
-	}
54
-
55
-	/**
56
-	 * Autoload any components on the fly.
57
-	 *
58
-	 * @since 1.0.0
59
-	 *
60
-	 * @param $classname
61
-	 */
62
-	private function autoload( $classname ) {
63
-		$class     = str_replace( '_', '-', strtolower( $classname ) );
64
-		$file_path = trailingslashit( dirname( __FILE__ ) ) . "components/class-" . $class . '.php';
65
-		if ( $file_path && is_readable( $file_path ) ) {
66
-			include_once( $file_path );
67
-		}
68
-	}
69
-
70
-	public function render( $items = array() ) {
71
-		$output = '';
72
-
73
-		if ( ! empty( $items ) ) {
74
-			foreach ( $items as $args ) {
75
-				$render = isset( $args['render'] ) ? $args['render'] : '';
76
-				if ( $render && method_exists( __CLASS__, $render ) ) {
77
-					$output .= $this->$render( $args );
78
-				}
79
-			}
80
-		}
81
-
82
-		return $output;
83
-	}
84
-
85
-	/**
86
-	 * Render and return a bootstrap alert component.
87
-	 *
88
-	 * @since 1.0.0
89
-	 *
90
-	 * @param array $args
91
-	 *
92
-	 * @return string The rendered component.
93
-	 */
94
-	public function alert( $args = array() ) {
95
-		return AUI_Component_Alert::get( $args );
96
-	}
97
-
98
-	/**
99
-	 * Render and return a bootstrap input component.
100
-	 *
101
-	 * @since 1.0.0
102
-	 *
103
-	 * @param array $args
104
-	 *
105
-	 * @return string The rendered component.
106
-	 */
107
-	public function input( $args = array() ) {
108
-		return AUI_Component_Input::input( $args );
109
-	}
110
-
111
-	/**
112
-	 * Render and return a bootstrap textarea component.
113
-	 *
114
-	 * @since 1.0.0
115
-	 *
116
-	 * @param array $args
117
-	 *
118
-	 * @return string The rendered component.
119
-	 */
120
-	public function textarea( $args = array() ) {
121
-		return AUI_Component_Input::textarea( $args );
122
-	}
123
-
124
-	/**
125
-	 * Render and return a bootstrap button component.
126
-	 *
127
-	 * @since 1.0.0
128
-	 *
129
-	 * @param array $args
130
-	 *
131
-	 * @return string The rendered component.
132
-	 */
133
-	public function button( $args = array() ) {
134
-		return AUI_Component_Button::get( $args );
135
-	}
136
-
137
-	/**
138
-	 * Render and return a bootstrap button component.
139
-	 *
140
-	 * @since 1.0.0
141
-	 *
142
-	 * @param array $args
143
-	 *
144
-	 * @return string The rendered component.
145
-	 */
146
-	public function badge( $args = array() ) {
147
-		$defaults = array(
148
-			'class' => 'badge badge-primary align-middle',
149
-		);
150
-
151
-		// maybe set type
152
-		if ( empty( $args['href'] ) ) {
153
-			$defaults['type'] = 'badge';
154
-		}
155
-
156
-		/**
157
-		 * Parse incoming $args into an array and merge it with $defaults
158
-		 */
159
-		$args = wp_parse_args( $args, $defaults );
160
-
161
-		return AUI_Component_Button::get( $args );
162
-	}
163
-
164
-	/**
165
-	 * Render and return a bootstrap dropdown component.
166
-	 *
167
-	 * @since 1.0.0
168
-	 *
169
-	 * @param array $args
170
-	 *
171
-	 * @return string The rendered component.
172
-	 */
173
-	public function dropdown( $args = array() ) {
174
-		return AUI_Component_Dropdown::get( $args );
175
-	}
176
-
177
-	/**
178
-	 * Render and return a bootstrap select component.
179
-	 *
180
-	 * @since 1.0.0
181
-	 *
182
-	 * @param array $args
183
-	 *
184
-	 * @return string The rendered component.
185
-	 */
186
-	public function select( $args = array() ) {
187
-		return AUI_Component_Input::select( $args );
188
-	}
189
-
190
-	/**
191
-	 * Render and return a bootstrap pagination component.
192
-	 *
193
-	 * @since 1.0.0
194
-	 *
195
-	 * @param array $args
196
-	 *
197
-	 * @return string The rendered component.
198
-	 */
199
-	public function pagination( $args = array() ) {
200
-		return AUI_Component_Pagination::get( $args );
201
-	}
14
+    /**
15
+     * Holds the class instance.
16
+     *
17
+     * @since 1.0.0
18
+     * @var null
19
+     */
20
+    private static $instance = null;
21
+
22
+    /**
23
+     * Holds the current AUI version number.
24
+     *
25
+     * @var string $ver The current version number.
26
+     */
27
+    public static $ver = '0.1.11';
28
+
29
+    /**
30
+     * There can be only one.
31
+     *
32
+     * @since 1.0.0
33
+     * @return AUI|null
34
+     */
35
+    public static function instance() {
36
+        if ( self::$instance == null ) {
37
+            self::$instance = new AUI();
38
+        }
39
+
40
+        return self::$instance;
41
+    }
42
+
43
+    /**
44
+     * AUI constructor.
45
+     *
46
+     * @since 1.0.0
47
+     */
48
+    private function __construct() {
49
+        if ( function_exists( "__autoload" ) ) {
50
+            spl_autoload_register( "__autoload" );
51
+        }
52
+        spl_autoload_register( array( $this, 'autoload' ) );
53
+    }
54
+
55
+    /**
56
+     * Autoload any components on the fly.
57
+     *
58
+     * @since 1.0.0
59
+     *
60
+     * @param $classname
61
+     */
62
+    private function autoload( $classname ) {
63
+        $class     = str_replace( '_', '-', strtolower( $classname ) );
64
+        $file_path = trailingslashit( dirname( __FILE__ ) ) . "components/class-" . $class . '.php';
65
+        if ( $file_path && is_readable( $file_path ) ) {
66
+            include_once( $file_path );
67
+        }
68
+    }
69
+
70
+    public function render( $items = array() ) {
71
+        $output = '';
72
+
73
+        if ( ! empty( $items ) ) {
74
+            foreach ( $items as $args ) {
75
+                $render = isset( $args['render'] ) ? $args['render'] : '';
76
+                if ( $render && method_exists( __CLASS__, $render ) ) {
77
+                    $output .= $this->$render( $args );
78
+                }
79
+            }
80
+        }
81
+
82
+        return $output;
83
+    }
84
+
85
+    /**
86
+     * Render and return a bootstrap alert component.
87
+     *
88
+     * @since 1.0.0
89
+     *
90
+     * @param array $args
91
+     *
92
+     * @return string The rendered component.
93
+     */
94
+    public function alert( $args = array() ) {
95
+        return AUI_Component_Alert::get( $args );
96
+    }
97
+
98
+    /**
99
+     * Render and return a bootstrap input component.
100
+     *
101
+     * @since 1.0.0
102
+     *
103
+     * @param array $args
104
+     *
105
+     * @return string The rendered component.
106
+     */
107
+    public function input( $args = array() ) {
108
+        return AUI_Component_Input::input( $args );
109
+    }
110
+
111
+    /**
112
+     * Render and return a bootstrap textarea component.
113
+     *
114
+     * @since 1.0.0
115
+     *
116
+     * @param array $args
117
+     *
118
+     * @return string The rendered component.
119
+     */
120
+    public function textarea( $args = array() ) {
121
+        return AUI_Component_Input::textarea( $args );
122
+    }
123
+
124
+    /**
125
+     * Render and return a bootstrap button component.
126
+     *
127
+     * @since 1.0.0
128
+     *
129
+     * @param array $args
130
+     *
131
+     * @return string The rendered component.
132
+     */
133
+    public function button( $args = array() ) {
134
+        return AUI_Component_Button::get( $args );
135
+    }
136
+
137
+    /**
138
+     * Render and return a bootstrap button component.
139
+     *
140
+     * @since 1.0.0
141
+     *
142
+     * @param array $args
143
+     *
144
+     * @return string The rendered component.
145
+     */
146
+    public function badge( $args = array() ) {
147
+        $defaults = array(
148
+            'class' => 'badge badge-primary align-middle',
149
+        );
150
+
151
+        // maybe set type
152
+        if ( empty( $args['href'] ) ) {
153
+            $defaults['type'] = 'badge';
154
+        }
155
+
156
+        /**
157
+         * Parse incoming $args into an array and merge it with $defaults
158
+         */
159
+        $args = wp_parse_args( $args, $defaults );
160
+
161
+        return AUI_Component_Button::get( $args );
162
+    }
163
+
164
+    /**
165
+     * Render and return a bootstrap dropdown component.
166
+     *
167
+     * @since 1.0.0
168
+     *
169
+     * @param array $args
170
+     *
171
+     * @return string The rendered component.
172
+     */
173
+    public function dropdown( $args = array() ) {
174
+        return AUI_Component_Dropdown::get( $args );
175
+    }
176
+
177
+    /**
178
+     * Render and return a bootstrap select component.
179
+     *
180
+     * @since 1.0.0
181
+     *
182
+     * @param array $args
183
+     *
184
+     * @return string The rendered component.
185
+     */
186
+    public function select( $args = array() ) {
187
+        return AUI_Component_Input::select( $args );
188
+    }
189
+
190
+    /**
191
+     * Render and return a bootstrap pagination component.
192
+     *
193
+     * @since 1.0.0
194
+     *
195
+     * @param array $args
196
+     *
197
+     * @return string The rendered component.
198
+     */
199
+    public function pagination( $args = array() ) {
200
+        return AUI_Component_Pagination::get( $args );
201
+    }
202 202
 
203 203
 }
204 204
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
 	exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 * @return AUI|null
34 34
 	 */
35 35
 	public static function instance() {
36
-		if ( self::$instance == null ) {
36
+		if (self::$instance == null) {
37 37
 			self::$instance = new AUI();
38 38
 		}
39 39
 
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 	 * @since 1.0.0
47 47
 	 */
48 48
 	private function __construct() {
49
-		if ( function_exists( "__autoload" ) ) {
50
-			spl_autoload_register( "__autoload" );
49
+		if (function_exists("__autoload")) {
50
+			spl_autoload_register("__autoload");
51 51
 		}
52
-		spl_autoload_register( array( $this, 'autoload' ) );
52
+		spl_autoload_register(array($this, 'autoload'));
53 53
 	}
54 54
 
55 55
 	/**
@@ -59,22 +59,22 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @param $classname
61 61
 	 */
62
-	private function autoload( $classname ) {
63
-		$class     = str_replace( '_', '-', strtolower( $classname ) );
64
-		$file_path = trailingslashit( dirname( __FILE__ ) ) . "components/class-" . $class . '.php';
65
-		if ( $file_path && is_readable( $file_path ) ) {
66
-			include_once( $file_path );
62
+	private function autoload($classname) {
63
+		$class     = str_replace('_', '-', strtolower($classname));
64
+		$file_path = trailingslashit(dirname(__FILE__)) . "components/class-" . $class . '.php';
65
+		if ($file_path && is_readable($file_path)) {
66
+			include_once($file_path);
67 67
 		}
68 68
 	}
69 69
 
70
-	public function render( $items = array() ) {
70
+	public function render($items = array()) {
71 71
 		$output = '';
72 72
 
73
-		if ( ! empty( $items ) ) {
74
-			foreach ( $items as $args ) {
75
-				$render = isset( $args['render'] ) ? $args['render'] : '';
76
-				if ( $render && method_exists( __CLASS__, $render ) ) {
77
-					$output .= $this->$render( $args );
73
+		if (!empty($items)) {
74
+			foreach ($items as $args) {
75
+				$render = isset($args['render']) ? $args['render'] : '';
76
+				if ($render && method_exists(__CLASS__, $render)) {
77
+					$output .= $this->$render($args);
78 78
 				}
79 79
 			}
80 80
 		}
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @return string The rendered component.
93 93
 	 */
94
-	public function alert( $args = array() ) {
95
-		return AUI_Component_Alert::get( $args );
94
+	public function alert($args = array()) {
95
+		return AUI_Component_Alert::get($args);
96 96
 	}
97 97
 
98 98
 	/**
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @return string The rendered component.
106 106
 	 */
107
-	public function input( $args = array() ) {
108
-		return AUI_Component_Input::input( $args );
107
+	public function input($args = array()) {
108
+		return AUI_Component_Input::input($args);
109 109
 	}
110 110
 
111 111
 	/**
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 	 *
118 118
 	 * @return string The rendered component.
119 119
 	 */
120
-	public function textarea( $args = array() ) {
121
-		return AUI_Component_Input::textarea( $args );
120
+	public function textarea($args = array()) {
121
+		return AUI_Component_Input::textarea($args);
122 122
 	}
123 123
 
124 124
 	/**
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @return string The rendered component.
132 132
 	 */
133
-	public function button( $args = array() ) {
134
-		return AUI_Component_Button::get( $args );
133
+	public function button($args = array()) {
134
+		return AUI_Component_Button::get($args);
135 135
 	}
136 136
 
137 137
 	/**
@@ -143,22 +143,22 @@  discard block
 block discarded – undo
143 143
 	 *
144 144
 	 * @return string The rendered component.
145 145
 	 */
146
-	public function badge( $args = array() ) {
146
+	public function badge($args = array()) {
147 147
 		$defaults = array(
148 148
 			'class' => 'badge badge-primary align-middle',
149 149
 		);
150 150
 
151 151
 		// maybe set type
152
-		if ( empty( $args['href'] ) ) {
152
+		if (empty($args['href'])) {
153 153
 			$defaults['type'] = 'badge';
154 154
 		}
155 155
 
156 156
 		/**
157 157
 		 * Parse incoming $args into an array and merge it with $defaults
158 158
 		 */
159
-		$args = wp_parse_args( $args, $defaults );
159
+		$args = wp_parse_args($args, $defaults);
160 160
 
161
-		return AUI_Component_Button::get( $args );
161
+		return AUI_Component_Button::get($args);
162 162
 	}
163 163
 
164 164
 	/**
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @return string The rendered component.
172 172
 	 */
173
-	public function dropdown( $args = array() ) {
174
-		return AUI_Component_Dropdown::get( $args );
173
+	public function dropdown($args = array()) {
174
+		return AUI_Component_Dropdown::get($args);
175 175
 	}
176 176
 
177 177
 	/**
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
 	 *
184 184
 	 * @return string The rendered component.
185 185
 	 */
186
-	public function select( $args = array() ) {
187
-		return AUI_Component_Input::select( $args );
186
+	public function select($args = array()) {
187
+		return AUI_Component_Input::select($args);
188 188
 	}
189 189
 
190 190
 	/**
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
 	 *
197 197
 	 * @return string The rendered component.
198 198
 	 */
199
-	public function pagination( $args = array() ) {
200
-		return AUI_Component_Pagination::get( $args );
199
+	public function pagination($args = array()) {
200
+		return AUI_Component_Pagination::get($args);
201 201
 	}
202 202
 
203 203
 }
204 204
\ No newline at end of file
Please login to merge, or discard this patch.