Passed
Push — master ( 51c804...1c8cf7 )
by Brian
05:30
created
vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php 1 patch
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.81";
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.81";
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
 }
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/ayecode-ui-settings.php 1 patch
Indentation   +1553 added lines, -1553 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,422 +21,422 @@  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.81';
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
-		/**
93
-		 * Main AyeCode_UI_Settings Instance.
94
-		 *
95
-		 * Ensures only one instance of AyeCode_UI_Settings is loaded or can be loaded.
96
-		 *
97
-		 * @since 1.0.0
98
-		 * @static
99
-		 * @return AyeCode_UI_Settings - Main instance.
100
-		 */
101
-		public static function instance() {
102
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) {
103
-
104
-				self::$instance = new AyeCode_UI_Settings;
105
-
106
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
107
-
108
-				if ( is_admin() ) {
109
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
110
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
111
-
112
-					// Maybe show example page
113
-					add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
114
-
115
-					if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
116
-						add_filter( 'sd_aui_colors', array( self::$instance,'sd_aui_colors' ), 10, 3 );
117
-					}
118
-				}
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.81';
119 39
 
120
-				add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
40
+        /**
41
+         * Class textdomain.
42
+         *
43
+         * @var string
44
+         */
45
+        public $textdomain = 'aui';
121 46
 
122
-				do_action( 'ayecode_ui_settings_loaded' );
123
-			}
47
+        /**
48
+         * Latest version of Bootstrap at time of publish published.
49
+         *
50
+         * @var string
51
+         */
52
+        public $latest = "4.5.3";
124 53
 
125
-			return self::$instance;
126
-		}
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
+        /**
93
+         * Main AyeCode_UI_Settings Instance.
94
+         *
95
+         * Ensures only one instance of AyeCode_UI_Settings is loaded or can be loaded.
96
+         *
97
+         * @since 1.0.0
98
+         * @static
99
+         * @return AyeCode_UI_Settings - Main instance.
100
+         */
101
+        public static function instance() {
102
+            if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) {
103
+
104
+                self::$instance = new AyeCode_UI_Settings;
105
+
106
+                add_action( 'init', array( self::$instance, 'init' ) ); // set settings
107
+
108
+                if ( is_admin() ) {
109
+                    add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
110
+                    add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
127 111
 
128
-		/**
112
+                    // Maybe show example page
113
+                    add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
114
+
115
+                    if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
116
+                        add_filter( 'sd_aui_colors', array( self::$instance,'sd_aui_colors' ), 10, 3 );
117
+                    }
118
+                }
119
+
120
+                add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
121
+
122
+                do_action( 'ayecode_ui_settings_loaded' );
123
+            }
124
+
125
+            return self::$instance;
126
+        }
127
+
128
+        /**
129 129
          * Add custom colors to the color selector.
130 130
          *
131
-		 * @param $theme_colors
132
-		 * @param $include_outlines
133
-		 * @param $include_branding
134
-		 *
135
-		 * @return mixed
136
-		 */
137
-		public function sd_aui_colors( $theme_colors, $include_outlines, $include_branding ){
131
+         * @param $theme_colors
132
+         * @param $include_outlines
133
+         * @param $include_branding
134
+         *
135
+         * @return mixed
136
+         */
137
+        public function sd_aui_colors( $theme_colors, $include_outlines, $include_branding ){
138 138
 
139 139
 
140
-			$setting = wp_get_global_settings();
140
+            $setting = wp_get_global_settings();
141 141
 
142
-			if(!empty($setting['color']['palette']['custom'])){
143
-				foreach($setting['color']['palette']['custom'] as $color){
144
-					$theme_colors[$color['slug']] = esc_attr($color['name']);
145
-				}
146
-			}
142
+            if(!empty($setting['color']['palette']['custom'])){
143
+                foreach($setting['color']['palette']['custom'] as $color){
144
+                    $theme_colors[$color['slug']] = esc_attr($color['name']);
145
+                }
146
+            }
147 147
 
148
-			return $theme_colors;
149
-		}
148
+            return $theme_colors;
149
+        }
150 150
 
151
-		/**
152
-		 * Setup some constants.
153
-		 */
154
-		public function constants(){
155
-			define( 'AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be" );
156
-			define( 'AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d' );
157
-			define( 'AUI_INFO_COLOR_ORIGINAL', '#17a2b8' );
158
-			define( 'AUI_WARNING_COLOR_ORIGINAL', '#ffc107' );
159
-			define( 'AUI_DANGER_COLOR_ORIGINAL', '#dc3545' );
160
-			define( 'AUI_SUCCESS_COLOR_ORIGINAL', '#44c553' );
161
-			define( 'AUI_LIGHT_COLOR_ORIGINAL', '#f8f9fa' );
162
-			define( 'AUI_DARK_COLOR_ORIGINAL', '#343a40' );
163
-			define( 'AUI_WHITE_COLOR_ORIGINAL', '#fff' );
164
-			define( 'AUI_PURPLE_COLOR_ORIGINAL', '#ad6edd' );
165
-			define( 'AUI_SALMON_COLOR_ORIGINAL', '#ff977a' );
166
-			define( 'AUI_CYAN_COLOR_ORIGINAL', '#35bdff' );
167
-			define( 'AUI_GRAY_COLOR_ORIGINAL', '#ced4da' );
168
-			define( 'AUI_INDIGO_COLOR_ORIGINAL', '#502c6c' );
169
-			define( 'AUI_ORANGE_COLOR_ORIGINAL', '#orange' );
170
-			define( 'AUI_BLACK_COLOR_ORIGINAL', '#000' );
171
-
172
-			if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
173
-				define( 'AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL );
174
-			}
175
-			if ( ! defined( 'AUI_SECONDARY_COLOR' ) ) {
176
-				define( 'AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL );
177
-			}
178
-			if ( ! defined( 'AUI_INFO_COLOR' ) ) {
179
-				define( 'AUI_INFO_COLOR', AUI_INFO_COLOR_ORIGINAL );
180
-			}
181
-			if ( ! defined( 'AUI_WARNING_COLOR' ) ) {
182
-				define( 'AUI_WARNING_COLOR', AUI_WARNING_COLOR_ORIGINAL );
183
-			}
184
-			if ( ! defined( 'AUI_DANGER_COLOR' ) ) {
185
-				define( 'AUI_DANGER_COLOR', AUI_DANGER_COLOR_ORIGINAL );
186
-			}
187
-			if ( ! defined( 'AUI_SUCCESS_COLOR' ) ) {
188
-				define( 'AUI_SUCCESS_COLOR', AUI_SUCCESS_COLOR_ORIGINAL );
189
-			}
190
-			if ( ! defined( 'AUI_LIGHT_COLOR' ) ) {
191
-				define( 'AUI_LIGHT_COLOR', AUI_LIGHT_COLOR_ORIGINAL );
192
-			}
193
-			if ( ! defined( 'AUI_DARK_COLOR' ) ) {
194
-				define( 'AUI_DARK_COLOR', AUI_DARK_COLOR_ORIGINAL );
195
-			}
196
-			if ( ! defined( 'AUI_WHITE_COLOR' ) ) {
197
-				define( 'AUI_WHITE_COLOR', AUI_WHITE_COLOR_ORIGINAL );
198
-			}
199
-			if ( ! defined( 'AUI_PURPLE_COLOR' ) ) {
200
-				define( 'AUI_PURPLE_COLOR', AUI_PURPLE_COLOR_ORIGINAL );
201
-			}
202
-			if ( ! defined( 'AUI_SALMON_COLOR' ) ) {
203
-				define( 'AUI_SALMON_COLOR', AUI_SALMON_COLOR_ORIGINAL );
204
-			}
205
-			if ( ! defined( 'AUI_CYAN_COLOR' ) ) {
206
-				define( 'AUI_CYAN_COLOR', AUI_CYAN_COLOR_ORIGINAL );
207
-			}
208
-			if ( ! defined( 'AUI_GRAY_COLOR' ) ) {
209
-				define( 'AUI_GRAY_COLOR', AUI_GRAY_COLOR_ORIGINAL );
210
-			}
211
-			if ( ! defined( 'AUI_INDIGO_COLOR' ) ) {
212
-				define( 'AUI_INDIGO_COLOR', AUI_INDIGO_COLOR_ORIGINAL );
213
-			}
214
-			if ( ! defined( 'AUI_ORANGE_COLOR' ) ) {
215
-				define( 'AUI_ORANGE_COLOR', AUI_ORANGE_COLOR_ORIGINAL );
216
-			}
217
-			if ( ! defined( 'AUI_BLACK_COLOR' ) ) {
218
-				define( 'AUI_BLACK_COLOR', AUI_BLACK_COLOR_ORIGINAL );
219
-			}
151
+        /**
152
+         * Setup some constants.
153
+         */
154
+        public function constants(){
155
+            define( 'AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be" );
156
+            define( 'AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d' );
157
+            define( 'AUI_INFO_COLOR_ORIGINAL', '#17a2b8' );
158
+            define( 'AUI_WARNING_COLOR_ORIGINAL', '#ffc107' );
159
+            define( 'AUI_DANGER_COLOR_ORIGINAL', '#dc3545' );
160
+            define( 'AUI_SUCCESS_COLOR_ORIGINAL', '#44c553' );
161
+            define( 'AUI_LIGHT_COLOR_ORIGINAL', '#f8f9fa' );
162
+            define( 'AUI_DARK_COLOR_ORIGINAL', '#343a40' );
163
+            define( 'AUI_WHITE_COLOR_ORIGINAL', '#fff' );
164
+            define( 'AUI_PURPLE_COLOR_ORIGINAL', '#ad6edd' );
165
+            define( 'AUI_SALMON_COLOR_ORIGINAL', '#ff977a' );
166
+            define( 'AUI_CYAN_COLOR_ORIGINAL', '#35bdff' );
167
+            define( 'AUI_GRAY_COLOR_ORIGINAL', '#ced4da' );
168
+            define( 'AUI_INDIGO_COLOR_ORIGINAL', '#502c6c' );
169
+            define( 'AUI_ORANGE_COLOR_ORIGINAL', '#orange' );
170
+            define( 'AUI_BLACK_COLOR_ORIGINAL', '#000' );
171
+
172
+            if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
173
+                define( 'AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL );
174
+            }
175
+            if ( ! defined( 'AUI_SECONDARY_COLOR' ) ) {
176
+                define( 'AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL );
177
+            }
178
+            if ( ! defined( 'AUI_INFO_COLOR' ) ) {
179
+                define( 'AUI_INFO_COLOR', AUI_INFO_COLOR_ORIGINAL );
180
+            }
181
+            if ( ! defined( 'AUI_WARNING_COLOR' ) ) {
182
+                define( 'AUI_WARNING_COLOR', AUI_WARNING_COLOR_ORIGINAL );
183
+            }
184
+            if ( ! defined( 'AUI_DANGER_COLOR' ) ) {
185
+                define( 'AUI_DANGER_COLOR', AUI_DANGER_COLOR_ORIGINAL );
186
+            }
187
+            if ( ! defined( 'AUI_SUCCESS_COLOR' ) ) {
188
+                define( 'AUI_SUCCESS_COLOR', AUI_SUCCESS_COLOR_ORIGINAL );
189
+            }
190
+            if ( ! defined( 'AUI_LIGHT_COLOR' ) ) {
191
+                define( 'AUI_LIGHT_COLOR', AUI_LIGHT_COLOR_ORIGINAL );
192
+            }
193
+            if ( ! defined( 'AUI_DARK_COLOR' ) ) {
194
+                define( 'AUI_DARK_COLOR', AUI_DARK_COLOR_ORIGINAL );
195
+            }
196
+            if ( ! defined( 'AUI_WHITE_COLOR' ) ) {
197
+                define( 'AUI_WHITE_COLOR', AUI_WHITE_COLOR_ORIGINAL );
198
+            }
199
+            if ( ! defined( 'AUI_PURPLE_COLOR' ) ) {
200
+                define( 'AUI_PURPLE_COLOR', AUI_PURPLE_COLOR_ORIGINAL );
201
+            }
202
+            if ( ! defined( 'AUI_SALMON_COLOR' ) ) {
203
+                define( 'AUI_SALMON_COLOR', AUI_SALMON_COLOR_ORIGINAL );
204
+            }
205
+            if ( ! defined( 'AUI_CYAN_COLOR' ) ) {
206
+                define( 'AUI_CYAN_COLOR', AUI_CYAN_COLOR_ORIGINAL );
207
+            }
208
+            if ( ! defined( 'AUI_GRAY_COLOR' ) ) {
209
+                define( 'AUI_GRAY_COLOR', AUI_GRAY_COLOR_ORIGINAL );
210
+            }
211
+            if ( ! defined( 'AUI_INDIGO_COLOR' ) ) {
212
+                define( 'AUI_INDIGO_COLOR', AUI_INDIGO_COLOR_ORIGINAL );
213
+            }
214
+            if ( ! defined( 'AUI_ORANGE_COLOR' ) ) {
215
+                define( 'AUI_ORANGE_COLOR', AUI_ORANGE_COLOR_ORIGINAL );
216
+            }
217
+            if ( ! defined( 'AUI_BLACK_COLOR' ) ) {
218
+                define( 'AUI_BLACK_COLOR', AUI_BLACK_COLOR_ORIGINAL );
219
+            }
220 220
 
221
-		}
221
+        }
222 222
 
223 223
         public static function get_colors( $original = false){
224 224
 
225
-	        if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
225
+            if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
226 226
                 return array();
227
-	        }
228
-	        if ( $original ) {
227
+            }
228
+            if ( $original ) {
229 229
                 return array(
230
-	                'primary'   => AUI_PRIMARY_COLOR_ORIGINAL,
231
-	                'secondary' => AUI_SECONDARY_COLOR_ORIGINAL,
232
-	                'info'      => AUI_INFO_COLOR_ORIGINAL,
233
-	                'warning'   => AUI_WARNING_COLOR_ORIGINAL,
234
-	                'danger'    => AUI_DANGER_COLOR_ORIGINAL,
235
-	                'success'   => AUI_SUCCESS_COLOR_ORIGINAL,
236
-	                'light'     => AUI_LIGHT_COLOR_ORIGINAL,
237
-	                'dark'      => AUI_DARK_COLOR_ORIGINAL,
238
-	                'white'     => AUI_WHITE_COLOR_ORIGINAL,
239
-	                'purple'    => AUI_PURPLE_COLOR_ORIGINAL,
240
-	                'salmon'    => AUI_SALMON_COLOR_ORIGINAL,
241
-	                'cyan'      => AUI_CYAN_COLOR_ORIGINAL,
242
-	                'gray'      => AUI_GRAY_COLOR_ORIGINAL,
243
-	                'indigo'    => AUI_INDIGO_COLOR_ORIGINAL,
244
-	                'orange'    => AUI_ORANGE_COLOR_ORIGINAL,
245
-	                'black'     => AUI_BLACK_COLOR_ORIGINAL,
230
+                    'primary'   => AUI_PRIMARY_COLOR_ORIGINAL,
231
+                    'secondary' => AUI_SECONDARY_COLOR_ORIGINAL,
232
+                    'info'      => AUI_INFO_COLOR_ORIGINAL,
233
+                    'warning'   => AUI_WARNING_COLOR_ORIGINAL,
234
+                    'danger'    => AUI_DANGER_COLOR_ORIGINAL,
235
+                    'success'   => AUI_SUCCESS_COLOR_ORIGINAL,
236
+                    'light'     => AUI_LIGHT_COLOR_ORIGINAL,
237
+                    'dark'      => AUI_DARK_COLOR_ORIGINAL,
238
+                    'white'     => AUI_WHITE_COLOR_ORIGINAL,
239
+                    'purple'    => AUI_PURPLE_COLOR_ORIGINAL,
240
+                    'salmon'    => AUI_SALMON_COLOR_ORIGINAL,
241
+                    'cyan'      => AUI_CYAN_COLOR_ORIGINAL,
242
+                    'gray'      => AUI_GRAY_COLOR_ORIGINAL,
243
+                    'indigo'    => AUI_INDIGO_COLOR_ORIGINAL,
244
+                    'orange'    => AUI_ORANGE_COLOR_ORIGINAL,
245
+                    'black'     => AUI_BLACK_COLOR_ORIGINAL,
246 246
                 );
247
-	        }
247
+            }
248 248
 
249 249
             return array(
250
-	            'primary'   => AUI_PRIMARY_COLOR,
251
-	            'secondary' => AUI_SECONDARY_COLOR,
252
-	            'info'      => AUI_INFO_COLOR,
253
-	            'warning'   => AUI_WARNING_COLOR,
254
-	            'danger'    => AUI_DANGER_COLOR,
255
-	            'success'   => AUI_SUCCESS_COLOR,
256
-	            'light'     => AUI_LIGHT_COLOR,
257
-	            'dark'      => AUI_DARK_COLOR,
258
-	            'white'     => AUI_WHITE_COLOR,
259
-	            'purple'    => AUI_PURPLE_COLOR,
260
-	            'salmon'    => AUI_SALMON_COLOR,
261
-	            'cyan'      => AUI_CYAN_COLOR,
262
-	            'gray'      => AUI_GRAY_COLOR,
263
-	            'indigo'    => AUI_INDIGO_COLOR,
264
-	            'orange'    => AUI_ORANGE_COLOR,
265
-	            'black'     => AUI_BLACK_COLOR,
250
+                'primary'   => AUI_PRIMARY_COLOR,
251
+                'secondary' => AUI_SECONDARY_COLOR,
252
+                'info'      => AUI_INFO_COLOR,
253
+                'warning'   => AUI_WARNING_COLOR,
254
+                'danger'    => AUI_DANGER_COLOR,
255
+                'success'   => AUI_SUCCESS_COLOR,
256
+                'light'     => AUI_LIGHT_COLOR,
257
+                'dark'      => AUI_DARK_COLOR,
258
+                'white'     => AUI_WHITE_COLOR,
259
+                'purple'    => AUI_PURPLE_COLOR,
260
+                'salmon'    => AUI_SALMON_COLOR,
261
+                'cyan'      => AUI_CYAN_COLOR,
262
+                'gray'      => AUI_GRAY_COLOR,
263
+                'indigo'    => AUI_INDIGO_COLOR,
264
+                'orange'    => AUI_ORANGE_COLOR,
265
+                'black'     => AUI_BLACK_COLOR,
266 266
             );
267 267
         }
268 268
 
269
-		/**
270
-		 * Initiate the settings and add the required action hooks.
271
-		 */
272
-		public function init() {
273
-
274
-			// Maybe fix settings
275
-			if ( ! empty( $_REQUEST['aui-fix-admin'] ) && !empty($_REQUEST['nonce']) && wp_verify_nonce( $_REQUEST['nonce'], "aui-fix-admin" ) ) {
276
-				$db_settings = get_option( 'ayecode-ui-settings' );
277
-				if ( ! empty( $db_settings ) ) {
278
-					$db_settings['css_backend'] = 'compatibility';
279
-					$db_settings['js_backend'] = 'core-popper';
280
-					update_option( 'ayecode-ui-settings', $db_settings );
281
-					wp_safe_redirect(admin_url("options-general.php?page=ayecode-ui-settings&updated=true"));
282
-				}
283
-			}
269
+        /**
270
+         * Initiate the settings and add the required action hooks.
271
+         */
272
+        public function init() {
273
+
274
+            // Maybe fix settings
275
+            if ( ! empty( $_REQUEST['aui-fix-admin'] ) && !empty($_REQUEST['nonce']) && wp_verify_nonce( $_REQUEST['nonce'], "aui-fix-admin" ) ) {
276
+                $db_settings = get_option( 'ayecode-ui-settings' );
277
+                if ( ! empty( $db_settings ) ) {
278
+                    $db_settings['css_backend'] = 'compatibility';
279
+                    $db_settings['js_backend'] = 'core-popper';
280
+                    update_option( 'ayecode-ui-settings', $db_settings );
281
+                    wp_safe_redirect(admin_url("options-general.php?page=ayecode-ui-settings&updated=true"));
282
+                }
283
+            }
284 284
 
285
-			$this->constants();
286
-			$this->settings = $this->get_settings();
287
-			$this->url = $this->get_url();
285
+            $this->constants();
286
+            $this->settings = $this->get_settings();
287
+            $this->url = $this->get_url();
288
+
289
+            /**
290
+             * Maybe load CSS
291
+             *
292
+             * We load super early in case there is a theme version that might change the colors
293
+             */
294
+            if ( $this->settings['css'] ) {
295
+                $priority = $this->is_bs3_compat() ? 100 : 1;
296
+                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), $priority );
297
+            }
298
+            if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
299
+                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
300
+            }
288 301
 
289
-			/**
290
-			 * Maybe load CSS
291
-			 *
292
-			 * We load super early in case there is a theme version that might change the colors
293
-			 */
294
-			if ( $this->settings['css'] ) {
295
-				$priority = $this->is_bs3_compat() ? 100 : 1;
296
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), $priority );
297
-			}
298
-			if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
299
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
300
-			}
301
-
302
-			// maybe load JS
303
-			if ( $this->settings['js'] ) {
304
-				$priority = $this->is_bs3_compat() ? 100 : 1;
305
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority );
306
-			}
307
-			if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
308
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
309
-			}
310
-
311
-			// Maybe set the HTML font size
312
-			if ( $this->settings['html_font_size'] ) {
313
-				add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
314
-			}
315
-
316
-			// Maybe show backend style error
317
-			if( $this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper' ){
318
-				add_action( 'admin_notices', array( $this, 'show_admin_style_notice' ) );
319
-			}
302
+            // maybe load JS
303
+            if ( $this->settings['js'] ) {
304
+                $priority = $this->is_bs3_compat() ? 100 : 1;
305
+                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority );
306
+            }
307
+            if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
308
+                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
309
+            }
320 310
 
321
-		}
311
+            // Maybe set the HTML font size
312
+            if ( $this->settings['html_font_size'] ) {
313
+                add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
314
+            }
322 315
 
323
-		/**
324
-		 * Show admin notice if backend scripts not loaded.
325
-		 */
326
-		public function show_admin_style_notice(){
327
-			$fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=".wp_create_nonce('aui-fix-admin'));
328
-			$button = '<a href="'.esc_url($fix_url).'" class="button-primary">Fix Now</a>';
329
-			$message = __( '<b>Style Issue:</b> AyeCode UI is disable or set wrong.')." " .$button;
330
-			echo '<div class="notice notice-error aui-settings-error-notice"><p>'.$message.'</p></div>';
331
-		}
316
+            // Maybe show backend style error
317
+            if( $this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper' ){
318
+                add_action( 'admin_notices', array( $this, 'show_admin_style_notice' ) );
319
+            }
332 320
 
333
-		/**
334
-		 * Check if we should load the admin scripts or not.
335
-		 *
336
-		 * @return bool
337
-		 */
338
-		public function load_admin_scripts(){
339
-			$result = true;
340
-
341
-			// check if specifically disabled
342
-			if(!empty($this->settings['disable_admin'])){
343
-				$url_parts = explode("\n",$this->settings['disable_admin']);
344
-				foreach($url_parts as $part){
345
-					if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
346
-						return false; // return early, no point checking further
347
-					}
348
-				}
349
-			}
321
+        }
350 322
 
351
-			return $result;
352
-		}
323
+        /**
324
+         * Show admin notice if backend scripts not loaded.
325
+         */
326
+        public function show_admin_style_notice(){
327
+            $fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=".wp_create_nonce('aui-fix-admin'));
328
+            $button = '<a href="'.esc_url($fix_url).'" class="button-primary">Fix Now</a>';
329
+            $message = __( '<b>Style Issue:</b> AyeCode UI is disable or set wrong.')." " .$button;
330
+            echo '<div class="notice notice-error aui-settings-error-notice"><p>'.$message.'</p></div>';
331
+        }
353 332
 
354
-		/**
355
-		 * Add a html font size to the footer.
356
-		 */
357
-		public function html_font_size(){
358
-			$this->settings = $this->get_settings();
359
-			echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
360
-		}
333
+        /**
334
+         * Check if we should load the admin scripts or not.
335
+         *
336
+         * @return bool
337
+         */
338
+        public function load_admin_scripts(){
339
+            $result = true;
340
+
341
+            // check if specifically disabled
342
+            if(!empty($this->settings['disable_admin'])){
343
+                $url_parts = explode("\n",$this->settings['disable_admin']);
344
+                foreach($url_parts as $part){
345
+                    if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
346
+                        return false; // return early, no point checking further
347
+                    }
348
+                }
349
+            }
350
+
351
+            return $result;
352
+        }
353
+
354
+        /**
355
+         * Add a html font size to the footer.
356
+         */
357
+        public function html_font_size(){
358
+            $this->settings = $this->get_settings();
359
+            echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
360
+        }
361 361
 
362
-		/**
363
-		 * Check if the current admin screen should load scripts.
364
-		 * 
365
-		 * @return bool
366
-		 */
367
-		public function is_aui_screen(){
362
+        /**
363
+         * Check if the current admin screen should load scripts.
364
+         * 
365
+         * @return bool
366
+         */
367
+        public function is_aui_screen(){
368 368
 //			echo '###';exit;
369
-			$load = false;
370
-			// check if we should load or not
371
-			if ( is_admin() ) {
372
-				// Only enable on set pages
373
-				$aui_screens = array(
374
-					'page',
375
-					'post',
376
-					'settings_page_ayecode-ui-settings',
377
-					'appearance_page_gutenberg-widgets',
378
-					'widgets',
379
-					'ayecode-ui-settings',
380
-					'site-editor'
381
-				);
382
-				$screen_ids = apply_filters( 'aui_screen_ids', $aui_screens );
383
-
384
-				$screen = get_current_screen();
369
+            $load = false;
370
+            // check if we should load or not
371
+            if ( is_admin() ) {
372
+                // Only enable on set pages
373
+                $aui_screens = array(
374
+                    'page',
375
+                    'post',
376
+                    'settings_page_ayecode-ui-settings',
377
+                    'appearance_page_gutenberg-widgets',
378
+                    'widgets',
379
+                    'ayecode-ui-settings',
380
+                    'site-editor'
381
+                );
382
+                $screen_ids = apply_filters( 'aui_screen_ids', $aui_screens );
383
+
384
+                $screen = get_current_screen();
385 385
 
386 386
 //				echo '###'.$screen->id;
387 387
 
388
-				// check if we are on a AUI screen
389
-				if ( $screen && in_array( $screen->id, $screen_ids ) ) {
390
-					$load = true;
391
-				}
388
+                // check if we are on a AUI screen
389
+                if ( $screen && in_array( $screen->id, $screen_ids ) ) {
390
+                    $load = true;
391
+                }
392 392
 
393
-				//load for widget previews in WP 5.8
394
-				if( !empty($_REQUEST['legacy-widget-preview'])){
395
-					$load = true;
396
-				}
397
-			}
393
+                //load for widget previews in WP 5.8
394
+                if( !empty($_REQUEST['legacy-widget-preview'])){
395
+                    $load = true;
396
+                }
397
+            }
398 398
 
399
-			return apply_filters( 'aui_load_on_admin' , $load );
400
-		}
399
+            return apply_filters( 'aui_load_on_admin' , $load );
400
+        }
401 401
 
402
-		/**
402
+        /**
403 403
          * Check if the current theme is a block theme.
404 404
          *
405
-		 * @return bool
406
-		 */
407
-		public static function is_block_theme() {
408
-			if ( function_exists( 'wp_is_block_theme' && wp_is_block_theme() ) ) {
409
-				return true;
410
-			}
411
-
412
-			return false;
413
-		}
405
+         * @return bool
406
+         */
407
+        public static function is_block_theme() {
408
+            if ( function_exists( 'wp_is_block_theme' && wp_is_block_theme() ) ) {
409
+                return true;
410
+            }
414 411
 
415
-		/**
416
-		 * Adds the styles.
417
-		 */
418
-		public function enqueue_style() {
412
+            return false;
413
+        }
419 414
 
415
+        /**
416
+         * Adds the styles.
417
+         */
418
+        public function enqueue_style() {
420 419
 
421
-			if( is_admin() && !$this->is_aui_screen()){
422
-				// don't add wp-admin scripts if not requested to
423
-			}else{
424
-				$css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
425 420
 
426
-				$rtl = is_rtl() ? '-rtl' : '';
421
+            if( is_admin() && !$this->is_aui_screen()){
422
+                // don't add wp-admin scripts if not requested to
423
+            }else{
424
+                $css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
427 425
 
428
-				if($this->settings[$css_setting]){
429
-					$compatibility = $this->settings[$css_setting]=='core' ? false : true;
430
-					$url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets/css/ayecode-ui-compatibility'.$rtl.'.css';
431
-					wp_register_style( 'ayecode-ui', $url, array(), $this->version );
432
-					wp_enqueue_style( 'ayecode-ui' );
426
+                $rtl = is_rtl() ? '-rtl' : '';
433 427
 
434
-					// flatpickr
435
-					wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->version );
428
+                if($this->settings[$css_setting]){
429
+                    $compatibility = $this->settings[$css_setting]=='core' ? false : true;
430
+                    $url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets/css/ayecode-ui-compatibility'.$rtl.'.css';
431
+                    wp_register_style( 'ayecode-ui', $url, array(), $this->version );
432
+                    wp_enqueue_style( 'ayecode-ui' );
436 433
 
437
-					// fix some wp-admin issues
438
-					if(is_admin()){
439
-						$custom_css = "
434
+                    // flatpickr
435
+                    wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->version );
436
+
437
+                    // fix some wp-admin issues
438
+                    if(is_admin()){
439
+                        $custom_css = "
440 440
                 body{
441 441
                     background-color: #f1f1f1;
442 442
                     font-family: -apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif;
@@ -482,35 +482,35 @@  discard block
 block discarded – undo
482 482
 				}
483 483
                 ";
484 484
 
485
-						// @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
486
-						$custom_css .= "
485
+                        // @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
486
+                        $custom_css .= "
487 487
 						.edit-post-sidebar input[type=color].components-text-control__input{
488 488
 						    padding: 0;
489 489
 						}
490 490
 					";
491
-						wp_add_inline_style( 'ayecode-ui', $custom_css );
492
-					}
491
+                        wp_add_inline_style( 'ayecode-ui', $custom_css );
492
+                    }
493 493
 
494
-					// custom changes
495
-					wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
494
+                    // custom changes
495
+                    wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
496 496
 
497
-				}
498
-			}
497
+                }
498
+            }
499 499
 
500 500
 
501
-		}
501
+        }
502 502
 
503
-		/**
504
-		 * Get inline script used if bootstrap enqueued
505
-		 *
506
-		 * If this remains small then its best to use this than to add another JS file.
507
-		 */
508
-		public function inline_script() {
509
-			// Flatpickr calendar locale
510
-			$flatpickr_locale = self::flatpickr_locale();
511
-
512
-			ob_start();
513
-			?>
503
+        /**
504
+         * Get inline script used if bootstrap enqueued
505
+         *
506
+         * If this remains small then its best to use this than to add another JS file.
507
+         */
508
+        public function inline_script() {
509
+            // Flatpickr calendar locale
510
+            $flatpickr_locale = self::flatpickr_locale();
511
+
512
+            ob_start();
513
+            ?>
514 514
 			<script>
515 515
 				/**
516 516
 				 * An AUI bootstrap adaptation of GreedyNav.js ( by Luke Jackson ).
@@ -1481,29 +1481,29 @@  discard block
 block discarded – undo
1481 1481
 
1482 1482
 			</script>
1483 1483
 			<?php
1484
-			$output = ob_get_clean();
1484
+            $output = ob_get_clean();
1485 1485
 
1486 1486
 
1487 1487
 
1488
-			/*
1488
+            /*
1489 1489
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1490 1490
 			 */
1491
-			return str_replace( array(
1492
-				'<script>',
1493
-				'</script>'
1494
-			), '', self::minify_js($output) );
1495
-		}
1491
+            return str_replace( array(
1492
+                '<script>',
1493
+                '</script>'
1494
+            ), '', self::minify_js($output) );
1495
+        }
1496 1496
 
1497 1497
 
1498
-		/**
1499
-		 * JS to help with conflict issues with other plugins and themes using bootstrap v3.
1500
-		 *
1501
-		 * @TODO we may need this when other conflicts arrise.
1502
-		 * @return mixed
1503
-		 */
1504
-		public static function bs3_compat_js() {
1505
-			ob_start();
1506
-			?>
1498
+        /**
1499
+         * JS to help with conflict issues with other plugins and themes using bootstrap v3.
1500
+         *
1501
+         * @TODO we may need this when other conflicts arrise.
1502
+         * @return mixed
1503
+         */
1504
+        public static function bs3_compat_js() {
1505
+            ob_start();
1506
+            ?>
1507 1507
 			<script>
1508 1508
 				<?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?>
1509 1509
 				/* With Avada builder */
@@ -1511,20 +1511,20 @@  discard block
 block discarded – undo
1511 1511
 				<?php } ?>
1512 1512
 			</script>
1513 1513
 			<?php
1514
-			return str_replace( array(
1515
-				'<script>',
1516
-				'</script>'
1517
-			), '', ob_get_clean());
1518
-		}
1514
+            return str_replace( array(
1515
+                '<script>',
1516
+                '</script>'
1517
+            ), '', ob_get_clean());
1518
+        }
1519 1519
 
1520
-		/**
1521
-		 * Get inline script used if bootstrap file browser enqueued.
1522
-		 *
1523
-		 * If this remains small then its best to use this than to add another JS file.
1524
-		 */
1525
-		public function inline_script_file_browser(){
1526
-			ob_start();
1527
-			?>
1520
+        /**
1521
+         * Get inline script used if bootstrap file browser enqueued.
1522
+         *
1523
+         * If this remains small then its best to use this than to add another JS file.
1524
+         */
1525
+        public function inline_script_file_browser(){
1526
+            ob_start();
1527
+            ?>
1528 1528
 			<script>
1529 1529
 				// run on doc ready
1530 1530
 				jQuery(document).ready(function () {
@@ -1532,224 +1532,224 @@  discard block
 block discarded – undo
1532 1532
 				});
1533 1533
 			</script>
1534 1534
 			<?php
1535
-			$output = ob_get_clean();
1535
+            $output = ob_get_clean();
1536 1536
 
1537
-			/*
1537
+            /*
1538 1538
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1539 1539
 			 */
1540
-			return str_replace( array(
1541
-				'<script>',
1542
-				'</script>'
1543
-			), '', $output );
1544
-		}
1540
+            return str_replace( array(
1541
+                '<script>',
1542
+                '</script>'
1543
+            ), '', $output );
1544
+        }
1545 1545
 
1546
-		/**
1547
-		 * Adds the Font Awesome JS.
1548
-		 */
1549
-		public function enqueue_scripts() {
1546
+        /**
1547
+         * Adds the Font Awesome JS.
1548
+         */
1549
+        public function enqueue_scripts() {
1550 1550
 
1551
-			if( is_admin() && !$this->is_aui_screen()){
1552
-				// don't add wp-admin scripts if not requested to
1553
-			}else {
1551
+            if( is_admin() && !$this->is_aui_screen()){
1552
+                // don't add wp-admin scripts if not requested to
1553
+            }else {
1554 1554
 
1555
-				$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
1555
+                $js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
1556 1556
 
1557
-				// select2
1558
-				wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
1557
+                // select2
1558
+                wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
1559 1559
 
1560
-				// flatpickr
1561
-				wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version );
1560
+                // flatpickr
1561
+                wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version );
1562 1562
 
1563
-				// flatpickr
1564
-				wp_register_script( 'iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version );
1563
+                // flatpickr
1564
+                wp_register_script( 'iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version );
1565 1565
 				
1566
-				// Bootstrap file browser
1567
-				wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
1568
-				wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
1569
-
1570
-				$load_inline = false;
1571
-
1572
-				if ( $this->settings[ $js_setting ] == 'core-popper' ) {
1573
-					// Bootstrap bundle
1574
-					$url = $this->url . 'assets/js/bootstrap.bundle.min.js';
1575
-					wp_register_script( 'bootstrap-js-bundle', $url, array(
1576
-						'select2',
1577
-						'jquery'
1578
-					), $this->version, $this->is_bs3_compat() );
1579
-					// if in admin then add to footer for compatibility.
1580
-					is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
1581
-					$script = $this->inline_script();
1582
-					wp_add_inline_script( 'bootstrap-js-bundle', $script );
1583
-				} elseif ( $this->settings[ $js_setting ] == 'popper' ) {
1584
-					$url = $this->url . 'assets/js/popper.min.js';
1585
-					wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->version );
1586
-					wp_enqueue_script( 'bootstrap-js-popper' );
1587
-					$load_inline = true;
1588
-				} else {
1589
-					$load_inline = true;
1590
-				}
1566
+                // Bootstrap file browser
1567
+                wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
1568
+                wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
1569
+
1570
+                $load_inline = false;
1571
+
1572
+                if ( $this->settings[ $js_setting ] == 'core-popper' ) {
1573
+                    // Bootstrap bundle
1574
+                    $url = $this->url . 'assets/js/bootstrap.bundle.min.js';
1575
+                    wp_register_script( 'bootstrap-js-bundle', $url, array(
1576
+                        'select2',
1577
+                        'jquery'
1578
+                    ), $this->version, $this->is_bs3_compat() );
1579
+                    // if in admin then add to footer for compatibility.
1580
+                    is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
1581
+                    $script = $this->inline_script();
1582
+                    wp_add_inline_script( 'bootstrap-js-bundle', $script );
1583
+                } elseif ( $this->settings[ $js_setting ] == 'popper' ) {
1584
+                    $url = $this->url . 'assets/js/popper.min.js';
1585
+                    wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->version );
1586
+                    wp_enqueue_script( 'bootstrap-js-popper' );
1587
+                    $load_inline = true;
1588
+                } else {
1589
+                    $load_inline = true;
1590
+                }
1591 1591
 
1592
-				// Load needed inline scripts by faking the loading of a script if the main script is not being loaded
1593
-				if ( $load_inline ) {
1594
-					wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) );
1595
-					wp_enqueue_script( 'bootstrap-dummy' );
1596
-					$script = $this->inline_script();
1597
-					wp_add_inline_script( 'bootstrap-dummy', $script );
1598
-				}
1599
-			}
1592
+                // Load needed inline scripts by faking the loading of a script if the main script is not being loaded
1593
+                if ( $load_inline ) {
1594
+                    wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) );
1595
+                    wp_enqueue_script( 'bootstrap-dummy' );
1596
+                    $script = $this->inline_script();
1597
+                    wp_add_inline_script( 'bootstrap-dummy', $script );
1598
+                }
1599
+            }
1600 1600
 
1601
-		}
1601
+        }
1602 1602
 
1603
-		/**
1604
-		 * Enqueue flatpickr if called.
1605
-		 */
1606
-		public function enqueue_flatpickr(){
1607
-			wp_enqueue_style( 'flatpickr' );
1608
-			wp_enqueue_script( 'flatpickr' );
1609
-		}
1603
+        /**
1604
+         * Enqueue flatpickr if called.
1605
+         */
1606
+        public function enqueue_flatpickr(){
1607
+            wp_enqueue_style( 'flatpickr' );
1608
+            wp_enqueue_script( 'flatpickr' );
1609
+        }
1610 1610
 
1611
-		/**
1612
-		 * Enqueue iconpicker if called.
1613
-		 */
1614
-		public function enqueue_iconpicker(){
1615
-			wp_enqueue_style( 'iconpicker' );
1616
-			wp_enqueue_script( 'iconpicker' );
1617
-		}
1611
+        /**
1612
+         * Enqueue iconpicker if called.
1613
+         */
1614
+        public function enqueue_iconpicker(){
1615
+            wp_enqueue_style( 'iconpicker' );
1616
+            wp_enqueue_script( 'iconpicker' );
1617
+        }
1618 1618
 
1619
-		/**
1620
-		 * Get the url path to the current folder.
1621
-		 *
1622
-		 * @return string
1623
-		 */
1624
-		public function get_url() {
1625
-			$content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1626
-			$content_url = untrailingslashit( WP_CONTENT_URL );
1627
-
1628
-			// Replace http:// to https://.
1629
-			if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1630
-				$content_url = str_replace( 'http://', 'https://', $content_url );
1631
-			}
1632
-
1633
-			// Check if we are inside a plugin
1634
-			$file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1635
-			$url = str_replace( $content_dir, $content_url, $file_dir );
1636
-
1637
-			return trailingslashit( $url );
1638
-		}
1619
+        /**
1620
+         * Get the url path to the current folder.
1621
+         *
1622
+         * @return string
1623
+         */
1624
+        public function get_url() {
1625
+            $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1626
+            $content_url = untrailingslashit( WP_CONTENT_URL );
1627
+
1628
+            // Replace http:// to https://.
1629
+            if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1630
+                $content_url = str_replace( 'http://', 'https://', $content_url );
1631
+            }
1632
+
1633
+            // Check if we are inside a plugin
1634
+            $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1635
+            $url = str_replace( $content_dir, $content_url, $file_dir );
1636
+
1637
+            return trailingslashit( $url );
1638
+        }
1639 1639
 
1640
-		/**
1641
-		 * Get the url path to the current folder.
1642
-		 *
1643
-		 * @return string
1644
-		 */
1645
-		public function get_url_old() {
1640
+        /**
1641
+         * Get the url path to the current folder.
1642
+         *
1643
+         * @return string
1644
+         */
1645
+        public function get_url_old() {
1646 1646
 
1647
-			$url = '';
1648
-			// check if we are inside a plugin
1649
-			$file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
1647
+            $url = '';
1648
+            // check if we are inside a plugin
1649
+            $file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
1650 1650
 
1651
-			// add check in-case user has changed wp-content dir name.
1652
-			$wp_content_folder_name = basename(WP_CONTENT_DIR);
1653
-			$dir_parts = explode("/$wp_content_folder_name/",$file_dir);
1654
-			$url_parts = explode("/$wp_content_folder_name/",plugins_url());
1651
+            // add check in-case user has changed wp-content dir name.
1652
+            $wp_content_folder_name = basename(WP_CONTENT_DIR);
1653
+            $dir_parts = explode("/$wp_content_folder_name/",$file_dir);
1654
+            $url_parts = explode("/$wp_content_folder_name/",plugins_url());
1655 1655
 
1656
-			if(!empty($url_parts[0]) && !empty($dir_parts[1])){
1657
-				$url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
1658
-			}
1656
+            if(!empty($url_parts[0]) && !empty($dir_parts[1])){
1657
+                $url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
1658
+            }
1659 1659
 
1660
-			return $url;
1661
-		}
1660
+            return $url;
1661
+        }
1662 1662
 
1663
-		/**
1664
-		 * Register the database settings with WordPress.
1665
-		 */
1666
-		public function register_settings() {
1667
-			register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
1668
-		}
1663
+        /**
1664
+         * Register the database settings with WordPress.
1665
+         */
1666
+        public function register_settings() {
1667
+            register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
1668
+        }
1669 1669
 
1670
-		/**
1671
-		 * Add the WordPress settings menu item.
1672
-		 * @since 1.0.10 Calling function name direct will fail theme check so we don't.
1673
-		 */
1674
-		public function menu_item() {
1675
-			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
1676
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
1677
-				$this,
1678
-				'settings_page'
1679
-			) );
1680
-		}
1670
+        /**
1671
+         * Add the WordPress settings menu item.
1672
+         * @since 1.0.10 Calling function name direct will fail theme check so we don't.
1673
+         */
1674
+        public function menu_item() {
1675
+            $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
1676
+            call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
1677
+                $this,
1678
+                'settings_page'
1679
+            ) );
1680
+        }
1681 1681
 
1682
-		/**
1683
-		 * Get a list of themes and their default JS settings.
1684
-		 *
1685
-		 * @return array
1686
-		 */
1687
-		public function theme_js_settings(){
1688
-			return array(
1689
-				'ayetheme' => 'popper',
1690
-				'listimia' => 'required',
1691
-				'listimia_backend' => 'core-popper',
1692
-				//'avada'    => 'required', // removed as we now add compatibility
1693
-			);
1694
-		}
1682
+        /**
1683
+         * Get a list of themes and their default JS settings.
1684
+         *
1685
+         * @return array
1686
+         */
1687
+        public function theme_js_settings(){
1688
+            return array(
1689
+                'ayetheme' => 'popper',
1690
+                'listimia' => 'required',
1691
+                'listimia_backend' => 'core-popper',
1692
+                //'avada'    => 'required', // removed as we now add compatibility
1693
+            );
1694
+        }
1695 1695
 
1696
-		/**
1697
-		 * Get the current Font Awesome output settings.
1698
-		 *
1699
-		 * @return array The array of settings.
1700
-		 */
1701
-		public function get_settings() {
1702
-
1703
-			$db_settings = get_option( 'ayecode-ui-settings' );
1704
-			$js_default = 'core-popper';
1705
-			$js_default_backend = $js_default;
1706
-
1707
-			// maybe set defaults (if no settings set)
1708
-			if(empty($db_settings)){
1709
-				$active_theme = strtolower( get_template() ); // active parent theme.
1710
-				$theme_js_settings = self::theme_js_settings();
1711
-				if(isset($theme_js_settings[$active_theme])){
1712
-					$js_default = $theme_js_settings[$active_theme];
1713
-					$js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
1714
-				}
1715
-			}
1716
-
1717
-			$defaults = array(
1718
-				'css'       => 'compatibility', // core, compatibility
1719
-				'js'        => $js_default, // js to load, core-popper, popper
1720
-				'html_font_size'        => '16', // js to load, core-popper, popper
1721
-				'css_backend'       => 'compatibility', // core, compatibility
1722
-				'js_backend'        => $js_default_backend, // js to load, core-popper, popper
1723
-				'disable_admin'     =>  '', // URL snippets to disable loading on admin
1724
-			);
1725
-
1726
-			$settings = wp_parse_args( $db_settings, $defaults );
1727
-
1728
-			/**
1729
-			 * Filter the Bootstrap settings.
1730
-			 *
1731
-			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
1732
-			 */
1733
-			return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
1734
-		}
1696
+        /**
1697
+         * Get the current Font Awesome output settings.
1698
+         *
1699
+         * @return array The array of settings.
1700
+         */
1701
+        public function get_settings() {
1702
+
1703
+            $db_settings = get_option( 'ayecode-ui-settings' );
1704
+            $js_default = 'core-popper';
1705
+            $js_default_backend = $js_default;
1706
+
1707
+            // maybe set defaults (if no settings set)
1708
+            if(empty($db_settings)){
1709
+                $active_theme = strtolower( get_template() ); // active parent theme.
1710
+                $theme_js_settings = self::theme_js_settings();
1711
+                if(isset($theme_js_settings[$active_theme])){
1712
+                    $js_default = $theme_js_settings[$active_theme];
1713
+                    $js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
1714
+                }
1715
+            }
1716
+
1717
+            $defaults = array(
1718
+                'css'       => 'compatibility', // core, compatibility
1719
+                'js'        => $js_default, // js to load, core-popper, popper
1720
+                'html_font_size'        => '16', // js to load, core-popper, popper
1721
+                'css_backend'       => 'compatibility', // core, compatibility
1722
+                'js_backend'        => $js_default_backend, // js to load, core-popper, popper
1723
+                'disable_admin'     =>  '', // URL snippets to disable loading on admin
1724
+            );
1735 1725
 
1726
+            $settings = wp_parse_args( $db_settings, $defaults );
1736 1727
 
1737
-		/**
1738
-		 * The settings page html output.
1739
-		 */
1740
-		public function settings_page() {
1741
-			if ( ! current_user_can( 'manage_options' ) ) {
1742
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
1743
-			}
1744
-			?>
1728
+            /**
1729
+             * Filter the Bootstrap settings.
1730
+             *
1731
+             * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
1732
+             */
1733
+            return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
1734
+        }
1735
+
1736
+
1737
+        /**
1738
+         * The settings page html output.
1739
+         */
1740
+        public function settings_page() {
1741
+            if ( ! current_user_can( 'manage_options' ) ) {
1742
+                wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
1743
+            }
1744
+            ?>
1745 1745
 			<div class="wrap">
1746 1746
 				<h1><?php echo $this->name; ?></h1>
1747 1747
 				<p><?php _e("Here you can adjust settings if you are having compatibility issues.",'aui');?></p>
1748 1748
 				<form method="post" action="options.php">
1749 1749
 					<?php
1750
-					settings_fields( 'ayecode-ui-settings' );
1751
-					do_settings_sections( 'ayecode-ui-settings' );
1752
-					?>
1750
+                    settings_fields( 'ayecode-ui-settings' );
1751
+                    do_settings_sections( 'ayecode-ui-settings' );
1752
+                    ?>
1753 1753
 
1754 1754
 					<h2><?php _e( 'Frontend', 'aui' ); ?></h2>
1755 1755
 					<table class="form-table wpbs-table-settings">
@@ -1829,60 +1829,60 @@  discard block
 block discarded – undo
1829 1829
 					</table>
1830 1830
 
1831 1831
 					<?php
1832
-					submit_button();
1833
-					?>
1832
+                    submit_button();
1833
+                    ?>
1834 1834
 				</form>
1835 1835
 
1836 1836
 				<div id="wpbs-version"><?php echo $this->version; ?></div>
1837 1837
 			</div>
1838 1838
 
1839 1839
 			<?php
1840
-		}
1840
+        }
1841 1841
 
1842
-		public function customizer_settings($wp_customize){
1843
-			$wp_customize->add_section('aui_settings', array(
1844
-				'title'    => __('AyeCode UI','aui'),
1845
-				'priority' => 120,
1846
-			));
1847
-
1848
-			//  =============================
1849
-			//  = Color Picker              =
1850
-			//  =============================
1851
-			$wp_customize->add_setting('aui_options[color_primary]', array(
1852
-				'default'           => AUI_PRIMARY_COLOR,
1853
-				'sanitize_callback' => 'sanitize_hex_color',
1854
-				'capability'        => 'edit_theme_options',
1855
-				'type'              => 'option',
1856
-				'transport'         => 'refresh',
1857
-			));
1858
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1859
-				'label'    => __('Primary Color','aui'),
1860
-				'section'  => 'aui_settings',
1861
-				'settings' => 'aui_options[color_primary]',
1862
-			)));
1863
-
1864
-			$wp_customize->add_setting('aui_options[color_secondary]', array(
1865
-				'default'           => '#6c757d',
1866
-				'sanitize_callback' => 'sanitize_hex_color',
1867
-				'capability'        => 'edit_theme_options',
1868
-				'type'              => 'option',
1869
-				'transport'         => 'refresh',
1870
-			));
1871
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1872
-				'label'    => __('Secondary Color','aui'),
1873
-				'section'  => 'aui_settings',
1874
-				'settings' => 'aui_options[color_secondary]',
1875
-			)));
1876
-		}
1842
+        public function customizer_settings($wp_customize){
1843
+            $wp_customize->add_section('aui_settings', array(
1844
+                'title'    => __('AyeCode UI','aui'),
1845
+                'priority' => 120,
1846
+            ));
1847
+
1848
+            //  =============================
1849
+            //  = Color Picker              =
1850
+            //  =============================
1851
+            $wp_customize->add_setting('aui_options[color_primary]', array(
1852
+                'default'           => AUI_PRIMARY_COLOR,
1853
+                'sanitize_callback' => 'sanitize_hex_color',
1854
+                'capability'        => 'edit_theme_options',
1855
+                'type'              => 'option',
1856
+                'transport'         => 'refresh',
1857
+            ));
1858
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1859
+                'label'    => __('Primary Color','aui'),
1860
+                'section'  => 'aui_settings',
1861
+                'settings' => 'aui_options[color_primary]',
1862
+            )));
1863
+
1864
+            $wp_customize->add_setting('aui_options[color_secondary]', array(
1865
+                'default'           => '#6c757d',
1866
+                'sanitize_callback' => 'sanitize_hex_color',
1867
+                'capability'        => 'edit_theme_options',
1868
+                'type'              => 'option',
1869
+                'transport'         => 'refresh',
1870
+            ));
1871
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1872
+                'label'    => __('Secondary Color','aui'),
1873
+                'section'  => 'aui_settings',
1874
+                'settings' => 'aui_options[color_secondary]',
1875
+            )));
1876
+        }
1877 1877
 
1878
-		/**
1879
-		 * CSS to help with conflict issues with other plugins and themes using bootstrap v3.
1880
-		 *
1881
-		 * @return mixed
1882
-		 */
1883
-		public static function bs3_compat_css() {
1884
-			ob_start();
1885
-			?>
1878
+        /**
1879
+         * CSS to help with conflict issues with other plugins and themes using bootstrap v3.
1880
+         *
1881
+         * @return mixed
1882
+         */
1883
+        public static function bs3_compat_css() {
1884
+            ob_start();
1885
+            ?>
1886 1886
 			<style>
1887 1887
 			/* Bootstrap 3 compatibility */
1888 1888
 			body.modal-open .modal-backdrop.show:not(.in) {opacity:0.5;}
@@ -1911,47 +1911,47 @@  discard block
 block discarded – undo
1911 1911
 			<?php } ?>
1912 1912
 			</style>
1913 1913
 			<?php
1914
-			return str_replace( array(
1915
-				'<style>',
1916
-				'</style>'
1917
-			), '', self::minify_css( ob_get_clean() ) );
1918
-		}
1914
+            return str_replace( array(
1915
+                '<style>',
1916
+                '</style>'
1917
+            ), '', self::minify_css( ob_get_clean() ) );
1918
+        }
1919 1919
 
1920 1920
 
1921
-		public static function custom_css($compatibility = true) {
1922
-			$colors = array();
1923
-			if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
1921
+        public static function custom_css($compatibility = true) {
1922
+            $colors = array();
1923
+            if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
1924 1924
 
1925
-				$setting = wp_get_global_settings();
1926
-				if(!empty($setting['color']['palette']['theme'])){
1927
-					foreach($setting['color']['palette']['theme'] as $color){
1928
-						$colors[$color['slug']] = esc_attr($color['color']);
1929
-					}
1930
-				}
1925
+                $setting = wp_get_global_settings();
1926
+                if(!empty($setting['color']['palette']['theme'])){
1927
+                    foreach($setting['color']['palette']['theme'] as $color){
1928
+                        $colors[$color['slug']] = esc_attr($color['color']);
1929
+                    }
1930
+                }
1931 1931
 
1932
-				if(!empty($setting['color']['palette']['custom'])){
1933
-					foreach($setting['color']['palette']['custom'] as $color){
1934
-						$colors[$color['slug']] = esc_attr($color['color']);
1935
-					}
1936
-				}
1937
-			}else{
1938
-				$settings = get_option('aui_options');
1939
-				$colors = array(
1940
-					'primary'   => ! empty( $settings['color_primary'] ) ? $settings['color_primary'] : AUI_PRIMARY_COLOR,
1941
-					'secondary' => ! empty( $settings['color_secondary'] ) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR
1942
-				);
1943
-			}
1932
+                if(!empty($setting['color']['palette']['custom'])){
1933
+                    foreach($setting['color']['palette']['custom'] as $color){
1934
+                        $colors[$color['slug']] = esc_attr($color['color']);
1935
+                    }
1936
+                }
1937
+            }else{
1938
+                $settings = get_option('aui_options');
1939
+                $colors = array(
1940
+                    'primary'   => ! empty( $settings['color_primary'] ) ? $settings['color_primary'] : AUI_PRIMARY_COLOR,
1941
+                    'secondary' => ! empty( $settings['color_secondary'] ) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR
1942
+                );
1943
+            }
1944 1944
 
1945
-			ob_start();
1945
+            ob_start();
1946 1946
 
1947
-			?>
1947
+            ?>
1948 1948
 			<style>
1949 1949
 				<?php
1950 1950
 
1951
-					// BS v3 compat
1952
-					if( self::is_bs3_compat() ){
1953
-					    echo self::bs3_compat_css();
1954
-					}
1951
+                    // BS v3 compat
1952
+                    if( self::is_bs3_compat() ){
1953
+                        echo self::bs3_compat_css();
1954
+                    }
1955 1955
 
1956 1956
                     if(!empty($colors)){
1957 1957
                         $d_colors = self::get_colors(true);
@@ -1965,768 +1965,768 @@  discard block
 block discarded – undo
1965 1965
                                 echo self::css_overwrite($key,$var,$compat);
1966 1966
                             }
1967 1967
                         }
1968
-                       // exit;
1968
+                        // exit;
1969 1969
                     }
1970 1970
 
1971
-					// Set admin bar z-index lower when modal is open.
1972
-					echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}';
1971
+                    // Set admin bar z-index lower when modal is open.
1972
+                    echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}';
1973 1973
 
1974
-					if(is_admin()){
1975
-						echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}';
1976
-					}
1974
+                    if(is_admin()){
1975
+                        echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}';
1976
+                    }
1977 1977
                 ?>
1978 1978
 			</style>
1979 1979
 			<?php
1980 1980
 
1981 1981
 
1982
-			/*
1982
+            /*
1983 1983
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1984 1984
 			 */
1985
-			return str_replace( array(
1986
-				'<style>',
1987
-				'</style>'
1988
-			), '', self::minify_css( ob_get_clean() ) );
1989
-		}
1985
+            return str_replace( array(
1986
+                '<style>',
1987
+                '</style>'
1988
+            ), '', self::minify_css( ob_get_clean() ) );
1989
+        }
1990 1990
 
1991 1991
 
1992 1992
 
1993
-		/**
1994
-		 * Check if we should add booststrap 3 compatibility changes.
1995
-		 *
1996
-		 * @return bool
1997
-		 */
1998
-		public static function is_bs3_compat(){
1999
-			return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
2000
-		}
1993
+        /**
1994
+         * Check if we should add booststrap 3 compatibility changes.
1995
+         *
1996
+         * @return bool
1997
+         */
1998
+        public static function is_bs3_compat(){
1999
+            return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
2000
+        }
2001 2001
 
2002
-		/**
2002
+        /**
2003 2003
          * Build the CSS to overwrite a bootstrap color variable.
2004 2004
          *
2005
-		 * @param $type
2006
-		 * @param $color_code
2007
-		 * @param $compatibility
2008
-		 *
2009
-		 * @return string
2010
-		 */
2011
-		public static function css_overwrite($type,$color_code,$compatibility){
2005
+         * @param $type
2006
+         * @param $color_code
2007
+         * @param $compatibility
2008
+         *
2009
+         * @return string
2010
+         */
2011
+        public static function css_overwrite($type,$color_code,$compatibility){
2012 2012
 
2013 2013
             $is_var = false;
2014
-			if(!$color_code){return '';}
2015
-			if(!sanitize_hex_color($color_code)){
2016
-				$color_code = esc_attr($color_code);
2017
-				$is_var = true;
2014
+            if(!$color_code){return '';}
2015
+            if(!sanitize_hex_color($color_code)){
2016
+                $color_code = esc_attr($color_code);
2017
+                $is_var = true;
2018 2018
 //                echo '###1'.$color_code;//exit;
2019
-			}
2020
-			if(!$color_code){return '';}
2019
+            }
2020
+            if(!$color_code){return '';}
2021 2021
 
2022 2022
             if($compatibility===true || $compatibility===1){
2023
-	            $compatibility = '.bsui';
2023
+                $compatibility = '.bsui';
2024 2024
             }elseif(!$compatibility){
2025
-	            $compatibility = '';
2025
+                $compatibility = '';
2026 2026
             }else{
2027
-	            $compatibility = esc_attr($compatibility);
2027
+                $compatibility = esc_attr($compatibility);
2028 2028
             }
2029 2029
 
2030 2030
 //            echo '####'.$color_code;exit;
2031 2031
 
2032
-			$type = sanitize_html_class($type);
2032
+            $type = sanitize_html_class($type);
2033
+
2034
+            /**
2035
+             * c = color, b = background color, o = border-color, f = fill
2036
+             */
2037
+            $selectors = array(
2038
+                ".btn-{$type}"                                              => array( 'b', 'o' ),
2039
+                ".btn-{$type}.disabled"                                     => array( 'b', 'o' ),
2040
+                ".btn-{$type}:disabled"                                     => array( 'b', 'o' ),
2041
+                ".btn-outline-{$type}"                                      => array( 'c', 'o' ),
2042
+                ".btn-outline-{$type}:hover"                                => array( 'b', 'o' ),
2043
+                ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ),
2044
+                ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ),
2045
+                ".show>.btn-outline-{$type}.dropdown-toggle"                => array( 'b', 'o' ),
2046
+                ".badge-{$type}"                                            => array( 'b' ),
2047
+                ".alert-{$type}"                                            => array( 'b', 'o' ),
2048
+                ".bg-{$type}"                                               => array( 'b', 'f' ),
2049
+                ".btn-link.btn-{$type}"                                     => array( 'c' ),
2050
+            );
2033 2051
 
2034
-			/**
2035
-			 * c = color, b = background color, o = border-color, f = fill
2036
-			 */
2037
-			$selectors = array(
2038
-				".btn-{$type}"                                              => array( 'b', 'o' ),
2039
-				".btn-{$type}.disabled"                                     => array( 'b', 'o' ),
2040
-				".btn-{$type}:disabled"                                     => array( 'b', 'o' ),
2041
-				".btn-outline-{$type}"                                      => array( 'c', 'o' ),
2042
-				".btn-outline-{$type}:hover"                                => array( 'b', 'o' ),
2043
-				".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ),
2044
-				".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ),
2045
-				".show>.btn-outline-{$type}.dropdown-toggle"                => array( 'b', 'o' ),
2046
-				".badge-{$type}"                                            => array( 'b' ),
2047
-				".alert-{$type}"                                            => array( 'b', 'o' ),
2048
-				".bg-{$type}"                                               => array( 'b', 'f' ),
2049
-				".btn-link.btn-{$type}"                                     => array( 'c' ),
2050
-			);
2051
-
2052
-			if ( $type == 'primary' ) {
2053
-				$selectors = $selectors + array(
2054
-						'a'                                                                                                    => array( 'c' ),
2055
-						'.btn-link'                                                                                            => array( 'c' ),
2056
-						'.dropdown-item.active'                                                                                => array( 'b' ),
2057
-						'.custom-control-input:checked~.custom-control-label::before'                                          => array(
2058
-							'b',
2059
-							'o'
2060
-						),
2061
-						'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before'                   => array(
2062
-							'b',
2063
-							'o'
2064
-						),
2065
-						'.nav-pills .nav-link.active'                                                                          => array( 'b' ),
2066
-						'.nav-pills .show>.nav-link'                                                                           => array( 'b' ),
2067
-						'.page-link'                                                                                           => array( 'c' ),
2068
-						'.page-item.active .page-link'                                                                         => array(
2069
-							'b',
2070
-							'o'
2071
-						),
2072
-						'.progress-bar'                                                                                        => array( 'b' ),
2073
-						'.list-group-item.active'                                                                              => array(
2074
-							'b',
2075
-							'o'
2076
-						),
2077
-						'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ),
2052
+            if ( $type == 'primary' ) {
2053
+                $selectors = $selectors + array(
2054
+                        'a'                                                                                                    => array( 'c' ),
2055
+                        '.btn-link'                                                                                            => array( 'c' ),
2056
+                        '.dropdown-item.active'                                                                                => array( 'b' ),
2057
+                        '.custom-control-input:checked~.custom-control-label::before'                                          => array(
2058
+                            'b',
2059
+                            'o'
2060
+                        ),
2061
+                        '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before'                   => array(
2062
+                            'b',
2063
+                            'o'
2064
+                        ),
2065
+                        '.nav-pills .nav-link.active'                                                                          => array( 'b' ),
2066
+                        '.nav-pills .show>.nav-link'                                                                           => array( 'b' ),
2067
+                        '.page-link'                                                                                           => array( 'c' ),
2068
+                        '.page-item.active .page-link'                                                                         => array(
2069
+                            'b',
2070
+                            'o'
2071
+                        ),
2072
+                        '.progress-bar'                                                                                        => array( 'b' ),
2073
+                        '.list-group-item.active'                                                                              => array(
2074
+                            'b',
2075
+                            'o'
2076
+                        ),
2077
+                        '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ),
2078 2078
 //				    '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
2079 2079
 //				    '.custom-range::-moz-range-thumb' => array('b'),
2080 2080
 //				    '.custom-range::-ms-thumb' => array('b'),
2081
-					);
2082
-			}
2083
-
2084
-			$important_selectors = array(
2085
-				".bg-{$type}" => array('b','f'),
2086
-				".border-{$type}" => array('o'),
2087
-				".text-{$type}" => array('c'),
2088
-			);
2089
-
2090
-			$color = array();
2091
-			$color_i = array();
2092
-			$background = array();
2093
-			$background_i = array();
2094
-			$border = array();
2095
-			$border_i = array();
2096
-			$fill = array();
2097
-			$fill_i = array();
2098
-
2099
-			$output = '';
2100
-
2101
-			// build rules into each type
2102
-			foreach($selectors as $selector => $types){
2103
-				$selector = $compatibility ? $compatibility . " ".$selector : $selector;
2104
-				$types = array_combine($types,$types);
2105
-				if(isset($types['c'])){$color[] = $selector;}
2106
-				if(isset($types['b'])){$background[] = $selector;}
2107
-				if(isset($types['o'])){$border[] = $selector;}
2108
-				if(isset($types['f'])){$fill[] = $selector;}
2109
-			}
2110
-
2111
-			// build rules into each type
2112
-			foreach($important_selectors as $selector => $types){
2113
-				$selector = $compatibility ? $compatibility . " ".$selector : $selector;
2114
-				$types = array_combine($types,$types);
2115
-				if(isset($types['c'])){$color_i[] = $selector;}
2116
-				if(isset($types['b'])){$background_i[] = $selector;}
2117
-				if(isset($types['o'])){$border_i[] = $selector;}
2118
-				if(isset($types['f'])){$fill_i[] = $selector;}
2119
-			}
2120
-
2121
-			// add any color rules
2122
-			if(!empty($color)){
2123
-				$output .= implode(",",$color) . "{color: $color_code;} ";
2124
-			}
2125
-			if(!empty($color_i)){
2126
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2127
-			}
2128
-
2129
-			// add any background color rules
2130
-			if(!empty($background)){
2131
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
2132
-			}
2133
-			if(!empty($background_i)){
2134
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2135
-			}
2136
-
2137
-			// add any border color rules
2138
-			if(!empty($border)){
2139
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
2140
-			}
2141
-			if(!empty($border_i)){
2142
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2143
-			}
2144
-
2145
-			// add any fill color rules
2146
-			if(!empty($fill)){
2147
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
2148
-			}
2149
-			if(!empty($fill_i)){
2150
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2151
-			}
2152
-
2153
-
2154
-			$prefix = $compatibility ? $compatibility . " " : "";
2081
+                    );
2082
+            }
2083
+
2084
+            $important_selectors = array(
2085
+                ".bg-{$type}" => array('b','f'),
2086
+                ".border-{$type}" => array('o'),
2087
+                ".text-{$type}" => array('c'),
2088
+            );
2089
+
2090
+            $color = array();
2091
+            $color_i = array();
2092
+            $background = array();
2093
+            $background_i = array();
2094
+            $border = array();
2095
+            $border_i = array();
2096
+            $fill = array();
2097
+            $fill_i = array();
2098
+
2099
+            $output = '';
2100
+
2101
+            // build rules into each type
2102
+            foreach($selectors as $selector => $types){
2103
+                $selector = $compatibility ? $compatibility . " ".$selector : $selector;
2104
+                $types = array_combine($types,$types);
2105
+                if(isset($types['c'])){$color[] = $selector;}
2106
+                if(isset($types['b'])){$background[] = $selector;}
2107
+                if(isset($types['o'])){$border[] = $selector;}
2108
+                if(isset($types['f'])){$fill[] = $selector;}
2109
+            }
2110
+
2111
+            // build rules into each type
2112
+            foreach($important_selectors as $selector => $types){
2113
+                $selector = $compatibility ? $compatibility . " ".$selector : $selector;
2114
+                $types = array_combine($types,$types);
2115
+                if(isset($types['c'])){$color_i[] = $selector;}
2116
+                if(isset($types['b'])){$background_i[] = $selector;}
2117
+                if(isset($types['o'])){$border_i[] = $selector;}
2118
+                if(isset($types['f'])){$fill_i[] = $selector;}
2119
+            }
2120
+
2121
+            // add any color rules
2122
+            if(!empty($color)){
2123
+                $output .= implode(",",$color) . "{color: $color_code;} ";
2124
+            }
2125
+            if(!empty($color_i)){
2126
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2127
+            }
2128
+
2129
+            // add any background color rules
2130
+            if(!empty($background)){
2131
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
2132
+            }
2133
+            if(!empty($background_i)){
2134
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2135
+            }
2136
+
2137
+            // add any border color rules
2138
+            if(!empty($border)){
2139
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
2140
+            }
2141
+            if(!empty($border_i)){
2142
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2143
+            }
2144
+
2145
+            // add any fill color rules
2146
+            if(!empty($fill)){
2147
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
2148
+            }
2149
+            if(!empty($fill_i)){
2150
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2151
+            }
2152
+
2153
+
2154
+            $prefix = $compatibility ? $compatibility . " " : "";
2155 2155
 
2156 2156
             $transition = $is_var ? 'transition: color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out,filter 0.15s ease-in-out;' : '';
2157
-			// darken
2158
-			$darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075");
2159
-			$darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10");
2160
-			$darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125");
2157
+            // darken
2158
+            $darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075");
2159
+            $darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10");
2160
+            $darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125");
2161 2161
 
2162
-			// lighten
2163
-			$lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25");
2162
+            // lighten
2163
+            $lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25");
2164 2164
 
2165
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
2166
-			$op_25 = $color_code."40"; // 25% opacity
2165
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
2166
+            $op_25 = $color_code."40"; // 25% opacity
2167 2167
 
2168 2168
 
2169
-			// button states
2170
-			$output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : '';
2171
-			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2169
+            // button states
2170
+            $output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : '';
2171
+            $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2172 2172
 //			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000;    border-color: #000;} ";
2173
-			$output .= $prefix ." .btn-outline-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-{$type}.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2174
-			$output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active, $prefix .btn-{$type}:not(:disabled):not(.disabled).active, .show>$prefix .btn-{$type}.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
2175
-			$output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-{$type}.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
2173
+            $output .= $prefix ." .btn-outline-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-{$type}.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2174
+            $output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active, $prefix .btn-{$type}:not(:disabled):not(.disabled).active, .show>$prefix .btn-{$type}.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
2175
+            $output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-{$type}.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
2176 2176
 
2177
-			if ( $type == 'primary' ) {
2178
-				// dropdown's
2179
-				$output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2177
+            if ( $type == 'primary' ) {
2178
+                // dropdown's
2179
+                $output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2180 2180
 
2181
-				// input states
2182
-				$output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
2181
+                // input states
2182
+                $output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
2183 2183
 
2184
-				// page link
2185
-				$output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2186
-			}
2184
+                // page link
2185
+                $output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2186
+            }
2187 2187
 
2188
-			return $output;
2189
-		}
2188
+            return $output;
2189
+        }
2190 2190
 
2191
-		/**
2191
+        /**
2192 2192
          *
2193 2193
          * @deprecated 0.1.76 Use css_overwrite()
2194 2194
          *
2195
-		 * @param $color_code
2196
-		 * @param $compatibility
2197
-		 * @param $use_variable
2198
-		 *
2199
-		 * @return string
2200
-		 */
2201
-		public static function css_primary($color_code,$compatibility, $use_variable = false){
2195
+         * @param $color_code
2196
+         * @param $compatibility
2197
+         * @param $use_variable
2198
+         *
2199
+         * @return string
2200
+         */
2201
+        public static function css_primary($color_code,$compatibility, $use_variable = false){
2202 2202
 
2203 2203
             if(!$use_variable){
2204
-				$color_code = sanitize_hex_color($color_code);
2205
-				if(!$color_code){return '';}
2206
-			}
2204
+                $color_code = sanitize_hex_color($color_code);
2205
+                if(!$color_code){return '';}
2206
+            }
2207 2207
 
2208
-			/**
2209
-			 * c = color, b = background color, o = border-color, f = fill
2210
-			 */
2211
-			$selectors = array(
2212
-				'a' => array('c'),
2213
-				'.btn-primary' => array('b','o'),
2214
-				'.btn-primary.disabled' => array('b','o'),
2215
-				'.btn-primary:disabled' => array('b','o'),
2216
-				'.btn-outline-primary' => array('c','o'),
2217
-				'.btn-outline-primary:hover' => array('b','o'),
2218
-				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
2219
-				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
2220
-				'.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
2221
-				'.btn-link' => array('c'),
2222
-				'.dropdown-item.active' => array('b'),
2223
-				'.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
2224
-				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
2208
+            /**
2209
+             * c = color, b = background color, o = border-color, f = fill
2210
+             */
2211
+            $selectors = array(
2212
+                'a' => array('c'),
2213
+                '.btn-primary' => array('b','o'),
2214
+                '.btn-primary.disabled' => array('b','o'),
2215
+                '.btn-primary:disabled' => array('b','o'),
2216
+                '.btn-outline-primary' => array('c','o'),
2217
+                '.btn-outline-primary:hover' => array('b','o'),
2218
+                '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
2219
+                '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
2220
+                '.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
2221
+                '.btn-link' => array('c'),
2222
+                '.dropdown-item.active' => array('b'),
2223
+                '.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
2224
+                '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
2225 2225
 //				'.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
2226 2226
 //				'.custom-range::-moz-range-thumb' => array('b'),
2227 2227
 //				'.custom-range::-ms-thumb' => array('b'),
2228
-				'.nav-pills .nav-link.active' => array('b'),
2229
-				'.nav-pills .show>.nav-link' => array('b'),
2230
-				'.page-link' => array('c'),
2231
-				'.page-item.active .page-link' => array('b','o'),
2232
-				'.badge-primary' => array('b'),
2233
-				'.alert-primary' => array('b','o'),
2234
-				'.progress-bar' => array('b'),
2235
-				'.list-group-item.active' => array('b','o'),
2236
-				'.bg-primary' => array('b','f'),
2237
-				'.btn-link.btn-primary' => array('c'),
2238
-				'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
2239
-			);
2240
-
2241
-			$important_selectors = array(
2242
-				'.bg-primary' => array('b','f'),
2243
-				'.border-primary' => array('o'),
2244
-				'.text-primary' => array('c'),
2245
-			);
2246
-
2247
-			$color = array();
2248
-			$color_i = array();
2249
-			$background = array();
2250
-			$background_i = array();
2251
-			$border = array();
2252
-			$border_i = array();
2253
-			$fill = array();
2254
-			$fill_i = array();
2255
-
2256
-			$output = '';
2257
-
2258
-			// build rules into each type
2259
-			foreach($selectors as $selector => $types){
2260
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2261
-				$types = array_combine($types,$types);
2262
-				if(isset($types['c'])){$color[] = $selector;}
2263
-				if(isset($types['b'])){$background[] = $selector;}
2264
-				if(isset($types['o'])){$border[] = $selector;}
2265
-				if(isset($types['f'])){$fill[] = $selector;}
2266
-			}
2267
-
2268
-			// build rules into each type
2269
-			foreach($important_selectors as $selector => $types){
2270
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2271
-				$types = array_combine($types,$types);
2272
-				if(isset($types['c'])){$color_i[] = $selector;}
2273
-				if(isset($types['b'])){$background_i[] = $selector;}
2274
-				if(isset($types['o'])){$border_i[] = $selector;}
2275
-				if(isset($types['f'])){$fill_i[] = $selector;}
2276
-			}
2277
-
2278
-			// add any color rules
2279
-			if(!empty($color)){
2280
-				$output .= implode(",",$color) . "{color: $color_code;} ";
2281
-			}
2282
-			if(!empty($color_i)){
2283
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2284
-			}
2285
-
2286
-			// add any background color rules
2287
-			if(!empty($background)){
2288
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
2289
-			}
2290
-			if(!empty($background_i)){
2291
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2292
-			}
2293
-
2294
-			// add any border color rules
2295
-			if(!empty($border)){
2296
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
2297
-			}
2298
-			if(!empty($border_i)){
2299
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2300
-			}
2301
-
2302
-			// add any fill color rules
2303
-			if(!empty($fill)){
2304
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
2305
-			}
2306
-			if(!empty($fill_i)){
2307
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2308
-			}
2309
-
2310
-
2311
-			$prefix = $compatibility ? ".bsui " : "";
2312
-
2313
-			// darken
2314
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2315
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2316
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2317
-
2318
-			// lighten
2319
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2320
-
2321
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
2322
-			$op_25 = $color_code."40"; // 25% opacity
2323
-
2324
-
2325
-			// button states
2326
-			$output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2327
-			$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;} ";
2328
-			$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.";} ";
2329
-			$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;} ";
2330
-
2331
-
2332
-			// dropdown's
2333
-			$output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2334
-
2335
-
2336
-			// input states
2337
-			$output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
2338
-
2339
-			// page link
2340
-			$output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2341
-
2342
-			return $output;
2343
-		}
2228
+                '.nav-pills .nav-link.active' => array('b'),
2229
+                '.nav-pills .show>.nav-link' => array('b'),
2230
+                '.page-link' => array('c'),
2231
+                '.page-item.active .page-link' => array('b','o'),
2232
+                '.badge-primary' => array('b'),
2233
+                '.alert-primary' => array('b','o'),
2234
+                '.progress-bar' => array('b'),
2235
+                '.list-group-item.active' => array('b','o'),
2236
+                '.bg-primary' => array('b','f'),
2237
+                '.btn-link.btn-primary' => array('c'),
2238
+                '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
2239
+            );
2344 2240
 
2345
-		/**
2241
+            $important_selectors = array(
2242
+                '.bg-primary' => array('b','f'),
2243
+                '.border-primary' => array('o'),
2244
+                '.text-primary' => array('c'),
2245
+            );
2246
+
2247
+            $color = array();
2248
+            $color_i = array();
2249
+            $background = array();
2250
+            $background_i = array();
2251
+            $border = array();
2252
+            $border_i = array();
2253
+            $fill = array();
2254
+            $fill_i = array();
2255
+
2256
+            $output = '';
2257
+
2258
+            // build rules into each type
2259
+            foreach($selectors as $selector => $types){
2260
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
2261
+                $types = array_combine($types,$types);
2262
+                if(isset($types['c'])){$color[] = $selector;}
2263
+                if(isset($types['b'])){$background[] = $selector;}
2264
+                if(isset($types['o'])){$border[] = $selector;}
2265
+                if(isset($types['f'])){$fill[] = $selector;}
2266
+            }
2267
+
2268
+            // build rules into each type
2269
+            foreach($important_selectors as $selector => $types){
2270
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
2271
+                $types = array_combine($types,$types);
2272
+                if(isset($types['c'])){$color_i[] = $selector;}
2273
+                if(isset($types['b'])){$background_i[] = $selector;}
2274
+                if(isset($types['o'])){$border_i[] = $selector;}
2275
+                if(isset($types['f'])){$fill_i[] = $selector;}
2276
+            }
2277
+
2278
+            // add any color rules
2279
+            if(!empty($color)){
2280
+                $output .= implode(",",$color) . "{color: $color_code;} ";
2281
+            }
2282
+            if(!empty($color_i)){
2283
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2284
+            }
2285
+
2286
+            // add any background color rules
2287
+            if(!empty($background)){
2288
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
2289
+            }
2290
+            if(!empty($background_i)){
2291
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2292
+            }
2293
+
2294
+            // add any border color rules
2295
+            if(!empty($border)){
2296
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
2297
+            }
2298
+            if(!empty($border_i)){
2299
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2300
+            }
2301
+
2302
+            // add any fill color rules
2303
+            if(!empty($fill)){
2304
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
2305
+            }
2306
+            if(!empty($fill_i)){
2307
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2308
+            }
2309
+
2310
+
2311
+            $prefix = $compatibility ? ".bsui " : "";
2312
+
2313
+            // darken
2314
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2315
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2316
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2317
+
2318
+            // lighten
2319
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2320
+
2321
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
2322
+            $op_25 = $color_code."40"; // 25% opacity
2323
+
2324
+
2325
+            // button states
2326
+            $output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2327
+            $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;} ";
2328
+            $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.";} ";
2329
+            $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;} ";
2330
+
2331
+
2332
+            // dropdown's
2333
+            $output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2334
+
2335
+
2336
+            // input states
2337
+            $output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
2338
+
2339
+            // page link
2340
+            $output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2341
+
2342
+            return $output;
2343
+        }
2344
+
2345
+        /**
2346 2346
          *
2347 2347
          * @deprecated 0.1.76 Use css_overwrite()
2348 2348
          *
2349
-		 * @param $color_code
2350
-		 * @param $compatibility
2351
-		 *
2352
-		 * @return string
2353
-		 */
2354
-		public static function css_secondary($color_code,$compatibility){;
2355
-			$color_code = sanitize_hex_color($color_code);
2356
-			if(!$color_code){return '';}
2357
-			/**
2358
-			 * c = color, b = background color, o = border-color, f = fill
2359
-			 */
2360
-			$selectors = array(
2361
-				'.btn-secondary' => array('b','o'),
2362
-				'.btn-secondary.disabled' => array('b','o'),
2363
-				'.btn-secondary:disabled' => array('b','o'),
2364
-				'.btn-outline-secondary' => array('c','o'),
2365
-				'.btn-outline-secondary:hover' => array('b','o'),
2366
-				'.btn-outline-secondary.disabled' => array('c'),
2367
-				'.btn-outline-secondary:disabled' => array('c'),
2368
-				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
2369
-				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
2370
-				'.btn-outline-secondary.dropdown-toggle' => array('b','o'),
2371
-				'.badge-secondary' => array('b'),
2372
-				'.alert-secondary' => array('b','o'),
2373
-				'.btn-link.btn-secondary' => array('c'),
2374
-			);
2375
-
2376
-			$important_selectors = array(
2377
-				'.bg-secondary' => array('b','f'),
2378
-				'.border-secondary' => array('o'),
2379
-				'.text-secondary' => array('c'),
2380
-			);
2381
-
2382
-			$color = array();
2383
-			$color_i = array();
2384
-			$background = array();
2385
-			$background_i = array();
2386
-			$border = array();
2387
-			$border_i = array();
2388
-			$fill = array();
2389
-			$fill_i = array();
2390
-
2391
-			$output = '';
2392
-
2393
-			// build rules into each type
2394
-			foreach($selectors as $selector => $types){
2395
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2396
-				$types = array_combine($types,$types);
2397
-				if(isset($types['c'])){$color[] = $selector;}
2398
-				if(isset($types['b'])){$background[] = $selector;}
2399
-				if(isset($types['o'])){$border[] = $selector;}
2400
-				if(isset($types['f'])){$fill[] = $selector;}
2401
-			}
2402
-
2403
-			// build rules into each type
2404
-			foreach($important_selectors as $selector => $types){
2405
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2406
-				$types = array_combine($types,$types);
2407
-				if(isset($types['c'])){$color_i[] = $selector;}
2408
-				if(isset($types['b'])){$background_i[] = $selector;}
2409
-				if(isset($types['o'])){$border_i[] = $selector;}
2410
-				if(isset($types['f'])){$fill_i[] = $selector;}
2411
-			}
2412
-
2413
-			// add any color rules
2414
-			if(!empty($color)){
2415
-				$output .= implode(",",$color) . "{color: $color_code;} ";
2416
-			}
2417
-			if(!empty($color_i)){
2418
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2419
-			}
2420
-
2421
-			// add any background color rules
2422
-			if(!empty($background)){
2423
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
2424
-			}
2425
-			if(!empty($background_i)){
2426
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2427
-			}
2428
-
2429
-			// add any border color rules
2430
-			if(!empty($border)){
2431
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
2432
-			}
2433
-			if(!empty($border_i)){
2434
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2435
-			}
2436
-
2437
-			// add any fill color rules
2438
-			if(!empty($fill)){
2439
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
2440
-			}
2441
-			if(!empty($fill_i)){
2442
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2443
-			}
2444
-
2445
-
2446
-			$prefix = $compatibility ? ".bsui " : "";
2447
-
2448
-			// darken
2449
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2450
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2451
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2452
-
2453
-			// lighten
2454
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2455
-
2456
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
2457
-			$op_25 = $color_code."40"; // 25% opacity
2458
-
2459
-
2460
-			// button states
2461
-			$output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2462
-			$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;} ";
2463
-			$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.";} ";
2464
-			$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;} ";
2465
-
2466
-
2467
-			return $output;
2468
-		}
2349
+         * @param $color_code
2350
+         * @param $compatibility
2351
+         *
2352
+         * @return string
2353
+         */
2354
+        public static function css_secondary($color_code,$compatibility){;
2355
+            $color_code = sanitize_hex_color($color_code);
2356
+            if(!$color_code){return '';}
2357
+            /**
2358
+             * c = color, b = background color, o = border-color, f = fill
2359
+             */
2360
+            $selectors = array(
2361
+                '.btn-secondary' => array('b','o'),
2362
+                '.btn-secondary.disabled' => array('b','o'),
2363
+                '.btn-secondary:disabled' => array('b','o'),
2364
+                '.btn-outline-secondary' => array('c','o'),
2365
+                '.btn-outline-secondary:hover' => array('b','o'),
2366
+                '.btn-outline-secondary.disabled' => array('c'),
2367
+                '.btn-outline-secondary:disabled' => array('c'),
2368
+                '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
2369
+                '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
2370
+                '.btn-outline-secondary.dropdown-toggle' => array('b','o'),
2371
+                '.badge-secondary' => array('b'),
2372
+                '.alert-secondary' => array('b','o'),
2373
+                '.btn-link.btn-secondary' => array('c'),
2374
+            );
2469 2375
 
2470
-		/**
2471
-		 * Increases or decreases the brightness of a color by a percentage of the current brightness.
2472
-		 *
2473
-		 * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
2474
-		 * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
2475
-		 *
2476
-		 * @return  string
2477
-		 */
2478
-		public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
2479
-			$hexCode = ltrim($hexCode, '#');
2376
+            $important_selectors = array(
2377
+                '.bg-secondary' => array('b','f'),
2378
+                '.border-secondary' => array('o'),
2379
+                '.text-secondary' => array('c'),
2380
+            );
2480 2381
 
2481
-			if (strlen($hexCode) == 3) {
2482
-				$hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
2483
-			}
2382
+            $color = array();
2383
+            $color_i = array();
2384
+            $background = array();
2385
+            $background_i = array();
2386
+            $border = array();
2387
+            $border_i = array();
2388
+            $fill = array();
2389
+            $fill_i = array();
2390
+
2391
+            $output = '';
2392
+
2393
+            // build rules into each type
2394
+            foreach($selectors as $selector => $types){
2395
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
2396
+                $types = array_combine($types,$types);
2397
+                if(isset($types['c'])){$color[] = $selector;}
2398
+                if(isset($types['b'])){$background[] = $selector;}
2399
+                if(isset($types['o'])){$border[] = $selector;}
2400
+                if(isset($types['f'])){$fill[] = $selector;}
2401
+            }
2484 2402
 
2485
-			$hexCode = array_map('hexdec', str_split($hexCode, 2));
2403
+            // build rules into each type
2404
+            foreach($important_selectors as $selector => $types){
2405
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
2406
+                $types = array_combine($types,$types);
2407
+                if(isset($types['c'])){$color_i[] = $selector;}
2408
+                if(isset($types['b'])){$background_i[] = $selector;}
2409
+                if(isset($types['o'])){$border_i[] = $selector;}
2410
+                if(isset($types['f'])){$fill_i[] = $selector;}
2411
+            }
2486 2412
 
2487
-			foreach ($hexCode as & $color) {
2488
-				$adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
2489
-				$adjustAmount = ceil($adjustableLimit * $adjustPercent);
2413
+            // add any color rules
2414
+            if(!empty($color)){
2415
+                $output .= implode(",",$color) . "{color: $color_code;} ";
2416
+            }
2417
+            if(!empty($color_i)){
2418
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2419
+            }
2490 2420
 
2491
-				$color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
2492
-			}
2421
+            // add any background color rules
2422
+            if(!empty($background)){
2423
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
2424
+            }
2425
+            if(!empty($background_i)){
2426
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2427
+            }
2493 2428
 
2494
-			return '#' . implode($hexCode);
2495
-		}
2429
+            // add any border color rules
2430
+            if(!empty($border)){
2431
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
2432
+            }
2433
+            if(!empty($border_i)){
2434
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2435
+            }
2496 2436
 
2497
-		/**
2498
-		 * Check if we should display examples.
2499
-		 */
2500
-		public function maybe_show_examples(){
2501
-			if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
2502
-				echo "<head>";
2503
-				wp_head();
2504
-				echo "</head>";
2505
-				echo "<body>";
2506
-				echo $this->get_examples();
2507
-				echo "</body>";
2508
-				exit;
2509
-			}
2510
-		}
2437
+            // add any fill color rules
2438
+            if(!empty($fill)){
2439
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
2440
+            }
2441
+            if(!empty($fill_i)){
2442
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2443
+            }
2511 2444
 
2512
-		/**
2513
-		 * Get developer examples.
2514
-		 *
2515
-		 * @return string
2516
-		 */
2517
-		public function get_examples(){
2518
-			$output = '';
2519
-
2520
-
2521
-			// open form
2522
-			$output .= "<form class='p-5 m-5 border rounded'>";
2523
-
2524
-			// input example
2525
-			$output .= aui()->input(array(
2526
-				'type'  =>  'text',
2527
-				'id'    =>  'text-example',
2528
-				'name'    =>  'text-example',
2529
-				'placeholder'   => 'text placeholder',
2530
-				'title'   => 'Text input example',
2531
-				'value' =>  '',
2532
-				'required'  => false,
2533
-				'help_text' => 'help text',
2534
-				'label' => 'Text input example label'
2535
-			));
2536
-
2537
-			// input example
2538
-			$output .= aui()->input(array(
2539
-				'type'  =>  'url',
2540
-				'id'    =>  'text-example2',
2541
-				'name'    =>  'text-example',
2542
-				'placeholder'   => 'url placeholder',
2543
-				'title'   => 'Text input example',
2544
-				'value' =>  '',
2545
-				'required'  => false,
2546
-				'help_text' => 'help text',
2547
-				'label' => 'Text input example label'
2548
-			));
2549
-
2550
-			// checkbox example
2551
-			$output .= aui()->input(array(
2552
-				'type'  =>  'checkbox',
2553
-				'id'    =>  'checkbox-example',
2554
-				'name'    =>  'checkbox-example',
2555
-				'placeholder'   => 'checkbox-example',
2556
-				'title'   => 'Checkbox example',
2557
-				'value' =>  '1',
2558
-				'checked'   => true,
2559
-				'required'  => false,
2560
-				'help_text' => 'help text',
2561
-				'label' => 'Checkbox checked'
2562
-			));
2563
-
2564
-			// checkbox example
2565
-			$output .= aui()->input(array(
2566
-				'type'  =>  'checkbox',
2567
-				'id'    =>  'checkbox-example2',
2568
-				'name'    =>  'checkbox-example2',
2569
-				'placeholder'   => 'checkbox-example',
2570
-				'title'   => 'Checkbox example',
2571
-				'value' =>  '1',
2572
-				'checked'   => false,
2573
-				'required'  => false,
2574
-				'help_text' => 'help text',
2575
-				'label' => 'Checkbox un-checked'
2576
-			));
2577
-
2578
-			// switch example
2579
-			$output .= aui()->input(array(
2580
-				'type'  =>  'checkbox',
2581
-				'id'    =>  'switch-example',
2582
-				'name'    =>  'switch-example',
2583
-				'placeholder'   => 'checkbox-example',
2584
-				'title'   => 'Switch example',
2585
-				'value' =>  '1',
2586
-				'checked'   => true,
2587
-				'switch'    => true,
2588
-				'required'  => false,
2589
-				'help_text' => 'help text',
2590
-				'label' => 'Switch on'
2591
-			));
2592
-
2593
-			// switch example
2594
-			$output .= aui()->input(array(
2595
-				'type'  =>  'checkbox',
2596
-				'id'    =>  'switch-example2',
2597
-				'name'    =>  'switch-example2',
2598
-				'placeholder'   => 'checkbox-example',
2599
-				'title'   => 'Switch example',
2600
-				'value' =>  '1',
2601
-				'checked'   => false,
2602
-				'switch'    => true,
2603
-				'required'  => false,
2604
-				'help_text' => 'help text',
2605
-				'label' => 'Switch off'
2606
-			));
2607
-
2608
-			// close form
2609
-			$output .= "</form>";
2610
-
2611
-			return $output;
2612
-		}
2613 2445
 
2614
-		/**
2615
-		 * Calendar params.
2616
-		 *
2617
-		 * @since 0.1.44
2618
-		 *
2619
-		 * @return array Calendar params.
2620
-		 */
2621
-		public static function calendar_params() {
2622
-			$params = array(
2623
-				'month_long_1' => __( 'January', 'aui' ),
2624
-				'month_long_2' => __( 'February', 'aui' ),
2625
-				'month_long_3' => __( 'March', 'aui' ),
2626
-				'month_long_4' => __( 'April', 'aui' ),
2627
-				'month_long_5' => __( 'May', 'aui' ),
2628
-				'month_long_6' => __( 'June', 'aui' ),
2629
-				'month_long_7' => __( 'July', 'aui' ),
2630
-				'month_long_8' => __( 'August', 'aui' ),
2631
-				'month_long_9' => __( 'September', 'aui' ),
2632
-				'month_long_10' => __( 'October', 'aui' ),
2633
-				'month_long_11' => __( 'November', 'aui' ),
2634
-				'month_long_12' => __( 'December', 'aui' ),
2635
-				'month_s_1' => _x( 'Jan', 'January abbreviation', 'aui' ),
2636
-				'month_s_2' => _x( 'Feb', 'February abbreviation', 'aui' ),
2637
-				'month_s_3' => _x( 'Mar', 'March abbreviation', 'aui' ),
2638
-				'month_s_4' => _x( 'Apr', 'April abbreviation', 'aui' ),
2639
-				'month_s_5' => _x( 'May', 'May abbreviation', 'aui' ),
2640
-				'month_s_6' => _x( 'Jun', 'June abbreviation', 'aui' ),
2641
-				'month_s_7' => _x( 'Jul', 'July abbreviation', 'aui' ),
2642
-				'month_s_8' => _x( 'Aug', 'August abbreviation', 'aui' ),
2643
-				'month_s_9' => _x( 'Sep', 'September abbreviation', 'aui' ),
2644
-				'month_s_10' => _x( 'Oct', 'October abbreviation', 'aui' ),
2645
-				'month_s_11' => _x( 'Nov', 'November abbreviation', 'aui' ),
2646
-				'month_s_12' => _x( 'Dec', 'December abbreviation', 'aui' ),
2647
-				'day_s1_1' => _x( 'S', 'Sunday initial', 'aui' ),
2648
-				'day_s1_2' => _x( 'M', 'Monday initial', 'aui' ),
2649
-				'day_s1_3' => _x( 'T', 'Tuesday initial', 'aui' ),
2650
-				'day_s1_4' => _x( 'W', 'Wednesday initial', 'aui' ),
2651
-				'day_s1_5' => _x( 'T', 'Friday initial', 'aui' ),
2652
-				'day_s1_6' => _x( 'F', 'Thursday initial', 'aui' ),
2653
-				'day_s1_7' => _x( 'S', 'Saturday initial', 'aui' ),
2654
-				'day_s2_1' => __( 'Su', 'aui' ),
2655
-				'day_s2_2' => __( 'Mo', 'aui' ),
2656
-				'day_s2_3' => __( 'Tu', 'aui' ),
2657
-				'day_s2_4' => __( 'We', 'aui' ),
2658
-				'day_s2_5' => __( 'Th', 'aui' ),
2659
-				'day_s2_6' => __( 'Fr', 'aui' ),
2660
-				'day_s2_7' => __( 'Sa', 'aui' ),
2661
-				'day_s3_1' => __( 'Sun', 'aui' ),
2662
-				'day_s3_2' => __( 'Mon', 'aui' ),
2663
-				'day_s3_3' => __( 'Tue', 'aui' ),
2664
-				'day_s3_4' => __( 'Wed', 'aui' ),
2665
-				'day_s3_5' => __( 'Thu', 'aui' ),
2666
-				'day_s3_6' => __( 'Fri', 'aui' ),
2667
-				'day_s3_7' => __( 'Sat', 'aui' ),
2668
-				'day_s5_1' => __( 'Sunday', 'aui' ),
2669
-				'day_s5_2' => __( 'Monday', 'aui' ),
2670
-				'day_s5_3' => __( 'Tuesday', 'aui' ),
2671
-				'day_s5_4' => __( 'Wednesday', 'aui' ),
2672
-				'day_s5_5' => __( 'Thursday', 'aui' ),
2673
-				'day_s5_6' => __( 'Friday', 'aui' ),
2674
-				'day_s5_7' => __( 'Saturday', 'aui' ),
2675
-				'am_lower' => __( 'am', 'aui' ),
2676
-				'pm_lower' => __( 'pm', 'aui' ),
2677
-				'am_upper' => __( 'AM', 'aui' ),
2678
-				'pm_upper' => __( 'PM', 'aui' ),
2679
-				'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
2680
-				'time_24hr' => false,
2681
-				'year' => __( 'Year', 'aui' ),
2682
-				'hour' => __( 'Hour', 'aui' ),
2683
-				'minute' => __( 'Minute', 'aui' ),
2684
-				'weekAbbreviation' => __( 'Wk', 'aui' ),
2685
-				'rangeSeparator' => __( ' to ', 'aui' ),
2686
-				'scrollTitle' => __( 'Scroll to increment', 'aui' ),
2687
-				'toggleTitle' => __( 'Click to toggle', 'aui' )
2688
-			);
2689
-
2690
-			return apply_filters( 'ayecode_ui_calendar_params', $params );
2691
-		}
2446
+            $prefix = $compatibility ? ".bsui " : "";
2692 2447
 
2693
-		/**
2694
-		 * Flatpickr calendar localize.
2695
-		 *
2696
-		 * @since 0.1.44
2697
-		 *
2698
-		 * @return string Calendar locale.
2699
-		 */
2700
-		public static function flatpickr_locale() {
2701
-			$params = self::calendar_params();
2702
-
2703
-			if ( is_string( $params ) ) {
2704
-				$params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
2705
-			} else {
2706
-				foreach ( (array) $params as $key => $value ) {
2707
-					if ( ! is_scalar( $value ) ) {
2708
-						continue;
2709
-					}
2448
+            // darken
2449
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2450
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2451
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2710 2452
 
2711
-					$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2712
-				}
2713
-			}
2453
+            // lighten
2454
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2455
+
2456
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
2457
+            $op_25 = $color_code."40"; // 25% opacity
2458
+
2459
+
2460
+            // button states
2461
+            $output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2462
+            $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;} ";
2463
+            $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.";} ";
2464
+            $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;} ";
2465
+
2466
+
2467
+            return $output;
2468
+        }
2469
+
2470
+        /**
2471
+         * Increases or decreases the brightness of a color by a percentage of the current brightness.
2472
+         *
2473
+         * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
2474
+         * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
2475
+         *
2476
+         * @return  string
2477
+         */
2478
+        public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
2479
+            $hexCode = ltrim($hexCode, '#');
2480
+
2481
+            if (strlen($hexCode) == 3) {
2482
+                $hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
2483
+            }
2484
+
2485
+            $hexCode = array_map('hexdec', str_split($hexCode, 2));
2486
+
2487
+            foreach ($hexCode as & $color) {
2488
+                $adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
2489
+                $adjustAmount = ceil($adjustableLimit * $adjustPercent);
2490
+
2491
+                $color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
2492
+            }
2493
+
2494
+            return '#' . implode($hexCode);
2495
+        }
2496
+
2497
+        /**
2498
+         * Check if we should display examples.
2499
+         */
2500
+        public function maybe_show_examples(){
2501
+            if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
2502
+                echo "<head>";
2503
+                wp_head();
2504
+                echo "</head>";
2505
+                echo "<body>";
2506
+                echo $this->get_examples();
2507
+                echo "</body>";
2508
+                exit;
2509
+            }
2510
+        }
2511
+
2512
+        /**
2513
+         * Get developer examples.
2514
+         *
2515
+         * @return string
2516
+         */
2517
+        public function get_examples(){
2518
+            $output = '';
2519
+
2520
+
2521
+            // open form
2522
+            $output .= "<form class='p-5 m-5 border rounded'>";
2523
+
2524
+            // input example
2525
+            $output .= aui()->input(array(
2526
+                'type'  =>  'text',
2527
+                'id'    =>  'text-example',
2528
+                'name'    =>  'text-example',
2529
+                'placeholder'   => 'text placeholder',
2530
+                'title'   => 'Text input example',
2531
+                'value' =>  '',
2532
+                'required'  => false,
2533
+                'help_text' => 'help text',
2534
+                'label' => 'Text input example label'
2535
+            ));
2536
+
2537
+            // input example
2538
+            $output .= aui()->input(array(
2539
+                'type'  =>  'url',
2540
+                'id'    =>  'text-example2',
2541
+                'name'    =>  'text-example',
2542
+                'placeholder'   => 'url placeholder',
2543
+                'title'   => 'Text input example',
2544
+                'value' =>  '',
2545
+                'required'  => false,
2546
+                'help_text' => 'help text',
2547
+                'label' => 'Text input example label'
2548
+            ));
2549
+
2550
+            // checkbox example
2551
+            $output .= aui()->input(array(
2552
+                'type'  =>  'checkbox',
2553
+                'id'    =>  'checkbox-example',
2554
+                'name'    =>  'checkbox-example',
2555
+                'placeholder'   => 'checkbox-example',
2556
+                'title'   => 'Checkbox example',
2557
+                'value' =>  '1',
2558
+                'checked'   => true,
2559
+                'required'  => false,
2560
+                'help_text' => 'help text',
2561
+                'label' => 'Checkbox checked'
2562
+            ));
2563
+
2564
+            // checkbox example
2565
+            $output .= aui()->input(array(
2566
+                'type'  =>  'checkbox',
2567
+                'id'    =>  'checkbox-example2',
2568
+                'name'    =>  'checkbox-example2',
2569
+                'placeholder'   => 'checkbox-example',
2570
+                'title'   => 'Checkbox example',
2571
+                'value' =>  '1',
2572
+                'checked'   => false,
2573
+                'required'  => false,
2574
+                'help_text' => 'help text',
2575
+                'label' => 'Checkbox un-checked'
2576
+            ));
2577
+
2578
+            // switch example
2579
+            $output .= aui()->input(array(
2580
+                'type'  =>  'checkbox',
2581
+                'id'    =>  'switch-example',
2582
+                'name'    =>  'switch-example',
2583
+                'placeholder'   => 'checkbox-example',
2584
+                'title'   => 'Switch example',
2585
+                'value' =>  '1',
2586
+                'checked'   => true,
2587
+                'switch'    => true,
2588
+                'required'  => false,
2589
+                'help_text' => 'help text',
2590
+                'label' => 'Switch on'
2591
+            ));
2592
+
2593
+            // switch example
2594
+            $output .= aui()->input(array(
2595
+                'type'  =>  'checkbox',
2596
+                'id'    =>  'switch-example2',
2597
+                'name'    =>  'switch-example2',
2598
+                'placeholder'   => 'checkbox-example',
2599
+                'title'   => 'Switch example',
2600
+                'value' =>  '1',
2601
+                'checked'   => false,
2602
+                'switch'    => true,
2603
+                'required'  => false,
2604
+                'help_text' => 'help text',
2605
+                'label' => 'Switch off'
2606
+            ));
2607
+
2608
+            // close form
2609
+            $output .= "</form>";
2610
+
2611
+            return $output;
2612
+        }
2613
+
2614
+        /**
2615
+         * Calendar params.
2616
+         *
2617
+         * @since 0.1.44
2618
+         *
2619
+         * @return array Calendar params.
2620
+         */
2621
+        public static function calendar_params() {
2622
+            $params = array(
2623
+                'month_long_1' => __( 'January', 'aui' ),
2624
+                'month_long_2' => __( 'February', 'aui' ),
2625
+                'month_long_3' => __( 'March', 'aui' ),
2626
+                'month_long_4' => __( 'April', 'aui' ),
2627
+                'month_long_5' => __( 'May', 'aui' ),
2628
+                'month_long_6' => __( 'June', 'aui' ),
2629
+                'month_long_7' => __( 'July', 'aui' ),
2630
+                'month_long_8' => __( 'August', 'aui' ),
2631
+                'month_long_9' => __( 'September', 'aui' ),
2632
+                'month_long_10' => __( 'October', 'aui' ),
2633
+                'month_long_11' => __( 'November', 'aui' ),
2634
+                'month_long_12' => __( 'December', 'aui' ),
2635
+                'month_s_1' => _x( 'Jan', 'January abbreviation', 'aui' ),
2636
+                'month_s_2' => _x( 'Feb', 'February abbreviation', 'aui' ),
2637
+                'month_s_3' => _x( 'Mar', 'March abbreviation', 'aui' ),
2638
+                'month_s_4' => _x( 'Apr', 'April abbreviation', 'aui' ),
2639
+                'month_s_5' => _x( 'May', 'May abbreviation', 'aui' ),
2640
+                'month_s_6' => _x( 'Jun', 'June abbreviation', 'aui' ),
2641
+                'month_s_7' => _x( 'Jul', 'July abbreviation', 'aui' ),
2642
+                'month_s_8' => _x( 'Aug', 'August abbreviation', 'aui' ),
2643
+                'month_s_9' => _x( 'Sep', 'September abbreviation', 'aui' ),
2644
+                'month_s_10' => _x( 'Oct', 'October abbreviation', 'aui' ),
2645
+                'month_s_11' => _x( 'Nov', 'November abbreviation', 'aui' ),
2646
+                'month_s_12' => _x( 'Dec', 'December abbreviation', 'aui' ),
2647
+                'day_s1_1' => _x( 'S', 'Sunday initial', 'aui' ),
2648
+                'day_s1_2' => _x( 'M', 'Monday initial', 'aui' ),
2649
+                'day_s1_3' => _x( 'T', 'Tuesday initial', 'aui' ),
2650
+                'day_s1_4' => _x( 'W', 'Wednesday initial', 'aui' ),
2651
+                'day_s1_5' => _x( 'T', 'Friday initial', 'aui' ),
2652
+                'day_s1_6' => _x( 'F', 'Thursday initial', 'aui' ),
2653
+                'day_s1_7' => _x( 'S', 'Saturday initial', 'aui' ),
2654
+                'day_s2_1' => __( 'Su', 'aui' ),
2655
+                'day_s2_2' => __( 'Mo', 'aui' ),
2656
+                'day_s2_3' => __( 'Tu', 'aui' ),
2657
+                'day_s2_4' => __( 'We', 'aui' ),
2658
+                'day_s2_5' => __( 'Th', 'aui' ),
2659
+                'day_s2_6' => __( 'Fr', 'aui' ),
2660
+                'day_s2_7' => __( 'Sa', 'aui' ),
2661
+                'day_s3_1' => __( 'Sun', 'aui' ),
2662
+                'day_s3_2' => __( 'Mon', 'aui' ),
2663
+                'day_s3_3' => __( 'Tue', 'aui' ),
2664
+                'day_s3_4' => __( 'Wed', 'aui' ),
2665
+                'day_s3_5' => __( 'Thu', 'aui' ),
2666
+                'day_s3_6' => __( 'Fri', 'aui' ),
2667
+                'day_s3_7' => __( 'Sat', 'aui' ),
2668
+                'day_s5_1' => __( 'Sunday', 'aui' ),
2669
+                'day_s5_2' => __( 'Monday', 'aui' ),
2670
+                'day_s5_3' => __( 'Tuesday', 'aui' ),
2671
+                'day_s5_4' => __( 'Wednesday', 'aui' ),
2672
+                'day_s5_5' => __( 'Thursday', 'aui' ),
2673
+                'day_s5_6' => __( 'Friday', 'aui' ),
2674
+                'day_s5_7' => __( 'Saturday', 'aui' ),
2675
+                'am_lower' => __( 'am', 'aui' ),
2676
+                'pm_lower' => __( 'pm', 'aui' ),
2677
+                'am_upper' => __( 'AM', 'aui' ),
2678
+                'pm_upper' => __( 'PM', 'aui' ),
2679
+                'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
2680
+                'time_24hr' => false,
2681
+                'year' => __( 'Year', 'aui' ),
2682
+                'hour' => __( 'Hour', 'aui' ),
2683
+                'minute' => __( 'Minute', 'aui' ),
2684
+                'weekAbbreviation' => __( 'Wk', 'aui' ),
2685
+                'rangeSeparator' => __( ' to ', 'aui' ),
2686
+                'scrollTitle' => __( 'Scroll to increment', 'aui' ),
2687
+                'toggleTitle' => __( 'Click to toggle', 'aui' )
2688
+            );
2689
+
2690
+            return apply_filters( 'ayecode_ui_calendar_params', $params );
2691
+        }
2692
+
2693
+        /**
2694
+         * Flatpickr calendar localize.
2695
+         *
2696
+         * @since 0.1.44
2697
+         *
2698
+         * @return string Calendar locale.
2699
+         */
2700
+        public static function flatpickr_locale() {
2701
+            $params = self::calendar_params();
2702
+
2703
+            if ( is_string( $params ) ) {
2704
+                $params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
2705
+            } else {
2706
+                foreach ( (array) $params as $key => $value ) {
2707
+                    if ( ! is_scalar( $value ) ) {
2708
+                        continue;
2709
+                    }
2710
+
2711
+                    $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2712
+                }
2713
+            }
2714 2714
 
2715
-			$day_s3 = array();
2716
-			$day_s5 = array();
2715
+            $day_s3 = array();
2716
+            $day_s5 = array();
2717 2717
 
2718
-			for ( $i = 1; $i <= 7; $i ++ ) {
2719
-				$day_s3[] = addslashes( $params[ 'day_s3_' . $i ] );
2720
-				$day_s5[] = addslashes( $params[ 'day_s3_' . $i ] );
2721
-			}
2718
+            for ( $i = 1; $i <= 7; $i ++ ) {
2719
+                $day_s3[] = addslashes( $params[ 'day_s3_' . $i ] );
2720
+                $day_s5[] = addslashes( $params[ 'day_s3_' . $i ] );
2721
+            }
2722 2722
 
2723
-			$month_s = array();
2724
-			$month_long = array();
2723
+            $month_s = array();
2724
+            $month_long = array();
2725 2725
 
2726
-			for ( $i = 1; $i <= 12; $i ++ ) {
2727
-				$month_s[] = addslashes( $params[ 'month_s_' . $i ] );
2728
-				$month_long[] = addslashes( $params[ 'month_long_' . $i ] );
2729
-			}
2726
+            for ( $i = 1; $i <= 12; $i ++ ) {
2727
+                $month_s[] = addslashes( $params[ 'month_s_' . $i ] );
2728
+                $month_long[] = addslashes( $params[ 'month_long_' . $i ] );
2729
+            }
2730 2730
 
2731 2731
 ob_start();
2732 2732
 if ( 0 ) { ?><script><?php } ?>
@@ -2768,189 +2768,189 @@  discard block
 block discarded – undo
2768 2768
 }
2769 2769
 <?php if ( 0 ) { ?></script><?php } ?>
2770 2770
 <?php
2771
-			$locale = ob_get_clean();
2771
+            $locale = ob_get_clean();
2772 2772
 
2773
-			return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
2774
-		}
2773
+            return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
2774
+        }
2775 2775
 
2776
-		/**
2777
-		 * Select2 JS params.
2778
-		 *
2779
-		 * @since 0.1.44
2780
-		 *
2781
-		 * @return array Select2 JS params.
2782
-		 */
2783
-		public static function select2_params() {
2784
-			$params = array(
2785
-				'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'aui' ),
2786
-				'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'aui' ),
2787
-				'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'aui' ),
2788
-				'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'aui' ),
2789
-				'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'aui' ),
2790
-				'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'aui' ),
2791
-				'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'aui' ),
2792
-				'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'aui' ),
2793
-				'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'aui' ),
2794
-				'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'aui' ),
2795
-				'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'aui' )
2796
-			);
2797
-
2798
-			return apply_filters( 'ayecode_ui_select2_params', $params );
2799
-		}
2776
+        /**
2777
+         * Select2 JS params.
2778
+         *
2779
+         * @since 0.1.44
2780
+         *
2781
+         * @return array Select2 JS params.
2782
+         */
2783
+        public static function select2_params() {
2784
+            $params = array(
2785
+                'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'aui' ),
2786
+                'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'aui' ),
2787
+                'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'aui' ),
2788
+                'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'aui' ),
2789
+                'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'aui' ),
2790
+                'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'aui' ),
2791
+                'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'aui' ),
2792
+                'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'aui' ),
2793
+                'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'aui' ),
2794
+                'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'aui' ),
2795
+                'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'aui' )
2796
+            );
2800 2797
 
2801
-		/**
2802
-		 * Select2 JS localize.
2803
-		 *
2804
-		 * @since 0.1.44
2805
-		 *
2806
-		 * @return string Select2 JS locale.
2807
-		 */
2808
-		public static function select2_locale() {
2809
-			$params = self::select2_params();
2810
-
2811
-			foreach ( (array) $params as $key => $value ) {
2812
-				if ( ! is_scalar( $value ) ) {
2813
-					continue;
2814
-				}
2798
+            return apply_filters( 'ayecode_ui_select2_params', $params );
2799
+        }
2815 2800
 
2816
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2817
-			}
2801
+        /**
2802
+         * Select2 JS localize.
2803
+         *
2804
+         * @since 0.1.44
2805
+         *
2806
+         * @return string Select2 JS locale.
2807
+         */
2808
+        public static function select2_locale() {
2809
+            $params = self::select2_params();
2810
+
2811
+            foreach ( (array) $params as $key => $value ) {
2812
+                if ( ! is_scalar( $value ) ) {
2813
+                    continue;
2814
+                }
2818 2815
 
2819
-			$locale = json_encode( $params );
2816
+                $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2817
+            }
2820 2818
 
2821
-			return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
2822
-		}
2819
+            $locale = json_encode( $params );
2823 2820
 
2824
-		/**
2825
-		 * Time ago JS localize.
2826
-		 *
2827
-		 * @since 0.1.47
2828
-		 *
2829
-		 * @return string Time ago JS locale.
2830
-		 */
2831
-		public static function timeago_locale() {
2832
-			$params = array(
2833
-				'prefix_ago' => '',
2834
-				'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'aui' ),
2835
-				'prefix_after' => _x( 'after', 'time ago', 'aui' ) . ' ',
2836
-				'suffix_after' => '',
2837
-				'seconds' => _x( 'less than a minute', 'time ago', 'aui' ),
2838
-				'minute' => _x( 'about a minute', 'time ago', 'aui' ),
2839
-				'minutes' => _x( '%d minutes', 'time ago', 'aui' ),
2840
-				'hour' => _x( 'about an hour', 'time ago', 'aui' ),
2841
-				'hours' => _x( 'about %d hours', 'time ago', 'aui' ),
2842
-				'day' => _x( 'a day', 'time ago', 'aui' ),
2843
-				'days' => _x( '%d days', 'time ago', 'aui' ),
2844
-				'month' => _x( 'about a month', 'time ago', 'aui' ),
2845
-				'months' => _x( '%d months', 'time ago', 'aui' ),
2846
-				'year' => _x( 'about a year', 'time ago', 'aui' ),
2847
-				'years' => _x( '%d years', 'time ago', 'aui' ),
2848
-			);
2849
-
2850
-			$params = apply_filters( 'ayecode_ui_timeago_params', $params );
2851
-
2852
-			foreach ( (array) $params as $key => $value ) {
2853
-				if ( ! is_scalar( $value ) ) {
2854
-					continue;
2855
-				}
2821
+            return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
2822
+        }
2856 2823
 
2857
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2858
-			}
2824
+        /**
2825
+         * Time ago JS localize.
2826
+         *
2827
+         * @since 0.1.47
2828
+         *
2829
+         * @return string Time ago JS locale.
2830
+         */
2831
+        public static function timeago_locale() {
2832
+            $params = array(
2833
+                'prefix_ago' => '',
2834
+                'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'aui' ),
2835
+                'prefix_after' => _x( 'after', 'time ago', 'aui' ) . ' ',
2836
+                'suffix_after' => '',
2837
+                'seconds' => _x( 'less than a minute', 'time ago', 'aui' ),
2838
+                'minute' => _x( 'about a minute', 'time ago', 'aui' ),
2839
+                'minutes' => _x( '%d minutes', 'time ago', 'aui' ),
2840
+                'hour' => _x( 'about an hour', 'time ago', 'aui' ),
2841
+                'hours' => _x( 'about %d hours', 'time ago', 'aui' ),
2842
+                'day' => _x( 'a day', 'time ago', 'aui' ),
2843
+                'days' => _x( '%d days', 'time ago', 'aui' ),
2844
+                'month' => _x( 'about a month', 'time ago', 'aui' ),
2845
+                'months' => _x( '%d months', 'time ago', 'aui' ),
2846
+                'year' => _x( 'about a year', 'time ago', 'aui' ),
2847
+                'years' => _x( '%d years', 'time ago', 'aui' ),
2848
+            );
2859 2849
 
2860
-			$locale = json_encode( $params );
2850
+            $params = apply_filters( 'ayecode_ui_timeago_params', $params );
2861 2851
 
2862
-			return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) );
2863
-		}
2852
+            foreach ( (array) $params as $key => $value ) {
2853
+                if ( ! is_scalar( $value ) ) {
2854
+                    continue;
2855
+                }
2864 2856
 
2865
-		/**
2866
-		 * JavaScript Minifier
2867
-		 *
2868
-		 * @param $input
2869
-		 *
2870
-		 * @return mixed
2871
-		 */
2872
-		public static function minify_js($input) {
2873
-			if(trim($input) === "") return $input;
2874
-			return preg_replace(
2875
-				array(
2876
-					// Remove comment(s)
2877
-					'#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
2878
-					// Remove white-space(s) outside the string and regex
2879
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/)|\/(?!\/)[^\n\r]*?\/(?=[\s.,;]|[gimuy]|$))|\s*([!%&*\(\)\-=+\[\]\{\}|;:,.<>?\/])\s*#s',
2880
-					// Remove the last semicolon
2881
-					'#;+\}#',
2882
-					// Minify object attribute(s) except JSON attribute(s). From `{'foo':'bar'}` to `{foo:'bar'}`
2883
-					'#([\{,])([\'])(\d+|[a-z_][a-z0-9_]*)\2(?=\:)#i',
2884
-					// --ibid. From `foo['bar']` to `foo.bar`
2885
-					'#([a-z0-9_\)\]])\[([\'"])([a-z_][a-z0-9_]*)\2\]#i'
2886
-				),
2887
-				array(
2888
-					'$1',
2889
-					'$1$2',
2890
-					'}',
2891
-					'$1$3',
2892
-					'$1.$3'
2893
-				),
2894
-				$input);
2895
-		}
2857
+                $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2858
+            }
2896 2859
 
2897
-		/**
2898
-		 * Minify CSS
2899
-		 *
2900
-		 * @param $input
2901
-		 *
2902
-		 * @return mixed
2903
-		 */
2904
-		public static function minify_css($input) {
2905
-			if(trim($input) === "") return $input;
2906
-			return preg_replace(
2907
-				array(
2908
-					// Remove comment(s)
2909
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')|\/\*(?!\!)(?>.*?\*\/)|^\s*|\s*$#s',
2910
-					// Remove unused white-space(s)
2911
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/))|\s*+;\s*+(})\s*+|\s*+([*$~^|]?+=|[{};,>~]|\s(?![0-9\.])|!important\b)\s*+|([[(:])\s++|\s++([])])|\s++(:)\s*+(?!(?>[^{}"\']++|"(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')*+{)|^\s++|\s++\z|(\s)\s+#si',
2912
-					// Replace `0(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)` with `0`
2913
-					'#(?<=[\s:])(0)(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)#si',
2914
-					// Replace `:0 0 0 0` with `:0`
2915
-					'#:(0\s+0|0\s+0\s+0\s+0)(?=[;\}]|\!important)#i',
2916
-					// Replace `background-position:0` with `background-position:0 0`
2917
-					'#(background-position):0(?=[;\}])#si',
2918
-					// Replace `0.6` with `.6`, but only when preceded by `:`, `,`, `-` or a white-space
2919
-					'#(?<=[\s:,\-])0+\.(\d+)#s',
2920
-					// Minify string value
2921
-					'#(\/\*(?>.*?\*\/))|(?<!content\:)([\'"])([a-z_][a-z0-9\-_]*?)\2(?=[\s\{\}\];,])#si',
2922
-					'#(\/\*(?>.*?\*\/))|(\burl\()([\'"])([^\s]+?)\3(\))#si',
2923
-					// Minify HEX color code
2924
-					'#(?<=[\s:,\-]\#)([a-f0-6]+)\1([a-f0-6]+)\2([a-f0-6]+)\3#i',
2925
-					// Replace `(border|outline):none` with `(border|outline):0`
2926
-					'#(?<=[\{;])(border|outline):none(?=[;\}\!])#',
2927
-					// Remove empty selector(s)
2928
-					'#(\/\*(?>.*?\*\/))|(^|[\{\}])(?:[^\s\{\}]+)\{\}#s'
2929
-				),
2930
-				array(
2931
-					'$1',
2932
-					'$1$2$3$4$5$6$7',
2933
-					'$1',
2934
-					':0',
2935
-					'$1:0 0',
2936
-					'.$1',
2937
-					'$1$3',
2938
-					'$1$2$4$5',
2939
-					'$1$2$3',
2940
-					'$1:0',
2941
-					'$1$2'
2942
-				),
2943
-				$input);
2944
-		}
2860
+            $locale = json_encode( $params );
2861
+
2862
+            return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) );
2863
+        }
2945 2864
 
2946
-		/**
2947
-		 * Get the conditional fields JavaScript.
2948
-		 *
2949
-		 * @return mixed
2950
-		 */
2951
-		public function conditional_fields_js() {
2952
-			ob_start();
2953
-			?>
2865
+        /**
2866
+         * JavaScript Minifier
2867
+         *
2868
+         * @param $input
2869
+         *
2870
+         * @return mixed
2871
+         */
2872
+        public static function minify_js($input) {
2873
+            if(trim($input) === "") return $input;
2874
+            return preg_replace(
2875
+                array(
2876
+                    // Remove comment(s)
2877
+                    '#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
2878
+                    // Remove white-space(s) outside the string and regex
2879
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/)|\/(?!\/)[^\n\r]*?\/(?=[\s.,;]|[gimuy]|$))|\s*([!%&*\(\)\-=+\[\]\{\}|;:,.<>?\/])\s*#s',
2880
+                    // Remove the last semicolon
2881
+                    '#;+\}#',
2882
+                    // Minify object attribute(s) except JSON attribute(s). From `{'foo':'bar'}` to `{foo:'bar'}`
2883
+                    '#([\{,])([\'])(\d+|[a-z_][a-z0-9_]*)\2(?=\:)#i',
2884
+                    // --ibid. From `foo['bar']` to `foo.bar`
2885
+                    '#([a-z0-9_\)\]])\[([\'"])([a-z_][a-z0-9_]*)\2\]#i'
2886
+                ),
2887
+                array(
2888
+                    '$1',
2889
+                    '$1$2',
2890
+                    '}',
2891
+                    '$1$3',
2892
+                    '$1.$3'
2893
+                ),
2894
+                $input);
2895
+        }
2896
+
2897
+        /**
2898
+         * Minify CSS
2899
+         *
2900
+         * @param $input
2901
+         *
2902
+         * @return mixed
2903
+         */
2904
+        public static function minify_css($input) {
2905
+            if(trim($input) === "") return $input;
2906
+            return preg_replace(
2907
+                array(
2908
+                    // Remove comment(s)
2909
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')|\/\*(?!\!)(?>.*?\*\/)|^\s*|\s*$#s',
2910
+                    // Remove unused white-space(s)
2911
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/))|\s*+;\s*+(})\s*+|\s*+([*$~^|]?+=|[{};,>~]|\s(?![0-9\.])|!important\b)\s*+|([[(:])\s++|\s++([])])|\s++(:)\s*+(?!(?>[^{}"\']++|"(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')*+{)|^\s++|\s++\z|(\s)\s+#si',
2912
+                    // Replace `0(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)` with `0`
2913
+                    '#(?<=[\s:])(0)(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)#si',
2914
+                    // Replace `:0 0 0 0` with `:0`
2915
+                    '#:(0\s+0|0\s+0\s+0\s+0)(?=[;\}]|\!important)#i',
2916
+                    // Replace `background-position:0` with `background-position:0 0`
2917
+                    '#(background-position):0(?=[;\}])#si',
2918
+                    // Replace `0.6` with `.6`, but only when preceded by `:`, `,`, `-` or a white-space
2919
+                    '#(?<=[\s:,\-])0+\.(\d+)#s',
2920
+                    // Minify string value
2921
+                    '#(\/\*(?>.*?\*\/))|(?<!content\:)([\'"])([a-z_][a-z0-9\-_]*?)\2(?=[\s\{\}\];,])#si',
2922
+                    '#(\/\*(?>.*?\*\/))|(\burl\()([\'"])([^\s]+?)\3(\))#si',
2923
+                    // Minify HEX color code
2924
+                    '#(?<=[\s:,\-]\#)([a-f0-6]+)\1([a-f0-6]+)\2([a-f0-6]+)\3#i',
2925
+                    // Replace `(border|outline):none` with `(border|outline):0`
2926
+                    '#(?<=[\{;])(border|outline):none(?=[;\}\!])#',
2927
+                    // Remove empty selector(s)
2928
+                    '#(\/\*(?>.*?\*\/))|(^|[\{\}])(?:[^\s\{\}]+)\{\}#s'
2929
+                ),
2930
+                array(
2931
+                    '$1',
2932
+                    '$1$2$3$4$5$6$7',
2933
+                    '$1',
2934
+                    ':0',
2935
+                    '$1:0 0',
2936
+                    '.$1',
2937
+                    '$1$3',
2938
+                    '$1$2$4$5',
2939
+                    '$1$2$3',
2940
+                    '$1:0',
2941
+                    '$1$2'
2942
+                ),
2943
+                $input);
2944
+        }
2945
+
2946
+        /**
2947
+         * Get the conditional fields JavaScript.
2948
+         *
2949
+         * @return mixed
2950
+         */
2951
+        public function conditional_fields_js() {
2952
+            ob_start();
2953
+            ?>
2954 2954
 <script>
2955 2955
 /**
2956 2956
  * Conditional Fields
@@ -3453,14 +3453,14 @@  discard block
 block discarded – undo
3453 3453
 <?php do_action( 'aui_conditional_fields_js', $this ); ?>
3454 3454
 </script>
3455 3455
 			<?php
3456
-			$output = ob_get_clean();
3456
+            $output = ob_get_clean();
3457 3457
 
3458
-			return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) );
3459
-		}
3460
-	}
3458
+            return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) );
3459
+        }
3460
+    }
3461 3461
 
3462
-	/**
3463
-	 * Run the class if found.
3464
-	 */
3465
-	AyeCode_UI_Settings::instance();
3462
+    /**
3463
+     * Run the class if found.
3464
+     */
3465
+    AyeCode_UI_Settings::instance();
3466 3466
 }
3467 3467
\ No newline at end of file
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/wp-super-duper.php 1 patch
Indentation   +1989 added lines, -1989 removed lines patch added patch discarded remove patch
@@ -1,60 +1,60 @@  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
-	define( 'SUPER_DUPER_VER', '1.1.8' );
9
-
10
-	/**
11
-	 * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress.
12
-	 *
13
-	 * Should not be called direct but extended instead.
14
-	 *
15
-	 * Class WP_Super_Duper
16
-	 * @since 1.0.16 change log moved to file change-log.txt - CHANGED
17
-	 * @ver 1.1.1
18
-	 */
19
-	class WP_Super_Duper extends WP_Widget {
20
-
21
-		public $version = SUPER_DUPER_VER;
22
-		public $font_awesome_icon_version = "5.11.2";
23
-		public $block_code;
24
-		public $options;
25
-		public $base_id;
26
-		public $settings_hash;
27
-		public $arguments = array();
28
-		public $instance = array();
29
-		private $class_name;
30
-
31
-		/**
32
-		 * The relative url to the current folder.
33
-		 *
34
-		 * @var string
35
-		 */
36
-		public $url = '';
37
-
38
-		/**
39
-		 * Take the array options and use them to build.
40
-		 */
41
-		public function __construct( $options ) {
42
-			global $sd_widgets;
43
-
44
-			$sd_widgets[ $options['base_id'] ] = array(
45
-				'name'       => $options['name'],
46
-				'class_name' => $options['class_name'],
47
-				'output_types' => !empty($options['output_types']) ? $options['output_types'] : array()
48
-			);
49
-			$this->base_id                     = $options['base_id'];
50
-			// lets filter the options before we do anything
51
-			$options       = apply_filters( "wp_super_duper_options", $options );
52
-			$options       = apply_filters( "wp_super_duper_options_{$this->base_id}", $options );
53
-			$options       = $this->add_name_from_key( $options );
54
-			$this->options = $options;
55
-
56
-			$this->base_id   = $options['base_id'];
57
-			$this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
8
+    define( 'SUPER_DUPER_VER', '1.1.8' );
9
+
10
+    /**
11
+     * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress.
12
+     *
13
+     * Should not be called direct but extended instead.
14
+     *
15
+     * Class WP_Super_Duper
16
+     * @since 1.0.16 change log moved to file change-log.txt - CHANGED
17
+     * @ver 1.1.1
18
+     */
19
+    class WP_Super_Duper extends WP_Widget {
20
+
21
+        public $version = SUPER_DUPER_VER;
22
+        public $font_awesome_icon_version = "5.11.2";
23
+        public $block_code;
24
+        public $options;
25
+        public $base_id;
26
+        public $settings_hash;
27
+        public $arguments = array();
28
+        public $instance = array();
29
+        private $class_name;
30
+
31
+        /**
32
+         * The relative url to the current folder.
33
+         *
34
+         * @var string
35
+         */
36
+        public $url = '';
37
+
38
+        /**
39
+         * Take the array options and use them to build.
40
+         */
41
+        public function __construct( $options ) {
42
+            global $sd_widgets;
43
+
44
+            $sd_widgets[ $options['base_id'] ] = array(
45
+                'name'       => $options['name'],
46
+                'class_name' => $options['class_name'],
47
+                'output_types' => !empty($options['output_types']) ? $options['output_types'] : array()
48
+            );
49
+            $this->base_id                     = $options['base_id'];
50
+            // lets filter the options before we do anything
51
+            $options       = apply_filters( "wp_super_duper_options", $options );
52
+            $options       = apply_filters( "wp_super_duper_options_{$this->base_id}", $options );
53
+            $options       = $this->add_name_from_key( $options );
54
+            $this->options = $options;
55
+
56
+            $this->base_id   = $options['base_id'];
57
+            $this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
58 58
 
59 59
             // nested blocks can't work as a widget
60 60
             if(!empty($this->options['nested-block'])){
@@ -65,234 +65,234 @@  discard block
 block discarded – undo
65 65
                 }
66 66
             }
67 67
 
68
-			// init parent
69
-			if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
68
+            // init parent
69
+            if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
70 70
                 parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] );
71
-			}
71
+            }
72 72
 
73 73
 
74
-			if ( isset( $options['class_name'] ) ) {
75
-				// register widget
76
-				$this->class_name = $options['class_name'];
74
+            if ( isset( $options['class_name'] ) ) {
75
+                // register widget
76
+                $this->class_name = $options['class_name'];
77 77
 
78
-				// register shortcode, this needs to be done even for blocks and widgets
78
+                // register shortcode, this needs to be done even for blocks and widgets
79 79
                 $this->register_shortcode();
80 80
 
81 81
 
82
-				// Fusion Builder (avada) support
83
-				if ( function_exists( 'fusion_builder_map' ) ) {
84
-					add_action( 'init', array( $this, 'register_fusion_element' ) );
85
-				}
82
+                // Fusion Builder (avada) support
83
+                if ( function_exists( 'fusion_builder_map' ) ) {
84
+                    add_action( 'init', array( $this, 'register_fusion_element' ) );
85
+                }
86 86
 
87
-				// register block
88
-				if(empty($this->options['output_types']) || in_array('block',$this->options['output_types'])){
89
-				    add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
87
+                // register block
88
+                if(empty($this->options['output_types']) || in_array('block',$this->options['output_types'])){
89
+                    add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
90 90
                 }
91
-			}
91
+            }
92 92
 
93
-			// add the CSS and JS we need ONCE
94
-			global $sd_widget_scripts;
93
+            // add the CSS and JS we need ONCE
94
+            global $sd_widget_scripts;
95 95
 
96
-			if ( ! $sd_widget_scripts ) {
97
-				wp_add_inline_script( 'admin-widgets', $this->widget_js() );
98
-				wp_add_inline_script( 'customize-controls', $this->widget_js() );
99
-				wp_add_inline_style( 'widgets', $this->widget_css() );
96
+            if ( ! $sd_widget_scripts ) {
97
+                wp_add_inline_script( 'admin-widgets', $this->widget_js() );
98
+                wp_add_inline_script( 'customize-controls', $this->widget_js() );
99
+                wp_add_inline_style( 'widgets', $this->widget_css() );
100 100
 
101
-				// maybe add elementor editor styles
102
-				add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) );
101
+                // maybe add elementor editor styles
102
+                add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) );
103 103
 
104
-				$sd_widget_scripts = true;
104
+                $sd_widget_scripts = true;
105 105
 
106
-				// add shortcode insert button once
107
-				add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
108
-				// generatepress theme sections compatibility
109
-				if ( function_exists( 'generate_sections_sections_metabox' ) ) {
110
-					add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
111
-				}
112
-				/* Load script on Divi theme builder page */
113
-				if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) {
114
-					add_thickbox();
115
-					add_action( 'admin_footer', array( $this, 'shortcode_insert_button_script' ) );
116
-				}
106
+                // add shortcode insert button once
107
+                add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
108
+                // generatepress theme sections compatibility
109
+                if ( function_exists( 'generate_sections_sections_metabox' ) ) {
110
+                    add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
111
+                }
112
+                /* Load script on Divi theme builder page */
113
+                if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) {
114
+                    add_thickbox();
115
+                    add_action( 'admin_footer', array( $this, 'shortcode_insert_button_script' ) );
116
+                }
117 117
 
118
-				if ( $this->is_preview() ) {
119
-					add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
120
-					// this makes the insert button work for elementor
121
-					add_action( 'elementor/editor/after_enqueue_scripts', array(
122
-						$this,
123
-						'shortcode_insert_button_script'
124
-					) ); // for elementor
125
-				}
126
-				// this makes the insert button work for cornerstone
127
-				add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) );
118
+                if ( $this->is_preview() ) {
119
+                    add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
120
+                    // this makes the insert button work for elementor
121
+                    add_action( 'elementor/editor/after_enqueue_scripts', array(
122
+                        $this,
123
+                        'shortcode_insert_button_script'
124
+                    ) ); // for elementor
125
+                }
126
+                // this makes the insert button work for cornerstone
127
+                add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) );
128 128
 
129
-				add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) );
130
-				add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
129
+                add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) );
130
+                add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
131 131
 
132
-				// add generator text to admin head
133
-				add_action( 'admin_head', array( $this, 'generator' ) );
134
-			}
132
+                // add generator text to admin head
133
+                add_action( 'admin_head', array( $this, 'generator' ) );
134
+            }
135 135
 
136
-			do_action( 'wp_super_duper_widget_init', $options, $this );
137
-		}
136
+            do_action( 'wp_super_duper_widget_init', $options, $this );
137
+        }
138 138
 
139 139
         /**
140 140
          * The register widget function
141 141
          * @return void
142 142
          */
143
-		public function _register() {
143
+        public function _register() {
144 144
             if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
145 145
                 parent::_register();
146
-			}
147
-		}
146
+            }
147
+        }
148 148
 
149
-		/**
150
-		 * Add our widget CSS to elementor editor.
151
-		 */
152
-		public function elementor_editor_styles() {
153
-			wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) );
154
-		}
149
+        /**
150
+         * Add our widget CSS to elementor editor.
151
+         */
152
+        public function elementor_editor_styles() {
153
+            wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) );
154
+        }
155 155
 
156
-		public function register_fusion_element() {
156
+        public function register_fusion_element() {
157 157
 
158
-			$options = $this->options;
158
+            $options = $this->options;
159 159
 
160
-			if ( $this->base_id ) {
160
+            if ( $this->base_id ) {
161 161
 
162
-				$params = $this->get_fusion_params();
162
+                $params = $this->get_fusion_params();
163 163
 
164
-				$args = array(
165
-					'name'            => $options['name'],
166
-					'shortcode'       => $this->base_id,
167
-					'icon'            => $options['block-icon'] ? $options['block-icon'] : 'far fa-square',
168
-					'allow_generator' => true,
169
-				);
164
+                $args = array(
165
+                    'name'            => $options['name'],
166
+                    'shortcode'       => $this->base_id,
167
+                    'icon'            => $options['block-icon'] ? $options['block-icon'] : 'far fa-square',
168
+                    'allow_generator' => true,
169
+                );
170 170
 
171
-				if ( ! empty( $params ) ) {
172
-					$args['params'] = $params;
173
-				}
171
+                if ( ! empty( $params ) ) {
172
+                    $args['params'] = $params;
173
+                }
174 174
 
175
-				fusion_builder_map( $args );
176
-			}
175
+                fusion_builder_map( $args );
176
+            }
177 177
 
178
-		}
178
+        }
179 179
 
180
-		public function get_fusion_params() {
181
-			$params    = array();
182
-			$arguments = $this->get_arguments();
183
-
184
-			if ( ! empty( $arguments ) ) {
185
-				foreach ( $arguments as $key => $val ) {
186
-					$param = array();
187
-					// type
188
-					$param['type'] = str_replace(
189
-						array(
190
-							"text",
191
-							"number",
192
-							"email",
193
-							"color",
194
-							"checkbox"
195
-						),
196
-						array(
197
-							"textfield",
198
-							"textfield",
199
-							"textfield",
200
-							"colorpicker",
201
-							"select",
202
-
203
-						),
204
-						$val['type'] );
205
-
206
-					// multiselect
207
-					if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
208
-						$param['type']     = 'multiple_select';
209
-						$param['multiple'] = true;
210
-					}
180
+        public function get_fusion_params() {
181
+            $params    = array();
182
+            $arguments = $this->get_arguments();
183
+
184
+            if ( ! empty( $arguments ) ) {
185
+                foreach ( $arguments as $key => $val ) {
186
+                    $param = array();
187
+                    // type
188
+                    $param['type'] = str_replace(
189
+                        array(
190
+                            "text",
191
+                            "number",
192
+                            "email",
193
+                            "color",
194
+                            "checkbox"
195
+                        ),
196
+                        array(
197
+                            "textfield",
198
+                            "textfield",
199
+                            "textfield",
200
+                            "colorpicker",
201
+                            "select",
211 202
 
212
-					// heading
213
-					$param['heading'] = $val['title'];
203
+                        ),
204
+                        $val['type'] );
214 205
 
215
-					// description
216
-					$param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
206
+                    // multiselect
207
+                    if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
208
+                        $param['type']     = 'multiple_select';
209
+                        $param['multiple'] = true;
210
+                    }
217 211
 
218
-					// param_name
219
-					$param['param_name'] = $key;
212
+                    // heading
213
+                    $param['heading'] = $val['title'];
220 214
 
221
-					// Default
222
-					$param['default'] = isset( $val['default'] ) ? $val['default'] : '';
215
+                    // description
216
+                    $param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
223 217
 
224
-					// Group
225
-					if ( isset( $val['group'] ) ) {
226
-						$param['group'] = $val['group'];
227
-					}
218
+                    // param_name
219
+                    $param['param_name'] = $key;
228 220
 
229
-					// value
230
-					if ( $val['type'] == 'checkbox' ) {
231
-						if ( isset( $val['default'] ) && $val['default'] == '0' ) {
232
-							unset( $param['default'] );
233
-						}
234
-						$param['value'] = array( '' => __( "No" ), '1' => __( "Yes" ) );
235
-					} elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
236
-						$param['value'] = isset( $val['options'] ) ? $val['options'] : array();
237
-					} else {
238
-						$param['value'] = isset( $val['default'] ) ? $val['default'] : '';
239
-					}
221
+                    // Default
222
+                    $param['default'] = isset( $val['default'] ) ? $val['default'] : '';
240 223
 
241
-					// setup the param
242
-					$params[] = $param;
224
+                    // Group
225
+                    if ( isset( $val['group'] ) ) {
226
+                        $param['group'] = $val['group'];
227
+                    }
243 228
 
244
-				}
245
-			}
229
+                    // value
230
+                    if ( $val['type'] == 'checkbox' ) {
231
+                        if ( isset( $val['default'] ) && $val['default'] == '0' ) {
232
+                            unset( $param['default'] );
233
+                        }
234
+                        $param['value'] = array( '' => __( "No" ), '1' => __( "Yes" ) );
235
+                    } elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
236
+                        $param['value'] = isset( $val['options'] ) ? $val['options'] : array();
237
+                    } else {
238
+                        $param['value'] = isset( $val['default'] ) ? $val['default'] : '';
239
+                    }
246 240
 
241
+                    // setup the param
242
+                    $params[] = $param;
247 243
 
248
-			return $params;
249
-		}
244
+                }
245
+            }
250 246
 
251
-		/**
252
-		 * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
253
-		 */
254
-		public static function maybe_cornerstone_builder() {
255
-			if ( did_action( 'cornerstone_before_boot_app' ) ) {
256
-				self::shortcode_insert_button_script();
257
-			}
258
-		}
259 247
 
260
-		/**
261
-		 * A function to ge the shortcode builder picker html.
262
-		 *
263
-		 * @param string $editor_id
264
-		 *
265
-		 * @return string
266
-		 */
267
-		public static function get_picker( $editor_id = '' ) {
268
-
269
-			ob_start();
270
-			if ( isset( $_POST['editor_id'] ) ) {
271
-				$editor_id = esc_attr( $_POST['editor_id'] );
272
-			} elseif ( isset( $_REQUEST['et_fb'] ) ) {
273
-				$editor_id = 'main_content_content_vb_tiny_mce';
274
-			}
248
+            return $params;
249
+        }
250
+
251
+        /**
252
+         * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
253
+         */
254
+        public static function maybe_cornerstone_builder() {
255
+            if ( did_action( 'cornerstone_before_boot_app' ) ) {
256
+                self::shortcode_insert_button_script();
257
+            }
258
+        }
259
+
260
+        /**
261
+         * A function to ge the shortcode builder picker html.
262
+         *
263
+         * @param string $editor_id
264
+         *
265
+         * @return string
266
+         */
267
+        public static function get_picker( $editor_id = '' ) {
268
+
269
+            ob_start();
270
+            if ( isset( $_POST['editor_id'] ) ) {
271
+                $editor_id = esc_attr( $_POST['editor_id'] );
272
+            } elseif ( isset( $_REQUEST['et_fb'] ) ) {
273
+                $editor_id = 'main_content_content_vb_tiny_mce';
274
+            }
275 275
 
276
-			global $sd_widgets;
276
+            global $sd_widgets;
277 277
 
278 278
 //			print_r($sd_widgets);exit;
279
-			?>
279
+            ?>
280 280
 
281 281
 			<div class="sd-shortcode-left-wrap">
282 282
 				<?php
283
-				ksort( $sd_widgets );
284
-				//				print_r($sd_widgets);exit;
285
-				if ( ! empty( $sd_widgets ) ) {
286
-					echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
287
-					echo "<option>" . __( 'Select shortcode' ) . "</option>";
288
-					foreach ( $sd_widgets as $shortcode => $class ) {
289
-						if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; }
290
-						echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
291
-					}
292
-					echo "</select>";
283
+                ksort( $sd_widgets );
284
+                //				print_r($sd_widgets);exit;
285
+                if ( ! empty( $sd_widgets ) ) {
286
+                    echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
287
+                    echo "<option>" . __( 'Select shortcode' ) . "</option>";
288
+                    foreach ( $sd_widgets as $shortcode => $class ) {
289
+                        if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; }
290
+                        echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
291
+                    }
292
+                    echo "</select>";
293 293
 
294
-				}
295
-				?>
294
+                }
295
+                ?>
296 296
 				<div class="sd-shortcode-settings"></div>
297 297
 
298 298
 			</div>
@@ -303,8 +303,8 @@  discard block
 block discarded – undo
303 303
 					<?php if ( $editor_id != '' ) { ?>
304 304
 						<button class="button sd-insert-shortcode-button"
305 305
 						        onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) {
306
-							        echo "'" . $editor_id . "'";
307
-						        } ?>)"><?php _e( 'Insert shortcode' ); ?></button>
306
+                                    echo "'" . $editor_id . "'";
307
+                                } ?>)"><?php _e( 'Insert shortcode' ); ?></button>
308 308
 					<?php } ?>
309 309
 					<button class="button"
310 310
 					        onclick="sd_copy_to_clipboard()"><?php _e( 'Copy shortcode' ); ?></button>
@@ -312,135 +312,135 @@  discard block
 block discarded – undo
312 312
 			</div>
313 313
 			<?php
314 314
 
315
-			$html = ob_get_clean();
315
+            $html = ob_get_clean();
316 316
 
317
-			if ( wp_doing_ajax() ) {
318
-				echo $html;
319
-				$should_die = true;
317
+            if ( wp_doing_ajax() ) {
318
+                echo $html;
319
+                $should_die = true;
320 320
 
321
-				// some builder get the editor via ajax so we should not die on those occasions
322
-				$dont_die = array(
323
-					'parent_tag',// WP Bakery
324
-					'avia_request' // enfold
325
-				);
321
+                // some builder get the editor via ajax so we should not die on those occasions
322
+                $dont_die = array(
323
+                    'parent_tag',// WP Bakery
324
+                    'avia_request' // enfold
325
+                );
326 326
 
327
-				foreach ( $dont_die as $request ) {
328
-					if ( isset( $_REQUEST[ $request ] ) ) {
329
-						$should_die = false;
330
-					}
331
-				}
327
+                foreach ( $dont_die as $request ) {
328
+                    if ( isset( $_REQUEST[ $request ] ) ) {
329
+                        $should_die = false;
330
+                    }
331
+                }
332 332
 
333
-				if ( $should_die ) {
334
-					wp_die();
335
-				}
333
+                if ( $should_die ) {
334
+                    wp_die();
335
+                }
336 336
 
337
-			} else {
338
-				return $html;
339
-			}
337
+            } else {
338
+                return $html;
339
+            }
340 340
 
341
-			return '';
341
+            return '';
342 342
 
343
-		}
343
+        }
344 344
 
345
-		/**
346
-		 * Output the version in the admin header.
347
-		 */
348
-		public function generator() {
349
-			echo '<meta name="generator" content="WP Super Duper v' . $this->version . '" />';
350
-		}
345
+        /**
346
+         * Output the version in the admin header.
347
+         */
348
+        public function generator() {
349
+            echo '<meta name="generator" content="WP Super Duper v' . $this->version . '" />';
350
+        }
351 351
 
352
-		/**
353
-		 * Get widget settings.
354
-		 *
355
-		 * @since 1.0.0
356
-		 */
357
-		public static function get_widget_settings() {
358
-			global $sd_widgets;
359
-
360
-			$shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : '';
361
-			if ( ! $shortcode ) {
362
-				wp_die();
363
-			}
364
-			$widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : '';
365
-			if ( ! $widget_args ) {
366
-				wp_die();
367
-			}
368
-			$class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
369
-			if ( ! $class_name ) {
370
-				wp_die();
371
-			}
352
+        /**
353
+         * Get widget settings.
354
+         *
355
+         * @since 1.0.0
356
+         */
357
+        public static function get_widget_settings() {
358
+            global $sd_widgets;
359
+
360
+            $shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : '';
361
+            if ( ! $shortcode ) {
362
+                wp_die();
363
+            }
364
+            $widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : '';
365
+            if ( ! $widget_args ) {
366
+                wp_die();
367
+            }
368
+            $class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
369
+            if ( ! $class_name ) {
370
+                wp_die();
371
+            }
372 372
 
373
-			// invoke an instance method
374
-			$widget = new $class_name;
373
+            // invoke an instance method
374
+            $widget = new $class_name;
375 375
 
376
-			ob_start();
377
-			$widget->form( array() );
378
-			$form = ob_get_clean();
379
-			echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>";
380
-			echo "<style>" . $widget->widget_css() . "</style>";
381
-			echo "<script>" . $widget->widget_js() . "</script>";
382
-			?>
376
+            ob_start();
377
+            $widget->form( array() );
378
+            $form = ob_get_clean();
379
+            echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>";
380
+            echo "<style>" . $widget->widget_css() . "</style>";
381
+            echo "<script>" . $widget->widget_js() . "</script>";
382
+            ?>
383 383
 			<?php
384
-			wp_die();
385
-		}
384
+            wp_die();
385
+        }
386 386
 
387
-		/**
388
-		 * Insert shortcode builder button to classic editor (not inside Gutenberg, not needed).
389
-		 *
390
-		 * @param string $editor_id Optional. Shortcode editor id. Default null.
391
-		 * @param string $insert_shortcode_function Optional. Insert shortcode function. Default null.
392
-		 *
393
-		 *@since 1.0.0
394
-		 *
395
-		 */
396
-		public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
397
-			global $sd_widgets, $shortcode_insert_button_once;
398
-			if ( $shortcode_insert_button_once ) {
399
-				return;
400
-			}
401
-			add_thickbox();
387
+        /**
388
+         * Insert shortcode builder button to classic editor (not inside Gutenberg, not needed).
389
+         *
390
+         * @param string $editor_id Optional. Shortcode editor id. Default null.
391
+         * @param string $insert_shortcode_function Optional. Insert shortcode function. Default null.
392
+         *
393
+         *@since 1.0.0
394
+         *
395
+         */
396
+        public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
397
+            global $sd_widgets, $shortcode_insert_button_once;
398
+            if ( $shortcode_insert_button_once ) {
399
+                return;
400
+            }
401
+            add_thickbox();
402 402
 
403 403
 
404
-			/**
405
-			 * Cornerstone makes us play dirty tricks :/
406
-			 * 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.
407
-			 */
408
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
409
-				echo '<span id="insert-media-button">';
410
-			}
404
+            /**
405
+             * Cornerstone makes us play dirty tricks :/
406
+             * 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.
407
+             */
408
+            if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
409
+                echo '<span id="insert-media-button">';
410
+            }
411 411
 
412
-			echo self::shortcode_button( 'this', 'true' );
412
+            echo self::shortcode_button( 'this', 'true' );
413 413
 
414
-			// see opening note
415
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
416
-				echo '</span>'; // end #insert-media-button
417
-			}
414
+            // see opening note
415
+            if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
416
+                echo '</span>'; // end #insert-media-button
417
+            }
418 418
 
419
-			// Add separate script for generatepress theme sections
420
-			if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
421
-			} else {
422
-				self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
423
-			}
419
+            // Add separate script for generatepress theme sections
420
+            if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
421
+            } else {
422
+                self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
423
+            }
424 424
 
425
-			$shortcode_insert_button_once = true;
426
-		}
425
+            $shortcode_insert_button_once = true;
426
+        }
427 427
 
428
-		/**
429
-		 * Gets the shortcode insert button html.
430
-		 *
431
-		 * @param string $id
432
-		 * @param string $search_for_id
433
-		 *
434
-		 * @return mixed
435
-		 */
436
-		public static function shortcode_button( $id = '', $search_for_id = '' ) {
437
-			ob_start();
438
-			?>
428
+        /**
429
+         * Gets the shortcode insert button html.
430
+         *
431
+         * @param string $id
432
+         * @param string $search_for_id
433
+         *
434
+         * @return mixed
435
+         */
436
+        public static function shortcode_button( $id = '', $search_for_id = '' ) {
437
+            ob_start();
438
+            ?>
439 439
 			<span class="sd-lable-shortcode-inserter">
440 440
 				<a onclick="sd_ajax_get_picker(<?php echo $id;
441
-				if ( $search_for_id ) {
442
-					echo "," . $search_for_id;
443
-				} ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
441
+                if ( $search_for_id ) {
442
+                    echo "," . $search_for_id;
443
+                } ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
444 444
 				   class="thickbox button super-duper-content-open" title="Add Shortcode">
445 445
 					<span style="vertical-align: middle;line-height: 18px;font-size: 20px;"
446 446
 					      class="dashicons dashicons-screenoptions"></span>
@@ -451,21 +451,21 @@  discard block
 block discarded – undo
451 451
 			</span>
452 452
 
453 453
 			<?php
454
-			$html = ob_get_clean();
454
+            $html = ob_get_clean();
455 455
 
456
-			// remove line breaks so we can use it in js
457
-			return preg_replace( "/\r|\n/", "", trim( $html ) );
458
-		}
456
+            // remove line breaks so we can use it in js
457
+            return preg_replace( "/\r|\n/", "", trim( $html ) );
458
+        }
459 459
 
460
-		/**
461
-		 * Makes SD work with the siteOrigin page builder.
462
-		 *
463
-		 * @return mixed
464
-		 *@since 1.0.6
465
-		 */
466
-		public static function siteorigin_js() {
467
-			ob_start();
468
-			?>
460
+        /**
461
+         * Makes SD work with the siteOrigin page builder.
462
+         *
463
+         * @return mixed
464
+         *@since 1.0.6
465
+         */
466
+        public static function siteorigin_js() {
467
+            ob_start();
468
+            ?>
469 469
 			<script>
470 470
 				/**
471 471
 				 * Check a form to see what items should be shown or hidden.
@@ -541,29 +541,29 @@  discard block
 block discarded – undo
541 541
 				});
542 542
 			</script>
543 543
 			<?php
544
-			$output = ob_get_clean();
544
+            $output = ob_get_clean();
545 545
 
546
-			/*
546
+            /*
547 547
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
548 548
 			 */
549 549
 
550
-			return str_replace( array(
551
-				'<script>',
552
-				'</script>'
553
-			), '', $output );
554
-		}
550
+            return str_replace( array(
551
+                '<script>',
552
+                '</script>'
553
+            ), '', $output );
554
+        }
555 555
 
556
-		/**
557
-		 * Output the JS and CSS for the shortcode insert button.
558
-		 *
559
-		 * @param string $editor_id
560
-		 * @param string $insert_shortcode_function
561
-		 *
562
-		 *@since 1.0.6
563
-		 *
564
-		 */
565
-		public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
566
-			?>
556
+        /**
557
+         * Output the JS and CSS for the shortcode insert button.
558
+         *
559
+         * @param string $editor_id
560
+         * @param string $insert_shortcode_function
561
+         *
562
+         *@since 1.0.6
563
+         *
564
+         */
565
+        public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
566
+            ?>
567 567
 			<style>
568 568
 				.sd-shortcode-left-wrap {
569 569
 					float: left;
@@ -691,35 +691,35 @@  discard block
 block discarded – undo
691 691
 				<?php } ?>
692 692
 			</style>
693 693
 			<?php
694
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
695
-				echo "<script>" . self::siteorigin_js() . "</script>";
696
-			}
697
-			?>
694
+            if ( class_exists( 'SiteOrigin_Panels' ) ) {
695
+                echo "<script>" . self::siteorigin_js() . "</script>";
696
+            }
697
+            ?>
698 698
 			<script>
699 699
 				<?php
700
-				if(! empty( $insert_shortcode_function )){
701
-					echo $insert_shortcode_function;
702
-				}else{
703
-
704
-				/**
705
-				 * Function for super duper insert shortcode.
706
-				 *
707
-				 * @since 1.0.0
708
-				 */
709
-				?>
700
+                if(! empty( $insert_shortcode_function )){
701
+                    echo $insert_shortcode_function;
702
+                }else{
703
+
704
+                /**
705
+                 * Function for super duper insert shortcode.
706
+                 *
707
+                 * @since 1.0.0
708
+                 */
709
+                ?>
710 710
 				function sd_insert_shortcode($editor_id) {
711 711
 					$shortcode = jQuery('#TB_ajaxContent #sd-shortcode-output').val();
712 712
 					if ($shortcode) {
713 713
 						if (!$editor_id) {
714 714
 							<?php
715
-							if ( isset( $_REQUEST['et_fb'] ) ) {
716
-								echo '$editor_id = "#main_content_content_vb_tiny_mce";';
717
-							} elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
718
-								echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
719
-							} else {
720
-								echo '$editor_id = "#wp-content-editor-container textarea";';
721
-							}
722
-							?>
715
+                            if ( isset( $_REQUEST['et_fb'] ) ) {
716
+                                echo '$editor_id = "#main_content_content_vb_tiny_mce";';
717
+                            } elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
718
+                                echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
719
+                            } else {
720
+                                echo '$editor_id = "#wp-content-editor-container textarea";';
721
+                            }
722
+                            ?>
723 723
 						} else {
724 724
 							$editor_id = '#' + $editor_id;
725 725
 						}
@@ -1046,18 +1046,18 @@  discard block
 block discarded – undo
1046 1046
 
1047 1047
 			</script>
1048 1048
 			<?php
1049
-		}
1049
+        }
1050 1050
 
1051
-		/**
1052
-		 * Gets some CSS for the widgets screen.
1053
-		 *
1054
-		 * @param bool $advanced If we should include advanced CSS.
1055
-		 *
1056
-		 * @return mixed
1057
-		 */
1058
-		public function widget_css( $advanced = true ) {
1059
-			ob_start();
1060
-			?>
1051
+        /**
1052
+         * Gets some CSS for the widgets screen.
1053
+         *
1054
+         * @param bool $advanced If we should include advanced CSS.
1055
+         *
1056
+         * @return mixed
1057
+         */
1058
+        public function widget_css( $advanced = true ) {
1059
+            ob_start();
1060
+            ?>
1061 1061
 			<style>
1062 1062
 				<?php if( $advanced ){ ?>
1063 1063
 				.sd-advanced-setting {
@@ -1095,26 +1095,26 @@  discard block
 block discarded – undo
1095 1095
 				}
1096 1096
 			</style>
1097 1097
 			<?php
1098
-			$output = ob_get_clean();
1098
+            $output = ob_get_clean();
1099 1099
 
1100
-			/*
1100
+            /*
1101 1101
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1102 1102
 			 */
1103 1103
 
1104
-			return str_replace( array(
1105
-				'<style>',
1106
-				'</style>'
1107
-			), '', $output );
1108
-		}
1104
+            return str_replace( array(
1105
+                '<style>',
1106
+                '</style>'
1107
+            ), '', $output );
1108
+        }
1109 1109
 
1110
-		/**
1111
-		 * Gets some JS for the widgets screen.
1112
-		 *
1113
-		 * @return mixed
1114
-		 */
1115
-		public function widget_js() {
1116
-			ob_start();
1117
-			?>
1110
+        /**
1111
+         * Gets some JS for the widgets screen.
1112
+         *
1113
+         * @return mixed
1114
+         */
1115
+        public function widget_js() {
1116
+            ob_start();
1117
+            ?>
1118 1118
 			<script>
1119 1119
 
1120 1120
 				/**
@@ -1265,471 +1265,471 @@  discard block
 block discarded – undo
1265 1265
 				<?php do_action( 'wp_super_duper_widget_js', $this ); ?>
1266 1266
 			</script>
1267 1267
 			<?php
1268
-			$output = ob_get_clean();
1268
+            $output = ob_get_clean();
1269 1269
 
1270
-			/*
1270
+            /*
1271 1271
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1272 1272
 			 */
1273 1273
 
1274
-			return str_replace( array(
1275
-				'<script>',
1276
-				'</script>'
1277
-			), '', $output );
1278
-		}
1274
+            return str_replace( array(
1275
+                '<script>',
1276
+                '</script>'
1277
+            ), '', $output );
1278
+        }
1279 1279
 
1280 1280
 
1281
-		/**
1282
-		 * Set the name from the argument key.
1283
-		 *
1284
-		 * @param $options
1285
-		 *
1286
-		 * @return mixed
1287
-		 */
1288
-		private function add_name_from_key( $options, $arguments = false ) {
1289
-			if ( ! empty( $options['arguments'] ) ) {
1290
-				foreach ( $options['arguments'] as $key => $val ) {
1291
-					$options['arguments'][ $key ]['name'] = $key;
1292
-				}
1293
-			} elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
1294
-				foreach ( $options as $key => $val ) {
1295
-					$options[ $key ]['name'] = $key;
1296
-				}
1297
-			}
1281
+        /**
1282
+         * Set the name from the argument key.
1283
+         *
1284
+         * @param $options
1285
+         *
1286
+         * @return mixed
1287
+         */
1288
+        private function add_name_from_key( $options, $arguments = false ) {
1289
+            if ( ! empty( $options['arguments'] ) ) {
1290
+                foreach ( $options['arguments'] as $key => $val ) {
1291
+                    $options['arguments'][ $key ]['name'] = $key;
1292
+                }
1293
+            } elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
1294
+                foreach ( $options as $key => $val ) {
1295
+                    $options[ $key ]['name'] = $key;
1296
+                }
1297
+            }
1298 1298
 
1299
-			return $options;
1300
-		}
1299
+            return $options;
1300
+        }
1301 1301
 
1302
-		/**
1303
-		 * Register the parent shortcode.
1304
-		 *
1305
-		 * @since 1.0.0
1306
-		 */
1307
-		public function register_shortcode() {
1308
-			add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) );
1309
-			add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) );
1310
-		}
1302
+        /**
1303
+         * Register the parent shortcode.
1304
+         *
1305
+         * @since 1.0.0
1306
+         */
1307
+        public function register_shortcode() {
1308
+            add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) );
1309
+            add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) );
1310
+        }
1311 1311
 
1312
-		/**
1313
-		 * Render the shortcode via ajax so we can return it to Gutenberg.
1314
-		 *
1315
-		 * @since 1.0.0
1316
-		 */
1317
-		public function render_shortcode() {
1318
-			check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
1319
-			if ( ! current_user_can( 'manage_options' ) ) {
1320
-				wp_die();
1321
-			}
1312
+        /**
1313
+         * Render the shortcode via ajax so we can return it to Gutenberg.
1314
+         *
1315
+         * @since 1.0.0
1316
+         */
1317
+        public function render_shortcode() {
1318
+            check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
1319
+            if ( ! current_user_can( 'manage_options' ) ) {
1320
+                wp_die();
1321
+            }
1322 1322
 
1323
-			// we might need the $post value here so lets set it.
1324
-			if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
1325
-				$post_obj = get_post( absint( $_POST['post_id'] ) );
1326
-				if ( ! empty( $post_obj ) && empty( $post ) ) {
1327
-					global $post;
1328
-					$post = $post_obj;
1329
-				}
1330
-			}
1323
+            // we might need the $post value here so lets set it.
1324
+            if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
1325
+                $post_obj = get_post( absint( $_POST['post_id'] ) );
1326
+                if ( ! empty( $post_obj ) && empty( $post ) ) {
1327
+                    global $post;
1328
+                    $post = $post_obj;
1329
+                }
1330
+            }
1331 1331
 
1332
-			if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) {
1333
-				$is_preview = $this->is_preview();
1334
-				$shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
1335
-				$attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
1336
-				$attributes       = '';
1337
-				if ( ! empty( $attributes_array ) ) {
1338
-					foreach ( $attributes_array as $key => $value ) {
1339
-						if ( is_array( $value ) ) {
1340
-							$value = implode( ",", $value );
1341
-						}
1332
+            if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) {
1333
+                $is_preview = $this->is_preview();
1334
+                $shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
1335
+                $attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
1336
+                $attributes       = '';
1337
+                if ( ! empty( $attributes_array ) ) {
1338
+                    foreach ( $attributes_array as $key => $value ) {
1339
+                        if ( is_array( $value ) ) {
1340
+                            $value = implode( ",", $value );
1341
+                        }
1342 1342
 
1343
-						if ( ! empty( $value ) ) {
1344
-							$value = wp_unslash( $value );
1343
+                        if ( ! empty( $value ) ) {
1344
+                            $value = wp_unslash( $value );
1345 1345
 
1346
-							// Encode [ and ].
1347
-							if ( $is_preview ) {
1348
-								$value = $this->encode_shortcodes( $value );
1349
-							}
1350
-						}
1351
-						$attributes .= " " . sanitize_title_with_dashes( $key ) . "='" . esc_attr( $value ) . "' ";
1352
-					}
1353
-				}
1346
+                            // Encode [ and ].
1347
+                            if ( $is_preview ) {
1348
+                                $value = $this->encode_shortcodes( $value );
1349
+                            }
1350
+                        }
1351
+                        $attributes .= " " . sanitize_title_with_dashes( $key ) . "='" . esc_attr( $value ) . "' ";
1352
+                    }
1353
+                }
1354 1354
 
1355
-				$shortcode = "[" . $shortcode_name . " " . $attributes . "]";
1355
+                $shortcode = "[" . $shortcode_name . " " . $attributes . "]";
1356 1356
 
1357
-				$content = do_shortcode( $shortcode );
1357
+                $content = do_shortcode( $shortcode );
1358 1358
 
1359
-				// Decode [ and ].
1360
-				if ( ! empty( $content ) && $is_preview ) {
1361
-					$content = $this->decode_shortcodes( $content );
1362
-				}
1359
+                // Decode [ and ].
1360
+                if ( ! empty( $content ) && $is_preview ) {
1361
+                    $content = $this->decode_shortcodes( $content );
1362
+                }
1363 1363
 
1364
-				echo $content;
1365
-			}
1366
-			wp_die();
1367
-		}
1364
+                echo $content;
1365
+            }
1366
+            wp_die();
1367
+        }
1368 1368
 
1369
-		/**
1370
-		 * Output the shortcode.
1371
-		 *
1372
-		 * @param array $args
1373
-		 * @param string $content
1374
-		 *
1375
-		 * @return string
1376
-		 */
1377
-		public function shortcode_output( $args = array(), $content = '' ) {
1378
-			$_instance = $args;
1379
-
1380
-			$args = $this->argument_values( $args );
1381
-
1382
-			// add extra argument so we know its a output to gutenberg
1383
-			//$args
1384
-			$args = $this->string_to_bool( $args );
1385
-
1386
-			// if we have a enclosed shortcode we add it to the special `html` argument
1387
-			if ( ! empty( $content ) ) {
1388
-				$args['html'] = $content;
1389
-			}
1369
+        /**
1370
+         * Output the shortcode.
1371
+         *
1372
+         * @param array $args
1373
+         * @param string $content
1374
+         *
1375
+         * @return string
1376
+         */
1377
+        public function shortcode_output( $args = array(), $content = '' ) {
1378
+            $_instance = $args;
1390 1379
 
1391
-			if ( ! $this->is_preview() ) {
1392
-				/**
1393
-				 * Filters the settings for a particular widget args.
1394
-				 *
1395
-				 * @param array          $args      The current widget instance's settings.
1396
-				 * @param WP_Super_Duper $widget    The current widget settings.
1397
-				 * @param array          $_instance An array of default widget arguments.
1398
-				 *
1399
-				 *@since 1.0.28
1400
-				 *
1401
-				 */
1402
-				$args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance );
1380
+            $args = $this->argument_values( $args );
1403 1381
 
1404
-				if ( ! is_array( $args ) ) {
1405
-					return $args;
1406
-				}
1407
-			}
1382
+            // add extra argument so we know its a output to gutenberg
1383
+            //$args
1384
+            $args = $this->string_to_bool( $args );
1408 1385
 
1409
-			$class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : '';
1410
-			$class .= " sdel-".$this->get_instance_hash();
1386
+            // if we have a enclosed shortcode we add it to the special `html` argument
1387
+            if ( ! empty( $content ) ) {
1388
+                $args['html'] = $content;
1389
+            }
1411 1390
 
1412
-			$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
1413
-			$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
1391
+            if ( ! $this->is_preview() ) {
1392
+                /**
1393
+                 * Filters the settings for a particular widget args.
1394
+                 *
1395
+                 * @param array          $args      The current widget instance's settings.
1396
+                 * @param WP_Super_Duper $widget    The current widget settings.
1397
+                 * @param array          $_instance An array of default widget arguments.
1398
+                 *
1399
+                 *@since 1.0.28
1400
+                 *
1401
+                 */
1402
+                $args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance );
1403
+
1404
+                if ( ! is_array( $args ) ) {
1405
+                    return $args;
1406
+                }
1407
+            }
1414 1408
 
1415
-			$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
1416
-			$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
1409
+            $class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : '';
1410
+            $class .= " sdel-".$this->get_instance_hash();
1417 1411
 
1418
-			$shortcode_args = array();
1419
-			$output         = '';
1420
-			$no_wrap        = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1421
-			if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) {
1422
-				$no_wrap = true;
1423
-			}
1424
-			$main_content = $this->output( $args, $shortcode_args, $content );
1425
-			if ( $main_content && ! $no_wrap ) {
1426
-				// wrap the shortcode in a div with the same class as the widget
1427
-				$output .= '<div class="' . $class . '" ' . $attrs . '>';
1428
-				if ( ! empty( $args['title'] ) ) {
1429
-					// if its a shortcode and there is a title try to grab the title wrappers
1430
-					$shortcode_args = array( 'before_title' => '', 'after_title' => '' );
1431
-					if ( empty( $instance ) ) {
1432
-						global $wp_registered_sidebars;
1433
-						if ( ! empty( $wp_registered_sidebars ) ) {
1434
-							foreach ( $wp_registered_sidebars as $sidebar ) {
1435
-								if ( ! empty( $sidebar['before_title'] ) ) {
1436
-									$shortcode_args['before_title'] = $sidebar['before_title'];
1437
-									$shortcode_args['after_title']  = $sidebar['after_title'];
1438
-									break;
1439
-								}
1440
-							}
1441
-						}
1442
-					}
1443
-					$output .= $this->output_title( $shortcode_args, $args );
1444
-				}
1445
-				$output .= $main_content;
1446
-				$output .= '</div>';
1447
-			} elseif ( $main_content && $no_wrap ) {
1448
-				$output .= $main_content;
1449
-			}
1412
+            $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
1413
+            $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
1450 1414
 
1451
-			// if preview show a placeholder if empty
1452
-			if ( $this->is_preview() && $output == '' ) {
1453
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
1454
-			}
1415
+            $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
1416
+            $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
1455 1417
 
1456
-			return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
1457
-		}
1418
+            $shortcode_args = array();
1419
+            $output         = '';
1420
+            $no_wrap        = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1421
+            if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) {
1422
+                $no_wrap = true;
1423
+            }
1424
+            $main_content = $this->output( $args, $shortcode_args, $content );
1425
+            if ( $main_content && ! $no_wrap ) {
1426
+                // wrap the shortcode in a div with the same class as the widget
1427
+                $output .= '<div class="' . $class . '" ' . $attrs . '>';
1428
+                if ( ! empty( $args['title'] ) ) {
1429
+                    // if its a shortcode and there is a title try to grab the title wrappers
1430
+                    $shortcode_args = array( 'before_title' => '', 'after_title' => '' );
1431
+                    if ( empty( $instance ) ) {
1432
+                        global $wp_registered_sidebars;
1433
+                        if ( ! empty( $wp_registered_sidebars ) ) {
1434
+                            foreach ( $wp_registered_sidebars as $sidebar ) {
1435
+                                if ( ! empty( $sidebar['before_title'] ) ) {
1436
+                                    $shortcode_args['before_title'] = $sidebar['before_title'];
1437
+                                    $shortcode_args['after_title']  = $sidebar['after_title'];
1438
+                                    break;
1439
+                                }
1440
+                            }
1441
+                        }
1442
+                    }
1443
+                    $output .= $this->output_title( $shortcode_args, $args );
1444
+                }
1445
+                $output .= $main_content;
1446
+                $output .= '</div>';
1447
+            } elseif ( $main_content && $no_wrap ) {
1448
+                $output .= $main_content;
1449
+            }
1458 1450
 
1459
-		/**
1460
-		 * Placeholder text to show if output is empty and we are on a preview/builder page.
1461
-		 *
1462
-		 * @param string $name
1463
-		 *
1464
-		 * @return string
1465
-		 */
1466
-		public function preview_placeholder_text( $name = '' ) {
1467
-			return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf( __( 'Placeholder for: %s' ), $name ) . "</div>";
1468
-		}
1451
+            // if preview show a placeholder if empty
1452
+            if ( $this->is_preview() && $output == '' ) {
1453
+                $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
1454
+            }
1469 1455
 
1470
-		/**
1471
-		 * Sometimes booleans values can be turned to strings, so we fix that.
1472
-		 *
1473
-		 * @param $options
1474
-		 *
1475
-		 * @return mixed
1476
-		 */
1477
-		public function string_to_bool( $options ) {
1478
-			// convert bool strings to booleans
1479
-			foreach ( $options as $key => $val ) {
1480
-				if ( $val == 'false' ) {
1481
-					$options[ $key ] = false;
1482
-				} elseif ( $val == 'true' ) {
1483
-					$options[ $key ] = true;
1484
-				}
1485
-			}
1456
+            return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
1457
+        }
1486 1458
 
1487
-			return $options;
1488
-		}
1459
+        /**
1460
+         * Placeholder text to show if output is empty and we are on a preview/builder page.
1461
+         *
1462
+         * @param string $name
1463
+         *
1464
+         * @return string
1465
+         */
1466
+        public function preview_placeholder_text( $name = '' ) {
1467
+            return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf( __( 'Placeholder for: %s' ), $name ) . "</div>";
1468
+        }
1489 1469
 
1490
-		/**
1491
-		 * Get the argument values that are also filterable.
1492
-		 *
1493
-		 * @param $instance
1494
-		 *
1495
-		 * @return array
1496
-		 *@since 1.0.12 Don't set checkbox default value if the value is empty.
1497
-		 *
1498
-		 */
1499
-		public function argument_values( $instance ) {
1500
-			$argument_values = array();
1501
-
1502
-			// set widget instance
1503
-			$this->instance = $instance;
1504
-
1505
-			if ( empty( $this->arguments ) ) {
1506
-				$this->arguments = $this->get_arguments();
1507
-			}
1470
+        /**
1471
+         * Sometimes booleans values can be turned to strings, so we fix that.
1472
+         *
1473
+         * @param $options
1474
+         *
1475
+         * @return mixed
1476
+         */
1477
+        public function string_to_bool( $options ) {
1478
+            // convert bool strings to booleans
1479
+            foreach ( $options as $key => $val ) {
1480
+                if ( $val == 'false' ) {
1481
+                    $options[ $key ] = false;
1482
+                } elseif ( $val == 'true' ) {
1483
+                    $options[ $key ] = true;
1484
+                }
1485
+            }
1508 1486
 
1509
-			if ( ! empty( $this->arguments ) ) {
1510
-				foreach ( $this->arguments as $key => $args ) {
1511
-					// set the input name from the key
1512
-					$args['name'] = $key;
1513
-					//
1514
-					$argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
1515
-					if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
1516
-						// don't set default for an empty checkbox
1517
-					} elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
1518
-						$argument_values[ $key ] = $args['default'];
1519
-					}
1520
-				}
1521
-			}
1487
+            return $options;
1488
+        }
1522 1489
 
1523
-			return $argument_values;
1524
-		}
1490
+        /**
1491
+         * Get the argument values that are also filterable.
1492
+         *
1493
+         * @param $instance
1494
+         *
1495
+         * @return array
1496
+         *@since 1.0.12 Don't set checkbox default value if the value is empty.
1497
+         *
1498
+         */
1499
+        public function argument_values( $instance ) {
1500
+            $argument_values = array();
1525 1501
 
1526
-		/**
1527
-		 * Set arguments in super duper.
1528
-		 *
1529
-		 * @return array Set arguments.
1530
-		 *@since 1.0.0
1531
-		 *
1532
-		 */
1533
-		public function set_arguments() {
1534
-			return $this->arguments;
1535
-		}
1502
+            // set widget instance
1503
+            $this->instance = $instance;
1536 1504
 
1537
-		/**
1538
-		 * Get arguments in super duper.
1539
-		 *
1540
-		 * @return array Get arguments.
1541
-		 *@since 1.0.0
1542
-		 *
1543
-		 */
1544
-		public function get_arguments() {
1545
-			if ( empty( $this->arguments ) ) {
1546
-				$this->arguments = $this->set_arguments();
1547
-			}
1505
+            if ( empty( $this->arguments ) ) {
1506
+                $this->arguments = $this->get_arguments();
1507
+            }
1548 1508
 
1549
-			$this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
1550
-			$this->arguments = $this->add_name_from_key( $this->arguments, true );
1509
+            if ( ! empty( $this->arguments ) ) {
1510
+                foreach ( $this->arguments as $key => $args ) {
1511
+                    // set the input name from the key
1512
+                    $args['name'] = $key;
1513
+                    //
1514
+                    $argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
1515
+                    if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
1516
+                        // don't set default for an empty checkbox
1517
+                    } elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
1518
+                        $argument_values[ $key ] = $args['default'];
1519
+                    }
1520
+                }
1521
+            }
1551 1522
 
1552
-			return $this->arguments;
1553
-		}
1523
+            return $argument_values;
1524
+        }
1554 1525
 
1555
-		/**
1556
-		 * This is the main output class for all 3 items, widget, shortcode and block, it is extended in the calling class.
1557
-		 *
1558
-		 * @param array $args
1559
-		 * @param array $widget_args
1560
-		 * @param string $content
1561
-		 */
1562
-		public function output( $args = array(), $widget_args = array(), $content = '' ) {
1526
+        /**
1527
+         * Set arguments in super duper.
1528
+         *
1529
+         * @return array Set arguments.
1530
+         *@since 1.0.0
1531
+         *
1532
+         */
1533
+        public function set_arguments() {
1534
+            return $this->arguments;
1535
+        }
1563 1536
 
1564
-		}
1537
+        /**
1538
+         * Get arguments in super duper.
1539
+         *
1540
+         * @return array Get arguments.
1541
+         *@since 1.0.0
1542
+         *
1543
+         */
1544
+        public function get_arguments() {
1545
+            if ( empty( $this->arguments ) ) {
1546
+                $this->arguments = $this->set_arguments();
1547
+            }
1565 1548
 
1566
-		/**
1567
-		 * Add the dynamic block code inline when the wp-block in enqueued.
1568
-		 */
1569
-		public function register_block() {
1570
-			wp_add_inline_script( 'wp-blocks', $this->block() );
1571
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
1572
-				wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() );
1573
-			}
1574
-		}
1549
+            $this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
1550
+            $this->arguments = $this->add_name_from_key( $this->arguments, true );
1575 1551
 
1576
-		/**
1577
-		 * Check if we need to show advanced options.
1578
-		 *
1579
-		 * @return bool
1580
-		 */
1581
-		public function block_show_advanced() {
1582
-
1583
-			$show      = false;
1584
-			$arguments = $this->get_arguments();
1585
-
1586
-			if ( ! empty( $arguments ) ) {
1587
-				foreach ( $arguments as $argument ) {
1588
-					if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1589
-						$show = true;
1590
-						break; // no need to continue if we know we have it
1591
-					}
1592
-				}
1593
-			}
1552
+            return $this->arguments;
1553
+        }
1594 1554
 
1595
-			return $show;
1596
-		}
1555
+        /**
1556
+         * This is the main output class for all 3 items, widget, shortcode and block, it is extended in the calling class.
1557
+         *
1558
+         * @param array $args
1559
+         * @param array $widget_args
1560
+         * @param string $content
1561
+         */
1562
+        public function output( $args = array(), $widget_args = array(), $content = '' ) {
1597 1563
 
1598
-		/**
1599
-		 * Get the url path to the current folder.
1600
-		 *
1601
-		 * @return string
1602
-		 */
1603
-		public function get_url() {
1604
-			$url = $this->url;
1605
-
1606
-			if ( ! $url ) {
1607
-				$content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1608
-				$content_url = untrailingslashit( WP_CONTENT_URL );
1609
-
1610
-				// Replace http:// to https://.
1611
-				if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1612
-					$content_url = str_replace( 'http://', 'https://', $content_url );
1613
-				}
1564
+        }
1614 1565
 
1615
-				// Check if we are inside a plugin
1616
-				$file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1617
-				$url = str_replace( $content_dir, $content_url, $file_dir );
1618
-				$url = trailingslashit( $url );
1619
-				$this->url = $url;
1620
-			}
1566
+        /**
1567
+         * Add the dynamic block code inline when the wp-block in enqueued.
1568
+         */
1569
+        public function register_block() {
1570
+            wp_add_inline_script( 'wp-blocks', $this->block() );
1571
+            if ( class_exists( 'SiteOrigin_Panels' ) ) {
1572
+                wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() );
1573
+            }
1574
+        }
1621 1575
 
1622
-			return $url;
1623
-		}
1576
+        /**
1577
+         * Check if we need to show advanced options.
1578
+         *
1579
+         * @return bool
1580
+         */
1581
+        public function block_show_advanced() {
1624 1582
 
1625
-		/**
1626
-		 * Get the url path to the current folder.
1627
-		 *
1628
-		 * @return string
1629
-		 */
1630
-		public function get_url_old() {
1583
+            $show      = false;
1584
+            $arguments = $this->get_arguments();
1631 1585
 
1632
-			$url = $this->url;
1586
+            if ( ! empty( $arguments ) ) {
1587
+                foreach ( $arguments as $argument ) {
1588
+                    if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1589
+                        $show = true;
1590
+                        break; // no need to continue if we know we have it
1591
+                    }
1592
+                }
1593
+            }
1633 1594
 
1634
-			if ( ! $url ) {
1635
-				// check if we are inside a plugin
1636
-				$file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
1595
+            return $show;
1596
+        }
1637 1597
 
1638
-				$dir_parts = explode( "/wp-content/", $file_dir );
1639
-				$url_parts = explode( "/wp-content/", plugins_url() );
1598
+        /**
1599
+         * Get the url path to the current folder.
1600
+         *
1601
+         * @return string
1602
+         */
1603
+        public function get_url() {
1604
+            $url = $this->url;
1640 1605
 
1641
-				if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
1642
-					$url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
1643
-					$this->url = $url;
1644
-				}
1645
-			}
1606
+            if ( ! $url ) {
1607
+                $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1608
+                $content_url = untrailingslashit( WP_CONTENT_URL );
1646 1609
 
1610
+                // Replace http:// to https://.
1611
+                if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1612
+                    $content_url = str_replace( 'http://', 'https://', $content_url );
1613
+                }
1647 1614
 
1648
-			return $url;
1649
-		}
1615
+                // Check if we are inside a plugin
1616
+                $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1617
+                $url = str_replace( $content_dir, $content_url, $file_dir );
1618
+                $url = trailingslashit( $url );
1619
+                $this->url = $url;
1620
+            }
1650 1621
 
1651
-		/**
1652
-		 * Generate the block icon.
1653
-		 *
1654
-		 * Enables the use of Font Awesome icons.
1655
-		 *
1656
-		 * @note xlink:href is actually deprecated but href is not supported by all so we use both.
1657
-		 *
1658
-		 * @param $icon
1659
-		 *
1660
-		 * @return string
1661
-		 *@since 1.1.0
1662
-		 */
1663
-		public function get_block_icon( $icon ) {
1664
-
1665
-			// check if we have a Font Awesome icon
1666
-			$fa_type = '';
1667
-			if ( substr( $icon, 0, 7 ) === "fas fa-" ) {
1668
-				$fa_type = 'solid';
1669
-			} elseif ( substr( $icon, 0, 7 ) === "far fa-" ) {
1670
-				$fa_type = 'regular';
1671
-			} elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) {
1672
-				$fa_type = 'brands';
1673
-			} else {
1674
-				$icon = "'" . $icon . "'";
1675
-			}
1622
+            return $url;
1623
+        }
1676 1624
 
1677
-			// set the icon if we found one
1678
-			if ( $fa_type ) {
1679
-				$fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon );
1680
-				$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 . "'}))";
1681
-			}
1625
+        /**
1626
+         * Get the url path to the current folder.
1627
+         *
1628
+         * @return string
1629
+         */
1630
+        public function get_url_old() {
1682 1631
 
1683
-			return $icon;
1684
-		}
1632
+            $url = $this->url;
1633
+
1634
+            if ( ! $url ) {
1635
+                // check if we are inside a plugin
1636
+                $file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
1637
+
1638
+                $dir_parts = explode( "/wp-content/", $file_dir );
1639
+                $url_parts = explode( "/wp-content/", plugins_url() );
1640
+
1641
+                if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
1642
+                    $url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
1643
+                    $this->url = $url;
1644
+                }
1645
+            }
1646
+
1647
+
1648
+            return $url;
1649
+        }
1650
+
1651
+        /**
1652
+         * Generate the block icon.
1653
+         *
1654
+         * Enables the use of Font Awesome icons.
1655
+         *
1656
+         * @note xlink:href is actually deprecated but href is not supported by all so we use both.
1657
+         *
1658
+         * @param $icon
1659
+         *
1660
+         * @return string
1661
+         *@since 1.1.0
1662
+         */
1663
+        public function get_block_icon( $icon ) {
1664
+
1665
+            // check if we have a Font Awesome icon
1666
+            $fa_type = '';
1667
+            if ( substr( $icon, 0, 7 ) === "fas fa-" ) {
1668
+                $fa_type = 'solid';
1669
+            } elseif ( substr( $icon, 0, 7 ) === "far fa-" ) {
1670
+                $fa_type = 'regular';
1671
+            } elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) {
1672
+                $fa_type = 'brands';
1673
+            } else {
1674
+                $icon = "'" . $icon . "'";
1675
+            }
1685 1676
 
1686
-		public function group_arguments( $arguments ) {
1677
+            // set the icon if we found one
1678
+            if ( $fa_type ) {
1679
+                $fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon );
1680
+                $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 . "'}))";
1681
+            }
1682
+
1683
+            return $icon;
1684
+        }
1685
+
1686
+        public function group_arguments( $arguments ) {
1687 1687
 //			echo '###';print_r($arguments);
1688
-			if ( ! empty( $arguments ) ) {
1689
-				$temp_arguments = array();
1690
-				$general        = __( "General" );
1691
-				$add_sections   = false;
1692
-				foreach ( $arguments as $key => $args ) {
1693
-					if ( isset( $args['group'] ) ) {
1694
-						$temp_arguments[ $args['group'] ][ $key ] = $args;
1695
-						$add_sections                             = true;
1696
-					} else {
1697
-						$temp_arguments[ $general ][ $key ] = $args;
1698
-					}
1699
-				}
1688
+            if ( ! empty( $arguments ) ) {
1689
+                $temp_arguments = array();
1690
+                $general        = __( "General" );
1691
+                $add_sections   = false;
1692
+                foreach ( $arguments as $key => $args ) {
1693
+                    if ( isset( $args['group'] ) ) {
1694
+                        $temp_arguments[ $args['group'] ][ $key ] = $args;
1695
+                        $add_sections                             = true;
1696
+                    } else {
1697
+                        $temp_arguments[ $general ][ $key ] = $args;
1698
+                    }
1699
+                }
1700 1700
 
1701
-				// only add sections if more than one
1702
-				if ( $add_sections ) {
1703
-					$arguments = $temp_arguments;
1704
-				}
1705
-			}
1701
+                // only add sections if more than one
1702
+                if ( $add_sections ) {
1703
+                    $arguments = $temp_arguments;
1704
+                }
1705
+            }
1706 1706
 
1707 1707
 //			echo '###';print_r($arguments);
1708
-			return $arguments;
1709
-		}
1708
+            return $arguments;
1709
+        }
1710 1710
 
1711 1711
 
1712
-		/**
1713
-		 * Output the JS for building the dynamic Guntenberg block.
1714
-		 *
1715
-		 * @return mixed
1716
-		 *@since 1.0.9 Save numbers as numbers and not strings.
1717
-		 * @since 1.1.0 Font Awesome classes can be used for icons.
1718
-		 * @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.
1719
-		 */
1720
-		public function block() {
1712
+        /**
1713
+         * Output the JS for building the dynamic Guntenberg block.
1714
+         *
1715
+         * @return mixed
1716
+         *@since 1.0.9 Save numbers as numbers and not strings.
1717
+         * @since 1.1.0 Font Awesome classes can be used for icons.
1718
+         * @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.
1719
+         */
1720
+        public function block() {
1721 1721
             global $sd_is_js_functions_loaded;
1722 1722
 
1723
-			ob_start();
1723
+            ob_start();
1724 1724
 
1725
-			$show_advanced = $this->block_show_advanced();
1725
+            $show_advanced = $this->block_show_advanced();
1726 1726
 
1727 1727
 
1728
-			?>
1728
+            ?>
1729 1729
 			<script>
1730 1730
 
1731 1731
 			<?php
1732
-			if(!$sd_is_js_functions_loaded){
1732
+            if(!$sd_is_js_functions_loaded){
1733 1733
                 $sd_is_js_functions_loaded = true;
1734 1734
             ?>
1735 1735
 
@@ -2103,10 +2103,10 @@  discard block
 block discarded – undo
2103 2103
 
2104 2104
             }
2105 2105
 
2106
-			if(method_exists($this,'block_global_js')){
2107
-					echo $this->block_global_js();
2108
-			}
2109
-			?>
2106
+            if(method_exists($this,'block_global_js')){
2107
+                    echo $this->block_global_js();
2108
+            }
2109
+            ?>
2110 2110
 
2111 2111
 jQuery(function() {
2112 2112
 
@@ -2156,14 +2156,14 @@  discard block
 block discarded – undo
2156 2156
 						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/.
2157 2157
 						supports: {
2158 2158
 							<?php
2159
-							if ( isset( $this->options['block-supports'] ) ) {
2160
-								echo $this->array_to_attributes( $this->options['block-supports'] );
2161
-							}
2162
-							?>
2159
+                            if ( isset( $this->options['block-supports'] ) ) {
2160
+                                echo $this->array_to_attributes( $this->options['block-supports'] );
2161
+                            }
2162
+                            ?>
2163 2163
 						},
2164 2164
 						<?php
2165
-						if ( isset( $this->options['block-label'] ) ) {
2166
-						?>
2165
+                        if ( isset( $this->options['block-label'] ) ) {
2166
+                        ?>
2167 2167
 						__experimentalLabel( attributes, { context } ) {
2168 2168
                             return <?php echo $this->options['block-label']; ?>;
2169 2169
                         },
@@ -2172,7 +2172,7 @@  discard block
 block discarded – undo
2172 2172
                         ?>
2173 2173
 						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.
2174 2174
 						<?php if ( isset( $this->options['block-keywords'] ) ) {
2175
-						echo "keywords : " . $this->options['block-keywords'] . ",";
2175
+                        echo "keywords : " . $this->options['block-keywords'] . ",";
2176 2176
 
2177 2177
 //						// block hover preview.
2178 2178
 //						$example_args = array();
@@ -2197,86 +2197,86 @@  discard block
 block discarded – undo
2197 2197
 
2198 2198
                         }
2199 2199
 
2200
-						// maybe set no_wrap
2201
-						$no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
2202
-						if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) {
2203
-							$no_wrap = true;
2204
-						}
2205
-						if ( $no_wrap ) {
2206
-							$this->options['block-wrap'] = '';
2207
-						}
2200
+                        // maybe set no_wrap
2201
+                        $no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
2202
+                        if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) {
2203
+                            $no_wrap = true;
2204
+                        }
2205
+                        if ( $no_wrap ) {
2206
+                            $this->options['block-wrap'] = '';
2207
+                        }
2208 2208
 
2209
-						// maybe load the drag/drop functions.
2210
-						$img_drag_drop = false;
2209
+                        // maybe load the drag/drop functions.
2210
+                        $img_drag_drop = false;
2211 2211
 
2212
-						$show_alignment = false;
2213
-						// align feature
2214
-						/*echo "supports: {";
2212
+                        $show_alignment = false;
2213
+                        // align feature
2214
+                        /*echo "supports: {";
2215 2215
 						echo "	align: true,";
2216 2216
 						echo "  html: false";
2217 2217
 						echo "},";*/
2218 2218
 
2219
-						if ( ! empty( $this->arguments ) ) {
2220
-							echo "attributes : {";
2219
+                        if ( ! empty( $this->arguments ) ) {
2220
+                            echo "attributes : {";
2221 2221
 
2222
-							if ( $show_advanced ) {
2223
-								echo "show_advanced: {";
2224
-								echo "	type: 'boolean',";
2225
-								echo "  default: false,";
2226
-								echo "},";
2227
-							}
2222
+                            if ( $show_advanced ) {
2223
+                                echo "show_advanced: {";
2224
+                                echo "	type: 'boolean',";
2225
+                                echo "  default: false,";
2226
+                                echo "},";
2227
+                            }
2228 2228
 
2229
-							// block wrap element
2230
-							if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this?
2231
-								echo "block_wrap: {";
2232
-								echo "	type: 'string',";
2233
-								echo "  default: '" . esc_attr( $this->options['block-wrap'] ) . "',";
2234
-								echo "},";
2235
-							}
2229
+                            // block wrap element
2230
+                            if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this?
2231
+                                echo "block_wrap: {";
2232
+                                echo "	type: 'string',";
2233
+                                echo "  default: '" . esc_attr( $this->options['block-wrap'] ) . "',";
2234
+                                echo "},";
2235
+                            }
2236 2236
 
2237 2237
 
2238 2238
 
2239
-							foreach ( $this->arguments as $key => $args ) {
2239
+                            foreach ( $this->arguments as $key => $args ) {
2240 2240
 
2241
-								if( $args['type'] == 'image' ||  $args['type'] == 'images' ){
2242
-									$img_drag_drop = true;
2243
-								}
2241
+                                if( $args['type'] == 'image' ||  $args['type'] == 'images' ){
2242
+                                    $img_drag_drop = true;
2243
+                                }
2244 2244
 
2245
-								// set if we should show alignment
2246
-								if ( $key == 'alignment' ) {
2247
-									$show_alignment = true;
2248
-								}
2245
+                                // set if we should show alignment
2246
+                                if ( $key == 'alignment' ) {
2247
+                                    $show_alignment = true;
2248
+                                }
2249 2249
 
2250
-								$extra = '';
2250
+                                $extra = '';
2251 2251
 
2252
-								if ( $args['type'] == 'notice' ||  $args['type'] == 'tab' ) {
2253
-									continue;
2254
-								}
2255
-								elseif ( $args['type'] == 'checkbox' ) {
2256
-									$type    = 'boolean';
2257
-									$default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false';
2258
-								} elseif ( $args['type'] == 'number' ) {
2259
-									$type    = 'number';
2260
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2261
-								} elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
2262
-									$type = 'array';
2263
-									if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
2264
-										$default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]";
2265
-									} else {
2266
-										$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2267
-									}
2268
-								} elseif ( $args['type'] == 'tagselect' ) {
2269
-									$type    = 'array';
2270
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2271
-								} elseif ( $args['type'] == 'multiselect' ) {
2272
-									$type    = 'array';
2273
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2274
-								} elseif ( $args['type'] == 'image_xy' ) {
2275
-									$type    = 'object';
2276
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2277
-								} elseif ( $args['type'] == 'image' ) {
2278
-									$type    = 'string';
2279
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2252
+                                if ( $args['type'] == 'notice' ||  $args['type'] == 'tab' ) {
2253
+                                    continue;
2254
+                                }
2255
+                                elseif ( $args['type'] == 'checkbox' ) {
2256
+                                    $type    = 'boolean';
2257
+                                    $default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false';
2258
+                                } elseif ( $args['type'] == 'number' ) {
2259
+                                    $type    = 'number';
2260
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2261
+                                } elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
2262
+                                    $type = 'array';
2263
+                                    if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
2264
+                                        $default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]";
2265
+                                    } else {
2266
+                                        $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2267
+                                    }
2268
+                                } elseif ( $args['type'] == 'tagselect' ) {
2269
+                                    $type    = 'array';
2270
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2271
+                                } elseif ( $args['type'] == 'multiselect' ) {
2272
+                                    $type    = 'array';
2273
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2274
+                                } elseif ( $args['type'] == 'image_xy' ) {
2275
+                                    $type    = 'object';
2276
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2277
+                                } elseif ( $args['type'] == 'image' ) {
2278
+                                    $type    = 'string';
2279
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2280 2280
 
2281 2281
                                     // add a field for ID
2282 2282
 //                                    echo $key . "_id : {";
@@ -2286,25 +2286,25 @@  discard block
 block discarded – undo
2286 2286
 //                                    echo "type : 'object',";
2287 2287
 //                                    echo "},";
2288 2288
 
2289
-								} else {
2290
-									$type    = !empty($args['hidden_type']) ? esc_attr($args['hidden_type']) : 'string';
2291
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2289
+                                } else {
2290
+                                    $type    = !empty($args['hidden_type']) ? esc_attr($args['hidden_type']) : 'string';
2291
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2292 2292
 
2293
-								}
2294
-								echo $key . " : {";
2295
-								echo "type : '$type',";
2296
-								echo "default : $default,";
2297
-								echo "},";
2298
-							}
2293
+                                }
2294
+                                echo $key . " : {";
2295
+                                echo "type : '$type',";
2296
+                                echo "default : $default,";
2297
+                                echo "},";
2298
+                            }
2299 2299
 
2300
-							echo "content : {type : 'string',default: 'Please select the attributes in the block settings'},";
2301
-							echo "className: { type: 'string', default: '' },";
2300
+                            echo "content : {type : 'string',default: 'Please select the attributes in the block settings'},";
2301
+                            echo "className: { type: 'string', default: '' },";
2302 2302
 
2303
-							echo "},";
2303
+                            echo "},";
2304 2304
 
2305
-						}
2305
+                        }
2306 2306
 
2307
-						?>
2307
+                        ?>
2308 2308
 
2309 2309
 						// The "edit" property must be a valid function.
2310 2310
 						edit: function (props) {
@@ -2404,9 +2404,9 @@  discard block
 block discarded – undo
2404 2404
 
2405 2405
 							var $value = '';
2406 2406
 							<?php
2407
-							// if we have a post_type and a category then link them
2408
-							if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){
2409
-							?>
2407
+                            // if we have a post_type and a category then link them
2408
+                            if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){
2409
+                            ?>
2410 2410
 							if(typeof(prev_attributes[props.clientId]) != 'undefined' ){
2411 2411
 								$pt = props.attributes.post_type;
2412 2412
 								if(post_type_rest_slugs.length){
@@ -2469,7 +2469,7 @@  discard block
 block discarded – undo
2469 2469
 <?php
2470 2470
 $current_screen = function_exists('get_current_screen') ? get_current_screen() : '';
2471 2471
 if(!empty($current_screen->base) && $current_screen->base==='widgets'){
2472
-	echo 'const { deviceType } = "";';
2472
+    echo 'const { deviceType } = "";';
2473 2473
 }else{
2474 2474
 ?>
2475 2475
 /** Get device type const. */
@@ -2503,8 +2503,8 @@  discard block
 block discarded – undo
2503 2503
 										'attributes': props.attributes,
2504 2504
 										'block_parent_name': parentBlocks.length ? parentBlocks[parentBlocks.length - 1].name : '',
2505 2505
 										'post_id': <?php global $post; if ( isset( $post->ID ) ) {
2506
-										echo $post->ID;
2507
-									}else{echo '0';}?>,
2506
+                                        echo $post->ID;
2507
+                                    }else{echo '0';}?>,
2508 2508
 										'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
2509 2509
 									};
2510 2510
 
@@ -2581,10 +2581,10 @@  discard block
 block discarded – undo
2581 2581
 
2582 2582
 									<?php
2583 2583
 
2584
-									if(! empty( $this->arguments )){
2584
+                                    if(! empty( $this->arguments )){
2585 2585
 
2586
-									if ( $show_advanced ) {
2587
-									?>
2586
+                                    if ( $show_advanced ) {
2587
+                                    ?>
2588 2588
 									el('div', {
2589 2589
 											style: {'padding-left': '16px','padding-right': '16px'}
2590 2590
 										},
@@ -2602,146 +2602,146 @@  discard block
 block discarded – undo
2602 2602
 									,
2603 2603
 									<?php
2604 2604
 
2605
-									}
2605
+                                    }
2606 2606
 
2607
-								//	print_r( $this->arguments);
2607
+                                //	print_r( $this->arguments);
2608 2608
 
2609
-									//echo '####';
2609
+                                    //echo '####';
2610 2610
 
2611
-									$arguments = $this->group_arguments( $this->arguments );
2611
+                                    $arguments = $this->group_arguments( $this->arguments );
2612 2612
 //print_r($arguments ); exit;
2613
-									// Do we have sections?
2614
-									$has_sections = $arguments == $this->arguments ? false : true;
2613
+                                    // Do we have sections?
2614
+                                    $has_sections = $arguments == $this->arguments ? false : true;
2615 2615
 
2616 2616
 
2617
-									if($has_sections){
2618
-									$panel_count = 0;
2619
-									$open_tab = '';
2617
+                                    if($has_sections){
2618
+                                    $panel_count = 0;
2619
+                                    $open_tab = '';
2620 2620
 
2621
-									$open_tab_groups = array();
2622
-									$used_tabs = array();
2623
-									foreach($arguments as $key => $args){
2621
+                                    $open_tab_groups = array();
2622
+                                    $used_tabs = array();
2623
+                                    foreach($arguments as $key => $args){
2624 2624
 
2625
-										$close_tab = false;
2626
-										$close_tabs = false;
2625
+                                        $close_tab = false;
2626
+                                        $close_tabs = false;
2627 2627
 
2628
-										 if(!empty($this->options['block_group_tabs'])) {
2629
-											foreach($this->options['block_group_tabs'] as $tab_name => $tab_args){
2630
-												if(in_array($key,$tab_args['groups'])){
2628
+                                            if(!empty($this->options['block_group_tabs'])) {
2629
+                                            foreach($this->options['block_group_tabs'] as $tab_name => $tab_args){
2630
+                                                if(in_array($key,$tab_args['groups'])){
2631 2631
 
2632
-													$open_tab_groups[] = $key;
2632
+                                                    $open_tab_groups[] = $key;
2633 2633
 
2634
-													if($open_tab != $tab_name){
2635
-														$tab_args['tab']['tabs_open'] = $open_tab == '' ? true : false;
2636
-														$tab_args['tab']['open'] = true;
2634
+                                                    if($open_tab != $tab_name){
2635
+                                                        $tab_args['tab']['tabs_open'] = $open_tab == '' ? true : false;
2636
+                                                        $tab_args['tab']['open'] = true;
2637 2637
 
2638
-														$this->block_tab_start( '', $tab_args );
2638
+                                                        $this->block_tab_start( '', $tab_args );
2639 2639
 //														echo '###open'.$tab_name;print_r($tab_args);
2640
-														$open_tab = $tab_name;
2641
-														$used_tabs[] = $tab_name;
2642
-													}
2640
+                                                        $open_tab = $tab_name;
2641
+                                                        $used_tabs[] = $tab_name;
2642
+                                                    }
2643 2643
 
2644
-													if($open_tab_groups == $tab_args['groups']){
2645
-														//$open_tab = '';
2646
-														$close_tab = true;
2647
-														$open_tab_groups = array();
2644
+                                                    if($open_tab_groups == $tab_args['groups']){
2645
+                                                        //$open_tab = '';
2646
+                                                        $close_tab = true;
2647
+                                                        $open_tab_groups = array();
2648 2648
 
2649 2649
 //													print_r(array_keys($this->options['block_group_tabs']));echo '####';print_r($used_tabs);
2650
-													if($used_tabs == array_keys($this->options['block_group_tabs'])){
2650
+                                                    if($used_tabs == array_keys($this->options['block_group_tabs'])){
2651 2651
 //														echo '@@@';
2652
-															$close_tabs = true;
2653
-														}
2654
-													}
2652
+                                                            $close_tabs = true;
2653
+                                                        }
2654
+                                                    }
2655 2655
 
2656
-												}
2657
-											}
2658
-										}
2656
+                                                }
2657
+                                            }
2658
+                                        }
2659 2659
 
2660 2660
 //
2661 2661
 
2662
-									//	print_r($arguments);exit;
2662
+                                    //	print_r($arguments);exit;
2663 2663
 
2664
-										?>
2664
+                                        ?>
2665 2665
 										el(wp.components.PanelBody, {
2666 2666
 												title: '<?php esc_attr_e( $key ); ?>',
2667 2667
 												initialOpen: <?php if ( $panel_count ) {
2668
-												echo "false";
2669
-											} else {
2670
-												echo "true";
2671
-											}?>
2668
+                                                echo "false";
2669
+                                            } else {
2670
+                                                echo "true";
2671
+                                            }?>
2672 2672
 											},
2673 2673
 											<?php
2674 2674
 
2675 2675
 
2676 2676
 
2677
-											foreach ( $args as $k => $a ) {
2677
+                                            foreach ( $args as $k => $a ) {
2678 2678
 
2679
-												$this->block_tab_start( $k, $a );
2680
-												$this->block_row_start( $k, $a );
2681
-												$this->build_block_arguments( $k, $a );
2682
-												$this->block_row_end( $k, $a );
2683
-												$this->block_tab_end( $k, $a );
2684
-											}
2685
-											?>
2679
+                                                $this->block_tab_start( $k, $a );
2680
+                                                $this->block_row_start( $k, $a );
2681
+                                                $this->build_block_arguments( $k, $a );
2682
+                                                $this->block_row_end( $k, $a );
2683
+                                                $this->block_tab_end( $k, $a );
2684
+                                            }
2685
+                                            ?>
2686 2686
 										),
2687 2687
 										<?php
2688
-										$panel_count ++;
2688
+                                        $panel_count ++;
2689 2689
 
2690 2690
 
2691
-										if($close_tab || $close_tabs){
2692
-											$tab_args = array(
2693
-												'tab'	=> array(
2694
-													'tabs_close' => $close_tabs,
2695
-												'close' => true,
2696
-												)
2691
+                                        if($close_tab || $close_tabs){
2692
+                                            $tab_args = array(
2693
+                                                'tab'	=> array(
2694
+                                                    'tabs_close' => $close_tabs,
2695
+                                                'close' => true,
2696
+                                                )
2697 2697
 
2698
-											);
2699
-											$this->block_tab_end( '', $tab_args );
2698
+                                            );
2699
+                                            $this->block_tab_end( '', $tab_args );
2700 2700
 //											echo '###close'; print_r($tab_args);
2701
-											$panel_count = 0;
2702
-										}
2701
+                                            $panel_count = 0;
2702
+                                        }
2703 2703
 //
2704 2704
 
2705
-									}
2706
-									}else {
2707
-									?>
2705
+                                    }
2706
+                                    }else {
2707
+                                    ?>
2708 2708
 									el(wp.components.PanelBody, {
2709 2709
 											title: '<?php esc_attr_e( "Settings" ); ?>',
2710 2710
 											initialOpen: true
2711 2711
 										},
2712 2712
 										<?php
2713
-										foreach ( $this->arguments as $key => $args ) {
2714
-											$this->block_row_start( $key, $args );
2715
-											$this->build_block_arguments( $key, $args );
2716
-											$this->block_row_end( $key, $args );
2717
-										}
2718
-										?>
2713
+                                        foreach ( $this->arguments as $key => $args ) {
2714
+                                            $this->block_row_start( $key, $args );
2715
+                                            $this->build_block_arguments( $key, $args );
2716
+                                            $this->block_row_end( $key, $args );
2717
+                                        }
2718
+                                        ?>
2719 2719
 									),
2720 2720
 									<?php
2721
-									}
2721
+                                    }
2722 2722
 
2723
-									}
2724
-									?>
2723
+                                    }
2724
+                                    ?>
2725 2725
 
2726 2726
 								),
2727 2727
 
2728 2728
 								<?php
2729
-								// If the user sets block-output array then build it
2730
-								if ( ! empty( $this->options['block-output'] ) ) {
2731
-								$this->block_element( $this->options['block-output'] );
2732
-							}elseif(!empty($this->options['block-edit-return'])){
2733
-                                   echo $this->options['block-edit-return'];
2734
-							}else{
2735
-								// if no block-output is set then we try and get the shortcode html output via ajax.
2736
-								?>
2729
+                                // If the user sets block-output array then build it
2730
+                                if ( ! empty( $this->options['block-output'] ) ) {
2731
+                                $this->block_element( $this->options['block-output'] );
2732
+                            }elseif(!empty($this->options['block-edit-return'])){
2733
+                                    echo $this->options['block-edit-return'];
2734
+                            }else{
2735
+                                // if no block-output is set then we try and get the shortcode html output via ajax.
2736
+                                ?>
2737 2737
 								el('div', wp.blockEditor.useBlockProps({
2738 2738
 									dangerouslySetInnerHTML: {__html: onChangeContent()},
2739 2739
 									className: props.className,
2740 2740
 									style: {'minHeight': '30px'}
2741 2741
 								}))
2742 2742
 								<?php
2743
-								}
2744
-								?>
2743
+                                }
2744
+                                ?>
2745 2745
 							]; // end return
2746 2746
 
2747 2747
 							<?php
@@ -2760,11 +2760,11 @@  discard block
 block discarded – undo
2760 2760
 							$html = '';
2761 2761
 							<?php
2762 2762
 
2763
-							if(! empty( $this->arguments )){
2763
+                            if(! empty( $this->arguments )){
2764 2764
 
2765
-							foreach($this->arguments as $key => $args){
2766
-                               // if($args['type']=='tabs'){continue;}
2767
-							?>
2765
+                            foreach($this->arguments as $key => $args){
2766
+                                // if($args['type']=='tabs'){continue;}
2767
+                            ?>
2768 2768
 							if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
2769 2769
 								if ('<?php echo esc_attr( $key );?>' == 'html') {
2770 2770
 									$html = attr.<?php echo esc_attr( $key );?>;
@@ -2775,10 +2775,10 @@  discard block
 block discarded – undo
2775 2775
 								}
2776 2776
 							}
2777 2777
 							<?php
2778
-							}
2779
-							}
2778
+                            }
2779
+                            }
2780 2780
 
2781
-							?>
2781
+                            ?>
2782 2782
 							content += "]";
2783 2783
 
2784 2784
                             <?php
@@ -2825,7 +2825,7 @@  discard block
 block discarded – undo
2825 2825
 //                               $this->block_element( $this->options['block-output'], true );
2826 2826
 //                               echo ";";
2827 2827
 
2828
-                               ?>
2828
+                                ?>
2829 2829
                               return el(
2830 2830
                                    '',
2831 2831
                                    {},
@@ -2835,9 +2835,9 @@  discard block
 block discarded – undo
2835 2835
                                );
2836 2836
                                 <?php
2837 2837
 
2838
-							}elseif(!empty($this->options['block-save-return'])){
2839
-                                   echo 'return ' . $this->options['block-save-return'];
2840
-							}elseif(!empty($this->options['nested-block'])){
2838
+                            }elseif(!empty($this->options['block-save-return'])){
2839
+                                    echo 'return ' . $this->options['block-save-return'];
2840
+                            }elseif(!empty($this->options['nested-block'])){
2841 2841
                                 ?>
2842 2842
                               return el(
2843 2843
                                    '',
@@ -2847,22 +2847,22 @@  discard block
 block discarded – undo
2847 2847
                                    el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}})
2848 2848
                                );
2849 2849
                                 <?php
2850
-							}elseif(!empty( $this->options['block-save-return'] ) ){
2850
+                            }elseif(!empty( $this->options['block-save-return'] ) ){
2851 2851
                                 echo "return ". $this->options['block-edit-return'].";";
2852
-							}elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
2853
-							?>
2852
+                            }elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
2853
+                            ?>
2854 2854
 							return content;
2855 2855
 							<?php
2856
-							}else{
2857
-							?>
2856
+                            }else{
2857
+                            ?>
2858 2858
 							var block_wrap = 'div';
2859 2859
 							if (attr.hasOwnProperty("block_wrap")) {
2860 2860
 								block_wrap = attr.block_wrap;
2861 2861
 							}
2862 2862
 							return el(block_wrap, wp.blockEditor.useBlockProps.save( {dangerouslySetInnerHTML: {__html: content}, className: align} ));
2863 2863
 							<?php
2864
-							}
2865
-							?>
2864
+                            }
2865
+                            ?>
2866 2866
 
2867 2867
 
2868 2868
 						}
@@ -2876,29 +2876,29 @@  discard block
 block discarded – undo
2876 2876
                 });
2877 2877
 			</script>
2878 2878
 			<?php
2879
-			$output = ob_get_clean();
2879
+            $output = ob_get_clean();
2880 2880
 
2881
-			/*
2881
+            /*
2882 2882
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
2883 2883
 			 */
2884 2884
 
2885
-			return str_replace( array(
2886
-				'<script>',
2887
-				'</script>'
2888
-			), '', $output );
2889
-		}
2885
+            return str_replace( array(
2886
+                '<script>',
2887
+                '</script>'
2888
+            ), '', $output );
2889
+        }
2890 2890
 
2891 2891
 
2892 2892
 
2893
-		public function block_row_start($key, $args){
2893
+        public function block_row_start($key, $args){
2894 2894
 
2895
-			// check for row
2896
-			if(!empty($args['row'])){
2895
+            // check for row
2896
+            if(!empty($args['row'])){
2897 2897
 
2898
-				if(!empty($args['row']['open'])){
2898
+                if(!empty($args['row']['open'])){
2899 2899
 
2900
-				// element require
2901
-				$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
2900
+                // element require
2901
+                $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
2902 2902
                 $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
2903 2903
                 $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
2904 2904
                 $device_type_icon = '';
@@ -2909,10 +2909,10 @@  discard block
 block discarded – undo
2909 2909
                 }elseif($device_type=='Mobile'){
2910 2910
                     $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;"></span>';
2911 2911
                 }
2912
-				echo $element_require;
2912
+                echo $element_require;
2913 2913
                 echo $device_type_require;
2914 2914
 
2915
-					if(false){?><script><?php }?>
2915
+                    if(false){?><script><?php }?>
2916 2916
 						el('div', {
2917 2917
 								className: 'bsui components-base-control',
2918 2918
 							},
@@ -2950,51 +2950,51 @@  discard block
 block discarded – undo
2950 2950
 									},
2951 2951
 
2952 2952
 					<?php
2953
-					if(false){?></script><?php }
2954
-				}elseif(!empty($args['row']['close'])){
2955
-					if(false){?><script><?php }?>
2953
+                    if(false){?></script><?php }
2954
+                }elseif(!empty($args['row']['close'])){
2955
+                    if(false){?><script><?php }?>
2956 2956
 						el(
2957 2957
 							'div',
2958 2958
 							{
2959 2959
 								className: 'col pl-0',
2960 2960
 							},
2961 2961
 					<?php
2962
-					if(false){?></script><?php }
2963
-				}else{
2964
-					if(false){?><script><?php }?>
2962
+                    if(false){?></script><?php }
2963
+                }else{
2964
+                    if(false){?><script><?php }?>
2965 2965
 						el(
2966 2966
 							'div',
2967 2967
 							{
2968 2968
 								className: 'col pl-0 pr-2',
2969 2969
 							},
2970 2970
 					<?php
2971
-					if(false){?></script><?php }
2972
-				}
2971
+                    if(false){?></script><?php }
2972
+                }
2973 2973
 
2974
-			}
2974
+            }
2975 2975
 
2976
-		}
2976
+        }
2977 2977
 
2978
-		public function block_row_end($key, $args){
2978
+        public function block_row_end($key, $args){
2979 2979
 
2980
-			if(!empty($args['row'])){
2981
-				// maybe close
2982
-				if(!empty($args['row']['close'])){
2983
-					echo "))";
2984
-				}
2980
+            if(!empty($args['row'])){
2981
+                // maybe close
2982
+                if(!empty($args['row']['close'])){
2983
+                    echo "))";
2984
+                }
2985 2985
 
2986
-				echo "),";
2987
-			}
2988
-		}
2986
+                echo "),";
2987
+            }
2988
+        }
2989 2989
 
2990
-		public function block_tab_start($key, $args){
2990
+        public function block_tab_start($key, $args){
2991 2991
 
2992
-			// check for row
2993
-			if(!empty($args['tab'])){
2992
+            // check for row
2993
+            if(!empty($args['tab'])){
2994 2994
 
2995
-				if(!empty($args['tab']['tabs_open'])){
2995
+                if(!empty($args['tab']['tabs_open'])){
2996 2996
 
2997
-					if(false){?><script><?php }?>
2997
+                    if(false){?><script><?php }?>
2998 2998
 
2999 2999
 el('div',{className: 'bsui'},
3000 3000
 
@@ -3007,12 +3007,12 @@  discard block
 block discarded – undo
3007 3007
 										tabs: [
3008 3008
 
3009 3009
 					<?php
3010
-					if(false){?></script><?php }
3011
-				}
3010
+                    if(false){?></script><?php }
3011
+                }
3012 3012
 
3013
-				if(!empty($args['tab']['open'])){
3013
+                if(!empty($args['tab']['open'])){
3014 3014
 
3015
-					if(false){?><script><?php }?>
3015
+                    if(false){?><script><?php }?>
3016 3016
 							{
3017 3017
 												name: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>',
3018 3018
 												title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes( esc_attr( $args['tab']['title']) ); ?>'}}),
@@ -3021,23 +3021,23 @@  discard block
 block discarded – undo
3021 3021
 									className: 'components-base-control__help mb-0',
3022 3022
 									dangerouslySetInnerHTML: {__html:'<?php echo addslashes( $args['tab']['desc'] ); ?>'}
3023 3023
 								}),<?php }
3024
-					if(false){?></script><?php }
3025
-				}
3024
+                    if(false){?></script><?php }
3025
+                }
3026 3026
 
3027
-			}
3027
+            }
3028 3028
 
3029
-		}
3029
+        }
3030 3030
 
3031
-		public function block_tab_end($key, $args){
3031
+        public function block_tab_end($key, $args){
3032 3032
 
3033
-			if(!empty($args['tab'])){
3034
-				// maybe close
3035
-				if(!empty($args['tab']['close'])){
3036
-					echo ")}, /* tab close */";
3037
-				}
3033
+            if(!empty($args['tab'])){
3034
+                // maybe close
3035
+                if(!empty($args['tab']['close'])){
3036
+                    echo ")}, /* tab close */";
3037
+                }
3038 3038
 
3039
-				if(!empty($args['tab']['tabs_close'])){
3040
-					if(false){?><script><?php }?>
3039
+                if(!empty($args['tab']['tabs_close'])){
3040
+                    if(false){?><script><?php }?>
3041 3041
 							],
3042 3042
 									},
3043 3043
 									( tab ) => {
@@ -3047,21 +3047,21 @@  discard block
 block discarded – undo
3047 3047
 								}
3048 3048
 								)), /* tabs close */
3049 3049
 					<?php if(false){ ?></script><?php }
3050
-				}
3051
-			}
3052
-		}
3050
+                }
3051
+            }
3052
+        }
3053 3053
 
3054
-		public function build_block_arguments( $key, $args ) {
3055
-			$custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : '';
3056
-			$options           = '';
3057
-			$extra             = '';
3058
-			$require           = '';
3054
+        public function build_block_arguments( $key, $args ) {
3055
+            $custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : '';
3056
+            $options           = '';
3057
+            $extra             = '';
3058
+            $require           = '';
3059 3059
             $inside_elements   = '';
3060 3060
 
3061
-			// `content` is a protected and special argument
3062
-			if ( $key == 'content' ) {
3063
-				return;
3064
-			}
3061
+            // `content` is a protected and special argument
3062
+            if ( $key == 'content' ) {
3063
+                return;
3064
+            }
3065 3065
 
3066 3066
             $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
3067 3067
             $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
@@ -3074,51 +3074,51 @@  discard block
 block discarded – undo
3074 3074
                 $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3075 3075
             }
3076 3076
 
3077
-			// icon
3078
-			$icon = '';
3079
-			if( !empty( $args['icon'] ) ){
3080
-				$icon .= "el('div', {";
3081
-									$icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},";
3082
-									$icon .= "className: 'text-center',";
3083
-									$icon .= "title: '".addslashes( $args['title'] )."',";
3084
-								$icon .= "}),";
3085
-
3086
-				// blank title as its added to the icon.
3087
-				$args['title'] = '';
3088
-			}
3077
+            // icon
3078
+            $icon = '';
3079
+            if( !empty( $args['icon'] ) ){
3080
+                $icon .= "el('div', {";
3081
+                                    $icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},";
3082
+                                    $icon .= "className: 'text-center',";
3083
+                                    $icon .= "title: '".addslashes( $args['title'] )."',";
3084
+                                $icon .= "}),";
3085
+
3086
+                // blank title as its added to the icon.
3087
+                $args['title'] = '';
3088
+            }
3089 3089
 
3090
-			// require advanced
3091
-			$require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
3090
+            // require advanced
3091
+            $require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
3092 3092
 
3093
-			// element require
3094
-			$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3093
+            // element require
3094
+            $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3095 3095
 
3096 3096
 
3097
-			$onchange  = "props.setAttributes({ $key: $key } )";
3098
-			$onchangecomplete  = "";
3099
-			$value     = "props.attributes.$key";
3100
-			$text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' );
3101
-			if ( in_array( $args['type'], $text_type ) ) {
3102
-				$type = 'TextControl';
3103
-				// Save numbers as numbers and not strings
3104
-				if ( $args['type'] == 'number' ) {
3105
-					$onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )";
3106
-				}
3107
-			}else if ( $args['type'] == 'styleid' ) {
3108
-				$type = 'TextControl';
3109
-				$args['type'] == 'text';
3110
-				// Save numbers as numbers and not strings
3111
-				$value     = "props.attributes.$key ? props.attributes.$key : 'aaabbbccc'";
3112
-			}else if ( $args['type'] == 'notice' ) {
3113
-
3114
-				$notice_message = !empty($args['desc']) ? addslashes($args['desc']) : '';
3115
-				$notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info';
3116
-
3117
-				$notice = "el('div',{className:'bsui'},el(wp.components.Notice, {status: '$notice_status',isDismissible: false,className: 'm-0 pr-0 mb-3'},el('div',{dangerouslySetInnerHTML: {__html: '$notice_message'}}))),";
3118
-				echo $notice_message ? $element_require . $notice : '';
3119
-				return;
3120
-			}
3121
-			/*
3097
+            $onchange  = "props.setAttributes({ $key: $key } )";
3098
+            $onchangecomplete  = "";
3099
+            $value     = "props.attributes.$key";
3100
+            $text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' );
3101
+            if ( in_array( $args['type'], $text_type ) ) {
3102
+                $type = 'TextControl';
3103
+                // Save numbers as numbers and not strings
3104
+                if ( $args['type'] == 'number' ) {
3105
+                    $onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )";
3106
+                }
3107
+            }else if ( $args['type'] == 'styleid' ) {
3108
+                $type = 'TextControl';
3109
+                $args['type'] == 'text';
3110
+                // Save numbers as numbers and not strings
3111
+                $value     = "props.attributes.$key ? props.attributes.$key : 'aaabbbccc'";
3112
+            }else if ( $args['type'] == 'notice' ) {
3113
+
3114
+                $notice_message = !empty($args['desc']) ? addslashes($args['desc']) : '';
3115
+                $notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info';
3116
+
3117
+                $notice = "el('div',{className:'bsui'},el(wp.components.Notice, {status: '$notice_status',isDismissible: false,className: 'm-0 pr-0 mb-3'},el('div',{dangerouslySetInnerHTML: {__html: '$notice_message'}}))),";
3118
+                echo $notice_message ? $element_require . $notice : '';
3119
+                return;
3120
+            }
3121
+            /*
3122 3122
 			 * https://www.wptricks.com/question/set-current-tab-on-a-gutenberg-tabpanel-component-from-outside-that-component/ es5 layout
3123 3123
 						elseif($args['type']=='tabs'){
3124 3124
 							?>
@@ -3171,23 +3171,23 @@  discard block
 block discarded – undo
3171 3171
 							return;
3172 3172
 						}
3173 3173
 */
3174
-			elseif ( $args['type'] == 'color' ) {
3175
-				$type = 'ColorPicker';
3176
-				$onchange = "";
3177
-				$extra = "color: $value,";
3178
-				if(!empty($args['disable_alpha'])){
3179
-					$extra .= "disableAlpha: true,";
3180
-				}
3181
-				$onchangecomplete = "onChangeComplete: function($key) {
3174
+            elseif ( $args['type'] == 'color' ) {
3175
+                $type = 'ColorPicker';
3176
+                $onchange = "";
3177
+                $extra = "color: $value,";
3178
+                if(!empty($args['disable_alpha'])){
3179
+                    $extra .= "disableAlpha: true,";
3180
+                }
3181
+                $onchangecomplete = "onChangeComplete: function($key) {
3182 3182
 				value =  $key.rgb.a && $key.rgb.a < 1 ? \"rgba(\"+$key.rgb.r+\",\"+$key.rgb.g+\",\"+$key.rgb.b+\",\"+$key.rgb.a+\")\" : $key.hex;
3183 3183
                         props.setAttributes({
3184 3184
                             $key: value
3185 3185
                         });
3186 3186
                     },";
3187
-			}elseif ( $args['type'] == 'gradient' ) {
3188
-				$type = 'GradientPicker';
3187
+            }elseif ( $args['type'] == 'gradient' ) {
3188
+                $type = 'GradientPicker';
3189 3189
 
3190
-			}elseif ( $args['type'] == 'image' ) {
3190
+            }elseif ( $args['type'] == 'image' ) {
3191 3191
 //                print_r($args);
3192 3192
 
3193 3193
                 $img_preview = isset($args['focalpoint']) && !$args['focalpoint'] ? " props.attributes.$key && el('img', { src: props.attributes.$key,style: {maxWidth:'100%',background: '#ccc'}})," : " ( props.attributes.$key ||  props.attributes.{$key}_use_featured ) && el(wp.components.FocalPointPicker,{
@@ -3212,15 +3212,15 @@  discard block
 block discarded – undo
3212 3212
 
3213 3213
 
3214 3214
                 $value = '""';
3215
-				$type = 'MediaUpload';
3215
+                $type = 'MediaUpload';
3216 3216
                 $extra .= "onSelect: function(media){
3217 3217
                       return props.setAttributes({
3218 3218
                           $key: media.url,
3219 3219
                           {$key}_id: media.id
3220 3220
                         });
3221 3221
                       },";
3222
-                   $extra .= "type: 'image',";
3223
-                   $extra .= "render: function (obj) {
3222
+                    $extra .= "type: 'image',";
3223
+                    $extra .= "render: function (obj) {
3224 3224
                         return el( 'div',{},
3225 3225
                         ( !props.attributes.$key && !props.attributes.{$key}_use_featured ) && el( wp.components.Button, {
3226 3226
                           className: 'components-button components-circular-option-picker__clear is-primary is-smallx',
@@ -3249,8 +3249,8 @@  discard block
 block discarded – undo
3249 3249
                 $onchange = "";
3250 3250
 
3251 3251
                 //$inside_elements = ",el('div',{},'file upload')";
3252
-			}elseif ( $args['type'] == 'images' ) {
3253
-				//                print_r($args);
3252
+            }elseif ( $args['type'] == 'images' ) {
3253
+                //                print_r($args);
3254 3254
 
3255 3255
                 $img_preview = "props.attributes.$key && (function() {
3256 3256
 
@@ -3279,7 +3279,7 @@  discard block
 block discarded – undo
3279 3279
 
3280 3280
 
3281 3281
                 $value = '""';
3282
-				$type = 'MediaUpload';
3282
+                $type = 'MediaUpload';
3283 3283
                 $extra .= "onSelect: function(media){
3284 3284
 
3285 3285
                 let slim_images = props.attributes.$key ? JSON.parse('['+props.attributes.$key+']') : [];
@@ -3293,9 +3293,9 @@  discard block
 block discarded – undo
3293 3293
                           $key: JSON.stringify(slim_images).replace('[','').replace(']',''),
3294 3294
                         });
3295 3295
                       },";
3296
-                   $extra .= "type: 'image',";
3297
-                   $extra .= "multiple: true,";
3298
-                   $extra .= "render: function (obj) {
3296
+                    $extra .= "type: 'image',";
3297
+                    $extra .= "multiple: true,";
3298
+                    $extra .= "render: function (obj) {
3299 3299
 
3300 3300
                    // init the sort
3301 3301
 				enableDragSort('sd-sortable');
@@ -3334,34 +3334,34 @@  discard block
 block discarded – undo
3334 3334
                 $onchange = "";
3335 3335
 
3336 3336
                 //$inside_elements = ",el('div',{},'file upload')";
3337
-			}
3338
-			elseif ( $args['type'] == 'checkbox' ) {
3339
-				$type = 'CheckboxControl';
3340
-				$extra .= "checked: props.attributes.$key,";
3341
-				$onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
3342
-			} elseif ( $args['type'] == 'textarea' ) {
3343
-				$type = 'TextareaControl';
3344
-			} elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
3345
-				$type = 'SelectControl';
3346
-
3347
-				if($args['name'] == 'category' && !empty($args['post_type_linked'])){
3348
-					$options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
3349
-				}elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3350
-					$options .= "options: sort_by_".str_replace("-","_", $this->id).",";
3351
-				}else {
3352
-
3353
-					if ( ! empty( $args['options'] ) ) {
3354
-						$options .= "options: [";
3355
-						foreach ( $args['options'] as $option_val => $option_label ) {
3356
-							$options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . addslashes( $option_label ) . "' },";
3357
-						}
3358
-						$options .= "],";
3359
-					}
3360
-				}
3361
-				if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
3362
-					$extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, ';
3363
-				}
3364
-			} elseif ( $args['type'] == 'tagselect' ) {
3337
+            }
3338
+            elseif ( $args['type'] == 'checkbox' ) {
3339
+                $type = 'CheckboxControl';
3340
+                $extra .= "checked: props.attributes.$key,";
3341
+                $onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
3342
+            } elseif ( $args['type'] == 'textarea' ) {
3343
+                $type = 'TextareaControl';
3344
+            } elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
3345
+                $type = 'SelectControl';
3346
+
3347
+                if($args['name'] == 'category' && !empty($args['post_type_linked'])){
3348
+                    $options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
3349
+                }elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3350
+                    $options .= "options: sort_by_".str_replace("-","_", $this->id).",";
3351
+                }else {
3352
+
3353
+                    if ( ! empty( $args['options'] ) ) {
3354
+                        $options .= "options: [";
3355
+                        foreach ( $args['options'] as $option_val => $option_label ) {
3356
+                            $options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . addslashes( $option_label ) . "' },";
3357
+                        }
3358
+                        $options .= "],";
3359
+                    }
3360
+                }
3361
+                if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
3362
+                    $extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, ';
3363
+                }
3364
+            } elseif ( $args['type'] == 'tagselect' ) {
3365 3365
 //				$type = 'FormTokenField';
3366 3366
 //
3367 3367
 //				if ( ! empty( $args['options'] ) ) {
@@ -3396,39 +3396,39 @@  discard block
 block discarded – undo
3396 3396
 //				$value     = "[]";
3397 3397
 //				$extra .= ' __experimentalExpandOnFocus: true,';
3398 3398
 
3399
-			} elseif ( $args['type'] == 'alignment' ) {
3400
-				$type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
3401
-			}elseif ( $args['type'] == 'margins' ) {
3399
+            } elseif ( $args['type'] == 'alignment' ) {
3400
+                $type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
3401
+            }elseif ( $args['type'] == 'margins' ) {
3402 3402
 
3403
-			} else {
3404
-				return;// if we have not implemented the control then don't break the JS.
3405
-			}
3403
+            } else {
3404
+                return;// if we have not implemented the control then don't break the JS.
3405
+            }
3406 3406
 
3407 3407
 
3408 3408
 
3409
-			// color input does not show the labels so we add them
3410
-			if($args['type']=='color'){
3411
-				// add show only if advanced
3412
-				echo $require_advanced;
3413
-				// add setting require if defined
3414
-				echo $element_require;
3415
-				echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
3416
-			}
3409
+            // color input does not show the labels so we add them
3410
+            if($args['type']=='color'){
3411
+                // add show only if advanced
3412
+                echo $require_advanced;
3413
+                // add setting require if defined
3414
+                echo $element_require;
3415
+                echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
3416
+            }
3417 3417
 
3418
-			// add show only if advanced
3419
-			echo $require_advanced;
3420
-			// add setting require if defined
3421
-			echo $element_require;
3418
+            // add show only if advanced
3419
+            echo $require_advanced;
3420
+            // add setting require if defined
3421
+            echo $element_require;
3422 3422
             echo $device_type_require;
3423 3423
 
3424
-			// icon
3425
-			echo $icon;
3426
-			?>
3424
+            // icon
3425
+            echo $icon;
3426
+            ?>
3427 3427
 			el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type  : "wp.components.".$type; ?>, {
3428 3428
 			label: <?php
3429
-			if(empty($args['title'])){
3429
+            if(empty($args['title'])){
3430 3430
                 echo "''";
3431
-			}elseif(empty($args['row']) && !empty($args['device_type'])){
3431
+            }elseif(empty($args['row']) && !empty($args['device_type'])){
3432 3432
                 ?>el('label', {
3433 3433
 									className: 'components-base-control__label',
3434 3434
 									style: {width:"100%"}
@@ -3443,22 +3443,22 @@  discard block
 block discarded – undo
3443 3443
 
3444 3444
 							)<?php
3445 3445
 
3446
-			}else{
3447
-                 ?>'<?php echo addslashes( $args['title'] ); ?>'<?php
3446
+            }else{
3447
+                    ?>'<?php echo addslashes( $args['title'] ); ?>'<?php
3448 3448
 
3449
-			}
3449
+            }
3450 3450
 
3451
-			?>,
3451
+            ?>,
3452 3452
 			help: <?php if ( isset( $args['desc'] ) ) {
3453
-				echo "el('span',{dangerouslySetInnerHTML: {__html: '".wp_kses_post( addslashes($args['desc']) )."'}})";
3454
-			}else{ echo "''"; } ?>,
3453
+                echo "el('span',{dangerouslySetInnerHTML: {__html: '".wp_kses_post( addslashes($args['desc']) )."'}})";
3454
+            }else{ echo "''"; } ?>,
3455 3455
 			value: <?php echo $value; ?>,
3456 3456
 			<?php if ( $type == 'TextControl' && $args['type'] != 'text' ) {
3457
-				echo "type: '" . addslashes( $args['type'] ) . "',";
3458
-			} ?>
3457
+                echo "type: '" . addslashes( $args['type'] ) . "',";
3458
+            } ?>
3459 3459
 			<?php if ( ! empty( $args['placeholder'] ) ) {
3460
-				echo "placeholder: '" . addslashes( $args['placeholder'] ) . "',";
3461
-			} ?>
3460
+                echo "placeholder: '" . addslashes( $args['placeholder'] ) . "',";
3461
+            } ?>
3462 3462
 			<?php echo $options; ?>
3463 3463
 			<?php echo $extra; ?>
3464 3464
 			<?php echo $custom_attributes; ?>
@@ -3473,67 +3473,67 @@  discard block
 block discarded – undo
3473 3473
 			<?php
3474 3474
 
3475 3475
 
3476
-		}
3476
+        }
3477 3477
 
3478
-		/**
3479
-		 * Convert an array of attributes to block string.
3480
-		 *
3481
-		 * @param $custom_attributes
3482
-		 *
3483
-		 * @return string
3484
-		 *@todo there is prob a faster way to do this, also we could add some validation here.
3485
-		 *
3486
-		 */
3487
-		public function array_to_attributes( $custom_attributes, $html = false ) {
3488
-			$attributes = '';
3489
-			if ( ! empty( $custom_attributes ) ) {
3490
-
3491
-				foreach ( $custom_attributes as $key => $val ) {
3492
-					if(is_array($val)){
3493
-						$attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},';
3494
-					}else{
3495
-						$attributes .= $html ?  " $key='$val' " : "'$key': '$val',";
3496
-					}
3497
-				}
3478
+        /**
3479
+         * Convert an array of attributes to block string.
3480
+         *
3481
+         * @param $custom_attributes
3482
+         *
3483
+         * @return string
3484
+         *@todo there is prob a faster way to do this, also we could add some validation here.
3485
+         *
3486
+         */
3487
+        public function array_to_attributes( $custom_attributes, $html = false ) {
3488
+            $attributes = '';
3489
+            if ( ! empty( $custom_attributes ) ) {
3498 3490
 
3499
-			}
3491
+                foreach ( $custom_attributes as $key => $val ) {
3492
+                    if(is_array($val)){
3493
+                        $attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},';
3494
+                    }else{
3495
+                        $attributes .= $html ?  " $key='$val' " : "'$key': '$val',";
3496
+                    }
3497
+                }
3500 3498
 
3501
-			return $attributes;
3502
-		}
3499
+            }
3500
+
3501
+            return $attributes;
3502
+        }
3503 3503
 
3504 3504
 
3505 3505
 
3506
-		/**
3507
-		 * A self looping function to create the output for JS block elements.
3508
-		 *
3509
-		 * This is what is output in the WP Editor visual view.
3510
-		 *
3511
-		 * @param $args
3512
-		 */
3513
-		public function block_element( $args, $save = false ) {
3506
+        /**
3507
+         * A self looping function to create the output for JS block elements.
3508
+         *
3509
+         * This is what is output in the WP Editor visual view.
3510
+         *
3511
+         * @param $args
3512
+         */
3513
+        public function block_element( $args, $save = false ) {
3514 3514
 
3515 3515
 
3516
-			if ( ! empty( $args ) ) {
3517
-				foreach ( $args as $element => $new_args ) {
3516
+            if ( ! empty( $args ) ) {
3517
+                foreach ( $args as $element => $new_args ) {
3518 3518
 
3519
-					if ( is_array( $new_args ) ) { // its an element
3519
+                    if ( is_array( $new_args ) ) { // its an element
3520 3520
 
3521 3521
 
3522
-						if ( isset( $new_args['element'] ) ) {
3522
+                        if ( isset( $new_args['element'] ) ) {
3523 3523
 
3524
-							if ( isset( $new_args['element_require'] ) ) {
3525
-								echo str_replace( array(
3526
-										"'+",
3527
-										"+'"
3528
-									), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
3529
-								unset( $new_args['element_require'] );
3530
-							}
3524
+                            if ( isset( $new_args['element_require'] ) ) {
3525
+                                echo str_replace( array(
3526
+                                        "'+",
3527
+                                        "+'"
3528
+                                    ), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
3529
+                                unset( $new_args['element_require'] );
3530
+                            }
3531 3531
 
3532 3532
                             if($new_args['element']=='InnerBlocks'){
3533 3533
                                 echo "\n el( InnerBlocks, {";
3534 3534
                             }elseif($new_args['element']=='innerBlocksProps'){
3535 3535
                                 $element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div';
3536
-                              //  echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {";
3536
+                                //  echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {";
3537 3537
 //                                echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
3538 3538
                                 echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
3539 3539
                                 echo $save ? "wp.blockEditor.useBlockProps.save( {" : "wp.blockEditor.useBlockProps( {";
@@ -3543,74 +3543,74 @@  discard block
 block discarded – undo
3543 3543
                                 echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element( $new_args['innerBlocksProps'],$save ) : '';
3544 3544
                             //    echo '###';
3545 3545
 
3546
-                              //  echo '###';
3546
+                                //  echo '###';
3547 3547
                             }elseif($new_args['element']=='BlocksProps'){
3548 3548
 
3549
-								if ( isset($new_args['if_inner_element']) ) {
3550
-									$element = $new_args['if_inner_element'];
3551
-								}else {
3552
-									$element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'";
3553
-								}
3549
+                                if ( isset($new_args['if_inner_element']) ) {
3550
+                                    $element = $new_args['if_inner_element'];
3551
+                                }else {
3552
+                                    $element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'";
3553
+                                }
3554 3554
 
3555
-								unset($new_args['inner_element']);
3555
+                                unset($new_args['inner_element']);
3556 3556
                                 echo $save ? "\n el( $element, wp.blockEditor.useBlockProps.save( {" : "\n el( $element, wp.blockEditor.useBlockProps( {";
3557 3557
                                 echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
3558 3558
 
3559 3559
 
3560
-                               // echo "} ),";
3560
+                                // echo "} ),";
3561 3561
 
3562 3562
                             }else{
3563 3563
                                 echo "\n el( '" . $new_args['element'] . "', {";
3564 3564
                             }
3565 3565
 
3566 3566
 
3567
-							// get the attributes
3568
-							foreach ( $new_args as $new_key => $new_value ) {
3567
+                            // get the attributes
3568
+                            foreach ( $new_args as $new_key => $new_value ) {
3569 3569
 
3570 3570
 
3571
-								if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
3572
-									// do nothing
3573
-								} else {
3574
-									echo $this->block_element( array( $new_key => $new_value ),$save );
3575
-								}
3576
-							}
3571
+                                if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
3572
+                                    // do nothing
3573
+                                } else {
3574
+                                    echo $this->block_element( array( $new_key => $new_value ),$save );
3575
+                                }
3576
+                            }
3577 3577
 
3578
-							echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes
3578
+                            echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes
3579 3579
 
3580
-							// get the content
3581
-							$first_item = 0;
3582
-							foreach ( $new_args as $new_key => $new_value ) {
3583
-								if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) {
3580
+                            // get the content
3581
+                            $first_item = 0;
3582
+                            foreach ( $new_args as $new_key => $new_value ) {
3583
+                                if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) {
3584 3584
 
3585
-									if ( $new_key === 'content' ) {
3586
-										echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
3587
-									}else if ( $new_key === 'if_content' ) {
3588
-										echo  $this->block_props_replace(  $new_value  );
3589
-									}
3585
+                                    if ( $new_key === 'content' ) {
3586
+                                        echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
3587
+                                    }else if ( $new_key === 'if_content' ) {
3588
+                                        echo  $this->block_props_replace(  $new_value  );
3589
+                                    }
3590 3590
 
3591
-									if ( is_array( $new_value ) ) {
3591
+                                    if ( is_array( $new_value ) ) {
3592 3592
 
3593
-										if ( isset( $new_value['element_require'] ) ) {
3594
-											echo str_replace( array(
3595
-													"'+",
3596
-													"+'"
3597
-												), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
3598
-											unset( $new_value['element_require'] );
3599
-										}
3593
+                                        if ( isset( $new_value['element_require'] ) ) {
3594
+                                            echo str_replace( array(
3595
+                                                    "'+",
3596
+                                                    "+'"
3597
+                                                ), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
3598
+                                            unset( $new_value['element_require'] );
3599
+                                        }
3600 3600
 
3601
-										if ( isset( $new_value['element_repeat'] ) ) {
3602
-											$x = 1;
3603
-											while ( $x <= absint( $new_value['element_repeat'] ) ) {
3604
-												$this->block_element( array( '' => $new_value ),$save );
3605
-												$x ++;
3606
-											}
3607
-										} else {
3608
-											$this->block_element( array( '' => $new_value ),$save );
3609
-										}
3610
-									}
3611
-									$first_item ++;
3612
-								}
3613
-							}
3601
+                                        if ( isset( $new_value['element_repeat'] ) ) {
3602
+                                            $x = 1;
3603
+                                            while ( $x <= absint( $new_value['element_repeat'] ) ) {
3604
+                                                $this->block_element( array( '' => $new_value ),$save );
3605
+                                                $x ++;
3606
+                                            }
3607
+                                        } else {
3608
+                                            $this->block_element( array( '' => $new_value ),$save );
3609
+                                        }
3610
+                                    }
3611
+                                    $first_item ++;
3612
+                                }
3613
+                            }
3614 3614
 
3615 3615
                             if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){
3616 3616
                                 echo "))";// end content
@@ -3619,517 +3619,517 @@  discard block
 block discarded – undo
3619 3619
                             }
3620 3620
 
3621 3621
 
3622
-							echo ", \n";
3622
+                            echo ", \n";
3623 3623
 
3624
-						}
3625
-					} else {
3624
+                        }
3625
+                    } else {
3626 3626
 
3627
-						if ( substr( $element, 0, 3 ) === "if_" ) {
3628
-							$extra = '';
3629
-							if( strpos($new_args, '[%WrapClass%]') !== false ){
3630
-								$new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args);
3631
-								$new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args);
3632
-							}
3633
-							echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
3634
-						} elseif ( $element == 'style' &&  strpos($new_args, '[%WrapStyle%]') !== false ) {
3627
+                        if ( substr( $element, 0, 3 ) === "if_" ) {
3628
+                            $extra = '';
3629
+                            if( strpos($new_args, '[%WrapClass%]') !== false ){
3630
+                                $new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args);
3631
+                                $new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args);
3632
+                            }
3633
+                            echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
3634
+                        } elseif ( $element == 'style' &&  strpos($new_args, '[%WrapStyle%]') !== false ) {
3635 3635
                             $new_args = str_replace('[%WrapStyle%]','',$new_args);
3636 3636
                             echo $element . ": {..." . $this->block_props_replace( $new_args ) . " , ...sd_build_aui_styles(props.attributes) },";
3637 3637
 //                            echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
3638
-						} elseif ( $element == 'style' ) {
3639
-							echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
3640
-						} elseif ( ( $element == 'class' || $element == 'className'  ) &&  strpos($new_args, '[%WrapClass%]') !== false ) {
3638
+                        } elseif ( $element == 'style' ) {
3639
+                            echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
3640
+                        } elseif ( ( $element == 'class' || $element == 'className'  ) &&  strpos($new_args, '[%WrapClass%]') !== false ) {
3641 3641
                             $new_args = str_replace('[%WrapClass%]','',$new_args);
3642 3642
                             echo $element . ": '" . $this->block_props_replace( $new_args ) . "' + sd_build_aui_class(props.attributes),";
3643
-						} elseif ( $element == 'template' && $new_args ) {
3644
-							echo $element . ": $new_args,";
3645
-						} else {
3646
-							echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
3647
-						}
3643
+                        } elseif ( $element == 'template' && $new_args ) {
3644
+                            echo $element . ": $new_args,";
3645
+                        } else {
3646
+                            echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
3647
+                        }
3648 3648
 
3649
-					}
3650
-				}
3651
-			}
3652
-		}
3649
+                    }
3650
+                }
3651
+            }
3652
+        }
3653 3653
 
3654
-		/**
3655
-		 * Replace block attributes placeholders with the proper naming.
3656
-		 *
3657
-		 * @param $string
3658
-		 *
3659
-		 * @return mixed
3660
-		 */
3661
-		public function block_props_replace( $string, $no_wrap = false ) {
3662
-
3663
-			if ( $no_wrap ) {
3664
-				$string = str_replace( array( "[%", "%]" ), array( "props.attributes.", "" ), $string );
3665
-			} else {
3666
-				$string = str_replace( array( "[%", "%]" ), array( "'+props.attributes.", "+'" ), $string );
3667
-			}
3654
+        /**
3655
+         * Replace block attributes placeholders with the proper naming.
3656
+         *
3657
+         * @param $string
3658
+         *
3659
+         * @return mixed
3660
+         */
3661
+        public function block_props_replace( $string, $no_wrap = false ) {
3668 3662
 
3669
-			return $string;
3670
-		}
3663
+            if ( $no_wrap ) {
3664
+                $string = str_replace( array( "[%", "%]" ), array( "props.attributes.", "" ), $string );
3665
+            } else {
3666
+                $string = str_replace( array( "[%", "%]" ), array( "'+props.attributes.", "+'" ), $string );
3667
+            }
3671 3668
 
3672
-		/**
3673
-		 * Outputs the content of the widget
3674
-		 *
3675
-		 * @param array $args
3676
-		 * @param array $instance
3677
-		 */
3678
-		public function widget( $args, $instance ) {
3679
-
3680
-			// get the filtered values
3681
-			$argument_values = $this->argument_values( $instance );
3682
-			$argument_values = $this->string_to_bool( $argument_values );
3683
-			$output          = $this->output( $argument_values, $args );
3684
-
3685
-			$no_wrap = false;
3686
-			if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
3687
-				$no_wrap = true;
3688
-			}
3669
+            return $string;
3670
+        }
3689 3671
 
3690
-			ob_start();
3691
-			if ( $output && ! $no_wrap ) {
3672
+        /**
3673
+         * Outputs the content of the widget
3674
+         *
3675
+         * @param array $args
3676
+         * @param array $instance
3677
+         */
3678
+        public function widget( $args, $instance ) {
3692 3679
 
3693
-				$class_original = $this->options['widget_ops']['classname'];
3694
-				$class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
3680
+            // get the filtered values
3681
+            $argument_values = $this->argument_values( $instance );
3682
+            $argument_values = $this->string_to_bool( $argument_values );
3683
+            $output          = $this->output( $argument_values, $args );
3695 3684
 
3696
-				// Before widget
3697
-				$before_widget = $args['before_widget'];
3698
-				$before_widget = str_replace($class_original,$class,$before_widget);
3699
-				$before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
3700
-				$before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
3685
+            $no_wrap = false;
3686
+            if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
3687
+                $no_wrap = true;
3688
+            }
3701 3689
 
3702
-				// After widget
3703
-				$after_widget = $args['after_widget'];
3704
-				$after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
3705
-				$after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
3690
+            ob_start();
3691
+            if ( $output && ! $no_wrap ) {
3706 3692
 
3707
-				echo $before_widget;
3708
-				// elementor strips the widget wrapping div so we check for and add it back if needed
3709
-				if ( $this->is_elementor_widget_output() ) {
3710
-					// Filter class & attrs for elementor widget output.
3711
-					$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
3712
-					$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
3693
+                $class_original = $this->options['widget_ops']['classname'];
3694
+                $class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
3713 3695
 
3714
-					$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
3715
-					$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
3696
+                // Before widget
3697
+                $before_widget = $args['before_widget'];
3698
+                $before_widget = str_replace($class_original,$class,$before_widget);
3699
+                $before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
3700
+                $before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
3716 3701
 
3717
-					echo "<span class='" . esc_attr( $class  ) . "' " . $attrs . ">";
3718
-				}
3719
-				echo $this->output_title( $args, $instance );
3720
-				echo $output;
3721
-				if ( $this->is_elementor_widget_output() ) {
3722
-					echo "</span>";
3723
-				}
3724
-				echo $after_widget;
3725
-			} elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
3726
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
3727
-				echo $output;
3728
-			} elseif ( $output && $no_wrap ) {
3729
-				echo $output;
3730
-			}
3731
-			$output = ob_get_clean();
3702
+                // After widget
3703
+                $after_widget = $args['after_widget'];
3704
+                $after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
3705
+                $after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
3732 3706
 
3733
-			$output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
3707
+                echo $before_widget;
3708
+                // elementor strips the widget wrapping div so we check for and add it back if needed
3709
+                if ( $this->is_elementor_widget_output() ) {
3710
+                    // Filter class & attrs for elementor widget output.
3711
+                    $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
3712
+                    $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
3734 3713
 
3735
-			echo $output;
3736
-		}
3714
+                    $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
3715
+                    $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
3737 3716
 
3738
-		/**
3739
-		 * Tests if the current output is inside a elementor container.
3740
-		 *
3741
-		 * @return bool
3742
-		 *@since 1.0.4
3743
-		 */
3744
-		public function is_elementor_widget_output() {
3745
-			$result = false;
3746
-			if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
3747
-				$result = true;
3748
-			}
3717
+                    echo "<span class='" . esc_attr( $class  ) . "' " . $attrs . ">";
3718
+                }
3719
+                echo $this->output_title( $args, $instance );
3720
+                echo $output;
3721
+                if ( $this->is_elementor_widget_output() ) {
3722
+                    echo "</span>";
3723
+                }
3724
+                echo $after_widget;
3725
+            } elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
3726
+                $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
3727
+                echo $output;
3728
+            } elseif ( $output && $no_wrap ) {
3729
+                echo $output;
3730
+            }
3731
+            $output = ob_get_clean();
3749 3732
 
3750
-			return $result;
3751
-		}
3733
+            $output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
3752 3734
 
3753
-		/**
3754
-		 * Tests if the current output is inside a elementor preview.
3755
-		 *
3756
-		 * @return bool
3757
-		 *@since 1.0.4
3758
-		 */
3759
-		public function is_elementor_preview() {
3760
-			$result = false;
3761
-			if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
3762
-				$result = true;
3763
-			}
3735
+            echo $output;
3736
+        }
3764 3737
 
3765
-			return $result;
3766
-		}
3738
+        /**
3739
+         * Tests if the current output is inside a elementor container.
3740
+         *
3741
+         * @return bool
3742
+         *@since 1.0.4
3743
+         */
3744
+        public function is_elementor_widget_output() {
3745
+            $result = false;
3746
+            if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
3747
+                $result = true;
3748
+            }
3767 3749
 
3768
-		/**
3769
-		 * Tests if the current output is inside a Divi preview.
3770
-		 *
3771
-		 * @return bool
3772
-		 *@since 1.0.6
3773
-		 */
3774
-		public function is_divi_preview() {
3775
-			$result = false;
3776
-			if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
3777
-				$result = true;
3778
-			}
3750
+            return $result;
3751
+        }
3779 3752
 
3780
-			return $result;
3781
-		}
3753
+        /**
3754
+         * Tests if the current output is inside a elementor preview.
3755
+         *
3756
+         * @return bool
3757
+         *@since 1.0.4
3758
+         */
3759
+        public function is_elementor_preview() {
3760
+            $result = false;
3761
+            if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
3762
+                $result = true;
3763
+            }
3782 3764
 
3783
-		/**
3784
-		 * Tests if the current output is inside a Beaver builder preview.
3785
-		 *
3786
-		 * @return bool
3787
-		 *@since 1.0.6
3788
-		 */
3789
-		public function is_beaver_preview() {
3790
-			$result = false;
3791
-			if ( isset( $_REQUEST['fl_builder'] ) ) {
3792
-				$result = true;
3793
-			}
3765
+            return $result;
3766
+        }
3794 3767
 
3795
-			return $result;
3796
-		}
3768
+        /**
3769
+         * Tests if the current output is inside a Divi preview.
3770
+         *
3771
+         * @return bool
3772
+         *@since 1.0.6
3773
+         */
3774
+        public function is_divi_preview() {
3775
+            $result = false;
3776
+            if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
3777
+                $result = true;
3778
+            }
3797 3779
 
3798
-		/**
3799
-		 * Tests if the current output is inside a siteorigin builder preview.
3800
-		 *
3801
-		 * @return bool
3802
-		 *@since 1.0.6
3803
-		 */
3804
-		public function is_siteorigin_preview() {
3805
-			$result = false;
3806
-			if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
3807
-				$result = true;
3808
-			}
3780
+            return $result;
3781
+        }
3809 3782
 
3810
-			return $result;
3811
-		}
3783
+        /**
3784
+         * Tests if the current output is inside a Beaver builder preview.
3785
+         *
3786
+         * @return bool
3787
+         *@since 1.0.6
3788
+         */
3789
+        public function is_beaver_preview() {
3790
+            $result = false;
3791
+            if ( isset( $_REQUEST['fl_builder'] ) ) {
3792
+                $result = true;
3793
+            }
3812 3794
 
3813
-		/**
3814
-		 * Tests if the current output is inside a cornerstone builder preview.
3815
-		 *
3816
-		 * @return bool
3817
-		 *@since 1.0.8
3818
-		 */
3819
-		public function is_cornerstone_preview() {
3820
-			$result = false;
3821
-			if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
3822
-				$result = true;
3823
-			}
3795
+            return $result;
3796
+        }
3824 3797
 
3825
-			return $result;
3826
-		}
3798
+        /**
3799
+         * Tests if the current output is inside a siteorigin builder preview.
3800
+         *
3801
+         * @return bool
3802
+         *@since 1.0.6
3803
+         */
3804
+        public function is_siteorigin_preview() {
3805
+            $result = false;
3806
+            if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
3807
+                $result = true;
3808
+            }
3827 3809
 
3828
-		/**
3829
-		 * Tests if the current output is inside a fusion builder preview.
3830
-		 *
3831
-		 * @return bool
3832
-		 *@since 1.1.0
3833
-		 */
3834
-		public function is_fusion_preview() {
3835
-			$result = false;
3836
-			if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
3837
-				$result = true;
3838
-			}
3810
+            return $result;
3811
+        }
3839 3812
 
3840
-			return $result;
3841
-		}
3813
+        /**
3814
+         * Tests if the current output is inside a cornerstone builder preview.
3815
+         *
3816
+         * @return bool
3817
+         *@since 1.0.8
3818
+         */
3819
+        public function is_cornerstone_preview() {
3820
+            $result = false;
3821
+            if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
3822
+                $result = true;
3823
+            }
3842 3824
 
3843
-		/**
3844
-		 * Tests if the current output is inside a Oxygen builder preview.
3845
-		 *
3846
-		 * @return bool
3847
-		 *@since 1.0.18
3848
-		 */
3849
-		public function is_oxygen_preview() {
3850
-			$result = false;
3851
-			if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
3852
-				$result = true;
3853
-			}
3825
+            return $result;
3826
+        }
3854 3827
 
3855
-			return $result;
3856
-		}
3828
+        /**
3829
+         * Tests if the current output is inside a fusion builder preview.
3830
+         *
3831
+         * @return bool
3832
+         *@since 1.1.0
3833
+         */
3834
+        public function is_fusion_preview() {
3835
+            $result = false;
3836
+            if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
3837
+                $result = true;
3838
+            }
3857 3839
 
3858
-		/**
3859
-		 * General function to check if we are in a preview situation.
3860
-		 *
3861
-		 * @return bool
3862
-		 *@since 1.0.6
3863
-		 */
3864
-		public function is_preview() {
3865
-			$preview = false;
3866
-			if ( $this->is_divi_preview() ) {
3867
-				$preview = true;
3868
-			} elseif ( $this->is_elementor_preview() ) {
3869
-				$preview = true;
3870
-			} elseif ( $this->is_beaver_preview() ) {
3871
-				$preview = true;
3872
-			} elseif ( $this->is_siteorigin_preview() ) {
3873
-				$preview = true;
3874
-			} elseif ( $this->is_cornerstone_preview() ) {
3875
-				$preview = true;
3876
-			} elseif ( $this->is_fusion_preview() ) {
3877
-				$preview = true;
3878
-			} elseif ( $this->is_oxygen_preview() ) {
3879
-				$preview = true;
3880
-			} elseif( $this->is_block_content_call() ) {
3881
-				$preview = true;
3882
-			}
3840
+            return $result;
3841
+        }
3883 3842
 
3884
-			return $preview;
3885
-		}
3843
+        /**
3844
+         * Tests if the current output is inside a Oxygen builder preview.
3845
+         *
3846
+         * @return bool
3847
+         *@since 1.0.18
3848
+         */
3849
+        public function is_oxygen_preview() {
3850
+            $result = false;
3851
+            if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
3852
+                $result = true;
3853
+            }
3886 3854
 
3887
-		/**
3888
-		 * Output the super title.
3889
-		 *
3890
-		 * @param $args
3891
-		 * @param array $instance
3892
-		 *
3893
-		 * @return string
3894
-		 */
3895
-		public function output_title( $args, $instance = array() ) {
3896
-			$output = '';
3897
-			if ( ! empty( $instance['title'] ) ) {
3898
-				/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
3899
-				$title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
3900
-
3901
-				if(empty($instance['widget_title_tag'])){
3902
-					$output = $args['before_title'] . $title . $args['after_title'];
3903
-				}else{
3904
-					$title_tag = esc_attr( $instance['widget_title_tag'] );
3905
-
3906
-					// classes
3907
-					$title_classes = array();
3908
-					$title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
3909
-					$title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
3910
-					$title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
3911
-					$title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
3912
-					$title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
3913
-					$title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
3914
-					$title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
3915
-					$title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
3916
-					$title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
3917
-					$title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
3918
-					$title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
3919
-					$title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
3920
-					$title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
3921
-
3922
-					$class = !empty( $title_classes ) ? implode(" ",$title_classes) : '';
3923
-					$output = "<$title_tag class='$class' >$title</$title_tag>";
3924
-				}
3855
+            return $result;
3856
+        }
3925 3857
 
3926
-			}
3858
+        /**
3859
+         * General function to check if we are in a preview situation.
3860
+         *
3861
+         * @return bool
3862
+         *@since 1.0.6
3863
+         */
3864
+        public function is_preview() {
3865
+            $preview = false;
3866
+            if ( $this->is_divi_preview() ) {
3867
+                $preview = true;
3868
+            } elseif ( $this->is_elementor_preview() ) {
3869
+                $preview = true;
3870
+            } elseif ( $this->is_beaver_preview() ) {
3871
+                $preview = true;
3872
+            } elseif ( $this->is_siteorigin_preview() ) {
3873
+                $preview = true;
3874
+            } elseif ( $this->is_cornerstone_preview() ) {
3875
+                $preview = true;
3876
+            } elseif ( $this->is_fusion_preview() ) {
3877
+                $preview = true;
3878
+            } elseif ( $this->is_oxygen_preview() ) {
3879
+                $preview = true;
3880
+            } elseif( $this->is_block_content_call() ) {
3881
+                $preview = true;
3882
+            }
3927 3883
 
3928
-			return $output;
3929
-		}
3884
+            return $preview;
3885
+        }
3886
+
3887
+        /**
3888
+         * Output the super title.
3889
+         *
3890
+         * @param $args
3891
+         * @param array $instance
3892
+         *
3893
+         * @return string
3894
+         */
3895
+        public function output_title( $args, $instance = array() ) {
3896
+            $output = '';
3897
+            if ( ! empty( $instance['title'] ) ) {
3898
+                /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
3899
+                $title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
3900
+
3901
+                if(empty($instance['widget_title_tag'])){
3902
+                    $output = $args['before_title'] . $title . $args['after_title'];
3903
+                }else{
3904
+                    $title_tag = esc_attr( $instance['widget_title_tag'] );
3905
+
3906
+                    // classes
3907
+                    $title_classes = array();
3908
+                    $title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
3909
+                    $title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
3910
+                    $title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
3911
+                    $title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
3912
+                    $title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
3913
+                    $title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
3914
+                    $title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
3915
+                    $title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
3916
+                    $title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
3917
+                    $title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
3918
+                    $title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
3919
+                    $title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
3920
+                    $title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
3921
+
3922
+                    $class = !empty( $title_classes ) ? implode(" ",$title_classes) : '';
3923
+                    $output = "<$title_tag class='$class' >$title</$title_tag>";
3924
+                }
3925
+
3926
+            }
3927
+
3928
+            return $output;
3929
+        }
3930 3930
 
3931
-		/**
3932
-		 * Outputs the options form inputs for the widget.
3933
-		 *
3934
-		 * @param array $instance The widget options.
3935
-		 */
3936
-		public function form( $instance ) {
3931
+        /**
3932
+         * Outputs the options form inputs for the widget.
3933
+         *
3934
+         * @param array $instance The widget options.
3935
+         */
3936
+        public function form( $instance ) {
3937 3937
 
3938
-			// set widget instance
3939
-			$this->instance = $instance;
3938
+            // set widget instance
3939
+            $this->instance = $instance;
3940 3940
 
3941
-			// set it as a SD widget
3942
-			echo $this->widget_advanced_toggle();
3941
+            // set it as a SD widget
3942
+            echo $this->widget_advanced_toggle();
3943 3943
 
3944
-			echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
3945
-			$arguments_raw = $this->get_arguments();
3944
+            echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
3945
+            $arguments_raw = $this->get_arguments();
3946 3946
 
3947
-			if ( is_array( $arguments_raw ) ) {
3947
+            if ( is_array( $arguments_raw ) ) {
3948 3948
 
3949
-				$arguments = $this->group_arguments( $arguments_raw );
3949
+                $arguments = $this->group_arguments( $arguments_raw );
3950 3950
 
3951
-				// Do we have sections?
3952
-				$has_sections = $arguments == $arguments_raw ? false : true;
3951
+                // Do we have sections?
3952
+                $has_sections = $arguments == $arguments_raw ? false : true;
3953 3953
 
3954 3954
 
3955
-				if ( $has_sections ) {
3956
-					$panel_count = 0;
3957
-					foreach ( $arguments as $key => $args ) {
3955
+                if ( $has_sections ) {
3956
+                    $panel_count = 0;
3957
+                    foreach ( $arguments as $key => $args ) {
3958 3958
 
3959
-						?>
3959
+                        ?>
3960 3960
 						<script>
3961 3961
 							//							jQuery(this).find("i").toggleClass("fas fa-chevron-up fas fa-chevron-down");jQuery(this).next().toggle();
3962 3962
 						</script>
3963 3963
 						<?php
3964 3964
 
3965
-						$hide       = $panel_count ? ' style="display:none;" ' : '';
3966
-						$icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
3967
-						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>";
3968
-						echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
3965
+                        $hide       = $panel_count ? ' style="display:none;" ' : '';
3966
+                        $icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
3967
+                        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>";
3968
+                        echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
3969 3969
 
3970
-						foreach ( $args as $k => $a ) {
3970
+                        foreach ( $args as $k => $a ) {
3971 3971
 
3972
-							$this->widget_inputs_row_start($k, $a);
3973
-							$this->widget_inputs( $a, $instance );
3974
-							$this->widget_inputs_row_end($k, $a);
3972
+                            $this->widget_inputs_row_start($k, $a);
3973
+                            $this->widget_inputs( $a, $instance );
3974
+                            $this->widget_inputs_row_end($k, $a);
3975 3975
 
3976
-						}
3976
+                        }
3977 3977
 
3978
-						echo "</div>";
3978
+                        echo "</div>";
3979 3979
 
3980
-						$panel_count ++;
3980
+                        $panel_count ++;
3981 3981
 
3982
-					}
3983
-				} else {
3984
-					foreach ( $arguments as $key => $args ) {
3985
-						$this->widget_inputs_row_start($key, $args);
3986
-						$this->widget_inputs( $args, $instance );
3987
-						$this->widget_inputs_row_end($key, $args);
3988
-					}
3989
-				}
3982
+                    }
3983
+                } else {
3984
+                    foreach ( $arguments as $key => $args ) {
3985
+                        $this->widget_inputs_row_start($key, $args);
3986
+                        $this->widget_inputs( $args, $instance );
3987
+                        $this->widget_inputs_row_end($key, $args);
3988
+                    }
3989
+                }
3990 3990
 
3991
-			}
3992
-		}
3991
+            }
3992
+        }
3993 3993
 
3994
-		public function widget_inputs_row_start($key, $args){
3995
-			if(!empty($args['row'])){
3996
-				// maybe open
3997
-				if(!empty($args['row']['open'])){
3998
-					?>
3994
+        public function widget_inputs_row_start($key, $args){
3995
+            if(!empty($args['row'])){
3996
+                // maybe open
3997
+                if(!empty($args['row']['open'])){
3998
+                    ?>
3999 3999
 					<div class='bsui sd-argument ' data-argument='<?php echo esc_attr( $args['row']['key'] ); ?>' data-element_require='<?php if ( !empty($args['row']['element_require'])) {
4000
-						echo $this->convert_element_require( $args['row']['element_require'] );
4001
-					} ?>'>
4000
+                        echo $this->convert_element_require( $args['row']['element_require'] );
4001
+                    } ?>'>
4002 4002
 					<?php if(!empty($args['row']['title'])){ ?>
4003 4003
 					<label class="mb-0 "><?php echo esc_attr( $args['row']['title'] ); ?><?php echo $this->widget_field_desc( $args['row'] ); ?></label>
4004 4004
 					<?php }?>
4005 4005
 					<div class='row <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>'>
4006 4006
 					<div class='col pr-2'>
4007 4007
 					<?php
4008
-				}elseif(!empty($args['row']['close'])){
4009
-					echo "<div class='col pl-0'>";
4010
-				}else{
4011
-					echo "<div class='col pl-0 pr-2'>";
4012
-				}
4013
-			}
4014
-		}
4008
+                }elseif(!empty($args['row']['close'])){
4009
+                    echo "<div class='col pl-0'>";
4010
+                }else{
4011
+                    echo "<div class='col pl-0 pr-2'>";
4012
+                }
4013
+            }
4014
+        }
4015 4015
 
4016
-		public function widget_inputs_row_end($key, $args){
4016
+        public function widget_inputs_row_end($key, $args){
4017 4017
 
4018
-			if(!empty($args['row'])){
4019
-				// maybe close
4020
-				if(!empty($args['row']['close'])){
4021
-					echo "</div></div>";
4022
-				}
4018
+            if(!empty($args['row'])){
4019
+                // maybe close
4020
+                if(!empty($args['row']['close'])){
4021
+                    echo "</div></div>";
4022
+                }
4023 4023
 
4024
-				echo "</div>";
4025
-			}
4026
-		}
4024
+                echo "</div>";
4025
+            }
4026
+        }
4027 4027
 
4028
-		/**
4029
-		 * Get the hidden input that when added makes the advanced button show on widget settings.
4030
-		 *
4031
-		 * @return string
4032
-		 */
4033
-		public function widget_advanced_toggle() {
4034
-
4035
-			$output = '';
4036
-			if ( $this->block_show_advanced() ) {
4037
-				$val = 1;
4038
-			} else {
4039
-				$val = 0;
4040
-			}
4028
+        /**
4029
+         * Get the hidden input that when added makes the advanced button show on widget settings.
4030
+         *
4031
+         * @return string
4032
+         */
4033
+        public function widget_advanced_toggle() {
4041 4034
 
4042
-			$output .= "<input type='hidden'  class='sd-show-advanced' value='$val' />";
4035
+            $output = '';
4036
+            if ( $this->block_show_advanced() ) {
4037
+                $val = 1;
4038
+            } else {
4039
+                $val = 0;
4040
+            }
4043 4041
 
4044
-			return $output;
4045
-		}
4042
+            $output .= "<input type='hidden'  class='sd-show-advanced' value='$val' />";
4046 4043
 
4047
-		/**
4048
-		 * Convert require element.
4049
-		 *
4050
-		 * @param string $input Input element.
4051
-		 *
4052
-		 * @return string $output
4053
-		 *@since 1.0.0
4054
-		 *
4055
-		 */
4056
-		public function convert_element_require( $input ) {
4057
-
4058
-			$input = str_replace( "'", '"', $input );// we only want double quotes
4059
-
4060
-			$output = esc_attr( str_replace( array( "[%", "%]" ), array(
4061
-				"jQuery(form).find('[data-argument=\"",
4062
-				"\"]').find('input,select,textarea').val()"
4063
-			), $input ) );
4064
-
4065
-			return $output;
4066
-		}
4044
+            return $output;
4045
+        }
4067 4046
 
4068
-		/**
4069
-		 * Builds the inputs for the widget options.
4070
-		 *
4071
-		 * @param $args
4072
-		 * @param $instance
4073
-		 */
4074
-		public function widget_inputs( $args, $instance ) {
4075
-
4076
-			$class             = "";
4077
-			$element_require   = "";
4078
-			$custom_attributes = "";
4079
-
4080
-			// get value
4081
-			if ( isset( $instance[ $args['name'] ] ) ) {
4082
-				$value = $instance[ $args['name'] ];
4083
-			} elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
4084
-				$value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
4085
-			} else {
4086
-				$value = '';
4087
-			}
4047
+        /**
4048
+         * Convert require element.
4049
+         *
4050
+         * @param string $input Input element.
4051
+         *
4052
+         * @return string $output
4053
+         *@since 1.0.0
4054
+         *
4055
+         */
4056
+        public function convert_element_require( $input ) {
4088 4057
 
4089
-			// get placeholder
4090
-			if ( ! empty( $args['placeholder'] ) ) {
4091
-				$placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
4092
-			} else {
4093
-				$placeholder = '';
4094
-			}
4058
+            $input = str_replace( "'", '"', $input );// we only want double quotes
4095 4059
 
4096
-			// get if advanced
4097
-			if ( isset( $args['advanced'] ) && $args['advanced'] ) {
4098
-				$class .= " sd-advanced-setting ";
4099
-			}
4060
+            $output = esc_attr( str_replace( array( "[%", "%]" ), array(
4061
+                "jQuery(form).find('[data-argument=\"",
4062
+                "\"]').find('input,select,textarea').val()"
4063
+            ), $input ) );
4100 4064
 
4101
-			// element_require
4102
-			if ( isset( $args['element_require'] ) && $args['element_require'] ) {
4103
-				$element_require = $args['element_require'];
4104
-			}
4065
+            return $output;
4066
+        }
4105 4067
 
4106
-			// custom_attributes
4107
-			if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
4108
-				$custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
4109
-			}
4068
+        /**
4069
+         * Builds the inputs for the widget options.
4070
+         *
4071
+         * @param $args
4072
+         * @param $instance
4073
+         */
4074
+        public function widget_inputs( $args, $instance ) {
4075
+
4076
+            $class             = "";
4077
+            $element_require   = "";
4078
+            $custom_attributes = "";
4079
+
4080
+            // get value
4081
+            if ( isset( $instance[ $args['name'] ] ) ) {
4082
+                $value = $instance[ $args['name'] ];
4083
+            } elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
4084
+                $value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
4085
+            } else {
4086
+                $value = '';
4087
+            }
4088
+
4089
+            // get placeholder
4090
+            if ( ! empty( $args['placeholder'] ) ) {
4091
+                $placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
4092
+            } else {
4093
+                $placeholder = '';
4094
+            }
4110 4095
 
4096
+            // get if advanced
4097
+            if ( isset( $args['advanced'] ) && $args['advanced'] ) {
4098
+                $class .= " sd-advanced-setting ";
4099
+            }
4111 4100
 
4112
-			// before wrapper
4113
-			?>
4101
+            // element_require
4102
+            if ( isset( $args['element_require'] ) && $args['element_require'] ) {
4103
+                $element_require = $args['element_require'];
4104
+            }
4105
+
4106
+            // custom_attributes
4107
+            if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
4108
+                $custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
4109
+            }
4110
+
4111
+
4112
+            // before wrapper
4113
+            ?>
4114 4114
 			<p class="sd-argument <?php echo esc_attr( $class ); ?>"
4115 4115
 			data-argument='<?php echo esc_attr( $args['name'] ); ?>'
4116 4116
 			data-element_require='<?php if ( $element_require ) {
4117
-				echo $this->convert_element_require( $element_require );
4118
-			} ?>'
4117
+                echo $this->convert_element_require( $element_require );
4118
+            } ?>'
4119 4119
 			>
4120 4120
 			<?php
4121 4121
 
4122 4122
 
4123
-			switch ( $args['type'] ) {
4124
-				//array('text','password','number','email','tel','url','color')
4125
-				case "text":
4126
-				case "password":
4127
-				case "number":
4128
-				case "email":
4129
-				case "tel":
4130
-				case "url":
4131
-				case "color":
4132
-					?>
4123
+            switch ( $args['type'] ) {
4124
+                //array('text','password','number','email','tel','url','color')
4125
+                case "text":
4126
+                case "password":
4127
+                case "number":
4128
+                case "email":
4129
+                case "tel":
4130
+                case "url":
4131
+                case "color":
4132
+                    ?>
4133 4133
 					<label
4134 4134
 						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>
4135 4135
 					<input <?php echo $placeholder; ?> class="widefat"
@@ -4140,47 +4140,47 @@  discard block
 block discarded – undo
4140 4140
 						                               value="<?php echo esc_attr( $value ); ?>">
4141 4141
 					<?php
4142 4142
 
4143
-					break;
4144
-				case "select":
4145
-					$multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
4146
-					if ( $multiple ) {
4147
-						if ( empty( $value ) ) {
4148
-							$value = array();
4149
-						}
4150
-					}
4151
-					?>
4143
+                    break;
4144
+                case "select":
4145
+                    $multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
4146
+                    if ( $multiple ) {
4147
+                        if ( empty( $value ) ) {
4148
+                            $value = array();
4149
+                        }
4150
+                    }
4151
+                    ?>
4152 4152
 					<label
4153 4153
 						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>
4154 4154
 					<select <?php echo $placeholder; ?> class="widefat"
4155 4155
 						<?php echo $custom_attributes; ?>
4156 4156
 						                                id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
4157 4157
 						                                name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) );
4158
-						                                if ( $multiple ) {
4159
-							                                echo "[]";
4160
-						                                } ?>"
4158
+                                                        if ( $multiple ) {
4159
+                                                            echo "[]";
4160
+                                                        } ?>"
4161 4161
 						<?php if ( $multiple ) {
4162
-							echo "multiple";
4163
-						} //@todo not implemented yet due to gutenberg not supporting it
4164
-						?>
4162
+                            echo "multiple";
4163
+                        } //@todo not implemented yet due to gutenberg not supporting it
4164
+                        ?>
4165 4165
 					>
4166 4166
 						<?php
4167 4167
 
4168
-						if ( ! empty( $args['options'] ) ) {
4169
-							foreach ( $args['options'] as $val => $label ) {
4170
-								if ( $multiple ) {
4171
-									$selected = in_array( $val, $value ) ? 'selected="selected"' : '';
4172
-								} else {
4173
-									$selected = selected( $value, $val, false );
4174
-								}
4175
-								echo "<option value='$val' " . $selected . ">$label</option>";
4176
-							}
4177
-						}
4178
-						?>
4168
+                        if ( ! empty( $args['options'] ) ) {
4169
+                            foreach ( $args['options'] as $val => $label ) {
4170
+                                if ( $multiple ) {
4171
+                                    $selected = in_array( $val, $value ) ? 'selected="selected"' : '';
4172
+                                } else {
4173
+                                    $selected = selected( $value, $val, false );
4174
+                                }
4175
+                                echo "<option value='$val' " . $selected . ">$label</option>";
4176
+                            }
4177
+                        }
4178
+                        ?>
4179 4179
 					</select>
4180 4180
 					<?php
4181
-					break;
4182
-				case "checkbox":
4183
-					?>
4181
+                    break;
4182
+                case "checkbox":
4183
+                    ?>
4184 4184
 					<input <?php echo $placeholder; ?>
4185 4185
 						<?php checked( 1, $value, true ) ?>
4186 4186
 						<?php echo $custom_attributes; ?>
@@ -4190,9 +4190,9 @@  discard block
 block discarded – undo
4190 4190
 					<label
4191 4191
 						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>
4192 4192
 					<?php
4193
-					break;
4194
-				case "textarea":
4195
-					?>
4193
+                    break;
4194
+                case "textarea":
4195
+                    ?>
4196 4196
 					<label
4197 4197
 						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>
4198 4198
 					<textarea <?php echo $placeholder; ?> class="widefat"
@@ -4202,282 +4202,282 @@  discard block
 block discarded – undo
4202 4202
 					><?php echo esc_attr( $value ); ?></textarea>
4203 4203
 					<?php
4204 4204
 
4205
-					break;
4206
-				case "hidden":
4207
-					?>
4205
+                    break;
4206
+                case "hidden":
4207
+                    ?>
4208 4208
 					<input id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
4209 4209
 					       name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="hidden"
4210 4210
 					       value="<?php echo esc_attr( $value ); ?>">
4211 4211
 					<?php
4212
-					break;
4213
-				default:
4214
-					echo "No input type found!"; // @todo we need to add more input types.
4215
-			}
4212
+                    break;
4213
+                default:
4214
+                    echo "No input type found!"; // @todo we need to add more input types.
4215
+            }
4216 4216
 
4217
-			// after wrapper
4218
-			?>
4217
+            // after wrapper
4218
+            ?>
4219 4219
 			</p>
4220 4220
 			<?php
4221 4221
 
4222 4222
 
4223
-		}
4223
+        }
4224 4224
 
4225
-		public function get_widget_icon($icon = 'box-top', $title = ''){
4226
-			if($icon=='box-top'){
4227
-				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>';
4228
-			}elseif($icon=='box-right'){
4229
-				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>';
4230
-			}elseif($icon=='box-bottom'){
4231
-				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>';
4232
-			}elseif($icon=='box-left'){
4233
-				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>';
4234
-			}
4235
-		}
4225
+        public function get_widget_icon($icon = 'box-top', $title = ''){
4226
+            if($icon=='box-top'){
4227
+                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>';
4228
+            }elseif($icon=='box-right'){
4229
+                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>';
4230
+            }elseif($icon=='box-bottom'){
4231
+                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>';
4232
+            }elseif($icon=='box-left'){
4233
+                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>';
4234
+            }
4235
+        }
4236 4236
 
4237
-		/**
4238
-		 * Get the widget input description html.
4239
-		 *
4240
-		 * @param $args
4241
-		 *
4242
-		 * @return string
4243
-		 * @todo, need to make its own tooltip script
4244
-		 */
4245
-		public function widget_field_desc( $args ) {
4246
-
4247
-			$description = '';
4248
-			if ( isset( $args['desc'] ) && $args['desc'] ) {
4249
-				if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
4250
-					$description = $this->desc_tip( $args['desc'] );
4251
-				} else {
4252
-					$description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
4253
-				}
4254
-			}
4237
+        /**
4238
+         * Get the widget input description html.
4239
+         *
4240
+         * @param $args
4241
+         *
4242
+         * @return string
4243
+         * @todo, need to make its own tooltip script
4244
+         */
4245
+        public function widget_field_desc( $args ) {
4246
+
4247
+            $description = '';
4248
+            if ( isset( $args['desc'] ) && $args['desc'] ) {
4249
+                if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
4250
+                    $description = $this->desc_tip( $args['desc'] );
4251
+                } else {
4252
+                    $description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
4253
+                }
4254
+            }
4255 4255
 
4256
-			return $description;
4257
-		}
4256
+            return $description;
4257
+        }
4258 4258
 
4259
-		/**
4260
-		 * Get the widget input title html.
4261
-		 *
4262
-		 * @param $args
4263
-		 *
4264
-		 * @return string
4265
-		 */
4266
-		public function widget_field_title( $args ) {
4267
-
4268
-			$title = '';
4269
-			if ( isset( $args['title'] ) && $args['title'] ) {
4270
-				if ( isset( $args['icon'] ) && $args['icon'] ) {
4271
-					$title = self::get_widget_icon( $args['icon'], $args['title']  );
4272
-				} else {
4273
-					$title = esc_attr($args['title']);
4274
-				}
4275
-			}
4259
+        /**
4260
+         * Get the widget input title html.
4261
+         *
4262
+         * @param $args
4263
+         *
4264
+         * @return string
4265
+         */
4266
+        public function widget_field_title( $args ) {
4267
+
4268
+            $title = '';
4269
+            if ( isset( $args['title'] ) && $args['title'] ) {
4270
+                if ( isset( $args['icon'] ) && $args['icon'] ) {
4271
+                    $title = self::get_widget_icon( $args['icon'], $args['title']  );
4272
+                } else {
4273
+                    $title = esc_attr($args['title']);
4274
+                }
4275
+            }
4276 4276
 
4277
-			return $title;
4278
-		}
4277
+            return $title;
4278
+        }
4279 4279
 
4280
-		/**
4281
-		 * Get the tool tip html.
4282
-		 *
4283
-		 * @param $tip
4284
-		 * @param bool $allow_html
4285
-		 *
4286
-		 * @return string
4287
-		 */
4288
-		function desc_tip( $tip, $allow_html = false ) {
4289
-			if ( $allow_html ) {
4290
-				$tip = $this->sanitize_tooltip( $tip );
4291
-			} else {
4292
-				$tip = esc_attr( $tip );
4293
-			}
4280
+        /**
4281
+         * Get the tool tip html.
4282
+         *
4283
+         * @param $tip
4284
+         * @param bool $allow_html
4285
+         *
4286
+         * @return string
4287
+         */
4288
+        function desc_tip( $tip, $allow_html = false ) {
4289
+            if ( $allow_html ) {
4290
+                $tip = $this->sanitize_tooltip( $tip );
4291
+            } else {
4292
+                $tip = esc_attr( $tip );
4293
+            }
4294 4294
 
4295
-			return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
4296
-		}
4295
+            return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
4296
+        }
4297 4297
 
4298
-		/**
4299
-		 * Sanitize a string destined to be a tooltip.
4300
-		 *
4301
-		 * @param string $var
4302
-		 *
4303
-		 * @return string
4304
-		 */
4305
-		public function sanitize_tooltip( $var ) {
4306
-			return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
4307
-				'br'     => array(),
4308
-				'em'     => array(),
4309
-				'strong' => array(),
4310
-				'small'  => array(),
4311
-				'span'   => array(),
4312
-				'ul'     => array(),
4313
-				'li'     => array(),
4314
-				'ol'     => array(),
4315
-				'p'      => array(),
4316
-			) ) );
4317
-		}
4298
+        /**
4299
+         * Sanitize a string destined to be a tooltip.
4300
+         *
4301
+         * @param string $var
4302
+         *
4303
+         * @return string
4304
+         */
4305
+        public function sanitize_tooltip( $var ) {
4306
+            return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
4307
+                'br'     => array(),
4308
+                'em'     => array(),
4309
+                'strong' => array(),
4310
+                'small'  => array(),
4311
+                'span'   => array(),
4312
+                'ul'     => array(),
4313
+                'li'     => array(),
4314
+                'ol'     => array(),
4315
+                'p'      => array(),
4316
+            ) ) );
4317
+        }
4318 4318
 
4319
-		/**
4320
-		 * Processing widget options on save
4321
-		 *
4322
-		 * @param array $new_instance The new options
4323
-		 * @param array $old_instance The previous options
4324
-		 *
4325
-		 * @return array
4326
-		 * @todo we should add some sanitation here.
4327
-		 */
4328
-		public function update( $new_instance, $old_instance ) {
4329
-
4330
-			//save the widget
4331
-			$instance = array_merge( (array) $old_instance, (array) $new_instance );
4332
-
4333
-			// set widget instance
4334
-			$this->instance = $instance;
4335
-
4336
-			if ( empty( $this->arguments ) ) {
4337
-				$this->get_arguments();
4338
-			}
4319
+        /**
4320
+         * Processing widget options on save
4321
+         *
4322
+         * @param array $new_instance The new options
4323
+         * @param array $old_instance The previous options
4324
+         *
4325
+         * @return array
4326
+         * @todo we should add some sanitation here.
4327
+         */
4328
+        public function update( $new_instance, $old_instance ) {
4339 4329
 
4340
-			// check for checkboxes
4341
-			if ( ! empty( $this->arguments ) ) {
4342
-				foreach ( $this->arguments as $argument ) {
4343
-					if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
4344
-						$instance[ $argument['name'] ] = '0';
4345
-					}
4346
-				}
4347
-			}
4330
+            //save the widget
4331
+            $instance = array_merge( (array) $old_instance, (array) $new_instance );
4348 4332
 
4349
-			return $instance;
4350
-		}
4333
+            // set widget instance
4334
+            $this->instance = $instance;
4351 4335
 
4352
-		/**
4353
-		 * Checks if the current call is a ajax call to get the block content.
4354
-		 *
4355
-		 * This can be used in your widget to return different content as the block content.
4356
-		 *
4357
-		 * @return bool
4358
-		 *@since 1.0.3
4359
-		 */
4360
-		public function is_block_content_call() {
4361
-			$result = false;
4362
-			if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
4363
-				$result = true;
4364
-			}
4336
+            if ( empty( $this->arguments ) ) {
4337
+                $this->get_arguments();
4338
+            }
4365 4339
 
4366
-			return $result;
4367
-		}
4340
+            // check for checkboxes
4341
+            if ( ! empty( $this->arguments ) ) {
4342
+                foreach ( $this->arguments as $argument ) {
4343
+                    if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
4344
+                        $instance[ $argument['name'] ] = '0';
4345
+                    }
4346
+                }
4347
+            }
4368 4348
 
4369
-		/**
4370
-		 * Get an instance hash that will be unique to the type and settings.
4371
-		 *
4372
-		 * @return string
4373
-		 *@since 1.0.20
4374
-		 */
4375
-		public function get_instance_hash(){
4376
-			$instance_string = $this->base_id.serialize($this->instance);
4377
-			return hash('crc32b',$instance_string);
4378
-		}
4349
+            return $instance;
4350
+        }
4379 4351
 
4380
-		/**
4381
-		 * Generate and return inline styles from CSS rules that will match the unique class of the instance.
4382
-		 *
4383
-		 * @param array $rules
4384
-		 *
4385
-		 * @return string
4386
-		 *@since 1.0.20
4387
-		 */
4388
-		public function get_instance_style($rules = array()){
4389
-			$css = '';
4390
-
4391
-			if(!empty($rules)){
4392
-				$rules = array_unique($rules);
4393
-				$instance_hash = $this->get_instance_hash();
4394
-				$css .= "<style>";
4395
-				foreach($rules as $rule){
4396
-					$css .= ".sdel-$instance_hash $rule";
4397
-				}
4398
-				$css .= "</style>";
4399
-			}
4352
+        /**
4353
+         * Checks if the current call is a ajax call to get the block content.
4354
+         *
4355
+         * This can be used in your widget to return different content as the block content.
4356
+         *
4357
+         * @return bool
4358
+         *@since 1.0.3
4359
+         */
4360
+        public function is_block_content_call() {
4361
+            $result = false;
4362
+            if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
4363
+                $result = true;
4364
+            }
4400 4365
 
4401
-			return $css;
4402
-		}
4366
+            return $result;
4367
+        }
4368
+
4369
+        /**
4370
+         * Get an instance hash that will be unique to the type and settings.
4371
+         *
4372
+         * @return string
4373
+         *@since 1.0.20
4374
+         */
4375
+        public function get_instance_hash(){
4376
+            $instance_string = $this->base_id.serialize($this->instance);
4377
+            return hash('crc32b',$instance_string);
4378
+        }
4379
+
4380
+        /**
4381
+         * Generate and return inline styles from CSS rules that will match the unique class of the instance.
4382
+         *
4383
+         * @param array $rules
4384
+         *
4385
+         * @return string
4386
+         *@since 1.0.20
4387
+         */
4388
+        public function get_instance_style($rules = array()){
4389
+            $css = '';
4390
+
4391
+            if(!empty($rules)){
4392
+                $rules = array_unique($rules);
4393
+                $instance_hash = $this->get_instance_hash();
4394
+                $css .= "<style>";
4395
+                foreach($rules as $rule){
4396
+                    $css .= ".sdel-$instance_hash $rule";
4397
+                }
4398
+                $css .= "</style>";
4399
+            }
4400
+
4401
+            return $css;
4402
+        }
4403 4403
 
4404
-		/**
4405
-		 * Encode shortcodes tags.
4406
-		 *
4407
-		 * @param string $content Content to search for shortcode tags.
4408
-		 *
4404
+        /**
4405
+         * Encode shortcodes tags.
4406
+         *
4407
+         * @param string $content Content to search for shortcode tags.
4408
+         *
4409 4409
 *@return string Content with shortcode tags removed.
4410
-		 *@since 1.0.28
4411
-		 *
4412
-		 */
4413
-		public function encode_shortcodes( $content ) {
4414
-			// Avoids existing encoded tags.
4415
-			$trans   = array(
4416
-				'&#91;' => '&#091;',
4417
-				'&#93;' => '&#093;',
4418
-				'&amp;#91;' => '&#091;',
4419
-				'&amp;#93;' => '&#093;',
4420
-				'&lt;' => '&0lt;',
4421
-				'&gt;' => '&0gt;',
4422
-				'&amp;lt;' => '&0lt;',
4423
-				'&amp;gt;' => '&0gt;',
4424
-			);
4425
-
4426
-			$content = strtr( $content, $trans );
4427
-
4428
-			$trans   = array(
4429
-				'[' => '&#91;',
4430
-				']' => '&#93;',
4431
-				'<' => '&lt;',
4432
-				'>' => '&gt;',
4433
-				'"' => '&quot;',
4434
-				"'" => '&apos;',
4435
-			);
4436
-
4437
-			$content = strtr( $content, $trans );
4438
-
4439
-			return $content;
4440
-		}
4410
+         *@since 1.0.28
4411
+         *
4412
+         */
4413
+        public function encode_shortcodes( $content ) {
4414
+            // Avoids existing encoded tags.
4415
+            $trans   = array(
4416
+                '&#91;' => '&#091;',
4417
+                '&#93;' => '&#093;',
4418
+                '&amp;#91;' => '&#091;',
4419
+                '&amp;#93;' => '&#093;',
4420
+                '&lt;' => '&0lt;',
4421
+                '&gt;' => '&0gt;',
4422
+                '&amp;lt;' => '&0lt;',
4423
+                '&amp;gt;' => '&0gt;',
4424
+            );
4425
+
4426
+            $content = strtr( $content, $trans );
4427
+
4428
+            $trans   = array(
4429
+                '[' => '&#91;',
4430
+                ']' => '&#93;',
4431
+                '<' => '&lt;',
4432
+                '>' => '&gt;',
4433
+                '"' => '&quot;',
4434
+                "'" => '&apos;',
4435
+            );
4436
+
4437
+            $content = strtr( $content, $trans );
4438
+
4439
+            return $content;
4440
+        }
4441 4441
 
4442
-		/**
4443
-		 * Remove encoded shortcod tags.
4444
-		 *
4445
-		 * @param string $content Content to search for shortcode tags.
4446
-		 *
4442
+        /**
4443
+         * Remove encoded shortcod tags.
4444
+         *
4445
+         * @param string $content Content to search for shortcode tags.
4446
+         *
4447 4447
 *@return string Content with decoded shortcode tags.
4448
-		 *@since 1.0.28
4449
-		 *
4450
-		 */
4451
-		public function decode_shortcodes( $content ) {
4452
-			$trans   = array(
4453
-				'&#91;' => '[',
4454
-				'&#93;' => ']',
4455
-				'&amp;#91;' => '[',
4456
-				'&amp;#93;' => ']',
4457
-				'&lt;' => '<',
4458
-				'&gt;' => '>',
4459
-				'&amp;lt;' => '<',
4460
-				'&amp;gt;' => '>',
4461
-				'&quot;' => '"',
4462
-				'&apos;' => "'",
4463
-			);
4464
-
4465
-			$content = strtr( $content, $trans );
4466
-
4467
-			$trans   = array(
4468
-				'&#091;' => '&#91;',
4469
-				'&#093;' => '&#93;',
4470
-				'&amp;#091;' => '&#91;',
4471
-				'&amp;#093;' => '&#93;',
4472
-				'&0lt;' => '&lt;',
4473
-				'&0gt;' => '&gt;',
4474
-				'&amp;0lt;' => '&lt;',
4475
-				'&amp;0gt;' => '&gt;',
4476
-			);
4477
-
4478
-			$content = strtr( $content, $trans );
4479
-
4480
-			return $content;
4481
-		}
4482
-	}
4448
+         *@since 1.0.28
4449
+         *
4450
+         */
4451
+        public function decode_shortcodes( $content ) {
4452
+            $trans   = array(
4453
+                '&#91;' => '[',
4454
+                '&#93;' => ']',
4455
+                '&amp;#91;' => '[',
4456
+                '&amp;#93;' => ']',
4457
+                '&lt;' => '<',
4458
+                '&gt;' => '>',
4459
+                '&amp;lt;' => '<',
4460
+                '&amp;gt;' => '>',
4461
+                '&quot;' => '"',
4462
+                '&apos;' => "'",
4463
+            );
4464
+
4465
+            $content = strtr( $content, $trans );
4466
+
4467
+            $trans   = array(
4468
+                '&#091;' => '&#91;',
4469
+                '&#093;' => '&#93;',
4470
+                '&amp;#091;' => '&#91;',
4471
+                '&amp;#093;' => '&#93;',
4472
+                '&0lt;' => '&lt;',
4473
+                '&0gt;' => '&gt;',
4474
+                '&amp;0lt;' => '&lt;',
4475
+                '&amp;0gt;' => '&gt;',
4476
+            );
4477
+
4478
+            $content = strtr( $content, $trans );
4479
+
4480
+            return $content;
4481
+        }
4482
+    }
4483 4483
 }
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/sd-functions.php 1 patch
Indentation   +1655 added lines, -1655 removed lines patch added patch discarded remove patch
@@ -11,21 +11,21 @@  discard block
 block discarded – undo
11 11
  * @return mixed|void
12 12
  */
13 13
 function sd_pagenow_exclude() {
14
-	return apply_filters(
15
-		'sd_pagenow_exclude',
16
-		array(
17
-			'upload.php',
18
-			'edit-comments.php',
19
-			'edit-tags.php',
20
-			'index.php',
21
-			'media-new.php',
22
-			'options-discussion.php',
23
-			'options-writing.php',
24
-			'edit.php',
25
-			'themes.php',
26
-			'users.php',
27
-		)
28
-	);
14
+    return apply_filters(
15
+        'sd_pagenow_exclude',
16
+        array(
17
+            'upload.php',
18
+            'edit-comments.php',
19
+            'edit-tags.php',
20
+            'index.php',
21
+            'media-new.php',
22
+            'options-discussion.php',
23
+            'options-writing.php',
24
+            'edit.php',
25
+            'themes.php',
26
+            'users.php',
27
+        )
28
+    );
29 29
 }
30 30
 
31 31
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
  * @return mixed|void
38 38
  */
39 39
 function sd_widget_exclude() {
40
-	return apply_filters( 'sd_widget_exclude', array() );
40
+    return apply_filters( 'sd_widget_exclude', array() );
41 41
 }
42 42
 
43 43
 
@@ -50,68 +50,68 @@  discard block
 block discarded – undo
50 50
  * @return array
51 51
  */
52 52
 function sd_get_margin_input( $type = 'mt', $overwrite = array(), $include_negatives = true ) {
53
-	$options = array(
54
-		''     => __( 'None', 'super-duper' ),
55
-		'auto' => __( 'auto', 'super-duper' ),
56
-		'0'    => '0',
57
-		'1'    => '1',
58
-		'2'    => '2',
59
-		'3'    => '3',
60
-		'4'    => '4',
61
-		'5'    => '5',
62
-	);
63
-
64
-	if ( $include_negatives ) {
65
-		$options['n1'] = '-1';
66
-		$options['n2'] = '-2';
67
-		$options['n3'] = '-3';
68
-		$options['n4'] = '-4';
69
-		$options['n5'] = '-5';
70
-	}
71
-
72
-	$defaults = array(
73
-		'type'     => 'select',
74
-		'title'    => __( 'Margin top', 'super-duper' ),
75
-		'options'  => $options,
76
-		'default'  => '',
77
-		'desc_tip' => true,
78
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
79
-	);
80
-
81
-	// title
82
-	if ( $type == 'mt' ) {
83
-		$defaults['title'] = __( 'Margin top', 'super-duper' );
84
-		$defaults['icon']  = 'box-top';
85
-		$defaults['row']   = array(
86
-			'title' => __( 'Margins', 'super-duper' ),
87
-			'key'   => 'wrapper-margins',
88
-			'open'  => true,
89
-			'class' => 'text-center',
90
-		);
91
-	} elseif ( $type == 'mr' ) {
92
-		$defaults['title'] = __( 'Margin right', 'super-duper' );
93
-		$defaults['icon']  = 'box-right';
94
-		$defaults['row']   = array(
95
-			'key' => 'wrapper-margins',
96
-		);
97
-	} elseif ( $type == 'mb' ) {
98
-		$defaults['title'] = __( 'Margin bottom', 'super-duper' );
99
-		$defaults['icon']  = 'box-bottom';
100
-		$defaults['row']   = array(
101
-			'key' => 'wrapper-margins',
102
-		);
103
-	} elseif ( $type == 'ml' ) {
104
-		$defaults['title'] = __( 'Margin left', 'super-duper' );
105
-		$defaults['icon']  = 'box-left';
106
-		$defaults['row']   = array(
107
-			'key'   => 'wrapper-margins',
108
-			'close' => true,
109
-		);
110
-	}
111
-
112
-	$input = wp_parse_args( $overwrite, $defaults );
113
-
114
-	return $input;
53
+    $options = array(
54
+        ''     => __( 'None', 'super-duper' ),
55
+        'auto' => __( 'auto', 'super-duper' ),
56
+        '0'    => '0',
57
+        '1'    => '1',
58
+        '2'    => '2',
59
+        '3'    => '3',
60
+        '4'    => '4',
61
+        '5'    => '5',
62
+    );
63
+
64
+    if ( $include_negatives ) {
65
+        $options['n1'] = '-1';
66
+        $options['n2'] = '-2';
67
+        $options['n3'] = '-3';
68
+        $options['n4'] = '-4';
69
+        $options['n5'] = '-5';
70
+    }
71
+
72
+    $defaults = array(
73
+        'type'     => 'select',
74
+        'title'    => __( 'Margin top', 'super-duper' ),
75
+        'options'  => $options,
76
+        'default'  => '',
77
+        'desc_tip' => true,
78
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
79
+    );
80
+
81
+    // title
82
+    if ( $type == 'mt' ) {
83
+        $defaults['title'] = __( 'Margin top', 'super-duper' );
84
+        $defaults['icon']  = 'box-top';
85
+        $defaults['row']   = array(
86
+            'title' => __( 'Margins', 'super-duper' ),
87
+            'key'   => 'wrapper-margins',
88
+            'open'  => true,
89
+            'class' => 'text-center',
90
+        );
91
+    } elseif ( $type == 'mr' ) {
92
+        $defaults['title'] = __( 'Margin right', 'super-duper' );
93
+        $defaults['icon']  = 'box-right';
94
+        $defaults['row']   = array(
95
+            'key' => 'wrapper-margins',
96
+        );
97
+    } elseif ( $type == 'mb' ) {
98
+        $defaults['title'] = __( 'Margin bottom', 'super-duper' );
99
+        $defaults['icon']  = 'box-bottom';
100
+        $defaults['row']   = array(
101
+            'key' => 'wrapper-margins',
102
+        );
103
+    } elseif ( $type == 'ml' ) {
104
+        $defaults['title'] = __( 'Margin left', 'super-duper' );
105
+        $defaults['icon']  = 'box-left';
106
+        $defaults['row']   = array(
107
+            'key'   => 'wrapper-margins',
108
+            'close' => true,
109
+        );
110
+    }
111
+
112
+    $input = wp_parse_args( $overwrite, $defaults );
113
+
114
+    return $input;
115 115
 }
116 116
 
117 117
 /**
@@ -123,60 +123,60 @@  discard block
 block discarded – undo
123 123
  * @return array
124 124
  */
125 125
 function sd_get_padding_input( $type = 'pt', $overwrite = array() ) {
126
-	$options = array(
127
-		''  => __( 'None', 'super-duper' ),
128
-		'0' => '0',
129
-		'1' => '1',
130
-		'2' => '2',
131
-		'3' => '3',
132
-		'4' => '4',
133
-		'5' => '5',
134
-	);
135
-
136
-	$defaults = array(
137
-		'type'     => 'select',
138
-		'title'    => __( 'Padding top', 'super-duper' ),
139
-		'options'  => $options,
140
-		'default'  => '',
141
-		'desc_tip' => true,
142
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
143
-	);
144
-
145
-	// title
146
-	if ( $type == 'pt' ) {
147
-		$defaults['title'] = __( 'Padding top', 'super-duper' );
148
-		$defaults['icon']  = 'box-top';
149
-		$defaults['row']   = array(
150
-			'title' => __( 'Padding', 'super-duper' ),
151
-			'key'   => 'wrapper-padding',
152
-			'open'  => true,
153
-			'class' => 'text-center',
154
-		);
155
-	} elseif ( $type == 'pr' ) {
156
-		$defaults['title'] = __( 'Padding right', 'super-duper' );
157
-		$defaults['icon']  = 'box-right';
158
-		$defaults['row']   = array(
159
-			'key' => 'wrapper-padding',
160
-		);
161
-	} elseif ( $type == 'pb' ) {
162
-		$defaults['title'] = __( 'Padding bottom', 'super-duper' );
163
-		$defaults['icon']  = 'box-bottom';
164
-		$defaults['row']   = array(
165
-			'key' => 'wrapper-padding',
166
-		);
167
-	} elseif ( $type == 'pl' ) {
168
-		$defaults['title'] = __( 'Padding left', 'super-duper' );
169
-		$defaults['icon']  = 'box-left';
170
-		$defaults['row']   = array(
171
-			'key'   => 'wrapper-padding',
172
-			'close' => true,
173
-
174
-		);
175
-	}
176
-
177
-	$input = wp_parse_args( $overwrite, $defaults );
178
-
179
-	return $input;
126
+    $options = array(
127
+        ''  => __( 'None', 'super-duper' ),
128
+        '0' => '0',
129
+        '1' => '1',
130
+        '2' => '2',
131
+        '3' => '3',
132
+        '4' => '4',
133
+        '5' => '5',
134
+    );
135
+
136
+    $defaults = array(
137
+        'type'     => 'select',
138
+        'title'    => __( 'Padding top', 'super-duper' ),
139
+        'options'  => $options,
140
+        'default'  => '',
141
+        'desc_tip' => true,
142
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
143
+    );
144
+
145
+    // title
146
+    if ( $type == 'pt' ) {
147
+        $defaults['title'] = __( 'Padding top', 'super-duper' );
148
+        $defaults['icon']  = 'box-top';
149
+        $defaults['row']   = array(
150
+            'title' => __( 'Padding', 'super-duper' ),
151
+            'key'   => 'wrapper-padding',
152
+            'open'  => true,
153
+            'class' => 'text-center',
154
+        );
155
+    } elseif ( $type == 'pr' ) {
156
+        $defaults['title'] = __( 'Padding right', 'super-duper' );
157
+        $defaults['icon']  = 'box-right';
158
+        $defaults['row']   = array(
159
+            'key' => 'wrapper-padding',
160
+        );
161
+    } elseif ( $type == 'pb' ) {
162
+        $defaults['title'] = __( 'Padding bottom', 'super-duper' );
163
+        $defaults['icon']  = 'box-bottom';
164
+        $defaults['row']   = array(
165
+            'key' => 'wrapper-padding',
166
+        );
167
+    } elseif ( $type == 'pl' ) {
168
+        $defaults['title'] = __( 'Padding left', 'super-duper' );
169
+        $defaults['icon']  = 'box-left';
170
+        $defaults['row']   = array(
171
+            'key'   => 'wrapper-padding',
172
+            'close' => true,
173
+
174
+        );
175
+    }
176
+
177
+    $input = wp_parse_args( $overwrite, $defaults );
178
+
179
+    return $input;
180 180
 }
181 181
 
182 182
 /**
@@ -189,57 +189,57 @@  discard block
 block discarded – undo
189 189
  */
190 190
 function sd_get_border_input( $type = 'border', $overwrite = array() ) {
191 191
 
192
-	$defaults = array(
193
-		'type'     => 'select',
194
-		'title'    => __( 'Border' ),
195
-		'options'  => array(),
196
-		'default'  => '',
197
-		'desc_tip' => true,
198
-		'group'    => __( 'Wrapper Styles', 'geodirectory' ),
199
-	);
200
-
201
-	// title
202
-	if ( $type == 'rounded' ) {
203
-		$defaults['title']   = __( 'Border radius type', 'super-duper' );
204
-		$defaults['options'] = array(
205
-			''               => __( 'Default', 'super-duper' ),
206
-			'rounded'        => 'rounded',
207
-			'rounded-top'    => 'rounded-top',
208
-			'rounded-right'  => 'rounded-right',
209
-			'rounded-bottom' => 'rounded-bottom',
210
-			'rounded-left'   => 'rounded-left',
211
-			'rounded-circle' => 'rounded-circle',
212
-			'rounded-pill'   => 'rounded-pill',
213
-			'rounded-0'      => 'rounded-0',
214
-		);
215
-	} elseif ( $type == 'rounded_size' ) {
216
-		$defaults['title']   = __( 'Border radius size', 'super-duper' );
217
-		$defaults['options'] = array(
218
-			''   => __( 'Default', 'super-duper' ),
219
-			'sm' => __( 'Small', 'super-duper' ),
220
-			'lg' => __( 'Large', 'super-duper' ),
221
-		);
222
-	} elseif ( $type == 'type' ) {
223
-		$defaults['title']   = __( 'Border type', 'super-duper' );
224
-		$defaults['options'] = array(
225
-			''              => __( 'None', 'super-duper' ),
226
-			'border'        => __( 'Full', 'super-duper' ),
227
-			'border-top'    => __( 'Top', 'super-duper' ),
228
-			'border-bottom' => __( 'Bottom', 'super-duper' ),
229
-			'border-left'   => __( 'Left', 'super-duper' ),
230
-			'border-right'  => __( 'Right', 'super-duper' ),
231
-		);
232
-	} else {
233
-		$defaults['title']   = __( 'Border color' );
234
-		$defaults['options'] = array(
235
-			                       ''  => __( 'Default', 'super-duper' ),
236
-			                       '0' => __( 'None', 'super-duper' ),
237
-		                       ) + sd_aui_colors();
238
-	}
239
-
240
-	$input = wp_parse_args( $overwrite, $defaults );
241
-
242
-	return $input;
192
+    $defaults = array(
193
+        'type'     => 'select',
194
+        'title'    => __( 'Border' ),
195
+        'options'  => array(),
196
+        'default'  => '',
197
+        'desc_tip' => true,
198
+        'group'    => __( 'Wrapper Styles', 'geodirectory' ),
199
+    );
200
+
201
+    // title
202
+    if ( $type == 'rounded' ) {
203
+        $defaults['title']   = __( 'Border radius type', 'super-duper' );
204
+        $defaults['options'] = array(
205
+            ''               => __( 'Default', 'super-duper' ),
206
+            'rounded'        => 'rounded',
207
+            'rounded-top'    => 'rounded-top',
208
+            'rounded-right'  => 'rounded-right',
209
+            'rounded-bottom' => 'rounded-bottom',
210
+            'rounded-left'   => 'rounded-left',
211
+            'rounded-circle' => 'rounded-circle',
212
+            'rounded-pill'   => 'rounded-pill',
213
+            'rounded-0'      => 'rounded-0',
214
+        );
215
+    } elseif ( $type == 'rounded_size' ) {
216
+        $defaults['title']   = __( 'Border radius size', 'super-duper' );
217
+        $defaults['options'] = array(
218
+            ''   => __( 'Default', 'super-duper' ),
219
+            'sm' => __( 'Small', 'super-duper' ),
220
+            'lg' => __( 'Large', 'super-duper' ),
221
+        );
222
+    } elseif ( $type == 'type' ) {
223
+        $defaults['title']   = __( 'Border type', 'super-duper' );
224
+        $defaults['options'] = array(
225
+            ''              => __( 'None', 'super-duper' ),
226
+            'border'        => __( 'Full', 'super-duper' ),
227
+            'border-top'    => __( 'Top', 'super-duper' ),
228
+            'border-bottom' => __( 'Bottom', 'super-duper' ),
229
+            'border-left'   => __( 'Left', 'super-duper' ),
230
+            'border-right'  => __( 'Right', 'super-duper' ),
231
+        );
232
+    } else {
233
+        $defaults['title']   = __( 'Border color' );
234
+        $defaults['options'] = array(
235
+                                    ''  => __( 'Default', 'super-duper' ),
236
+                                    '0' => __( 'None', 'super-duper' ),
237
+                                ) + sd_aui_colors();
238
+    }
239
+
240
+    $input = wp_parse_args( $overwrite, $defaults );
241
+
242
+    return $input;
243 243
 }
244 244
 
245 245
 /**
@@ -251,25 +251,25 @@  discard block
 block discarded – undo
251 251
  * @return array
252 252
  */
253 253
 function sd_get_shadow_input( $type = 'shadow', $overwrite = array() ) {
254
-	$options = array(
255
-		''          => __( 'None', 'super-duper' ),
256
-		'shadow-sm' => __( 'Small', 'super-duper' ),
257
-		'shadow'    => __( 'Regular', 'super-duper' ),
258
-		'shadow-lg' => __( 'Large', 'super-duper' ),
259
-	);
260
-
261
-	$defaults = array(
262
-		'type'     => 'select',
263
-		'title'    => __( 'Shadow', 'super-duper' ),
264
-		'options'  => $options,
265
-		'default'  => '',
266
-		'desc_tip' => true,
267
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
268
-	);
269
-
270
-	$input = wp_parse_args( $overwrite, $defaults );
271
-
272
-	return $input;
254
+    $options = array(
255
+        ''          => __( 'None', 'super-duper' ),
256
+        'shadow-sm' => __( 'Small', 'super-duper' ),
257
+        'shadow'    => __( 'Regular', 'super-duper' ),
258
+        'shadow-lg' => __( 'Large', 'super-duper' ),
259
+    );
260
+
261
+    $defaults = array(
262
+        'type'     => 'select',
263
+        'title'    => __( 'Shadow', 'super-duper' ),
264
+        'options'  => $options,
265
+        'default'  => '',
266
+        'desc_tip' => true,
267
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
268
+    );
269
+
270
+    $input = wp_parse_args( $overwrite, $defaults );
271
+
272
+    return $input;
273 273
 }
274 274
 
275 275
 /**
@@ -281,23 +281,23 @@  discard block
 block discarded – undo
281 281
  * @return array
282 282
  */
283 283
 function sd_get_background_input( $type = 'bg', $overwrite = array() ) {
284
-	$options = array(
285
-		           ''            => __( 'None', 'super-duper' ),
286
-		           'transparent' => __( 'Transparent', 'super-duper' ),
287
-	           ) + sd_aui_colors();
288
-
289
-	$defaults = array(
290
-		'type'     => 'select',
291
-		'title'    => __( 'Background color', 'super-duper' ),
292
-		'options'  => $options,
293
-		'default'  => '',
294
-		'desc_tip' => true,
295
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
296
-	);
297
-
298
-	$input = wp_parse_args( $overwrite, $defaults );
299
-
300
-	return $input;
284
+    $options = array(
285
+                    ''            => __( 'None', 'super-duper' ),
286
+                    'transparent' => __( 'Transparent', 'super-duper' ),
287
+                ) + sd_aui_colors();
288
+
289
+    $defaults = array(
290
+        'type'     => 'select',
291
+        'title'    => __( 'Background color', 'super-duper' ),
292
+        'options'  => $options,
293
+        'default'  => '',
294
+        'desc_tip' => true,
295
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
296
+    );
297
+
298
+    $input = wp_parse_args( $overwrite, $defaults );
299
+
300
+    return $input;
301 301
 }
302 302
 
303 303
 /**
@@ -309,118 +309,118 @@  discard block
 block discarded – undo
309 309
  * @return array
310 310
  */
311 311
 function sd_get_background_inputs( $type = 'bg', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array() ) {
312
-	$options = array(
313
-		           ''            => __( 'None', 'super-duper' ),
314
-		           'transparent' => __( 'Transparent', 'super-duper' ),
315
-	           ) + sd_aui_colors()
316
-	           + array(
317
-		           'custom-color'    => __( 'Custom Color', 'super-duper' ),
318
-		           'custom-gradient' => __( 'Custom Gradient', 'super-duper' ),
319
-	           );
320
-
321
-	$defaults = array(
322
-		'type'     => 'select',
323
-		'title'    => __( 'Background Color', 'super-duper' ),
324
-		'options'  => $options,
325
-		'default'  => '',
326
-		'desc_tip' => true,
327
-		'group'    => __( 'Background', 'super-duper' ),
328
-	);
329
-
330
-	if ( $overwrite !== false ) {
331
-		$input[ $type ] = wp_parse_args( $overwrite, $defaults );
332
-	}
333
-
334
-	if ( $overwrite_color !== false ) {
335
-		$input[ $type . '_color' ] = wp_parse_args(
336
-			$overwrite_color,
337
-			array(
338
-				'type'            => 'color',
339
-				'title'           => __( 'Custom color', 'super-duper' ),
340
-				'placeholder'     => '',
341
-				'default'         => '#0073aa',
342
-				'desc_tip'        => true,
343
-				'group'           => __( 'Background', 'super-duper' ),
344
-				'element_require' => '[%' . $type . '%]=="custom-color"',
345
-			)
346
-		);
347
-	}
348
-
349
-	if ( $overwrite_gradient !== false ) {
350
-		$input[ $type . '_gradient' ] = wp_parse_args(
351
-			$overwrite_gradient,
352
-			array(
353
-				'type'            => 'gradient',
354
-				'title'           => __( 'Custom gradient', 'super-duper' ),
355
-				'placeholder'     => '',
356
-				'default'         => 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
357
-				'desc_tip'        => true,
358
-				'group'           => __( 'Background', 'super-duper' ),
359
-				'element_require' => '[%' . $type . '%]=="custom-gradient"',
360
-			)
361
-		);
362
-	}
363
-
364
-	if ( $overwrite_image !== false ) {
365
-
366
-		$input[ $type . '_image_fixed' ] = array(
367
-			'type'            => 'checkbox',
368
-			'title'           => __( 'Fixed background', 'super-duper' ),
369
-			'default'         => '',
370
-			'desc_tip'        => true,
371
-			'group'           => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background' ),
372
-			'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )',
373
-
374
-		);
375
-
376
-		$input[ $type . '_image_use_featured' ] = array(
377
-			'type'            => 'checkbox',
378
-			'title'           => __( 'Use featured image', 'super-duper' ),
379
-			'default'         => '',
380
-			'desc_tip'        => true,
381
-			'group'           => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background', 'super-duper' ),
382
-			'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )',
383
-
384
-		);
385
-
386
-		$input[ $type . '_image' ] = wp_parse_args(
387
-			$overwrite_image,
388
-			array(
389
-				'type'        => 'image',
390
-				'title'       => __( 'Custom image', 'super-duper' ),
391
-				'placeholder' => '',
392
-				'default'     => '',
393
-				'desc_tip'    => true,
394
-				'group'       => __( 'Background', 'super-duper' ),
395
-				//          'element_require' => ' ![%' . $type . '_image_use_featured%] '
396
-			)
397
-		);
398
-
399
-		$input[ $type . '_image_id' ] = wp_parse_args(
400
-			$overwrite_image,
401
-			array(
402
-				'type'        => 'hidden',
403
-				'hidden_type' => 'number',
404
-				'title'       => '',
405
-				'placeholder' => '',
406
-				'default'     => '',
407
-				'group'       => __( 'Background', 'super-duper' ),
408
-			)
409
-		);
410
-
411
-		$input[ $type . '_image_xy' ] = wp_parse_args(
412
-			$overwrite_image,
413
-			array(
414
-				'type'        => 'image_xy',
415
-				'title'       => '',
416
-				'placeholder' => '',
417
-				'default'     => '',
418
-				'group'       => __( 'Background', 'super-duper' ),
419
-			)
420
-		);
421
-	}
422
-
423
-	return $input;
312
+    $options = array(
313
+                    ''            => __( 'None', 'super-duper' ),
314
+                    'transparent' => __( 'Transparent', 'super-duper' ),
315
+                ) + sd_aui_colors()
316
+               + array(
317
+                    'custom-color'    => __( 'Custom Color', 'super-duper' ),
318
+                    'custom-gradient' => __( 'Custom Gradient', 'super-duper' ),
319
+                );
320
+
321
+    $defaults = array(
322
+        'type'     => 'select',
323
+        'title'    => __( 'Background Color', 'super-duper' ),
324
+        'options'  => $options,
325
+        'default'  => '',
326
+        'desc_tip' => true,
327
+        'group'    => __( 'Background', 'super-duper' ),
328
+    );
329
+
330
+    if ( $overwrite !== false ) {
331
+        $input[ $type ] = wp_parse_args( $overwrite, $defaults );
332
+    }
333
+
334
+    if ( $overwrite_color !== false ) {
335
+        $input[ $type . '_color' ] = wp_parse_args(
336
+            $overwrite_color,
337
+            array(
338
+                'type'            => 'color',
339
+                'title'           => __( 'Custom color', 'super-duper' ),
340
+                'placeholder'     => '',
341
+                'default'         => '#0073aa',
342
+                'desc_tip'        => true,
343
+                'group'           => __( 'Background', 'super-duper' ),
344
+                'element_require' => '[%' . $type . '%]=="custom-color"',
345
+            )
346
+        );
347
+    }
348
+
349
+    if ( $overwrite_gradient !== false ) {
350
+        $input[ $type . '_gradient' ] = wp_parse_args(
351
+            $overwrite_gradient,
352
+            array(
353
+                'type'            => 'gradient',
354
+                'title'           => __( 'Custom gradient', 'super-duper' ),
355
+                'placeholder'     => '',
356
+                'default'         => 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
357
+                'desc_tip'        => true,
358
+                'group'           => __( 'Background', 'super-duper' ),
359
+                'element_require' => '[%' . $type . '%]=="custom-gradient"',
360
+            )
361
+        );
362
+    }
363
+
364
+    if ( $overwrite_image !== false ) {
365
+
366
+        $input[ $type . '_image_fixed' ] = array(
367
+            'type'            => 'checkbox',
368
+            'title'           => __( 'Fixed background', 'super-duper' ),
369
+            'default'         => '',
370
+            'desc_tip'        => true,
371
+            'group'           => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background' ),
372
+            'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )',
373
+
374
+        );
375
+
376
+        $input[ $type . '_image_use_featured' ] = array(
377
+            'type'            => 'checkbox',
378
+            'title'           => __( 'Use featured image', 'super-duper' ),
379
+            'default'         => '',
380
+            'desc_tip'        => true,
381
+            'group'           => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background', 'super-duper' ),
382
+            'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )',
383
+
384
+        );
385
+
386
+        $input[ $type . '_image' ] = wp_parse_args(
387
+            $overwrite_image,
388
+            array(
389
+                'type'        => 'image',
390
+                'title'       => __( 'Custom image', 'super-duper' ),
391
+                'placeholder' => '',
392
+                'default'     => '',
393
+                'desc_tip'    => true,
394
+                'group'       => __( 'Background', 'super-duper' ),
395
+                //          'element_require' => ' ![%' . $type . '_image_use_featured%] '
396
+            )
397
+        );
398
+
399
+        $input[ $type . '_image_id' ] = wp_parse_args(
400
+            $overwrite_image,
401
+            array(
402
+                'type'        => 'hidden',
403
+                'hidden_type' => 'number',
404
+                'title'       => '',
405
+                'placeholder' => '',
406
+                'default'     => '',
407
+                'group'       => __( 'Background', 'super-duper' ),
408
+            )
409
+        );
410
+
411
+        $input[ $type . '_image_xy' ] = wp_parse_args(
412
+            $overwrite_image,
413
+            array(
414
+                'type'        => 'image_xy',
415
+                'title'       => '',
416
+                'placeholder' => '',
417
+                'default'     => '',
418
+                'group'       => __( 'Background', 'super-duper' ),
419
+            )
420
+        );
421
+    }
422
+
423
+    return $input;
424 424
 }
425 425
 
426 426
 /**
@@ -433,175 +433,175 @@  discard block
 block discarded – undo
433 433
  */
434 434
 function sd_get_shape_divider_inputs( $type = 'sd', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array() ) {
435 435
 
436
-	$options = array(
437
-		''                      => __( 'None', 'super-duper' ),
438
-		'mountains'             => __( 'Mountains', 'super-duper' ),
439
-		'drops'                 => __( 'Drops', 'super-duper' ),
440
-		'clouds'                => __( 'Clouds', 'super-duper' ),
441
-		'zigzag'                => __( 'Zigzag', 'super-duper' ),
442
-		'pyramids'              => __( 'Pyramids', 'super-duper' ),
443
-		'triangle'              => __( 'Triangle', 'super-duper' ),
444
-		'triangle-asymmetrical' => __( 'Triangle Asymmetrical', 'super-duper' ),
445
-		'tilt'                  => __( 'Tilt', 'super-duper' ),
446
-		'opacity-tilt'          => __( 'Opacity Tilt', 'super-duper' ),
447
-		'opacity-fan'           => __( 'Opacity Fan', 'super-duper' ),
448
-		'curve'                 => __( 'Curve', 'super-duper' ),
449
-		'curve-asymmetrical'    => __( 'Curve Asymmetrical', 'super-duper' ),
450
-		'waves'                 => __( 'Waves', 'super-duper' ),
451
-		'wave-brush'            => __( 'Wave Brush', 'super-duper' ),
452
-		'waves-pattern'         => __( 'Waves Pattern', 'super-duper' ),
453
-		'arrow'                 => __( 'Arrow', 'super-duper' ),
454
-		'split'                 => __( 'Split', 'super-duper' ),
455
-		'book'                  => __( 'Book', 'super-duper' ),
456
-	);
457
-
458
-	$defaults = array(
459
-		'type'     => 'select',
460
-		'title'    => __( 'Type', 'super-duper' ),
461
-		'options'  => $options,
462
-		'default'  => '',
463
-		'desc_tip' => true,
464
-		'group'    => __( 'Shape Divider', 'super-duper' ),
465
-	);
466
-
467
-	$input[ $type ] = wp_parse_args( $overwrite, $defaults );
468
-
469
-	$input[ $type . '_notice' ] = array(
470
-		'type'            => 'notice',
471
-		'desc'            => __( 'Parent element must be position `relative`', 'super-duper' ),
472
-		'status'          => 'warning',
473
-		'group'           => __( 'Shape Divider', 'super-duper' ),
474
-		'element_require' => '[%' . $type . '%]!=""',
475
-	);
476
-
477
-	$input[ $type . '_position' ] = wp_parse_args(
478
-		$overwrite_color,
479
-		array(
480
-			'type'            => 'select',
481
-			'title'           => __( 'Position', 'super-duper' ),
482
-			'options'         => array(
483
-				'top'    => __( 'Top', 'super-duper' ),
484
-				'bottom' => __( 'Bottom', 'super-duper' ),
485
-			),
486
-			'desc_tip'        => true,
487
-			'group'           => __( 'Shape Divider', 'super-duper' ),
488
-			'element_require' => '[%' . $type . '%]!=""',
489
-		)
490
-	);
491
-
492
-	$options = array(
493
-		           ''            => __( 'None', 'super-duper' ),
494
-		           'transparent' => __( 'Transparent', 'super-duper' ),
495
-	           ) + sd_aui_colors()
496
-	           + array(
497
-		           'custom-color' => __( 'Custom Color', 'super-duper' ),
498
-	           );
499
-
500
-	$input[ $type . '_color' ] = wp_parse_args(
501
-		$overwrite_color,
502
-		array(
503
-			'type'            => 'select',
504
-			'title'           => __( 'Color', 'super-duper' ),
505
-			'options'         => $options,
506
-			'desc_tip'        => true,
507
-			'group'           => __( 'Shape Divider', 'super-duper' ),
508
-			'element_require' => '[%' . $type . '%]!=""',
509
-		)
510
-	);
511
-
512
-	$input[ $type . '_custom_color' ] = wp_parse_args(
513
-		$overwrite_color,
514
-		array(
515
-			'type'            => 'color',
516
-			'title'           => __( 'Custom color', 'super-duper' ),
517
-			'placeholder'     => '',
518
-			'default'         => '#0073aa',
519
-			'desc_tip'        => true,
520
-			'group'           => __( 'Shape Divider', 'super-duper' ),
521
-			'element_require' => '[%' . $type . '_color%]=="custom-color" && [%' . $type . '%]!=""',
522
-		)
523
-	);
524
-
525
-	$input[ $type . '_width' ] = wp_parse_args(
526
-		$overwrite_gradient,
527
-		array(
528
-			'type'              => 'range',
529
-			'title'             => __( 'Width', 'super-duper' ),
530
-			'placeholder'       => '',
531
-			'default'           => '200',
532
-			'desc_tip'          => true,
533
-			'custom_attributes' => array(
534
-				'min' => 100,
535
-				'max' => 300,
536
-			),
537
-			'group'             => __( 'Shape Divider', 'super-duper' ),
538
-			'element_require'   => '[%' . $type . '%]!=""',
539
-		)
540
-	);
541
-
542
-	$input[ $type . '_height' ] = array(
543
-		'type'              => 'range',
544
-		'title'             => __( 'Height', 'super-duper' ),
545
-		'default'           => '100',
546
-		'desc_tip'          => true,
547
-		'custom_attributes' => array(
548
-			'min' => 0,
549
-			'max' => 500,
550
-		),
551
-		'group'             => __( 'Shape Divider', 'super-duper' ),
552
-		'element_require'   => '[%' . $type . '%]!=""',
553
-	);
554
-
555
-	$requires = array(
556
-		'mountains'             => array( 'flip' ),
557
-		'drops'                 => array( 'flip', 'invert' ),
558
-		'clouds'                => array( 'flip', 'invert' ),
559
-		'zigzag'                => array(),
560
-		'pyramids'              => array( 'flip', 'invert' ),
561
-		'triangle'              => array( 'invert' ),
562
-		'triangle-asymmetrical' => array( 'flip', 'invert' ),
563
-		'tilt'                  => array( 'flip' ),
564
-		'opacity-tilt'          => array( 'flip' ),
565
-		'opacity-fan'           => array(),
566
-		'curve'                 => array( 'invert' ),
567
-		'curve-asymmetrical'    => array( 'flip', 'invert' ),
568
-		'waves'                 => array( 'flip', 'invert' ),
569
-		'wave-brush'            => array( 'flip' ),
570
-		'waves-pattern'         => array( 'flip' ),
571
-		'arrow'                 => array( 'invert' ),
572
-		'split'                 => array( 'invert' ),
573
-		'book'                  => array( 'invert' ),
574
-	);
575
-
576
-	$input[ $type . '_flip' ] = array(
577
-		'type'            => 'checkbox',
578
-		'title'           => __( 'Flip', 'super-duper' ),
579
-		'default'         => '',
580
-		'desc_tip'        => true,
581
-		'group'           => __( 'Shape Divider', 'super-duper' ),
582
-		'element_require' => sd_get_element_require_string( $requires, 'flip', 'sd' ),
583
-	);
584
-
585
-	$input[ $type . '_invert' ] = array(
586
-		'type'            => 'checkbox',
587
-		'title'           => __( 'Invert', 'super-duper' ),
588
-		'default'         => '',
589
-		'desc_tip'        => true,
590
-		'group'           => __( 'Shape Divider', 'super-duper' ),
591
-		'element_require' => sd_get_element_require_string( $requires, 'invert', 'sd' ),
592
-	);
593
-
594
-	$input[ $type . '_btf' ] = array(
595
-		'type'            => 'checkbox',
596
-		'title'           => __( 'Bring to front', 'super-duper' ),
597
-		'default'         => '',
598
-		'desc_tip'        => true,
599
-		'group'           => __( 'Shape Divider', 'super-duper' ),
600
-		'element_require' => '[%' . $type . '%]!=""',
601
-
602
-	);
603
-
604
-	return $input;
436
+    $options = array(
437
+        ''                      => __( 'None', 'super-duper' ),
438
+        'mountains'             => __( 'Mountains', 'super-duper' ),
439
+        'drops'                 => __( 'Drops', 'super-duper' ),
440
+        'clouds'                => __( 'Clouds', 'super-duper' ),
441
+        'zigzag'                => __( 'Zigzag', 'super-duper' ),
442
+        'pyramids'              => __( 'Pyramids', 'super-duper' ),
443
+        'triangle'              => __( 'Triangle', 'super-duper' ),
444
+        'triangle-asymmetrical' => __( 'Triangle Asymmetrical', 'super-duper' ),
445
+        'tilt'                  => __( 'Tilt', 'super-duper' ),
446
+        'opacity-tilt'          => __( 'Opacity Tilt', 'super-duper' ),
447
+        'opacity-fan'           => __( 'Opacity Fan', 'super-duper' ),
448
+        'curve'                 => __( 'Curve', 'super-duper' ),
449
+        'curve-asymmetrical'    => __( 'Curve Asymmetrical', 'super-duper' ),
450
+        'waves'                 => __( 'Waves', 'super-duper' ),
451
+        'wave-brush'            => __( 'Wave Brush', 'super-duper' ),
452
+        'waves-pattern'         => __( 'Waves Pattern', 'super-duper' ),
453
+        'arrow'                 => __( 'Arrow', 'super-duper' ),
454
+        'split'                 => __( 'Split', 'super-duper' ),
455
+        'book'                  => __( 'Book', 'super-duper' ),
456
+    );
457
+
458
+    $defaults = array(
459
+        'type'     => 'select',
460
+        'title'    => __( 'Type', 'super-duper' ),
461
+        'options'  => $options,
462
+        'default'  => '',
463
+        'desc_tip' => true,
464
+        'group'    => __( 'Shape Divider', 'super-duper' ),
465
+    );
466
+
467
+    $input[ $type ] = wp_parse_args( $overwrite, $defaults );
468
+
469
+    $input[ $type . '_notice' ] = array(
470
+        'type'            => 'notice',
471
+        'desc'            => __( 'Parent element must be position `relative`', 'super-duper' ),
472
+        'status'          => 'warning',
473
+        'group'           => __( 'Shape Divider', 'super-duper' ),
474
+        'element_require' => '[%' . $type . '%]!=""',
475
+    );
476
+
477
+    $input[ $type . '_position' ] = wp_parse_args(
478
+        $overwrite_color,
479
+        array(
480
+            'type'            => 'select',
481
+            'title'           => __( 'Position', 'super-duper' ),
482
+            'options'         => array(
483
+                'top'    => __( 'Top', 'super-duper' ),
484
+                'bottom' => __( 'Bottom', 'super-duper' ),
485
+            ),
486
+            'desc_tip'        => true,
487
+            'group'           => __( 'Shape Divider', 'super-duper' ),
488
+            'element_require' => '[%' . $type . '%]!=""',
489
+        )
490
+    );
491
+
492
+    $options = array(
493
+                    ''            => __( 'None', 'super-duper' ),
494
+                    'transparent' => __( 'Transparent', 'super-duper' ),
495
+                ) + sd_aui_colors()
496
+               + array(
497
+                    'custom-color' => __( 'Custom Color', 'super-duper' ),
498
+                );
499
+
500
+    $input[ $type . '_color' ] = wp_parse_args(
501
+        $overwrite_color,
502
+        array(
503
+            'type'            => 'select',
504
+            'title'           => __( 'Color', 'super-duper' ),
505
+            'options'         => $options,
506
+            'desc_tip'        => true,
507
+            'group'           => __( 'Shape Divider', 'super-duper' ),
508
+            'element_require' => '[%' . $type . '%]!=""',
509
+        )
510
+    );
511
+
512
+    $input[ $type . '_custom_color' ] = wp_parse_args(
513
+        $overwrite_color,
514
+        array(
515
+            'type'            => 'color',
516
+            'title'           => __( 'Custom color', 'super-duper' ),
517
+            'placeholder'     => '',
518
+            'default'         => '#0073aa',
519
+            'desc_tip'        => true,
520
+            'group'           => __( 'Shape Divider', 'super-duper' ),
521
+            'element_require' => '[%' . $type . '_color%]=="custom-color" && [%' . $type . '%]!=""',
522
+        )
523
+    );
524
+
525
+    $input[ $type . '_width' ] = wp_parse_args(
526
+        $overwrite_gradient,
527
+        array(
528
+            'type'              => 'range',
529
+            'title'             => __( 'Width', 'super-duper' ),
530
+            'placeholder'       => '',
531
+            'default'           => '200',
532
+            'desc_tip'          => true,
533
+            'custom_attributes' => array(
534
+                'min' => 100,
535
+                'max' => 300,
536
+            ),
537
+            'group'             => __( 'Shape Divider', 'super-duper' ),
538
+            'element_require'   => '[%' . $type . '%]!=""',
539
+        )
540
+    );
541
+
542
+    $input[ $type . '_height' ] = array(
543
+        'type'              => 'range',
544
+        'title'             => __( 'Height', 'super-duper' ),
545
+        'default'           => '100',
546
+        'desc_tip'          => true,
547
+        'custom_attributes' => array(
548
+            'min' => 0,
549
+            'max' => 500,
550
+        ),
551
+        'group'             => __( 'Shape Divider', 'super-duper' ),
552
+        'element_require'   => '[%' . $type . '%]!=""',
553
+    );
554
+
555
+    $requires = array(
556
+        'mountains'             => array( 'flip' ),
557
+        'drops'                 => array( 'flip', 'invert' ),
558
+        'clouds'                => array( 'flip', 'invert' ),
559
+        'zigzag'                => array(),
560
+        'pyramids'              => array( 'flip', 'invert' ),
561
+        'triangle'              => array( 'invert' ),
562
+        'triangle-asymmetrical' => array( 'flip', 'invert' ),
563
+        'tilt'                  => array( 'flip' ),
564
+        'opacity-tilt'          => array( 'flip' ),
565
+        'opacity-fan'           => array(),
566
+        'curve'                 => array( 'invert' ),
567
+        'curve-asymmetrical'    => array( 'flip', 'invert' ),
568
+        'waves'                 => array( 'flip', 'invert' ),
569
+        'wave-brush'            => array( 'flip' ),
570
+        'waves-pattern'         => array( 'flip' ),
571
+        'arrow'                 => array( 'invert' ),
572
+        'split'                 => array( 'invert' ),
573
+        'book'                  => array( 'invert' ),
574
+    );
575
+
576
+    $input[ $type . '_flip' ] = array(
577
+        'type'            => 'checkbox',
578
+        'title'           => __( 'Flip', 'super-duper' ),
579
+        'default'         => '',
580
+        'desc_tip'        => true,
581
+        'group'           => __( 'Shape Divider', 'super-duper' ),
582
+        'element_require' => sd_get_element_require_string( $requires, 'flip', 'sd' ),
583
+    );
584
+
585
+    $input[ $type . '_invert' ] = array(
586
+        'type'            => 'checkbox',
587
+        'title'           => __( 'Invert', 'super-duper' ),
588
+        'default'         => '',
589
+        'desc_tip'        => true,
590
+        'group'           => __( 'Shape Divider', 'super-duper' ),
591
+        'element_require' => sd_get_element_require_string( $requires, 'invert', 'sd' ),
592
+    );
593
+
594
+    $input[ $type . '_btf' ] = array(
595
+        'type'            => 'checkbox',
596
+        'title'           => __( 'Bring to front', 'super-duper' ),
597
+        'default'         => '',
598
+        'desc_tip'        => true,
599
+        'group'           => __( 'Shape Divider', 'super-duper' ),
600
+        'element_require' => '[%' . $type . '%]!=""',
601
+
602
+    );
603
+
604
+    return $input;
605 605
 }
606 606
 
607 607
 /**
@@ -614,22 +614,22 @@  discard block
 block discarded – undo
614 614
  * @return string
615 615
  */
616 616
 function sd_get_element_require_string( $args, $key, $type ) {
617
-	$output   = '';
618
-	$requires = array();
619
-
620
-	if ( ! empty( $args ) ) {
621
-		foreach ( $args as $t => $k ) {
622
-			if ( in_array( $key, $k ) ) {
623
-				$requires[] = '[%' . $type . '%]=="' . $t . '"';
624
-			}
625
-		}
626
-
627
-		if ( ! empty( $requires ) ) {
628
-			$output = '(' . implode( ' || ', $requires ) . ')';
629
-		}
630
-	}
631
-
632
-	return $output;
617
+    $output   = '';
618
+    $requires = array();
619
+
620
+    if ( ! empty( $args ) ) {
621
+        foreach ( $args as $t => $k ) {
622
+            if ( in_array( $key, $k ) ) {
623
+                $requires[] = '[%' . $type . '%]=="' . $t . '"';
624
+            }
625
+        }
626
+
627
+        if ( ! empty( $requires ) ) {
628
+            $output = '(' . implode( ' || ', $requires ) . ')';
629
+        }
630
+    }
631
+
632
+    return $output;
633 633
 }
634 634
 
635 635
 /**
@@ -641,41 +641,41 @@  discard block
 block discarded – undo
641 641
  * @return array
642 642
  */
643 643
 function sd_get_text_color_input( $type = 'text_color', $overwrite = array(), $has_custom = false ) {
644
-	$options = array(
645
-		           '' => __( 'None', 'super-duper' ),
646
-	           ) + sd_aui_colors();
647
-
648
-	if ( $has_custom ) {
649
-		$options['custom'] = __( 'Custom color', 'super-duper' );
650
-	}
651
-
652
-	$defaults = array(
653
-		'type'     => 'select',
654
-		'title'    => __( 'Text color', 'super-duper' ),
655
-		'options'  => $options,
656
-		'default'  => '',
657
-		'desc_tip' => true,
658
-		'group'    => __( 'Typography', 'super-duper' ),
659
-	);
660
-
661
-	$input = wp_parse_args( $overwrite, $defaults );
662
-
663
-	return $input;
644
+    $options = array(
645
+                    '' => __( 'None', 'super-duper' ),
646
+                ) + sd_aui_colors();
647
+
648
+    if ( $has_custom ) {
649
+        $options['custom'] = __( 'Custom color', 'super-duper' );
650
+    }
651
+
652
+    $defaults = array(
653
+        'type'     => 'select',
654
+        'title'    => __( 'Text color', 'super-duper' ),
655
+        'options'  => $options,
656
+        'default'  => '',
657
+        'desc_tip' => true,
658
+        'group'    => __( 'Typography', 'super-duper' ),
659
+    );
660
+
661
+    $input = wp_parse_args( $overwrite, $defaults );
662
+
663
+    return $input;
664 664
 }
665 665
 
666 666
 function sd_get_text_color_input_group( $type = 'text_color', $overwrite = array(), $overwrite_custom = array() ) {
667
-	$inputs = array();
667
+    $inputs = array();
668 668
 
669
-	if ( $overwrite !== false ) {
670
-		$inputs[ $type ] = sd_get_text_color_input( $type, $overwrite, true );
671
-	}
669
+    if ( $overwrite !== false ) {
670
+        $inputs[ $type ] = sd_get_text_color_input( $type, $overwrite, true );
671
+    }
672 672
 
673
-	if ( $overwrite_custom !== false ) {
674
-		$custom            = $type . '_custom';
675
-		$inputs[ $custom ] = sd_get_custom_color_input( $custom, $overwrite_custom, $type );
676
-	}
673
+    if ( $overwrite_custom !== false ) {
674
+        $custom            = $type . '_custom';
675
+        $inputs[ $custom ] = sd_get_custom_color_input( $custom, $overwrite_custom, $type );
676
+    }
677 677
 
678
-	return $inputs;
678
+    return $inputs;
679 679
 }
680 680
 
681 681
 /**
@@ -688,22 +688,22 @@  discard block
 block discarded – undo
688 688
  */
689 689
 function sd_get_custom_color_input( $type = 'color_custom', $overwrite = array(), $parent_type = '' ) {
690 690
 
691
-	$defaults = array(
692
-		'type'        => 'color',
693
-		'title'       => __( 'Custom color', 'super-duper' ),
694
-		'default'     => '',
695
-		'placeholder' => '',
696
-		'desc_tip'    => true,
697
-		'group'       => __( 'Typography', 'super-duper' ),
698
-	);
691
+    $defaults = array(
692
+        'type'        => 'color',
693
+        'title'       => __( 'Custom color', 'super-duper' ),
694
+        'default'     => '',
695
+        'placeholder' => '',
696
+        'desc_tip'    => true,
697
+        'group'       => __( 'Typography', 'super-duper' ),
698
+    );
699 699
 
700
-	if ( $parent_type ) {
701
-		$defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
702
-	}
700
+    if ( $parent_type ) {
701
+        $defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
702
+    }
703 703
 
704
-	$input = wp_parse_args( $overwrite, $defaults );
704
+    $input = wp_parse_args( $overwrite, $defaults );
705 705
 
706
-	return $input;
706
+    return $input;
707 707
 }
708 708
 
709 709
 /**
@@ -716,43 +716,43 @@  discard block
 block discarded – undo
716 716
  */
717 717
 function sd_get_col_input( $type = 'col', $overwrite = array() ) {
718 718
 
719
-	$device_size = '';
720
-	if ( ! empty( $overwrite['device_type'] ) ) {
721
-		if ( $overwrite['device_type'] == 'Tablet' ) {
722
-			$device_size = '-md';
723
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
724
-			$device_size = '-lg';
725
-		}
726
-	}
727
-	$options = array(
728
-		''   => __( 'auto', 'super-duper' ),
729
-		'1'  => '1/12',
730
-		'2'  => '2/12',
731
-		'3'  => '3/12',
732
-		'4'  => '4/12',
733
-		'5'  => '5/12',
734
-		'6'  => '6/12',
735
-		'7'  => '7/12',
736
-		'8'  => '8/12',
737
-		'9'  => '9/12',
738
-		'10' => '10/12',
739
-		'11' => '11/12',
740
-		'12' => '12/12',
741
-	);
742
-
743
-	$defaults = array(
744
-		'type'            => 'select',
745
-		'title'           => __( 'Column width', 'super-duper' ),
746
-		'options'         => $options,
747
-		'default'         => '',
748
-		'desc_tip'        => true,
749
-		'group'           => __( 'Container', 'super-duper' ),
750
-		'element_require' => '[%container%]=="col"',
751
-	);
752
-
753
-	$input = wp_parse_args( $overwrite, $defaults );
754
-
755
-	return $input;
719
+    $device_size = '';
720
+    if ( ! empty( $overwrite['device_type'] ) ) {
721
+        if ( $overwrite['device_type'] == 'Tablet' ) {
722
+            $device_size = '-md';
723
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
724
+            $device_size = '-lg';
725
+        }
726
+    }
727
+    $options = array(
728
+        ''   => __( 'auto', 'super-duper' ),
729
+        '1'  => '1/12',
730
+        '2'  => '2/12',
731
+        '3'  => '3/12',
732
+        '4'  => '4/12',
733
+        '5'  => '5/12',
734
+        '6'  => '6/12',
735
+        '7'  => '7/12',
736
+        '8'  => '8/12',
737
+        '9'  => '9/12',
738
+        '10' => '10/12',
739
+        '11' => '11/12',
740
+        '12' => '12/12',
741
+    );
742
+
743
+    $defaults = array(
744
+        'type'            => 'select',
745
+        'title'           => __( 'Column width', 'super-duper' ),
746
+        'options'         => $options,
747
+        'default'         => '',
748
+        'desc_tip'        => true,
749
+        'group'           => __( 'Container', 'super-duper' ),
750
+        'element_require' => '[%container%]=="col"',
751
+    );
752
+
753
+    $input = wp_parse_args( $overwrite, $defaults );
754
+
755
+    return $input;
756 756
 }
757 757
 
758 758
 /**
@@ -765,37 +765,37 @@  discard block
 block discarded – undo
765 765
  */
766 766
 function sd_get_row_cols_input( $type = 'row_cols', $overwrite = array() ) {
767 767
 
768
-	$device_size = '';
769
-	if ( ! empty( $overwrite['device_type'] ) ) {
770
-		if ( $overwrite['device_type'] == 'Tablet' ) {
771
-			$device_size = '-md';
772
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
773
-			$device_size = '-lg';
774
-		}
775
-	}
776
-	$options = array(
777
-		''  => __( 'auto', 'super-duper' ),
778
-		'1' => '1',
779
-		'2' => '2',
780
-		'3' => '3',
781
-		'4' => '4',
782
-		'5' => '5',
783
-		'6' => '6',
784
-	);
785
-
786
-	$defaults = array(
787
-		'type'            => 'select',
788
-		'title'           => __( 'Row columns', 'super-duper' ),
789
-		'options'         => $options,
790
-		'default'         => '',
791
-		'desc_tip'        => true,
792
-		'group'           => __( 'Container', 'super-duper' ),
793
-		'element_require' => '[%container%]=="row"',
794
-	);
795
-
796
-	$input = wp_parse_args( $overwrite, $defaults );
797
-
798
-	return $input;
768
+    $device_size = '';
769
+    if ( ! empty( $overwrite['device_type'] ) ) {
770
+        if ( $overwrite['device_type'] == 'Tablet' ) {
771
+            $device_size = '-md';
772
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
773
+            $device_size = '-lg';
774
+        }
775
+    }
776
+    $options = array(
777
+        ''  => __( 'auto', 'super-duper' ),
778
+        '1' => '1',
779
+        '2' => '2',
780
+        '3' => '3',
781
+        '4' => '4',
782
+        '5' => '5',
783
+        '6' => '6',
784
+    );
785
+
786
+    $defaults = array(
787
+        'type'            => 'select',
788
+        'title'           => __( 'Row columns', 'super-duper' ),
789
+        'options'         => $options,
790
+        'default'         => '',
791
+        'desc_tip'        => true,
792
+        'group'           => __( 'Container', 'super-duper' ),
793
+        'element_require' => '[%container%]=="row"',
794
+    );
795
+
796
+    $input = wp_parse_args( $overwrite, $defaults );
797
+
798
+    return $input;
799 799
 }
800 800
 
801 801
 /**
@@ -808,33 +808,33 @@  discard block
 block discarded – undo
808 808
  */
809 809
 function sd_get_text_align_input( $type = 'text_align', $overwrite = array() ) {
810 810
 
811
-	$device_size = '';
812
-	if ( ! empty( $overwrite['device_type'] ) ) {
813
-		if ( $overwrite['device_type'] == 'Tablet' ) {
814
-			$device_size = '-md';
815
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
816
-			$device_size = '-lg';
817
-		}
818
-	}
819
-	$options = array(
820
-		''                                => __( 'Default', 'super-duper' ),
821
-		'text' . $device_size . '-left'   => __( 'Left', 'super-duper' ),
822
-		'text' . $device_size . '-right'  => __( 'Right', 'super-duper' ),
823
-		'text' . $device_size . '-center' => __( 'Center', 'super-duper' ),
824
-	);
825
-
826
-	$defaults = array(
827
-		'type'     => 'select',
828
-		'title'    => __( 'Text align', 'super-duper' ),
829
-		'options'  => $options,
830
-		'default'  => '',
831
-		'desc_tip' => true,
832
-		'group'    => __( 'Typography', 'super-duper' ),
833
-	);
834
-
835
-	$input = wp_parse_args( $overwrite, $defaults );
836
-
837
-	return $input;
811
+    $device_size = '';
812
+    if ( ! empty( $overwrite['device_type'] ) ) {
813
+        if ( $overwrite['device_type'] == 'Tablet' ) {
814
+            $device_size = '-md';
815
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
816
+            $device_size = '-lg';
817
+        }
818
+    }
819
+    $options = array(
820
+        ''                                => __( 'Default', 'super-duper' ),
821
+        'text' . $device_size . '-left'   => __( 'Left', 'super-duper' ),
822
+        'text' . $device_size . '-right'  => __( 'Right', 'super-duper' ),
823
+        'text' . $device_size . '-center' => __( 'Center', 'super-duper' ),
824
+    );
825
+
826
+    $defaults = array(
827
+        'type'     => 'select',
828
+        'title'    => __( 'Text align', 'super-duper' ),
829
+        'options'  => $options,
830
+        'default'  => '',
831
+        'desc_tip' => true,
832
+        'group'    => __( 'Typography', 'super-duper' ),
833
+    );
834
+
835
+    $input = wp_parse_args( $overwrite, $defaults );
836
+
837
+    return $input;
838 838
 }
839 839
 
840 840
 /**
@@ -847,39 +847,39 @@  discard block
 block discarded – undo
847 847
  */
848 848
 function sd_get_display_input( $type = 'display', $overwrite = array() ) {
849 849
 
850
-	$device_size = '';
851
-	if ( ! empty( $overwrite['device_type'] ) ) {
852
-		if ( $overwrite['device_type'] == 'Tablet' ) {
853
-			$device_size = '-md';
854
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
855
-			$device_size = '-lg';
856
-		}
857
-	}
858
-	$options = array(
859
-		''                                   => __( 'Default', 'super-duper' ),
860
-		'd' . $device_size . '-none'         => 'none',
861
-		'd' . $device_size . '-inline'       => 'inline',
862
-		'd' . $device_size . '-inline-block' => 'inline-block',
863
-		'd' . $device_size . '-block'        => 'block',
864
-		'd' . $device_size . '-table'        => 'table',
865
-		'd' . $device_size . '-table-cell'   => 'table-cell',
866
-		'd' . $device_size . '-table-row'    => 'table-row',
867
-		'd' . $device_size . '-flex'         => 'flex',
868
-		'd' . $device_size . '-inline-flex'  => 'inline-flex',
869
-	);
870
-
871
-	$defaults = array(
872
-		'type'     => 'select',
873
-		'title'    => __( 'Display', 'super-duper' ),
874
-		'options'  => $options,
875
-		'default'  => '',
876
-		'desc_tip' => true,
877
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
878
-	);
879
-
880
-	$input = wp_parse_args( $overwrite, $defaults );
881
-
882
-	return $input;
850
+    $device_size = '';
851
+    if ( ! empty( $overwrite['device_type'] ) ) {
852
+        if ( $overwrite['device_type'] == 'Tablet' ) {
853
+            $device_size = '-md';
854
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
855
+            $device_size = '-lg';
856
+        }
857
+    }
858
+    $options = array(
859
+        ''                                   => __( 'Default', 'super-duper' ),
860
+        'd' . $device_size . '-none'         => 'none',
861
+        'd' . $device_size . '-inline'       => 'inline',
862
+        'd' . $device_size . '-inline-block' => 'inline-block',
863
+        'd' . $device_size . '-block'        => 'block',
864
+        'd' . $device_size . '-table'        => 'table',
865
+        'd' . $device_size . '-table-cell'   => 'table-cell',
866
+        'd' . $device_size . '-table-row'    => 'table-row',
867
+        'd' . $device_size . '-flex'         => 'flex',
868
+        'd' . $device_size . '-inline-flex'  => 'inline-flex',
869
+    );
870
+
871
+    $defaults = array(
872
+        'type'     => 'select',
873
+        'title'    => __( 'Display', 'super-duper' ),
874
+        'options'  => $options,
875
+        'default'  => '',
876
+        'desc_tip' => true,
877
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
878
+    );
879
+
880
+    $input = wp_parse_args( $overwrite, $defaults );
881
+
882
+    return $input;
883 883
 }
884 884
 
885 885
 /**
@@ -892,17 +892,17 @@  discard block
 block discarded – undo
892 892
  */
893 893
 function sd_get_text_justify_input( $type = 'text_justify', $overwrite = array() ) {
894 894
 
895
-	$defaults = array(
896
-		'type'     => 'checkbox',
897
-		'title'    => __( 'Text justify', 'super-duper' ),
898
-		'default'  => '',
899
-		'desc_tip' => true,
900
-		'group'    => __( 'Typography', 'super-duper' ),
901
-	);
895
+    $defaults = array(
896
+        'type'     => 'checkbox',
897
+        'title'    => __( 'Text justify', 'super-duper' ),
898
+        'default'  => '',
899
+        'desc_tip' => true,
900
+        'group'    => __( 'Typography', 'super-duper' ),
901
+    );
902 902
 
903
-	$input = wp_parse_args( $overwrite, $defaults );
903
+    $input = wp_parse_args( $overwrite, $defaults );
904 904
 
905
-	return $input;
905
+    return $input;
906 906
 }
907 907
 
908 908
 /**
@@ -915,50 +915,50 @@  discard block
 block discarded – undo
915 915
  * @return array
916 916
  */
917 917
 function sd_aui_colors( $include_branding = false, $include_outlines = false, $outline_button_only_text = false ) {
918
-	$theme_colors = array();
919
-
920
-	$theme_colors['primary']   = __( 'Primary', 'super-duper' );
921
-	$theme_colors['secondary'] = __( 'Secondary', 'super-duper' );
922
-	$theme_colors['success']   = __( 'Success', 'super-duper' );
923
-	$theme_colors['danger']    = __( 'Danger', 'super-duper' );
924
-	$theme_colors['warning']   = __( 'Warning', 'super-duper' );
925
-	$theme_colors['info']      = __( 'Info', 'super-duper' );
926
-	$theme_colors['light']     = __( 'Light', 'super-duper' );
927
-	$theme_colors['dark']      = __( 'Dark', 'super-duper' );
928
-	$theme_colors['white']     = __( 'White', 'super-duper' );
929
-	$theme_colors['purple']    = __( 'Purple', 'super-duper' );
930
-	$theme_colors['salmon']    = __( 'Salmon', 'super-duper' );
931
-	$theme_colors['cyan']      = __( 'Cyan', 'super-duper' );
932
-	$theme_colors['gray']      = __( 'Gray', 'super-duper' );
933
-	$theme_colors['gray-dark'] = __( 'Gray dark', 'super-duper' );
934
-	$theme_colors['indigo']    = __( 'Indigo', 'super-duper' );
935
-	$theme_colors['orange']    = __( 'Orange', 'super-duper' );
936
-
937
-	if ( $include_outlines ) {
938
-		$button_only                       = $outline_button_only_text ? ' ' . __( '(button only)', 'super-duper' ) : '';
939
-		$theme_colors['outline-primary']   = __( 'Primary outline', 'super-duper' ) . $button_only;
940
-		$theme_colors['outline-secondary'] = __( 'Secondary outline', 'super-duper' ) . $button_only;
941
-		$theme_colors['outline-success']   = __( 'Success outline', 'super-duper' ) . $button_only;
942
-		$theme_colors['outline-danger']    = __( 'Danger outline', 'super-duper' ) . $button_only;
943
-		$theme_colors['outline-warning']   = __( 'Warning outline', 'super-duper' ) . $button_only;
944
-		$theme_colors['outline-info']      = __( 'Info outline', 'super-duper' ) . $button_only;
945
-		$theme_colors['outline-light']     = __( 'Light outline', 'super-duper' ) . $button_only;
946
-		$theme_colors['outline-dark']      = __( 'Dark outline', 'super-duper' ) . $button_only;
947
-		$theme_colors['outline-white']     = __( 'White outline', 'super-duper' ) . $button_only;
948
-		$theme_colors['outline-purple']    = __( 'Purple outline', 'super-duper' ) . $button_only;
949
-		$theme_colors['outline-salmon']    = __( 'Salmon outline', 'super-duper' ) . $button_only;
950
-		$theme_colors['outline-cyan']      = __( 'Cyan outline', 'super-duper' ) . $button_only;
951
-		$theme_colors['outline-gray']      = __( 'Gray outline', 'super-duper' ) . $button_only;
952
-		$theme_colors['outline-gray-dark'] = __( 'Gray dark outline', 'super-duper' ) . $button_only;
953
-		$theme_colors['outline-indigo']    = __( 'Indigo outline', 'super-duper' ) . $button_only;
954
-		$theme_colors['outline-orange']    = __( 'Orange outline', 'super-duper' ) . $button_only;
955
-	}
956
-
957
-	if ( $include_branding ) {
958
-		$theme_colors = $theme_colors + sd_aui_branding_colors();
959
-	}
960
-
961
-	return apply_filters( 'sd_aui_colors', $theme_colors, $include_outlines, $include_branding );
918
+    $theme_colors = array();
919
+
920
+    $theme_colors['primary']   = __( 'Primary', 'super-duper' );
921
+    $theme_colors['secondary'] = __( 'Secondary', 'super-duper' );
922
+    $theme_colors['success']   = __( 'Success', 'super-duper' );
923
+    $theme_colors['danger']    = __( 'Danger', 'super-duper' );
924
+    $theme_colors['warning']   = __( 'Warning', 'super-duper' );
925
+    $theme_colors['info']      = __( 'Info', 'super-duper' );
926
+    $theme_colors['light']     = __( 'Light', 'super-duper' );
927
+    $theme_colors['dark']      = __( 'Dark', 'super-duper' );
928
+    $theme_colors['white']     = __( 'White', 'super-duper' );
929
+    $theme_colors['purple']    = __( 'Purple', 'super-duper' );
930
+    $theme_colors['salmon']    = __( 'Salmon', 'super-duper' );
931
+    $theme_colors['cyan']      = __( 'Cyan', 'super-duper' );
932
+    $theme_colors['gray']      = __( 'Gray', 'super-duper' );
933
+    $theme_colors['gray-dark'] = __( 'Gray dark', 'super-duper' );
934
+    $theme_colors['indigo']    = __( 'Indigo', 'super-duper' );
935
+    $theme_colors['orange']    = __( 'Orange', 'super-duper' );
936
+
937
+    if ( $include_outlines ) {
938
+        $button_only                       = $outline_button_only_text ? ' ' . __( '(button only)', 'super-duper' ) : '';
939
+        $theme_colors['outline-primary']   = __( 'Primary outline', 'super-duper' ) . $button_only;
940
+        $theme_colors['outline-secondary'] = __( 'Secondary outline', 'super-duper' ) . $button_only;
941
+        $theme_colors['outline-success']   = __( 'Success outline', 'super-duper' ) . $button_only;
942
+        $theme_colors['outline-danger']    = __( 'Danger outline', 'super-duper' ) . $button_only;
943
+        $theme_colors['outline-warning']   = __( 'Warning outline', 'super-duper' ) . $button_only;
944
+        $theme_colors['outline-info']      = __( 'Info outline', 'super-duper' ) . $button_only;
945
+        $theme_colors['outline-light']     = __( 'Light outline', 'super-duper' ) . $button_only;
946
+        $theme_colors['outline-dark']      = __( 'Dark outline', 'super-duper' ) . $button_only;
947
+        $theme_colors['outline-white']     = __( 'White outline', 'super-duper' ) . $button_only;
948
+        $theme_colors['outline-purple']    = __( 'Purple outline', 'super-duper' ) . $button_only;
949
+        $theme_colors['outline-salmon']    = __( 'Salmon outline', 'super-duper' ) . $button_only;
950
+        $theme_colors['outline-cyan']      = __( 'Cyan outline', 'super-duper' ) . $button_only;
951
+        $theme_colors['outline-gray']      = __( 'Gray outline', 'super-duper' ) . $button_only;
952
+        $theme_colors['outline-gray-dark'] = __( 'Gray dark outline', 'super-duper' ) . $button_only;
953
+        $theme_colors['outline-indigo']    = __( 'Indigo outline', 'super-duper' ) . $button_only;
954
+        $theme_colors['outline-orange']    = __( 'Orange outline', 'super-duper' ) . $button_only;
955
+    }
956
+
957
+    if ( $include_branding ) {
958
+        $theme_colors = $theme_colors + sd_aui_branding_colors();
959
+    }
960
+
961
+    return apply_filters( 'sd_aui_colors', $theme_colors, $include_outlines, $include_branding );
962 962
 }
963 963
 
964 964
 /**
@@ -967,19 +967,19 @@  discard block
 block discarded – undo
967 967
  * @return array
968 968
  */
969 969
 function sd_aui_branding_colors() {
970
-	return array(
971
-		'facebook'  => __( 'Facebook', 'super-duper' ),
972
-		'twitter'   => __( 'Twitter', 'super-duper' ),
973
-		'instagram' => __( 'Instagram', 'super-duper' ),
974
-		'linkedin'  => __( 'Linkedin', 'super-duper' ),
975
-		'flickr'    => __( 'Flickr', 'super-duper' ),
976
-		'github'    => __( 'GitHub', 'super-duper' ),
977
-		'youtube'   => __( 'YouTube', 'super-duper' ),
978
-		'wordpress' => __( 'WordPress', 'super-duper' ),
979
-		'google'    => __( 'Google', 'super-duper' ),
980
-		'yahoo'     => __( 'Yahoo', 'super-duper' ),
981
-		'vkontakte' => __( 'Vkontakte', 'super-duper' ),
982
-	);
970
+    return array(
971
+        'facebook'  => __( 'Facebook', 'super-duper' ),
972
+        'twitter'   => __( 'Twitter', 'super-duper' ),
973
+        'instagram' => __( 'Instagram', 'super-duper' ),
974
+        'linkedin'  => __( 'Linkedin', 'super-duper' ),
975
+        'flickr'    => __( 'Flickr', 'super-duper' ),
976
+        'github'    => __( 'GitHub', 'super-duper' ),
977
+        'youtube'   => __( 'YouTube', 'super-duper' ),
978
+        'wordpress' => __( 'WordPress', 'super-duper' ),
979
+        'google'    => __( 'Google', 'super-duper' ),
980
+        'yahoo'     => __( 'Yahoo', 'super-duper' ),
981
+        'vkontakte' => __( 'Vkontakte', 'super-duper' ),
982
+    );
983 983
 }
984 984
 
985 985
 
@@ -993,36 +993,36 @@  discard block
 block discarded – undo
993 993
  */
994 994
 function sd_get_container_class_input( $type = 'container', $overwrite = array() ) {
995 995
 
996
-	$options = array(
997
-		'container'       => __( 'container (default)', 'super-duper' ),
998
-		'container-sm'    => 'container-sm',
999
-		'container-md'    => 'container-md',
1000
-		'container-lg'    => 'container-lg',
1001
-		'container-xl'    => 'container-xl',
1002
-		'container-xxl'   => 'container-xxl',
1003
-		'container-fluid' => 'container-fluid',
1004
-		'row'             => 'row',
1005
-		'col'             => 'col',
1006
-		'card'            => 'card',
1007
-		'card-header'     => 'card-header',
1008
-		'card-body'       => 'card-body',
1009
-		'card-footer'     => 'card-footer',
1010
-		'list-group'      => 'list-group',
1011
-		'list-group-item' => 'list-group-item',
1012
-	);
1013
-
1014
-	$defaults = array(
1015
-		'type'     => 'select',
1016
-		'title'    => __( 'Type', 'super-duper' ),
1017
-		'options'  => $options,
1018
-		'default'  => '',
1019
-		'desc_tip' => true,
1020
-		'group'    => __( 'Container', 'super-duper' ),
1021
-	);
1022
-
1023
-	$input = wp_parse_args( $overwrite, $defaults );
1024
-
1025
-	return $input;
996
+    $options = array(
997
+        'container'       => __( 'container (default)', 'super-duper' ),
998
+        'container-sm'    => 'container-sm',
999
+        'container-md'    => 'container-md',
1000
+        'container-lg'    => 'container-lg',
1001
+        'container-xl'    => 'container-xl',
1002
+        'container-xxl'   => 'container-xxl',
1003
+        'container-fluid' => 'container-fluid',
1004
+        'row'             => 'row',
1005
+        'col'             => 'col',
1006
+        'card'            => 'card',
1007
+        'card-header'     => 'card-header',
1008
+        'card-body'       => 'card-body',
1009
+        'card-footer'     => 'card-footer',
1010
+        'list-group'      => 'list-group',
1011
+        'list-group-item' => 'list-group-item',
1012
+    );
1013
+
1014
+    $defaults = array(
1015
+        'type'     => 'select',
1016
+        'title'    => __( 'Type', 'super-duper' ),
1017
+        'options'  => $options,
1018
+        'default'  => '',
1019
+        'desc_tip' => true,
1020
+        'group'    => __( 'Container', 'super-duper' ),
1021
+    );
1022
+
1023
+    $input = wp_parse_args( $overwrite, $defaults );
1024
+
1025
+    return $input;
1026 1026
 }
1027 1027
 
1028 1028
 /**
@@ -1035,30 +1035,30 @@  discard block
 block discarded – undo
1035 1035
  */
1036 1036
 function sd_get_position_class_input( $type = 'position', $overwrite = array() ) {
1037 1037
 
1038
-	$options = array(
1039
-		''                  => __( 'Default', 'super-duper' ),
1040
-		'position-static'   => 'static',
1041
-		'position-relative' => 'relative',
1042
-		'position-absolute' => 'absolute',
1043
-		'position-fixed'    => 'fixed',
1044
-		'position-sticky'   => 'sticky',
1045
-		'fixed-top'         => 'fixed-top',
1046
-		'fixed-bottom'      => 'fixed-bottom',
1047
-		'sticky-top'        => 'sticky-top',
1048
-	);
1049
-
1050
-	$defaults = array(
1051
-		'type'     => 'select',
1052
-		'title'    => __( 'Position', 'super-duper' ),
1053
-		'options'  => $options,
1054
-		'default'  => '',
1055
-		'desc_tip' => true,
1056
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
1057
-	);
1058
-
1059
-	$input = wp_parse_args( $overwrite, $defaults );
1060
-
1061
-	return $input;
1038
+    $options = array(
1039
+        ''                  => __( 'Default', 'super-duper' ),
1040
+        'position-static'   => 'static',
1041
+        'position-relative' => 'relative',
1042
+        'position-absolute' => 'absolute',
1043
+        'position-fixed'    => 'fixed',
1044
+        'position-sticky'   => 'sticky',
1045
+        'fixed-top'         => 'fixed-top',
1046
+        'fixed-bottom'      => 'fixed-bottom',
1047
+        'sticky-top'        => 'sticky-top',
1048
+    );
1049
+
1050
+    $defaults = array(
1051
+        'type'     => 'select',
1052
+        'title'    => __( 'Position', 'super-duper' ),
1053
+        'options'  => $options,
1054
+        'default'  => '',
1055
+        'desc_tip' => true,
1056
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
1057
+    );
1058
+
1059
+    $input = wp_parse_args( $overwrite, $defaults );
1060
+
1061
+    return $input;
1062 1062
 }
1063 1063
 
1064 1064
 /**
@@ -1071,38 +1071,38 @@  discard block
 block discarded – undo
1071 1071
  */
1072 1072
 function sd_get_sticky_offset_input( $type = 'top', $overwrite = array() ) {
1073 1073
 
1074
-	$defaults = array(
1075
-		'type'            => 'number',
1076
-		'title'           => __( 'Sticky offset', 'super-duper' ),
1077
-		//'desc' =>  __('Sticky offset'),
1078
-		'default'         => '',
1079
-		'desc_tip'        => true,
1080
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1081
-		'element_require' => '[%position%]=="sticky" || [%position%]=="sticky-top"',
1082
-	);
1083
-
1084
-	// title
1085
-	if ( $type == 'top' ) {
1086
-		$defaults['title'] = __( 'Top offset', 'super-duper' );
1087
-		$defaults['icon']  = 'box-top';
1088
-		$defaults['row']   = array(
1089
-			'title' => __( 'Sticky offset', 'super-duper' ),
1090
-			'key'   => 'sticky-offset',
1091
-			'open'  => true,
1092
-			'class' => 'text-center',
1093
-		);
1094
-	} elseif ( $type == 'bottom' ) {
1095
-		$defaults['title'] = __( 'Bottom offset', 'super-duper' );
1096
-		$defaults['icon']  = 'box-bottom';
1097
-		$defaults['row']   = array(
1098
-			'key'   => 'sticky-offset',
1099
-			'close' => true,
1100
-		);
1101
-	}
1102
-
1103
-	$input = wp_parse_args( $overwrite, $defaults );
1104
-
1105
-	return $input;
1074
+    $defaults = array(
1075
+        'type'            => 'number',
1076
+        'title'           => __( 'Sticky offset', 'super-duper' ),
1077
+        //'desc' =>  __('Sticky offset'),
1078
+        'default'         => '',
1079
+        'desc_tip'        => true,
1080
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1081
+        'element_require' => '[%position%]=="sticky" || [%position%]=="sticky-top"',
1082
+    );
1083
+
1084
+    // title
1085
+    if ( $type == 'top' ) {
1086
+        $defaults['title'] = __( 'Top offset', 'super-duper' );
1087
+        $defaults['icon']  = 'box-top';
1088
+        $defaults['row']   = array(
1089
+            'title' => __( 'Sticky offset', 'super-duper' ),
1090
+            'key'   => 'sticky-offset',
1091
+            'open'  => true,
1092
+            'class' => 'text-center',
1093
+        );
1094
+    } elseif ( $type == 'bottom' ) {
1095
+        $defaults['title'] = __( 'Bottom offset', 'super-duper' );
1096
+        $defaults['icon']  = 'box-bottom';
1097
+        $defaults['row']   = array(
1098
+            'key'   => 'sticky-offset',
1099
+            'close' => true,
1100
+        );
1101
+    }
1102
+
1103
+    $input = wp_parse_args( $overwrite, $defaults );
1104
+
1105
+    return $input;
1106 1106
 }
1107 1107
 
1108 1108
 /**
@@ -1115,36 +1115,36 @@  discard block
 block discarded – undo
1115 1115
  */
1116 1116
 function sd_get_font_size_input( $type = 'font_size', $overwrite = array(), $has_custom = false ) {
1117 1117
 
1118
-	$options = array(
1119
-		''          => __( 'Inherit from parent', 'super-duper' ),
1120
-		'h6'        => 'h6',
1121
-		'h5'        => 'h5',
1122
-		'h4'        => 'h4',
1123
-		'h3'        => 'h3',
1124
-		'h2'        => 'h2',
1125
-		'h1'        => 'h1',
1126
-		'display-1' => 'display-1',
1127
-		'display-2' => 'display-2',
1128
-		'display-3' => 'display-3',
1129
-		'display-4' => 'display-4',
1130
-	);
1131
-
1132
-	if ( $has_custom ) {
1133
-		$options['custom'] = __( 'Custom size', 'super-duper' );
1134
-	}
1135
-
1136
-	$defaults = array(
1137
-		'type'     => 'select',
1138
-		'title'    => __( 'Font size', 'super-duper' ),
1139
-		'options'  => $options,
1140
-		'default'  => '',
1141
-		'desc_tip' => true,
1142
-		'group'    => __( 'Typography', 'super-duper' ),
1143
-	);
1144
-
1145
-	$input = wp_parse_args( $overwrite, $defaults );
1146
-
1147
-	return $input;
1118
+    $options = array(
1119
+        ''          => __( 'Inherit from parent', 'super-duper' ),
1120
+        'h6'        => 'h6',
1121
+        'h5'        => 'h5',
1122
+        'h4'        => 'h4',
1123
+        'h3'        => 'h3',
1124
+        'h2'        => 'h2',
1125
+        'h1'        => 'h1',
1126
+        'display-1' => 'display-1',
1127
+        'display-2' => 'display-2',
1128
+        'display-3' => 'display-3',
1129
+        'display-4' => 'display-4',
1130
+    );
1131
+
1132
+    if ( $has_custom ) {
1133
+        $options['custom'] = __( 'Custom size', 'super-duper' );
1134
+    }
1135
+
1136
+    $defaults = array(
1137
+        'type'     => 'select',
1138
+        'title'    => __( 'Font size', 'super-duper' ),
1139
+        'options'  => $options,
1140
+        'default'  => '',
1141
+        'desc_tip' => true,
1142
+        'group'    => __( 'Typography', 'super-duper' ),
1143
+    );
1144
+
1145
+    $input = wp_parse_args( $overwrite, $defaults );
1146
+
1147
+    return $input;
1148 1148
 }
1149 1149
 
1150 1150
 /**
@@ -1157,27 +1157,27 @@  discard block
 block discarded – undo
1157 1157
  */
1158 1158
 function sd_get_font_custom_size_input( $type = 'font_size_custom', $overwrite = array(), $parent_type = '' ) {
1159 1159
 
1160
-	$defaults = array(
1161
-		'type'              => 'number',
1162
-		'title'             => __( 'Font size (rem)', 'super-duper' ),
1163
-		'default'           => '',
1164
-		'placeholder'       => '1.25',
1165
-		'custom_attributes' => array(
1166
-			'step' => '0.1',
1167
-			'min'  => '0',
1168
-			'max'  => '100',
1169
-		),
1170
-		'desc_tip'          => true,
1171
-		'group'             => __( 'Typography', 'super-duper' ),
1172
-	);
1173
-
1174
-	if ( $parent_type ) {
1175
-		$defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
1176
-	}
1177
-
1178
-	$input = wp_parse_args( $overwrite, $defaults );
1179
-
1180
-	return $input;
1160
+    $defaults = array(
1161
+        'type'              => 'number',
1162
+        'title'             => __( 'Font size (rem)', 'super-duper' ),
1163
+        'default'           => '',
1164
+        'placeholder'       => '1.25',
1165
+        'custom_attributes' => array(
1166
+            'step' => '0.1',
1167
+            'min'  => '0',
1168
+            'max'  => '100',
1169
+        ),
1170
+        'desc_tip'          => true,
1171
+        'group'             => __( 'Typography', 'super-duper' ),
1172
+    );
1173
+
1174
+    if ( $parent_type ) {
1175
+        $defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
1176
+    }
1177
+
1178
+    $input = wp_parse_args( $overwrite, $defaults );
1179
+
1180
+    return $input;
1181 1181
 }
1182 1182
 
1183 1183
 /**
@@ -1190,23 +1190,23 @@  discard block
 block discarded – undo
1190 1190
  */
1191 1191
 function sd_get_font_line_height_input( $type = 'font_line_height', $overwrite = array() ) {
1192 1192
 
1193
-	$defaults = array(
1194
-		'type'              => 'number',
1195
-		'title'             => __( 'Font Line Height', 'super-duper' ),
1196
-		'default'           => '',
1197
-		'placeholder'       => '1.75',
1198
-		'custom_attributes' => array(
1199
-			'step' => '0.1',
1200
-			'min'  => '0',
1201
-			'max'  => '100',
1202
-		),
1203
-		'desc_tip'          => true,
1204
-		'group'             => __( 'Typography', 'super-duper' ),
1205
-	);
1206
-
1207
-	$input = wp_parse_args( $overwrite, $defaults );
1208
-
1209
-	return $input;
1193
+    $defaults = array(
1194
+        'type'              => 'number',
1195
+        'title'             => __( 'Font Line Height', 'super-duper' ),
1196
+        'default'           => '',
1197
+        'placeholder'       => '1.75',
1198
+        'custom_attributes' => array(
1199
+            'step' => '0.1',
1200
+            'min'  => '0',
1201
+            'max'  => '100',
1202
+        ),
1203
+        'desc_tip'          => true,
1204
+        'group'             => __( 'Typography', 'super-duper' ),
1205
+    );
1206
+
1207
+    $input = wp_parse_args( $overwrite, $defaults );
1208
+
1209
+    return $input;
1210 1210
 }
1211 1211
 
1212 1212
 /**
@@ -1219,18 +1219,18 @@  discard block
 block discarded – undo
1219 1219
  */
1220 1220
 function sd_get_font_size_input_group( $type = 'font_size', $overwrite = array(), $overwrite_custom = array() ) {
1221 1221
 
1222
-	$inputs = array();
1222
+    $inputs = array();
1223 1223
 
1224
-	if ( $overwrite !== false ) {
1225
-		$inputs[ $type ] = sd_get_font_size_input( $type, $overwrite, true );
1226
-	}
1224
+    if ( $overwrite !== false ) {
1225
+        $inputs[ $type ] = sd_get_font_size_input( $type, $overwrite, true );
1226
+    }
1227 1227
 
1228
-	if ( $overwrite_custom !== false ) {
1229
-		$custom            = $type . '_custom';
1230
-		$inputs[ $custom ] = sd_get_font_custom_size_input( $custom, $overwrite_custom, $type );
1231
-	}
1228
+    if ( $overwrite_custom !== false ) {
1229
+        $custom            = $type . '_custom';
1230
+        $inputs[ $custom ] = sd_get_font_custom_size_input( $custom, $overwrite_custom, $type );
1231
+    }
1232 1232
 
1233
-	return $inputs;
1233
+    return $inputs;
1234 1234
 }
1235 1235
 
1236 1236
 /**
@@ -1243,33 +1243,33 @@  discard block
 block discarded – undo
1243 1243
  */
1244 1244
 function sd_get_font_weight_input( $type = 'font_weight', $overwrite = array() ) {
1245 1245
 
1246
-	$options = array(
1247
-		''                                => __( 'Inherit', 'super-duper' ),
1248
-		'font-weight-bold'                => 'bold',
1249
-		'font-weight-bolder'              => 'bolder',
1250
-		'font-weight-normal'              => 'normal',
1251
-		'font-weight-light'               => 'light',
1252
-		'font-weight-lighter'             => 'lighter',
1253
-		'font-italic'                     => 'italic',
1254
-		'font-weight-bold font-italic'    => 'bold italic',
1255
-		'font-weight-bolder font-italic'  => 'bolder italic',
1256
-		'font-weight-normal font-italic'  => 'normal italic',
1257
-		'font-weight-light font-italic'   => 'light italic',
1258
-		'font-weight-lighter font-italic' => 'lighter italic',
1259
-	);
1260
-
1261
-	$defaults = array(
1262
-		'type'     => 'select',
1263
-		'title'    => __( 'Appearance', 'super-duper' ),
1264
-		'options'  => $options,
1265
-		'default'  => '',
1266
-		'desc_tip' => true,
1267
-		'group'    => __( 'Typography', 'super-duper' ),
1268
-	);
1269
-
1270
-	$input = wp_parse_args( $overwrite, $defaults );
1271
-
1272
-	return $input;
1246
+    $options = array(
1247
+        ''                                => __( 'Inherit', 'super-duper' ),
1248
+        'font-weight-bold'                => 'bold',
1249
+        'font-weight-bolder'              => 'bolder',
1250
+        'font-weight-normal'              => 'normal',
1251
+        'font-weight-light'               => 'light',
1252
+        'font-weight-lighter'             => 'lighter',
1253
+        'font-italic'                     => 'italic',
1254
+        'font-weight-bold font-italic'    => 'bold italic',
1255
+        'font-weight-bolder font-italic'  => 'bolder italic',
1256
+        'font-weight-normal font-italic'  => 'normal italic',
1257
+        'font-weight-light font-italic'   => 'light italic',
1258
+        'font-weight-lighter font-italic' => 'lighter italic',
1259
+    );
1260
+
1261
+    $defaults = array(
1262
+        'type'     => 'select',
1263
+        'title'    => __( 'Appearance', 'super-duper' ),
1264
+        'options'  => $options,
1265
+        'default'  => '',
1266
+        'desc_tip' => true,
1267
+        'group'    => __( 'Typography', 'super-duper' ),
1268
+    );
1269
+
1270
+    $input = wp_parse_args( $overwrite, $defaults );
1271
+
1272
+    return $input;
1273 1273
 }
1274 1274
 
1275 1275
 /**
@@ -1282,25 +1282,25 @@  discard block
 block discarded – undo
1282 1282
  */
1283 1283
 function sd_get_font_case_input( $type = 'font_weight', $overwrite = array() ) {
1284 1284
 
1285
-	$options = array(
1286
-		''                => __( 'Default', 'super-duper' ),
1287
-		'text-lowercase'  => __( 'lowercase', 'super-duper' ),
1288
-		'text-uppercase'  => __( 'UPPERCASE', 'super-duper' ),
1289
-		'text-capitalize' => __( 'Capitalize', 'super-duper' ),
1290
-	);
1291
-
1292
-	$defaults = array(
1293
-		'type'     => 'select',
1294
-		'title'    => __( 'Letter case', 'super-duper' ),
1295
-		'options'  => $options,
1296
-		'default'  => '',
1297
-		'desc_tip' => true,
1298
-		'group'    => __( 'Typography', 'super-duper' ),
1299
-	);
1300
-
1301
-	$input = wp_parse_args( $overwrite, $defaults );
1302
-
1303
-	return $input;
1285
+    $options = array(
1286
+        ''                => __( 'Default', 'super-duper' ),
1287
+        'text-lowercase'  => __( 'lowercase', 'super-duper' ),
1288
+        'text-uppercase'  => __( 'UPPERCASE', 'super-duper' ),
1289
+        'text-capitalize' => __( 'Capitalize', 'super-duper' ),
1290
+    );
1291
+
1292
+    $defaults = array(
1293
+        'type'     => 'select',
1294
+        'title'    => __( 'Letter case', 'super-duper' ),
1295
+        'options'  => $options,
1296
+        'default'  => '',
1297
+        'desc_tip' => true,
1298
+        'group'    => __( 'Typography', 'super-duper' ),
1299
+    );
1300
+
1301
+    $input = wp_parse_args( $overwrite, $defaults );
1302
+
1303
+    return $input;
1304 1304
 }
1305 1305
 
1306 1306
 /**
@@ -1314,23 +1314,23 @@  discard block
 block discarded – undo
1314 1314
  */
1315 1315
 function sd_get_font_italic_input( $type = 'font_italic', $overwrite = array() ) {
1316 1316
 
1317
-	$options = array(
1318
-		''            => __( 'No', 'super-duper' ),
1319
-		'font-italic' => __( 'Yes', 'super-duper' ),
1320
-	);
1317
+    $options = array(
1318
+        ''            => __( 'No', 'super-duper' ),
1319
+        'font-italic' => __( 'Yes', 'super-duper' ),
1320
+    );
1321 1321
 
1322
-	$defaults = array(
1323
-		'type'     => 'select',
1324
-		'title'    => __( 'Font italic', 'super-duper' ),
1325
-		'options'  => $options,
1326
-		'default'  => '',
1327
-		'desc_tip' => true,
1328
-		'group'    => __( 'Typography', 'super-duper' ),
1329
-	);
1322
+    $defaults = array(
1323
+        'type'     => 'select',
1324
+        'title'    => __( 'Font italic', 'super-duper' ),
1325
+        'options'  => $options,
1326
+        'default'  => '',
1327
+        'desc_tip' => true,
1328
+        'group'    => __( 'Typography', 'super-duper' ),
1329
+    );
1330 1330
 
1331
-	$input = wp_parse_args( $overwrite, $defaults );
1331
+    $input = wp_parse_args( $overwrite, $defaults );
1332 1332
 
1333
-	return $input;
1333
+    return $input;
1334 1334
 }
1335 1335
 
1336 1336
 /**
@@ -1343,18 +1343,18 @@  discard block
 block discarded – undo
1343 1343
  */
1344 1344
 function sd_get_anchor_input( $type = 'anchor', $overwrite = array() ) {
1345 1345
 
1346
-	$defaults = array(
1347
-		'type'     => 'text',
1348
-		'title'    => __( 'HTML anchor', 'super-duper' ),
1349
-		'desc'     => __( 'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.' ),
1350
-		'default'  => '',
1351
-		'desc_tip' => true,
1352
-		'group'    => __( 'Advanced', 'super-duper' ),
1353
-	);
1346
+    $defaults = array(
1347
+        'type'     => 'text',
1348
+        'title'    => __( 'HTML anchor', 'super-duper' ),
1349
+        'desc'     => __( 'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.' ),
1350
+        'default'  => '',
1351
+        'desc_tip' => true,
1352
+        'group'    => __( 'Advanced', 'super-duper' ),
1353
+    );
1354 1354
 
1355
-	$input = wp_parse_args( $overwrite, $defaults );
1355
+    $input = wp_parse_args( $overwrite, $defaults );
1356 1356
 
1357
-	return $input;
1357
+    return $input;
1358 1358
 }
1359 1359
 
1360 1360
 /**
@@ -1367,18 +1367,18 @@  discard block
 block discarded – undo
1367 1367
  */
1368 1368
 function sd_get_class_input( $type = 'css_class', $overwrite = array() ) {
1369 1369
 
1370
-	$defaults = array(
1371
-		'type'     => 'text',
1372
-		'title'    => __( 'Additional CSS class(es)', 'super-duper' ),
1373
-		'desc'     => __( 'Separate multiple classes with spaces.', 'super-duper' ),
1374
-		'default'  => '',
1375
-		'desc_tip' => true,
1376
-		'group'    => __( 'Advanced', 'super-duper' ),
1377
-	);
1370
+    $defaults = array(
1371
+        'type'     => 'text',
1372
+        'title'    => __( 'Additional CSS class(es)', 'super-duper' ),
1373
+        'desc'     => __( 'Separate multiple classes with spaces.', 'super-duper' ),
1374
+        'default'  => '',
1375
+        'desc_tip' => true,
1376
+        'group'    => __( 'Advanced', 'super-duper' ),
1377
+    );
1378 1378
 
1379
-	$input = wp_parse_args( $overwrite, $defaults );
1379
+    $input = wp_parse_args( $overwrite, $defaults );
1380 1380
 
1381
-	return $input;
1381
+    return $input;
1382 1382
 }
1383 1383
 
1384 1384
 /**
@@ -1391,243 +1391,243 @@  discard block
 block discarded – undo
1391 1391
  */
1392 1392
 function sd_get_hover_animations_input( $type = 'hover_animations', $overwrite = array() ) {
1393 1393
 
1394
-	$options = array(
1395
-		'hover-zoom'       => __( 'Zoom', 'super-duper' ),
1396
-		'hover-shadow'     => __( 'Shadow', 'super-duper' ),
1397
-		'hover-move-up'    => __( 'Move up', 'super-duper' ),
1398
-		'hover-move-down'  => __( 'Move down', 'super-duper' ),
1399
-		'hover-move-left'  => __( 'Move left', 'super-duper' ),
1400
-		'hover-move-right' => __( 'Move right', 'super-duper' ),
1401
-	);
1402
-
1403
-	$defaults = array(
1404
-		'type'     => 'select',
1405
-		'multiple' => true,
1406
-		'title'    => __( 'Hover Animations', 'super-duper' ),
1407
-		'options'  => $options,
1408
-		'default'  => '',
1409
-		'desc_tip' => true,
1410
-		'group'    => __( 'Hover Animations', 'super-duper' ),
1411
-	);
1412
-
1413
-	$input = wp_parse_args( $overwrite, $defaults );
1414
-
1415
-	return $input;
1394
+    $options = array(
1395
+        'hover-zoom'       => __( 'Zoom', 'super-duper' ),
1396
+        'hover-shadow'     => __( 'Shadow', 'super-duper' ),
1397
+        'hover-move-up'    => __( 'Move up', 'super-duper' ),
1398
+        'hover-move-down'  => __( 'Move down', 'super-duper' ),
1399
+        'hover-move-left'  => __( 'Move left', 'super-duper' ),
1400
+        'hover-move-right' => __( 'Move right', 'super-duper' ),
1401
+    );
1402
+
1403
+    $defaults = array(
1404
+        'type'     => 'select',
1405
+        'multiple' => true,
1406
+        'title'    => __( 'Hover Animations', 'super-duper' ),
1407
+        'options'  => $options,
1408
+        'default'  => '',
1409
+        'desc_tip' => true,
1410
+        'group'    => __( 'Hover Animations', 'super-duper' ),
1411
+    );
1412
+
1413
+    $input = wp_parse_args( $overwrite, $defaults );
1414
+
1415
+    return $input;
1416 1416
 }
1417 1417
 
1418 1418
 
1419 1419
 function sd_get_flex_align_items_input( $type = 'align-items', $overwrite = array() ) {
1420
-	$device_size = '';
1421
-	if ( ! empty( $overwrite['device_type'] ) ) {
1422
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1423
-			$device_size = '-md';
1424
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1425
-			$device_size = '-lg';
1426
-		}
1427
-	}
1428
-	$options = array(
1429
-		''                                         => __( 'Default', 'super-duper' ),
1430
-		'align-items' . $device_size . '-start'    => 'align-items-start',
1431
-		'align-items' . $device_size . '-end'      => 'align-items-end',
1432
-		'align-items' . $device_size . '-center'   => 'align-items-center',
1433
-		'align-items' . $device_size . '-baseline' => 'align-items-baseline',
1434
-		'align-items' . $device_size . '-stretch'  => 'align-items-stretch',
1435
-	);
1436
-
1437
-	$defaults = array(
1438
-		'type'            => 'select',
1439
-		'title'           => __( 'Vertical Align Items', 'super-duper' ),
1440
-		'options'         => $options,
1441
-		'default'         => '',
1442
-		'desc_tip'        => true,
1443
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1444
-		'element_require' => ' ( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ',
1445
-
1446
-	);
1447
-
1448
-	$input = wp_parse_args( $overwrite, $defaults );
1449
-
1450
-	return $input;
1420
+    $device_size = '';
1421
+    if ( ! empty( $overwrite['device_type'] ) ) {
1422
+        if ( $overwrite['device_type'] == 'Tablet' ) {
1423
+            $device_size = '-md';
1424
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
1425
+            $device_size = '-lg';
1426
+        }
1427
+    }
1428
+    $options = array(
1429
+        ''                                         => __( 'Default', 'super-duper' ),
1430
+        'align-items' . $device_size . '-start'    => 'align-items-start',
1431
+        'align-items' . $device_size . '-end'      => 'align-items-end',
1432
+        'align-items' . $device_size . '-center'   => 'align-items-center',
1433
+        'align-items' . $device_size . '-baseline' => 'align-items-baseline',
1434
+        'align-items' . $device_size . '-stretch'  => 'align-items-stretch',
1435
+    );
1436
+
1437
+    $defaults = array(
1438
+        'type'            => 'select',
1439
+        'title'           => __( 'Vertical Align Items', 'super-duper' ),
1440
+        'options'         => $options,
1441
+        'default'         => '',
1442
+        'desc_tip'        => true,
1443
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1444
+        'element_require' => ' ( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ',
1445
+
1446
+    );
1447
+
1448
+    $input = wp_parse_args( $overwrite, $defaults );
1449
+
1450
+    return $input;
1451 1451
 }
1452 1452
 
1453 1453
 function sd_get_flex_align_items_input_group( $type = 'flex_align_items', $overwrite = array() ) {
1454
-	$inputs = array();
1455
-	$sizes  = array(
1456
-		''    => 'Mobile',
1457
-		'_md' => 'Tablet',
1458
-		'_lg' => 'Desktop',
1459
-	);
1460
-
1461
-	if ( $overwrite !== false ) {
1462
-
1463
-		foreach ( $sizes as $ds => $dt ) {
1464
-			$overwrite['device_type'] = $dt;
1465
-			$inputs[ $type . $ds ]    = sd_get_flex_align_items_input( $type, $overwrite );
1466
-		}
1467
-	}
1468
-
1469
-	return $inputs;
1454
+    $inputs = array();
1455
+    $sizes  = array(
1456
+        ''    => 'Mobile',
1457
+        '_md' => 'Tablet',
1458
+        '_lg' => 'Desktop',
1459
+    );
1460
+
1461
+    if ( $overwrite !== false ) {
1462
+
1463
+        foreach ( $sizes as $ds => $dt ) {
1464
+            $overwrite['device_type'] = $dt;
1465
+            $inputs[ $type . $ds ]    = sd_get_flex_align_items_input( $type, $overwrite );
1466
+        }
1467
+    }
1468
+
1469
+    return $inputs;
1470 1470
 }
1471 1471
 
1472 1472
 function sd_get_flex_justify_content_input( $type = 'flex_justify_content', $overwrite = array() ) {
1473
-	$device_size = '';
1474
-	if ( ! empty( $overwrite['device_type'] ) ) {
1475
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1476
-			$device_size = '-md';
1477
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1478
-			$device_size = '-lg';
1479
-		}
1480
-	}
1481
-	$options = array(
1482
-		''                                             => __( 'Default', 'super-duper' ),
1483
-		'justify-content' . $device_size . '-start'    => 'justify-content-start',
1484
-		'justify-content' . $device_size . '-end'      => 'justify-content-end',
1485
-		'justify-content' . $device_size . '-center'   => 'justify-content-center',
1486
-		'justify-content' . $device_size . '-between' => 'justify-content-between',
1487
-		'justify-content' . $device_size . '-stretch'  => 'justify-content-around',
1488
-	);
1489
-
1490
-	$defaults = array(
1491
-		'type'            => 'select',
1492
-		'title'           => __( 'Justify content' ),
1493
-		'options'         => $options,
1494
-		'default'         => '',
1495
-		'desc_tip'        => true,
1496
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1497
-		'element_require' => '( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ',
1498
-
1499
-	);
1500
-
1501
-	$input = wp_parse_args( $overwrite, $defaults );
1502
-
1503
-	return $input;
1473
+    $device_size = '';
1474
+    if ( ! empty( $overwrite['device_type'] ) ) {
1475
+        if ( $overwrite['device_type'] == 'Tablet' ) {
1476
+            $device_size = '-md';
1477
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
1478
+            $device_size = '-lg';
1479
+        }
1480
+    }
1481
+    $options = array(
1482
+        ''                                             => __( 'Default', 'super-duper' ),
1483
+        'justify-content' . $device_size . '-start'    => 'justify-content-start',
1484
+        'justify-content' . $device_size . '-end'      => 'justify-content-end',
1485
+        'justify-content' . $device_size . '-center'   => 'justify-content-center',
1486
+        'justify-content' . $device_size . '-between' => 'justify-content-between',
1487
+        'justify-content' . $device_size . '-stretch'  => 'justify-content-around',
1488
+    );
1489
+
1490
+    $defaults = array(
1491
+        'type'            => 'select',
1492
+        'title'           => __( 'Justify content' ),
1493
+        'options'         => $options,
1494
+        'default'         => '',
1495
+        'desc_tip'        => true,
1496
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1497
+        'element_require' => '( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ',
1498
+
1499
+    );
1500
+
1501
+    $input = wp_parse_args( $overwrite, $defaults );
1502
+
1503
+    return $input;
1504 1504
 }
1505 1505
 
1506 1506
 function sd_get_flex_justify_content_input_group( $type = 'flex_justify_content', $overwrite = array() ) {
1507
-	$inputs = array();
1508
-	$sizes  = array(
1509
-		''    => 'Mobile',
1510
-		'_md' => 'Tablet',
1511
-		'_lg' => 'Desktop',
1512
-	);
1513
-
1514
-	if ( $overwrite !== false ) {
1515
-
1516
-		foreach ( $sizes as $ds => $dt ) {
1517
-			$overwrite['device_type'] = $dt;
1518
-			$inputs[ $type . $ds ]    = sd_get_flex_justify_content_input( $type, $overwrite );
1519
-		}
1520
-	}
1521
-
1522
-	return $inputs;
1507
+    $inputs = array();
1508
+    $sizes  = array(
1509
+        ''    => 'Mobile',
1510
+        '_md' => 'Tablet',
1511
+        '_lg' => 'Desktop',
1512
+    );
1513
+
1514
+    if ( $overwrite !== false ) {
1515
+
1516
+        foreach ( $sizes as $ds => $dt ) {
1517
+            $overwrite['device_type'] = $dt;
1518
+            $inputs[ $type . $ds ]    = sd_get_flex_justify_content_input( $type, $overwrite );
1519
+        }
1520
+    }
1521
+
1522
+    return $inputs;
1523 1523
 }
1524 1524
 
1525 1525
 
1526 1526
 function sd_get_flex_align_self_input( $type = 'flex_align_self', $overwrite = array() ) {
1527
-	$device_size = '';
1528
-	if ( ! empty( $overwrite['device_type'] ) ) {
1529
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1530
-			$device_size = '-md';
1531
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1532
-			$device_size = '-lg';
1533
-		}
1534
-	}
1535
-	$options = array(
1536
-		''                                         => __( 'Default', 'super-duper' ),
1537
-		'align-items' . $device_size . '-start'    => 'align-items-start',
1538
-		'align-items' . $device_size . '-end'      => 'align-items-end',
1539
-		'align-items' . $device_size . '-center'   => 'align-items-center',
1540
-		'align-items' . $device_size . '-baseline' => 'align-items-baseline',
1541
-		'align-items' . $device_size . '-stretch'  => 'align-items-stretch',
1542
-	);
1543
-
1544
-	$defaults = array(
1545
-		'type'            => 'select',
1546
-		'title'           => __( 'Align Self', 'super-duper' ),
1547
-		'options'         => $options,
1548
-		'default'         => '',
1549
-		'desc_tip'        => true,
1550
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1551
-		'element_require' => ' [%container%]=="col" ',
1552
-
1553
-	);
1554
-
1555
-	$input = wp_parse_args( $overwrite, $defaults );
1556
-
1557
-	return $input;
1527
+    $device_size = '';
1528
+    if ( ! empty( $overwrite['device_type'] ) ) {
1529
+        if ( $overwrite['device_type'] == 'Tablet' ) {
1530
+            $device_size = '-md';
1531
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
1532
+            $device_size = '-lg';
1533
+        }
1534
+    }
1535
+    $options = array(
1536
+        ''                                         => __( 'Default', 'super-duper' ),
1537
+        'align-items' . $device_size . '-start'    => 'align-items-start',
1538
+        'align-items' . $device_size . '-end'      => 'align-items-end',
1539
+        'align-items' . $device_size . '-center'   => 'align-items-center',
1540
+        'align-items' . $device_size . '-baseline' => 'align-items-baseline',
1541
+        'align-items' . $device_size . '-stretch'  => 'align-items-stretch',
1542
+    );
1543
+
1544
+    $defaults = array(
1545
+        'type'            => 'select',
1546
+        'title'           => __( 'Align Self', 'super-duper' ),
1547
+        'options'         => $options,
1548
+        'default'         => '',
1549
+        'desc_tip'        => true,
1550
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1551
+        'element_require' => ' [%container%]=="col" ',
1552
+
1553
+    );
1554
+
1555
+    $input = wp_parse_args( $overwrite, $defaults );
1556
+
1557
+    return $input;
1558 1558
 }
1559 1559
 
1560 1560
 function sd_get_flex_align_self_input_group( $type = 'flex_align_self', $overwrite = array() ) {
1561
-	$inputs = array();
1562
-	$sizes  = array(
1563
-		''    => 'Mobile',
1564
-		'_md' => 'Tablet',
1565
-		'_lg' => 'Desktop',
1566
-	);
1567
-
1568
-	if ( $overwrite !== false ) {
1569
-
1570
-		foreach ( $sizes as $ds => $dt ) {
1571
-			$overwrite['device_type'] = $dt;
1572
-			$inputs[ $type . $ds ]    = sd_get_flex_align_self_input( $type, $overwrite );
1573
-		}
1574
-	}
1575
-
1576
-	return $inputs;
1561
+    $inputs = array();
1562
+    $sizes  = array(
1563
+        ''    => 'Mobile',
1564
+        '_md' => 'Tablet',
1565
+        '_lg' => 'Desktop',
1566
+    );
1567
+
1568
+    if ( $overwrite !== false ) {
1569
+
1570
+        foreach ( $sizes as $ds => $dt ) {
1571
+            $overwrite['device_type'] = $dt;
1572
+            $inputs[ $type . $ds ]    = sd_get_flex_align_self_input( $type, $overwrite );
1573
+        }
1574
+    }
1575
+
1576
+    return $inputs;
1577 1577
 }
1578 1578
 
1579 1579
 function sd_get_flex_order_input( $type = 'flex_order', $overwrite = array() ) {
1580
-	$device_size = '';
1581
-	if ( ! empty( $overwrite['device_type'] ) ) {
1582
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1583
-			$device_size = '-md';
1584
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1585
-			$device_size = '-lg';
1586
-		}
1587
-	}
1588
-	$options = array(
1589
-		'' => __( 'Default', 'super-duper' ),
1590
-	);
1591
-
1592
-	$i = 0;
1593
-	while ( $i <= 12 ) {
1594
-		$options[ 'order' . $device_size . '-' . $i ] = $i;
1595
-		$i++;
1596
-	}
1597
-
1598
-	$defaults = array(
1599
-		'type'            => 'select',
1600
-		'title'           => __( 'Flex Order', 'super-duper' ),
1601
-		'options'         => $options,
1602
-		'default'         => '',
1603
-		'desc_tip'        => true,
1604
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1605
-		'element_require' => ' [%container%]=="col" ',
1606
-
1607
-	);
1608
-
1609
-	$input = wp_parse_args( $overwrite, $defaults );
1610
-
1611
-	return $input;
1580
+    $device_size = '';
1581
+    if ( ! empty( $overwrite['device_type'] ) ) {
1582
+        if ( $overwrite['device_type'] == 'Tablet' ) {
1583
+            $device_size = '-md';
1584
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
1585
+            $device_size = '-lg';
1586
+        }
1587
+    }
1588
+    $options = array(
1589
+        '' => __( 'Default', 'super-duper' ),
1590
+    );
1591
+
1592
+    $i = 0;
1593
+    while ( $i <= 12 ) {
1594
+        $options[ 'order' . $device_size . '-' . $i ] = $i;
1595
+        $i++;
1596
+    }
1597
+
1598
+    $defaults = array(
1599
+        'type'            => 'select',
1600
+        'title'           => __( 'Flex Order', 'super-duper' ),
1601
+        'options'         => $options,
1602
+        'default'         => '',
1603
+        'desc_tip'        => true,
1604
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1605
+        'element_require' => ' [%container%]=="col" ',
1606
+
1607
+    );
1608
+
1609
+    $input = wp_parse_args( $overwrite, $defaults );
1610
+
1611
+    return $input;
1612 1612
 }
1613 1613
 
1614 1614
 function sd_get_flex_order_input_group( $type = 'flex_order', $overwrite = array() ) {
1615
-	$inputs = array();
1616
-	$sizes  = array(
1617
-		''    => 'Mobile',
1618
-		'_md' => 'Tablet',
1619
-		'_lg' => 'Desktop',
1620
-	);
1621
-
1622
-	if ( $overwrite !== false ) {
1623
-
1624
-		foreach ( $sizes as $ds => $dt ) {
1625
-			$overwrite['device_type'] = $dt;
1626
-			$inputs[ $type . $ds ]    = sd_get_flex_order_input( $type, $overwrite );
1627
-		}
1628
-	}
1629
-
1630
-	return $inputs;
1615
+    $inputs = array();
1616
+    $sizes  = array(
1617
+        ''    => 'Mobile',
1618
+        '_md' => 'Tablet',
1619
+        '_lg' => 'Desktop',
1620
+    );
1621
+
1622
+    if ( $overwrite !== false ) {
1623
+
1624
+        foreach ( $sizes as $ds => $dt ) {
1625
+            $overwrite['device_type'] = $dt;
1626
+            $inputs[ $type . $ds ]    = sd_get_flex_order_input( $type, $overwrite );
1627
+        }
1628
+    }
1629
+
1630
+    return $inputs;
1631 1631
 }
1632 1632
 
1633 1633
 /**
@@ -1640,345 +1640,345 @@  discard block
 block discarded – undo
1640 1640
  */
1641 1641
 function sd_build_aui_class( $args ) {
1642 1642
 
1643
-	$classes = array();
1644
-
1645
-	// margins.
1646
-	if ( isset( $args['mt'] ) && $args['mt'] !== '' ) {
1647
-		$classes[] = 'mt-' . sanitize_html_class( $args['mt'] );
1648
-		$mt        = $args['mt'];
1649
-	} else {
1650
-		$mt = null;
1651
-	}
1652
-	if ( isset( $args['mr'] ) && $args['mr'] !== '' ) {
1653
-		$classes[] = 'mr-' . sanitize_html_class( $args['mr'] );
1654
-		$mr        = $args['mr'];
1655
-	} else {
1656
-		$mr = null;
1657
-	}
1658
-	if ( isset( $args['mb'] ) && $args['mb'] !== '' ) {
1659
-		$classes[] = 'mb-' . sanitize_html_class( $args['mb'] );
1660
-		$mb        = $args['mb'];
1661
-	} else {
1662
-		$mb = null;
1663
-	}
1664
-	if ( isset( $args['ml'] ) && $args['ml'] !== '' ) {
1665
-		$classes[] = 'ml-' . sanitize_html_class( $args['ml'] );
1666
-		$ml        = $args['ml'];
1667
-	} else {
1668
-		$ml = null;
1669
-	}
1670
-
1671
-	// margins tablet.
1672
-	if ( isset( $args['mt_md'] ) && $args['mt_md'] !== '' ) {
1673
-		$classes[] = 'mt-md-' . sanitize_html_class( $args['mt_md'] );
1674
-		$mt_md     = $args['mt_md'];
1675
-	} else {
1676
-		$mt_md = null;
1677
-	}
1678
-	if ( isset( $args['mr_md'] ) && $args['mr_md'] !== '' ) {
1679
-		$classes[] = 'mr-md-' . sanitize_html_class( $args['mr_md'] );
1680
-		$mt_md     = $args['mr_md'];
1681
-	} else {
1682
-		$mr_md = null;
1683
-	}
1684
-	if ( isset( $args['mb_md'] ) && $args['mb_md'] !== '' ) {
1685
-		$classes[] = 'mb-md-' . sanitize_html_class( $args['mb_md'] );
1686
-		$mt_md     = $args['mb_md'];
1687
-	} else {
1688
-		$mb_md = null;
1689
-	}
1690
-	if ( isset( $args['ml_md'] ) && $args['ml_md'] !== '' ) {
1691
-		$classes[] = 'ml-md-' . sanitize_html_class( $args['ml_md'] );
1692
-		$mt_md     = $args['ml_md'];
1693
-	} else {
1694
-		$ml_md = null;
1695
-	}
1696
-
1697
-	// margins desktop.
1698
-	if ( isset( $args['mt_lg'] ) && $args['mt_lg'] !== '' ) {
1699
-		if ( $mt == null && $mt_md == null ) {
1700
-			$classes[] = 'mt-' . sanitize_html_class( $args['mt_lg'] );
1701
-		} else {
1702
-			$classes[] = 'mt-lg-' . sanitize_html_class( $args['mt_lg'] );
1703
-		}
1704
-	}
1705
-	if ( isset( $args['mr_lg'] ) && $args['mr_lg'] !== '' ) {
1706
-		if ( $mr == null && $mr_md == null ) {
1707
-			$classes[] = 'mr-' . sanitize_html_class( $args['mr_lg'] );
1708
-		} else {
1709
-			$classes[] = 'mr-lg-' . sanitize_html_class( $args['mr_lg'] );
1710
-		}
1711
-	}
1712
-	if ( isset( $args['mb_lg'] ) && $args['mb_lg'] !== '' ) {
1713
-		if ( $mb == null && $mb_md == null ) {
1714
-			$classes[] = 'mb-' . sanitize_html_class( $args['mb_lg'] );
1715
-		} else {
1716
-			$classes[] = 'mb-lg-' . sanitize_html_class( $args['mb_lg'] );
1717
-		}
1718
-	}
1719
-	if ( isset( $args['ml_lg'] ) && $args['ml_lg'] !== '' ) {
1720
-		if ( $ml == null && $ml_md == null ) {
1721
-			$classes[] = 'ml-' . sanitize_html_class( $args['ml_lg'] );
1722
-		} else {
1723
-			$classes[] = 'ml-lg-' . sanitize_html_class( $args['ml_lg'] );
1724
-		}
1725
-	}
1726
-
1727
-	// padding.
1728
-	if ( isset( $args['pt'] ) && $args['pt'] !== '' ) {
1729
-		$classes[] = 'pt-' . sanitize_html_class( $args['pt'] );
1730
-		$pt        = $args['pt'];
1731
-	} else {
1732
-		$pt = null;
1733
-	}
1734
-	if ( isset( $args['pr'] ) && $args['pr'] !== '' ) {
1735
-		$classes[] = 'pr-' . sanitize_html_class( $args['pr'] );
1736
-		$pr        = $args['pr'];
1737
-	} else {
1738
-		$pr = null;
1739
-	}
1740
-	if ( isset( $args['pb'] ) && $args['pb'] !== '' ) {
1741
-		$classes[] = 'pb-' . sanitize_html_class( $args['pb'] );
1742
-		$pb        = $args['pb'];
1743
-	} else {
1744
-		$pb = null;
1745
-	}
1746
-	if ( isset( $args['pl'] ) && $args['pl'] !== '' ) {
1747
-		$classes[] = 'pl-' . sanitize_html_class( $args['pl'] );
1748
-		$pl        = $args['pl'];
1749
-	} else {
1750
-		$pl = null;
1751
-	}
1752
-
1753
-	// padding tablet.
1754
-	if ( isset( $args['pt_md'] ) && $args['pt_md'] !== '' ) {
1755
-		$classes[] = 'pt-md-' . sanitize_html_class( $args['pt_md'] );
1756
-		$pt_md     = $args['pt_md'];
1757
-	} else {
1758
-		$pt_md = null;
1759
-	}
1760
-	if ( isset( $args['pr_md'] ) && $args['pr_md'] !== '' ) {
1761
-		$classes[] = 'pr-md-' . sanitize_html_class( $args['pr_md'] );
1762
-		$pt_md     = $args['pr_md'];
1763
-	} else {
1764
-		$pr_md = null;
1765
-	}
1766
-	if ( isset( $args['pb_md'] ) && $args['pb_md'] !== '' ) {
1767
-		$classes[] = 'pb-md-' . sanitize_html_class( $args['pb_md'] );
1768
-		$pt_md     = $args['pb_md'];
1769
-	} else {
1770
-		$pb_md = null;
1771
-	}
1772
-	if ( isset( $args['pl_md'] ) && $args['pl_md'] !== '' ) {
1773
-		$classes[] = 'pl-md-' . sanitize_html_class( $args['pl_md'] );
1774
-		$pt_md     = $args['pl_md'];
1775
-	} else {
1776
-		$pl_md = null;
1777
-	}
1778
-
1779
-	// padding desktop.
1780
-	if ( isset( $args['pt_lg'] ) && $args['pt_lg'] !== '' ) {
1781
-		if ( $pt == null && $pt_md == null ) {
1782
-			$classes[] = 'pt-' . sanitize_html_class( $args['pt_lg'] );
1783
-		} else {
1784
-			$classes[] = 'pt-lg-' . sanitize_html_class( $args['pt_lg'] );
1785
-		}
1786
-	}
1787
-	if ( isset( $args['pr_lg'] ) && $args['pr_lg'] !== '' ) {
1788
-		if ( $pr == null && $pr_md == null ) {
1789
-			$classes[] = 'pr-' . sanitize_html_class( $args['pr_lg'] );
1790
-		} else {
1791
-			$classes[] = 'pr-lg-' . sanitize_html_class( $args['pr_lg'] );
1792
-		}
1793
-	}
1794
-	if ( isset( $args['pb_lg'] ) && $args['pb_lg'] !== '' ) {
1795
-		if ( $pb == null && $pb_md == null ) {
1796
-			$classes[] = 'pb-' . sanitize_html_class( $args['pb_lg'] );
1797
-		} else {
1798
-			$classes[] = 'pb-lg-' . sanitize_html_class( $args['pb_lg'] );
1799
-		}
1800
-	}
1801
-	if ( isset( $args['pl_lg'] ) && $args['pl_lg'] !== '' ) {
1802
-		if ( $pl == null && $pl_md == null ) {
1803
-			$classes[] = 'pl-' . sanitize_html_class( $args['pl_lg'] );
1804
-		} else {
1805
-			$classes[] = 'pl-lg-' . sanitize_html_class( $args['pl_lg'] );
1806
-		}
1807
-	}
1808
-
1809
-	// row cols, mobile, tablet, desktop
1810
-	if ( ! empty( $args['row_cols'] ) && $args['row_cols'] !== '' ) {
1811
-		$classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols'] );
1812
-		$row_cols  = $args['row_cols'];
1813
-	} else {
1814
-		$row_cols = null;
1815
-	}
1816
-	if ( ! empty( $args['row_cols_md'] ) && $args['row_cols_md'] !== '' ) {
1817
-		$classes[]   = sanitize_html_class( 'row-cols-md-' . $args['row_cols_md'] );
1818
-		$row_cols_md = $args['row_cols_md'];
1819
-	} else {
1820
-		$row_cols_md = null;
1821
-	}
1822
-	if ( ! empty( $args['row_cols_lg'] ) && $args['row_cols_lg'] !== '' ) {
1823
-		if ( $row_cols == null && $row_cols_md == null ) {
1824
-			$classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols_lg'] );
1825
-		} else {
1826
-			$classes[] = sanitize_html_class( 'row-cols-lg-' . $args['row_cols_lg'] );
1827
-		}
1828
-	}
1829
-
1830
-	// columns , mobile, tablet, desktop
1831
-	if ( ! empty( $args['col'] ) && $args['col'] !== '' ) {
1832
-		$classes[] = sanitize_html_class( 'col-' . $args['col'] );
1833
-		$col       = $args['col'];
1834
-	} else {
1835
-		$col = null;
1836
-	}
1837
-	if ( ! empty( $args['col_md'] ) && $args['col_md'] !== '' ) {
1838
-		$classes[] = sanitize_html_class( 'col-md-' . $args['col_md'] );
1839
-		$col_md    = $args['col_md'];
1840
-	} else {
1841
-		$col_md = null;
1842
-	}
1843
-	if ( ! empty( $args['col_lg'] ) && $args['col_lg'] !== '' ) {
1844
-		if ( $col == null && $col_md == null ) {
1845
-			$classes[] = sanitize_html_class( 'col-' . $args['col_lg'] );
1846
-		} else {
1847
-			$classes[] = sanitize_html_class( 'col-lg-' . $args['col_lg'] );
1848
-		}
1849
-	}
1850
-
1851
-	// border
1852
-	if ( ! empty( $args['border'] ) && ( $args['border'] == 'none' || $args['border'] === '0' ) ) {
1853
-		$classes[] = 'border-0';
1854
-	} elseif ( ! empty( $args['border'] ) ) {
1855
-		$classes[] = 'border border-' . sanitize_html_class( $args['border'] );
1856
-	}
1857
-
1858
-	// border radius type
1859
-	if ( ! empty( $args['rounded'] ) ) {
1860
-		$classes[] = sanitize_html_class( $args['rounded'] );
1861
-	}
1862
-
1863
-	// border radius size
1864
-	if ( ! empty( $args['rounded_size'] ) ) {
1865
-		$classes[] = 'rounded-' . sanitize_html_class( $args['rounded_size'] );
1866
-		// if we set a size then we need to remove "rounded" if set
1867
-		if ( ( $key = array_search( 'rounded', $classes ) ) !== false ) {
1868
-			unset( $classes[ $key ] );
1869
-		}
1870
-	}
1871
-
1872
-	// shadow
1873
-	//if ( !empty( $args['shadow'] ) ) { $classes[] = sanitize_html_class($args['shadow']); }
1874
-
1875
-	// background
1876
-	if ( ! empty( $args['bg'] ) ) {
1877
-		$classes[] = 'bg-' . sanitize_html_class( $args['bg'] );
1878
-	}
1879
-
1880
-	// text_color
1881
-	if ( ! empty( $args['text_color'] ) ) {
1882
-		$classes[] = 'text-' . sanitize_html_class( $args['text_color'] );
1883
-	}
1884
-
1885
-	// text_align
1886
-	if ( ! empty( $args['text_justify'] ) ) {
1887
-		$classes[] = 'text-justify';
1888
-	} else {
1889
-		if ( ! empty( $args['text_align'] ) ) {
1890
-			$classes[]  = sanitize_html_class( $args['text_align'] );
1891
-			$text_align = $args['text_align'];
1892
-		} else {
1893
-			$text_align = null;
1894
-		}
1895
-		if ( ! empty( $args['text_align_md'] ) && $args['text_align_md'] !== '' ) {
1896
-			$classes[]     = sanitize_html_class( $args['text_align_md'] );
1897
-			$text_align_md = $args['text_align_md'];
1898
-		} else {
1899
-			$text_align_md = null;
1900
-		}
1901
-		if ( ! empty( $args['text_align_lg'] ) && $args['text_align_lg'] !== '' ) {
1902
-			if ( $text_align == null && $text_align_md == null ) {
1903
-				$classes[] = sanitize_html_class( str_replace( '-lg', '', $args['text_align_lg'] ) );
1904
-			} else {
1905
-				$classes[] = sanitize_html_class( $args['text_align_lg'] );
1906
-			}
1907
-		}
1908
-	}
1909
-
1910
-	// display
1911
-	if ( ! empty( $args['display'] ) ) {
1912
-		$classes[] = sanitize_html_class( $args['display'] );
1913
-		$display   = $args['display'];
1914
-	} else {
1915
-		$display = null;
1916
-	}
1917
-	if ( ! empty( $args['display_md'] ) && $args['display_md'] !== '' ) {
1918
-		$classes[]  = sanitize_html_class( $args['display_md'] );
1919
-		$display_md = $args['display_md'];
1920
-	} else {
1921
-		$display_md = null;
1922
-	}
1923
-	if ( ! empty( $args['display_lg'] ) && $args['display_lg'] !== '' ) {
1924
-		if ( $display == null && $display_md == null ) {
1925
-			$classes[] = sanitize_html_class( str_replace( '-lg', '', $args['display_lg'] ) );
1926
-		} else {
1927
-			$classes[] = sanitize_html_class( $args['display_lg'] );
1928
-		}
1929
-	}
1930
-
1931
-	// bgtus - background transparent until scroll
1932
-	if ( ! empty( $args['bgtus'] ) ) {
1933
-		$classes[] = sanitize_html_class( 'bg-transparent-until-scroll' );
1934
-	}
1935
-
1936
-	// hover animations
1937
-	if ( ! empty( $args['hover_animations'] ) ) {
1938
-		$classes[] = sd_sanitize_html_classes( str_replace( ',', ' ', $args['hover_animations'] ) );
1939
-	}
1940
-
1941
-	// build classes from build keys
1942
-	$build_keys = sd_get_class_build_keys();
1943
-	if ( ! empty( $build_keys ) ) {
1944
-		foreach ( $build_keys as $key ) {
1945
-
1946
-			if ( substr( $key, -4 ) == '-MTD' ) {
1947
-
1948
-				$k = str_replace( '_MTD', '', $key );
1949
-
1950
-				// Mobile, Tablet, Desktop
1951
-				if ( ! empty( $args[ $k ] ) && $args[ $k ] !== '' ) {
1952
-					$classes[] = sanitize_html_class( $args[ $k ] );
1953
-					$v         = $args[ $k ];
1954
-				} else {
1955
-					$v = null;
1956
-				}
1957
-				if ( ! empty( $args[ $k . '_md' ] ) && $args[ $k . '_md' ] !== '' ) {
1958
-					$classes[] = sanitize_html_class( $args[ $k . '_md' ] );
1959
-					$v_md      = $args[ $k . '_md' ];
1960
-				} else {
1961
-					$v_md = null;
1962
-				}
1963
-				if ( ! empty( $args[ $k . '_lg' ] ) && $args[ $k . '_lg' ] !== '' ) {
1964
-					if ( $v == null && $v_md == null ) {
1965
-						$classes[] = sanitize_html_class( str_replace( '-lg', '', $args[ $k . '_lg' ] ) );
1966
-					} else {
1967
-						$classes[] = sanitize_html_class( $args[ $k . '_lg' ] );
1968
-					}
1969
-				}
1970
-			} else {
1971
-				if ( $key == 'font_size' && ! empty( $args[ $key ] ) && $args[ $key ] == 'custom' ) {
1972
-					continue;
1973
-				}
1974
-				if ( ! empty( $args[ $key ] ) ) {
1975
-					$classes[] = sd_sanitize_html_classes( $args[ $key ] );
1976
-				}
1977
-			}
1978
-		}
1979
-	}
1980
-
1981
-	return implode( ' ', $classes );
1643
+    $classes = array();
1644
+
1645
+    // margins.
1646
+    if ( isset( $args['mt'] ) && $args['mt'] !== '' ) {
1647
+        $classes[] = 'mt-' . sanitize_html_class( $args['mt'] );
1648
+        $mt        = $args['mt'];
1649
+    } else {
1650
+        $mt = null;
1651
+    }
1652
+    if ( isset( $args['mr'] ) && $args['mr'] !== '' ) {
1653
+        $classes[] = 'mr-' . sanitize_html_class( $args['mr'] );
1654
+        $mr        = $args['mr'];
1655
+    } else {
1656
+        $mr = null;
1657
+    }
1658
+    if ( isset( $args['mb'] ) && $args['mb'] !== '' ) {
1659
+        $classes[] = 'mb-' . sanitize_html_class( $args['mb'] );
1660
+        $mb        = $args['mb'];
1661
+    } else {
1662
+        $mb = null;
1663
+    }
1664
+    if ( isset( $args['ml'] ) && $args['ml'] !== '' ) {
1665
+        $classes[] = 'ml-' . sanitize_html_class( $args['ml'] );
1666
+        $ml        = $args['ml'];
1667
+    } else {
1668
+        $ml = null;
1669
+    }
1670
+
1671
+    // margins tablet.
1672
+    if ( isset( $args['mt_md'] ) && $args['mt_md'] !== '' ) {
1673
+        $classes[] = 'mt-md-' . sanitize_html_class( $args['mt_md'] );
1674
+        $mt_md     = $args['mt_md'];
1675
+    } else {
1676
+        $mt_md = null;
1677
+    }
1678
+    if ( isset( $args['mr_md'] ) && $args['mr_md'] !== '' ) {
1679
+        $classes[] = 'mr-md-' . sanitize_html_class( $args['mr_md'] );
1680
+        $mt_md     = $args['mr_md'];
1681
+    } else {
1682
+        $mr_md = null;
1683
+    }
1684
+    if ( isset( $args['mb_md'] ) && $args['mb_md'] !== '' ) {
1685
+        $classes[] = 'mb-md-' . sanitize_html_class( $args['mb_md'] );
1686
+        $mt_md     = $args['mb_md'];
1687
+    } else {
1688
+        $mb_md = null;
1689
+    }
1690
+    if ( isset( $args['ml_md'] ) && $args['ml_md'] !== '' ) {
1691
+        $classes[] = 'ml-md-' . sanitize_html_class( $args['ml_md'] );
1692
+        $mt_md     = $args['ml_md'];
1693
+    } else {
1694
+        $ml_md = null;
1695
+    }
1696
+
1697
+    // margins desktop.
1698
+    if ( isset( $args['mt_lg'] ) && $args['mt_lg'] !== '' ) {
1699
+        if ( $mt == null && $mt_md == null ) {
1700
+            $classes[] = 'mt-' . sanitize_html_class( $args['mt_lg'] );
1701
+        } else {
1702
+            $classes[] = 'mt-lg-' . sanitize_html_class( $args['mt_lg'] );
1703
+        }
1704
+    }
1705
+    if ( isset( $args['mr_lg'] ) && $args['mr_lg'] !== '' ) {
1706
+        if ( $mr == null && $mr_md == null ) {
1707
+            $classes[] = 'mr-' . sanitize_html_class( $args['mr_lg'] );
1708
+        } else {
1709
+            $classes[] = 'mr-lg-' . sanitize_html_class( $args['mr_lg'] );
1710
+        }
1711
+    }
1712
+    if ( isset( $args['mb_lg'] ) && $args['mb_lg'] !== '' ) {
1713
+        if ( $mb == null && $mb_md == null ) {
1714
+            $classes[] = 'mb-' . sanitize_html_class( $args['mb_lg'] );
1715
+        } else {
1716
+            $classes[] = 'mb-lg-' . sanitize_html_class( $args['mb_lg'] );
1717
+        }
1718
+    }
1719
+    if ( isset( $args['ml_lg'] ) && $args['ml_lg'] !== '' ) {
1720
+        if ( $ml == null && $ml_md == null ) {
1721
+            $classes[] = 'ml-' . sanitize_html_class( $args['ml_lg'] );
1722
+        } else {
1723
+            $classes[] = 'ml-lg-' . sanitize_html_class( $args['ml_lg'] );
1724
+        }
1725
+    }
1726
+
1727
+    // padding.
1728
+    if ( isset( $args['pt'] ) && $args['pt'] !== '' ) {
1729
+        $classes[] = 'pt-' . sanitize_html_class( $args['pt'] );
1730
+        $pt        = $args['pt'];
1731
+    } else {
1732
+        $pt = null;
1733
+    }
1734
+    if ( isset( $args['pr'] ) && $args['pr'] !== '' ) {
1735
+        $classes[] = 'pr-' . sanitize_html_class( $args['pr'] );
1736
+        $pr        = $args['pr'];
1737
+    } else {
1738
+        $pr = null;
1739
+    }
1740
+    if ( isset( $args['pb'] ) && $args['pb'] !== '' ) {
1741
+        $classes[] = 'pb-' . sanitize_html_class( $args['pb'] );
1742
+        $pb        = $args['pb'];
1743
+    } else {
1744
+        $pb = null;
1745
+    }
1746
+    if ( isset( $args['pl'] ) && $args['pl'] !== '' ) {
1747
+        $classes[] = 'pl-' . sanitize_html_class( $args['pl'] );
1748
+        $pl        = $args['pl'];
1749
+    } else {
1750
+        $pl = null;
1751
+    }
1752
+
1753
+    // padding tablet.
1754
+    if ( isset( $args['pt_md'] ) && $args['pt_md'] !== '' ) {
1755
+        $classes[] = 'pt-md-' . sanitize_html_class( $args['pt_md'] );
1756
+        $pt_md     = $args['pt_md'];
1757
+    } else {
1758
+        $pt_md = null;
1759
+    }
1760
+    if ( isset( $args['pr_md'] ) && $args['pr_md'] !== '' ) {
1761
+        $classes[] = 'pr-md-' . sanitize_html_class( $args['pr_md'] );
1762
+        $pt_md     = $args['pr_md'];
1763
+    } else {
1764
+        $pr_md = null;
1765
+    }
1766
+    if ( isset( $args['pb_md'] ) && $args['pb_md'] !== '' ) {
1767
+        $classes[] = 'pb-md-' . sanitize_html_class( $args['pb_md'] );
1768
+        $pt_md     = $args['pb_md'];
1769
+    } else {
1770
+        $pb_md = null;
1771
+    }
1772
+    if ( isset( $args['pl_md'] ) && $args['pl_md'] !== '' ) {
1773
+        $classes[] = 'pl-md-' . sanitize_html_class( $args['pl_md'] );
1774
+        $pt_md     = $args['pl_md'];
1775
+    } else {
1776
+        $pl_md = null;
1777
+    }
1778
+
1779
+    // padding desktop.
1780
+    if ( isset( $args['pt_lg'] ) && $args['pt_lg'] !== '' ) {
1781
+        if ( $pt == null && $pt_md == null ) {
1782
+            $classes[] = 'pt-' . sanitize_html_class( $args['pt_lg'] );
1783
+        } else {
1784
+            $classes[] = 'pt-lg-' . sanitize_html_class( $args['pt_lg'] );
1785
+        }
1786
+    }
1787
+    if ( isset( $args['pr_lg'] ) && $args['pr_lg'] !== '' ) {
1788
+        if ( $pr == null && $pr_md == null ) {
1789
+            $classes[] = 'pr-' . sanitize_html_class( $args['pr_lg'] );
1790
+        } else {
1791
+            $classes[] = 'pr-lg-' . sanitize_html_class( $args['pr_lg'] );
1792
+        }
1793
+    }
1794
+    if ( isset( $args['pb_lg'] ) && $args['pb_lg'] !== '' ) {
1795
+        if ( $pb == null && $pb_md == null ) {
1796
+            $classes[] = 'pb-' . sanitize_html_class( $args['pb_lg'] );
1797
+        } else {
1798
+            $classes[] = 'pb-lg-' . sanitize_html_class( $args['pb_lg'] );
1799
+        }
1800
+    }
1801
+    if ( isset( $args['pl_lg'] ) && $args['pl_lg'] !== '' ) {
1802
+        if ( $pl == null && $pl_md == null ) {
1803
+            $classes[] = 'pl-' . sanitize_html_class( $args['pl_lg'] );
1804
+        } else {
1805
+            $classes[] = 'pl-lg-' . sanitize_html_class( $args['pl_lg'] );
1806
+        }
1807
+    }
1808
+
1809
+    // row cols, mobile, tablet, desktop
1810
+    if ( ! empty( $args['row_cols'] ) && $args['row_cols'] !== '' ) {
1811
+        $classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols'] );
1812
+        $row_cols  = $args['row_cols'];
1813
+    } else {
1814
+        $row_cols = null;
1815
+    }
1816
+    if ( ! empty( $args['row_cols_md'] ) && $args['row_cols_md'] !== '' ) {
1817
+        $classes[]   = sanitize_html_class( 'row-cols-md-' . $args['row_cols_md'] );
1818
+        $row_cols_md = $args['row_cols_md'];
1819
+    } else {
1820
+        $row_cols_md = null;
1821
+    }
1822
+    if ( ! empty( $args['row_cols_lg'] ) && $args['row_cols_lg'] !== '' ) {
1823
+        if ( $row_cols == null && $row_cols_md == null ) {
1824
+            $classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols_lg'] );
1825
+        } else {
1826
+            $classes[] = sanitize_html_class( 'row-cols-lg-' . $args['row_cols_lg'] );
1827
+        }
1828
+    }
1829
+
1830
+    // columns , mobile, tablet, desktop
1831
+    if ( ! empty( $args['col'] ) && $args['col'] !== '' ) {
1832
+        $classes[] = sanitize_html_class( 'col-' . $args['col'] );
1833
+        $col       = $args['col'];
1834
+    } else {
1835
+        $col = null;
1836
+    }
1837
+    if ( ! empty( $args['col_md'] ) && $args['col_md'] !== '' ) {
1838
+        $classes[] = sanitize_html_class( 'col-md-' . $args['col_md'] );
1839
+        $col_md    = $args['col_md'];
1840
+    } else {
1841
+        $col_md = null;
1842
+    }
1843
+    if ( ! empty( $args['col_lg'] ) && $args['col_lg'] !== '' ) {
1844
+        if ( $col == null && $col_md == null ) {
1845
+            $classes[] = sanitize_html_class( 'col-' . $args['col_lg'] );
1846
+        } else {
1847
+            $classes[] = sanitize_html_class( 'col-lg-' . $args['col_lg'] );
1848
+        }
1849
+    }
1850
+
1851
+    // border
1852
+    if ( ! empty( $args['border'] ) && ( $args['border'] == 'none' || $args['border'] === '0' ) ) {
1853
+        $classes[] = 'border-0';
1854
+    } elseif ( ! empty( $args['border'] ) ) {
1855
+        $classes[] = 'border border-' . sanitize_html_class( $args['border'] );
1856
+    }
1857
+
1858
+    // border radius type
1859
+    if ( ! empty( $args['rounded'] ) ) {
1860
+        $classes[] = sanitize_html_class( $args['rounded'] );
1861
+    }
1862
+
1863
+    // border radius size
1864
+    if ( ! empty( $args['rounded_size'] ) ) {
1865
+        $classes[] = 'rounded-' . sanitize_html_class( $args['rounded_size'] );
1866
+        // if we set a size then we need to remove "rounded" if set
1867
+        if ( ( $key = array_search( 'rounded', $classes ) ) !== false ) {
1868
+            unset( $classes[ $key ] );
1869
+        }
1870
+    }
1871
+
1872
+    // shadow
1873
+    //if ( !empty( $args['shadow'] ) ) { $classes[] = sanitize_html_class($args['shadow']); }
1874
+
1875
+    // background
1876
+    if ( ! empty( $args['bg'] ) ) {
1877
+        $classes[] = 'bg-' . sanitize_html_class( $args['bg'] );
1878
+    }
1879
+
1880
+    // text_color
1881
+    if ( ! empty( $args['text_color'] ) ) {
1882
+        $classes[] = 'text-' . sanitize_html_class( $args['text_color'] );
1883
+    }
1884
+
1885
+    // text_align
1886
+    if ( ! empty( $args['text_justify'] ) ) {
1887
+        $classes[] = 'text-justify';
1888
+    } else {
1889
+        if ( ! empty( $args['text_align'] ) ) {
1890
+            $classes[]  = sanitize_html_class( $args['text_align'] );
1891
+            $text_align = $args['text_align'];
1892
+        } else {
1893
+            $text_align = null;
1894
+        }
1895
+        if ( ! empty( $args['text_align_md'] ) && $args['text_align_md'] !== '' ) {
1896
+            $classes[]     = sanitize_html_class( $args['text_align_md'] );
1897
+            $text_align_md = $args['text_align_md'];
1898
+        } else {
1899
+            $text_align_md = null;
1900
+        }
1901
+        if ( ! empty( $args['text_align_lg'] ) && $args['text_align_lg'] !== '' ) {
1902
+            if ( $text_align == null && $text_align_md == null ) {
1903
+                $classes[] = sanitize_html_class( str_replace( '-lg', '', $args['text_align_lg'] ) );
1904
+            } else {
1905
+                $classes[] = sanitize_html_class( $args['text_align_lg'] );
1906
+            }
1907
+        }
1908
+    }
1909
+
1910
+    // display
1911
+    if ( ! empty( $args['display'] ) ) {
1912
+        $classes[] = sanitize_html_class( $args['display'] );
1913
+        $display   = $args['display'];
1914
+    } else {
1915
+        $display = null;
1916
+    }
1917
+    if ( ! empty( $args['display_md'] ) && $args['display_md'] !== '' ) {
1918
+        $classes[]  = sanitize_html_class( $args['display_md'] );
1919
+        $display_md = $args['display_md'];
1920
+    } else {
1921
+        $display_md = null;
1922
+    }
1923
+    if ( ! empty( $args['display_lg'] ) && $args['display_lg'] !== '' ) {
1924
+        if ( $display == null && $display_md == null ) {
1925
+            $classes[] = sanitize_html_class( str_replace( '-lg', '', $args['display_lg'] ) );
1926
+        } else {
1927
+            $classes[] = sanitize_html_class( $args['display_lg'] );
1928
+        }
1929
+    }
1930
+
1931
+    // bgtus - background transparent until scroll
1932
+    if ( ! empty( $args['bgtus'] ) ) {
1933
+        $classes[] = sanitize_html_class( 'bg-transparent-until-scroll' );
1934
+    }
1935
+
1936
+    // hover animations
1937
+    if ( ! empty( $args['hover_animations'] ) ) {
1938
+        $classes[] = sd_sanitize_html_classes( str_replace( ',', ' ', $args['hover_animations'] ) );
1939
+    }
1940
+
1941
+    // build classes from build keys
1942
+    $build_keys = sd_get_class_build_keys();
1943
+    if ( ! empty( $build_keys ) ) {
1944
+        foreach ( $build_keys as $key ) {
1945
+
1946
+            if ( substr( $key, -4 ) == '-MTD' ) {
1947
+
1948
+                $k = str_replace( '_MTD', '', $key );
1949
+
1950
+                // Mobile, Tablet, Desktop
1951
+                if ( ! empty( $args[ $k ] ) && $args[ $k ] !== '' ) {
1952
+                    $classes[] = sanitize_html_class( $args[ $k ] );
1953
+                    $v         = $args[ $k ];
1954
+                } else {
1955
+                    $v = null;
1956
+                }
1957
+                if ( ! empty( $args[ $k . '_md' ] ) && $args[ $k . '_md' ] !== '' ) {
1958
+                    $classes[] = sanitize_html_class( $args[ $k . '_md' ] );
1959
+                    $v_md      = $args[ $k . '_md' ];
1960
+                } else {
1961
+                    $v_md = null;
1962
+                }
1963
+                if ( ! empty( $args[ $k . '_lg' ] ) && $args[ $k . '_lg' ] !== '' ) {
1964
+                    if ( $v == null && $v_md == null ) {
1965
+                        $classes[] = sanitize_html_class( str_replace( '-lg', '', $args[ $k . '_lg' ] ) );
1966
+                    } else {
1967
+                        $classes[] = sanitize_html_class( $args[ $k . '_lg' ] );
1968
+                    }
1969
+                }
1970
+            } else {
1971
+                if ( $key == 'font_size' && ! empty( $args[ $key ] ) && $args[ $key ] == 'custom' ) {
1972
+                    continue;
1973
+                }
1974
+                if ( ! empty( $args[ $key ] ) ) {
1975
+                    $classes[] = sd_sanitize_html_classes( $args[ $key ] );
1976
+                }
1977
+            }
1978
+        }
1979
+    }
1980
+
1981
+    return implode( ' ', $classes );
1982 1982
 }
1983 1983
 
1984 1984
 /**
@@ -1990,85 +1990,85 @@  discard block
 block discarded – undo
1990 1990
  */
1991 1991
 function sd_build_aui_styles( $args ) {
1992 1992
 
1993
-	$styles = array();
1994
-
1995
-	// background color
1996
-	if ( ! empty( $args['bg'] ) && $args['bg'] !== '' ) {
1997
-		if ( $args['bg'] == 'custom-color' ) {
1998
-			$styles['background-color'] = $args['bg_color'];
1999
-		} elseif ( $args['bg'] == 'custom-gradient' ) {
2000
-			$styles['background-image'] = $args['bg_gradient'];
2001
-
2002
-			// use background on text.
2003
-			if ( ! empty( $args['bg_on_text'] ) && $args['bg_on_text'] ) {
2004
-				$styles['background-clip']         = 'text';
2005
-				$styles['-webkit-background-clip'] = 'text';
2006
-				$styles['text-fill-color']         = 'transparent';
2007
-				$styles['-webkit-text-fill-color'] = 'transparent';
2008
-			}
2009
-		}
2010
-	}
2011
-
2012
-	if ( ! empty( $args['bg_image'] ) && $args['bg_image'] !== '' ) {
2013
-		$hasImage = true;
2014
-		if ( ! empty( $styles['background-color'] ) && $args['bg'] == 'custom-color' ) {
2015
-			$styles['background-image']      = 'url(' . $args['bg_image'] . ')';
2016
-			$styles['background-blend-mode'] = 'overlay';
2017
-		} elseif ( ! empty( $styles['background-image'] ) && $args['bg'] == 'custom-gradient' ) {
2018
-			$styles['background-image'] .= ',url(' . $args['bg_image'] . ')';
2019
-		} elseif ( ! empty( $args['bg'] ) && $args['bg'] != '' && $args['bg'] != 'transparent' ) {
2020
-			// do nothing as we alreay have a preset
2021
-			$hasImage = false;
2022
-		} else {
2023
-			$styles['background-image'] = 'url(' . $args['bg_image'] . ')';
2024
-		}
2025
-
2026
-		if ( $hasImage ) {
2027
-			$styles['background-size'] = 'cover';
2028
-
2029
-			if ( ! empty( $args['bg_image_fixed'] ) && $args['bg_image_fixed'] ) {
2030
-				$styles['background-attachment'] = 'fixed';
2031
-			}
2032
-		}
2033
-
2034
-		if ( $hasImage && ! empty( $args['bg_image_xy'] ) && ! empty( $args['bg_image_xy']['x'] ) ) {
2035
-			$styles['background-position'] = ( $args['bg_image_xy']['x'] * 100 ) . '% ' . ( $args['bg_image_xy']['y'] * 100 ) . '%';
2036
-		}
2037
-	}
2038
-
2039
-	// sticky offset top
2040
-	if ( ! empty( $args['sticky_offset_top'] ) && $args['sticky_offset_top'] !== '' ) {
2041
-		$styles['top'] = absint( $args['sticky_offset_top'] );
2042
-	}
2043
-
2044
-	// sticky offset bottom
2045
-	if ( ! empty( $args['sticky_offset_bottom'] ) && $args['sticky_offset_bottom'] !== '' ) {
2046
-		$styles['bottom'] = absint( $args['sticky_offset_bottom'] );
2047
-	}
2048
-
2049
-	// font size
2050
-	if ( ! empty( $args['font_size_custom'] ) && $args['font_size_custom'] !== '' ) {
2051
-		$styles['font-size'] = (float) $args['font_size_custom'] . 'rem';
2052
-	}
2053
-
2054
-	// font color
2055
-	if ( ! empty( $args['text_color_custom'] ) && $args['text_color_custom'] !== '' ) {
2056
-		$styles['color'] = esc_attr( $args['text_color_custom'] );
2057
-	}
2058
-
2059
-	// font line height
2060
-	if ( ! empty( $args['font_line_height'] ) && $args['font_line_height'] !== '' ) {
2061
-		$styles['line-height'] = esc_attr( $args['font_line_height'] );
2062
-	}
2063
-
2064
-	$style_string = '';
2065
-	if ( ! empty( $styles ) ) {
2066
-		foreach ( $styles as $key => $val ) {
2067
-			$style_string .= esc_attr( $key ) . ':' . esc_attr( $val ) . ';';
2068
-		}
2069
-	}
2070
-
2071
-	return $style_string;
1993
+    $styles = array();
1994
+
1995
+    // background color
1996
+    if ( ! empty( $args['bg'] ) && $args['bg'] !== '' ) {
1997
+        if ( $args['bg'] == 'custom-color' ) {
1998
+            $styles['background-color'] = $args['bg_color'];
1999
+        } elseif ( $args['bg'] == 'custom-gradient' ) {
2000
+            $styles['background-image'] = $args['bg_gradient'];
2001
+
2002
+            // use background on text.
2003
+            if ( ! empty( $args['bg_on_text'] ) && $args['bg_on_text'] ) {
2004
+                $styles['background-clip']         = 'text';
2005
+                $styles['-webkit-background-clip'] = 'text';
2006
+                $styles['text-fill-color']         = 'transparent';
2007
+                $styles['-webkit-text-fill-color'] = 'transparent';
2008
+            }
2009
+        }
2010
+    }
2011
+
2012
+    if ( ! empty( $args['bg_image'] ) && $args['bg_image'] !== '' ) {
2013
+        $hasImage = true;
2014
+        if ( ! empty( $styles['background-color'] ) && $args['bg'] == 'custom-color' ) {
2015
+            $styles['background-image']      = 'url(' . $args['bg_image'] . ')';
2016
+            $styles['background-blend-mode'] = 'overlay';
2017
+        } elseif ( ! empty( $styles['background-image'] ) && $args['bg'] == 'custom-gradient' ) {
2018
+            $styles['background-image'] .= ',url(' . $args['bg_image'] . ')';
2019
+        } elseif ( ! empty( $args['bg'] ) && $args['bg'] != '' && $args['bg'] != 'transparent' ) {
2020
+            // do nothing as we alreay have a preset
2021
+            $hasImage = false;
2022
+        } else {
2023
+            $styles['background-image'] = 'url(' . $args['bg_image'] . ')';
2024
+        }
2025
+
2026
+        if ( $hasImage ) {
2027
+            $styles['background-size'] = 'cover';
2028
+
2029
+            if ( ! empty( $args['bg_image_fixed'] ) && $args['bg_image_fixed'] ) {
2030
+                $styles['background-attachment'] = 'fixed';
2031
+            }
2032
+        }
2033
+
2034
+        if ( $hasImage && ! empty( $args['bg_image_xy'] ) && ! empty( $args['bg_image_xy']['x'] ) ) {
2035
+            $styles['background-position'] = ( $args['bg_image_xy']['x'] * 100 ) . '% ' . ( $args['bg_image_xy']['y'] * 100 ) . '%';
2036
+        }
2037
+    }
2038
+
2039
+    // sticky offset top
2040
+    if ( ! empty( $args['sticky_offset_top'] ) && $args['sticky_offset_top'] !== '' ) {
2041
+        $styles['top'] = absint( $args['sticky_offset_top'] );
2042
+    }
2043
+
2044
+    // sticky offset bottom
2045
+    if ( ! empty( $args['sticky_offset_bottom'] ) && $args['sticky_offset_bottom'] !== '' ) {
2046
+        $styles['bottom'] = absint( $args['sticky_offset_bottom'] );
2047
+    }
2048
+
2049
+    // font size
2050
+    if ( ! empty( $args['font_size_custom'] ) && $args['font_size_custom'] !== '' ) {
2051
+        $styles['font-size'] = (float) $args['font_size_custom'] . 'rem';
2052
+    }
2053
+
2054
+    // font color
2055
+    if ( ! empty( $args['text_color_custom'] ) && $args['text_color_custom'] !== '' ) {
2056
+        $styles['color'] = esc_attr( $args['text_color_custom'] );
2057
+    }
2058
+
2059
+    // font line height
2060
+    if ( ! empty( $args['font_line_height'] ) && $args['font_line_height'] !== '' ) {
2061
+        $styles['line-height'] = esc_attr( $args['font_line_height'] );
2062
+    }
2063
+
2064
+    $style_string = '';
2065
+    if ( ! empty( $styles ) ) {
2066
+        foreach ( $styles as $key => $val ) {
2067
+            $style_string .= esc_attr( $key ) . ':' . esc_attr( $val ) . ';';
2068
+        }
2069
+    }
2070
+
2071
+    return $style_string;
2072 2072
 
2073 2073
 }
2074 2074
 
@@ -2081,19 +2081,19 @@  discard block
 block discarded – undo
2081 2081
  * @return string
2082 2082
  */
2083 2083
 function sd_sanitize_html_classes( $classes, $sep = ' ' ) {
2084
-	$return = '';
2084
+    $return = '';
2085 2085
 
2086
-	if ( ! is_array( $classes ) ) {
2087
-		$classes = explode( $sep, $classes );
2088
-	}
2086
+    if ( ! is_array( $classes ) ) {
2087
+        $classes = explode( $sep, $classes );
2088
+    }
2089 2089
 
2090
-	if ( ! empty( $classes ) ) {
2091
-		foreach ( $classes as $class ) {
2092
-			$return .= sanitize_html_class( $class ) . ' ';
2093
-		}
2094
-	}
2090
+    if ( ! empty( $classes ) ) {
2091
+        foreach ( $classes as $class ) {
2092
+            $return .= sanitize_html_class( $class ) . ' ';
2093
+        }
2094
+    }
2095 2095
 
2096
-	return $return;
2096
+    return $return;
2097 2097
 }
2098 2098
 
2099 2099
 
@@ -2103,25 +2103,25 @@  discard block
 block discarded – undo
2103 2103
  * @return void
2104 2104
  */
2105 2105
 function sd_get_class_build_keys() {
2106
-	$keys = array(
2107
-		'container',
2108
-		'position',
2109
-		'flex_direction',
2110
-		'shadow',
2111
-		'rounded',
2112
-		'nav_style',
2113
-		'horizontal_alignment',
2114
-		'nav_fill',
2115
-		'width',
2116
-		'font_weight',
2117
-		'font_size',
2118
-		'font_case',
2119
-		'css_class',
2120
-		'flex_align_items-MTD',
2121
-		'flex_justify_content-MTD',
2122
-		'flex_align_self-MTD',
2123
-		'flex_order-MTD',
2124
-	);
2125
-
2126
-	return apply_filters( 'sd_class_build_keys', $keys );
2106
+    $keys = array(
2107
+        'container',
2108
+        'position',
2109
+        'flex_direction',
2110
+        'shadow',
2111
+        'rounded',
2112
+        'nav_style',
2113
+        'horizontal_alignment',
2114
+        'nav_fill',
2115
+        'width',
2116
+        'font_weight',
2117
+        'font_size',
2118
+        'font_case',
2119
+        'css_class',
2120
+        'flex_align_items-MTD',
2121
+        'flex_justify_content-MTD',
2122
+        'flex_align_self-MTD',
2123
+        'flex_order-MTD',
2124
+    );
2125
+
2126
+    return apply_filters( 'sd_class_build_keys', $keys );
2127 2127
 }
Please login to merge, or discard this patch.
vendor/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php 1 patch
Indentation   +733 added lines, -733 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,359 +21,359 @@  discard block
 block discarded – undo
21 21
  */
22 22
 if ( ! class_exists( 'WP_Font_Awesome_Settings' ) ) {
23 23
 
24
-	/**
25
-	 * A Class to be able to change settings for Font Awesome.
26
-	 *
27
-	 * Class WP_Font_Awesome_Settings
28
-	 * @since 1.0.10 Now able to pass wp.org theme check.
29
-	 * @since 1.0.11 Font Awesome Pro now supported.
30
-	 * @since 1.0.11 Font Awesome Kits now supported.
31
-	 * @since 1.0.13 RTL language support added.
32
-	 * @since 1.0.14 Warning added for v6 pro requires kit and will now not work if official FA plugin installed.
33
-	 * @since 1.0.15 Font Awesome will now load in the FSE if enable din the backend.
34
-	 * @since 1.1.0 Option added to load FontAwesome locally.
35
-	 * @ver 1.0.15
36
-	 * @todo decide how to implement textdomain
37
-	 */
38
-	class WP_Font_Awesome_Settings {
39
-
40
-		/**
41
-		 * Class version version.
42
-		 *
43
-		 * @var string
44
-		 */
45
-		public $version = '1.0.15';
46
-
47
-		/**
48
-		 * Class textdomain.
49
-		 *
50
-		 * @var string
51
-		 */
52
-		public $textdomain = 'font-awesome-settings';
53
-
54
-		/**
55
-		 * Latest version of Font Awesome at time of publish published.
56
-		 *
57
-		 * @var string
58
-		 */
59
-		public $latest = "5.8.2";
60
-
61
-		/**
62
-		 * The title.
63
-		 *
64
-		 * @var string
65
-		 */
66
-		public $name = 'Font Awesome';
67
-
68
-		/**
69
-		 * Holds the settings values.
70
-		 *
71
-		 * @var array
72
-		 */
73
-		private $settings;
74
-
75
-		/**
76
-		 * WP_Font_Awesome_Settings instance.
77
-		 *
78
-		 * @access private
79
-		 * @since  1.0.0
80
-		 * @var    WP_Font_Awesome_Settings There can be only one!
81
-		 */
82
-		private static $instance = null;
83
-
84
-		/**
85
-		 * Main WP_Font_Awesome_Settings Instance.
86
-		 *
87
-		 * Ensures only one instance of WP_Font_Awesome_Settings is loaded or can be loaded.
88
-		 *
89
-		 * @since 1.0.0
90
-		 * @static
91
-		 * @return WP_Font_Awesome_Settings - Main instance.
92
-		 */
93
-		public static function instance() {
94
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Font_Awesome_Settings ) ) {
95
-				self::$instance = new WP_Font_Awesome_Settings;
96
-
97
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
98
-
99
-				if ( is_admin() ) {
100
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
101
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
102
-					add_action( 'admin_notices', array( self::$instance, 'admin_notices' ) );
103
-				}
104
-
105
-				do_action( 'wp_font_awesome_settings_loaded' );
106
-			}
107
-
108
-			return self::$instance;
109
-		}
110
-
111
-		/**
112
-		 * Initiate the settings and add the required action hooks.
113
-		 *
114
-		 * @since 1.0.8 Settings name wrong - FIXED
115
-		 */
116
-		public function init() {
117
-			// Download fontawesome locally.
118
-			add_action( 'update_option_wp-font-awesome-settings', array( $this, 'update_option_wp_font_awesome_settings' ), 10, 2 );
119
-
120
-			$this->settings = $this->get_settings();
121
-
122
-			// check if the official plugin is active and use that instead if so.
123
-			if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
124
-
125
-				if ( $this->settings['type'] == 'CSS' ) {
126
-
127
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
128
-						add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
129
-					}
130
-
131
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
132
-						add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
133
-						add_filter( 'block_editor_settings_all', array( $this, 'enqueue_editor_styles' ), 10, 2 );
134
-					}
135
-
136
-				} else {
137
-
138
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
139
-						add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
140
-					}
141
-
142
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
143
-						add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
144
-						add_filter( 'block_editor_settings_all', array( $this, 'enqueue_editor_scripts' ), 10, 2 );
145
-					}
146
-				}
147
-
148
-				// remove font awesome if set to do so
149
-				if ( $this->settings['dequeue'] == '1' ) {
150
-					add_action( 'clean_url', array( $this, 'remove_font_awesome' ), 5000, 3 );
151
-				}
152
-			}
153
-
154
-		}
155
-
156
-		/**
157
-		 * Add FA to the FSE.
158
-		 *
159
-		 * @param $editor_settings
160
-		 * @param $block_editor_context
161
-		 *
162
-		 * @return array
163
-		 */
164
-		public function enqueue_editor_styles( $editor_settings, $block_editor_context ){
165
-
166
-			if ( ! empty( $editor_settings['__unstableResolvedAssets']['styles'] ) ) {
167
-				$url = $this->get_url();
168
-				$editor_settings['__unstableResolvedAssets']['styles'] .= "<link rel='stylesheet' id='font-awesome-css'  href='$url' media='all' />";
169
-			}
170
-
171
-			return $editor_settings;
172
-		}
173
-
174
-		/**
175
-		 * Add FA to the FSE.
176
-		 *
177
-		 * @param $editor_settings
178
-		 * @param $block_editor_context
179
-		 *
180
-		 * @return array
181
-		 */
182
-		public function enqueue_editor_scripts( $editor_settings, $block_editor_context ){
183
-
184
-			$url = $this->get_url();
185
-			$editor_settings['__unstableResolvedAssets']['scripts'] .= "<script src='$url' id='font-awesome-js'></script>";
186
-
187
-			return $editor_settings;
188
-		}
189
-
190
-		/**
191
-		 * Adds the Font Awesome styles.
192
-		 */
193
-		public function enqueue_style() {
194
-			// build url
195
-			$url = $this->get_url();
196
-			$version = ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) ? strip_tags( $this->settings['local_version'] ) : null;
197
-
198
-			wp_deregister_style( 'font-awesome' ); // deregister in case its already there
199
-			wp_register_style( 'font-awesome', $url, array(), $version );
200
-			wp_enqueue_style( 'font-awesome' );
201
-
202
-			// RTL language support CSS.
203
-			if ( is_rtl() ) {
204
-				wp_add_inline_style( 'font-awesome', $this->rtl_inline_css() );
205
-			}
206
-
207
-			if ( $this->settings['shims'] ) {
208
-				$url = $this->get_url( true );
209
-				wp_deregister_style( 'font-awesome-shims' ); // deregister in case its already there
210
-				wp_register_style( 'font-awesome-shims', $url, array(), $version );
211
-				wp_enqueue_style( 'font-awesome-shims' );
212
-			}
213
-		}
214
-
215
-		/**
216
-		 * Adds the Font Awesome JS.
217
-		 */
218
-		public function enqueue_scripts() {
219
-			// build url
220
-			$url = $this->get_url();
221
-
222
-			$deregister_function = 'wp' . '_' . 'deregister' . '_' . 'script';
223
-			call_user_func( $deregister_function, 'font-awesome' ); // deregister in case its already there
224
-			wp_register_script( 'font-awesome', $url, array(), null );
225
-			wp_enqueue_script( 'font-awesome' );
226
-
227
-			if ( $this->settings['shims'] ) {
228
-				$url = $this->get_url( true );
229
-				call_user_func( $deregister_function, 'font-awesome-shims' ); // deregister in case its already there
230
-				wp_register_script( 'font-awesome-shims', $url, array(), null );
231
-				wp_enqueue_script( 'font-awesome-shims' );
232
-			}
233
-		}
234
-
235
-		/**
236
-		 * Get the url of the Font Awesome files.
237
-		 *
238
-		 * @param bool $shims If this is a shim file or not.
239
-		 * @param bool $local Load locally if allowed.
240
-		 *
241
-		 * @return string The url to the file.
242
-		 */
243
-		public function get_url( $shims = false, $local = true ) {
244
-			$script  = $shims ? 'v4-shims' : 'all';
245
-			$sub     = $this->settings['pro'] ? 'pro' : 'use';
246
-			$type    = $this->settings['type'];
247
-			$version = $this->settings['version'];
248
-			$kit_url = $this->settings['kit-url'] ? esc_url( $this->settings['kit-url'] ) : '';
249
-			$url     = '';
250
-
251
-			if ( $type == 'KIT' && $kit_url ) {
252
-				if ( $shims ) {
253
-					// if its a kit then we don't add shims here
254
-					return '';
255
-				}
256
-				$url .= $kit_url; // CDN
257
-				$url .= "?wpfas=true"; // set our var so our version is not removed
258
-			} else {
259
-				$v = '';
260
-				// Check and load locally.
261
-				if ( $local && $this->has_local() ) {
262
-					$script .= ".min";
263
-					$v .= '&ver=' . strip_tags( $this->settings['local_version'] );
264
-					$url .= $this->get_fonts_url(); // Local fonts url.
265
-				} else {
266
-					$url .= "https://$sub.fontawesome.com/releases/"; // CDN
267
-					$url .= ! empty( $version ) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version
268
-				}
269
-				$url .= $type == 'CSS' ? 'css/' : 'js/'; // type
270
-				$url .= $type == 'CSS' ? $script . '.css' : $script . '.js'; // type
271
-				$url .= "?wpfas=true" . $v; // set our var so our version is not removed
272
-			}
273
-
274
-			return $url;
275
-		}
276
-
277
-		/**
278
-		 * Try and remove any other versions of Font Awesome added by other plugins/themes.
279
-		 *
280
-		 * Uses the clean_url filter to try and remove any other Font Awesome files added, it can also add pseudo-elements flag for the JS version.
281
-		 *
282
-		 * @param $url
283
-		 * @param $original_url
284
-		 * @param $_context
285
-		 *
286
-		 * @return string The filtered url.
287
-		 */
288
-		public function remove_font_awesome( $url, $original_url, $_context ) {
289
-
290
-			if ( $_context == 'display'
291
-			     && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false )
292
-			     && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false )
293
-			) {// it's a font-awesome-url (probably)
294
-
295
-				if ( strstr( $url, "wpfas=true" ) !== false ) {
296
-					if ( $this->settings['type'] == 'JS' ) {
297
-						if ( $this->settings['js-pseudo'] ) {
298
-							$url .= "' data-search-pseudo-elements defer='defer";
299
-						} else {
300
-							$url .= "' defer='defer";
301
-						}
302
-					}
303
-				} else {
304
-					$url = ''; // removing the url removes the file
305
-				}
306
-
307
-			}
308
-
309
-			return $url;
310
-		}
311
-
312
-		/**
313
-		 * Register the database settings with WordPress.
314
-		 */
315
-		public function register_settings() {
316
-			register_setting( 'wp-font-awesome-settings', 'wp-font-awesome-settings' );
317
-		}
318
-
319
-		/**
320
-		 * Add the WordPress settings menu item.
321
-		 * @since 1.0.10 Calling function name direct will fail theme check so we don't.
322
-		 */
323
-		public function menu_item() {
324
-			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
325
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array(
326
-				$this,
327
-				'settings_page'
328
-			) );
329
-		}
330
-
331
-		/**
332
-		 * Get the current Font Awesome output settings.
333
-		 *
334
-		 * @return array The array of settings.
335
-		 */
336
-		public function get_settings() {
337
-			$db_settings = get_option( 'wp-font-awesome-settings' );
338
-
339
-			$defaults = array(
340
-				'type'      => 'CSS', // type to use, CSS or JS or KIT
341
-				'version'   => '', // latest
342
-				'enqueue'   => '', // front and backend
343
-				'shims'     => '0', // default OFF now in 2020
344
-				'js-pseudo' => '0', // if the pseudo elements flag should be set (CPU intensive)
345
-				'dequeue'   => '0', // if we should try to remove other versions added by other plugins/themes
346
-				'pro'       => '0', // if pro CDN url should be used
347
-				'local'     => '0', // Store fonts locally.
348
-				'local_version' => '', // Local fonts version.
349
-				'kit-url'   => '', // the kit url
350
-			);
351
-
352
-			$settings = wp_parse_args( $db_settings, $defaults );
353
-
354
-			/**
355
-			 * Filter the Font Awesome settings.
356
-			 *
357
-			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
358
-			 */
359
-			return $this->settings = apply_filters( 'wp-font-awesome-settings', $settings, $db_settings, $defaults );
360
-		}
361
-
362
-		/**
363
-		 * The settings page html output.
364
-		 */
365
-		public function settings_page() {
366
-			if ( ! current_user_can( 'manage_options' ) ) {
367
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'font-awesome-settings' ) );
368
-			}
369
-
370
-			// a hidden way to force the update of the version number via api instead of waiting the 48 hours
371
-			if ( isset( $_REQUEST['force-version-check'] ) ) {
372
-				$this->get_latest_version( $force_api = true );
373
-			}
374
-
375
-			if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
376
-				?>
24
+    /**
25
+     * A Class to be able to change settings for Font Awesome.
26
+     *
27
+     * Class WP_Font_Awesome_Settings
28
+     * @since 1.0.10 Now able to pass wp.org theme check.
29
+     * @since 1.0.11 Font Awesome Pro now supported.
30
+     * @since 1.0.11 Font Awesome Kits now supported.
31
+     * @since 1.0.13 RTL language support added.
32
+     * @since 1.0.14 Warning added for v6 pro requires kit and will now not work if official FA plugin installed.
33
+     * @since 1.0.15 Font Awesome will now load in the FSE if enable din the backend.
34
+     * @since 1.1.0 Option added to load FontAwesome locally.
35
+     * @ver 1.0.15
36
+     * @todo decide how to implement textdomain
37
+     */
38
+    class WP_Font_Awesome_Settings {
39
+
40
+        /**
41
+         * Class version version.
42
+         *
43
+         * @var string
44
+         */
45
+        public $version = '1.0.15';
46
+
47
+        /**
48
+         * Class textdomain.
49
+         *
50
+         * @var string
51
+         */
52
+        public $textdomain = 'font-awesome-settings';
53
+
54
+        /**
55
+         * Latest version of Font Awesome at time of publish published.
56
+         *
57
+         * @var string
58
+         */
59
+        public $latest = "5.8.2";
60
+
61
+        /**
62
+         * The title.
63
+         *
64
+         * @var string
65
+         */
66
+        public $name = 'Font Awesome';
67
+
68
+        /**
69
+         * Holds the settings values.
70
+         *
71
+         * @var array
72
+         */
73
+        private $settings;
74
+
75
+        /**
76
+         * WP_Font_Awesome_Settings instance.
77
+         *
78
+         * @access private
79
+         * @since  1.0.0
80
+         * @var    WP_Font_Awesome_Settings There can be only one!
81
+         */
82
+        private static $instance = null;
83
+
84
+        /**
85
+         * Main WP_Font_Awesome_Settings Instance.
86
+         *
87
+         * Ensures only one instance of WP_Font_Awesome_Settings is loaded or can be loaded.
88
+         *
89
+         * @since 1.0.0
90
+         * @static
91
+         * @return WP_Font_Awesome_Settings - Main instance.
92
+         */
93
+        public static function instance() {
94
+            if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Font_Awesome_Settings ) ) {
95
+                self::$instance = new WP_Font_Awesome_Settings;
96
+
97
+                add_action( 'init', array( self::$instance, 'init' ) ); // set settings
98
+
99
+                if ( is_admin() ) {
100
+                    add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
101
+                    add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
102
+                    add_action( 'admin_notices', array( self::$instance, 'admin_notices' ) );
103
+                }
104
+
105
+                do_action( 'wp_font_awesome_settings_loaded' );
106
+            }
107
+
108
+            return self::$instance;
109
+        }
110
+
111
+        /**
112
+         * Initiate the settings and add the required action hooks.
113
+         *
114
+         * @since 1.0.8 Settings name wrong - FIXED
115
+         */
116
+        public function init() {
117
+            // Download fontawesome locally.
118
+            add_action( 'update_option_wp-font-awesome-settings', array( $this, 'update_option_wp_font_awesome_settings' ), 10, 2 );
119
+
120
+            $this->settings = $this->get_settings();
121
+
122
+            // check if the official plugin is active and use that instead if so.
123
+            if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
124
+
125
+                if ( $this->settings['type'] == 'CSS' ) {
126
+
127
+                    if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
128
+                        add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
129
+                    }
130
+
131
+                    if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
132
+                        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
133
+                        add_filter( 'block_editor_settings_all', array( $this, 'enqueue_editor_styles' ), 10, 2 );
134
+                    }
135
+
136
+                } else {
137
+
138
+                    if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
139
+                        add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
140
+                    }
141
+
142
+                    if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
143
+                        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
144
+                        add_filter( 'block_editor_settings_all', array( $this, 'enqueue_editor_scripts' ), 10, 2 );
145
+                    }
146
+                }
147
+
148
+                // remove font awesome if set to do so
149
+                if ( $this->settings['dequeue'] == '1' ) {
150
+                    add_action( 'clean_url', array( $this, 'remove_font_awesome' ), 5000, 3 );
151
+                }
152
+            }
153
+
154
+        }
155
+
156
+        /**
157
+         * Add FA to the FSE.
158
+         *
159
+         * @param $editor_settings
160
+         * @param $block_editor_context
161
+         *
162
+         * @return array
163
+         */
164
+        public function enqueue_editor_styles( $editor_settings, $block_editor_context ){
165
+
166
+            if ( ! empty( $editor_settings['__unstableResolvedAssets']['styles'] ) ) {
167
+                $url = $this->get_url();
168
+                $editor_settings['__unstableResolvedAssets']['styles'] .= "<link rel='stylesheet' id='font-awesome-css'  href='$url' media='all' />";
169
+            }
170
+
171
+            return $editor_settings;
172
+        }
173
+
174
+        /**
175
+         * Add FA to the FSE.
176
+         *
177
+         * @param $editor_settings
178
+         * @param $block_editor_context
179
+         *
180
+         * @return array
181
+         */
182
+        public function enqueue_editor_scripts( $editor_settings, $block_editor_context ){
183
+
184
+            $url = $this->get_url();
185
+            $editor_settings['__unstableResolvedAssets']['scripts'] .= "<script src='$url' id='font-awesome-js'></script>";
186
+
187
+            return $editor_settings;
188
+        }
189
+
190
+        /**
191
+         * Adds the Font Awesome styles.
192
+         */
193
+        public function enqueue_style() {
194
+            // build url
195
+            $url = $this->get_url();
196
+            $version = ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) ? strip_tags( $this->settings['local_version'] ) : null;
197
+
198
+            wp_deregister_style( 'font-awesome' ); // deregister in case its already there
199
+            wp_register_style( 'font-awesome', $url, array(), $version );
200
+            wp_enqueue_style( 'font-awesome' );
201
+
202
+            // RTL language support CSS.
203
+            if ( is_rtl() ) {
204
+                wp_add_inline_style( 'font-awesome', $this->rtl_inline_css() );
205
+            }
206
+
207
+            if ( $this->settings['shims'] ) {
208
+                $url = $this->get_url( true );
209
+                wp_deregister_style( 'font-awesome-shims' ); // deregister in case its already there
210
+                wp_register_style( 'font-awesome-shims', $url, array(), $version );
211
+                wp_enqueue_style( 'font-awesome-shims' );
212
+            }
213
+        }
214
+
215
+        /**
216
+         * Adds the Font Awesome JS.
217
+         */
218
+        public function enqueue_scripts() {
219
+            // build url
220
+            $url = $this->get_url();
221
+
222
+            $deregister_function = 'wp' . '_' . 'deregister' . '_' . 'script';
223
+            call_user_func( $deregister_function, 'font-awesome' ); // deregister in case its already there
224
+            wp_register_script( 'font-awesome', $url, array(), null );
225
+            wp_enqueue_script( 'font-awesome' );
226
+
227
+            if ( $this->settings['shims'] ) {
228
+                $url = $this->get_url( true );
229
+                call_user_func( $deregister_function, 'font-awesome-shims' ); // deregister in case its already there
230
+                wp_register_script( 'font-awesome-shims', $url, array(), null );
231
+                wp_enqueue_script( 'font-awesome-shims' );
232
+            }
233
+        }
234
+
235
+        /**
236
+         * Get the url of the Font Awesome files.
237
+         *
238
+         * @param bool $shims If this is a shim file or not.
239
+         * @param bool $local Load locally if allowed.
240
+         *
241
+         * @return string The url to the file.
242
+         */
243
+        public function get_url( $shims = false, $local = true ) {
244
+            $script  = $shims ? 'v4-shims' : 'all';
245
+            $sub     = $this->settings['pro'] ? 'pro' : 'use';
246
+            $type    = $this->settings['type'];
247
+            $version = $this->settings['version'];
248
+            $kit_url = $this->settings['kit-url'] ? esc_url( $this->settings['kit-url'] ) : '';
249
+            $url     = '';
250
+
251
+            if ( $type == 'KIT' && $kit_url ) {
252
+                if ( $shims ) {
253
+                    // if its a kit then we don't add shims here
254
+                    return '';
255
+                }
256
+                $url .= $kit_url; // CDN
257
+                $url .= "?wpfas=true"; // set our var so our version is not removed
258
+            } else {
259
+                $v = '';
260
+                // Check and load locally.
261
+                if ( $local && $this->has_local() ) {
262
+                    $script .= ".min";
263
+                    $v .= '&ver=' . strip_tags( $this->settings['local_version'] );
264
+                    $url .= $this->get_fonts_url(); // Local fonts url.
265
+                } else {
266
+                    $url .= "https://$sub.fontawesome.com/releases/"; // CDN
267
+                    $url .= ! empty( $version ) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version
268
+                }
269
+                $url .= $type == 'CSS' ? 'css/' : 'js/'; // type
270
+                $url .= $type == 'CSS' ? $script . '.css' : $script . '.js'; // type
271
+                $url .= "?wpfas=true" . $v; // set our var so our version is not removed
272
+            }
273
+
274
+            return $url;
275
+        }
276
+
277
+        /**
278
+         * Try and remove any other versions of Font Awesome added by other plugins/themes.
279
+         *
280
+         * Uses the clean_url filter to try and remove any other Font Awesome files added, it can also add pseudo-elements flag for the JS version.
281
+         *
282
+         * @param $url
283
+         * @param $original_url
284
+         * @param $_context
285
+         *
286
+         * @return string The filtered url.
287
+         */
288
+        public function remove_font_awesome( $url, $original_url, $_context ) {
289
+
290
+            if ( $_context == 'display'
291
+                 && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false )
292
+                 && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false )
293
+            ) {// it's a font-awesome-url (probably)
294
+
295
+                if ( strstr( $url, "wpfas=true" ) !== false ) {
296
+                    if ( $this->settings['type'] == 'JS' ) {
297
+                        if ( $this->settings['js-pseudo'] ) {
298
+                            $url .= "' data-search-pseudo-elements defer='defer";
299
+                        } else {
300
+                            $url .= "' defer='defer";
301
+                        }
302
+                    }
303
+                } else {
304
+                    $url = ''; // removing the url removes the file
305
+                }
306
+
307
+            }
308
+
309
+            return $url;
310
+        }
311
+
312
+        /**
313
+         * Register the database settings with WordPress.
314
+         */
315
+        public function register_settings() {
316
+            register_setting( 'wp-font-awesome-settings', 'wp-font-awesome-settings' );
317
+        }
318
+
319
+        /**
320
+         * Add the WordPress settings menu item.
321
+         * @since 1.0.10 Calling function name direct will fail theme check so we don't.
322
+         */
323
+        public function menu_item() {
324
+            $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
325
+            call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array(
326
+                $this,
327
+                'settings_page'
328
+            ) );
329
+        }
330
+
331
+        /**
332
+         * Get the current Font Awesome output settings.
333
+         *
334
+         * @return array The array of settings.
335
+         */
336
+        public function get_settings() {
337
+            $db_settings = get_option( 'wp-font-awesome-settings' );
338
+
339
+            $defaults = array(
340
+                'type'      => 'CSS', // type to use, CSS or JS or KIT
341
+                'version'   => '', // latest
342
+                'enqueue'   => '', // front and backend
343
+                'shims'     => '0', // default OFF now in 2020
344
+                'js-pseudo' => '0', // if the pseudo elements flag should be set (CPU intensive)
345
+                'dequeue'   => '0', // if we should try to remove other versions added by other plugins/themes
346
+                'pro'       => '0', // if pro CDN url should be used
347
+                'local'     => '0', // Store fonts locally.
348
+                'local_version' => '', // Local fonts version.
349
+                'kit-url'   => '', // the kit url
350
+            );
351
+
352
+            $settings = wp_parse_args( $db_settings, $defaults );
353
+
354
+            /**
355
+             * Filter the Font Awesome settings.
356
+             *
357
+             * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
358
+             */
359
+            return $this->settings = apply_filters( 'wp-font-awesome-settings', $settings, $db_settings, $defaults );
360
+        }
361
+
362
+        /**
363
+         * The settings page html output.
364
+         */
365
+        public function settings_page() {
366
+            if ( ! current_user_can( 'manage_options' ) ) {
367
+                wp_die( __( 'You do not have sufficient permissions to access this page.', 'font-awesome-settings' ) );
368
+            }
369
+
370
+            // a hidden way to force the update of the version number via api instead of waiting the 48 hours
371
+            if ( isset( $_REQUEST['force-version-check'] ) ) {
372
+                $this->get_latest_version( $force_api = true );
373
+            }
374
+
375
+            if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
376
+                ?>
377 377
                 <style>
378 378
                     .wpfas-kit-show {
379 379
                         display: none;
@@ -399,16 +399,16 @@  discard block
 block discarded – undo
399 399
                     <h1><?php echo $this->name; ?></h1>
400 400
                     <form method="post" action="options.php" class="fas-settings-form">
401 401
 						<?php
402
-						settings_fields( 'wp-font-awesome-settings' );
403
-						do_settings_sections( 'wp-font-awesome-settings' );
404
-						$table_class = '';
405
-						if ( $this->settings['type'] ) {
406
-							$table_class .= 'wpfas-' . sanitize_html_class( strtolower( $this->settings['type'] ) ) . '-set';
407
-						}
408
-						if ( ! empty( $this->settings['pro'] ) ) {
409
-							$table_class .= ' wpfas-has-pro';
410
-						}
411
-						?>
402
+                        settings_fields( 'wp-font-awesome-settings' );
403
+                        do_settings_sections( 'wp-font-awesome-settings' );
404
+                        $table_class = '';
405
+                        if ( $this->settings['type'] ) {
406
+                            $table_class .= 'wpfas-' . sanitize_html_class( strtolower( $this->settings['type'] ) ) . '-set';
407
+                        }
408
+                        if ( ! empty( $this->settings['pro'] ) ) {
409
+                            $table_class .= ' wpfas-has-pro';
410
+                        }
411
+                        ?>
412 412
 						<?php if ( $this->settings['type'] != 'KIT' && ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) ) { ?>
413 413
 							<?php if ( $this->has_local() ) { ?>
414 414
 							<div class="notice notice-info"><p><strong><?php _e( 'Font Awesome fonts are loading locally.', 'font-awesome-settings' ); ?></strong></p></div>
@@ -433,12 +433,12 @@  discard block
 block discarded – undo
433 433
                                 <td>
434 434
                                     <input class="regular-text" id="wpfas-kit-url" type="url" name="wp-font-awesome-settings[kit-url]" value="<?php echo esc_attr( $this->settings['kit-url'] ); ?>" placeholder="<?php echo 'https://kit.font';echo 'awesome.com/123abc.js'; // this won't pass theme check :(?>"/>
435 435
                                     <span><?php
436
-										echo sprintf(
437
-											__( 'Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings' ),
438
-											'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/kits"><i class="fas fa-external-link-alt"></i>',
439
-											'</a>'
440
-										);
441
-										?></span>
436
+                                        echo sprintf(
437
+                                            __( 'Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings' ),
438
+                                            '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/kits"><i class="fas fa-external-link-alt"></i>',
439
+                                            '</a>'
440
+                                        );
441
+                                        ?></span>
442 442
                                 </td>
443 443
                             </tr>
444 444
 
@@ -479,14 +479,14 @@  discard block
 block discarded – undo
479 479
                                     <input type="hidden" name="wp-font-awesome-settings[pro]" value="0"/>
480 480
                                     <input type="checkbox" name="wp-font-awesome-settings[pro]" value="1" <?php checked( $this->settings['pro'], '1' ); ?> id="wpfas-pro" onchange="if(jQuery(this).is(':checked')){jQuery('.wpfas-table-settings').addClass('wpfas-has-pro')}else{jQuery('.wpfas-table-settings').removeClass('wpfas-has-pro')}"/>
481 481
                                     <span><?php
482
-										echo wp_sprintf(
483
-											__( 'Requires a subscription. %sLearn more%s  %sManage my allowed domains%s', 'font-awesome-settings' ),
484
-											'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/referral?a=c9b89e1418">',
485
-											' <i class="fas fa-external-link-alt"></i></a>',
486
-											'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/account/cdn">',
487
-											' <i class="fas fa-external-link-alt"></i></a>'
488
-										);
489
-										?></span>
482
+                                        echo wp_sprintf(
483
+                                            __( 'Requires a subscription. %sLearn more%s  %sManage my allowed domains%s', 'font-awesome-settings' ),
484
+                                            '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/referral?a=c9b89e1418">',
485
+                                            ' <i class="fas fa-external-link-alt"></i></a>',
486
+                                            '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/account/cdn">',
487
+                                            ' <i class="fas fa-external-link-alt"></i></a>'
488
+                                        );
489
+                                        ?></span>
490 490
                                 </td>
491 491
                             </tr>
492 492
 
@@ -540,8 +540,8 @@  discard block
 block discarded – undo
540 540
                         </table>
541 541
                         <div class="fas-buttons">
542 542
 							<?php
543
-							submit_button();
544
-							?>
543
+                            submit_button();
544
+                            ?>
545 545
                             <p class="submit"><a href="https://fontawesome.com/referral?a=c9b89e1418" class="button button-secondary"><?php _e('Get 14,000+ more icons with Font Awesome Pro','font-awesome-settings'); ?> <i class="fas fa-external-link-alt"></i></a></p>
546 546
 
547 547
                         </div>
@@ -550,365 +550,365 @@  discard block
 block discarded – undo
550 550
                     <div id="wpfas-version"><?php echo sprintf(__( 'Version: %s (affiliate links provided)', 'font-awesome-settings' ), $this->version ); ?></div>
551 551
                 </div>
552 552
 				<?php
553
-			}
554
-		}
555
-
556
-		/**
557
-		 * Check a version number is valid and if so return it or else return an empty string.
558
-		 *
559
-		 * @param $version string The version number to check.
560
-		 *
561
-		 * @since 1.0.6
562
-		 *
563
-		 * @return string Either a valid version number or an empty string.
564
-		 */
565
-		public function validate_version_number( $version ) {
566
-
567
-			if ( version_compare( $version, '0.0.1', '>=' ) >= 0 ) {
568
-				// valid
569
-			} else {
570
-				$version = '';// not validated
571
-			}
572
-
573
-			return $version;
574
-		}
575
-
576
-
577
-		/**
578
-		 * Get the latest version of Font Awesome.
579
-		 *
580
-		 * We check for a cached version and if none we will check for a live version via API and then cache it for 48 hours.
581
-		 *
582
-		 * @since 1.0.7
583
-		 * @return mixed|string The latest version number found.
584
-		 */
585
-		public function get_latest_version( $force_api = false ) {
586
-			$latest_version = $this->latest;
587
-
588
-			$cache = get_transient( 'wp-font-awesome-settings-version' );
589
-
590
-			if ( $cache === false || $force_api ) { // its not set
591
-				$api_ver = $this->get_latest_version_from_api();
592
-				if ( version_compare( $api_ver, $this->latest, '>=' ) >= 0 ) {
593
-					$latest_version = $api_ver;
594
-					set_transient( 'wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS );
595
-				}
596
-			} elseif ( $this->validate_version_number( $cache ) ) {
597
-				if ( version_compare( $cache, $this->latest, '>=' ) >= 0 ) {
598
-					$latest_version = $cache;
599
-				}
600
-			}
601
-
602
-			// Check and auto download fonts locally.
603
-			if ( empty( $this->settings['pro'] ) && empty( $this->settings['version'] ) && $this->settings['type'] != 'KIT' && ! empty( $this->settings['local'] ) && ! empty( $this->settings['local_version'] ) && ! empty( $latest_version ) ) {
604
-				if ( version_compare( $latest_version, $this->settings['local_version'], '>' ) && is_admin() && ! wp_doing_ajax() ) {
605
-					$this->download_package( $latest_version );
606
-				}
607
-			}
608
-
609
-			return $latest_version;
610
-		}
611
-
612
-		/**
613
-		 * Get the latest Font Awesome version from the github API.
614
-		 *
615
-		 * @since 1.0.7
616
-		 * @return string The latest version number or `0` on API fail.
617
-		 */
618
-		public function get_latest_version_from_api() {
619
-			$version  = "0";
620
-			$response = wp_remote_get( "https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest" );
621
-			if ( ! is_wp_error( $response ) && is_array( $response ) ) {
622
-				$api_response = json_decode( wp_remote_retrieve_body( $response ), true );
623
-				if ( isset( $api_response['tag_name'] ) && version_compare( $api_response['tag_name'], $this->latest, '>=' ) >= 0 && empty( $api_response['prerelease'] ) ) {
624
-					$version = $api_response['tag_name'];
625
-				}
626
-			}
627
-
628
-			return $version;
629
-		}
630
-
631
-		/**
632
-		 * Inline CSS for RTL language support.
633
-		 *
634
-		 * @since 1.0.13
635
-		 * @return string Inline CSS.
636
-		 */
637
-		public function rtl_inline_css() {
638
-			$inline_css = '[dir=rtl] .fa-address,[dir=rtl] .fa-address-card,[dir=rtl] .fa-adjust,[dir=rtl] .fa-alarm-clock,[dir=rtl] .fa-align-left,[dir=rtl] .fa-align-right,[dir=rtl] .fa-analytics,[dir=rtl] .fa-angle-double-left,[dir=rtl] .fa-angle-double-right,[dir=rtl] .fa-angle-left,[dir=rtl] .fa-angle-right,[dir=rtl] .fa-arrow-alt-circle-left,[dir=rtl] .fa-arrow-alt-circle-right,[dir=rtl] .fa-arrow-alt-from-left,[dir=rtl] .fa-arrow-alt-from-right,[dir=rtl] .fa-arrow-alt-left,[dir=rtl] .fa-arrow-alt-right,[dir=rtl] .fa-arrow-alt-square-left,[dir=rtl] .fa-arrow-alt-square-right,[dir=rtl] .fa-arrow-alt-to-left,[dir=rtl] .fa-arrow-alt-to-right,[dir=rtl] .fa-arrow-circle-left,[dir=rtl] .fa-arrow-circle-right,[dir=rtl] .fa-arrow-from-left,[dir=rtl] .fa-arrow-from-right,[dir=rtl] .fa-arrow-left,[dir=rtl] .fa-arrow-right,[dir=rtl] .fa-arrow-square-left,[dir=rtl] .fa-arrow-square-right,[dir=rtl] .fa-arrow-to-left,[dir=rtl] .fa-arrow-to-right,[dir=rtl] .fa-balance-scale-left,[dir=rtl] .fa-balance-scale-right,[dir=rtl] .fa-bed,[dir=rtl] .fa-bed-bunk,[dir=rtl] .fa-bed-empty,[dir=rtl] .fa-border-left,[dir=rtl] .fa-border-right,[dir=rtl] .fa-calendar-check,[dir=rtl] .fa-caret-circle-left,[dir=rtl] .fa-caret-circle-right,[dir=rtl] .fa-caret-left,[dir=rtl] .fa-caret-right,[dir=rtl] .fa-caret-square-left,[dir=rtl] .fa-caret-square-right,[dir=rtl] .fa-cart-arrow-down,[dir=rtl] .fa-cart-plus,[dir=rtl] .fa-chart-area,[dir=rtl] .fa-chart-bar,[dir=rtl] .fa-chart-line,[dir=rtl] .fa-chart-line-down,[dir=rtl] .fa-chart-network,[dir=rtl] .fa-chart-pie,[dir=rtl] .fa-chart-pie-alt,[dir=rtl] .fa-chart-scatter,[dir=rtl] .fa-check-circle,[dir=rtl] .fa-check-square,[dir=rtl] .fa-chevron-circle-left,[dir=rtl] .fa-chevron-circle-right,[dir=rtl] .fa-chevron-double-left,[dir=rtl] .fa-chevron-double-right,[dir=rtl] .fa-chevron-left,[dir=rtl] .fa-chevron-right,[dir=rtl] .fa-chevron-square-left,[dir=rtl] .fa-chevron-square-right,[dir=rtl] .fa-clock,[dir=rtl] .fa-file,[dir=rtl] .fa-file-alt,[dir=rtl] .fa-file-archive,[dir=rtl] .fa-file-audio,[dir=rtl] .fa-file-chart-line,[dir=rtl] .fa-file-chart-pie,[dir=rtl] .fa-file-code,[dir=rtl] .fa-file-excel,[dir=rtl] .fa-file-image,[dir=rtl] .fa-file-pdf,[dir=rtl] .fa-file-powerpoint,[dir=rtl] .fa-file-video,[dir=rtl] .fa-file-word,[dir=rtl] .fa-flag,[dir=rtl] .fa-folder,[dir=rtl] .fa-folder-open,[dir=rtl] .fa-hand-lizard,[dir=rtl] .fa-hand-point-down,[dir=rtl] .fa-hand-point-left,[dir=rtl] .fa-hand-point-right,[dir=rtl] .fa-hand-point-up,[dir=rtl] .fa-hand-scissors,[dir=rtl] .fa-image,[dir=rtl] .fa-long-arrow-alt-left,[dir=rtl] .fa-long-arrow-alt-right,[dir=rtl] .fa-long-arrow-left,[dir=rtl] .fa-long-arrow-right,[dir=rtl] .fa-luggage-cart,[dir=rtl] .fa-moon,[dir=rtl] .fa-pencil,[dir=rtl] .fa-pencil-alt,[dir=rtl] .fa-play-circle,[dir=rtl] .fa-project-diagram,[dir=rtl] .fa-quote-left,[dir=rtl] .fa-quote-right,[dir=rtl] .fa-shopping-cart,[dir=rtl] .fa-thumbs-down,[dir=rtl] .fa-thumbs-up,[dir=rtl] .fa-user-chart{filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);transform:scale(-1,1)}[dir=rtl] .fa-spin{animation-direction:reverse}';
639
-
640
-			return $inline_css;
641
-		}
642
-
643
-		/**
644
-		 * Show any warnings as an admin notice.
645
-		 *
646
-		 * @return void
647
-		 */
648
-		public function admin_notices() {
649
-			$settings = $this->settings;
650
-
651
-			if ( defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
652
-				if ( ! empty( $_REQUEST['page'] ) && $_REQUEST['page'] == 'wp-font-awesome-settings' ) {
653
-					?>
553
+            }
554
+        }
555
+
556
+        /**
557
+         * Check a version number is valid and if so return it or else return an empty string.
558
+         *
559
+         * @param $version string The version number to check.
560
+         *
561
+         * @since 1.0.6
562
+         *
563
+         * @return string Either a valid version number or an empty string.
564
+         */
565
+        public function validate_version_number( $version ) {
566
+
567
+            if ( version_compare( $version, '0.0.1', '>=' ) >= 0 ) {
568
+                // valid
569
+            } else {
570
+                $version = '';// not validated
571
+            }
572
+
573
+            return $version;
574
+        }
575
+
576
+
577
+        /**
578
+         * Get the latest version of Font Awesome.
579
+         *
580
+         * We check for a cached version and if none we will check for a live version via API and then cache it for 48 hours.
581
+         *
582
+         * @since 1.0.7
583
+         * @return mixed|string The latest version number found.
584
+         */
585
+        public function get_latest_version( $force_api = false ) {
586
+            $latest_version = $this->latest;
587
+
588
+            $cache = get_transient( 'wp-font-awesome-settings-version' );
589
+
590
+            if ( $cache === false || $force_api ) { // its not set
591
+                $api_ver = $this->get_latest_version_from_api();
592
+                if ( version_compare( $api_ver, $this->latest, '>=' ) >= 0 ) {
593
+                    $latest_version = $api_ver;
594
+                    set_transient( 'wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS );
595
+                }
596
+            } elseif ( $this->validate_version_number( $cache ) ) {
597
+                if ( version_compare( $cache, $this->latest, '>=' ) >= 0 ) {
598
+                    $latest_version = $cache;
599
+                }
600
+            }
601
+
602
+            // Check and auto download fonts locally.
603
+            if ( empty( $this->settings['pro'] ) && empty( $this->settings['version'] ) && $this->settings['type'] != 'KIT' && ! empty( $this->settings['local'] ) && ! empty( $this->settings['local_version'] ) && ! empty( $latest_version ) ) {
604
+                if ( version_compare( $latest_version, $this->settings['local_version'], '>' ) && is_admin() && ! wp_doing_ajax() ) {
605
+                    $this->download_package( $latest_version );
606
+                }
607
+            }
608
+
609
+            return $latest_version;
610
+        }
611
+
612
+        /**
613
+         * Get the latest Font Awesome version from the github API.
614
+         *
615
+         * @since 1.0.7
616
+         * @return string The latest version number or `0` on API fail.
617
+         */
618
+        public function get_latest_version_from_api() {
619
+            $version  = "0";
620
+            $response = wp_remote_get( "https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest" );
621
+            if ( ! is_wp_error( $response ) && is_array( $response ) ) {
622
+                $api_response = json_decode( wp_remote_retrieve_body( $response ), true );
623
+                if ( isset( $api_response['tag_name'] ) && version_compare( $api_response['tag_name'], $this->latest, '>=' ) >= 0 && empty( $api_response['prerelease'] ) ) {
624
+                    $version = $api_response['tag_name'];
625
+                }
626
+            }
627
+
628
+            return $version;
629
+        }
630
+
631
+        /**
632
+         * Inline CSS for RTL language support.
633
+         *
634
+         * @since 1.0.13
635
+         * @return string Inline CSS.
636
+         */
637
+        public function rtl_inline_css() {
638
+            $inline_css = '[dir=rtl] .fa-address,[dir=rtl] .fa-address-card,[dir=rtl] .fa-adjust,[dir=rtl] .fa-alarm-clock,[dir=rtl] .fa-align-left,[dir=rtl] .fa-align-right,[dir=rtl] .fa-analytics,[dir=rtl] .fa-angle-double-left,[dir=rtl] .fa-angle-double-right,[dir=rtl] .fa-angle-left,[dir=rtl] .fa-angle-right,[dir=rtl] .fa-arrow-alt-circle-left,[dir=rtl] .fa-arrow-alt-circle-right,[dir=rtl] .fa-arrow-alt-from-left,[dir=rtl] .fa-arrow-alt-from-right,[dir=rtl] .fa-arrow-alt-left,[dir=rtl] .fa-arrow-alt-right,[dir=rtl] .fa-arrow-alt-square-left,[dir=rtl] .fa-arrow-alt-square-right,[dir=rtl] .fa-arrow-alt-to-left,[dir=rtl] .fa-arrow-alt-to-right,[dir=rtl] .fa-arrow-circle-left,[dir=rtl] .fa-arrow-circle-right,[dir=rtl] .fa-arrow-from-left,[dir=rtl] .fa-arrow-from-right,[dir=rtl] .fa-arrow-left,[dir=rtl] .fa-arrow-right,[dir=rtl] .fa-arrow-square-left,[dir=rtl] .fa-arrow-square-right,[dir=rtl] .fa-arrow-to-left,[dir=rtl] .fa-arrow-to-right,[dir=rtl] .fa-balance-scale-left,[dir=rtl] .fa-balance-scale-right,[dir=rtl] .fa-bed,[dir=rtl] .fa-bed-bunk,[dir=rtl] .fa-bed-empty,[dir=rtl] .fa-border-left,[dir=rtl] .fa-border-right,[dir=rtl] .fa-calendar-check,[dir=rtl] .fa-caret-circle-left,[dir=rtl] .fa-caret-circle-right,[dir=rtl] .fa-caret-left,[dir=rtl] .fa-caret-right,[dir=rtl] .fa-caret-square-left,[dir=rtl] .fa-caret-square-right,[dir=rtl] .fa-cart-arrow-down,[dir=rtl] .fa-cart-plus,[dir=rtl] .fa-chart-area,[dir=rtl] .fa-chart-bar,[dir=rtl] .fa-chart-line,[dir=rtl] .fa-chart-line-down,[dir=rtl] .fa-chart-network,[dir=rtl] .fa-chart-pie,[dir=rtl] .fa-chart-pie-alt,[dir=rtl] .fa-chart-scatter,[dir=rtl] .fa-check-circle,[dir=rtl] .fa-check-square,[dir=rtl] .fa-chevron-circle-left,[dir=rtl] .fa-chevron-circle-right,[dir=rtl] .fa-chevron-double-left,[dir=rtl] .fa-chevron-double-right,[dir=rtl] .fa-chevron-left,[dir=rtl] .fa-chevron-right,[dir=rtl] .fa-chevron-square-left,[dir=rtl] .fa-chevron-square-right,[dir=rtl] .fa-clock,[dir=rtl] .fa-file,[dir=rtl] .fa-file-alt,[dir=rtl] .fa-file-archive,[dir=rtl] .fa-file-audio,[dir=rtl] .fa-file-chart-line,[dir=rtl] .fa-file-chart-pie,[dir=rtl] .fa-file-code,[dir=rtl] .fa-file-excel,[dir=rtl] .fa-file-image,[dir=rtl] .fa-file-pdf,[dir=rtl] .fa-file-powerpoint,[dir=rtl] .fa-file-video,[dir=rtl] .fa-file-word,[dir=rtl] .fa-flag,[dir=rtl] .fa-folder,[dir=rtl] .fa-folder-open,[dir=rtl] .fa-hand-lizard,[dir=rtl] .fa-hand-point-down,[dir=rtl] .fa-hand-point-left,[dir=rtl] .fa-hand-point-right,[dir=rtl] .fa-hand-point-up,[dir=rtl] .fa-hand-scissors,[dir=rtl] .fa-image,[dir=rtl] .fa-long-arrow-alt-left,[dir=rtl] .fa-long-arrow-alt-right,[dir=rtl] .fa-long-arrow-left,[dir=rtl] .fa-long-arrow-right,[dir=rtl] .fa-luggage-cart,[dir=rtl] .fa-moon,[dir=rtl] .fa-pencil,[dir=rtl] .fa-pencil-alt,[dir=rtl] .fa-play-circle,[dir=rtl] .fa-project-diagram,[dir=rtl] .fa-quote-left,[dir=rtl] .fa-quote-right,[dir=rtl] .fa-shopping-cart,[dir=rtl] .fa-thumbs-down,[dir=rtl] .fa-thumbs-up,[dir=rtl] .fa-user-chart{filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);transform:scale(-1,1)}[dir=rtl] .fa-spin{animation-direction:reverse}';
639
+
640
+            return $inline_css;
641
+        }
642
+
643
+        /**
644
+         * Show any warnings as an admin notice.
645
+         *
646
+         * @return void
647
+         */
648
+        public function admin_notices() {
649
+            $settings = $this->settings;
650
+
651
+            if ( defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
652
+                if ( ! empty( $_REQUEST['page'] ) && $_REQUEST['page'] == 'wp-font-awesome-settings' ) {
653
+                    ?>
654 654
                     <div class="notice  notice-error is-dismissible">
655 655
                         <p><?php _e( 'The Official Font Awesome Plugin is active, please adjust your settings there.', 'font-awesome-settings' ); ?></p>
656 656
                     </div>
657 657
 					<?php
658
-				}
659
-			} else {
660
-				if ( ! empty( $settings ) ) {
661
-					if ( $settings['type'] != 'KIT' && $settings['pro'] && ( $settings['version'] == '' || version_compare( $settings['version'], '6', '>=' ) ) ) {
662
-						$link = admin_url('options-general.php?page=wp-font-awesome-settings');
663
-						?>
658
+                }
659
+            } else {
660
+                if ( ! empty( $settings ) ) {
661
+                    if ( $settings['type'] != 'KIT' && $settings['pro'] && ( $settings['version'] == '' || version_compare( $settings['version'], '6', '>=' ) ) ) {
662
+                        $link = admin_url('options-general.php?page=wp-font-awesome-settings');
663
+                        ?>
664 664
                         <div class="notice  notice-error is-dismissible">
665 665
                             <p><?php echo sprintf( __( 'Font Awesome Pro v6 requires the use of a kit, please setup your kit in %ssettings.%s', 'font-awesome-settings' ),"<a href='". esc_url_raw( $link )."'>","</a>" ); ?></p>
666 666
                         </div>
667 667
 						<?php
668
-					}
669
-				}
670
-			}
671
-		}
672
-
673
-		/**
674
-		 * Handle fontawesome save settings to download fontawesome to store locally.
675
-		 *
676
-		 * @since 1.1.0
677
-		 *
678
-		 * @param mixed $old_value The old option value.
679
-		 * @param mixed $value     The new option value.
680
-		 */
681
-		public function update_option_wp_font_awesome_settings( $old_value, $new_value ) {
682
-			// Do nothing if WordPress is being installed.
683
-			if ( wp_installing() ) {
684
-				return;
685
-			}
686
-
687
-			if ( ! empty( $new_value['local'] ) && empty( $new_value['pro'] ) ) {
688
-				// Old values
689
-				$old_version = isset( $old_value['version'] ) && $old_value['version'] ? $old_value['version'] : ( isset( $old_value['local_version'] ) ? $old_value['local_version'] : '' );
690
-				$old_local = isset( $old_value['local'] ) ? (int) $old_value['local'] : 0;
691
-
692
-				// New values
693
-				$new_version = isset( $new_value['version'] ) && $new_value['version'] ? $new_value['version'] : $this->get_latest_version();
694
-
695
-				if ( empty( $old_local ) || $old_version !== $new_version ) {
696
-					$response = $this->download_package( $new_version, $new_value );
697
-
698
-					if ( is_wp_error( $response ) ) {
699
-						add_settings_error( 'general', 'fontawesome_download', __( 'ERROR:', 'font-awesome-settings' ) . ' ' . $response->get_error_message(), 'error' );
700
-					}
701
-				}
702
-			}
703
-		}
704
-
705
-		/**
706
-		 * Get the fonts directory local path.
707
-		 *
708
-		 * @since 1.1.0
709
-		 *
710
-		 * @param string Fonts directory local path.
711
-		 */
712
-		public function get_fonts_dir() {
713
-			$upload_dir = wp_upload_dir( null, false );
714
-
715
-			return $upload_dir['basedir'] . DIRECTORY_SEPARATOR .  'ayefonts' . DIRECTORY_SEPARATOR . 'fa' . DIRECTORY_SEPARATOR;
716
-		}
717
-
718
-		/**
719
-		 * Get the fonts directory local url.
720
-		 *
721
-		 * @since 1.1.0
722
-		 *
723
-		 * @param string Fonts directory local url.
724
-		 */
725
-		public function get_fonts_url() {
726
-			$upload_dir = wp_upload_dir( null, false );
727
-
728
-			return $upload_dir['baseurl'] .  '/ayefonts/fa/';
729
-		}
730
-
731
-		/**
732
-		 * Check whether load locally active.
733
-		 *
734
-		 * @since 1.1.0
735
-		 *
736
-		 * @return bool True if active else false.
737
-		 */
738
-		public function has_local() {
739
-			if ( ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) && file_exists( $this->get_fonts_dir() . 'css' . DIRECTORY_SEPARATOR . 'all.css' ) ) {
740
-				return true;
741
-			}
742
-
743
-			return false;
744
-		}
745
-
746
-		/**
747
-		 * Get the WP Filesystem access.
748
-		 *
749
-		 * @since 1.1.0
750
-		 *
751
-		 * @return object The WP Filesystem.
752
-		 */
753
-		public function get_wp_filesystem() {
754
-			if ( ! function_exists( 'get_filesystem_method' ) ) {
755
-				require_once( ABSPATH . "/wp-admin/includes/file.php" );
756
-			}
757
-
758
-			$access_type = get_filesystem_method();
759
-
760
-			if ( $access_type === 'direct' ) {
761
-				/* You can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
762
-				$creds = request_filesystem_credentials( trailingslashit( site_url() ) . 'wp-admin/', '', false, false, array() );
763
-
764
-				/* Initialize the API */
765
-				if ( ! WP_Filesystem( $creds ) ) {
766
-					/* Any problems and we exit */
767
-					return false;
768
-				}
769
-
770
-				global $wp_filesystem;
771
-
772
-				return $wp_filesystem;
773
-				/* Do our file manipulations below */
774
-			} else if ( defined( 'FTP_USER' ) ) {
775
-				$creds = request_filesystem_credentials( trailingslashit( site_url() ) . 'wp-admin/', '', false, false, array() );
776
-
777
-				/* Initialize the API */
778
-				if ( ! WP_Filesystem( $creds ) ) {
779
-					/* Any problems and we exit */
780
-					return false;
781
-				}
782
-
783
-				global $wp_filesystem;
784
-
785
-				return $wp_filesystem;
786
-			} else {
787
-				/* Don't have direct write access. Prompt user with our notice */
788
-				return false;
789
-			}
790
-		}
791
-
792
-		/**
793
-		 * Download the fontawesome package file.
794
-		 *
795
-		 * @since 1.1.0
796
-		 *
797
-		 * @param mixed $version The font awesome.
798
-		 * @param array $option Fontawesome settings.
799
-		 * @return WP_ERROR|bool Error on fail and true on success.
800
-		 */
801
-		public function download_package( $version, $option = array() ) {
802
-			$filename = 'fontawesome-free-' . $version . '-web';
803
-			$url = 'https://use.fontawesome.com/releases/v' . $version . '/' . $filename . '.zip';
804
-
805
-			if ( ! function_exists( 'wp_handle_upload' ) ) {
806
-				require_once ABSPATH . 'wp-admin/includes/file.php';
807
-			}
808
-
809
-			$download_file = download_url( esc_url_raw( $url ) );
810
-
811
-			if ( is_wp_error( $download_file ) ) {
812
-				return new WP_Error( 'fontawesome_download_failed', __( $download_file->get_error_message(), 'font-awesome-settings' ) );
813
-			} else if ( empty( $download_file ) ) {
814
-				return new WP_Error( 'fontawesome_download_failed', __( 'Something went wrong in downloading the font awesome to store locally.', 'font-awesome-settings' ) );
815
-			}
816
-
817
-			$response = $this->extract_package( $download_file, $filename, true );
818
-
819
-			// Update local version.
820
-			if ( is_wp_error( $response ) ) {
821
-				return $response;
822
-			} else if ( $response ) {
823
-				if ( empty( $option ) ) {
824
-					$option = get_option( 'wp-font-awesome-settings' );
825
-				}
826
-
827
-				$option['local_version'] = $version;
828
-
829
-				// Remove action to prevent looping.
830
-				remove_action( 'update_option_wp-font-awesome-settings', array( $this, 'update_option_wp_font_awesome_settings' ), 10, 2 );
831
-
832
-				update_option( 'wp-font-awesome-settings', $option );
833
-
834
-				return true;
835
-			}
836
-
837
-			return false;
838
-		}
839
-
840
-		/**
841
-		 * Extract the fontawesome package file.
842
-		 *
843
-		 * @since 1.1.0
844
-		 *
845
-		 * @param string $package The package file path.
846
-		 * @param string $dirname Package file name.
847
-		 * @param bool   $delete_package Delete temp file or not.
848
-		 * @return WP_Error|bool True on success WP_Error on fail.
849
-		 */
850
-		public function extract_package( $package, $dirname = '', $delete_package = false ) {
851
-			global $wp_filesystem;
852
-
853
-			$wp_filesystem = $this->get_wp_filesystem();
854
-
855
-			if ( empty( $wp_filesystem ) && isset( $wp_filesystem->errors ) && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
856
-				return new WP_Error( 'fontawesome_filesystem_error', __( $wp_filesystem->errors->get_error_message(), 'font-awesome-settings' ) );
857
-			} else if ( empty( $wp_filesystem ) ) {
858
-				return new WP_Error( 'fontawesome_filesystem_error', __( 'Failed to initialise WP_Filesystem while trying to download the Font Awesome package.', 'font-awesome-settings' ) );
859
-			}
860
-
861
-			$fonts_dir = $this->get_fonts_dir();
862
-			$fonts_tmp_dir = dirname( $fonts_dir ) . DIRECTORY_SEPARATOR . 'fa-tmp' . DIRECTORY_SEPARATOR;
863
-
864
-			if ( $wp_filesystem->is_dir( $fonts_tmp_dir ) ) {
865
-				$wp_filesystem->delete( $fonts_tmp_dir, true );
866
-			}
867
-
868
-			// Unzip package to working directory.
869
-			$result = unzip_file( $package, $fonts_tmp_dir );
870
-
871
-			if ( is_wp_error( $result ) ) {
872
-				$wp_filesystem->delete( $fonts_tmp_dir, true );
873
-
874
-				if ( 'incompatible_archive' === $result->get_error_code() ) {
875
-					return new WP_Error( 'fontawesome_incompatible_archive', __( $result->get_error_message(), 'font-awesome-settings' ) );
876
-				}
877
-
878
-				return $result;
879
-			}
880
-
881
-			if ( $wp_filesystem->is_dir( $fonts_dir ) ) {
882
-				$wp_filesystem->delete( $fonts_dir, true );
883
-			}
884
-
885
-			$extract_dir = $fonts_tmp_dir;
886
-
887
-			if ( $dirname && $wp_filesystem->is_dir( $extract_dir . $dirname . DIRECTORY_SEPARATOR ) ) {
888
-				$extract_dir .= $dirname . DIRECTORY_SEPARATOR;
889
-			}
890
-
891
-			try {
892
-				$return = $wp_filesystem->move( $extract_dir, $fonts_dir, true );
893
-			} catch ( Exception $e ) {
894
-				$return = new WP_Error( 'fontawesome_move_package', __( 'Fail to move font awesome package!', 'font-awesome-settings' ) );
895
-			}
896
-
897
-			if ( $wp_filesystem->is_dir( $fonts_tmp_dir ) ) {
898
-				$wp_filesystem->delete( $fonts_tmp_dir, true );
899
-			}
900
-
901
-			// Once extracted, delete the package if required.
902
-			if ( $delete_package ) {
903
-				unlink( $package );
904
-			}
905
-
906
-			return $return;
907
-		}
908
-	}
909
-
910
-	/**
911
-	 * Run the class if found.
912
-	 */
913
-	WP_Font_Awesome_Settings::instance();
668
+                    }
669
+                }
670
+            }
671
+        }
672
+
673
+        /**
674
+         * Handle fontawesome save settings to download fontawesome to store locally.
675
+         *
676
+         * @since 1.1.0
677
+         *
678
+         * @param mixed $old_value The old option value.
679
+         * @param mixed $value     The new option value.
680
+         */
681
+        public function update_option_wp_font_awesome_settings( $old_value, $new_value ) {
682
+            // Do nothing if WordPress is being installed.
683
+            if ( wp_installing() ) {
684
+                return;
685
+            }
686
+
687
+            if ( ! empty( $new_value['local'] ) && empty( $new_value['pro'] ) ) {
688
+                // Old values
689
+                $old_version = isset( $old_value['version'] ) && $old_value['version'] ? $old_value['version'] : ( isset( $old_value['local_version'] ) ? $old_value['local_version'] : '' );
690
+                $old_local = isset( $old_value['local'] ) ? (int) $old_value['local'] : 0;
691
+
692
+                // New values
693
+                $new_version = isset( $new_value['version'] ) && $new_value['version'] ? $new_value['version'] : $this->get_latest_version();
694
+
695
+                if ( empty( $old_local ) || $old_version !== $new_version ) {
696
+                    $response = $this->download_package( $new_version, $new_value );
697
+
698
+                    if ( is_wp_error( $response ) ) {
699
+                        add_settings_error( 'general', 'fontawesome_download', __( 'ERROR:', 'font-awesome-settings' ) . ' ' . $response->get_error_message(), 'error' );
700
+                    }
701
+                }
702
+            }
703
+        }
704
+
705
+        /**
706
+         * Get the fonts directory local path.
707
+         *
708
+         * @since 1.1.0
709
+         *
710
+         * @param string Fonts directory local path.
711
+         */
712
+        public function get_fonts_dir() {
713
+            $upload_dir = wp_upload_dir( null, false );
714
+
715
+            return $upload_dir['basedir'] . DIRECTORY_SEPARATOR .  'ayefonts' . DIRECTORY_SEPARATOR . 'fa' . DIRECTORY_SEPARATOR;
716
+        }
717
+
718
+        /**
719
+         * Get the fonts directory local url.
720
+         *
721
+         * @since 1.1.0
722
+         *
723
+         * @param string Fonts directory local url.
724
+         */
725
+        public function get_fonts_url() {
726
+            $upload_dir = wp_upload_dir( null, false );
727
+
728
+            return $upload_dir['baseurl'] .  '/ayefonts/fa/';
729
+        }
730
+
731
+        /**
732
+         * Check whether load locally active.
733
+         *
734
+         * @since 1.1.0
735
+         *
736
+         * @return bool True if active else false.
737
+         */
738
+        public function has_local() {
739
+            if ( ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) && file_exists( $this->get_fonts_dir() . 'css' . DIRECTORY_SEPARATOR . 'all.css' ) ) {
740
+                return true;
741
+            }
742
+
743
+            return false;
744
+        }
745
+
746
+        /**
747
+         * Get the WP Filesystem access.
748
+         *
749
+         * @since 1.1.0
750
+         *
751
+         * @return object The WP Filesystem.
752
+         */
753
+        public function get_wp_filesystem() {
754
+            if ( ! function_exists( 'get_filesystem_method' ) ) {
755
+                require_once( ABSPATH . "/wp-admin/includes/file.php" );
756
+            }
757
+
758
+            $access_type = get_filesystem_method();
759
+
760
+            if ( $access_type === 'direct' ) {
761
+                /* You can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
762
+                $creds = request_filesystem_credentials( trailingslashit( site_url() ) . 'wp-admin/', '', false, false, array() );
763
+
764
+                /* Initialize the API */
765
+                if ( ! WP_Filesystem( $creds ) ) {
766
+                    /* Any problems and we exit */
767
+                    return false;
768
+                }
769
+
770
+                global $wp_filesystem;
771
+
772
+                return $wp_filesystem;
773
+                /* Do our file manipulations below */
774
+            } else if ( defined( 'FTP_USER' ) ) {
775
+                $creds = request_filesystem_credentials( trailingslashit( site_url() ) . 'wp-admin/', '', false, false, array() );
776
+
777
+                /* Initialize the API */
778
+                if ( ! WP_Filesystem( $creds ) ) {
779
+                    /* Any problems and we exit */
780
+                    return false;
781
+                }
782
+
783
+                global $wp_filesystem;
784
+
785
+                return $wp_filesystem;
786
+            } else {
787
+                /* Don't have direct write access. Prompt user with our notice */
788
+                return false;
789
+            }
790
+        }
791
+
792
+        /**
793
+         * Download the fontawesome package file.
794
+         *
795
+         * @since 1.1.0
796
+         *
797
+         * @param mixed $version The font awesome.
798
+         * @param array $option Fontawesome settings.
799
+         * @return WP_ERROR|bool Error on fail and true on success.
800
+         */
801
+        public function download_package( $version, $option = array() ) {
802
+            $filename = 'fontawesome-free-' . $version . '-web';
803
+            $url = 'https://use.fontawesome.com/releases/v' . $version . '/' . $filename . '.zip';
804
+
805
+            if ( ! function_exists( 'wp_handle_upload' ) ) {
806
+                require_once ABSPATH . 'wp-admin/includes/file.php';
807
+            }
808
+
809
+            $download_file = download_url( esc_url_raw( $url ) );
810
+
811
+            if ( is_wp_error( $download_file ) ) {
812
+                return new WP_Error( 'fontawesome_download_failed', __( $download_file->get_error_message(), 'font-awesome-settings' ) );
813
+            } else if ( empty( $download_file ) ) {
814
+                return new WP_Error( 'fontawesome_download_failed', __( 'Something went wrong in downloading the font awesome to store locally.', 'font-awesome-settings' ) );
815
+            }
816
+
817
+            $response = $this->extract_package( $download_file, $filename, true );
818
+
819
+            // Update local version.
820
+            if ( is_wp_error( $response ) ) {
821
+                return $response;
822
+            } else if ( $response ) {
823
+                if ( empty( $option ) ) {
824
+                    $option = get_option( 'wp-font-awesome-settings' );
825
+                }
826
+
827
+                $option['local_version'] = $version;
828
+
829
+                // Remove action to prevent looping.
830
+                remove_action( 'update_option_wp-font-awesome-settings', array( $this, 'update_option_wp_font_awesome_settings' ), 10, 2 );
831
+
832
+                update_option( 'wp-font-awesome-settings', $option );
833
+
834
+                return true;
835
+            }
836
+
837
+            return false;
838
+        }
839
+
840
+        /**
841
+         * Extract the fontawesome package file.
842
+         *
843
+         * @since 1.1.0
844
+         *
845
+         * @param string $package The package file path.
846
+         * @param string $dirname Package file name.
847
+         * @param bool   $delete_package Delete temp file or not.
848
+         * @return WP_Error|bool True on success WP_Error on fail.
849
+         */
850
+        public function extract_package( $package, $dirname = '', $delete_package = false ) {
851
+            global $wp_filesystem;
852
+
853
+            $wp_filesystem = $this->get_wp_filesystem();
854
+
855
+            if ( empty( $wp_filesystem ) && isset( $wp_filesystem->errors ) && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
856
+                return new WP_Error( 'fontawesome_filesystem_error', __( $wp_filesystem->errors->get_error_message(), 'font-awesome-settings' ) );
857
+            } else if ( empty( $wp_filesystem ) ) {
858
+                return new WP_Error( 'fontawesome_filesystem_error', __( 'Failed to initialise WP_Filesystem while trying to download the Font Awesome package.', 'font-awesome-settings' ) );
859
+            }
860
+
861
+            $fonts_dir = $this->get_fonts_dir();
862
+            $fonts_tmp_dir = dirname( $fonts_dir ) . DIRECTORY_SEPARATOR . 'fa-tmp' . DIRECTORY_SEPARATOR;
863
+
864
+            if ( $wp_filesystem->is_dir( $fonts_tmp_dir ) ) {
865
+                $wp_filesystem->delete( $fonts_tmp_dir, true );
866
+            }
867
+
868
+            // Unzip package to working directory.
869
+            $result = unzip_file( $package, $fonts_tmp_dir );
870
+
871
+            if ( is_wp_error( $result ) ) {
872
+                $wp_filesystem->delete( $fonts_tmp_dir, true );
873
+
874
+                if ( 'incompatible_archive' === $result->get_error_code() ) {
875
+                    return new WP_Error( 'fontawesome_incompatible_archive', __( $result->get_error_message(), 'font-awesome-settings' ) );
876
+                }
877
+
878
+                return $result;
879
+            }
880
+
881
+            if ( $wp_filesystem->is_dir( $fonts_dir ) ) {
882
+                $wp_filesystem->delete( $fonts_dir, true );
883
+            }
884
+
885
+            $extract_dir = $fonts_tmp_dir;
886
+
887
+            if ( $dirname && $wp_filesystem->is_dir( $extract_dir . $dirname . DIRECTORY_SEPARATOR ) ) {
888
+                $extract_dir .= $dirname . DIRECTORY_SEPARATOR;
889
+            }
890
+
891
+            try {
892
+                $return = $wp_filesystem->move( $extract_dir, $fonts_dir, true );
893
+            } catch ( Exception $e ) {
894
+                $return = new WP_Error( 'fontawesome_move_package', __( 'Fail to move font awesome package!', 'font-awesome-settings' ) );
895
+            }
896
+
897
+            if ( $wp_filesystem->is_dir( $fonts_tmp_dir ) ) {
898
+                $wp_filesystem->delete( $fonts_tmp_dir, true );
899
+            }
900
+
901
+            // Once extracted, delete the package if required.
902
+            if ( $delete_package ) {
903
+                unlink( $package );
904
+            }
905
+
906
+            return $return;
907
+        }
908
+    }
909
+
910
+    /**
911
+     * Run the class if found.
912
+     */
913
+    WP_Font_Awesome_Settings::instance();
914 914
 }
Please login to merge, or discard this patch.