Passed
Push — master ( 6f34c7...15e88c )
by Brian
10:50 queued 05:58
created
vendor/composer/autoload_static.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,35 +6,35 @@  discard block
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5
8 8
 {
9
-    public static $files = array (
9
+    public static $files = array(
10 10
         '24583d3588ebda5228dd453cfaa070da' => __DIR__ . '/..' . '/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php',
11 11
         'e8d544c98e79f913e13eae1306ab635e' => __DIR__ . '/..' . '/ayecode/wp-ayecode-ui/ayecode-ui-loader.php',
12 12
         '42671a413efb740d7040437ff2a982cd' => __DIR__ . '/..' . '/ayecode/wp-super-duper/sd-functions.php',
13 13
     );
14 14
 
15
-    public static $prefixLengthsPsr4 = array (
15
+    public static $prefixLengthsPsr4 = array(
16 16
         'M' => 
17
-        array (
17
+        array(
18 18
             'MaxMind\\Db\\' => 11,
19 19
         ),
20 20
         'C' => 
21
-        array (
21
+        array(
22 22
             'Composer\\Installers\\' => 20,
23 23
         ),
24 24
     );
25 25
 
26
-    public static $prefixDirsPsr4 = array (
26
+    public static $prefixDirsPsr4 = array(
27 27
         'MaxMind\\Db\\' => 
28
-        array (
28
+        array(
29 29
             0 => __DIR__ . '/..' . '/maxmind-db/reader/src/MaxMind/Db',
30 30
         ),
31 31
         'Composer\\Installers\\' => 
32
-        array (
32
+        array(
33 33
             0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers',
34 34
         ),
35 35
     );
36 36
 
37
-    public static $classMap = array (
37
+    public static $classMap = array(
38 38
         'AyeCode_Connect_Helper' => __DIR__ . '/..' . '/ayecode/ayecode-connect-helper/ayecode-connect-helper.php',
39 39
         'AyeCode_Deactivation_Survey' => __DIR__ . '/..' . '/ayecode/wp-deactivation-survey/wp-deactivation-survey.php',
40 40
         'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
     public static function getInitializer(ClassLoader $loader)
45 45
     {
46
-        return \Closure::bind(function () use ($loader) {
46
+        return \Closure::bind(function() use ($loader) {
47 47
             $loader->prefixLengthsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixLengthsPsr4;
48 48
             $loader->prefixDirsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixDirsPsr4;
49 49
             $loader->classMap = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$classMap;
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/wp-super-duper.php 2 patches
Indentation   +2043 added lines, -2043 removed lines patch added patch discarded remove patch
@@ -1,262 +1,262 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined( 'ABSPATH' ) ) {
3
-	exit;
3
+    exit;
4 4
 }
5 5
 
6 6
 if ( ! class_exists( 'WP_Super_Duper' ) ) {
7 7
 
8 8
 
9
-	/**
10
-	 * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress.
11
-	 *
12
-	 * Should not be called direct but extended instead.
13
-	 *
14
-	 * Class WP_Super_Duper
15
-	 * @since 1.0.16 change log moved to file change-log.txt - CHANGED
16
-	 * @ver 1.0.19
17
-	 */
18
-	class WP_Super_Duper extends WP_Widget {
19
-
20
-		public $version = "1.0.28";
21
-		public $font_awesome_icon_version = "5.11.2";
22
-		public $block_code;
23
-		public $options;
24
-		public $base_id;
25
-		public $settings_hash;
26
-		public $arguments = array();
27
-		public $instance = array();
28
-		private $class_name;
29
-
30
-		/**
31
-		 * The relative url to the current folder.
32
-		 *
33
-		 * @var string
34
-		 */
35
-		public $url = '';
36
-
37
-		/**
38
-		 * Take the array options and use them to build.
39
-		 */
40
-		public function __construct( $options ) {
41
-			global $sd_widgets;
42
-
43
-			$sd_widgets[ $options['base_id'] ] = array(
44
-				'name'       => $options['name'],
45
-				'class_name' => $options['class_name']
46
-			);
47
-			$this->base_id                     = $options['base_id'];
48
-			// lets filter the options before we do anything
49
-			$options       = apply_filters( "wp_super_duper_options", $options );
50
-			$options       = apply_filters( "wp_super_duper_options_{$this->base_id}", $options );
51
-			$options       = $this->add_name_from_key( $options );
52
-			$this->options = $options;
53
-
54
-			$this->base_id   = $options['base_id'];
55
-			$this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
56
-
57
-			// init parent
58
-			parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] );
59
-
60
-			if ( isset( $options['class_name'] ) ) {
61
-				// register widget
62
-				$this->class_name = $options['class_name'];
63
-
64
-				// register shortcode
65
-				$this->register_shortcode();
66
-
67
-				// Fusion Builder (avada) support
68
-				if ( function_exists( 'fusion_builder_map' ) ) {
69
-					add_action( 'init', array( $this, 'register_fusion_element' ) );
70
-				}
71
-
72
-				// register block
73
-				add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
74
-			}
75
-
76
-			// add the CSS and JS we need ONCE
77
-			global $sd_widget_scripts;
78
-
79
-			if ( ! $sd_widget_scripts ) {
80
-				wp_add_inline_script( 'admin-widgets', $this->widget_js() );
81
-				wp_add_inline_script( 'customize-controls', $this->widget_js() );
82
-				wp_add_inline_style( 'widgets', $this->widget_css() );
83
-
84
-				// maybe add elementor editor styles
85
-				add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) );
86
-
87
-				$sd_widget_scripts = true;
88
-
89
-				// add shortcode insert button once
90
-				add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
91
-				// generatepress theme sections compatibility
92
-				if ( function_exists( 'generate_sections_sections_metabox' ) ) {
93
-					add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
94
-				}
95
-				if ( $this->is_preview() ) {
96
-					add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
97
-					// this makes the insert button work for elementor
98
-					add_action( 'elementor/editor/after_enqueue_scripts', array(
99
-						$this,
100
-						'shortcode_insert_button_script'
101
-					) ); // for elementor
102
-				}
103
-				// this makes the insert button work for cornerstone
104
-				add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) );
105
-
106
-				add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) );
107
-				add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
108
-
109
-				// add generator text to admin head
110
-				add_action( 'admin_head', array( $this, 'generator' ) );
111
-			}
112
-
113
-			do_action( 'wp_super_duper_widget_init', $options, $this );
114
-		}
115
-
116
-		/**
117
-		 * Add our widget CSS to elementor editor.
118
-		 */
119
-		public function elementor_editor_styles() {
120
-			wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) );
121
-		}
122
-
123
-		public function register_fusion_element() {
124
-
125
-			$options = $this->options;
126
-
127
-			if ( $this->base_id ) {
128
-
129
-				$params = $this->get_fusion_params();
130
-
131
-				$args = array(
132
-					'name'            => $options['name'],
133
-					'shortcode'       => $this->base_id,
134
-					'icon'            => $options['block-icon'] ? $options['block-icon'] : 'far fa-square',
135
-					'allow_generator' => true,
136
-				);
137
-
138
-				if ( ! empty( $params ) ) {
139
-					$args['params'] = $params;
140
-				}
141
-
142
-				fusion_builder_map( $args );
143
-			}
144
-
145
-		}
146
-
147
-		public function get_fusion_params() {
148
-			$params    = array();
149
-			$arguments = $this->get_arguments();
150
-
151
-			if ( ! empty( $arguments ) ) {
152
-				foreach ( $arguments as $key => $val ) {
153
-					$param = array();
154
-					// type
155
-					$param['type'] = str_replace(
156
-						array(
157
-							"text",
158
-							"number",
159
-							"email",
160
-							"color",
161
-							"checkbox"
162
-						),
163
-						array(
164
-							"textfield",
165
-							"textfield",
166
-							"textfield",
167
-							"colorpicker",
168
-							"select",
169
-
170
-						),
171
-						$val['type'] );
172
-
173
-					// multiselect
174
-					if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
175
-						$param['type']     = 'multiple_select';
176
-						$param['multiple'] = true;
177
-					}
178
-
179
-					// heading
180
-					$param['heading'] = $val['title'];
181
-
182
-					// description
183
-					$param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
184
-
185
-					// param_name
186
-					$param['param_name'] = $key;
187
-
188
-					// Default
189
-					$param['default'] = isset( $val['default'] ) ? $val['default'] : '';
190
-
191
-					// Group
192
-					if ( isset( $val['group'] ) ) {
193
-						$param['group'] = $val['group'];
194
-					}
195
-
196
-					// value
197
-					if ( $val['type'] == 'checkbox' ) {
198
-						if ( isset( $val['default'] ) && $val['default'] == '0' ) {
199
-							unset( $param['default'] );
200
-						}
201
-						$param['value'] = array( '' => __( "No" ), '1' => __( "Yes" ) );
202
-					} elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
203
-						$param['value'] = isset( $val['options'] ) ? $val['options'] : array();
204
-					} else {
205
-						$param['value'] = isset( $val['default'] ) ? $val['default'] : '';
206
-					}
207
-
208
-					// setup the param
209
-					$params[] = $param;
210
-
211
-				}
212
-			}
213
-
214
-
215
-			return $params;
216
-		}
217
-
218
-		/**
219
-		 * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
220
-		 */
221
-		public static function maybe_cornerstone_builder() {
222
-			if ( did_action( 'cornerstone_before_boot_app' ) ) {
223
-				self::shortcode_insert_button_script();
224
-			}
225
-		}
226
-
227
-		/**
228
-		 * A function to ge the shortcode builder picker html.
229
-		 *
230
-		 * @param string $editor_id
231
-		 *
232
-		 * @return string
233
-		 */
234
-		public static function get_picker( $editor_id = '' ) {
235
-
236
-			ob_start();
237
-			if ( isset( $_POST['editor_id'] ) ) {
238
-				$editor_id = esc_attr( $_POST['editor_id'] );
239
-			} elseif ( isset( $_REQUEST['et_fb'] ) ) {
240
-				$editor_id = 'main_content_content_vb_tiny_mce';
241
-			}
242
-
243
-			global $sd_widgets;
244
-			?>
9
+    /**
10
+     * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress.
11
+     *
12
+     * Should not be called direct but extended instead.
13
+     *
14
+     * Class WP_Super_Duper
15
+     * @since 1.0.16 change log moved to file change-log.txt - CHANGED
16
+     * @ver 1.0.19
17
+     */
18
+    class WP_Super_Duper extends WP_Widget {
19
+
20
+        public $version = "1.0.28";
21
+        public $font_awesome_icon_version = "5.11.2";
22
+        public $block_code;
23
+        public $options;
24
+        public $base_id;
25
+        public $settings_hash;
26
+        public $arguments = array();
27
+        public $instance = array();
28
+        private $class_name;
29
+
30
+        /**
31
+         * The relative url to the current folder.
32
+         *
33
+         * @var string
34
+         */
35
+        public $url = '';
36
+
37
+        /**
38
+         * Take the array options and use them to build.
39
+         */
40
+        public function __construct( $options ) {
41
+            global $sd_widgets;
42
+
43
+            $sd_widgets[ $options['base_id'] ] = array(
44
+                'name'       => $options['name'],
45
+                'class_name' => $options['class_name']
46
+            );
47
+            $this->base_id                     = $options['base_id'];
48
+            // lets filter the options before we do anything
49
+            $options       = apply_filters( "wp_super_duper_options", $options );
50
+            $options       = apply_filters( "wp_super_duper_options_{$this->base_id}", $options );
51
+            $options       = $this->add_name_from_key( $options );
52
+            $this->options = $options;
53
+
54
+            $this->base_id   = $options['base_id'];
55
+            $this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
56
+
57
+            // init parent
58
+            parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] );
59
+
60
+            if ( isset( $options['class_name'] ) ) {
61
+                // register widget
62
+                $this->class_name = $options['class_name'];
63
+
64
+                // register shortcode
65
+                $this->register_shortcode();
66
+
67
+                // Fusion Builder (avada) support
68
+                if ( function_exists( 'fusion_builder_map' ) ) {
69
+                    add_action( 'init', array( $this, 'register_fusion_element' ) );
70
+                }
71
+
72
+                // register block
73
+                add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
74
+            }
75
+
76
+            // add the CSS and JS we need ONCE
77
+            global $sd_widget_scripts;
78
+
79
+            if ( ! $sd_widget_scripts ) {
80
+                wp_add_inline_script( 'admin-widgets', $this->widget_js() );
81
+                wp_add_inline_script( 'customize-controls', $this->widget_js() );
82
+                wp_add_inline_style( 'widgets', $this->widget_css() );
83
+
84
+                // maybe add elementor editor styles
85
+                add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) );
86
+
87
+                $sd_widget_scripts = true;
88
+
89
+                // add shortcode insert button once
90
+                add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
91
+                // generatepress theme sections compatibility
92
+                if ( function_exists( 'generate_sections_sections_metabox' ) ) {
93
+                    add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
94
+                }
95
+                if ( $this->is_preview() ) {
96
+                    add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
97
+                    // this makes the insert button work for elementor
98
+                    add_action( 'elementor/editor/after_enqueue_scripts', array(
99
+                        $this,
100
+                        'shortcode_insert_button_script'
101
+                    ) ); // for elementor
102
+                }
103
+                // this makes the insert button work for cornerstone
104
+                add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) );
105
+
106
+                add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) );
107
+                add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
108
+
109
+                // add generator text to admin head
110
+                add_action( 'admin_head', array( $this, 'generator' ) );
111
+            }
112
+
113
+            do_action( 'wp_super_duper_widget_init', $options, $this );
114
+        }
115
+
116
+        /**
117
+         * Add our widget CSS to elementor editor.
118
+         */
119
+        public function elementor_editor_styles() {
120
+            wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) );
121
+        }
122
+
123
+        public function register_fusion_element() {
124
+
125
+            $options = $this->options;
126
+
127
+            if ( $this->base_id ) {
128
+
129
+                $params = $this->get_fusion_params();
130
+
131
+                $args = array(
132
+                    'name'            => $options['name'],
133
+                    'shortcode'       => $this->base_id,
134
+                    'icon'            => $options['block-icon'] ? $options['block-icon'] : 'far fa-square',
135
+                    'allow_generator' => true,
136
+                );
137
+
138
+                if ( ! empty( $params ) ) {
139
+                    $args['params'] = $params;
140
+                }
141
+
142
+                fusion_builder_map( $args );
143
+            }
144
+
145
+        }
146
+
147
+        public function get_fusion_params() {
148
+            $params    = array();
149
+            $arguments = $this->get_arguments();
150
+
151
+            if ( ! empty( $arguments ) ) {
152
+                foreach ( $arguments as $key => $val ) {
153
+                    $param = array();
154
+                    // type
155
+                    $param['type'] = str_replace(
156
+                        array(
157
+                            "text",
158
+                            "number",
159
+                            "email",
160
+                            "color",
161
+                            "checkbox"
162
+                        ),
163
+                        array(
164
+                            "textfield",
165
+                            "textfield",
166
+                            "textfield",
167
+                            "colorpicker",
168
+                            "select",
169
+
170
+                        ),
171
+                        $val['type'] );
172
+
173
+                    // multiselect
174
+                    if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
175
+                        $param['type']     = 'multiple_select';
176
+                        $param['multiple'] = true;
177
+                    }
178
+
179
+                    // heading
180
+                    $param['heading'] = $val['title'];
181
+
182
+                    // description
183
+                    $param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
184
+
185
+                    // param_name
186
+                    $param['param_name'] = $key;
187
+
188
+                    // Default
189
+                    $param['default'] = isset( $val['default'] ) ? $val['default'] : '';
190
+
191
+                    // Group
192
+                    if ( isset( $val['group'] ) ) {
193
+                        $param['group'] = $val['group'];
194
+                    }
195
+
196
+                    // value
197
+                    if ( $val['type'] == 'checkbox' ) {
198
+                        if ( isset( $val['default'] ) && $val['default'] == '0' ) {
199
+                            unset( $param['default'] );
200
+                        }
201
+                        $param['value'] = array( '' => __( "No" ), '1' => __( "Yes" ) );
202
+                    } elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
203
+                        $param['value'] = isset( $val['options'] ) ? $val['options'] : array();
204
+                    } else {
205
+                        $param['value'] = isset( $val['default'] ) ? $val['default'] : '';
206
+                    }
207
+
208
+                    // setup the param
209
+                    $params[] = $param;
210
+
211
+                }
212
+            }
213
+
214
+
215
+            return $params;
216
+        }
217
+
218
+        /**
219
+         * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
220
+         */
221
+        public static function maybe_cornerstone_builder() {
222
+            if ( did_action( 'cornerstone_before_boot_app' ) ) {
223
+                self::shortcode_insert_button_script();
224
+            }
225
+        }
226
+
227
+        /**
228
+         * A function to ge the shortcode builder picker html.
229
+         *
230
+         * @param string $editor_id
231
+         *
232
+         * @return string
233
+         */
234
+        public static function get_picker( $editor_id = '' ) {
235
+
236
+            ob_start();
237
+            if ( isset( $_POST['editor_id'] ) ) {
238
+                $editor_id = esc_attr( $_POST['editor_id'] );
239
+            } elseif ( isset( $_REQUEST['et_fb'] ) ) {
240
+                $editor_id = 'main_content_content_vb_tiny_mce';
241
+            }
242
+
243
+            global $sd_widgets;
244
+            ?>
245 245
 
246 246
 			<div class="sd-shortcode-left-wrap">
247 247
 				<?php
248
-				ksort( $sd_widgets );
249
-				//				print_r($sd_widgets);exit;
250
-				if ( ! empty( $sd_widgets ) ) {
251
-					echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
252
-					echo "<option>" . __( 'Select shortcode' ) . "</option>";
253
-					foreach ( $sd_widgets as $shortcode => $class ) {
254
-						echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
255
-					}
256
-					echo "</select>";
257
-
258
-				}
259
-				?>
248
+                ksort( $sd_widgets );
249
+                //				print_r($sd_widgets);exit;
250
+                if ( ! empty( $sd_widgets ) ) {
251
+                    echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
252
+                    echo "<option>" . __( 'Select shortcode' ) . "</option>";
253
+                    foreach ( $sd_widgets as $shortcode => $class ) {
254
+                        echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
255
+                    }
256
+                    echo "</select>";
257
+
258
+                }
259
+                ?>
260 260
 				<div class="sd-shortcode-settings"></div>
261 261
 
262 262
 			</div>
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
 					<?php if ( $editor_id != '' ) { ?>
268 268
 						<button class="button sd-insert-shortcode-button"
269 269
 						        onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) {
270
-							        echo "'" . $editor_id . "'";
271
-						        } ?>)"><?php _e( 'Insert shortcode' ); ?></button>
270
+                                    echo "'" . $editor_id . "'";
271
+                                } ?>)"><?php _e( 'Insert shortcode' ); ?></button>
272 272
 					<?php } ?>
273 273
 					<button class="button"
274 274
 					        onclick="sd_copy_to_clipboard()"><?php _e( 'Copy shortcode' ); ?></button>
@@ -276,134 +276,134 @@  discard block
 block discarded – undo
276 276
 			</div>
277 277
 			<?php
278 278
 
279
-			$html = ob_get_clean();
280
-
281
-			if ( wp_doing_ajax() ) {
282
-				echo $html;
283
-				$should_die = true;
284
-
285
-				// some builder get the editor via ajax so we should not die on those occasions
286
-				$dont_die = array(
287
-					'parent_tag',// WP Bakery
288
-					'avia_request' // enfold
289
-				);
290
-
291
-				foreach ( $dont_die as $request ) {
292
-					if ( isset( $_REQUEST[ $request ] ) ) {
293
-						$should_die = false;
294
-					}
295
-				}
296
-
297
-				if ( $should_die ) {
298
-					wp_die();
299
-				}
300
-
301
-			} else {
302
-				return $html;
303
-			}
304
-
305
-			return '';
306
-
307
-		}
308
-
309
-		/**
310
-		 * Output the version in the admin header.
311
-		 */
312
-		public function generator() {
313
-			echo '<meta name="generator" content="WP Super Duper v' . $this->version . '" />';
314
-		}
315
-
316
-		/**
317
-		 * Get widget settings.
318
-		 *
319
-		 * @since 1.0.0
320
-		 */
321
-		public static function get_widget_settings() {
322
-			global $sd_widgets;
323
-
324
-			$shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : '';
325
-			if ( ! $shortcode ) {
326
-				wp_die();
327
-			}
328
-			$widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : '';
329
-			if ( ! $widget_args ) {
330
-				wp_die();
331
-			}
332
-			$class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
333
-			if ( ! $class_name ) {
334
-				wp_die();
335
-			}
336
-
337
-			// invoke an instance method
338
-			$widget = new $class_name;
339
-
340
-			ob_start();
341
-			$widget->form( array() );
342
-			$form = ob_get_clean();
343
-			echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>";
344
-			echo "<style>" . $widget->widget_css() . "</style>";
345
-			echo "<script>" . $widget->widget_js() . "</script>";
346
-			?>
279
+            $html = ob_get_clean();
280
+
281
+            if ( wp_doing_ajax() ) {
282
+                echo $html;
283
+                $should_die = true;
284
+
285
+                // some builder get the editor via ajax so we should not die on those occasions
286
+                $dont_die = array(
287
+                    'parent_tag',// WP Bakery
288
+                    'avia_request' // enfold
289
+                );
290
+
291
+                foreach ( $dont_die as $request ) {
292
+                    if ( isset( $_REQUEST[ $request ] ) ) {
293
+                        $should_die = false;
294
+                    }
295
+                }
296
+
297
+                if ( $should_die ) {
298
+                    wp_die();
299
+                }
300
+
301
+            } else {
302
+                return $html;
303
+            }
304
+
305
+            return '';
306
+
307
+        }
308
+
309
+        /**
310
+         * Output the version in the admin header.
311
+         */
312
+        public function generator() {
313
+            echo '<meta name="generator" content="WP Super Duper v' . $this->version . '" />';
314
+        }
315
+
316
+        /**
317
+         * Get widget settings.
318
+         *
319
+         * @since 1.0.0
320
+         */
321
+        public static function get_widget_settings() {
322
+            global $sd_widgets;
323
+
324
+            $shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : '';
325
+            if ( ! $shortcode ) {
326
+                wp_die();
327
+            }
328
+            $widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : '';
329
+            if ( ! $widget_args ) {
330
+                wp_die();
331
+            }
332
+            $class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
333
+            if ( ! $class_name ) {
334
+                wp_die();
335
+            }
336
+
337
+            // invoke an instance method
338
+            $widget = new $class_name;
339
+
340
+            ob_start();
341
+            $widget->form( array() );
342
+            $form = ob_get_clean();
343
+            echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>";
344
+            echo "<style>" . $widget->widget_css() . "</style>";
345
+            echo "<script>" . $widget->widget_js() . "</script>";
346
+            ?>
347 347
 			<?php
348
-			wp_die();
349
-		}
350
-
351
-		/**
352
-		 * Insert shortcode builder button to classic editor (not inside Gutenberg, not needed).
353
-		 *
354
-		 * @since 1.0.0
355
-		 *
356
-		 * @param string $editor_id Optional. Shortcode editor id. Default null.
357
-		 * @param string $insert_shortcode_function Optional. Insert shortcode function. Default null.
358
-		 */
359
-		public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
360
-			global $sd_widgets, $shortcode_insert_button_once;
361
-			if ( $shortcode_insert_button_once ) {
362
-				return;
363
-			}
364
-			add_thickbox();
365
-
366
-
367
-			/**
368
-			 * Cornerstone makes us play dirty tricks :/
369
-			 * All media_buttons are removed via JS unless they are two specific id's so we wrap our content in this ID so it is not removed.
370
-			 */
371
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
372
-				echo '<span id="insert-media-button">';
373
-			}
374
-
375
-			echo self::shortcode_button( 'this', 'true' );
376
-
377
-			// see opening note
378
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
379
-				echo '</span>'; // end #insert-media-button
380
-			}
381
-
382
-			// Add separate script for generatepress theme sections
383
-			if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
384
-			} else {
385
-				self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
386
-			}
387
-
388
-			$shortcode_insert_button_once = true;
389
-		}
390
-
391
-		/**
392
-		 * Gets the shortcode insert button html.
393
-		 *
394
-		 * @param string $id
395
-		 * @param string $search_for_id
396
-		 *
397
-		 * @return mixed
398
-		 */
399
-		public static function shortcode_button( $id = '', $search_for_id = '' ) {
400
-			ob_start();
401
-			?>
348
+            wp_die();
349
+        }
350
+
351
+        /**
352
+         * Insert shortcode builder button to classic editor (not inside Gutenberg, not needed).
353
+         *
354
+         * @since 1.0.0
355
+         *
356
+         * @param string $editor_id Optional. Shortcode editor id. Default null.
357
+         * @param string $insert_shortcode_function Optional. Insert shortcode function. Default null.
358
+         */
359
+        public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
360
+            global $sd_widgets, $shortcode_insert_button_once;
361
+            if ( $shortcode_insert_button_once ) {
362
+                return;
363
+            }
364
+            add_thickbox();
365
+
366
+
367
+            /**
368
+             * Cornerstone makes us play dirty tricks :/
369
+             * All media_buttons are removed via JS unless they are two specific id's so we wrap our content in this ID so it is not removed.
370
+             */
371
+            if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
372
+                echo '<span id="insert-media-button">';
373
+            }
374
+
375
+            echo self::shortcode_button( 'this', 'true' );
376
+
377
+            // see opening note
378
+            if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
379
+                echo '</span>'; // end #insert-media-button
380
+            }
381
+
382
+            // Add separate script for generatepress theme sections
383
+            if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
384
+            } else {
385
+                self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
386
+            }
387
+
388
+            $shortcode_insert_button_once = true;
389
+        }
390
+
391
+        /**
392
+         * Gets the shortcode insert button html.
393
+         *
394
+         * @param string $id
395
+         * @param string $search_for_id
396
+         *
397
+         * @return mixed
398
+         */
399
+        public static function shortcode_button( $id = '', $search_for_id = '' ) {
400
+            ob_start();
401
+            ?>
402 402
 			<span class="sd-lable-shortcode-inserter">
403 403
 				<a onclick="sd_ajax_get_picker(<?php echo $id;
404
-				if ( $search_for_id ) {
405
-					echo "," . $search_for_id;
406
-				} ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
404
+                if ( $search_for_id ) {
405
+                    echo "," . $search_for_id;
406
+                } ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
407 407
 				   class="thickbox button super-duper-content-open" title="Add Shortcode">
408 408
 					<span style="vertical-align: middle;line-height: 18px;font-size: 20px;"
409 409
 					      class="dashicons dashicons-screenoptions"></span>
@@ -414,21 +414,21 @@  discard block
 block discarded – undo
414 414
 			</span>
415 415
 
416 416
 			<?php
417
-			$html = ob_get_clean();
418
-
419
-			// remove line breaks so we can use it in js
420
-			return preg_replace( "/\r|\n/", "", trim( $html ) );
421
-		}
422
-
423
-		/**
424
-		 * Makes SD work with the siteOrigin page builder.
425
-		 *
426
-		 * @since 1.0.6
427
-		 * @return mixed
428
-		 */
429
-		public static function siteorigin_js() {
430
-			ob_start();
431
-			?>
417
+            $html = ob_get_clean();
418
+
419
+            // remove line breaks so we can use it in js
420
+            return preg_replace( "/\r|\n/", "", trim( $html ) );
421
+        }
422
+
423
+        /**
424
+         * Makes SD work with the siteOrigin page builder.
425
+         *
426
+         * @since 1.0.6
427
+         * @return mixed
428
+         */
429
+        public static function siteorigin_js() {
430
+            ob_start();
431
+            ?>
432 432
 			<script>
433 433
 				/**
434 434
 				 * Check a form to see what items should be shown or hidden.
@@ -506,28 +506,28 @@  discard block
 block discarded – undo
506 506
 				});
507 507
 			</script>
508 508
 			<?php
509
-			$output = ob_get_clean();
509
+            $output = ob_get_clean();
510 510
 
511
-			/*
511
+            /*
512 512
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
513 513
 			 */
514 514
 
515
-			return str_replace( array(
516
-				'<script>',
517
-				'</script>'
518
-			), '', $output );
519
-		}
520
-
521
-		/**
522
-		 * Output the JS and CSS for the shortcode insert button.
523
-		 *
524
-		 * @since 1.0.6
525
-		 *
526
-		 * @param string $editor_id
527
-		 * @param string $insert_shortcode_function
528
-		 */
529
-		public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
530
-			?>
515
+            return str_replace( array(
516
+                '<script>',
517
+                '</script>'
518
+            ), '', $output );
519
+        }
520
+
521
+        /**
522
+         * Output the JS and CSS for the shortcode insert button.
523
+         *
524
+         * @since 1.0.6
525
+         *
526
+         * @param string $editor_id
527
+         * @param string $insert_shortcode_function
528
+         */
529
+        public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
530
+            ?>
531 531
 			<style>
532 532
 				.sd-shortcode-left-wrap {
533 533
 					float: left;
@@ -653,35 +653,35 @@  discard block
 block discarded – undo
653 653
 				<?php } ?>
654 654
 			</style>
655 655
 			<?php
656
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
657
-				echo "<script>" . self::siteorigin_js() . "</script>";
658
-			}
659
-			?>
656
+            if ( class_exists( 'SiteOrigin_Panels' ) ) {
657
+                echo "<script>" . self::siteorigin_js() . "</script>";
658
+            }
659
+            ?>
660 660
 			<script>
661 661
 				<?php
662
-				if(! empty( $insert_shortcode_function )){
663
-					echo $insert_shortcode_function;
664
-				}else{
665
-
666
-				/**
667
-				 * Function for super duper insert shortcode.
668
-				 *
669
-				 * @since 1.0.0
670
-				 */
671
-				?>
662
+                if(! empty( $insert_shortcode_function )){
663
+                    echo $insert_shortcode_function;
664
+                }else{
665
+
666
+                /**
667
+                 * Function for super duper insert shortcode.
668
+                 *
669
+                 * @since 1.0.0
670
+                 */
671
+                ?>
672 672
 				function sd_insert_shortcode($editor_id) {
673 673
 					$shortcode = jQuery('#TB_ajaxContent #sd-shortcode-output').val();
674 674
 					if ($shortcode) {
675 675
 						if (!$editor_id) {
676 676
 							<?php
677
-							if ( isset( $_REQUEST['et_fb'] ) ) {
678
-								echo '$editor_id = "#main_content_content_vb_tiny_mce";';
679
-							} elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
680
-								echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
681
-							} else {
682
-								echo '$editor_id = "#wp-content-editor-container textarea";';
683
-							}
684
-							?>
677
+                            if ( isset( $_REQUEST['et_fb'] ) ) {
678
+                                echo '$editor_id = "#main_content_content_vb_tiny_mce";';
679
+                            } elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
680
+                                echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
681
+                            } else {
682
+                                echo '$editor_id = "#wp-content-editor-container textarea";';
683
+                            }
684
+                            ?>
685 685
 						} else {
686 686
 							$editor_id = '#' + $editor_id;
687 687
 						}
@@ -1007,18 +1007,18 @@  discard block
 block discarded – undo
1007 1007
 
1008 1008
 			</script>
1009 1009
 			<?php
1010
-		}
1011
-
1012
-		/**
1013
-		 * Gets some CSS for the widgets screen.
1014
-		 *
1015
-		 * @param bool $advanced If we should include advanced CSS.
1016
-		 *
1017
-		 * @return mixed
1018
-		 */
1019
-		public function widget_css( $advanced = true ) {
1020
-			ob_start();
1021
-			?>
1010
+        }
1011
+
1012
+        /**
1013
+         * Gets some CSS for the widgets screen.
1014
+         *
1015
+         * @param bool $advanced If we should include advanced CSS.
1016
+         *
1017
+         * @return mixed
1018
+         */
1019
+        public function widget_css( $advanced = true ) {
1020
+            ob_start();
1021
+            ?>
1022 1022
 			<style>
1023 1023
 				<?php if( $advanced ){ ?>
1024 1024
 				.sd-advanced-setting {
@@ -1056,26 +1056,26 @@  discard block
 block discarded – undo
1056 1056
 				}
1057 1057
 			</style>
1058 1058
 			<?php
1059
-			$output = ob_get_clean();
1059
+            $output = ob_get_clean();
1060 1060
 
1061
-			/*
1061
+            /*
1062 1062
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1063 1063
 			 */
1064 1064
 
1065
-			return str_replace( array(
1066
-				'<style>',
1067
-				'</style>'
1068
-			), '', $output );
1069
-		}
1070
-
1071
-		/**
1072
-		 * Gets some JS for the widgets screen.
1073
-		 *
1074
-		 * @return mixed
1075
-		 */
1076
-		public function widget_js() {
1077
-			ob_start();
1078
-			?>
1065
+            return str_replace( array(
1066
+                '<style>',
1067
+                '</style>'
1068
+            ), '', $output );
1069
+        }
1070
+
1071
+        /**
1072
+         * Gets some JS for the widgets screen.
1073
+         *
1074
+         * @return mixed
1075
+         */
1076
+        public function widget_js() {
1077
+            ob_start();
1078
+            ?>
1079 1079
 			<script>
1080 1080
 
1081 1081
 				/**
@@ -1233,435 +1233,435 @@  discard block
 block discarded – undo
1233 1233
 				<?php do_action( 'wp_super_duper_widget_js', $this ); ?>
1234 1234
 			</script>
1235 1235
 			<?php
1236
-			$output = ob_get_clean();
1236
+            $output = ob_get_clean();
1237 1237
 
1238
-			/*
1238
+            /*
1239 1239
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1240 1240
 			 */
1241 1241
 
1242
-			return str_replace( array(
1243
-				'<script>',
1244
-				'</script>'
1245
-			), '', $output );
1246
-		}
1247
-
1248
-
1249
-		/**
1250
-		 * Set the name from the argument key.
1251
-		 *
1252
-		 * @param $options
1253
-		 *
1254
-		 * @return mixed
1255
-		 */
1256
-		private function add_name_from_key( $options, $arguments = false ) {
1257
-			if ( ! empty( $options['arguments'] ) ) {
1258
-				foreach ( $options['arguments'] as $key => $val ) {
1259
-					$options['arguments'][ $key ]['name'] = $key;
1260
-				}
1261
-			} elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
1262
-				foreach ( $options as $key => $val ) {
1263
-					$options[ $key ]['name'] = $key;
1264
-				}
1265
-			}
1266
-
1267
-			return $options;
1268
-		}
1269
-
1270
-		/**
1271
-		 * Register the parent shortcode.
1272
-		 *
1273
-		 * @since 1.0.0
1274
-		 */
1275
-		public function register_shortcode() {
1276
-			add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) );
1277
-			add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) );
1278
-		}
1279
-
1280
-		/**
1281
-		 * Render the shortcode via ajax so we can return it to Gutenberg.
1282
-		 *
1283
-		 * @since 1.0.0
1284
-		 */
1285
-		public function render_shortcode() {
1286
-			check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
1287
-			if ( ! current_user_can( 'manage_options' ) ) {
1288
-				wp_die();
1289
-			}
1290
-
1291
-			// we might need the $post value here so lets set it.
1292
-			if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
1293
-				$post_obj = get_post( absint( $_POST['post_id'] ) );
1294
-				if ( ! empty( $post_obj ) && empty( $post ) ) {
1295
-					global $post;
1296
-					$post = $post_obj;
1297
-				}
1298
-			}
1299
-
1300
-			if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) {
1301
-				$is_preview = $this->is_preview();
1302
-				$shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
1303
-				$attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
1304
-				$attributes       = '';
1305
-				if ( ! empty( $attributes_array ) ) {
1306
-					foreach ( $attributes_array as $key => $value ) {
1307
-						if ( is_array( $value ) ) {
1308
-							$value = implode( ",", $value );
1309
-						}
1310
-
1311
-						if ( ! empty( $value ) ) {
1312
-							$value = wp_unslash( $value );
1313
-
1314
-							// Encode [ and ].
1315
-							if ( $is_preview ) {
1316
-								$value = $this->encode_shortcodes( $value );
1317
-							}
1318
-						}
1319
-						$attributes .= " " . sanitize_title_with_dashes( $key ) . "='" . esc_attr( $value ) . "' ";
1320
-					}
1321
-				}
1322
-
1323
-				$shortcode = "[" . $shortcode_name . " " . $attributes . "]";
1324
-
1325
-				$content = do_shortcode( $shortcode );
1326
-
1327
-				// Decode [ and ].
1328
-				if ( ! empty( $content ) && $is_preview ) {
1329
-					$content = $this->decode_shortcodes( $content );
1330
-				}
1331
-
1332
-				echo $content;
1333
-			}
1334
-			wp_die();
1335
-		}
1336
-
1337
-		/**
1338
-		 * Output the shortcode.
1339
-		 *
1340
-		 * @param array $args
1341
-		 * @param string $content
1342
-		 *
1343
-		 * @return string
1344
-		 */
1345
-		public function shortcode_output( $args = array(), $content = '' ) {
1346
-			$_instance = $args;
1347
-
1348
-			$args = $this->argument_values( $args );
1349
-
1350
-			// add extra argument so we know its a output to gutenberg
1351
-			//$args
1352
-			$args = $this->string_to_bool( $args );
1353
-
1354
-			// if we have a enclosed shortcode we add it to the special `html` argument
1355
-			if ( ! empty( $content ) ) {
1356
-				$args['html'] = $content;
1357
-			}
1358
-
1359
-			if ( ! $this->is_preview() ) {
1360
-				/**
1361
-				 * Filters the settings for a particular widget args.
1362
-				 *
1363
-				 * @since 1.0.28
1364
-				 *
1365
-				 * @param array          $args      The current widget instance's settings.
1366
-				 * @param WP_Super_Duper $widget    The current widget settings.
1367
-				 * @param array          $_instance An array of default widget arguments.
1368
-				 */
1369
-				$args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance );
1370
-
1371
-				if ( ! is_array( $args ) ) {
1372
-					return $args;
1373
-				}
1374
-			}
1375
-
1376
-			$class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : '';
1377
-			$class .= " sdel-".$this->get_instance_hash();
1378
-
1379
-			$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
1380
-			$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
1381
-
1382
-			$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
1383
-			$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
1384
-
1385
-			$shortcode_args = array();
1386
-			$output         = '';
1387
-			$no_wrap        = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1388
-			if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) {
1389
-				$no_wrap = true;
1390
-			}
1391
-			$main_content = $this->output( $args, $shortcode_args, $content );
1392
-			if ( $main_content && ! $no_wrap ) {
1393
-				// wrap the shortcode in a div with the same class as the widget
1394
-				$output .= '<div class="' . $class . '" ' . $attrs . '>';
1395
-				if ( ! empty( $args['title'] ) ) {
1396
-					// if its a shortcode and there is a title try to grab the title wrappers
1397
-					$shortcode_args = array( 'before_title' => '', 'after_title' => '' );
1398
-					if ( empty( $instance ) ) {
1399
-						global $wp_registered_sidebars;
1400
-						if ( ! empty( $wp_registered_sidebars ) ) {
1401
-							foreach ( $wp_registered_sidebars as $sidebar ) {
1402
-								if ( ! empty( $sidebar['before_title'] ) ) {
1403
-									$shortcode_args['before_title'] = $sidebar['before_title'];
1404
-									$shortcode_args['after_title']  = $sidebar['after_title'];
1405
-									break;
1406
-								}
1407
-							}
1408
-						}
1409
-					}
1410
-					$output .= $this->output_title( $shortcode_args, $args );
1411
-				}
1412
-				$output .= $main_content;
1413
-				$output .= '</div>';
1414
-			} elseif ( $main_content && $no_wrap ) {
1415
-				$output .= $main_content;
1416
-			}
1417
-
1418
-			// if preview show a placeholder if empty
1419
-			if ( $this->is_preview() && $output == '' ) {
1420
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
1421
-			}
1422
-
1423
-			return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
1424
-		}
1425
-
1426
-		/**
1427
-		 * Placeholder text to show if output is empty and we are on a preview/builder page.
1428
-		 *
1429
-		 * @param string $name
1430
-		 *
1431
-		 * @return string
1432
-		 */
1433
-		public function preview_placeholder_text( $name = '' ) {
1434
-			return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf( __( 'Placeholder for: %s' ), $name ) . "</div>";
1435
-		}
1436
-
1437
-		/**
1438
-		 * Sometimes booleans values can be turned to strings, so we fix that.
1439
-		 *
1440
-		 * @param $options
1441
-		 *
1442
-		 * @return mixed
1443
-		 */
1444
-		public function string_to_bool( $options ) {
1445
-			// convert bool strings to booleans
1446
-			foreach ( $options as $key => $val ) {
1447
-				if ( $val == 'false' ) {
1448
-					$options[ $key ] = false;
1449
-				} elseif ( $val == 'true' ) {
1450
-					$options[ $key ] = true;
1451
-				}
1452
-			}
1453
-
1454
-			return $options;
1455
-		}
1456
-
1457
-		/**
1458
-		 * Get the argument values that are also filterable.
1459
-		 *
1460
-		 * @param $instance
1461
-		 *
1462
-		 * @since 1.0.12 Don't set checkbox default value if the value is empty.
1463
-		 *
1464
-		 * @return array
1465
-		 */
1466
-		public function argument_values( $instance ) {
1467
-			$argument_values = array();
1468
-
1469
-			// set widget instance
1470
-			$this->instance = $instance;
1471
-
1472
-			if ( empty( $this->arguments ) ) {
1473
-				$this->arguments = $this->get_arguments();
1474
-			}
1475
-
1476
-			if ( ! empty( $this->arguments ) ) {
1477
-				foreach ( $this->arguments as $key => $args ) {
1478
-					// set the input name from the key
1479
-					$args['name'] = $key;
1480
-					//
1481
-					$argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
1482
-					if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
1483
-						// don't set default for an empty checkbox
1484
-					} elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
1485
-						$argument_values[ $key ] = $args['default'];
1486
-					}
1487
-				}
1488
-			}
1489
-
1490
-			return $argument_values;
1491
-		}
1492
-
1493
-		/**
1494
-		 * Set arguments in super duper.
1495
-		 *
1496
-		 * @since 1.0.0
1497
-		 *
1498
-		 * @return array Set arguments.
1499
-		 */
1500
-		public function set_arguments() {
1501
-			return $this->arguments;
1502
-		}
1503
-
1504
-		/**
1505
-		 * Get arguments in super duper.
1506
-		 *
1507
-		 * @since 1.0.0
1508
-		 *
1509
-		 * @return array Get arguments.
1510
-		 */
1511
-		public function get_arguments() {
1512
-			if ( empty( $this->arguments ) ) {
1513
-				$this->arguments = $this->set_arguments();
1514
-			}
1515
-
1516
-			$this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
1517
-			$this->arguments = $this->add_name_from_key( $this->arguments, true );
1518
-
1519
-			return $this->arguments;
1520
-		}
1521
-
1522
-		/**
1523
-		 * This is the main output class for all 3 items, widget, shortcode and block, it is extended in the calling class.
1524
-		 *
1525
-		 * @param array $args
1526
-		 * @param array $widget_args
1527
-		 * @param string $content
1528
-		 */
1529
-		public function output( $args = array(), $widget_args = array(), $content = '' ) {
1530
-
1531
-		}
1532
-
1533
-		/**
1534
-		 * Add the dynamic block code inline when the wp-block in enqueued.
1535
-		 */
1536
-		public function register_block() {
1537
-			wp_add_inline_script( 'wp-blocks', $this->block() );
1538
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
1539
-				wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() );
1540
-			}
1541
-		}
1542
-
1543
-		/**
1544
-		 * Check if we need to show advanced options.
1545
-		 *
1546
-		 * @return bool
1547
-		 */
1548
-		public function block_show_advanced() {
1549
-
1550
-			$show      = false;
1551
-			$arguments = $this->get_arguments();
1242
+            return str_replace( array(
1243
+                '<script>',
1244
+                '</script>'
1245
+            ), '', $output );
1246
+        }
1247
+
1248
+
1249
+        /**
1250
+         * Set the name from the argument key.
1251
+         *
1252
+         * @param $options
1253
+         *
1254
+         * @return mixed
1255
+         */
1256
+        private function add_name_from_key( $options, $arguments = false ) {
1257
+            if ( ! empty( $options['arguments'] ) ) {
1258
+                foreach ( $options['arguments'] as $key => $val ) {
1259
+                    $options['arguments'][ $key ]['name'] = $key;
1260
+                }
1261
+            } elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
1262
+                foreach ( $options as $key => $val ) {
1263
+                    $options[ $key ]['name'] = $key;
1264
+                }
1265
+            }
1266
+
1267
+            return $options;
1268
+        }
1269
+
1270
+        /**
1271
+         * Register the parent shortcode.
1272
+         *
1273
+         * @since 1.0.0
1274
+         */
1275
+        public function register_shortcode() {
1276
+            add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) );
1277
+            add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) );
1278
+        }
1279
+
1280
+        /**
1281
+         * Render the shortcode via ajax so we can return it to Gutenberg.
1282
+         *
1283
+         * @since 1.0.0
1284
+         */
1285
+        public function render_shortcode() {
1286
+            check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
1287
+            if ( ! current_user_can( 'manage_options' ) ) {
1288
+                wp_die();
1289
+            }
1290
+
1291
+            // we might need the $post value here so lets set it.
1292
+            if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
1293
+                $post_obj = get_post( absint( $_POST['post_id'] ) );
1294
+                if ( ! empty( $post_obj ) && empty( $post ) ) {
1295
+                    global $post;
1296
+                    $post = $post_obj;
1297
+                }
1298
+            }
1299
+
1300
+            if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) {
1301
+                $is_preview = $this->is_preview();
1302
+                $shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
1303
+                $attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
1304
+                $attributes       = '';
1305
+                if ( ! empty( $attributes_array ) ) {
1306
+                    foreach ( $attributes_array as $key => $value ) {
1307
+                        if ( is_array( $value ) ) {
1308
+                            $value = implode( ",", $value );
1309
+                        }
1310
+
1311
+                        if ( ! empty( $value ) ) {
1312
+                            $value = wp_unslash( $value );
1313
+
1314
+                            // Encode [ and ].
1315
+                            if ( $is_preview ) {
1316
+                                $value = $this->encode_shortcodes( $value );
1317
+                            }
1318
+                        }
1319
+                        $attributes .= " " . sanitize_title_with_dashes( $key ) . "='" . esc_attr( $value ) . "' ";
1320
+                    }
1321
+                }
1322
+
1323
+                $shortcode = "[" . $shortcode_name . " " . $attributes . "]";
1324
+
1325
+                $content = do_shortcode( $shortcode );
1326
+
1327
+                // Decode [ and ].
1328
+                if ( ! empty( $content ) && $is_preview ) {
1329
+                    $content = $this->decode_shortcodes( $content );
1330
+                }
1331
+
1332
+                echo $content;
1333
+            }
1334
+            wp_die();
1335
+        }
1336
+
1337
+        /**
1338
+         * Output the shortcode.
1339
+         *
1340
+         * @param array $args
1341
+         * @param string $content
1342
+         *
1343
+         * @return string
1344
+         */
1345
+        public function shortcode_output( $args = array(), $content = '' ) {
1346
+            $_instance = $args;
1347
+
1348
+            $args = $this->argument_values( $args );
1349
+
1350
+            // add extra argument so we know its a output to gutenberg
1351
+            //$args
1352
+            $args = $this->string_to_bool( $args );
1353
+
1354
+            // if we have a enclosed shortcode we add it to the special `html` argument
1355
+            if ( ! empty( $content ) ) {
1356
+                $args['html'] = $content;
1357
+            }
1358
+
1359
+            if ( ! $this->is_preview() ) {
1360
+                /**
1361
+                 * Filters the settings for a particular widget args.
1362
+                 *
1363
+                 * @since 1.0.28
1364
+                 *
1365
+                 * @param array          $args      The current widget instance's settings.
1366
+                 * @param WP_Super_Duper $widget    The current widget settings.
1367
+                 * @param array          $_instance An array of default widget arguments.
1368
+                 */
1369
+                $args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance );
1370
+
1371
+                if ( ! is_array( $args ) ) {
1372
+                    return $args;
1373
+                }
1374
+            }
1375
+
1376
+            $class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : '';
1377
+            $class .= " sdel-".$this->get_instance_hash();
1378
+
1379
+            $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
1380
+            $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
1381
+
1382
+            $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
1383
+            $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
1384
+
1385
+            $shortcode_args = array();
1386
+            $output         = '';
1387
+            $no_wrap        = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1388
+            if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) {
1389
+                $no_wrap = true;
1390
+            }
1391
+            $main_content = $this->output( $args, $shortcode_args, $content );
1392
+            if ( $main_content && ! $no_wrap ) {
1393
+                // wrap the shortcode in a div with the same class as the widget
1394
+                $output .= '<div class="' . $class . '" ' . $attrs . '>';
1395
+                if ( ! empty( $args['title'] ) ) {
1396
+                    // if its a shortcode and there is a title try to grab the title wrappers
1397
+                    $shortcode_args = array( 'before_title' => '', 'after_title' => '' );
1398
+                    if ( empty( $instance ) ) {
1399
+                        global $wp_registered_sidebars;
1400
+                        if ( ! empty( $wp_registered_sidebars ) ) {
1401
+                            foreach ( $wp_registered_sidebars as $sidebar ) {
1402
+                                if ( ! empty( $sidebar['before_title'] ) ) {
1403
+                                    $shortcode_args['before_title'] = $sidebar['before_title'];
1404
+                                    $shortcode_args['after_title']  = $sidebar['after_title'];
1405
+                                    break;
1406
+                                }
1407
+                            }
1408
+                        }
1409
+                    }
1410
+                    $output .= $this->output_title( $shortcode_args, $args );
1411
+                }
1412
+                $output .= $main_content;
1413
+                $output .= '</div>';
1414
+            } elseif ( $main_content && $no_wrap ) {
1415
+                $output .= $main_content;
1416
+            }
1417
+
1418
+            // if preview show a placeholder if empty
1419
+            if ( $this->is_preview() && $output == '' ) {
1420
+                $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
1421
+            }
1422
+
1423
+            return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
1424
+        }
1425
+
1426
+        /**
1427
+         * Placeholder text to show if output is empty and we are on a preview/builder page.
1428
+         *
1429
+         * @param string $name
1430
+         *
1431
+         * @return string
1432
+         */
1433
+        public function preview_placeholder_text( $name = '' ) {
1434
+            return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf( __( 'Placeholder for: %s' ), $name ) . "</div>";
1435
+        }
1436
+
1437
+        /**
1438
+         * Sometimes booleans values can be turned to strings, so we fix that.
1439
+         *
1440
+         * @param $options
1441
+         *
1442
+         * @return mixed
1443
+         */
1444
+        public function string_to_bool( $options ) {
1445
+            // convert bool strings to booleans
1446
+            foreach ( $options as $key => $val ) {
1447
+                if ( $val == 'false' ) {
1448
+                    $options[ $key ] = false;
1449
+                } elseif ( $val == 'true' ) {
1450
+                    $options[ $key ] = true;
1451
+                }
1452
+            }
1453
+
1454
+            return $options;
1455
+        }
1456
+
1457
+        /**
1458
+         * Get the argument values that are also filterable.
1459
+         *
1460
+         * @param $instance
1461
+         *
1462
+         * @since 1.0.12 Don't set checkbox default value if the value is empty.
1463
+         *
1464
+         * @return array
1465
+         */
1466
+        public function argument_values( $instance ) {
1467
+            $argument_values = array();
1468
+
1469
+            // set widget instance
1470
+            $this->instance = $instance;
1471
+
1472
+            if ( empty( $this->arguments ) ) {
1473
+                $this->arguments = $this->get_arguments();
1474
+            }
1475
+
1476
+            if ( ! empty( $this->arguments ) ) {
1477
+                foreach ( $this->arguments as $key => $args ) {
1478
+                    // set the input name from the key
1479
+                    $args['name'] = $key;
1480
+                    //
1481
+                    $argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
1482
+                    if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
1483
+                        // don't set default for an empty checkbox
1484
+                    } elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
1485
+                        $argument_values[ $key ] = $args['default'];
1486
+                    }
1487
+                }
1488
+            }
1489
+
1490
+            return $argument_values;
1491
+        }
1492
+
1493
+        /**
1494
+         * Set arguments in super duper.
1495
+         *
1496
+         * @since 1.0.0
1497
+         *
1498
+         * @return array Set arguments.
1499
+         */
1500
+        public function set_arguments() {
1501
+            return $this->arguments;
1502
+        }
1503
+
1504
+        /**
1505
+         * Get arguments in super duper.
1506
+         *
1507
+         * @since 1.0.0
1508
+         *
1509
+         * @return array Get arguments.
1510
+         */
1511
+        public function get_arguments() {
1512
+            if ( empty( $this->arguments ) ) {
1513
+                $this->arguments = $this->set_arguments();
1514
+            }
1515
+
1516
+            $this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
1517
+            $this->arguments = $this->add_name_from_key( $this->arguments, true );
1518
+
1519
+            return $this->arguments;
1520
+        }
1521
+
1522
+        /**
1523
+         * This is the main output class for all 3 items, widget, shortcode and block, it is extended in the calling class.
1524
+         *
1525
+         * @param array $args
1526
+         * @param array $widget_args
1527
+         * @param string $content
1528
+         */
1529
+        public function output( $args = array(), $widget_args = array(), $content = '' ) {
1530
+
1531
+        }
1532
+
1533
+        /**
1534
+         * Add the dynamic block code inline when the wp-block in enqueued.
1535
+         */
1536
+        public function register_block() {
1537
+            wp_add_inline_script( 'wp-blocks', $this->block() );
1538
+            if ( class_exists( 'SiteOrigin_Panels' ) ) {
1539
+                wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() );
1540
+            }
1541
+        }
1542
+
1543
+        /**
1544
+         * Check if we need to show advanced options.
1545
+         *
1546
+         * @return bool
1547
+         */
1548
+        public function block_show_advanced() {
1549
+
1550
+            $show      = false;
1551
+            $arguments = $this->get_arguments();
1552 1552
 			
1553
-			if ( ! empty( $arguments ) ) {
1554
-				foreach ( $arguments as $argument ) {
1555
-					if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1556
-						$show = true;
1557
-						break; // no need to continue if we know we have it
1558
-					}
1559
-				}
1560
-			}
1561
-
1562
-			return $show;
1563
-		}
1564
-
1565
-		/**
1566
-		 * Get the url path to the current folder.
1567
-		 *
1568
-		 * @return string
1569
-		 */
1570
-		public function get_url() {
1571
-
1572
-			$url = $this->url;
1573
-
1574
-			if ( ! $url ) {
1575
-				// check if we are inside a plugin
1576
-				$file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
1577
-
1578
-				$dir_parts = explode( "/wp-content/", $file_dir );
1579
-				$url_parts = explode( "/wp-content/", plugins_url() );
1580
-
1581
-				if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
1582
-					$url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
1583
-					$this->url = $url;
1584
-				}
1585
-			}
1586
-
1587
-
1588
-			return $url;
1589
-		}
1590
-
1591
-		/**
1592
-		 * Generate the block icon.
1593
-		 *
1594
-		 * Enables the use of Font Awesome icons.
1595
-		 *
1596
-		 * @note xlink:href is actually deprecated but href is not supported by all so we use both.
1597
-		 *
1598
-		 * @param $icon
1599
-		 *
1600
-		 * @since 1.1.0
1601
-		 * @return string
1602
-		 */
1603
-		public function get_block_icon( $icon ) {
1604
-
1605
-			// check if we have a Font Awesome icon
1606
-			$fa_type = '';
1607
-			if ( substr( $icon, 0, 7 ) === "fas fa-" ) {
1608
-				$fa_type = 'solid';
1609
-			} elseif ( substr( $icon, 0, 7 ) === "far fa-" ) {
1610
-				$fa_type = 'regular';
1611
-			} elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) {
1612
-				$fa_type = 'brands';
1613
-			} else {
1614
-				$icon = "'" . $icon . "'";
1615
-			}
1616
-
1617
-			// set the icon if we found one
1618
-			if ( $fa_type ) {
1619
-				$fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon );
1620
-				$icon    = "el('svg',{width: 20, height: 20, viewBox: '0 0 20 20'},el('use', {'xlink:href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "','href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "'}))";
1621
-			}
1622
-
1623
-			return $icon;
1624
-		}
1625
-
1626
-		public function group_arguments( $arguments ) {
1553
+            if ( ! empty( $arguments ) ) {
1554
+                foreach ( $arguments as $argument ) {
1555
+                    if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1556
+                        $show = true;
1557
+                        break; // no need to continue if we know we have it
1558
+                    }
1559
+                }
1560
+            }
1561
+
1562
+            return $show;
1563
+        }
1564
+
1565
+        /**
1566
+         * Get the url path to the current folder.
1567
+         *
1568
+         * @return string
1569
+         */
1570
+        public function get_url() {
1571
+
1572
+            $url = $this->url;
1573
+
1574
+            if ( ! $url ) {
1575
+                // check if we are inside a plugin
1576
+                $file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
1577
+
1578
+                $dir_parts = explode( "/wp-content/", $file_dir );
1579
+                $url_parts = explode( "/wp-content/", plugins_url() );
1580
+
1581
+                if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
1582
+                    $url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
1583
+                    $this->url = $url;
1584
+                }
1585
+            }
1586
+
1587
+
1588
+            return $url;
1589
+        }
1590
+
1591
+        /**
1592
+         * Generate the block icon.
1593
+         *
1594
+         * Enables the use of Font Awesome icons.
1595
+         *
1596
+         * @note xlink:href is actually deprecated but href is not supported by all so we use both.
1597
+         *
1598
+         * @param $icon
1599
+         *
1600
+         * @since 1.1.0
1601
+         * @return string
1602
+         */
1603
+        public function get_block_icon( $icon ) {
1604
+
1605
+            // check if we have a Font Awesome icon
1606
+            $fa_type = '';
1607
+            if ( substr( $icon, 0, 7 ) === "fas fa-" ) {
1608
+                $fa_type = 'solid';
1609
+            } elseif ( substr( $icon, 0, 7 ) === "far fa-" ) {
1610
+                $fa_type = 'regular';
1611
+            } elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) {
1612
+                $fa_type = 'brands';
1613
+            } else {
1614
+                $icon = "'" . $icon . "'";
1615
+            }
1616
+
1617
+            // set the icon if we found one
1618
+            if ( $fa_type ) {
1619
+                $fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon );
1620
+                $icon    = "el('svg',{width: 20, height: 20, viewBox: '0 0 20 20'},el('use', {'xlink:href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "','href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "'}))";
1621
+            }
1622
+
1623
+            return $icon;
1624
+        }
1625
+
1626
+        public function group_arguments( $arguments ) {
1627 1627
 //			echo '###';print_r($arguments);
1628
-			if ( ! empty( $arguments ) ) {
1629
-				$temp_arguments = array();
1630
-				$general        = __( "General" );
1631
-				$add_sections   = false;
1632
-				foreach ( $arguments as $key => $args ) {
1633
-					if ( isset( $args['group'] ) ) {
1634
-						$temp_arguments[ $args['group'] ][ $key ] = $args;
1635
-						$add_sections                             = true;
1636
-					} else {
1637
-						$temp_arguments[ $general ][ $key ] = $args;
1638
-					}
1639
-				}
1640
-
1641
-				// only add sections if more than one
1642
-				if ( $add_sections ) {
1643
-					$arguments = $temp_arguments;
1644
-				}
1645
-			}
1628
+            if ( ! empty( $arguments ) ) {
1629
+                $temp_arguments = array();
1630
+                $general        = __( "General" );
1631
+                $add_sections   = false;
1632
+                foreach ( $arguments as $key => $args ) {
1633
+                    if ( isset( $args['group'] ) ) {
1634
+                        $temp_arguments[ $args['group'] ][ $key ] = $args;
1635
+                        $add_sections                             = true;
1636
+                    } else {
1637
+                        $temp_arguments[ $general ][ $key ] = $args;
1638
+                    }
1639
+                }
1640
+
1641
+                // only add sections if more than one
1642
+                if ( $add_sections ) {
1643
+                    $arguments = $temp_arguments;
1644
+                }
1645
+            }
1646 1646
 
1647 1647
 //			echo '###';print_r($arguments);
1648
-			return $arguments;
1649
-		}
1650
-
1651
-
1652
-		/**
1653
-		 * Output the JS for building the dynamic Guntenberg block.
1654
-		 *
1655
-		 * @since 1.0.4 Added block_wrap property which will set the block wrapping output element ie: div, span, p or empty for no wrap.
1656
-		 * @since 1.0.9 Save numbers as numbers and not strings.
1657
-		 * @since 1.1.0 Font Awesome classes can be used for icons.
1658
-		 * @return mixed
1659
-		 */
1660
-		public function block() {
1661
-			ob_start();
1662
-
1663
-			$show_advanced = $this->block_show_advanced();
1664
-			?>
1648
+            return $arguments;
1649
+        }
1650
+
1651
+
1652
+        /**
1653
+         * Output the JS for building the dynamic Guntenberg block.
1654
+         *
1655
+         * @since 1.0.4 Added block_wrap property which will set the block wrapping output element ie: div, span, p or empty for no wrap.
1656
+         * @since 1.0.9 Save numbers as numbers and not strings.
1657
+         * @since 1.1.0 Font Awesome classes can be used for icons.
1658
+         * @return mixed
1659
+         */
1660
+        public function block() {
1661
+            ob_start();
1662
+
1663
+            $show_advanced = $this->block_show_advanced();
1664
+            ?>
1665 1665
 			<script>
1666 1666
 				/**
1667 1667
 				 * BLOCK: Basic
@@ -1705,97 +1705,97 @@  discard block
 block discarded – undo
1705 1705
 						icon: <?php echo $this->get_block_icon( $this->options['block-icon'] );?>,//'<?php echo isset( $this->options['block-icon'] ) ? esc_attr( $this->options['block-icon'] ) : 'shield-alt';?>', // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
1706 1706
 						supports: {
1707 1707
 							<?php
1708
-							if ( isset( $this->options['block-supports'] ) ) {
1709
-								echo $this->array_to_attributes( $this->options['block-supports'] );
1710
-							}
1711
-							?>
1708
+                            if ( isset( $this->options['block-supports'] ) ) {
1709
+                                echo $this->array_to_attributes( $this->options['block-supports'] );
1710
+                            }
1711
+                            ?>
1712 1712
 						},
1713 1713
 						category: '<?php echo isset( $this->options['block-category'] ) ? esc_attr( $this->options['block-category'] ) : 'common';?>', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
1714 1714
 						<?php if ( isset( $this->options['block-keywords'] ) ) {
1715
-						echo "keywords : " . $this->options['block-keywords'] . ",";
1716
-					}?>
1715
+                        echo "keywords : " . $this->options['block-keywords'] . ",";
1716
+                    }?>
1717 1717
 
1718 1718
 						<?php
1719 1719
 
1720
-						// maybe set no_wrap
1721
-						$no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1722
-						if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) {
1723
-							$no_wrap = true;
1724
-						}
1725
-						if ( $no_wrap ) {
1726
-							$this->options['block-wrap'] = '';
1727
-						}
1720
+                        // maybe set no_wrap
1721
+                        $no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1722
+                        if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) {
1723
+                            $no_wrap = true;
1724
+                        }
1725
+                        if ( $no_wrap ) {
1726
+                            $this->options['block-wrap'] = '';
1727
+                        }
1728 1728
 
1729 1729
 
1730 1730
 
1731
-						$show_alignment = false;
1732
-						// align feature
1733
-						/*echo "supports: {";
1731
+                        $show_alignment = false;
1732
+                        // align feature
1733
+                        /*echo "supports: {";
1734 1734
 						echo "	align: true,";
1735 1735
 						echo "  html: false";
1736 1736
 						echo "},";*/
1737 1737
 
1738
-						if ( ! empty( $this->arguments ) ) {
1739
-							echo "attributes : {";
1740
-
1741
-							if ( $show_advanced ) {
1742
-								echo "show_advanced: {";
1743
-								echo "	type: 'boolean',";
1744
-								echo "  default: false,";
1745
-								echo "},";
1746
-							}
1747
-
1748
-							// block wrap element
1749
-							if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this?
1750
-								echo "block_wrap: {";
1751
-								echo "	type: 'string',";
1752
-								echo "  default: '" . esc_attr( $this->options['block-wrap'] ) . "',";
1753
-								echo "},";
1754
-							}
1755
-
1756
-							foreach ( $this->arguments as $key => $args ) {
1757
-
1758
-								// set if we should show alignment
1759
-								if ( $key == 'alignment' ) {
1760
-									$show_alignment = true;
1761
-								}
1762
-
1763
-								$extra = '';
1764
-
1765
-								if ( $args['type'] == 'checkbox' ) {
1766
-									$type    = 'boolean';
1767
-									$default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false';
1768
-								} elseif ( $args['type'] == 'number' ) {
1769
-									$type    = 'number';
1770
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
1771
-								} elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
1772
-									$type = 'array';
1773
-									if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
1774
-										$default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]";
1775
-									} else {
1776
-										$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
1777
-									}
1778
-								} elseif ( $args['type'] == 'multiselect' ) {
1779
-									$type    = 'array';
1780
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
1781
-								} else {
1782
-									$type    = 'string';
1783
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
1784
-								}
1785
-								echo $key . " : {";
1786
-								echo "type : '$type',";
1787
-								echo "default : $default,";
1788
-								echo "},";
1789
-							}
1790
-
1791
-							echo "content : {type : 'string',default: 'Please select the attributes in the block settings'},";
1792
-							echo "className: { type: 'string', default: '' },";
1793
-
1794
-							echo "},";
1795
-
1796
-						}
1797
-
1798
-						?>
1738
+                        if ( ! empty( $this->arguments ) ) {
1739
+                            echo "attributes : {";
1740
+
1741
+                            if ( $show_advanced ) {
1742
+                                echo "show_advanced: {";
1743
+                                echo "	type: 'boolean',";
1744
+                                echo "  default: false,";
1745
+                                echo "},";
1746
+                            }
1747
+
1748
+                            // block wrap element
1749
+                            if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this?
1750
+                                echo "block_wrap: {";
1751
+                                echo "	type: 'string',";
1752
+                                echo "  default: '" . esc_attr( $this->options['block-wrap'] ) . "',";
1753
+                                echo "},";
1754
+                            }
1755
+
1756
+                            foreach ( $this->arguments as $key => $args ) {
1757
+
1758
+                                // set if we should show alignment
1759
+                                if ( $key == 'alignment' ) {
1760
+                                    $show_alignment = true;
1761
+                                }
1762
+
1763
+                                $extra = '';
1764
+
1765
+                                if ( $args['type'] == 'checkbox' ) {
1766
+                                    $type    = 'boolean';
1767
+                                    $default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false';
1768
+                                } elseif ( $args['type'] == 'number' ) {
1769
+                                    $type    = 'number';
1770
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
1771
+                                } elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
1772
+                                    $type = 'array';
1773
+                                    if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
1774
+                                        $default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]";
1775
+                                    } else {
1776
+                                        $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
1777
+                                    }
1778
+                                } elseif ( $args['type'] == 'multiselect' ) {
1779
+                                    $type    = 'array';
1780
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
1781
+                                } else {
1782
+                                    $type    = 'string';
1783
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
1784
+                                }
1785
+                                echo $key . " : {";
1786
+                                echo "type : '$type',";
1787
+                                echo "default : $default,";
1788
+                                echo "},";
1789
+                            }
1790
+
1791
+                            echo "content : {type : 'string',default: 'Please select the attributes in the block settings'},";
1792
+                            echo "className: { type: 'string', default: '' },";
1793
+
1794
+                            echo "},";
1795
+
1796
+                        }
1797
+
1798
+                        ?>
1799 1799
 
1800 1800
 						// The "edit" property must be a valid function.
1801 1801
 						edit: function (props) {
@@ -1803,9 +1803,9 @@  discard block
 block discarded – undo
1803 1803
 
1804 1804
 							var $value = '';
1805 1805
 							<?php
1806
-							// if we have a post_type and a category then link them
1807
-							if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){
1808
-							?>
1806
+                            // if we have a post_type and a category then link them
1807
+                            if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){
1808
+                            ?>
1809 1809
 							if(typeof(prev_attributes[props.id]) != 'undefined' ){
1810 1810
 								$pt = props.attributes.post_type;
1811 1811
 								if(post_type_rest_slugs.length){
@@ -1889,8 +1889,8 @@  discard block
 block discarded – undo
1889 1889
 										'shortcode': '<?php echo $this->options['base_id'];?>',
1890 1890
 										'attributes': props.attributes,
1891 1891
 										'post_id': <?php global $post; if ( isset( $post->ID ) ) {
1892
-										echo $post->ID;
1893
-									}else{echo '0';}?>,
1892
+                                        echo $post->ID;
1893
+                                    }else{echo '0';}?>,
1894 1894
 										'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
1895 1895
 									};
1896 1896
 
@@ -1942,10 +1942,10 @@  discard block
 block discarded – undo
1942 1942
 
1943 1943
 									<?php
1944 1944
 
1945
-									if(! empty( $this->arguments )){
1945
+                                    if(! empty( $this->arguments )){
1946 1946
 
1947
-									if ( $show_advanced ) {
1948
-									?>
1947
+                                    if ( $show_advanced ) {
1948
+                                    ?>
1949 1949
 									el('div', {
1950 1950
 											style: {'padding-left': '16px','padding-right': '16px'}
1951 1951
 										},
@@ -1963,79 +1963,79 @@  discard block
 block discarded – undo
1963 1963
 									,
1964 1964
 									<?php
1965 1965
 
1966
-									}
1966
+                                    }
1967 1967
 
1968
-									$arguments = $this->group_arguments( $this->arguments );
1968
+                                    $arguments = $this->group_arguments( $this->arguments );
1969 1969
 
1970
-									// Do we have sections?
1971
-									$has_sections = $arguments == $this->arguments ? false : true;
1970
+                                    // Do we have sections?
1971
+                                    $has_sections = $arguments == $this->arguments ? false : true;
1972 1972
 
1973 1973
 
1974
-									if($has_sections){
1975
-									$panel_count = 0;
1976
-									foreach($arguments as $key => $args){
1977
-									?>
1974
+                                    if($has_sections){
1975
+                                    $panel_count = 0;
1976
+                                    foreach($arguments as $key => $args){
1977
+                                    ?>
1978 1978
 									el(wp.components.PanelBody, {
1979 1979
 											title: '<?php esc_attr_e( $key ); ?>',
1980 1980
 											initialOpen: <?php if ( $panel_count ) {
1981
-											echo "false";
1982
-										} else {
1983
-											echo "true";
1984
-										}?>
1981
+                                            echo "false";
1982
+                                        } else {
1983
+                                            echo "true";
1984
+                                        }?>
1985 1985
 										},
1986 1986
 										<?php
1987 1987
 
1988 1988
 
1989 1989
 
1990
-										foreach ( $args as $k => $a ) {
1990
+                                        foreach ( $args as $k => $a ) {
1991 1991
 
1992
-											$this->block_row_start( $k, $a );
1993
-											$this->build_block_arguments( $k, $a );
1994
-											$this->block_row_end( $k, $a );
1995
-										}
1996
-										?>
1992
+                                            $this->block_row_start( $k, $a );
1993
+                                            $this->build_block_arguments( $k, $a );
1994
+                                            $this->block_row_end( $k, $a );
1995
+                                        }
1996
+                                        ?>
1997 1997
 									),
1998 1998
 									<?php
1999
-									$panel_count ++;
1999
+                                    $panel_count ++;
2000 2000
 
2001
-									}
2002
-									}else {
2003
-									?>
2001
+                                    }
2002
+                                    }else {
2003
+                                    ?>
2004 2004
 									el(wp.components.PanelBody, {
2005 2005
 											title: '<?php esc_attr_e( "Settings" ); ?>',
2006 2006
 											initialOpen: true
2007 2007
 										},
2008 2008
 										<?php
2009
-										foreach ( $this->arguments as $key => $args ) {
2010
-											$this->block_row_start( $key, $args );
2011
-											$this->build_block_arguments( $key, $args );
2012
-											$this->block_row_end( $key, $args );
2013
-										}
2014
-										?>
2009
+                                        foreach ( $this->arguments as $key => $args ) {
2010
+                                            $this->block_row_start( $key, $args );
2011
+                                            $this->build_block_arguments( $key, $args );
2012
+                                            $this->block_row_end( $key, $args );
2013
+                                        }
2014
+                                        ?>
2015 2015
 									),
2016 2016
 									<?php
2017
-									}
2017
+                                    }
2018 2018
 
2019
-									}
2020
-									?>
2019
+                                    }
2020
+                                    ?>
2021 2021
 
2022 2022
 								),
2023 2023
 
2024 2024
 								<?php
2025
-								// If the user sets block-output array then build it
2026
-								if ( ! empty( $this->options['block-output'] ) ) {
2027
-								$this->block_element( $this->options['block-output'] );
2028
-							}else{
2029
-								// if no block-output is set then we try and get the shortcode html output via ajax.
2030
-								?>
2025
+                                // If the user sets block-output array then build it
2026
+                                if ( ! empty( $this->options['block-output'] ) ) {
2027
+                                $this->block_element( $this->options['block-output'] );
2028
+                            }else{
2029
+                                // if no block-output is set then we try and get the shortcode html output via ajax.
2030
+                                ?>
2031 2031
 								el('div', {
2032 2032
 									dangerouslySetInnerHTML: {__html: onChangeContent()},
2033 2033
 									className: props.className,
2034 2034
 									style: {'minHeight': '30px'}
2035 2035
 								})
2036 2036
 								<?php
2037
-								}
2038
-								?>
2037
+                                }
2038
+                                ?>
2039 2039
 							]; // end return
2040 2040
 						},
2041 2041
 
@@ -2053,10 +2053,10 @@  discard block
 block discarded – undo
2053 2053
 							$html = '';
2054 2054
 							<?php
2055 2055
 
2056
-							if(! empty( $this->arguments )){
2056
+                            if(! empty( $this->arguments )){
2057 2057
 
2058
-							foreach($this->arguments as $key => $args){
2059
-							?>
2058
+                            foreach($this->arguments as $key => $args){
2059
+                            ?>
2060 2060
 							if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
2061 2061
 								if ('<?php echo esc_attr( $key );?>' == 'html') {
2062 2062
 									$html = attr.<?php echo esc_attr( $key );?>;
@@ -2065,10 +2065,10 @@  discard block
 block discarded – undo
2065 2065
 								}
2066 2066
 							}
2067 2067
 							<?php
2068
-							}
2069
-							}
2068
+                            }
2069
+                            }
2070 2070
 
2071
-							?>
2071
+                            ?>
2072 2072
 							content += "]";
2073 2073
 
2074 2074
 							// if has html element
@@ -2091,20 +2091,20 @@  discard block
 block discarded – undo
2091 2091
 							}
2092 2092
 
2093 2093
 							<?php
2094
-							if(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
2095
-							?>
2094
+                            if(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
2095
+                            ?>
2096 2096
 							return content;
2097 2097
 							<?php
2098
-							}else{
2099
-							?>
2098
+                            }else{
2099
+                            ?>
2100 2100
 							var block_wrap = 'div';
2101 2101
 							if (attr.hasOwnProperty("block_wrap")) {
2102 2102
 								block_wrap = attr.block_wrap;
2103 2103
 							}
2104 2104
 							return el(block_wrap, {dangerouslySetInnerHTML: {__html: content}, className: align});
2105 2105
 							<?php
2106
-							}
2107
-							?>
2106
+                            }
2107
+                            ?>
2108 2108
 
2109 2109
 
2110 2110
 						}
@@ -2112,30 +2112,30 @@  discard block
 block discarded – undo
2112 2112
 				})();
2113 2113
 			</script>
2114 2114
 			<?php
2115
-			$output = ob_get_clean();
2115
+            $output = ob_get_clean();
2116 2116
 
2117
-			/*
2117
+            /*
2118 2118
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
2119 2119
 			 */
2120 2120
 
2121
-			return str_replace( array(
2122
-				'<script>',
2123
-				'</script>'
2124
-			), '', $output );
2125
-		}
2121
+            return str_replace( array(
2122
+                '<script>',
2123
+                '</script>'
2124
+            ), '', $output );
2125
+        }
2126 2126
 
2127
-		public function block_row_start($key, $args){
2127
+        public function block_row_start($key, $args){
2128 2128
 
2129
-			// check for row
2130
-			if(!empty($args['row'])){
2129
+            // check for row
2130
+            if(!empty($args['row'])){
2131 2131
 
2132
-				if(!empty($args['row']['open'])){
2132
+                if(!empty($args['row']['open'])){
2133 2133
 
2134
-				// element require
2135
-				$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
2136
-				echo $element_require;
2134
+                // element require
2135
+                $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
2136
+                echo $element_require;
2137 2137
 
2138
-					if(false){?><script><?php }?>
2138
+                    if(false){?><script><?php }?>
2139 2139
 						el('div', {
2140 2140
 								className: 'bsui components-base-control',
2141 2141
 							},
@@ -2165,87 +2165,87 @@  discard block
 block discarded – undo
2165 2165
 									},
2166 2166
 
2167 2167
 					<?php
2168
-					if(false){?></script><?php }
2169
-				}elseif(!empty($args['row']['close'])){
2170
-					if(false){?><script><?php }?>
2168
+                    if(false){?></script><?php }
2169
+                }elseif(!empty($args['row']['close'])){
2170
+                    if(false){?><script><?php }?>
2171 2171
 						el(
2172 2172
 							'div',
2173 2173
 							{
2174 2174
 								className: 'col pl-0',
2175 2175
 							},
2176 2176
 					<?php
2177
-					if(false){?></script><?php }
2178
-				}else{
2179
-					if(false){?><script><?php }?>
2177
+                    if(false){?></script><?php }
2178
+                }else{
2179
+                    if(false){?><script><?php }?>
2180 2180
 						el(
2181 2181
 							'div',
2182 2182
 							{
2183 2183
 								className: 'col pl-0 pr-2',
2184 2184
 							},
2185 2185
 					<?php
2186
-					if(false){?></script><?php }
2187
-				}
2188
-
2189
-			}
2190
-
2191
-		}
2192
-
2193
-		public function block_row_end($key, $args){
2194
-
2195
-			if(!empty($args['row'])){
2196
-				// maybe close
2197
-				if(!empty($args['row']['close'])){
2198
-					echo "))";
2199
-				}
2200
-
2201
-				echo "),";
2202
-			}
2203
-		}
2204
-
2205
-		public function build_block_arguments( $key, $args ) {
2206
-			$custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : '';
2207
-			$options           = '';
2208
-			$extra             = '';
2209
-			$require           = '';
2210
-
2211
-			// `content` is a protected and special argument
2212
-			if ( $key == 'content' ) {
2213
-				return;
2214
-			}
2215
-
2216
-
2217
-			// icon
2218
-			$icon = '';
2219
-			if( !empty( $args['icon'] ) ){
2220
-				$icon .= "el('div', {";
2221
-									$icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},";
2222
-									$icon .= "className: 'text-center',";
2223
-									$icon .= "title: '".addslashes( $args['title'] )."',";
2224
-								$icon .= "}),";
2225
-
2226
-				// blank title as its added to the icon.
2227
-				$args['title'] = '';
2228
-			}
2229
-
2230
-			// require advanced
2231
-			$require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
2232
-
2233
-			// element require
2234
-			$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
2235
-
2236
-
2237
-			$onchange  = "props.setAttributes({ $key: $key } )";
2238
-			$onchangecomplete  = "";
2239
-			$value     = "props.attributes.$key";
2240
-			$text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx' );
2241
-			if ( in_array( $args['type'], $text_type ) ) {
2242
-				$type = 'TextControl';
2243
-				// Save numbers as numbers and not strings
2244
-				if ( $args['type'] == 'number' ) {
2245
-					$onchange = "props.setAttributes({ $key: Number($key) } )";
2246
-				}
2247
-			}
2248
-			/*
2186
+                    if(false){?></script><?php }
2187
+                }
2188
+
2189
+            }
2190
+
2191
+        }
2192
+
2193
+        public function block_row_end($key, $args){
2194
+
2195
+            if(!empty($args['row'])){
2196
+                // maybe close
2197
+                if(!empty($args['row']['close'])){
2198
+                    echo "))";
2199
+                }
2200
+
2201
+                echo "),";
2202
+            }
2203
+        }
2204
+
2205
+        public function build_block_arguments( $key, $args ) {
2206
+            $custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : '';
2207
+            $options           = '';
2208
+            $extra             = '';
2209
+            $require           = '';
2210
+
2211
+            // `content` is a protected and special argument
2212
+            if ( $key == 'content' ) {
2213
+                return;
2214
+            }
2215
+
2216
+
2217
+            // icon
2218
+            $icon = '';
2219
+            if( !empty( $args['icon'] ) ){
2220
+                $icon .= "el('div', {";
2221
+                                    $icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},";
2222
+                                    $icon .= "className: 'text-center',";
2223
+                                    $icon .= "title: '".addslashes( $args['title'] )."',";
2224
+                                $icon .= "}),";
2225
+
2226
+                // blank title as its added to the icon.
2227
+                $args['title'] = '';
2228
+            }
2229
+
2230
+            // require advanced
2231
+            $require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
2232
+
2233
+            // element require
2234
+            $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
2235
+
2236
+
2237
+            $onchange  = "props.setAttributes({ $key: $key } )";
2238
+            $onchangecomplete  = "";
2239
+            $value     = "props.attributes.$key";
2240
+            $text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx' );
2241
+            if ( in_array( $args['type'], $text_type ) ) {
2242
+                $type = 'TextControl';
2243
+                // Save numbers as numbers and not strings
2244
+                if ( $args['type'] == 'number' ) {
2245
+                    $onchange = "props.setAttributes({ $key: Number($key) } )";
2246
+                }
2247
+            }
2248
+            /*
2249 2249
 			 * https://www.wptricks.com/question/set-current-tab-on-a-gutenberg-tabpanel-component-from-outside-that-component/ es5 layout
2250 2250
 						elseif($args['type']=='tabs'){
2251 2251
 							?>
@@ -2279,85 +2279,85 @@  discard block
 block discarded – undo
2279 2279
 							return;
2280 2280
 						}
2281 2281
 			*/
2282
-			elseif ( $args['type'] == 'color' ) {
2283
-				$type = 'ColorPicker';
2284
-				$onchange = "";
2285
-				$extra = "color: $value,";
2286
-				if(!empty($args['disable_alpha'])){
2287
-					$extra .= "disableAlpha: true,";
2288
-				}
2289
-				$onchangecomplete = "onChangeComplete: function($key) {
2282
+            elseif ( $args['type'] == 'color' ) {
2283
+                $type = 'ColorPicker';
2284
+                $onchange = "";
2285
+                $extra = "color: $value,";
2286
+                if(!empty($args['disable_alpha'])){
2287
+                    $extra .= "disableAlpha: true,";
2288
+                }
2289
+                $onchangecomplete = "onChangeComplete: function($key) {
2290 2290
 				value =  $key.rgb.a && $key.rgb.a < 1 ? \"rgba(\"+$key.rgb.r+\",\"+$key.rgb.g+\",\"+$key.rgb.b+\",\"+$key.rgb.a+\")\" : $key.hex;
2291 2291
                         props.setAttributes({
2292 2292
                             $key: value
2293 2293
                         });
2294 2294
                     },";
2295
-			}
2296
-			elseif ( $args['type'] == 'checkbox' ) {
2297
-				$type = 'CheckboxControl';
2298
-				$extra .= "checked: props.attributes.$key,";
2299
-				$onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
2300
-			} elseif ( $args['type'] == 'textarea' ) {
2301
-				$type = 'TextareaControl';
2302
-			} elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
2303
-				$type = 'SelectControl';
2304
-
2305
-				if($args['name'] == 'category' && !empty($args['post_type_linked'])){
2306
-					$options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
2307
-				}elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
2308
-					$options .= "options: sort_by_".str_replace("-","_", $this->id).",";
2309
-				}else {
2310
-
2311
-					if ( ! empty( $args['options'] ) ) {
2312
-						$options .= "options: [";
2313
-						foreach ( $args['options'] as $option_val => $option_label ) {
2314
-							$options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . addslashes( $option_label ) . "' },";
2315
-						}
2316
-						$options .= "],";
2317
-					}
2318
-				}
2319
-				if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
2320
-					$extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px"}, ';
2321
-				}
2322
-			} elseif ( $args['type'] == 'alignment' ) {
2323
-				$type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
2324
-			}elseif ( $args['type'] == 'margins' ) {
2325
-
2326
-			} else {
2327
-				return;// if we have not implemented the control then don't break the JS.
2328
-			}
2329
-
2330
-
2331
-
2332
-			// color input does not show the labels so we add them
2333
-			if($args['type']=='color'){
2334
-				// add show only if advanced
2335
-				echo $require_advanced;
2336
-				// add setting require if defined
2337
-				echo $element_require;
2338
-				echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
2339
-			}
2340
-
2341
-			// add show only if advanced
2342
-			echo $require_advanced;
2343
-			// add setting require if defined
2344
-			echo $element_require;
2345
-
2346
-			// icon
2347
-			echo $icon;
2348
-			?>
2295
+            }
2296
+            elseif ( $args['type'] == 'checkbox' ) {
2297
+                $type = 'CheckboxControl';
2298
+                $extra .= "checked: props.attributes.$key,";
2299
+                $onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
2300
+            } elseif ( $args['type'] == 'textarea' ) {
2301
+                $type = 'TextareaControl';
2302
+            } elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
2303
+                $type = 'SelectControl';
2304
+
2305
+                if($args['name'] == 'category' && !empty($args['post_type_linked'])){
2306
+                    $options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
2307
+                }elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
2308
+                    $options .= "options: sort_by_".str_replace("-","_", $this->id).",";
2309
+                }else {
2310
+
2311
+                    if ( ! empty( $args['options'] ) ) {
2312
+                        $options .= "options: [";
2313
+                        foreach ( $args['options'] as $option_val => $option_label ) {
2314
+                            $options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . addslashes( $option_label ) . "' },";
2315
+                        }
2316
+                        $options .= "],";
2317
+                    }
2318
+                }
2319
+                if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
2320
+                    $extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px"}, ';
2321
+                }
2322
+            } elseif ( $args['type'] == 'alignment' ) {
2323
+                $type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
2324
+            }elseif ( $args['type'] == 'margins' ) {
2325
+
2326
+            } else {
2327
+                return;// if we have not implemented the control then don't break the JS.
2328
+            }
2329
+
2330
+
2331
+
2332
+            // color input does not show the labels so we add them
2333
+            if($args['type']=='color'){
2334
+                // add show only if advanced
2335
+                echo $require_advanced;
2336
+                // add setting require if defined
2337
+                echo $element_require;
2338
+                echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
2339
+            }
2340
+
2341
+            // add show only if advanced
2342
+            echo $require_advanced;
2343
+            // add setting require if defined
2344
+            echo $element_require;
2345
+
2346
+            // icon
2347
+            echo $icon;
2348
+            ?>
2349 2349
 			el( wp.components.<?php echo $type; ?>, {
2350 2350
 			label: '<?php echo addslashes( $args['title'] ); ?>',
2351 2351
 			help: '<?php if ( isset( $args['desc'] ) ) {
2352
-				echo addslashes( $args['desc'] );
2353
-			} ?>',
2352
+                echo addslashes( $args['desc'] );
2353
+            } ?>',
2354 2354
 			value: <?php echo $value; ?>,
2355 2355
 			<?php if ( $type == 'TextControl' && $args['type'] != 'text' ) {
2356
-				echo "type: '" . addslashes( $args['type'] ) . "',";
2357
-			} ?>
2356
+                echo "type: '" . addslashes( $args['type'] ) . "',";
2357
+            } ?>
2358 2358
 			<?php if ( ! empty( $args['placeholder'] ) ) {
2359
-				echo "placeholder: '" . addslashes( $args['placeholder'] ) . "',";
2360
-			} ?>
2359
+                echo "placeholder: '" . addslashes( $args['placeholder'] ) . "',";
2360
+            } ?>
2361 2361
 			<?php echo $options; ?>
2362 2362
 			<?php echo $extra; ?>
2363 2363
 			<?php echo $custom_attributes; ?>
@@ -2369,608 +2369,608 @@  discard block
 block discarded – undo
2369 2369
 			<?php
2370 2370
 
2371 2371
 
2372
-		}
2373
-
2374
-		/**
2375
-		 * Convert an array of attributes to block string.
2376
-		 *
2377
-		 * @todo there is prob a faster way to do this, also we could add some validation here.
2378
-		 *
2379
-		 * @param $custom_attributes
2380
-		 *
2381
-		 * @return string
2382
-		 */
2383
-		public function array_to_attributes( $custom_attributes, $html = false ) {
2384
-			$attributes = '';
2385
-			if ( ! empty( $custom_attributes ) ) {
2386
-
2387
-				if ( $html ) {
2388
-					foreach ( $custom_attributes as $key => $val ) {
2389
-						$attributes .= " $key='$val' ";
2390
-					}
2391
-				} else {
2392
-					foreach ( $custom_attributes as $key => $val ) {
2393
-						$attributes .= "'$key': '$val',";
2394
-					}
2395
-				}
2396
-			}
2397
-
2398
-			return $attributes;
2399
-		}
2400
-
2401
-		/**
2402
-		 * A self looping function to create the output for JS block elements.
2403
-		 *
2404
-		 * This is what is output in the WP Editor visual view.
2405
-		 *
2406
-		 * @param $args
2407
-		 */
2408
-		public function block_element( $args ) {
2409
-
2410
-
2411
-			if ( ! empty( $args ) ) {
2412
-				foreach ( $args as $element => $new_args ) {
2413
-
2414
-					if ( is_array( $new_args ) ) { // its an element
2415
-
2416
-
2417
-						if ( isset( $new_args['element'] ) ) {
2418
-
2419
-							if ( isset( $new_args['element_require'] ) ) {
2420
-								echo str_replace( array(
2421
-										"'+",
2422
-										"+'"
2423
-									), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
2424
-								unset( $new_args['element_require'] );
2425
-							}
2426
-
2427
-							echo "\n el( '" . $new_args['element'] . "', {";
2428
-
2429
-							// get the attributes
2430
-							foreach ( $new_args as $new_key => $new_value ) {
2431
-
2432
-
2433
-								if ( $new_key == 'element' || $new_key == 'content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
2434
-									// do nothing
2435
-								} else {
2436
-									echo $this->block_element( array( $new_key => $new_value ) );
2437
-								}
2438
-							}
2439
-
2440
-							echo "},";// end attributes
2441
-
2442
-							// get the content
2443
-							$first_item = 0;
2444
-							foreach ( $new_args as $new_key => $new_value ) {
2445
-								if ( $new_key === 'content' || is_array( $new_value ) ) {
2446
-
2447
-									if ( $new_key === 'content' ) {
2448
-										echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
2449
-									}
2450
-
2451
-									if ( is_array( $new_value ) ) {
2452
-
2453
-										if ( isset( $new_value['element_require'] ) ) {
2454
-											echo str_replace( array(
2455
-													"'+",
2456
-													"+'"
2457
-												), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
2458
-											unset( $new_value['element_require'] );
2459
-										}
2460
-
2461
-										if ( isset( $new_value['element_repeat'] ) ) {
2462
-											$x = 1;
2463
-											while ( $x <= absint( $new_value['element_repeat'] ) ) {
2464
-												$this->block_element( array( '' => $new_value ) );
2465
-												$x ++;
2466
-											}
2467
-										} else {
2468
-											$this->block_element( array( '' => $new_value ) );
2469
-										}
2470
-									}
2471
-									$first_item ++;
2472
-								}
2473
-							}
2474
-
2475
-							echo ")";// end content
2476
-
2477
-							echo ", \n";
2478
-
2479
-						}
2480
-					} else {
2481
-
2482
-						if ( substr( $element, 0, 3 ) === "if_" ) {
2483
-							echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
2484
-						} elseif ( $element == 'style' ) {
2485
-							echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
2486
-						} else {
2487
-							echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
2488
-						}
2489
-
2490
-					}
2491
-				}
2492
-			}
2493
-		}
2494
-
2495
-		/**
2496
-		 * Replace block attributes placeholders with the proper naming.
2497
-		 *
2498
-		 * @param $string
2499
-		 *
2500
-		 * @return mixed
2501
-		 */
2502
-		public function block_props_replace( $string, $no_wrap = false ) {
2503
-
2504
-			if ( $no_wrap ) {
2505
-				$string = str_replace( array( "[%", "%]" ), array( "props.attributes.", "" ), $string );
2506
-			} else {
2507
-				$string = str_replace( array( "[%", "%]" ), array( "'+props.attributes.", "+'" ), $string );
2508
-			}
2509
-
2510
-			return $string;
2511
-		}
2512
-
2513
-		/**
2514
-		 * Outputs the content of the widget
2515
-		 *
2516
-		 * @param array $args
2517
-		 * @param array $instance
2518
-		 */
2519
-		public function widget( $args, $instance ) {
2520
-
2521
-			// get the filtered values
2522
-			$argument_values = $this->argument_values( $instance );
2523
-			$argument_values = $this->string_to_bool( $argument_values );
2524
-			$output          = $this->output( $argument_values, $args );
2525
-
2526
-			$no_wrap = false;
2527
-			if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
2528
-				$no_wrap = true;
2529
-			}
2530
-
2531
-			ob_start();
2532
-			if ( $output && ! $no_wrap ) {
2533
-
2534
-				$class_original = $this->options['widget_ops']['classname'];
2535
-				$class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
2536
-
2537
-				// Before widget
2538
-				$before_widget = $args['before_widget'];
2539
-				$before_widget = str_replace($class_original,$class,$before_widget);
2540
-				$before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
2541
-				$before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
2542
-
2543
-				// After widget
2544
-				$after_widget = $args['after_widget'];
2545
-				$after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
2546
-				$after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
2547
-
2548
-				echo $before_widget;
2549
-				// elementor strips the widget wrapping div so we check for and add it back if needed
2550
-				if ( $this->is_elementor_widget_output() ) {
2551
-					// Filter class & attrs for elementor widget output.
2552
-					$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
2553
-					$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
2554
-
2555
-					$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
2556
-					$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
2557
-
2558
-					echo "<span class='" . esc_attr( $class  ) . "' " . $attrs . ">";
2559
-				}
2560
-				echo $this->output_title( $args, $instance );
2561
-				echo $output;
2562
-				if ( $this->is_elementor_widget_output() ) {
2563
-					echo "</span>";
2564
-				}
2565
-				echo $after_widget;
2566
-			} elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
2567
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
2568
-				echo $output;
2569
-			} elseif ( $output && $no_wrap ) {
2570
-				echo $output;
2571
-			}
2572
-			$output = ob_get_clean();
2573
-
2574
-			$output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
2575
-
2576
-			echo $output;
2577
-		}
2578
-
2579
-		/**
2580
-		 * Tests if the current output is inside a elementor container.
2581
-		 *
2582
-		 * @since 1.0.4
2583
-		 * @return bool
2584
-		 */
2585
-		public function is_elementor_widget_output() {
2586
-			$result = false;
2587
-			if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
2588
-				$result = true;
2589
-			}
2590
-
2591
-			return $result;
2592
-		}
2593
-
2594
-		/**
2595
-		 * Tests if the current output is inside a elementor preview.
2596
-		 *
2597
-		 * @since 1.0.4
2598
-		 * @return bool
2599
-		 */
2600
-		public function is_elementor_preview() {
2601
-			$result = false;
2602
-			if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
2603
-				$result = true;
2604
-			}
2605
-
2606
-			return $result;
2607
-		}
2608
-
2609
-		/**
2610
-		 * Tests if the current output is inside a Divi preview.
2611
-		 *
2612
-		 * @since 1.0.6
2613
-		 * @return bool
2614
-		 */
2615
-		public function is_divi_preview() {
2616
-			$result = false;
2617
-			if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
2618
-				$result = true;
2619
-			}
2620
-
2621
-			return $result;
2622
-		}
2623
-
2624
-		/**
2625
-		 * Tests if the current output is inside a Beaver builder preview.
2626
-		 *
2627
-		 * @since 1.0.6
2628
-		 * @return bool
2629
-		 */
2630
-		public function is_beaver_preview() {
2631
-			$result = false;
2632
-			if ( isset( $_REQUEST['fl_builder'] ) ) {
2633
-				$result = true;
2634
-			}
2635
-
2636
-			return $result;
2637
-		}
2638
-
2639
-		/**
2640
-		 * Tests if the current output is inside a siteorigin builder preview.
2641
-		 *
2642
-		 * @since 1.0.6
2643
-		 * @return bool
2644
-		 */
2645
-		public function is_siteorigin_preview() {
2646
-			$result = false;
2647
-			if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
2648
-				$result = true;
2649
-			}
2650
-
2651
-			return $result;
2652
-		}
2653
-
2654
-		/**
2655
-		 * Tests if the current output is inside a cornerstone builder preview.
2656
-		 *
2657
-		 * @since 1.0.8
2658
-		 * @return bool
2659
-		 */
2660
-		public function is_cornerstone_preview() {
2661
-			$result = false;
2662
-			if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
2663
-				$result = true;
2664
-			}
2665
-
2666
-			return $result;
2667
-		}
2668
-
2669
-		/**
2670
-		 * Tests if the current output is inside a fusion builder preview.
2671
-		 *
2672
-		 * @since 1.1.0
2673
-		 * @return bool
2674
-		 */
2675
-		public function is_fusion_preview() {
2676
-			$result = false;
2677
-			if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
2678
-				$result = true;
2679
-			}
2680
-
2681
-			return $result;
2682
-		}
2683
-
2684
-		/**
2685
-		 * Tests if the current output is inside a Oxygen builder preview.
2686
-		 *
2687
-		 * @since 1.0.18
2688
-		 * @return bool
2689
-		 */
2690
-		public function is_oxygen_preview() {
2691
-			$result = false;
2692
-			if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
2693
-				$result = true;
2694
-			}
2695
-
2696
-			return $result;
2697
-		}
2698
-
2699
-		/**
2700
-		 * General function to check if we are in a preview situation.
2701
-		 *
2702
-		 * @since 1.0.6
2703
-		 * @return bool
2704
-		 */
2705
-		public function is_preview() {
2706
-			$preview = false;
2707
-			if ( $this->is_divi_preview() ) {
2708
-				$preview = true;
2709
-			} elseif ( $this->is_elementor_preview() ) {
2710
-				$preview = true;
2711
-			} elseif ( $this->is_beaver_preview() ) {
2712
-				$preview = true;
2713
-			} elseif ( $this->is_siteorigin_preview() ) {
2714
-				$preview = true;
2715
-			} elseif ( $this->is_cornerstone_preview() ) {
2716
-				$preview = true;
2717
-			} elseif ( $this->is_fusion_preview() ) {
2718
-				$preview = true;
2719
-			} elseif ( $this->is_oxygen_preview() ) {
2720
-				$preview = true;
2721
-			} elseif( $this->is_block_content_call() ) {
2722
-				$preview = true;
2723
-			}
2724
-
2725
-			return $preview;
2726
-		}
2727
-
2728
-		/**
2729
-		 * Output the super title.
2730
-		 *
2731
-		 * @param $args
2732
-		 * @param array $instance
2733
-		 *
2734
-		 * @return string
2735
-		 */
2736
-		public function output_title( $args, $instance = array() ) {
2737
-			$output = '';
2738
-			if ( ! empty( $instance['title'] ) ) {
2739
-				/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
2740
-				$title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
2741
-
2742
-				if(empty($instance['widget_title_tag'])){
2743
-					$output = $args['before_title'] . $title . $args['after_title'];
2744
-				}else{
2745
-					$title_tag = esc_attr( $instance['widget_title_tag'] );
2746
-
2747
-					// classes
2748
-					$title_classes = array();
2749
-					$title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
2750
-					$title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
2751
-					$title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
2752
-					$title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
2753
-					$title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
2754
-					$title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
2755
-					$title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
2756
-					$title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
2757
-					$title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
2758
-					$title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
2759
-					$title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
2760
-					$title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
2761
-					$title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
2762
-
2763
-					$class = !empty( $title_classes ) ? implode(" ",$title_classes) : '';
2764
-					$output = "<$title_tag class='$class' >$title</$title_tag>";
2765
-				}
2766
-
2767
-			}
2768
-
2769
-			return $output;
2770
-		}
2771
-
2772
-		/**
2773
-		 * Outputs the options form inputs for the widget.
2774
-		 *
2775
-		 * @param array $instance The widget options.
2776
-		 */
2777
-		public function form( $instance ) {
2778
-
2779
-			// set widget instance
2780
-			$this->instance = $instance;
2781
-
2782
-			// set it as a SD widget
2783
-			echo $this->widget_advanced_toggle();
2784
-
2785
-			echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
2786
-			$arguments_raw = $this->get_arguments();
2787
-
2788
-			if ( is_array( $arguments_raw ) ) {
2789
-
2790
-				$arguments = $this->group_arguments( $arguments_raw );
2791
-
2792
-				// Do we have sections?
2793
-				$has_sections = $arguments == $arguments_raw ? false : true;
2794
-
2795
-
2796
-				if ( $has_sections ) {
2797
-					$panel_count = 0;
2798
-					foreach ( $arguments as $key => $args ) {
2799
-
2800
-						?>
2372
+        }
2373
+
2374
+        /**
2375
+         * Convert an array of attributes to block string.
2376
+         *
2377
+         * @todo there is prob a faster way to do this, also we could add some validation here.
2378
+         *
2379
+         * @param $custom_attributes
2380
+         *
2381
+         * @return string
2382
+         */
2383
+        public function array_to_attributes( $custom_attributes, $html = false ) {
2384
+            $attributes = '';
2385
+            if ( ! empty( $custom_attributes ) ) {
2386
+
2387
+                if ( $html ) {
2388
+                    foreach ( $custom_attributes as $key => $val ) {
2389
+                        $attributes .= " $key='$val' ";
2390
+                    }
2391
+                } else {
2392
+                    foreach ( $custom_attributes as $key => $val ) {
2393
+                        $attributes .= "'$key': '$val',";
2394
+                    }
2395
+                }
2396
+            }
2397
+
2398
+            return $attributes;
2399
+        }
2400
+
2401
+        /**
2402
+         * A self looping function to create the output for JS block elements.
2403
+         *
2404
+         * This is what is output in the WP Editor visual view.
2405
+         *
2406
+         * @param $args
2407
+         */
2408
+        public function block_element( $args ) {
2409
+
2410
+
2411
+            if ( ! empty( $args ) ) {
2412
+                foreach ( $args as $element => $new_args ) {
2413
+
2414
+                    if ( is_array( $new_args ) ) { // its an element
2415
+
2416
+
2417
+                        if ( isset( $new_args['element'] ) ) {
2418
+
2419
+                            if ( isset( $new_args['element_require'] ) ) {
2420
+                                echo str_replace( array(
2421
+                                        "'+",
2422
+                                        "+'"
2423
+                                    ), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
2424
+                                unset( $new_args['element_require'] );
2425
+                            }
2426
+
2427
+                            echo "\n el( '" . $new_args['element'] . "', {";
2428
+
2429
+                            // get the attributes
2430
+                            foreach ( $new_args as $new_key => $new_value ) {
2431
+
2432
+
2433
+                                if ( $new_key == 'element' || $new_key == 'content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
2434
+                                    // do nothing
2435
+                                } else {
2436
+                                    echo $this->block_element( array( $new_key => $new_value ) );
2437
+                                }
2438
+                            }
2439
+
2440
+                            echo "},";// end attributes
2441
+
2442
+                            // get the content
2443
+                            $first_item = 0;
2444
+                            foreach ( $new_args as $new_key => $new_value ) {
2445
+                                if ( $new_key === 'content' || is_array( $new_value ) ) {
2446
+
2447
+                                    if ( $new_key === 'content' ) {
2448
+                                        echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
2449
+                                    }
2450
+
2451
+                                    if ( is_array( $new_value ) ) {
2452
+
2453
+                                        if ( isset( $new_value['element_require'] ) ) {
2454
+                                            echo str_replace( array(
2455
+                                                    "'+",
2456
+                                                    "+'"
2457
+                                                ), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
2458
+                                            unset( $new_value['element_require'] );
2459
+                                        }
2460
+
2461
+                                        if ( isset( $new_value['element_repeat'] ) ) {
2462
+                                            $x = 1;
2463
+                                            while ( $x <= absint( $new_value['element_repeat'] ) ) {
2464
+                                                $this->block_element( array( '' => $new_value ) );
2465
+                                                $x ++;
2466
+                                            }
2467
+                                        } else {
2468
+                                            $this->block_element( array( '' => $new_value ) );
2469
+                                        }
2470
+                                    }
2471
+                                    $first_item ++;
2472
+                                }
2473
+                            }
2474
+
2475
+                            echo ")";// end content
2476
+
2477
+                            echo ", \n";
2478
+
2479
+                        }
2480
+                    } else {
2481
+
2482
+                        if ( substr( $element, 0, 3 ) === "if_" ) {
2483
+                            echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
2484
+                        } elseif ( $element == 'style' ) {
2485
+                            echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
2486
+                        } else {
2487
+                            echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
2488
+                        }
2489
+
2490
+                    }
2491
+                }
2492
+            }
2493
+        }
2494
+
2495
+        /**
2496
+         * Replace block attributes placeholders with the proper naming.
2497
+         *
2498
+         * @param $string
2499
+         *
2500
+         * @return mixed
2501
+         */
2502
+        public function block_props_replace( $string, $no_wrap = false ) {
2503
+
2504
+            if ( $no_wrap ) {
2505
+                $string = str_replace( array( "[%", "%]" ), array( "props.attributes.", "" ), $string );
2506
+            } else {
2507
+                $string = str_replace( array( "[%", "%]" ), array( "'+props.attributes.", "+'" ), $string );
2508
+            }
2509
+
2510
+            return $string;
2511
+        }
2512
+
2513
+        /**
2514
+         * Outputs the content of the widget
2515
+         *
2516
+         * @param array $args
2517
+         * @param array $instance
2518
+         */
2519
+        public function widget( $args, $instance ) {
2520
+
2521
+            // get the filtered values
2522
+            $argument_values = $this->argument_values( $instance );
2523
+            $argument_values = $this->string_to_bool( $argument_values );
2524
+            $output          = $this->output( $argument_values, $args );
2525
+
2526
+            $no_wrap = false;
2527
+            if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
2528
+                $no_wrap = true;
2529
+            }
2530
+
2531
+            ob_start();
2532
+            if ( $output && ! $no_wrap ) {
2533
+
2534
+                $class_original = $this->options['widget_ops']['classname'];
2535
+                $class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
2536
+
2537
+                // Before widget
2538
+                $before_widget = $args['before_widget'];
2539
+                $before_widget = str_replace($class_original,$class,$before_widget);
2540
+                $before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
2541
+                $before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
2542
+
2543
+                // After widget
2544
+                $after_widget = $args['after_widget'];
2545
+                $after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
2546
+                $after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
2547
+
2548
+                echo $before_widget;
2549
+                // elementor strips the widget wrapping div so we check for and add it back if needed
2550
+                if ( $this->is_elementor_widget_output() ) {
2551
+                    // Filter class & attrs for elementor widget output.
2552
+                    $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
2553
+                    $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
2554
+
2555
+                    $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
2556
+                    $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
2557
+
2558
+                    echo "<span class='" . esc_attr( $class  ) . "' " . $attrs . ">";
2559
+                }
2560
+                echo $this->output_title( $args, $instance );
2561
+                echo $output;
2562
+                if ( $this->is_elementor_widget_output() ) {
2563
+                    echo "</span>";
2564
+                }
2565
+                echo $after_widget;
2566
+            } elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
2567
+                $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
2568
+                echo $output;
2569
+            } elseif ( $output && $no_wrap ) {
2570
+                echo $output;
2571
+            }
2572
+            $output = ob_get_clean();
2573
+
2574
+            $output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
2575
+
2576
+            echo $output;
2577
+        }
2578
+
2579
+        /**
2580
+         * Tests if the current output is inside a elementor container.
2581
+         *
2582
+         * @since 1.0.4
2583
+         * @return bool
2584
+         */
2585
+        public function is_elementor_widget_output() {
2586
+            $result = false;
2587
+            if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
2588
+                $result = true;
2589
+            }
2590
+
2591
+            return $result;
2592
+        }
2593
+
2594
+        /**
2595
+         * Tests if the current output is inside a elementor preview.
2596
+         *
2597
+         * @since 1.0.4
2598
+         * @return bool
2599
+         */
2600
+        public function is_elementor_preview() {
2601
+            $result = false;
2602
+            if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
2603
+                $result = true;
2604
+            }
2605
+
2606
+            return $result;
2607
+        }
2608
+
2609
+        /**
2610
+         * Tests if the current output is inside a Divi preview.
2611
+         *
2612
+         * @since 1.0.6
2613
+         * @return bool
2614
+         */
2615
+        public function is_divi_preview() {
2616
+            $result = false;
2617
+            if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
2618
+                $result = true;
2619
+            }
2620
+
2621
+            return $result;
2622
+        }
2623
+
2624
+        /**
2625
+         * Tests if the current output is inside a Beaver builder preview.
2626
+         *
2627
+         * @since 1.0.6
2628
+         * @return bool
2629
+         */
2630
+        public function is_beaver_preview() {
2631
+            $result = false;
2632
+            if ( isset( $_REQUEST['fl_builder'] ) ) {
2633
+                $result = true;
2634
+            }
2635
+
2636
+            return $result;
2637
+        }
2638
+
2639
+        /**
2640
+         * Tests if the current output is inside a siteorigin builder preview.
2641
+         *
2642
+         * @since 1.0.6
2643
+         * @return bool
2644
+         */
2645
+        public function is_siteorigin_preview() {
2646
+            $result = false;
2647
+            if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
2648
+                $result = true;
2649
+            }
2650
+
2651
+            return $result;
2652
+        }
2653
+
2654
+        /**
2655
+         * Tests if the current output is inside a cornerstone builder preview.
2656
+         *
2657
+         * @since 1.0.8
2658
+         * @return bool
2659
+         */
2660
+        public function is_cornerstone_preview() {
2661
+            $result = false;
2662
+            if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
2663
+                $result = true;
2664
+            }
2665
+
2666
+            return $result;
2667
+        }
2668
+
2669
+        /**
2670
+         * Tests if the current output is inside a fusion builder preview.
2671
+         *
2672
+         * @since 1.1.0
2673
+         * @return bool
2674
+         */
2675
+        public function is_fusion_preview() {
2676
+            $result = false;
2677
+            if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
2678
+                $result = true;
2679
+            }
2680
+
2681
+            return $result;
2682
+        }
2683
+
2684
+        /**
2685
+         * Tests if the current output is inside a Oxygen builder preview.
2686
+         *
2687
+         * @since 1.0.18
2688
+         * @return bool
2689
+         */
2690
+        public function is_oxygen_preview() {
2691
+            $result = false;
2692
+            if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
2693
+                $result = true;
2694
+            }
2695
+
2696
+            return $result;
2697
+        }
2698
+
2699
+        /**
2700
+         * General function to check if we are in a preview situation.
2701
+         *
2702
+         * @since 1.0.6
2703
+         * @return bool
2704
+         */
2705
+        public function is_preview() {
2706
+            $preview = false;
2707
+            if ( $this->is_divi_preview() ) {
2708
+                $preview = true;
2709
+            } elseif ( $this->is_elementor_preview() ) {
2710
+                $preview = true;
2711
+            } elseif ( $this->is_beaver_preview() ) {
2712
+                $preview = true;
2713
+            } elseif ( $this->is_siteorigin_preview() ) {
2714
+                $preview = true;
2715
+            } elseif ( $this->is_cornerstone_preview() ) {
2716
+                $preview = true;
2717
+            } elseif ( $this->is_fusion_preview() ) {
2718
+                $preview = true;
2719
+            } elseif ( $this->is_oxygen_preview() ) {
2720
+                $preview = true;
2721
+            } elseif( $this->is_block_content_call() ) {
2722
+                $preview = true;
2723
+            }
2724
+
2725
+            return $preview;
2726
+        }
2727
+
2728
+        /**
2729
+         * Output the super title.
2730
+         *
2731
+         * @param $args
2732
+         * @param array $instance
2733
+         *
2734
+         * @return string
2735
+         */
2736
+        public function output_title( $args, $instance = array() ) {
2737
+            $output = '';
2738
+            if ( ! empty( $instance['title'] ) ) {
2739
+                /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
2740
+                $title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
2741
+
2742
+                if(empty($instance['widget_title_tag'])){
2743
+                    $output = $args['before_title'] . $title . $args['after_title'];
2744
+                }else{
2745
+                    $title_tag = esc_attr( $instance['widget_title_tag'] );
2746
+
2747
+                    // classes
2748
+                    $title_classes = array();
2749
+                    $title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
2750
+                    $title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
2751
+                    $title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
2752
+                    $title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
2753
+                    $title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
2754
+                    $title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
2755
+                    $title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
2756
+                    $title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
2757
+                    $title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
2758
+                    $title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
2759
+                    $title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
2760
+                    $title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
2761
+                    $title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
2762
+
2763
+                    $class = !empty( $title_classes ) ? implode(" ",$title_classes) : '';
2764
+                    $output = "<$title_tag class='$class' >$title</$title_tag>";
2765
+                }
2766
+
2767
+            }
2768
+
2769
+            return $output;
2770
+        }
2771
+
2772
+        /**
2773
+         * Outputs the options form inputs for the widget.
2774
+         *
2775
+         * @param array $instance The widget options.
2776
+         */
2777
+        public function form( $instance ) {
2778
+
2779
+            // set widget instance
2780
+            $this->instance = $instance;
2781
+
2782
+            // set it as a SD widget
2783
+            echo $this->widget_advanced_toggle();
2784
+
2785
+            echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
2786
+            $arguments_raw = $this->get_arguments();
2787
+
2788
+            if ( is_array( $arguments_raw ) ) {
2789
+
2790
+                $arguments = $this->group_arguments( $arguments_raw );
2791
+
2792
+                // Do we have sections?
2793
+                $has_sections = $arguments == $arguments_raw ? false : true;
2794
+
2795
+
2796
+                if ( $has_sections ) {
2797
+                    $panel_count = 0;
2798
+                    foreach ( $arguments as $key => $args ) {
2799
+
2800
+                        ?>
2801 2801
 						<script>
2802 2802
 							//							jQuery(this).find("i").toggleClass("fas fa-chevron-up fas fa-chevron-down");jQuery(this).next().toggle();
2803 2803
 						</script>
2804 2804
 						<?php
2805 2805
 
2806
-						$hide       = $panel_count ? ' style="display:none;" ' : '';
2807
-						$icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
2808
-						echo "<button onclick='jQuery(this).find(\"i\").toggleClass(\"fas fa-chevron-up fas fa-chevron-down\");jQuery(this).next().slideToggle();' type='button' class='sd-toggle-group-button sd-input-group-toggle" . sanitize_title_with_dashes( $key ) . "'>" . esc_attr( $key ) . " <i style='float:right;' class='" . $icon_class . "'></i></button>";
2809
-						echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
2806
+                        $hide       = $panel_count ? ' style="display:none;" ' : '';
2807
+                        $icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
2808
+                        echo "<button onclick='jQuery(this).find(\"i\").toggleClass(\"fas fa-chevron-up fas fa-chevron-down\");jQuery(this).next().slideToggle();' type='button' class='sd-toggle-group-button sd-input-group-toggle" . sanitize_title_with_dashes( $key ) . "'>" . esc_attr( $key ) . " <i style='float:right;' class='" . $icon_class . "'></i></button>";
2809
+                        echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
2810 2810
 
2811
-						foreach ( $args as $k => $a ) {
2811
+                        foreach ( $args as $k => $a ) {
2812 2812
 
2813
-							$this->widget_inputs_row_start($k, $a);
2814
-							$this->widget_inputs( $a, $instance );
2815
-							$this->widget_inputs_row_end($k, $a);
2813
+                            $this->widget_inputs_row_start($k, $a);
2814
+                            $this->widget_inputs( $a, $instance );
2815
+                            $this->widget_inputs_row_end($k, $a);
2816 2816
 
2817
-						}
2817
+                        }
2818 2818
 
2819
-						echo "</div>";
2819
+                        echo "</div>";
2820 2820
 
2821
-						$panel_count ++;
2821
+                        $panel_count ++;
2822 2822
 
2823
-					}
2824
-				} else {
2825
-					foreach ( $arguments as $key => $args ) {
2826
-						$this->widget_inputs_row_start($key, $args);
2827
-						$this->widget_inputs( $args, $instance );
2828
-						$this->widget_inputs_row_end($key, $args);
2829
-					}
2830
-				}
2823
+                    }
2824
+                } else {
2825
+                    foreach ( $arguments as $key => $args ) {
2826
+                        $this->widget_inputs_row_start($key, $args);
2827
+                        $this->widget_inputs( $args, $instance );
2828
+                        $this->widget_inputs_row_end($key, $args);
2829
+                    }
2830
+                }
2831 2831
 
2832
-			}
2833
-		}
2832
+            }
2833
+        }
2834 2834
 
2835
-		public function widget_inputs_row_start($key, $args){
2836
-			if(!empty($args['row'])){
2837
-				// maybe open
2838
-				if(!empty($args['row']['open'])){
2839
-					?>
2835
+        public function widget_inputs_row_start($key, $args){
2836
+            if(!empty($args['row'])){
2837
+                // maybe open
2838
+                if(!empty($args['row']['open'])){
2839
+                    ?>
2840 2840
 					<div class='bsui sd-argument ' data-argument='<?php echo esc_attr( $args['row']['key'] ); ?>' data-element_require='<?php if ( !empty($args['row']['element_require'])) {
2841
-						echo $this->convert_element_require( $args['row']['element_require'] );
2842
-					} ?>'>
2841
+                        echo $this->convert_element_require( $args['row']['element_require'] );
2842
+                    } ?>'>
2843 2843
 					<?php if(!empty($args['row']['title'])){ ?>
2844 2844
 					<label class="mb-0 "><?php echo esc_attr( $args['row']['title'] ); ?><?php echo $this->widget_field_desc( $args['row'] ); ?></label>
2845 2845
 					<?php }?>
2846 2846
 					<div class='row <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>'>
2847 2847
 					<div class='col pr-2'>
2848 2848
 					<?php
2849
-				}elseif(!empty($args['row']['close'])){
2850
-					echo "<div class='col pl-0'>";
2851
-				}else{
2852
-					echo "<div class='col pl-0 pr-2'>";
2853
-				}
2854
-			}
2855
-		}
2856
-
2857
-		public function widget_inputs_row_end($key, $args){
2858
-
2859
-			if(!empty($args['row'])){
2860
-				// maybe close
2861
-				if(!empty($args['row']['close'])){
2862
-					echo "</div></div>";
2863
-				}
2864
-
2865
-				echo "</div>";
2866
-			}
2867
-		}
2868
-
2869
-		/**
2870
-		 * Get the hidden input that when added makes the advanced button show on widget settings.
2871
-		 *
2872
-		 * @return string
2873
-		 */
2874
-		public function widget_advanced_toggle() {
2875
-
2876
-			$output = '';
2877
-			if ( $this->block_show_advanced() ) {
2878
-				$val = 1;
2879
-			} else {
2880
-				$val = 0;
2881
-			}
2882
-
2883
-			$output .= "<input type='hidden'  class='sd-show-advanced' value='$val' />";
2884
-
2885
-			return $output;
2886
-		}
2887
-
2888
-		/**
2889
-		 * Convert require element.
2890
-		 *
2891
-		 * @since 1.0.0
2892
-		 *
2893
-		 * @param string $input Input element.
2894
-		 *
2895
-		 * @return string $output
2896
-		 */
2897
-		public function convert_element_require( $input ) {
2898
-
2899
-			$input = str_replace( "'", '"', $input );// we only want double quotes
2900
-
2901
-			$output = esc_attr( str_replace( array( "[%", "%]" ), array(
2902
-				"jQuery(form).find('[data-argument=\"",
2903
-				"\"]').find('input,select,textarea').val()"
2904
-			), $input ) );
2905
-
2906
-			return $output;
2907
-		}
2908
-
2909
-		/**
2910
-		 * Builds the inputs for the widget options.
2911
-		 *
2912
-		 * @param $args
2913
-		 * @param $instance
2914
-		 */
2915
-		public function widget_inputs( $args, $instance ) {
2916
-
2917
-			$class             = "";
2918
-			$element_require   = "";
2919
-			$custom_attributes = "";
2920
-
2921
-			// get value
2922
-			if ( isset( $instance[ $args['name'] ] ) ) {
2923
-				$value = $instance[ $args['name'] ];
2924
-			} elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
2925
-				$value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
2926
-			} else {
2927
-				$value = '';
2928
-			}
2929
-
2930
-			// get placeholder
2931
-			if ( ! empty( $args['placeholder'] ) ) {
2932
-				$placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
2933
-			} else {
2934
-				$placeholder = '';
2935
-			}
2936
-
2937
-			// get if advanced
2938
-			if ( isset( $args['advanced'] ) && $args['advanced'] ) {
2939
-				$class .= " sd-advanced-setting ";
2940
-			}
2941
-
2942
-			// element_require
2943
-			if ( isset( $args['element_require'] ) && $args['element_require'] ) {
2944
-				$element_require = $args['element_require'];
2945
-			}
2946
-
2947
-			// custom_attributes
2948
-			if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
2949
-				$custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
2950
-			}
2951
-
2952
-
2953
-			// before wrapper
2954
-			?>
2849
+                }elseif(!empty($args['row']['close'])){
2850
+                    echo "<div class='col pl-0'>";
2851
+                }else{
2852
+                    echo "<div class='col pl-0 pr-2'>";
2853
+                }
2854
+            }
2855
+        }
2856
+
2857
+        public function widget_inputs_row_end($key, $args){
2858
+
2859
+            if(!empty($args['row'])){
2860
+                // maybe close
2861
+                if(!empty($args['row']['close'])){
2862
+                    echo "</div></div>";
2863
+                }
2864
+
2865
+                echo "</div>";
2866
+            }
2867
+        }
2868
+
2869
+        /**
2870
+         * Get the hidden input that when added makes the advanced button show on widget settings.
2871
+         *
2872
+         * @return string
2873
+         */
2874
+        public function widget_advanced_toggle() {
2875
+
2876
+            $output = '';
2877
+            if ( $this->block_show_advanced() ) {
2878
+                $val = 1;
2879
+            } else {
2880
+                $val = 0;
2881
+            }
2882
+
2883
+            $output .= "<input type='hidden'  class='sd-show-advanced' value='$val' />";
2884
+
2885
+            return $output;
2886
+        }
2887
+
2888
+        /**
2889
+         * Convert require element.
2890
+         *
2891
+         * @since 1.0.0
2892
+         *
2893
+         * @param string $input Input element.
2894
+         *
2895
+         * @return string $output
2896
+         */
2897
+        public function convert_element_require( $input ) {
2898
+
2899
+            $input = str_replace( "'", '"', $input );// we only want double quotes
2900
+
2901
+            $output = esc_attr( str_replace( array( "[%", "%]" ), array(
2902
+                "jQuery(form).find('[data-argument=\"",
2903
+                "\"]').find('input,select,textarea').val()"
2904
+            ), $input ) );
2905
+
2906
+            return $output;
2907
+        }
2908
+
2909
+        /**
2910
+         * Builds the inputs for the widget options.
2911
+         *
2912
+         * @param $args
2913
+         * @param $instance
2914
+         */
2915
+        public function widget_inputs( $args, $instance ) {
2916
+
2917
+            $class             = "";
2918
+            $element_require   = "";
2919
+            $custom_attributes = "";
2920
+
2921
+            // get value
2922
+            if ( isset( $instance[ $args['name'] ] ) ) {
2923
+                $value = $instance[ $args['name'] ];
2924
+            } elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
2925
+                $value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
2926
+            } else {
2927
+                $value = '';
2928
+            }
2929
+
2930
+            // get placeholder
2931
+            if ( ! empty( $args['placeholder'] ) ) {
2932
+                $placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
2933
+            } else {
2934
+                $placeholder = '';
2935
+            }
2936
+
2937
+            // get if advanced
2938
+            if ( isset( $args['advanced'] ) && $args['advanced'] ) {
2939
+                $class .= " sd-advanced-setting ";
2940
+            }
2941
+
2942
+            // element_require
2943
+            if ( isset( $args['element_require'] ) && $args['element_require'] ) {
2944
+                $element_require = $args['element_require'];
2945
+            }
2946
+
2947
+            // custom_attributes
2948
+            if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
2949
+                $custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
2950
+            }
2951
+
2952
+
2953
+            // before wrapper
2954
+            ?>
2955 2955
 			<p class="sd-argument <?php echo esc_attr( $class ); ?>"
2956 2956
 			data-argument='<?php echo esc_attr( $args['name'] ); ?>'
2957 2957
 			data-element_require='<?php if ( $element_require ) {
2958
-				echo $this->convert_element_require( $element_require );
2959
-			} ?>'
2958
+                echo $this->convert_element_require( $element_require );
2959
+            } ?>'
2960 2960
 			>
2961 2961
 			<?php
2962 2962
 
2963 2963
 
2964
-			switch ( $args['type'] ) {
2965
-				//array('text','password','number','email','tel','url','color')
2966
-				case "text":
2967
-				case "password":
2968
-				case "number":
2969
-				case "email":
2970
-				case "tel":
2971
-				case "url":
2972
-				case "color":
2973
-					?>
2964
+            switch ( $args['type'] ) {
2965
+                //array('text','password','number','email','tel','url','color')
2966
+                case "text":
2967
+                case "password":
2968
+                case "number":
2969
+                case "email":
2970
+                case "tel":
2971
+                case "url":
2972
+                case "color":
2973
+                    ?>
2974 2974
 					<label
2975 2975
 						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label>
2976 2976
 					<input <?php echo $placeholder; ?> class="widefat"
@@ -2981,47 +2981,47 @@  discard block
 block discarded – undo
2981 2981
 						                               value="<?php echo esc_attr( $value ); ?>">
2982 2982
 					<?php
2983 2983
 
2984
-					break;
2985
-				case "select":
2986
-					$multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
2987
-					if ( $multiple ) {
2988
-						if ( empty( $value ) ) {
2989
-							$value = array();
2990
-						}
2991
-					}
2992
-					?>
2984
+                    break;
2985
+                case "select":
2986
+                    $multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
2987
+                    if ( $multiple ) {
2988
+                        if ( empty( $value ) ) {
2989
+                            $value = array();
2990
+                        }
2991
+                    }
2992
+                    ?>
2993 2993
 					<label
2994 2994
 						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
2995 2995
 					<select <?php echo $placeholder; ?> class="widefat"
2996 2996
 						<?php echo $custom_attributes; ?>
2997 2997
 						                                id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
2998 2998
 						                                name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) );
2999
-						                                if ( $multiple ) {
3000
-							                                echo "[]";
3001
-						                                } ?>"
2999
+                                                        if ( $multiple ) {
3000
+                                                            echo "[]";
3001
+                                                        } ?>"
3002 3002
 						<?php if ( $multiple ) {
3003
-							echo "multiple";
3004
-						} //@todo not implemented yet due to gutenberg not supporting it
3005
-						?>
3003
+                            echo "multiple";
3004
+                        } //@todo not implemented yet due to gutenberg not supporting it
3005
+                        ?>
3006 3006
 					>
3007 3007
 						<?php
3008 3008
 
3009
-						if ( ! empty( $args['options'] ) ) {
3010
-							foreach ( $args['options'] as $val => $label ) {
3011
-								if ( $multiple ) {
3012
-									$selected = in_array( $val, $value ) ? 'selected="selected"' : '';
3013
-								} else {
3014
-									$selected = selected( $value, $val, false );
3015
-								}
3016
-								echo "<option value='$val' " . $selected . ">$label</option>";
3017
-							}
3018
-						}
3019
-						?>
3009
+                        if ( ! empty( $args['options'] ) ) {
3010
+                            foreach ( $args['options'] as $val => $label ) {
3011
+                                if ( $multiple ) {
3012
+                                    $selected = in_array( $val, $value ) ? 'selected="selected"' : '';
3013
+                                } else {
3014
+                                    $selected = selected( $value, $val, false );
3015
+                                }
3016
+                                echo "<option value='$val' " . $selected . ">$label</option>";
3017
+                            }
3018
+                        }
3019
+                        ?>
3020 3020
 					</select>
3021 3021
 					<?php
3022
-					break;
3023
-				case "checkbox":
3024
-					?>
3022
+                    break;
3023
+                case "checkbox":
3024
+                    ?>
3025 3025
 					<input <?php echo $placeholder; ?>
3026 3026
 						<?php checked( 1, $value, true ) ?>
3027 3027
 						<?php echo $custom_attributes; ?>
@@ -3031,9 +3031,9 @@  discard block
 block discarded – undo
3031 3031
 					<label
3032 3032
 						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label>
3033 3033
 					<?php
3034
-					break;
3035
-				case "textarea":
3036
-					?>
3034
+                    break;
3035
+                case "textarea":
3036
+                    ?>
3037 3037
 					<label
3038 3038
 						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
3039 3039
 					<textarea <?php echo $placeholder; ?> class="widefat"
@@ -3043,280 +3043,280 @@  discard block
 block discarded – undo
3043 3043
 					><?php echo esc_attr( $value ); ?></textarea>
3044 3044
 					<?php
3045 3045
 
3046
-					break;
3047
-				case "hidden":
3048
-					?>
3046
+                    break;
3047
+                case "hidden":
3048
+                    ?>
3049 3049
 					<input id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
3050 3050
 					       name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="hidden"
3051 3051
 					       value="<?php echo esc_attr( $value ); ?>">
3052 3052
 					<?php
3053
-					break;
3054
-				default:
3055
-					echo "No input type found!"; // @todo we need to add more input types.
3056
-			}
3053
+                    break;
3054
+                default:
3055
+                    echo "No input type found!"; // @todo we need to add more input types.
3056
+            }
3057 3057
 
3058
-			// after wrapper
3059
-			?>
3058
+            // after wrapper
3059
+            ?>
3060 3060
 			</p>
3061 3061
 			<?php
3062 3062
 
3063 3063
 
3064
-		}
3065
-
3066
-		public function get_widget_icon($icon = 'box-top', $title = ''){
3067
-			if($icon=='box-top'){
3068
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
3069
-			}elseif($icon=='box-right'){
3070
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
3071
-			}elseif($icon=='box-bottom'){
3072
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
3073
-			}elseif($icon=='box-left'){
3074
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
3075
-			}
3076
-		}
3077
-
3078
-		/**
3079
-		 * Get the widget input description html.
3080
-		 *
3081
-		 * @param $args
3082
-		 *
3083
-		 * @return string
3084
-		 * @todo, need to make its own tooltip script
3085
-		 */
3086
-		public function widget_field_desc( $args ) {
3087
-
3088
-			$description = '';
3089
-			if ( isset( $args['desc'] ) && $args['desc'] ) {
3090
-				if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
3091
-					$description = $this->desc_tip( $args['desc'] );
3092
-				} else {
3093
-					$description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
3094
-				}
3095
-			}
3096
-
3097
-			return $description;
3098
-		}
3099
-
3100
-		/**
3101
-		 * Get the widget input title html.
3102
-		 *
3103
-		 * @param $args
3104
-		 *
3105
-		 * @return string
3106
-		 */
3107
-		public function widget_field_title( $args ) {
3108
-
3109
-			$title = '';
3110
-			if ( isset( $args['title'] ) && $args['title'] ) {
3111
-				if ( isset( $args['icon'] ) && $args['icon'] ) {
3112
-					$title = self::get_widget_icon( $args['icon'], $args['title']  );
3113
-				} else {
3114
-					$title = esc_attr($args['title']);
3115
-				}
3116
-			}
3117
-
3118
-			return $title;
3119
-		}
3120
-
3121
-		/**
3122
-		 * Get the tool tip html.
3123
-		 *
3124
-		 * @param $tip
3125
-		 * @param bool $allow_html
3126
-		 *
3127
-		 * @return string
3128
-		 */
3129
-		function desc_tip( $tip, $allow_html = false ) {
3130
-			if ( $allow_html ) {
3131
-				$tip = $this->sanitize_tooltip( $tip );
3132
-			} else {
3133
-				$tip = esc_attr( $tip );
3134
-			}
3135
-
3136
-			return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
3137
-		}
3138
-
3139
-		/**
3140
-		 * Sanitize a string destined to be a tooltip.
3141
-		 *
3142
-		 * @param string $var
3143
-		 *
3144
-		 * @return string
3145
-		 */
3146
-		public function sanitize_tooltip( $var ) {
3147
-			return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
3148
-				'br'     => array(),
3149
-				'em'     => array(),
3150
-				'strong' => array(),
3151
-				'small'  => array(),
3152
-				'span'   => array(),
3153
-				'ul'     => array(),
3154
-				'li'     => array(),
3155
-				'ol'     => array(),
3156
-				'p'      => array(),
3157
-			) ) );
3158
-		}
3159
-
3160
-		/**
3161
-		 * Processing widget options on save
3162
-		 *
3163
-		 * @param array $new_instance The new options
3164
-		 * @param array $old_instance The previous options
3165
-		 *
3166
-		 * @return array
3167
-		 * @todo we should add some sanitation here.
3168
-		 */
3169
-		public function update( $new_instance, $old_instance ) {
3170
-
3171
-			//save the widget
3172
-			$instance = array_merge( (array) $old_instance, (array) $new_instance );
3173
-
3174
-			// set widget instance
3175
-			$this->instance = $instance;
3176
-
3177
-			if ( empty( $this->arguments ) ) {
3178
-				$this->get_arguments();
3179
-			}
3180
-
3181
-			// check for checkboxes
3182
-			if ( ! empty( $this->arguments ) ) {
3183
-				foreach ( $this->arguments as $argument ) {
3184
-					if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
3185
-						$instance[ $argument['name'] ] = '0';
3186
-					}
3187
-				}
3188
-			}
3189
-
3190
-			return $instance;
3191
-		}
3192
-
3193
-		/**
3194
-		 * Checks if the current call is a ajax call to get the block content.
3195
-		 *
3196
-		 * This can be used in your widget to return different content as the block content.
3197
-		 *
3198
-		 * @since 1.0.3
3199
-		 * @return bool
3200
-		 */
3201
-		public function is_block_content_call() {
3202
-			$result = false;
3203
-			if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
3204
-				$result = true;
3205
-			}
3206
-
3207
-			return $result;
3208
-		}
3209
-
3210
-		/**
3211
-		 * Get an instance hash that will be unique to the type and settings.
3212
-		 *
3213
-		 * @since 1.0.20
3214
-		 * @return string
3215
-		 */
3216
-		public function get_instance_hash(){
3217
-			$instance_string = $this->base_id.serialize($this->instance);
3218
-			return hash('crc32b',$instance_string);
3219
-		}
3220
-
3221
-		/**
3222
-		 * Generate and return inline styles from CSS rules that will match the unique class of the instance.
3223
-		 *
3224
-		 * @param array $rules
3225
-		 *
3226
-		 * @since 1.0.20
3227
-		 * @return string
3228
-		 */
3229
-		public function get_instance_style($rules = array()){
3230
-			$css = '';
3231
-
3232
-			if(!empty($rules)){
3233
-				$rules = array_unique($rules);
3234
-				$instance_hash = $this->get_instance_hash();
3235
-				$css .= "<style>";
3236
-				foreach($rules as $rule){
3237
-					$css .= ".sdel-$instance_hash $rule";
3238
-				}
3239
-				$css .= "</style>";
3240
-			}
3241
-
3242
-			return $css;
3243
-		}
3244
-
3245
-		/**
3246
-		 * Encode shortcodes tags.
3247
-		 *
3248
-		 * @since 1.0.28
3249
-		 *
3250
-		 * @param string $content Content to search for shortcode tags.
3251
-		 * @return string Content with shortcode tags removed.
3252
-		 */
3253
-		public function encode_shortcodes( $content ) {
3254
-			// Avoids existing encoded tags.
3255
-			$trans   = array(
3256
-				'&#91;' => '&#091;',
3257
-				'&#93;' => '&#093;',
3258
-				'&amp;#91;' => '&#091;',
3259
-				'&amp;#93;' => '&#093;',
3260
-				'&lt;' => '&0lt;',
3261
-				'&gt;' => '&0gt;',
3262
-				'&amp;lt;' => '&0lt;',
3263
-				'&amp;gt;' => '&0gt;',
3264
-			);
3265
-
3266
-			$content = strtr( $content, $trans );
3267
-
3268
-			$trans   = array(
3269
-				'[' => '&#91;',
3270
-				']' => '&#93;',
3271
-				'<' => '&lt;',
3272
-				'>' => '&gt;',
3273
-				'"' => '&quot;',
3274
-				"'" => '&apos;',
3275
-			);
3276
-
3277
-			$content = strtr( $content, $trans );
3278
-
3279
-			return $content;
3280
-		}
3281
-
3282
-		/**
3283
-		 * Remove encoded shortcod tags.
3284
-		 *
3285
-		 * @since 1.0.28
3286
-		 *
3287
-		 * @param string $content Content to search for shortcode tags.
3288
-		 * @return string Content with decoded shortcode tags.
3289
-		 */
3290
-		public function decode_shortcodes( $content ) {
3291
-			$trans   = array(
3292
-				'&#91;' => '[',
3293
-				'&#93;' => ']',
3294
-				'&amp;#91;' => '[',
3295
-				'&amp;#93;' => ']',
3296
-				'&lt;' => '<',
3297
-				'&gt;' => '>',
3298
-				'&amp;lt;' => '<',
3299
-				'&amp;gt;' => '>',
3300
-				'&quot;' => '"',
3301
-				'&apos;' => "'",
3302
-			);
3303
-
3304
-			$content = strtr( $content, $trans );
3305
-
3306
-			$trans   = array(
3307
-				'&#091;' => '&#91;',
3308
-				'&#093;' => '&#93;',
3309
-				'&amp;#091;' => '&#91;',
3310
-				'&amp;#093;' => '&#93;',
3311
-				'&0lt;' => '&lt;',
3312
-				'&0gt;' => '&gt;',
3313
-				'&amp;0lt;' => '&lt;',
3314
-				'&amp;0gt;' => '&gt;',
3315
-			);
3316
-
3317
-			$content = strtr( $content, $trans );
3318
-
3319
-			return $content;
3320
-		}
3321
-	}
3064
+        }
3065
+
3066
+        public function get_widget_icon($icon = 'box-top', $title = ''){
3067
+            if($icon=='box-top'){
3068
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
3069
+            }elseif($icon=='box-right'){
3070
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
3071
+            }elseif($icon=='box-bottom'){
3072
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
3073
+            }elseif($icon=='box-left'){
3074
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
3075
+            }
3076
+        }
3077
+
3078
+        /**
3079
+         * Get the widget input description html.
3080
+         *
3081
+         * @param $args
3082
+         *
3083
+         * @return string
3084
+         * @todo, need to make its own tooltip script
3085
+         */
3086
+        public function widget_field_desc( $args ) {
3087
+
3088
+            $description = '';
3089
+            if ( isset( $args['desc'] ) && $args['desc'] ) {
3090
+                if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
3091
+                    $description = $this->desc_tip( $args['desc'] );
3092
+                } else {
3093
+                    $description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
3094
+                }
3095
+            }
3096
+
3097
+            return $description;
3098
+        }
3099
+
3100
+        /**
3101
+         * Get the widget input title html.
3102
+         *
3103
+         * @param $args
3104
+         *
3105
+         * @return string
3106
+         */
3107
+        public function widget_field_title( $args ) {
3108
+
3109
+            $title = '';
3110
+            if ( isset( $args['title'] ) && $args['title'] ) {
3111
+                if ( isset( $args['icon'] ) && $args['icon'] ) {
3112
+                    $title = self::get_widget_icon( $args['icon'], $args['title']  );
3113
+                } else {
3114
+                    $title = esc_attr($args['title']);
3115
+                }
3116
+            }
3117
+
3118
+            return $title;
3119
+        }
3120
+
3121
+        /**
3122
+         * Get the tool tip html.
3123
+         *
3124
+         * @param $tip
3125
+         * @param bool $allow_html
3126
+         *
3127
+         * @return string
3128
+         */
3129
+        function desc_tip( $tip, $allow_html = false ) {
3130
+            if ( $allow_html ) {
3131
+                $tip = $this->sanitize_tooltip( $tip );
3132
+            } else {
3133
+                $tip = esc_attr( $tip );
3134
+            }
3135
+
3136
+            return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
3137
+        }
3138
+
3139
+        /**
3140
+         * Sanitize a string destined to be a tooltip.
3141
+         *
3142
+         * @param string $var
3143
+         *
3144
+         * @return string
3145
+         */
3146
+        public function sanitize_tooltip( $var ) {
3147
+            return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
3148
+                'br'     => array(),
3149
+                'em'     => array(),
3150
+                'strong' => array(),
3151
+                'small'  => array(),
3152
+                'span'   => array(),
3153
+                'ul'     => array(),
3154
+                'li'     => array(),
3155
+                'ol'     => array(),
3156
+                'p'      => array(),
3157
+            ) ) );
3158
+        }
3159
+
3160
+        /**
3161
+         * Processing widget options on save
3162
+         *
3163
+         * @param array $new_instance The new options
3164
+         * @param array $old_instance The previous options
3165
+         *
3166
+         * @return array
3167
+         * @todo we should add some sanitation here.
3168
+         */
3169
+        public function update( $new_instance, $old_instance ) {
3170
+
3171
+            //save the widget
3172
+            $instance = array_merge( (array) $old_instance, (array) $new_instance );
3173
+
3174
+            // set widget instance
3175
+            $this->instance = $instance;
3176
+
3177
+            if ( empty( $this->arguments ) ) {
3178
+                $this->get_arguments();
3179
+            }
3180
+
3181
+            // check for checkboxes
3182
+            if ( ! empty( $this->arguments ) ) {
3183
+                foreach ( $this->arguments as $argument ) {
3184
+                    if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
3185
+                        $instance[ $argument['name'] ] = '0';
3186
+                    }
3187
+                }
3188
+            }
3189
+
3190
+            return $instance;
3191
+        }
3192
+
3193
+        /**
3194
+         * Checks if the current call is a ajax call to get the block content.
3195
+         *
3196
+         * This can be used in your widget to return different content as the block content.
3197
+         *
3198
+         * @since 1.0.3
3199
+         * @return bool
3200
+         */
3201
+        public function is_block_content_call() {
3202
+            $result = false;
3203
+            if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
3204
+                $result = true;
3205
+            }
3206
+
3207
+            return $result;
3208
+        }
3209
+
3210
+        /**
3211
+         * Get an instance hash that will be unique to the type and settings.
3212
+         *
3213
+         * @since 1.0.20
3214
+         * @return string
3215
+         */
3216
+        public function get_instance_hash(){
3217
+            $instance_string = $this->base_id.serialize($this->instance);
3218
+            return hash('crc32b',$instance_string);
3219
+        }
3220
+
3221
+        /**
3222
+         * Generate and return inline styles from CSS rules that will match the unique class of the instance.
3223
+         *
3224
+         * @param array $rules
3225
+         *
3226
+         * @since 1.0.20
3227
+         * @return string
3228
+         */
3229
+        public function get_instance_style($rules = array()){
3230
+            $css = '';
3231
+
3232
+            if(!empty($rules)){
3233
+                $rules = array_unique($rules);
3234
+                $instance_hash = $this->get_instance_hash();
3235
+                $css .= "<style>";
3236
+                foreach($rules as $rule){
3237
+                    $css .= ".sdel-$instance_hash $rule";
3238
+                }
3239
+                $css .= "</style>";
3240
+            }
3241
+
3242
+            return $css;
3243
+        }
3244
+
3245
+        /**
3246
+         * Encode shortcodes tags.
3247
+         *
3248
+         * @since 1.0.28
3249
+         *
3250
+         * @param string $content Content to search for shortcode tags.
3251
+         * @return string Content with shortcode tags removed.
3252
+         */
3253
+        public function encode_shortcodes( $content ) {
3254
+            // Avoids existing encoded tags.
3255
+            $trans   = array(
3256
+                '&#91;' => '&#091;',
3257
+                '&#93;' => '&#093;',
3258
+                '&amp;#91;' => '&#091;',
3259
+                '&amp;#93;' => '&#093;',
3260
+                '&lt;' => '&0lt;',
3261
+                '&gt;' => '&0gt;',
3262
+                '&amp;lt;' => '&0lt;',
3263
+                '&amp;gt;' => '&0gt;',
3264
+            );
3265
+
3266
+            $content = strtr( $content, $trans );
3267
+
3268
+            $trans   = array(
3269
+                '[' => '&#91;',
3270
+                ']' => '&#93;',
3271
+                '<' => '&lt;',
3272
+                '>' => '&gt;',
3273
+                '"' => '&quot;',
3274
+                "'" => '&apos;',
3275
+            );
3276
+
3277
+            $content = strtr( $content, $trans );
3278
+
3279
+            return $content;
3280
+        }
3281
+
3282
+        /**
3283
+         * Remove encoded shortcod tags.
3284
+         *
3285
+         * @since 1.0.28
3286
+         *
3287
+         * @param string $content Content to search for shortcode tags.
3288
+         * @return string Content with decoded shortcode tags.
3289
+         */
3290
+        public function decode_shortcodes( $content ) {
3291
+            $trans   = array(
3292
+                '&#91;' => '[',
3293
+                '&#93;' => ']',
3294
+                '&amp;#91;' => '[',
3295
+                '&amp;#93;' => ']',
3296
+                '&lt;' => '<',
3297
+                '&gt;' => '>',
3298
+                '&amp;lt;' => '<',
3299
+                '&amp;gt;' => '>',
3300
+                '&quot;' => '"',
3301
+                '&apos;' => "'",
3302
+            );
3303
+
3304
+            $content = strtr( $content, $trans );
3305
+
3306
+            $trans   = array(
3307
+                '&#091;' => '&#91;',
3308
+                '&#093;' => '&#93;',
3309
+                '&amp;#091;' => '&#91;',
3310
+                '&amp;#093;' => '&#93;',
3311
+                '&0lt;' => '&lt;',
3312
+                '&0gt;' => '&gt;',
3313
+                '&amp;0lt;' => '&lt;',
3314
+                '&amp;0gt;' => '&gt;',
3315
+            );
3316
+
3317
+            $content = strtr( $content, $trans );
3318
+
3319
+            return $content;
3320
+        }
3321
+    }
3322 3322
 }
Please login to merge, or discard this patch.
Spacing   +578 added lines, -578 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
6
-if ( ! class_exists( 'WP_Super_Duper' ) ) {
6
+if (!class_exists('WP_Super_Duper')) {
7 7
 
8 8
 
9 9
 	/**
@@ -37,27 +37,27 @@  discard block
 block discarded – undo
37 37
 		/**
38 38
 		 * Take the array options and use them to build.
39 39
 		 */
40
-		public function __construct( $options ) {
40
+		public function __construct($options) {
41 41
 			global $sd_widgets;
42 42
 
43
-			$sd_widgets[ $options['base_id'] ] = array(
43
+			$sd_widgets[$options['base_id']] = array(
44 44
 				'name'       => $options['name'],
45 45
 				'class_name' => $options['class_name']
46 46
 			);
47
-			$this->base_id                     = $options['base_id'];
47
+			$this->base_id = $options['base_id'];
48 48
 			// lets filter the options before we do anything
49
-			$options       = apply_filters( "wp_super_duper_options", $options );
50
-			$options       = apply_filters( "wp_super_duper_options_{$this->base_id}", $options );
51
-			$options       = $this->add_name_from_key( $options );
49
+			$options       = apply_filters("wp_super_duper_options", $options);
50
+			$options       = apply_filters("wp_super_duper_options_{$this->base_id}", $options);
51
+			$options       = $this->add_name_from_key($options);
52 52
 			$this->options = $options;
53 53
 
54 54
 			$this->base_id   = $options['base_id'];
55
-			$this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
55
+			$this->arguments = isset($options['arguments']) ? $options['arguments'] : array();
56 56
 
57 57
 			// init parent
58
-			parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] );
58
+			parent::__construct($options['base_id'], $options['name'], $options['widget_ops']);
59 59
 
60
-			if ( isset( $options['class_name'] ) ) {
60
+			if (isset($options['class_name'])) {
61 61
 				// register widget
62 62
 				$this->class_name = $options['class_name'];
63 63
 
@@ -65,66 +65,66 @@  discard block
 block discarded – undo
65 65
 				$this->register_shortcode();
66 66
 
67 67
 				// Fusion Builder (avada) support
68
-				if ( function_exists( 'fusion_builder_map' ) ) {
69
-					add_action( 'init', array( $this, 'register_fusion_element' ) );
68
+				if (function_exists('fusion_builder_map')) {
69
+					add_action('init', array($this, 'register_fusion_element'));
70 70
 				}
71 71
 
72 72
 				// register block
73
-				add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
73
+				add_action('admin_enqueue_scripts', array($this, 'register_block'));
74 74
 			}
75 75
 
76 76
 			// add the CSS and JS we need ONCE
77 77
 			global $sd_widget_scripts;
78 78
 
79
-			if ( ! $sd_widget_scripts ) {
80
-				wp_add_inline_script( 'admin-widgets', $this->widget_js() );
81
-				wp_add_inline_script( 'customize-controls', $this->widget_js() );
82
-				wp_add_inline_style( 'widgets', $this->widget_css() );
79
+			if (!$sd_widget_scripts) {
80
+				wp_add_inline_script('admin-widgets', $this->widget_js());
81
+				wp_add_inline_script('customize-controls', $this->widget_js());
82
+				wp_add_inline_style('widgets', $this->widget_css());
83 83
 
84 84
 				// maybe add elementor editor styles
85
-				add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) );
85
+				add_action('elementor/editor/after_enqueue_styles', array($this, 'elementor_editor_styles'));
86 86
 
87 87
 				$sd_widget_scripts = true;
88 88
 
89 89
 				// add shortcode insert button once
90
-				add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
90
+				add_action('media_buttons', array($this, 'shortcode_insert_button'));
91 91
 				// generatepress theme sections compatibility
92
-				if ( function_exists( 'generate_sections_sections_metabox' ) ) {
93
-					add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
92
+				if (function_exists('generate_sections_sections_metabox')) {
93
+					add_action('generate_sections_metabox', array($this, 'shortcode_insert_button_script'));
94 94
 				}
95
-				if ( $this->is_preview() ) {
96
-					add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
95
+				if ($this->is_preview()) {
96
+					add_action('wp_footer', array($this, 'shortcode_insert_button_script'));
97 97
 					// this makes the insert button work for elementor
98
-					add_action( 'elementor/editor/after_enqueue_scripts', array(
98
+					add_action('elementor/editor/after_enqueue_scripts', array(
99 99
 						$this,
100 100
 						'shortcode_insert_button_script'
101
-					) ); // for elementor
101
+					)); // for elementor
102 102
 				}
103 103
 				// this makes the insert button work for cornerstone
104
-				add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) );
104
+				add_action('wp_print_footer_scripts', array(__CLASS__, 'maybe_cornerstone_builder'));
105 105
 
106
-				add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) );
107
-				add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
106
+				add_action('wp_ajax_super_duper_get_widget_settings', array(__CLASS__, 'get_widget_settings'));
107
+				add_action('wp_ajax_super_duper_get_picker', array(__CLASS__, 'get_picker'));
108 108
 
109 109
 				// add generator text to admin head
110
-				add_action( 'admin_head', array( $this, 'generator' ) );
110
+				add_action('admin_head', array($this, 'generator'));
111 111
 			}
112 112
 
113
-			do_action( 'wp_super_duper_widget_init', $options, $this );
113
+			do_action('wp_super_duper_widget_init', $options, $this);
114 114
 		}
115 115
 
116 116
 		/**
117 117
 		 * Add our widget CSS to elementor editor.
118 118
 		 */
119 119
 		public function elementor_editor_styles() {
120
-			wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) );
120
+			wp_add_inline_style('elementor-editor', $this->widget_css(false));
121 121
 		}
122 122
 
123 123
 		public function register_fusion_element() {
124 124
 
125 125
 			$options = $this->options;
126 126
 
127
-			if ( $this->base_id ) {
127
+			if ($this->base_id) {
128 128
 
129 129
 				$params = $this->get_fusion_params();
130 130
 
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
 					'allow_generator' => true,
136 136
 				);
137 137
 
138
-				if ( ! empty( $params ) ) {
138
+				if (!empty($params)) {
139 139
 					$args['params'] = $params;
140 140
 				}
141 141
 
142
-				fusion_builder_map( $args );
142
+				fusion_builder_map($args);
143 143
 			}
144 144
 
145 145
 		}
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
 			$params    = array();
149 149
 			$arguments = $this->get_arguments();
150 150
 
151
-			if ( ! empty( $arguments ) ) {
152
-				foreach ( $arguments as $key => $val ) {
151
+			if (!empty($arguments)) {
152
+				foreach ($arguments as $key => $val) {
153 153
 					$param = array();
154 154
 					// type
155 155
 					$param['type'] = str_replace(
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 						$val['type'] );
172 172
 
173 173
 					// multiselect
174
-					if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
174
+					if ($val['type'] == 'multiselect' || (($param['type'] == 'select' || $val['type'] == 'select') && !empty($val['multiple']))) {
175 175
 						$param['type']     = 'multiple_select';
176 176
 						$param['multiple'] = true;
177 177
 					}
@@ -180,29 +180,29 @@  discard block
 block discarded – undo
180 180
 					$param['heading'] = $val['title'];
181 181
 
182 182
 					// description
183
-					$param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
183
+					$param['description'] = isset($val['desc']) ? $val['desc'] : '';
184 184
 
185 185
 					// param_name
186 186
 					$param['param_name'] = $key;
187 187
 
188 188
 					// Default
189
-					$param['default'] = isset( $val['default'] ) ? $val['default'] : '';
189
+					$param['default'] = isset($val['default']) ? $val['default'] : '';
190 190
 
191 191
 					// Group
192
-					if ( isset( $val['group'] ) ) {
192
+					if (isset($val['group'])) {
193 193
 						$param['group'] = $val['group'];
194 194
 					}
195 195
 
196 196
 					// value
197
-					if ( $val['type'] == 'checkbox' ) {
198
-						if ( isset( $val['default'] ) && $val['default'] == '0' ) {
199
-							unset( $param['default'] );
197
+					if ($val['type'] == 'checkbox') {
198
+						if (isset($val['default']) && $val['default'] == '0') {
199
+							unset($param['default']);
200 200
 						}
201
-						$param['value'] = array( '' => __( "No" ), '1' => __( "Yes" ) );
202
-					} elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
203
-						$param['value'] = isset( $val['options'] ) ? $val['options'] : array();
201
+						$param['value'] = array('' => __("No"), '1' => __("Yes"));
202
+					} elseif ($param['type'] == 'select' || $param['type'] == 'multiple_select') {
203
+						$param['value'] = isset($val['options']) ? $val['options'] : array();
204 204
 					} else {
205
-						$param['value'] = isset( $val['default'] ) ? $val['default'] : '';
205
+						$param['value'] = isset($val['default']) ? $val['default'] : '';
206 206
 					}
207 207
 
208 208
 					// setup the param
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 		 * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
220 220
 		 */
221 221
 		public static function maybe_cornerstone_builder() {
222
-			if ( did_action( 'cornerstone_before_boot_app' ) ) {
222
+			if (did_action('cornerstone_before_boot_app')) {
223 223
 				self::shortcode_insert_button_script();
224 224
 			}
225 225
 		}
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 		 *
232 232
 		 * @return string
233 233
 		 */
234
-		public static function get_picker( $editor_id = '' ) {
234
+		public static function get_picker($editor_id = '') {
235 235
 
236 236
 			ob_start();
237
-			if ( isset( $_POST['editor_id'] ) ) {
238
-				$editor_id = esc_attr( $_POST['editor_id'] );
239
-			} elseif ( isset( $_REQUEST['et_fb'] ) ) {
237
+			if (isset($_POST['editor_id'])) {
238
+				$editor_id = esc_attr($_POST['editor_id']);
239
+			} elseif (isset($_REQUEST['et_fb'])) {
240 240
 				$editor_id = 'main_content_content_vb_tiny_mce';
241 241
 			}
242 242
 
@@ -245,13 +245,13 @@  discard block
 block discarded – undo
245 245
 
246 246
 			<div class="sd-shortcode-left-wrap">
247 247
 				<?php
248
-				ksort( $sd_widgets );
248
+				ksort($sd_widgets);
249 249
 				//				print_r($sd_widgets);exit;
250
-				if ( ! empty( $sd_widgets ) ) {
250
+				if (!empty($sd_widgets)) {
251 251
 					echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
252
-					echo "<option>" . __( 'Select shortcode' ) . "</option>";
253
-					foreach ( $sd_widgets as $shortcode => $class ) {
254
-						echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
252
+					echo "<option>" . __('Select shortcode') . "</option>";
253
+					foreach ($sd_widgets as $shortcode => $class) {
254
+						echo "<option value='" . esc_attr($shortcode) . "'>" . esc_attr($shortcode) . " (" . esc_attr($class['name']) . ")</option>";
255 255
 					}
256 256
 					echo "</select>";
257 257
 
@@ -264,37 +264,37 @@  discard block
 block discarded – undo
264 264
 			<div class="sd-shortcode-right-wrap">
265 265
 				<textarea id='sd-shortcode-output' disabled></textarea>
266 266
 				<div id='sd-shortcode-output-actions'>
267
-					<?php if ( $editor_id != '' ) { ?>
267
+					<?php if ($editor_id != '') { ?>
268 268
 						<button class="button sd-insert-shortcode-button"
269
-						        onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) {
269
+						        onclick="sd_insert_shortcode(<?php if (!empty($editor_id)) {
270 270
 							        echo "'" . $editor_id . "'";
271
-						        } ?>)"><?php _e( 'Insert shortcode' ); ?></button>
271
+						        } ?>)"><?php _e('Insert shortcode'); ?></button>
272 272
 					<?php } ?>
273 273
 					<button class="button"
274
-					        onclick="sd_copy_to_clipboard()"><?php _e( 'Copy shortcode' ); ?></button>
274
+					        onclick="sd_copy_to_clipboard()"><?php _e('Copy shortcode'); ?></button>
275 275
 				</div>
276 276
 			</div>
277 277
 			<?php
278 278
 
279 279
 			$html = ob_get_clean();
280 280
 
281
-			if ( wp_doing_ajax() ) {
281
+			if (wp_doing_ajax()) {
282 282
 				echo $html;
283 283
 				$should_die = true;
284 284
 
285 285
 				// some builder get the editor via ajax so we should not die on those occasions
286 286
 				$dont_die = array(
287
-					'parent_tag',// WP Bakery
287
+					'parent_tag', // WP Bakery
288 288
 					'avia_request' // enfold
289 289
 				);
290 290
 
291
-				foreach ( $dont_die as $request ) {
292
-					if ( isset( $_REQUEST[ $request ] ) ) {
291
+				foreach ($dont_die as $request) {
292
+					if (isset($_REQUEST[$request])) {
293 293
 						$should_die = false;
294 294
 					}
295 295
 				}
296 296
 
297
-				if ( $should_die ) {
297
+				if ($should_die) {
298 298
 					wp_die();
299 299
 				}
300 300
 
@@ -321,16 +321,16 @@  discard block
 block discarded – undo
321 321
 		public static function get_widget_settings() {
322 322
 			global $sd_widgets;
323 323
 
324
-			$shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : '';
325
-			if ( ! $shortcode ) {
324
+			$shortcode = isset($_REQUEST['shortcode']) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes($_REQUEST['shortcode']) : '';
325
+			if (!$shortcode) {
326 326
 				wp_die();
327 327
 			}
328
-			$widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : '';
329
-			if ( ! $widget_args ) {
328
+			$widget_args = isset($sd_widgets[$shortcode]) ? $sd_widgets[$shortcode] : '';
329
+			if (!$widget_args) {
330 330
 				wp_die();
331 331
 			}
332
-			$class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
333
-			if ( ! $class_name ) {
332
+			$class_name = isset($widget_args['class_name']) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
333
+			if (!$class_name) {
334 334
 				wp_die();
335 335
 			}
336 336
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 			$widget = new $class_name;
339 339
 
340 340
 			ob_start();
341
-			$widget->form( array() );
341
+			$widget->form(array());
342 342
 			$form = ob_get_clean();
343 343
 			echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>";
344 344
 			echo "<style>" . $widget->widget_css() . "</style>";
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
 		 * @param string $editor_id Optional. Shortcode editor id. Default null.
357 357
 		 * @param string $insert_shortcode_function Optional. Insert shortcode function. Default null.
358 358
 		 */
359
-		public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
359
+		public static function shortcode_insert_button($editor_id = '', $insert_shortcode_function = '') {
360 360
 			global $sd_widgets, $shortcode_insert_button_once;
361
-			if ( $shortcode_insert_button_once ) {
361
+			if ($shortcode_insert_button_once) {
362 362
 				return;
363 363
 			}
364 364
 			add_thickbox();
@@ -368,21 +368,21 @@  discard block
 block discarded – undo
368 368
 			 * Cornerstone makes us play dirty tricks :/
369 369
 			 * All media_buttons are removed via JS unless they are two specific id's so we wrap our content in this ID so it is not removed.
370 370
 			 */
371
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
371
+			if (function_exists('cornerstone_plugin_init') && !is_admin()) {
372 372
 				echo '<span id="insert-media-button">';
373 373
 			}
374 374
 
375
-			echo self::shortcode_button( 'this', 'true' );
375
+			echo self::shortcode_button('this', 'true');
376 376
 
377 377
 			// see opening note
378
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
378
+			if (function_exists('cornerstone_plugin_init') && !is_admin()) {
379 379
 				echo '</span>'; // end #insert-media-button
380 380
 			}
381 381
 
382 382
 			// Add separate script for generatepress theme sections
383
-			if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
383
+			if (function_exists('generate_sections_sections_metabox') && did_action('generate_sections_metabox')) {
384 384
 			} else {
385
-				self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
385
+				self::shortcode_insert_button_script($editor_id, $insert_shortcode_function);
386 386
 			}
387 387
 
388 388
 			$shortcode_insert_button_once = true;
@@ -396,12 +396,12 @@  discard block
 block discarded – undo
396 396
 		 *
397 397
 		 * @return mixed
398 398
 		 */
399
-		public static function shortcode_button( $id = '', $search_for_id = '' ) {
399
+		public static function shortcode_button($id = '', $search_for_id = '') {
400 400
 			ob_start();
401 401
 			?>
402 402
 			<span class="sd-lable-shortcode-inserter">
403 403
 				<a onclick="sd_ajax_get_picker(<?php echo $id;
404
-				if ( $search_for_id ) {
404
+				if ($search_for_id) {
405 405
 					echo "," . $search_for_id;
406 406
 				} ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
407 407
 				   class="thickbox button super-duper-content-open" title="Add Shortcode">
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 			$html = ob_get_clean();
418 418
 
419 419
 			// remove line breaks so we can use it in js
420
-			return preg_replace( "/\r|\n/", "", trim( $html ) );
420
+			return preg_replace("/\r|\n/", "", trim($html));
421 421
 		}
422 422
 
423 423
 		/**
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 						jQuery($this).data('sd-widget-enabled', true);
476 476
 					}
477 477
 
478
-					var $button = '<button title="<?php _e( 'Advanced Settings' );?>" class="button button-primary right sd-advanced-button" onclick="sd_so_toggle_advanced(this);return false;"><i class="fas fa-sliders-h" aria-hidden="true"></i></button>';
478
+					var $button = '<button title="<?php _e('Advanced Settings'); ?>" class="button button-primary right sd-advanced-button" onclick="sd_so_toggle_advanced(this);return false;"><i class="fas fa-sliders-h" aria-hidden="true"></i></button>';
479 479
 					var form = jQuery($this).parents('' + $selector + '');
480 480
 
481 481
 					if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) {
@@ -512,10 +512,10 @@  discard block
 block discarded – undo
512 512
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
513 513
 			 */
514 514
 
515
-			return str_replace( array(
515
+			return str_replace(array(
516 516
 				'<script>',
517 517
 				'</script>'
518
-			), '', $output );
518
+			), '', $output);
519 519
 		}
520 520
 
521 521
 		/**
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 		 * @param string $editor_id
527 527
 		 * @param string $insert_shortcode_function
528 528
 		 */
529
-		public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
529
+		public static function shortcode_insert_button_script($editor_id = '', $insert_shortcode_function = '') {
530 530
 			?>
531 531
 			<style>
532 532
 				.sd-shortcode-left-wrap {
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 					width: 100%;
646 646
 				}
647 647
 
648
-				<?php if ( function_exists( 'generate_sections_sections_metabox' ) ) { ?>
648
+				<?php if (function_exists('generate_sections_sections_metabox')) { ?>
649 649
 				.generate-sections-modal #custom-media-buttons > .sd-lable-shortcode-inserter {
650 650
 					display: inline;
651 651
 				}
@@ -653,15 +653,15 @@  discard block
 block discarded – undo
653 653
 				<?php } ?>
654 654
 			</style>
655 655
 			<?php
656
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
656
+			if (class_exists('SiteOrigin_Panels')) {
657 657
 				echo "<script>" . self::siteorigin_js() . "</script>";
658 658
 			}
659 659
 			?>
660 660
 			<script>
661 661
 				<?php
662
-				if(! empty( $insert_shortcode_function )){
662
+				if (!empty($insert_shortcode_function)) {
663 663
 					echo $insert_shortcode_function;
664
-				}else{
664
+				} else {
665 665
 
666 666
 				/**
667 667
 				 * Function for super duper insert shortcode.
@@ -674,9 +674,9 @@  discard block
 block discarded – undo
674 674
 					if ($shortcode) {
675 675
 						if (!$editor_id) {
676 676
 							<?php
677
-							if ( isset( $_REQUEST['et_fb'] ) ) {
677
+							if (isset($_REQUEST['et_fb'])) {
678 678
 								echo '$editor_id = "#main_content_content_vb_tiny_mce";';
679
-							} elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
679
+							} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') {
680 680
 								echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
681 681
 							} else {
682 682
 								echo '$editor_id = "#wp-content-editor-container textarea";';
@@ -761,11 +761,11 @@  discard block
 block discarded – undo
761 761
 							'shortcode': $short_code,
762 762
 							'attributes': 123,
763 763
 							'post_id': 321,
764
-							'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
764
+							'_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>'
765 765
 						};
766 766
 
767 767
 						if (typeof ajaxurl === 'undefined') {
768
-							var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' );?>";
768
+							var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
769 769
 						}
770 770
 
771 771
 						jQuery.post(ajaxurl, data, function (response) {
@@ -974,11 +974,11 @@  discard block
 block discarded – undo
974 974
 					var data = {
975 975
 						'action': 'super_duper_get_picker',
976 976
 						'editor_id': $id,
977
-						'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_picker' );?>'
977
+						'_ajax_nonce': '<?php echo wp_create_nonce('super_duper_picker'); ?>'
978 978
 					};
979 979
 
980 980
 					if (!ajaxurl) {
981
-						var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' ); ?>";
981
+						var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
982 982
 					}
983 983
 
984 984
 					jQuery.post(ajaxurl, data, function (response) {
@@ -999,9 +999,9 @@  discard block
 block discarded – undo
999 999
 				 */
1000 1000
 				function sd_shortcode_button($id) {
1001 1001
 					if ($id) {
1002
-						return '<?php echo self::shortcode_button( "\\''+\$id+'\\'" );?>';
1002
+						return '<?php echo self::shortcode_button("\\''+\$id+'\\'"); ?>';
1003 1003
 					} else {
1004
-						return '<?php echo self::shortcode_button();?>';
1004
+						return '<?php echo self::shortcode_button(); ?>';
1005 1005
 					}
1006 1006
 				}
1007 1007
 
@@ -1016,11 +1016,11 @@  discard block
 block discarded – undo
1016 1016
 		 *
1017 1017
 		 * @return mixed
1018 1018
 		 */
1019
-		public function widget_css( $advanced = true ) {
1019
+		public function widget_css($advanced = true) {
1020 1020
 			ob_start();
1021 1021
 			?>
1022 1022
 			<style>
1023
-				<?php if( $advanced ){ ?>
1023
+				<?php if ($advanced) { ?>
1024 1024
 				.sd-advanced-setting {
1025 1025
 					display: none;
1026 1026
 				}
@@ -1062,10 +1062,10 @@  discard block
 block discarded – undo
1062 1062
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1063 1063
 			 */
1064 1064
 
1065
-			return str_replace( array(
1065
+			return str_replace(array(
1066 1066
 				'<style>',
1067 1067
 				'</style>'
1068
-			), '', $output );
1068
+			), '', $output);
1069 1069
 		}
1070 1070
 
1071 1071
 		/**
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
 						jQuery($this).data('sd-widget-enabled', true);
1136 1136
 					}
1137 1137
 
1138
-					var $button = '<button title="<?php _e( 'Advanced Settings' );?>" style="line-height: 28px;" class="button button-primary right sd-advanced-button" onclick="sd_toggle_advanced(this);return false;"><span class="dashicons dashicons-admin-settings" style="width: 28px;font-size: 28px;"></span></button>';
1138
+					var $button = '<button title="<?php _e('Advanced Settings'); ?>" style="line-height: 28px;" class="button button-primary right sd-advanced-button" onclick="sd_toggle_advanced(this);return false;"><span class="dashicons dashicons-admin-settings" style="width: 28px;font-size: 28px;"></span></button>';
1139 1139
 					var form = jQuery($this).parents('' + $selector + '');
1140 1140
 
1141 1141
 					if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) {
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
 					});
1231 1231
 
1232 1232
 				}
1233
-				<?php do_action( 'wp_super_duper_widget_js', $this ); ?>
1233
+				<?php do_action('wp_super_duper_widget_js', $this); ?>
1234 1234
 			</script>
1235 1235
 			<?php
1236 1236
 			$output = ob_get_clean();
@@ -1239,10 +1239,10 @@  discard block
 block discarded – undo
1239 1239
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1240 1240
 			 */
1241 1241
 
1242
-			return str_replace( array(
1242
+			return str_replace(array(
1243 1243
 				'<script>',
1244 1244
 				'</script>'
1245
-			), '', $output );
1245
+			), '', $output);
1246 1246
 		}
1247 1247
 
1248 1248
 
@@ -1253,14 +1253,14 @@  discard block
 block discarded – undo
1253 1253
 		 *
1254 1254
 		 * @return mixed
1255 1255
 		 */
1256
-		private function add_name_from_key( $options, $arguments = false ) {
1257
-			if ( ! empty( $options['arguments'] ) ) {
1258
-				foreach ( $options['arguments'] as $key => $val ) {
1259
-					$options['arguments'][ $key ]['name'] = $key;
1256
+		private function add_name_from_key($options, $arguments = false) {
1257
+			if (!empty($options['arguments'])) {
1258
+				foreach ($options['arguments'] as $key => $val) {
1259
+					$options['arguments'][$key]['name'] = $key;
1260 1260
 				}
1261
-			} elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
1262
-				foreach ( $options as $key => $val ) {
1263
-					$options[ $key ]['name'] = $key;
1261
+			} elseif ($arguments && is_array($options) && !empty($options)) {
1262
+				foreach ($options as $key => $val) {
1263
+					$options[$key]['name'] = $key;
1264 1264
 				}
1265 1265
 			}
1266 1266
 
@@ -1273,8 +1273,8 @@  discard block
 block discarded – undo
1273 1273
 		 * @since 1.0.0
1274 1274
 		 */
1275 1275
 		public function register_shortcode() {
1276
-			add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) );
1277
-			add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) );
1276
+			add_shortcode($this->base_id, array($this, 'shortcode_output'));
1277
+			add_action('wp_ajax_super_duper_output_shortcode', array($this, 'render_shortcode'));
1278 1278
 		}
1279 1279
 
1280 1280
 		/**
@@ -1283,50 +1283,50 @@  discard block
 block discarded – undo
1283 1283
 		 * @since 1.0.0
1284 1284
 		 */
1285 1285
 		public function render_shortcode() {
1286
-			check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
1287
-			if ( ! current_user_can( 'manage_options' ) ) {
1286
+			check_ajax_referer('super_duper_output_shortcode', '_ajax_nonce', true);
1287
+			if (!current_user_can('manage_options')) {
1288 1288
 				wp_die();
1289 1289
 			}
1290 1290
 
1291 1291
 			// we might need the $post value here so lets set it.
1292
-			if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
1293
-				$post_obj = get_post( absint( $_POST['post_id'] ) );
1294
-				if ( ! empty( $post_obj ) && empty( $post ) ) {
1292
+			if (isset($_POST['post_id']) && $_POST['post_id']) {
1293
+				$post_obj = get_post(absint($_POST['post_id']));
1294
+				if (!empty($post_obj) && empty($post)) {
1295 1295
 					global $post;
1296 1296
 					$post = $post_obj;
1297 1297
 				}
1298 1298
 			}
1299 1299
 
1300
-			if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) {
1300
+			if (isset($_POST['shortcode']) && $_POST['shortcode']) {
1301 1301
 				$is_preview = $this->is_preview();
1302
-				$shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
1303
-				$attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
1302
+				$shortcode_name   = sanitize_title_with_dashes($_POST['shortcode']);
1303
+				$attributes_array = isset($_POST['attributes']) && $_POST['attributes'] ? $_POST['attributes'] : array();
1304 1304
 				$attributes       = '';
1305
-				if ( ! empty( $attributes_array ) ) {
1306
-					foreach ( $attributes_array as $key => $value ) {
1307
-						if ( is_array( $value ) ) {
1308
-							$value = implode( ",", $value );
1305
+				if (!empty($attributes_array)) {
1306
+					foreach ($attributes_array as $key => $value) {
1307
+						if (is_array($value)) {
1308
+							$value = implode(",", $value);
1309 1309
 						}
1310 1310
 
1311
-						if ( ! empty( $value ) ) {
1312
-							$value = wp_unslash( $value );
1311
+						if (!empty($value)) {
1312
+							$value = wp_unslash($value);
1313 1313
 
1314 1314
 							// Encode [ and ].
1315
-							if ( $is_preview ) {
1316
-								$value = $this->encode_shortcodes( $value );
1315
+							if ($is_preview) {
1316
+								$value = $this->encode_shortcodes($value);
1317 1317
 							}
1318 1318
 						}
1319
-						$attributes .= " " . sanitize_title_with_dashes( $key ) . "='" . esc_attr( $value ) . "' ";
1319
+						$attributes .= " " . sanitize_title_with_dashes($key) . "='" . esc_attr($value) . "' ";
1320 1320
 					}
1321 1321
 				}
1322 1322
 
1323 1323
 				$shortcode = "[" . $shortcode_name . " " . $attributes . "]";
1324 1324
 
1325
-				$content = do_shortcode( $shortcode );
1325
+				$content = do_shortcode($shortcode);
1326 1326
 
1327 1327
 				// Decode [ and ].
1328
-				if ( ! empty( $content ) && $is_preview ) {
1329
-					$content = $this->decode_shortcodes( $content );
1328
+				if (!empty($content) && $is_preview) {
1329
+					$content = $this->decode_shortcodes($content);
1330 1330
 				}
1331 1331
 
1332 1332
 				echo $content;
@@ -1342,21 +1342,21 @@  discard block
 block discarded – undo
1342 1342
 		 *
1343 1343
 		 * @return string
1344 1344
 		 */
1345
-		public function shortcode_output( $args = array(), $content = '' ) {
1345
+		public function shortcode_output($args = array(), $content = '') {
1346 1346
 			$_instance = $args;
1347 1347
 
1348
-			$args = $this->argument_values( $args );
1348
+			$args = $this->argument_values($args);
1349 1349
 
1350 1350
 			// add extra argument so we know its a output to gutenberg
1351 1351
 			//$args
1352
-			$args = $this->string_to_bool( $args );
1352
+			$args = $this->string_to_bool($args);
1353 1353
 
1354 1354
 			// if we have a enclosed shortcode we add it to the special `html` argument
1355
-			if ( ! empty( $content ) ) {
1355
+			if (!empty($content)) {
1356 1356
 				$args['html'] = $content;
1357 1357
 			}
1358 1358
 
1359
-			if ( ! $this->is_preview() ) {
1359
+			if (!$this->is_preview()) {
1360 1360
 				/**
1361 1361
 				 * Filters the settings for a particular widget args.
1362 1362
 				 *
@@ -1366,40 +1366,40 @@  discard block
 block discarded – undo
1366 1366
 				 * @param WP_Super_Duper $widget    The current widget settings.
1367 1367
 				 * @param array          $_instance An array of default widget arguments.
1368 1368
 				 */
1369
-				$args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance );
1369
+				$args = apply_filters('wp_super_duper_widget_display_callback', $args, $this, $_instance);
1370 1370
 
1371
-				if ( ! is_array( $args ) ) {
1371
+				if (!is_array($args)) {
1372 1372
 					return $args;
1373 1373
 				}
1374 1374
 			}
1375 1375
 
1376
-			$class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : '';
1377
-			$class .= " sdel-".$this->get_instance_hash();
1376
+			$class = isset($this->options['widget_ops']['classname']) ? esc_attr($this->options['widget_ops']['classname']) : '';
1377
+			$class .= " sdel-" . $this->get_instance_hash();
1378 1378
 
1379
-			$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
1380
-			$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
1379
+			$class = apply_filters('wp_super_duper_div_classname', $class, $args, $this);
1380
+			$class = apply_filters('wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this);
1381 1381
 
1382
-			$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
1383
-			$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
1382
+			$attrs = apply_filters('wp_super_duper_div_attrs', '', $args, $this);
1383
+			$attrs = apply_filters('wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this);
1384 1384
 
1385 1385
 			$shortcode_args = array();
1386 1386
 			$output         = '';
1387
-			$no_wrap        = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1388
-			if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) {
1387
+			$no_wrap        = isset($this->options['no_wrap']) && $this->options['no_wrap'] ? true : false;
1388
+			if (isset($args['no_wrap']) && $args['no_wrap']) {
1389 1389
 				$no_wrap = true;
1390 1390
 			}
1391
-			$main_content = $this->output( $args, $shortcode_args, $content );
1392
-			if ( $main_content && ! $no_wrap ) {
1391
+			$main_content = $this->output($args, $shortcode_args, $content);
1392
+			if ($main_content && !$no_wrap) {
1393 1393
 				// wrap the shortcode in a div with the same class as the widget
1394 1394
 				$output .= '<div class="' . $class . '" ' . $attrs . '>';
1395
-				if ( ! empty( $args['title'] ) ) {
1395
+				if (!empty($args['title'])) {
1396 1396
 					// if its a shortcode and there is a title try to grab the title wrappers
1397
-					$shortcode_args = array( 'before_title' => '', 'after_title' => '' );
1398
-					if ( empty( $instance ) ) {
1397
+					$shortcode_args = array('before_title' => '', 'after_title' => '');
1398
+					if (empty($instance)) {
1399 1399
 						global $wp_registered_sidebars;
1400
-						if ( ! empty( $wp_registered_sidebars ) ) {
1401
-							foreach ( $wp_registered_sidebars as $sidebar ) {
1402
-								if ( ! empty( $sidebar['before_title'] ) ) {
1400
+						if (!empty($wp_registered_sidebars)) {
1401
+							foreach ($wp_registered_sidebars as $sidebar) {
1402
+								if (!empty($sidebar['before_title'])) {
1403 1403
 									$shortcode_args['before_title'] = $sidebar['before_title'];
1404 1404
 									$shortcode_args['after_title']  = $sidebar['after_title'];
1405 1405
 									break;
@@ -1407,20 +1407,20 @@  discard block
 block discarded – undo
1407 1407
 							}
1408 1408
 						}
1409 1409
 					}
1410
-					$output .= $this->output_title( $shortcode_args, $args );
1410
+					$output .= $this->output_title($shortcode_args, $args);
1411 1411
 				}
1412 1412
 				$output .= $main_content;
1413 1413
 				$output .= '</div>';
1414
-			} elseif ( $main_content && $no_wrap ) {
1414
+			} elseif ($main_content && $no_wrap) {
1415 1415
 				$output .= $main_content;
1416 1416
 			}
1417 1417
 
1418 1418
 			// if preview show a placeholder if empty
1419
-			if ( $this->is_preview() && $output == '' ) {
1420
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
1419
+			if ($this->is_preview() && $output == '') {
1420
+				$output = $this->preview_placeholder_text("{{" . $this->base_id . "}}");
1421 1421
 			}
1422 1422
 
1423
-			return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
1423
+			return apply_filters('wp_super_duper_widget_output', $output, $args, $shortcode_args, $this);
1424 1424
 		}
1425 1425
 
1426 1426
 		/**
@@ -1430,8 +1430,8 @@  discard block
 block discarded – undo
1430 1430
 		 *
1431 1431
 		 * @return string
1432 1432
 		 */
1433
-		public function preview_placeholder_text( $name = '' ) {
1434
-			return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf( __( 'Placeholder for: %s' ), $name ) . "</div>";
1433
+		public function preview_placeholder_text($name = '') {
1434
+			return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf(__('Placeholder for: %s'), $name) . "</div>";
1435 1435
 		}
1436 1436
 
1437 1437
 		/**
@@ -1441,13 +1441,13 @@  discard block
 block discarded – undo
1441 1441
 		 *
1442 1442
 		 * @return mixed
1443 1443
 		 */
1444
-		public function string_to_bool( $options ) {
1444
+		public function string_to_bool($options) {
1445 1445
 			// convert bool strings to booleans
1446
-			foreach ( $options as $key => $val ) {
1447
-				if ( $val == 'false' ) {
1448
-					$options[ $key ] = false;
1449
-				} elseif ( $val == 'true' ) {
1450
-					$options[ $key ] = true;
1446
+			foreach ($options as $key => $val) {
1447
+				if ($val == 'false') {
1448
+					$options[$key] = false;
1449
+				} elseif ($val == 'true') {
1450
+					$options[$key] = true;
1451 1451
 				}
1452 1452
 			}
1453 1453
 
@@ -1463,26 +1463,26 @@  discard block
 block discarded – undo
1463 1463
 		 *
1464 1464
 		 * @return array
1465 1465
 		 */
1466
-		public function argument_values( $instance ) {
1466
+		public function argument_values($instance) {
1467 1467
 			$argument_values = array();
1468 1468
 
1469 1469
 			// set widget instance
1470 1470
 			$this->instance = $instance;
1471 1471
 
1472
-			if ( empty( $this->arguments ) ) {
1472
+			if (empty($this->arguments)) {
1473 1473
 				$this->arguments = $this->get_arguments();
1474 1474
 			}
1475 1475
 
1476
-			if ( ! empty( $this->arguments ) ) {
1477
-				foreach ( $this->arguments as $key => $args ) {
1476
+			if (!empty($this->arguments)) {
1477
+				foreach ($this->arguments as $key => $args) {
1478 1478
 					// set the input name from the key
1479 1479
 					$args['name'] = $key;
1480 1480
 					//
1481
-					$argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
1482
-					if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
1481
+					$argument_values[$key] = isset($instance[$key]) ? $instance[$key] : '';
1482
+					if ($args['type'] == 'checkbox' && $argument_values[$key] == '') {
1483 1483
 						// don't set default for an empty checkbox
1484
-					} elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
1485
-						$argument_values[ $key ] = $args['default'];
1484
+					} elseif ($argument_values[$key] == '' && isset($args['default'])) {
1485
+						$argument_values[$key] = $args['default'];
1486 1486
 					}
1487 1487
 				}
1488 1488
 			}
@@ -1509,12 +1509,12 @@  discard block
 block discarded – undo
1509 1509
 		 * @return array Get arguments.
1510 1510
 		 */
1511 1511
 		public function get_arguments() {
1512
-			if ( empty( $this->arguments ) ) {
1512
+			if (empty($this->arguments)) {
1513 1513
 				$this->arguments = $this->set_arguments();
1514 1514
 			}
1515 1515
 
1516
-			$this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
1517
-			$this->arguments = $this->add_name_from_key( $this->arguments, true );
1516
+			$this->arguments = apply_filters('wp_super_duper_arguments', $this->arguments, $this->options, $this->instance);
1517
+			$this->arguments = $this->add_name_from_key($this->arguments, true);
1518 1518
 
1519 1519
 			return $this->arguments;
1520 1520
 		}
@@ -1526,7 +1526,7 @@  discard block
 block discarded – undo
1526 1526
 		 * @param array $widget_args
1527 1527
 		 * @param string $content
1528 1528
 		 */
1529
-		public function output( $args = array(), $widget_args = array(), $content = '' ) {
1529
+		public function output($args = array(), $widget_args = array(), $content = '') {
1530 1530
 
1531 1531
 		}
1532 1532
 
@@ -1534,9 +1534,9 @@  discard block
 block discarded – undo
1534 1534
 		 * Add the dynamic block code inline when the wp-block in enqueued.
1535 1535
 		 */
1536 1536
 		public function register_block() {
1537
-			wp_add_inline_script( 'wp-blocks', $this->block() );
1538
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
1539
-				wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() );
1537
+			wp_add_inline_script('wp-blocks', $this->block());
1538
+			if (class_exists('SiteOrigin_Panels')) {
1539
+				wp_add_inline_script('wp-blocks', $this->siteorigin_js());
1540 1540
 			}
1541 1541
 		}
1542 1542
 
@@ -1550,9 +1550,9 @@  discard block
 block discarded – undo
1550 1550
 			$show      = false;
1551 1551
 			$arguments = $this->get_arguments();
1552 1552
 			
1553
-			if ( ! empty( $arguments ) ) {
1554
-				foreach ( $arguments as $argument ) {
1555
-					if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1553
+			if (!empty($arguments)) {
1554
+				foreach ($arguments as $argument) {
1555
+					if (isset($argument['advanced']) && $argument['advanced']) {
1556 1556
 						$show = true;
1557 1557
 						break; // no need to continue if we know we have it
1558 1558
 					}
@@ -1571,15 +1571,15 @@  discard block
 block discarded – undo
1571 1571
 
1572 1572
 			$url = $this->url;
1573 1573
 
1574
-			if ( ! $url ) {
1574
+			if (!$url) {
1575 1575
 				// check if we are inside a plugin
1576
-				$file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
1576
+				$file_dir = str_replace("/includes", "", dirname(__FILE__));
1577 1577
 
1578
-				$dir_parts = explode( "/wp-content/", $file_dir );
1579
-				$url_parts = explode( "/wp-content/", plugins_url() );
1578
+				$dir_parts = explode("/wp-content/", $file_dir);
1579
+				$url_parts = explode("/wp-content/", plugins_url());
1580 1580
 
1581
-				if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
1582
-					$url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
1581
+				if (!empty($url_parts[0]) && !empty($dir_parts[1])) {
1582
+					$url       = trailingslashit($url_parts[0] . "/wp-content/" . $dir_parts[1]);
1583 1583
 					$this->url = $url;
1584 1584
 				}
1585 1585
 			}
@@ -1600,46 +1600,46 @@  discard block
 block discarded – undo
1600 1600
 		 * @since 1.1.0
1601 1601
 		 * @return string
1602 1602
 		 */
1603
-		public function get_block_icon( $icon ) {
1603
+		public function get_block_icon($icon) {
1604 1604
 
1605 1605
 			// check if we have a Font Awesome icon
1606 1606
 			$fa_type = '';
1607
-			if ( substr( $icon, 0, 7 ) === "fas fa-" ) {
1607
+			if (substr($icon, 0, 7) === "fas fa-") {
1608 1608
 				$fa_type = 'solid';
1609
-			} elseif ( substr( $icon, 0, 7 ) === "far fa-" ) {
1609
+			} elseif (substr($icon, 0, 7) === "far fa-") {
1610 1610
 				$fa_type = 'regular';
1611
-			} elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) {
1611
+			} elseif (substr($icon, 0, 7) === "fab fa-") {
1612 1612
 				$fa_type = 'brands';
1613 1613
 			} else {
1614 1614
 				$icon = "'" . $icon . "'";
1615 1615
 			}
1616 1616
 
1617 1617
 			// set the icon if we found one
1618
-			if ( $fa_type ) {
1619
-				$fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon );
1618
+			if ($fa_type) {
1619
+				$fa_icon = str_replace(array("fas fa-", "far fa-", "fab fa-"), "", $icon);
1620 1620
 				$icon    = "el('svg',{width: 20, height: 20, viewBox: '0 0 20 20'},el('use', {'xlink:href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "','href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "'}))";
1621 1621
 			}
1622 1622
 
1623 1623
 			return $icon;
1624 1624
 		}
1625 1625
 
1626
-		public function group_arguments( $arguments ) {
1626
+		public function group_arguments($arguments) {
1627 1627
 //			echo '###';print_r($arguments);
1628
-			if ( ! empty( $arguments ) ) {
1628
+			if (!empty($arguments)) {
1629 1629
 				$temp_arguments = array();
1630
-				$general        = __( "General" );
1630
+				$general        = __("General");
1631 1631
 				$add_sections   = false;
1632
-				foreach ( $arguments as $key => $args ) {
1633
-					if ( isset( $args['group'] ) ) {
1634
-						$temp_arguments[ $args['group'] ][ $key ] = $args;
1632
+				foreach ($arguments as $key => $args) {
1633
+					if (isset($args['group'])) {
1634
+						$temp_arguments[$args['group']][$key] = $args;
1635 1635
 						$add_sections                             = true;
1636 1636
 					} else {
1637
-						$temp_arguments[ $general ][ $key ] = $args;
1637
+						$temp_arguments[$general][$key] = $args;
1638 1638
 					}
1639 1639
 				}
1640 1640
 
1641 1641
 				// only add sections if more than one
1642
-				if ( $add_sections ) {
1642
+				if ($add_sections) {
1643 1643
 					$arguments = $temp_arguments;
1644 1644
 				}
1645 1645
 			}
@@ -1683,9 +1683,9 @@  discard block
 block discarded – undo
1683 1683
 					var prev_attributes = [];
1684 1684
 
1685 1685
 					var term_query_type = '';
1686
-					var post_type_rest_slugs = <?php if(! empty( $this->arguments ) && isset($this->arguments['post_type']['onchange_rest']['values'])){echo "[".json_encode($this->arguments['post_type']['onchange_rest']['values'])."]";}else{echo "[]";} ?>;
1687
-					const taxonomies_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}];
1688
-					const sort_by_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}];
1686
+					var post_type_rest_slugs = <?php if (!empty($this->arguments) && isset($this->arguments['post_type']['onchange_rest']['values'])) {echo "[" . json_encode($this->arguments['post_type']['onchange_rest']['values']) . "]"; } else {echo "[]"; } ?>;
1687
+					const taxonomies_<?php echo str_replace("-", "_", $this->id); ?> = [{label: "Please wait", value: 0}];
1688
+					const sort_by_<?php echo str_replace("-", "_", $this->id); ?> = [{label: "Please wait", value: 0}];
1689 1689
 
1690 1690
 					/**
1691 1691
 					 * Register Basic Block.
@@ -1699,30 +1699,30 @@  discard block
 block discarded – undo
1699 1699
 					 * @return {?WPBlock}          The block, if it has been successfully
1700 1700
 					 *                             registered; otherwise `undefined`.
1701 1701
 					 */
1702
-					registerBlockType('<?php echo str_replace( "_", "-", sanitize_title_with_dashes( $this->options['textdomain'] ) . '/' . sanitize_title_with_dashes( $this->options['class_name'] ) );  ?>', { // Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
1703
-						title: '<?php echo addslashes( $this->options['name'] ); ?>', // Block title.
1704
-						description: '<?php echo addslashes( $this->options['widget_ops']['description'] )?>', // Block title.
1705
-						icon: <?php echo $this->get_block_icon( $this->options['block-icon'] );?>,//'<?php echo isset( $this->options['block-icon'] ) ? esc_attr( $this->options['block-icon'] ) : 'shield-alt';?>', // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
1702
+					registerBlockType('<?php echo str_replace("_", "-", sanitize_title_with_dashes($this->options['textdomain']) . '/' . sanitize_title_with_dashes($this->options['class_name'])); ?>', { // Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
1703
+						title: '<?php echo addslashes($this->options['name']); ?>', // Block title.
1704
+						description: '<?php echo addslashes($this->options['widget_ops']['description'])?>', // Block title.
1705
+						icon: <?php echo $this->get_block_icon($this->options['block-icon']); ?>,//'<?php echo isset($this->options['block-icon']) ? esc_attr($this->options['block-icon']) : 'shield-alt'; ?>', // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
1706 1706
 						supports: {
1707 1707
 							<?php
1708
-							if ( isset( $this->options['block-supports'] ) ) {
1709
-								echo $this->array_to_attributes( $this->options['block-supports'] );
1708
+							if (isset($this->options['block-supports'])) {
1709
+								echo $this->array_to_attributes($this->options['block-supports']);
1710 1710
 							}
1711 1711
 							?>
1712 1712
 						},
1713
-						category: '<?php echo isset( $this->options['block-category'] ) ? esc_attr( $this->options['block-category'] ) : 'common';?>', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
1714
-						<?php if ( isset( $this->options['block-keywords'] ) ) {
1713
+						category: '<?php echo isset($this->options['block-category']) ? esc_attr($this->options['block-category']) : 'common'; ?>', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
1714
+						<?php if (isset($this->options['block-keywords'])) {
1715 1715
 						echo "keywords : " . $this->options['block-keywords'] . ",";
1716 1716
 					}?>
1717 1717
 
1718 1718
 						<?php
1719 1719
 
1720 1720
 						// maybe set no_wrap
1721
-						$no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1722
-						if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) {
1721
+						$no_wrap = isset($this->options['no_wrap']) && $this->options['no_wrap'] ? true : false;
1722
+						if (isset($this->arguments['no_wrap']) && $this->arguments['no_wrap']) {
1723 1723
 							$no_wrap = true;
1724 1724
 						}
1725
-						if ( $no_wrap ) {
1725
+						if ($no_wrap) {
1726 1726
 							$this->options['block-wrap'] = '';
1727 1727
 						}
1728 1728
 
@@ -1735,10 +1735,10 @@  discard block
 block discarded – undo
1735 1735
 						echo "  html: false";
1736 1736
 						echo "},";*/
1737 1737
 
1738
-						if ( ! empty( $this->arguments ) ) {
1738
+						if (!empty($this->arguments)) {
1739 1739
 							echo "attributes : {";
1740 1740
 
1741
-							if ( $show_advanced ) {
1741
+							if ($show_advanced) {
1742 1742
 								echo "show_advanced: {";
1743 1743
 								echo "	type: 'boolean',";
1744 1744
 								echo "  default: false,";
@@ -1746,41 +1746,41 @@  discard block
 block discarded – undo
1746 1746
 							}
1747 1747
 
1748 1748
 							// block wrap element
1749
-							if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this?
1749
+							if (!empty($this->options['block-wrap'])) { //@todo we should validate this?
1750 1750
 								echo "block_wrap: {";
1751 1751
 								echo "	type: 'string',";
1752
-								echo "  default: '" . esc_attr( $this->options['block-wrap'] ) . "',";
1752
+								echo "  default: '" . esc_attr($this->options['block-wrap']) . "',";
1753 1753
 								echo "},";
1754 1754
 							}
1755 1755
 
1756
-							foreach ( $this->arguments as $key => $args ) {
1756
+							foreach ($this->arguments as $key => $args) {
1757 1757
 
1758 1758
 								// set if we should show alignment
1759
-								if ( $key == 'alignment' ) {
1759
+								if ($key == 'alignment') {
1760 1760
 									$show_alignment = true;
1761 1761
 								}
1762 1762
 
1763 1763
 								$extra = '';
1764 1764
 
1765
-								if ( $args['type'] == 'checkbox' ) {
1765
+								if ($args['type'] == 'checkbox') {
1766 1766
 									$type    = 'boolean';
1767
-									$default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false';
1768
-								} elseif ( $args['type'] == 'number' ) {
1767
+									$default = isset($args['default']) && $args['default'] ? 'true' : 'false';
1768
+								} elseif ($args['type'] == 'number') {
1769 1769
 									$type    = 'number';
1770
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
1771
-								} elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
1770
+									$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
1771
+								} elseif ($args['type'] == 'select' && !empty($args['multiple'])) {
1772 1772
 									$type = 'array';
1773
-									if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
1774
-										$default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]";
1773
+									if (isset($args['default']) && is_array($args['default'])) {
1774
+										$default = !empty($args['default']) ? "['" . implode("','", $args['default']) . "']" : "[]";
1775 1775
 									} else {
1776
-										$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
1776
+										$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
1777 1777
 									}
1778
-								} elseif ( $args['type'] == 'multiselect' ) {
1778
+								} elseif ($args['type'] == 'multiselect') {
1779 1779
 									$type    = 'array';
1780
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
1780
+									$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
1781 1781
 								} else {
1782 1782
 									$type    = 'string';
1783
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
1783
+									$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
1784 1784
 								}
1785 1785
 								echo $key . " : {";
1786 1786
 								echo "type : '$type',";
@@ -1804,7 +1804,7 @@  discard block
 block discarded – undo
1804 1804
 							var $value = '';
1805 1805
 							<?php
1806 1806
 							// if we have a post_type and a category then link them
1807
-							if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){
1807
+							if (isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked'])) {
1808 1808
 							?>
1809 1809
 							if(typeof(prev_attributes[props.id]) != 'undefined' ){
1810 1810
 								$pt = props.attributes.post_type;
@@ -1820,13 +1820,13 @@  discard block
 block discarded – undo
1820 1820
 
1821 1821
 								// taxonomies
1822 1822
 								if( $value && 'post_type' in prev_attributes[props.id] && 'category' in prev_attributes[props.id] && run ){
1823
-									wp.apiFetch({path: "<?php if(isset($this->arguments['post_type']['onchange_rest']['path'])){echo $this->arguments['post_type']['onchange_rest']['path'];}else{'/wp/v2/"+$value+"/categories/?per_page=100';} ?>"}).then(terms => {
1824
-										while (taxonomies_<?php echo str_replace("-","_", $this->id);?>.length) {
1825
-										taxonomies_<?php echo str_replace("-","_", $this->id);?>.pop();
1823
+									wp.apiFetch({path: "<?php if (isset($this->arguments['post_type']['onchange_rest']['path'])) {echo $this->arguments['post_type']['onchange_rest']['path']; } else {'/wp/v2/"+$value+"/categories/?per_page=100'; } ?>"}).then(terms => {
1824
+										while (taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.length) {
1825
+										taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.pop();
1826 1826
 									}
1827
-									taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: "All", value: 0});
1827
+									taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: "All", value: 0});
1828 1828
 									jQuery.each( terms, function( key, val ) {
1829
-										taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: val.name, value: val.id});
1829
+										taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val.name, value: val.id});
1830 1830
 									});
1831 1831
 
1832 1832
 									// setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options.
@@ -1834,7 +1834,7 @@  discard block
 block discarded – undo
1834 1834
 									props.setAttributes({category: [0] });
1835 1835
 									props.setAttributes({category: $old_cat_value });
1836 1836
 
1837
-									return taxonomies_<?php echo str_replace("-","_", $this->id);?>;
1837
+									return taxonomies_<?php echo str_replace("-", "_", $this->id); ?>;
1838 1838
 								});
1839 1839
 								}
1840 1840
 
@@ -1846,12 +1846,12 @@  discard block
 block discarded – undo
1846 1846
 									};
1847 1847
 									jQuery.post(ajaxurl, data, function(response) {
1848 1848
 										response = JSON.parse(response);
1849
-										while (sort_by_<?php echo str_replace("-","_", $this->id);?>.length) {
1850
-											sort_by_<?php echo str_replace("-","_", $this->id);?>.pop();
1849
+										while (sort_by_<?php echo str_replace("-", "_", $this->id); ?>.length) {
1850
+											sort_by_<?php echo str_replace("-", "_", $this->id); ?>.pop();
1851 1851
 										}
1852 1852
 
1853 1853
 										jQuery.each( response, function( key, val ) {
1854
-											sort_by_<?php echo str_replace("-","_", $this->id);?>.push({label: val, value: key});
1854
+											sort_by_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val, value: key});
1855 1855
 										});
1856 1856
 
1857 1857
 										// setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options.
@@ -1859,7 +1859,7 @@  discard block
 block discarded – undo
1859 1859
 										props.setAttributes({sort_by: [0] });
1860 1860
 										props.setAttributes({sort_by: $old_sort_by_value });
1861 1861
 
1862
-										return sort_by_<?php echo str_replace("-","_", $this->id);?>;
1862
+										return sort_by_<?php echo str_replace("-", "_", $this->id); ?>;
1863 1863
 									});
1864 1864
 
1865 1865
 								}
@@ -1886,12 +1886,12 @@  discard block
 block discarded – undo
1886 1886
 									is_fetching = true;
1887 1887
 									var data = {
1888 1888
 										'action': 'super_duper_output_shortcode',
1889
-										'shortcode': '<?php echo $this->options['base_id'];?>',
1889
+										'shortcode': '<?php echo $this->options['base_id']; ?>',
1890 1890
 										'attributes': props.attributes,
1891
-										'post_id': <?php global $post; if ( isset( $post->ID ) ) {
1891
+										'post_id': <?php global $post; if (isset($post->ID)) {
1892 1892
 										echo $post->ID;
1893
-									}else{echo '0';}?>,
1894
-										'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
1893
+									} else {echo '0'; }?>,
1894
+										'_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>'
1895 1895
 									};
1896 1896
 
1897 1897
 									jQuery.post(ajaxurl, data, function (response) {
@@ -1900,7 +1900,7 @@  discard block
 block discarded – undo
1900 1900
 
1901 1901
 										// if the content is empty then we place some placeholder text
1902 1902
 										if (env == '') {
1903
-											env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e( 'Placeholder for: ' );?>" + props.name + "</div>";
1903
+											env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e('Placeholder for: '); ?>" + props.name + "</div>";
1904 1904
 										}
1905 1905
 
1906 1906
 										props.setAttributes({content: env});
@@ -1924,7 +1924,7 @@  discard block
 block discarded – undo
1924 1924
 
1925 1925
 								el(wp.blockEditor.BlockControls, {key: 'controls'},
1926 1926
 
1927
-									<?php if($show_alignment){?>
1927
+									<?php if ($show_alignment) {?>
1928 1928
 									el(
1929 1929
 										wp.blockEditor.AlignmentToolbar,
1930 1930
 										{
@@ -1942,9 +1942,9 @@  discard block
 block discarded – undo
1942 1942
 
1943 1943
 									<?php
1944 1944
 
1945
-									if(! empty( $this->arguments )){
1945
+									if (!empty($this->arguments)) {
1946 1946
 
1947
-									if ( $show_advanced ) {
1947
+									if ($show_advanced) {
1948 1948
 									?>
1949 1949
 									el('div', {
1950 1950
 											style: {'padding-left': '16px','padding-right': '16px'}
@@ -1965,19 +1965,19 @@  discard block
 block discarded – undo
1965 1965
 
1966 1966
 									}
1967 1967
 
1968
-									$arguments = $this->group_arguments( $this->arguments );
1968
+									$arguments = $this->group_arguments($this->arguments);
1969 1969
 
1970 1970
 									// Do we have sections?
1971 1971
 									$has_sections = $arguments == $this->arguments ? false : true;
1972 1972
 
1973 1973
 
1974
-									if($has_sections){
1974
+									if ($has_sections) {
1975 1975
 									$panel_count = 0;
1976
-									foreach($arguments as $key => $args){
1976
+									foreach ($arguments as $key => $args) {
1977 1977
 									?>
1978 1978
 									el(wp.components.PanelBody, {
1979
-											title: '<?php esc_attr_e( $key ); ?>',
1980
-											initialOpen: <?php if ( $panel_count ) {
1979
+											title: '<?php esc_attr_e($key); ?>',
1980
+											initialOpen: <?php if ($panel_count) {
1981 1981
 											echo "false";
1982 1982
 										} else {
1983 1983
 											echo "true";
@@ -1987,29 +1987,29 @@  discard block
 block discarded – undo
1987 1987
 
1988 1988
 
1989 1989
 
1990
-										foreach ( $args as $k => $a ) {
1990
+										foreach ($args as $k => $a) {
1991 1991
 
1992
-											$this->block_row_start( $k, $a );
1993
-											$this->build_block_arguments( $k, $a );
1994
-											$this->block_row_end( $k, $a );
1992
+											$this->block_row_start($k, $a);
1993
+											$this->build_block_arguments($k, $a);
1994
+											$this->block_row_end($k, $a);
1995 1995
 										}
1996 1996
 										?>
1997 1997
 									),
1998 1998
 									<?php
1999
-									$panel_count ++;
1999
+									$panel_count++;
2000 2000
 
2001 2001
 									}
2002
-									}else {
2002
+									} else {
2003 2003
 									?>
2004 2004
 									el(wp.components.PanelBody, {
2005
-											title: '<?php esc_attr_e( "Settings" ); ?>',
2005
+											title: '<?php esc_attr_e("Settings"); ?>',
2006 2006
 											initialOpen: true
2007 2007
 										},
2008 2008
 										<?php
2009
-										foreach ( $this->arguments as $key => $args ) {
2010
-											$this->block_row_start( $key, $args );
2011
-											$this->build_block_arguments( $key, $args );
2012
-											$this->block_row_end( $key, $args );
2009
+										foreach ($this->arguments as $key => $args) {
2010
+											$this->block_row_start($key, $args);
2011
+											$this->build_block_arguments($key, $args);
2012
+											$this->block_row_end($key, $args);
2013 2013
 										}
2014 2014
 										?>
2015 2015
 									),
@@ -2023,9 +2023,9 @@  discard block
 block discarded – undo
2023 2023
 
2024 2024
 								<?php
2025 2025
 								// If the user sets block-output array then build it
2026
-								if ( ! empty( $this->options['block-output'] ) ) {
2027
-								$this->block_element( $this->options['block-output'] );
2028
-							}else{
2026
+								if (!empty($this->options['block-output'])) {
2027
+								$this->block_element($this->options['block-output']);
2028
+							} else {
2029 2029
 								// if no block-output is set then we try and get the shortcode html output via ajax.
2030 2030
 								?>
2031 2031
 								el('div', {
@@ -2049,19 +2049,19 @@  discard block
 block discarded – undo
2049 2049
 							var align = '';
2050 2050
 
2051 2051
 							// build the shortcode.
2052
-							var content = "[<?php echo $this->options['base_id'];?>";
2052
+							var content = "[<?php echo $this->options['base_id']; ?>";
2053 2053
 							$html = '';
2054 2054
 							<?php
2055 2055
 
2056
-							if(! empty( $this->arguments )){
2056
+							if (!empty($this->arguments)) {
2057 2057
 
2058
-							foreach($this->arguments as $key => $args){
2058
+							foreach ($this->arguments as $key => $args) {
2059 2059
 							?>
2060
-							if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
2061
-								if ('<?php echo esc_attr( $key );?>' == 'html') {
2062
-									$html = attr.<?php echo esc_attr( $key );?>;
2060
+							if (attr.hasOwnProperty("<?php echo esc_attr($key); ?>")) {
2061
+								if ('<?php echo esc_attr($key); ?>' == 'html') {
2062
+									$html = attr.<?php echo esc_attr($key); ?>;
2063 2063
 								} else {
2064
-									content += " <?php echo esc_attr( $key );?>='" + attr.<?php echo esc_attr( $key );?>+ "' ";
2064
+									content += " <?php echo esc_attr($key); ?>='" + attr.<?php echo esc_attr($key); ?>+ "' ";
2065 2065
 								}
2066 2066
 							}
2067 2067
 							<?php
@@ -2073,7 +2073,7 @@  discard block
 block discarded – undo
2073 2073
 
2074 2074
 							// if has html element
2075 2075
 							if ($html) {
2076
-								content += $html + "[/<?php echo $this->options['base_id'];?>]";
2076
+								content += $html + "[/<?php echo $this->options['base_id']; ?>]";
2077 2077
 							}
2078 2078
 
2079 2079
 
@@ -2091,11 +2091,11 @@  discard block
 block discarded – undo
2091 2091
 							}
2092 2092
 
2093 2093
 							<?php
2094
-							if(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
2094
+							if (isset($this->options['block-wrap']) && $this->options['block-wrap'] == '') {
2095 2095
 							?>
2096 2096
 							return content;
2097 2097
 							<?php
2098
-							}else{
2098
+							} else {
2099 2099
 							?>
2100 2100
 							var block_wrap = 'div';
2101 2101
 							if (attr.hasOwnProperty("block_wrap")) {
@@ -2118,45 +2118,45 @@  discard block
 block discarded – undo
2118 2118
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
2119 2119
 			 */
2120 2120
 
2121
-			return str_replace( array(
2121
+			return str_replace(array(
2122 2122
 				'<script>',
2123 2123
 				'</script>'
2124
-			), '', $output );
2124
+			), '', $output);
2125 2125
 		}
2126 2126
 
2127
-		public function block_row_start($key, $args){
2127
+		public function block_row_start($key, $args) {
2128 2128
 
2129 2129
 			// check for row
2130
-			if(!empty($args['row'])){
2130
+			if (!empty($args['row'])) {
2131 2131
 
2132
-				if(!empty($args['row']['open'])){
2132
+				if (!empty($args['row']['open'])) {
2133 2133
 
2134 2134
 				// element require
2135
-				$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
2135
+				$element_require = !empty($args['element_require']) ? $this->block_props_replace($args['element_require'], true) . " && " : "";
2136 2136
 				echo $element_require;
2137 2137
 
2138
-					if(false){?><script><?php }?>
2138
+					if (false) {?><script><?php }?>
2139 2139
 						el('div', {
2140 2140
 								className: 'bsui components-base-control',
2141 2141
 							},
2142
-							<?php if(!empty($args['row']['title'])){ ?>
2142
+							<?php if (!empty($args['row']['title'])) { ?>
2143 2143
 							el('label', {
2144 2144
 									className: 'components-base-control__label',
2145 2145
 								},
2146
-								'<?php echo addslashes( $args['row']['title'] ); ?>'
2146
+								'<?php echo addslashes($args['row']['title']); ?>'
2147 2147
 							),
2148 2148
 							<?php }?>
2149
-							<?php if(!empty($args['row']['desc'])){ ?>
2149
+							<?php if (!empty($args['row']['desc'])) { ?>
2150 2150
 							el('p', {
2151 2151
 									className: 'components-base-control__help mb-0',
2152 2152
 								},
2153
-								'<?php echo addslashes( $args['row']['desc'] ); ?>'
2153
+								'<?php echo addslashes($args['row']['desc']); ?>'
2154 2154
 							),
2155 2155
 							<?php }?>
2156 2156
 							el(
2157 2157
 								'div',
2158 2158
 								{
2159
-									className: 'row mb-n2 <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>',
2159
+									className: 'row mb-n2 <?php if (!empty($args['row']['class'])) { echo esc_attr($args['row']['class']); } ?>',
2160 2160
 								},
2161 2161
 								el(
2162 2162
 									'div',
@@ -2165,36 +2165,36 @@  discard block
 block discarded – undo
2165 2165
 									},
2166 2166
 
2167 2167
 					<?php
2168
-					if(false){?></script><?php }
2169
-				}elseif(!empty($args['row']['close'])){
2170
-					if(false){?><script><?php }?>
2168
+					if (false) {?></script><?php }
2169
+				}elseif (!empty($args['row']['close'])) {
2170
+					if (false) {?><script><?php }?>
2171 2171
 						el(
2172 2172
 							'div',
2173 2173
 							{
2174 2174
 								className: 'col pl-0',
2175 2175
 							},
2176 2176
 					<?php
2177
-					if(false){?></script><?php }
2178
-				}else{
2179
-					if(false){?><script><?php }?>
2177
+					if (false) {?></script><?php }
2178
+				} else {
2179
+					if (false) {?><script><?php }?>
2180 2180
 						el(
2181 2181
 							'div',
2182 2182
 							{
2183 2183
 								className: 'col pl-0 pr-2',
2184 2184
 							},
2185 2185
 					<?php
2186
-					if(false){?></script><?php }
2186
+					if (false) {?></script><?php }
2187 2187
 				}
2188 2188
 
2189 2189
 			}
2190 2190
 
2191 2191
 		}
2192 2192
 
2193
-		public function block_row_end($key, $args){
2193
+		public function block_row_end($key, $args) {
2194 2194
 
2195
-			if(!empty($args['row'])){
2195
+			if (!empty($args['row'])) {
2196 2196
 				// maybe close
2197
-				if(!empty($args['row']['close'])){
2197
+				if (!empty($args['row']['close'])) {
2198 2198
 					echo "))";
2199 2199
 				}
2200 2200
 
@@ -2202,25 +2202,25 @@  discard block
 block discarded – undo
2202 2202
 			}
2203 2203
 		}
2204 2204
 
2205
-		public function build_block_arguments( $key, $args ) {
2206
-			$custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : '';
2205
+		public function build_block_arguments($key, $args) {
2206
+			$custom_attributes = !empty($args['custom_attributes']) ? $this->array_to_attributes($args['custom_attributes']) : '';
2207 2207
 			$options           = '';
2208 2208
 			$extra             = '';
2209 2209
 			$require           = '';
2210 2210
 
2211 2211
 			// `content` is a protected and special argument
2212
-			if ( $key == 'content' ) {
2212
+			if ($key == 'content') {
2213 2213
 				return;
2214 2214
 			}
2215 2215
 
2216 2216
 
2217 2217
 			// icon
2218 2218
 			$icon = '';
2219
-			if( !empty( $args['icon'] ) ){
2219
+			if (!empty($args['icon'])) {
2220 2220
 				$icon .= "el('div', {";
2221
-									$icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},";
2221
+									$icon .= "dangerouslySetInnerHTML: {__html: '" . self::get_widget_icon(esc_attr($args['icon'])) . "'},";
2222 2222
 									$icon .= "className: 'text-center',";
2223
-									$icon .= "title: '".addslashes( $args['title'] )."',";
2223
+									$icon .= "title: '" . addslashes($args['title']) . "',";
2224 2224
 								$icon .= "}),";
2225 2225
 
2226 2226
 				// blank title as its added to the icon.
@@ -2228,20 +2228,20 @@  discard block
 block discarded – undo
2228 2228
 			}
2229 2229
 
2230 2230
 			// require advanced
2231
-			$require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
2231
+			$require_advanced = !empty($args['advanced']) ? "props.attributes.show_advanced && " : "";
2232 2232
 
2233 2233
 			// element require
2234
-			$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
2234
+			$element_require = !empty($args['element_require']) ? $this->block_props_replace($args['element_require'], true) . " && " : "";
2235 2235
 
2236 2236
 
2237 2237
 			$onchange  = "props.setAttributes({ $key: $key } )";
2238
-			$onchangecomplete  = "";
2238
+			$onchangecomplete = "";
2239 2239
 			$value     = "props.attributes.$key";
2240
-			$text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx' );
2241
-			if ( in_array( $args['type'], $text_type ) ) {
2240
+			$text_type = array('text', 'password', 'number', 'email', 'tel', 'url', 'colorx');
2241
+			if (in_array($args['type'], $text_type)) {
2242 2242
 				$type = 'TextControl';
2243 2243
 				// Save numbers as numbers and not strings
2244
-				if ( $args['type'] == 'number' ) {
2244
+				if ($args['type'] == 'number') {
2245 2245
 					$onchange = "props.setAttributes({ $key: Number($key) } )";
2246 2246
 				}
2247 2247
 			}
@@ -2279,11 +2279,11 @@  discard block
 block discarded – undo
2279 2279
 							return;
2280 2280
 						}
2281 2281
 			*/
2282
-			elseif ( $args['type'] == 'color' ) {
2282
+			elseif ($args['type'] == 'color') {
2283 2283
 				$type = 'ColorPicker';
2284 2284
 				$onchange = "";
2285 2285
 				$extra = "color: $value,";
2286
-				if(!empty($args['disable_alpha'])){
2286
+				if (!empty($args['disable_alpha'])) {
2287 2287
 					$extra .= "disableAlpha: true,";
2288 2288
 				}
2289 2289
 				$onchangecomplete = "onChangeComplete: function($key) {
@@ -2293,49 +2293,49 @@  discard block
 block discarded – undo
2293 2293
                         });
2294 2294
                     },";
2295 2295
 			}
2296
-			elseif ( $args['type'] == 'checkbox' ) {
2296
+			elseif ($args['type'] == 'checkbox') {
2297 2297
 				$type = 'CheckboxControl';
2298 2298
 				$extra .= "checked: props.attributes.$key,";
2299 2299
 				$onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
2300
-			} elseif ( $args['type'] == 'textarea' ) {
2300
+			} elseif ($args['type'] == 'textarea') {
2301 2301
 				$type = 'TextareaControl';
2302
-			} elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
2302
+			} elseif ($args['type'] == 'select' || $args['type'] == 'multiselect') {
2303 2303
 				$type = 'SelectControl';
2304 2304
 
2305
-				if($args['name'] == 'category' && !empty($args['post_type_linked'])){
2306
-					$options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
2307
-				}elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
2308
-					$options .= "options: sort_by_".str_replace("-","_", $this->id).",";
2309
-				}else {
2305
+				if ($args['name'] == 'category' && !empty($args['post_type_linked'])) {
2306
+					$options .= "options: taxonomies_" . str_replace("-", "_", $this->id) . ",";
2307
+				}elseif ($args['name'] == 'sort_by' && !empty($args['post_type_linked'])) {
2308
+					$options .= "options: sort_by_" . str_replace("-", "_", $this->id) . ",";
2309
+				} else {
2310 2310
 
2311
-					if ( ! empty( $args['options'] ) ) {
2311
+					if (!empty($args['options'])) {
2312 2312
 						$options .= "options: [";
2313
-						foreach ( $args['options'] as $option_val => $option_label ) {
2314
-							$options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . addslashes( $option_label ) . "' },";
2313
+						foreach ($args['options'] as $option_val => $option_label) {
2314
+							$options .= "{ value: '" . esc_attr($option_val) . "', label: '" . addslashes($option_label) . "' },";
2315 2315
 						}
2316 2316
 						$options .= "],";
2317 2317
 					}
2318 2318
 				}
2319
-				if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
2319
+				if (isset($args['multiple']) && $args['multiple']) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
2320 2320
 					$extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px"}, ';
2321 2321
 				}
2322
-			} elseif ( $args['type'] == 'alignment' ) {
2322
+			} elseif ($args['type'] == 'alignment') {
2323 2323
 				$type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
2324
-			}elseif ( $args['type'] == 'margins' ) {
2324
+			}elseif ($args['type'] == 'margins') {
2325 2325
 
2326 2326
 			} else {
2327
-				return;// if we have not implemented the control then don't break the JS.
2327
+				return; // if we have not implemented the control then don't break the JS.
2328 2328
 			}
2329 2329
 
2330 2330
 
2331 2331
 
2332 2332
 			// color input does not show the labels so we add them
2333
-			if($args['type']=='color'){
2333
+			if ($args['type'] == 'color') {
2334 2334
 				// add show only if advanced
2335 2335
 				echo $require_advanced;
2336 2336
 				// add setting require if defined
2337 2337
 				echo $element_require;
2338
-				echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
2338
+				echo "el('div', {style: {'marginBottom': '8px'}}, '" . addslashes($args['title']) . "'),";
2339 2339
 			}
2340 2340
 
2341 2341
 			// add show only if advanced
@@ -2347,21 +2347,21 @@  discard block
 block discarded – undo
2347 2347
 			echo $icon;
2348 2348
 			?>
2349 2349
 			el( wp.components.<?php echo $type; ?>, {
2350
-			label: '<?php echo addslashes( $args['title'] ); ?>',
2351
-			help: '<?php if ( isset( $args['desc'] ) ) {
2352
-				echo addslashes( $args['desc'] );
2350
+			label: '<?php echo addslashes($args['title']); ?>',
2351
+			help: '<?php if (isset($args['desc'])) {
2352
+				echo addslashes($args['desc']);
2353 2353
 			} ?>',
2354 2354
 			value: <?php echo $value; ?>,
2355
-			<?php if ( $type == 'TextControl' && $args['type'] != 'text' ) {
2356
-				echo "type: '" . addslashes( $args['type'] ) . "',";
2355
+			<?php if ($type == 'TextControl' && $args['type'] != 'text') {
2356
+				echo "type: '" . addslashes($args['type']) . "',";
2357 2357
 			} ?>
2358
-			<?php if ( ! empty( $args['placeholder'] ) ) {
2359
-				echo "placeholder: '" . addslashes( $args['placeholder'] ) . "',";
2358
+			<?php if (!empty($args['placeholder'])) {
2359
+				echo "placeholder: '" . addslashes($args['placeholder']) . "',";
2360 2360
 			} ?>
2361 2361
 			<?php echo $options; ?>
2362 2362
 			<?php echo $extra; ?>
2363 2363
 			<?php echo $custom_attributes; ?>
2364
-			<?php echo $onchangecomplete;?>
2364
+			<?php echo $onchangecomplete; ?>
2365 2365
 			onChange: function ( <?php echo $key; ?> ) {
2366 2366
 			<?php echo $onchange; ?>
2367 2367
 			}
@@ -2380,16 +2380,16 @@  discard block
 block discarded – undo
2380 2380
 		 *
2381 2381
 		 * @return string
2382 2382
 		 */
2383
-		public function array_to_attributes( $custom_attributes, $html = false ) {
2383
+		public function array_to_attributes($custom_attributes, $html = false) {
2384 2384
 			$attributes = '';
2385
-			if ( ! empty( $custom_attributes ) ) {
2385
+			if (!empty($custom_attributes)) {
2386 2386
 
2387
-				if ( $html ) {
2388
-					foreach ( $custom_attributes as $key => $val ) {
2387
+				if ($html) {
2388
+					foreach ($custom_attributes as $key => $val) {
2389 2389
 						$attributes .= " $key='$val' ";
2390 2390
 					}
2391 2391
 				} else {
2392
-					foreach ( $custom_attributes as $key => $val ) {
2392
+					foreach ($custom_attributes as $key => $val) {
2393 2393
 						$attributes .= "'$key': '$val',";
2394 2394
 					}
2395 2395
 				}
@@ -2405,86 +2405,86 @@  discard block
 block discarded – undo
2405 2405
 		 *
2406 2406
 		 * @param $args
2407 2407
 		 */
2408
-		public function block_element( $args ) {
2408
+		public function block_element($args) {
2409 2409
 
2410 2410
 
2411
-			if ( ! empty( $args ) ) {
2412
-				foreach ( $args as $element => $new_args ) {
2411
+			if (!empty($args)) {
2412
+				foreach ($args as $element => $new_args) {
2413 2413
 
2414
-					if ( is_array( $new_args ) ) { // its an element
2414
+					if (is_array($new_args)) { // its an element
2415 2415
 
2416 2416
 
2417
-						if ( isset( $new_args['element'] ) ) {
2417
+						if (isset($new_args['element'])) {
2418 2418
 
2419
-							if ( isset( $new_args['element_require'] ) ) {
2420
-								echo str_replace( array(
2419
+							if (isset($new_args['element_require'])) {
2420
+								echo str_replace(array(
2421 2421
 										"'+",
2422 2422
 										"+'"
2423
-									), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
2424
-								unset( $new_args['element_require'] );
2423
+									), '', $this->block_props_replace($new_args['element_require'])) . " &&  ";
2424
+								unset($new_args['element_require']);
2425 2425
 							}
2426 2426
 
2427 2427
 							echo "\n el( '" . $new_args['element'] . "', {";
2428 2428
 
2429 2429
 							// get the attributes
2430
-							foreach ( $new_args as $new_key => $new_value ) {
2430
+							foreach ($new_args as $new_key => $new_value) {
2431 2431
 
2432 2432
 
2433
-								if ( $new_key == 'element' || $new_key == 'content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
2433
+								if ($new_key == 'element' || $new_key == 'content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array($new_value)) {
2434 2434
 									// do nothing
2435 2435
 								} else {
2436
-									echo $this->block_element( array( $new_key => $new_value ) );
2436
+									echo $this->block_element(array($new_key => $new_value));
2437 2437
 								}
2438 2438
 							}
2439 2439
 
2440
-							echo "},";// end attributes
2440
+							echo "},"; // end attributes
2441 2441
 
2442 2442
 							// get the content
2443 2443
 							$first_item = 0;
2444
-							foreach ( $new_args as $new_key => $new_value ) {
2445
-								if ( $new_key === 'content' || is_array( $new_value ) ) {
2444
+							foreach ($new_args as $new_key => $new_value) {
2445
+								if ($new_key === 'content' || is_array($new_value)) {
2446 2446
 
2447
-									if ( $new_key === 'content' ) {
2448
-										echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
2447
+									if ($new_key === 'content') {
2448
+										echo "'" . $this->block_props_replace(wp_slash($new_value)) . "'";
2449 2449
 									}
2450 2450
 
2451
-									if ( is_array( $new_value ) ) {
2451
+									if (is_array($new_value)) {
2452 2452
 
2453
-										if ( isset( $new_value['element_require'] ) ) {
2454
-											echo str_replace( array(
2453
+										if (isset($new_value['element_require'])) {
2454
+											echo str_replace(array(
2455 2455
 													"'+",
2456 2456
 													"+'"
2457
-												), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
2458
-											unset( $new_value['element_require'] );
2457
+												), '', $this->block_props_replace($new_value['element_require'])) . " &&  ";
2458
+											unset($new_value['element_require']);
2459 2459
 										}
2460 2460
 
2461
-										if ( isset( $new_value['element_repeat'] ) ) {
2461
+										if (isset($new_value['element_repeat'])) {
2462 2462
 											$x = 1;
2463
-											while ( $x <= absint( $new_value['element_repeat'] ) ) {
2464
-												$this->block_element( array( '' => $new_value ) );
2465
-												$x ++;
2463
+											while ($x <= absint($new_value['element_repeat'])) {
2464
+												$this->block_element(array('' => $new_value));
2465
+												$x++;
2466 2466
 											}
2467 2467
 										} else {
2468
-											$this->block_element( array( '' => $new_value ) );
2468
+											$this->block_element(array('' => $new_value));
2469 2469
 										}
2470 2470
 									}
2471
-									$first_item ++;
2471
+									$first_item++;
2472 2472
 								}
2473 2473
 							}
2474 2474
 
2475
-							echo ")";// end content
2475
+							echo ")"; // end content
2476 2476
 
2477 2477
 							echo ", \n";
2478 2478
 
2479 2479
 						}
2480 2480
 					} else {
2481 2481
 
2482
-						if ( substr( $element, 0, 3 ) === "if_" ) {
2483
-							echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
2484
-						} elseif ( $element == 'style' ) {
2485
-							echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
2482
+						if (substr($element, 0, 3) === "if_") {
2483
+							echo str_replace("if_", "", $element) . ": " . $this->block_props_replace($new_args, true) . ",";
2484
+						} elseif ($element == 'style') {
2485
+							echo $element . ": " . $this->block_props_replace($new_args) . ",";
2486 2486
 						} else {
2487
-							echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
2487
+							echo $element . ": '" . $this->block_props_replace($new_args) . "',";
2488 2488
 						}
2489 2489
 
2490 2490
 					}
@@ -2499,12 +2499,12 @@  discard block
 block discarded – undo
2499 2499
 		 *
2500 2500
 		 * @return mixed
2501 2501
 		 */
2502
-		public function block_props_replace( $string, $no_wrap = false ) {
2502
+		public function block_props_replace($string, $no_wrap = false) {
2503 2503
 
2504
-			if ( $no_wrap ) {
2505
-				$string = str_replace( array( "[%", "%]" ), array( "props.attributes.", "" ), $string );
2504
+			if ($no_wrap) {
2505
+				$string = str_replace(array("[%", "%]"), array("props.attributes.", ""), $string);
2506 2506
 			} else {
2507
-				$string = str_replace( array( "[%", "%]" ), array( "'+props.attributes.", "+'" ), $string );
2507
+				$string = str_replace(array("[%", "%]"), array("'+props.attributes.", "+'"), $string);
2508 2508
 			}
2509 2509
 
2510 2510
 			return $string;
@@ -2516,62 +2516,62 @@  discard block
 block discarded – undo
2516 2516
 		 * @param array $args
2517 2517
 		 * @param array $instance
2518 2518
 		 */
2519
-		public function widget( $args, $instance ) {
2519
+		public function widget($args, $instance) {
2520 2520
 
2521 2521
 			// get the filtered values
2522
-			$argument_values = $this->argument_values( $instance );
2523
-			$argument_values = $this->string_to_bool( $argument_values );
2524
-			$output          = $this->output( $argument_values, $args );
2522
+			$argument_values = $this->argument_values($instance);
2523
+			$argument_values = $this->string_to_bool($argument_values);
2524
+			$output          = $this->output($argument_values, $args);
2525 2525
 
2526 2526
 			$no_wrap = false;
2527
-			if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
2527
+			if (isset($argument_values['no_wrap']) && $argument_values['no_wrap']) {
2528 2528
 				$no_wrap = true;
2529 2529
 			}
2530 2530
 
2531 2531
 			ob_start();
2532
-			if ( $output && ! $no_wrap ) {
2532
+			if ($output && !$no_wrap) {
2533 2533
 
2534 2534
 				$class_original = $this->options['widget_ops']['classname'];
2535
-				$class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
2535
+				$class = $this->options['widget_ops']['classname'] . " sdel-" . $this->get_instance_hash();
2536 2536
 
2537 2537
 				// Before widget
2538 2538
 				$before_widget = $args['before_widget'];
2539
-				$before_widget = str_replace($class_original,$class,$before_widget);
2540
-				$before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
2541
-				$before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
2539
+				$before_widget = str_replace($class_original, $class, $before_widget);
2540
+				$before_widget = apply_filters('wp_super_duper_before_widget', $before_widget, $args, $instance, $this);
2541
+				$before_widget = apply_filters('wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this);
2542 2542
 
2543 2543
 				// After widget
2544 2544
 				$after_widget = $args['after_widget'];
2545
-				$after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
2546
-				$after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
2545
+				$after_widget = apply_filters('wp_super_duper_after_widget', $after_widget, $args, $instance, $this);
2546
+				$after_widget = apply_filters('wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this);
2547 2547
 
2548 2548
 				echo $before_widget;
2549 2549
 				// elementor strips the widget wrapping div so we check for and add it back if needed
2550
-				if ( $this->is_elementor_widget_output() ) {
2550
+				if ($this->is_elementor_widget_output()) {
2551 2551
 					// Filter class & attrs for elementor widget output.
2552
-					$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
2553
-					$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
2552
+					$class = apply_filters('wp_super_duper_div_classname', $class, $args, $this);
2553
+					$class = apply_filters('wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this);
2554 2554
 
2555
-					$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
2556
-					$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
2555
+					$attrs = apply_filters('wp_super_duper_div_attrs', '', $args, $this);
2556
+					$attrs = apply_filters('wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this);
2557 2557
 
2558
-					echo "<span class='" . esc_attr( $class  ) . "' " . $attrs . ">";
2558
+					echo "<span class='" . esc_attr($class) . "' " . $attrs . ">";
2559 2559
 				}
2560
-				echo $this->output_title( $args, $instance );
2560
+				echo $this->output_title($args, $instance);
2561 2561
 				echo $output;
2562
-				if ( $this->is_elementor_widget_output() ) {
2562
+				if ($this->is_elementor_widget_output()) {
2563 2563
 					echo "</span>";
2564 2564
 				}
2565 2565
 				echo $after_widget;
2566
-			} elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
2567
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
2566
+			} elseif ($this->is_preview() && $output == '') {// if preview show a placeholder if empty
2567
+				$output = $this->preview_placeholder_text("{{" . $this->base_id . "}}");
2568 2568
 				echo $output;
2569
-			} elseif ( $output && $no_wrap ) {
2569
+			} elseif ($output && $no_wrap) {
2570 2570
 				echo $output;
2571 2571
 			}
2572 2572
 			$output = ob_get_clean();
2573 2573
 
2574
-			$output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
2574
+			$output = apply_filters('wp_super_duper_widget_output', $output, $instance, $args, $this);
2575 2575
 
2576 2576
 			echo $output;
2577 2577
 		}
@@ -2584,7 +2584,7 @@  discard block
 block discarded – undo
2584 2584
 		 */
2585 2585
 		public function is_elementor_widget_output() {
2586 2586
 			$result = false;
2587
-			if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
2587
+			if (defined('ELEMENTOR_VERSION') && isset($this->number) && $this->number == 'REPLACE_TO_ID') {
2588 2588
 				$result = true;
2589 2589
 			}
2590 2590
 
@@ -2599,7 +2599,7 @@  discard block
 block discarded – undo
2599 2599
 		 */
2600 2600
 		public function is_elementor_preview() {
2601 2601
 			$result = false;
2602
-			if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
2602
+			if (isset($_REQUEST['elementor-preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor_ajax')) {
2603 2603
 				$result = true;
2604 2604
 			}
2605 2605
 
@@ -2614,7 +2614,7 @@  discard block
 block discarded – undo
2614 2614
 		 */
2615 2615
 		public function is_divi_preview() {
2616 2616
 			$result = false;
2617
-			if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
2617
+			if (isset($_REQUEST['et_fb']) || isset($_REQUEST['et_pb_preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor')) {
2618 2618
 				$result = true;
2619 2619
 			}
2620 2620
 
@@ -2629,7 +2629,7 @@  discard block
 block discarded – undo
2629 2629
 		 */
2630 2630
 		public function is_beaver_preview() {
2631 2631
 			$result = false;
2632
-			if ( isset( $_REQUEST['fl_builder'] ) ) {
2632
+			if (isset($_REQUEST['fl_builder'])) {
2633 2633
 				$result = true;
2634 2634
 			}
2635 2635
 
@@ -2644,7 +2644,7 @@  discard block
 block discarded – undo
2644 2644
 		 */
2645 2645
 		public function is_siteorigin_preview() {
2646 2646
 			$result = false;
2647
-			if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
2647
+			if (!empty($_REQUEST['siteorigin_panels_live_editor'])) {
2648 2648
 				$result = true;
2649 2649
 			}
2650 2650
 
@@ -2659,7 +2659,7 @@  discard block
 block discarded – undo
2659 2659
 		 */
2660 2660
 		public function is_cornerstone_preview() {
2661 2661
 			$result = false;
2662
-			if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
2662
+			if (!empty($_REQUEST['cornerstone_preview']) || basename($_SERVER['REQUEST_URI']) == 'cornerstone-endpoint') {
2663 2663
 				$result = true;
2664 2664
 			}
2665 2665
 
@@ -2674,7 +2674,7 @@  discard block
 block discarded – undo
2674 2674
 		 */
2675 2675
 		public function is_fusion_preview() {
2676 2676
 			$result = false;
2677
-			if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
2677
+			if (!empty($_REQUEST['fb-edit']) || !empty($_REQUEST['fusion_load_nonce'])) {
2678 2678
 				$result = true;
2679 2679
 			}
2680 2680
 
@@ -2689,7 +2689,7 @@  discard block
 block discarded – undo
2689 2689
 		 */
2690 2690
 		public function is_oxygen_preview() {
2691 2691
 			$result = false;
2692
-			if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
2692
+			if (!empty($_REQUEST['ct_builder']) || (!empty($_REQUEST['action']) && (substr($_REQUEST['action'], 0, 11) === "oxy_render_" || substr($_REQUEST['action'], 0, 10) === "ct_render_"))) {
2693 2693
 				$result = true;
2694 2694
 			}
2695 2695
 
@@ -2704,21 +2704,21 @@  discard block
 block discarded – undo
2704 2704
 		 */
2705 2705
 		public function is_preview() {
2706 2706
 			$preview = false;
2707
-			if ( $this->is_divi_preview() ) {
2707
+			if ($this->is_divi_preview()) {
2708 2708
 				$preview = true;
2709
-			} elseif ( $this->is_elementor_preview() ) {
2709
+			} elseif ($this->is_elementor_preview()) {
2710 2710
 				$preview = true;
2711
-			} elseif ( $this->is_beaver_preview() ) {
2711
+			} elseif ($this->is_beaver_preview()) {
2712 2712
 				$preview = true;
2713
-			} elseif ( $this->is_siteorigin_preview() ) {
2713
+			} elseif ($this->is_siteorigin_preview()) {
2714 2714
 				$preview = true;
2715
-			} elseif ( $this->is_cornerstone_preview() ) {
2715
+			} elseif ($this->is_cornerstone_preview()) {
2716 2716
 				$preview = true;
2717
-			} elseif ( $this->is_fusion_preview() ) {
2717
+			} elseif ($this->is_fusion_preview()) {
2718 2718
 				$preview = true;
2719
-			} elseif ( $this->is_oxygen_preview() ) {
2719
+			} elseif ($this->is_oxygen_preview()) {
2720 2720
 				$preview = true;
2721
-			} elseif( $this->is_block_content_call() ) {
2721
+			} elseif ($this->is_block_content_call()) {
2722 2722
 				$preview = true;
2723 2723
 			}
2724 2724
 
@@ -2733,34 +2733,34 @@  discard block
 block discarded – undo
2733 2733
 		 *
2734 2734
 		 * @return string
2735 2735
 		 */
2736
-		public function output_title( $args, $instance = array() ) {
2736
+		public function output_title($args, $instance = array()) {
2737 2737
 			$output = '';
2738
-			if ( ! empty( $instance['title'] ) ) {
2738
+			if (!empty($instance['title'])) {
2739 2739
 				/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
2740
-				$title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
2740
+				$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
2741 2741
 
2742
-				if(empty($instance['widget_title_tag'])){
2742
+				if (empty($instance['widget_title_tag'])) {
2743 2743
 					$output = $args['before_title'] . $title . $args['after_title'];
2744
-				}else{
2745
-					$title_tag = esc_attr( $instance['widget_title_tag'] );
2744
+				} else {
2745
+					$title_tag = esc_attr($instance['widget_title_tag']);
2746 2746
 
2747 2747
 					// classes
2748 2748
 					$title_classes = array();
2749
-					$title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
2750
-					$title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
2751
-					$title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
2752
-					$title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
2753
-					$title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
2754
-					$title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
2755
-					$title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
2756
-					$title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
2757
-					$title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
2758
-					$title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
2759
-					$title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
2760
-					$title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
2761
-					$title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
2762
-
2763
-					$class = !empty( $title_classes ) ? implode(" ",$title_classes) : '';
2749
+					$title_classes[] = !empty($instance['widget_title_size_class']) ? sanitize_html_class($instance['widget_title_size_class']) : '';
2750
+					$title_classes[] = !empty($instance['widget_title_align_class']) ? sanitize_html_class($instance['widget_title_align_class']) : '';
2751
+					$title_classes[] = !empty($instance['widget_title_color_class']) ? "text-" . sanitize_html_class($instance['widget_title_color_class']) : '';
2752
+					$title_classes[] = !empty($instance['widget_title_border_class']) ? sanitize_html_class($instance['widget_title_border_class']) : '';
2753
+					$title_classes[] = !empty($instance['widget_title_border_color_class']) ? "border-" . sanitize_html_class($instance['widget_title_border_color_class']) : '';
2754
+					$title_classes[] = !empty($instance['widget_title_mt_class']) ? "mt-" . absint($instance['widget_title_mt_class']) : '';
2755
+					$title_classes[] = !empty($instance['widget_title_mr_class']) ? "mr-" . absint($instance['widget_title_mr_class']) : '';
2756
+					$title_classes[] = !empty($instance['widget_title_mb_class']) ? "mb-" . absint($instance['widget_title_mb_class']) : '';
2757
+					$title_classes[] = !empty($instance['widget_title_ml_class']) ? "ml-" . absint($instance['widget_title_ml_class']) : '';
2758
+					$title_classes[] = !empty($instance['widget_title_pt_class']) ? "pt-" . absint($instance['widget_title_pt_class']) : '';
2759
+					$title_classes[] = !empty($instance['widget_title_pr_class']) ? "pr-" . absint($instance['widget_title_pr_class']) : '';
2760
+					$title_classes[] = !empty($instance['widget_title_pb_class']) ? "pb-" . absint($instance['widget_title_pb_class']) : '';
2761
+					$title_classes[] = !empty($instance['widget_title_pl_class']) ? "pl-" . absint($instance['widget_title_pl_class']) : '';
2762
+
2763
+					$class = !empty($title_classes) ? implode(" ", $title_classes) : '';
2764 2764
 					$output = "<$title_tag class='$class' >$title</$title_tag>";
2765 2765
 				}
2766 2766
 
@@ -2774,7 +2774,7 @@  discard block
 block discarded – undo
2774 2774
 		 *
2775 2775
 		 * @param array $instance The widget options.
2776 2776
 		 */
2777
-		public function form( $instance ) {
2777
+		public function form($instance) {
2778 2778
 
2779 2779
 			// set widget instance
2780 2780
 			$this->instance = $instance;
@@ -2782,20 +2782,20 @@  discard block
 block discarded – undo
2782 2782
 			// set it as a SD widget
2783 2783
 			echo $this->widget_advanced_toggle();
2784 2784
 
2785
-			echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
2785
+			echo "<p>" . esc_attr($this->options['widget_ops']['description']) . "</p>";
2786 2786
 			$arguments_raw = $this->get_arguments();
2787 2787
 
2788
-			if ( is_array( $arguments_raw ) ) {
2788
+			if (is_array($arguments_raw)) {
2789 2789
 
2790
-				$arguments = $this->group_arguments( $arguments_raw );
2790
+				$arguments = $this->group_arguments($arguments_raw);
2791 2791
 
2792 2792
 				// Do we have sections?
2793 2793
 				$has_sections = $arguments == $arguments_raw ? false : true;
2794 2794
 
2795 2795
 
2796
-				if ( $has_sections ) {
2796
+				if ($has_sections) {
2797 2797
 					$panel_count = 0;
2798
-					foreach ( $arguments as $key => $args ) {
2798
+					foreach ($arguments as $key => $args) {
2799 2799
 
2800 2800
 						?>
2801 2801
 						<script>
@@ -2805,26 +2805,26 @@  discard block
 block discarded – undo
2805 2805
 
2806 2806
 						$hide       = $panel_count ? ' style="display:none;" ' : '';
2807 2807
 						$icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
2808
-						echo "<button onclick='jQuery(this).find(\"i\").toggleClass(\"fas fa-chevron-up fas fa-chevron-down\");jQuery(this).next().slideToggle();' type='button' class='sd-toggle-group-button sd-input-group-toggle" . sanitize_title_with_dashes( $key ) . "'>" . esc_attr( $key ) . " <i style='float:right;' class='" . $icon_class . "'></i></button>";
2809
-						echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
2808
+						echo "<button onclick='jQuery(this).find(\"i\").toggleClass(\"fas fa-chevron-up fas fa-chevron-down\");jQuery(this).next().slideToggle();' type='button' class='sd-toggle-group-button sd-input-group-toggle" . sanitize_title_with_dashes($key) . "'>" . esc_attr($key) . " <i style='float:right;' class='" . $icon_class . "'></i></button>";
2809
+						echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes($key) . "' $hide>";
2810 2810
 
2811
-						foreach ( $args as $k => $a ) {
2811
+						foreach ($args as $k => $a) {
2812 2812
 
2813 2813
 							$this->widget_inputs_row_start($k, $a);
2814
-							$this->widget_inputs( $a, $instance );
2814
+							$this->widget_inputs($a, $instance);
2815 2815
 							$this->widget_inputs_row_end($k, $a);
2816 2816
 
2817 2817
 						}
2818 2818
 
2819 2819
 						echo "</div>";
2820 2820
 
2821
-						$panel_count ++;
2821
+						$panel_count++;
2822 2822
 
2823 2823
 					}
2824 2824
 				} else {
2825
-					foreach ( $arguments as $key => $args ) {
2825
+					foreach ($arguments as $key => $args) {
2826 2826
 						$this->widget_inputs_row_start($key, $args);
2827
-						$this->widget_inputs( $args, $instance );
2827
+						$this->widget_inputs($args, $instance);
2828 2828
 						$this->widget_inputs_row_end($key, $args);
2829 2829
 					}
2830 2830
 				}
@@ -2832,33 +2832,33 @@  discard block
 block discarded – undo
2832 2832
 			}
2833 2833
 		}
2834 2834
 
2835
-		public function widget_inputs_row_start($key, $args){
2836
-			if(!empty($args['row'])){
2835
+		public function widget_inputs_row_start($key, $args) {
2836
+			if (!empty($args['row'])) {
2837 2837
 				// maybe open
2838
-				if(!empty($args['row']['open'])){
2838
+				if (!empty($args['row']['open'])) {
2839 2839
 					?>
2840
-					<div class='bsui sd-argument ' data-argument='<?php echo esc_attr( $args['row']['key'] ); ?>' data-element_require='<?php if ( !empty($args['row']['element_require'])) {
2841
-						echo $this->convert_element_require( $args['row']['element_require'] );
2840
+					<div class='bsui sd-argument ' data-argument='<?php echo esc_attr($args['row']['key']); ?>' data-element_require='<?php if (!empty($args['row']['element_require'])) {
2841
+						echo $this->convert_element_require($args['row']['element_require']);
2842 2842
 					} ?>'>
2843
-					<?php if(!empty($args['row']['title'])){ ?>
2844
-					<label class="mb-0 "><?php echo esc_attr( $args['row']['title'] ); ?><?php echo $this->widget_field_desc( $args['row'] ); ?></label>
2843
+					<?php if (!empty($args['row']['title'])) { ?>
2844
+					<label class="mb-0 "><?php echo esc_attr($args['row']['title']); ?><?php echo $this->widget_field_desc($args['row']); ?></label>
2845 2845
 					<?php }?>
2846
-					<div class='row <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>'>
2846
+					<div class='row <?php if (!empty($args['row']['class'])) { echo esc_attr($args['row']['class']); } ?>'>
2847 2847
 					<div class='col pr-2'>
2848 2848
 					<?php
2849
-				}elseif(!empty($args['row']['close'])){
2849
+				}elseif (!empty($args['row']['close'])) {
2850 2850
 					echo "<div class='col pl-0'>";
2851
-				}else{
2851
+				} else {
2852 2852
 					echo "<div class='col pl-0 pr-2'>";
2853 2853
 				}
2854 2854
 			}
2855 2855
 		}
2856 2856
 
2857
-		public function widget_inputs_row_end($key, $args){
2857
+		public function widget_inputs_row_end($key, $args) {
2858 2858
 
2859
-			if(!empty($args['row'])){
2859
+			if (!empty($args['row'])) {
2860 2860
 				// maybe close
2861
-				if(!empty($args['row']['close'])){
2861
+				if (!empty($args['row']['close'])) {
2862 2862
 					echo "</div></div>";
2863 2863
 				}
2864 2864
 
@@ -2874,7 +2874,7 @@  discard block
 block discarded – undo
2874 2874
 		public function widget_advanced_toggle() {
2875 2875
 
2876 2876
 			$output = '';
2877
-			if ( $this->block_show_advanced() ) {
2877
+			if ($this->block_show_advanced()) {
2878 2878
 				$val = 1;
2879 2879
 			} else {
2880 2880
 				$val = 0;
@@ -2894,14 +2894,14 @@  discard block
 block discarded – undo
2894 2894
 		 *
2895 2895
 		 * @return string $output
2896 2896
 		 */
2897
-		public function convert_element_require( $input ) {
2897
+		public function convert_element_require($input) {
2898 2898
 
2899
-			$input = str_replace( "'", '"', $input );// we only want double quotes
2899
+			$input = str_replace("'", '"', $input); // we only want double quotes
2900 2900
 
2901
-			$output = esc_attr( str_replace( array( "[%", "%]" ), array(
2901
+			$output = esc_attr(str_replace(array("[%", "%]"), array(
2902 2902
 				"jQuery(form).find('[data-argument=\"",
2903 2903
 				"\"]').find('input,select,textarea').val()"
2904
-			), $input ) );
2904
+			), $input));
2905 2905
 
2906 2906
 			return $output;
2907 2907
 		}
@@ -2912,56 +2912,56 @@  discard block
 block discarded – undo
2912 2912
 		 * @param $args
2913 2913
 		 * @param $instance
2914 2914
 		 */
2915
-		public function widget_inputs( $args, $instance ) {
2915
+		public function widget_inputs($args, $instance) {
2916 2916
 
2917 2917
 			$class             = "";
2918 2918
 			$element_require   = "";
2919 2919
 			$custom_attributes = "";
2920 2920
 
2921 2921
 			// get value
2922
-			if ( isset( $instance[ $args['name'] ] ) ) {
2923
-				$value = $instance[ $args['name'] ];
2924
-			} elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
2925
-				$value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
2922
+			if (isset($instance[$args['name']])) {
2923
+				$value = $instance[$args['name']];
2924
+			} elseif (!isset($instance[$args['name']]) && !empty($args['default'])) {
2925
+				$value = is_array($args['default']) ? array_map("esc_html", $args['default']) : esc_html($args['default']);
2926 2926
 			} else {
2927 2927
 				$value = '';
2928 2928
 			}
2929 2929
 
2930 2930
 			// get placeholder
2931
-			if ( ! empty( $args['placeholder'] ) ) {
2932
-				$placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
2931
+			if (!empty($args['placeholder'])) {
2932
+				$placeholder = "placeholder='" . esc_html($args['placeholder']) . "'";
2933 2933
 			} else {
2934 2934
 				$placeholder = '';
2935 2935
 			}
2936 2936
 
2937 2937
 			// get if advanced
2938
-			if ( isset( $args['advanced'] ) && $args['advanced'] ) {
2938
+			if (isset($args['advanced']) && $args['advanced']) {
2939 2939
 				$class .= " sd-advanced-setting ";
2940 2940
 			}
2941 2941
 
2942 2942
 			// element_require
2943
-			if ( isset( $args['element_require'] ) && $args['element_require'] ) {
2943
+			if (isset($args['element_require']) && $args['element_require']) {
2944 2944
 				$element_require = $args['element_require'];
2945 2945
 			}
2946 2946
 
2947 2947
 			// custom_attributes
2948
-			if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
2949
-				$custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
2948
+			if (isset($args['custom_attributes']) && $args['custom_attributes']) {
2949
+				$custom_attributes = $this->array_to_attributes($args['custom_attributes'], true);
2950 2950
 			}
2951 2951
 
2952 2952
 
2953 2953
 			// before wrapper
2954 2954
 			?>
2955
-			<p class="sd-argument <?php echo esc_attr( $class ); ?>"
2956
-			data-argument='<?php echo esc_attr( $args['name'] ); ?>'
2957
-			data-element_require='<?php if ( $element_require ) {
2958
-				echo $this->convert_element_require( $element_require );
2955
+			<p class="sd-argument <?php echo esc_attr($class); ?>"
2956
+			data-argument='<?php echo esc_attr($args['name']); ?>'
2957
+			data-element_require='<?php if ($element_require) {
2958
+				echo $this->convert_element_require($element_require);
2959 2959
 			} ?>'
2960 2960
 			>
2961 2961
 			<?php
2962 2962
 
2963 2963
 
2964
-			switch ( $args['type'] ) {
2964
+			switch ($args['type']) {
2965 2965
 				//array('text','password','number','email','tel','url','color')
2966 2966
 				case "text":
2967 2967
 				case "password":
@@ -2972,46 +2972,46 @@  discard block
 block discarded – undo
2972 2972
 				case "color":
2973 2973
 					?>
2974 2974
 					<label
2975
-						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label>
2975
+						for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label>
2976 2976
 					<input <?php echo $placeholder; ?> class="widefat"
2977 2977
 						<?php echo $custom_attributes; ?>
2978
-						                               id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
2979
-						                               name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>"
2980
-						                               type="<?php echo esc_attr( $args['type'] ); ?>"
2981
-						                               value="<?php echo esc_attr( $value ); ?>">
2978
+						                               id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
2979
+						                               name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>"
2980
+						                               type="<?php echo esc_attr($args['type']); ?>"
2981
+						                               value="<?php echo esc_attr($value); ?>">
2982 2982
 					<?php
2983 2983
 
2984 2984
 					break;
2985 2985
 				case "select":
2986
-					$multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
2987
-					if ( $multiple ) {
2988
-						if ( empty( $value ) ) {
2986
+					$multiple = isset($args['multiple']) && $args['multiple'] ? true : false;
2987
+					if ($multiple) {
2988
+						if (empty($value)) {
2989 2989
 							$value = array();
2990 2990
 						}
2991 2991
 					}
2992 2992
 					?>
2993 2993
 					<label
2994
-						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
2994
+						for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label>
2995 2995
 					<select <?php echo $placeholder; ?> class="widefat"
2996 2996
 						<?php echo $custom_attributes; ?>
2997
-						                                id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
2998
-						                                name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) );
2999
-						                                if ( $multiple ) {
2997
+						                                id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
2998
+						                                name="<?php echo esc_attr($this->get_field_name($args['name']));
2999
+						                                if ($multiple) {
3000 3000
 							                                echo "[]";
3001 3001
 						                                } ?>"
3002
-						<?php if ( $multiple ) {
3002
+						<?php if ($multiple) {
3003 3003
 							echo "multiple";
3004 3004
 						} //@todo not implemented yet due to gutenberg not supporting it
3005 3005
 						?>
3006 3006
 					>
3007 3007
 						<?php
3008 3008
 
3009
-						if ( ! empty( $args['options'] ) ) {
3010
-							foreach ( $args['options'] as $val => $label ) {
3011
-								if ( $multiple ) {
3012
-									$selected = in_array( $val, $value ) ? 'selected="selected"' : '';
3009
+						if (!empty($args['options'])) {
3010
+							foreach ($args['options'] as $val => $label) {
3011
+								if ($multiple) {
3012
+									$selected = in_array($val, $value) ? 'selected="selected"' : '';
3013 3013
 								} else {
3014
-									$selected = selected( $value, $val, false );
3014
+									$selected = selected($value, $val, false);
3015 3015
 								}
3016 3016
 								echo "<option value='$val' " . $selected . ">$label</option>";
3017 3017
 							}
@@ -3023,32 +3023,32 @@  discard block
 block discarded – undo
3023 3023
 				case "checkbox":
3024 3024
 					?>
3025 3025
 					<input <?php echo $placeholder; ?>
3026
-						<?php checked( 1, $value, true ) ?>
3026
+						<?php checked(1, $value, true) ?>
3027 3027
 						<?php echo $custom_attributes; ?>
3028
-						class="widefat" id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
3029
-						name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="checkbox"
3028
+						class="widefat" id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
3029
+						name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="checkbox"
3030 3030
 						value="1">
3031 3031
 					<label
3032
-						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label>
3032
+						for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label>
3033 3033
 					<?php
3034 3034
 					break;
3035 3035
 				case "textarea":
3036 3036
 					?>
3037 3037
 					<label
3038
-						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
3038
+						for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label>
3039 3039
 					<textarea <?php echo $placeholder; ?> class="widefat"
3040 3040
 						<?php echo $custom_attributes; ?>
3041
-						                                  id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
3042
-						                                  name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>"
3043
-					><?php echo esc_attr( $value ); ?></textarea>
3041
+						                                  id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
3042
+						                                  name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>"
3043
+					><?php echo esc_attr($value); ?></textarea>
3044 3044
 					<?php
3045 3045
 
3046 3046
 					break;
3047 3047
 				case "hidden":
3048 3048
 					?>
3049
-					<input id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
3050
-					       name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="hidden"
3051
-					       value="<?php echo esc_attr( $value ); ?>">
3049
+					<input id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
3050
+					       name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="hidden"
3051
+					       value="<?php echo esc_attr($value); ?>">
3052 3052
 					<?php
3053 3053
 					break;
3054 3054
 				default:
@@ -3063,15 +3063,15 @@  discard block
 block discarded – undo
3063 3063
 
3064 3064
 		}
3065 3065
 
3066
-		public function get_widget_icon($icon = 'box-top', $title = ''){
3067
-			if($icon=='box-top'){
3068
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
3069
-			}elseif($icon=='box-right'){
3070
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
3071
-			}elseif($icon=='box-bottom'){
3072
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
3073
-			}elseif($icon=='box-left'){
3074
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
3066
+		public function get_widget_icon($icon = 'box-top', $title = '') {
3067
+			if ($icon == 'box-top') {
3068
+				return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
3069
+			}elseif ($icon == 'box-right') {
3070
+				return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
3071
+			}elseif ($icon == 'box-bottom') {
3072
+				return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
3073
+			}elseif ($icon == 'box-left') {
3074
+				return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
3075 3075
 			}
3076 3076
 		}
3077 3077
 
@@ -3083,14 +3083,14 @@  discard block
 block discarded – undo
3083 3083
 		 * @return string
3084 3084
 		 * @todo, need to make its own tooltip script
3085 3085
 		 */
3086
-		public function widget_field_desc( $args ) {
3086
+		public function widget_field_desc($args) {
3087 3087
 
3088 3088
 			$description = '';
3089
-			if ( isset( $args['desc'] ) && $args['desc'] ) {
3090
-				if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
3091
-					$description = $this->desc_tip( $args['desc'] );
3089
+			if (isset($args['desc']) && $args['desc']) {
3090
+				if (isset($args['desc_tip']) && $args['desc_tip']) {
3091
+					$description = $this->desc_tip($args['desc']);
3092 3092
 				} else {
3093
-					$description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
3093
+					$description = '<span class="description">' . wp_kses_post($args['desc']) . '</span>';
3094 3094
 				}
3095 3095
 			}
3096 3096
 
@@ -3104,12 +3104,12 @@  discard block
 block discarded – undo
3104 3104
 		 *
3105 3105
 		 * @return string
3106 3106
 		 */
3107
-		public function widget_field_title( $args ) {
3107
+		public function widget_field_title($args) {
3108 3108
 
3109 3109
 			$title = '';
3110
-			if ( isset( $args['title'] ) && $args['title'] ) {
3111
-				if ( isset( $args['icon'] ) && $args['icon'] ) {
3112
-					$title = self::get_widget_icon( $args['icon'], $args['title']  );
3110
+			if (isset($args['title']) && $args['title']) {
3111
+				if (isset($args['icon']) && $args['icon']) {
3112
+					$title = self::get_widget_icon($args['icon'], $args['title']);
3113 3113
 				} else {
3114 3114
 					$title = esc_attr($args['title']);
3115 3115
 				}
@@ -3126,11 +3126,11 @@  discard block
 block discarded – undo
3126 3126
 		 *
3127 3127
 		 * @return string
3128 3128
 		 */
3129
-		function desc_tip( $tip, $allow_html = false ) {
3130
-			if ( $allow_html ) {
3131
-				$tip = $this->sanitize_tooltip( $tip );
3129
+		function desc_tip($tip, $allow_html = false) {
3130
+			if ($allow_html) {
3131
+				$tip = $this->sanitize_tooltip($tip);
3132 3132
 			} else {
3133
-				$tip = esc_attr( $tip );
3133
+				$tip = esc_attr($tip);
3134 3134
 			}
3135 3135
 
3136 3136
 			return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
@@ -3143,8 +3143,8 @@  discard block
 block discarded – undo
3143 3143
 		 *
3144 3144
 		 * @return string
3145 3145
 		 */
3146
-		public function sanitize_tooltip( $var ) {
3147
-			return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
3146
+		public function sanitize_tooltip($var) {
3147
+			return htmlspecialchars(wp_kses(html_entity_decode($var), array(
3148 3148
 				'br'     => array(),
3149 3149
 				'em'     => array(),
3150 3150
 				'strong' => array(),
@@ -3154,7 +3154,7 @@  discard block
 block discarded – undo
3154 3154
 				'li'     => array(),
3155 3155
 				'ol'     => array(),
3156 3156
 				'p'      => array(),
3157
-			) ) );
3157
+			)));
3158 3158
 		}
3159 3159
 
3160 3160
 		/**
@@ -3166,23 +3166,23 @@  discard block
 block discarded – undo
3166 3166
 		 * @return array
3167 3167
 		 * @todo we should add some sanitation here.
3168 3168
 		 */
3169
-		public function update( $new_instance, $old_instance ) {
3169
+		public function update($new_instance, $old_instance) {
3170 3170
 
3171 3171
 			//save the widget
3172
-			$instance = array_merge( (array) $old_instance, (array) $new_instance );
3172
+			$instance = array_merge((array) $old_instance, (array) $new_instance);
3173 3173
 
3174 3174
 			// set widget instance
3175 3175
 			$this->instance = $instance;
3176 3176
 
3177
-			if ( empty( $this->arguments ) ) {
3177
+			if (empty($this->arguments)) {
3178 3178
 				$this->get_arguments();
3179 3179
 			}
3180 3180
 
3181 3181
 			// check for checkboxes
3182
-			if ( ! empty( $this->arguments ) ) {
3183
-				foreach ( $this->arguments as $argument ) {
3184
-					if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
3185
-						$instance[ $argument['name'] ] = '0';
3182
+			if (!empty($this->arguments)) {
3183
+				foreach ($this->arguments as $argument) {
3184
+					if (isset($argument['type']) && $argument['type'] == 'checkbox' && !isset($new_instance[$argument['name']])) {
3185
+						$instance[$argument['name']] = '0';
3186 3186
 					}
3187 3187
 				}
3188 3188
 			}
@@ -3200,7 +3200,7 @@  discard block
 block discarded – undo
3200 3200
 		 */
3201 3201
 		public function is_block_content_call() {
3202 3202
 			$result = false;
3203
-			if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
3203
+			if (wp_doing_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'super_duper_output_shortcode') {
3204 3204
 				$result = true;
3205 3205
 			}
3206 3206
 
@@ -3213,9 +3213,9 @@  discard block
 block discarded – undo
3213 3213
 		 * @since 1.0.20
3214 3214
 		 * @return string
3215 3215
 		 */
3216
-		public function get_instance_hash(){
3217
-			$instance_string = $this->base_id.serialize($this->instance);
3218
-			return hash('crc32b',$instance_string);
3216
+		public function get_instance_hash() {
3217
+			$instance_string = $this->base_id . serialize($this->instance);
3218
+			return hash('crc32b', $instance_string);
3219 3219
 		}
3220 3220
 
3221 3221
 		/**
@@ -3226,14 +3226,14 @@  discard block
 block discarded – undo
3226 3226
 		 * @since 1.0.20
3227 3227
 		 * @return string
3228 3228
 		 */
3229
-		public function get_instance_style($rules = array()){
3229
+		public function get_instance_style($rules = array()) {
3230 3230
 			$css = '';
3231 3231
 
3232
-			if(!empty($rules)){
3232
+			if (!empty($rules)) {
3233 3233
 				$rules = array_unique($rules);
3234 3234
 				$instance_hash = $this->get_instance_hash();
3235 3235
 				$css .= "<style>";
3236
-				foreach($rules as $rule){
3236
+				foreach ($rules as $rule) {
3237 3237
 					$css .= ".sdel-$instance_hash $rule";
3238 3238
 				}
3239 3239
 				$css .= "</style>";
@@ -3250,9 +3250,9 @@  discard block
 block discarded – undo
3250 3250
 		 * @param string $content Content to search for shortcode tags.
3251 3251
 		 * @return string Content with shortcode tags removed.
3252 3252
 		 */
3253
-		public function encode_shortcodes( $content ) {
3253
+		public function encode_shortcodes($content) {
3254 3254
 			// Avoids existing encoded tags.
3255
-			$trans   = array(
3255
+			$trans = array(
3256 3256
 				'&#91;' => '&#091;',
3257 3257
 				'&#93;' => '&#093;',
3258 3258
 				'&amp;#91;' => '&#091;',
@@ -3263,7 +3263,7 @@  discard block
 block discarded – undo
3263 3263
 				'&amp;gt;' => '&0gt;',
3264 3264
 			);
3265 3265
 
3266
-			$content = strtr( $content, $trans );
3266
+			$content = strtr($content, $trans);
3267 3267
 
3268 3268
 			$trans   = array(
3269 3269
 				'[' => '&#91;',
@@ -3274,7 +3274,7 @@  discard block
 block discarded – undo
3274 3274
 				"'" => '&apos;',
3275 3275
 			);
3276 3276
 
3277
-			$content = strtr( $content, $trans );
3277
+			$content = strtr($content, $trans);
3278 3278
 
3279 3279
 			return $content;
3280 3280
 		}
@@ -3287,8 +3287,8 @@  discard block
 block discarded – undo
3287 3287
 		 * @param string $content Content to search for shortcode tags.
3288 3288
 		 * @return string Content with decoded shortcode tags.
3289 3289
 		 */
3290
-		public function decode_shortcodes( $content ) {
3291
-			$trans   = array(
3290
+		public function decode_shortcodes($content) {
3291
+			$trans = array(
3292 3292
 				'&#91;' => '[',
3293 3293
 				'&#93;' => ']',
3294 3294
 				'&amp;#91;' => '[',
@@ -3301,7 +3301,7 @@  discard block
 block discarded – undo
3301 3301
 				'&apos;' => "'",
3302 3302
 			);
3303 3303
 
3304
-			$content = strtr( $content, $trans );
3304
+			$content = strtr($content, $trans);
3305 3305
 
3306 3306
 			$trans   = array(
3307 3307
 				'&#091;' => '&#91;',
@@ -3314,7 +3314,7 @@  discard block
 block discarded – undo
3314 3314
 				'&amp;0gt;' => '&gt;',
3315 3315
 			);
3316 3316
 
3317
-			$content = strtr( $content, $trans );
3317
+			$content = strtr($content, $trans);
3318 3318
 
3319 3319
 			return $content;
3320 3320
 		}
Please login to merge, or discard this patch.
ayecode/wp-ayecode-ui/includes/components/class-aui-component-helper.php 2 patches
Indentation   +392 added lines, -392 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,395 +11,395 @@  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
-	 * @param $multiple bool If the name is set to be multiple but no brackets found then we add some.
19
-	 *
20
-	 * @return string
21
-	 */
22
-	public static function name( $text, $multiple = false ) {
23
-		$output = '';
24
-
25
-		if ( $text ) {
26
-			$is_multiple = strpos( $text, '[' ) === false && $multiple ? '[]' : '';
27
-			$output      = ' name="' . esc_attr( $text ) . $is_multiple . '" ';
28
-		}
29
-
30
-		return $output;
31
-	}
32
-
33
-	/**
34
-	 * A component helper for generating a item id.
35
-	 *
36
-	 * @param $text string The text to be used as the value.
37
-	 *
38
-	 * @return string The sanitized item.
39
-	 */
40
-	public static function id( $text ) {
41
-		$output = '';
42
-
43
-		if ( $text ) {
44
-			$output = ' id="' . sanitize_html_class( $text ) . '" ';
45
-		}
46
-
47
-		return $output;
48
-	}
49
-
50
-	/**
51
-	 * A component helper for generating a item title.
52
-	 *
53
-	 * @param $text string The text to be used as the value.
54
-	 *
55
-	 * @return string The sanitized item.
56
-	 */
57
-	public static function title( $text ) {
58
-		$output = '';
59
-
60
-		if ( $text ) {
61
-			$output = ' title="' . esc_attr( $text ) . '" ';
62
-		}
63
-
64
-		return $output;
65
-	}
66
-
67
-	/**
68
-	 * A component helper for generating a item value.
69
-	 *
70
-	 * @param $text string The text to be used as the value.
71
-	 *
72
-	 * @return string The sanitized item.
73
-	 */
74
-	public static function value( $text ) {
75
-		$output = '';
76
-
77
-		if ( $text !== null && $text !== false ) {
78
-			$output = ' value="' . esc_attr( wp_unslash( $text ) ) . '" ';
79
-		}
80
-
81
-		return $output;
82
-	}
83
-
84
-	/**
85
-	 * A component helper for generating a item class attribute.
86
-	 *
87
-	 * @param $text string The text to be used as the value.
88
-	 *
89
-	 * @return string The sanitized item.
90
-	 */
91
-	public static function class_attr( $text ) {
92
-		$output = '';
93
-
94
-		if ( $text ) {
95
-			$classes = self::esc_classes( $text );
96
-			if ( ! empty( $classes ) ) {
97
-				$output = ' class="' . $classes . '" ';
98
-			}
99
-		}
100
-
101
-		return $output;
102
-	}
103
-
104
-	/**
105
-	 * Escape a string of classes.
106
-	 *
107
-	 * @param $text
108
-	 *
109
-	 * @return string
110
-	 */
111
-	public static function esc_classes( $text ) {
112
-		$output = '';
113
-
114
-		if ( $text ) {
115
-			$classes = explode( " ", $text );
116
-			$classes = array_map( "trim", $classes );
117
-			$classes = array_map( "sanitize_html_class", $classes );
118
-			if ( ! empty( $classes ) ) {
119
-				$output = implode( " ", $classes );
120
-			}
121
-		}
122
-
123
-		return $output;
124
-
125
-	}
126
-
127
-	/**
128
-	 * @param $args
129
-	 *
130
-	 * @return string
131
-	 */
132
-	public static function data_attributes( $args ) {
133
-		$output = '';
134
-
135
-		if ( ! empty( $args ) ) {
136
-
137
-			foreach ( $args as $key => $val ) {
138
-				if ( substr( $key, 0, 5 ) === "data-" ) {
139
-					$output .= ' ' . sanitize_html_class( $key ) . '="' . esc_attr( $val ) . '" ';
140
-				}
141
-			}
142
-		}
143
-
144
-		return $output;
145
-	}
146
-
147
-	/**
148
-	 * @param $args
149
-	 *
150
-	 * @return string
151
-	 */
152
-	public static function aria_attributes( $args ) {
153
-		$output = '';
154
-
155
-		if ( ! empty( $args ) ) {
156
-
157
-			foreach ( $args as $key => $val ) {
158
-				if ( substr( $key, 0, 5 ) === "aria-" ) {
159
-					$output .= ' ' . sanitize_html_class( $key ) . '="' . esc_attr( $val ) . '" ';
160
-				}
161
-			}
162
-		}
163
-
164
-		return $output;
165
-	}
166
-
167
-	/**
168
-	 * Build a font awesome icon from a class.
169
-	 *
170
-	 * @param $class
171
-	 * @param bool $space_after
172
-	 * @param array $extra_attributes An array of extra attributes.
173
-	 *
174
-	 * @return string
175
-	 */
176
-	public static function icon( $class, $space_after = false, $extra_attributes = array() ) {
177
-		$output = '';
178
-
179
-		if ( $class ) {
180
-			$classes = self::esc_classes( $class );
181
-			if ( ! empty( $classes ) ) {
182
-				$output = '<i class="' . $classes . '" ';
183
-				// extra attributes
184
-				if ( ! empty( $extra_attributes ) ) {
185
-					$output .= AUI_Component_Helper::extra_attributes( $extra_attributes );
186
-				}
187
-				$output .= '></i>';
188
-				if ( $space_after ) {
189
-					$output .= " ";
190
-				}
191
-			}
192
-		}
193
-
194
-		return $output;
195
-	}
196
-
197
-	/**
198
-	 * @param $args
199
-	 *
200
-	 * @return string
201
-	 */
202
-	public static function extra_attributes( $args ) {
203
-		$output = '';
204
-
205
-		if ( ! empty( $args ) ) {
206
-
207
-			if ( is_array( $args ) ) {
208
-				foreach ( $args as $key => $val ) {
209
-					$output .= ' ' . sanitize_html_class( $key ) . '="' . esc_attr( $val ) . '" ';
210
-				}
211
-			} else {
212
-				$output .= ' ' . $args . ' ';
213
-			}
214
-
215
-		}
216
-
217
-		return $output;
218
-	}
219
-
220
-	/**
221
-	 * @param $args
222
-	 *
223
-	 * @return string
224
-	 */
225
-	public static function help_text( $text ) {
226
-		$output = '';
227
-
228
-		if ( $text ) {
229
-			$output .= '<small class="form-text text-muted">' . wp_kses_post( $text ) . '</small>';
230
-		}
231
-
232
-
233
-		return $output;
234
-	}
235
-
236
-	/**
237
-	 * Replace element require context with JS.
238
-	 *
239
-	 * @param $input
240
-	 *
241
-	 * @return string|void
242
-	 */
243
-	public static function element_require( $input ) {
244
-
245
-		$input = str_replace( "'", '"', $input );// we only want double quotes
246
-
247
-		$output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array(
248
-			"jQuery(form).find('[data-argument=\"",
249
-			"\"]').find('input,select,textarea').val()",
250
-			"\"]').find('input:checked').val()",
251
-		), $input ) );
252
-
253
-		if ( $output ) {
254
-			$output = ' data-element-require="' . $output . '" ';
255
-		}
256
-
257
-		return $output;
258
-	}
259
-
260
-	/**
261
-	 * Navigates through an array, object, or scalar, and removes slashes from the values.
262
-	 *
263
-	 * @since 0.1.41
264
-	 *
265
-	 * @param mixed $value The value to be stripped.
266
-	 * @param array $input Input Field.
267
-	 *
268
-	 * @return mixed Stripped value.
269
-	 */
270
-	public static function sanitize_html_field( $value, $input = array() ) {
271
-		$original = $value;
272
-
273
-		if ( is_array( $value ) ) {
274
-			foreach ( $value as $index => $item ) {
275
-				$value[ $index ] = self::_sanitize_html_field( $value, $input );
276
-			}
277
-		} elseif ( is_object( $value ) ) {
278
-			$object_vars = get_object_vars( $value );
279
-
280
-			foreach ( $object_vars as $property_name => $property_value ) {
281
-				$value->$property_name = self::_sanitize_html_field( $property_value, $input );
282
-			}
283
-		} else {
284
-			$value = self::_sanitize_html_field( $value, $input );
285
-		}
286
-
287
-		/**
288
-		 * Filters content and keeps only allowable HTML elements.
289
-		 *
290
-		 * @since 0.1.41
291
-		 *
292
-		 * @param string|array $value Content to filter through kses.
293
-		 * @param string|array $value Original content without filter.
294
-		 * @param array $input Input Field.
295
-		 */
296
-		return apply_filters( 'ayecode_ui_sanitize_html_field', $value, $original, $input );
297
-	}
298
-
299
-	/**
300
-	 * Filters content and keeps only allowable HTML elements.
301
-	 *
302
-	 * This function makes sure that only the allowed HTML element names, attribute
303
-	 * names and attribute values plus only sane HTML entities will occur in
304
-	 * $string. You have to remove any slashes from PHP's magic quotes before you
305
-	 * call this function.
306
-	 *
307
-	 * The default allowed protocols are 'http', 'https', 'ftp', 'mailto', 'news',
308
-	 * 'irc', 'gopher', 'nntp', 'feed', 'telnet, 'mms', 'rtsp' and 'svn'. This
309
-	 * covers all common link protocols, except for 'javascript' which should not
310
-	 * be allowed for untrusted users.
311
-	 *
312
-	 * @since 0.1.41
313
-	 *
314
-	 * @param string|array $value Content to filter through kses.
315
-	 * @param array $input Input Field.
316
-	 *
317
-	 * @return string Filtered content with only allowed HTML elements.
318
-	 */
319
-	public static function _sanitize_html_field( $value, $input = array() ) {
320
-		if ( $value === '' ) {
321
-			return $value;
322
-		}
323
-
324
-		$allowed_html = self::kses_allowed_html( 'post', $input );
325
-
326
-		if ( ! is_array( $allowed_html ) ) {
327
-			$allowed_html = wp_kses_allowed_html( 'post' );
328
-		}
329
-
330
-		$filtered = trim( wp_unslash( $value ) );
331
-		$filtered = wp_kses( $filtered, $allowed_html );
332
-		$filtered = balanceTags( $filtered ); // Balances tags
333
-
334
-		return $filtered;
335
-	}
336
-
337
-	/**
338
-	 * Returns an array of allowed HTML tags and attributes for a given context.
339
-	 *
340
-	 * @since 0.1.41
341
-	 *
342
-	 * @param string|array $context The context for which to retrieve tags. Allowed values are 'post',
343
-	 *                              'strip', 'data', 'entities', or the name of a field filter such as
344
-	 *                              'pre_user_description'.
345
-	 * @param array $input Input.
346
-	 *
347
-	 * @return array Array of allowed HTML tags and their allowed attributes.
348
-	 */
349
-	public static function kses_allowed_html( $context = 'post', $input = array() ) {
350
-		$allowed_html = wp_kses_allowed_html( $context );
351
-
352
-		if ( is_array( $allowed_html ) ) {
353
-			// <iframe>
354
-			if ( ! isset( $allowed_html['iframe'] ) && $context == 'post' ) {
355
-				$allowed_html['iframe'] = array(
356
-					'class'           => true,
357
-					'id'              => true,
358
-					'src'             => true,
359
-					'width'           => true,
360
-					'height'          => true,
361
-					'frameborder'     => true,
362
-					'marginwidth'     => true,
363
-					'marginheight'    => true,
364
-					'scrolling'       => true,
365
-					'style'           => true,
366
-					'title'           => true,
367
-					'allow'           => true,
368
-					'allowfullscreen' => true,
369
-					'data-*'          => true,
370
-				);
371
-			}
372
-		}
373
-
374
-		/**
375
-		 * Filters the allowed html tags.
376
-		 *
377
-		 * @since 0.1.41
378
-		 *
379
-		 * @param array[]|string $allowed_html Allowed html tags.
380
-		 * @param @param string|array $context The context for which to retrieve tags.
381
-		 * @param array $input Input field.
382
-		 */
383
-		return apply_filters( 'ayecode_ui_kses_allowed_html', $allowed_html, $context, $input );
384
-	}
385
-
386
-	public static function get_column_class( $label_number = 2, $type = 'label' ) {
387
-
388
-		$class = '';
389
-
390
-		// set default if empty
391
-		if( $label_number === '' ){
392
-			$label_number = 2;
393
-		}
394
-
395
-		if ( $label_number && $label_number < 12 && $label_number > 0 ) {
396
-			if ( $type == 'label' ) {
397
-				$class = 'col-sm-' . absint( $label_number );
398
-			} elseif ( $type == 'input' ) {
399
-				$class = 'col-sm-' . ( 12 - absint( $label_number ) );
400
-			}
401
-		}
402
-
403
-		return $class;
404
-	}
14
+    /**
15
+     * A component helper for generating a input name.
16
+     *
17
+     * @param $text
18
+     * @param $multiple bool If the name is set to be multiple but no brackets found then we add some.
19
+     *
20
+     * @return string
21
+     */
22
+    public static function name( $text, $multiple = false ) {
23
+        $output = '';
24
+
25
+        if ( $text ) {
26
+            $is_multiple = strpos( $text, '[' ) === false && $multiple ? '[]' : '';
27
+            $output      = ' name="' . esc_attr( $text ) . $is_multiple . '" ';
28
+        }
29
+
30
+        return $output;
31
+    }
32
+
33
+    /**
34
+     * A component helper for generating a item id.
35
+     *
36
+     * @param $text string The text to be used as the value.
37
+     *
38
+     * @return string The sanitized item.
39
+     */
40
+    public static function id( $text ) {
41
+        $output = '';
42
+
43
+        if ( $text ) {
44
+            $output = ' id="' . sanitize_html_class( $text ) . '" ';
45
+        }
46
+
47
+        return $output;
48
+    }
49
+
50
+    /**
51
+     * A component helper for generating a item title.
52
+     *
53
+     * @param $text string The text to be used as the value.
54
+     *
55
+     * @return string The sanitized item.
56
+     */
57
+    public static function title( $text ) {
58
+        $output = '';
59
+
60
+        if ( $text ) {
61
+            $output = ' title="' . esc_attr( $text ) . '" ';
62
+        }
63
+
64
+        return $output;
65
+    }
66
+
67
+    /**
68
+     * A component helper for generating a item value.
69
+     *
70
+     * @param $text string The text to be used as the value.
71
+     *
72
+     * @return string The sanitized item.
73
+     */
74
+    public static function value( $text ) {
75
+        $output = '';
76
+
77
+        if ( $text !== null && $text !== false ) {
78
+            $output = ' value="' . esc_attr( wp_unslash( $text ) ) . '" ';
79
+        }
80
+
81
+        return $output;
82
+    }
83
+
84
+    /**
85
+     * A component helper for generating a item class attribute.
86
+     *
87
+     * @param $text string The text to be used as the value.
88
+     *
89
+     * @return string The sanitized item.
90
+     */
91
+    public static function class_attr( $text ) {
92
+        $output = '';
93
+
94
+        if ( $text ) {
95
+            $classes = self::esc_classes( $text );
96
+            if ( ! empty( $classes ) ) {
97
+                $output = ' class="' . $classes . '" ';
98
+            }
99
+        }
100
+
101
+        return $output;
102
+    }
103
+
104
+    /**
105
+     * Escape a string of classes.
106
+     *
107
+     * @param $text
108
+     *
109
+     * @return string
110
+     */
111
+    public static function esc_classes( $text ) {
112
+        $output = '';
113
+
114
+        if ( $text ) {
115
+            $classes = explode( " ", $text );
116
+            $classes = array_map( "trim", $classes );
117
+            $classes = array_map( "sanitize_html_class", $classes );
118
+            if ( ! empty( $classes ) ) {
119
+                $output = implode( " ", $classes );
120
+            }
121
+        }
122
+
123
+        return $output;
124
+
125
+    }
126
+
127
+    /**
128
+     * @param $args
129
+     *
130
+     * @return string
131
+     */
132
+    public static function data_attributes( $args ) {
133
+        $output = '';
134
+
135
+        if ( ! empty( $args ) ) {
136
+
137
+            foreach ( $args as $key => $val ) {
138
+                if ( substr( $key, 0, 5 ) === "data-" ) {
139
+                    $output .= ' ' . sanitize_html_class( $key ) . '="' . esc_attr( $val ) . '" ';
140
+                }
141
+            }
142
+        }
143
+
144
+        return $output;
145
+    }
146
+
147
+    /**
148
+     * @param $args
149
+     *
150
+     * @return string
151
+     */
152
+    public static function aria_attributes( $args ) {
153
+        $output = '';
154
+
155
+        if ( ! empty( $args ) ) {
156
+
157
+            foreach ( $args as $key => $val ) {
158
+                if ( substr( $key, 0, 5 ) === "aria-" ) {
159
+                    $output .= ' ' . sanitize_html_class( $key ) . '="' . esc_attr( $val ) . '" ';
160
+                }
161
+            }
162
+        }
163
+
164
+        return $output;
165
+    }
166
+
167
+    /**
168
+     * Build a font awesome icon from a class.
169
+     *
170
+     * @param $class
171
+     * @param bool $space_after
172
+     * @param array $extra_attributes An array of extra attributes.
173
+     *
174
+     * @return string
175
+     */
176
+    public static function icon( $class, $space_after = false, $extra_attributes = array() ) {
177
+        $output = '';
178
+
179
+        if ( $class ) {
180
+            $classes = self::esc_classes( $class );
181
+            if ( ! empty( $classes ) ) {
182
+                $output = '<i class="' . $classes . '" ';
183
+                // extra attributes
184
+                if ( ! empty( $extra_attributes ) ) {
185
+                    $output .= AUI_Component_Helper::extra_attributes( $extra_attributes );
186
+                }
187
+                $output .= '></i>';
188
+                if ( $space_after ) {
189
+                    $output .= " ";
190
+                }
191
+            }
192
+        }
193
+
194
+        return $output;
195
+    }
196
+
197
+    /**
198
+     * @param $args
199
+     *
200
+     * @return string
201
+     */
202
+    public static function extra_attributes( $args ) {
203
+        $output = '';
204
+
205
+        if ( ! empty( $args ) ) {
206
+
207
+            if ( is_array( $args ) ) {
208
+                foreach ( $args as $key => $val ) {
209
+                    $output .= ' ' . sanitize_html_class( $key ) . '="' . esc_attr( $val ) . '" ';
210
+                }
211
+            } else {
212
+                $output .= ' ' . $args . ' ';
213
+            }
214
+
215
+        }
216
+
217
+        return $output;
218
+    }
219
+
220
+    /**
221
+     * @param $args
222
+     *
223
+     * @return string
224
+     */
225
+    public static function help_text( $text ) {
226
+        $output = '';
227
+
228
+        if ( $text ) {
229
+            $output .= '<small class="form-text text-muted">' . wp_kses_post( $text ) . '</small>';
230
+        }
231
+
232
+
233
+        return $output;
234
+    }
235
+
236
+    /**
237
+     * Replace element require context with JS.
238
+     *
239
+     * @param $input
240
+     *
241
+     * @return string|void
242
+     */
243
+    public static function element_require( $input ) {
244
+
245
+        $input = str_replace( "'", '"', $input );// we only want double quotes
246
+
247
+        $output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array(
248
+            "jQuery(form).find('[data-argument=\"",
249
+            "\"]').find('input,select,textarea').val()",
250
+            "\"]').find('input:checked').val()",
251
+        ), $input ) );
252
+
253
+        if ( $output ) {
254
+            $output = ' data-element-require="' . $output . '" ';
255
+        }
256
+
257
+        return $output;
258
+    }
259
+
260
+    /**
261
+     * Navigates through an array, object, or scalar, and removes slashes from the values.
262
+     *
263
+     * @since 0.1.41
264
+     *
265
+     * @param mixed $value The value to be stripped.
266
+     * @param array $input Input Field.
267
+     *
268
+     * @return mixed Stripped value.
269
+     */
270
+    public static function sanitize_html_field( $value, $input = array() ) {
271
+        $original = $value;
272
+
273
+        if ( is_array( $value ) ) {
274
+            foreach ( $value as $index => $item ) {
275
+                $value[ $index ] = self::_sanitize_html_field( $value, $input );
276
+            }
277
+        } elseif ( is_object( $value ) ) {
278
+            $object_vars = get_object_vars( $value );
279
+
280
+            foreach ( $object_vars as $property_name => $property_value ) {
281
+                $value->$property_name = self::_sanitize_html_field( $property_value, $input );
282
+            }
283
+        } else {
284
+            $value = self::_sanitize_html_field( $value, $input );
285
+        }
286
+
287
+        /**
288
+         * Filters content and keeps only allowable HTML elements.
289
+         *
290
+         * @since 0.1.41
291
+         *
292
+         * @param string|array $value Content to filter through kses.
293
+         * @param string|array $value Original content without filter.
294
+         * @param array $input Input Field.
295
+         */
296
+        return apply_filters( 'ayecode_ui_sanitize_html_field', $value, $original, $input );
297
+    }
298
+
299
+    /**
300
+     * Filters content and keeps only allowable HTML elements.
301
+     *
302
+     * This function makes sure that only the allowed HTML element names, attribute
303
+     * names and attribute values plus only sane HTML entities will occur in
304
+     * $string. You have to remove any slashes from PHP's magic quotes before you
305
+     * call this function.
306
+     *
307
+     * The default allowed protocols are 'http', 'https', 'ftp', 'mailto', 'news',
308
+     * 'irc', 'gopher', 'nntp', 'feed', 'telnet, 'mms', 'rtsp' and 'svn'. This
309
+     * covers all common link protocols, except for 'javascript' which should not
310
+     * be allowed for untrusted users.
311
+     *
312
+     * @since 0.1.41
313
+     *
314
+     * @param string|array $value Content to filter through kses.
315
+     * @param array $input Input Field.
316
+     *
317
+     * @return string Filtered content with only allowed HTML elements.
318
+     */
319
+    public static function _sanitize_html_field( $value, $input = array() ) {
320
+        if ( $value === '' ) {
321
+            return $value;
322
+        }
323
+
324
+        $allowed_html = self::kses_allowed_html( 'post', $input );
325
+
326
+        if ( ! is_array( $allowed_html ) ) {
327
+            $allowed_html = wp_kses_allowed_html( 'post' );
328
+        }
329
+
330
+        $filtered = trim( wp_unslash( $value ) );
331
+        $filtered = wp_kses( $filtered, $allowed_html );
332
+        $filtered = balanceTags( $filtered ); // Balances tags
333
+
334
+        return $filtered;
335
+    }
336
+
337
+    /**
338
+     * Returns an array of allowed HTML tags and attributes for a given context.
339
+     *
340
+     * @since 0.1.41
341
+     *
342
+     * @param string|array $context The context for which to retrieve tags. Allowed values are 'post',
343
+     *                              'strip', 'data', 'entities', or the name of a field filter such as
344
+     *                              'pre_user_description'.
345
+     * @param array $input Input.
346
+     *
347
+     * @return array Array of allowed HTML tags and their allowed attributes.
348
+     */
349
+    public static function kses_allowed_html( $context = 'post', $input = array() ) {
350
+        $allowed_html = wp_kses_allowed_html( $context );
351
+
352
+        if ( is_array( $allowed_html ) ) {
353
+            // <iframe>
354
+            if ( ! isset( $allowed_html['iframe'] ) && $context == 'post' ) {
355
+                $allowed_html['iframe'] = array(
356
+                    'class'           => true,
357
+                    'id'              => true,
358
+                    'src'             => true,
359
+                    'width'           => true,
360
+                    'height'          => true,
361
+                    'frameborder'     => true,
362
+                    'marginwidth'     => true,
363
+                    'marginheight'    => true,
364
+                    'scrolling'       => true,
365
+                    'style'           => true,
366
+                    'title'           => true,
367
+                    'allow'           => true,
368
+                    'allowfullscreen' => true,
369
+                    'data-*'          => true,
370
+                );
371
+            }
372
+        }
373
+
374
+        /**
375
+         * Filters the allowed html tags.
376
+         *
377
+         * @since 0.1.41
378
+         *
379
+         * @param array[]|string $allowed_html Allowed html tags.
380
+         * @param @param string|array $context The context for which to retrieve tags.
381
+         * @param array $input Input field.
382
+         */
383
+        return apply_filters( 'ayecode_ui_kses_allowed_html', $allowed_html, $context, $input );
384
+    }
385
+
386
+    public static function get_column_class( $label_number = 2, $type = 'label' ) {
387
+
388
+        $class = '';
389
+
390
+        // set default if empty
391
+        if( $label_number === '' ){
392
+            $label_number = 2;
393
+        }
394
+
395
+        if ( $label_number && $label_number < 12 && $label_number > 0 ) {
396
+            if ( $type == 'label' ) {
397
+                $class = 'col-sm-' . absint( $label_number );
398
+            } elseif ( $type == 'input' ) {
399
+                $class = 'col-sm-' . ( 12 - absint( $label_number ) );
400
+            }
401
+        }
402
+
403
+        return $class;
404
+    }
405 405
 }
406 406
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +85 added lines, -85 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
 
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
 	 *
20 20
 	 * @return string
21 21
 	 */
22
-	public static function name( $text, $multiple = false ) {
22
+	public static function name($text, $multiple = false) {
23 23
 		$output = '';
24 24
 
25
-		if ( $text ) {
26
-			$is_multiple = strpos( $text, '[' ) === false && $multiple ? '[]' : '';
27
-			$output      = ' name="' . esc_attr( $text ) . $is_multiple . '" ';
25
+		if ($text) {
26
+			$is_multiple = strpos($text, '[') === false && $multiple ? '[]' : '';
27
+			$output      = ' name="' . esc_attr($text) . $is_multiple . '" ';
28 28
 		}
29 29
 
30 30
 		return $output;
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @return string The sanitized item.
39 39
 	 */
40
-	public static function id( $text ) {
40
+	public static function id($text) {
41 41
 		$output = '';
42 42
 
43
-		if ( $text ) {
44
-			$output = ' id="' . sanitize_html_class( $text ) . '" ';
43
+		if ($text) {
44
+			$output = ' id="' . sanitize_html_class($text) . '" ';
45 45
 		}
46 46
 
47 47
 		return $output;
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @return string The sanitized item.
56 56
 	 */
57
-	public static function title( $text ) {
57
+	public static function title($text) {
58 58
 		$output = '';
59 59
 
60
-		if ( $text ) {
61
-			$output = ' title="' . esc_attr( $text ) . '" ';
60
+		if ($text) {
61
+			$output = ' title="' . esc_attr($text) . '" ';
62 62
 		}
63 63
 
64 64
 		return $output;
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @return string The sanitized item.
73 73
 	 */
74
-	public static function value( $text ) {
74
+	public static function value($text) {
75 75
 		$output = '';
76 76
 
77
-		if ( $text !== null && $text !== false ) {
78
-			$output = ' value="' . esc_attr( wp_unslash( $text ) ) . '" ';
77
+		if ($text !== null && $text !== false) {
78
+			$output = ' value="' . esc_attr(wp_unslash($text)) . '" ';
79 79
 		}
80 80
 
81 81
 		return $output;
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return string The sanitized item.
90 90
 	 */
91
-	public static function class_attr( $text ) {
91
+	public static function class_attr($text) {
92 92
 		$output = '';
93 93
 
94
-		if ( $text ) {
95
-			$classes = self::esc_classes( $text );
96
-			if ( ! empty( $classes ) ) {
94
+		if ($text) {
95
+			$classes = self::esc_classes($text);
96
+			if (!empty($classes)) {
97 97
 				$output = ' class="' . $classes . '" ';
98 98
 			}
99 99
 		}
@@ -108,15 +108,15 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return string
110 110
 	 */
111
-	public static function esc_classes( $text ) {
111
+	public static function esc_classes($text) {
112 112
 		$output = '';
113 113
 
114
-		if ( $text ) {
115
-			$classes = explode( " ", $text );
116
-			$classes = array_map( "trim", $classes );
117
-			$classes = array_map( "sanitize_html_class", $classes );
118
-			if ( ! empty( $classes ) ) {
119
-				$output = implode( " ", $classes );
114
+		if ($text) {
115
+			$classes = explode(" ", $text);
116
+			$classes = array_map("trim", $classes);
117
+			$classes = array_map("sanitize_html_class", $classes);
118
+			if (!empty($classes)) {
119
+				$output = implode(" ", $classes);
120 120
 			}
121 121
 		}
122 122
 
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @return string
131 131
 	 */
132
-	public static function data_attributes( $args ) {
132
+	public static function data_attributes($args) {
133 133
 		$output = '';
134 134
 
135
-		if ( ! empty( $args ) ) {
135
+		if (!empty($args)) {
136 136
 
137
-			foreach ( $args as $key => $val ) {
138
-				if ( substr( $key, 0, 5 ) === "data-" ) {
139
-					$output .= ' ' . sanitize_html_class( $key ) . '="' . esc_attr( $val ) . '" ';
137
+			foreach ($args as $key => $val) {
138
+				if (substr($key, 0, 5) === "data-") {
139
+					$output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" ';
140 140
 				}
141 141
 			}
142 142
 		}
@@ -149,14 +149,14 @@  discard block
 block discarded – undo
149 149
 	 *
150 150
 	 * @return string
151 151
 	 */
152
-	public static function aria_attributes( $args ) {
152
+	public static function aria_attributes($args) {
153 153
 		$output = '';
154 154
 
155
-		if ( ! empty( $args ) ) {
155
+		if (!empty($args)) {
156 156
 
157
-			foreach ( $args as $key => $val ) {
158
-				if ( substr( $key, 0, 5 ) === "aria-" ) {
159
-					$output .= ' ' . sanitize_html_class( $key ) . '="' . esc_attr( $val ) . '" ';
157
+			foreach ($args as $key => $val) {
158
+				if (substr($key, 0, 5) === "aria-") {
159
+					$output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" ';
160 160
 				}
161 161
 			}
162 162
 		}
@@ -173,19 +173,19 @@  discard block
 block discarded – undo
173 173
 	 *
174 174
 	 * @return string
175 175
 	 */
176
-	public static function icon( $class, $space_after = false, $extra_attributes = array() ) {
176
+	public static function icon($class, $space_after = false, $extra_attributes = array()) {
177 177
 		$output = '';
178 178
 
179
-		if ( $class ) {
180
-			$classes = self::esc_classes( $class );
181
-			if ( ! empty( $classes ) ) {
179
+		if ($class) {
180
+			$classes = self::esc_classes($class);
181
+			if (!empty($classes)) {
182 182
 				$output = '<i class="' . $classes . '" ';
183 183
 				// extra attributes
184
-				if ( ! empty( $extra_attributes ) ) {
185
-					$output .= AUI_Component_Helper::extra_attributes( $extra_attributes );
184
+				if (!empty($extra_attributes)) {
185
+					$output .= AUI_Component_Helper::extra_attributes($extra_attributes);
186 186
 				}
187 187
 				$output .= '></i>';
188
-				if ( $space_after ) {
188
+				if ($space_after) {
189 189
 					$output .= " ";
190 190
 				}
191 191
 			}
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return string
201 201
 	 */
202
-	public static function extra_attributes( $args ) {
202
+	public static function extra_attributes($args) {
203 203
 		$output = '';
204 204
 
205
-		if ( ! empty( $args ) ) {
205
+		if (!empty($args)) {
206 206
 
207
-			if ( is_array( $args ) ) {
208
-				foreach ( $args as $key => $val ) {
209
-					$output .= ' ' . sanitize_html_class( $key ) . '="' . esc_attr( $val ) . '" ';
207
+			if (is_array($args)) {
208
+				foreach ($args as $key => $val) {
209
+					$output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" ';
210 210
 				}
211 211
 			} else {
212 212
 				$output .= ' ' . $args . ' ';
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 	 *
223 223
 	 * @return string
224 224
 	 */
225
-	public static function help_text( $text ) {
225
+	public static function help_text($text) {
226 226
 		$output = '';
227 227
 
228
-		if ( $text ) {
229
-			$output .= '<small class="form-text text-muted">' . wp_kses_post( $text ) . '</small>';
228
+		if ($text) {
229
+			$output .= '<small class="form-text text-muted">' . wp_kses_post($text) . '</small>';
230 230
 		}
231 231
 
232 232
 
@@ -240,17 +240,17 @@  discard block
 block discarded – undo
240 240
 	 *
241 241
 	 * @return string|void
242 242
 	 */
243
-	public static function element_require( $input ) {
243
+	public static function element_require($input) {
244 244
 
245
-		$input = str_replace( "'", '"', $input );// we only want double quotes
245
+		$input = str_replace("'", '"', $input); // we only want double quotes
246 246
 
247
-		$output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array(
247
+		$output = esc_attr(str_replace(array("[%", "%]", "%:checked]"), array(
248 248
 			"jQuery(form).find('[data-argument=\"",
249 249
 			"\"]').find('input,select,textarea').val()",
250 250
 			"\"]').find('input:checked').val()",
251
-		), $input ) );
251
+		), $input));
252 252
 
253
-		if ( $output ) {
253
+		if ($output) {
254 254
 			$output = ' data-element-require="' . $output . '" ';
255 255
 		}
256 256
 
@@ -267,21 +267,21 @@  discard block
 block discarded – undo
267 267
 	 *
268 268
 	 * @return mixed Stripped value.
269 269
 	 */
270
-	public static function sanitize_html_field( $value, $input = array() ) {
270
+	public static function sanitize_html_field($value, $input = array()) {
271 271
 		$original = $value;
272 272
 
273
-		if ( is_array( $value ) ) {
274
-			foreach ( $value as $index => $item ) {
275
-				$value[ $index ] = self::_sanitize_html_field( $value, $input );
273
+		if (is_array($value)) {
274
+			foreach ($value as $index => $item) {
275
+				$value[$index] = self::_sanitize_html_field($value, $input);
276 276
 			}
277
-		} elseif ( is_object( $value ) ) {
278
-			$object_vars = get_object_vars( $value );
277
+		} elseif (is_object($value)) {
278
+			$object_vars = get_object_vars($value);
279 279
 
280
-			foreach ( $object_vars as $property_name => $property_value ) {
281
-				$value->$property_name = self::_sanitize_html_field( $property_value, $input );
280
+			foreach ($object_vars as $property_name => $property_value) {
281
+				$value->$property_name = self::_sanitize_html_field($property_value, $input);
282 282
 			}
283 283
 		} else {
284
-			$value = self::_sanitize_html_field( $value, $input );
284
+			$value = self::_sanitize_html_field($value, $input);
285 285
 		}
286 286
 
287 287
 		/**
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 		 * @param string|array $value Original content without filter.
294 294
 		 * @param array $input Input Field.
295 295
 		 */
296
-		return apply_filters( 'ayecode_ui_sanitize_html_field', $value, $original, $input );
296
+		return apply_filters('ayecode_ui_sanitize_html_field', $value, $original, $input);
297 297
 	}
298 298
 
299 299
 	/**
@@ -316,20 +316,20 @@  discard block
 block discarded – undo
316 316
 	 *
317 317
 	 * @return string Filtered content with only allowed HTML elements.
318 318
 	 */
319
-	public static function _sanitize_html_field( $value, $input = array() ) {
320
-		if ( $value === '' ) {
319
+	public static function _sanitize_html_field($value, $input = array()) {
320
+		if ($value === '') {
321 321
 			return $value;
322 322
 		}
323 323
 
324
-		$allowed_html = self::kses_allowed_html( 'post', $input );
324
+		$allowed_html = self::kses_allowed_html('post', $input);
325 325
 
326
-		if ( ! is_array( $allowed_html ) ) {
327
-			$allowed_html = wp_kses_allowed_html( 'post' );
326
+		if (!is_array($allowed_html)) {
327
+			$allowed_html = wp_kses_allowed_html('post');
328 328
 		}
329 329
 
330
-		$filtered = trim( wp_unslash( $value ) );
331
-		$filtered = wp_kses( $filtered, $allowed_html );
332
-		$filtered = balanceTags( $filtered ); // Balances tags
330
+		$filtered = trim(wp_unslash($value));
331
+		$filtered = wp_kses($filtered, $allowed_html);
332
+		$filtered = balanceTags($filtered); // Balances tags
333 333
 
334 334
 		return $filtered;
335 335
 	}
@@ -346,12 +346,12 @@  discard block
 block discarded – undo
346 346
 	 *
347 347
 	 * @return array Array of allowed HTML tags and their allowed attributes.
348 348
 	 */
349
-	public static function kses_allowed_html( $context = 'post', $input = array() ) {
350
-		$allowed_html = wp_kses_allowed_html( $context );
349
+	public static function kses_allowed_html($context = 'post', $input = array()) {
350
+		$allowed_html = wp_kses_allowed_html($context);
351 351
 
352
-		if ( is_array( $allowed_html ) ) {
352
+		if (is_array($allowed_html)) {
353 353
 			// <iframe>
354
-			if ( ! isset( $allowed_html['iframe'] ) && $context == 'post' ) {
354
+			if (!isset($allowed_html['iframe']) && $context == 'post') {
355 355
 				$allowed_html['iframe'] = array(
356 356
 					'class'           => true,
357 357
 					'id'              => true,
@@ -380,23 +380,23 @@  discard block
 block discarded – undo
380 380
 		 * @param @param string|array $context The context for which to retrieve tags.
381 381
 		 * @param array $input Input field.
382 382
 		 */
383
-		return apply_filters( 'ayecode_ui_kses_allowed_html', $allowed_html, $context, $input );
383
+		return apply_filters('ayecode_ui_kses_allowed_html', $allowed_html, $context, $input);
384 384
 	}
385 385
 
386
-	public static function get_column_class( $label_number = 2, $type = 'label' ) {
386
+	public static function get_column_class($label_number = 2, $type = 'label') {
387 387
 
388 388
 		$class = '';
389 389
 
390 390
 		// set default if empty
391
-		if( $label_number === '' ){
391
+		if ($label_number === '') {
392 392
 			$label_number = 2;
393 393
 		}
394 394
 
395
-		if ( $label_number && $label_number < 12 && $label_number > 0 ) {
396
-			if ( $type == 'label' ) {
397
-				$class = 'col-sm-' . absint( $label_number );
398
-			} elseif ( $type == 'input' ) {
399
-				$class = 'col-sm-' . ( 12 - absint( $label_number ) );
395
+		if ($label_number && $label_number < 12 && $label_number > 0) {
396
+			if ($type == 'label') {
397
+				$class = 'col-sm-' . absint($label_number);
398
+			} elseif ($type == 'input') {
399
+				$class = 'col-sm-' . (12 - absint($label_number));
400 400
 			}
401 401
 		}
402 402
 
Please login to merge, or discard this patch.
ayecode/wp-ayecode-ui/includes/components/class-aui-component-input.php 3 patches
Indentation   +1155 added lines, -1155 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,1179 +11,1179 @@  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
-			'wrap_class'               => '',
27
-			'id'                       => '',
28
-			'placeholder'              => '',
29
-			'title'                    => '',
30
-			'value'                    => '',
31
-			'required'                 => false,
32
-			'label'                    => '',
33
-			'label_after'              => false,
34
-			'label_class'              => '',
35
-			'label_col'                => '2',
36
-			'label_type'               => '',
37
-			'label_force_left'         => false, // used to force checkbox label left when using horizontal
38
-			// sets the label type, default: hidden. Options: hidden, top, horizontal, floating
39
-			'help_text'                => '',
40
-			'validation_text'          => '',
41
-			'validation_pattern'       => '',
42
-			'no_wrap'                  => false,
43
-			'input_group_right'        => '',
44
-			'input_group_left'         => '',
45
-			'input_group_right_inside' => false,
46
-			// forces the input group inside the input
47
-			'input_group_left_inside'  => false,
48
-			// forces the input group inside the input
49
-			'step'                     => '',
50
-			'switch'                   => false,
51
-			// to show checkbox as a switch
52
-			'checked'                  => false,
53
-			// set a checkbox or radio as selected
54
-			'password_toggle'          => true,
55
-			// toggle view/hide password
56
-			'element_require'          => '',
57
-			// [%element_id%] == "1"
58
-			'extra_attributes'         => array(),
59
-			// an array of extra attributes
60
-			'wrap_attributes'          => array()
61
-		);
62
-
63
-		/**
64
-		 * Parse incoming $args into an array and merge it with $defaults
65
-		 */
66
-		$args   = wp_parse_args( $args, $defaults );
67
-		$output = '';
68
-		if ( ! empty( $args['type'] ) ) {
69
-			// hidden label option needs to be empty
70
-			$args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
71
-
72
-			$type = sanitize_html_class( $args['type'] );
73
-
74
-			$help_text   = '';
75
-			$label       = '';
76
-			$label_after = $args['label_after'];
77
-			$label_args  = array(
78
-				'title'      => $args['label'],
79
-				'for'        => $args['id'],
80
-				'class'      => $args['label_class'] . " ",
81
-				'label_type' => $args['label_type'],
82
-				'label_col'  => $args['label_col']
83
-			);
84
-
85
-			// floating labels need label after
86
-			if ( $args['label_type'] == 'floating' && $type != 'checkbox' ) {
87
-				$label_after         = true;
88
-				$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
89
-			}
90
-
91
-			// Some special sauce for files
92
-			if ( $type == 'file' ) {
93
-				$label_after = true; // if type file we need the label after
94
-				$args['class'] .= ' custom-file-input ';
95
-			} elseif ( $type == 'checkbox' ) {
96
-				$label_after = true; // if type file we need the label after
97
-				$args['class'] .= ' custom-control-input ';
98
-			} elseif ( $type == 'datepicker' || $type == 'timepicker' ) {
99
-				$type = 'text';
100
-				//$args['class'] .= ' aui-flatpickr bg-initial ';
101
-				$args['class'] .= ' bg-initial ';
102
-
103
-				$args['extra_attributes']['data-aui-init'] = 'flatpickr';
104
-				// enqueue the script
105
-				$aui_settings = AyeCode_UI_Settings::instance();
106
-				$aui_settings->enqueue_flatpickr();
107
-			} elseif ( $type == 'iconpicker' ) {
108
-				$type = 'text';
109
-				//$args['class'] .= ' aui-flatpickr bg-initial ';
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
+            'wrap_class'               => '',
27
+            'id'                       => '',
28
+            'placeholder'              => '',
29
+            'title'                    => '',
30
+            'value'                    => '',
31
+            'required'                 => false,
32
+            'label'                    => '',
33
+            'label_after'              => false,
34
+            'label_class'              => '',
35
+            'label_col'                => '2',
36
+            'label_type'               => '',
37
+            'label_force_left'         => false, // used to force checkbox label left when using horizontal
38
+            // sets the label type, default: hidden. Options: hidden, top, horizontal, floating
39
+            'help_text'                => '',
40
+            'validation_text'          => '',
41
+            'validation_pattern'       => '',
42
+            'no_wrap'                  => false,
43
+            'input_group_right'        => '',
44
+            'input_group_left'         => '',
45
+            'input_group_right_inside' => false,
46
+            // forces the input group inside the input
47
+            'input_group_left_inside'  => false,
48
+            // forces the input group inside the input
49
+            'step'                     => '',
50
+            'switch'                   => false,
51
+            // to show checkbox as a switch
52
+            'checked'                  => false,
53
+            // set a checkbox or radio as selected
54
+            'password_toggle'          => true,
55
+            // toggle view/hide password
56
+            'element_require'          => '',
57
+            // [%element_id%] == "1"
58
+            'extra_attributes'         => array(),
59
+            // an array of extra attributes
60
+            'wrap_attributes'          => array()
61
+        );
62
+
63
+        /**
64
+         * Parse incoming $args into an array and merge it with $defaults
65
+         */
66
+        $args   = wp_parse_args( $args, $defaults );
67
+        $output = '';
68
+        if ( ! empty( $args['type'] ) ) {
69
+            // hidden label option needs to be empty
70
+            $args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
71
+
72
+            $type = sanitize_html_class( $args['type'] );
73
+
74
+            $help_text   = '';
75
+            $label       = '';
76
+            $label_after = $args['label_after'];
77
+            $label_args  = array(
78
+                'title'      => $args['label'],
79
+                'for'        => $args['id'],
80
+                'class'      => $args['label_class'] . " ",
81
+                'label_type' => $args['label_type'],
82
+                'label_col'  => $args['label_col']
83
+            );
84
+
85
+            // floating labels need label after
86
+            if ( $args['label_type'] == 'floating' && $type != 'checkbox' ) {
87
+                $label_after         = true;
88
+                $args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
89
+            }
90
+
91
+            // Some special sauce for files
92
+            if ( $type == 'file' ) {
93
+                $label_after = true; // if type file we need the label after
94
+                $args['class'] .= ' custom-file-input ';
95
+            } elseif ( $type == 'checkbox' ) {
96
+                $label_after = true; // if type file we need the label after
97
+                $args['class'] .= ' custom-control-input ';
98
+            } elseif ( $type == 'datepicker' || $type == 'timepicker' ) {
99
+                $type = 'text';
100
+                //$args['class'] .= ' aui-flatpickr bg-initial ';
101
+                $args['class'] .= ' bg-initial ';
102
+
103
+                $args['extra_attributes']['data-aui-init'] = 'flatpickr';
104
+                // enqueue the script
105
+                $aui_settings = AyeCode_UI_Settings::instance();
106
+                $aui_settings->enqueue_flatpickr();
107
+            } elseif ( $type == 'iconpicker' ) {
108
+                $type = 'text';
109
+                //$args['class'] .= ' aui-flatpickr bg-initial ';
110 110
 //				$args['class'] .= ' bg-initial ';
111 111
 
112
-				$args['extra_attributes']['data-aui-init'] = 'iconpicker';
113
-				$args['extra_attributes']['data-placement'] = 'bottomRight';
112
+                $args['extra_attributes']['data-aui-init'] = 'iconpicker';
113
+                $args['extra_attributes']['data-placement'] = 'bottomRight';
114 114
 
115
-				$args['input_group_right'] = '<span class="input-group-addon input-group-text c-pointer"></span>';
115
+                $args['input_group_right'] = '<span class="input-group-addon input-group-text c-pointer"></span>';
116 116
 //				$args['input_group_right_inside'] = true;
117
-				// enqueue the script
118
-				$aui_settings = AyeCode_UI_Settings::instance();
119
-				$aui_settings->enqueue_iconpicker();
120
-			}
121
-
122
-			if ( $type == 'checkbox' && !empty($args['name'] ) && strpos($args['name'], '[') === false ) {
123
-				$output .= '<input type="hidden" name="' . esc_attr( $args['name'] ) . '" value="0" />';
124
-			}
125
-
126
-
127
-			// open/type
128
-			$output .= '<input type="' . $type . '" ';
129
-
130
-			// name
131
-			if ( ! empty( $args['name'] ) ) {
132
-				$output .= ' name="' . esc_attr( $args['name'] ) . '" ';
133
-			}
134
-
135
-			// id
136
-			if ( ! empty( $args['id'] ) ) {
137
-				$output .= ' id="' . sanitize_html_class( $args['id'] ) . '" ';
138
-			}
139
-
140
-			// placeholder
141
-			if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] ) {
142
-				$output .= ' placeholder="' . esc_attr( $args['placeholder'] ) . '" ';
143
-			}
144
-
145
-			// title
146
-			if ( ! empty( $args['title'] ) ) {
147
-				$output .= ' title="' . esc_attr( $args['title'] ) . '" ';
148
-			}
149
-
150
-			// value
151
-			if ( ! empty( $args['value'] ) ) {
152
-				$output .= AUI_Component_Helper::value( $args['value'] );
153
-			}
154
-
155
-			// checked, for radio and checkboxes
156
-			if ( ( $type == 'checkbox' || $type == 'radio' ) && $args['checked'] ) {
157
-				$output .= ' checked ';
158
-			}
159
-
160
-			// validation text
161
-			if ( ! empty( $args['validation_text'] ) ) {
162
-				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr( $args['validation_text'] ) . '\')" ';
163
-				$output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
164
-			}
165
-
166
-			// validation_pattern
167
-			if ( ! empty( $args['validation_pattern'] ) ) {
168
-				$output .= ' pattern="' . esc_attr( $args['validation_pattern'] ) . '" ';
169
-			}
170
-
171
-			// step (for numbers)
172
-			if ( ! empty( $args['step'] ) ) {
173
-				$output .= ' step="' . $args['step'] . '" ';
174
-			}
175
-
176
-			// required
177
-			if ( ! empty( $args['required'] ) ) {
178
-				$output .= ' required ';
179
-			}
180
-
181
-			// class
182
-			$class = ! empty( $args['class'] ) ? AUI_Component_Helper::esc_classes( $args['class'] ) : '';
183
-			$output .= ' class="form-control ' . $class . '" ';
184
-
185
-			// data-attributes
186
-			$output .= AUI_Component_Helper::data_attributes( $args );
187
-
188
-			// extra attributes
189
-			if ( ! empty( $args['extra_attributes'] ) ) {
190
-				$output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
191
-			}
192
-
193
-			// close
194
-			$output .= ' >';
195
-
196
-			// help text
197
-			if ( ! empty( $args['help_text'] ) ) {
198
-				$help_text = AUI_Component_Helper::help_text( $args['help_text'] );
199
-			}
200
-
201
-			// label
202
-			if ( ! empty( $args['label'] ) ) {
203
-				$label_base_class = '';
204
-				if ( $type == 'file' ) {
205
-					$label_base_class = ' custom-file-label';
206
-				} elseif ( $type == 'checkbox' ) {
207
-					if ( ! empty( $args['label_force_left'] ) ) {
208
-						$label_args['title'] = wp_kses_post( $args['help_text'] );
209
-						$help_text = '';
210
-						//$label_args['class'] .= ' d-inline ';
211
-						$args['wrap_class'] .= ' align-items-center ';
212
-					}else{
213
-
214
-					}
215
-
216
-					$label_base_class = ' custom-control-label';
217
-				}
218
-				$label_args['class'] .= $label_base_class;
219
-				$temp_label_args = $label_args;
220
-				if(! empty( $args['label_force_left'] )){$temp_label_args['class'] = $label_base_class." text-muted";}
221
-				$label = self::label( $temp_label_args, $type );
222
-			}
223
-
224
-
225
-
226
-
227
-			// set help text in the correct position
228
-			if ( $label_after ) {
229
-				$output .= $label . $help_text;
230
-			}
231
-
232
-			// some input types need a separate wrap
233
-			if ( $type == 'file' ) {
234
-				$output = self::wrap( array(
235
-					'content' => $output,
236
-					'class'   => 'form-group custom-file'
237
-				) );
238
-			} elseif ( $type == 'checkbox' ) {
239
-
240
-				$label_args['title'] = $args['label'];
241
-				$label_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'label' );
242
-				$label = !empty( $args['label_force_left'] ) ? self::label( $label_args, 'cb' ) : '<div class="' . $label_col . ' col-form-label"></div>';
243
-				$switch_size_class = $args['switch'] && !is_bool( $args['switch'] ) ? ' custom-switch-'.esc_attr( $args['switch'] ) : '';
244
-				$wrap_class = $args['switch'] ? 'custom-switch'.$switch_size_class : 'custom-checkbox';
245
-				if ( ! empty( $args['label_force_left'] ) ) {
246
-					$wrap_class .= ' d-flex align-content-center';
247
-					$label = str_replace("custom-control-label","", self::label( $label_args, 'cb' ) );
248
-				}
249
-				$output     = self::wrap( array(
250
-					'content' => $output,
251
-					'class'   => 'custom-control ' . $wrap_class
252
-				) );
253
-
254
-				if ( $args['label_type'] == 'horizontal' ) {
255
-					$input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' );
256
-					$output    = $label . '<div class="' . $input_col . '">' . $output . '</div>';
257
-				}
258
-			} elseif ( $type == 'password' && $args['password_toggle'] && ! $args['input_group_right'] ) {
259
-
260
-
261
-				// allow password field to toggle view
262
-				$args['input_group_right'] = '<span class="input-group-text c-pointer px-3" 
117
+                // enqueue the script
118
+                $aui_settings = AyeCode_UI_Settings::instance();
119
+                $aui_settings->enqueue_iconpicker();
120
+            }
121
+
122
+            if ( $type == 'checkbox' && !empty($args['name'] ) && strpos($args['name'], '[') === false ) {
123
+                $output .= '<input type="hidden" name="' . esc_attr( $args['name'] ) . '" value="0" />';
124
+            }
125
+
126
+
127
+            // open/type
128
+            $output .= '<input type="' . $type . '" ';
129
+
130
+            // name
131
+            if ( ! empty( $args['name'] ) ) {
132
+                $output .= ' name="' . esc_attr( $args['name'] ) . '" ';
133
+            }
134
+
135
+            // id
136
+            if ( ! empty( $args['id'] ) ) {
137
+                $output .= ' id="' . sanitize_html_class( $args['id'] ) . '" ';
138
+            }
139
+
140
+            // placeholder
141
+            if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] ) {
142
+                $output .= ' placeholder="' . esc_attr( $args['placeholder'] ) . '" ';
143
+            }
144
+
145
+            // title
146
+            if ( ! empty( $args['title'] ) ) {
147
+                $output .= ' title="' . esc_attr( $args['title'] ) . '" ';
148
+            }
149
+
150
+            // value
151
+            if ( ! empty( $args['value'] ) ) {
152
+                $output .= AUI_Component_Helper::value( $args['value'] );
153
+            }
154
+
155
+            // checked, for radio and checkboxes
156
+            if ( ( $type == 'checkbox' || $type == 'radio' ) && $args['checked'] ) {
157
+                $output .= ' checked ';
158
+            }
159
+
160
+            // validation text
161
+            if ( ! empty( $args['validation_text'] ) ) {
162
+                $output .= ' oninvalid="setCustomValidity(\'' . esc_attr( $args['validation_text'] ) . '\')" ';
163
+                $output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
164
+            }
165
+
166
+            // validation_pattern
167
+            if ( ! empty( $args['validation_pattern'] ) ) {
168
+                $output .= ' pattern="' . esc_attr( $args['validation_pattern'] ) . '" ';
169
+            }
170
+
171
+            // step (for numbers)
172
+            if ( ! empty( $args['step'] ) ) {
173
+                $output .= ' step="' . $args['step'] . '" ';
174
+            }
175
+
176
+            // required
177
+            if ( ! empty( $args['required'] ) ) {
178
+                $output .= ' required ';
179
+            }
180
+
181
+            // class
182
+            $class = ! empty( $args['class'] ) ? AUI_Component_Helper::esc_classes( $args['class'] ) : '';
183
+            $output .= ' class="form-control ' . $class . '" ';
184
+
185
+            // data-attributes
186
+            $output .= AUI_Component_Helper::data_attributes( $args );
187
+
188
+            // extra attributes
189
+            if ( ! empty( $args['extra_attributes'] ) ) {
190
+                $output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
191
+            }
192
+
193
+            // close
194
+            $output .= ' >';
195
+
196
+            // help text
197
+            if ( ! empty( $args['help_text'] ) ) {
198
+                $help_text = AUI_Component_Helper::help_text( $args['help_text'] );
199
+            }
200
+
201
+            // label
202
+            if ( ! empty( $args['label'] ) ) {
203
+                $label_base_class = '';
204
+                if ( $type == 'file' ) {
205
+                    $label_base_class = ' custom-file-label';
206
+                } elseif ( $type == 'checkbox' ) {
207
+                    if ( ! empty( $args['label_force_left'] ) ) {
208
+                        $label_args['title'] = wp_kses_post( $args['help_text'] );
209
+                        $help_text = '';
210
+                        //$label_args['class'] .= ' d-inline ';
211
+                        $args['wrap_class'] .= ' align-items-center ';
212
+                    }else{
213
+
214
+                    }
215
+
216
+                    $label_base_class = ' custom-control-label';
217
+                }
218
+                $label_args['class'] .= $label_base_class;
219
+                $temp_label_args = $label_args;
220
+                if(! empty( $args['label_force_left'] )){$temp_label_args['class'] = $label_base_class." text-muted";}
221
+                $label = self::label( $temp_label_args, $type );
222
+            }
223
+
224
+
225
+
226
+
227
+            // set help text in the correct position
228
+            if ( $label_after ) {
229
+                $output .= $label . $help_text;
230
+            }
231
+
232
+            // some input types need a separate wrap
233
+            if ( $type == 'file' ) {
234
+                $output = self::wrap( array(
235
+                    'content' => $output,
236
+                    'class'   => 'form-group custom-file'
237
+                ) );
238
+            } elseif ( $type == 'checkbox' ) {
239
+
240
+                $label_args['title'] = $args['label'];
241
+                $label_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'label' );
242
+                $label = !empty( $args['label_force_left'] ) ? self::label( $label_args, 'cb' ) : '<div class="' . $label_col . ' col-form-label"></div>';
243
+                $switch_size_class = $args['switch'] && !is_bool( $args['switch'] ) ? ' custom-switch-'.esc_attr( $args['switch'] ) : '';
244
+                $wrap_class = $args['switch'] ? 'custom-switch'.$switch_size_class : 'custom-checkbox';
245
+                if ( ! empty( $args['label_force_left'] ) ) {
246
+                    $wrap_class .= ' d-flex align-content-center';
247
+                    $label = str_replace("custom-control-label","", self::label( $label_args, 'cb' ) );
248
+                }
249
+                $output     = self::wrap( array(
250
+                    'content' => $output,
251
+                    'class'   => 'custom-control ' . $wrap_class
252
+                ) );
253
+
254
+                if ( $args['label_type'] == 'horizontal' ) {
255
+                    $input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' );
256
+                    $output    = $label . '<div class="' . $input_col . '">' . $output . '</div>';
257
+                }
258
+            } elseif ( $type == 'password' && $args['password_toggle'] && ! $args['input_group_right'] ) {
259
+
260
+
261
+                // allow password field to toggle view
262
+                $args['input_group_right'] = '<span class="input-group-text c-pointer px-3" 
263 263
 onclick="var $el = jQuery(this).find(\'i\');$el.toggleClass(\'fa-eye fa-eye-slash\');
264 264
 var $eli = jQuery(this).parent().parent().find(\'input\');
265 265
 if($el.hasClass(\'fa-eye\'))
266 266
 {$eli.attr(\'type\',\'text\');}
267 267
 else{$eli.attr(\'type\',\'password\');}"
268 268
 ><i class="far fa-fw fa-eye-slash"></i></span>';
269
-			}
270
-
271
-			// input group wraps
272
-			if ( $args['input_group_left'] || $args['input_group_right'] ) {
273
-				$w100 = strpos( $args['class'], 'w-100' ) !== false ? ' w-100' : '';
274
-				if ( $args['input_group_left'] ) {
275
-					$output = self::wrap( array(
276
-						'content'                 => $output,
277
-						'class'                   => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
278
-						'input_group_left'        => $args['input_group_left'],
279
-						'input_group_left_inside' => $args['input_group_left_inside']
280
-					) );
281
-				}
282
-				if ( $args['input_group_right'] ) {
283
-					$output = self::wrap( array(
284
-						'content'                  => $output,
285
-						'class'                    => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
286
-						'input_group_right'        => $args['input_group_right'],
287
-						'input_group_right_inside' => $args['input_group_right_inside']
288
-					) );
289
-				}
290
-
291
-			}
292
-
293
-			if ( ! $label_after ) {
294
-				$output .= $help_text;
295
-			}
296
-
297
-
298
-			if ( $args['label_type'] == 'horizontal' && $type != 'checkbox' ) {
299
-				$output = self::wrap( array(
300
-					'content' => $output,
301
-					'class'   => AUI_Component_Helper::get_column_class( $args['label_col'], 'input' )
302
-				) );
303
-			}
304
-
305
-			if ( ! $label_after ) {
306
-				$output = $label . $output;
307
-			}
308
-
309
-			// wrap
310
-			if ( ! $args['no_wrap'] ) {
311
-				$form_group_class = $args['label_type'] == 'floating' && $type != 'checkbox' ? 'form-label-group' : 'form-group';
312
-				$wrap_class       = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class;
313
-				$wrap_class       = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
314
-				$output           = self::wrap( array(
315
-					'content'         => $output,
316
-					'class'           => $wrap_class,
317
-					'element_require' => $args['element_require'],
318
-					'argument_id'     => $args['id'],
319
-					'wrap_attributes' => $args['wrap_attributes'],
320
-				) );
321
-			}
322
-		}
323
-
324
-		return $output;
325
-	}
326
-
327
-	public static function label( $args = array(), $type = '' ) {
328
-		//<label for="exampleInputEmail1">Email address</label>
329
-		$defaults = array(
330
-			'title'      => 'div',
331
-			'for'        => '',
332
-			'class'      => '',
333
-			'label_type' => '', // empty = hidden, top, horizontal
334
-			'label_col'  => '',
335
-		);
336
-
337
-		/**
338
-		 * Parse incoming $args into an array and merge it with $defaults
339
-		 */
340
-		$args   = wp_parse_args( $args, $defaults );
341
-		$output = '';
342
-
343
-		if ( $args['title'] ) {
344
-
345
-			// maybe hide labels //@todo set a global option for visibility class
346
-			if ( $type == 'file' || $type == 'checkbox' || $type == 'radio' || ! empty( $args['label_type'] ) ) {
347
-				$class = $args['class'];
348
-			} else {
349
-				$class = 'sr-only ' . $args['class'];
350
-			}
351
-
352
-			// maybe horizontal
353
-			if ( $args['label_type'] == 'horizontal' && $type != 'checkbox' ) {
354
-				$class .= ' ' . AUI_Component_Helper::get_column_class( $args['label_col'], 'label' ) . ' col-form-label';
355
-			}
356
-
357
-			// open
358
-			$output .= '<label ';
359
-
360
-			// for
361
-			if ( ! empty( $args['for'] ) ) {
362
-				$output .= ' for="' . esc_attr( $args['for'] ) . '" ';
363
-			}
364
-
365
-			// class
366
-			$class = $class ? AUI_Component_Helper::esc_classes( $class ) : '';
367
-			$output .= ' class="' . $class . '" ';
368
-
369
-			// close
370
-			$output .= '>';
371
-
372
-
373
-			// title, don't escape fully as can contain html
374
-			if ( ! empty( $args['title'] ) ) {
375
-				$output .= wp_kses_post( $args['title'] );
376
-			}
377
-
378
-			// close wrap
379
-			$output .= '</label>';
380
-
381
-
382
-		}
383
-
384
-
385
-		return $output;
386
-	}
387
-
388
-	/**
389
-	 * Wrap some content in a HTML wrapper.
390
-	 *
391
-	 * @param array $args
392
-	 *
393
-	 * @return string
394
-	 */
395
-	public static function wrap( $args = array() ) {
396
-		$defaults = array(
397
-			'type'                     => 'div',
398
-			'class'                    => 'form-group',
399
-			'content'                  => '',
400
-			'input_group_left'         => '',
401
-			'input_group_right'        => '',
402
-			'input_group_left_inside'  => false,
403
-			'input_group_right_inside' => false,
404
-			'element_require'          => '',
405
-			'argument_id'              => '',
406
-			'wrap_attributes'          => array()
407
-		);
408
-
409
-		/**
410
-		 * Parse incoming $args into an array and merge it with $defaults
411
-		 */
412
-		$args   = wp_parse_args( $args, $defaults );
413
-		$output = '';
414
-		if ( $args['type'] ) {
415
-
416
-			// open
417
-			$output .= '<' . sanitize_html_class( $args['type'] );
418
-
419
-			// element require
420
-			if ( ! empty( $args['element_require'] ) ) {
421
-				$output .= AUI_Component_Helper::element_require( $args['element_require'] );
422
-				$args['class'] .= " aui-conditional-field";
423
-			}
424
-
425
-			// argument_id
426
-			if ( ! empty( $args['argument_id'] ) ) {
427
-				$output .= ' data-argument="' . esc_attr( $args['argument_id'] ) . '"';
428
-			}
429
-
430
-			// class
431
-			$class = ! empty( $args['class'] ) ? AUI_Component_Helper::esc_classes( $args['class'] ) : '';
432
-			$output .= ' class="' . $class . '" ';
433
-
434
-			// Attributes
435
-			if ( ! empty( $args['wrap_attributes'] ) ) {
436
-				$output .= AUI_Component_Helper::extra_attributes( $args['wrap_attributes'] );
437
-			}
438
-
439
-			// close wrap
440
-			$output .= ' >';
441
-
442
-
443
-			// Input group left
444
-			if ( ! empty( $args['input_group_left'] ) ) {
445
-				$position_class   = ! empty( $args['input_group_left_inside'] ) ? 'position-absolute h-100' : '';
446
-				$input_group_left = strpos( $args['input_group_left'], '<' ) !== false ? $args['input_group_left'] : '<span class="input-group-text">' . $args['input_group_left'] . '</span>';
447
-				$output .= '<div class="input-group-prepend ' . $position_class . '">' . $input_group_left . '</div>';
448
-			}
449
-
450
-			// content
451
-			$output .= $args['content'];
452
-
453
-			// Input group right
454
-			if ( ! empty( $args['input_group_right'] ) ) {
455
-				$position_class    = ! empty( $args['input_group_left_inside'] ) ? 'position-absolute h-100' : '';
456
-				$input_group_right = strpos( $args['input_group_right'], '<' ) !== false ? $args['input_group_right'] : '<span class="input-group-text">' . $args['input_group_right'] . '</span>';
457
-				$output .= '<div class="input-group-append ' . $position_class . '">' . $input_group_right . '</div>';
458
-			}
459
-
460
-
461
-			// close wrap
462
-			$output .= '</' . sanitize_html_class( $args['type'] ) . '>';
463
-
464
-
465
-		} else {
466
-			$output = $args['content'];
467
-		}
468
-
469
-		return $output;
470
-	}
471
-
472
-	/**
473
-	 * Build the component.
474
-	 *
475
-	 * @param array $args
476
-	 *
477
-	 * @return string The rendered component.
478
-	 */
479
-	public static function textarea( $args = array() ) {
480
-		$defaults = array(
481
-			'name'               => '',
482
-			'class'              => '',
483
-			'wrap_class'         => '',
484
-			'id'                 => '',
485
-			'placeholder'        => '',
486
-			'title'              => '',
487
-			'value'              => '',
488
-			'required'           => false,
489
-			'label'              => '',
490
-			'label_after'        => false,
491
-			'label_class'        => '',
492
-			'label_type'         => '',
493
-			'label_col'          => '',
494
-			// sets the label type, default: hidden. Options: hidden, top, horizontal, floating
495
-			'help_text'          => '',
496
-			'validation_text'    => '',
497
-			'validation_pattern' => '',
498
-			'no_wrap'            => false,
499
-			'rows'               => '',
500
-			'wysiwyg'            => false,
501
-			'allow_tags'         => false,
502
-			// Allow HTML tags
503
-			'element_require'    => '',
504
-			// [%element_id%] == "1"
505
-			'extra_attributes'   => array(),
506
-			// an array of extra attributes
507
-			'wrap_attributes'    => array(),
508
-		);
509
-
510
-		/**
511
-		 * Parse incoming $args into an array and merge it with $defaults
512
-		 */
513
-		$args   = wp_parse_args( $args, $defaults );
514
-		$output = '';
515
-
516
-		// hidden label option needs to be empty
517
-		$args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
518
-
519
-		// floating labels don't work with wysiwyg so set it as top
520
-		if ( $args['label_type'] == 'floating' && ! empty( $args['wysiwyg'] ) ) {
521
-			$args['label_type'] = 'top';
522
-		}
523
-
524
-		$label_after = $args['label_after'];
525
-
526
-		// floating labels need label after
527
-		if ( $args['label_type'] == 'floating' && empty( $args['wysiwyg'] ) ) {
528
-			$label_after         = true;
529
-			$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
530
-		}
531
-
532
-		// label
533
-		if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) {
534
-		} elseif ( ! empty( $args['label'] ) && ! $label_after ) {
535
-			$label_args = array(
536
-				'title'      => $args['label'],
537
-				'for'        => $args['id'],
538
-				'class'      => $args['label_class'] . " ",
539
-				'label_type' => $args['label_type'],
540
-				'label_col'  => $args['label_col']
541
-			);
542
-			$output .= self::label( $label_args );
543
-		}
544
-
545
-		// maybe horizontal label
546
-		if ( $args['label_type'] == 'horizontal' ) {
547
-			$input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' );
548
-			$output .= '<div class="' . $input_col . '">';
549
-		}
550
-
551
-		if ( ! empty( $args['wysiwyg'] ) ) {
552
-			ob_start();
553
-			$content   = $args['value'];
554
-			$editor_id = ! empty( $args['id'] ) ? sanitize_html_class( $args['id'] ) : 'wp_editor';
555
-			$settings  = array(
556
-				'textarea_rows' => ! empty( absint( $args['rows'] ) ) ? absint( $args['rows'] ) : 4,
557
-				'quicktags'     => false,
558
-				'media_buttons' => false,
559
-				'editor_class'  => 'form-control',
560
-				'textarea_name' => ! empty( $args['name'] ) ? sanitize_html_class( $args['name'] ) : sanitize_html_class( $args['id'] ),
561
-				'teeny'         => true,
562
-			);
563
-
564
-			// maybe set settings if array
565
-			if ( is_array( $args['wysiwyg'] ) ) {
566
-				$settings = wp_parse_args( $args['wysiwyg'], $settings );
567
-			}
568
-
569
-			wp_editor( $content, $editor_id, $settings );
570
-			$output .= ob_get_clean();
571
-		} else {
572
-
573
-			// open
574
-			$output .= '<textarea ';
575
-
576
-			// name
577
-			if ( ! empty( $args['name'] ) ) {
578
-				$output .= ' name="' . esc_attr( $args['name'] ) . '" ';
579
-			}
580
-
581
-			// id
582
-			if ( ! empty( $args['id'] ) ) {
583
-				$output .= ' id="' . sanitize_html_class( $args['id'] ) . '" ';
584
-			}
585
-
586
-			// placeholder
587
-			if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] ) {
588
-				$output .= ' placeholder="' . esc_attr( $args['placeholder'] ) . '" ';
589
-			}
590
-
591
-			// title
592
-			if ( ! empty( $args['title'] ) ) {
593
-				$output .= ' title="' . esc_attr( $args['title'] ) . '" ';
594
-			}
595
-
596
-			// validation text
597
-			if ( ! empty( $args['validation_text'] ) ) {
598
-				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr( $args['validation_text'] ) . '\')" ';
599
-				$output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
600
-			}
601
-
602
-			// validation_pattern
603
-			if ( ! empty( $args['validation_pattern'] ) ) {
604
-				$output .= ' pattern="' . esc_attr( $args['validation_pattern'] ) . '" ';
605
-			}
606
-
607
-			// required
608
-			if ( ! empty( $args['required'] ) ) {
609
-				$output .= ' required ';
610
-			}
611
-
612
-			// rows
613
-			if ( ! empty( $args['rows'] ) ) {
614
-				$output .= ' rows="' . absint( $args['rows'] ) . '" ';
615
-			}
616
-
617
-
618
-			// class
619
-			$class = ! empty( $args['class'] ) ? $args['class'] : '';
620
-			$output .= ' class="form-control ' . $class . '" ';
621
-
622
-			// extra attributes
623
-			if ( ! empty( $args['extra_attributes'] ) ) {
624
-				$output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
625
-			}
626
-
627
-			// close tag
628
-			$output .= ' >';
629
-
630
-			// value
631
-			if ( ! empty( $args['value'] ) ) {
632
-				if ( ! empty( $args['allow_tags'] ) ) {
633
-					$output .= AUI_Component_Helper::sanitize_html_field( $args['value'], $args ); // Sanitize HTML.
634
-				} else {
635
-					$output .= sanitize_textarea_field( $args['value'] );
636
-				}
637
-			}
638
-
639
-			// closing tag
640
-			$output .= '</textarea>';
641
-
642
-		}
643
-
644
-		if ( ! empty( $args['label'] ) && $label_after ) {
645
-			$label_args = array(
646
-				'title'      => $args['label'],
647
-				'for'        => $args['id'],
648
-				'class'      => $args['label_class'] . " ",
649
-				'label_type' => $args['label_type'],
650
-				'label_col'  => $args['label_col']
651
-			);
652
-			$output .= self::label( $label_args );
653
-		}
654
-
655
-		// help text
656
-		if ( ! empty( $args['help_text'] ) ) {
657
-			$output .= AUI_Component_Helper::help_text( $args['help_text'] );
658
-		}
659
-
660
-		// maybe horizontal label
661
-		if ( $args['label_type'] == 'horizontal' ) {
662
-			$output .= '</div>';
663
-		}
664
-
665
-
666
-		// wrap
667
-		if ( ! $args['no_wrap'] ) {
668
-			$form_group_class = $args['label_type'] == 'floating' ? 'form-label-group' : 'form-group';
669
-			$wrap_class       = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class;
670
-			$wrap_class       = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
671
-			$output           = self::wrap( array(
672
-				'content'         => $output,
673
-				'class'           => $wrap_class,
674
-				'element_require' => $args['element_require'],
675
-				'argument_id'     => $args['id'],
676
-				'wrap_attributes' => $args['wrap_attributes'],
677
-			) );
678
-		}
679
-
680
-
681
-		return $output;
682
-	}
683
-
684
-	/**
685
-	 * Build the component.
686
-	 *
687
-	 * @param array $args
688
-	 *
689
-	 * @return string The rendered component.
690
-	 */
691
-	public static function select( $args = array() ) {
692
-		$defaults = array(
693
-			'class'            => '',
694
-			'wrap_class'       => '',
695
-			'id'               => '',
696
-			'title'            => '',
697
-			'value'            => '',
698
-			// can be an array or a string
699
-			'required'         => false,
700
-			'label'            => '',
701
-			'label_after'      => false,
702
-			'label_type'       => '',
703
-			'label_col'        => '',
704
-			// sets the label type, default: hidden. Options: hidden, top, horizontal, floating
705
-			'label_class'      => '',
706
-			'help_text'        => '',
707
-			'placeholder'      => '',
708
-			'options'          => array(),
709
-			// array or string
710
-			'icon'             => '',
711
-			'multiple'         => false,
712
-			'select2'          => false,
713
-			'no_wrap'          => false,
714
-			'input_group_right' => '',
715
-			'input_group_left' => '',
716
-			'input_group_right_inside' => false, // forces the input group inside the input
717
-			'input_group_left_inside' => false, // forces the input group inside the input
718
-			'element_require'  => '',
719
-			// [%element_id%] == "1"
720
-			'extra_attributes' => array(),
721
-			// an array of extra attributes
722
-			'wrap_attributes'  => array(),
723
-		);
724
-
725
-		/**
726
-		 * Parse incoming $args into an array and merge it with $defaults
727
-		 */
728
-		$args   = wp_parse_args( $args, $defaults );
729
-		$output = '';
730
-
731
-		// for now lets hide floating labels
732
-		if ( $args['label_type'] == 'floating' ) {
733
-			$args['label_type'] = 'hidden';
734
-		}
735
-
736
-		// hidden label option needs to be empty
737
-		$args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
738
-
739
-
740
-		$label_after = $args['label_after'];
741
-
742
-		// floating labels need label after
743
-		if ( $args['label_type'] == 'floating' ) {
744
-			$label_after         = true;
745
-			$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
746
-		}
747
-
748
-		// Maybe setup select2
749
-		$is_select2 = false;
750
-		if ( ! empty( $args['select2'] ) ) {
751
-			$args['class'] .= ' aui-select2';
752
-			$is_select2 = true;
753
-		} elseif ( strpos( $args['class'], 'aui-select2' ) !== false ) {
754
-			$is_select2 = true;
755
-		}
756
-
757
-		// select2 tags
758
-		if ( ! empty( $args['select2'] ) && $args['select2'] === 'tags' ) { // triple equals needed here for some reason
759
-			$args['data-tags']             = 'true';
760
-			$args['data-token-separators'] = "[',']";
761
-			$args['multiple']              = true;
762
-		}
763
-
764
-		// select2 placeholder
765
-		if ( $is_select2 && isset( $args['placeholder'] ) && '' != $args['placeholder'] && empty( $args['data-placeholder'] ) ) {
766
-			$args['data-placeholder'] = esc_attr( $args['placeholder'] );
767
-			$args['data-allow-clear'] = isset( $args['data-allow-clear'] ) ? (bool) $args['data-allow-clear'] : true;
768
-		}
769
-
770
-
771
-
772
-		// maybe horizontal label
269
+            }
270
+
271
+            // input group wraps
272
+            if ( $args['input_group_left'] || $args['input_group_right'] ) {
273
+                $w100 = strpos( $args['class'], 'w-100' ) !== false ? ' w-100' : '';
274
+                if ( $args['input_group_left'] ) {
275
+                    $output = self::wrap( array(
276
+                        'content'                 => $output,
277
+                        'class'                   => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
278
+                        'input_group_left'        => $args['input_group_left'],
279
+                        'input_group_left_inside' => $args['input_group_left_inside']
280
+                    ) );
281
+                }
282
+                if ( $args['input_group_right'] ) {
283
+                    $output = self::wrap( array(
284
+                        'content'                  => $output,
285
+                        'class'                    => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
286
+                        'input_group_right'        => $args['input_group_right'],
287
+                        'input_group_right_inside' => $args['input_group_right_inside']
288
+                    ) );
289
+                }
290
+
291
+            }
292
+
293
+            if ( ! $label_after ) {
294
+                $output .= $help_text;
295
+            }
296
+
297
+
298
+            if ( $args['label_type'] == 'horizontal' && $type != 'checkbox' ) {
299
+                $output = self::wrap( array(
300
+                    'content' => $output,
301
+                    'class'   => AUI_Component_Helper::get_column_class( $args['label_col'], 'input' )
302
+                ) );
303
+            }
304
+
305
+            if ( ! $label_after ) {
306
+                $output = $label . $output;
307
+            }
308
+
309
+            // wrap
310
+            if ( ! $args['no_wrap'] ) {
311
+                $form_group_class = $args['label_type'] == 'floating' && $type != 'checkbox' ? 'form-label-group' : 'form-group';
312
+                $wrap_class       = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class;
313
+                $wrap_class       = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
314
+                $output           = self::wrap( array(
315
+                    'content'         => $output,
316
+                    'class'           => $wrap_class,
317
+                    'element_require' => $args['element_require'],
318
+                    'argument_id'     => $args['id'],
319
+                    'wrap_attributes' => $args['wrap_attributes'],
320
+                ) );
321
+            }
322
+        }
323
+
324
+        return $output;
325
+    }
326
+
327
+    public static function label( $args = array(), $type = '' ) {
328
+        //<label for="exampleInputEmail1">Email address</label>
329
+        $defaults = array(
330
+            'title'      => 'div',
331
+            'for'        => '',
332
+            'class'      => '',
333
+            'label_type' => '', // empty = hidden, top, horizontal
334
+            'label_col'  => '',
335
+        );
336
+
337
+        /**
338
+         * Parse incoming $args into an array and merge it with $defaults
339
+         */
340
+        $args   = wp_parse_args( $args, $defaults );
341
+        $output = '';
342
+
343
+        if ( $args['title'] ) {
344
+
345
+            // maybe hide labels //@todo set a global option for visibility class
346
+            if ( $type == 'file' || $type == 'checkbox' || $type == 'radio' || ! empty( $args['label_type'] ) ) {
347
+                $class = $args['class'];
348
+            } else {
349
+                $class = 'sr-only ' . $args['class'];
350
+            }
351
+
352
+            // maybe horizontal
353
+            if ( $args['label_type'] == 'horizontal' && $type != 'checkbox' ) {
354
+                $class .= ' ' . AUI_Component_Helper::get_column_class( $args['label_col'], 'label' ) . ' col-form-label';
355
+            }
356
+
357
+            // open
358
+            $output .= '<label ';
359
+
360
+            // for
361
+            if ( ! empty( $args['for'] ) ) {
362
+                $output .= ' for="' . esc_attr( $args['for'] ) . '" ';
363
+            }
364
+
365
+            // class
366
+            $class = $class ? AUI_Component_Helper::esc_classes( $class ) : '';
367
+            $output .= ' class="' . $class . '" ';
368
+
369
+            // close
370
+            $output .= '>';
371
+
372
+
373
+            // title, don't escape fully as can contain html
374
+            if ( ! empty( $args['title'] ) ) {
375
+                $output .= wp_kses_post( $args['title'] );
376
+            }
377
+
378
+            // close wrap
379
+            $output .= '</label>';
380
+
381
+
382
+        }
383
+
384
+
385
+        return $output;
386
+    }
387
+
388
+    /**
389
+     * Wrap some content in a HTML wrapper.
390
+     *
391
+     * @param array $args
392
+     *
393
+     * @return string
394
+     */
395
+    public static function wrap( $args = array() ) {
396
+        $defaults = array(
397
+            'type'                     => 'div',
398
+            'class'                    => 'form-group',
399
+            'content'                  => '',
400
+            'input_group_left'         => '',
401
+            'input_group_right'        => '',
402
+            'input_group_left_inside'  => false,
403
+            'input_group_right_inside' => false,
404
+            'element_require'          => '',
405
+            'argument_id'              => '',
406
+            'wrap_attributes'          => array()
407
+        );
408
+
409
+        /**
410
+         * Parse incoming $args into an array and merge it with $defaults
411
+         */
412
+        $args   = wp_parse_args( $args, $defaults );
413
+        $output = '';
414
+        if ( $args['type'] ) {
415
+
416
+            // open
417
+            $output .= '<' . sanitize_html_class( $args['type'] );
418
+
419
+            // element require
420
+            if ( ! empty( $args['element_require'] ) ) {
421
+                $output .= AUI_Component_Helper::element_require( $args['element_require'] );
422
+                $args['class'] .= " aui-conditional-field";
423
+            }
424
+
425
+            // argument_id
426
+            if ( ! empty( $args['argument_id'] ) ) {
427
+                $output .= ' data-argument="' . esc_attr( $args['argument_id'] ) . '"';
428
+            }
429
+
430
+            // class
431
+            $class = ! empty( $args['class'] ) ? AUI_Component_Helper::esc_classes( $args['class'] ) : '';
432
+            $output .= ' class="' . $class . '" ';
433
+
434
+            // Attributes
435
+            if ( ! empty( $args['wrap_attributes'] ) ) {
436
+                $output .= AUI_Component_Helper::extra_attributes( $args['wrap_attributes'] );
437
+            }
438
+
439
+            // close wrap
440
+            $output .= ' >';
441
+
442
+
443
+            // Input group left
444
+            if ( ! empty( $args['input_group_left'] ) ) {
445
+                $position_class   = ! empty( $args['input_group_left_inside'] ) ? 'position-absolute h-100' : '';
446
+                $input_group_left = strpos( $args['input_group_left'], '<' ) !== false ? $args['input_group_left'] : '<span class="input-group-text">' . $args['input_group_left'] . '</span>';
447
+                $output .= '<div class="input-group-prepend ' . $position_class . '">' . $input_group_left . '</div>';
448
+            }
449
+
450
+            // content
451
+            $output .= $args['content'];
452
+
453
+            // Input group right
454
+            if ( ! empty( $args['input_group_right'] ) ) {
455
+                $position_class    = ! empty( $args['input_group_left_inside'] ) ? 'position-absolute h-100' : '';
456
+                $input_group_right = strpos( $args['input_group_right'], '<' ) !== false ? $args['input_group_right'] : '<span class="input-group-text">' . $args['input_group_right'] . '</span>';
457
+                $output .= '<div class="input-group-append ' . $position_class . '">' . $input_group_right . '</div>';
458
+            }
459
+
460
+
461
+            // close wrap
462
+            $output .= '</' . sanitize_html_class( $args['type'] ) . '>';
463
+
464
+
465
+        } else {
466
+            $output = $args['content'];
467
+        }
468
+
469
+        return $output;
470
+    }
471
+
472
+    /**
473
+     * Build the component.
474
+     *
475
+     * @param array $args
476
+     *
477
+     * @return string The rendered component.
478
+     */
479
+    public static function textarea( $args = array() ) {
480
+        $defaults = array(
481
+            'name'               => '',
482
+            'class'              => '',
483
+            'wrap_class'         => '',
484
+            'id'                 => '',
485
+            'placeholder'        => '',
486
+            'title'              => '',
487
+            'value'              => '',
488
+            'required'           => false,
489
+            'label'              => '',
490
+            'label_after'        => false,
491
+            'label_class'        => '',
492
+            'label_type'         => '',
493
+            'label_col'          => '',
494
+            // sets the label type, default: hidden. Options: hidden, top, horizontal, floating
495
+            'help_text'          => '',
496
+            'validation_text'    => '',
497
+            'validation_pattern' => '',
498
+            'no_wrap'            => false,
499
+            'rows'               => '',
500
+            'wysiwyg'            => false,
501
+            'allow_tags'         => false,
502
+            // Allow HTML tags
503
+            'element_require'    => '',
504
+            // [%element_id%] == "1"
505
+            'extra_attributes'   => array(),
506
+            // an array of extra attributes
507
+            'wrap_attributes'    => array(),
508
+        );
509
+
510
+        /**
511
+         * Parse incoming $args into an array and merge it with $defaults
512
+         */
513
+        $args   = wp_parse_args( $args, $defaults );
514
+        $output = '';
515
+
516
+        // hidden label option needs to be empty
517
+        $args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
518
+
519
+        // floating labels don't work with wysiwyg so set it as top
520
+        if ( $args['label_type'] == 'floating' && ! empty( $args['wysiwyg'] ) ) {
521
+            $args['label_type'] = 'top';
522
+        }
523
+
524
+        $label_after = $args['label_after'];
525
+
526
+        // floating labels need label after
527
+        if ( $args['label_type'] == 'floating' && empty( $args['wysiwyg'] ) ) {
528
+            $label_after         = true;
529
+            $args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
530
+        }
531
+
532
+        // label
533
+        if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) {
534
+        } elseif ( ! empty( $args['label'] ) && ! $label_after ) {
535
+            $label_args = array(
536
+                'title'      => $args['label'],
537
+                'for'        => $args['id'],
538
+                'class'      => $args['label_class'] . " ",
539
+                'label_type' => $args['label_type'],
540
+                'label_col'  => $args['label_col']
541
+            );
542
+            $output .= self::label( $label_args );
543
+        }
544
+
545
+        // maybe horizontal label
546
+        if ( $args['label_type'] == 'horizontal' ) {
547
+            $input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' );
548
+            $output .= '<div class="' . $input_col . '">';
549
+        }
550
+
551
+        if ( ! empty( $args['wysiwyg'] ) ) {
552
+            ob_start();
553
+            $content   = $args['value'];
554
+            $editor_id = ! empty( $args['id'] ) ? sanitize_html_class( $args['id'] ) : 'wp_editor';
555
+            $settings  = array(
556
+                'textarea_rows' => ! empty( absint( $args['rows'] ) ) ? absint( $args['rows'] ) : 4,
557
+                'quicktags'     => false,
558
+                'media_buttons' => false,
559
+                'editor_class'  => 'form-control',
560
+                'textarea_name' => ! empty( $args['name'] ) ? sanitize_html_class( $args['name'] ) : sanitize_html_class( $args['id'] ),
561
+                'teeny'         => true,
562
+            );
563
+
564
+            // maybe set settings if array
565
+            if ( is_array( $args['wysiwyg'] ) ) {
566
+                $settings = wp_parse_args( $args['wysiwyg'], $settings );
567
+            }
568
+
569
+            wp_editor( $content, $editor_id, $settings );
570
+            $output .= ob_get_clean();
571
+        } else {
572
+
573
+            // open
574
+            $output .= '<textarea ';
575
+
576
+            // name
577
+            if ( ! empty( $args['name'] ) ) {
578
+                $output .= ' name="' . esc_attr( $args['name'] ) . '" ';
579
+            }
580
+
581
+            // id
582
+            if ( ! empty( $args['id'] ) ) {
583
+                $output .= ' id="' . sanitize_html_class( $args['id'] ) . '" ';
584
+            }
585
+
586
+            // placeholder
587
+            if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] ) {
588
+                $output .= ' placeholder="' . esc_attr( $args['placeholder'] ) . '" ';
589
+            }
590
+
591
+            // title
592
+            if ( ! empty( $args['title'] ) ) {
593
+                $output .= ' title="' . esc_attr( $args['title'] ) . '" ';
594
+            }
595
+
596
+            // validation text
597
+            if ( ! empty( $args['validation_text'] ) ) {
598
+                $output .= ' oninvalid="setCustomValidity(\'' . esc_attr( $args['validation_text'] ) . '\')" ';
599
+                $output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
600
+            }
601
+
602
+            // validation_pattern
603
+            if ( ! empty( $args['validation_pattern'] ) ) {
604
+                $output .= ' pattern="' . esc_attr( $args['validation_pattern'] ) . '" ';
605
+            }
606
+
607
+            // required
608
+            if ( ! empty( $args['required'] ) ) {
609
+                $output .= ' required ';
610
+            }
611
+
612
+            // rows
613
+            if ( ! empty( $args['rows'] ) ) {
614
+                $output .= ' rows="' . absint( $args['rows'] ) . '" ';
615
+            }
616
+
617
+
618
+            // class
619
+            $class = ! empty( $args['class'] ) ? $args['class'] : '';
620
+            $output .= ' class="form-control ' . $class . '" ';
621
+
622
+            // extra attributes
623
+            if ( ! empty( $args['extra_attributes'] ) ) {
624
+                $output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
625
+            }
626
+
627
+            // close tag
628
+            $output .= ' >';
629
+
630
+            // value
631
+            if ( ! empty( $args['value'] ) ) {
632
+                if ( ! empty( $args['allow_tags'] ) ) {
633
+                    $output .= AUI_Component_Helper::sanitize_html_field( $args['value'], $args ); // Sanitize HTML.
634
+                } else {
635
+                    $output .= sanitize_textarea_field( $args['value'] );
636
+                }
637
+            }
638
+
639
+            // closing tag
640
+            $output .= '</textarea>';
641
+
642
+        }
643
+
644
+        if ( ! empty( $args['label'] ) && $label_after ) {
645
+            $label_args = array(
646
+                'title'      => $args['label'],
647
+                'for'        => $args['id'],
648
+                'class'      => $args['label_class'] . " ",
649
+                'label_type' => $args['label_type'],
650
+                'label_col'  => $args['label_col']
651
+            );
652
+            $output .= self::label( $label_args );
653
+        }
654
+
655
+        // help text
656
+        if ( ! empty( $args['help_text'] ) ) {
657
+            $output .= AUI_Component_Helper::help_text( $args['help_text'] );
658
+        }
659
+
660
+        // maybe horizontal label
661
+        if ( $args['label_type'] == 'horizontal' ) {
662
+            $output .= '</div>';
663
+        }
664
+
665
+
666
+        // wrap
667
+        if ( ! $args['no_wrap'] ) {
668
+            $form_group_class = $args['label_type'] == 'floating' ? 'form-label-group' : 'form-group';
669
+            $wrap_class       = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class;
670
+            $wrap_class       = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
671
+            $output           = self::wrap( array(
672
+                'content'         => $output,
673
+                'class'           => $wrap_class,
674
+                'element_require' => $args['element_require'],
675
+                'argument_id'     => $args['id'],
676
+                'wrap_attributes' => $args['wrap_attributes'],
677
+            ) );
678
+        }
679
+
680
+
681
+        return $output;
682
+    }
683
+
684
+    /**
685
+     * Build the component.
686
+     *
687
+     * @param array $args
688
+     *
689
+     * @return string The rendered component.
690
+     */
691
+    public static function select( $args = array() ) {
692
+        $defaults = array(
693
+            'class'            => '',
694
+            'wrap_class'       => '',
695
+            'id'               => '',
696
+            'title'            => '',
697
+            'value'            => '',
698
+            // can be an array or a string
699
+            'required'         => false,
700
+            'label'            => '',
701
+            'label_after'      => false,
702
+            'label_type'       => '',
703
+            'label_col'        => '',
704
+            // sets the label type, default: hidden. Options: hidden, top, horizontal, floating
705
+            'label_class'      => '',
706
+            'help_text'        => '',
707
+            'placeholder'      => '',
708
+            'options'          => array(),
709
+            // array or string
710
+            'icon'             => '',
711
+            'multiple'         => false,
712
+            'select2'          => false,
713
+            'no_wrap'          => false,
714
+            'input_group_right' => '',
715
+            'input_group_left' => '',
716
+            'input_group_right_inside' => false, // forces the input group inside the input
717
+            'input_group_left_inside' => false, // forces the input group inside the input
718
+            'element_require'  => '',
719
+            // [%element_id%] == "1"
720
+            'extra_attributes' => array(),
721
+            // an array of extra attributes
722
+            'wrap_attributes'  => array(),
723
+        );
724
+
725
+        /**
726
+         * Parse incoming $args into an array and merge it with $defaults
727
+         */
728
+        $args   = wp_parse_args( $args, $defaults );
729
+        $output = '';
730
+
731
+        // for now lets hide floating labels
732
+        if ( $args['label_type'] == 'floating' ) {
733
+            $args['label_type'] = 'hidden';
734
+        }
735
+
736
+        // hidden label option needs to be empty
737
+        $args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
738
+
739
+
740
+        $label_after = $args['label_after'];
741
+
742
+        // floating labels need label after
743
+        if ( $args['label_type'] == 'floating' ) {
744
+            $label_after         = true;
745
+            $args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
746
+        }
747
+
748
+        // Maybe setup select2
749
+        $is_select2 = false;
750
+        if ( ! empty( $args['select2'] ) ) {
751
+            $args['class'] .= ' aui-select2';
752
+            $is_select2 = true;
753
+        } elseif ( strpos( $args['class'], 'aui-select2' ) !== false ) {
754
+            $is_select2 = true;
755
+        }
756
+
757
+        // select2 tags
758
+        if ( ! empty( $args['select2'] ) && $args['select2'] === 'tags' ) { // triple equals needed here for some reason
759
+            $args['data-tags']             = 'true';
760
+            $args['data-token-separators'] = "[',']";
761
+            $args['multiple']              = true;
762
+        }
763
+
764
+        // select2 placeholder
765
+        if ( $is_select2 && isset( $args['placeholder'] ) && '' != $args['placeholder'] && empty( $args['data-placeholder'] ) ) {
766
+            $args['data-placeholder'] = esc_attr( $args['placeholder'] );
767
+            $args['data-allow-clear'] = isset( $args['data-allow-clear'] ) ? (bool) $args['data-allow-clear'] : true;
768
+        }
769
+
770
+
771
+
772
+        // maybe horizontal label
773 773
 //		if ( $args['label_type'] == 'horizontal' ) {
774 774
 //			$input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' );
775 775
 //			$output .= '<div class="' . $input_col . '">';
776 776
 //		}
777 777
 
778
-		// Set hidden input to save empty value for multiselect.
779
-		if ( ! empty( $args['multiple'] ) && ! empty( $args['name'] ) ) {
780
-			$output .= '<input type="hidden" ' . AUI_Component_Helper::name( $args['name'] ) . ' value=""/>';
781
-		}
782
-
783
-		// open/type
784
-		$output .= '<select ';
785
-
786
-		// style
787
-		if ( $is_select2 && !($args['input_group_left'] || $args['input_group_right'])) {
788
-			$output .= " style='width:100%;' ";
789
-		}
790
-
791
-		// element require
792
-		if ( ! empty( $args['element_require'] ) ) {
793
-			$output .= AUI_Component_Helper::element_require( $args['element_require'] );
794
-			$args['class'] .= " aui-conditional-field";
795
-		}
796
-
797
-		// class
798
-		$class = ! empty( $args['class'] ) ? $args['class'] : '';
799
-		$output .= AUI_Component_Helper::class_attr( 'custom-select ' . $class );
800
-
801
-		// name
802
-		if ( ! empty( $args['name'] ) ) {
803
-			$output .= AUI_Component_Helper::name( $args['name'], $args['multiple'] );
804
-		}
805
-
806
-		// id
807
-		if ( ! empty( $args['id'] ) ) {
808
-			$output .= AUI_Component_Helper::id( $args['id'] );
809
-		}
810
-
811
-		// title
812
-		if ( ! empty( $args['title'] ) ) {
813
-			$output .= AUI_Component_Helper::title( $args['title'] );
814
-		}
815
-
816
-		// data-attributes
817
-		$output .= AUI_Component_Helper::data_attributes( $args );
818
-
819
-		// aria-attributes
820
-		$output .= AUI_Component_Helper::aria_attributes( $args );
821
-
822
-		// extra attributes
823
-		if ( ! empty( $args['extra_attributes'] ) ) {
824
-			$output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
825
-		}
826
-
827
-		// required
828
-		if ( ! empty( $args['required'] ) ) {
829
-			$output .= ' required ';
830
-		}
831
-
832
-		// multiple
833
-		if ( ! empty( $args['multiple'] ) ) {
834
-			$output .= ' multiple ';
835
-		}
836
-
837
-		// close opening tag
838
-		$output .= ' >';
839
-
840
-		// placeholder
841
-		if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] && ! $is_select2 ) {
842
-			$output .= '<option value="" disabled selected hidden>' . esc_attr( $args['placeholder'] ) . '</option>';
843
-		} elseif ( $is_select2 && ! empty( $args['placeholder'] ) ) {
844
-			$output .= "<option></option>"; // select2 needs an empty select to fill the placeholder
845
-		}
846
-
847
-		// Options
848
-		if ( ! empty( $args['options'] ) ) {
849
-
850
-			if ( ! is_array( $args['options'] ) ) {
851
-				$output .= $args['options']; // not the preferred way but an option
852
-			} else {
853
-				foreach ( $args['options'] as $val => $name ) {
854
-					$selected = '';
855
-					if ( is_array( $name ) ) {
856
-						if ( isset( $name['optgroup'] ) && ( $name['optgroup'] == 'start' || $name['optgroup'] == 'end' ) ) {
857
-							$option_label = isset( $name['label'] ) ? $name['label'] : '';
858
-
859
-							$output .= $name['optgroup'] == 'start' ? '<optgroup label="' . esc_attr( $option_label ) . '">' : '</optgroup>';
860
-						} else {
861
-							$option_label = isset( $name['label'] ) ? $name['label'] : '';
862
-							$option_value = isset( $name['value'] ) ? $name['value'] : '';
863
-							$extra_attributes = !empty($name['extra_attributes']) ? AUI_Component_Helper::extra_attributes( $name['extra_attributes'] ) : '';
864
-							if ( ! empty( $args['multiple'] ) && ! empty( $args['value'] ) && is_array( $args['value'] ) ) {
865
-								$selected = in_array( $option_value, stripslashes_deep( $args['value'] ) ) ? "selected" : "";
866
-							} elseif ( ! empty( $args['value'] ) ) {
867
-								$selected = selected( $option_value, stripslashes_deep( $args['value'] ), false );
868
-							}
869
-
870
-							$output .= '<option value="' . esc_attr( $option_value ) . '" ' . $selected . ' '.$extra_attributes .'>' . $option_label . '</option>';
871
-						}
872
-					} else {
873
-						if ( ! empty( $args['value'] ) ) {
874
-							if ( is_array( $args['value'] ) ) {
875
-								$selected = in_array( $val, $args['value'] ) ? 'selected="selected"' : '';
876
-							} elseif ( ! empty( $args['value'] ) ) {
877
-								$selected = selected( $args['value'], $val, false );
878
-							}
879
-						}
880
-						$output .= '<option value="' . esc_attr( $val ) . '" ' . $selected . '>' . esc_attr( $name ) . '</option>';
881
-					}
882
-				}
883
-			}
884
-
885
-		}
886
-
887
-		// closing tag
888
-		$output .= '</select>';
889
-
890
-		$label = '';
891
-		$help_text = '';
892
-		// label
893
-		if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) {
894
-		} elseif ( ! empty( $args['label'] ) && ! $label_after ) {
895
-			$label_args = array(
896
-				'title'      => $args['label'],
897
-				'for'        => $args['id'],
898
-				'class'      => $args['label_class'] . " ",
899
-				'label_type' => $args['label_type'],
900
-				'label_col'  => $args['label_col']
901
-			);
902
-			$label = self::label( $label_args );
903
-		}
904
-
905
-		// help text
906
-		if ( ! empty( $args['help_text'] ) ) {
907
-			$help_text = AUI_Component_Helper::help_text( $args['help_text'] );
908
-		}
909
-
910
-		// input group wraps
911
-		if ( $args['input_group_left'] || $args['input_group_right'] ) {
912
-			$w100 = strpos( $args['class'], 'w-100' ) !== false ? ' w-100' : '';
913
-			if ( $args['input_group_left'] ) {
914
-				$output = self::wrap( array(
915
-					'content'                 => $output,
916
-					'class'                   => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
917
-					'input_group_left'        => $args['input_group_left'],
918
-					'input_group_left_inside' => $args['input_group_left_inside']
919
-				) );
920
-			}
921
-			if ( $args['input_group_right'] ) {
922
-				$output = self::wrap( array(
923
-					'content'                  => $output,
924
-					'class'                    => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
925
-					'input_group_right'        => $args['input_group_right'],
926
-					'input_group_right_inside' => $args['input_group_right_inside']
927
-				) );
928
-			}
929
-
930
-		}
931
-
932
-		if ( ! $label_after ) {
933
-			$output .= $help_text;
934
-		}
935
-
936
-
937
-		if ( $args['label_type'] == 'horizontal' ) {
938
-			$output = self::wrap( array(
939
-				'content' => $output,
940
-				'class'   => AUI_Component_Helper::get_column_class( $args['label_col'], 'input' )
941
-			) );
942
-		}
943
-
944
-		if ( ! $label_after ) {
945
-			$output = $label . $output;
946
-		}
947
-
948
-		// maybe horizontal label
778
+        // Set hidden input to save empty value for multiselect.
779
+        if ( ! empty( $args['multiple'] ) && ! empty( $args['name'] ) ) {
780
+            $output .= '<input type="hidden" ' . AUI_Component_Helper::name( $args['name'] ) . ' value=""/>';
781
+        }
782
+
783
+        // open/type
784
+        $output .= '<select ';
785
+
786
+        // style
787
+        if ( $is_select2 && !($args['input_group_left'] || $args['input_group_right'])) {
788
+            $output .= " style='width:100%;' ";
789
+        }
790
+
791
+        // element require
792
+        if ( ! empty( $args['element_require'] ) ) {
793
+            $output .= AUI_Component_Helper::element_require( $args['element_require'] );
794
+            $args['class'] .= " aui-conditional-field";
795
+        }
796
+
797
+        // class
798
+        $class = ! empty( $args['class'] ) ? $args['class'] : '';
799
+        $output .= AUI_Component_Helper::class_attr( 'custom-select ' . $class );
800
+
801
+        // name
802
+        if ( ! empty( $args['name'] ) ) {
803
+            $output .= AUI_Component_Helper::name( $args['name'], $args['multiple'] );
804
+        }
805
+
806
+        // id
807
+        if ( ! empty( $args['id'] ) ) {
808
+            $output .= AUI_Component_Helper::id( $args['id'] );
809
+        }
810
+
811
+        // title
812
+        if ( ! empty( $args['title'] ) ) {
813
+            $output .= AUI_Component_Helper::title( $args['title'] );
814
+        }
815
+
816
+        // data-attributes
817
+        $output .= AUI_Component_Helper::data_attributes( $args );
818
+
819
+        // aria-attributes
820
+        $output .= AUI_Component_Helper::aria_attributes( $args );
821
+
822
+        // extra attributes
823
+        if ( ! empty( $args['extra_attributes'] ) ) {
824
+            $output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
825
+        }
826
+
827
+        // required
828
+        if ( ! empty( $args['required'] ) ) {
829
+            $output .= ' required ';
830
+        }
831
+
832
+        // multiple
833
+        if ( ! empty( $args['multiple'] ) ) {
834
+            $output .= ' multiple ';
835
+        }
836
+
837
+        // close opening tag
838
+        $output .= ' >';
839
+
840
+        // placeholder
841
+        if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] && ! $is_select2 ) {
842
+            $output .= '<option value="" disabled selected hidden>' . esc_attr( $args['placeholder'] ) . '</option>';
843
+        } elseif ( $is_select2 && ! empty( $args['placeholder'] ) ) {
844
+            $output .= "<option></option>"; // select2 needs an empty select to fill the placeholder
845
+        }
846
+
847
+        // Options
848
+        if ( ! empty( $args['options'] ) ) {
849
+
850
+            if ( ! is_array( $args['options'] ) ) {
851
+                $output .= $args['options']; // not the preferred way but an option
852
+            } else {
853
+                foreach ( $args['options'] as $val => $name ) {
854
+                    $selected = '';
855
+                    if ( is_array( $name ) ) {
856
+                        if ( isset( $name['optgroup'] ) && ( $name['optgroup'] == 'start' || $name['optgroup'] == 'end' ) ) {
857
+                            $option_label = isset( $name['label'] ) ? $name['label'] : '';
858
+
859
+                            $output .= $name['optgroup'] == 'start' ? '<optgroup label="' . esc_attr( $option_label ) . '">' : '</optgroup>';
860
+                        } else {
861
+                            $option_label = isset( $name['label'] ) ? $name['label'] : '';
862
+                            $option_value = isset( $name['value'] ) ? $name['value'] : '';
863
+                            $extra_attributes = !empty($name['extra_attributes']) ? AUI_Component_Helper::extra_attributes( $name['extra_attributes'] ) : '';
864
+                            if ( ! empty( $args['multiple'] ) && ! empty( $args['value'] ) && is_array( $args['value'] ) ) {
865
+                                $selected = in_array( $option_value, stripslashes_deep( $args['value'] ) ) ? "selected" : "";
866
+                            } elseif ( ! empty( $args['value'] ) ) {
867
+                                $selected = selected( $option_value, stripslashes_deep( $args['value'] ), false );
868
+                            }
869
+
870
+                            $output .= '<option value="' . esc_attr( $option_value ) . '" ' . $selected . ' '.$extra_attributes .'>' . $option_label . '</option>';
871
+                        }
872
+                    } else {
873
+                        if ( ! empty( $args['value'] ) ) {
874
+                            if ( is_array( $args['value'] ) ) {
875
+                                $selected = in_array( $val, $args['value'] ) ? 'selected="selected"' : '';
876
+                            } elseif ( ! empty( $args['value'] ) ) {
877
+                                $selected = selected( $args['value'], $val, false );
878
+                            }
879
+                        }
880
+                        $output .= '<option value="' . esc_attr( $val ) . '" ' . $selected . '>' . esc_attr( $name ) . '</option>';
881
+                    }
882
+                }
883
+            }
884
+
885
+        }
886
+
887
+        // closing tag
888
+        $output .= '</select>';
889
+
890
+        $label = '';
891
+        $help_text = '';
892
+        // label
893
+        if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) {
894
+        } elseif ( ! empty( $args['label'] ) && ! $label_after ) {
895
+            $label_args = array(
896
+                'title'      => $args['label'],
897
+                'for'        => $args['id'],
898
+                'class'      => $args['label_class'] . " ",
899
+                'label_type' => $args['label_type'],
900
+                'label_col'  => $args['label_col']
901
+            );
902
+            $label = self::label( $label_args );
903
+        }
904
+
905
+        // help text
906
+        if ( ! empty( $args['help_text'] ) ) {
907
+            $help_text = AUI_Component_Helper::help_text( $args['help_text'] );
908
+        }
909
+
910
+        // input group wraps
911
+        if ( $args['input_group_left'] || $args['input_group_right'] ) {
912
+            $w100 = strpos( $args['class'], 'w-100' ) !== false ? ' w-100' : '';
913
+            if ( $args['input_group_left'] ) {
914
+                $output = self::wrap( array(
915
+                    'content'                 => $output,
916
+                    'class'                   => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
917
+                    'input_group_left'        => $args['input_group_left'],
918
+                    'input_group_left_inside' => $args['input_group_left_inside']
919
+                ) );
920
+            }
921
+            if ( $args['input_group_right'] ) {
922
+                $output = self::wrap( array(
923
+                    'content'                  => $output,
924
+                    'class'                    => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
925
+                    'input_group_right'        => $args['input_group_right'],
926
+                    'input_group_right_inside' => $args['input_group_right_inside']
927
+                ) );
928
+            }
929
+
930
+        }
931
+
932
+        if ( ! $label_after ) {
933
+            $output .= $help_text;
934
+        }
935
+
936
+
937
+        if ( $args['label_type'] == 'horizontal' ) {
938
+            $output = self::wrap( array(
939
+                'content' => $output,
940
+                'class'   => AUI_Component_Helper::get_column_class( $args['label_col'], 'input' )
941
+            ) );
942
+        }
943
+
944
+        if ( ! $label_after ) {
945
+            $output = $label . $output;
946
+        }
947
+
948
+        // maybe horizontal label
949 949
 //		if ( $args['label_type'] == 'horizontal' ) {
950 950
 //			$output .= '</div>';
951 951
 //		}
952 952
 
953 953
 
954
-		// wrap
955
-		if ( ! $args['no_wrap'] ) {
956
-			$wrap_class = $args['label_type'] == 'horizontal' ? 'form-group row' : 'form-group';
957
-			$wrap_class = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
958
-			$output     = self::wrap( array(
959
-				'content'         => $output,
960
-				'class'           => $wrap_class,
961
-				'element_require' => $args['element_require'],
962
-				'argument_id'     => $args['id'],
963
-				'wrap_attributes' => $args['wrap_attributes'],
964
-			) );
965
-		}
966
-
967
-
968
-		return $output;
969
-	}
970
-
971
-	/**
972
-	 * Build the component.
973
-	 *
974
-	 * @param array $args
975
-	 *
976
-	 * @return string The rendered component.
977
-	 */
978
-	public static function radio( $args = array() ) {
979
-		$defaults = array(
980
-			'class'            => '',
981
-			'wrap_class'       => '',
982
-			'id'               => '',
983
-			'title'            => '',
984
-			'horizontal'       => false,
985
-			// sets the lable horizontal
986
-			'value'            => '',
987
-			'label'            => '',
988
-			'label_class'      => '',
989
-			'label_type'       => '',
990
-			'label_col'        => '',
991
-			// sets the label type, default: hidden. Options: hidden, top, horizontal, floating
992
-			'help_text'        => '',
993
-			'inline'           => true,
994
-			'required'         => false,
995
-			'options'          => array(),
996
-			'icon'             => '',
997
-			'no_wrap'          => false,
998
-			'element_require'  => '',
999
-			// [%element_id%] == "1"
1000
-			'extra_attributes' => array(),
1001
-			// an array of extra attributes
1002
-			'wrap_attributes'  => array()
1003
-		);
1004
-
1005
-		/**
1006
-		 * Parse incoming $args into an array and merge it with $defaults
1007
-		 */
1008
-		$args = wp_parse_args( $args, $defaults );
1009
-
1010
-		// for now lets use horizontal for floating
1011
-		if ( $args['label_type'] == 'floating' ) {
1012
-			$args['label_type'] = 'horizontal';
1013
-		}
1014
-
1015
-		$label_args = array(
1016
-			'title'      => $args['label'],
1017
-			'class'      => $args['label_class'] . " pt-0 ",
1018
-			'label_type' => $args['label_type'],
1019
-			'label_col'  => $args['label_col']
1020
-		);
1021
-
1022
-		$output = '';
1023
-
1024
-
1025
-		// label before
1026
-		if ( ! empty( $args['label'] ) ) {
1027
-			$output .= self::label( $label_args, 'radio' );
1028
-		}
1029
-
1030
-		// maybe horizontal label
1031
-		if ( $args['label_type'] == 'horizontal' ) {
1032
-			$input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' );
1033
-			$output .= '<div class="' . $input_col . '">';
1034
-		}
1035
-
1036
-		if ( ! empty( $args['options'] ) ) {
1037
-			$count = 0;
1038
-			foreach ( $args['options'] as $value => $label ) {
1039
-				$option_args            = $args;
1040
-				$option_args['value']   = $value;
1041
-				$option_args['label']   = $label;
1042
-				$option_args['checked'] = $value == $args['value'] ? true : false;
1043
-				$output .= self::radio_option( $option_args, $count );
1044
-				$count ++;
1045
-			}
1046
-		}
1047
-
1048
-		// help text
1049
-		$help_text = ! empty( $args['help_text'] ) ? AUI_Component_Helper::help_text( $args['help_text'] ) : '';
1050
-		$output .= $help_text;
1051
-
1052
-		// maybe horizontal label
1053
-		if ( $args['label_type'] == 'horizontal' ) {
1054
-			$output .= '</div>';
1055
-		}
1056
-
1057
-		// wrap
1058
-		$wrap_class = $args['label_type'] == 'horizontal' ? 'form-group row' : 'form-group';
1059
-		$wrap_class = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
1060
-		$output     = self::wrap( array(
1061
-			'content'         => $output,
1062
-			'class'           => $wrap_class,
1063
-			'element_require' => $args['element_require'],
1064
-			'argument_id'     => $args['id'],
1065
-			'wrap_attributes' => $args['wrap_attributes'],
1066
-		) );
1067
-
1068
-
1069
-		return $output;
1070
-	}
1071
-
1072
-	/**
1073
-	 * Build the component.
1074
-	 *
1075
-	 * @param array $args
1076
-	 *
1077
-	 * @return string The rendered component.
1078
-	 */
1079
-	public static function radio_option( $args = array(), $count = '' ) {
1080
-		$defaults = array(
1081
-			'class'            => '',
1082
-			'id'               => '',
1083
-			'title'            => '',
1084
-			'value'            => '',
1085
-			'required'         => false,
1086
-			'inline'           => true,
1087
-			'label'            => '',
1088
-			'options'          => array(),
1089
-			'icon'             => '',
1090
-			'no_wrap'          => false,
1091
-			'extra_attributes' => array() // an array of extra attributes
1092
-		);
1093
-
1094
-		/**
1095
-		 * Parse incoming $args into an array and merge it with $defaults
1096
-		 */
1097
-		$args = wp_parse_args( $args, $defaults );
1098
-
1099
-		$output = '';
1100
-
1101
-		// open/type
1102
-		$output .= '<input type="radio"';
1103
-
1104
-		// class
1105
-		$output .= ' class="form-check-input" ';
1106
-
1107
-		// name
1108
-		if ( ! empty( $args['name'] ) ) {
1109
-			$output .= AUI_Component_Helper::name( $args['name'] );
1110
-		}
1111
-
1112
-		// id
1113
-		if ( ! empty( $args['id'] ) ) {
1114
-			$output .= AUI_Component_Helper::id( $args['id'] . $count );
1115
-		}
1116
-
1117
-		// title
1118
-		if ( ! empty( $args['title'] ) ) {
1119
-			$output .= AUI_Component_Helper::title( $args['title'] );
1120
-		}
1121
-
1122
-		// value
1123
-		if ( isset( $args['value'] ) ) {
1124
-			$output .= AUI_Component_Helper::value( $args['value'] );
1125
-		}
1126
-
1127
-		// checked, for radio and checkboxes
1128
-		if ( $args['checked'] ) {
1129
-			$output .= ' checked ';
1130
-		}
1131
-
1132
-		// data-attributes
1133
-		$output .= AUI_Component_Helper::data_attributes( $args );
1134
-
1135
-		// aria-attributes
1136
-		$output .= AUI_Component_Helper::aria_attributes( $args );
1137
-
1138
-		// extra attributes
1139
-		if ( ! empty( $args['extra_attributes'] ) ) {
1140
-			$output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
1141
-		}
1142
-
1143
-		// required
1144
-		if ( ! empty( $args['required'] ) ) {
1145
-			$output .= ' required ';
1146
-		}
1147
-
1148
-		// close opening tag
1149
-		$output .= ' >';
1150
-
1151
-		// label
1152
-		if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) {
1153
-		} elseif ( ! empty( $args['label'] ) ) {
1154
-			$output .= self::label( array(
1155
-				'title' => $args['label'],
1156
-				'for'   => $args['id'] . $count,
1157
-				'class' => 'form-check-label'
1158
-			), 'radio' );
1159
-		}
1160
-
1161
-		// wrap
1162
-		if ( ! $args['no_wrap'] ) {
1163
-			$wrap_class = $args['inline'] ? 'form-check form-check-inline' : 'form-check';
1164
-
1165
-			// Unique wrap class
1166
-			$uniq_class = 'fwrap';
1167
-			if ( ! empty( $args['name'] ) ) {
1168
-				$uniq_class .= '-' . $args['name'];
1169
-			} else if ( ! empty( $args['id'] ) ) {
1170
-				$uniq_class .= '-' . $args['id'];
1171
-			}
1172
-
1173
-			if ( isset( $args['value'] ) || $args['value'] !== "" ) {
1174
-				$uniq_class .= '-' . $args['value'];
1175
-			} else {
1176
-				$uniq_class .= '-' . $count;
1177
-			}
1178
-			$wrap_class .= ' ' . sanitize_html_class( $uniq_class );
1179
-
1180
-			$output = self::wrap( array(
1181
-				'content' => $output,
1182
-				'class'   => $wrap_class
1183
-			) );
1184
-		}
1185
-
1186
-		return $output;
1187
-	}
954
+        // wrap
955
+        if ( ! $args['no_wrap'] ) {
956
+            $wrap_class = $args['label_type'] == 'horizontal' ? 'form-group row' : 'form-group';
957
+            $wrap_class = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
958
+            $output     = self::wrap( array(
959
+                'content'         => $output,
960
+                'class'           => $wrap_class,
961
+                'element_require' => $args['element_require'],
962
+                'argument_id'     => $args['id'],
963
+                'wrap_attributes' => $args['wrap_attributes'],
964
+            ) );
965
+        }
966
+
967
+
968
+        return $output;
969
+    }
970
+
971
+    /**
972
+     * Build the component.
973
+     *
974
+     * @param array $args
975
+     *
976
+     * @return string The rendered component.
977
+     */
978
+    public static function radio( $args = array() ) {
979
+        $defaults = array(
980
+            'class'            => '',
981
+            'wrap_class'       => '',
982
+            'id'               => '',
983
+            'title'            => '',
984
+            'horizontal'       => false,
985
+            // sets the lable horizontal
986
+            'value'            => '',
987
+            'label'            => '',
988
+            'label_class'      => '',
989
+            'label_type'       => '',
990
+            'label_col'        => '',
991
+            // sets the label type, default: hidden. Options: hidden, top, horizontal, floating
992
+            'help_text'        => '',
993
+            'inline'           => true,
994
+            'required'         => false,
995
+            'options'          => array(),
996
+            'icon'             => '',
997
+            'no_wrap'          => false,
998
+            'element_require'  => '',
999
+            // [%element_id%] == "1"
1000
+            'extra_attributes' => array(),
1001
+            // an array of extra attributes
1002
+            'wrap_attributes'  => array()
1003
+        );
1004
+
1005
+        /**
1006
+         * Parse incoming $args into an array and merge it with $defaults
1007
+         */
1008
+        $args = wp_parse_args( $args, $defaults );
1009
+
1010
+        // for now lets use horizontal for floating
1011
+        if ( $args['label_type'] == 'floating' ) {
1012
+            $args['label_type'] = 'horizontal';
1013
+        }
1014
+
1015
+        $label_args = array(
1016
+            'title'      => $args['label'],
1017
+            'class'      => $args['label_class'] . " pt-0 ",
1018
+            'label_type' => $args['label_type'],
1019
+            'label_col'  => $args['label_col']
1020
+        );
1021
+
1022
+        $output = '';
1023
+
1024
+
1025
+        // label before
1026
+        if ( ! empty( $args['label'] ) ) {
1027
+            $output .= self::label( $label_args, 'radio' );
1028
+        }
1029
+
1030
+        // maybe horizontal label
1031
+        if ( $args['label_type'] == 'horizontal' ) {
1032
+            $input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' );
1033
+            $output .= '<div class="' . $input_col . '">';
1034
+        }
1035
+
1036
+        if ( ! empty( $args['options'] ) ) {
1037
+            $count = 0;
1038
+            foreach ( $args['options'] as $value => $label ) {
1039
+                $option_args            = $args;
1040
+                $option_args['value']   = $value;
1041
+                $option_args['label']   = $label;
1042
+                $option_args['checked'] = $value == $args['value'] ? true : false;
1043
+                $output .= self::radio_option( $option_args, $count );
1044
+                $count ++;
1045
+            }
1046
+        }
1047
+
1048
+        // help text
1049
+        $help_text = ! empty( $args['help_text'] ) ? AUI_Component_Helper::help_text( $args['help_text'] ) : '';
1050
+        $output .= $help_text;
1051
+
1052
+        // maybe horizontal label
1053
+        if ( $args['label_type'] == 'horizontal' ) {
1054
+            $output .= '</div>';
1055
+        }
1056
+
1057
+        // wrap
1058
+        $wrap_class = $args['label_type'] == 'horizontal' ? 'form-group row' : 'form-group';
1059
+        $wrap_class = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
1060
+        $output     = self::wrap( array(
1061
+            'content'         => $output,
1062
+            'class'           => $wrap_class,
1063
+            'element_require' => $args['element_require'],
1064
+            'argument_id'     => $args['id'],
1065
+            'wrap_attributes' => $args['wrap_attributes'],
1066
+        ) );
1067
+
1068
+
1069
+        return $output;
1070
+    }
1071
+
1072
+    /**
1073
+     * Build the component.
1074
+     *
1075
+     * @param array $args
1076
+     *
1077
+     * @return string The rendered component.
1078
+     */
1079
+    public static function radio_option( $args = array(), $count = '' ) {
1080
+        $defaults = array(
1081
+            'class'            => '',
1082
+            'id'               => '',
1083
+            'title'            => '',
1084
+            'value'            => '',
1085
+            'required'         => false,
1086
+            'inline'           => true,
1087
+            'label'            => '',
1088
+            'options'          => array(),
1089
+            'icon'             => '',
1090
+            'no_wrap'          => false,
1091
+            'extra_attributes' => array() // an array of extra attributes
1092
+        );
1093
+
1094
+        /**
1095
+         * Parse incoming $args into an array and merge it with $defaults
1096
+         */
1097
+        $args = wp_parse_args( $args, $defaults );
1098
+
1099
+        $output = '';
1100
+
1101
+        // open/type
1102
+        $output .= '<input type="radio"';
1103
+
1104
+        // class
1105
+        $output .= ' class="form-check-input" ';
1106
+
1107
+        // name
1108
+        if ( ! empty( $args['name'] ) ) {
1109
+            $output .= AUI_Component_Helper::name( $args['name'] );
1110
+        }
1111
+
1112
+        // id
1113
+        if ( ! empty( $args['id'] ) ) {
1114
+            $output .= AUI_Component_Helper::id( $args['id'] . $count );
1115
+        }
1116
+
1117
+        // title
1118
+        if ( ! empty( $args['title'] ) ) {
1119
+            $output .= AUI_Component_Helper::title( $args['title'] );
1120
+        }
1121
+
1122
+        // value
1123
+        if ( isset( $args['value'] ) ) {
1124
+            $output .= AUI_Component_Helper::value( $args['value'] );
1125
+        }
1126
+
1127
+        // checked, for radio and checkboxes
1128
+        if ( $args['checked'] ) {
1129
+            $output .= ' checked ';
1130
+        }
1131
+
1132
+        // data-attributes
1133
+        $output .= AUI_Component_Helper::data_attributes( $args );
1134
+
1135
+        // aria-attributes
1136
+        $output .= AUI_Component_Helper::aria_attributes( $args );
1137
+
1138
+        // extra attributes
1139
+        if ( ! empty( $args['extra_attributes'] ) ) {
1140
+            $output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
1141
+        }
1142
+
1143
+        // required
1144
+        if ( ! empty( $args['required'] ) ) {
1145
+            $output .= ' required ';
1146
+        }
1147
+
1148
+        // close opening tag
1149
+        $output .= ' >';
1150
+
1151
+        // label
1152
+        if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) {
1153
+        } elseif ( ! empty( $args['label'] ) ) {
1154
+            $output .= self::label( array(
1155
+                'title' => $args['label'],
1156
+                'for'   => $args['id'] . $count,
1157
+                'class' => 'form-check-label'
1158
+            ), 'radio' );
1159
+        }
1160
+
1161
+        // wrap
1162
+        if ( ! $args['no_wrap'] ) {
1163
+            $wrap_class = $args['inline'] ? 'form-check form-check-inline' : 'form-check';
1164
+
1165
+            // Unique wrap class
1166
+            $uniq_class = 'fwrap';
1167
+            if ( ! empty( $args['name'] ) ) {
1168
+                $uniq_class .= '-' . $args['name'];
1169
+            } else if ( ! empty( $args['id'] ) ) {
1170
+                $uniq_class .= '-' . $args['id'];
1171
+            }
1172
+
1173
+            if ( isset( $args['value'] ) || $args['value'] !== "" ) {
1174
+                $uniq_class .= '-' . $args['value'];
1175
+            } else {
1176
+                $uniq_class .= '-' . $count;
1177
+            }
1178
+            $wrap_class .= ' ' . sanitize_html_class( $uniq_class );
1179
+
1180
+            $output = self::wrap( array(
1181
+                'content' => $output,
1182
+                'class'   => $wrap_class
1183
+            ) );
1184
+        }
1185
+
1186
+        return $output;
1187
+    }
1188 1188
 
1189 1189
 }
1190 1190
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +272 added lines, -272 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'                     => '',
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 		/**
64 64
 		 * Parse incoming $args into an array and merge it with $defaults
65 65
 		 */
66
-		$args   = wp_parse_args( $args, $defaults );
66
+		$args   = wp_parse_args($args, $defaults);
67 67
 		$output = '';
68
-		if ( ! empty( $args['type'] ) ) {
68
+		if (!empty($args['type'])) {
69 69
 			// hidden label option needs to be empty
70 70
 			$args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
71 71
 
72
-			$type = sanitize_html_class( $args['type'] );
72
+			$type = sanitize_html_class($args['type']);
73 73
 
74 74
 			$help_text   = '';
75 75
 			$label       = '';
@@ -83,19 +83,19 @@  discard block
 block discarded – undo
83 83
 			);
84 84
 
85 85
 			// floating labels need label after
86
-			if ( $args['label_type'] == 'floating' && $type != 'checkbox' ) {
86
+			if ($args['label_type'] == 'floating' && $type != 'checkbox') {
87 87
 				$label_after         = true;
88 88
 				$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
89 89
 			}
90 90
 
91 91
 			// Some special sauce for files
92
-			if ( $type == 'file' ) {
92
+			if ($type == 'file') {
93 93
 				$label_after = true; // if type file we need the label after
94 94
 				$args['class'] .= ' custom-file-input ';
95
-			} elseif ( $type == 'checkbox' ) {
95
+			} elseif ($type == 'checkbox') {
96 96
 				$label_after = true; // if type file we need the label after
97 97
 				$args['class'] .= ' custom-control-input ';
98
-			} elseif ( $type == 'datepicker' || $type == 'timepicker' ) {
98
+			} elseif ($type == 'datepicker' || $type == 'timepicker') {
99 99
 				$type = 'text';
100 100
 				//$args['class'] .= ' aui-flatpickr bg-initial ';
101 101
 				$args['class'] .= ' bg-initial ';
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 				// enqueue the script
105 105
 				$aui_settings = AyeCode_UI_Settings::instance();
106 106
 				$aui_settings->enqueue_flatpickr();
107
-			} elseif ( $type == 'iconpicker' ) {
107
+			} elseif ($type == 'iconpicker') {
108 108
 				$type = 'text';
109 109
 				//$args['class'] .= ' aui-flatpickr bg-initial ';
110 110
 //				$args['class'] .= ' bg-initial ';
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 				$aui_settings->enqueue_iconpicker();
120 120
 			}
121 121
 
122
-			if ( $type == 'checkbox' && !empty($args['name'] ) && strpos($args['name'], '[') === false ) {
123
-				$output .= '<input type="hidden" name="' . esc_attr( $args['name'] ) . '" value="0" />';
122
+			if ($type == 'checkbox' && !empty($args['name']) && strpos($args['name'], '[') === false) {
123
+				$output .= '<input type="hidden" name="' . esc_attr($args['name']) . '" value="0" />';
124 124
 			}
125 125
 
126 126
 
@@ -128,88 +128,88 @@  discard block
 block discarded – undo
128 128
 			$output .= '<input type="' . $type . '" ';
129 129
 
130 130
 			// name
131
-			if ( ! empty( $args['name'] ) ) {
132
-				$output .= ' name="' . esc_attr( $args['name'] ) . '" ';
131
+			if (!empty($args['name'])) {
132
+				$output .= ' name="' . esc_attr($args['name']) . '" ';
133 133
 			}
134 134
 
135 135
 			// id
136
-			if ( ! empty( $args['id'] ) ) {
137
-				$output .= ' id="' . sanitize_html_class( $args['id'] ) . '" ';
136
+			if (!empty($args['id'])) {
137
+				$output .= ' id="' . sanitize_html_class($args['id']) . '" ';
138 138
 			}
139 139
 
140 140
 			// placeholder
141
-			if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] ) {
142
-				$output .= ' placeholder="' . esc_attr( $args['placeholder'] ) . '" ';
141
+			if (isset($args['placeholder']) && '' != $args['placeholder']) {
142
+				$output .= ' placeholder="' . esc_attr($args['placeholder']) . '" ';
143 143
 			}
144 144
 
145 145
 			// title
146
-			if ( ! empty( $args['title'] ) ) {
147
-				$output .= ' title="' . esc_attr( $args['title'] ) . '" ';
146
+			if (!empty($args['title'])) {
147
+				$output .= ' title="' . esc_attr($args['title']) . '" ';
148 148
 			}
149 149
 
150 150
 			// value
151
-			if ( ! empty( $args['value'] ) ) {
152
-				$output .= AUI_Component_Helper::value( $args['value'] );
151
+			if (!empty($args['value'])) {
152
+				$output .= AUI_Component_Helper::value($args['value']);
153 153
 			}
154 154
 
155 155
 			// checked, for radio and checkboxes
156
-			if ( ( $type == 'checkbox' || $type == 'radio' ) && $args['checked'] ) {
156
+			if (($type == 'checkbox' || $type == 'radio') && $args['checked']) {
157 157
 				$output .= ' checked ';
158 158
 			}
159 159
 
160 160
 			// validation text
161
-			if ( ! empty( $args['validation_text'] ) ) {
162
-				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr( $args['validation_text'] ) . '\')" ';
161
+			if (!empty($args['validation_text'])) {
162
+				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr($args['validation_text']) . '\')" ';
163 163
 				$output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
164 164
 			}
165 165
 
166 166
 			// validation_pattern
167
-			if ( ! empty( $args['validation_pattern'] ) ) {
168
-				$output .= ' pattern="' . esc_attr( $args['validation_pattern'] ) . '" ';
167
+			if (!empty($args['validation_pattern'])) {
168
+				$output .= ' pattern="' . esc_attr($args['validation_pattern']) . '" ';
169 169
 			}
170 170
 
171 171
 			// step (for numbers)
172
-			if ( ! empty( $args['step'] ) ) {
172
+			if (!empty($args['step'])) {
173 173
 				$output .= ' step="' . $args['step'] . '" ';
174 174
 			}
175 175
 
176 176
 			// required
177
-			if ( ! empty( $args['required'] ) ) {
177
+			if (!empty($args['required'])) {
178 178
 				$output .= ' required ';
179 179
 			}
180 180
 
181 181
 			// class
182
-			$class = ! empty( $args['class'] ) ? AUI_Component_Helper::esc_classes( $args['class'] ) : '';
182
+			$class = !empty($args['class']) ? AUI_Component_Helper::esc_classes($args['class']) : '';
183 183
 			$output .= ' class="form-control ' . $class . '" ';
184 184
 
185 185
 			// data-attributes
186
-			$output .= AUI_Component_Helper::data_attributes( $args );
186
+			$output .= AUI_Component_Helper::data_attributes($args);
187 187
 
188 188
 			// extra attributes
189
-			if ( ! empty( $args['extra_attributes'] ) ) {
190
-				$output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
189
+			if (!empty($args['extra_attributes'])) {
190
+				$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
191 191
 			}
192 192
 
193 193
 			// close
194 194
 			$output .= ' >';
195 195
 
196 196
 			// help text
197
-			if ( ! empty( $args['help_text'] ) ) {
198
-				$help_text = AUI_Component_Helper::help_text( $args['help_text'] );
197
+			if (!empty($args['help_text'])) {
198
+				$help_text = AUI_Component_Helper::help_text($args['help_text']);
199 199
 			}
200 200
 
201 201
 			// label
202
-			if ( ! empty( $args['label'] ) ) {
202
+			if (!empty($args['label'])) {
203 203
 				$label_base_class = '';
204
-				if ( $type == 'file' ) {
204
+				if ($type == 'file') {
205 205
 					$label_base_class = ' custom-file-label';
206
-				} elseif ( $type == 'checkbox' ) {
207
-					if ( ! empty( $args['label_force_left'] ) ) {
208
-						$label_args['title'] = wp_kses_post( $args['help_text'] );
206
+				} elseif ($type == 'checkbox') {
207
+					if (!empty($args['label_force_left'])) {
208
+						$label_args['title'] = wp_kses_post($args['help_text']);
209 209
 						$help_text = '';
210 210
 						//$label_args['class'] .= ' d-inline ';
211 211
 						$args['wrap_class'] .= ' align-items-center ';
212
-					}else{
212
+					} else {
213 213
 
214 214
 					}
215 215
 
@@ -217,45 +217,45 @@  discard block
 block discarded – undo
217 217
 				}
218 218
 				$label_args['class'] .= $label_base_class;
219 219
 				$temp_label_args = $label_args;
220
-				if(! empty( $args['label_force_left'] )){$temp_label_args['class'] = $label_base_class." text-muted";}
221
-				$label = self::label( $temp_label_args, $type );
220
+				if (!empty($args['label_force_left'])) {$temp_label_args['class'] = $label_base_class . " text-muted"; }
221
+				$label = self::label($temp_label_args, $type);
222 222
 			}
223 223
 
224 224
 
225 225
 
226 226
 
227 227
 			// set help text in the correct position
228
-			if ( $label_after ) {
228
+			if ($label_after) {
229 229
 				$output .= $label . $help_text;
230 230
 			}
231 231
 
232 232
 			// some input types need a separate wrap
233
-			if ( $type == 'file' ) {
234
-				$output = self::wrap( array(
233
+			if ($type == 'file') {
234
+				$output = self::wrap(array(
235 235
 					'content' => $output,
236 236
 					'class'   => 'form-group custom-file'
237
-				) );
238
-			} elseif ( $type == 'checkbox' ) {
237
+				));
238
+			} elseif ($type == 'checkbox') {
239 239
 
240 240
 				$label_args['title'] = $args['label'];
241
-				$label_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'label' );
242
-				$label = !empty( $args['label_force_left'] ) ? self::label( $label_args, 'cb' ) : '<div class="' . $label_col . ' col-form-label"></div>';
243
-				$switch_size_class = $args['switch'] && !is_bool( $args['switch'] ) ? ' custom-switch-'.esc_attr( $args['switch'] ) : '';
244
-				$wrap_class = $args['switch'] ? 'custom-switch'.$switch_size_class : 'custom-checkbox';
245
-				if ( ! empty( $args['label_force_left'] ) ) {
241
+				$label_col = AUI_Component_Helper::get_column_class($args['label_col'], 'label');
242
+				$label = !empty($args['label_force_left']) ? self::label($label_args, 'cb') : '<div class="' . $label_col . ' col-form-label"></div>';
243
+				$switch_size_class = $args['switch'] && !is_bool($args['switch']) ? ' custom-switch-' . esc_attr($args['switch']) : '';
244
+				$wrap_class = $args['switch'] ? 'custom-switch' . $switch_size_class : 'custom-checkbox';
245
+				if (!empty($args['label_force_left'])) {
246 246
 					$wrap_class .= ' d-flex align-content-center';
247
-					$label = str_replace("custom-control-label","", self::label( $label_args, 'cb' ) );
247
+					$label = str_replace("custom-control-label", "", self::label($label_args, 'cb'));
248 248
 				}
249
-				$output     = self::wrap( array(
249
+				$output = self::wrap(array(
250 250
 					'content' => $output,
251 251
 					'class'   => 'custom-control ' . $wrap_class
252
-				) );
252
+				));
253 253
 
254
-				if ( $args['label_type'] == 'horizontal' ) {
255
-					$input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' );
254
+				if ($args['label_type'] == 'horizontal') {
255
+					$input_col = AUI_Component_Helper::get_column_class($args['label_col'], 'input');
256 256
 					$output    = $label . '<div class="' . $input_col . '">' . $output . '</div>';
257 257
 				}
258
-			} elseif ( $type == 'password' && $args['password_toggle'] && ! $args['input_group_right'] ) {
258
+			} elseif ($type == 'password' && $args['password_toggle'] && !$args['input_group_right']) {
259 259
 
260 260
 
261 261
 				// allow password field to toggle view
@@ -269,62 +269,62 @@  discard block
 block discarded – undo
269 269
 			}
270 270
 
271 271
 			// input group wraps
272
-			if ( $args['input_group_left'] || $args['input_group_right'] ) {
273
-				$w100 = strpos( $args['class'], 'w-100' ) !== false ? ' w-100' : '';
274
-				if ( $args['input_group_left'] ) {
275
-					$output = self::wrap( array(
272
+			if ($args['input_group_left'] || $args['input_group_right']) {
273
+				$w100 = strpos($args['class'], 'w-100') !== false ? ' w-100' : '';
274
+				if ($args['input_group_left']) {
275
+					$output = self::wrap(array(
276 276
 						'content'                 => $output,
277 277
 						'class'                   => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
278 278
 						'input_group_left'        => $args['input_group_left'],
279 279
 						'input_group_left_inside' => $args['input_group_left_inside']
280
-					) );
280
+					));
281 281
 				}
282
-				if ( $args['input_group_right'] ) {
283
-					$output = self::wrap( array(
282
+				if ($args['input_group_right']) {
283
+					$output = self::wrap(array(
284 284
 						'content'                  => $output,
285 285
 						'class'                    => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
286 286
 						'input_group_right'        => $args['input_group_right'],
287 287
 						'input_group_right_inside' => $args['input_group_right_inside']
288
-					) );
288
+					));
289 289
 				}
290 290
 
291 291
 			}
292 292
 
293
-			if ( ! $label_after ) {
293
+			if (!$label_after) {
294 294
 				$output .= $help_text;
295 295
 			}
296 296
 
297 297
 
298
-			if ( $args['label_type'] == 'horizontal' && $type != 'checkbox' ) {
299
-				$output = self::wrap( array(
298
+			if ($args['label_type'] == 'horizontal' && $type != 'checkbox') {
299
+				$output = self::wrap(array(
300 300
 					'content' => $output,
301
-					'class'   => AUI_Component_Helper::get_column_class( $args['label_col'], 'input' )
302
-				) );
301
+					'class'   => AUI_Component_Helper::get_column_class($args['label_col'], 'input')
302
+				));
303 303
 			}
304 304
 
305
-			if ( ! $label_after ) {
305
+			if (!$label_after) {
306 306
 				$output = $label . $output;
307 307
 			}
308 308
 
309 309
 			// wrap
310
-			if ( ! $args['no_wrap'] ) {
310
+			if (!$args['no_wrap']) {
311 311
 				$form_group_class = $args['label_type'] == 'floating' && $type != 'checkbox' ? 'form-label-group' : 'form-group';
312 312
 				$wrap_class       = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class;
313
-				$wrap_class       = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
314
-				$output           = self::wrap( array(
313
+				$wrap_class       = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
314
+				$output           = self::wrap(array(
315 315
 					'content'         => $output,
316 316
 					'class'           => $wrap_class,
317 317
 					'element_require' => $args['element_require'],
318 318
 					'argument_id'     => $args['id'],
319 319
 					'wrap_attributes' => $args['wrap_attributes'],
320
-				) );
320
+				));
321 321
 			}
322 322
 		}
323 323
 
324 324
 		return $output;
325 325
 	}
326 326
 
327
-	public static function label( $args = array(), $type = '' ) {
327
+	public static function label($args = array(), $type = '') {
328 328
 		//<label for="exampleInputEmail1">Email address</label>
329 329
 		$defaults = array(
330 330
 			'title'      => 'div',
@@ -337,33 +337,33 @@  discard block
 block discarded – undo
337 337
 		/**
338 338
 		 * Parse incoming $args into an array and merge it with $defaults
339 339
 		 */
340
-		$args   = wp_parse_args( $args, $defaults );
340
+		$args   = wp_parse_args($args, $defaults);
341 341
 		$output = '';
342 342
 
343
-		if ( $args['title'] ) {
343
+		if ($args['title']) {
344 344
 
345 345
 			// maybe hide labels //@todo set a global option for visibility class
346
-			if ( $type == 'file' || $type == 'checkbox' || $type == 'radio' || ! empty( $args['label_type'] ) ) {
346
+			if ($type == 'file' || $type == 'checkbox' || $type == 'radio' || !empty($args['label_type'])) {
347 347
 				$class = $args['class'];
348 348
 			} else {
349 349
 				$class = 'sr-only ' . $args['class'];
350 350
 			}
351 351
 
352 352
 			// maybe horizontal
353
-			if ( $args['label_type'] == 'horizontal' && $type != 'checkbox' ) {
354
-				$class .= ' ' . AUI_Component_Helper::get_column_class( $args['label_col'], 'label' ) . ' col-form-label';
353
+			if ($args['label_type'] == 'horizontal' && $type != 'checkbox') {
354
+				$class .= ' ' . AUI_Component_Helper::get_column_class($args['label_col'], 'label') . ' col-form-label';
355 355
 			}
356 356
 
357 357
 			// open
358 358
 			$output .= '<label ';
359 359
 
360 360
 			// for
361
-			if ( ! empty( $args['for'] ) ) {
362
-				$output .= ' for="' . esc_attr( $args['for'] ) . '" ';
361
+			if (!empty($args['for'])) {
362
+				$output .= ' for="' . esc_attr($args['for']) . '" ';
363 363
 			}
364 364
 
365 365
 			// class
366
-			$class = $class ? AUI_Component_Helper::esc_classes( $class ) : '';
366
+			$class = $class ? AUI_Component_Helper::esc_classes($class) : '';
367 367
 			$output .= ' class="' . $class . '" ';
368 368
 
369 369
 			// close
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
 
372 372
 
373 373
 			// title, don't escape fully as can contain html
374
-			if ( ! empty( $args['title'] ) ) {
375
-				$output .= wp_kses_post( $args['title'] );
374
+			if (!empty($args['title'])) {
375
+				$output .= wp_kses_post($args['title']);
376 376
 			}
377 377
 
378 378
 			// close wrap
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 *
393 393
 	 * @return string
394 394
 	 */
395
-	public static function wrap( $args = array() ) {
395
+	public static function wrap($args = array()) {
396 396
 		$defaults = array(
397 397
 			'type'                     => 'div',
398 398
 			'class'                    => 'form-group',
@@ -409,31 +409,31 @@  discard block
 block discarded – undo
409 409
 		/**
410 410
 		 * Parse incoming $args into an array and merge it with $defaults
411 411
 		 */
412
-		$args   = wp_parse_args( $args, $defaults );
412
+		$args   = wp_parse_args($args, $defaults);
413 413
 		$output = '';
414
-		if ( $args['type'] ) {
414
+		if ($args['type']) {
415 415
 
416 416
 			// open
417
-			$output .= '<' . sanitize_html_class( $args['type'] );
417
+			$output .= '<' . sanitize_html_class($args['type']);
418 418
 
419 419
 			// element require
420
-			if ( ! empty( $args['element_require'] ) ) {
421
-				$output .= AUI_Component_Helper::element_require( $args['element_require'] );
420
+			if (!empty($args['element_require'])) {
421
+				$output .= AUI_Component_Helper::element_require($args['element_require']);
422 422
 				$args['class'] .= " aui-conditional-field";
423 423
 			}
424 424
 
425 425
 			// argument_id
426
-			if ( ! empty( $args['argument_id'] ) ) {
427
-				$output .= ' data-argument="' . esc_attr( $args['argument_id'] ) . '"';
426
+			if (!empty($args['argument_id'])) {
427
+				$output .= ' data-argument="' . esc_attr($args['argument_id']) . '"';
428 428
 			}
429 429
 
430 430
 			// class
431
-			$class = ! empty( $args['class'] ) ? AUI_Component_Helper::esc_classes( $args['class'] ) : '';
431
+			$class = !empty($args['class']) ? AUI_Component_Helper::esc_classes($args['class']) : '';
432 432
 			$output .= ' class="' . $class . '" ';
433 433
 
434 434
 			// Attributes
435
-			if ( ! empty( $args['wrap_attributes'] ) ) {
436
-				$output .= AUI_Component_Helper::extra_attributes( $args['wrap_attributes'] );
435
+			if (!empty($args['wrap_attributes'])) {
436
+				$output .= AUI_Component_Helper::extra_attributes($args['wrap_attributes']);
437 437
 			}
438 438
 
439 439
 			// close wrap
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
 
442 442
 
443 443
 			// Input group left
444
-			if ( ! empty( $args['input_group_left'] ) ) {
445
-				$position_class   = ! empty( $args['input_group_left_inside'] ) ? 'position-absolute h-100' : '';
446
-				$input_group_left = strpos( $args['input_group_left'], '<' ) !== false ? $args['input_group_left'] : '<span class="input-group-text">' . $args['input_group_left'] . '</span>';
444
+			if (!empty($args['input_group_left'])) {
445
+				$position_class   = !empty($args['input_group_left_inside']) ? 'position-absolute h-100' : '';
446
+				$input_group_left = strpos($args['input_group_left'], '<') !== false ? $args['input_group_left'] : '<span class="input-group-text">' . $args['input_group_left'] . '</span>';
447 447
 				$output .= '<div class="input-group-prepend ' . $position_class . '">' . $input_group_left . '</div>';
448 448
 			}
449 449
 
@@ -451,15 +451,15 @@  discard block
 block discarded – undo
451 451
 			$output .= $args['content'];
452 452
 
453 453
 			// Input group right
454
-			if ( ! empty( $args['input_group_right'] ) ) {
455
-				$position_class    = ! empty( $args['input_group_left_inside'] ) ? 'position-absolute h-100' : '';
456
-				$input_group_right = strpos( $args['input_group_right'], '<' ) !== false ? $args['input_group_right'] : '<span class="input-group-text">' . $args['input_group_right'] . '</span>';
454
+			if (!empty($args['input_group_right'])) {
455
+				$position_class    = !empty($args['input_group_left_inside']) ? 'position-absolute h-100' : '';
456
+				$input_group_right = strpos($args['input_group_right'], '<') !== false ? $args['input_group_right'] : '<span class="input-group-text">' . $args['input_group_right'] . '</span>';
457 457
 				$output .= '<div class="input-group-append ' . $position_class . '">' . $input_group_right . '</div>';
458 458
 			}
459 459
 
460 460
 
461 461
 			// close wrap
462
-			$output .= '</' . sanitize_html_class( $args['type'] ) . '>';
462
+			$output .= '</' . sanitize_html_class($args['type']) . '>';
463 463
 
464 464
 
465 465
 		} else {
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 	 *
477 477
 	 * @return string The rendered component.
478 478
 	 */
479
-	public static function textarea( $args = array() ) {
479
+	public static function textarea($args = array()) {
480 480
 		$defaults = array(
481 481
 			'name'               => '',
482 482
 			'class'              => '',
@@ -510,28 +510,28 @@  discard block
 block discarded – undo
510 510
 		/**
511 511
 		 * Parse incoming $args into an array and merge it with $defaults
512 512
 		 */
513
-		$args   = wp_parse_args( $args, $defaults );
513
+		$args   = wp_parse_args($args, $defaults);
514 514
 		$output = '';
515 515
 
516 516
 		// hidden label option needs to be empty
517 517
 		$args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
518 518
 
519 519
 		// floating labels don't work with wysiwyg so set it as top
520
-		if ( $args['label_type'] == 'floating' && ! empty( $args['wysiwyg'] ) ) {
520
+		if ($args['label_type'] == 'floating' && !empty($args['wysiwyg'])) {
521 521
 			$args['label_type'] = 'top';
522 522
 		}
523 523
 
524 524
 		$label_after = $args['label_after'];
525 525
 
526 526
 		// floating labels need label after
527
-		if ( $args['label_type'] == 'floating' && empty( $args['wysiwyg'] ) ) {
527
+		if ($args['label_type'] == 'floating' && empty($args['wysiwyg'])) {
528 528
 			$label_after         = true;
529 529
 			$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
530 530
 		}
531 531
 
532 532
 		// label
533
-		if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) {
534
-		} elseif ( ! empty( $args['label'] ) && ! $label_after ) {
533
+		if (!empty($args['label']) && is_array($args['label'])) {
534
+		} elseif (!empty($args['label']) && !$label_after) {
535 535
 			$label_args = array(
536 536
 				'title'      => $args['label'],
537 537
 				'for'        => $args['id'],
@@ -539,34 +539,34 @@  discard block
 block discarded – undo
539 539
 				'label_type' => $args['label_type'],
540 540
 				'label_col'  => $args['label_col']
541 541
 			);
542
-			$output .= self::label( $label_args );
542
+			$output .= self::label($label_args);
543 543
 		}
544 544
 
545 545
 		// maybe horizontal label
546
-		if ( $args['label_type'] == 'horizontal' ) {
547
-			$input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' );
546
+		if ($args['label_type'] == 'horizontal') {
547
+			$input_col = AUI_Component_Helper::get_column_class($args['label_col'], 'input');
548 548
 			$output .= '<div class="' . $input_col . '">';
549 549
 		}
550 550
 
551
-		if ( ! empty( $args['wysiwyg'] ) ) {
551
+		if (!empty($args['wysiwyg'])) {
552 552
 			ob_start();
553 553
 			$content   = $args['value'];
554
-			$editor_id = ! empty( $args['id'] ) ? sanitize_html_class( $args['id'] ) : 'wp_editor';
554
+			$editor_id = !empty($args['id']) ? sanitize_html_class($args['id']) : 'wp_editor';
555 555
 			$settings  = array(
556
-				'textarea_rows' => ! empty( absint( $args['rows'] ) ) ? absint( $args['rows'] ) : 4,
556
+				'textarea_rows' => !empty(absint($args['rows'])) ? absint($args['rows']) : 4,
557 557
 				'quicktags'     => false,
558 558
 				'media_buttons' => false,
559 559
 				'editor_class'  => 'form-control',
560
-				'textarea_name' => ! empty( $args['name'] ) ? sanitize_html_class( $args['name'] ) : sanitize_html_class( $args['id'] ),
560
+				'textarea_name' => !empty($args['name']) ? sanitize_html_class($args['name']) : sanitize_html_class($args['id']),
561 561
 				'teeny'         => true,
562 562
 			);
563 563
 
564 564
 			// maybe set settings if array
565
-			if ( is_array( $args['wysiwyg'] ) ) {
566
-				$settings = wp_parse_args( $args['wysiwyg'], $settings );
565
+			if (is_array($args['wysiwyg'])) {
566
+				$settings = wp_parse_args($args['wysiwyg'], $settings);
567 567
 			}
568 568
 
569
-			wp_editor( $content, $editor_id, $settings );
569
+			wp_editor($content, $editor_id, $settings);
570 570
 			$output .= ob_get_clean();
571 571
 		} else {
572 572
 
@@ -574,65 +574,65 @@  discard block
 block discarded – undo
574 574
 			$output .= '<textarea ';
575 575
 
576 576
 			// name
577
-			if ( ! empty( $args['name'] ) ) {
578
-				$output .= ' name="' . esc_attr( $args['name'] ) . '" ';
577
+			if (!empty($args['name'])) {
578
+				$output .= ' name="' . esc_attr($args['name']) . '" ';
579 579
 			}
580 580
 
581 581
 			// id
582
-			if ( ! empty( $args['id'] ) ) {
583
-				$output .= ' id="' . sanitize_html_class( $args['id'] ) . '" ';
582
+			if (!empty($args['id'])) {
583
+				$output .= ' id="' . sanitize_html_class($args['id']) . '" ';
584 584
 			}
585 585
 
586 586
 			// placeholder
587
-			if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] ) {
588
-				$output .= ' placeholder="' . esc_attr( $args['placeholder'] ) . '" ';
587
+			if (isset($args['placeholder']) && '' != $args['placeholder']) {
588
+				$output .= ' placeholder="' . esc_attr($args['placeholder']) . '" ';
589 589
 			}
590 590
 
591 591
 			// title
592
-			if ( ! empty( $args['title'] ) ) {
593
-				$output .= ' title="' . esc_attr( $args['title'] ) . '" ';
592
+			if (!empty($args['title'])) {
593
+				$output .= ' title="' . esc_attr($args['title']) . '" ';
594 594
 			}
595 595
 
596 596
 			// validation text
597
-			if ( ! empty( $args['validation_text'] ) ) {
598
-				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr( $args['validation_text'] ) . '\')" ';
597
+			if (!empty($args['validation_text'])) {
598
+				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr($args['validation_text']) . '\')" ';
599 599
 				$output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
600 600
 			}
601 601
 
602 602
 			// validation_pattern
603
-			if ( ! empty( $args['validation_pattern'] ) ) {
604
-				$output .= ' pattern="' . esc_attr( $args['validation_pattern'] ) . '" ';
603
+			if (!empty($args['validation_pattern'])) {
604
+				$output .= ' pattern="' . esc_attr($args['validation_pattern']) . '" ';
605 605
 			}
606 606
 
607 607
 			// required
608
-			if ( ! empty( $args['required'] ) ) {
608
+			if (!empty($args['required'])) {
609 609
 				$output .= ' required ';
610 610
 			}
611 611
 
612 612
 			// rows
613
-			if ( ! empty( $args['rows'] ) ) {
614
-				$output .= ' rows="' . absint( $args['rows'] ) . '" ';
613
+			if (!empty($args['rows'])) {
614
+				$output .= ' rows="' . absint($args['rows']) . '" ';
615 615
 			}
616 616
 
617 617
 
618 618
 			// class
619
-			$class = ! empty( $args['class'] ) ? $args['class'] : '';
619
+			$class = !empty($args['class']) ? $args['class'] : '';
620 620
 			$output .= ' class="form-control ' . $class . '" ';
621 621
 
622 622
 			// extra attributes
623
-			if ( ! empty( $args['extra_attributes'] ) ) {
624
-				$output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
623
+			if (!empty($args['extra_attributes'])) {
624
+				$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
625 625
 			}
626 626
 
627 627
 			// close tag
628 628
 			$output .= ' >';
629 629
 
630 630
 			// value
631
-			if ( ! empty( $args['value'] ) ) {
632
-				if ( ! empty( $args['allow_tags'] ) ) {
633
-					$output .= AUI_Component_Helper::sanitize_html_field( $args['value'], $args ); // Sanitize HTML.
631
+			if (!empty($args['value'])) {
632
+				if (!empty($args['allow_tags'])) {
633
+					$output .= AUI_Component_Helper::sanitize_html_field($args['value'], $args); // Sanitize HTML.
634 634
 				} else {
635
-					$output .= sanitize_textarea_field( $args['value'] );
635
+					$output .= sanitize_textarea_field($args['value']);
636 636
 				}
637 637
 			}
638 638
 
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 
642 642
 		}
643 643
 
644
-		if ( ! empty( $args['label'] ) && $label_after ) {
644
+		if (!empty($args['label']) && $label_after) {
645 645
 			$label_args = array(
646 646
 				'title'      => $args['label'],
647 647
 				'for'        => $args['id'],
@@ -649,32 +649,32 @@  discard block
 block discarded – undo
649 649
 				'label_type' => $args['label_type'],
650 650
 				'label_col'  => $args['label_col']
651 651
 			);
652
-			$output .= self::label( $label_args );
652
+			$output .= self::label($label_args);
653 653
 		}
654 654
 
655 655
 		// help text
656
-		if ( ! empty( $args['help_text'] ) ) {
657
-			$output .= AUI_Component_Helper::help_text( $args['help_text'] );
656
+		if (!empty($args['help_text'])) {
657
+			$output .= AUI_Component_Helper::help_text($args['help_text']);
658 658
 		}
659 659
 
660 660
 		// maybe horizontal label
661
-		if ( $args['label_type'] == 'horizontal' ) {
661
+		if ($args['label_type'] == 'horizontal') {
662 662
 			$output .= '</div>';
663 663
 		}
664 664
 
665 665
 
666 666
 		// wrap
667
-		if ( ! $args['no_wrap'] ) {
667
+		if (!$args['no_wrap']) {
668 668
 			$form_group_class = $args['label_type'] == 'floating' ? 'form-label-group' : 'form-group';
669 669
 			$wrap_class       = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class;
670
-			$wrap_class       = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
671
-			$output           = self::wrap( array(
670
+			$wrap_class       = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
671
+			$output           = self::wrap(array(
672 672
 				'content'         => $output,
673 673
 				'class'           => $wrap_class,
674 674
 				'element_require' => $args['element_require'],
675 675
 				'argument_id'     => $args['id'],
676 676
 				'wrap_attributes' => $args['wrap_attributes'],
677
-			) );
677
+			));
678 678
 		}
679 679
 
680 680
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 	 *
689 689
 	 * @return string The rendered component.
690 690
 	 */
691
-	public static function select( $args = array() ) {
691
+	public static function select($args = array()) {
692 692
 		$defaults = array(
693 693
 			'class'            => '',
694 694
 			'wrap_class'       => '',
@@ -725,11 +725,11 @@  discard block
 block discarded – undo
725 725
 		/**
726 726
 		 * Parse incoming $args into an array and merge it with $defaults
727 727
 		 */
728
-		$args   = wp_parse_args( $args, $defaults );
728
+		$args   = wp_parse_args($args, $defaults);
729 729
 		$output = '';
730 730
 
731 731
 		// for now lets hide floating labels
732
-		if ( $args['label_type'] == 'floating' ) {
732
+		if ($args['label_type'] == 'floating') {
733 733
 			$args['label_type'] = 'hidden';
734 734
 		}
735 735
 
@@ -740,31 +740,31 @@  discard block
 block discarded – undo
740 740
 		$label_after = $args['label_after'];
741 741
 
742 742
 		// floating labels need label after
743
-		if ( $args['label_type'] == 'floating' ) {
743
+		if ($args['label_type'] == 'floating') {
744 744
 			$label_after         = true;
745 745
 			$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
746 746
 		}
747 747
 
748 748
 		// Maybe setup select2
749 749
 		$is_select2 = false;
750
-		if ( ! empty( $args['select2'] ) ) {
750
+		if (!empty($args['select2'])) {
751 751
 			$args['class'] .= ' aui-select2';
752 752
 			$is_select2 = true;
753
-		} elseif ( strpos( $args['class'], 'aui-select2' ) !== false ) {
753
+		} elseif (strpos($args['class'], 'aui-select2') !== false) {
754 754
 			$is_select2 = true;
755 755
 		}
756 756
 
757 757
 		// select2 tags
758
-		if ( ! empty( $args['select2'] ) && $args['select2'] === 'tags' ) { // triple equals needed here for some reason
758
+		if (!empty($args['select2']) && $args['select2'] === 'tags') { // triple equals needed here for some reason
759 759
 			$args['data-tags']             = 'true';
760 760
 			$args['data-token-separators'] = "[',']";
761 761
 			$args['multiple']              = true;
762 762
 		}
763 763
 
764 764
 		// select2 placeholder
765
-		if ( $is_select2 && isset( $args['placeholder'] ) && '' != $args['placeholder'] && empty( $args['data-placeholder'] ) ) {
766
-			$args['data-placeholder'] = esc_attr( $args['placeholder'] );
767
-			$args['data-allow-clear'] = isset( $args['data-allow-clear'] ) ? (bool) $args['data-allow-clear'] : true;
765
+		if ($is_select2 && isset($args['placeholder']) && '' != $args['placeholder'] && empty($args['data-placeholder'])) {
766
+			$args['data-placeholder'] = esc_attr($args['placeholder']);
767
+			$args['data-allow-clear'] = isset($args['data-allow-clear']) ? (bool) $args['data-allow-clear'] : true;
768 768
 		}
769 769
 
770 770
 
@@ -776,61 +776,61 @@  discard block
 block discarded – undo
776 776
 //		}
777 777
 
778 778
 		// Set hidden input to save empty value for multiselect.
779
-		if ( ! empty( $args['multiple'] ) && ! empty( $args['name'] ) ) {
780
-			$output .= '<input type="hidden" ' . AUI_Component_Helper::name( $args['name'] ) . ' value=""/>';
779
+		if (!empty($args['multiple']) && !empty($args['name'])) {
780
+			$output .= '<input type="hidden" ' . AUI_Component_Helper::name($args['name']) . ' value=""/>';
781 781
 		}
782 782
 
783 783
 		// open/type
784 784
 		$output .= '<select ';
785 785
 
786 786
 		// style
787
-		if ( $is_select2 && !($args['input_group_left'] || $args['input_group_right'])) {
787
+		if ($is_select2 && !($args['input_group_left'] || $args['input_group_right'])) {
788 788
 			$output .= " style='width:100%;' ";
789 789
 		}
790 790
 
791 791
 		// element require
792
-		if ( ! empty( $args['element_require'] ) ) {
793
-			$output .= AUI_Component_Helper::element_require( $args['element_require'] );
792
+		if (!empty($args['element_require'])) {
793
+			$output .= AUI_Component_Helper::element_require($args['element_require']);
794 794
 			$args['class'] .= " aui-conditional-field";
795 795
 		}
796 796
 
797 797
 		// class
798
-		$class = ! empty( $args['class'] ) ? $args['class'] : '';
799
-		$output .= AUI_Component_Helper::class_attr( 'custom-select ' . $class );
798
+		$class = !empty($args['class']) ? $args['class'] : '';
799
+		$output .= AUI_Component_Helper::class_attr('custom-select ' . $class);
800 800
 
801 801
 		// name
802
-		if ( ! empty( $args['name'] ) ) {
803
-			$output .= AUI_Component_Helper::name( $args['name'], $args['multiple'] );
802
+		if (!empty($args['name'])) {
803
+			$output .= AUI_Component_Helper::name($args['name'], $args['multiple']);
804 804
 		}
805 805
 
806 806
 		// id
807
-		if ( ! empty( $args['id'] ) ) {
808
-			$output .= AUI_Component_Helper::id( $args['id'] );
807
+		if (!empty($args['id'])) {
808
+			$output .= AUI_Component_Helper::id($args['id']);
809 809
 		}
810 810
 
811 811
 		// title
812
-		if ( ! empty( $args['title'] ) ) {
813
-			$output .= AUI_Component_Helper::title( $args['title'] );
812
+		if (!empty($args['title'])) {
813
+			$output .= AUI_Component_Helper::title($args['title']);
814 814
 		}
815 815
 
816 816
 		// data-attributes
817
-		$output .= AUI_Component_Helper::data_attributes( $args );
817
+		$output .= AUI_Component_Helper::data_attributes($args);
818 818
 
819 819
 		// aria-attributes
820
-		$output .= AUI_Component_Helper::aria_attributes( $args );
820
+		$output .= AUI_Component_Helper::aria_attributes($args);
821 821
 
822 822
 		// extra attributes
823
-		if ( ! empty( $args['extra_attributes'] ) ) {
824
-			$output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
823
+		if (!empty($args['extra_attributes'])) {
824
+			$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
825 825
 		}
826 826
 
827 827
 		// required
828
-		if ( ! empty( $args['required'] ) ) {
828
+		if (!empty($args['required'])) {
829 829
 			$output .= ' required ';
830 830
 		}
831 831
 
832 832
 		// multiple
833
-		if ( ! empty( $args['multiple'] ) ) {
833
+		if (!empty($args['multiple'])) {
834 834
 			$output .= ' multiple ';
835 835
 		}
836 836
 
@@ -838,46 +838,46 @@  discard block
 block discarded – undo
838 838
 		$output .= ' >';
839 839
 
840 840
 		// placeholder
841
-		if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] && ! $is_select2 ) {
842
-			$output .= '<option value="" disabled selected hidden>' . esc_attr( $args['placeholder'] ) . '</option>';
843
-		} elseif ( $is_select2 && ! empty( $args['placeholder'] ) ) {
841
+		if (isset($args['placeholder']) && '' != $args['placeholder'] && !$is_select2) {
842
+			$output .= '<option value="" disabled selected hidden>' . esc_attr($args['placeholder']) . '</option>';
843
+		} elseif ($is_select2 && !empty($args['placeholder'])) {
844 844
 			$output .= "<option></option>"; // select2 needs an empty select to fill the placeholder
845 845
 		}
846 846
 
847 847
 		// Options
848
-		if ( ! empty( $args['options'] ) ) {
848
+		if (!empty($args['options'])) {
849 849
 
850
-			if ( ! is_array( $args['options'] ) ) {
850
+			if (!is_array($args['options'])) {
851 851
 				$output .= $args['options']; // not the preferred way but an option
852 852
 			} else {
853
-				foreach ( $args['options'] as $val => $name ) {
853
+				foreach ($args['options'] as $val => $name) {
854 854
 					$selected = '';
855
-					if ( is_array( $name ) ) {
856
-						if ( isset( $name['optgroup'] ) && ( $name['optgroup'] == 'start' || $name['optgroup'] == 'end' ) ) {
857
-							$option_label = isset( $name['label'] ) ? $name['label'] : '';
855
+					if (is_array($name)) {
856
+						if (isset($name['optgroup']) && ($name['optgroup'] == 'start' || $name['optgroup'] == 'end')) {
857
+							$option_label = isset($name['label']) ? $name['label'] : '';
858 858
 
859
-							$output .= $name['optgroup'] == 'start' ? '<optgroup label="' . esc_attr( $option_label ) . '">' : '</optgroup>';
859
+							$output .= $name['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
860 860
 						} else {
861
-							$option_label = isset( $name['label'] ) ? $name['label'] : '';
862
-							$option_value = isset( $name['value'] ) ? $name['value'] : '';
863
-							$extra_attributes = !empty($name['extra_attributes']) ? AUI_Component_Helper::extra_attributes( $name['extra_attributes'] ) : '';
864
-							if ( ! empty( $args['multiple'] ) && ! empty( $args['value'] ) && is_array( $args['value'] ) ) {
865
-								$selected = in_array( $option_value, stripslashes_deep( $args['value'] ) ) ? "selected" : "";
866
-							} elseif ( ! empty( $args['value'] ) ) {
867
-								$selected = selected( $option_value, stripslashes_deep( $args['value'] ), false );
861
+							$option_label = isset($name['label']) ? $name['label'] : '';
862
+							$option_value = isset($name['value']) ? $name['value'] : '';
863
+							$extra_attributes = !empty($name['extra_attributes']) ? AUI_Component_Helper::extra_attributes($name['extra_attributes']) : '';
864
+							if (!empty($args['multiple']) && !empty($args['value']) && is_array($args['value'])) {
865
+								$selected = in_array($option_value, stripslashes_deep($args['value'])) ? "selected" : "";
866
+							} elseif (!empty($args['value'])) {
867
+								$selected = selected($option_value, stripslashes_deep($args['value']), false);
868 868
 							}
869 869
 
870
-							$output .= '<option value="' . esc_attr( $option_value ) . '" ' . $selected . ' '.$extra_attributes .'>' . $option_label . '</option>';
870
+							$output .= '<option value="' . esc_attr($option_value) . '" ' . $selected . ' ' . $extra_attributes . '>' . $option_label . '</option>';
871 871
 						}
872 872
 					} else {
873
-						if ( ! empty( $args['value'] ) ) {
874
-							if ( is_array( $args['value'] ) ) {
875
-								$selected = in_array( $val, $args['value'] ) ? 'selected="selected"' : '';
876
-							} elseif ( ! empty( $args['value'] ) ) {
877
-								$selected = selected( $args['value'], $val, false );
873
+						if (!empty($args['value'])) {
874
+							if (is_array($args['value'])) {
875
+								$selected = in_array($val, $args['value']) ? 'selected="selected"' : '';
876
+							} elseif (!empty($args['value'])) {
877
+								$selected = selected($args['value'], $val, false);
878 878
 							}
879 879
 						}
880
-						$output .= '<option value="' . esc_attr( $val ) . '" ' . $selected . '>' . esc_attr( $name ) . '</option>';
880
+						$output .= '<option value="' . esc_attr($val) . '" ' . $selected . '>' . esc_attr($name) . '</option>';
881 881
 					}
882 882
 				}
883 883
 			}
@@ -890,8 +890,8 @@  discard block
 block discarded – undo
890 890
 		$label = '';
891 891
 		$help_text = '';
892 892
 		// label
893
-		if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) {
894
-		} elseif ( ! empty( $args['label'] ) && ! $label_after ) {
893
+		if (!empty($args['label']) && is_array($args['label'])) {
894
+		} elseif (!empty($args['label']) && !$label_after) {
895 895
 			$label_args = array(
896 896
 				'title'      => $args['label'],
897 897
 				'for'        => $args['id'],
@@ -899,49 +899,49 @@  discard block
 block discarded – undo
899 899
 				'label_type' => $args['label_type'],
900 900
 				'label_col'  => $args['label_col']
901 901
 			);
902
-			$label = self::label( $label_args );
902
+			$label = self::label($label_args);
903 903
 		}
904 904
 
905 905
 		// help text
906
-		if ( ! empty( $args['help_text'] ) ) {
907
-			$help_text = AUI_Component_Helper::help_text( $args['help_text'] );
906
+		if (!empty($args['help_text'])) {
907
+			$help_text = AUI_Component_Helper::help_text($args['help_text']);
908 908
 		}
909 909
 
910 910
 		// input group wraps
911
-		if ( $args['input_group_left'] || $args['input_group_right'] ) {
912
-			$w100 = strpos( $args['class'], 'w-100' ) !== false ? ' w-100' : '';
913
-			if ( $args['input_group_left'] ) {
914
-				$output = self::wrap( array(
911
+		if ($args['input_group_left'] || $args['input_group_right']) {
912
+			$w100 = strpos($args['class'], 'w-100') !== false ? ' w-100' : '';
913
+			if ($args['input_group_left']) {
914
+				$output = self::wrap(array(
915 915
 					'content'                 => $output,
916 916
 					'class'                   => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
917 917
 					'input_group_left'        => $args['input_group_left'],
918 918
 					'input_group_left_inside' => $args['input_group_left_inside']
919
-				) );
919
+				));
920 920
 			}
921
-			if ( $args['input_group_right'] ) {
922
-				$output = self::wrap( array(
921
+			if ($args['input_group_right']) {
922
+				$output = self::wrap(array(
923 923
 					'content'                  => $output,
924 924
 					'class'                    => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
925 925
 					'input_group_right'        => $args['input_group_right'],
926 926
 					'input_group_right_inside' => $args['input_group_right_inside']
927
-				) );
927
+				));
928 928
 			}
929 929
 
930 930
 		}
931 931
 
932
-		if ( ! $label_after ) {
932
+		if (!$label_after) {
933 933
 			$output .= $help_text;
934 934
 		}
935 935
 
936 936
 
937
-		if ( $args['label_type'] == 'horizontal' ) {
938
-			$output = self::wrap( array(
937
+		if ($args['label_type'] == 'horizontal') {
938
+			$output = self::wrap(array(
939 939
 				'content' => $output,
940
-				'class'   => AUI_Component_Helper::get_column_class( $args['label_col'], 'input' )
941
-			) );
940
+				'class'   => AUI_Component_Helper::get_column_class($args['label_col'], 'input')
941
+			));
942 942
 		}
943 943
 
944
-		if ( ! $label_after ) {
944
+		if (!$label_after) {
945 945
 			$output = $label . $output;
946 946
 		}
947 947
 
@@ -952,16 +952,16 @@  discard block
 block discarded – undo
952 952
 
953 953
 
954 954
 		// wrap
955
-		if ( ! $args['no_wrap'] ) {
955
+		if (!$args['no_wrap']) {
956 956
 			$wrap_class = $args['label_type'] == 'horizontal' ? 'form-group row' : 'form-group';
957
-			$wrap_class = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
958
-			$output     = self::wrap( array(
957
+			$wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
958
+			$output     = self::wrap(array(
959 959
 				'content'         => $output,
960 960
 				'class'           => $wrap_class,
961 961
 				'element_require' => $args['element_require'],
962 962
 				'argument_id'     => $args['id'],
963 963
 				'wrap_attributes' => $args['wrap_attributes'],
964
-			) );
964
+			));
965 965
 		}
966 966
 
967 967
 
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
 	 *
976 976
 	 * @return string The rendered component.
977 977
 	 */
978
-	public static function radio( $args = array() ) {
978
+	public static function radio($args = array()) {
979 979
 		$defaults = array(
980 980
 			'class'            => '',
981 981
 			'wrap_class'       => '',
@@ -1005,10 +1005,10 @@  discard block
 block discarded – undo
1005 1005
 		/**
1006 1006
 		 * Parse incoming $args into an array and merge it with $defaults
1007 1007
 		 */
1008
-		$args = wp_parse_args( $args, $defaults );
1008
+		$args = wp_parse_args($args, $defaults);
1009 1009
 
1010 1010
 		// for now lets use horizontal for floating
1011
-		if ( $args['label_type'] == 'floating' ) {
1011
+		if ($args['label_type'] == 'floating') {
1012 1012
 			$args['label_type'] = 'horizontal';
1013 1013
 		}
1014 1014
 
@@ -1023,47 +1023,47 @@  discard block
 block discarded – undo
1023 1023
 
1024 1024
 
1025 1025
 		// label before
1026
-		if ( ! empty( $args['label'] ) ) {
1027
-			$output .= self::label( $label_args, 'radio' );
1026
+		if (!empty($args['label'])) {
1027
+			$output .= self::label($label_args, 'radio');
1028 1028
 		}
1029 1029
 
1030 1030
 		// maybe horizontal label
1031
-		if ( $args['label_type'] == 'horizontal' ) {
1032
-			$input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' );
1031
+		if ($args['label_type'] == 'horizontal') {
1032
+			$input_col = AUI_Component_Helper::get_column_class($args['label_col'], 'input');
1033 1033
 			$output .= '<div class="' . $input_col . '">';
1034 1034
 		}
1035 1035
 
1036
-		if ( ! empty( $args['options'] ) ) {
1036
+		if (!empty($args['options'])) {
1037 1037
 			$count = 0;
1038
-			foreach ( $args['options'] as $value => $label ) {
1038
+			foreach ($args['options'] as $value => $label) {
1039 1039
 				$option_args            = $args;
1040 1040
 				$option_args['value']   = $value;
1041 1041
 				$option_args['label']   = $label;
1042 1042
 				$option_args['checked'] = $value == $args['value'] ? true : false;
1043
-				$output .= self::radio_option( $option_args, $count );
1044
-				$count ++;
1043
+				$output .= self::radio_option($option_args, $count);
1044
+				$count++;
1045 1045
 			}
1046 1046
 		}
1047 1047
 
1048 1048
 		// help text
1049
-		$help_text = ! empty( $args['help_text'] ) ? AUI_Component_Helper::help_text( $args['help_text'] ) : '';
1049
+		$help_text = !empty($args['help_text']) ? AUI_Component_Helper::help_text($args['help_text']) : '';
1050 1050
 		$output .= $help_text;
1051 1051
 
1052 1052
 		// maybe horizontal label
1053
-		if ( $args['label_type'] == 'horizontal' ) {
1053
+		if ($args['label_type'] == 'horizontal') {
1054 1054
 			$output .= '</div>';
1055 1055
 		}
1056 1056
 
1057 1057
 		// wrap
1058 1058
 		$wrap_class = $args['label_type'] == 'horizontal' ? 'form-group row' : 'form-group';
1059
-		$wrap_class = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
1060
-		$output     = self::wrap( array(
1059
+		$wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
1060
+		$output     = self::wrap(array(
1061 1061
 			'content'         => $output,
1062 1062
 			'class'           => $wrap_class,
1063 1063
 			'element_require' => $args['element_require'],
1064 1064
 			'argument_id'     => $args['id'],
1065 1065
 			'wrap_attributes' => $args['wrap_attributes'],
1066
-		) );
1066
+		));
1067 1067
 
1068 1068
 
1069 1069
 		return $output;
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 	 *
1077 1077
 	 * @return string The rendered component.
1078 1078
 	 */
1079
-	public static function radio_option( $args = array(), $count = '' ) {
1079
+	public static function radio_option($args = array(), $count = '') {
1080 1080
 		$defaults = array(
1081 1081
 			'class'            => '',
1082 1082
 			'id'               => '',
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 		/**
1095 1095
 		 * Parse incoming $args into an array and merge it with $defaults
1096 1096
 		 */
1097
-		$args = wp_parse_args( $args, $defaults );
1097
+		$args = wp_parse_args($args, $defaults);
1098 1098
 
1099 1099
 		$output = '';
1100 1100
 
@@ -1105,43 +1105,43 @@  discard block
 block discarded – undo
1105 1105
 		$output .= ' class="form-check-input" ';
1106 1106
 
1107 1107
 		// name
1108
-		if ( ! empty( $args['name'] ) ) {
1109
-			$output .= AUI_Component_Helper::name( $args['name'] );
1108
+		if (!empty($args['name'])) {
1109
+			$output .= AUI_Component_Helper::name($args['name']);
1110 1110
 		}
1111 1111
 
1112 1112
 		// id
1113
-		if ( ! empty( $args['id'] ) ) {
1114
-			$output .= AUI_Component_Helper::id( $args['id'] . $count );
1113
+		if (!empty($args['id'])) {
1114
+			$output .= AUI_Component_Helper::id($args['id'] . $count);
1115 1115
 		}
1116 1116
 
1117 1117
 		// title
1118
-		if ( ! empty( $args['title'] ) ) {
1119
-			$output .= AUI_Component_Helper::title( $args['title'] );
1118
+		if (!empty($args['title'])) {
1119
+			$output .= AUI_Component_Helper::title($args['title']);
1120 1120
 		}
1121 1121
 
1122 1122
 		// value
1123
-		if ( isset( $args['value'] ) ) {
1124
-			$output .= AUI_Component_Helper::value( $args['value'] );
1123
+		if (isset($args['value'])) {
1124
+			$output .= AUI_Component_Helper::value($args['value']);
1125 1125
 		}
1126 1126
 
1127 1127
 		// checked, for radio and checkboxes
1128
-		if ( $args['checked'] ) {
1128
+		if ($args['checked']) {
1129 1129
 			$output .= ' checked ';
1130 1130
 		}
1131 1131
 
1132 1132
 		// data-attributes
1133
-		$output .= AUI_Component_Helper::data_attributes( $args );
1133
+		$output .= AUI_Component_Helper::data_attributes($args);
1134 1134
 
1135 1135
 		// aria-attributes
1136
-		$output .= AUI_Component_Helper::aria_attributes( $args );
1136
+		$output .= AUI_Component_Helper::aria_attributes($args);
1137 1137
 
1138 1138
 		// extra attributes
1139
-		if ( ! empty( $args['extra_attributes'] ) ) {
1140
-			$output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
1139
+		if (!empty($args['extra_attributes'])) {
1140
+			$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
1141 1141
 		}
1142 1142
 
1143 1143
 		// required
1144
-		if ( ! empty( $args['required'] ) ) {
1144
+		if (!empty($args['required'])) {
1145 1145
 			$output .= ' required ';
1146 1146
 		}
1147 1147
 
@@ -1149,38 +1149,38 @@  discard block
 block discarded – undo
1149 1149
 		$output .= ' >';
1150 1150
 
1151 1151
 		// label
1152
-		if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) {
1153
-		} elseif ( ! empty( $args['label'] ) ) {
1154
-			$output .= self::label( array(
1152
+		if (!empty($args['label']) && is_array($args['label'])) {
1153
+		} elseif (!empty($args['label'])) {
1154
+			$output .= self::label(array(
1155 1155
 				'title' => $args['label'],
1156 1156
 				'for'   => $args['id'] . $count,
1157 1157
 				'class' => 'form-check-label'
1158
-			), 'radio' );
1158
+			), 'radio');
1159 1159
 		}
1160 1160
 
1161 1161
 		// wrap
1162
-		if ( ! $args['no_wrap'] ) {
1162
+		if (!$args['no_wrap']) {
1163 1163
 			$wrap_class = $args['inline'] ? 'form-check form-check-inline' : 'form-check';
1164 1164
 
1165 1165
 			// Unique wrap class
1166 1166
 			$uniq_class = 'fwrap';
1167
-			if ( ! empty( $args['name'] ) ) {
1167
+			if (!empty($args['name'])) {
1168 1168
 				$uniq_class .= '-' . $args['name'];
1169
-			} else if ( ! empty( $args['id'] ) ) {
1169
+			} else if (!empty($args['id'])) {
1170 1170
 				$uniq_class .= '-' . $args['id'];
1171 1171
 			}
1172 1172
 
1173
-			if ( isset( $args['value'] ) || $args['value'] !== "" ) {
1173
+			if (isset($args['value']) || $args['value'] !== "") {
1174 1174
 				$uniq_class .= '-' . $args['value'];
1175 1175
 			} else {
1176 1176
 				$uniq_class .= '-' . $count;
1177 1177
 			}
1178
-			$wrap_class .= ' ' . sanitize_html_class( $uniq_class );
1178
+			$wrap_class .= ' ' . sanitize_html_class($uniq_class);
1179 1179
 
1180
-			$output = self::wrap( array(
1180
+			$output = self::wrap(array(
1181 1181
 				'content' => $output,
1182 1182
 				'class'   => $wrap_class
1183
-			) );
1183
+			));
1184 1184
 		}
1185 1185
 
1186 1186
 		return $output;
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@
 block discarded – undo
209 209
 						$help_text = '';
210 210
 						//$label_args['class'] .= ' d-inline ';
211 211
 						$args['wrap_class'] .= ' align-items-center ';
212
-					}else{
212
+					} else{
213 213
 
214 214
 					}
215 215
 
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/class-aui.php 1 patch
Indentation   +227 added lines, -227 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,231 +11,231 @@  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.63';
28
-
29
-	public static $options = null;
30
-
31
-	/**
32
-	 * There can be only one.
33
-	 *
34
-	 * @since 1.0.0
35
-	 * @return AUI|null
36
-	 */
37
-	public static function instance() {
38
-		if ( self::$instance == null ) {
39
-			self::$instance = new AUI();
40
-		}
41
-
42
-		return self::$instance;
43
-	}
44
-
45
-	/**
46
-	 * AUI constructor.
47
-	 *
48
-	 * @since 1.0.0
49
-	 */
50
-	private function __construct() {
51
-		if ( function_exists( "__autoload" ) ) {
52
-			spl_autoload_register( "__autoload" );
53
-		}
54
-		spl_autoload_register( array( $this, 'autoload' ) );
55
-
56
-		// load options
57
-		self::$options = get_option('aui_options');
58
-	}
59
-
60
-	/**
61
-	 * Autoload any components on the fly.
62
-	 *
63
-	 * @since 1.0.0
64
-	 *
65
-	 * @param $classname
66
-	 */
67
-	private function autoload( $classname ) {
68
-		$class     = str_replace( '_', '-', strtolower( $classname ) );
69
-		$file_path = trailingslashit( dirname( __FILE__ ) ) . "components/class-" . $class . '.php';
70
-		if ( $file_path && is_readable( $file_path ) ) {
71
-			include_once( $file_path );
72
-		}
73
-	}
74
-
75
-	/**
76
-	 * Get the AUI options.
77
-	 *
78
-	 * @param $option
79
-	 *
80
-	 * @return string|void
81
-	 */
82
-	public function get_option( $option ){
83
-		$result = isset(self::$options[$option]) ? esc_attr(self::$options[$option]) : '';
84
-
85
-		if ( ! $result && $option) {
86
-			if( $option == 'color_primary' ){
87
-				$result = AUI_PRIMARY_COLOR;
88
-			}elseif( $option == 'color_secondary' ){
89
-				$result = AUI_SECONDARY_COLOR;
90
-			}
91
-		}
92
-		return $result;
93
-	}
94
-
95
-	public function render( $items = array() ) {
96
-		$output = '';
97
-
98
-		if ( ! empty( $items ) ) {
99
-			foreach ( $items as $args ) {
100
-				$render = isset( $args['render'] ) ? $args['render'] : '';
101
-				if ( $render && method_exists( __CLASS__, $render ) ) {
102
-					$output .= $this->$render( $args );
103
-				}
104
-			}
105
-		}
106
-
107
-		return $output;
108
-	}
109
-
110
-	/**
111
-	 * Render and return a bootstrap alert component.
112
-	 *
113
-	 * @since 1.0.0
114
-	 *
115
-	 * @param array $args
116
-	 *
117
-	 * @return string The rendered component.
118
-	 */
119
-	public function alert( $args = array() ) {
120
-		return AUI_Component_Alert::get( $args );
121
-	}
122
-
123
-	/**
124
-	 * Render and return a bootstrap input component.
125
-	 *
126
-	 * @since 1.0.0
127
-	 *
128
-	 * @param array $args
129
-	 *
130
-	 * @return string The rendered component.
131
-	 */
132
-	public function input( $args = array() ) {
133
-		return AUI_Component_Input::input( $args );
134
-	}
135
-
136
-	/**
137
-	 * Render and return a bootstrap textarea component.
138
-	 *
139
-	 * @since 1.0.0
140
-	 *
141
-	 * @param array $args
142
-	 *
143
-	 * @return string The rendered component.
144
-	 */
145
-	public function textarea( $args = array() ) {
146
-		return AUI_Component_Input::textarea( $args );
147
-	}
148
-
149
-	/**
150
-	 * Render and return a bootstrap button component.
151
-	 *
152
-	 * @since 1.0.0
153
-	 *
154
-	 * @param array $args
155
-	 *
156
-	 * @return string The rendered component.
157
-	 */
158
-	public function button( $args = array() ) {
159
-		return AUI_Component_Button::get( $args );
160
-	}
161
-
162
-	/**
163
-	 * Render and return a bootstrap button component.
164
-	 *
165
-	 * @since 1.0.0
166
-	 *
167
-	 * @param array $args
168
-	 *
169
-	 * @return string The rendered component.
170
-	 */
171
-	public function badge( $args = array() ) {
172
-		$defaults = array(
173
-			'class' => 'badge badge-primary align-middle',
174
-		);
175
-
176
-		// maybe set type
177
-		if ( empty( $args['href'] ) ) {
178
-			$defaults['type'] = 'badge';
179
-		}
180
-
181
-		/**
182
-		 * Parse incoming $args into an array and merge it with $defaults
183
-		 */
184
-		$args = wp_parse_args( $args, $defaults );
185
-
186
-		return AUI_Component_Button::get( $args );
187
-	}
188
-
189
-	/**
190
-	 * Render and return a bootstrap dropdown component.
191
-	 *
192
-	 * @since 1.0.0
193
-	 *
194
-	 * @param array $args
195
-	 *
196
-	 * @return string The rendered component.
197
-	 */
198
-	public function dropdown( $args = array() ) {
199
-		return AUI_Component_Dropdown::get( $args );
200
-	}
201
-
202
-	/**
203
-	 * Render and return a bootstrap select component.
204
-	 *
205
-	 * @since 1.0.0
206
-	 *
207
-	 * @param array $args
208
-	 *
209
-	 * @return string The rendered component.
210
-	 */
211
-	public function select( $args = array() ) {
212
-		return AUI_Component_Input::select( $args );
213
-	}
214
-
215
-	/**
216
-	 * Render and return a bootstrap radio component.
217
-	 *
218
-	 * @since 1.0.0
219
-	 *
220
-	 * @param array $args
221
-	 *
222
-	 * @return string The rendered component.
223
-	 */
224
-	public function radio( $args = array() ) {
225
-		return AUI_Component_Input::radio( $args );
226
-	}
227
-
228
-	/**
229
-	 * Render and return a bootstrap pagination component.
230
-	 *
231
-	 * @since 1.0.0
232
-	 *
233
-	 * @param array $args
234
-	 *
235
-	 * @return string The rendered component.
236
-	 */
237
-	public function pagination( $args = array() ) {
238
-		return AUI_Component_Pagination::get( $args );
239
-	}
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.63';
28
+
29
+    public static $options = null;
30
+
31
+    /**
32
+     * There can be only one.
33
+     *
34
+     * @since 1.0.0
35
+     * @return AUI|null
36
+     */
37
+    public static function instance() {
38
+        if ( self::$instance == null ) {
39
+            self::$instance = new AUI();
40
+        }
41
+
42
+        return self::$instance;
43
+    }
44
+
45
+    /**
46
+     * AUI constructor.
47
+     *
48
+     * @since 1.0.0
49
+     */
50
+    private function __construct() {
51
+        if ( function_exists( "__autoload" ) ) {
52
+            spl_autoload_register( "__autoload" );
53
+        }
54
+        spl_autoload_register( array( $this, 'autoload' ) );
55
+
56
+        // load options
57
+        self::$options = get_option('aui_options');
58
+    }
59
+
60
+    /**
61
+     * Autoload any components on the fly.
62
+     *
63
+     * @since 1.0.0
64
+     *
65
+     * @param $classname
66
+     */
67
+    private function autoload( $classname ) {
68
+        $class     = str_replace( '_', '-', strtolower( $classname ) );
69
+        $file_path = trailingslashit( dirname( __FILE__ ) ) . "components/class-" . $class . '.php';
70
+        if ( $file_path && is_readable( $file_path ) ) {
71
+            include_once( $file_path );
72
+        }
73
+    }
74
+
75
+    /**
76
+     * Get the AUI options.
77
+     *
78
+     * @param $option
79
+     *
80
+     * @return string|void
81
+     */
82
+    public function get_option( $option ){
83
+        $result = isset(self::$options[$option]) ? esc_attr(self::$options[$option]) : '';
84
+
85
+        if ( ! $result && $option) {
86
+            if( $option == 'color_primary' ){
87
+                $result = AUI_PRIMARY_COLOR;
88
+            }elseif( $option == 'color_secondary' ){
89
+                $result = AUI_SECONDARY_COLOR;
90
+            }
91
+        }
92
+        return $result;
93
+    }
94
+
95
+    public function render( $items = array() ) {
96
+        $output = '';
97
+
98
+        if ( ! empty( $items ) ) {
99
+            foreach ( $items as $args ) {
100
+                $render = isset( $args['render'] ) ? $args['render'] : '';
101
+                if ( $render && method_exists( __CLASS__, $render ) ) {
102
+                    $output .= $this->$render( $args );
103
+                }
104
+            }
105
+        }
106
+
107
+        return $output;
108
+    }
109
+
110
+    /**
111
+     * Render and return a bootstrap alert component.
112
+     *
113
+     * @since 1.0.0
114
+     *
115
+     * @param array $args
116
+     *
117
+     * @return string The rendered component.
118
+     */
119
+    public function alert( $args = array() ) {
120
+        return AUI_Component_Alert::get( $args );
121
+    }
122
+
123
+    /**
124
+     * Render and return a bootstrap input component.
125
+     *
126
+     * @since 1.0.0
127
+     *
128
+     * @param array $args
129
+     *
130
+     * @return string The rendered component.
131
+     */
132
+    public function input( $args = array() ) {
133
+        return AUI_Component_Input::input( $args );
134
+    }
135
+
136
+    /**
137
+     * Render and return a bootstrap textarea component.
138
+     *
139
+     * @since 1.0.0
140
+     *
141
+     * @param array $args
142
+     *
143
+     * @return string The rendered component.
144
+     */
145
+    public function textarea( $args = array() ) {
146
+        return AUI_Component_Input::textarea( $args );
147
+    }
148
+
149
+    /**
150
+     * Render and return a bootstrap button component.
151
+     *
152
+     * @since 1.0.0
153
+     *
154
+     * @param array $args
155
+     *
156
+     * @return string The rendered component.
157
+     */
158
+    public function button( $args = array() ) {
159
+        return AUI_Component_Button::get( $args );
160
+    }
161
+
162
+    /**
163
+     * Render and return a bootstrap button component.
164
+     *
165
+     * @since 1.0.0
166
+     *
167
+     * @param array $args
168
+     *
169
+     * @return string The rendered component.
170
+     */
171
+    public function badge( $args = array() ) {
172
+        $defaults = array(
173
+            'class' => 'badge badge-primary align-middle',
174
+        );
175
+
176
+        // maybe set type
177
+        if ( empty( $args['href'] ) ) {
178
+            $defaults['type'] = 'badge';
179
+        }
180
+
181
+        /**
182
+         * Parse incoming $args into an array and merge it with $defaults
183
+         */
184
+        $args = wp_parse_args( $args, $defaults );
185
+
186
+        return AUI_Component_Button::get( $args );
187
+    }
188
+
189
+    /**
190
+     * Render and return a bootstrap dropdown component.
191
+     *
192
+     * @since 1.0.0
193
+     *
194
+     * @param array $args
195
+     *
196
+     * @return string The rendered component.
197
+     */
198
+    public function dropdown( $args = array() ) {
199
+        return AUI_Component_Dropdown::get( $args );
200
+    }
201
+
202
+    /**
203
+     * Render and return a bootstrap select component.
204
+     *
205
+     * @since 1.0.0
206
+     *
207
+     * @param array $args
208
+     *
209
+     * @return string The rendered component.
210
+     */
211
+    public function select( $args = array() ) {
212
+        return AUI_Component_Input::select( $args );
213
+    }
214
+
215
+    /**
216
+     * Render and return a bootstrap radio component.
217
+     *
218
+     * @since 1.0.0
219
+     *
220
+     * @param array $args
221
+     *
222
+     * @return string The rendered component.
223
+     */
224
+    public function radio( $args = array() ) {
225
+        return AUI_Component_Input::radio( $args );
226
+    }
227
+
228
+    /**
229
+     * Render and return a bootstrap pagination component.
230
+     *
231
+     * @since 1.0.0
232
+     *
233
+     * @param array $args
234
+     *
235
+     * @return string The rendered component.
236
+     */
237
+    public function pagination( $args = array() ) {
238
+        return AUI_Component_Pagination::get( $args );
239
+    }
240 240
 
241 241
 }
242 242
\ No newline at end of file
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/ayecode-ui-settings.php 2 patches
Indentation   +1221 added lines, -1221 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,275 +21,275 @@  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 = '0.1.63';
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.5.3";
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
-
103
-				self::$instance = new AyeCode_UI_Settings;
104
-
105
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
106
-
107
-				if ( is_admin() ) {
108
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
109
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
110
-
111
-					// Maybe show example page
112
-					add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
113
-				}
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 = '0.1.63';
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.5.3";
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
+
103
+                self::$instance = new AyeCode_UI_Settings;
104
+
105
+                add_action( 'init', array( self::$instance, 'init' ) ); // set settings
106
+
107
+                if ( is_admin() ) {
108
+                    add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
109
+                    add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
110
+
111
+                    // Maybe show example page
112
+                    add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
113
+                }
114 114
 
115
-				add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
115
+                add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
116 116
 
117
-				do_action( 'ayecode_ui_settings_loaded' );
118
-			}
117
+                do_action( 'ayecode_ui_settings_loaded' );
118
+            }
119 119
 
120
-			return self::$instance;
121
-		}
120
+            return self::$instance;
121
+        }
122 122
 
123
-		/**
124
-		 * Setup some constants.
125
-		 */
126
-		public function constants(){
127
-			define('AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be");
128
-			define('AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d');
129
-			if (!defined('AUI_PRIMARY_COLOR')) define('AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL);
130
-			if (!defined('AUI_SECONDARY_COLOR')) define('AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL);
131
-		}
123
+        /**
124
+         * Setup some constants.
125
+         */
126
+        public function constants(){
127
+            define('AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be");
128
+            define('AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d');
129
+            if (!defined('AUI_PRIMARY_COLOR')) define('AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL);
130
+            if (!defined('AUI_SECONDARY_COLOR')) define('AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL);
131
+        }
132 132
 
133
-		/**
134
-		 * Initiate the settings and add the required action hooks.
135
-		 */
136
-		public function init() {
137
-
138
-			// Maybe fix settings
139
-			if ( ! empty( $_REQUEST['aui-fix-admin'] ) && !empty($_REQUEST['nonce']) && wp_verify_nonce( $_REQUEST['nonce'], "aui-fix-admin" ) ) {
140
-				$db_settings = get_option( 'ayecode-ui-settings' );
141
-				if ( ! empty( $db_settings ) ) {
142
-					$db_settings['css_backend'] = 'compatibility';
143
-					$db_settings['js_backend'] = 'core-popper';
144
-					update_option( 'ayecode-ui-settings', $db_settings );
145
-					wp_safe_redirect(admin_url("options-general.php?page=ayecode-ui-settings&updated=true"));
146
-				}
147
-			}
133
+        /**
134
+         * Initiate the settings and add the required action hooks.
135
+         */
136
+        public function init() {
137
+
138
+            // Maybe fix settings
139
+            if ( ! empty( $_REQUEST['aui-fix-admin'] ) && !empty($_REQUEST['nonce']) && wp_verify_nonce( $_REQUEST['nonce'], "aui-fix-admin" ) ) {
140
+                $db_settings = get_option( 'ayecode-ui-settings' );
141
+                if ( ! empty( $db_settings ) ) {
142
+                    $db_settings['css_backend'] = 'compatibility';
143
+                    $db_settings['js_backend'] = 'core-popper';
144
+                    update_option( 'ayecode-ui-settings', $db_settings );
145
+                    wp_safe_redirect(admin_url("options-general.php?page=ayecode-ui-settings&updated=true"));
146
+                }
147
+            }
148 148
 
149
-			$this->constants();
150
-			$this->settings = $this->get_settings();
151
-			$this->url = $this->get_url();
149
+            $this->constants();
150
+            $this->settings = $this->get_settings();
151
+            $this->url = $this->get_url();
152
+
153
+            /**
154
+             * Maybe load CSS
155
+             *
156
+             * We load super early in case there is a theme version that might change the colors
157
+             */
158
+            if ( $this->settings['css'] ) {
159
+                $priority = $this->is_bs3_compat() ? 100 : 1;
160
+                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), $priority );
161
+            }
162
+            if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
163
+                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
164
+            }
152 165
 
153
-			/**
154
-			 * Maybe load CSS
155
-			 *
156
-			 * We load super early in case there is a theme version that might change the colors
157
-			 */
158
-			if ( $this->settings['css'] ) {
159
-				$priority = $this->is_bs3_compat() ? 100 : 1;
160
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), $priority );
161
-			}
162
-			if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
163
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
164
-			}
165
-
166
-			// maybe load JS
167
-			if ( $this->settings['js'] ) {
168
-				$priority = $this->is_bs3_compat() ? 100 : 1;
169
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority );
170
-			}
171
-			if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
172
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
173
-			}
174
-
175
-			// Maybe set the HTML font size
176
-			if ( $this->settings['html_font_size'] ) {
177
-				add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
178
-			}
179
-
180
-			// Maybe show backend style error
181
-			if( $this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper' ){
182
-				add_action( 'admin_notices', array( $this, 'show_admin_style_notice' ) );
183
-			}
166
+            // maybe load JS
167
+            if ( $this->settings['js'] ) {
168
+                $priority = $this->is_bs3_compat() ? 100 : 1;
169
+                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority );
170
+            }
171
+            if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
172
+                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
173
+            }
184 174
 
185
-		}
175
+            // Maybe set the HTML font size
176
+            if ( $this->settings['html_font_size'] ) {
177
+                add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
178
+            }
186 179
 
187
-		/**
188
-		 * Show admin notice if backend scripts not loaded.
189
-		 */
190
-		public function show_admin_style_notice(){
191
-			$fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=".wp_create_nonce('aui-fix-admin'));
192
-			$button = '<a href="'.esc_url($fix_url).'" class="button-primary">Fix Now</a>';
193
-			$message = __( '<b>Style Issue:</b> AyeCode UI is disable or set wrong.')." " .$button;
194
-			echo '<div class="notice notice-error aui-settings-error-notice"><p>'.$message.'</p></div>';
195
-		}
180
+            // Maybe show backend style error
181
+            if( $this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper' ){
182
+                add_action( 'admin_notices', array( $this, 'show_admin_style_notice' ) );
183
+            }
196 184
 
197
-		/**
198
-		 * Check if we should load the admin scripts or not.
199
-		 *
200
-		 * @return bool
201
-		 */
202
-		public function load_admin_scripts(){
203
-			$result = true;
204
-
205
-			// check if specifically disabled
206
-			if(!empty($this->settings['disable_admin'])){
207
-				$url_parts = explode("\n",$this->settings['disable_admin']);
208
-				foreach($url_parts as $part){
209
-					if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
210
-						return false; // return early, no point checking further
211
-					}
212
-				}
213
-			}
185
+        }
214 186
 
215
-			return $result;
216
-		}
187
+        /**
188
+         * Show admin notice if backend scripts not loaded.
189
+         */
190
+        public function show_admin_style_notice(){
191
+            $fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=".wp_create_nonce('aui-fix-admin'));
192
+            $button = '<a href="'.esc_url($fix_url).'" class="button-primary">Fix Now</a>';
193
+            $message = __( '<b>Style Issue:</b> AyeCode UI is disable or set wrong.')." " .$button;
194
+            echo '<div class="notice notice-error aui-settings-error-notice"><p>'.$message.'</p></div>';
195
+        }
217 196
 
218
-		/**
219
-		 * Add a html font size to the footer.
220
-		 */
221
-		public function html_font_size(){
222
-			$this->settings = $this->get_settings();
223
-			echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
224
-		}
197
+        /**
198
+         * Check if we should load the admin scripts or not.
199
+         *
200
+         * @return bool
201
+         */
202
+        public function load_admin_scripts(){
203
+            $result = true;
204
+
205
+            // check if specifically disabled
206
+            if(!empty($this->settings['disable_admin'])){
207
+                $url_parts = explode("\n",$this->settings['disable_admin']);
208
+                foreach($url_parts as $part){
209
+                    if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
210
+                        return false; // return early, no point checking further
211
+                    }
212
+                }
213
+            }
214
+
215
+            return $result;
216
+        }
217
+
218
+        /**
219
+         * Add a html font size to the footer.
220
+         */
221
+        public function html_font_size(){
222
+            $this->settings = $this->get_settings();
223
+            echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
224
+        }
225 225
 
226
-		/**
227
-		 * Check if the current admin screen should load scripts.
228
-		 * 
229
-		 * @return bool
230
-		 */
231
-		public function is_aui_screen(){
226
+        /**
227
+         * Check if the current admin screen should load scripts.
228
+         * 
229
+         * @return bool
230
+         */
231
+        public function is_aui_screen(){
232 232
 //			echo '###';exit;
233
-			$load = false;
234
-			// check if we should load or not
235
-			if ( is_admin() ) {
236
-				// Only enable on set pages
237
-				$aui_screens = array(
238
-					'page',
239
-					'post',
240
-					'settings_page_ayecode-ui-settings',
241
-					'appearance_page_gutenberg-widgets',
242
-					'widgets',
243
-					'ayecode-ui-settings',
244
-				);
245
-				$screen_ids = apply_filters( 'aui_screen_ids', $aui_screens );
246
-
247
-				$screen = get_current_screen();
233
+            $load = false;
234
+            // check if we should load or not
235
+            if ( is_admin() ) {
236
+                // Only enable on set pages
237
+                $aui_screens = array(
238
+                    'page',
239
+                    'post',
240
+                    'settings_page_ayecode-ui-settings',
241
+                    'appearance_page_gutenberg-widgets',
242
+                    'widgets',
243
+                    'ayecode-ui-settings',
244
+                );
245
+                $screen_ids = apply_filters( 'aui_screen_ids', $aui_screens );
246
+
247
+                $screen = get_current_screen();
248 248
 
249 249
 //				echo '###'.$screen->id;
250 250
 
251
-				// check if we are on a AUI screen
252
-				if ( $screen && in_array( $screen->id, $screen_ids ) ) {
253
-					$load = true;
254
-				}
251
+                // check if we are on a AUI screen
252
+                if ( $screen && in_array( $screen->id, $screen_ids ) ) {
253
+                    $load = true;
254
+                }
255 255
 
256
-				//load for widget previews in WP 5.8
257
-				if( !empty($_REQUEST['legacy-widget-preview'])){
258
-					$load = true;
259
-				}
260
-			}
256
+                //load for widget previews in WP 5.8
257
+                if( !empty($_REQUEST['legacy-widget-preview'])){
258
+                    $load = true;
259
+                }
260
+            }
261 261
 
262
-			return apply_filters( 'aui_load_on_admin' , $load );
263
-		}
262
+            return apply_filters( 'aui_load_on_admin' , $load );
263
+        }
264 264
 
265
-		/**
266
-		 * Adds the styles.
267
-		 */
268
-		public function enqueue_style() {
265
+        /**
266
+         * Adds the styles.
267
+         */
268
+        public function enqueue_style() {
269 269
 
270 270
 
271
-			if( is_admin() && !$this->is_aui_screen()){
272
-				// don't add wp-admin scripts if not requested to
273
-			}else{
274
-				$css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
271
+            if( is_admin() && !$this->is_aui_screen()){
272
+                // don't add wp-admin scripts if not requested to
273
+            }else{
274
+                $css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
275 275
 
276
-				$rtl = is_rtl() ? '-rtl' : '';
276
+                $rtl = is_rtl() ? '-rtl' : '';
277 277
 
278
-				if($this->settings[$css_setting]){
279
-					$compatibility = $this->settings[$css_setting]=='core' ? false : true;
280
-					$url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets/css/ayecode-ui-compatibility'.$rtl.'.css';
281
-					wp_register_style( 'ayecode-ui', $url, array(), $this->latest );
282
-					wp_enqueue_style( 'ayecode-ui' );
278
+                if($this->settings[$css_setting]){
279
+                    $compatibility = $this->settings[$css_setting]=='core' ? false : true;
280
+                    $url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets/css/ayecode-ui-compatibility'.$rtl.'.css';
281
+                    wp_register_style( 'ayecode-ui', $url, array(), $this->latest );
282
+                    wp_enqueue_style( 'ayecode-ui' );
283 283
 
284
-					// flatpickr
285
-					wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->latest );
284
+                    // flatpickr
285
+                    wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->latest );
286 286
 
287
-					// fontawesome-iconpicker
288
-					//wp_register_style( 'fontawesome-iconpicker', $this->url.'assets/css/flatpickr.min.css', array(), $this->latest );
287
+                    // fontawesome-iconpicker
288
+                    //wp_register_style( 'fontawesome-iconpicker', $this->url.'assets/css/flatpickr.min.css', array(), $this->latest );
289 289
 
290
-					// fix some wp-admin issues
291
-					if(is_admin()){
292
-						$custom_css = "
290
+                    // fix some wp-admin issues
291
+                    if(is_admin()){
292
+                        $custom_css = "
293 293
                 body{
294 294
                     background-color: #f1f1f1;
295 295
                     font-family: -apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif;
@@ -335,35 +335,35 @@  discard block
 block discarded – undo
335 335
 				}
336 336
                 ";
337 337
 
338
-						// @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
339
-						$custom_css .= "
338
+                        // @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
339
+                        $custom_css .= "
340 340
 						.edit-post-sidebar input[type=color].components-text-control__input{
341 341
 						    padding: 0;
342 342
 						}
343 343
 					";
344
-						wp_add_inline_style( 'ayecode-ui', $custom_css );
345
-					}
344
+                        wp_add_inline_style( 'ayecode-ui', $custom_css );
345
+                    }
346 346
 
347
-					// custom changes
348
-					wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
347
+                    // custom changes
348
+                    wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
349 349
 
350
-				}
351
-			}
350
+                }
351
+            }
352 352
 
353 353
 
354
-		}
354
+        }
355 355
 
356
-		/**
357
-		 * Get inline script used if bootstrap enqueued
358
-		 *
359
-		 * If this remains small then its best to use this than to add another JS file.
360
-		 */
361
-		public function inline_script() {
362
-			// Flatpickr calendar locale
363
-			$flatpickr_locale = self::flatpickr_locale();
364
-
365
-			ob_start();
366
-			?>
356
+        /**
357
+         * Get inline script used if bootstrap enqueued
358
+         *
359
+         * If this remains small then its best to use this than to add another JS file.
360
+         */
361
+        public function inline_script() {
362
+            // Flatpickr calendar locale
363
+            $flatpickr_locale = self::flatpickr_locale();
364
+
365
+            ob_start();
366
+            ?>
367 367
 			<script>
368 368
 				/**
369 369
 				 * An AUI bootstrap adaptation of GreedyNav.js ( by Luke Jackson ).
@@ -1198,29 +1198,29 @@  discard block
 block discarded – undo
1198 1198
 				}
1199 1199
 			</script>
1200 1200
 			<?php
1201
-			$output = ob_get_clean();
1201
+            $output = ob_get_clean();
1202 1202
 
1203 1203
 
1204 1204
 
1205
-			/*
1205
+            /*
1206 1206
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1207 1207
 			 */
1208
-			return str_replace( array(
1209
-				'<script>',
1210
-				'</script>'
1211
-			), '', self::minify_js($output) );
1212
-		}
1208
+            return str_replace( array(
1209
+                '<script>',
1210
+                '</script>'
1211
+            ), '', self::minify_js($output) );
1212
+        }
1213 1213
 
1214 1214
 
1215
-		/**
1216
-		 * JS to help with conflict issues with other plugins and themes using bootstrap v3.
1217
-		 *
1218
-		 * @TODO we may need this when other conflicts arrise.
1219
-		 * @return mixed
1220
-		 */
1221
-		public static function bs3_compat_js() {
1222
-			ob_start();
1223
-			?>
1215
+        /**
1216
+         * JS to help with conflict issues with other plugins and themes using bootstrap v3.
1217
+         *
1218
+         * @TODO we may need this when other conflicts arrise.
1219
+         * @return mixed
1220
+         */
1221
+        public static function bs3_compat_js() {
1222
+            ob_start();
1223
+            ?>
1224 1224
 			<script>
1225 1225
 				<?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?>
1226 1226
 				/* With Avada builder */
@@ -1228,20 +1228,20 @@  discard block
 block discarded – undo
1228 1228
 				<?php } ?>
1229 1229
 			</script>
1230 1230
 			<?php
1231
-			return str_replace( array(
1232
-				'<script>',
1233
-				'</script>'
1234
-			), '', ob_get_clean());
1235
-		}
1231
+            return str_replace( array(
1232
+                '<script>',
1233
+                '</script>'
1234
+            ), '', ob_get_clean());
1235
+        }
1236 1236
 
1237
-		/**
1238
-		 * Get inline script used if bootstrap file browser enqueued.
1239
-		 *
1240
-		 * If this remains small then its best to use this than to add another JS file.
1241
-		 */
1242
-		public function inline_script_file_browser(){
1243
-			ob_start();
1244
-			?>
1237
+        /**
1238
+         * Get inline script used if bootstrap file browser enqueued.
1239
+         *
1240
+         * If this remains small then its best to use this than to add another JS file.
1241
+         */
1242
+        public function inline_script_file_browser(){
1243
+            ob_start();
1244
+            ?>
1245 1245
 			<script>
1246 1246
 				// run on doc ready
1247 1247
 				jQuery(document).ready(function () {
@@ -1249,203 +1249,203 @@  discard block
 block discarded – undo
1249 1249
 				});
1250 1250
 			</script>
1251 1251
 			<?php
1252
-			$output = ob_get_clean();
1252
+            $output = ob_get_clean();
1253 1253
 
1254
-			/*
1254
+            /*
1255 1255
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1256 1256
 			 */
1257
-			return str_replace( array(
1258
-				'<script>',
1259
-				'</script>'
1260
-			), '', $output );
1261
-		}
1257
+            return str_replace( array(
1258
+                '<script>',
1259
+                '</script>'
1260
+            ), '', $output );
1261
+        }
1262 1262
 
1263
-		/**
1264
-		 * Adds the Font Awesome JS.
1265
-		 */
1266
-		public function enqueue_scripts() {
1263
+        /**
1264
+         * Adds the Font Awesome JS.
1265
+         */
1266
+        public function enqueue_scripts() {
1267 1267
 
1268
-			if( is_admin() && !$this->is_aui_screen()){
1269
-				// don't add wp-admin scripts if not requested to
1270
-			}else {
1268
+            if( is_admin() && !$this->is_aui_screen()){
1269
+                // don't add wp-admin scripts if not requested to
1270
+            }else {
1271 1271
 
1272
-				$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
1272
+                $js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
1273 1273
 
1274
-				// select2
1275
-				wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
1274
+                // select2
1275
+                wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
1276 1276
 
1277
-				// flatpickr
1278
-				wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->latest );
1277
+                // flatpickr
1278
+                wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->latest );
1279 1279
 
1280
-				// flatpickr
1281
-				wp_register_script( 'iconpicker', $this->url . 'assets/js/fontawesome-iconpicker.min.js', array(), $this->latest );
1280
+                // flatpickr
1281
+                wp_register_script( 'iconpicker', $this->url . 'assets/js/fontawesome-iconpicker.min.js', array(), $this->latest );
1282 1282
 				
1283
-				// Bootstrap file browser
1284
-				wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
1285
-				wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
1286
-
1287
-				$load_inline = false;
1288
-
1289
-				if ( $this->settings[ $js_setting ] == 'core-popper' ) {
1290
-					// Bootstrap bundle
1291
-					$url = $this->url . 'assets/js/bootstrap.bundle.min.js';
1292
-					wp_register_script( 'bootstrap-js-bundle', $url, array(
1293
-						'select2',
1294
-						'jquery'
1295
-					), $this->latest, $this->is_bs3_compat() );
1296
-					// if in admin then add to footer for compatibility.
1297
-					is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
1298
-					$script = $this->inline_script();
1299
-					wp_add_inline_script( 'bootstrap-js-bundle', $script );
1300
-				} elseif ( $this->settings[ $js_setting ] == 'popper' ) {
1301
-					$url = $this->url . 'assets/js/popper.min.js';
1302
-					wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->latest );
1303
-					wp_enqueue_script( 'bootstrap-js-popper' );
1304
-					$load_inline = true;
1305
-				} else {
1306
-					$load_inline = true;
1307
-				}
1283
+                // Bootstrap file browser
1284
+                wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
1285
+                wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
1286
+
1287
+                $load_inline = false;
1288
+
1289
+                if ( $this->settings[ $js_setting ] == 'core-popper' ) {
1290
+                    // Bootstrap bundle
1291
+                    $url = $this->url . 'assets/js/bootstrap.bundle.min.js';
1292
+                    wp_register_script( 'bootstrap-js-bundle', $url, array(
1293
+                        'select2',
1294
+                        'jquery'
1295
+                    ), $this->latest, $this->is_bs3_compat() );
1296
+                    // if in admin then add to footer for compatibility.
1297
+                    is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
1298
+                    $script = $this->inline_script();
1299
+                    wp_add_inline_script( 'bootstrap-js-bundle', $script );
1300
+                } elseif ( $this->settings[ $js_setting ] == 'popper' ) {
1301
+                    $url = $this->url . 'assets/js/popper.min.js';
1302
+                    wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->latest );
1303
+                    wp_enqueue_script( 'bootstrap-js-popper' );
1304
+                    $load_inline = true;
1305
+                } else {
1306
+                    $load_inline = true;
1307
+                }
1308 1308
 
1309
-				// Load needed inline scripts by faking the loading of a script if the main script is not being loaded
1310
-				if ( $load_inline ) {
1311
-					wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) );
1312
-					wp_enqueue_script( 'bootstrap-dummy' );
1313
-					$script = $this->inline_script();
1314
-					wp_add_inline_script( 'bootstrap-dummy', $script );
1315
-				}
1316
-			}
1309
+                // Load needed inline scripts by faking the loading of a script if the main script is not being loaded
1310
+                if ( $load_inline ) {
1311
+                    wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) );
1312
+                    wp_enqueue_script( 'bootstrap-dummy' );
1313
+                    $script = $this->inline_script();
1314
+                    wp_add_inline_script( 'bootstrap-dummy', $script );
1315
+                }
1316
+            }
1317 1317
 
1318
-		}
1318
+        }
1319 1319
 
1320
-		/**
1321
-		 * Enqueue flatpickr if called.
1322
-		 */
1323
-		public function enqueue_flatpickr(){
1324
-			wp_enqueue_style( 'flatpickr' );
1325
-			wp_enqueue_script( 'flatpickr' );
1326
-		}
1320
+        /**
1321
+         * Enqueue flatpickr if called.
1322
+         */
1323
+        public function enqueue_flatpickr(){
1324
+            wp_enqueue_style( 'flatpickr' );
1325
+            wp_enqueue_script( 'flatpickr' );
1326
+        }
1327 1327
 
1328
-		/**
1329
-		 * Enqueue iconpicker if called.
1330
-		 */
1331
-		public function enqueue_iconpicker(){
1332
-			wp_enqueue_style( 'iconpicker' );
1333
-			wp_enqueue_script( 'iconpicker' );
1334
-		}
1328
+        /**
1329
+         * Enqueue iconpicker if called.
1330
+         */
1331
+        public function enqueue_iconpicker(){
1332
+            wp_enqueue_style( 'iconpicker' );
1333
+            wp_enqueue_script( 'iconpicker' );
1334
+        }
1335 1335
 
1336
-		/**
1337
-		 * Get the url path to the current folder.
1338
-		 *
1339
-		 * @return string
1340
-		 */
1341
-		public function get_url() {
1336
+        /**
1337
+         * Get the url path to the current folder.
1338
+         *
1339
+         * @return string
1340
+         */
1341
+        public function get_url() {
1342 1342
 
1343
-			$url = '';
1344
-			// check if we are inside a plugin
1345
-			$file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
1343
+            $url = '';
1344
+            // check if we are inside a plugin
1345
+            $file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
1346 1346
 
1347
-			// add check in-case user has changed wp-content dir name.
1348
-			$wp_content_folder_name = basename(WP_CONTENT_DIR);
1349
-			$dir_parts = explode("/$wp_content_folder_name/",$file_dir);
1350
-			$url_parts = explode("/$wp_content_folder_name/",plugins_url());
1347
+            // add check in-case user has changed wp-content dir name.
1348
+            $wp_content_folder_name = basename(WP_CONTENT_DIR);
1349
+            $dir_parts = explode("/$wp_content_folder_name/",$file_dir);
1350
+            $url_parts = explode("/$wp_content_folder_name/",plugins_url());
1351 1351
 
1352
-			if(!empty($url_parts[0]) && !empty($dir_parts[1])){
1353
-				$url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
1354
-			}
1352
+            if(!empty($url_parts[0]) && !empty($dir_parts[1])){
1353
+                $url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
1354
+            }
1355 1355
 
1356
-			return $url;
1357
-		}
1356
+            return $url;
1357
+        }
1358 1358
 
1359
-		/**
1360
-		 * Register the database settings with WordPress.
1361
-		 */
1362
-		public function register_settings() {
1363
-			register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
1364
-		}
1359
+        /**
1360
+         * Register the database settings with WordPress.
1361
+         */
1362
+        public function register_settings() {
1363
+            register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
1364
+        }
1365 1365
 
1366
-		/**
1367
-		 * Add the WordPress settings menu item.
1368
-		 * @since 1.0.10 Calling function name direct will fail theme check so we don't.
1369
-		 */
1370
-		public function menu_item() {
1371
-			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
1372
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
1373
-				$this,
1374
-				'settings_page'
1375
-			) );
1376
-		}
1366
+        /**
1367
+         * Add the WordPress settings menu item.
1368
+         * @since 1.0.10 Calling function name direct will fail theme check so we don't.
1369
+         */
1370
+        public function menu_item() {
1371
+            $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
1372
+            call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
1373
+                $this,
1374
+                'settings_page'
1375
+            ) );
1376
+        }
1377 1377
 
1378
-		/**
1379
-		 * Get a list of themes and their default JS settings.
1380
-		 *
1381
-		 * @return array
1382
-		 */
1383
-		public function theme_js_settings(){
1384
-			return array(
1385
-				'ayetheme' => 'popper',
1386
-				'listimia' => 'required',
1387
-				'listimia_backend' => 'core-popper',
1388
-				//'avada'    => 'required', // removed as we now add compatibility
1389
-			);
1390
-		}
1378
+        /**
1379
+         * Get a list of themes and their default JS settings.
1380
+         *
1381
+         * @return array
1382
+         */
1383
+        public function theme_js_settings(){
1384
+            return array(
1385
+                'ayetheme' => 'popper',
1386
+                'listimia' => 'required',
1387
+                'listimia_backend' => 'core-popper',
1388
+                //'avada'    => 'required', // removed as we now add compatibility
1389
+            );
1390
+        }
1391 1391
 
1392
-		/**
1393
-		 * Get the current Font Awesome output settings.
1394
-		 *
1395
-		 * @return array The array of settings.
1396
-		 */
1397
-		public function get_settings() {
1398
-
1399
-			$db_settings = get_option( 'ayecode-ui-settings' );
1400
-			$js_default = 'core-popper';
1401
-			$js_default_backend = $js_default;
1402
-
1403
-			// maybe set defaults (if no settings set)
1404
-			if(empty($db_settings)){
1405
-				$active_theme = strtolower( get_template() ); // active parent theme.
1406
-				$theme_js_settings = self::theme_js_settings();
1407
-				if(isset($theme_js_settings[$active_theme])){
1408
-					$js_default = $theme_js_settings[$active_theme];
1409
-					$js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
1410
-				}
1411
-			}
1412
-
1413
-			$defaults = array(
1414
-				'css'       => 'compatibility', // core, compatibility
1415
-				'js'        => $js_default, // js to load, core-popper, popper
1416
-				'html_font_size'        => '16', // js to load, core-popper, popper
1417
-				'css_backend'       => 'compatibility', // core, compatibility
1418
-				'js_backend'        => $js_default_backend, // js to load, core-popper, popper
1419
-				'disable_admin'     =>  '', // URL snippets to disable loading on admin
1420
-			);
1421
-
1422
-			$settings = wp_parse_args( $db_settings, $defaults );
1423
-
1424
-			/**
1425
-			 * Filter the Bootstrap settings.
1426
-			 *
1427
-			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
1428
-			 */
1429
-			return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
1430
-		}
1392
+        /**
1393
+         * Get the current Font Awesome output settings.
1394
+         *
1395
+         * @return array The array of settings.
1396
+         */
1397
+        public function get_settings() {
1398
+
1399
+            $db_settings = get_option( 'ayecode-ui-settings' );
1400
+            $js_default = 'core-popper';
1401
+            $js_default_backend = $js_default;
1402
+
1403
+            // maybe set defaults (if no settings set)
1404
+            if(empty($db_settings)){
1405
+                $active_theme = strtolower( get_template() ); // active parent theme.
1406
+                $theme_js_settings = self::theme_js_settings();
1407
+                if(isset($theme_js_settings[$active_theme])){
1408
+                    $js_default = $theme_js_settings[$active_theme];
1409
+                    $js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
1410
+                }
1411
+            }
1412
+
1413
+            $defaults = array(
1414
+                'css'       => 'compatibility', // core, compatibility
1415
+                'js'        => $js_default, // js to load, core-popper, popper
1416
+                'html_font_size'        => '16', // js to load, core-popper, popper
1417
+                'css_backend'       => 'compatibility', // core, compatibility
1418
+                'js_backend'        => $js_default_backend, // js to load, core-popper, popper
1419
+                'disable_admin'     =>  '', // URL snippets to disable loading on admin
1420
+            );
1421
+
1422
+            $settings = wp_parse_args( $db_settings, $defaults );
1423
+
1424
+            /**
1425
+             * Filter the Bootstrap settings.
1426
+             *
1427
+             * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
1428
+             */
1429
+            return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
1430
+        }
1431 1431
 
1432 1432
 
1433
-		/**
1434
-		 * The settings page html output.
1435
-		 */
1436
-		public function settings_page() {
1437
-			if ( ! current_user_can( 'manage_options' ) ) {
1438
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
1439
-			}
1440
-			?>
1433
+        /**
1434
+         * The settings page html output.
1435
+         */
1436
+        public function settings_page() {
1437
+            if ( ! current_user_can( 'manage_options' ) ) {
1438
+                wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
1439
+            }
1440
+            ?>
1441 1441
 			<div class="wrap">
1442 1442
 				<h1><?php echo $this->name; ?></h1>
1443 1443
 				<p><?php _e("Here you can adjust settings if you are having compatibility issues.",'aui');?></p>
1444 1444
 				<form method="post" action="options.php">
1445 1445
 					<?php
1446
-					settings_fields( 'ayecode-ui-settings' );
1447
-					do_settings_sections( 'ayecode-ui-settings' );
1448
-					?>
1446
+                    settings_fields( 'ayecode-ui-settings' );
1447
+                    do_settings_sections( 'ayecode-ui-settings' );
1448
+                    ?>
1449 1449
 
1450 1450
 					<h2><?php _e( 'Frontend', 'aui' ); ?></h2>
1451 1451
 					<table class="form-table wpbs-table-settings">
@@ -1525,60 +1525,60 @@  discard block
 block discarded – undo
1525 1525
 					</table>
1526 1526
 
1527 1527
 					<?php
1528
-					submit_button();
1529
-					?>
1528
+                    submit_button();
1529
+                    ?>
1530 1530
 				</form>
1531 1531
 
1532 1532
 				<div id="wpbs-version"><?php echo $this->version; ?></div>
1533 1533
 			</div>
1534 1534
 
1535 1535
 			<?php
1536
-		}
1536
+        }
1537 1537
 
1538
-		public function customizer_settings($wp_customize){
1539
-			$wp_customize->add_section('aui_settings', array(
1540
-				'title'    => __('AyeCode UI','aui'),
1541
-				'priority' => 120,
1542
-			));
1543
-
1544
-			//  =============================
1545
-			//  = Color Picker              =
1546
-			//  =============================
1547
-			$wp_customize->add_setting('aui_options[color_primary]', array(
1548
-				'default'           => AUI_PRIMARY_COLOR,
1549
-				'sanitize_callback' => 'sanitize_hex_color',
1550
-				'capability'        => 'edit_theme_options',
1551
-				'type'              => 'option',
1552
-				'transport'         => 'refresh',
1553
-			));
1554
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1555
-				'label'    => __('Primary Color','aui'),
1556
-				'section'  => 'aui_settings',
1557
-				'settings' => 'aui_options[color_primary]',
1558
-			)));
1559
-
1560
-			$wp_customize->add_setting('aui_options[color_secondary]', array(
1561
-				'default'           => '#6c757d',
1562
-				'sanitize_callback' => 'sanitize_hex_color',
1563
-				'capability'        => 'edit_theme_options',
1564
-				'type'              => 'option',
1565
-				'transport'         => 'refresh',
1566
-			));
1567
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1568
-				'label'    => __('Secondary Color','aui'),
1569
-				'section'  => 'aui_settings',
1570
-				'settings' => 'aui_options[color_secondary]',
1571
-			)));
1572
-		}
1538
+        public function customizer_settings($wp_customize){
1539
+            $wp_customize->add_section('aui_settings', array(
1540
+                'title'    => __('AyeCode UI','aui'),
1541
+                'priority' => 120,
1542
+            ));
1543
+
1544
+            //  =============================
1545
+            //  = Color Picker              =
1546
+            //  =============================
1547
+            $wp_customize->add_setting('aui_options[color_primary]', array(
1548
+                'default'           => AUI_PRIMARY_COLOR,
1549
+                'sanitize_callback' => 'sanitize_hex_color',
1550
+                'capability'        => 'edit_theme_options',
1551
+                'type'              => 'option',
1552
+                'transport'         => 'refresh',
1553
+            ));
1554
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1555
+                'label'    => __('Primary Color','aui'),
1556
+                'section'  => 'aui_settings',
1557
+                'settings' => 'aui_options[color_primary]',
1558
+            )));
1559
+
1560
+            $wp_customize->add_setting('aui_options[color_secondary]', array(
1561
+                'default'           => '#6c757d',
1562
+                'sanitize_callback' => 'sanitize_hex_color',
1563
+                'capability'        => 'edit_theme_options',
1564
+                'type'              => 'option',
1565
+                'transport'         => 'refresh',
1566
+            ));
1567
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1568
+                'label'    => __('Secondary Color','aui'),
1569
+                'section'  => 'aui_settings',
1570
+                'settings' => 'aui_options[color_secondary]',
1571
+            )));
1572
+        }
1573 1573
 
1574
-		/**
1575
-		 * CSS to help with conflict issues with other plugins and themes using bootstrap v3.
1576
-		 *
1577
-		 * @return mixed
1578
-		 */
1579
-		public static function bs3_compat_css() {
1580
-			ob_start();
1581
-			?>
1574
+        /**
1575
+         * CSS to help with conflict issues with other plugins and themes using bootstrap v3.
1576
+         *
1577
+         * @return mixed
1578
+         */
1579
+        public static function bs3_compat_css() {
1580
+            ob_start();
1581
+            ?>
1582 1582
 			<style>
1583 1583
 			/* Bootstrap 3 compatibility */
1584 1584
 			body.modal-open .modal-backdrop.show:not(.in) {opacity:0.5;}
@@ -1604,583 +1604,583 @@  discard block
 block discarded – undo
1604 1604
 			<?php } ?>
1605 1605
 			</style>
1606 1606
 			<?php
1607
-			return str_replace( array(
1608
-				'<style>',
1609
-				'</style>'
1610
-			), '', self::minify_css( ob_get_clean() ) );
1611
-		}
1607
+            return str_replace( array(
1608
+                '<style>',
1609
+                '</style>'
1610
+            ), '', self::minify_css( ob_get_clean() ) );
1611
+        }
1612 1612
 
1613 1613
 
1614
-		public static function custom_css($compatibility = true) {
1615
-			$settings = get_option('aui_options');
1614
+        public static function custom_css($compatibility = true) {
1615
+            $settings = get_option('aui_options');
1616 1616
 
1617
-			ob_start();
1617
+            ob_start();
1618 1618
 
1619
-			$primary_color = !empty($settings['color_primary']) ? $settings['color_primary'] : AUI_PRIMARY_COLOR;
1620
-			$secondary_color = !empty($settings['color_secondary']) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR;
1621
-				//AUI_PRIMARY_COLOR_ORIGINAL
1622
-			?>
1619
+            $primary_color = !empty($settings['color_primary']) ? $settings['color_primary'] : AUI_PRIMARY_COLOR;
1620
+            $secondary_color = !empty($settings['color_secondary']) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR;
1621
+                //AUI_PRIMARY_COLOR_ORIGINAL
1622
+            ?>
1623 1623
 			<style>
1624 1624
 				<?php
1625 1625
 
1626
-					// BS v3 compat
1627
-					if( self::is_bs3_compat() ){
1628
-					    echo self::bs3_compat_css();
1629
-					}
1626
+                    // BS v3 compat
1627
+                    if( self::is_bs3_compat() ){
1628
+                        echo self::bs3_compat_css();
1629
+                    }
1630 1630
 
1631
-					if(!is_admin() && $primary_color != AUI_PRIMARY_COLOR_ORIGINAL){
1632
-						echo self::css_primary($primary_color,$compatibility);
1633
-					}
1631
+                    if(!is_admin() && $primary_color != AUI_PRIMARY_COLOR_ORIGINAL){
1632
+                        echo self::css_primary($primary_color,$compatibility);
1633
+                    }
1634 1634
 
1635
-					if(!is_admin() && $secondary_color != AUI_SECONDARY_COLOR_ORIGINAL){
1636
-						echo self::css_secondary($settings['color_secondary'],$compatibility);
1637
-					}
1635
+                    if(!is_admin() && $secondary_color != AUI_SECONDARY_COLOR_ORIGINAL){
1636
+                        echo self::css_secondary($settings['color_secondary'],$compatibility);
1637
+                    }
1638 1638
 
1639
-					// Set admin bar z-index lower when modal is open.
1640
-					echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}';
1639
+                    // Set admin bar z-index lower when modal is open.
1640
+                    echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}';
1641 1641
 
1642
-					if(is_admin()){
1643
-						echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}';
1644
-					}
1642
+                    if(is_admin()){
1643
+                        echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}';
1644
+                    }
1645 1645
                 ?>
1646 1646
 			</style>
1647 1647
 			<?php
1648 1648
 
1649 1649
 
1650
-			/*
1650
+            /*
1651 1651
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1652 1652
 			 */
1653
-			return str_replace( array(
1654
-				'<style>',
1655
-				'</style>'
1656
-			), '', self::minify_css( ob_get_clean() ) );
1657
-		}
1653
+            return str_replace( array(
1654
+                '<style>',
1655
+                '</style>'
1656
+            ), '', self::minify_css( ob_get_clean() ) );
1657
+        }
1658 1658
 
1659
-		/**
1660
-		 * Check if we should add booststrap 3 compatibility changes.
1661
-		 *
1662
-		 * @return bool
1663
-		 */
1664
-		public static function is_bs3_compat(){
1665
-			return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
1666
-		}
1659
+        /**
1660
+         * Check if we should add booststrap 3 compatibility changes.
1661
+         *
1662
+         * @return bool
1663
+         */
1664
+        public static function is_bs3_compat(){
1665
+            return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
1666
+        }
1667 1667
 
1668
-		public static function css_primary($color_code,$compatibility){;
1669
-			$color_code = sanitize_hex_color($color_code);
1670
-			if(!$color_code){return '';}
1671
-			/**
1672
-			 * c = color, b = background color, o = border-color, f = fill
1673
-			 */
1674
-			$selectors = array(
1675
-				'a' => array('c'),
1676
-				'.btn-primary' => array('b','o'),
1677
-				'.btn-primary.disabled' => array('b','o'),
1678
-				'.btn-primary:disabled' => array('b','o'),
1679
-				'.btn-outline-primary' => array('c','o'),
1680
-				'.btn-outline-primary:hover' => array('b','o'),
1681
-				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
1682
-				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
1683
-				'.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
1684
-				'.btn-link' => array('c'),
1685
-				'.dropdown-item.active' => array('b'),
1686
-				'.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
1687
-				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
1668
+        public static function css_primary($color_code,$compatibility){;
1669
+            $color_code = sanitize_hex_color($color_code);
1670
+            if(!$color_code){return '';}
1671
+            /**
1672
+             * c = color, b = background color, o = border-color, f = fill
1673
+             */
1674
+            $selectors = array(
1675
+                'a' => array('c'),
1676
+                '.btn-primary' => array('b','o'),
1677
+                '.btn-primary.disabled' => array('b','o'),
1678
+                '.btn-primary:disabled' => array('b','o'),
1679
+                '.btn-outline-primary' => array('c','o'),
1680
+                '.btn-outline-primary:hover' => array('b','o'),
1681
+                '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
1682
+                '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
1683
+                '.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
1684
+                '.btn-link' => array('c'),
1685
+                '.dropdown-item.active' => array('b'),
1686
+                '.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
1687
+                '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
1688 1688
 //				'.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
1689 1689
 //				'.custom-range::-moz-range-thumb' => array('b'),
1690 1690
 //				'.custom-range::-ms-thumb' => array('b'),
1691
-				'.nav-pills .nav-link.active' => array('b'),
1692
-				'.nav-pills .show>.nav-link' => array('b'),
1693
-				'.page-link' => array('c'),
1694
-				'.page-item.active .page-link' => array('b','o'),
1695
-				'.badge-primary' => array('b'),
1696
-				'.alert-primary' => array('b','o'),
1697
-				'.progress-bar' => array('b'),
1698
-				'.list-group-item.active' => array('b','o'),
1699
-				'.bg-primary' => array('b','f'),
1700
-				'.btn-link.btn-primary' => array('c'),
1701
-				'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
1702
-			);
1703
-
1704
-			$important_selectors = array(
1705
-				'.bg-primary' => array('b','f'),
1706
-				'.border-primary' => array('o'),
1707
-				'.text-primary' => array('c'),
1708
-			);
1709
-
1710
-			$color = array();
1711
-			$color_i = array();
1712
-			$background = array();
1713
-			$background_i = array();
1714
-			$border = array();
1715
-			$border_i = array();
1716
-			$fill = array();
1717
-			$fill_i = array();
1718
-
1719
-			$output = '';
1720
-
1721
-			// build rules into each type
1722
-			foreach($selectors as $selector => $types){
1723
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1724
-				$types = array_combine($types,$types);
1725
-				if(isset($types['c'])){$color[] = $selector;}
1726
-				if(isset($types['b'])){$background[] = $selector;}
1727
-				if(isset($types['o'])){$border[] = $selector;}
1728
-				if(isset($types['f'])){$fill[] = $selector;}
1729
-			}
1730
-
1731
-			// build rules into each type
1732
-			foreach($important_selectors as $selector => $types){
1733
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1734
-				$types = array_combine($types,$types);
1735
-				if(isset($types['c'])){$color_i[] = $selector;}
1736
-				if(isset($types['b'])){$background_i[] = $selector;}
1737
-				if(isset($types['o'])){$border_i[] = $selector;}
1738
-				if(isset($types['f'])){$fill_i[] = $selector;}
1739
-			}
1740
-
1741
-			// add any color rules
1742
-			if(!empty($color)){
1743
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1744
-			}
1745
-			if(!empty($color_i)){
1746
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1747
-			}
1748
-
1749
-			// add any background color rules
1750
-			if(!empty($background)){
1751
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1752
-			}
1753
-			if(!empty($background_i)){
1754
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1755
-			}
1756
-
1757
-			// add any border color rules
1758
-			if(!empty($border)){
1759
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1760
-			}
1761
-			if(!empty($border_i)){
1762
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1763
-			}
1764
-
1765
-			// add any fill color rules
1766
-			if(!empty($fill)){
1767
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1768
-			}
1769
-			if(!empty($fill_i)){
1770
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1771
-			}
1772
-
1773
-
1774
-			$prefix = $compatibility ? ".bsui " : "";
1775
-
1776
-			// darken
1777
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1778
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1779
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1780
-
1781
-			// lighten
1782
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1783
-
1784
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
1785
-			$op_25 = $color_code."40"; // 25% opacity
1786
-
1787
-
1788
-			// button states
1789
-			$output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1790
-			$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;} ";
1791
-			$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.";} ";
1792
-			$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;} ";
1793
-
1794
-
1795
-			// dropdown's
1796
-			$output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1797
-
1798
-
1799
-			// input states
1800
-			$output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
1801
-
1802
-			// page link
1803
-			$output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1804
-
1805
-			return $output;
1806
-		}
1691
+                '.nav-pills .nav-link.active' => array('b'),
1692
+                '.nav-pills .show>.nav-link' => array('b'),
1693
+                '.page-link' => array('c'),
1694
+                '.page-item.active .page-link' => array('b','o'),
1695
+                '.badge-primary' => array('b'),
1696
+                '.alert-primary' => array('b','o'),
1697
+                '.progress-bar' => array('b'),
1698
+                '.list-group-item.active' => array('b','o'),
1699
+                '.bg-primary' => array('b','f'),
1700
+                '.btn-link.btn-primary' => array('c'),
1701
+                '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
1702
+            );
1703
+
1704
+            $important_selectors = array(
1705
+                '.bg-primary' => array('b','f'),
1706
+                '.border-primary' => array('o'),
1707
+                '.text-primary' => array('c'),
1708
+            );
1709
+
1710
+            $color = array();
1711
+            $color_i = array();
1712
+            $background = array();
1713
+            $background_i = array();
1714
+            $border = array();
1715
+            $border_i = array();
1716
+            $fill = array();
1717
+            $fill_i = array();
1718
+
1719
+            $output = '';
1720
+
1721
+            // build rules into each type
1722
+            foreach($selectors as $selector => $types){
1723
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
1724
+                $types = array_combine($types,$types);
1725
+                if(isset($types['c'])){$color[] = $selector;}
1726
+                if(isset($types['b'])){$background[] = $selector;}
1727
+                if(isset($types['o'])){$border[] = $selector;}
1728
+                if(isset($types['f'])){$fill[] = $selector;}
1729
+            }
1807 1730
 
1808
-		public static function css_secondary($color_code,$compatibility){;
1809
-			$color_code = sanitize_hex_color($color_code);
1810
-			if(!$color_code){return '';}
1811
-			/**
1812
-			 * c = color, b = background color, o = border-color, f = fill
1813
-			 */
1814
-			$selectors = array(
1815
-				'.btn-secondary' => array('b','o'),
1816
-				'.btn-secondary.disabled' => array('b','o'),
1817
-				'.btn-secondary:disabled' => array('b','o'),
1818
-				'.btn-outline-secondary' => array('c','o'),
1819
-				'.btn-outline-secondary:hover' => array('b','o'),
1820
-				'.btn-outline-secondary.disabled' => array('c'),
1821
-				'.btn-outline-secondary:disabled' => array('c'),
1822
-				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
1823
-				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
1824
-				'.btn-outline-secondary.dropdown-toggle' => array('b','o'),
1825
-				'.badge-secondary' => array('b'),
1826
-				'.alert-secondary' => array('b','o'),
1827
-				'.btn-link.btn-secondary' => array('c'),
1828
-			);
1829
-
1830
-			$important_selectors = array(
1831
-				'.bg-secondary' => array('b','f'),
1832
-				'.border-secondary' => array('o'),
1833
-				'.text-secondary' => array('c'),
1834
-			);
1835
-
1836
-			$color = array();
1837
-			$color_i = array();
1838
-			$background = array();
1839
-			$background_i = array();
1840
-			$border = array();
1841
-			$border_i = array();
1842
-			$fill = array();
1843
-			$fill_i = array();
1844
-
1845
-			$output = '';
1846
-
1847
-			// build rules into each type
1848
-			foreach($selectors as $selector => $types){
1849
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1850
-				$types = array_combine($types,$types);
1851
-				if(isset($types['c'])){$color[] = $selector;}
1852
-				if(isset($types['b'])){$background[] = $selector;}
1853
-				if(isset($types['o'])){$border[] = $selector;}
1854
-				if(isset($types['f'])){$fill[] = $selector;}
1855
-			}
1856
-
1857
-			// build rules into each type
1858
-			foreach($important_selectors as $selector => $types){
1859
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1860
-				$types = array_combine($types,$types);
1861
-				if(isset($types['c'])){$color_i[] = $selector;}
1862
-				if(isset($types['b'])){$background_i[] = $selector;}
1863
-				if(isset($types['o'])){$border_i[] = $selector;}
1864
-				if(isset($types['f'])){$fill_i[] = $selector;}
1865
-			}
1866
-
1867
-			// add any color rules
1868
-			if(!empty($color)){
1869
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1870
-			}
1871
-			if(!empty($color_i)){
1872
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1873
-			}
1874
-
1875
-			// add any background color rules
1876
-			if(!empty($background)){
1877
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1878
-			}
1879
-			if(!empty($background_i)){
1880
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1881
-			}
1882
-
1883
-			// add any border color rules
1884
-			if(!empty($border)){
1885
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1886
-			}
1887
-			if(!empty($border_i)){
1888
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1889
-			}
1890
-
1891
-			// add any fill color rules
1892
-			if(!empty($fill)){
1893
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1894
-			}
1895
-			if(!empty($fill_i)){
1896
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1897
-			}
1898
-
1899
-
1900
-			$prefix = $compatibility ? ".bsui " : "";
1901
-
1902
-			// darken
1903
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1904
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1905
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1906
-
1907
-			// lighten
1908
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1909
-
1910
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
1911
-			$op_25 = $color_code."40"; // 25% opacity
1912
-
1913
-
1914
-			// button states
1915
-			$output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1916
-			$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;} ";
1917
-			$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.";} ";
1918
-			$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;} ";
1919
-
1920
-
1921
-			return $output;
1922
-		}
1731
+            // build rules into each type
1732
+            foreach($important_selectors as $selector => $types){
1733
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
1734
+                $types = array_combine($types,$types);
1735
+                if(isset($types['c'])){$color_i[] = $selector;}
1736
+                if(isset($types['b'])){$background_i[] = $selector;}
1737
+                if(isset($types['o'])){$border_i[] = $selector;}
1738
+                if(isset($types['f'])){$fill_i[] = $selector;}
1739
+            }
1923 1740
 
1924
-		/**
1925
-		 * Increases or decreases the brightness of a color by a percentage of the current brightness.
1926
-		 *
1927
-		 * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
1928
-		 * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
1929
-		 *
1930
-		 * @return  string
1931
-		 */
1932
-		public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
1933
-			$hexCode = ltrim($hexCode, '#');
1741
+            // add any color rules
1742
+            if(!empty($color)){
1743
+                $output .= implode(",",$color) . "{color: $color_code;} ";
1744
+            }
1745
+            if(!empty($color_i)){
1746
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1747
+            }
1934 1748
 
1935
-			if (strlen($hexCode) == 3) {
1936
-				$hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
1937
-			}
1749
+            // add any background color rules
1750
+            if(!empty($background)){
1751
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
1752
+            }
1753
+            if(!empty($background_i)){
1754
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1755
+            }
1938 1756
 
1939
-			$hexCode = array_map('hexdec', str_split($hexCode, 2));
1757
+            // add any border color rules
1758
+            if(!empty($border)){
1759
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
1760
+            }
1761
+            if(!empty($border_i)){
1762
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1763
+            }
1940 1764
 
1941
-			foreach ($hexCode as & $color) {
1942
-				$adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
1943
-				$adjustAmount = ceil($adjustableLimit * $adjustPercent);
1765
+            // add any fill color rules
1766
+            if(!empty($fill)){
1767
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
1768
+            }
1769
+            if(!empty($fill_i)){
1770
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1771
+            }
1944 1772
 
1945
-				$color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
1946
-			}
1947 1773
 
1948
-			return '#' . implode($hexCode);
1949
-		}
1774
+            $prefix = $compatibility ? ".bsui " : "";
1950 1775
 
1951
-		/**
1952
-		 * Check if we should display examples.
1953
-		 */
1954
-		public function maybe_show_examples(){
1955
-			if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
1956
-				echo "<head>";
1957
-				wp_head();
1958
-				echo "</head>";
1959
-				echo "<body>";
1960
-				echo $this->get_examples();
1961
-				echo "</body>";
1962
-				exit;
1963
-			}
1964
-		}
1776
+            // darken
1777
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1778
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1779
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1965 1780
 
1966
-		/**
1967
-		 * Get developer examples.
1968
-		 *
1969
-		 * @return string
1970
-		 */
1971
-		public function get_examples(){
1972
-			$output = '';
1973
-
1974
-
1975
-			// open form
1976
-			$output .= "<form class='p-5 m-5 border rounded'>";
1977
-
1978
-			// input example
1979
-			$output .= aui()->input(array(
1980
-				'type'  =>  'text',
1981
-				'id'    =>  'text-example',
1982
-				'name'    =>  'text-example',
1983
-				'placeholder'   => 'text placeholder',
1984
-				'title'   => 'Text input example',
1985
-				'value' =>  '',
1986
-				'required'  => false,
1987
-				'help_text' => 'help text',
1988
-				'label' => 'Text input example label'
1989
-			));
1990
-
1991
-			// input example
1992
-			$output .= aui()->input(array(
1993
-				'type'  =>  'url',
1994
-				'id'    =>  'text-example2',
1995
-				'name'    =>  'text-example',
1996
-				'placeholder'   => 'url placeholder',
1997
-				'title'   => 'Text input example',
1998
-				'value' =>  '',
1999
-				'required'  => false,
2000
-				'help_text' => 'help text',
2001
-				'label' => 'Text input example label'
2002
-			));
2003
-
2004
-			// checkbox example
2005
-			$output .= aui()->input(array(
2006
-				'type'  =>  'checkbox',
2007
-				'id'    =>  'checkbox-example',
2008
-				'name'    =>  'checkbox-example',
2009
-				'placeholder'   => 'checkbox-example',
2010
-				'title'   => 'Checkbox example',
2011
-				'value' =>  '1',
2012
-				'checked'   => true,
2013
-				'required'  => false,
2014
-				'help_text' => 'help text',
2015
-				'label' => 'Checkbox checked'
2016
-			));
2017
-
2018
-			// checkbox example
2019
-			$output .= aui()->input(array(
2020
-				'type'  =>  'checkbox',
2021
-				'id'    =>  'checkbox-example2',
2022
-				'name'    =>  'checkbox-example2',
2023
-				'placeholder'   => 'checkbox-example',
2024
-				'title'   => 'Checkbox example',
2025
-				'value' =>  '1',
2026
-				'checked'   => false,
2027
-				'required'  => false,
2028
-				'help_text' => 'help text',
2029
-				'label' => 'Checkbox un-checked'
2030
-			));
2031
-
2032
-			// switch example
2033
-			$output .= aui()->input(array(
2034
-				'type'  =>  'checkbox',
2035
-				'id'    =>  'switch-example',
2036
-				'name'    =>  'switch-example',
2037
-				'placeholder'   => 'checkbox-example',
2038
-				'title'   => 'Switch example',
2039
-				'value' =>  '1',
2040
-				'checked'   => true,
2041
-				'switch'    => true,
2042
-				'required'  => false,
2043
-				'help_text' => 'help text',
2044
-				'label' => 'Switch on'
2045
-			));
2046
-
2047
-			// switch example
2048
-			$output .= aui()->input(array(
2049
-				'type'  =>  'checkbox',
2050
-				'id'    =>  'switch-example2',
2051
-				'name'    =>  'switch-example2',
2052
-				'placeholder'   => 'checkbox-example',
2053
-				'title'   => 'Switch example',
2054
-				'value' =>  '1',
2055
-				'checked'   => false,
2056
-				'switch'    => true,
2057
-				'required'  => false,
2058
-				'help_text' => 'help text',
2059
-				'label' => 'Switch off'
2060
-			));
2061
-
2062
-			// close form
2063
-			$output .= "</form>";
2064
-
2065
-			return $output;
2066
-		}
1781
+            // lighten
1782
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2067 1783
 
2068
-		/**
2069
-		 * Calendar params.
2070
-		 *
2071
-		 * @since 0.1.44
2072
-		 *
2073
-		 * @return array Calendar params.
2074
-		 */
2075
-		public static function calendar_params() {
2076
-			$params = array(
2077
-				'month_long_1' => __( 'January', 'aui' ),
2078
-				'month_long_2' => __( 'February', 'aui' ),
2079
-				'month_long_3' => __( 'March', 'aui' ),
2080
-				'month_long_4' => __( 'April', 'aui' ),
2081
-				'month_long_5' => __( 'May', 'aui' ),
2082
-				'month_long_6' => __( 'June', 'aui' ),
2083
-				'month_long_7' => __( 'July', 'aui' ),
2084
-				'month_long_8' => __( 'August', 'aui' ),
2085
-				'month_long_9' => __( 'September', 'aui' ),
2086
-				'month_long_10' => __( 'October', 'aui' ),
2087
-				'month_long_11' => __( 'November', 'aui' ),
2088
-				'month_long_12' => __( 'December', 'aui' ),
2089
-				'month_s_1' => _x( 'Jan', 'January abbreviation', 'aui' ),
2090
-				'month_s_2' => _x( 'Feb', 'February abbreviation', 'aui' ),
2091
-				'month_s_3' => _x( 'Mar', 'March abbreviation', 'aui' ),
2092
-				'month_s_4' => _x( 'Apr', 'April abbreviation', 'aui' ),
2093
-				'month_s_5' => _x( 'May', 'May abbreviation', 'aui' ),
2094
-				'month_s_6' => _x( 'Jun', 'June abbreviation', 'aui' ),
2095
-				'month_s_7' => _x( 'Jul', 'July abbreviation', 'aui' ),
2096
-				'month_s_8' => _x( 'Aug', 'August abbreviation', 'aui' ),
2097
-				'month_s_9' => _x( 'Sep', 'September abbreviation', 'aui' ),
2098
-				'month_s_10' => _x( 'Oct', 'October abbreviation', 'aui' ),
2099
-				'month_s_11' => _x( 'Nov', 'November abbreviation', 'aui' ),
2100
-				'month_s_12' => _x( 'Dec', 'December abbreviation', 'aui' ),
2101
-				'day_s1_1' => _x( 'S', 'Sunday initial', 'aui' ),
2102
-				'day_s1_2' => _x( 'M', 'Monday initial', 'aui' ),
2103
-				'day_s1_3' => _x( 'T', 'Tuesday initial', 'aui' ),
2104
-				'day_s1_4' => _x( 'W', 'Wednesday initial', 'aui' ),
2105
-				'day_s1_5' => _x( 'T', 'Friday initial', 'aui' ),
2106
-				'day_s1_6' => _x( 'F', 'Thursday initial', 'aui' ),
2107
-				'day_s1_7' => _x( 'S', 'Saturday initial', 'aui' ),
2108
-				'day_s2_1' => __( 'Su', 'aui' ),
2109
-				'day_s2_2' => __( 'Mo', 'aui' ),
2110
-				'day_s2_3' => __( 'Tu', 'aui' ),
2111
-				'day_s2_4' => __( 'We', 'aui' ),
2112
-				'day_s2_5' => __( 'Th', 'aui' ),
2113
-				'day_s2_6' => __( 'Fr', 'aui' ),
2114
-				'day_s2_7' => __( 'Sa', 'aui' ),
2115
-				'day_s3_1' => __( 'Sun', 'aui' ),
2116
-				'day_s3_2' => __( 'Mon', 'aui' ),
2117
-				'day_s3_3' => __( 'Tue', 'aui' ),
2118
-				'day_s3_4' => __( 'Wed', 'aui' ),
2119
-				'day_s3_5' => __( 'Thu', 'aui' ),
2120
-				'day_s3_6' => __( 'Fri', 'aui' ),
2121
-				'day_s3_7' => __( 'Sat', 'aui' ),
2122
-				'day_s5_1' => __( 'Sunday', 'aui' ),
2123
-				'day_s5_2' => __( 'Monday', 'aui' ),
2124
-				'day_s5_3' => __( 'Tuesday', 'aui' ),
2125
-				'day_s5_4' => __( 'Wednesday', 'aui' ),
2126
-				'day_s5_5' => __( 'Thursday', 'aui' ),
2127
-				'day_s5_6' => __( 'Friday', 'aui' ),
2128
-				'day_s5_7' => __( 'Saturday', 'aui' ),
2129
-				'am_lower' => __( 'am', 'aui' ),
2130
-				'pm_lower' => __( 'pm', 'aui' ),
2131
-				'am_upper' => __( 'AM', 'aui' ),
2132
-				'pm_upper' => __( 'PM', 'aui' ),
2133
-				'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
2134
-				'time_24hr' => false,
2135
-				'year' => __( 'Year', 'aui' ),
2136
-				'hour' => __( 'Hour', 'aui' ),
2137
-				'minute' => __( 'Minute', 'aui' ),
2138
-				'weekAbbreviation' => __( 'Wk', 'aui' ),
2139
-				'rangeSeparator' => __( ' to ', 'aui' ),
2140
-				'scrollTitle' => __( 'Scroll to increment', 'aui' ),
2141
-				'toggleTitle' => __( 'Click to toggle', 'aui' )
2142
-			);
2143
-
2144
-			return apply_filters( 'ayecode_ui_calendar_params', $params );
2145
-		}
1784
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
1785
+            $op_25 = $color_code."40"; // 25% opacity
2146 1786
 
2147
-		/**
2148
-		 * Flatpickr calendar localize.
2149
-		 *
2150
-		 * @since 0.1.44
2151
-		 *
2152
-		 * @return string Calendar locale.
2153
-		 */
2154
-		public static function flatpickr_locale() {
2155
-			$params = self::calendar_params();
2156
-
2157
-			if ( is_string( $params ) ) {
2158
-				$params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
2159
-			} else {
2160
-				foreach ( (array) $params as $key => $value ) {
2161
-					if ( ! is_scalar( $value ) ) {
2162
-						continue;
2163
-					}
2164 1787
 
2165
-					$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2166
-				}
2167
-			}
1788
+            // button states
1789
+            $output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1790
+            $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;} ";
1791
+            $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.";} ";
1792
+            $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;} ";
1793
+
1794
+
1795
+            // dropdown's
1796
+            $output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1797
+
1798
+
1799
+            // input states
1800
+            $output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
1801
+
1802
+            // page link
1803
+            $output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1804
+
1805
+            return $output;
1806
+        }
1807
+
1808
+        public static function css_secondary($color_code,$compatibility){;
1809
+            $color_code = sanitize_hex_color($color_code);
1810
+            if(!$color_code){return '';}
1811
+            /**
1812
+             * c = color, b = background color, o = border-color, f = fill
1813
+             */
1814
+            $selectors = array(
1815
+                '.btn-secondary' => array('b','o'),
1816
+                '.btn-secondary.disabled' => array('b','o'),
1817
+                '.btn-secondary:disabled' => array('b','o'),
1818
+                '.btn-outline-secondary' => array('c','o'),
1819
+                '.btn-outline-secondary:hover' => array('b','o'),
1820
+                '.btn-outline-secondary.disabled' => array('c'),
1821
+                '.btn-outline-secondary:disabled' => array('c'),
1822
+                '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
1823
+                '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
1824
+                '.btn-outline-secondary.dropdown-toggle' => array('b','o'),
1825
+                '.badge-secondary' => array('b'),
1826
+                '.alert-secondary' => array('b','o'),
1827
+                '.btn-link.btn-secondary' => array('c'),
1828
+            );
1829
+
1830
+            $important_selectors = array(
1831
+                '.bg-secondary' => array('b','f'),
1832
+                '.border-secondary' => array('o'),
1833
+                '.text-secondary' => array('c'),
1834
+            );
1835
+
1836
+            $color = array();
1837
+            $color_i = array();
1838
+            $background = array();
1839
+            $background_i = array();
1840
+            $border = array();
1841
+            $border_i = array();
1842
+            $fill = array();
1843
+            $fill_i = array();
1844
+
1845
+            $output = '';
1846
+
1847
+            // build rules into each type
1848
+            foreach($selectors as $selector => $types){
1849
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
1850
+                $types = array_combine($types,$types);
1851
+                if(isset($types['c'])){$color[] = $selector;}
1852
+                if(isset($types['b'])){$background[] = $selector;}
1853
+                if(isset($types['o'])){$border[] = $selector;}
1854
+                if(isset($types['f'])){$fill[] = $selector;}
1855
+            }
1856
+
1857
+            // build rules into each type
1858
+            foreach($important_selectors as $selector => $types){
1859
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
1860
+                $types = array_combine($types,$types);
1861
+                if(isset($types['c'])){$color_i[] = $selector;}
1862
+                if(isset($types['b'])){$background_i[] = $selector;}
1863
+                if(isset($types['o'])){$border_i[] = $selector;}
1864
+                if(isset($types['f'])){$fill_i[] = $selector;}
1865
+            }
1866
+
1867
+            // add any color rules
1868
+            if(!empty($color)){
1869
+                $output .= implode(",",$color) . "{color: $color_code;} ";
1870
+            }
1871
+            if(!empty($color_i)){
1872
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1873
+            }
1874
+
1875
+            // add any background color rules
1876
+            if(!empty($background)){
1877
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
1878
+            }
1879
+            if(!empty($background_i)){
1880
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1881
+            }
1882
+
1883
+            // add any border color rules
1884
+            if(!empty($border)){
1885
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
1886
+            }
1887
+            if(!empty($border_i)){
1888
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1889
+            }
1890
+
1891
+            // add any fill color rules
1892
+            if(!empty($fill)){
1893
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
1894
+            }
1895
+            if(!empty($fill_i)){
1896
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1897
+            }
1898
+
1899
+
1900
+            $prefix = $compatibility ? ".bsui " : "";
1901
+
1902
+            // darken
1903
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1904
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1905
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1906
+
1907
+            // lighten
1908
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1909
+
1910
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
1911
+            $op_25 = $color_code."40"; // 25% opacity
2168 1912
 
2169
-			$day_s3 = array();
2170
-			$day_s5 = array();
2171 1913
 
2172
-			for ( $i = 1; $i <= 7; $i ++ ) {
2173
-				$day_s3[] = addslashes( $params[ 'day_s3_' . $i ] );
2174
-				$day_s5[] = addslashes( $params[ 'day_s3_' . $i ] );
2175
-			}
1914
+            // button states
1915
+            $output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1916
+            $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;} ";
1917
+            $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.";} ";
1918
+            $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;} ";
2176 1919
 
2177
-			$month_s = array();
2178
-			$month_long = array();
2179 1920
 
2180
-			for ( $i = 1; $i <= 12; $i ++ ) {
2181
-				$month_s[] = addslashes( $params[ 'month_s_' . $i ] );
2182
-				$month_long[] = addslashes( $params[ 'month_long_' . $i ] );
2183
-			}
1921
+            return $output;
1922
+        }
1923
+
1924
+        /**
1925
+         * Increases or decreases the brightness of a color by a percentage of the current brightness.
1926
+         *
1927
+         * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
1928
+         * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
1929
+         *
1930
+         * @return  string
1931
+         */
1932
+        public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
1933
+            $hexCode = ltrim($hexCode, '#');
1934
+
1935
+            if (strlen($hexCode) == 3) {
1936
+                $hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
1937
+            }
1938
+
1939
+            $hexCode = array_map('hexdec', str_split($hexCode, 2));
1940
+
1941
+            foreach ($hexCode as & $color) {
1942
+                $adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
1943
+                $adjustAmount = ceil($adjustableLimit * $adjustPercent);
1944
+
1945
+                $color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
1946
+            }
1947
+
1948
+            return '#' . implode($hexCode);
1949
+        }
1950
+
1951
+        /**
1952
+         * Check if we should display examples.
1953
+         */
1954
+        public function maybe_show_examples(){
1955
+            if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
1956
+                echo "<head>";
1957
+                wp_head();
1958
+                echo "</head>";
1959
+                echo "<body>";
1960
+                echo $this->get_examples();
1961
+                echo "</body>";
1962
+                exit;
1963
+            }
1964
+        }
1965
+
1966
+        /**
1967
+         * Get developer examples.
1968
+         *
1969
+         * @return string
1970
+         */
1971
+        public function get_examples(){
1972
+            $output = '';
1973
+
1974
+
1975
+            // open form
1976
+            $output .= "<form class='p-5 m-5 border rounded'>";
1977
+
1978
+            // input example
1979
+            $output .= aui()->input(array(
1980
+                'type'  =>  'text',
1981
+                'id'    =>  'text-example',
1982
+                'name'    =>  'text-example',
1983
+                'placeholder'   => 'text placeholder',
1984
+                'title'   => 'Text input example',
1985
+                'value' =>  '',
1986
+                'required'  => false,
1987
+                'help_text' => 'help text',
1988
+                'label' => 'Text input example label'
1989
+            ));
1990
+
1991
+            // input example
1992
+            $output .= aui()->input(array(
1993
+                'type'  =>  'url',
1994
+                'id'    =>  'text-example2',
1995
+                'name'    =>  'text-example',
1996
+                'placeholder'   => 'url placeholder',
1997
+                'title'   => 'Text input example',
1998
+                'value' =>  '',
1999
+                'required'  => false,
2000
+                'help_text' => 'help text',
2001
+                'label' => 'Text input example label'
2002
+            ));
2003
+
2004
+            // checkbox example
2005
+            $output .= aui()->input(array(
2006
+                'type'  =>  'checkbox',
2007
+                'id'    =>  'checkbox-example',
2008
+                'name'    =>  'checkbox-example',
2009
+                'placeholder'   => 'checkbox-example',
2010
+                'title'   => 'Checkbox example',
2011
+                'value' =>  '1',
2012
+                'checked'   => true,
2013
+                'required'  => false,
2014
+                'help_text' => 'help text',
2015
+                'label' => 'Checkbox checked'
2016
+            ));
2017
+
2018
+            // checkbox example
2019
+            $output .= aui()->input(array(
2020
+                'type'  =>  'checkbox',
2021
+                'id'    =>  'checkbox-example2',
2022
+                'name'    =>  'checkbox-example2',
2023
+                'placeholder'   => 'checkbox-example',
2024
+                'title'   => 'Checkbox example',
2025
+                'value' =>  '1',
2026
+                'checked'   => false,
2027
+                'required'  => false,
2028
+                'help_text' => 'help text',
2029
+                'label' => 'Checkbox un-checked'
2030
+            ));
2031
+
2032
+            // switch example
2033
+            $output .= aui()->input(array(
2034
+                'type'  =>  'checkbox',
2035
+                'id'    =>  'switch-example',
2036
+                'name'    =>  'switch-example',
2037
+                'placeholder'   => 'checkbox-example',
2038
+                'title'   => 'Switch example',
2039
+                'value' =>  '1',
2040
+                'checked'   => true,
2041
+                'switch'    => true,
2042
+                'required'  => false,
2043
+                'help_text' => 'help text',
2044
+                'label' => 'Switch on'
2045
+            ));
2046
+
2047
+            // switch example
2048
+            $output .= aui()->input(array(
2049
+                'type'  =>  'checkbox',
2050
+                'id'    =>  'switch-example2',
2051
+                'name'    =>  'switch-example2',
2052
+                'placeholder'   => 'checkbox-example',
2053
+                'title'   => 'Switch example',
2054
+                'value' =>  '1',
2055
+                'checked'   => false,
2056
+                'switch'    => true,
2057
+                'required'  => false,
2058
+                'help_text' => 'help text',
2059
+                'label' => 'Switch off'
2060
+            ));
2061
+
2062
+            // close form
2063
+            $output .= "</form>";
2064
+
2065
+            return $output;
2066
+        }
2067
+
2068
+        /**
2069
+         * Calendar params.
2070
+         *
2071
+         * @since 0.1.44
2072
+         *
2073
+         * @return array Calendar params.
2074
+         */
2075
+        public static function calendar_params() {
2076
+            $params = array(
2077
+                'month_long_1' => __( 'January', 'aui' ),
2078
+                'month_long_2' => __( 'February', 'aui' ),
2079
+                'month_long_3' => __( 'March', 'aui' ),
2080
+                'month_long_4' => __( 'April', 'aui' ),
2081
+                'month_long_5' => __( 'May', 'aui' ),
2082
+                'month_long_6' => __( 'June', 'aui' ),
2083
+                'month_long_7' => __( 'July', 'aui' ),
2084
+                'month_long_8' => __( 'August', 'aui' ),
2085
+                'month_long_9' => __( 'September', 'aui' ),
2086
+                'month_long_10' => __( 'October', 'aui' ),
2087
+                'month_long_11' => __( 'November', 'aui' ),
2088
+                'month_long_12' => __( 'December', 'aui' ),
2089
+                'month_s_1' => _x( 'Jan', 'January abbreviation', 'aui' ),
2090
+                'month_s_2' => _x( 'Feb', 'February abbreviation', 'aui' ),
2091
+                'month_s_3' => _x( 'Mar', 'March abbreviation', 'aui' ),
2092
+                'month_s_4' => _x( 'Apr', 'April abbreviation', 'aui' ),
2093
+                'month_s_5' => _x( 'May', 'May abbreviation', 'aui' ),
2094
+                'month_s_6' => _x( 'Jun', 'June abbreviation', 'aui' ),
2095
+                'month_s_7' => _x( 'Jul', 'July abbreviation', 'aui' ),
2096
+                'month_s_8' => _x( 'Aug', 'August abbreviation', 'aui' ),
2097
+                'month_s_9' => _x( 'Sep', 'September abbreviation', 'aui' ),
2098
+                'month_s_10' => _x( 'Oct', 'October abbreviation', 'aui' ),
2099
+                'month_s_11' => _x( 'Nov', 'November abbreviation', 'aui' ),
2100
+                'month_s_12' => _x( 'Dec', 'December abbreviation', 'aui' ),
2101
+                'day_s1_1' => _x( 'S', 'Sunday initial', 'aui' ),
2102
+                'day_s1_2' => _x( 'M', 'Monday initial', 'aui' ),
2103
+                'day_s1_3' => _x( 'T', 'Tuesday initial', 'aui' ),
2104
+                'day_s1_4' => _x( 'W', 'Wednesday initial', 'aui' ),
2105
+                'day_s1_5' => _x( 'T', 'Friday initial', 'aui' ),
2106
+                'day_s1_6' => _x( 'F', 'Thursday initial', 'aui' ),
2107
+                'day_s1_7' => _x( 'S', 'Saturday initial', 'aui' ),
2108
+                'day_s2_1' => __( 'Su', 'aui' ),
2109
+                'day_s2_2' => __( 'Mo', 'aui' ),
2110
+                'day_s2_3' => __( 'Tu', 'aui' ),
2111
+                'day_s2_4' => __( 'We', 'aui' ),
2112
+                'day_s2_5' => __( 'Th', 'aui' ),
2113
+                'day_s2_6' => __( 'Fr', 'aui' ),
2114
+                'day_s2_7' => __( 'Sa', 'aui' ),
2115
+                'day_s3_1' => __( 'Sun', 'aui' ),
2116
+                'day_s3_2' => __( 'Mon', 'aui' ),
2117
+                'day_s3_3' => __( 'Tue', 'aui' ),
2118
+                'day_s3_4' => __( 'Wed', 'aui' ),
2119
+                'day_s3_5' => __( 'Thu', 'aui' ),
2120
+                'day_s3_6' => __( 'Fri', 'aui' ),
2121
+                'day_s3_7' => __( 'Sat', 'aui' ),
2122
+                'day_s5_1' => __( 'Sunday', 'aui' ),
2123
+                'day_s5_2' => __( 'Monday', 'aui' ),
2124
+                'day_s5_3' => __( 'Tuesday', 'aui' ),
2125
+                'day_s5_4' => __( 'Wednesday', 'aui' ),
2126
+                'day_s5_5' => __( 'Thursday', 'aui' ),
2127
+                'day_s5_6' => __( 'Friday', 'aui' ),
2128
+                'day_s5_7' => __( 'Saturday', 'aui' ),
2129
+                'am_lower' => __( 'am', 'aui' ),
2130
+                'pm_lower' => __( 'pm', 'aui' ),
2131
+                'am_upper' => __( 'AM', 'aui' ),
2132
+                'pm_upper' => __( 'PM', 'aui' ),
2133
+                'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
2134
+                'time_24hr' => false,
2135
+                'year' => __( 'Year', 'aui' ),
2136
+                'hour' => __( 'Hour', 'aui' ),
2137
+                'minute' => __( 'Minute', 'aui' ),
2138
+                'weekAbbreviation' => __( 'Wk', 'aui' ),
2139
+                'rangeSeparator' => __( ' to ', 'aui' ),
2140
+                'scrollTitle' => __( 'Scroll to increment', 'aui' ),
2141
+                'toggleTitle' => __( 'Click to toggle', 'aui' )
2142
+            );
2143
+
2144
+            return apply_filters( 'ayecode_ui_calendar_params', $params );
2145
+        }
2146
+
2147
+        /**
2148
+         * Flatpickr calendar localize.
2149
+         *
2150
+         * @since 0.1.44
2151
+         *
2152
+         * @return string Calendar locale.
2153
+         */
2154
+        public static function flatpickr_locale() {
2155
+            $params = self::calendar_params();
2156
+
2157
+            if ( is_string( $params ) ) {
2158
+                $params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
2159
+            } else {
2160
+                foreach ( (array) $params as $key => $value ) {
2161
+                    if ( ! is_scalar( $value ) ) {
2162
+                        continue;
2163
+                    }
2164
+
2165
+                    $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2166
+                }
2167
+            }
2168
+
2169
+            $day_s3 = array();
2170
+            $day_s5 = array();
2171
+
2172
+            for ( $i = 1; $i <= 7; $i ++ ) {
2173
+                $day_s3[] = addslashes( $params[ 'day_s3_' . $i ] );
2174
+                $day_s5[] = addslashes( $params[ 'day_s3_' . $i ] );
2175
+            }
2176
+
2177
+            $month_s = array();
2178
+            $month_long = array();
2179
+
2180
+            for ( $i = 1; $i <= 12; $i ++ ) {
2181
+                $month_s[] = addslashes( $params[ 'month_s_' . $i ] );
2182
+                $month_long[] = addslashes( $params[ 'month_long_' . $i ] );
2183
+            }
2184 2184
 
2185 2185
 ob_start();
2186 2186
 if ( 0 ) { ?><script><?php } ?>
@@ -2222,189 +2222,189 @@  discard block
 block discarded – undo
2222 2222
 }
2223 2223
 <?php if ( 0 ) { ?></script><?php } ?>
2224 2224
 <?php
2225
-			$locale = ob_get_clean();
2225
+            $locale = ob_get_clean();
2226 2226
 
2227
-			return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
2228
-		}
2227
+            return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
2228
+        }
2229 2229
 
2230
-		/**
2231
-		 * Select2 JS params.
2232
-		 *
2233
-		 * @since 0.1.44
2234
-		 *
2235
-		 * @return array Select2 JS params.
2236
-		 */
2237
-		public static function select2_params() {
2238
-			$params = array(
2239
-				'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'aui' ),
2240
-				'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'aui' ),
2241
-				'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'aui' ),
2242
-				'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'aui' ),
2243
-				'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'aui' ),
2244
-				'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'aui' ),
2245
-				'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'aui' ),
2246
-				'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'aui' ),
2247
-				'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'aui' ),
2248
-				'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'aui' ),
2249
-				'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'aui' )
2250
-			);
2251
-
2252
-			return apply_filters( 'ayecode_ui_select2_params', $params );
2253
-		}
2230
+        /**
2231
+         * Select2 JS params.
2232
+         *
2233
+         * @since 0.1.44
2234
+         *
2235
+         * @return array Select2 JS params.
2236
+         */
2237
+        public static function select2_params() {
2238
+            $params = array(
2239
+                'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'aui' ),
2240
+                'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'aui' ),
2241
+                'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'aui' ),
2242
+                'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'aui' ),
2243
+                'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'aui' ),
2244
+                'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'aui' ),
2245
+                'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'aui' ),
2246
+                'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'aui' ),
2247
+                'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'aui' ),
2248
+                'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'aui' ),
2249
+                'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'aui' )
2250
+            );
2251
+
2252
+            return apply_filters( 'ayecode_ui_select2_params', $params );
2253
+        }
2254 2254
 
2255
-		/**
2256
-		 * Select2 JS localize.
2257
-		 *
2258
-		 * @since 0.1.44
2259
-		 *
2260
-		 * @return string Select2 JS locale.
2261
-		 */
2262
-		public static function select2_locale() {
2263
-			$params = self::select2_params();
2264
-
2265
-			foreach ( (array) $params as $key => $value ) {
2266
-				if ( ! is_scalar( $value ) ) {
2267
-					continue;
2268
-				}
2255
+        /**
2256
+         * Select2 JS localize.
2257
+         *
2258
+         * @since 0.1.44
2259
+         *
2260
+         * @return string Select2 JS locale.
2261
+         */
2262
+        public static function select2_locale() {
2263
+            $params = self::select2_params();
2264
+
2265
+            foreach ( (array) $params as $key => $value ) {
2266
+                if ( ! is_scalar( $value ) ) {
2267
+                    continue;
2268
+                }
2269 2269
 
2270
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2271
-			}
2270
+                $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2271
+            }
2272 2272
 
2273
-			$locale = json_encode( $params );
2273
+            $locale = json_encode( $params );
2274 2274
 
2275
-			return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
2276
-		}
2275
+            return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
2276
+        }
2277 2277
 
2278
-		/**
2279
-		 * Time ago JS localize.
2280
-		 *
2281
-		 * @since 0.1.47
2282
-		 *
2283
-		 * @return string Time ago JS locale.
2284
-		 */
2285
-		public static function timeago_locale() {
2286
-			$params = array(
2287
-				'prefix_ago' => '',
2288
-				'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'aui' ),
2289
-				'prefix_after' => _x( 'after', 'time ago', 'aui' ) . ' ',
2290
-				'suffix_after' => '',
2291
-				'seconds' => _x( 'less than a minute', 'time ago', 'aui' ),
2292
-				'minute' => _x( 'about a minute', 'time ago', 'aui' ),
2293
-				'minutes' => _x( '%d minutes', 'time ago', 'aui' ),
2294
-				'hour' => _x( 'about an hour', 'time ago', 'aui' ),
2295
-				'hours' => _x( 'about %d hours', 'time ago', 'aui' ),
2296
-				'day' => _x( 'a day', 'time ago', 'aui' ),
2297
-				'days' => _x( '%d days', 'time ago', 'aui' ),
2298
-				'month' => _x( 'about a month', 'time ago', 'aui' ),
2299
-				'months' => _x( '%d months', 'time ago', 'aui' ),
2300
-				'year' => _x( 'about a year', 'time ago', 'aui' ),
2301
-				'years' => _x( '%d years', 'time ago', 'aui' ),
2302
-			);
2303
-
2304
-			$params = apply_filters( 'ayecode_ui_timeago_params', $params );
2305
-
2306
-			foreach ( (array) $params as $key => $value ) {
2307
-				if ( ! is_scalar( $value ) ) {
2308
-					continue;
2309
-				}
2278
+        /**
2279
+         * Time ago JS localize.
2280
+         *
2281
+         * @since 0.1.47
2282
+         *
2283
+         * @return string Time ago JS locale.
2284
+         */
2285
+        public static function timeago_locale() {
2286
+            $params = array(
2287
+                'prefix_ago' => '',
2288
+                'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'aui' ),
2289
+                'prefix_after' => _x( 'after', 'time ago', 'aui' ) . ' ',
2290
+                'suffix_after' => '',
2291
+                'seconds' => _x( 'less than a minute', 'time ago', 'aui' ),
2292
+                'minute' => _x( 'about a minute', 'time ago', 'aui' ),
2293
+                'minutes' => _x( '%d minutes', 'time ago', 'aui' ),
2294
+                'hour' => _x( 'about an hour', 'time ago', 'aui' ),
2295
+                'hours' => _x( 'about %d hours', 'time ago', 'aui' ),
2296
+                'day' => _x( 'a day', 'time ago', 'aui' ),
2297
+                'days' => _x( '%d days', 'time ago', 'aui' ),
2298
+                'month' => _x( 'about a month', 'time ago', 'aui' ),
2299
+                'months' => _x( '%d months', 'time ago', 'aui' ),
2300
+                'year' => _x( 'about a year', 'time ago', 'aui' ),
2301
+                'years' => _x( '%d years', 'time ago', 'aui' ),
2302
+            );
2303
+
2304
+            $params = apply_filters( 'ayecode_ui_timeago_params', $params );
2305
+
2306
+            foreach ( (array) $params as $key => $value ) {
2307
+                if ( ! is_scalar( $value ) ) {
2308
+                    continue;
2309
+                }
2310 2310
 
2311
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2312
-			}
2311
+                $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2312
+            }
2313 2313
 
2314
-			$locale = json_encode( $params );
2314
+            $locale = json_encode( $params );
2315 2315
 
2316
-			return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) );
2317
-		}
2316
+            return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) );
2317
+        }
2318 2318
 
2319
-		/**
2320
-		 * JavaScript Minifier
2321
-		 *
2322
-		 * @param $input
2323
-		 *
2324
-		 * @return mixed
2325
-		 */
2326
-		public static function minify_js($input) {
2327
-			if(trim($input) === "") return $input;
2328
-			return preg_replace(
2329
-				array(
2330
-					// Remove comment(s)
2331
-					'#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
2332
-					// Remove white-space(s) outside the string and regex
2333
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/)|\/(?!\/)[^\n\r]*?\/(?=[\s.,;]|[gimuy]|$))|\s*([!%&*\(\)\-=+\[\]\{\}|;:,.<>?\/])\s*#s',
2334
-					// Remove the last semicolon
2335
-					'#;+\}#',
2336
-					// Minify object attribute(s) except JSON attribute(s). From `{'foo':'bar'}` to `{foo:'bar'}`
2337
-					'#([\{,])([\'])(\d+|[a-z_][a-z0-9_]*)\2(?=\:)#i',
2338
-					// --ibid. From `foo['bar']` to `foo.bar`
2339
-					'#([a-z0-9_\)\]])\[([\'"])([a-z_][a-z0-9_]*)\2\]#i'
2340
-				),
2341
-				array(
2342
-					'$1',
2343
-					'$1$2',
2344
-					'}',
2345
-					'$1$3',
2346
-					'$1.$3'
2347
-				),
2348
-				$input);
2349
-		}
2319
+        /**
2320
+         * JavaScript Minifier
2321
+         *
2322
+         * @param $input
2323
+         *
2324
+         * @return mixed
2325
+         */
2326
+        public static function minify_js($input) {
2327
+            if(trim($input) === "") return $input;
2328
+            return preg_replace(
2329
+                array(
2330
+                    // Remove comment(s)
2331
+                    '#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
2332
+                    // Remove white-space(s) outside the string and regex
2333
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/)|\/(?!\/)[^\n\r]*?\/(?=[\s.,;]|[gimuy]|$))|\s*([!%&*\(\)\-=+\[\]\{\}|;:,.<>?\/])\s*#s',
2334
+                    // Remove the last semicolon
2335
+                    '#;+\}#',
2336
+                    // Minify object attribute(s) except JSON attribute(s). From `{'foo':'bar'}` to `{foo:'bar'}`
2337
+                    '#([\{,])([\'])(\d+|[a-z_][a-z0-9_]*)\2(?=\:)#i',
2338
+                    // --ibid. From `foo['bar']` to `foo.bar`
2339
+                    '#([a-z0-9_\)\]])\[([\'"])([a-z_][a-z0-9_]*)\2\]#i'
2340
+                ),
2341
+                array(
2342
+                    '$1',
2343
+                    '$1$2',
2344
+                    '}',
2345
+                    '$1$3',
2346
+                    '$1.$3'
2347
+                ),
2348
+                $input);
2349
+        }
2350 2350
 
2351
-		/**
2352
-		 * Minify CSS
2353
-		 *
2354
-		 * @param $input
2355
-		 *
2356
-		 * @return mixed
2357
-		 */
2358
-		public static function minify_css($input) {
2359
-			if(trim($input) === "") return $input;
2360
-			return preg_replace(
2361
-				array(
2362
-					// Remove comment(s)
2363
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')|\/\*(?!\!)(?>.*?\*\/)|^\s*|\s*$#s',
2364
-					// Remove unused white-space(s)
2365
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/))|\s*+;\s*+(})\s*+|\s*+([*$~^|]?+=|[{};,>~]|\s(?![0-9\.])|!important\b)\s*+|([[(:])\s++|\s++([])])|\s++(:)\s*+(?!(?>[^{}"\']++|"(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')*+{)|^\s++|\s++\z|(\s)\s+#si',
2366
-					// Replace `0(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)` with `0`
2367
-					'#(?<=[\s:])(0)(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)#si',
2368
-					// Replace `:0 0 0 0` with `:0`
2369
-					'#:(0\s+0|0\s+0\s+0\s+0)(?=[;\}]|\!important)#i',
2370
-					// Replace `background-position:0` with `background-position:0 0`
2371
-					'#(background-position):0(?=[;\}])#si',
2372
-					// Replace `0.6` with `.6`, but only when preceded by `:`, `,`, `-` or a white-space
2373
-					'#(?<=[\s:,\-])0+\.(\d+)#s',
2374
-					// Minify string value
2375
-					'#(\/\*(?>.*?\*\/))|(?<!content\:)([\'"])([a-z_][a-z0-9\-_]*?)\2(?=[\s\{\}\];,])#si',
2376
-					'#(\/\*(?>.*?\*\/))|(\burl\()([\'"])([^\s]+?)\3(\))#si',
2377
-					// Minify HEX color code
2378
-					'#(?<=[\s:,\-]\#)([a-f0-6]+)\1([a-f0-6]+)\2([a-f0-6]+)\3#i',
2379
-					// Replace `(border|outline):none` with `(border|outline):0`
2380
-					'#(?<=[\{;])(border|outline):none(?=[;\}\!])#',
2381
-					// Remove empty selector(s)
2382
-					'#(\/\*(?>.*?\*\/))|(^|[\{\}])(?:[^\s\{\}]+)\{\}#s'
2383
-				),
2384
-				array(
2385
-					'$1',
2386
-					'$1$2$3$4$5$6$7',
2387
-					'$1',
2388
-					':0',
2389
-					'$1:0 0',
2390
-					'.$1',
2391
-					'$1$3',
2392
-					'$1$2$4$5',
2393
-					'$1$2$3',
2394
-					'$1:0',
2395
-					'$1$2'
2396
-				),
2397
-				$input);
2398
-		}
2351
+        /**
2352
+         * Minify CSS
2353
+         *
2354
+         * @param $input
2355
+         *
2356
+         * @return mixed
2357
+         */
2358
+        public static function minify_css($input) {
2359
+            if(trim($input) === "") return $input;
2360
+            return preg_replace(
2361
+                array(
2362
+                    // Remove comment(s)
2363
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')|\/\*(?!\!)(?>.*?\*\/)|^\s*|\s*$#s',
2364
+                    // Remove unused white-space(s)
2365
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/))|\s*+;\s*+(})\s*+|\s*+([*$~^|]?+=|[{};,>~]|\s(?![0-9\.])|!important\b)\s*+|([[(:])\s++|\s++([])])|\s++(:)\s*+(?!(?>[^{}"\']++|"(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')*+{)|^\s++|\s++\z|(\s)\s+#si',
2366
+                    // Replace `0(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)` with `0`
2367
+                    '#(?<=[\s:])(0)(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)#si',
2368
+                    // Replace `:0 0 0 0` with `:0`
2369
+                    '#:(0\s+0|0\s+0\s+0\s+0)(?=[;\}]|\!important)#i',
2370
+                    // Replace `background-position:0` with `background-position:0 0`
2371
+                    '#(background-position):0(?=[;\}])#si',
2372
+                    // Replace `0.6` with `.6`, but only when preceded by `:`, `,`, `-` or a white-space
2373
+                    '#(?<=[\s:,\-])0+\.(\d+)#s',
2374
+                    // Minify string value
2375
+                    '#(\/\*(?>.*?\*\/))|(?<!content\:)([\'"])([a-z_][a-z0-9\-_]*?)\2(?=[\s\{\}\];,])#si',
2376
+                    '#(\/\*(?>.*?\*\/))|(\burl\()([\'"])([^\s]+?)\3(\))#si',
2377
+                    // Minify HEX color code
2378
+                    '#(?<=[\s:,\-]\#)([a-f0-6]+)\1([a-f0-6]+)\2([a-f0-6]+)\3#i',
2379
+                    // Replace `(border|outline):none` with `(border|outline):0`
2380
+                    '#(?<=[\{;])(border|outline):none(?=[;\}\!])#',
2381
+                    // Remove empty selector(s)
2382
+                    '#(\/\*(?>.*?\*\/))|(^|[\{\}])(?:[^\s\{\}]+)\{\}#s'
2383
+                ),
2384
+                array(
2385
+                    '$1',
2386
+                    '$1$2$3$4$5$6$7',
2387
+                    '$1',
2388
+                    ':0',
2389
+                    '$1:0 0',
2390
+                    '.$1',
2391
+                    '$1$3',
2392
+                    '$1$2$4$5',
2393
+                    '$1$2$3',
2394
+                    '$1:0',
2395
+                    '$1$2'
2396
+                ),
2397
+                $input);
2398
+        }
2399 2399
 
2400
-		/**
2401
-		 * Get the conditional fields JavaScript.
2402
-		 *
2403
-		 * @return mixed
2404
-		 */
2405
-		public function conditional_fields_js() {
2406
-			ob_start();
2407
-			?>
2400
+        /**
2401
+         * Get the conditional fields JavaScript.
2402
+         *
2403
+         * @return mixed
2404
+         */
2405
+        public function conditional_fields_js() {
2406
+            ob_start();
2407
+            ?>
2408 2408
 <script>
2409 2409
 /**
2410 2410
  * Conditional Fields
@@ -2908,14 +2908,14 @@  discard block
 block discarded – undo
2908 2908
 <?php do_action( 'aui_conditional_fields_js', $this ); ?>
2909 2909
 </script>
2910 2910
 			<?php
2911
-			$output = ob_get_clean();
2911
+            $output = ob_get_clean();
2912 2912
 
2913
-			return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) );
2914
-		}
2915
-	}
2913
+            return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) );
2914
+        }
2915
+    }
2916 2916
 
2917
-	/**
2918
-	 * Run the class if found.
2919
-	 */
2920
-	AyeCode_UI_Settings::instance();
2917
+    /**
2918
+     * Run the class if found.
2919
+     */
2920
+    AyeCode_UI_Settings::instance();
2921 2921
 }
2922 2922
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +401 added lines, -401 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,23 +98,23 @@  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
 
103 103
 				self::$instance = new AyeCode_UI_Settings;
104 104
 
105
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
105
+				add_action('init', array(self::$instance, 'init')); // set settings
106 106
 
107
-				if ( is_admin() ) {
108
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
109
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
107
+				if (is_admin()) {
108
+					add_action('admin_menu', array(self::$instance, 'menu_item'));
109
+					add_action('admin_init', array(self::$instance, 'register_settings'));
110 110
 
111 111
 					// Maybe show example page
112
-					add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
112
+					add_action('template_redirect', array(self::$instance, 'maybe_show_examples'));
113 113
 				}
114 114
 
115
-				add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
115
+				add_action('customize_register', array(self::$instance, 'customizer_settings'));
116 116
 
117
-				do_action( 'ayecode_ui_settings_loaded' );
117
+				do_action('ayecode_ui_settings_loaded');
118 118
 			}
119 119
 
120 120
 			return self::$instance;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		/**
124 124
 		 * Setup some constants.
125 125
 		 */
126
-		public function constants(){
126
+		public function constants() {
127 127
 			define('AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be");
128 128
 			define('AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d');
129 129
 			if (!defined('AUI_PRIMARY_COLOR')) define('AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL);
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
 		public function init() {
137 137
 
138 138
 			// Maybe fix settings
139
-			if ( ! empty( $_REQUEST['aui-fix-admin'] ) && !empty($_REQUEST['nonce']) && wp_verify_nonce( $_REQUEST['nonce'], "aui-fix-admin" ) ) {
140
-				$db_settings = get_option( 'ayecode-ui-settings' );
141
-				if ( ! empty( $db_settings ) ) {
139
+			if (!empty($_REQUEST['aui-fix-admin']) && !empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], "aui-fix-admin")) {
140
+				$db_settings = get_option('ayecode-ui-settings');
141
+				if (!empty($db_settings)) {
142 142
 					$db_settings['css_backend'] = 'compatibility';
143 143
 					$db_settings['js_backend'] = 'core-popper';
144
-					update_option( 'ayecode-ui-settings', $db_settings );
144
+					update_option('ayecode-ui-settings', $db_settings);
145 145
 					wp_safe_redirect(admin_url("options-general.php?page=ayecode-ui-settings&updated=true"));
146 146
 				}
147 147
 			}
@@ -155,31 +155,31 @@  discard block
 block discarded – undo
155 155
 			 *
156 156
 			 * We load super early in case there is a theme version that might change the colors
157 157
 			 */
158
-			if ( $this->settings['css'] ) {
158
+			if ($this->settings['css']) {
159 159
 				$priority = $this->is_bs3_compat() ? 100 : 1;
160
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), $priority );
160
+				add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), $priority);
161 161
 			}
162
-			if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
163
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
162
+			if ($this->settings['css_backend'] && $this->load_admin_scripts()) {
163
+				add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 1);
164 164
 			}
165 165
 
166 166
 			// maybe load JS
167
-			if ( $this->settings['js'] ) {
167
+			if ($this->settings['js']) {
168 168
 				$priority = $this->is_bs3_compat() ? 100 : 1;
169
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority );
169
+				add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), $priority);
170 170
 			}
171
-			if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
172
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
171
+			if ($this->settings['js_backend'] && $this->load_admin_scripts()) {
172
+				add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 1);
173 173
 			}
174 174
 
175 175
 			// Maybe set the HTML font size
176
-			if ( $this->settings['html_font_size'] ) {
177
-				add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
176
+			if ($this->settings['html_font_size']) {
177
+				add_action('wp_footer', array($this, 'html_font_size'), 10);
178 178
 			}
179 179
 
180 180
 			// Maybe show backend style error
181
-			if( $this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper' ){
182
-				add_action( 'admin_notices', array( $this, 'show_admin_style_notice' ) );
181
+			if ($this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper') {
182
+				add_action('admin_notices', array($this, 'show_admin_style_notice'));
183 183
 			}
184 184
 
185 185
 		}
@@ -187,11 +187,11 @@  discard block
 block discarded – undo
187 187
 		/**
188 188
 		 * Show admin notice if backend scripts not loaded.
189 189
 		 */
190
-		public function show_admin_style_notice(){
191
-			$fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=".wp_create_nonce('aui-fix-admin'));
192
-			$button = '<a href="'.esc_url($fix_url).'" class="button-primary">Fix Now</a>';
193
-			$message = __( '<b>Style Issue:</b> AyeCode UI is disable or set wrong.')." " .$button;
194
-			echo '<div class="notice notice-error aui-settings-error-notice"><p>'.$message.'</p></div>';
190
+		public function show_admin_style_notice() {
191
+			$fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=" . wp_create_nonce('aui-fix-admin'));
192
+			$button = '<a href="' . esc_url($fix_url) . '" class="button-primary">Fix Now</a>';
193
+			$message = __('<b>Style Issue:</b> AyeCode UI is disable or set wrong.') . " " . $button;
194
+			echo '<div class="notice notice-error aui-settings-error-notice"><p>' . $message . '</p></div>';
195 195
 		}
196 196
 
197 197
 		/**
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
 		 *
200 200
 		 * @return bool
201 201
 		 */
202
-		public function load_admin_scripts(){
202
+		public function load_admin_scripts() {
203 203
 			$result = true;
204 204
 
205 205
 			// check if specifically disabled
206
-			if(!empty($this->settings['disable_admin'])){
207
-				$url_parts = explode("\n",$this->settings['disable_admin']);
208
-				foreach($url_parts as $part){
209
-					if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
206
+			if (!empty($this->settings['disable_admin'])) {
207
+				$url_parts = explode("\n", $this->settings['disable_admin']);
208
+				foreach ($url_parts as $part) {
209
+					if (strpos($_SERVER['REQUEST_URI'], trim($part)) !== false) {
210 210
 						return false; // return early, no point checking further
211 211
 					}
212 212
 				}
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
 		/**
219 219
 		 * Add a html font size to the footer.
220 220
 		 */
221
-		public function html_font_size(){
221
+		public function html_font_size() {
222 222
 			$this->settings = $this->get_settings();
223
-			echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
223
+			echo "<style>html{font-size:" . absint($this->settings['html_font_size']) . "px;}</style>";
224 224
 		}
225 225
 
226 226
 		/**
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 		 * 
229 229
 		 * @return bool
230 230
 		 */
231
-		public function is_aui_screen(){
231
+		public function is_aui_screen() {
232 232
 //			echo '###';exit;
233 233
 			$load = false;
234 234
 			// check if we should load or not
235
-			if ( is_admin() ) {
235
+			if (is_admin()) {
236 236
 				// Only enable on set pages
237 237
 				$aui_screens = array(
238 238
 					'page',
@@ -242,24 +242,24 @@  discard block
 block discarded – undo
242 242
 					'widgets',
243 243
 					'ayecode-ui-settings',
244 244
 				);
245
-				$screen_ids = apply_filters( 'aui_screen_ids', $aui_screens );
245
+				$screen_ids = apply_filters('aui_screen_ids', $aui_screens);
246 246
 
247 247
 				$screen = get_current_screen();
248 248
 
249 249
 //				echo '###'.$screen->id;
250 250
 
251 251
 				// check if we are on a AUI screen
252
-				if ( $screen && in_array( $screen->id, $screen_ids ) ) {
252
+				if ($screen && in_array($screen->id, $screen_ids)) {
253 253
 					$load = true;
254 254
 				}
255 255
 
256 256
 				//load for widget previews in WP 5.8
257
-				if( !empty($_REQUEST['legacy-widget-preview'])){
257
+				if (!empty($_REQUEST['legacy-widget-preview'])) {
258 258
 					$load = true;
259 259
 				}
260 260
 			}
261 261
 
262
-			return apply_filters( 'aui_load_on_admin' , $load );
262
+			return apply_filters('aui_load_on_admin', $load);
263 263
 		}
264 264
 
265 265
 		/**
@@ -268,27 +268,27 @@  discard block
 block discarded – undo
268 268
 		public function enqueue_style() {
269 269
 
270 270
 
271
-			if( is_admin() && !$this->is_aui_screen()){
271
+			if (is_admin() && !$this->is_aui_screen()) {
272 272
 				// don't add wp-admin scripts if not requested to
273
-			}else{
273
+			} else {
274 274
 				$css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
275 275
 
276 276
 				$rtl = is_rtl() ? '-rtl' : '';
277 277
 
278
-				if($this->settings[$css_setting]){
279
-					$compatibility = $this->settings[$css_setting]=='core' ? false : true;
280
-					$url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets/css/ayecode-ui-compatibility'.$rtl.'.css';
281
-					wp_register_style( 'ayecode-ui', $url, array(), $this->latest );
282
-					wp_enqueue_style( 'ayecode-ui' );
278
+				if ($this->settings[$css_setting]) {
279
+					$compatibility = $this->settings[$css_setting] == 'core' ? false : true;
280
+					$url = $this->settings[$css_setting] == 'core' ? $this->url . 'assets/css/ayecode-ui' . $rtl . '.css' : $this->url . 'assets/css/ayecode-ui-compatibility' . $rtl . '.css';
281
+					wp_register_style('ayecode-ui', $url, array(), $this->latest);
282
+					wp_enqueue_style('ayecode-ui');
283 283
 
284 284
 					// flatpickr
285
-					wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->latest );
285
+					wp_register_style('flatpickr', $this->url . 'assets/css/flatpickr.min.css', array(), $this->latest);
286 286
 
287 287
 					// fontawesome-iconpicker
288 288
 					//wp_register_style( 'fontawesome-iconpicker', $this->url.'assets/css/flatpickr.min.css', array(), $this->latest );
289 289
 
290 290
 					// fix some wp-admin issues
291
-					if(is_admin()){
291
+					if (is_admin()) {
292 292
 						$custom_css = "
293 293
                 body{
294 294
                     background-color: #f1f1f1;
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
 						    padding: 0;
342 342
 						}
343 343
 					";
344
-						wp_add_inline_style( 'ayecode-ui', $custom_css );
344
+						wp_add_inline_style('ayecode-ui', $custom_css);
345 345
 					}
346 346
 
347 347
 					// custom changes
348
-					wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
348
+					wp_add_inline_style('ayecode-ui', self::custom_css($compatibility));
349 349
 
350 350
 				}
351 351
 			}
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 				function aui_init_flatpickr(){
606 606
 					if ( typeof jQuery.fn.flatpickr === "function" && !$aui_doing_init_flatpickr) {
607 607
 						$aui_doing_init_flatpickr = true;
608
-						<?php if ( ! empty( $flatpickr_locale ) ) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; ?>);}catch(err){console.log(err.message);}<?php } ?>
608
+						<?php if (!empty($flatpickr_locale)) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; ?>);}catch(err){console.log(err.message);}<?php } ?>
609 609
 						jQuery('input[data-aui-init="flatpickr"]:not(.flatpickr-input)').flatpickr();
610 610
 					}
611 611
 					$aui_doing_init_flatpickr = false;
@@ -1205,10 +1205,10 @@  discard block
 block discarded – undo
1205 1205
 			/*
1206 1206
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1207 1207
 			 */
1208
-			return str_replace( array(
1208
+			return str_replace(array(
1209 1209
 				'<script>',
1210 1210
 				'</script>'
1211
-			), '', self::minify_js($output) );
1211
+			), '', self::minify_js($output));
1212 1212
 		}
1213 1213
 
1214 1214
 
@@ -1222,13 +1222,13 @@  discard block
 block discarded – undo
1222 1222
 			ob_start();
1223 1223
 			?>
1224 1224
 			<script>
1225
-				<?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?>
1225
+				<?php if (defined('FUSION_BUILDER_VERSION')) { ?>
1226 1226
 				/* With Avada builder */
1227 1227
 
1228 1228
 				<?php } ?>
1229 1229
 			</script>
1230 1230
 			<?php
1231
-			return str_replace( array(
1231
+			return str_replace(array(
1232 1232
 				'<script>',
1233 1233
 				'</script>'
1234 1234
 			), '', ob_get_clean());
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
 		 *
1240 1240
 		 * If this remains small then its best to use this than to add another JS file.
1241 1241
 		 */
1242
-		public function inline_script_file_browser(){
1242
+		public function inline_script_file_browser() {
1243 1243
 			ob_start();
1244 1244
 			?>
1245 1245
 			<script>
@@ -1254,10 +1254,10 @@  discard block
 block discarded – undo
1254 1254
 			/*
1255 1255
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1256 1256
 			 */
1257
-			return str_replace( array(
1257
+			return str_replace(array(
1258 1258
 				'<script>',
1259 1259
 				'</script>'
1260
-			), '', $output );
1260
+			), '', $output);
1261 1261
 		}
1262 1262
 
1263 1263
 		/**
@@ -1265,53 +1265,53 @@  discard block
 block discarded – undo
1265 1265
 		 */
1266 1266
 		public function enqueue_scripts() {
1267 1267
 
1268
-			if( is_admin() && !$this->is_aui_screen()){
1268
+			if (is_admin() && !$this->is_aui_screen()) {
1269 1269
 				// don't add wp-admin scripts if not requested to
1270
-			}else {
1270
+			} else {
1271 1271
 
1272 1272
 				$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
1273 1273
 
1274 1274
 				// select2
1275
-				wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
1275
+				wp_register_script('select2', $this->url . 'assets/js/select2.min.js', array('jquery'), $this->select2_version);
1276 1276
 
1277 1277
 				// flatpickr
1278
-				wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->latest );
1278
+				wp_register_script('flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->latest);
1279 1279
 
1280 1280
 				// flatpickr
1281
-				wp_register_script( 'iconpicker', $this->url . 'assets/js/fontawesome-iconpicker.min.js', array(), $this->latest );
1281
+				wp_register_script('iconpicker', $this->url . 'assets/js/fontawesome-iconpicker.min.js', array(), $this->latest);
1282 1282
 				
1283 1283
 				// Bootstrap file browser
1284
-				wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
1285
-				wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
1284
+				wp_register_script('aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version);
1285
+				wp_add_inline_script('aui-custom-file-input', $this->inline_script_file_browser());
1286 1286
 
1287 1287
 				$load_inline = false;
1288 1288
 
1289
-				if ( $this->settings[ $js_setting ] == 'core-popper' ) {
1289
+				if ($this->settings[$js_setting] == 'core-popper') {
1290 1290
 					// Bootstrap bundle
1291 1291
 					$url = $this->url . 'assets/js/bootstrap.bundle.min.js';
1292
-					wp_register_script( 'bootstrap-js-bundle', $url, array(
1292
+					wp_register_script('bootstrap-js-bundle', $url, array(
1293 1293
 						'select2',
1294 1294
 						'jquery'
1295
-					), $this->latest, $this->is_bs3_compat() );
1295
+					), $this->latest, $this->is_bs3_compat());
1296 1296
 					// if in admin then add to footer for compatibility.
1297
-					is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
1297
+					is_admin() ? wp_enqueue_script('bootstrap-js-bundle', '', null, null, true) : wp_enqueue_script('bootstrap-js-bundle');
1298 1298
 					$script = $this->inline_script();
1299
-					wp_add_inline_script( 'bootstrap-js-bundle', $script );
1300
-				} elseif ( $this->settings[ $js_setting ] == 'popper' ) {
1299
+					wp_add_inline_script('bootstrap-js-bundle', $script);
1300
+				} elseif ($this->settings[$js_setting] == 'popper') {
1301 1301
 					$url = $this->url . 'assets/js/popper.min.js';
1302
-					wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->latest );
1303
-					wp_enqueue_script( 'bootstrap-js-popper' );
1302
+					wp_register_script('bootstrap-js-popper', $url, array('select2', 'jquery'), $this->latest);
1303
+					wp_enqueue_script('bootstrap-js-popper');
1304 1304
 					$load_inline = true;
1305 1305
 				} else {
1306 1306
 					$load_inline = true;
1307 1307
 				}
1308 1308
 
1309 1309
 				// Load needed inline scripts by faking the loading of a script if the main script is not being loaded
1310
-				if ( $load_inline ) {
1311
-					wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) );
1312
-					wp_enqueue_script( 'bootstrap-dummy' );
1310
+				if ($load_inline) {
1311
+					wp_register_script('bootstrap-dummy', '', array('select2', 'jquery'));
1312
+					wp_enqueue_script('bootstrap-dummy');
1313 1313
 					$script = $this->inline_script();
1314
-					wp_add_inline_script( 'bootstrap-dummy', $script );
1314
+					wp_add_inline_script('bootstrap-dummy', $script);
1315 1315
 				}
1316 1316
 			}
1317 1317
 
@@ -1320,17 +1320,17 @@  discard block
 block discarded – undo
1320 1320
 		/**
1321 1321
 		 * Enqueue flatpickr if called.
1322 1322
 		 */
1323
-		public function enqueue_flatpickr(){
1324
-			wp_enqueue_style( 'flatpickr' );
1325
-			wp_enqueue_script( 'flatpickr' );
1323
+		public function enqueue_flatpickr() {
1324
+			wp_enqueue_style('flatpickr');
1325
+			wp_enqueue_script('flatpickr');
1326 1326
 		}
1327 1327
 
1328 1328
 		/**
1329 1329
 		 * Enqueue iconpicker if called.
1330 1330
 		 */
1331
-		public function enqueue_iconpicker(){
1332
-			wp_enqueue_style( 'iconpicker' );
1333
-			wp_enqueue_script( 'iconpicker' );
1331
+		public function enqueue_iconpicker() {
1332
+			wp_enqueue_style('iconpicker');
1333
+			wp_enqueue_script('iconpicker');
1334 1334
 		}
1335 1335
 
1336 1336
 		/**
@@ -1342,15 +1342,15 @@  discard block
 block discarded – undo
1342 1342
 
1343 1343
 			$url = '';
1344 1344
 			// check if we are inside a plugin
1345
-			$file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
1345
+			$file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__)));
1346 1346
 
1347 1347
 			// add check in-case user has changed wp-content dir name.
1348 1348
 			$wp_content_folder_name = basename(WP_CONTENT_DIR);
1349
-			$dir_parts = explode("/$wp_content_folder_name/",$file_dir);
1350
-			$url_parts = explode("/$wp_content_folder_name/",plugins_url());
1349
+			$dir_parts = explode("/$wp_content_folder_name/", $file_dir);
1350
+			$url_parts = explode("/$wp_content_folder_name/", plugins_url());
1351 1351
 
1352
-			if(!empty($url_parts[0]) && !empty($dir_parts[1])){
1353
-				$url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
1352
+			if (!empty($url_parts[0]) && !empty($dir_parts[1])) {
1353
+				$url = trailingslashit($url_parts[0] . "/$wp_content_folder_name/" . $dir_parts[1]);
1354 1354
 			}
1355 1355
 
1356 1356
 			return $url;
@@ -1360,7 +1360,7 @@  discard block
 block discarded – undo
1360 1360
 		 * Register the database settings with WordPress.
1361 1361
 		 */
1362 1362
 		public function register_settings() {
1363
-			register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
1363
+			register_setting('ayecode-ui-settings', 'ayecode-ui-settings');
1364 1364
 		}
1365 1365
 
1366 1366
 		/**
@@ -1369,10 +1369,10 @@  discard block
 block discarded – undo
1369 1369
 		 */
1370 1370
 		public function menu_item() {
1371 1371
 			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
1372
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
1372
+			call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
1373 1373
 				$this,
1374 1374
 				'settings_page'
1375
-			) );
1375
+			));
1376 1376
 		}
1377 1377
 
1378 1378
 		/**
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
 		 *
1381 1381
 		 * @return array
1382 1382
 		 */
1383
-		public function theme_js_settings(){
1383
+		public function theme_js_settings() {
1384 1384
 			return array(
1385 1385
 				'ayetheme' => 'popper',
1386 1386
 				'listimia' => 'required',
@@ -1396,17 +1396,17 @@  discard block
 block discarded – undo
1396 1396
 		 */
1397 1397
 		public function get_settings() {
1398 1398
 
1399
-			$db_settings = get_option( 'ayecode-ui-settings' );
1399
+			$db_settings = get_option('ayecode-ui-settings');
1400 1400
 			$js_default = 'core-popper';
1401 1401
 			$js_default_backend = $js_default;
1402 1402
 
1403 1403
 			// maybe set defaults (if no settings set)
1404
-			if(empty($db_settings)){
1405
-				$active_theme = strtolower( get_template() ); // active parent theme.
1404
+			if (empty($db_settings)) {
1405
+				$active_theme = strtolower(get_template()); // active parent theme.
1406 1406
 				$theme_js_settings = self::theme_js_settings();
1407
-				if(isset($theme_js_settings[$active_theme])){
1407
+				if (isset($theme_js_settings[$active_theme])) {
1408 1408
 					$js_default = $theme_js_settings[$active_theme];
1409
-					$js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
1409
+					$js_default_backend = isset($theme_js_settings[$active_theme . "_backend"]) ? $theme_js_settings[$active_theme . "_backend"] : $js_default;
1410 1410
 				}
1411 1411
 			}
1412 1412
 
@@ -1419,14 +1419,14 @@  discard block
 block discarded – undo
1419 1419
 				'disable_admin'     =>  '', // URL snippets to disable loading on admin
1420 1420
 			);
1421 1421
 
1422
-			$settings = wp_parse_args( $db_settings, $defaults );
1422
+			$settings = wp_parse_args($db_settings, $defaults);
1423 1423
 
1424 1424
 			/**
1425 1425
 			 * Filter the Bootstrap settings.
1426 1426
 			 *
1427 1427
 			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
1428 1428
 			 */
1429
-			return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
1429
+			return $this->settings = apply_filters('ayecode-ui-settings', $settings, $db_settings, $defaults);
1430 1430
 		}
1431 1431
 
1432 1432
 
@@ -1434,90 +1434,90 @@  discard block
 block discarded – undo
1434 1434
 		 * The settings page html output.
1435 1435
 		 */
1436 1436
 		public function settings_page() {
1437
-			if ( ! current_user_can( 'manage_options' ) ) {
1438
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
1437
+			if (!current_user_can('manage_options')) {
1438
+				wp_die(__('You do not have sufficient permissions to access this page.', 'aui'));
1439 1439
 			}
1440 1440
 			?>
1441 1441
 			<div class="wrap">
1442 1442
 				<h1><?php echo $this->name; ?></h1>
1443
-				<p><?php _e("Here you can adjust settings if you are having compatibility issues.",'aui');?></p>
1443
+				<p><?php _e("Here you can adjust settings if you are having compatibility issues.", 'aui'); ?></p>
1444 1444
 				<form method="post" action="options.php">
1445 1445
 					<?php
1446
-					settings_fields( 'ayecode-ui-settings' );
1447
-					do_settings_sections( 'ayecode-ui-settings' );
1446
+					settings_fields('ayecode-ui-settings');
1447
+					do_settings_sections('ayecode-ui-settings');
1448 1448
 					?>
1449 1449
 
1450
-					<h2><?php _e( 'Frontend', 'aui' ); ?></h2>
1450
+					<h2><?php _e('Frontend', 'aui'); ?></h2>
1451 1451
 					<table class="form-table wpbs-table-settings">
1452 1452
 						<tr valign="top">
1453 1453
 							<th scope="row"><label
1454
-									for="wpbs-css"><?php _e( 'Load CSS', 'aui' ); ?></label></th>
1454
+									for="wpbs-css"><?php _e('Load CSS', 'aui'); ?></label></th>
1455 1455
 							<td>
1456 1456
 								<select name="ayecode-ui-settings[css]" id="wpbs-css">
1457
-									<option	value="compatibility" <?php selected( $this->settings['css'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode (default)', 'aui' ); ?></option>
1458
-									<option value="core" <?php selected( $this->settings['css'], 'core' ); ?>><?php _e( 'Full Mode', 'aui' ); ?></option>
1459
-									<option	value="" <?php selected( $this->settings['css'], '' ); ?>><?php _e( 'Disabled', 'aui' ); ?></option>
1457
+									<option	value="compatibility" <?php selected($this->settings['css'], 'compatibility'); ?>><?php _e('Compatibility Mode (default)', 'aui'); ?></option>
1458
+									<option value="core" <?php selected($this->settings['css'], 'core'); ?>><?php _e('Full Mode', 'aui'); ?></option>
1459
+									<option	value="" <?php selected($this->settings['css'], ''); ?>><?php _e('Disabled', 'aui'); ?></option>
1460 1460
 								</select>
1461 1461
 							</td>
1462 1462
 						</tr>
1463 1463
 
1464 1464
 						<tr valign="top">
1465 1465
 							<th scope="row"><label
1466
-									for="wpbs-js"><?php _e( 'Load JS', 'aui' ); ?></label></th>
1466
+									for="wpbs-js"><?php _e('Load JS', 'aui'); ?></label></th>
1467 1467
 							<td>
1468 1468
 								<select name="ayecode-ui-settings[js]" id="wpbs-js">
1469
-									<option	value="core-popper" <?php selected( $this->settings['js'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'aui' ); ?></option>
1470
-									<option value="popper" <?php selected( $this->settings['js'], 'popper' ); ?>><?php _e( 'Popper', 'aui' ); ?></option>
1471
-									<option value="required" <?php selected( $this->settings['js'], 'required' ); ?>><?php _e( 'Required functions only', 'aui' ); ?></option>
1472
-									<option	value="" <?php selected( $this->settings['js'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'aui' ); ?></option>
1469
+									<option	value="core-popper" <?php selected($this->settings['js'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'aui'); ?></option>
1470
+									<option value="popper" <?php selected($this->settings['js'], 'popper'); ?>><?php _e('Popper', 'aui'); ?></option>
1471
+									<option value="required" <?php selected($this->settings['js'], 'required'); ?>><?php _e('Required functions only', 'aui'); ?></option>
1472
+									<option	value="" <?php selected($this->settings['js'], ''); ?>><?php _e('Disabled (not recommended)', 'aui'); ?></option>
1473 1473
 								</select>
1474 1474
 							</td>
1475 1475
 						</tr>
1476 1476
 
1477 1477
 						<tr valign="top">
1478 1478
 							<th scope="row"><label
1479
-									for="wpbs-font_size"><?php _e( 'HTML Font Size (px)', 'aui' ); ?></label></th>
1479
+									for="wpbs-font_size"><?php _e('HTML Font Size (px)', 'aui'); ?></label></th>
1480 1480
 							<td>
1481
-								<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" />
1482
-								<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>
1481
+								<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" />
1482
+								<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>
1483 1483
 							</td>
1484 1484
 						</tr>
1485 1485
 
1486 1486
 					</table>
1487 1487
 
1488
-					<h2><?php _e( 'Backend', 'aui' ); ?> (wp-admin)</h2>
1488
+					<h2><?php _e('Backend', 'aui'); ?> (wp-admin)</h2>
1489 1489
 					<table class="form-table wpbs-table-settings">
1490 1490
 						<tr valign="top">
1491 1491
 							<th scope="row"><label
1492
-									for="wpbs-css-admin"><?php _e( 'Load CSS', 'aui' ); ?></label></th>
1492
+									for="wpbs-css-admin"><?php _e('Load CSS', 'aui'); ?></label></th>
1493 1493
 							<td>
1494 1494
 								<select name="ayecode-ui-settings[css_backend]" id="wpbs-css-admin">
1495
-									<option	value="compatibility" <?php selected( $this->settings['css_backend'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode (default)', 'aui' ); ?></option>
1496
-									<option value="core" <?php selected( $this->settings['css_backend'], 'core' ); ?>><?php _e( 'Full Mode (will cause style issues)', 'aui' ); ?></option>
1497
-									<option	value="" <?php selected( $this->settings['css_backend'], '' ); ?>><?php _e( 'Disabled', 'aui' ); ?></option>
1495
+									<option	value="compatibility" <?php selected($this->settings['css_backend'], 'compatibility'); ?>><?php _e('Compatibility Mode (default)', 'aui'); ?></option>
1496
+									<option value="core" <?php selected($this->settings['css_backend'], 'core'); ?>><?php _e('Full Mode (will cause style issues)', 'aui'); ?></option>
1497
+									<option	value="" <?php selected($this->settings['css_backend'], ''); ?>><?php _e('Disabled', 'aui'); ?></option>
1498 1498
 								</select>
1499 1499
 							</td>
1500 1500
 						</tr>
1501 1501
 
1502 1502
 						<tr valign="top">
1503 1503
 							<th scope="row"><label
1504
-									for="wpbs-js-admin"><?php _e( 'Load JS', 'aui' ); ?></label></th>
1504
+									for="wpbs-js-admin"><?php _e('Load JS', 'aui'); ?></label></th>
1505 1505
 							<td>
1506 1506
 								<select name="ayecode-ui-settings[js_backend]" id="wpbs-js-admin">
1507
-									<option	value="core-popper" <?php selected( $this->settings['js_backend'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'aui' ); ?></option>
1508
-									<option value="popper" <?php selected( $this->settings['js_backend'], 'popper' ); ?>><?php _e( 'Popper', 'aui' ); ?></option>
1509
-									<option value="required" <?php selected( $this->settings['js_backend'], 'required' ); ?>><?php _e( 'Required functions only', 'aui' ); ?></option>
1510
-									<option	value="" <?php selected( $this->settings['js_backend'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'aui' ); ?></option>
1507
+									<option	value="core-popper" <?php selected($this->settings['js_backend'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'aui'); ?></option>
1508
+									<option value="popper" <?php selected($this->settings['js_backend'], 'popper'); ?>><?php _e('Popper', 'aui'); ?></option>
1509
+									<option value="required" <?php selected($this->settings['js_backend'], 'required'); ?>><?php _e('Required functions only', 'aui'); ?></option>
1510
+									<option	value="" <?php selected($this->settings['js_backend'], ''); ?>><?php _e('Disabled (not recommended)', 'aui'); ?></option>
1511 1511
 								</select>
1512 1512
 							</td>
1513 1513
 						</tr>
1514 1514
 
1515 1515
 						<tr valign="top">
1516 1516
 							<th scope="row"><label
1517
-									for="wpbs-disable-admin"><?php _e( 'Disable load on URL', 'aui' ); ?></label></th>
1517
+									for="wpbs-disable-admin"><?php _e('Disable load on URL', 'aui'); ?></label></th>
1518 1518
 							<td>
1519
-								<p><?php _e( 'If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'aui' ); ?></p>
1520
-								<textarea name="ayecode-ui-settings[disable_admin]" rows="10" cols="50" id="wpbs-disable-admin" class="large-text code" spellcheck="false" placeholder="myplugin.php &#10;action=go"><?php echo $this->settings['disable_admin'];?></textarea>
1519
+								<p><?php _e('If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'aui'); ?></p>
1520
+								<textarea name="ayecode-ui-settings[disable_admin]" rows="10" cols="50" id="wpbs-disable-admin" class="large-text code" spellcheck="false" placeholder="myplugin.php &#10;action=go"><?php echo $this->settings['disable_admin']; ?></textarea>
1521 1521
 
1522 1522
 							</td>
1523 1523
 						</tr>
@@ -1535,9 +1535,9 @@  discard block
 block discarded – undo
1535 1535
 			<?php
1536 1536
 		}
1537 1537
 
1538
-		public function customizer_settings($wp_customize){
1538
+		public function customizer_settings($wp_customize) {
1539 1539
 			$wp_customize->add_section('aui_settings', array(
1540
-				'title'    => __('AyeCode UI','aui'),
1540
+				'title'    => __('AyeCode UI', 'aui'),
1541 1541
 				'priority' => 120,
1542 1542
 			));
1543 1543
 
@@ -1551,8 +1551,8 @@  discard block
 block discarded – undo
1551 1551
 				'type'              => 'option',
1552 1552
 				'transport'         => 'refresh',
1553 1553
 			));
1554
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1555
-				'label'    => __('Primary Color','aui'),
1554
+			$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1555
+				'label'    => __('Primary Color', 'aui'),
1556 1556
 				'section'  => 'aui_settings',
1557 1557
 				'settings' => 'aui_options[color_primary]',
1558 1558
 			)));
@@ -1564,8 +1564,8 @@  discard block
 block discarded – undo
1564 1564
 				'type'              => 'option',
1565 1565
 				'transport'         => 'refresh',
1566 1566
 			));
1567
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1568
-				'label'    => __('Secondary Color','aui'),
1567
+			$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1568
+				'label'    => __('Secondary Color', 'aui'),
1569 1569
 				'section'  => 'aui_settings',
1570 1570
 				'settings' => 'aui_options[color_secondary]',
1571 1571
 			)));
@@ -1591,12 +1591,12 @@  discard block
 block discarded – undo
1591 1591
 			.collapse.show:not(.in){display: inherit;}
1592 1592
 			.fade.show{opacity: 1;}
1593 1593
 
1594
-			<?php if( defined( 'SVQ_THEME_VERSION' ) ){ ?>
1594
+			<?php if (defined('SVQ_THEME_VERSION')) { ?>
1595 1595
 			/* KLEO theme specific */
1596 1596
 			.kleo-main-header .navbar-collapse.collapse.show:not(.in){display: block !important;}
1597 1597
 			<?php } ?>
1598 1598
 
1599
-			<?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?>
1599
+			<?php if (defined('FUSION_BUILDER_VERSION')) { ?>
1600 1600
 			/* With Avada builder */
1601 1601
 			body.modal-open .modal.in  {opacity:1;z-index: 99999}
1602 1602
 			body.modal-open .modal.bsui.in .modal-content  {box-shadow: none;}
@@ -1604,10 +1604,10 @@  discard block
 block discarded – undo
1604 1604
 			<?php } ?>
1605 1605
 			</style>
1606 1606
 			<?php
1607
-			return str_replace( array(
1607
+			return str_replace(array(
1608 1608
 				'<style>',
1609 1609
 				'</style>'
1610
-			), '', self::minify_css( ob_get_clean() ) );
1610
+			), '', self::minify_css(ob_get_clean()));
1611 1611
 		}
1612 1612
 
1613 1613
 
@@ -1624,22 +1624,22 @@  discard block
 block discarded – undo
1624 1624
 				<?php
1625 1625
 
1626 1626
 					// BS v3 compat
1627
-					if( self::is_bs3_compat() ){
1627
+					if (self::is_bs3_compat()) {
1628 1628
 					    echo self::bs3_compat_css();
1629 1629
 					}
1630 1630
 
1631
-					if(!is_admin() && $primary_color != AUI_PRIMARY_COLOR_ORIGINAL){
1632
-						echo self::css_primary($primary_color,$compatibility);
1631
+					if (!is_admin() && $primary_color != AUI_PRIMARY_COLOR_ORIGINAL) {
1632
+						echo self::css_primary($primary_color, $compatibility);
1633 1633
 					}
1634 1634
 
1635
-					if(!is_admin() && $secondary_color != AUI_SECONDARY_COLOR_ORIGINAL){
1636
-						echo self::css_secondary($settings['color_secondary'],$compatibility);
1635
+					if (!is_admin() && $secondary_color != AUI_SECONDARY_COLOR_ORIGINAL) {
1636
+						echo self::css_secondary($settings['color_secondary'], $compatibility);
1637 1637
 					}
1638 1638
 
1639 1639
 					// Set admin bar z-index lower when modal is open.
1640 1640
 					echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}';
1641 1641
 
1642
-					if(is_admin()){
1642
+					if (is_admin()) {
1643 1643
 						echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}';
1644 1644
 					}
1645 1645
                 ?>
@@ -1650,10 +1650,10 @@  discard block
 block discarded – undo
1650 1650
 			/*
1651 1651
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1652 1652
 			 */
1653
-			return str_replace( array(
1653
+			return str_replace(array(
1654 1654
 				'<style>',
1655 1655
 				'</style>'
1656
-			), '', self::minify_css( ob_get_clean() ) );
1656
+			), '', self::minify_css(ob_get_clean()));
1657 1657
 		}
1658 1658
 
1659 1659
 		/**
@@ -1661,48 +1661,48 @@  discard block
 block discarded – undo
1661 1661
 		 *
1662 1662
 		 * @return bool
1663 1663
 		 */
1664
-		public static function is_bs3_compat(){
1664
+		public static function is_bs3_compat() {
1665 1665
 			return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
1666 1666
 		}
1667 1667
 
1668
-		public static function css_primary($color_code,$compatibility){;
1668
+		public static function css_primary($color_code, $compatibility) {;
1669 1669
 			$color_code = sanitize_hex_color($color_code);
1670
-			if(!$color_code){return '';}
1670
+			if (!$color_code) {return ''; }
1671 1671
 			/**
1672 1672
 			 * c = color, b = background color, o = border-color, f = fill
1673 1673
 			 */
1674 1674
 			$selectors = array(
1675 1675
 				'a' => array('c'),
1676
-				'.btn-primary' => array('b','o'),
1677
-				'.btn-primary.disabled' => array('b','o'),
1678
-				'.btn-primary:disabled' => array('b','o'),
1679
-				'.btn-outline-primary' => array('c','o'),
1680
-				'.btn-outline-primary:hover' => array('b','o'),
1681
-				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
1682
-				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
1683
-				'.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
1676
+				'.btn-primary' => array('b', 'o'),
1677
+				'.btn-primary.disabled' => array('b', 'o'),
1678
+				'.btn-primary:disabled' => array('b', 'o'),
1679
+				'.btn-outline-primary' => array('c', 'o'),
1680
+				'.btn-outline-primary:hover' => array('b', 'o'),
1681
+				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b', 'o'),
1682
+				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b', 'o'),
1683
+				'.show>.btn-outline-primary.dropdown-toggle' => array('b', 'o'),
1684 1684
 				'.btn-link' => array('c'),
1685 1685
 				'.dropdown-item.active' => array('b'),
1686
-				'.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
1687
-				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
1686
+				'.custom-control-input:checked~.custom-control-label::before' => array('b', 'o'),
1687
+				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b', 'o'),
1688 1688
 //				'.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
1689 1689
 //				'.custom-range::-moz-range-thumb' => array('b'),
1690 1690
 //				'.custom-range::-ms-thumb' => array('b'),
1691 1691
 				'.nav-pills .nav-link.active' => array('b'),
1692 1692
 				'.nav-pills .show>.nav-link' => array('b'),
1693 1693
 				'.page-link' => array('c'),
1694
-				'.page-item.active .page-link' => array('b','o'),
1694
+				'.page-item.active .page-link' => array('b', 'o'),
1695 1695
 				'.badge-primary' => array('b'),
1696
-				'.alert-primary' => array('b','o'),
1696
+				'.alert-primary' => array('b', 'o'),
1697 1697
 				'.progress-bar' => array('b'),
1698
-				'.list-group-item.active' => array('b','o'),
1699
-				'.bg-primary' => array('b','f'),
1698
+				'.list-group-item.active' => array('b', 'o'),
1699
+				'.bg-primary' => array('b', 'f'),
1700 1700
 				'.btn-link.btn-primary' => array('c'),
1701 1701
 				'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
1702 1702
 			);
1703 1703
 
1704 1704
 			$important_selectors = array(
1705
-				'.bg-primary' => array('b','f'),
1705
+				'.bg-primary' => array('b', 'f'),
1706 1706
 				'.border-primary' => array('o'),
1707 1707
 				'.text-primary' => array('c'),
1708 1708
 			);
@@ -1719,116 +1719,116 @@  discard block
 block discarded – undo
1719 1719
 			$output = '';
1720 1720
 
1721 1721
 			// build rules into each type
1722
-			foreach($selectors as $selector => $types){
1723
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1724
-				$types = array_combine($types,$types);
1725
-				if(isset($types['c'])){$color[] = $selector;}
1726
-				if(isset($types['b'])){$background[] = $selector;}
1727
-				if(isset($types['o'])){$border[] = $selector;}
1728
-				if(isset($types['f'])){$fill[] = $selector;}
1722
+			foreach ($selectors as $selector => $types) {
1723
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1724
+				$types = array_combine($types, $types);
1725
+				if (isset($types['c'])) {$color[] = $selector; }
1726
+				if (isset($types['b'])) {$background[] = $selector; }
1727
+				if (isset($types['o'])) {$border[] = $selector; }
1728
+				if (isset($types['f'])) {$fill[] = $selector; }
1729 1729
 			}
1730 1730
 
1731 1731
 			// build rules into each type
1732
-			foreach($important_selectors as $selector => $types){
1733
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1734
-				$types = array_combine($types,$types);
1735
-				if(isset($types['c'])){$color_i[] = $selector;}
1736
-				if(isset($types['b'])){$background_i[] = $selector;}
1737
-				if(isset($types['o'])){$border_i[] = $selector;}
1738
-				if(isset($types['f'])){$fill_i[] = $selector;}
1732
+			foreach ($important_selectors as $selector => $types) {
1733
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1734
+				$types = array_combine($types, $types);
1735
+				if (isset($types['c'])) {$color_i[] = $selector; }
1736
+				if (isset($types['b'])) {$background_i[] = $selector; }
1737
+				if (isset($types['o'])) {$border_i[] = $selector; }
1738
+				if (isset($types['f'])) {$fill_i[] = $selector; }
1739 1739
 			}
1740 1740
 
1741 1741
 			// add any color rules
1742
-			if(!empty($color)){
1743
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1742
+			if (!empty($color)) {
1743
+				$output .= implode(",", $color) . "{color: $color_code;} ";
1744 1744
 			}
1745
-			if(!empty($color_i)){
1746
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1745
+			if (!empty($color_i)) {
1746
+				$output .= implode(",", $color_i) . "{color: $color_code !important;} ";
1747 1747
 			}
1748 1748
 
1749 1749
 			// add any background color rules
1750
-			if(!empty($background)){
1751
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1750
+			if (!empty($background)) {
1751
+				$output .= implode(",", $background) . "{background-color: $color_code;} ";
1752 1752
 			}
1753
-			if(!empty($background_i)){
1754
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1753
+			if (!empty($background_i)) {
1754
+				$output .= implode(",", $background_i) . "{background-color: $color_code !important;} ";
1755 1755
 			}
1756 1756
 
1757 1757
 			// add any border color rules
1758
-			if(!empty($border)){
1759
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1758
+			if (!empty($border)) {
1759
+				$output .= implode(",", $border) . "{border-color: $color_code;} ";
1760 1760
 			}
1761
-			if(!empty($border_i)){
1762
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1761
+			if (!empty($border_i)) {
1762
+				$output .= implode(",", $border_i) . "{border-color: $color_code !important;} ";
1763 1763
 			}
1764 1764
 
1765 1765
 			// add any fill color rules
1766
-			if(!empty($fill)){
1767
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1766
+			if (!empty($fill)) {
1767
+				$output .= implode(",", $fill) . "{fill: $color_code;} ";
1768 1768
 			}
1769
-			if(!empty($fill_i)){
1770
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1769
+			if (!empty($fill_i)) {
1770
+				$output .= implode(",", $fill_i) . "{fill: $color_code !important;} ";
1771 1771
 			}
1772 1772
 
1773 1773
 
1774 1774
 			$prefix = $compatibility ? ".bsui " : "";
1775 1775
 
1776 1776
 			// darken
1777
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1778
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1779
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1777
+			$darker_075 = self::css_hex_lighten_darken($color_code, "-0.075");
1778
+			$darker_10 = self::css_hex_lighten_darken($color_code, "-0.10");
1779
+			$darker_125 = self::css_hex_lighten_darken($color_code, "-0.125");
1780 1780
 
1781 1781
 			// lighten
1782
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1782
+			$lighten_25 = self::css_hex_lighten_darken($color_code, "0.25");
1783 1783
 
1784 1784
 			// opacity see https://css-tricks.com/8-digit-hex-codes/
1785
-			$op_25 = $color_code."40"; // 25% opacity
1785
+			$op_25 = $color_code . "40"; // 25% opacity
1786 1786
 
1787 1787
 
1788 1788
 			// button states
1789
-			$output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1790
-			$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;} ";
1791
-			$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.";} ";
1792
-			$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;} ";
1789
+			$output .= $prefix . " .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: " . $darker_075 . ";    border-color: " . $darker_10 . ";} ";
1790
+			$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;} ";
1791
+			$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 . ";} ";
1792
+			$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;} ";
1793 1793
 
1794 1794
 
1795 1795
 			// dropdown's
1796
-			$output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1796
+			$output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1797 1797
 
1798 1798
 
1799 1799
 			// input states
1800
-			$output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
1800
+			$output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
1801 1801
 
1802 1802
 			// page link
1803
-			$output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1803
+			$output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1804 1804
 
1805 1805
 			return $output;
1806 1806
 		}
1807 1807
 
1808
-		public static function css_secondary($color_code,$compatibility){;
1808
+		public static function css_secondary($color_code, $compatibility) {;
1809 1809
 			$color_code = sanitize_hex_color($color_code);
1810
-			if(!$color_code){return '';}
1810
+			if (!$color_code) {return ''; }
1811 1811
 			/**
1812 1812
 			 * c = color, b = background color, o = border-color, f = fill
1813 1813
 			 */
1814 1814
 			$selectors = array(
1815
-				'.btn-secondary' => array('b','o'),
1816
-				'.btn-secondary.disabled' => array('b','o'),
1817
-				'.btn-secondary:disabled' => array('b','o'),
1818
-				'.btn-outline-secondary' => array('c','o'),
1819
-				'.btn-outline-secondary:hover' => array('b','o'),
1815
+				'.btn-secondary' => array('b', 'o'),
1816
+				'.btn-secondary.disabled' => array('b', 'o'),
1817
+				'.btn-secondary:disabled' => array('b', 'o'),
1818
+				'.btn-outline-secondary' => array('c', 'o'),
1819
+				'.btn-outline-secondary:hover' => array('b', 'o'),
1820 1820
 				'.btn-outline-secondary.disabled' => array('c'),
1821 1821
 				'.btn-outline-secondary:disabled' => array('c'),
1822
-				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
1823
-				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
1824
-				'.btn-outline-secondary.dropdown-toggle' => array('b','o'),
1822
+				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b', 'o'),
1823
+				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b', 'o'),
1824
+				'.btn-outline-secondary.dropdown-toggle' => array('b', 'o'),
1825 1825
 				'.badge-secondary' => array('b'),
1826
-				'.alert-secondary' => array('b','o'),
1826
+				'.alert-secondary' => array('b', 'o'),
1827 1827
 				'.btn-link.btn-secondary' => array('c'),
1828 1828
 			);
1829 1829
 
1830 1830
 			$important_selectors = array(
1831
-				'.bg-secondary' => array('b','f'),
1831
+				'.bg-secondary' => array('b', 'f'),
1832 1832
 				'.border-secondary' => array('o'),
1833 1833
 				'.text-secondary' => array('c'),
1834 1834
 			);
@@ -1845,77 +1845,77 @@  discard block
 block discarded – undo
1845 1845
 			$output = '';
1846 1846
 
1847 1847
 			// build rules into each type
1848
-			foreach($selectors as $selector => $types){
1849
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1850
-				$types = array_combine($types,$types);
1851
-				if(isset($types['c'])){$color[] = $selector;}
1852
-				if(isset($types['b'])){$background[] = $selector;}
1853
-				if(isset($types['o'])){$border[] = $selector;}
1854
-				if(isset($types['f'])){$fill[] = $selector;}
1848
+			foreach ($selectors as $selector => $types) {
1849
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1850
+				$types = array_combine($types, $types);
1851
+				if (isset($types['c'])) {$color[] = $selector; }
1852
+				if (isset($types['b'])) {$background[] = $selector; }
1853
+				if (isset($types['o'])) {$border[] = $selector; }
1854
+				if (isset($types['f'])) {$fill[] = $selector; }
1855 1855
 			}
1856 1856
 
1857 1857
 			// build rules into each type
1858
-			foreach($important_selectors as $selector => $types){
1859
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1860
-				$types = array_combine($types,$types);
1861
-				if(isset($types['c'])){$color_i[] = $selector;}
1862
-				if(isset($types['b'])){$background_i[] = $selector;}
1863
-				if(isset($types['o'])){$border_i[] = $selector;}
1864
-				if(isset($types['f'])){$fill_i[] = $selector;}
1858
+			foreach ($important_selectors as $selector => $types) {
1859
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1860
+				$types = array_combine($types, $types);
1861
+				if (isset($types['c'])) {$color_i[] = $selector; }
1862
+				if (isset($types['b'])) {$background_i[] = $selector; }
1863
+				if (isset($types['o'])) {$border_i[] = $selector; }
1864
+				if (isset($types['f'])) {$fill_i[] = $selector; }
1865 1865
 			}
1866 1866
 
1867 1867
 			// add any color rules
1868
-			if(!empty($color)){
1869
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1868
+			if (!empty($color)) {
1869
+				$output .= implode(",", $color) . "{color: $color_code;} ";
1870 1870
 			}
1871
-			if(!empty($color_i)){
1872
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1871
+			if (!empty($color_i)) {
1872
+				$output .= implode(",", $color_i) . "{color: $color_code !important;} ";
1873 1873
 			}
1874 1874
 
1875 1875
 			// add any background color rules
1876
-			if(!empty($background)){
1877
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1876
+			if (!empty($background)) {
1877
+				$output .= implode(",", $background) . "{background-color: $color_code;} ";
1878 1878
 			}
1879
-			if(!empty($background_i)){
1880
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1879
+			if (!empty($background_i)) {
1880
+				$output .= implode(",", $background_i) . "{background-color: $color_code !important;} ";
1881 1881
 			}
1882 1882
 
1883 1883
 			// add any border color rules
1884
-			if(!empty($border)){
1885
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1884
+			if (!empty($border)) {
1885
+				$output .= implode(",", $border) . "{border-color: $color_code;} ";
1886 1886
 			}
1887
-			if(!empty($border_i)){
1888
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1887
+			if (!empty($border_i)) {
1888
+				$output .= implode(",", $border_i) . "{border-color: $color_code !important;} ";
1889 1889
 			}
1890 1890
 
1891 1891
 			// add any fill color rules
1892
-			if(!empty($fill)){
1893
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1892
+			if (!empty($fill)) {
1893
+				$output .= implode(",", $fill) . "{fill: $color_code;} ";
1894 1894
 			}
1895
-			if(!empty($fill_i)){
1896
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1895
+			if (!empty($fill_i)) {
1896
+				$output .= implode(",", $fill_i) . "{fill: $color_code !important;} ";
1897 1897
 			}
1898 1898
 
1899 1899
 
1900 1900
 			$prefix = $compatibility ? ".bsui " : "";
1901 1901
 
1902 1902
 			// darken
1903
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1904
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1905
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1903
+			$darker_075 = self::css_hex_lighten_darken($color_code, "-0.075");
1904
+			$darker_10 = self::css_hex_lighten_darken($color_code, "-0.10");
1905
+			$darker_125 = self::css_hex_lighten_darken($color_code, "-0.125");
1906 1906
 
1907 1907
 			// lighten
1908
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1908
+			$lighten_25 = self::css_hex_lighten_darken($color_code, "0.25");
1909 1909
 
1910 1910
 			// opacity see https://css-tricks.com/8-digit-hex-codes/
1911
-			$op_25 = $color_code."40"; // 25% opacity
1911
+			$op_25 = $color_code . "40"; // 25% opacity
1912 1912
 
1913 1913
 
1914 1914
 			// button states
1915
-			$output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1916
-			$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;} ";
1917
-			$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.";} ";
1918
-			$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;} ";
1915
+			$output .= $prefix . " .btn-secondary:hover{background-color: " . $darker_075 . ";    border-color: " . $darker_10 . ";} ";
1916
+			$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;} ";
1917
+			$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 . ";} ";
1918
+			$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;} ";
1919 1919
 
1920 1920
 
1921 1921
 			return $output;
@@ -1951,8 +1951,8 @@  discard block
 block discarded – undo
1951 1951
 		/**
1952 1952
 		 * Check if we should display examples.
1953 1953
 		 */
1954
-		public function maybe_show_examples(){
1955
-			if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
1954
+		public function maybe_show_examples() {
1955
+			if (current_user_can('manage_options') && isset($_REQUEST['preview-aui'])) {
1956 1956
 				echo "<head>";
1957 1957
 				wp_head();
1958 1958
 				echo "</head>";
@@ -1968,7 +1968,7 @@  discard block
 block discarded – undo
1968 1968
 		 *
1969 1969
 		 * @return string
1970 1970
 		 */
1971
-		public function get_examples(){
1971
+		public function get_examples() {
1972 1972
 			$output = '';
1973 1973
 
1974 1974
 
@@ -2074,74 +2074,74 @@  discard block
 block discarded – undo
2074 2074
 		 */
2075 2075
 		public static function calendar_params() {
2076 2076
 			$params = array(
2077
-				'month_long_1' => __( 'January', 'aui' ),
2078
-				'month_long_2' => __( 'February', 'aui' ),
2079
-				'month_long_3' => __( 'March', 'aui' ),
2080
-				'month_long_4' => __( 'April', 'aui' ),
2081
-				'month_long_5' => __( 'May', 'aui' ),
2082
-				'month_long_6' => __( 'June', 'aui' ),
2083
-				'month_long_7' => __( 'July', 'aui' ),
2084
-				'month_long_8' => __( 'August', 'aui' ),
2085
-				'month_long_9' => __( 'September', 'aui' ),
2086
-				'month_long_10' => __( 'October', 'aui' ),
2087
-				'month_long_11' => __( 'November', 'aui' ),
2088
-				'month_long_12' => __( 'December', 'aui' ),
2089
-				'month_s_1' => _x( 'Jan', 'January abbreviation', 'aui' ),
2090
-				'month_s_2' => _x( 'Feb', 'February abbreviation', 'aui' ),
2091
-				'month_s_3' => _x( 'Mar', 'March abbreviation', 'aui' ),
2092
-				'month_s_4' => _x( 'Apr', 'April abbreviation', 'aui' ),
2093
-				'month_s_5' => _x( 'May', 'May abbreviation', 'aui' ),
2094
-				'month_s_6' => _x( 'Jun', 'June abbreviation', 'aui' ),
2095
-				'month_s_7' => _x( 'Jul', 'July abbreviation', 'aui' ),
2096
-				'month_s_8' => _x( 'Aug', 'August abbreviation', 'aui' ),
2097
-				'month_s_9' => _x( 'Sep', 'September abbreviation', 'aui' ),
2098
-				'month_s_10' => _x( 'Oct', 'October abbreviation', 'aui' ),
2099
-				'month_s_11' => _x( 'Nov', 'November abbreviation', 'aui' ),
2100
-				'month_s_12' => _x( 'Dec', 'December abbreviation', 'aui' ),
2101
-				'day_s1_1' => _x( 'S', 'Sunday initial', 'aui' ),
2102
-				'day_s1_2' => _x( 'M', 'Monday initial', 'aui' ),
2103
-				'day_s1_3' => _x( 'T', 'Tuesday initial', 'aui' ),
2104
-				'day_s1_4' => _x( 'W', 'Wednesday initial', 'aui' ),
2105
-				'day_s1_5' => _x( 'T', 'Friday initial', 'aui' ),
2106
-				'day_s1_6' => _x( 'F', 'Thursday initial', 'aui' ),
2107
-				'day_s1_7' => _x( 'S', 'Saturday initial', 'aui' ),
2108
-				'day_s2_1' => __( 'Su', 'aui' ),
2109
-				'day_s2_2' => __( 'Mo', 'aui' ),
2110
-				'day_s2_3' => __( 'Tu', 'aui' ),
2111
-				'day_s2_4' => __( 'We', 'aui' ),
2112
-				'day_s2_5' => __( 'Th', 'aui' ),
2113
-				'day_s2_6' => __( 'Fr', 'aui' ),
2114
-				'day_s2_7' => __( 'Sa', 'aui' ),
2115
-				'day_s3_1' => __( 'Sun', 'aui' ),
2116
-				'day_s3_2' => __( 'Mon', 'aui' ),
2117
-				'day_s3_3' => __( 'Tue', 'aui' ),
2118
-				'day_s3_4' => __( 'Wed', 'aui' ),
2119
-				'day_s3_5' => __( 'Thu', 'aui' ),
2120
-				'day_s3_6' => __( 'Fri', 'aui' ),
2121
-				'day_s3_7' => __( 'Sat', 'aui' ),
2122
-				'day_s5_1' => __( 'Sunday', 'aui' ),
2123
-				'day_s5_2' => __( 'Monday', 'aui' ),
2124
-				'day_s5_3' => __( 'Tuesday', 'aui' ),
2125
-				'day_s5_4' => __( 'Wednesday', 'aui' ),
2126
-				'day_s5_5' => __( 'Thursday', 'aui' ),
2127
-				'day_s5_6' => __( 'Friday', 'aui' ),
2128
-				'day_s5_7' => __( 'Saturday', 'aui' ),
2129
-				'am_lower' => __( 'am', 'aui' ),
2130
-				'pm_lower' => __( 'pm', 'aui' ),
2131
-				'am_upper' => __( 'AM', 'aui' ),
2132
-				'pm_upper' => __( 'PM', 'aui' ),
2133
-				'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
2077
+				'month_long_1' => __('January', 'aui'),
2078
+				'month_long_2' => __('February', 'aui'),
2079
+				'month_long_3' => __('March', 'aui'),
2080
+				'month_long_4' => __('April', 'aui'),
2081
+				'month_long_5' => __('May', 'aui'),
2082
+				'month_long_6' => __('June', 'aui'),
2083
+				'month_long_7' => __('July', 'aui'),
2084
+				'month_long_8' => __('August', 'aui'),
2085
+				'month_long_9' => __('September', 'aui'),
2086
+				'month_long_10' => __('October', 'aui'),
2087
+				'month_long_11' => __('November', 'aui'),
2088
+				'month_long_12' => __('December', 'aui'),
2089
+				'month_s_1' => _x('Jan', 'January abbreviation', 'aui'),
2090
+				'month_s_2' => _x('Feb', 'February abbreviation', 'aui'),
2091
+				'month_s_3' => _x('Mar', 'March abbreviation', 'aui'),
2092
+				'month_s_4' => _x('Apr', 'April abbreviation', 'aui'),
2093
+				'month_s_5' => _x('May', 'May abbreviation', 'aui'),
2094
+				'month_s_6' => _x('Jun', 'June abbreviation', 'aui'),
2095
+				'month_s_7' => _x('Jul', 'July abbreviation', 'aui'),
2096
+				'month_s_8' => _x('Aug', 'August abbreviation', 'aui'),
2097
+				'month_s_9' => _x('Sep', 'September abbreviation', 'aui'),
2098
+				'month_s_10' => _x('Oct', 'October abbreviation', 'aui'),
2099
+				'month_s_11' => _x('Nov', 'November abbreviation', 'aui'),
2100
+				'month_s_12' => _x('Dec', 'December abbreviation', 'aui'),
2101
+				'day_s1_1' => _x('S', 'Sunday initial', 'aui'),
2102
+				'day_s1_2' => _x('M', 'Monday initial', 'aui'),
2103
+				'day_s1_3' => _x('T', 'Tuesday initial', 'aui'),
2104
+				'day_s1_4' => _x('W', 'Wednesday initial', 'aui'),
2105
+				'day_s1_5' => _x('T', 'Friday initial', 'aui'),
2106
+				'day_s1_6' => _x('F', 'Thursday initial', 'aui'),
2107
+				'day_s1_7' => _x('S', 'Saturday initial', 'aui'),
2108
+				'day_s2_1' => __('Su', 'aui'),
2109
+				'day_s2_2' => __('Mo', 'aui'),
2110
+				'day_s2_3' => __('Tu', 'aui'),
2111
+				'day_s2_4' => __('We', 'aui'),
2112
+				'day_s2_5' => __('Th', 'aui'),
2113
+				'day_s2_6' => __('Fr', 'aui'),
2114
+				'day_s2_7' => __('Sa', 'aui'),
2115
+				'day_s3_1' => __('Sun', 'aui'),
2116
+				'day_s3_2' => __('Mon', 'aui'),
2117
+				'day_s3_3' => __('Tue', 'aui'),
2118
+				'day_s3_4' => __('Wed', 'aui'),
2119
+				'day_s3_5' => __('Thu', 'aui'),
2120
+				'day_s3_6' => __('Fri', 'aui'),
2121
+				'day_s3_7' => __('Sat', 'aui'),
2122
+				'day_s5_1' => __('Sunday', 'aui'),
2123
+				'day_s5_2' => __('Monday', 'aui'),
2124
+				'day_s5_3' => __('Tuesday', 'aui'),
2125
+				'day_s5_4' => __('Wednesday', 'aui'),
2126
+				'day_s5_5' => __('Thursday', 'aui'),
2127
+				'day_s5_6' => __('Friday', 'aui'),
2128
+				'day_s5_7' => __('Saturday', 'aui'),
2129
+				'am_lower' => __('am', 'aui'),
2130
+				'pm_lower' => __('pm', 'aui'),
2131
+				'am_upper' => __('AM', 'aui'),
2132
+				'pm_upper' => __('PM', 'aui'),
2133
+				'firstDayOfWeek' => (int) get_option('start_of_week'),
2134 2134
 				'time_24hr' => false,
2135
-				'year' => __( 'Year', 'aui' ),
2136
-				'hour' => __( 'Hour', 'aui' ),
2137
-				'minute' => __( 'Minute', 'aui' ),
2138
-				'weekAbbreviation' => __( 'Wk', 'aui' ),
2139
-				'rangeSeparator' => __( ' to ', 'aui' ),
2140
-				'scrollTitle' => __( 'Scroll to increment', 'aui' ),
2141
-				'toggleTitle' => __( 'Click to toggle', 'aui' )
2135
+				'year' => __('Year', 'aui'),
2136
+				'hour' => __('Hour', 'aui'),
2137
+				'minute' => __('Minute', 'aui'),
2138
+				'weekAbbreviation' => __('Wk', 'aui'),
2139
+				'rangeSeparator' => __(' to ', 'aui'),
2140
+				'scrollTitle' => __('Scroll to increment', 'aui'),
2141
+				'toggleTitle' => __('Click to toggle', 'aui')
2142 2142
 			);
2143 2143
 
2144
-			return apply_filters( 'ayecode_ui_calendar_params', $params );
2144
+			return apply_filters('ayecode_ui_calendar_params', $params);
2145 2145
 		}
2146 2146
 
2147 2147
 		/**
@@ -2154,47 +2154,47 @@  discard block
 block discarded – undo
2154 2154
 		public static function flatpickr_locale() {
2155 2155
 			$params = self::calendar_params();
2156 2156
 
2157
-			if ( is_string( $params ) ) {
2158
-				$params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
2157
+			if (is_string($params)) {
2158
+				$params = html_entity_decode($params, ENT_QUOTES, 'UTF-8');
2159 2159
 			} else {
2160
-				foreach ( (array) $params as $key => $value ) {
2161
-					if ( ! is_scalar( $value ) ) {
2160
+				foreach ((array) $params as $key => $value) {
2161
+					if (!is_scalar($value)) {
2162 2162
 						continue;
2163 2163
 					}
2164 2164
 
2165
-					$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2165
+					$params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
2166 2166
 				}
2167 2167
 			}
2168 2168
 
2169 2169
 			$day_s3 = array();
2170 2170
 			$day_s5 = array();
2171 2171
 
2172
-			for ( $i = 1; $i <= 7; $i ++ ) {
2173
-				$day_s3[] = addslashes( $params[ 'day_s3_' . $i ] );
2174
-				$day_s5[] = addslashes( $params[ 'day_s3_' . $i ] );
2172
+			for ($i = 1; $i <= 7; $i++) {
2173
+				$day_s3[] = addslashes($params['day_s3_' . $i]);
2174
+				$day_s5[] = addslashes($params['day_s3_' . $i]);
2175 2175
 			}
2176 2176
 
2177 2177
 			$month_s = array();
2178 2178
 			$month_long = array();
2179 2179
 
2180
-			for ( $i = 1; $i <= 12; $i ++ ) {
2181
-				$month_s[] = addslashes( $params[ 'month_s_' . $i ] );
2182
-				$month_long[] = addslashes( $params[ 'month_long_' . $i ] );
2180
+			for ($i = 1; $i <= 12; $i++) {
2181
+				$month_s[] = addslashes($params['month_s_' . $i]);
2182
+				$month_long[] = addslashes($params['month_long_' . $i]);
2183 2183
 			}
2184 2184
 
2185 2185
 ob_start();
2186
-if ( 0 ) { ?><script><?php } ?>
2186
+if (0) { ?><script><?php } ?>
2187 2187
 {
2188 2188
 	weekdays: {
2189
-		shorthand: ['<?php echo implode( "','", $day_s3 ); ?>'],
2190
-		longhand: ['<?php echo implode( "','", $day_s5 ); ?>'],
2189
+		shorthand: ['<?php echo implode("','", $day_s3); ?>'],
2190
+		longhand: ['<?php echo implode("','", $day_s5); ?>'],
2191 2191
 	},
2192 2192
 	months: {
2193
-		shorthand: ['<?php echo implode( "','", $month_s ); ?>'],
2194
-		longhand: ['<?php echo implode( "','", $month_long ); ?>'],
2193
+		shorthand: ['<?php echo implode("','", $month_s); ?>'],
2194
+		longhand: ['<?php echo implode("','", $month_long); ?>'],
2195 2195
 	},
2196 2196
 	daysInMonth: [31,28,31,30,31,30,31,31,30,31,30,31],
2197
-	firstDayOfWeek: <?php echo (int) $params[ 'firstDayOfWeek' ]; ?>,
2197
+	firstDayOfWeek: <?php echo (int) $params['firstDayOfWeek']; ?>,
2198 2198
 	ordinal: function (nth) {
2199 2199
 		var s = nth % 100;
2200 2200
 		if (s > 3 && s < 21)
@@ -2210,21 +2210,21 @@  discard block
 block discarded – undo
2210 2210
 				return "th";
2211 2211
 		}
2212 2212
 	},
2213
-	rangeSeparator: '<?php echo addslashes( $params[ 'rangeSeparator' ] ); ?>',
2214
-	weekAbbreviation: '<?php echo addslashes( $params[ 'weekAbbreviation' ] ); ?>',
2215
-	scrollTitle: '<?php echo addslashes( $params[ 'scrollTitle' ] ); ?>',
2216
-	toggleTitle: '<?php echo addslashes( $params[ 'toggleTitle' ] ); ?>',
2217
-	amPM: ['<?php echo addslashes( $params[ 'am_upper' ] ); ?>','<?php echo addslashes( $params[ 'pm_upper' ] ); ?>'],
2218
-	yearAriaLabel: '<?php echo addslashes( $params[ 'year' ] ); ?>',
2219
-	hourAriaLabel: '<?php echo addslashes( $params[ 'hour' ] ); ?>',
2220
-	minuteAriaLabel: '<?php echo addslashes( $params[ 'minute' ] ); ?>',
2221
-	time_24hr: <?php echo ( $params[ 'time_24hr' ] ? 'true' : 'false' ) ; ?>
2213
+	rangeSeparator: '<?php echo addslashes($params['rangeSeparator']); ?>',
2214
+	weekAbbreviation: '<?php echo addslashes($params['weekAbbreviation']); ?>',
2215
+	scrollTitle: '<?php echo addslashes($params['scrollTitle']); ?>',
2216
+	toggleTitle: '<?php echo addslashes($params['toggleTitle']); ?>',
2217
+	amPM: ['<?php echo addslashes($params['am_upper']); ?>','<?php echo addslashes($params['pm_upper']); ?>'],
2218
+	yearAriaLabel: '<?php echo addslashes($params['year']); ?>',
2219
+	hourAriaLabel: '<?php echo addslashes($params['hour']); ?>',
2220
+	minuteAriaLabel: '<?php echo addslashes($params['minute']); ?>',
2221
+	time_24hr: <?php echo ($params['time_24hr'] ? 'true' : 'false'); ?>
2222 2222
 }
2223
-<?php if ( 0 ) { ?></script><?php } ?>
2223
+<?php if (0) { ?></script><?php } ?>
2224 2224
 <?php
2225 2225
 			$locale = ob_get_clean();
2226 2226
 
2227
-			return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
2227
+			return apply_filters('ayecode_ui_flatpickr_locale', trim($locale));
2228 2228
 		}
2229 2229
 
2230 2230
 		/**
@@ -2236,20 +2236,20 @@  discard block
 block discarded – undo
2236 2236
 		 */
2237 2237
 		public static function select2_params() {
2238 2238
 			$params = array(
2239
-				'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'aui' ),
2240
-				'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'aui' ),
2241
-				'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'aui' ),
2242
-				'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'aui' ),
2243
-				'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'aui' ),
2244
-				'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'aui' ),
2245
-				'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'aui' ),
2246
-				'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'aui' ),
2247
-				'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'aui' ),
2248
-				'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'aui' ),
2249
-				'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'aui' )
2239
+				'i18n_select_state_text'    => esc_attr__('Select an option&hellip;', 'aui'),
2240
+				'i18n_no_matches'           => _x('No matches found', 'enhanced select', 'aui'),
2241
+				'i18n_ajax_error'           => _x('Loading failed', 'enhanced select', 'aui'),
2242
+				'i18n_input_too_short_1'    => _x('Please enter 1 or more characters', 'enhanced select', 'aui'),
2243
+				'i18n_input_too_short_n'    => _x('Please enter %item% or more characters', 'enhanced select', 'aui'),
2244
+				'i18n_input_too_long_1'     => _x('Please delete 1 character', 'enhanced select', 'aui'),
2245
+				'i18n_input_too_long_n'     => _x('Please delete %item% characters', 'enhanced select', 'aui'),
2246
+				'i18n_selection_too_long_1' => _x('You can only select 1 item', 'enhanced select', 'aui'),
2247
+				'i18n_selection_too_long_n' => _x('You can only select %item% items', 'enhanced select', 'aui'),
2248
+				'i18n_load_more'            => _x('Loading more results&hellip;', 'enhanced select', 'aui'),
2249
+				'i18n_searching'            => _x('Searching&hellip;', 'enhanced select', 'aui')
2250 2250
 			);
2251 2251
 
2252
-			return apply_filters( 'ayecode_ui_select2_params', $params );
2252
+			return apply_filters('ayecode_ui_select2_params', $params);
2253 2253
 		}
2254 2254
 
2255 2255
 		/**
@@ -2262,17 +2262,17 @@  discard block
 block discarded – undo
2262 2262
 		public static function select2_locale() {
2263 2263
 			$params = self::select2_params();
2264 2264
 
2265
-			foreach ( (array) $params as $key => $value ) {
2266
-				if ( ! is_scalar( $value ) ) {
2265
+			foreach ((array) $params as $key => $value) {
2266
+				if (!is_scalar($value)) {
2267 2267
 					continue;
2268 2268
 				}
2269 2269
 
2270
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2270
+				$params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
2271 2271
 			}
2272 2272
 
2273
-			$locale = json_encode( $params );
2273
+			$locale = json_encode($params);
2274 2274
 
2275
-			return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
2275
+			return apply_filters('ayecode_ui_select2_locale', trim($locale));
2276 2276
 		}
2277 2277
 
2278 2278
 		/**
@@ -2285,35 +2285,35 @@  discard block
 block discarded – undo
2285 2285
 		public static function timeago_locale() {
2286 2286
 			$params = array(
2287 2287
 				'prefix_ago' => '',
2288
-				'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'aui' ),
2289
-				'prefix_after' => _x( 'after', 'time ago', 'aui' ) . ' ',
2288
+				'suffix_ago' => ' ' . _x('ago', 'time ago', 'aui'),
2289
+				'prefix_after' => _x('after', 'time ago', 'aui') . ' ',
2290 2290
 				'suffix_after' => '',
2291
-				'seconds' => _x( 'less than a minute', 'time ago', 'aui' ),
2292
-				'minute' => _x( 'about a minute', 'time ago', 'aui' ),
2293
-				'minutes' => _x( '%d minutes', 'time ago', 'aui' ),
2294
-				'hour' => _x( 'about an hour', 'time ago', 'aui' ),
2295
-				'hours' => _x( 'about %d hours', 'time ago', 'aui' ),
2296
-				'day' => _x( 'a day', 'time ago', 'aui' ),
2297
-				'days' => _x( '%d days', 'time ago', 'aui' ),
2298
-				'month' => _x( 'about a month', 'time ago', 'aui' ),
2299
-				'months' => _x( '%d months', 'time ago', 'aui' ),
2300
-				'year' => _x( 'about a year', 'time ago', 'aui' ),
2301
-				'years' => _x( '%d years', 'time ago', 'aui' ),
2291
+				'seconds' => _x('less than a minute', 'time ago', 'aui'),
2292
+				'minute' => _x('about a minute', 'time ago', 'aui'),
2293
+				'minutes' => _x('%d minutes', 'time ago', 'aui'),
2294
+				'hour' => _x('about an hour', 'time ago', 'aui'),
2295
+				'hours' => _x('about %d hours', 'time ago', 'aui'),
2296
+				'day' => _x('a day', 'time ago', 'aui'),
2297
+				'days' => _x('%d days', 'time ago', 'aui'),
2298
+				'month' => _x('about a month', 'time ago', 'aui'),
2299
+				'months' => _x('%d months', 'time ago', 'aui'),
2300
+				'year' => _x('about a year', 'time ago', 'aui'),
2301
+				'years' => _x('%d years', 'time ago', 'aui'),
2302 2302
 			);
2303 2303
 
2304
-			$params = apply_filters( 'ayecode_ui_timeago_params', $params );
2304
+			$params = apply_filters('ayecode_ui_timeago_params', $params);
2305 2305
 
2306
-			foreach ( (array) $params as $key => $value ) {
2307
-				if ( ! is_scalar( $value ) ) {
2306
+			foreach ((array) $params as $key => $value) {
2307
+				if (!is_scalar($value)) {
2308 2308
 					continue;
2309 2309
 				}
2310 2310
 
2311
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2311
+				$params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
2312 2312
 			}
2313 2313
 
2314
-			$locale = json_encode( $params );
2314
+			$locale = json_encode($params);
2315 2315
 
2316
-			return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) );
2316
+			return apply_filters('ayecode_ui_timeago_locale', trim($locale));
2317 2317
 		}
2318 2318
 
2319 2319
 		/**
@@ -2324,7 +2324,7 @@  discard block
 block discarded – undo
2324 2324
 		 * @return mixed
2325 2325
 		 */
2326 2326
 		public static function minify_js($input) {
2327
-			if(trim($input) === "") return $input;
2327
+			if (trim($input) === "") return $input;
2328 2328
 			return preg_replace(
2329 2329
 				array(
2330 2330
 					// Remove comment(s)
@@ -2356,7 +2356,7 @@  discard block
 block discarded – undo
2356 2356
 		 * @return mixed
2357 2357
 		 */
2358 2358
 		public static function minify_css($input) {
2359
-			if(trim($input) === "") return $input;
2359
+			if (trim($input) === "") return $input;
2360 2360
 			return preg_replace(
2361 2361
 				array(
2362 2362
 					// Remove comment(s)
@@ -2905,12 +2905,12 @@  discard block
 block discarded – undo
2905 2905
         });
2906 2906
     }
2907 2907
 }
2908
-<?php do_action( 'aui_conditional_fields_js', $this ); ?>
2908
+<?php do_action('aui_conditional_fields_js', $this); ?>
2909 2909
 </script>
2910 2910
 			<?php
2911 2911
 			$output = ob_get_clean();
2912 2912
 
2913
-			return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) );
2913
+			return str_replace(array('<script>', '</script>'), '', self::minify_js($output));
2914 2914
 		}
2915 2915
 	}
2916 2916
 
Please login to merge, or discard this patch.
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.63";
19
-	if(empty($ayecode_ui_version) || 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.63";
19
+    if(empty($ayecode_ui_version) || 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.63";
19
-	if(empty($ayecode_ui_version) || version_compare($this_version , $ayecode_ui_version, '>')){
20
-		$ayecode_ui_version = $this_version ;
21
-		$ayecode_ui_file_key = wp_hash( __FILE__ );
19
+	if (empty($ayecode_ui_version) || 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.
vendor/composer/InstalledVersions.php 2 patches
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
 class InstalledVersions
13 13
 {
14 14
 private static $installed = array (
15
-  'root' => 
16
-  array (
15
+    'root' => 
16
+    array (
17 17
     'pretty_version' => 'dev-master',
18 18
     'version' => 'dev-master',
19 19
     'aliases' => 
@@ -21,96 +21,96 @@  discard block
 block discarded – undo
21 21
     ),
22 22
     'reference' => '6f34c79e3ece7e41afb9a24d2c0632e8eb770a84',
23 23
     'name' => 'ayecode/invoicing',
24
-  ),
25
-  'versions' => 
26
-  array (
24
+    ),
25
+    'versions' => 
26
+    array (
27 27
     'ayecode/ayecode-connect-helper' => 
28 28
     array (
29
-      'pretty_version' => '1.0.3',
30
-      'version' => '1.0.3.0',
31
-      'aliases' => 
32
-      array (
33
-      ),
34
-      'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
29
+        'pretty_version' => '1.0.3',
30
+        'version' => '1.0.3.0',
31
+        'aliases' => 
32
+        array (
33
+        ),
34
+        'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
35 35
     ),
36 36
     'ayecode/invoicing' => 
37 37
     array (
38
-      'pretty_version' => 'dev-master',
39
-      'version' => 'dev-master',
40
-      'aliases' => 
41
-      array (
42
-      ),
43
-      'reference' => '6f34c79e3ece7e41afb9a24d2c0632e8eb770a84',
38
+        'pretty_version' => 'dev-master',
39
+        'version' => 'dev-master',
40
+        'aliases' => 
41
+        array (
42
+        ),
43
+        'reference' => '6f34c79e3ece7e41afb9a24d2c0632e8eb770a84',
44 44
     ),
45 45
     'ayecode/wp-ayecode-ui' => 
46 46
     array (
47
-      'pretty_version' => '0.1.63',
48
-      'version' => '0.1.63.0',
49
-      'aliases' => 
50
-      array (
51
-      ),
52
-      'reference' => 'a7ec8b7719feb7d4b2cacb02c8d0e19aadb6c037',
47
+        'pretty_version' => '0.1.63',
48
+        'version' => '0.1.63.0',
49
+        'aliases' => 
50
+        array (
51
+        ),
52
+        'reference' => 'a7ec8b7719feb7d4b2cacb02c8d0e19aadb6c037',
53 53
     ),
54 54
     'ayecode/wp-deactivation-survey' => 
55 55
     array (
56
-      'pretty_version' => '1.0.4',
57
-      'version' => '1.0.4.0',
58
-      'aliases' => 
59
-      array (
60
-      ),
61
-      'reference' => 'd2777fed30acfc4da53b45bf3b4fec2fb27d8398',
56
+        'pretty_version' => '1.0.4',
57
+        'version' => '1.0.4.0',
58
+        'aliases' => 
59
+        array (
60
+        ),
61
+        'reference' => 'd2777fed30acfc4da53b45bf3b4fec2fb27d8398',
62 62
     ),
63 63
     'ayecode/wp-font-awesome-settings' => 
64 64
     array (
65
-      'pretty_version' => '1.0.13',
66
-      'version' => '1.0.13.0',
67
-      'aliases' => 
68
-      array (
69
-      ),
70
-      'reference' => 'a7a11ee4290674ec214d1fe694139af275350402',
65
+        'pretty_version' => '1.0.13',
66
+        'version' => '1.0.13.0',
67
+        'aliases' => 
68
+        array (
69
+        ),
70
+        'reference' => 'a7a11ee4290674ec214d1fe694139af275350402',
71 71
     ),
72 72
     'ayecode/wp-super-duper' => 
73 73
     array (
74
-      'pretty_version' => '1.0.28',
75
-      'version' => '1.0.28.0',
76
-      'aliases' => 
77
-      array (
78
-      ),
79
-      'reference' => 'c3d8a73d9760352719da271ee13cfe676f5af075',
74
+        'pretty_version' => '1.0.28',
75
+        'version' => '1.0.28.0',
76
+        'aliases' => 
77
+        array (
78
+        ),
79
+        'reference' => 'c3d8a73d9760352719da271ee13cfe676f5af075',
80 80
     ),
81 81
     'composer/installers' => 
82 82
     array (
83
-      'pretty_version' => 'v1.12.0',
84
-      'version' => '1.12.0.0',
85
-      'aliases' => 
86
-      array (
87
-      ),
88
-      'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19',
83
+        'pretty_version' => 'v1.12.0',
84
+        'version' => '1.12.0.0',
85
+        'aliases' => 
86
+        array (
87
+        ),
88
+        'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19',
89 89
     ),
90 90
     'maxmind-db/reader' => 
91 91
     array (
92
-      'pretty_version' => 'v1.6.0',
93
-      'version' => '1.6.0.0',
94
-      'aliases' => 
95
-      array (
96
-      ),
97
-      'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
92
+        'pretty_version' => 'v1.6.0',
93
+        'version' => '1.6.0.0',
94
+        'aliases' => 
95
+        array (
96
+        ),
97
+        'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
98 98
     ),
99 99
     'roundcube/plugin-installer' => 
100 100
     array (
101
-      'replaced' => 
102
-      array (
101
+        'replaced' => 
102
+        array (
103 103
         0 => '*',
104
-      ),
104
+        ),
105 105
     ),
106 106
     'shama/baton' => 
107 107
     array (
108
-      'replaced' => 
109
-      array (
108
+        'replaced' => 
109
+        array (
110 110
         0 => '*',
111
-      ),
111
+        ),
112
+    ),
112 113
     ),
113
-  ),
114 114
 );
115 115
 
116 116
 
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -11,102 +11,102 @@
 block discarded – undo
11 11
 
12 12
 class InstalledVersions
13 13
 {
14
-private static $installed = array (
14
+private static $installed = array(
15 15
   'root' => 
16
-  array (
16
+  array(
17 17
     'pretty_version' => 'dev-master',
18 18
     'version' => 'dev-master',
19 19
     'aliases' => 
20
-    array (
20
+    array(
21 21
     ),
22 22
     'reference' => '6f34c79e3ece7e41afb9a24d2c0632e8eb770a84',
23 23
     'name' => 'ayecode/invoicing',
24 24
   ),
25 25
   'versions' => 
26
-  array (
26
+  array(
27 27
     'ayecode/ayecode-connect-helper' => 
28
-    array (
28
+    array(
29 29
       'pretty_version' => '1.0.3',
30 30
       'version' => '1.0.3.0',
31 31
       'aliases' => 
32
-      array (
32
+      array(
33 33
       ),
34 34
       'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
35 35
     ),
36 36
     'ayecode/invoicing' => 
37
-    array (
37
+    array(
38 38
       'pretty_version' => 'dev-master',
39 39
       'version' => 'dev-master',
40 40
       'aliases' => 
41
-      array (
41
+      array(
42 42
       ),
43 43
       'reference' => '6f34c79e3ece7e41afb9a24d2c0632e8eb770a84',
44 44
     ),
45 45
     'ayecode/wp-ayecode-ui' => 
46
-    array (
46
+    array(
47 47
       'pretty_version' => '0.1.63',
48 48
       'version' => '0.1.63.0',
49 49
       'aliases' => 
50
-      array (
50
+      array(
51 51
       ),
52 52
       'reference' => 'a7ec8b7719feb7d4b2cacb02c8d0e19aadb6c037',
53 53
     ),
54 54
     'ayecode/wp-deactivation-survey' => 
55
-    array (
55
+    array(
56 56
       'pretty_version' => '1.0.4',
57 57
       'version' => '1.0.4.0',
58 58
       'aliases' => 
59
-      array (
59
+      array(
60 60
       ),
61 61
       'reference' => 'd2777fed30acfc4da53b45bf3b4fec2fb27d8398',
62 62
     ),
63 63
     'ayecode/wp-font-awesome-settings' => 
64
-    array (
64
+    array(
65 65
       'pretty_version' => '1.0.13',
66 66
       'version' => '1.0.13.0',
67 67
       'aliases' => 
68
-      array (
68
+      array(
69 69
       ),
70 70
       'reference' => 'a7a11ee4290674ec214d1fe694139af275350402',
71 71
     ),
72 72
     'ayecode/wp-super-duper' => 
73
-    array (
73
+    array(
74 74
       'pretty_version' => '1.0.28',
75 75
       'version' => '1.0.28.0',
76 76
       'aliases' => 
77
-      array (
77
+      array(
78 78
       ),
79 79
       'reference' => 'c3d8a73d9760352719da271ee13cfe676f5af075',
80 80
     ),
81 81
     'composer/installers' => 
82
-    array (
82
+    array(
83 83
       'pretty_version' => 'v1.12.0',
84 84
       'version' => '1.12.0.0',
85 85
       'aliases' => 
86
-      array (
86
+      array(
87 87
       ),
88 88
       'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19',
89 89
     ),
90 90
     'maxmind-db/reader' => 
91
-    array (
91
+    array(
92 92
       'pretty_version' => 'v1.6.0',
93 93
       'version' => '1.6.0.0',
94 94
       'aliases' => 
95
-      array (
95
+      array(
96 96
       ),
97 97
       'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
98 98
     ),
99 99
     'roundcube/plugin-installer' => 
100
-    array (
100
+    array(
101 101
       'replaced' => 
102
-      array (
102
+      array(
103 103
         0 => '*',
104 104
       ),
105 105
     ),
106 106
     'shama/baton' => 
107
-    array (
107
+    array(
108 108
       'replaced' => 
109
-      array (
109
+      array(
110 110
         0 => '*',
111 111
       ),
112 112
     ),
Please login to merge, or discard this patch.
vendor/composer/installed.php 2 patches
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php return array (
2
-  'root' => 
3
-  array (
2
+    'root' => 
3
+    array (
4 4
     'pretty_version' => 'dev-master',
5 5
     'version' => 'dev-master',
6 6
     'aliases' => 
@@ -8,94 +8,94 @@  discard block
 block discarded – undo
8 8
     ),
9 9
     'reference' => '6f34c79e3ece7e41afb9a24d2c0632e8eb770a84',
10 10
     'name' => 'ayecode/invoicing',
11
-  ),
12
-  'versions' => 
13
-  array (
11
+    ),
12
+    'versions' => 
13
+    array (
14 14
     'ayecode/ayecode-connect-helper' => 
15 15
     array (
16
-      'pretty_version' => '1.0.3',
17
-      'version' => '1.0.3.0',
18
-      'aliases' => 
19
-      array (
20
-      ),
21
-      'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
16
+        'pretty_version' => '1.0.3',
17
+        'version' => '1.0.3.0',
18
+        'aliases' => 
19
+        array (
20
+        ),
21
+        'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
22 22
     ),
23 23
     'ayecode/invoicing' => 
24 24
     array (
25
-      'pretty_version' => 'dev-master',
26
-      'version' => 'dev-master',
27
-      'aliases' => 
28
-      array (
29
-      ),
30
-      'reference' => '6f34c79e3ece7e41afb9a24d2c0632e8eb770a84',
25
+        'pretty_version' => 'dev-master',
26
+        'version' => 'dev-master',
27
+        'aliases' => 
28
+        array (
29
+        ),
30
+        'reference' => '6f34c79e3ece7e41afb9a24d2c0632e8eb770a84',
31 31
     ),
32 32
     'ayecode/wp-ayecode-ui' => 
33 33
     array (
34
-      'pretty_version' => '0.1.63',
35
-      'version' => '0.1.63.0',
36
-      'aliases' => 
37
-      array (
38
-      ),
39
-      'reference' => 'a7ec8b7719feb7d4b2cacb02c8d0e19aadb6c037',
34
+        'pretty_version' => '0.1.63',
35
+        'version' => '0.1.63.0',
36
+        'aliases' => 
37
+        array (
38
+        ),
39
+        'reference' => 'a7ec8b7719feb7d4b2cacb02c8d0e19aadb6c037',
40 40
     ),
41 41
     'ayecode/wp-deactivation-survey' => 
42 42
     array (
43
-      'pretty_version' => '1.0.4',
44
-      'version' => '1.0.4.0',
45
-      'aliases' => 
46
-      array (
47
-      ),
48
-      'reference' => 'd2777fed30acfc4da53b45bf3b4fec2fb27d8398',
43
+        'pretty_version' => '1.0.4',
44
+        'version' => '1.0.4.0',
45
+        'aliases' => 
46
+        array (
47
+        ),
48
+        'reference' => 'd2777fed30acfc4da53b45bf3b4fec2fb27d8398',
49 49
     ),
50 50
     'ayecode/wp-font-awesome-settings' => 
51 51
     array (
52
-      'pretty_version' => '1.0.13',
53
-      'version' => '1.0.13.0',
54
-      'aliases' => 
55
-      array (
56
-      ),
57
-      'reference' => 'a7a11ee4290674ec214d1fe694139af275350402',
52
+        'pretty_version' => '1.0.13',
53
+        'version' => '1.0.13.0',
54
+        'aliases' => 
55
+        array (
56
+        ),
57
+        'reference' => 'a7a11ee4290674ec214d1fe694139af275350402',
58 58
     ),
59 59
     'ayecode/wp-super-duper' => 
60 60
     array (
61
-      'pretty_version' => '1.0.28',
62
-      'version' => '1.0.28.0',
63
-      'aliases' => 
64
-      array (
65
-      ),
66
-      'reference' => 'c3d8a73d9760352719da271ee13cfe676f5af075',
61
+        'pretty_version' => '1.0.28',
62
+        'version' => '1.0.28.0',
63
+        'aliases' => 
64
+        array (
65
+        ),
66
+        'reference' => 'c3d8a73d9760352719da271ee13cfe676f5af075',
67 67
     ),
68 68
     'composer/installers' => 
69 69
     array (
70
-      'pretty_version' => 'v1.12.0',
71
-      'version' => '1.12.0.0',
72
-      'aliases' => 
73
-      array (
74
-      ),
75
-      'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19',
70
+        'pretty_version' => 'v1.12.0',
71
+        'version' => '1.12.0.0',
72
+        'aliases' => 
73
+        array (
74
+        ),
75
+        'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19',
76 76
     ),
77 77
     'maxmind-db/reader' => 
78 78
     array (
79
-      'pretty_version' => 'v1.6.0',
80
-      'version' => '1.6.0.0',
81
-      'aliases' => 
82
-      array (
83
-      ),
84
-      'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
79
+        'pretty_version' => 'v1.6.0',
80
+        'version' => '1.6.0.0',
81
+        'aliases' => 
82
+        array (
83
+        ),
84
+        'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
85 85
     ),
86 86
     'roundcube/plugin-installer' => 
87 87
     array (
88
-      'replaced' => 
89
-      array (
88
+        'replaced' => 
89
+        array (
90 90
         0 => '*',
91
-      ),
91
+        ),
92 92
     ),
93 93
     'shama/baton' => 
94 94
     array (
95
-      'replaced' => 
96
-      array (
95
+        'replaced' => 
96
+        array (
97 97
         0 => '*',
98
-      ),
98
+        ),
99
+    ),
99 100
     ),
100
-  ),
101 101
 );
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,99 +1,99 @@
 block discarded – undo
1
-<?php return array (
1
+<?php return array(
2 2
   'root' => 
3
-  array (
3
+  array(
4 4
     'pretty_version' => 'dev-master',
5 5
     'version' => 'dev-master',
6 6
     'aliases' => 
7
-    array (
7
+    array(
8 8
     ),
9 9
     'reference' => '6f34c79e3ece7e41afb9a24d2c0632e8eb770a84',
10 10
     'name' => 'ayecode/invoicing',
11 11
   ),
12 12
   'versions' => 
13
-  array (
13
+  array(
14 14
     'ayecode/ayecode-connect-helper' => 
15
-    array (
15
+    array(
16 16
       'pretty_version' => '1.0.3',
17 17
       'version' => '1.0.3.0',
18 18
       'aliases' => 
19
-      array (
19
+      array(
20 20
       ),
21 21
       'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
22 22
     ),
23 23
     'ayecode/invoicing' => 
24
-    array (
24
+    array(
25 25
       'pretty_version' => 'dev-master',
26 26
       'version' => 'dev-master',
27 27
       'aliases' => 
28
-      array (
28
+      array(
29 29
       ),
30 30
       'reference' => '6f34c79e3ece7e41afb9a24d2c0632e8eb770a84',
31 31
     ),
32 32
     'ayecode/wp-ayecode-ui' => 
33
-    array (
33
+    array(
34 34
       'pretty_version' => '0.1.63',
35 35
       'version' => '0.1.63.0',
36 36
       'aliases' => 
37
-      array (
37
+      array(
38 38
       ),
39 39
       'reference' => 'a7ec8b7719feb7d4b2cacb02c8d0e19aadb6c037',
40 40
     ),
41 41
     'ayecode/wp-deactivation-survey' => 
42
-    array (
42
+    array(
43 43
       'pretty_version' => '1.0.4',
44 44
       'version' => '1.0.4.0',
45 45
       'aliases' => 
46
-      array (
46
+      array(
47 47
       ),
48 48
       'reference' => 'd2777fed30acfc4da53b45bf3b4fec2fb27d8398',
49 49
     ),
50 50
     'ayecode/wp-font-awesome-settings' => 
51
-    array (
51
+    array(
52 52
       'pretty_version' => '1.0.13',
53 53
       'version' => '1.0.13.0',
54 54
       'aliases' => 
55
-      array (
55
+      array(
56 56
       ),
57 57
       'reference' => 'a7a11ee4290674ec214d1fe694139af275350402',
58 58
     ),
59 59
     'ayecode/wp-super-duper' => 
60
-    array (
60
+    array(
61 61
       'pretty_version' => '1.0.28',
62 62
       'version' => '1.0.28.0',
63 63
       'aliases' => 
64
-      array (
64
+      array(
65 65
       ),
66 66
       'reference' => 'c3d8a73d9760352719da271ee13cfe676f5af075',
67 67
     ),
68 68
     'composer/installers' => 
69
-    array (
69
+    array(
70 70
       'pretty_version' => 'v1.12.0',
71 71
       'version' => '1.12.0.0',
72 72
       'aliases' => 
73
-      array (
73
+      array(
74 74
       ),
75 75
       'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19',
76 76
     ),
77 77
     'maxmind-db/reader' => 
78
-    array (
78
+    array(
79 79
       'pretty_version' => 'v1.6.0',
80 80
       'version' => '1.6.0.0',
81 81
       'aliases' => 
82
-      array (
82
+      array(
83 83
       ),
84 84
       'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
85 85
     ),
86 86
     'roundcube/plugin-installer' => 
87
-    array (
87
+    array(
88 88
       'replaced' => 
89
-      array (
89
+      array(
90 90
         0 => '*',
91 91
       ),
92 92
     ),
93 93
     'shama/baton' => 
94
-    array (
94
+    array(
95 95
       'replaced' => 
96
-      array (
96
+      array(
97 97
         0 => '*',
98 98
       ),
99 99
     ),
Please login to merge, or discard this patch.