Passed
Push — master ( ae1644...093b58 )
by Brian
04:25
created
vendor/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php 1 patch
Indentation   +762 added lines, -762 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,361 +21,361 @@  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
-	 * @since 1.1.1 Requires to re-save settings to load locally when option does not exists - FIXED.
36
-	 * @ver 1.0.15
37
-	 * @todo decide how to implement textdomain
38
-	 */
39
-	class WP_Font_Awesome_Settings {
40
-
41
-		/**
42
-		 * Class version version.
43
-		 *
44
-		 * @var string
45
-		 */
46
-		public $version = '1.1.1';
47
-
48
-		/**
49
-		 * Class textdomain.
50
-		 *
51
-		 * @var string
52
-		 */
53
-		public $textdomain = 'font-awesome-settings';
54
-
55
-		/**
56
-		 * Latest version of Font Awesome at time of publish published.
57
-		 *
58
-		 * @var string
59
-		 */
60
-		public $latest = "5.8.2";
61
-
62
-		/**
63
-		 * The title.
64
-		 *
65
-		 * @var string
66
-		 */
67
-		public $name = 'Font Awesome';
68
-
69
-		/**
70
-		 * Holds the settings values.
71
-		 *
72
-		 * @var array
73
-		 */
74
-		private $settings;
75
-
76
-		/**
77
-		 * WP_Font_Awesome_Settings instance.
78
-		 *
79
-		 * @access private
80
-		 * @since  1.0.0
81
-		 * @var    WP_Font_Awesome_Settings There can be only one!
82
-		 */
83
-		private static $instance = null;
84
-
85
-		/**
86
-		 * Main WP_Font_Awesome_Settings Instance.
87
-		 *
88
-		 * Ensures only one instance of WP_Font_Awesome_Settings is loaded or can be loaded.
89
-		 *
90
-		 * @since 1.0.0
91
-		 * @static
92
-		 * @return WP_Font_Awesome_Settings - Main instance.
93
-		 */
94
-		public static function instance() {
95
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Font_Awesome_Settings ) ) {
96
-				self::$instance = new WP_Font_Awesome_Settings;
97
-
98
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
99
-
100
-				if ( is_admin() ) {
101
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
102
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
103
-					add_action( 'admin_notices', array( self::$instance, 'admin_notices' ) );
104
-				}
105
-
106
-				do_action( 'wp_font_awesome_settings_loaded' );
107
-			}
108
-
109
-			return self::$instance;
110
-		}
111
-
112
-		/**
113
-		 * Initiate the settings and add the required action hooks.
114
-		 *
115
-		 * @since 1.0.8 Settings name wrong - FIXED
116
-		 */
117
-		public function init() {
118
-			// Download fontawesome locally.
119
-			add_action( 'add_option_wp-font-awesome-settings', array( $this, 'add_option_wp_font_awesome_settings' ), 10, 2 );
120
-			add_action( 'update_option_wp-font-awesome-settings', array( $this, 'update_option_wp_font_awesome_settings' ), 10, 2 );
121
-
122
-			$this->settings = $this->get_settings();
123
-
124
-			// check if the official plugin is active and use that instead if so.
125
-			if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
126
-
127
-				if ( $this->settings['type'] == 'CSS' ) {
128
-
129
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
130
-						add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
131
-					}
132
-
133
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
134
-						add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
135
-						add_filter( 'block_editor_settings_all', array( $this, 'enqueue_editor_styles' ), 10, 2 );
136
-					}
137
-
138
-				} else {
139
-
140
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
141
-						add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
142
-					}
143
-
144
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
145
-						add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
146
-						add_filter( 'block_editor_settings_all', array( $this, 'enqueue_editor_scripts' ), 10, 2 );
147
-					}
148
-				}
149
-
150
-				// remove font awesome if set to do so
151
-				if ( $this->settings['dequeue'] == '1' ) {
152
-					add_action( 'clean_url', array( $this, 'remove_font_awesome' ), 5000, 3 );
153
-				}
154
-			}
155
-
156
-		}
157
-
158
-		/**
159
-		 * Add FA to the FSE.
160
-		 *
161
-		 * @param $editor_settings
162
-		 * @param $block_editor_context
163
-		 *
164
-		 * @return array
165
-		 */
166
-		public function enqueue_editor_styles( $editor_settings, $block_editor_context ){
167
-
168
-			if ( ! empty( $editor_settings['__unstableResolvedAssets']['styles'] ) ) {
169
-				$url = $this->get_url();
170
-				$editor_settings['__unstableResolvedAssets']['styles'] .= "<link rel='stylesheet' id='font-awesome-css'  href='$url' media='all' />";
171
-			}
172
-
173
-			return $editor_settings;
174
-		}
175
-
176
-		/**
177
-		 * Add FA to the FSE.
178
-		 *
179
-		 * @param $editor_settings
180
-		 * @param $block_editor_context
181
-		 *
182
-		 * @return array
183
-		 */
184
-		public function enqueue_editor_scripts( $editor_settings, $block_editor_context ){
185
-
186
-			$url = $this->get_url();
187
-			$editor_settings['__unstableResolvedAssets']['scripts'] .= "<script src='$url' id='font-awesome-js'></script>";
188
-
189
-			return $editor_settings;
190
-		}
191
-
192
-		/**
193
-		 * Adds the Font Awesome styles.
194
-		 */
195
-		public function enqueue_style() {
196
-			// build url
197
-			$url = $this->get_url();
198
-			$version = ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) ? strip_tags( $this->settings['local_version'] ) : null;
199
-
200
-			wp_deregister_style( 'font-awesome' ); // deregister in case its already there
201
-			wp_register_style( 'font-awesome', $url, array(), $version );
202
-			wp_enqueue_style( 'font-awesome' );
203
-
204
-			// RTL language support CSS.
205
-			if ( is_rtl() ) {
206
-				wp_add_inline_style( 'font-awesome', $this->rtl_inline_css() );
207
-			}
208
-
209
-			if ( $this->settings['shims'] ) {
210
-				$url = $this->get_url( true );
211
-				wp_deregister_style( 'font-awesome-shims' ); // deregister in case its already there
212
-				wp_register_style( 'font-awesome-shims', $url, array(), $version );
213
-				wp_enqueue_style( 'font-awesome-shims' );
214
-			}
215
-		}
216
-
217
-		/**
218
-		 * Adds the Font Awesome JS.
219
-		 */
220
-		public function enqueue_scripts() {
221
-			// build url
222
-			$url = $this->get_url();
223
-
224
-			$deregister_function = 'wp' . '_' . 'deregister' . '_' . 'script';
225
-			call_user_func( $deregister_function, 'font-awesome' ); // deregister in case its already there
226
-			wp_register_script( 'font-awesome', $url, array(), null );
227
-			wp_enqueue_script( 'font-awesome' );
228
-
229
-			if ( $this->settings['shims'] ) {
230
-				$url = $this->get_url( true );
231
-				call_user_func( $deregister_function, 'font-awesome-shims' ); // deregister in case its already there
232
-				wp_register_script( 'font-awesome-shims', $url, array(), null );
233
-				wp_enqueue_script( 'font-awesome-shims' );
234
-			}
235
-		}
236
-
237
-		/**
238
-		 * Get the url of the Font Awesome files.
239
-		 *
240
-		 * @param bool $shims If this is a shim file or not.
241
-		 * @param bool $local Load locally if allowed.
242
-		 *
243
-		 * @return string The url to the file.
244
-		 */
245
-		public function get_url( $shims = false, $local = true ) {
246
-			$script  = $shims ? 'v4-shims' : 'all';
247
-			$sub     = $this->settings['pro'] ? 'pro' : 'use';
248
-			$type    = $this->settings['type'];
249
-			$version = $this->settings['version'];
250
-			$kit_url = $this->settings['kit-url'] ? esc_url( $this->settings['kit-url'] ) : '';
251
-			$url     = '';
252
-
253
-			if ( $type == 'KIT' && $kit_url ) {
254
-				if ( $shims ) {
255
-					// if its a kit then we don't add shims here
256
-					return '';
257
-				}
258
-				$url .= $kit_url; // CDN
259
-				$url .= "?wpfas=true"; // set our var so our version is not removed
260
-			} else {
261
-				$v = '';
262
-				// Check and load locally.
263
-				if ( $local && $this->has_local() ) {
264
-					$script .= ".min";
265
-					$v .= '&ver=' . strip_tags( $this->settings['local_version'] );
266
-					$url .= $this->get_fonts_url(); // Local fonts url.
267
-				} else {
268
-					$url .= "https://$sub.fontawesome.com/releases/"; // CDN
269
-					$url .= ! empty( $version ) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version
270
-				}
271
-				$url .= $type == 'CSS' ? 'css/' : 'js/'; // type
272
-				$url .= $type == 'CSS' ? $script . '.css' : $script . '.js'; // type
273
-				$url .= "?wpfas=true" . $v; // set our var so our version is not removed
274
-			}
275
-
276
-			return $url;
277
-		}
278
-
279
-		/**
280
-		 * Try and remove any other versions of Font Awesome added by other plugins/themes.
281
-		 *
282
-		 * 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.
283
-		 *
284
-		 * @param $url
285
-		 * @param $original_url
286
-		 * @param $_context
287
-		 *
288
-		 * @return string The filtered url.
289
-		 */
290
-		public function remove_font_awesome( $url, $original_url, $_context ) {
291
-
292
-			if ( $_context == 'display'
293
-			     && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false )
294
-			     && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false )
295
-			) {// it's a font-awesome-url (probably)
296
-
297
-				if ( strstr( $url, "wpfas=true" ) !== false ) {
298
-					if ( $this->settings['type'] == 'JS' ) {
299
-						if ( $this->settings['js-pseudo'] ) {
300
-							$url .= "' data-search-pseudo-elements defer='defer";
301
-						} else {
302
-							$url .= "' defer='defer";
303
-						}
304
-					}
305
-				} else {
306
-					$url = ''; // removing the url removes the file
307
-				}
308
-
309
-			}
310
-
311
-			return $url;
312
-		}
313
-
314
-		/**
315
-		 * Register the database settings with WordPress.
316
-		 */
317
-		public function register_settings() {
318
-			register_setting( 'wp-font-awesome-settings', 'wp-font-awesome-settings' );
319
-		}
320
-
321
-		/**
322
-		 * Add the WordPress settings menu item.
323
-		 * @since 1.0.10 Calling function name direct will fail theme check so we don't.
324
-		 */
325
-		public function menu_item() {
326
-			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
327
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array(
328
-				$this,
329
-				'settings_page'
330
-			) );
331
-		}
332
-
333
-		/**
334
-		 * Get the current Font Awesome output settings.
335
-		 *
336
-		 * @return array The array of settings.
337
-		 */
338
-		public function get_settings() {
339
-			$db_settings = get_option( 'wp-font-awesome-settings' );
340
-
341
-			$defaults = array(
342
-				'type'      => 'CSS', // type to use, CSS or JS or KIT
343
-				'version'   => '', // latest
344
-				'enqueue'   => '', // front and backend
345
-				'shims'     => '0', // default OFF now in 2020
346
-				'js-pseudo' => '0', // if the pseudo elements flag should be set (CPU intensive)
347
-				'dequeue'   => '0', // if we should try to remove other versions added by other plugins/themes
348
-				'pro'       => '0', // if pro CDN url should be used
349
-				'local'     => '0', // Store fonts locally.
350
-				'local_version' => '', // Local fonts version.
351
-				'kit-url'   => '', // the kit url
352
-			);
353
-
354
-			$settings = wp_parse_args( $db_settings, $defaults );
355
-
356
-			/**
357
-			 * Filter the Font Awesome settings.
358
-			 *
359
-			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
360
-			 */
361
-			return $this->settings = apply_filters( 'wp-font-awesome-settings', $settings, $db_settings, $defaults );
362
-		}
363
-
364
-		/**
365
-		 * The settings page html output.
366
-		 */
367
-		public function settings_page() {
368
-			if ( ! current_user_can( 'manage_options' ) ) {
369
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'font-awesome-settings' ) );
370
-			}
371
-
372
-			// a hidden way to force the update of the version number via api instead of waiting the 48 hours
373
-			if ( isset( $_REQUEST['force-version-check'] ) ) {
374
-				$this->get_latest_version( $force_api = true );
375
-			}
376
-
377
-			if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
378
-				?>
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
+     * @since 1.1.1 Requires to re-save settings to load locally when option does not exists - FIXED.
36
+     * @ver 1.0.15
37
+     * @todo decide how to implement textdomain
38
+     */
39
+    class WP_Font_Awesome_Settings {
40
+
41
+        /**
42
+         * Class version version.
43
+         *
44
+         * @var string
45
+         */
46
+        public $version = '1.1.1';
47
+
48
+        /**
49
+         * Class textdomain.
50
+         *
51
+         * @var string
52
+         */
53
+        public $textdomain = 'font-awesome-settings';
54
+
55
+        /**
56
+         * Latest version of Font Awesome at time of publish published.
57
+         *
58
+         * @var string
59
+         */
60
+        public $latest = "5.8.2";
61
+
62
+        /**
63
+         * The title.
64
+         *
65
+         * @var string
66
+         */
67
+        public $name = 'Font Awesome';
68
+
69
+        /**
70
+         * Holds the settings values.
71
+         *
72
+         * @var array
73
+         */
74
+        private $settings;
75
+
76
+        /**
77
+         * WP_Font_Awesome_Settings instance.
78
+         *
79
+         * @access private
80
+         * @since  1.0.0
81
+         * @var    WP_Font_Awesome_Settings There can be only one!
82
+         */
83
+        private static $instance = null;
84
+
85
+        /**
86
+         * Main WP_Font_Awesome_Settings Instance.
87
+         *
88
+         * Ensures only one instance of WP_Font_Awesome_Settings is loaded or can be loaded.
89
+         *
90
+         * @since 1.0.0
91
+         * @static
92
+         * @return WP_Font_Awesome_Settings - Main instance.
93
+         */
94
+        public static function instance() {
95
+            if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Font_Awesome_Settings ) ) {
96
+                self::$instance = new WP_Font_Awesome_Settings;
97
+
98
+                add_action( 'init', array( self::$instance, 'init' ) ); // set settings
99
+
100
+                if ( is_admin() ) {
101
+                    add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
102
+                    add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
103
+                    add_action( 'admin_notices', array( self::$instance, 'admin_notices' ) );
104
+                }
105
+
106
+                do_action( 'wp_font_awesome_settings_loaded' );
107
+            }
108
+
109
+            return self::$instance;
110
+        }
111
+
112
+        /**
113
+         * Initiate the settings and add the required action hooks.
114
+         *
115
+         * @since 1.0.8 Settings name wrong - FIXED
116
+         */
117
+        public function init() {
118
+            // Download fontawesome locally.
119
+            add_action( 'add_option_wp-font-awesome-settings', array( $this, 'add_option_wp_font_awesome_settings' ), 10, 2 );
120
+            add_action( 'update_option_wp-font-awesome-settings', array( $this, 'update_option_wp_font_awesome_settings' ), 10, 2 );
121
+
122
+            $this->settings = $this->get_settings();
123
+
124
+            // check if the official plugin is active and use that instead if so.
125
+            if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
126
+
127
+                if ( $this->settings['type'] == 'CSS' ) {
128
+
129
+                    if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
130
+                        add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
131
+                    }
132
+
133
+                    if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
134
+                        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
135
+                        add_filter( 'block_editor_settings_all', array( $this, 'enqueue_editor_styles' ), 10, 2 );
136
+                    }
137
+
138
+                } else {
139
+
140
+                    if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
141
+                        add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
142
+                    }
143
+
144
+                    if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
145
+                        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
146
+                        add_filter( 'block_editor_settings_all', array( $this, 'enqueue_editor_scripts' ), 10, 2 );
147
+                    }
148
+                }
149
+
150
+                // remove font awesome if set to do so
151
+                if ( $this->settings['dequeue'] == '1' ) {
152
+                    add_action( 'clean_url', array( $this, 'remove_font_awesome' ), 5000, 3 );
153
+                }
154
+            }
155
+
156
+        }
157
+
158
+        /**
159
+         * Add FA to the FSE.
160
+         *
161
+         * @param $editor_settings
162
+         * @param $block_editor_context
163
+         *
164
+         * @return array
165
+         */
166
+        public function enqueue_editor_styles( $editor_settings, $block_editor_context ){
167
+
168
+            if ( ! empty( $editor_settings['__unstableResolvedAssets']['styles'] ) ) {
169
+                $url = $this->get_url();
170
+                $editor_settings['__unstableResolvedAssets']['styles'] .= "<link rel='stylesheet' id='font-awesome-css'  href='$url' media='all' />";
171
+            }
172
+
173
+            return $editor_settings;
174
+        }
175
+
176
+        /**
177
+         * Add FA to the FSE.
178
+         *
179
+         * @param $editor_settings
180
+         * @param $block_editor_context
181
+         *
182
+         * @return array
183
+         */
184
+        public function enqueue_editor_scripts( $editor_settings, $block_editor_context ){
185
+
186
+            $url = $this->get_url();
187
+            $editor_settings['__unstableResolvedAssets']['scripts'] .= "<script src='$url' id='font-awesome-js'></script>";
188
+
189
+            return $editor_settings;
190
+        }
191
+
192
+        /**
193
+         * Adds the Font Awesome styles.
194
+         */
195
+        public function enqueue_style() {
196
+            // build url
197
+            $url = $this->get_url();
198
+            $version = ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) ? strip_tags( $this->settings['local_version'] ) : null;
199
+
200
+            wp_deregister_style( 'font-awesome' ); // deregister in case its already there
201
+            wp_register_style( 'font-awesome', $url, array(), $version );
202
+            wp_enqueue_style( 'font-awesome' );
203
+
204
+            // RTL language support CSS.
205
+            if ( is_rtl() ) {
206
+                wp_add_inline_style( 'font-awesome', $this->rtl_inline_css() );
207
+            }
208
+
209
+            if ( $this->settings['shims'] ) {
210
+                $url = $this->get_url( true );
211
+                wp_deregister_style( 'font-awesome-shims' ); // deregister in case its already there
212
+                wp_register_style( 'font-awesome-shims', $url, array(), $version );
213
+                wp_enqueue_style( 'font-awesome-shims' );
214
+            }
215
+        }
216
+
217
+        /**
218
+         * Adds the Font Awesome JS.
219
+         */
220
+        public function enqueue_scripts() {
221
+            // build url
222
+            $url = $this->get_url();
223
+
224
+            $deregister_function = 'wp' . '_' . 'deregister' . '_' . 'script';
225
+            call_user_func( $deregister_function, 'font-awesome' ); // deregister in case its already there
226
+            wp_register_script( 'font-awesome', $url, array(), null );
227
+            wp_enqueue_script( 'font-awesome' );
228
+
229
+            if ( $this->settings['shims'] ) {
230
+                $url = $this->get_url( true );
231
+                call_user_func( $deregister_function, 'font-awesome-shims' ); // deregister in case its already there
232
+                wp_register_script( 'font-awesome-shims', $url, array(), null );
233
+                wp_enqueue_script( 'font-awesome-shims' );
234
+            }
235
+        }
236
+
237
+        /**
238
+         * Get the url of the Font Awesome files.
239
+         *
240
+         * @param bool $shims If this is a shim file or not.
241
+         * @param bool $local Load locally if allowed.
242
+         *
243
+         * @return string The url to the file.
244
+         */
245
+        public function get_url( $shims = false, $local = true ) {
246
+            $script  = $shims ? 'v4-shims' : 'all';
247
+            $sub     = $this->settings['pro'] ? 'pro' : 'use';
248
+            $type    = $this->settings['type'];
249
+            $version = $this->settings['version'];
250
+            $kit_url = $this->settings['kit-url'] ? esc_url( $this->settings['kit-url'] ) : '';
251
+            $url     = '';
252
+
253
+            if ( $type == 'KIT' && $kit_url ) {
254
+                if ( $shims ) {
255
+                    // if its a kit then we don't add shims here
256
+                    return '';
257
+                }
258
+                $url .= $kit_url; // CDN
259
+                $url .= "?wpfas=true"; // set our var so our version is not removed
260
+            } else {
261
+                $v = '';
262
+                // Check and load locally.
263
+                if ( $local && $this->has_local() ) {
264
+                    $script .= ".min";
265
+                    $v .= '&ver=' . strip_tags( $this->settings['local_version'] );
266
+                    $url .= $this->get_fonts_url(); // Local fonts url.
267
+                } else {
268
+                    $url .= "https://$sub.fontawesome.com/releases/"; // CDN
269
+                    $url .= ! empty( $version ) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version
270
+                }
271
+                $url .= $type == 'CSS' ? 'css/' : 'js/'; // type
272
+                $url .= $type == 'CSS' ? $script . '.css' : $script . '.js'; // type
273
+                $url .= "?wpfas=true" . $v; // set our var so our version is not removed
274
+            }
275
+
276
+            return $url;
277
+        }
278
+
279
+        /**
280
+         * Try and remove any other versions of Font Awesome added by other plugins/themes.
281
+         *
282
+         * 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.
283
+         *
284
+         * @param $url
285
+         * @param $original_url
286
+         * @param $_context
287
+         *
288
+         * @return string The filtered url.
289
+         */
290
+        public function remove_font_awesome( $url, $original_url, $_context ) {
291
+
292
+            if ( $_context == 'display'
293
+                 && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false )
294
+                 && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false )
295
+            ) {// it's a font-awesome-url (probably)
296
+
297
+                if ( strstr( $url, "wpfas=true" ) !== false ) {
298
+                    if ( $this->settings['type'] == 'JS' ) {
299
+                        if ( $this->settings['js-pseudo'] ) {
300
+                            $url .= "' data-search-pseudo-elements defer='defer";
301
+                        } else {
302
+                            $url .= "' defer='defer";
303
+                        }
304
+                    }
305
+                } else {
306
+                    $url = ''; // removing the url removes the file
307
+                }
308
+
309
+            }
310
+
311
+            return $url;
312
+        }
313
+
314
+        /**
315
+         * Register the database settings with WordPress.
316
+         */
317
+        public function register_settings() {
318
+            register_setting( 'wp-font-awesome-settings', 'wp-font-awesome-settings' );
319
+        }
320
+
321
+        /**
322
+         * Add the WordPress settings menu item.
323
+         * @since 1.0.10 Calling function name direct will fail theme check so we don't.
324
+         */
325
+        public function menu_item() {
326
+            $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
327
+            call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array(
328
+                $this,
329
+                'settings_page'
330
+            ) );
331
+        }
332
+
333
+        /**
334
+         * Get the current Font Awesome output settings.
335
+         *
336
+         * @return array The array of settings.
337
+         */
338
+        public function get_settings() {
339
+            $db_settings = get_option( 'wp-font-awesome-settings' );
340
+
341
+            $defaults = array(
342
+                'type'      => 'CSS', // type to use, CSS or JS or KIT
343
+                'version'   => '', // latest
344
+                'enqueue'   => '', // front and backend
345
+                'shims'     => '0', // default OFF now in 2020
346
+                'js-pseudo' => '0', // if the pseudo elements flag should be set (CPU intensive)
347
+                'dequeue'   => '0', // if we should try to remove other versions added by other plugins/themes
348
+                'pro'       => '0', // if pro CDN url should be used
349
+                'local'     => '0', // Store fonts locally.
350
+                'local_version' => '', // Local fonts version.
351
+                'kit-url'   => '', // the kit url
352
+            );
353
+
354
+            $settings = wp_parse_args( $db_settings, $defaults );
355
+
356
+            /**
357
+             * Filter the Font Awesome settings.
358
+             *
359
+             * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
360
+             */
361
+            return $this->settings = apply_filters( 'wp-font-awesome-settings', $settings, $db_settings, $defaults );
362
+        }
363
+
364
+        /**
365
+         * The settings page html output.
366
+         */
367
+        public function settings_page() {
368
+            if ( ! current_user_can( 'manage_options' ) ) {
369
+                wp_die( __( 'You do not have sufficient permissions to access this page.', 'font-awesome-settings' ) );
370
+            }
371
+
372
+            // a hidden way to force the update of the version number via api instead of waiting the 48 hours
373
+            if ( isset( $_REQUEST['force-version-check'] ) ) {
374
+                $this->get_latest_version( $force_api = true );
375
+            }
376
+
377
+            if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
378
+                ?>
379 379
                 <style>
380 380
                     .wpfas-kit-show {
381 381
                         display: none;
@@ -401,16 +401,16 @@  discard block
 block discarded – undo
401 401
                     <h1><?php echo $this->name; ?></h1>
402 402
                     <form method="post" action="options.php" class="fas-settings-form">
403 403
 						<?php
404
-						settings_fields( 'wp-font-awesome-settings' );
405
-						do_settings_sections( 'wp-font-awesome-settings' );
406
-						$table_class = '';
407
-						if ( $this->settings['type'] ) {
408
-							$table_class .= 'wpfas-' . sanitize_html_class( strtolower( $this->settings['type'] ) ) . '-set';
409
-						}
410
-						if ( ! empty( $this->settings['pro'] ) ) {
411
-							$table_class .= ' wpfas-has-pro';
412
-						}
413
-						?>
404
+                        settings_fields( 'wp-font-awesome-settings' );
405
+                        do_settings_sections( 'wp-font-awesome-settings' );
406
+                        $table_class = '';
407
+                        if ( $this->settings['type'] ) {
408
+                            $table_class .= 'wpfas-' . sanitize_html_class( strtolower( $this->settings['type'] ) ) . '-set';
409
+                        }
410
+                        if ( ! empty( $this->settings['pro'] ) ) {
411
+                            $table_class .= ' wpfas-has-pro';
412
+                        }
413
+                        ?>
414 414
 						<?php if ( $this->settings['type'] != 'KIT' && ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) ) { ?>
415 415
 							<?php if ( $this->has_local() ) { ?>
416 416
 							<div class="notice notice-info"><p><strong><?php _e( 'Font Awesome fonts are loading locally.', 'font-awesome-settings' ); ?></strong></p></div>
@@ -435,12 +435,12 @@  discard block
 block discarded – undo
435 435
                                 <td>
436 436
                                     <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 :(?>"/>
437 437
                                     <span><?php
438
-										echo sprintf(
439
-											__( 'Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings' ),
440
-											'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/kits"><i class="fas fa-external-link-alt"></i>',
441
-											'</a>'
442
-										);
443
-										?></span>
438
+                                        echo sprintf(
439
+                                            __( 'Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings' ),
440
+                                            '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/kits"><i class="fas fa-external-link-alt"></i>',
441
+                                            '</a>'
442
+                                        );
443
+                                        ?></span>
444 444
                                 </td>
445 445
                             </tr>
446 446
 
@@ -481,14 +481,14 @@  discard block
 block discarded – undo
481 481
                                     <input type="hidden" name="wp-font-awesome-settings[pro]" value="0"/>
482 482
                                     <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')}"/>
483 483
                                     <span><?php
484
-										echo wp_sprintf(
485
-											__( 'Requires a subscription. %sLearn more%s  %sManage my allowed domains%s', 'font-awesome-settings' ),
486
-											'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/referral?a=c9b89e1418">',
487
-											' <i class="fas fa-external-link-alt"></i></a>',
488
-											'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/account/cdn">',
489
-											' <i class="fas fa-external-link-alt"></i></a>'
490
-										);
491
-										?></span>
484
+                                        echo wp_sprintf(
485
+                                            __( 'Requires a subscription. %sLearn more%s  %sManage my allowed domains%s', 'font-awesome-settings' ),
486
+                                            '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/referral?a=c9b89e1418">',
487
+                                            ' <i class="fas fa-external-link-alt"></i></a>',
488
+                                            '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/account/cdn">',
489
+                                            ' <i class="fas fa-external-link-alt"></i></a>'
490
+                                        );
491
+                                        ?></span>
492 492
                                 </td>
493 493
                             </tr>
494 494
 
@@ -542,8 +542,8 @@  discard block
 block discarded – undo
542 542
                         </table>
543 543
                         <div class="fas-buttons">
544 544
 							<?php
545
-							submit_button();
546
-							?>
545
+                            submit_button();
546
+                            ?>
547 547
                             <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>
548 548
 
549 549
                         </div>
@@ -552,392 +552,392 @@  discard block
 block discarded – undo
552 552
                     <div id="wpfas-version"><?php echo sprintf(__( 'Version: %s (affiliate links provided)', 'font-awesome-settings' ), $this->version ); ?></div>
553 553
                 </div>
554 554
 				<?php
555
-			}
556
-		}
557
-
558
-		/**
559
-		 * Check a version number is valid and if so return it or else return an empty string.
560
-		 *
561
-		 * @param $version string The version number to check.
562
-		 *
563
-		 * @since 1.0.6
564
-		 *
565
-		 * @return string Either a valid version number or an empty string.
566
-		 */
567
-		public function validate_version_number( $version ) {
568
-
569
-			if ( version_compare( $version, '0.0.1', '>=' ) >= 0 ) {
570
-				// valid
571
-			} else {
572
-				$version = '';// not validated
573
-			}
574
-
575
-			return $version;
576
-		}
577
-
578
-
579
-		/**
580
-		 * Get the latest version of Font Awesome.
581
-		 *
582
-		 * 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.
583
-		 *
584
-		 * @since 1.0.7
585
-		 * @return mixed|string The latest version number found.
586
-		 */
587
-		public function get_latest_version( $force_api = false ) {
588
-			$latest_version = $this->latest;
589
-
590
-			$cache = get_transient( 'wp-font-awesome-settings-version' );
591
-
592
-			if ( $cache === false || $force_api ) { // its not set
593
-				$api_ver = $this->get_latest_version_from_api();
594
-				if ( version_compare( $api_ver, $this->latest, '>=' ) >= 0 ) {
595
-					$latest_version = $api_ver;
596
-					set_transient( 'wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS );
597
-				}
598
-			} elseif ( $this->validate_version_number( $cache ) ) {
599
-				if ( version_compare( $cache, $this->latest, '>=' ) >= 0 ) {
600
-					$latest_version = $cache;
601
-				}
602
-			}
603
-
604
-			// Check and auto download fonts locally.
605
-			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 ) ) {
606
-				if ( version_compare( $latest_version, $this->settings['local_version'], '>' ) && is_admin() && ! wp_doing_ajax() ) {
607
-					$this->download_package( $latest_version );
608
-				}
609
-			}
610
-
611
-			return $latest_version;
612
-		}
613
-
614
-		/**
615
-		 * Get the latest Font Awesome version from the github API.
616
-		 *
617
-		 * @since 1.0.7
618
-		 * @return string The latest version number or `0` on API fail.
619
-		 */
620
-		public function get_latest_version_from_api() {
621
-			$version  = "0";
622
-			$response = wp_remote_get( "https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest" );
623
-			if ( ! is_wp_error( $response ) && is_array( $response ) ) {
624
-				$api_response = json_decode( wp_remote_retrieve_body( $response ), true );
625
-				if ( isset( $api_response['tag_name'] ) && version_compare( $api_response['tag_name'], $this->latest, '>=' ) >= 0 && empty( $api_response['prerelease'] ) ) {
626
-					$version = $api_response['tag_name'];
627
-				}
628
-			}
629
-
630
-			return $version;
631
-		}
632
-
633
-		/**
634
-		 * Inline CSS for RTL language support.
635
-		 *
636
-		 * @since 1.0.13
637
-		 * @return string Inline CSS.
638
-		 */
639
-		public function rtl_inline_css() {
640
-			$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}';
641
-
642
-			return $inline_css;
643
-		}
644
-
645
-		/**
646
-		 * Show any warnings as an admin notice.
647
-		 *
648
-		 * @return void
649
-		 */
650
-		public function admin_notices() {
651
-			$settings = $this->settings;
652
-
653
-			if ( defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
654
-				if ( ! empty( $_REQUEST['page'] ) && $_REQUEST['page'] == 'wp-font-awesome-settings' ) {
655
-					?>
555
+            }
556
+        }
557
+
558
+        /**
559
+         * Check a version number is valid and if so return it or else return an empty string.
560
+         *
561
+         * @param $version string The version number to check.
562
+         *
563
+         * @since 1.0.6
564
+         *
565
+         * @return string Either a valid version number or an empty string.
566
+         */
567
+        public function validate_version_number( $version ) {
568
+
569
+            if ( version_compare( $version, '0.0.1', '>=' ) >= 0 ) {
570
+                // valid
571
+            } else {
572
+                $version = '';// not validated
573
+            }
574
+
575
+            return $version;
576
+        }
577
+
578
+
579
+        /**
580
+         * Get the latest version of Font Awesome.
581
+         *
582
+         * 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.
583
+         *
584
+         * @since 1.0.7
585
+         * @return mixed|string The latest version number found.
586
+         */
587
+        public function get_latest_version( $force_api = false ) {
588
+            $latest_version = $this->latest;
589
+
590
+            $cache = get_transient( 'wp-font-awesome-settings-version' );
591
+
592
+            if ( $cache === false || $force_api ) { // its not set
593
+                $api_ver = $this->get_latest_version_from_api();
594
+                if ( version_compare( $api_ver, $this->latest, '>=' ) >= 0 ) {
595
+                    $latest_version = $api_ver;
596
+                    set_transient( 'wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS );
597
+                }
598
+            } elseif ( $this->validate_version_number( $cache ) ) {
599
+                if ( version_compare( $cache, $this->latest, '>=' ) >= 0 ) {
600
+                    $latest_version = $cache;
601
+                }
602
+            }
603
+
604
+            // Check and auto download fonts locally.
605
+            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 ) ) {
606
+                if ( version_compare( $latest_version, $this->settings['local_version'], '>' ) && is_admin() && ! wp_doing_ajax() ) {
607
+                    $this->download_package( $latest_version );
608
+                }
609
+            }
610
+
611
+            return $latest_version;
612
+        }
613
+
614
+        /**
615
+         * Get the latest Font Awesome version from the github API.
616
+         *
617
+         * @since 1.0.7
618
+         * @return string The latest version number or `0` on API fail.
619
+         */
620
+        public function get_latest_version_from_api() {
621
+            $version  = "0";
622
+            $response = wp_remote_get( "https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest" );
623
+            if ( ! is_wp_error( $response ) && is_array( $response ) ) {
624
+                $api_response = json_decode( wp_remote_retrieve_body( $response ), true );
625
+                if ( isset( $api_response['tag_name'] ) && version_compare( $api_response['tag_name'], $this->latest, '>=' ) >= 0 && empty( $api_response['prerelease'] ) ) {
626
+                    $version = $api_response['tag_name'];
627
+                }
628
+            }
629
+
630
+            return $version;
631
+        }
632
+
633
+        /**
634
+         * Inline CSS for RTL language support.
635
+         *
636
+         * @since 1.0.13
637
+         * @return string Inline CSS.
638
+         */
639
+        public function rtl_inline_css() {
640
+            $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}';
641
+
642
+            return $inline_css;
643
+        }
644
+
645
+        /**
646
+         * Show any warnings as an admin notice.
647
+         *
648
+         * @return void
649
+         */
650
+        public function admin_notices() {
651
+            $settings = $this->settings;
652
+
653
+            if ( defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
654
+                if ( ! empty( $_REQUEST['page'] ) && $_REQUEST['page'] == 'wp-font-awesome-settings' ) {
655
+                    ?>
656 656
                     <div class="notice  notice-error is-dismissible">
657 657
                         <p><?php _e( 'The Official Font Awesome Plugin is active, please adjust your settings there.', 'font-awesome-settings' ); ?></p>
658 658
                     </div>
659 659
 					<?php
660
-				}
661
-			} else {
662
-				if ( ! empty( $settings ) ) {
663
-					if ( $settings['type'] != 'KIT' && $settings['pro'] && ( $settings['version'] == '' || version_compare( $settings['version'], '6', '>=' ) ) ) {
664
-						$link = admin_url('options-general.php?page=wp-font-awesome-settings');
665
-						?>
660
+                }
661
+            } else {
662
+                if ( ! empty( $settings ) ) {
663
+                    if ( $settings['type'] != 'KIT' && $settings['pro'] && ( $settings['version'] == '' || version_compare( $settings['version'], '6', '>=' ) ) ) {
664
+                        $link = admin_url('options-general.php?page=wp-font-awesome-settings');
665
+                        ?>
666 666
                         <div class="notice  notice-error is-dismissible">
667 667
                             <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>
668 668
                         </div>
669 669
 						<?php
670
-					}
671
-				}
672
-			}
673
-		}
674
-
675
-		/**
676
-		 * Handle fontawesome add settings to download fontawesome to store locally.
677
-		 *
678
-		 * @since 1.1.1
679
-		 *
680
-		 * @param string $option The option name.
681
-		 * @param mixed  $value  The option value.
682
-		 */
683
-		public function add_option_wp_font_awesome_settings( $option, $value ) {
684
-			// Do nothing if WordPress is being installed.
685
-			if ( wp_installing() ) {
686
-				return;
687
-			}
688
-
689
-			if ( ! empty( $value['local'] ) && empty( $value['pro'] ) && ! ( ! empty( $value['type'] ) && $value['type'] == 'KIT' ) ) {
690
-				$version = isset( $value['version'] ) && $value['version'] ? $value['version'] : $this->get_latest_version();
691
-
692
-				if ( ! empty( $version ) ) {
693
-					$response = $this->download_package( $version, $value );
694
-
695
-					if ( is_wp_error( $response ) ) {
696
-						add_settings_error( 'general', 'fontawesome_download', __( 'ERROR:', 'font-awesome-settings' ) . ' ' . $response->get_error_message(), 'error' );
697
-					}
698
-				}
699
-			}
700
-		}
701
-
702
-		/**
703
-		 * Handle fontawesome update settings to download fontawesome to store locally.
704
-		 *
705
-		 * @since 1.1.0
706
-		 *
707
-		 * @param mixed $old_value The old option value.
708
-		 * @param mixed $value     The new option value.
709
-		 */
710
-		public function update_option_wp_font_awesome_settings( $old_value, $new_value ) {
711
-			// Do nothing if WordPress is being installed.
712
-			if ( wp_installing() ) {
713
-				return;
714
-			}
715
-
716
-			if ( ! empty( $new_value['local'] ) && empty( $new_value['pro'] ) && ! ( ! empty( $new_value['type'] ) && $new_value['type'] == 'KIT' ) ) {
717
-				// Old values
718
-				$old_version = isset( $old_value['version'] ) && $old_value['version'] ? $old_value['version'] : ( isset( $old_value['local_version'] ) ? $old_value['local_version'] : '' );
719
-				$old_local = isset( $old_value['local'] ) ? (int) $old_value['local'] : 0;
720
-
721
-				// New values
722
-				$new_version = isset( $new_value['version'] ) && $new_value['version'] ? $new_value['version'] : $this->get_latest_version();
723
-
724
-				if ( empty( $old_local ) || $old_version !== $new_version || ! file_exists( $this->get_fonts_dir() . 'css' . DIRECTORY_SEPARATOR . 'all.css' ) ) {
725
-					$response = $this->download_package( $new_version, $new_value );
726
-
727
-					if ( is_wp_error( $response ) ) {
728
-						add_settings_error( 'general', 'fontawesome_download', __( 'ERROR:', 'font-awesome-settings' ) . ' ' . $response->get_error_message(), 'error' );
729
-					}
730
-				}
731
-			}
732
-		}
733
-
734
-		/**
735
-		 * Get the fonts directory local path.
736
-		 *
737
-		 * @since 1.1.0
738
-		 *
739
-		 * @param string Fonts directory local path.
740
-		 */
741
-		public function get_fonts_dir() {
742
-			$upload_dir = wp_upload_dir( null, false );
743
-
744
-			return $upload_dir['basedir'] . DIRECTORY_SEPARATOR .  'ayefonts' . DIRECTORY_SEPARATOR . 'fa' . DIRECTORY_SEPARATOR;
745
-		}
746
-
747
-		/**
748
-		 * Get the fonts directory local url.
749
-		 *
750
-		 * @since 1.1.0
751
-		 *
752
-		 * @param string Fonts directory local url.
753
-		 */
754
-		public function get_fonts_url() {
755
-			$upload_dir = wp_upload_dir( null, false );
756
-
757
-			return $upload_dir['baseurl'] .  '/ayefonts/fa/';
758
-		}
759
-
760
-		/**
761
-		 * Check whether load locally active.
762
-		 *
763
-		 * @since 1.1.0
764
-		 *
765
-		 * @return bool True if active else false.
766
-		 */
767
-		public function has_local() {
768
-			if ( ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) && file_exists( $this->get_fonts_dir() . 'css' . DIRECTORY_SEPARATOR . 'all.css' ) ) {
769
-				return true;
770
-			}
771
-
772
-			return false;
773
-		}
774
-
775
-		/**
776
-		 * Get the WP Filesystem access.
777
-		 *
778
-		 * @since 1.1.0
779
-		 *
780
-		 * @return object The WP Filesystem.
781
-		 */
782
-		public function get_wp_filesystem() {
783
-			if ( ! function_exists( 'get_filesystem_method' ) ) {
784
-				require_once( ABSPATH . "/wp-admin/includes/file.php" );
785
-			}
786
-
787
-			$access_type = get_filesystem_method();
788
-
789
-			if ( $access_type === 'direct' ) {
790
-				/* You can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
791
-				$creds = request_filesystem_credentials( trailingslashit( site_url() ) . 'wp-admin/', '', false, false, array() );
792
-
793
-				/* Initialize the API */
794
-				if ( ! WP_Filesystem( $creds ) ) {
795
-					/* Any problems and we exit */
796
-					return false;
797
-				}
798
-
799
-				global $wp_filesystem;
800
-
801
-				return $wp_filesystem;
802
-				/* Do our file manipulations below */
803
-			} else if ( defined( 'FTP_USER' ) ) {
804
-				$creds = request_filesystem_credentials( trailingslashit( site_url() ) . 'wp-admin/', '', false, false, array() );
805
-
806
-				/* Initialize the API */
807
-				if ( ! WP_Filesystem( $creds ) ) {
808
-					/* Any problems and we exit */
809
-					return false;
810
-				}
811
-
812
-				global $wp_filesystem;
813
-
814
-				return $wp_filesystem;
815
-			} else {
816
-				/* Don't have direct write access. Prompt user with our notice */
817
-				return false;
818
-			}
819
-		}
820
-
821
-		/**
822
-		 * Download the fontawesome package file.
823
-		 *
824
-		 * @since 1.1.0
825
-		 *
826
-		 * @param mixed $version The font awesome.
827
-		 * @param array $option Fontawesome settings.
828
-		 * @return WP_ERROR|bool Error on fail and true on success.
829
-		 */
830
-		public function download_package( $version, $option = array() ) {
831
-			$filename = 'fontawesome-free-' . $version . '-web';
832
-			$url = 'https://use.fontawesome.com/releases/v' . $version . '/' . $filename . '.zip';
833
-
834
-			if ( ! function_exists( 'wp_handle_upload' ) ) {
835
-				require_once ABSPATH . 'wp-admin/includes/file.php';
836
-			}
837
-
838
-			$download_file = download_url( esc_url_raw( $url ) );
839
-
840
-			if ( is_wp_error( $download_file ) ) {
841
-				return new WP_Error( 'fontawesome_download_failed', __( $download_file->get_error_message(), 'font-awesome-settings' ) );
842
-			} else if ( empty( $download_file ) ) {
843
-				return new WP_Error( 'fontawesome_download_failed', __( 'Something went wrong in downloading the font awesome to store locally.', 'font-awesome-settings' ) );
844
-			}
845
-
846
-			$response = $this->extract_package( $download_file, $filename, true );
847
-
848
-			// Update local version.
849
-			if ( is_wp_error( $response ) ) {
850
-				return $response;
851
-			} else if ( $response ) {
852
-				if ( empty( $option ) ) {
853
-					$option = get_option( 'wp-font-awesome-settings' );
854
-				}
855
-
856
-				$option['local_version'] = $version;
857
-
858
-				// Remove action to prevent looping.
859
-				remove_action( 'update_option_wp-font-awesome-settings', array( $this, 'update_option_wp_font_awesome_settings' ), 10, 2 );
860
-
861
-				update_option( 'wp-font-awesome-settings', $option );
862
-
863
-				return true;
864
-			}
865
-
866
-			return false;
867
-		}
868
-
869
-		/**
870
-		 * Extract the fontawesome package file.
871
-		 *
872
-		 * @since 1.1.0
873
-		 *
874
-		 * @param string $package The package file path.
875
-		 * @param string $dirname Package file name.
876
-		 * @param bool   $delete_package Delete temp file or not.
877
-		 * @return WP_Error|bool True on success WP_Error on fail.
878
-		 */
879
-		public function extract_package( $package, $dirname = '', $delete_package = false ) {
880
-			global $wp_filesystem;
881
-
882
-			$wp_filesystem = $this->get_wp_filesystem();
883
-
884
-			if ( empty( $wp_filesystem ) && isset( $wp_filesystem->errors ) && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
885
-				return new WP_Error( 'fontawesome_filesystem_error', __( $wp_filesystem->errors->get_error_message(), 'font-awesome-settings' ) );
886
-			} else if ( empty( $wp_filesystem ) ) {
887
-				return new WP_Error( 'fontawesome_filesystem_error', __( 'Failed to initialise WP_Filesystem while trying to download the Font Awesome package.', 'font-awesome-settings' ) );
888
-			}
889
-
890
-			$fonts_dir = $this->get_fonts_dir();
891
-			$fonts_tmp_dir = dirname( $fonts_dir ) . DIRECTORY_SEPARATOR . 'fa-tmp' . DIRECTORY_SEPARATOR;
892
-
893
-			if ( $wp_filesystem->is_dir( $fonts_tmp_dir ) ) {
894
-				$wp_filesystem->delete( $fonts_tmp_dir, true );
895
-			}
896
-
897
-			// Unzip package to working directory.
898
-			$result = unzip_file( $package, $fonts_tmp_dir );
899
-
900
-			if ( is_wp_error( $result ) ) {
901
-				$wp_filesystem->delete( $fonts_tmp_dir, true );
902
-
903
-				if ( 'incompatible_archive' === $result->get_error_code() ) {
904
-					return new WP_Error( 'fontawesome_incompatible_archive', __( $result->get_error_message(), 'font-awesome-settings' ) );
905
-				}
906
-
907
-				return $result;
908
-			}
909
-
910
-			if ( $wp_filesystem->is_dir( $fonts_dir ) ) {
911
-				$wp_filesystem->delete( $fonts_dir, true );
912
-			}
913
-
914
-			$extract_dir = $fonts_tmp_dir;
915
-
916
-			if ( $dirname && $wp_filesystem->is_dir( $extract_dir . $dirname . DIRECTORY_SEPARATOR ) ) {
917
-				$extract_dir .= $dirname . DIRECTORY_SEPARATOR;
918
-			}
919
-
920
-			try {
921
-				$return = $wp_filesystem->move( $extract_dir, $fonts_dir, true );
922
-			} catch ( Exception $e ) {
923
-				$return = new WP_Error( 'fontawesome_move_package', __( 'Fail to move font awesome package!', 'font-awesome-settings' ) );
924
-			}
925
-
926
-			if ( $wp_filesystem->is_dir( $fonts_tmp_dir ) ) {
927
-				$wp_filesystem->delete( $fonts_tmp_dir, true );
928
-			}
929
-
930
-			// Once extracted, delete the package if required.
931
-			if ( $delete_package ) {
932
-				unlink( $package );
933
-			}
934
-
935
-			return $return;
936
-		}
937
-	}
938
-
939
-	/**
940
-	 * Run the class if found.
941
-	 */
942
-	WP_Font_Awesome_Settings::instance();
670
+                    }
671
+                }
672
+            }
673
+        }
674
+
675
+        /**
676
+         * Handle fontawesome add settings to download fontawesome to store locally.
677
+         *
678
+         * @since 1.1.1
679
+         *
680
+         * @param string $option The option name.
681
+         * @param mixed  $value  The option value.
682
+         */
683
+        public function add_option_wp_font_awesome_settings( $option, $value ) {
684
+            // Do nothing if WordPress is being installed.
685
+            if ( wp_installing() ) {
686
+                return;
687
+            }
688
+
689
+            if ( ! empty( $value['local'] ) && empty( $value['pro'] ) && ! ( ! empty( $value['type'] ) && $value['type'] == 'KIT' ) ) {
690
+                $version = isset( $value['version'] ) && $value['version'] ? $value['version'] : $this->get_latest_version();
691
+
692
+                if ( ! empty( $version ) ) {
693
+                    $response = $this->download_package( $version, $value );
694
+
695
+                    if ( is_wp_error( $response ) ) {
696
+                        add_settings_error( 'general', 'fontawesome_download', __( 'ERROR:', 'font-awesome-settings' ) . ' ' . $response->get_error_message(), 'error' );
697
+                    }
698
+                }
699
+            }
700
+        }
701
+
702
+        /**
703
+         * Handle fontawesome update settings to download fontawesome to store locally.
704
+         *
705
+         * @since 1.1.0
706
+         *
707
+         * @param mixed $old_value The old option value.
708
+         * @param mixed $value     The new option value.
709
+         */
710
+        public function update_option_wp_font_awesome_settings( $old_value, $new_value ) {
711
+            // Do nothing if WordPress is being installed.
712
+            if ( wp_installing() ) {
713
+                return;
714
+            }
715
+
716
+            if ( ! empty( $new_value['local'] ) && empty( $new_value['pro'] ) && ! ( ! empty( $new_value['type'] ) && $new_value['type'] == 'KIT' ) ) {
717
+                // Old values
718
+                $old_version = isset( $old_value['version'] ) && $old_value['version'] ? $old_value['version'] : ( isset( $old_value['local_version'] ) ? $old_value['local_version'] : '' );
719
+                $old_local = isset( $old_value['local'] ) ? (int) $old_value['local'] : 0;
720
+
721
+                // New values
722
+                $new_version = isset( $new_value['version'] ) && $new_value['version'] ? $new_value['version'] : $this->get_latest_version();
723
+
724
+                if ( empty( $old_local ) || $old_version !== $new_version || ! file_exists( $this->get_fonts_dir() . 'css' . DIRECTORY_SEPARATOR . 'all.css' ) ) {
725
+                    $response = $this->download_package( $new_version, $new_value );
726
+
727
+                    if ( is_wp_error( $response ) ) {
728
+                        add_settings_error( 'general', 'fontawesome_download', __( 'ERROR:', 'font-awesome-settings' ) . ' ' . $response->get_error_message(), 'error' );
729
+                    }
730
+                }
731
+            }
732
+        }
733
+
734
+        /**
735
+         * Get the fonts directory local path.
736
+         *
737
+         * @since 1.1.0
738
+         *
739
+         * @param string Fonts directory local path.
740
+         */
741
+        public function get_fonts_dir() {
742
+            $upload_dir = wp_upload_dir( null, false );
743
+
744
+            return $upload_dir['basedir'] . DIRECTORY_SEPARATOR .  'ayefonts' . DIRECTORY_SEPARATOR . 'fa' . DIRECTORY_SEPARATOR;
745
+        }
746
+
747
+        /**
748
+         * Get the fonts directory local url.
749
+         *
750
+         * @since 1.1.0
751
+         *
752
+         * @param string Fonts directory local url.
753
+         */
754
+        public function get_fonts_url() {
755
+            $upload_dir = wp_upload_dir( null, false );
756
+
757
+            return $upload_dir['baseurl'] .  '/ayefonts/fa/';
758
+        }
759
+
760
+        /**
761
+         * Check whether load locally active.
762
+         *
763
+         * @since 1.1.0
764
+         *
765
+         * @return bool True if active else false.
766
+         */
767
+        public function has_local() {
768
+            if ( ! empty( $this->settings['local'] ) && empty( $this->settings['pro'] ) && file_exists( $this->get_fonts_dir() . 'css' . DIRECTORY_SEPARATOR . 'all.css' ) ) {
769
+                return true;
770
+            }
771
+
772
+            return false;
773
+        }
774
+
775
+        /**
776
+         * Get the WP Filesystem access.
777
+         *
778
+         * @since 1.1.0
779
+         *
780
+         * @return object The WP Filesystem.
781
+         */
782
+        public function get_wp_filesystem() {
783
+            if ( ! function_exists( 'get_filesystem_method' ) ) {
784
+                require_once( ABSPATH . "/wp-admin/includes/file.php" );
785
+            }
786
+
787
+            $access_type = get_filesystem_method();
788
+
789
+            if ( $access_type === 'direct' ) {
790
+                /* You can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
791
+                $creds = request_filesystem_credentials( trailingslashit( site_url() ) . 'wp-admin/', '', false, false, array() );
792
+
793
+                /* Initialize the API */
794
+                if ( ! WP_Filesystem( $creds ) ) {
795
+                    /* Any problems and we exit */
796
+                    return false;
797
+                }
798
+
799
+                global $wp_filesystem;
800
+
801
+                return $wp_filesystem;
802
+                /* Do our file manipulations below */
803
+            } else if ( defined( 'FTP_USER' ) ) {
804
+                $creds = request_filesystem_credentials( trailingslashit( site_url() ) . 'wp-admin/', '', false, false, array() );
805
+
806
+                /* Initialize the API */
807
+                if ( ! WP_Filesystem( $creds ) ) {
808
+                    /* Any problems and we exit */
809
+                    return false;
810
+                }
811
+
812
+                global $wp_filesystem;
813
+
814
+                return $wp_filesystem;
815
+            } else {
816
+                /* Don't have direct write access. Prompt user with our notice */
817
+                return false;
818
+            }
819
+        }
820
+
821
+        /**
822
+         * Download the fontawesome package file.
823
+         *
824
+         * @since 1.1.0
825
+         *
826
+         * @param mixed $version The font awesome.
827
+         * @param array $option Fontawesome settings.
828
+         * @return WP_ERROR|bool Error on fail and true on success.
829
+         */
830
+        public function download_package( $version, $option = array() ) {
831
+            $filename = 'fontawesome-free-' . $version . '-web';
832
+            $url = 'https://use.fontawesome.com/releases/v' . $version . '/' . $filename . '.zip';
833
+
834
+            if ( ! function_exists( 'wp_handle_upload' ) ) {
835
+                require_once ABSPATH . 'wp-admin/includes/file.php';
836
+            }
837
+
838
+            $download_file = download_url( esc_url_raw( $url ) );
839
+
840
+            if ( is_wp_error( $download_file ) ) {
841
+                return new WP_Error( 'fontawesome_download_failed', __( $download_file->get_error_message(), 'font-awesome-settings' ) );
842
+            } else if ( empty( $download_file ) ) {
843
+                return new WP_Error( 'fontawesome_download_failed', __( 'Something went wrong in downloading the font awesome to store locally.', 'font-awesome-settings' ) );
844
+            }
845
+
846
+            $response = $this->extract_package( $download_file, $filename, true );
847
+
848
+            // Update local version.
849
+            if ( is_wp_error( $response ) ) {
850
+                return $response;
851
+            } else if ( $response ) {
852
+                if ( empty( $option ) ) {
853
+                    $option = get_option( 'wp-font-awesome-settings' );
854
+                }
855
+
856
+                $option['local_version'] = $version;
857
+
858
+                // Remove action to prevent looping.
859
+                remove_action( 'update_option_wp-font-awesome-settings', array( $this, 'update_option_wp_font_awesome_settings' ), 10, 2 );
860
+
861
+                update_option( 'wp-font-awesome-settings', $option );
862
+
863
+                return true;
864
+            }
865
+
866
+            return false;
867
+        }
868
+
869
+        /**
870
+         * Extract the fontawesome package file.
871
+         *
872
+         * @since 1.1.0
873
+         *
874
+         * @param string $package The package file path.
875
+         * @param string $dirname Package file name.
876
+         * @param bool   $delete_package Delete temp file or not.
877
+         * @return WP_Error|bool True on success WP_Error on fail.
878
+         */
879
+        public function extract_package( $package, $dirname = '', $delete_package = false ) {
880
+            global $wp_filesystem;
881
+
882
+            $wp_filesystem = $this->get_wp_filesystem();
883
+
884
+            if ( empty( $wp_filesystem ) && isset( $wp_filesystem->errors ) && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
885
+                return new WP_Error( 'fontawesome_filesystem_error', __( $wp_filesystem->errors->get_error_message(), 'font-awesome-settings' ) );
886
+            } else if ( empty( $wp_filesystem ) ) {
887
+                return new WP_Error( 'fontawesome_filesystem_error', __( 'Failed to initialise WP_Filesystem while trying to download the Font Awesome package.', 'font-awesome-settings' ) );
888
+            }
889
+
890
+            $fonts_dir = $this->get_fonts_dir();
891
+            $fonts_tmp_dir = dirname( $fonts_dir ) . DIRECTORY_SEPARATOR . 'fa-tmp' . DIRECTORY_SEPARATOR;
892
+
893
+            if ( $wp_filesystem->is_dir( $fonts_tmp_dir ) ) {
894
+                $wp_filesystem->delete( $fonts_tmp_dir, true );
895
+            }
896
+
897
+            // Unzip package to working directory.
898
+            $result = unzip_file( $package, $fonts_tmp_dir );
899
+
900
+            if ( is_wp_error( $result ) ) {
901
+                $wp_filesystem->delete( $fonts_tmp_dir, true );
902
+
903
+                if ( 'incompatible_archive' === $result->get_error_code() ) {
904
+                    return new WP_Error( 'fontawesome_incompatible_archive', __( $result->get_error_message(), 'font-awesome-settings' ) );
905
+                }
906
+
907
+                return $result;
908
+            }
909
+
910
+            if ( $wp_filesystem->is_dir( $fonts_dir ) ) {
911
+                $wp_filesystem->delete( $fonts_dir, true );
912
+            }
913
+
914
+            $extract_dir = $fonts_tmp_dir;
915
+
916
+            if ( $dirname && $wp_filesystem->is_dir( $extract_dir . $dirname . DIRECTORY_SEPARATOR ) ) {
917
+                $extract_dir .= $dirname . DIRECTORY_SEPARATOR;
918
+            }
919
+
920
+            try {
921
+                $return = $wp_filesystem->move( $extract_dir, $fonts_dir, true );
922
+            } catch ( Exception $e ) {
923
+                $return = new WP_Error( 'fontawesome_move_package', __( 'Fail to move font awesome package!', 'font-awesome-settings' ) );
924
+            }
925
+
926
+            if ( $wp_filesystem->is_dir( $fonts_tmp_dir ) ) {
927
+                $wp_filesystem->delete( $fonts_tmp_dir, true );
928
+            }
929
+
930
+            // Once extracted, delete the package if required.
931
+            if ( $delete_package ) {
932
+                unlink( $package );
933
+            }
934
+
935
+            return $return;
936
+        }
937
+    }
938
+
939
+    /**
940
+     * Run the class if found.
941
+     */
942
+    WP_Font_Awesome_Settings::instance();
943 943
 }
Please login to merge, or discard this patch.
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.85";
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.85";
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   +1689 added lines, -1689 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,435 +21,435 @@  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.85';
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
-				}
119
-
120
-				add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
121
-
122
-				do_action( 'ayecode_ui_settings_loaded' );
123
-			}
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.85';
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
+                }
124 119
 
125
-			return self::$instance;
126
-		}
120
+                add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
127 121
 
128
-		/**
129
-		 * Add custom colors to the color selector.
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 ){
122
+                do_action( 'ayecode_ui_settings_loaded' );
123
+            }
138 124
 
125
+            return self::$instance;
126
+        }
139 127
 
140
-			$setting = wp_get_global_settings();
128
+        /**
129
+         * Add custom colors to the color selector.
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 ){
141 138
 
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
-
148
-			return $theme_colors;
149
-		}
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
-			}
220
-
221
-		}
222
-
223
-		public static function get_colors( $original = false){
224
-
225
-			if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
226
-				return array();
227
-			}
228
-			if ( $original ) {
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,
246
-				);
247
-			}
248
-
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,
266
-			);
267
-		}
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
-			}
284 139
 
285
-			$this->constants();
286
-			$this->settings = $this->get_settings();
287
-			$this->url = $this->get_url();
140
+            $setting = wp_get_global_settings();
288 141
 
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
-			}
320
-
321
-		}
322
-
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
-		}
332
-
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
-
362
-		/**
363
-		 * Check if the current admin screen should load scripts.
364
-		 *
365
-		 * @return bool
366
-		 */
367
-		public function is_aui_screen(){
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
+
148
+            return $theme_colors;
149
+        }
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
+            }
220
+
221
+        }
222
+
223
+        public static function get_colors( $original = false){
224
+
225
+            if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
226
+                return array();
227
+            }
228
+            if ( $original ) {
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,
246
+                );
247
+            }
248
+
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,
266
+            );
267
+        }
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
+            }
284
+
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
+            }
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
+            }
320
+
321
+        }
322
+
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
+        }
332
+
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
+
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
-		/**
403
-		 * Check if the current theme is a block theme.
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
-			}
402
+        /**
403
+         * Check if the current theme is a block theme.
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 411
 
412
-			return false;
413
-		}
412
+            return false;
413
+        }
414 414
 
415
-		/**
416
-		 * Adds the styles.
417
-		 */
418
-		public function enqueue_style() {
415
+        /**
416
+         * Adds the styles.
417
+         */
418
+        public function enqueue_style() {
419 419
 
420 420
 
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';
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 425
 
426
-				$rtl = is_rtl() ? '-rtl' : '';
426
+                $rtl = is_rtl() ? '-rtl' : '';
427 427
 
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';
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 431
 
432 432
 
433 433
 
434
-					wp_register_style( 'ayecode-ui', $url, array(), $this->version );
435
-					wp_enqueue_style( 'ayecode-ui' );
434
+                    wp_register_style( 'ayecode-ui', $url, array(), $this->version );
435
+                    wp_enqueue_style( 'ayecode-ui' );
436 436
 
437
-					$current_screen = function_exists('get_current_screen' ) ? get_current_screen() : '';
437
+                    $current_screen = function_exists('get_current_screen' ) ? get_current_screen() : '';
438 438
 
439 439
 //					if ( is_admin() && !empty($_REQUEST['postType']) ) {
440
-					if ( is_admin() && ( !empty($_REQUEST['postType']) || $current_screen->is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) )  ) {
441
-						$url = $this->url.'assets/css/ayecode-ui-fse.css';
442
-						wp_register_style( 'ayecode-ui-fse', $url, array(), $this->version );
443
-						wp_enqueue_style( 'ayecode-ui-fse' );
444
-					}
440
+                    if ( is_admin() && ( !empty($_REQUEST['postType']) || $current_screen->is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) )  ) {
441
+                        $url = $this->url.'assets/css/ayecode-ui-fse.css';
442
+                        wp_register_style( 'ayecode-ui-fse', $url, array(), $this->version );
443
+                        wp_enqueue_style( 'ayecode-ui-fse' );
444
+                    }
445 445
 
446 446
 
447
-					// flatpickr
448
-					wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->version );
447
+                    // flatpickr
448
+                    wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->version );
449 449
 
450
-					// fix some wp-admin issues
451
-					if(is_admin()){
452
-						$custom_css = "
450
+                    // fix some wp-admin issues
451
+                    if(is_admin()){
452
+                        $custom_css = "
453 453
                 body{
454 454
                     background-color: #f1f1f1;
455 455
                     font-family: -apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif;
@@ -495,35 +495,35 @@  discard block
 block discarded – undo
495 495
 				}
496 496
                 ";
497 497
 
498
-						// @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
499
-						$custom_css .= "
498
+                        // @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
499
+                        $custom_css .= "
500 500
 						.edit-post-sidebar input[type=color].components-text-control__input{
501 501
 						    padding: 0;
502 502
 						}
503 503
 					";
504
-						wp_add_inline_style( 'ayecode-ui', $custom_css );
505
-					}
504
+                        wp_add_inline_style( 'ayecode-ui', $custom_css );
505
+                    }
506 506
 
507
-					// custom changes
508
-					wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
507
+                    // custom changes
508
+                    wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
509 509
 
510
-				}
511
-			}
510
+                }
511
+            }
512 512
 
513 513
 
514
-		}
514
+        }
515 515
 
516
-		/**
517
-		 * Get inline script used if bootstrap enqueued
518
-		 *
519
-		 * If this remains small then its best to use this than to add another JS file.
520
-		 */
521
-		public function inline_script() {
522
-			// Flatpickr calendar locale
523
-			$flatpickr_locale = self::flatpickr_locale();
516
+        /**
517
+         * Get inline script used if bootstrap enqueued
518
+         *
519
+         * If this remains small then its best to use this than to add another JS file.
520
+         */
521
+        public function inline_script() {
522
+            // Flatpickr calendar locale
523
+            $flatpickr_locale = self::flatpickr_locale();
524 524
 
525
-			ob_start();
526
-			?>
525
+            ob_start();
526
+            ?>
527 527
             <script>
528 528
                 /**
529 529
                  * An AUI bootstrap adaptation of GreedyNav.js ( by Luke Jackson ).
@@ -1460,8 +1460,8 @@  discard block
 block discarded – undo
1460 1460
                 aui_set_data_scroll();
1461 1461
 
1462 1462
 				<?php
1463
-				// FSE tweaks.
1464
-				if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template'){ ?>
1463
+                // FSE tweaks.
1464
+                if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template'){ ?>
1465 1465
                 function aui_fse_set_data_scroll() {
1466 1466
                     console.log('init scroll');
1467 1467
                     let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas");
@@ -1494,29 +1494,29 @@  discard block
 block discarded – undo
1494 1494
 
1495 1495
             </script>
1496 1496
 			<?php
1497
-			$output = ob_get_clean();
1497
+            $output = ob_get_clean();
1498 1498
 
1499 1499
 
1500 1500
 
1501
-			/*
1501
+            /*
1502 1502
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1503 1503
 			 */
1504
-			return str_replace( array(
1505
-				'<script>',
1506
-				'</script>'
1507
-			), '', self::minify_js($output) );
1508
-		}
1509
-
1510
-
1511
-		/**
1512
-		 * JS to help with conflict issues with other plugins and themes using bootstrap v3.
1513
-		 *
1514
-		 * @TODO we may need this when other conflicts arrise.
1515
-		 * @return mixed
1516
-		 */
1517
-		public static function bs3_compat_js() {
1518
-			ob_start();
1519
-			?>
1504
+            return str_replace( array(
1505
+                '<script>',
1506
+                '</script>'
1507
+            ), '', self::minify_js($output) );
1508
+        }
1509
+
1510
+
1511
+        /**
1512
+         * JS to help with conflict issues with other plugins and themes using bootstrap v3.
1513
+         *
1514
+         * @TODO we may need this when other conflicts arrise.
1515
+         * @return mixed
1516
+         */
1517
+        public static function bs3_compat_js() {
1518
+            ob_start();
1519
+            ?>
1520 1520
             <script>
1521 1521
 				<?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?>
1522 1522
                 /* With Avada builder */
@@ -1524,20 +1524,20 @@  discard block
 block discarded – undo
1524 1524
 				<?php } ?>
1525 1525
             </script>
1526 1526
 			<?php
1527
-			return str_replace( array(
1528
-				'<script>',
1529
-				'</script>'
1530
-			), '', ob_get_clean());
1531
-		}
1532
-
1533
-		/**
1534
-		 * Get inline script used if bootstrap file browser enqueued.
1535
-		 *
1536
-		 * If this remains small then its best to use this than to add another JS file.
1537
-		 */
1538
-		public function inline_script_file_browser(){
1539
-			ob_start();
1540
-			?>
1527
+            return str_replace( array(
1528
+                '<script>',
1529
+                '</script>'
1530
+            ), '', ob_get_clean());
1531
+        }
1532
+
1533
+        /**
1534
+         * Get inline script used if bootstrap file browser enqueued.
1535
+         *
1536
+         * If this remains small then its best to use this than to add another JS file.
1537
+         */
1538
+        public function inline_script_file_browser(){
1539
+            ob_start();
1540
+            ?>
1541 1541
             <script>
1542 1542
                 // run on doc ready
1543 1543
                 jQuery(document).ready(function () {
@@ -1545,227 +1545,227 @@  discard block
 block discarded – undo
1545 1545
                 });
1546 1546
             </script>
1547 1547
 			<?php
1548
-			$output = ob_get_clean();
1548
+            $output = ob_get_clean();
1549 1549
 
1550
-			/*
1550
+            /*
1551 1551
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1552 1552
 			 */
1553
-			return str_replace( array(
1554
-				'<script>',
1555
-				'</script>'
1556
-			), '', $output );
1557
-		}
1558
-
1559
-		/**
1560
-		 * Adds the Font Awesome JS.
1561
-		 */
1562
-		public function enqueue_scripts() {
1563
-
1564
-			if( is_admin() && !$this->is_aui_screen()){
1565
-				// don't add wp-admin scripts if not requested to
1566
-			}else {
1567
-
1568
-				$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
1569
-
1570
-				// select2
1571
-				wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
1572
-
1573
-				// flatpickr
1574
-				wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version );
1575
-
1576
-				// flatpickr
1577
-				wp_register_script( 'iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version );
1578
-
1579
-				// Bootstrap file browser
1580
-				wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
1581
-				wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
1582
-
1583
-				$load_inline = false;
1584
-
1585
-				if ( $this->settings[ $js_setting ] == 'core-popper' ) {
1586
-					// Bootstrap bundle
1587
-					$url = $this->url . 'assets/js/bootstrap.bundle.min.js';
1588
-					wp_register_script( 'bootstrap-js-bundle', $url, array(
1589
-						'select2',
1590
-						'jquery'
1591
-					), $this->version, $this->is_bs3_compat() );
1592
-					// if in admin then add to footer for compatibility.
1593
-					is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
1594
-					$script = $this->inline_script();
1595
-					wp_add_inline_script( 'bootstrap-js-bundle', $script );
1596
-				} elseif ( $this->settings[ $js_setting ] == 'popper' ) {
1597
-					$url = $this->url . 'assets/js/popper.min.js';
1598
-					wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->version );
1599
-					wp_enqueue_script( 'bootstrap-js-popper' );
1600
-					$load_inline = true;
1601
-				} else {
1602
-					$load_inline = true;
1603
-				}
1604
-
1605
-				// Load needed inline scripts by faking the loading of a script if the main script is not being loaded
1606
-				if ( $load_inline ) {
1607
-					wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) );
1608
-					wp_enqueue_script( 'bootstrap-dummy' );
1609
-					$script = $this->inline_script();
1610
-					wp_add_inline_script( 'bootstrap-dummy', $script );
1611
-				}
1612
-			}
1613
-
1614
-		}
1615
-
1616
-		/**
1617
-		 * Enqueue flatpickr if called.
1618
-		 */
1619
-		public function enqueue_flatpickr(){
1620
-			wp_enqueue_style( 'flatpickr' );
1621
-			wp_enqueue_script( 'flatpickr' );
1622
-		}
1623
-
1624
-		/**
1625
-		 * Enqueue iconpicker if called.
1626
-		 */
1627
-		public function enqueue_iconpicker(){
1628
-			wp_enqueue_style( 'iconpicker' );
1629
-			wp_enqueue_script( 'iconpicker' );
1630
-		}
1631
-
1632
-		/**
1633
-		 * Get the url path to the current folder.
1634
-		 *
1635
-		 * @return string
1636
-		 */
1637
-		public function get_url() {
1638
-			$content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1639
-			$content_url = untrailingslashit( WP_CONTENT_URL );
1640
-
1641
-			// Replace http:// to https://.
1642
-			if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1643
-				$content_url = str_replace( 'http://', 'https://', $content_url );
1644
-			}
1645
-
1646
-			// Check if we are inside a plugin
1647
-			$file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1648
-			$url = str_replace( $content_dir, $content_url, $file_dir );
1649
-
1650
-			return trailingslashit( $url );
1651
-		}
1652
-
1653
-		/**
1654
-		 * Get the url path to the current folder.
1655
-		 *
1656
-		 * @return string
1657
-		 */
1658
-		public function get_url_old() {
1659
-
1660
-			$url = '';
1661
-			// check if we are inside a plugin
1662
-			$file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
1663
-
1664
-			// add check in-case user has changed wp-content dir name.
1665
-			$wp_content_folder_name = basename(WP_CONTENT_DIR);
1666
-			$dir_parts = explode("/$wp_content_folder_name/",$file_dir);
1667
-			$url_parts = explode("/$wp_content_folder_name/",plugins_url());
1668
-
1669
-			if(!empty($url_parts[0]) && !empty($dir_parts[1])){
1670
-				$url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
1671
-			}
1672
-
1673
-			return $url;
1674
-		}
1675
-
1676
-		/**
1677
-		 * Register the database settings with WordPress.
1678
-		 */
1679
-		public function register_settings() {
1680
-			register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
1681
-		}
1682
-
1683
-		/**
1684
-		 * Add the WordPress settings menu item.
1685
-		 * @since 1.0.10 Calling function name direct will fail theme check so we don't.
1686
-		 */
1687
-		public function menu_item() {
1688
-			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
1689
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
1690
-				$this,
1691
-				'settings_page'
1692
-			) );
1693
-		}
1694
-
1695
-		/**
1696
-		 * Get a list of themes and their default JS settings.
1697
-		 *
1698
-		 * @return array
1699
-		 */
1700
-		public function theme_js_settings(){
1701
-			return array(
1702
-				'ayetheme' => 'popper',
1703
-				'listimia' => 'required',
1704
-				'listimia_backend' => 'core-popper',
1705
-				//'avada'    => 'required', // removed as we now add compatibility
1706
-			);
1707
-		}
1708
-
1709
-		/**
1710
-		 * Get the current Font Awesome output settings.
1711
-		 *
1712
-		 * @return array The array of settings.
1713
-		 */
1714
-		public function get_settings() {
1715
-
1716
-			$db_settings = get_option( 'ayecode-ui-settings' );
1717
-			$js_default = 'core-popper';
1718
-			$js_default_backend = $js_default;
1719
-
1720
-			// maybe set defaults (if no settings set)
1721
-			if(empty($db_settings)){
1722
-				$active_theme = strtolower( get_template() ); // active parent theme.
1723
-				$theme_js_settings = self::theme_js_settings();
1724
-				if(isset($theme_js_settings[$active_theme])){
1725
-					$js_default = $theme_js_settings[$active_theme];
1726
-					$js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
1727
-				}
1728
-			}
1553
+            return str_replace( array(
1554
+                '<script>',
1555
+                '</script>'
1556
+            ), '', $output );
1557
+        }
1558
+
1559
+        /**
1560
+         * Adds the Font Awesome JS.
1561
+         */
1562
+        public function enqueue_scripts() {
1563
+
1564
+            if( is_admin() && !$this->is_aui_screen()){
1565
+                // don't add wp-admin scripts if not requested to
1566
+            }else {
1567
+
1568
+                $js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
1569
+
1570
+                // select2
1571
+                wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
1572
+
1573
+                // flatpickr
1574
+                wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version );
1575
+
1576
+                // flatpickr
1577
+                wp_register_script( 'iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version );
1578
+
1579
+                // Bootstrap file browser
1580
+                wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
1581
+                wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
1582
+
1583
+                $load_inline = false;
1584
+
1585
+                if ( $this->settings[ $js_setting ] == 'core-popper' ) {
1586
+                    // Bootstrap bundle
1587
+                    $url = $this->url . 'assets/js/bootstrap.bundle.min.js';
1588
+                    wp_register_script( 'bootstrap-js-bundle', $url, array(
1589
+                        'select2',
1590
+                        'jquery'
1591
+                    ), $this->version, $this->is_bs3_compat() );
1592
+                    // if in admin then add to footer for compatibility.
1593
+                    is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
1594
+                    $script = $this->inline_script();
1595
+                    wp_add_inline_script( 'bootstrap-js-bundle', $script );
1596
+                } elseif ( $this->settings[ $js_setting ] == 'popper' ) {
1597
+                    $url = $this->url . 'assets/js/popper.min.js';
1598
+                    wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->version );
1599
+                    wp_enqueue_script( 'bootstrap-js-popper' );
1600
+                    $load_inline = true;
1601
+                } else {
1602
+                    $load_inline = true;
1603
+                }
1729 1604
 
1730
-			/**
1731
-			 * Filter the default settings.
1732
-			 */
1733
-			$defaults = apply_filters( 'ayecode-ui-default-settings', array(
1734
-				'css'            => 'compatibility', // core, compatibility
1735
-				'js'             => $js_default, // js to load, core-popper, popper
1736
-				'html_font_size' => '16', // js to load, core-popper, popper
1737
-				'css_backend'    => 'compatibility', // core, compatibility
1738
-				'js_backend'     => $js_default_backend, // js to load, core-popper, popper
1739
-				'disable_admin'  => '', // URL snippets to disable loading on admin
1740
-			), $db_settings );
1741
-
1742
-			$settings = wp_parse_args( $db_settings, $defaults );
1743
-
1744
-			/**
1745
-			 * Filter the Bootstrap settings.
1746
-			 *
1747
-			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
1748
-			 */
1749
-			return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
1750
-		}
1751
-
1752
-
1753
-		/**
1754
-		 * The settings page html output.
1755
-		 */
1756
-		public function settings_page() {
1757
-			if ( ! current_user_can( 'manage_options' ) ) {
1758
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
1759
-			}
1760
-			?>
1605
+                // Load needed inline scripts by faking the loading of a script if the main script is not being loaded
1606
+                if ( $load_inline ) {
1607
+                    wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) );
1608
+                    wp_enqueue_script( 'bootstrap-dummy' );
1609
+                    $script = $this->inline_script();
1610
+                    wp_add_inline_script( 'bootstrap-dummy', $script );
1611
+                }
1612
+            }
1613
+
1614
+        }
1615
+
1616
+        /**
1617
+         * Enqueue flatpickr if called.
1618
+         */
1619
+        public function enqueue_flatpickr(){
1620
+            wp_enqueue_style( 'flatpickr' );
1621
+            wp_enqueue_script( 'flatpickr' );
1622
+        }
1623
+
1624
+        /**
1625
+         * Enqueue iconpicker if called.
1626
+         */
1627
+        public function enqueue_iconpicker(){
1628
+            wp_enqueue_style( 'iconpicker' );
1629
+            wp_enqueue_script( 'iconpicker' );
1630
+        }
1631
+
1632
+        /**
1633
+         * Get the url path to the current folder.
1634
+         *
1635
+         * @return string
1636
+         */
1637
+        public function get_url() {
1638
+            $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1639
+            $content_url = untrailingslashit( WP_CONTENT_URL );
1640
+
1641
+            // Replace http:// to https://.
1642
+            if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1643
+                $content_url = str_replace( 'http://', 'https://', $content_url );
1644
+            }
1645
+
1646
+            // Check if we are inside a plugin
1647
+            $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1648
+            $url = str_replace( $content_dir, $content_url, $file_dir );
1649
+
1650
+            return trailingslashit( $url );
1651
+        }
1652
+
1653
+        /**
1654
+         * Get the url path to the current folder.
1655
+         *
1656
+         * @return string
1657
+         */
1658
+        public function get_url_old() {
1659
+
1660
+            $url = '';
1661
+            // check if we are inside a plugin
1662
+            $file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
1663
+
1664
+            // add check in-case user has changed wp-content dir name.
1665
+            $wp_content_folder_name = basename(WP_CONTENT_DIR);
1666
+            $dir_parts = explode("/$wp_content_folder_name/",$file_dir);
1667
+            $url_parts = explode("/$wp_content_folder_name/",plugins_url());
1668
+
1669
+            if(!empty($url_parts[0]) && !empty($dir_parts[1])){
1670
+                $url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
1671
+            }
1672
+
1673
+            return $url;
1674
+        }
1675
+
1676
+        /**
1677
+         * Register the database settings with WordPress.
1678
+         */
1679
+        public function register_settings() {
1680
+            register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
1681
+        }
1682
+
1683
+        /**
1684
+         * Add the WordPress settings menu item.
1685
+         * @since 1.0.10 Calling function name direct will fail theme check so we don't.
1686
+         */
1687
+        public function menu_item() {
1688
+            $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
1689
+            call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
1690
+                $this,
1691
+                'settings_page'
1692
+            ) );
1693
+        }
1694
+
1695
+        /**
1696
+         * Get a list of themes and their default JS settings.
1697
+         *
1698
+         * @return array
1699
+         */
1700
+        public function theme_js_settings(){
1701
+            return array(
1702
+                'ayetheme' => 'popper',
1703
+                'listimia' => 'required',
1704
+                'listimia_backend' => 'core-popper',
1705
+                //'avada'    => 'required', // removed as we now add compatibility
1706
+            );
1707
+        }
1708
+
1709
+        /**
1710
+         * Get the current Font Awesome output settings.
1711
+         *
1712
+         * @return array The array of settings.
1713
+         */
1714
+        public function get_settings() {
1715
+
1716
+            $db_settings = get_option( 'ayecode-ui-settings' );
1717
+            $js_default = 'core-popper';
1718
+            $js_default_backend = $js_default;
1719
+
1720
+            // maybe set defaults (if no settings set)
1721
+            if(empty($db_settings)){
1722
+                $active_theme = strtolower( get_template() ); // active parent theme.
1723
+                $theme_js_settings = self::theme_js_settings();
1724
+                if(isset($theme_js_settings[$active_theme])){
1725
+                    $js_default = $theme_js_settings[$active_theme];
1726
+                    $js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
1727
+                }
1728
+            }
1729
+
1730
+            /**
1731
+             * Filter the default settings.
1732
+             */
1733
+            $defaults = apply_filters( 'ayecode-ui-default-settings', array(
1734
+                'css'            => 'compatibility', // core, compatibility
1735
+                'js'             => $js_default, // js to load, core-popper, popper
1736
+                'html_font_size' => '16', // js to load, core-popper, popper
1737
+                'css_backend'    => 'compatibility', // core, compatibility
1738
+                'js_backend'     => $js_default_backend, // js to load, core-popper, popper
1739
+                'disable_admin'  => '', // URL snippets to disable loading on admin
1740
+            ), $db_settings );
1741
+
1742
+            $settings = wp_parse_args( $db_settings, $defaults );
1743
+
1744
+            /**
1745
+             * Filter the Bootstrap settings.
1746
+             *
1747
+             * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
1748
+             */
1749
+            return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
1750
+        }
1751
+
1752
+
1753
+        /**
1754
+         * The settings page html output.
1755
+         */
1756
+        public function settings_page() {
1757
+            if ( ! current_user_can( 'manage_options' ) ) {
1758
+                wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
1759
+            }
1760
+            ?>
1761 1761
             <div class="wrap">
1762 1762
                 <h1><?php echo $this->name; ?></h1>
1763 1763
                 <p><?php echo apply_filters( 'ayecode-ui-settings-message', __("Here you can adjust settings if you are having compatibility issues.",'aui') );?></p>
1764 1764
                 <form method="post" action="options.php">
1765 1765
 					<?php
1766
-					settings_fields( 'ayecode-ui-settings' );
1767
-					do_settings_sections( 'ayecode-ui-settings' );
1768
-					?>
1766
+                    settings_fields( 'ayecode-ui-settings' );
1767
+                    do_settings_sections( 'ayecode-ui-settings' );
1768
+                    ?>
1769 1769
 
1770 1770
                     <h2><?php _e( 'Frontend', 'aui' ); ?></h2>
1771 1771
                     <table class="form-table wpbs-table-settings">
@@ -1845,60 +1845,60 @@  discard block
 block discarded – undo
1845 1845
                     </table>
1846 1846
 
1847 1847
 					<?php
1848
-					submit_button();
1849
-					?>
1848
+                    submit_button();
1849
+                    ?>
1850 1850
                 </form>
1851 1851
 
1852 1852
                 <div id="wpbs-version"><?php echo $this->version; ?></div>
1853 1853
             </div>
1854 1854
 
1855 1855
 			<?php
1856
-		}
1857
-
1858
-		public function customizer_settings($wp_customize){
1859
-			$wp_customize->add_section('aui_settings', array(
1860
-				'title'    => __('AyeCode UI','aui'),
1861
-				'priority' => 120,
1862
-			));
1863
-
1864
-			//  =============================
1865
-			//  = Color Picker              =
1866
-			//  =============================
1867
-			$wp_customize->add_setting('aui_options[color_primary]', array(
1868
-				'default'           => AUI_PRIMARY_COLOR,
1869
-				'sanitize_callback' => 'sanitize_hex_color',
1870
-				'capability'        => 'edit_theme_options',
1871
-				'type'              => 'option',
1872
-				'transport'         => 'refresh',
1873
-			));
1874
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1875
-				'label'    => __('Primary Color','aui'),
1876
-				'section'  => 'aui_settings',
1877
-				'settings' => 'aui_options[color_primary]',
1878
-			)));
1879
-
1880
-			$wp_customize->add_setting('aui_options[color_secondary]', array(
1881
-				'default'           => '#6c757d',
1882
-				'sanitize_callback' => 'sanitize_hex_color',
1883
-				'capability'        => 'edit_theme_options',
1884
-				'type'              => 'option',
1885
-				'transport'         => 'refresh',
1886
-			));
1887
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1888
-				'label'    => __('Secondary Color','aui'),
1889
-				'section'  => 'aui_settings',
1890
-				'settings' => 'aui_options[color_secondary]',
1891
-			)));
1892
-		}
1893
-
1894
-		/**
1895
-		 * CSS to help with conflict issues with other plugins and themes using bootstrap v3.
1896
-		 *
1897
-		 * @return mixed
1898
-		 */
1899
-		public static function bs3_compat_css() {
1900
-			ob_start();
1901
-			?>
1856
+        }
1857
+
1858
+        public function customizer_settings($wp_customize){
1859
+            $wp_customize->add_section('aui_settings', array(
1860
+                'title'    => __('AyeCode UI','aui'),
1861
+                'priority' => 120,
1862
+            ));
1863
+
1864
+            //  =============================
1865
+            //  = Color Picker              =
1866
+            //  =============================
1867
+            $wp_customize->add_setting('aui_options[color_primary]', array(
1868
+                'default'           => AUI_PRIMARY_COLOR,
1869
+                'sanitize_callback' => 'sanitize_hex_color',
1870
+                'capability'        => 'edit_theme_options',
1871
+                'type'              => 'option',
1872
+                'transport'         => 'refresh',
1873
+            ));
1874
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1875
+                'label'    => __('Primary Color','aui'),
1876
+                'section'  => 'aui_settings',
1877
+                'settings' => 'aui_options[color_primary]',
1878
+            )));
1879
+
1880
+            $wp_customize->add_setting('aui_options[color_secondary]', array(
1881
+                'default'           => '#6c757d',
1882
+                'sanitize_callback' => 'sanitize_hex_color',
1883
+                'capability'        => 'edit_theme_options',
1884
+                'type'              => 'option',
1885
+                'transport'         => 'refresh',
1886
+            ));
1887
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1888
+                'label'    => __('Secondary Color','aui'),
1889
+                'section'  => 'aui_settings',
1890
+                'settings' => 'aui_options[color_secondary]',
1891
+            )));
1892
+        }
1893
+
1894
+        /**
1895
+         * CSS to help with conflict issues with other plugins and themes using bootstrap v3.
1896
+         *
1897
+         * @return mixed
1898
+         */
1899
+        public static function bs3_compat_css() {
1900
+            ob_start();
1901
+            ?>
1902 1902
             <style>
1903 1903
                 /* Bootstrap 3 compatibility */
1904 1904
                 body.modal-open .modal-backdrop.show:not(.in) {opacity:0.5;}
@@ -1927,825 +1927,825 @@  discard block
 block discarded – undo
1927 1927
                 <?php } ?>
1928 1928
             </style>
1929 1929
 			<?php
1930
-			return str_replace( array(
1931
-				'<style>',
1932
-				'</style>'
1933
-			), '', self::minify_css( ob_get_clean() ) );
1934
-		}
1935
-
1936
-
1937
-		public static function custom_css($compatibility = true) {
1938
-			$colors = array();
1939
-			if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
1940
-
1941
-				$setting = wp_get_global_settings();
1942
-				if(!empty($setting['color']['palette']['theme'])){
1943
-					foreach($setting['color']['palette']['theme'] as $color){
1944
-						$colors[$color['slug']] = esc_attr($color['color']);
1945
-					}
1946
-				}
1930
+            return str_replace( array(
1931
+                '<style>',
1932
+                '</style>'
1933
+            ), '', self::minify_css( ob_get_clean() ) );
1934
+        }
1947 1935
 
1948
-				if(!empty($setting['color']['palette']['custom'])){
1949
-					foreach($setting['color']['palette']['custom'] as $color){
1950
-						$colors[$color['slug']] = esc_attr($color['color']);
1951
-					}
1952
-				}
1953
-			}else{
1954
-				$settings = get_option('aui_options');
1955
-				$colors = array(
1956
-					'primary'   => ! empty( $settings['color_primary'] ) ? $settings['color_primary'] : AUI_PRIMARY_COLOR,
1957
-					'secondary' => ! empty( $settings['color_secondary'] ) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR
1958
-				);
1959
-			}
1960 1936
 
1961
-			ob_start();
1937
+        public static function custom_css($compatibility = true) {
1938
+            $colors = array();
1939
+            if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
1940
+
1941
+                $setting = wp_get_global_settings();
1942
+                if(!empty($setting['color']['palette']['theme'])){
1943
+                    foreach($setting['color']['palette']['theme'] as $color){
1944
+                        $colors[$color['slug']] = esc_attr($color['color']);
1945
+                    }
1946
+                }
1947
+
1948
+                if(!empty($setting['color']['palette']['custom'])){
1949
+                    foreach($setting['color']['palette']['custom'] as $color){
1950
+                        $colors[$color['slug']] = esc_attr($color['color']);
1951
+                    }
1952
+                }
1953
+            }else{
1954
+                $settings = get_option('aui_options');
1955
+                $colors = array(
1956
+                    'primary'   => ! empty( $settings['color_primary'] ) ? $settings['color_primary'] : AUI_PRIMARY_COLOR,
1957
+                    'secondary' => ! empty( $settings['color_secondary'] ) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR
1958
+                );
1959
+            }
1962 1960
 
1963
-			?>
1961
+            ob_start();
1962
+
1963
+            ?>
1964 1964
             <style>
1965 1965
                 <?php
1966 1966
 
1967
-					// BS v3 compat
1968
-					if( self::is_bs3_compat() ){
1969
-						echo self::bs3_compat_css();
1970
-					}
1967
+                    // BS v3 compat
1968
+                    if( self::is_bs3_compat() ){
1969
+                        echo self::bs3_compat_css();
1970
+                    }
1971 1971
 
1972
-					if(!empty($colors)){
1973
-						$d_colors = self::get_colors(true);
1974
-						//print_r($d_colors );exit;
1972
+                    if(!empty($colors)){
1973
+                        $d_colors = self::get_colors(true);
1974
+                        //print_r($d_colors );exit;
1975 1975
 //                        print_r($colors );exit;
1976
-						$is_fse = !empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template';
1977
-						foreach($colors as $key => $color ){
1978
-							if((empty( $d_colors[$key]) ||  $d_colors[$key] != $color) || $is_fse ) {
1979
-								$var = $is_fse ? "var(--wp--preset--color--$key)" : $color;
1980
-								$compat = $is_fse ? '.editor-styles-wrapper' : $compatibility;
1981
-								echo self::css_overwrite($key,$var,$compat);
1982
-							}
1983
-						}
1984
-					   // exit;
1985
-					}
1976
+                        $is_fse = !empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template';
1977
+                        foreach($colors as $key => $color ){
1978
+                            if((empty( $d_colors[$key]) ||  $d_colors[$key] != $color) || $is_fse ) {
1979
+                                $var = $is_fse ? "var(--wp--preset--color--$key)" : $color;
1980
+                                $compat = $is_fse ? '.editor-styles-wrapper' : $compatibility;
1981
+                                echo self::css_overwrite($key,$var,$compat);
1982
+                            }
1983
+                        }
1984
+                        // exit;
1985
+                    }
1986 1986
 
1987
-					// Set admin bar z-index lower when modal is open.
1988
-					echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}';
1987
+                    // Set admin bar z-index lower when modal is open.
1988
+                    echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}';
1989 1989
 
1990
-					if(is_admin()){
1991
-						echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}';
1992
-					}
1993
-				?>
1990
+                    if(is_admin()){
1991
+                        echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}';
1992
+                    }
1993
+                ?>
1994 1994
             </style>
1995 1995
 			<?php
1996 1996
 
1997 1997
 
1998
-			/*
1998
+            /*
1999 1999
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
2000 2000
 			 */
2001
-			return str_replace( array(
2002
-				'<style>',
2003
-				'</style>'
2004
-			), '', self::minify_css( ob_get_clean() ) );
2005
-		}
2006
-
2007
-
2008
-
2009
-		/**
2010
-		 * Check if we should add booststrap 3 compatibility changes.
2011
-		 *
2012
-		 * @return bool
2013
-		 */
2014
-		public static function is_bs3_compat(){
2015
-			return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
2016
-		}
2017
-
2018
-		/**
2019
-		 * Build the CSS to overwrite a bootstrap color variable.
2020
-		 *
2021
-		 * @param $type
2022
-		 * @param $color_code
2023
-		 * @param $compatibility
2024
-		 *
2025
-		 * @return string
2026
-		 */
2027
-		public static function css_overwrite($type,$color_code,$compatibility){
2028
-
2029
-			$is_var = false;
2030
-			if(!$color_code){return '';}
2031
-			if(!sanitize_hex_color($color_code)){
2032
-				$color_code = esc_attr($color_code);
2033
-				$is_var = true;
2001
+            return str_replace( array(
2002
+                '<style>',
2003
+                '</style>'
2004
+            ), '', self::minify_css( ob_get_clean() ) );
2005
+        }
2006
+
2007
+
2008
+
2009
+        /**
2010
+         * Check if we should add booststrap 3 compatibility changes.
2011
+         *
2012
+         * @return bool
2013
+         */
2014
+        public static function is_bs3_compat(){
2015
+            return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
2016
+        }
2017
+
2018
+        /**
2019
+         * Build the CSS to overwrite a bootstrap color variable.
2020
+         *
2021
+         * @param $type
2022
+         * @param $color_code
2023
+         * @param $compatibility
2024
+         *
2025
+         * @return string
2026
+         */
2027
+        public static function css_overwrite($type,$color_code,$compatibility){
2028
+
2029
+            $is_var = false;
2030
+            if(!$color_code){return '';}
2031
+            if(!sanitize_hex_color($color_code)){
2032
+                $color_code = esc_attr($color_code);
2033
+                $is_var = true;
2034 2034
 //                echo '###1'.$color_code;//exit;
2035
-			}
2036
-			if(!$color_code){return '';}
2035
+            }
2036
+            if(!$color_code){return '';}
2037 2037
 
2038
-			if($compatibility===true || $compatibility===1){
2039
-				$compatibility = '.bsui';
2040
-			}elseif(!$compatibility){
2041
-				$compatibility = '';
2042
-			}else{
2043
-				$compatibility = esc_attr($compatibility);
2044
-			}
2038
+            if($compatibility===true || $compatibility===1){
2039
+                $compatibility = '.bsui';
2040
+            }elseif(!$compatibility){
2041
+                $compatibility = '';
2042
+            }else{
2043
+                $compatibility = esc_attr($compatibility);
2044
+            }
2045 2045
 
2046 2046
 //            echo '####'.$color_code;exit;
2047 2047
 
2048
-			$type = sanitize_html_class($type);
2049
-
2050
-			/**
2051
-			 * c = color, b = background color, o = border-color, f = fill
2052
-			 */
2053
-			$selectors = array(
2054
-				".btn-{$type}"                                              => array( 'b', 'o' ),
2055
-				".btn-{$type}.disabled"                                     => array( 'b', 'o' ),
2056
-				".btn-{$type}:disabled"                                     => array( 'b', 'o' ),
2057
-				".btn-outline-{$type}"                                      => array( 'c', 'o' ),
2058
-				".btn-outline-{$type}:hover"                                => array( 'b', 'o' ),
2059
-				".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ),
2060
-				".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ),
2061
-				".show>.btn-outline-{$type}.dropdown-toggle"                => array( 'b', 'o' ),
2062
-				".badge-{$type}"                                            => array( 'b' ),
2063
-				".alert-{$type}"                                            => array( 'b', 'o' ),
2064
-				".bg-{$type}"                                               => array( 'b', 'f' ),
2065
-				".btn-link.btn-{$type}"                                     => array( 'c' ),
2066
-			);
2067
-
2068
-			if ( $type == 'primary' ) {
2069
-				$selectors = $selectors + array(
2070
-						'a'                                                                                                    => array( 'c' ),
2071
-						'.btn-link'                                                                                            => array( 'c' ),
2072
-						'.dropdown-item.active'                                                                                => array( 'b' ),
2073
-						'.custom-control-input:checked~.custom-control-label::before'                                          => array(
2074
-							'b',
2075
-							'o'
2076
-						),
2077
-						'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before'                   => array(
2078
-							'b',
2079
-							'o'
2080
-						),
2081
-						'.nav-pills .nav-link.active'                                                                          => array( 'b' ),
2082
-						'.nav-pills .show>.nav-link'                                                                           => array( 'b' ),
2083
-						'.page-link'                                                                                           => array( 'c' ),
2084
-						'.page-item.active .page-link'                                                                         => array(
2085
-							'b',
2086
-							'o'
2087
-						),
2088
-						'.progress-bar'                                                                                        => array( 'b' ),
2089
-						'.list-group-item.active'                                                                              => array(
2090
-							'b',
2091
-							'o'
2092
-						),
2093
-						'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ),
2048
+            $type = sanitize_html_class($type);
2049
+
2050
+            /**
2051
+             * c = color, b = background color, o = border-color, f = fill
2052
+             */
2053
+            $selectors = array(
2054
+                ".btn-{$type}"                                              => array( 'b', 'o' ),
2055
+                ".btn-{$type}.disabled"                                     => array( 'b', 'o' ),
2056
+                ".btn-{$type}:disabled"                                     => array( 'b', 'o' ),
2057
+                ".btn-outline-{$type}"                                      => array( 'c', 'o' ),
2058
+                ".btn-outline-{$type}:hover"                                => array( 'b', 'o' ),
2059
+                ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ),
2060
+                ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ),
2061
+                ".show>.btn-outline-{$type}.dropdown-toggle"                => array( 'b', 'o' ),
2062
+                ".badge-{$type}"                                            => array( 'b' ),
2063
+                ".alert-{$type}"                                            => array( 'b', 'o' ),
2064
+                ".bg-{$type}"                                               => array( 'b', 'f' ),
2065
+                ".btn-link.btn-{$type}"                                     => array( 'c' ),
2066
+            );
2067
+
2068
+            if ( $type == 'primary' ) {
2069
+                $selectors = $selectors + array(
2070
+                        'a'                                                                                                    => array( 'c' ),
2071
+                        '.btn-link'                                                                                            => array( 'c' ),
2072
+                        '.dropdown-item.active'                                                                                => array( 'b' ),
2073
+                        '.custom-control-input:checked~.custom-control-label::before'                                          => array(
2074
+                            'b',
2075
+                            'o'
2076
+                        ),
2077
+                        '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before'                   => array(
2078
+                            'b',
2079
+                            'o'
2080
+                        ),
2081
+                        '.nav-pills .nav-link.active'                                                                          => array( 'b' ),
2082
+                        '.nav-pills .show>.nav-link'                                                                           => array( 'b' ),
2083
+                        '.page-link'                                                                                           => array( 'c' ),
2084
+                        '.page-item.active .page-link'                                                                         => array(
2085
+                            'b',
2086
+                            'o'
2087
+                        ),
2088
+                        '.progress-bar'                                                                                        => array( 'b' ),
2089
+                        '.list-group-item.active'                                                                              => array(
2090
+                            'b',
2091
+                            'o'
2092
+                        ),
2093
+                        '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ),
2094 2094
 //				    '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
2095 2095
 //				    '.custom-range::-moz-range-thumb' => array('b'),
2096 2096
 //				    '.custom-range::-ms-thumb' => array('b'),
2097
-					);
2098
-			}
2099
-
2100
-			$important_selectors = array(
2101
-				".bg-{$type}" => array('b','f'),
2102
-				".border-{$type}" => array('o'),
2103
-				".text-{$type}" => array('c'),
2104
-			);
2105
-
2106
-			$color = array();
2107
-			$color_i = array();
2108
-			$background = array();
2109
-			$background_i = array();
2110
-			$border = array();
2111
-			$border_i = array();
2112
-			$fill = array();
2113
-			$fill_i = array();
2114
-
2115
-			$output = '';
2116
-
2117
-			// build rules into each type
2118
-			foreach($selectors as $selector => $types){
2119
-				$selector = $compatibility ? $compatibility . " ".$selector : $selector;
2120
-				$types = array_combine($types,$types);
2121
-				if(isset($types['c'])){$color[] = $selector;}
2122
-				if(isset($types['b'])){$background[] = $selector;}
2123
-				if(isset($types['o'])){$border[] = $selector;}
2124
-				if(isset($types['f'])){$fill[] = $selector;}
2125
-			}
2126
-
2127
-			// build rules into each type
2128
-			foreach($important_selectors as $selector => $types){
2129
-				$selector = $compatibility ? $compatibility . " ".$selector : $selector;
2130
-				$types = array_combine($types,$types);
2131
-				if(isset($types['c'])){$color_i[] = $selector;}
2132
-				if(isset($types['b'])){$background_i[] = $selector;}
2133
-				if(isset($types['o'])){$border_i[] = $selector;}
2134
-				if(isset($types['f'])){$fill_i[] = $selector;}
2135
-			}
2136
-
2137
-			// add any color rules
2138
-			if(!empty($color)){
2139
-				$output .= implode(",",$color) . "{color: $color_code;} ";
2140
-			}
2141
-			if(!empty($color_i)){
2142
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2143
-			}
2144
-
2145
-			// add any background color rules
2146
-			if(!empty($background)){
2147
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
2148
-			}
2149
-			if(!empty($background_i)){
2150
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2151
-			}
2152
-
2153
-			// add any border color rules
2154
-			if(!empty($border)){
2155
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
2156
-			}
2157
-			if(!empty($border_i)){
2158
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2159
-			}
2160
-
2161
-			// add any fill color rules
2162
-			if(!empty($fill)){
2163
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
2164
-			}
2165
-			if(!empty($fill_i)){
2166
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2167
-			}
2168
-
2169
-
2170
-			$prefix = $compatibility ? $compatibility . " " : "";
2171
-
2172
-			$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;' : '';
2173
-			// darken
2174
-			$darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075");
2175
-			$darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10");
2176
-			$darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125");
2177
-
2178
-			// lighten
2179
-			$lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25");
2180
-
2181
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
2182
-			$op_25 = $color_code."40"; // 25% opacity
2183
-
2184
-
2185
-			// button states
2186
-			$output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : '';
2187
-			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2097
+                    );
2098
+            }
2099
+
2100
+            $important_selectors = array(
2101
+                ".bg-{$type}" => array('b','f'),
2102
+                ".border-{$type}" => array('o'),
2103
+                ".text-{$type}" => array('c'),
2104
+            );
2105
+
2106
+            $color = array();
2107
+            $color_i = array();
2108
+            $background = array();
2109
+            $background_i = array();
2110
+            $border = array();
2111
+            $border_i = array();
2112
+            $fill = array();
2113
+            $fill_i = array();
2114
+
2115
+            $output = '';
2116
+
2117
+            // build rules into each type
2118
+            foreach($selectors as $selector => $types){
2119
+                $selector = $compatibility ? $compatibility . " ".$selector : $selector;
2120
+                $types = array_combine($types,$types);
2121
+                if(isset($types['c'])){$color[] = $selector;}
2122
+                if(isset($types['b'])){$background[] = $selector;}
2123
+                if(isset($types['o'])){$border[] = $selector;}
2124
+                if(isset($types['f'])){$fill[] = $selector;}
2125
+            }
2126
+
2127
+            // build rules into each type
2128
+            foreach($important_selectors as $selector => $types){
2129
+                $selector = $compatibility ? $compatibility . " ".$selector : $selector;
2130
+                $types = array_combine($types,$types);
2131
+                if(isset($types['c'])){$color_i[] = $selector;}
2132
+                if(isset($types['b'])){$background_i[] = $selector;}
2133
+                if(isset($types['o'])){$border_i[] = $selector;}
2134
+                if(isset($types['f'])){$fill_i[] = $selector;}
2135
+            }
2136
+
2137
+            // add any color rules
2138
+            if(!empty($color)){
2139
+                $output .= implode(",",$color) . "{color: $color_code;} ";
2140
+            }
2141
+            if(!empty($color_i)){
2142
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2143
+            }
2144
+
2145
+            // add any background color rules
2146
+            if(!empty($background)){
2147
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
2148
+            }
2149
+            if(!empty($background_i)){
2150
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2151
+            }
2152
+
2153
+            // add any border color rules
2154
+            if(!empty($border)){
2155
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
2156
+            }
2157
+            if(!empty($border_i)){
2158
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2159
+            }
2160
+
2161
+            // add any fill color rules
2162
+            if(!empty($fill)){
2163
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
2164
+            }
2165
+            if(!empty($fill_i)){
2166
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2167
+            }
2168
+
2169
+
2170
+            $prefix = $compatibility ? $compatibility . " " : "";
2171
+
2172
+            $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;' : '';
2173
+            // darken
2174
+            $darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075");
2175
+            $darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10");
2176
+            $darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125");
2177
+
2178
+            // lighten
2179
+            $lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25");
2180
+
2181
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
2182
+            $op_25 = $color_code."40"; // 25% opacity
2183
+
2184
+
2185
+            // button states
2186
+            $output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : '';
2187
+            $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2188 2188
 //			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000;    border-color: #000;} ";
2189
-			$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;} ";
2190
-			$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.";} ";
2191
-			$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;} ";
2192
-
2193
-			if ( $type == 'primary' ) {
2194
-				// dropdown's
2195
-				$output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2196
-
2197
-				// input states
2198
-				$output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
2199
-
2200
-				// page link
2201
-				$output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2202
-			}
2203
-
2204
-			return $output;
2205
-		}
2206
-
2207
-		/**
2208
-		 *
2209
-		 * @deprecated 0.1.76 Use css_overwrite()
2210
-		 *
2211
-		 * @param $color_code
2212
-		 * @param $compatibility
2213
-		 * @param $use_variable
2214
-		 *
2215
-		 * @return string
2216
-		 */
2217
-		public static function css_primary($color_code,$compatibility, $use_variable = false){
2218
-
2219
-			if(!$use_variable){
2220
-				$color_code = sanitize_hex_color($color_code);
2221
-				if(!$color_code){return '';}
2222
-			}
2223
-
2224
-			/**
2225
-			 * c = color, b = background color, o = border-color, f = fill
2226
-			 */
2227
-			$selectors = array(
2228
-				'a' => array('c'),
2229
-				'.btn-primary' => array('b','o'),
2230
-				'.btn-primary.disabled' => array('b','o'),
2231
-				'.btn-primary:disabled' => array('b','o'),
2232
-				'.btn-outline-primary' => array('c','o'),
2233
-				'.btn-outline-primary:hover' => array('b','o'),
2234
-				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
2235
-				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
2236
-				'.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
2237
-				'.btn-link' => array('c'),
2238
-				'.dropdown-item.active' => array('b'),
2239
-				'.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
2240
-				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
2189
+            $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;} ";
2190
+            $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.";} ";
2191
+            $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;} ";
2192
+
2193
+            if ( $type == 'primary' ) {
2194
+                // dropdown's
2195
+                $output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2196
+
2197
+                // input states
2198
+                $output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
2199
+
2200
+                // page link
2201
+                $output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2202
+            }
2203
+
2204
+            return $output;
2205
+        }
2206
+
2207
+        /**
2208
+         *
2209
+         * @deprecated 0.1.76 Use css_overwrite()
2210
+         *
2211
+         * @param $color_code
2212
+         * @param $compatibility
2213
+         * @param $use_variable
2214
+         *
2215
+         * @return string
2216
+         */
2217
+        public static function css_primary($color_code,$compatibility, $use_variable = false){
2218
+
2219
+            if(!$use_variable){
2220
+                $color_code = sanitize_hex_color($color_code);
2221
+                if(!$color_code){return '';}
2222
+            }
2223
+
2224
+            /**
2225
+             * c = color, b = background color, o = border-color, f = fill
2226
+             */
2227
+            $selectors = array(
2228
+                'a' => array('c'),
2229
+                '.btn-primary' => array('b','o'),
2230
+                '.btn-primary.disabled' => array('b','o'),
2231
+                '.btn-primary:disabled' => array('b','o'),
2232
+                '.btn-outline-primary' => array('c','o'),
2233
+                '.btn-outline-primary:hover' => array('b','o'),
2234
+                '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
2235
+                '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
2236
+                '.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
2237
+                '.btn-link' => array('c'),
2238
+                '.dropdown-item.active' => array('b'),
2239
+                '.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
2240
+                '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
2241 2241
 //				'.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
2242 2242
 //				'.custom-range::-moz-range-thumb' => array('b'),
2243 2243
 //				'.custom-range::-ms-thumb' => array('b'),
2244
-				'.nav-pills .nav-link.active' => array('b'),
2245
-				'.nav-pills .show>.nav-link' => array('b'),
2246
-				'.page-link' => array('c'),
2247
-				'.page-item.active .page-link' => array('b','o'),
2248
-				'.badge-primary' => array('b'),
2249
-				'.alert-primary' => array('b','o'),
2250
-				'.progress-bar' => array('b'),
2251
-				'.list-group-item.active' => array('b','o'),
2252
-				'.bg-primary' => array('b','f'),
2253
-				'.btn-link.btn-primary' => array('c'),
2254
-				'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
2255
-			);
2256
-
2257
-			$important_selectors = array(
2258
-				'.bg-primary' => array('b','f'),
2259
-				'.border-primary' => array('o'),
2260
-				'.text-primary' => array('c'),
2261
-			);
2262
-
2263
-			$color = array();
2264
-			$color_i = array();
2265
-			$background = array();
2266
-			$background_i = array();
2267
-			$border = array();
2268
-			$border_i = array();
2269
-			$fill = array();
2270
-			$fill_i = array();
2271
-
2272
-			$output = '';
2273
-
2274
-			// build rules into each type
2275
-			foreach($selectors as $selector => $types){
2276
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2277
-				$types = array_combine($types,$types);
2278
-				if(isset($types['c'])){$color[] = $selector;}
2279
-				if(isset($types['b'])){$background[] = $selector;}
2280
-				if(isset($types['o'])){$border[] = $selector;}
2281
-				if(isset($types['f'])){$fill[] = $selector;}
2282
-			}
2283
-
2284
-			// build rules into each type
2285
-			foreach($important_selectors as $selector => $types){
2286
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2287
-				$types = array_combine($types,$types);
2288
-				if(isset($types['c'])){$color_i[] = $selector;}
2289
-				if(isset($types['b'])){$background_i[] = $selector;}
2290
-				if(isset($types['o'])){$border_i[] = $selector;}
2291
-				if(isset($types['f'])){$fill_i[] = $selector;}
2292
-			}
2293
-
2294
-			// add any color rules
2295
-			if(!empty($color)){
2296
-				$output .= implode(",",$color) . "{color: $color_code;} ";
2297
-			}
2298
-			if(!empty($color_i)){
2299
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2300
-			}
2301
-
2302
-			// add any background color rules
2303
-			if(!empty($background)){
2304
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
2305
-			}
2306
-			if(!empty($background_i)){
2307
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2308
-			}
2309
-
2310
-			// add any border color rules
2311
-			if(!empty($border)){
2312
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
2313
-			}
2314
-			if(!empty($border_i)){
2315
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2316
-			}
2317
-
2318
-			// add any fill color rules
2319
-			if(!empty($fill)){
2320
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
2321
-			}
2322
-			if(!empty($fill_i)){
2323
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2324
-			}
2325
-
2326
-
2327
-			$prefix = $compatibility ? ".bsui " : "";
2328
-
2329
-			// darken
2330
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2331
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2332
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2333
-
2334
-			// lighten
2335
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2336
-
2337
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
2338
-			$op_25 = $color_code."40"; // 25% opacity
2339
-
2340
-
2341
-			// button states
2342
-			$output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2343
-			$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;} ";
2344
-			$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.";} ";
2345
-			$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;} ";
2346
-
2347
-
2348
-			// dropdown's
2349
-			$output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2350
-
2351
-
2352
-			// input states
2353
-			$output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
2354
-
2355
-			// page link
2356
-			$output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2357
-
2358
-			return $output;
2359
-		}
2360
-
2361
-		/**
2362
-		 *
2363
-		 * @deprecated 0.1.76 Use css_overwrite()
2364
-		 *
2365
-		 * @param $color_code
2366
-		 * @param $compatibility
2367
-		 *
2368
-		 * @return string
2369
-		 */
2370
-		public static function css_secondary($color_code,$compatibility){;
2371
-			$color_code = sanitize_hex_color($color_code);
2372
-			if(!$color_code){return '';}
2373
-			/**
2374
-			 * c = color, b = background color, o = border-color, f = fill
2375
-			 */
2376
-			$selectors = array(
2377
-				'.btn-secondary' => array('b','o'),
2378
-				'.btn-secondary.disabled' => array('b','o'),
2379
-				'.btn-secondary:disabled' => array('b','o'),
2380
-				'.btn-outline-secondary' => array('c','o'),
2381
-				'.btn-outline-secondary:hover' => array('b','o'),
2382
-				'.btn-outline-secondary.disabled' => array('c'),
2383
-				'.btn-outline-secondary:disabled' => array('c'),
2384
-				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
2385
-				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
2386
-				'.btn-outline-secondary.dropdown-toggle' => array('b','o'),
2387
-				'.badge-secondary' => array('b'),
2388
-				'.alert-secondary' => array('b','o'),
2389
-				'.btn-link.btn-secondary' => array('c'),
2390
-			);
2391
-
2392
-			$important_selectors = array(
2393
-				'.bg-secondary' => array('b','f'),
2394
-				'.border-secondary' => array('o'),
2395
-				'.text-secondary' => array('c'),
2396
-			);
2397
-
2398
-			$color = array();
2399
-			$color_i = array();
2400
-			$background = array();
2401
-			$background_i = array();
2402
-			$border = array();
2403
-			$border_i = array();
2404
-			$fill = array();
2405
-			$fill_i = array();
2406
-
2407
-			$output = '';
2408
-
2409
-			// build rules into each type
2410
-			foreach($selectors as $selector => $types){
2411
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2412
-				$types = array_combine($types,$types);
2413
-				if(isset($types['c'])){$color[] = $selector;}
2414
-				if(isset($types['b'])){$background[] = $selector;}
2415
-				if(isset($types['o'])){$border[] = $selector;}
2416
-				if(isset($types['f'])){$fill[] = $selector;}
2417
-			}
2418
-
2419
-			// build rules into each type
2420
-			foreach($important_selectors as $selector => $types){
2421
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2422
-				$types = array_combine($types,$types);
2423
-				if(isset($types['c'])){$color_i[] = $selector;}
2424
-				if(isset($types['b'])){$background_i[] = $selector;}
2425
-				if(isset($types['o'])){$border_i[] = $selector;}
2426
-				if(isset($types['f'])){$fill_i[] = $selector;}
2427
-			}
2428
-
2429
-			// add any color rules
2430
-			if(!empty($color)){
2431
-				$output .= implode(",",$color) . "{color: $color_code;} ";
2432
-			}
2433
-			if(!empty($color_i)){
2434
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2435
-			}
2436
-
2437
-			// add any background color rules
2438
-			if(!empty($background)){
2439
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
2440
-			}
2441
-			if(!empty($background_i)){
2442
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2443
-			}
2444
-
2445
-			// add any border color rules
2446
-			if(!empty($border)){
2447
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
2448
-			}
2449
-			if(!empty($border_i)){
2450
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2451
-			}
2452
-
2453
-			// add any fill color rules
2454
-			if(!empty($fill)){
2455
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
2456
-			}
2457
-			if(!empty($fill_i)){
2458
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2459
-			}
2460
-
2461
-
2462
-			$prefix = $compatibility ? ".bsui " : "";
2463
-
2464
-			// darken
2465
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2466
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2467
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2468
-
2469
-			// lighten
2470
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2471
-
2472
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
2473
-			$op_25 = $color_code."40"; // 25% opacity
2474
-
2475
-
2476
-			// button states
2477
-			$output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2478
-			$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;} ";
2479
-			$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.";} ";
2480
-			$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;} ";
2481
-
2482
-
2483
-			return $output;
2484
-		}
2485
-
2486
-		/**
2487
-		 * Increases or decreases the brightness of a color by a percentage of the current brightness.
2488
-		 *
2489
-		 * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
2490
-		 * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
2491
-		 *
2492
-		 * @return  string
2493
-		 */
2494
-		public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
2495
-			$hexCode = ltrim($hexCode, '#');
2496
-
2497
-			if (strlen($hexCode) == 3) {
2498
-				$hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
2499
-			}
2500
-
2501
-			$hexCode = array_map('hexdec', str_split($hexCode, 2));
2502
-
2503
-			foreach ($hexCode as & $color) {
2504
-				$adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
2505
-				$adjustAmount = ceil($adjustableLimit * $adjustPercent);
2506
-
2507
-				$color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
2508
-			}
2509
-
2510
-			return '#' . implode($hexCode);
2511
-		}
2512
-
2513
-		/**
2514
-		 * Check if we should display examples.
2515
-		 */
2516
-		public function maybe_show_examples(){
2517
-			if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
2518
-				echo "<head>";
2519
-				wp_head();
2520
-				echo "</head>";
2521
-				echo "<body>";
2522
-				echo $this->get_examples();
2523
-				echo "</body>";
2524
-				exit;
2525
-			}
2526
-		}
2527
-
2528
-		/**
2529
-		 * Get developer examples.
2530
-		 *
2531
-		 * @return string
2532
-		 */
2533
-		public function get_examples(){
2534
-			$output = '';
2535
-
2536
-
2537
-			// open form
2538
-			$output .= "<form class='p-5 m-5 border rounded'>";
2539
-
2540
-			// input example
2541
-			$output .= aui()->input(array(
2542
-				'type'  =>  'text',
2543
-				'id'    =>  'text-example',
2544
-				'name'    =>  'text-example',
2545
-				'placeholder'   => 'text placeholder',
2546
-				'title'   => 'Text input example',
2547
-				'value' =>  '',
2548
-				'required'  => false,
2549
-				'help_text' => 'help text',
2550
-				'label' => 'Text input example label'
2551
-			));
2552
-
2553
-			// input example
2554
-			$output .= aui()->input(array(
2555
-				'type'  =>  'url',
2556
-				'id'    =>  'text-example2',
2557
-				'name'    =>  'text-example',
2558
-				'placeholder'   => 'url placeholder',
2559
-				'title'   => 'Text input example',
2560
-				'value' =>  '',
2561
-				'required'  => false,
2562
-				'help_text' => 'help text',
2563
-				'label' => 'Text input example label'
2564
-			));
2565
-
2566
-			// checkbox example
2567
-			$output .= aui()->input(array(
2568
-				'type'  =>  'checkbox',
2569
-				'id'    =>  'checkbox-example',
2570
-				'name'    =>  'checkbox-example',
2571
-				'placeholder'   => 'checkbox-example',
2572
-				'title'   => 'Checkbox example',
2573
-				'value' =>  '1',
2574
-				'checked'   => true,
2575
-				'required'  => false,
2576
-				'help_text' => 'help text',
2577
-				'label' => 'Checkbox checked'
2578
-			));
2579
-
2580
-			// checkbox example
2581
-			$output .= aui()->input(array(
2582
-				'type'  =>  'checkbox',
2583
-				'id'    =>  'checkbox-example2',
2584
-				'name'    =>  'checkbox-example2',
2585
-				'placeholder'   => 'checkbox-example',
2586
-				'title'   => 'Checkbox example',
2587
-				'value' =>  '1',
2588
-				'checked'   => false,
2589
-				'required'  => false,
2590
-				'help_text' => 'help text',
2591
-				'label' => 'Checkbox un-checked'
2592
-			));
2593
-
2594
-			// switch example
2595
-			$output .= aui()->input(array(
2596
-				'type'  =>  'checkbox',
2597
-				'id'    =>  'switch-example',
2598
-				'name'    =>  'switch-example',
2599
-				'placeholder'   => 'checkbox-example',
2600
-				'title'   => 'Switch example',
2601
-				'value' =>  '1',
2602
-				'checked'   => true,
2603
-				'switch'    => true,
2604
-				'required'  => false,
2605
-				'help_text' => 'help text',
2606
-				'label' => 'Switch on'
2607
-			));
2608
-
2609
-			// switch example
2610
-			$output .= aui()->input(array(
2611
-				'type'  =>  'checkbox',
2612
-				'id'    =>  'switch-example2',
2613
-				'name'    =>  'switch-example2',
2614
-				'placeholder'   => 'checkbox-example',
2615
-				'title'   => 'Switch example',
2616
-				'value' =>  '1',
2617
-				'checked'   => false,
2618
-				'switch'    => true,
2619
-				'required'  => false,
2620
-				'help_text' => 'help text',
2621
-				'label' => 'Switch off'
2622
-			));
2623
-
2624
-			// close form
2625
-			$output .= "</form>";
2626
-
2627
-			return $output;
2628
-		}
2629
-
2630
-		/**
2631
-		 * Calendar params.
2632
-		 *
2633
-		 * @since 0.1.44
2634
-		 *
2635
-		 * @return array Calendar params.
2636
-		 */
2637
-		public static function calendar_params() {
2638
-			$params = array(
2639
-				'month_long_1' => __( 'January', 'aui' ),
2640
-				'month_long_2' => __( 'February', 'aui' ),
2641
-				'month_long_3' => __( 'March', 'aui' ),
2642
-				'month_long_4' => __( 'April', 'aui' ),
2643
-				'month_long_5' => __( 'May', 'aui' ),
2644
-				'month_long_6' => __( 'June', 'aui' ),
2645
-				'month_long_7' => __( 'July', 'aui' ),
2646
-				'month_long_8' => __( 'August', 'aui' ),
2647
-				'month_long_9' => __( 'September', 'aui' ),
2648
-				'month_long_10' => __( 'October', 'aui' ),
2649
-				'month_long_11' => __( 'November', 'aui' ),
2650
-				'month_long_12' => __( 'December', 'aui' ),
2651
-				'month_s_1' => _x( 'Jan', 'January abbreviation', 'aui' ),
2652
-				'month_s_2' => _x( 'Feb', 'February abbreviation', 'aui' ),
2653
-				'month_s_3' => _x( 'Mar', 'March abbreviation', 'aui' ),
2654
-				'month_s_4' => _x( 'Apr', 'April abbreviation', 'aui' ),
2655
-				'month_s_5' => _x( 'May', 'May abbreviation', 'aui' ),
2656
-				'month_s_6' => _x( 'Jun', 'June abbreviation', 'aui' ),
2657
-				'month_s_7' => _x( 'Jul', 'July abbreviation', 'aui' ),
2658
-				'month_s_8' => _x( 'Aug', 'August abbreviation', 'aui' ),
2659
-				'month_s_9' => _x( 'Sep', 'September abbreviation', 'aui' ),
2660
-				'month_s_10' => _x( 'Oct', 'October abbreviation', 'aui' ),
2661
-				'month_s_11' => _x( 'Nov', 'November abbreviation', 'aui' ),
2662
-				'month_s_12' => _x( 'Dec', 'December abbreviation', 'aui' ),
2663
-				'day_s1_1' => _x( 'S', 'Sunday initial', 'aui' ),
2664
-				'day_s1_2' => _x( 'M', 'Monday initial', 'aui' ),
2665
-				'day_s1_3' => _x( 'T', 'Tuesday initial', 'aui' ),
2666
-				'day_s1_4' => _x( 'W', 'Wednesday initial', 'aui' ),
2667
-				'day_s1_5' => _x( 'T', 'Friday initial', 'aui' ),
2668
-				'day_s1_6' => _x( 'F', 'Thursday initial', 'aui' ),
2669
-				'day_s1_7' => _x( 'S', 'Saturday initial', 'aui' ),
2670
-				'day_s2_1' => __( 'Su', 'aui' ),
2671
-				'day_s2_2' => __( 'Mo', 'aui' ),
2672
-				'day_s2_3' => __( 'Tu', 'aui' ),
2673
-				'day_s2_4' => __( 'We', 'aui' ),
2674
-				'day_s2_5' => __( 'Th', 'aui' ),
2675
-				'day_s2_6' => __( 'Fr', 'aui' ),
2676
-				'day_s2_7' => __( 'Sa', 'aui' ),
2677
-				'day_s3_1' => __( 'Sun', 'aui' ),
2678
-				'day_s3_2' => __( 'Mon', 'aui' ),
2679
-				'day_s3_3' => __( 'Tue', 'aui' ),
2680
-				'day_s3_4' => __( 'Wed', 'aui' ),
2681
-				'day_s3_5' => __( 'Thu', 'aui' ),
2682
-				'day_s3_6' => __( 'Fri', 'aui' ),
2683
-				'day_s3_7' => __( 'Sat', 'aui' ),
2684
-				'day_s5_1' => __( 'Sunday', 'aui' ),
2685
-				'day_s5_2' => __( 'Monday', 'aui' ),
2686
-				'day_s5_3' => __( 'Tuesday', 'aui' ),
2687
-				'day_s5_4' => __( 'Wednesday', 'aui' ),
2688
-				'day_s5_5' => __( 'Thursday', 'aui' ),
2689
-				'day_s5_6' => __( 'Friday', 'aui' ),
2690
-				'day_s5_7' => __( 'Saturday', 'aui' ),
2691
-				'am_lower' => __( 'am', 'aui' ),
2692
-				'pm_lower' => __( 'pm', 'aui' ),
2693
-				'am_upper' => __( 'AM', 'aui' ),
2694
-				'pm_upper' => __( 'PM', 'aui' ),
2695
-				'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
2696
-				'time_24hr' => false,
2697
-				'year' => __( 'Year', 'aui' ),
2698
-				'hour' => __( 'Hour', 'aui' ),
2699
-				'minute' => __( 'Minute', 'aui' ),
2700
-				'weekAbbreviation' => __( 'Wk', 'aui' ),
2701
-				'rangeSeparator' => __( ' to ', 'aui' ),
2702
-				'scrollTitle' => __( 'Scroll to increment', 'aui' ),
2703
-				'toggleTitle' => __( 'Click to toggle', 'aui' )
2704
-			);
2705
-
2706
-			return apply_filters( 'ayecode_ui_calendar_params', $params );
2707
-		}
2708
-
2709
-		/**
2710
-		 * Flatpickr calendar localize.
2711
-		 *
2712
-		 * @since 0.1.44
2713
-		 *
2714
-		 * @return string Calendar locale.
2715
-		 */
2716
-		public static function flatpickr_locale() {
2717
-			$params = self::calendar_params();
2718
-
2719
-			if ( is_string( $params ) ) {
2720
-				$params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
2721
-			} else {
2722
-				foreach ( (array) $params as $key => $value ) {
2723
-					if ( ! is_scalar( $value ) ) {
2724
-						continue;
2725
-					}
2726
-
2727
-					$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2728
-				}
2729
-			}
2244
+                '.nav-pills .nav-link.active' => array('b'),
2245
+                '.nav-pills .show>.nav-link' => array('b'),
2246
+                '.page-link' => array('c'),
2247
+                '.page-item.active .page-link' => array('b','o'),
2248
+                '.badge-primary' => array('b'),
2249
+                '.alert-primary' => array('b','o'),
2250
+                '.progress-bar' => array('b'),
2251
+                '.list-group-item.active' => array('b','o'),
2252
+                '.bg-primary' => array('b','f'),
2253
+                '.btn-link.btn-primary' => array('c'),
2254
+                '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
2255
+            );
2256
+
2257
+            $important_selectors = array(
2258
+                '.bg-primary' => array('b','f'),
2259
+                '.border-primary' => array('o'),
2260
+                '.text-primary' => array('c'),
2261
+            );
2262
+
2263
+            $color = array();
2264
+            $color_i = array();
2265
+            $background = array();
2266
+            $background_i = array();
2267
+            $border = array();
2268
+            $border_i = array();
2269
+            $fill = array();
2270
+            $fill_i = array();
2271
+
2272
+            $output = '';
2273
+
2274
+            // build rules into each type
2275
+            foreach($selectors as $selector => $types){
2276
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
2277
+                $types = array_combine($types,$types);
2278
+                if(isset($types['c'])){$color[] = $selector;}
2279
+                if(isset($types['b'])){$background[] = $selector;}
2280
+                if(isset($types['o'])){$border[] = $selector;}
2281
+                if(isset($types['f'])){$fill[] = $selector;}
2282
+            }
2283
+
2284
+            // build rules into each type
2285
+            foreach($important_selectors as $selector => $types){
2286
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
2287
+                $types = array_combine($types,$types);
2288
+                if(isset($types['c'])){$color_i[] = $selector;}
2289
+                if(isset($types['b'])){$background_i[] = $selector;}
2290
+                if(isset($types['o'])){$border_i[] = $selector;}
2291
+                if(isset($types['f'])){$fill_i[] = $selector;}
2292
+            }
2293
+
2294
+            // add any color rules
2295
+            if(!empty($color)){
2296
+                $output .= implode(",",$color) . "{color: $color_code;} ";
2297
+            }
2298
+            if(!empty($color_i)){
2299
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2300
+            }
2301
+
2302
+            // add any background color rules
2303
+            if(!empty($background)){
2304
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
2305
+            }
2306
+            if(!empty($background_i)){
2307
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2308
+            }
2309
+
2310
+            // add any border color rules
2311
+            if(!empty($border)){
2312
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
2313
+            }
2314
+            if(!empty($border_i)){
2315
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2316
+            }
2317
+
2318
+            // add any fill color rules
2319
+            if(!empty($fill)){
2320
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
2321
+            }
2322
+            if(!empty($fill_i)){
2323
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2324
+            }
2325
+
2326
+
2327
+            $prefix = $compatibility ? ".bsui " : "";
2328
+
2329
+            // darken
2330
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2331
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2332
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2333
+
2334
+            // lighten
2335
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2336
+
2337
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
2338
+            $op_25 = $color_code."40"; // 25% opacity
2339
+
2340
+
2341
+            // button states
2342
+            $output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2343
+            $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;} ";
2344
+            $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.";} ";
2345
+            $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;} ";
2346
+
2347
+
2348
+            // dropdown's
2349
+            $output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2350
+
2351
+
2352
+            // input states
2353
+            $output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
2354
+
2355
+            // page link
2356
+            $output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2357
+
2358
+            return $output;
2359
+        }
2360
+
2361
+        /**
2362
+         *
2363
+         * @deprecated 0.1.76 Use css_overwrite()
2364
+         *
2365
+         * @param $color_code
2366
+         * @param $compatibility
2367
+         *
2368
+         * @return string
2369
+         */
2370
+        public static function css_secondary($color_code,$compatibility){;
2371
+            $color_code = sanitize_hex_color($color_code);
2372
+            if(!$color_code){return '';}
2373
+            /**
2374
+             * c = color, b = background color, o = border-color, f = fill
2375
+             */
2376
+            $selectors = array(
2377
+                '.btn-secondary' => array('b','o'),
2378
+                '.btn-secondary.disabled' => array('b','o'),
2379
+                '.btn-secondary:disabled' => array('b','o'),
2380
+                '.btn-outline-secondary' => array('c','o'),
2381
+                '.btn-outline-secondary:hover' => array('b','o'),
2382
+                '.btn-outline-secondary.disabled' => array('c'),
2383
+                '.btn-outline-secondary:disabled' => array('c'),
2384
+                '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
2385
+                '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
2386
+                '.btn-outline-secondary.dropdown-toggle' => array('b','o'),
2387
+                '.badge-secondary' => array('b'),
2388
+                '.alert-secondary' => array('b','o'),
2389
+                '.btn-link.btn-secondary' => array('c'),
2390
+            );
2391
+
2392
+            $important_selectors = array(
2393
+                '.bg-secondary' => array('b','f'),
2394
+                '.border-secondary' => array('o'),
2395
+                '.text-secondary' => array('c'),
2396
+            );
2397
+
2398
+            $color = array();
2399
+            $color_i = array();
2400
+            $background = array();
2401
+            $background_i = array();
2402
+            $border = array();
2403
+            $border_i = array();
2404
+            $fill = array();
2405
+            $fill_i = array();
2406
+
2407
+            $output = '';
2408
+
2409
+            // build rules into each type
2410
+            foreach($selectors as $selector => $types){
2411
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
2412
+                $types = array_combine($types,$types);
2413
+                if(isset($types['c'])){$color[] = $selector;}
2414
+                if(isset($types['b'])){$background[] = $selector;}
2415
+                if(isset($types['o'])){$border[] = $selector;}
2416
+                if(isset($types['f'])){$fill[] = $selector;}
2417
+            }
2418
+
2419
+            // build rules into each type
2420
+            foreach($important_selectors as $selector => $types){
2421
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
2422
+                $types = array_combine($types,$types);
2423
+                if(isset($types['c'])){$color_i[] = $selector;}
2424
+                if(isset($types['b'])){$background_i[] = $selector;}
2425
+                if(isset($types['o'])){$border_i[] = $selector;}
2426
+                if(isset($types['f'])){$fill_i[] = $selector;}
2427
+            }
2428
+
2429
+            // add any color rules
2430
+            if(!empty($color)){
2431
+                $output .= implode(",",$color) . "{color: $color_code;} ";
2432
+            }
2433
+            if(!empty($color_i)){
2434
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2435
+            }
2436
+
2437
+            // add any background color rules
2438
+            if(!empty($background)){
2439
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
2440
+            }
2441
+            if(!empty($background_i)){
2442
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2443
+            }
2444
+
2445
+            // add any border color rules
2446
+            if(!empty($border)){
2447
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
2448
+            }
2449
+            if(!empty($border_i)){
2450
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2451
+            }
2452
+
2453
+            // add any fill color rules
2454
+            if(!empty($fill)){
2455
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
2456
+            }
2457
+            if(!empty($fill_i)){
2458
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2459
+            }
2460
+
2461
+
2462
+            $prefix = $compatibility ? ".bsui " : "";
2463
+
2464
+            // darken
2465
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2466
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2467
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2468
+
2469
+            // lighten
2470
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2471
+
2472
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
2473
+            $op_25 = $color_code."40"; // 25% opacity
2474
+
2475
+
2476
+            // button states
2477
+            $output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2478
+            $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;} ";
2479
+            $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.";} ";
2480
+            $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;} ";
2481
+
2482
+
2483
+            return $output;
2484
+        }
2485
+
2486
+        /**
2487
+         * Increases or decreases the brightness of a color by a percentage of the current brightness.
2488
+         *
2489
+         * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
2490
+         * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
2491
+         *
2492
+         * @return  string
2493
+         */
2494
+        public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
2495
+            $hexCode = ltrim($hexCode, '#');
2496
+
2497
+            if (strlen($hexCode) == 3) {
2498
+                $hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
2499
+            }
2500
+
2501
+            $hexCode = array_map('hexdec', str_split($hexCode, 2));
2502
+
2503
+            foreach ($hexCode as & $color) {
2504
+                $adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
2505
+                $adjustAmount = ceil($adjustableLimit * $adjustPercent);
2506
+
2507
+                $color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
2508
+            }
2509
+
2510
+            return '#' . implode($hexCode);
2511
+        }
2512
+
2513
+        /**
2514
+         * Check if we should display examples.
2515
+         */
2516
+        public function maybe_show_examples(){
2517
+            if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
2518
+                echo "<head>";
2519
+                wp_head();
2520
+                echo "</head>";
2521
+                echo "<body>";
2522
+                echo $this->get_examples();
2523
+                echo "</body>";
2524
+                exit;
2525
+            }
2526
+        }
2527
+
2528
+        /**
2529
+         * Get developer examples.
2530
+         *
2531
+         * @return string
2532
+         */
2533
+        public function get_examples(){
2534
+            $output = '';
2535
+
2536
+
2537
+            // open form
2538
+            $output .= "<form class='p-5 m-5 border rounded'>";
2539
+
2540
+            // input example
2541
+            $output .= aui()->input(array(
2542
+                'type'  =>  'text',
2543
+                'id'    =>  'text-example',
2544
+                'name'    =>  'text-example',
2545
+                'placeholder'   => 'text placeholder',
2546
+                'title'   => 'Text input example',
2547
+                'value' =>  '',
2548
+                'required'  => false,
2549
+                'help_text' => 'help text',
2550
+                'label' => 'Text input example label'
2551
+            ));
2552
+
2553
+            // input example
2554
+            $output .= aui()->input(array(
2555
+                'type'  =>  'url',
2556
+                'id'    =>  'text-example2',
2557
+                'name'    =>  'text-example',
2558
+                'placeholder'   => 'url placeholder',
2559
+                'title'   => 'Text input example',
2560
+                'value' =>  '',
2561
+                'required'  => false,
2562
+                'help_text' => 'help text',
2563
+                'label' => 'Text input example label'
2564
+            ));
2565
+
2566
+            // checkbox example
2567
+            $output .= aui()->input(array(
2568
+                'type'  =>  'checkbox',
2569
+                'id'    =>  'checkbox-example',
2570
+                'name'    =>  'checkbox-example',
2571
+                'placeholder'   => 'checkbox-example',
2572
+                'title'   => 'Checkbox example',
2573
+                'value' =>  '1',
2574
+                'checked'   => true,
2575
+                'required'  => false,
2576
+                'help_text' => 'help text',
2577
+                'label' => 'Checkbox checked'
2578
+            ));
2579
+
2580
+            // checkbox example
2581
+            $output .= aui()->input(array(
2582
+                'type'  =>  'checkbox',
2583
+                'id'    =>  'checkbox-example2',
2584
+                'name'    =>  'checkbox-example2',
2585
+                'placeholder'   => 'checkbox-example',
2586
+                'title'   => 'Checkbox example',
2587
+                'value' =>  '1',
2588
+                'checked'   => false,
2589
+                'required'  => false,
2590
+                'help_text' => 'help text',
2591
+                'label' => 'Checkbox un-checked'
2592
+            ));
2593
+
2594
+            // switch example
2595
+            $output .= aui()->input(array(
2596
+                'type'  =>  'checkbox',
2597
+                'id'    =>  'switch-example',
2598
+                'name'    =>  'switch-example',
2599
+                'placeholder'   => 'checkbox-example',
2600
+                'title'   => 'Switch example',
2601
+                'value' =>  '1',
2602
+                'checked'   => true,
2603
+                'switch'    => true,
2604
+                'required'  => false,
2605
+                'help_text' => 'help text',
2606
+                'label' => 'Switch on'
2607
+            ));
2608
+
2609
+            // switch example
2610
+            $output .= aui()->input(array(
2611
+                'type'  =>  'checkbox',
2612
+                'id'    =>  'switch-example2',
2613
+                'name'    =>  'switch-example2',
2614
+                'placeholder'   => 'checkbox-example',
2615
+                'title'   => 'Switch example',
2616
+                'value' =>  '1',
2617
+                'checked'   => false,
2618
+                'switch'    => true,
2619
+                'required'  => false,
2620
+                'help_text' => 'help text',
2621
+                'label' => 'Switch off'
2622
+            ));
2623
+
2624
+            // close form
2625
+            $output .= "</form>";
2626
+
2627
+            return $output;
2628
+        }
2629
+
2630
+        /**
2631
+         * Calendar params.
2632
+         *
2633
+         * @since 0.1.44
2634
+         *
2635
+         * @return array Calendar params.
2636
+         */
2637
+        public static function calendar_params() {
2638
+            $params = array(
2639
+                'month_long_1' => __( 'January', 'aui' ),
2640
+                'month_long_2' => __( 'February', 'aui' ),
2641
+                'month_long_3' => __( 'March', 'aui' ),
2642
+                'month_long_4' => __( 'April', 'aui' ),
2643
+                'month_long_5' => __( 'May', 'aui' ),
2644
+                'month_long_6' => __( 'June', 'aui' ),
2645
+                'month_long_7' => __( 'July', 'aui' ),
2646
+                'month_long_8' => __( 'August', 'aui' ),
2647
+                'month_long_9' => __( 'September', 'aui' ),
2648
+                'month_long_10' => __( 'October', 'aui' ),
2649
+                'month_long_11' => __( 'November', 'aui' ),
2650
+                'month_long_12' => __( 'December', 'aui' ),
2651
+                'month_s_1' => _x( 'Jan', 'January abbreviation', 'aui' ),
2652
+                'month_s_2' => _x( 'Feb', 'February abbreviation', 'aui' ),
2653
+                'month_s_3' => _x( 'Mar', 'March abbreviation', 'aui' ),
2654
+                'month_s_4' => _x( 'Apr', 'April abbreviation', 'aui' ),
2655
+                'month_s_5' => _x( 'May', 'May abbreviation', 'aui' ),
2656
+                'month_s_6' => _x( 'Jun', 'June abbreviation', 'aui' ),
2657
+                'month_s_7' => _x( 'Jul', 'July abbreviation', 'aui' ),
2658
+                'month_s_8' => _x( 'Aug', 'August abbreviation', 'aui' ),
2659
+                'month_s_9' => _x( 'Sep', 'September abbreviation', 'aui' ),
2660
+                'month_s_10' => _x( 'Oct', 'October abbreviation', 'aui' ),
2661
+                'month_s_11' => _x( 'Nov', 'November abbreviation', 'aui' ),
2662
+                'month_s_12' => _x( 'Dec', 'December abbreviation', 'aui' ),
2663
+                'day_s1_1' => _x( 'S', 'Sunday initial', 'aui' ),
2664
+                'day_s1_2' => _x( 'M', 'Monday initial', 'aui' ),
2665
+                'day_s1_3' => _x( 'T', 'Tuesday initial', 'aui' ),
2666
+                'day_s1_4' => _x( 'W', 'Wednesday initial', 'aui' ),
2667
+                'day_s1_5' => _x( 'T', 'Friday initial', 'aui' ),
2668
+                'day_s1_6' => _x( 'F', 'Thursday initial', 'aui' ),
2669
+                'day_s1_7' => _x( 'S', 'Saturday initial', 'aui' ),
2670
+                'day_s2_1' => __( 'Su', 'aui' ),
2671
+                'day_s2_2' => __( 'Mo', 'aui' ),
2672
+                'day_s2_3' => __( 'Tu', 'aui' ),
2673
+                'day_s2_4' => __( 'We', 'aui' ),
2674
+                'day_s2_5' => __( 'Th', 'aui' ),
2675
+                'day_s2_6' => __( 'Fr', 'aui' ),
2676
+                'day_s2_7' => __( 'Sa', 'aui' ),
2677
+                'day_s3_1' => __( 'Sun', 'aui' ),
2678
+                'day_s3_2' => __( 'Mon', 'aui' ),
2679
+                'day_s3_3' => __( 'Tue', 'aui' ),
2680
+                'day_s3_4' => __( 'Wed', 'aui' ),
2681
+                'day_s3_5' => __( 'Thu', 'aui' ),
2682
+                'day_s3_6' => __( 'Fri', 'aui' ),
2683
+                'day_s3_7' => __( 'Sat', 'aui' ),
2684
+                'day_s5_1' => __( 'Sunday', 'aui' ),
2685
+                'day_s5_2' => __( 'Monday', 'aui' ),
2686
+                'day_s5_3' => __( 'Tuesday', 'aui' ),
2687
+                'day_s5_4' => __( 'Wednesday', 'aui' ),
2688
+                'day_s5_5' => __( 'Thursday', 'aui' ),
2689
+                'day_s5_6' => __( 'Friday', 'aui' ),
2690
+                'day_s5_7' => __( 'Saturday', 'aui' ),
2691
+                'am_lower' => __( 'am', 'aui' ),
2692
+                'pm_lower' => __( 'pm', 'aui' ),
2693
+                'am_upper' => __( 'AM', 'aui' ),
2694
+                'pm_upper' => __( 'PM', 'aui' ),
2695
+                'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
2696
+                'time_24hr' => false,
2697
+                'year' => __( 'Year', 'aui' ),
2698
+                'hour' => __( 'Hour', 'aui' ),
2699
+                'minute' => __( 'Minute', 'aui' ),
2700
+                'weekAbbreviation' => __( 'Wk', 'aui' ),
2701
+                'rangeSeparator' => __( ' to ', 'aui' ),
2702
+                'scrollTitle' => __( 'Scroll to increment', 'aui' ),
2703
+                'toggleTitle' => __( 'Click to toggle', 'aui' )
2704
+            );
2705
+
2706
+            return apply_filters( 'ayecode_ui_calendar_params', $params );
2707
+        }
2708
+
2709
+        /**
2710
+         * Flatpickr calendar localize.
2711
+         *
2712
+         * @since 0.1.44
2713
+         *
2714
+         * @return string Calendar locale.
2715
+         */
2716
+        public static function flatpickr_locale() {
2717
+            $params = self::calendar_params();
2718
+
2719
+            if ( is_string( $params ) ) {
2720
+                $params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
2721
+            } else {
2722
+                foreach ( (array) $params as $key => $value ) {
2723
+                    if ( ! is_scalar( $value ) ) {
2724
+                        continue;
2725
+                    }
2726
+
2727
+                    $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2728
+                }
2729
+            }
2730 2730
 
2731
-			$day_s3 = array();
2732
-			$day_s5 = array();
2731
+            $day_s3 = array();
2732
+            $day_s5 = array();
2733 2733
 
2734
-			for ( $i = 1; $i <= 7; $i ++ ) {
2735
-				$day_s3[] = addslashes( $params[ 'day_s3_' . $i ] );
2736
-				$day_s5[] = addslashes( $params[ 'day_s3_' . $i ] );
2737
-			}
2734
+            for ( $i = 1; $i <= 7; $i ++ ) {
2735
+                $day_s3[] = addslashes( $params[ 'day_s3_' . $i ] );
2736
+                $day_s5[] = addslashes( $params[ 'day_s3_' . $i ] );
2737
+            }
2738 2738
 
2739
-			$month_s = array();
2740
-			$month_long = array();
2739
+            $month_s = array();
2740
+            $month_long = array();
2741 2741
 
2742
-			for ( $i = 1; $i <= 12; $i ++ ) {
2743
-				$month_s[] = addslashes( $params[ 'month_s_' . $i ] );
2744
-				$month_long[] = addslashes( $params[ 'month_long_' . $i ] );
2745
-			}
2742
+            for ( $i = 1; $i <= 12; $i ++ ) {
2743
+                $month_s[] = addslashes( $params[ 'month_s_' . $i ] );
2744
+                $month_long[] = addslashes( $params[ 'month_long_' . $i ] );
2745
+            }
2746 2746
 
2747
-			ob_start();
2748
-		if ( 0 ) { ?><script><?php } ?>
2747
+            ob_start();
2748
+        if ( 0 ) { ?><script><?php } ?>
2749 2749
                 {
2750 2750
                     weekdays: {
2751 2751
                         shorthand: ['<?php echo implode( "','", $day_s3 ); ?>'],
@@ -2784,189 +2784,189 @@  discard block
 block discarded – undo
2784 2784
                 }
2785 2785
 				<?php if ( 0 ) { ?></script><?php } ?>
2786 2786
 			<?php
2787
-			$locale = ob_get_clean();
2788
-
2789
-			return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
2790
-		}
2791
-
2792
-		/**
2793
-		 * Select2 JS params.
2794
-		 *
2795
-		 * @since 0.1.44
2796
-		 *
2797
-		 * @return array Select2 JS params.
2798
-		 */
2799
-		public static function select2_params() {
2800
-			$params = array(
2801
-				'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'aui' ),
2802
-				'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'aui' ),
2803
-				'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'aui' ),
2804
-				'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'aui' ),
2805
-				'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'aui' ),
2806
-				'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'aui' ),
2807
-				'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'aui' ),
2808
-				'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'aui' ),
2809
-				'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'aui' ),
2810
-				'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'aui' ),
2811
-				'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'aui' )
2812
-			);
2813
-
2814
-			return apply_filters( 'ayecode_ui_select2_params', $params );
2815
-		}
2816
-
2817
-		/**
2818
-		 * Select2 JS localize.
2819
-		 *
2820
-		 * @since 0.1.44
2821
-		 *
2822
-		 * @return string Select2 JS locale.
2823
-		 */
2824
-		public static function select2_locale() {
2825
-			$params = self::select2_params();
2826
-
2827
-			foreach ( (array) $params as $key => $value ) {
2828
-				if ( ! is_scalar( $value ) ) {
2829
-					continue;
2830
-				}
2787
+            $locale = ob_get_clean();
2788
+
2789
+            return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
2790
+        }
2791
+
2792
+        /**
2793
+         * Select2 JS params.
2794
+         *
2795
+         * @since 0.1.44
2796
+         *
2797
+         * @return array Select2 JS params.
2798
+         */
2799
+        public static function select2_params() {
2800
+            $params = array(
2801
+                'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'aui' ),
2802
+                'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'aui' ),
2803
+                'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'aui' ),
2804
+                'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'aui' ),
2805
+                'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'aui' ),
2806
+                'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'aui' ),
2807
+                'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'aui' ),
2808
+                'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'aui' ),
2809
+                'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'aui' ),
2810
+                'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'aui' ),
2811
+                'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'aui' )
2812
+            );
2813
+
2814
+            return apply_filters( 'ayecode_ui_select2_params', $params );
2815
+        }
2816
+
2817
+        /**
2818
+         * Select2 JS localize.
2819
+         *
2820
+         * @since 0.1.44
2821
+         *
2822
+         * @return string Select2 JS locale.
2823
+         */
2824
+        public static function select2_locale() {
2825
+            $params = self::select2_params();
2826
+
2827
+            foreach ( (array) $params as $key => $value ) {
2828
+                if ( ! is_scalar( $value ) ) {
2829
+                    continue;
2830
+                }
2831 2831
 
2832
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2833
-			}
2834
-
2835
-			$locale = json_encode( $params );
2836
-
2837
-			return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
2838
-		}
2839
-
2840
-		/**
2841
-		 * Time ago JS localize.
2842
-		 *
2843
-		 * @since 0.1.47
2844
-		 *
2845
-		 * @return string Time ago JS locale.
2846
-		 */
2847
-		public static function timeago_locale() {
2848
-			$params = array(
2849
-				'prefix_ago' => '',
2850
-				'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'aui' ),
2851
-				'prefix_after' => _x( 'after', 'time ago', 'aui' ) . ' ',
2852
-				'suffix_after' => '',
2853
-				'seconds' => _x( 'less than a minute', 'time ago', 'aui' ),
2854
-				'minute' => _x( 'about a minute', 'time ago', 'aui' ),
2855
-				'minutes' => _x( '%d minutes', 'time ago', 'aui' ),
2856
-				'hour' => _x( 'about an hour', 'time ago', 'aui' ),
2857
-				'hours' => _x( 'about %d hours', 'time ago', 'aui' ),
2858
-				'day' => _x( 'a day', 'time ago', 'aui' ),
2859
-				'days' => _x( '%d days', 'time ago', 'aui' ),
2860
-				'month' => _x( 'about a month', 'time ago', 'aui' ),
2861
-				'months' => _x( '%d months', 'time ago', 'aui' ),
2862
-				'year' => _x( 'about a year', 'time ago', 'aui' ),
2863
-				'years' => _x( '%d years', 'time ago', 'aui' ),
2864
-			);
2865
-
2866
-			$params = apply_filters( 'ayecode_ui_timeago_params', $params );
2867
-
2868
-			foreach ( (array) $params as $key => $value ) {
2869
-				if ( ! is_scalar( $value ) ) {
2870
-					continue;
2871
-				}
2832
+                $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2833
+            }
2834
+
2835
+            $locale = json_encode( $params );
2836
+
2837
+            return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
2838
+        }
2839
+
2840
+        /**
2841
+         * Time ago JS localize.
2842
+         *
2843
+         * @since 0.1.47
2844
+         *
2845
+         * @return string Time ago JS locale.
2846
+         */
2847
+        public static function timeago_locale() {
2848
+            $params = array(
2849
+                'prefix_ago' => '',
2850
+                'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'aui' ),
2851
+                'prefix_after' => _x( 'after', 'time ago', 'aui' ) . ' ',
2852
+                'suffix_after' => '',
2853
+                'seconds' => _x( 'less than a minute', 'time ago', 'aui' ),
2854
+                'minute' => _x( 'about a minute', 'time ago', 'aui' ),
2855
+                'minutes' => _x( '%d minutes', 'time ago', 'aui' ),
2856
+                'hour' => _x( 'about an hour', 'time ago', 'aui' ),
2857
+                'hours' => _x( 'about %d hours', 'time ago', 'aui' ),
2858
+                'day' => _x( 'a day', 'time ago', 'aui' ),
2859
+                'days' => _x( '%d days', 'time ago', 'aui' ),
2860
+                'month' => _x( 'about a month', 'time ago', 'aui' ),
2861
+                'months' => _x( '%d months', 'time ago', 'aui' ),
2862
+                'year' => _x( 'about a year', 'time ago', 'aui' ),
2863
+                'years' => _x( '%d years', 'time ago', 'aui' ),
2864
+            );
2865
+
2866
+            $params = apply_filters( 'ayecode_ui_timeago_params', $params );
2867
+
2868
+            foreach ( (array) $params as $key => $value ) {
2869
+                if ( ! is_scalar( $value ) ) {
2870
+                    continue;
2871
+                }
2872 2872
 
2873
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2874
-			}
2875
-
2876
-			$locale = json_encode( $params );
2877
-
2878
-			return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) );
2879
-		}
2880
-
2881
-		/**
2882
-		 * JavaScript Minifier
2883
-		 *
2884
-		 * @param $input
2885
-		 *
2886
-		 * @return mixed
2887
-		 */
2888
-		public static function minify_js($input) {
2889
-			if(trim($input) === "") return $input;
2890
-			return preg_replace(
2891
-				array(
2892
-					// Remove comment(s)
2893
-					'#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
2894
-					// Remove white-space(s) outside the string and regex
2895
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/)|\/(?!\/)[^\n\r]*?\/(?=[\s.,;]|[gimuy]|$))|\s*([!%&*\(\)\-=+\[\]\{\}|;:,.<>?\/])\s*#s',
2896
-					// Remove the last semicolon
2897
-					'#;+\}#',
2898
-					// Minify object attribute(s) except JSON attribute(s). From `{'foo':'bar'}` to `{foo:'bar'}`
2899
-					'#([\{,])([\'])(\d+|[a-z_][a-z0-9_]*)\2(?=\:)#i',
2900
-					// --ibid. From `foo['bar']` to `foo.bar`
2901
-					'#([a-z0-9_\)\]])\[([\'"])([a-z_][a-z0-9_]*)\2\]#i'
2902
-				),
2903
-				array(
2904
-					'$1',
2905
-					'$1$2',
2906
-					'}',
2907
-					'$1$3',
2908
-					'$1.$3'
2909
-				),
2910
-				$input);
2911
-		}
2912
-
2913
-		/**
2914
-		 * Minify CSS
2915
-		 *
2916
-		 * @param $input
2917
-		 *
2918
-		 * @return mixed
2919
-		 */
2920
-		public static function minify_css($input) {
2921
-			if(trim($input) === "") return $input;
2922
-			return preg_replace(
2923
-				array(
2924
-					// Remove comment(s)
2925
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')|\/\*(?!\!)(?>.*?\*\/)|^\s*|\s*$#s',
2926
-					// Remove unused white-space(s)
2927
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/))|\s*+;\s*+(})\s*+|\s*+([*$~^|]?+=|[{};,>~]|\s(?![0-9\.])|!important\b)\s*+|([[(:])\s++|\s++([])])|\s++(:)\s*+(?!(?>[^{}"\']++|"(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')*+{)|^\s++|\s++\z|(\s)\s+#si',
2928
-					// Replace `0(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)` with `0`
2929
-					'#(?<=[\s:])(0)(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)#si',
2930
-					// Replace `:0 0 0 0` with `:0`
2931
-					'#:(0\s+0|0\s+0\s+0\s+0)(?=[;\}]|\!important)#i',
2932
-					// Replace `background-position:0` with `background-position:0 0`
2933
-					'#(background-position):0(?=[;\}])#si',
2934
-					// Replace `0.6` with `.6`, but only when preceded by `:`, `,`, `-` or a white-space
2935
-					'#(?<=[\s:,\-])0+\.(\d+)#s',
2936
-					// Minify string value
2937
-					'#(\/\*(?>.*?\*\/))|(?<!content\:)([\'"])([a-z_][a-z0-9\-_]*?)\2(?=[\s\{\}\];,])#si',
2938
-					'#(\/\*(?>.*?\*\/))|(\burl\()([\'"])([^\s]+?)\3(\))#si',
2939
-					// Minify HEX color code
2940
-					'#(?<=[\s:,\-]\#)([a-f0-6]+)\1([a-f0-6]+)\2([a-f0-6]+)\3#i',
2941
-					// Replace `(border|outline):none` with `(border|outline):0`
2942
-					'#(?<=[\{;])(border|outline):none(?=[;\}\!])#',
2943
-					// Remove empty selector(s)
2944
-					'#(\/\*(?>.*?\*\/))|(^|[\{\}])(?:[^\s\{\}]+)\{\}#s'
2945
-				),
2946
-				array(
2947
-					'$1',
2948
-					'$1$2$3$4$5$6$7',
2949
-					'$1',
2950
-					':0',
2951
-					'$1:0 0',
2952
-					'.$1',
2953
-					'$1$3',
2954
-					'$1$2$4$5',
2955
-					'$1$2$3',
2956
-					'$1:0',
2957
-					'$1$2'
2958
-				),
2959
-				$input);
2960
-		}
2961
-
2962
-		/**
2963
-		 * Get the conditional fields JavaScript.
2964
-		 *
2965
-		 * @return mixed
2966
-		 */
2967
-		public function conditional_fields_js() {
2968
-			ob_start();
2969
-			?>
2873
+                $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2874
+            }
2875
+
2876
+            $locale = json_encode( $params );
2877
+
2878
+            return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) );
2879
+        }
2880
+
2881
+        /**
2882
+         * JavaScript Minifier
2883
+         *
2884
+         * @param $input
2885
+         *
2886
+         * @return mixed
2887
+         */
2888
+        public static function minify_js($input) {
2889
+            if(trim($input) === "") return $input;
2890
+            return preg_replace(
2891
+                array(
2892
+                    // Remove comment(s)
2893
+                    '#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
2894
+                    // Remove white-space(s) outside the string and regex
2895
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/)|\/(?!\/)[^\n\r]*?\/(?=[\s.,;]|[gimuy]|$))|\s*([!%&*\(\)\-=+\[\]\{\}|;:,.<>?\/])\s*#s',
2896
+                    // Remove the last semicolon
2897
+                    '#;+\}#',
2898
+                    // Minify object attribute(s) except JSON attribute(s). From `{'foo':'bar'}` to `{foo:'bar'}`
2899
+                    '#([\{,])([\'])(\d+|[a-z_][a-z0-9_]*)\2(?=\:)#i',
2900
+                    // --ibid. From `foo['bar']` to `foo.bar`
2901
+                    '#([a-z0-9_\)\]])\[([\'"])([a-z_][a-z0-9_]*)\2\]#i'
2902
+                ),
2903
+                array(
2904
+                    '$1',
2905
+                    '$1$2',
2906
+                    '}',
2907
+                    '$1$3',
2908
+                    '$1.$3'
2909
+                ),
2910
+                $input);
2911
+        }
2912
+
2913
+        /**
2914
+         * Minify CSS
2915
+         *
2916
+         * @param $input
2917
+         *
2918
+         * @return mixed
2919
+         */
2920
+        public static function minify_css($input) {
2921
+            if(trim($input) === "") return $input;
2922
+            return preg_replace(
2923
+                array(
2924
+                    // Remove comment(s)
2925
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')|\/\*(?!\!)(?>.*?\*\/)|^\s*|\s*$#s',
2926
+                    // Remove unused white-space(s)
2927
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/))|\s*+;\s*+(})\s*+|\s*+([*$~^|]?+=|[{};,>~]|\s(?![0-9\.])|!important\b)\s*+|([[(:])\s++|\s++([])])|\s++(:)\s*+(?!(?>[^{}"\']++|"(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')*+{)|^\s++|\s++\z|(\s)\s+#si',
2928
+                    // Replace `0(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)` with `0`
2929
+                    '#(?<=[\s:])(0)(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)#si',
2930
+                    // Replace `:0 0 0 0` with `:0`
2931
+                    '#:(0\s+0|0\s+0\s+0\s+0)(?=[;\}]|\!important)#i',
2932
+                    // Replace `background-position:0` with `background-position:0 0`
2933
+                    '#(background-position):0(?=[;\}])#si',
2934
+                    // Replace `0.6` with `.6`, but only when preceded by `:`, `,`, `-` or a white-space
2935
+                    '#(?<=[\s:,\-])0+\.(\d+)#s',
2936
+                    // Minify string value
2937
+                    '#(\/\*(?>.*?\*\/))|(?<!content\:)([\'"])([a-z_][a-z0-9\-_]*?)\2(?=[\s\{\}\];,])#si',
2938
+                    '#(\/\*(?>.*?\*\/))|(\burl\()([\'"])([^\s]+?)\3(\))#si',
2939
+                    // Minify HEX color code
2940
+                    '#(?<=[\s:,\-]\#)([a-f0-6]+)\1([a-f0-6]+)\2([a-f0-6]+)\3#i',
2941
+                    // Replace `(border|outline):none` with `(border|outline):0`
2942
+                    '#(?<=[\{;])(border|outline):none(?=[;\}\!])#',
2943
+                    // Remove empty selector(s)
2944
+                    '#(\/\*(?>.*?\*\/))|(^|[\{\}])(?:[^\s\{\}]+)\{\}#s'
2945
+                ),
2946
+                array(
2947
+                    '$1',
2948
+                    '$1$2$3$4$5$6$7',
2949
+                    '$1',
2950
+                    ':0',
2951
+                    '$1:0 0',
2952
+                    '.$1',
2953
+                    '$1$3',
2954
+                    '$1$2$4$5',
2955
+                    '$1$2$3',
2956
+                    '$1:0',
2957
+                    '$1$2'
2958
+                ),
2959
+                $input);
2960
+        }
2961
+
2962
+        /**
2963
+         * Get the conditional fields JavaScript.
2964
+         *
2965
+         * @return mixed
2966
+         */
2967
+        public function conditional_fields_js() {
2968
+            ob_start();
2969
+            ?>
2970 2970
             <script>
2971 2971
                 /**
2972 2972
                  * Conditional Fields
@@ -3469,14 +3469,14 @@  discard block
 block discarded – undo
3469 3469
 				<?php do_action( 'aui_conditional_fields_js', $this ); ?>
3470 3470
             </script>
3471 3471
 			<?php
3472
-			$output = ob_get_clean();
3472
+            $output = ob_get_clean();
3473 3473
 
3474
-			return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) );
3475
-		}
3476
-	}
3474
+            return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) );
3475
+        }
3476
+    }
3477 3477
 
3478
-	/**
3479
-	 * Run the class if found.
3480
-	 */
3481
-	AyeCode_UI_Settings::instance();
3478
+    /**
3479
+     * Run the class if found.
3480
+     */
3481
+    AyeCode_UI_Settings::instance();
3482 3482
 }
3483 3483
\ No newline at end of file
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/sd-functions.php 1 patch
Indentation   +1678 added lines, -1678 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,82 +50,82 @@  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
-		'6'    => '6',
63
-		'7'    => '7',
64
-		'8'    => '8',
65
-		'9'    => '9',
66
-		'10'    => '10',
67
-		'11'    => '11',
68
-		'12'    => '12',
69
-	);
70
-
71
-	if ( $include_negatives ) {
72
-		$options['n1'] = '-1';
73
-		$options['n2'] = '-2';
74
-		$options['n3'] = '-3';
75
-		$options['n4'] = '-4';
76
-		$options['n5'] = '-5';
77
-		$options['n6'] = '-6';
78
-		$options['n7'] = '-7';
79
-		$options['n8'] = '-8';
80
-		$options['n9'] = '-9';
81
-		$options['n10'] = '-10';
82
-		$options['n11'] = '-11';
83
-		$options['n12'] = '-12';
84
-	}
85
-
86
-	$defaults = array(
87
-		'type'     => 'select',
88
-		'title'    => __( 'Margin top', 'super-duper' ),
89
-		'options'  => $options,
90
-		'default'  => '',
91
-		'desc_tip' => true,
92
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
93
-	);
94
-
95
-	// title
96
-	if ( $type == 'mt' ) {
97
-		$defaults['title'] = __( 'Margin top', 'super-duper' );
98
-		$defaults['icon']  = 'box-top';
99
-		$defaults['row']   = array(
100
-			'title' => __( 'Margins', 'super-duper' ),
101
-			'key'   => 'wrapper-margins',
102
-			'open'  => true,
103
-			'class' => 'text-center',
104
-		);
105
-	} elseif ( $type == 'mr' ) {
106
-		$defaults['title'] = __( 'Margin right', 'super-duper' );
107
-		$defaults['icon']  = 'box-right';
108
-		$defaults['row']   = array(
109
-			'key' => 'wrapper-margins',
110
-		);
111
-	} elseif ( $type == 'mb' ) {
112
-		$defaults['title'] = __( 'Margin bottom', 'super-duper' );
113
-		$defaults['icon']  = 'box-bottom';
114
-		$defaults['row']   = array(
115
-			'key' => 'wrapper-margins',
116
-		);
117
-	} elseif ( $type == 'ml' ) {
118
-		$defaults['title'] = __( 'Margin left', 'super-duper' );
119
-		$defaults['icon']  = 'box-left';
120
-		$defaults['row']   = array(
121
-			'key'   => 'wrapper-margins',
122
-			'close' => true,
123
-		);
124
-	}
125
-
126
-	$input = wp_parse_args( $overwrite, $defaults );
127
-
128
-	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
+        '6'    => '6',
63
+        '7'    => '7',
64
+        '8'    => '8',
65
+        '9'    => '9',
66
+        '10'    => '10',
67
+        '11'    => '11',
68
+        '12'    => '12',
69
+    );
70
+
71
+    if ( $include_negatives ) {
72
+        $options['n1'] = '-1';
73
+        $options['n2'] = '-2';
74
+        $options['n3'] = '-3';
75
+        $options['n4'] = '-4';
76
+        $options['n5'] = '-5';
77
+        $options['n6'] = '-6';
78
+        $options['n7'] = '-7';
79
+        $options['n8'] = '-8';
80
+        $options['n9'] = '-9';
81
+        $options['n10'] = '-10';
82
+        $options['n11'] = '-11';
83
+        $options['n12'] = '-12';
84
+    }
85
+
86
+    $defaults = array(
87
+        'type'     => 'select',
88
+        'title'    => __( 'Margin top', 'super-duper' ),
89
+        'options'  => $options,
90
+        'default'  => '',
91
+        'desc_tip' => true,
92
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
93
+    );
94
+
95
+    // title
96
+    if ( $type == 'mt' ) {
97
+        $defaults['title'] = __( 'Margin top', 'super-duper' );
98
+        $defaults['icon']  = 'box-top';
99
+        $defaults['row']   = array(
100
+            'title' => __( 'Margins', 'super-duper' ),
101
+            'key'   => 'wrapper-margins',
102
+            'open'  => true,
103
+            'class' => 'text-center',
104
+        );
105
+    } elseif ( $type == 'mr' ) {
106
+        $defaults['title'] = __( 'Margin right', 'super-duper' );
107
+        $defaults['icon']  = 'box-right';
108
+        $defaults['row']   = array(
109
+            'key' => 'wrapper-margins',
110
+        );
111
+    } elseif ( $type == 'mb' ) {
112
+        $defaults['title'] = __( 'Margin bottom', 'super-duper' );
113
+        $defaults['icon']  = 'box-bottom';
114
+        $defaults['row']   = array(
115
+            'key' => 'wrapper-margins',
116
+        );
117
+    } elseif ( $type == 'ml' ) {
118
+        $defaults['title'] = __( 'Margin left', 'super-duper' );
119
+        $defaults['icon']  = 'box-left';
120
+        $defaults['row']   = array(
121
+            'key'   => 'wrapper-margins',
122
+            'close' => true,
123
+        );
124
+    }
125
+
126
+    $input = wp_parse_args( $overwrite, $defaults );
127
+
128
+    return $input;
129 129
 }
130 130
 
131 131
 /**
@@ -137,67 +137,67 @@  discard block
 block discarded – undo
137 137
  * @return array
138 138
  */
139 139
 function sd_get_padding_input( $type = 'pt', $overwrite = array() ) {
140
-	$options = array(
141
-		''  => __( 'None', 'super-duper' ),
142
-		'0' => '0',
143
-		'1' => '1',
144
-		'2' => '2',
145
-		'3' => '3',
146
-		'4' => '4',
147
-		'5' => '5',
148
-		'6'    => '6',
149
-		'7'    => '7',
150
-		'8'    => '8',
151
-		'9'    => '9',
152
-		'10'    => '10',
153
-		'11'    => '11',
154
-		'12'    => '12',
155
-	);
156
-
157
-	$defaults = array(
158
-		'type'     => 'select',
159
-		'title'    => __( 'Padding top', 'super-duper' ),
160
-		'options'  => $options,
161
-		'default'  => '',
162
-		'desc_tip' => true,
163
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
164
-	);
165
-
166
-	// title
167
-	if ( $type == 'pt' ) {
168
-		$defaults['title'] = __( 'Padding top', 'super-duper' );
169
-		$defaults['icon']  = 'box-top';
170
-		$defaults['row']   = array(
171
-			'title' => __( 'Padding', 'super-duper' ),
172
-			'key'   => 'wrapper-padding',
173
-			'open'  => true,
174
-			'class' => 'text-center',
175
-		);
176
-	} elseif ( $type == 'pr' ) {
177
-		$defaults['title'] = __( 'Padding right', 'super-duper' );
178
-		$defaults['icon']  = 'box-right';
179
-		$defaults['row']   = array(
180
-			'key' => 'wrapper-padding',
181
-		);
182
-	} elseif ( $type == 'pb' ) {
183
-		$defaults['title'] = __( 'Padding bottom', 'super-duper' );
184
-		$defaults['icon']  = 'box-bottom';
185
-		$defaults['row']   = array(
186
-			'key' => 'wrapper-padding',
187
-		);
188
-	} elseif ( $type == 'pl' ) {
189
-		$defaults['title'] = __( 'Padding left', 'super-duper' );
190
-		$defaults['icon']  = 'box-left';
191
-		$defaults['row']   = array(
192
-			'key'   => 'wrapper-padding',
193
-			'close' => true,
194
-
195
-		);
196
-	}
197
-
198
-	$input = wp_parse_args( $overwrite, $defaults );
199
-
200
-	return $input;
140
+    $options = array(
141
+        ''  => __( 'None', 'super-duper' ),
142
+        '0' => '0',
143
+        '1' => '1',
144
+        '2' => '2',
145
+        '3' => '3',
146
+        '4' => '4',
147
+        '5' => '5',
148
+        '6'    => '6',
149
+        '7'    => '7',
150
+        '8'    => '8',
151
+        '9'    => '9',
152
+        '10'    => '10',
153
+        '11'    => '11',
154
+        '12'    => '12',
155
+    );
156
+
157
+    $defaults = array(
158
+        'type'     => 'select',
159
+        'title'    => __( 'Padding top', 'super-duper' ),
160
+        'options'  => $options,
161
+        'default'  => '',
162
+        'desc_tip' => true,
163
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
164
+    );
165
+
166
+    // title
167
+    if ( $type == 'pt' ) {
168
+        $defaults['title'] = __( 'Padding top', 'super-duper' );
169
+        $defaults['icon']  = 'box-top';
170
+        $defaults['row']   = array(
171
+            'title' => __( 'Padding', 'super-duper' ),
172
+            'key'   => 'wrapper-padding',
173
+            'open'  => true,
174
+            'class' => 'text-center',
175
+        );
176
+    } elseif ( $type == 'pr' ) {
177
+        $defaults['title'] = __( 'Padding right', 'super-duper' );
178
+        $defaults['icon']  = 'box-right';
179
+        $defaults['row']   = array(
180
+            'key' => 'wrapper-padding',
181
+        );
182
+    } elseif ( $type == 'pb' ) {
183
+        $defaults['title'] = __( 'Padding bottom', 'super-duper' );
184
+        $defaults['icon']  = 'box-bottom';
185
+        $defaults['row']   = array(
186
+            'key' => 'wrapper-padding',
187
+        );
188
+    } elseif ( $type == 'pl' ) {
189
+        $defaults['title'] = __( 'Padding left', 'super-duper' );
190
+        $defaults['icon']  = 'box-left';
191
+        $defaults['row']   = array(
192
+            'key'   => 'wrapper-padding',
193
+            'close' => true,
194
+
195
+        );
196
+    }
197
+
198
+    $input = wp_parse_args( $overwrite, $defaults );
199
+
200
+    return $input;
201 201
 }
202 202
 
203 203
 /**
@@ -210,57 +210,57 @@  discard block
 block discarded – undo
210 210
  */
211 211
 function sd_get_border_input( $type = 'border', $overwrite = array() ) {
212 212
 
213
-	$defaults = array(
214
-		'type'     => 'select',
215
-		'title'    => __( 'Border' ),
216
-		'options'  => array(),
217
-		'default'  => '',
218
-		'desc_tip' => true,
219
-		'group'    => __( 'Wrapper Styles', 'geodirectory' ),
220
-	);
221
-
222
-	// title
223
-	if ( $type == 'rounded' ) {
224
-		$defaults['title']   = __( 'Border radius type', 'super-duper' );
225
-		$defaults['options'] = array(
226
-			''               => __( 'Default', 'super-duper' ),
227
-			'rounded'        => 'rounded',
228
-			'rounded-top'    => 'rounded-top',
229
-			'rounded-right'  => 'rounded-right',
230
-			'rounded-bottom' => 'rounded-bottom',
231
-			'rounded-left'   => 'rounded-left',
232
-			'rounded-circle' => 'rounded-circle',
233
-			'rounded-pill'   => 'rounded-pill',
234
-			'rounded-0'      => 'rounded-0',
235
-		);
236
-	} elseif ( $type == 'rounded_size' ) {
237
-		$defaults['title']   = __( 'Border radius size', 'super-duper' );
238
-		$defaults['options'] = array(
239
-			''   => __( 'Default', 'super-duper' ),
240
-			'sm' => __( 'Small', 'super-duper' ),
241
-			'lg' => __( 'Large', 'super-duper' ),
242
-		);
243
-	} elseif ( $type == 'type' ) {
244
-		$defaults['title']   = __( 'Border type', 'super-duper' );
245
-		$defaults['options'] = array(
246
-			''              => __( 'None', 'super-duper' ),
247
-			'border'        => __( 'Full', 'super-duper' ),
248
-			'border-top'    => __( 'Top', 'super-duper' ),
249
-			'border-bottom' => __( 'Bottom', 'super-duper' ),
250
-			'border-left'   => __( 'Left', 'super-duper' ),
251
-			'border-right'  => __( 'Right', 'super-duper' ),
252
-		);
253
-	} else {
254
-		$defaults['title']   = __( 'Border color' );
255
-		$defaults['options'] = array(
256
-			                       ''  => __( 'Default', 'super-duper' ),
257
-			                       '0' => __( 'None', 'super-duper' ),
258
-		                       ) + sd_aui_colors();
259
-	}
260
-
261
-	$input = wp_parse_args( $overwrite, $defaults );
262
-
263
-	return $input;
213
+    $defaults = array(
214
+        'type'     => 'select',
215
+        'title'    => __( 'Border' ),
216
+        'options'  => array(),
217
+        'default'  => '',
218
+        'desc_tip' => true,
219
+        'group'    => __( 'Wrapper Styles', 'geodirectory' ),
220
+    );
221
+
222
+    // title
223
+    if ( $type == 'rounded' ) {
224
+        $defaults['title']   = __( 'Border radius type', 'super-duper' );
225
+        $defaults['options'] = array(
226
+            ''               => __( 'Default', 'super-duper' ),
227
+            'rounded'        => 'rounded',
228
+            'rounded-top'    => 'rounded-top',
229
+            'rounded-right'  => 'rounded-right',
230
+            'rounded-bottom' => 'rounded-bottom',
231
+            'rounded-left'   => 'rounded-left',
232
+            'rounded-circle' => 'rounded-circle',
233
+            'rounded-pill'   => 'rounded-pill',
234
+            'rounded-0'      => 'rounded-0',
235
+        );
236
+    } elseif ( $type == 'rounded_size' ) {
237
+        $defaults['title']   = __( 'Border radius size', 'super-duper' );
238
+        $defaults['options'] = array(
239
+            ''   => __( 'Default', 'super-duper' ),
240
+            'sm' => __( 'Small', 'super-duper' ),
241
+            'lg' => __( 'Large', 'super-duper' ),
242
+        );
243
+    } elseif ( $type == 'type' ) {
244
+        $defaults['title']   = __( 'Border type', 'super-duper' );
245
+        $defaults['options'] = array(
246
+            ''              => __( 'None', 'super-duper' ),
247
+            'border'        => __( 'Full', 'super-duper' ),
248
+            'border-top'    => __( 'Top', 'super-duper' ),
249
+            'border-bottom' => __( 'Bottom', 'super-duper' ),
250
+            'border-left'   => __( 'Left', 'super-duper' ),
251
+            'border-right'  => __( 'Right', 'super-duper' ),
252
+        );
253
+    } else {
254
+        $defaults['title']   = __( 'Border color' );
255
+        $defaults['options'] = array(
256
+                                    ''  => __( 'Default', 'super-duper' ),
257
+                                    '0' => __( 'None', 'super-duper' ),
258
+                                ) + sd_aui_colors();
259
+    }
260
+
261
+    $input = wp_parse_args( $overwrite, $defaults );
262
+
263
+    return $input;
264 264
 }
265 265
 
266 266
 /**
@@ -272,25 +272,25 @@  discard block
 block discarded – undo
272 272
  * @return array
273 273
  */
274 274
 function sd_get_shadow_input( $type = 'shadow', $overwrite = array() ) {
275
-	$options = array(
276
-		''          => __( 'None', 'super-duper' ),
277
-		'shadow-sm' => __( 'Small', 'super-duper' ),
278
-		'shadow'    => __( 'Regular', 'super-duper' ),
279
-		'shadow-lg' => __( 'Large', 'super-duper' ),
280
-	);
281
-
282
-	$defaults = array(
283
-		'type'     => 'select',
284
-		'title'    => __( 'Shadow', 'super-duper' ),
285
-		'options'  => $options,
286
-		'default'  => '',
287
-		'desc_tip' => true,
288
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
289
-	);
290
-
291
-	$input = wp_parse_args( $overwrite, $defaults );
292
-
293
-	return $input;
275
+    $options = array(
276
+        ''          => __( 'None', 'super-duper' ),
277
+        'shadow-sm' => __( 'Small', 'super-duper' ),
278
+        'shadow'    => __( 'Regular', 'super-duper' ),
279
+        'shadow-lg' => __( 'Large', 'super-duper' ),
280
+    );
281
+
282
+    $defaults = array(
283
+        'type'     => 'select',
284
+        'title'    => __( 'Shadow', 'super-duper' ),
285
+        'options'  => $options,
286
+        'default'  => '',
287
+        'desc_tip' => true,
288
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
289
+    );
290
+
291
+    $input = wp_parse_args( $overwrite, $defaults );
292
+
293
+    return $input;
294 294
 }
295 295
 
296 296
 /**
@@ -302,23 +302,23 @@  discard block
 block discarded – undo
302 302
  * @return array
303 303
  */
304 304
 function sd_get_background_input( $type = 'bg', $overwrite = array() ) {
305
-	$options = array(
306
-		           ''            => __( 'None', 'super-duper' ),
307
-		           'transparent' => __( 'Transparent', 'super-duper' ),
308
-	           ) + sd_aui_colors();
309
-
310
-	$defaults = array(
311
-		'type'     => 'select',
312
-		'title'    => __( 'Background color', 'super-duper' ),
313
-		'options'  => $options,
314
-		'default'  => '',
315
-		'desc_tip' => true,
316
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
317
-	);
318
-
319
-	$input = wp_parse_args( $overwrite, $defaults );
320
-
321
-	return $input;
305
+    $options = array(
306
+                    ''            => __( 'None', 'super-duper' ),
307
+                    'transparent' => __( 'Transparent', 'super-duper' ),
308
+                ) + sd_aui_colors();
309
+
310
+    $defaults = array(
311
+        'type'     => 'select',
312
+        'title'    => __( 'Background color', 'super-duper' ),
313
+        'options'  => $options,
314
+        'default'  => '',
315
+        'desc_tip' => true,
316
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
317
+    );
318
+
319
+    $input = wp_parse_args( $overwrite, $defaults );
320
+
321
+    return $input;
322 322
 }
323 323
 
324 324
 /**
@@ -330,118 +330,118 @@  discard block
 block discarded – undo
330 330
  * @return array
331 331
  */
332 332
 function sd_get_background_inputs( $type = 'bg', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array() ) {
333
-	$options = array(
334
-		           ''            => __( 'None', 'super-duper' ),
335
-		           'transparent' => __( 'Transparent', 'super-duper' ),
336
-	           ) + sd_aui_colors()
337
-	           + array(
338
-		           'custom-color'    => __( 'Custom Color', 'super-duper' ),
339
-		           'custom-gradient' => __( 'Custom Gradient', 'super-duper' ),
340
-	           );
341
-
342
-	$defaults = array(
343
-		'type'     => 'select',
344
-		'title'    => __( 'Background Color', 'super-duper' ),
345
-		'options'  => $options,
346
-		'default'  => '',
347
-		'desc_tip' => true,
348
-		'group'    => __( 'Background', 'super-duper' ),
349
-	);
350
-
351
-	if ( $overwrite !== false ) {
352
-		$input[ $type ] = wp_parse_args( $overwrite, $defaults );
353
-	}
354
-
355
-	if ( $overwrite_color !== false ) {
356
-		$input[ $type . '_color' ] = wp_parse_args(
357
-			$overwrite_color,
358
-			array(
359
-				'type'            => 'color',
360
-				'title'           => __( 'Custom color', 'super-duper' ),
361
-				'placeholder'     => '',
362
-				'default'         => '#0073aa',
363
-				'desc_tip'        => true,
364
-				'group'           => __( 'Background', 'super-duper' ),
365
-				'element_require' => '[%' . $type . '%]=="custom-color"',
366
-			)
367
-		);
368
-	}
369
-
370
-	if ( $overwrite_gradient !== false ) {
371
-		$input[ $type . '_gradient' ] = wp_parse_args(
372
-			$overwrite_gradient,
373
-			array(
374
-				'type'            => 'gradient',
375
-				'title'           => __( 'Custom gradient', 'super-duper' ),
376
-				'placeholder'     => '',
377
-				'default'         => 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
378
-				'desc_tip'        => true,
379
-				'group'           => __( 'Background', 'super-duper' ),
380
-				'element_require' => '[%' . $type . '%]=="custom-gradient"',
381
-			)
382
-		);
383
-	}
384
-
385
-	if ( $overwrite_image !== false ) {
386
-
387
-		$input[ $type . '_image_fixed' ] = array(
388
-			'type'            => 'checkbox',
389
-			'title'           => __( 'Fixed background', 'super-duper' ),
390
-			'default'         => '',
391
-			'desc_tip'        => true,
392
-			'group'           => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background' ),
393
-			'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )',
394
-
395
-		);
396
-
397
-		$input[ $type . '_image_use_featured' ] = array(
398
-			'type'            => 'checkbox',
399
-			'title'           => __( 'Use featured image', 'super-duper' ),
400
-			'default'         => '',
401
-			'desc_tip'        => true,
402
-			'group'           => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background', 'super-duper' ),
403
-			'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )',
404
-
405
-		);
406
-
407
-		$input[ $type . '_image' ] = wp_parse_args(
408
-			$overwrite_image,
409
-			array(
410
-				'type'        => 'image',
411
-				'title'       => __( 'Custom image', 'super-duper' ),
412
-				'placeholder' => '',
413
-				'default'     => '',
414
-				'desc_tip'    => true,
415
-				'group'       => __( 'Background', 'super-duper' ),
416
-				//          'element_require' => ' ![%' . $type . '_image_use_featured%] '
417
-			)
418
-		);
419
-
420
-		$input[ $type . '_image_id' ] = wp_parse_args(
421
-			$overwrite_image,
422
-			array(
423
-				'type'        => 'hidden',
424
-				'hidden_type' => 'number',
425
-				'title'       => '',
426
-				'placeholder' => '',
427
-				'default'     => '',
428
-				'group'       => __( 'Background', 'super-duper' ),
429
-			)
430
-		);
431
-
432
-		$input[ $type . '_image_xy' ] = wp_parse_args(
433
-			$overwrite_image,
434
-			array(
435
-				'type'        => 'image_xy',
436
-				'title'       => '',
437
-				'placeholder' => '',
438
-				'default'     => '',
439
-				'group'       => __( 'Background', 'super-duper' ),
440
-			)
441
-		);
442
-	}
443
-
444
-	return $input;
333
+    $options = array(
334
+                    ''            => __( 'None', 'super-duper' ),
335
+                    'transparent' => __( 'Transparent', 'super-duper' ),
336
+                ) + sd_aui_colors()
337
+               + array(
338
+                    'custom-color'    => __( 'Custom Color', 'super-duper' ),
339
+                    'custom-gradient' => __( 'Custom Gradient', 'super-duper' ),
340
+                );
341
+
342
+    $defaults = array(
343
+        'type'     => 'select',
344
+        'title'    => __( 'Background Color', 'super-duper' ),
345
+        'options'  => $options,
346
+        'default'  => '',
347
+        'desc_tip' => true,
348
+        'group'    => __( 'Background', 'super-duper' ),
349
+    );
350
+
351
+    if ( $overwrite !== false ) {
352
+        $input[ $type ] = wp_parse_args( $overwrite, $defaults );
353
+    }
354
+
355
+    if ( $overwrite_color !== false ) {
356
+        $input[ $type . '_color' ] = wp_parse_args(
357
+            $overwrite_color,
358
+            array(
359
+                'type'            => 'color',
360
+                'title'           => __( 'Custom color', 'super-duper' ),
361
+                'placeholder'     => '',
362
+                'default'         => '#0073aa',
363
+                'desc_tip'        => true,
364
+                'group'           => __( 'Background', 'super-duper' ),
365
+                'element_require' => '[%' . $type . '%]=="custom-color"',
366
+            )
367
+        );
368
+    }
369
+
370
+    if ( $overwrite_gradient !== false ) {
371
+        $input[ $type . '_gradient' ] = wp_parse_args(
372
+            $overwrite_gradient,
373
+            array(
374
+                'type'            => 'gradient',
375
+                'title'           => __( 'Custom gradient', 'super-duper' ),
376
+                'placeholder'     => '',
377
+                'default'         => 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
378
+                'desc_tip'        => true,
379
+                'group'           => __( 'Background', 'super-duper' ),
380
+                'element_require' => '[%' . $type . '%]=="custom-gradient"',
381
+            )
382
+        );
383
+    }
384
+
385
+    if ( $overwrite_image !== false ) {
386
+
387
+        $input[ $type . '_image_fixed' ] = array(
388
+            'type'            => 'checkbox',
389
+            'title'           => __( 'Fixed background', 'super-duper' ),
390
+            'default'         => '',
391
+            'desc_tip'        => true,
392
+            'group'           => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background' ),
393
+            'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )',
394
+
395
+        );
396
+
397
+        $input[ $type . '_image_use_featured' ] = array(
398
+            'type'            => 'checkbox',
399
+            'title'           => __( 'Use featured image', 'super-duper' ),
400
+            'default'         => '',
401
+            'desc_tip'        => true,
402
+            'group'           => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background', 'super-duper' ),
403
+            'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )',
404
+
405
+        );
406
+
407
+        $input[ $type . '_image' ] = wp_parse_args(
408
+            $overwrite_image,
409
+            array(
410
+                'type'        => 'image',
411
+                'title'       => __( 'Custom image', 'super-duper' ),
412
+                'placeholder' => '',
413
+                'default'     => '',
414
+                'desc_tip'    => true,
415
+                'group'       => __( 'Background', 'super-duper' ),
416
+                //          'element_require' => ' ![%' . $type . '_image_use_featured%] '
417
+            )
418
+        );
419
+
420
+        $input[ $type . '_image_id' ] = wp_parse_args(
421
+            $overwrite_image,
422
+            array(
423
+                'type'        => 'hidden',
424
+                'hidden_type' => 'number',
425
+                'title'       => '',
426
+                'placeholder' => '',
427
+                'default'     => '',
428
+                'group'       => __( 'Background', 'super-duper' ),
429
+            )
430
+        );
431
+
432
+        $input[ $type . '_image_xy' ] = wp_parse_args(
433
+            $overwrite_image,
434
+            array(
435
+                'type'        => 'image_xy',
436
+                'title'       => '',
437
+                'placeholder' => '',
438
+                'default'     => '',
439
+                'group'       => __( 'Background', 'super-duper' ),
440
+            )
441
+        );
442
+    }
443
+
444
+    return $input;
445 445
 }
446 446
 
447 447
 /**
@@ -454,175 +454,175 @@  discard block
 block discarded – undo
454 454
  */
455 455
 function sd_get_shape_divider_inputs( $type = 'sd', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array() ) {
456 456
 
457
-	$options = array(
458
-		''                      => __( 'None', 'super-duper' ),
459
-		'mountains'             => __( 'Mountains', 'super-duper' ),
460
-		'drops'                 => __( 'Drops', 'super-duper' ),
461
-		'clouds'                => __( 'Clouds', 'super-duper' ),
462
-		'zigzag'                => __( 'Zigzag', 'super-duper' ),
463
-		'pyramids'              => __( 'Pyramids', 'super-duper' ),
464
-		'triangle'              => __( 'Triangle', 'super-duper' ),
465
-		'triangle-asymmetrical' => __( 'Triangle Asymmetrical', 'super-duper' ),
466
-		'tilt'                  => __( 'Tilt', 'super-duper' ),
467
-		'opacity-tilt'          => __( 'Opacity Tilt', 'super-duper' ),
468
-		'opacity-fan'           => __( 'Opacity Fan', 'super-duper' ),
469
-		'curve'                 => __( 'Curve', 'super-duper' ),
470
-		'curve-asymmetrical'    => __( 'Curve Asymmetrical', 'super-duper' ),
471
-		'waves'                 => __( 'Waves', 'super-duper' ),
472
-		'wave-brush'            => __( 'Wave Brush', 'super-duper' ),
473
-		'waves-pattern'         => __( 'Waves Pattern', 'super-duper' ),
474
-		'arrow'                 => __( 'Arrow', 'super-duper' ),
475
-		'split'                 => __( 'Split', 'super-duper' ),
476
-		'book'                  => __( 'Book', 'super-duper' ),
477
-	);
478
-
479
-	$defaults = array(
480
-		'type'     => 'select',
481
-		'title'    => __( 'Type', 'super-duper' ),
482
-		'options'  => $options,
483
-		'default'  => '',
484
-		'desc_tip' => true,
485
-		'group'    => __( 'Shape Divider', 'super-duper' ),
486
-	);
487
-
488
-	$input[ $type ] = wp_parse_args( $overwrite, $defaults );
489
-
490
-	$input[ $type . '_notice' ] = array(
491
-		'type'            => 'notice',
492
-		'desc'            => __( 'Parent element must be position `relative`', 'super-duper' ),
493
-		'status'          => 'warning',
494
-		'group'           => __( 'Shape Divider', 'super-duper' ),
495
-		'element_require' => '[%' . $type . '%]!=""',
496
-	);
497
-
498
-	$input[ $type . '_position' ] = wp_parse_args(
499
-		$overwrite_color,
500
-		array(
501
-			'type'            => 'select',
502
-			'title'           => __( 'Position', 'super-duper' ),
503
-			'options'         => array(
504
-				'top'    => __( 'Top', 'super-duper' ),
505
-				'bottom' => __( 'Bottom', 'super-duper' ),
506
-			),
507
-			'desc_tip'        => true,
508
-			'group'           => __( 'Shape Divider', 'super-duper' ),
509
-			'element_require' => '[%' . $type . '%]!=""',
510
-		)
511
-	);
512
-
513
-	$options = array(
514
-		           ''            => __( 'None', 'super-duper' ),
515
-		           'transparent' => __( 'Transparent', 'super-duper' ),
516
-	           ) + sd_aui_colors()
517
-	           + array(
518
-		           'custom-color' => __( 'Custom Color', 'super-duper' ),
519
-	           );
520
-
521
-	$input[ $type . '_color' ] = wp_parse_args(
522
-		$overwrite_color,
523
-		array(
524
-			'type'            => 'select',
525
-			'title'           => __( 'Color', 'super-duper' ),
526
-			'options'         => $options,
527
-			'desc_tip'        => true,
528
-			'group'           => __( 'Shape Divider', 'super-duper' ),
529
-			'element_require' => '[%' . $type . '%]!=""',
530
-		)
531
-	);
532
-
533
-	$input[ $type . '_custom_color' ] = wp_parse_args(
534
-		$overwrite_color,
535
-		array(
536
-			'type'            => 'color',
537
-			'title'           => __( 'Custom color', 'super-duper' ),
538
-			'placeholder'     => '',
539
-			'default'         => '#0073aa',
540
-			'desc_tip'        => true,
541
-			'group'           => __( 'Shape Divider', 'super-duper' ),
542
-			'element_require' => '[%' . $type . '_color%]=="custom-color" && [%' . $type . '%]!=""',
543
-		)
544
-	);
545
-
546
-	$input[ $type . '_width' ] = wp_parse_args(
547
-		$overwrite_gradient,
548
-		array(
549
-			'type'              => 'range',
550
-			'title'             => __( 'Width', 'super-duper' ),
551
-			'placeholder'       => '',
552
-			'default'           => '200',
553
-			'desc_tip'          => true,
554
-			'custom_attributes' => array(
555
-				'min' => 100,
556
-				'max' => 300,
557
-			),
558
-			'group'             => __( 'Shape Divider', 'super-duper' ),
559
-			'element_require'   => '[%' . $type . '%]!=""',
560
-		)
561
-	);
562
-
563
-	$input[ $type . '_height' ] = array(
564
-		'type'              => 'range',
565
-		'title'             => __( 'Height', 'super-duper' ),
566
-		'default'           => '100',
567
-		'desc_tip'          => true,
568
-		'custom_attributes' => array(
569
-			'min' => 0,
570
-			'max' => 500,
571
-		),
572
-		'group'             => __( 'Shape Divider', 'super-duper' ),
573
-		'element_require'   => '[%' . $type . '%]!=""',
574
-	);
575
-
576
-	$requires = array(
577
-		'mountains'             => array( 'flip' ),
578
-		'drops'                 => array( 'flip', 'invert' ),
579
-		'clouds'                => array( 'flip', 'invert' ),
580
-		'zigzag'                => array(),
581
-		'pyramids'              => array( 'flip', 'invert' ),
582
-		'triangle'              => array( 'invert' ),
583
-		'triangle-asymmetrical' => array( 'flip', 'invert' ),
584
-		'tilt'                  => array( 'flip' ),
585
-		'opacity-tilt'          => array( 'flip' ),
586
-		'opacity-fan'           => array(),
587
-		'curve'                 => array( 'invert' ),
588
-		'curve-asymmetrical'    => array( 'flip', 'invert' ),
589
-		'waves'                 => array( 'flip', 'invert' ),
590
-		'wave-brush'            => array( 'flip' ),
591
-		'waves-pattern'         => array( 'flip' ),
592
-		'arrow'                 => array( 'invert' ),
593
-		'split'                 => array( 'invert' ),
594
-		'book'                  => array( 'invert' ),
595
-	);
596
-
597
-	$input[ $type . '_flip' ] = array(
598
-		'type'            => 'checkbox',
599
-		'title'           => __( 'Flip', 'super-duper' ),
600
-		'default'         => '',
601
-		'desc_tip'        => true,
602
-		'group'           => __( 'Shape Divider', 'super-duper' ),
603
-		'element_require' => sd_get_element_require_string( $requires, 'flip', 'sd' ),
604
-	);
605
-
606
-	$input[ $type . '_invert' ] = array(
607
-		'type'            => 'checkbox',
608
-		'title'           => __( 'Invert', 'super-duper' ),
609
-		'default'         => '',
610
-		'desc_tip'        => true,
611
-		'group'           => __( 'Shape Divider', 'super-duper' ),
612
-		'element_require' => sd_get_element_require_string( $requires, 'invert', 'sd' ),
613
-	);
614
-
615
-	$input[ $type . '_btf' ] = array(
616
-		'type'            => 'checkbox',
617
-		'title'           => __( 'Bring to front', 'super-duper' ),
618
-		'default'         => '',
619
-		'desc_tip'        => true,
620
-		'group'           => __( 'Shape Divider', 'super-duper' ),
621
-		'element_require' => '[%' . $type . '%]!=""',
622
-
623
-	);
624
-
625
-	return $input;
457
+    $options = array(
458
+        ''                      => __( 'None', 'super-duper' ),
459
+        'mountains'             => __( 'Mountains', 'super-duper' ),
460
+        'drops'                 => __( 'Drops', 'super-duper' ),
461
+        'clouds'                => __( 'Clouds', 'super-duper' ),
462
+        'zigzag'                => __( 'Zigzag', 'super-duper' ),
463
+        'pyramids'              => __( 'Pyramids', 'super-duper' ),
464
+        'triangle'              => __( 'Triangle', 'super-duper' ),
465
+        'triangle-asymmetrical' => __( 'Triangle Asymmetrical', 'super-duper' ),
466
+        'tilt'                  => __( 'Tilt', 'super-duper' ),
467
+        'opacity-tilt'          => __( 'Opacity Tilt', 'super-duper' ),
468
+        'opacity-fan'           => __( 'Opacity Fan', 'super-duper' ),
469
+        'curve'                 => __( 'Curve', 'super-duper' ),
470
+        'curve-asymmetrical'    => __( 'Curve Asymmetrical', 'super-duper' ),
471
+        'waves'                 => __( 'Waves', 'super-duper' ),
472
+        'wave-brush'            => __( 'Wave Brush', 'super-duper' ),
473
+        'waves-pattern'         => __( 'Waves Pattern', 'super-duper' ),
474
+        'arrow'                 => __( 'Arrow', 'super-duper' ),
475
+        'split'                 => __( 'Split', 'super-duper' ),
476
+        'book'                  => __( 'Book', 'super-duper' ),
477
+    );
478
+
479
+    $defaults = array(
480
+        'type'     => 'select',
481
+        'title'    => __( 'Type', 'super-duper' ),
482
+        'options'  => $options,
483
+        'default'  => '',
484
+        'desc_tip' => true,
485
+        'group'    => __( 'Shape Divider', 'super-duper' ),
486
+    );
487
+
488
+    $input[ $type ] = wp_parse_args( $overwrite, $defaults );
489
+
490
+    $input[ $type . '_notice' ] = array(
491
+        'type'            => 'notice',
492
+        'desc'            => __( 'Parent element must be position `relative`', 'super-duper' ),
493
+        'status'          => 'warning',
494
+        'group'           => __( 'Shape Divider', 'super-duper' ),
495
+        'element_require' => '[%' . $type . '%]!=""',
496
+    );
497
+
498
+    $input[ $type . '_position' ] = wp_parse_args(
499
+        $overwrite_color,
500
+        array(
501
+            'type'            => 'select',
502
+            'title'           => __( 'Position', 'super-duper' ),
503
+            'options'         => array(
504
+                'top'    => __( 'Top', 'super-duper' ),
505
+                'bottom' => __( 'Bottom', 'super-duper' ),
506
+            ),
507
+            'desc_tip'        => true,
508
+            'group'           => __( 'Shape Divider', 'super-duper' ),
509
+            'element_require' => '[%' . $type . '%]!=""',
510
+        )
511
+    );
512
+
513
+    $options = array(
514
+                    ''            => __( 'None', 'super-duper' ),
515
+                    'transparent' => __( 'Transparent', 'super-duper' ),
516
+                ) + sd_aui_colors()
517
+               + array(
518
+                    'custom-color' => __( 'Custom Color', 'super-duper' ),
519
+                );
520
+
521
+    $input[ $type . '_color' ] = wp_parse_args(
522
+        $overwrite_color,
523
+        array(
524
+            'type'            => 'select',
525
+            'title'           => __( 'Color', 'super-duper' ),
526
+            'options'         => $options,
527
+            'desc_tip'        => true,
528
+            'group'           => __( 'Shape Divider', 'super-duper' ),
529
+            'element_require' => '[%' . $type . '%]!=""',
530
+        )
531
+    );
532
+
533
+    $input[ $type . '_custom_color' ] = wp_parse_args(
534
+        $overwrite_color,
535
+        array(
536
+            'type'            => 'color',
537
+            'title'           => __( 'Custom color', 'super-duper' ),
538
+            'placeholder'     => '',
539
+            'default'         => '#0073aa',
540
+            'desc_tip'        => true,
541
+            'group'           => __( 'Shape Divider', 'super-duper' ),
542
+            'element_require' => '[%' . $type . '_color%]=="custom-color" && [%' . $type . '%]!=""',
543
+        )
544
+    );
545
+
546
+    $input[ $type . '_width' ] = wp_parse_args(
547
+        $overwrite_gradient,
548
+        array(
549
+            'type'              => 'range',
550
+            'title'             => __( 'Width', 'super-duper' ),
551
+            'placeholder'       => '',
552
+            'default'           => '200',
553
+            'desc_tip'          => true,
554
+            'custom_attributes' => array(
555
+                'min' => 100,
556
+                'max' => 300,
557
+            ),
558
+            'group'             => __( 'Shape Divider', 'super-duper' ),
559
+            'element_require'   => '[%' . $type . '%]!=""',
560
+        )
561
+    );
562
+
563
+    $input[ $type . '_height' ] = array(
564
+        'type'              => 'range',
565
+        'title'             => __( 'Height', 'super-duper' ),
566
+        'default'           => '100',
567
+        'desc_tip'          => true,
568
+        'custom_attributes' => array(
569
+            'min' => 0,
570
+            'max' => 500,
571
+        ),
572
+        'group'             => __( 'Shape Divider', 'super-duper' ),
573
+        'element_require'   => '[%' . $type . '%]!=""',
574
+    );
575
+
576
+    $requires = array(
577
+        'mountains'             => array( 'flip' ),
578
+        'drops'                 => array( 'flip', 'invert' ),
579
+        'clouds'                => array( 'flip', 'invert' ),
580
+        'zigzag'                => array(),
581
+        'pyramids'              => array( 'flip', 'invert' ),
582
+        'triangle'              => array( 'invert' ),
583
+        'triangle-asymmetrical' => array( 'flip', 'invert' ),
584
+        'tilt'                  => array( 'flip' ),
585
+        'opacity-tilt'          => array( 'flip' ),
586
+        'opacity-fan'           => array(),
587
+        'curve'                 => array( 'invert' ),
588
+        'curve-asymmetrical'    => array( 'flip', 'invert' ),
589
+        'waves'                 => array( 'flip', 'invert' ),
590
+        'wave-brush'            => array( 'flip' ),
591
+        'waves-pattern'         => array( 'flip' ),
592
+        'arrow'                 => array( 'invert' ),
593
+        'split'                 => array( 'invert' ),
594
+        'book'                  => array( 'invert' ),
595
+    );
596
+
597
+    $input[ $type . '_flip' ] = array(
598
+        'type'            => 'checkbox',
599
+        'title'           => __( 'Flip', 'super-duper' ),
600
+        'default'         => '',
601
+        'desc_tip'        => true,
602
+        'group'           => __( 'Shape Divider', 'super-duper' ),
603
+        'element_require' => sd_get_element_require_string( $requires, 'flip', 'sd' ),
604
+    );
605
+
606
+    $input[ $type . '_invert' ] = array(
607
+        'type'            => 'checkbox',
608
+        'title'           => __( 'Invert', 'super-duper' ),
609
+        'default'         => '',
610
+        'desc_tip'        => true,
611
+        'group'           => __( 'Shape Divider', 'super-duper' ),
612
+        'element_require' => sd_get_element_require_string( $requires, 'invert', 'sd' ),
613
+    );
614
+
615
+    $input[ $type . '_btf' ] = array(
616
+        'type'            => 'checkbox',
617
+        'title'           => __( 'Bring to front', 'super-duper' ),
618
+        'default'         => '',
619
+        'desc_tip'        => true,
620
+        'group'           => __( 'Shape Divider', 'super-duper' ),
621
+        'element_require' => '[%' . $type . '%]!=""',
622
+
623
+    );
624
+
625
+    return $input;
626 626
 }
627 627
 
628 628
 /**
@@ -635,22 +635,22 @@  discard block
 block discarded – undo
635 635
  * @return string
636 636
  */
637 637
 function sd_get_element_require_string( $args, $key, $type ) {
638
-	$output   = '';
639
-	$requires = array();
640
-
641
-	if ( ! empty( $args ) ) {
642
-		foreach ( $args as $t => $k ) {
643
-			if ( in_array( $key, $k ) ) {
644
-				$requires[] = '[%' . $type . '%]=="' . $t . '"';
645
-			}
646
-		}
647
-
648
-		if ( ! empty( $requires ) ) {
649
-			$output = '(' . implode( ' || ', $requires ) . ')';
650
-		}
651
-	}
652
-
653
-	return $output;
638
+    $output   = '';
639
+    $requires = array();
640
+
641
+    if ( ! empty( $args ) ) {
642
+        foreach ( $args as $t => $k ) {
643
+            if ( in_array( $key, $k ) ) {
644
+                $requires[] = '[%' . $type . '%]=="' . $t . '"';
645
+            }
646
+        }
647
+
648
+        if ( ! empty( $requires ) ) {
649
+            $output = '(' . implode( ' || ', $requires ) . ')';
650
+        }
651
+    }
652
+
653
+    return $output;
654 654
 }
655 655
 
656 656
 /**
@@ -662,41 +662,41 @@  discard block
 block discarded – undo
662 662
  * @return array
663 663
  */
664 664
 function sd_get_text_color_input( $type = 'text_color', $overwrite = array(), $has_custom = false ) {
665
-	$options = array(
666
-		           '' => __( 'None', 'super-duper' ),
667
-	           ) + sd_aui_colors();
668
-
669
-	if ( $has_custom ) {
670
-		$options['custom'] = __( 'Custom color', 'super-duper' );
671
-	}
672
-
673
-	$defaults = array(
674
-		'type'     => 'select',
675
-		'title'    => __( 'Text color', 'super-duper' ),
676
-		'options'  => $options,
677
-		'default'  => '',
678
-		'desc_tip' => true,
679
-		'group'    => __( 'Typography', 'super-duper' ),
680
-	);
681
-
682
-	$input = wp_parse_args( $overwrite, $defaults );
683
-
684
-	return $input;
665
+    $options = array(
666
+                    '' => __( 'None', 'super-duper' ),
667
+                ) + sd_aui_colors();
668
+
669
+    if ( $has_custom ) {
670
+        $options['custom'] = __( 'Custom color', 'super-duper' );
671
+    }
672
+
673
+    $defaults = array(
674
+        'type'     => 'select',
675
+        'title'    => __( 'Text color', 'super-duper' ),
676
+        'options'  => $options,
677
+        'default'  => '',
678
+        'desc_tip' => true,
679
+        'group'    => __( 'Typography', 'super-duper' ),
680
+    );
681
+
682
+    $input = wp_parse_args( $overwrite, $defaults );
683
+
684
+    return $input;
685 685
 }
686 686
 
687 687
 function sd_get_text_color_input_group( $type = 'text_color', $overwrite = array(), $overwrite_custom = array() ) {
688
-	$inputs = array();
688
+    $inputs = array();
689 689
 
690
-	if ( $overwrite !== false ) {
691
-		$inputs[ $type ] = sd_get_text_color_input( $type, $overwrite, true );
692
-	}
690
+    if ( $overwrite !== false ) {
691
+        $inputs[ $type ] = sd_get_text_color_input( $type, $overwrite, true );
692
+    }
693 693
 
694
-	if ( $overwrite_custom !== false ) {
695
-		$custom            = $type . '_custom';
696
-		$inputs[ $custom ] = sd_get_custom_color_input( $custom, $overwrite_custom, $type );
697
-	}
694
+    if ( $overwrite_custom !== false ) {
695
+        $custom            = $type . '_custom';
696
+        $inputs[ $custom ] = sd_get_custom_color_input( $custom, $overwrite_custom, $type );
697
+    }
698 698
 
699
-	return $inputs;
699
+    return $inputs;
700 700
 }
701 701
 
702 702
 /**
@@ -709,22 +709,22 @@  discard block
 block discarded – undo
709 709
  */
710 710
 function sd_get_custom_color_input( $type = 'color_custom', $overwrite = array(), $parent_type = '' ) {
711 711
 
712
-	$defaults = array(
713
-		'type'        => 'color',
714
-		'title'       => __( 'Custom color', 'super-duper' ),
715
-		'default'     => '',
716
-		'placeholder' => '',
717
-		'desc_tip'    => true,
718
-		'group'       => __( 'Typography', 'super-duper' ),
719
-	);
712
+    $defaults = array(
713
+        'type'        => 'color',
714
+        'title'       => __( 'Custom color', 'super-duper' ),
715
+        'default'     => '',
716
+        'placeholder' => '',
717
+        'desc_tip'    => true,
718
+        'group'       => __( 'Typography', 'super-duper' ),
719
+    );
720 720
 
721
-	if ( $parent_type ) {
722
-		$defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
723
-	}
721
+    if ( $parent_type ) {
722
+        $defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
723
+    }
724 724
 
725
-	$input = wp_parse_args( $overwrite, $defaults );
725
+    $input = wp_parse_args( $overwrite, $defaults );
726 726
 
727
-	return $input;
727
+    return $input;
728 728
 }
729 729
 
730 730
 /**
@@ -737,43 +737,43 @@  discard block
 block discarded – undo
737 737
  */
738 738
 function sd_get_col_input( $type = 'col', $overwrite = array() ) {
739 739
 
740
-	$device_size = '';
741
-	if ( ! empty( $overwrite['device_type'] ) ) {
742
-		if ( $overwrite['device_type'] == 'Tablet' ) {
743
-			$device_size = '-md';
744
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
745
-			$device_size = '-lg';
746
-		}
747
-	}
748
-	$options = array(
749
-		''   => __( 'auto', 'super-duper' ),
750
-		'1'  => '1/12',
751
-		'2'  => '2/12',
752
-		'3'  => '3/12',
753
-		'4'  => '4/12',
754
-		'5'  => '5/12',
755
-		'6'  => '6/12',
756
-		'7'  => '7/12',
757
-		'8'  => '8/12',
758
-		'9'  => '9/12',
759
-		'10' => '10/12',
760
-		'11' => '11/12',
761
-		'12' => '12/12',
762
-	);
763
-
764
-	$defaults = array(
765
-		'type'            => 'select',
766
-		'title'           => __( 'Column width', 'super-duper' ),
767
-		'options'         => $options,
768
-		'default'         => '',
769
-		'desc_tip'        => true,
770
-		'group'           => __( 'Container', 'super-duper' ),
771
-		'element_require' => '[%container%]=="col"',
772
-	);
773
-
774
-	$input = wp_parse_args( $overwrite, $defaults );
775
-
776
-	return $input;
740
+    $device_size = '';
741
+    if ( ! empty( $overwrite['device_type'] ) ) {
742
+        if ( $overwrite['device_type'] == 'Tablet' ) {
743
+            $device_size = '-md';
744
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
745
+            $device_size = '-lg';
746
+        }
747
+    }
748
+    $options = array(
749
+        ''   => __( 'auto', 'super-duper' ),
750
+        '1'  => '1/12',
751
+        '2'  => '2/12',
752
+        '3'  => '3/12',
753
+        '4'  => '4/12',
754
+        '5'  => '5/12',
755
+        '6'  => '6/12',
756
+        '7'  => '7/12',
757
+        '8'  => '8/12',
758
+        '9'  => '9/12',
759
+        '10' => '10/12',
760
+        '11' => '11/12',
761
+        '12' => '12/12',
762
+    );
763
+
764
+    $defaults = array(
765
+        'type'            => 'select',
766
+        'title'           => __( 'Column width', 'super-duper' ),
767
+        'options'         => $options,
768
+        'default'         => '',
769
+        'desc_tip'        => true,
770
+        'group'           => __( 'Container', 'super-duper' ),
771
+        'element_require' => '[%container%]=="col"',
772
+    );
773
+
774
+    $input = wp_parse_args( $overwrite, $defaults );
775
+
776
+    return $input;
777 777
 }
778 778
 
779 779
 /**
@@ -786,37 +786,37 @@  discard block
 block discarded – undo
786 786
  */
787 787
 function sd_get_row_cols_input( $type = 'row_cols', $overwrite = array() ) {
788 788
 
789
-	$device_size = '';
790
-	if ( ! empty( $overwrite['device_type'] ) ) {
791
-		if ( $overwrite['device_type'] == 'Tablet' ) {
792
-			$device_size = '-md';
793
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
794
-			$device_size = '-lg';
795
-		}
796
-	}
797
-	$options = array(
798
-		''  => __( 'auto', 'super-duper' ),
799
-		'1' => '1',
800
-		'2' => '2',
801
-		'3' => '3',
802
-		'4' => '4',
803
-		'5' => '5',
804
-		'6' => '6',
805
-	);
806
-
807
-	$defaults = array(
808
-		'type'            => 'select',
809
-		'title'           => __( 'Row columns', 'super-duper' ),
810
-		'options'         => $options,
811
-		'default'         => '',
812
-		'desc_tip'        => true,
813
-		'group'           => __( 'Container', 'super-duper' ),
814
-		'element_require' => '[%container%]=="row"',
815
-	);
816
-
817
-	$input = wp_parse_args( $overwrite, $defaults );
818
-
819
-	return $input;
789
+    $device_size = '';
790
+    if ( ! empty( $overwrite['device_type'] ) ) {
791
+        if ( $overwrite['device_type'] == 'Tablet' ) {
792
+            $device_size = '-md';
793
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
794
+            $device_size = '-lg';
795
+        }
796
+    }
797
+    $options = array(
798
+        ''  => __( 'auto', 'super-duper' ),
799
+        '1' => '1',
800
+        '2' => '2',
801
+        '3' => '3',
802
+        '4' => '4',
803
+        '5' => '5',
804
+        '6' => '6',
805
+    );
806
+
807
+    $defaults = array(
808
+        'type'            => 'select',
809
+        'title'           => __( 'Row columns', 'super-duper' ),
810
+        'options'         => $options,
811
+        'default'         => '',
812
+        'desc_tip'        => true,
813
+        'group'           => __( 'Container', 'super-duper' ),
814
+        'element_require' => '[%container%]=="row"',
815
+    );
816
+
817
+    $input = wp_parse_args( $overwrite, $defaults );
818
+
819
+    return $input;
820 820
 }
821 821
 
822 822
 /**
@@ -829,33 +829,33 @@  discard block
 block discarded – undo
829 829
  */
830 830
 function sd_get_text_align_input( $type = 'text_align', $overwrite = array() ) {
831 831
 
832
-	$device_size = '';
833
-	if ( ! empty( $overwrite['device_type'] ) ) {
834
-		if ( $overwrite['device_type'] == 'Tablet' ) {
835
-			$device_size = '-md';
836
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
837
-			$device_size = '-lg';
838
-		}
839
-	}
840
-	$options = array(
841
-		''                                => __( 'Default', 'super-duper' ),
842
-		'text' . $device_size . '-left'   => __( 'Left', 'super-duper' ),
843
-		'text' . $device_size . '-right'  => __( 'Right', 'super-duper' ),
844
-		'text' . $device_size . '-center' => __( 'Center', 'super-duper' ),
845
-	);
846
-
847
-	$defaults = array(
848
-		'type'     => 'select',
849
-		'title'    => __( 'Text align', 'super-duper' ),
850
-		'options'  => $options,
851
-		'default'  => '',
852
-		'desc_tip' => true,
853
-		'group'    => __( 'Typography', 'super-duper' ),
854
-	);
855
-
856
-	$input = wp_parse_args( $overwrite, $defaults );
857
-
858
-	return $input;
832
+    $device_size = '';
833
+    if ( ! empty( $overwrite['device_type'] ) ) {
834
+        if ( $overwrite['device_type'] == 'Tablet' ) {
835
+            $device_size = '-md';
836
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
837
+            $device_size = '-lg';
838
+        }
839
+    }
840
+    $options = array(
841
+        ''                                => __( 'Default', 'super-duper' ),
842
+        'text' . $device_size . '-left'   => __( 'Left', 'super-duper' ),
843
+        'text' . $device_size . '-right'  => __( 'Right', 'super-duper' ),
844
+        'text' . $device_size . '-center' => __( 'Center', 'super-duper' ),
845
+    );
846
+
847
+    $defaults = array(
848
+        'type'     => 'select',
849
+        'title'    => __( 'Text align', 'super-duper' ),
850
+        'options'  => $options,
851
+        'default'  => '',
852
+        'desc_tip' => true,
853
+        'group'    => __( 'Typography', 'super-duper' ),
854
+    );
855
+
856
+    $input = wp_parse_args( $overwrite, $defaults );
857
+
858
+    return $input;
859 859
 }
860 860
 
861 861
 /**
@@ -868,39 +868,39 @@  discard block
 block discarded – undo
868 868
  */
869 869
 function sd_get_display_input( $type = 'display', $overwrite = array() ) {
870 870
 
871
-	$device_size = '';
872
-	if ( ! empty( $overwrite['device_type'] ) ) {
873
-		if ( $overwrite['device_type'] == 'Tablet' ) {
874
-			$device_size = '-md';
875
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
876
-			$device_size = '-lg';
877
-		}
878
-	}
879
-	$options = array(
880
-		''                                   => __( 'Default', 'super-duper' ),
881
-		'd' . $device_size . '-none'         => 'none',
882
-		'd' . $device_size . '-inline'       => 'inline',
883
-		'd' . $device_size . '-inline-block' => 'inline-block',
884
-		'd' . $device_size . '-block'        => 'block',
885
-		'd' . $device_size . '-table'        => 'table',
886
-		'd' . $device_size . '-table-cell'   => 'table-cell',
887
-		'd' . $device_size . '-table-row'    => 'table-row',
888
-		'd' . $device_size . '-flex'         => 'flex',
889
-		'd' . $device_size . '-inline-flex'  => 'inline-flex',
890
-	);
891
-
892
-	$defaults = array(
893
-		'type'     => 'select',
894
-		'title'    => __( 'Display', 'super-duper' ),
895
-		'options'  => $options,
896
-		'default'  => '',
897
-		'desc_tip' => true,
898
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
899
-	);
900
-
901
-	$input = wp_parse_args( $overwrite, $defaults );
902
-
903
-	return $input;
871
+    $device_size = '';
872
+    if ( ! empty( $overwrite['device_type'] ) ) {
873
+        if ( $overwrite['device_type'] == 'Tablet' ) {
874
+            $device_size = '-md';
875
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
876
+            $device_size = '-lg';
877
+        }
878
+    }
879
+    $options = array(
880
+        ''                                   => __( 'Default', 'super-duper' ),
881
+        'd' . $device_size . '-none'         => 'none',
882
+        'd' . $device_size . '-inline'       => 'inline',
883
+        'd' . $device_size . '-inline-block' => 'inline-block',
884
+        'd' . $device_size . '-block'        => 'block',
885
+        'd' . $device_size . '-table'        => 'table',
886
+        'd' . $device_size . '-table-cell'   => 'table-cell',
887
+        'd' . $device_size . '-table-row'    => 'table-row',
888
+        'd' . $device_size . '-flex'         => 'flex',
889
+        'd' . $device_size . '-inline-flex'  => 'inline-flex',
890
+    );
891
+
892
+    $defaults = array(
893
+        'type'     => 'select',
894
+        'title'    => __( 'Display', 'super-duper' ),
895
+        'options'  => $options,
896
+        'default'  => '',
897
+        'desc_tip' => true,
898
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
899
+    );
900
+
901
+    $input = wp_parse_args( $overwrite, $defaults );
902
+
903
+    return $input;
904 904
 }
905 905
 
906 906
 /**
@@ -913,17 +913,17 @@  discard block
 block discarded – undo
913 913
  */
914 914
 function sd_get_text_justify_input( $type = 'text_justify', $overwrite = array() ) {
915 915
 
916
-	$defaults = array(
917
-		'type'     => 'checkbox',
918
-		'title'    => __( 'Text justify', 'super-duper' ),
919
-		'default'  => '',
920
-		'desc_tip' => true,
921
-		'group'    => __( 'Typography', 'super-duper' ),
922
-	);
916
+    $defaults = array(
917
+        'type'     => 'checkbox',
918
+        'title'    => __( 'Text justify', 'super-duper' ),
919
+        'default'  => '',
920
+        'desc_tip' => true,
921
+        'group'    => __( 'Typography', 'super-duper' ),
922
+    );
923 923
 
924
-	$input = wp_parse_args( $overwrite, $defaults );
924
+    $input = wp_parse_args( $overwrite, $defaults );
925 925
 
926
-	return $input;
926
+    return $input;
927 927
 }
928 928
 
929 929
 /**
@@ -936,50 +936,50 @@  discard block
 block discarded – undo
936 936
  * @return array
937 937
  */
938 938
 function sd_aui_colors( $include_branding = false, $include_outlines = false, $outline_button_only_text = false ) {
939
-	$theme_colors = array();
940
-
941
-	$theme_colors['primary']   = __( 'Primary', 'super-duper' );
942
-	$theme_colors['secondary'] = __( 'Secondary', 'super-duper' );
943
-	$theme_colors['success']   = __( 'Success', 'super-duper' );
944
-	$theme_colors['danger']    = __( 'Danger', 'super-duper' );
945
-	$theme_colors['warning']   = __( 'Warning', 'super-duper' );
946
-	$theme_colors['info']      = __( 'Info', 'super-duper' );
947
-	$theme_colors['light']     = __( 'Light', 'super-duper' );
948
-	$theme_colors['dark']      = __( 'Dark', 'super-duper' );
949
-	$theme_colors['white']     = __( 'White', 'super-duper' );
950
-	$theme_colors['purple']    = __( 'Purple', 'super-duper' );
951
-	$theme_colors['salmon']    = __( 'Salmon', 'super-duper' );
952
-	$theme_colors['cyan']      = __( 'Cyan', 'super-duper' );
953
-	$theme_colors['gray']      = __( 'Gray', 'super-duper' );
954
-	$theme_colors['gray-dark'] = __( 'Gray dark', 'super-duper' );
955
-	$theme_colors['indigo']    = __( 'Indigo', 'super-duper' );
956
-	$theme_colors['orange']    = __( 'Orange', 'super-duper' );
957
-
958
-	if ( $include_outlines ) {
959
-		$button_only                       = $outline_button_only_text ? ' ' . __( '(button only)', 'super-duper' ) : '';
960
-		$theme_colors['outline-primary']   = __( 'Primary outline', 'super-duper' ) . $button_only;
961
-		$theme_colors['outline-secondary'] = __( 'Secondary outline', 'super-duper' ) . $button_only;
962
-		$theme_colors['outline-success']   = __( 'Success outline', 'super-duper' ) . $button_only;
963
-		$theme_colors['outline-danger']    = __( 'Danger outline', 'super-duper' ) . $button_only;
964
-		$theme_colors['outline-warning']   = __( 'Warning outline', 'super-duper' ) . $button_only;
965
-		$theme_colors['outline-info']      = __( 'Info outline', 'super-duper' ) . $button_only;
966
-		$theme_colors['outline-light']     = __( 'Light outline', 'super-duper' ) . $button_only;
967
-		$theme_colors['outline-dark']      = __( 'Dark outline', 'super-duper' ) . $button_only;
968
-		$theme_colors['outline-white']     = __( 'White outline', 'super-duper' ) . $button_only;
969
-		$theme_colors['outline-purple']    = __( 'Purple outline', 'super-duper' ) . $button_only;
970
-		$theme_colors['outline-salmon']    = __( 'Salmon outline', 'super-duper' ) . $button_only;
971
-		$theme_colors['outline-cyan']      = __( 'Cyan outline', 'super-duper' ) . $button_only;
972
-		$theme_colors['outline-gray']      = __( 'Gray outline', 'super-duper' ) . $button_only;
973
-		$theme_colors['outline-gray-dark'] = __( 'Gray dark outline', 'super-duper' ) . $button_only;
974
-		$theme_colors['outline-indigo']    = __( 'Indigo outline', 'super-duper' ) . $button_only;
975
-		$theme_colors['outline-orange']    = __( 'Orange outline', 'super-duper' ) . $button_only;
976
-	}
977
-
978
-	if ( $include_branding ) {
979
-		$theme_colors = $theme_colors + sd_aui_branding_colors();
980
-	}
981
-
982
-	return apply_filters( 'sd_aui_colors', $theme_colors, $include_outlines, $include_branding );
939
+    $theme_colors = array();
940
+
941
+    $theme_colors['primary']   = __( 'Primary', 'super-duper' );
942
+    $theme_colors['secondary'] = __( 'Secondary', 'super-duper' );
943
+    $theme_colors['success']   = __( 'Success', 'super-duper' );
944
+    $theme_colors['danger']    = __( 'Danger', 'super-duper' );
945
+    $theme_colors['warning']   = __( 'Warning', 'super-duper' );
946
+    $theme_colors['info']      = __( 'Info', 'super-duper' );
947
+    $theme_colors['light']     = __( 'Light', 'super-duper' );
948
+    $theme_colors['dark']      = __( 'Dark', 'super-duper' );
949
+    $theme_colors['white']     = __( 'White', 'super-duper' );
950
+    $theme_colors['purple']    = __( 'Purple', 'super-duper' );
951
+    $theme_colors['salmon']    = __( 'Salmon', 'super-duper' );
952
+    $theme_colors['cyan']      = __( 'Cyan', 'super-duper' );
953
+    $theme_colors['gray']      = __( 'Gray', 'super-duper' );
954
+    $theme_colors['gray-dark'] = __( 'Gray dark', 'super-duper' );
955
+    $theme_colors['indigo']    = __( 'Indigo', 'super-duper' );
956
+    $theme_colors['orange']    = __( 'Orange', 'super-duper' );
957
+
958
+    if ( $include_outlines ) {
959
+        $button_only                       = $outline_button_only_text ? ' ' . __( '(button only)', 'super-duper' ) : '';
960
+        $theme_colors['outline-primary']   = __( 'Primary outline', 'super-duper' ) . $button_only;
961
+        $theme_colors['outline-secondary'] = __( 'Secondary outline', 'super-duper' ) . $button_only;
962
+        $theme_colors['outline-success']   = __( 'Success outline', 'super-duper' ) . $button_only;
963
+        $theme_colors['outline-danger']    = __( 'Danger outline', 'super-duper' ) . $button_only;
964
+        $theme_colors['outline-warning']   = __( 'Warning outline', 'super-duper' ) . $button_only;
965
+        $theme_colors['outline-info']      = __( 'Info outline', 'super-duper' ) . $button_only;
966
+        $theme_colors['outline-light']     = __( 'Light outline', 'super-duper' ) . $button_only;
967
+        $theme_colors['outline-dark']      = __( 'Dark outline', 'super-duper' ) . $button_only;
968
+        $theme_colors['outline-white']     = __( 'White outline', 'super-duper' ) . $button_only;
969
+        $theme_colors['outline-purple']    = __( 'Purple outline', 'super-duper' ) . $button_only;
970
+        $theme_colors['outline-salmon']    = __( 'Salmon outline', 'super-duper' ) . $button_only;
971
+        $theme_colors['outline-cyan']      = __( 'Cyan outline', 'super-duper' ) . $button_only;
972
+        $theme_colors['outline-gray']      = __( 'Gray outline', 'super-duper' ) . $button_only;
973
+        $theme_colors['outline-gray-dark'] = __( 'Gray dark outline', 'super-duper' ) . $button_only;
974
+        $theme_colors['outline-indigo']    = __( 'Indigo outline', 'super-duper' ) . $button_only;
975
+        $theme_colors['outline-orange']    = __( 'Orange outline', 'super-duper' ) . $button_only;
976
+    }
977
+
978
+    if ( $include_branding ) {
979
+        $theme_colors = $theme_colors + sd_aui_branding_colors();
980
+    }
981
+
982
+    return apply_filters( 'sd_aui_colors', $theme_colors, $include_outlines, $include_branding );
983 983
 }
984 984
 
985 985
 /**
@@ -988,19 +988,19 @@  discard block
 block discarded – undo
988 988
  * @return array
989 989
  */
990 990
 function sd_aui_branding_colors() {
991
-	return array(
992
-		'facebook'  => __( 'Facebook', 'super-duper' ),
993
-		'twitter'   => __( 'Twitter', 'super-duper' ),
994
-		'instagram' => __( 'Instagram', 'super-duper' ),
995
-		'linkedin'  => __( 'Linkedin', 'super-duper' ),
996
-		'flickr'    => __( 'Flickr', 'super-duper' ),
997
-		'github'    => __( 'GitHub', 'super-duper' ),
998
-		'youtube'   => __( 'YouTube', 'super-duper' ),
999
-		'wordpress' => __( 'WordPress', 'super-duper' ),
1000
-		'google'    => __( 'Google', 'super-duper' ),
1001
-		'yahoo'     => __( 'Yahoo', 'super-duper' ),
1002
-		'vkontakte' => __( 'Vkontakte', 'super-duper' ),
1003
-	);
991
+    return array(
992
+        'facebook'  => __( 'Facebook', 'super-duper' ),
993
+        'twitter'   => __( 'Twitter', 'super-duper' ),
994
+        'instagram' => __( 'Instagram', 'super-duper' ),
995
+        'linkedin'  => __( 'Linkedin', 'super-duper' ),
996
+        'flickr'    => __( 'Flickr', 'super-duper' ),
997
+        'github'    => __( 'GitHub', 'super-duper' ),
998
+        'youtube'   => __( 'YouTube', 'super-duper' ),
999
+        'wordpress' => __( 'WordPress', 'super-duper' ),
1000
+        'google'    => __( 'Google', 'super-duper' ),
1001
+        'yahoo'     => __( 'Yahoo', 'super-duper' ),
1002
+        'vkontakte' => __( 'Vkontakte', 'super-duper' ),
1003
+    );
1004 1004
 }
1005 1005
 
1006 1006
 
@@ -1014,36 +1014,36 @@  discard block
 block discarded – undo
1014 1014
  */
1015 1015
 function sd_get_container_class_input( $type = 'container', $overwrite = array() ) {
1016 1016
 
1017
-	$options = array(
1018
-		'container'       => __( 'container (default)', 'super-duper' ),
1019
-		'container-sm'    => 'container-sm',
1020
-		'container-md'    => 'container-md',
1021
-		'container-lg'    => 'container-lg',
1022
-		'container-xl'    => 'container-xl',
1023
-		'container-xxl'   => 'container-xxl',
1024
-		'container-fluid' => 'container-fluid',
1025
-		'row'             => 'row',
1026
-		'col'             => 'col',
1027
-		'card'            => 'card',
1028
-		'card-header'     => 'card-header',
1029
-		'card-body'       => 'card-body',
1030
-		'card-footer'     => 'card-footer',
1031
-		'list-group'      => 'list-group',
1032
-		'list-group-item' => 'list-group-item',
1033
-	);
1034
-
1035
-	$defaults = array(
1036
-		'type'     => 'select',
1037
-		'title'    => __( 'Type', 'super-duper' ),
1038
-		'options'  => $options,
1039
-		'default'  => '',
1040
-		'desc_tip' => true,
1041
-		'group'    => __( 'Container', 'super-duper' ),
1042
-	);
1043
-
1044
-	$input = wp_parse_args( $overwrite, $defaults );
1045
-
1046
-	return $input;
1017
+    $options = array(
1018
+        'container'       => __( 'container (default)', 'super-duper' ),
1019
+        'container-sm'    => 'container-sm',
1020
+        'container-md'    => 'container-md',
1021
+        'container-lg'    => 'container-lg',
1022
+        'container-xl'    => 'container-xl',
1023
+        'container-xxl'   => 'container-xxl',
1024
+        'container-fluid' => 'container-fluid',
1025
+        'row'             => 'row',
1026
+        'col'             => 'col',
1027
+        'card'            => 'card',
1028
+        'card-header'     => 'card-header',
1029
+        'card-body'       => 'card-body',
1030
+        'card-footer'     => 'card-footer',
1031
+        'list-group'      => 'list-group',
1032
+        'list-group-item' => 'list-group-item',
1033
+    );
1034
+
1035
+    $defaults = array(
1036
+        'type'     => 'select',
1037
+        'title'    => __( 'Type', 'super-duper' ),
1038
+        'options'  => $options,
1039
+        'default'  => '',
1040
+        'desc_tip' => true,
1041
+        'group'    => __( 'Container', 'super-duper' ),
1042
+    );
1043
+
1044
+    $input = wp_parse_args( $overwrite, $defaults );
1045
+
1046
+    return $input;
1047 1047
 }
1048 1048
 
1049 1049
 /**
@@ -1056,30 +1056,30 @@  discard block
 block discarded – undo
1056 1056
  */
1057 1057
 function sd_get_position_class_input( $type = 'position', $overwrite = array() ) {
1058 1058
 
1059
-	$options = array(
1060
-		''                  => __( 'Default', 'super-duper' ),
1061
-		'position-static'   => 'static',
1062
-		'position-relative' => 'relative',
1063
-		'position-absolute' => 'absolute',
1064
-		'position-fixed'    => 'fixed',
1065
-		'position-sticky'   => 'sticky',
1066
-		'fixed-top'         => 'fixed-top',
1067
-		'fixed-bottom'      => 'fixed-bottom',
1068
-		'sticky-top'        => 'sticky-top',
1069
-	);
1070
-
1071
-	$defaults = array(
1072
-		'type'     => 'select',
1073
-		'title'    => __( 'Position', 'super-duper' ),
1074
-		'options'  => $options,
1075
-		'default'  => '',
1076
-		'desc_tip' => true,
1077
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
1078
-	);
1079
-
1080
-	$input = wp_parse_args( $overwrite, $defaults );
1081
-
1082
-	return $input;
1059
+    $options = array(
1060
+        ''                  => __( 'Default', 'super-duper' ),
1061
+        'position-static'   => 'static',
1062
+        'position-relative' => 'relative',
1063
+        'position-absolute' => 'absolute',
1064
+        'position-fixed'    => 'fixed',
1065
+        'position-sticky'   => 'sticky',
1066
+        'fixed-top'         => 'fixed-top',
1067
+        'fixed-bottom'      => 'fixed-bottom',
1068
+        'sticky-top'        => 'sticky-top',
1069
+    );
1070
+
1071
+    $defaults = array(
1072
+        'type'     => 'select',
1073
+        'title'    => __( 'Position', 'super-duper' ),
1074
+        'options'  => $options,
1075
+        'default'  => '',
1076
+        'desc_tip' => true,
1077
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
1078
+    );
1079
+
1080
+    $input = wp_parse_args( $overwrite, $defaults );
1081
+
1082
+    return $input;
1083 1083
 }
1084 1084
 
1085 1085
 /**
@@ -1092,38 +1092,38 @@  discard block
 block discarded – undo
1092 1092
  */
1093 1093
 function sd_get_sticky_offset_input( $type = 'top', $overwrite = array() ) {
1094 1094
 
1095
-	$defaults = array(
1096
-		'type'            => 'number',
1097
-		'title'           => __( 'Sticky offset', 'super-duper' ),
1098
-		//'desc' =>  __('Sticky offset'),
1099
-		'default'         => '',
1100
-		'desc_tip'        => true,
1101
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1102
-		'element_require' => '[%position%]=="sticky" || [%position%]=="sticky-top"',
1103
-	);
1104
-
1105
-	// title
1106
-	if ( $type == 'top' ) {
1107
-		$defaults['title'] = __( 'Top offset', 'super-duper' );
1108
-		$defaults['icon']  = 'box-top';
1109
-		$defaults['row']   = array(
1110
-			'title' => __( 'Sticky offset', 'super-duper' ),
1111
-			'key'   => 'sticky-offset',
1112
-			'open'  => true,
1113
-			'class' => 'text-center',
1114
-		);
1115
-	} elseif ( $type == 'bottom' ) {
1116
-		$defaults['title'] = __( 'Bottom offset', 'super-duper' );
1117
-		$defaults['icon']  = 'box-bottom';
1118
-		$defaults['row']   = array(
1119
-			'key'   => 'sticky-offset',
1120
-			'close' => true,
1121
-		);
1122
-	}
1123
-
1124
-	$input = wp_parse_args( $overwrite, $defaults );
1125
-
1126
-	return $input;
1095
+    $defaults = array(
1096
+        'type'            => 'number',
1097
+        'title'           => __( 'Sticky offset', 'super-duper' ),
1098
+        //'desc' =>  __('Sticky offset'),
1099
+        'default'         => '',
1100
+        'desc_tip'        => true,
1101
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1102
+        'element_require' => '[%position%]=="sticky" || [%position%]=="sticky-top"',
1103
+    );
1104
+
1105
+    // title
1106
+    if ( $type == 'top' ) {
1107
+        $defaults['title'] = __( 'Top offset', 'super-duper' );
1108
+        $defaults['icon']  = 'box-top';
1109
+        $defaults['row']   = array(
1110
+            'title' => __( 'Sticky offset', 'super-duper' ),
1111
+            'key'   => 'sticky-offset',
1112
+            'open'  => true,
1113
+            'class' => 'text-center',
1114
+        );
1115
+    } elseif ( $type == 'bottom' ) {
1116
+        $defaults['title'] = __( 'Bottom offset', 'super-duper' );
1117
+        $defaults['icon']  = 'box-bottom';
1118
+        $defaults['row']   = array(
1119
+            'key'   => 'sticky-offset',
1120
+            'close' => true,
1121
+        );
1122
+    }
1123
+
1124
+    $input = wp_parse_args( $overwrite, $defaults );
1125
+
1126
+    return $input;
1127 1127
 }
1128 1128
 
1129 1129
 /**
@@ -1136,36 +1136,36 @@  discard block
 block discarded – undo
1136 1136
  */
1137 1137
 function sd_get_font_size_input( $type = 'font_size', $overwrite = array(), $has_custom = false ) {
1138 1138
 
1139
-	$options = array(
1140
-		''          => __( 'Inherit from parent', 'super-duper' ),
1141
-		'h6'        => 'h6',
1142
-		'h5'        => 'h5',
1143
-		'h4'        => 'h4',
1144
-		'h3'        => 'h3',
1145
-		'h2'        => 'h2',
1146
-		'h1'        => 'h1',
1147
-		'display-1' => 'display-1',
1148
-		'display-2' => 'display-2',
1149
-		'display-3' => 'display-3',
1150
-		'display-4' => 'display-4',
1151
-	);
1152
-
1153
-	if ( $has_custom ) {
1154
-		$options['custom'] = __( 'Custom size', 'super-duper' );
1155
-	}
1156
-
1157
-	$defaults = array(
1158
-		'type'     => 'select',
1159
-		'title'    => __( 'Font size', 'super-duper' ),
1160
-		'options'  => $options,
1161
-		'default'  => '',
1162
-		'desc_tip' => true,
1163
-		'group'    => __( 'Typography', 'super-duper' ),
1164
-	);
1165
-
1166
-	$input = wp_parse_args( $overwrite, $defaults );
1167
-
1168
-	return $input;
1139
+    $options = array(
1140
+        ''          => __( 'Inherit from parent', 'super-duper' ),
1141
+        'h6'        => 'h6',
1142
+        'h5'        => 'h5',
1143
+        'h4'        => 'h4',
1144
+        'h3'        => 'h3',
1145
+        'h2'        => 'h2',
1146
+        'h1'        => 'h1',
1147
+        'display-1' => 'display-1',
1148
+        'display-2' => 'display-2',
1149
+        'display-3' => 'display-3',
1150
+        'display-4' => 'display-4',
1151
+    );
1152
+
1153
+    if ( $has_custom ) {
1154
+        $options['custom'] = __( 'Custom size', 'super-duper' );
1155
+    }
1156
+
1157
+    $defaults = array(
1158
+        'type'     => 'select',
1159
+        'title'    => __( 'Font size', 'super-duper' ),
1160
+        'options'  => $options,
1161
+        'default'  => '',
1162
+        'desc_tip' => true,
1163
+        'group'    => __( 'Typography', 'super-duper' ),
1164
+    );
1165
+
1166
+    $input = wp_parse_args( $overwrite, $defaults );
1167
+
1168
+    return $input;
1169 1169
 }
1170 1170
 
1171 1171
 /**
@@ -1178,27 +1178,27 @@  discard block
 block discarded – undo
1178 1178
  */
1179 1179
 function sd_get_font_custom_size_input( $type = 'font_size_custom', $overwrite = array(), $parent_type = '' ) {
1180 1180
 
1181
-	$defaults = array(
1182
-		'type'              => 'number',
1183
-		'title'             => __( 'Font size (rem)', 'super-duper' ),
1184
-		'default'           => '',
1185
-		'placeholder'       => '1.25',
1186
-		'custom_attributes' => array(
1187
-			'step' => '0.1',
1188
-			'min'  => '0',
1189
-			'max'  => '100',
1190
-		),
1191
-		'desc_tip'          => true,
1192
-		'group'             => __( 'Typography', 'super-duper' ),
1193
-	);
1194
-
1195
-	if ( $parent_type ) {
1196
-		$defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
1197
-	}
1198
-
1199
-	$input = wp_parse_args( $overwrite, $defaults );
1200
-
1201
-	return $input;
1181
+    $defaults = array(
1182
+        'type'              => 'number',
1183
+        'title'             => __( 'Font size (rem)', 'super-duper' ),
1184
+        'default'           => '',
1185
+        'placeholder'       => '1.25',
1186
+        'custom_attributes' => array(
1187
+            'step' => '0.1',
1188
+            'min'  => '0',
1189
+            'max'  => '100',
1190
+        ),
1191
+        'desc_tip'          => true,
1192
+        'group'             => __( 'Typography', 'super-duper' ),
1193
+    );
1194
+
1195
+    if ( $parent_type ) {
1196
+        $defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
1197
+    }
1198
+
1199
+    $input = wp_parse_args( $overwrite, $defaults );
1200
+
1201
+    return $input;
1202 1202
 }
1203 1203
 
1204 1204
 /**
@@ -1211,23 +1211,23 @@  discard block
 block discarded – undo
1211 1211
  */
1212 1212
 function sd_get_font_line_height_input( $type = 'font_line_height', $overwrite = array() ) {
1213 1213
 
1214
-	$defaults = array(
1215
-		'type'              => 'number',
1216
-		'title'             => __( 'Font Line Height', 'super-duper' ),
1217
-		'default'           => '',
1218
-		'placeholder'       => '1.75',
1219
-		'custom_attributes' => array(
1220
-			'step' => '0.1',
1221
-			'min'  => '0',
1222
-			'max'  => '100',
1223
-		),
1224
-		'desc_tip'          => true,
1225
-		'group'             => __( 'Typography', 'super-duper' ),
1226
-	);
1227
-
1228
-	$input = wp_parse_args( $overwrite, $defaults );
1229
-
1230
-	return $input;
1214
+    $defaults = array(
1215
+        'type'              => 'number',
1216
+        'title'             => __( 'Font Line Height', 'super-duper' ),
1217
+        'default'           => '',
1218
+        'placeholder'       => '1.75',
1219
+        'custom_attributes' => array(
1220
+            'step' => '0.1',
1221
+            'min'  => '0',
1222
+            'max'  => '100',
1223
+        ),
1224
+        'desc_tip'          => true,
1225
+        'group'             => __( 'Typography', 'super-duper' ),
1226
+    );
1227
+
1228
+    $input = wp_parse_args( $overwrite, $defaults );
1229
+
1230
+    return $input;
1231 1231
 }
1232 1232
 
1233 1233
 /**
@@ -1240,18 +1240,18 @@  discard block
 block discarded – undo
1240 1240
  */
1241 1241
 function sd_get_font_size_input_group( $type = 'font_size', $overwrite = array(), $overwrite_custom = array() ) {
1242 1242
 
1243
-	$inputs = array();
1243
+    $inputs = array();
1244 1244
 
1245
-	if ( $overwrite !== false ) {
1246
-		$inputs[ $type ] = sd_get_font_size_input( $type, $overwrite, true );
1247
-	}
1245
+    if ( $overwrite !== false ) {
1246
+        $inputs[ $type ] = sd_get_font_size_input( $type, $overwrite, true );
1247
+    }
1248 1248
 
1249
-	if ( $overwrite_custom !== false ) {
1250
-		$custom            = $type . '_custom';
1251
-		$inputs[ $custom ] = sd_get_font_custom_size_input( $custom, $overwrite_custom, $type );
1252
-	}
1249
+    if ( $overwrite_custom !== false ) {
1250
+        $custom            = $type . '_custom';
1251
+        $inputs[ $custom ] = sd_get_font_custom_size_input( $custom, $overwrite_custom, $type );
1252
+    }
1253 1253
 
1254
-	return $inputs;
1254
+    return $inputs;
1255 1255
 }
1256 1256
 
1257 1257
 /**
@@ -1264,33 +1264,33 @@  discard block
 block discarded – undo
1264 1264
  */
1265 1265
 function sd_get_font_weight_input( $type = 'font_weight', $overwrite = array() ) {
1266 1266
 
1267
-	$options = array(
1268
-		''                                => __( 'Inherit', 'super-duper' ),
1269
-		'font-weight-bold'                => 'bold',
1270
-		'font-weight-bolder'              => 'bolder',
1271
-		'font-weight-normal'              => 'normal',
1272
-		'font-weight-light'               => 'light',
1273
-		'font-weight-lighter'             => 'lighter',
1274
-		'font-italic'                     => 'italic',
1275
-		'font-weight-bold font-italic'    => 'bold italic',
1276
-		'font-weight-bolder font-italic'  => 'bolder italic',
1277
-		'font-weight-normal font-italic'  => 'normal italic',
1278
-		'font-weight-light font-italic'   => 'light italic',
1279
-		'font-weight-lighter font-italic' => 'lighter italic',
1280
-	);
1281
-
1282
-	$defaults = array(
1283
-		'type'     => 'select',
1284
-		'title'    => __( 'Appearance', 'super-duper' ),
1285
-		'options'  => $options,
1286
-		'default'  => '',
1287
-		'desc_tip' => true,
1288
-		'group'    => __( 'Typography', 'super-duper' ),
1289
-	);
1290
-
1291
-	$input = wp_parse_args( $overwrite, $defaults );
1292
-
1293
-	return $input;
1267
+    $options = array(
1268
+        ''                                => __( 'Inherit', 'super-duper' ),
1269
+        'font-weight-bold'                => 'bold',
1270
+        'font-weight-bolder'              => 'bolder',
1271
+        'font-weight-normal'              => 'normal',
1272
+        'font-weight-light'               => 'light',
1273
+        'font-weight-lighter'             => 'lighter',
1274
+        'font-italic'                     => 'italic',
1275
+        'font-weight-bold font-italic'    => 'bold italic',
1276
+        'font-weight-bolder font-italic'  => 'bolder italic',
1277
+        'font-weight-normal font-italic'  => 'normal italic',
1278
+        'font-weight-light font-italic'   => 'light italic',
1279
+        'font-weight-lighter font-italic' => 'lighter italic',
1280
+    );
1281
+
1282
+    $defaults = array(
1283
+        'type'     => 'select',
1284
+        'title'    => __( 'Appearance', 'super-duper' ),
1285
+        'options'  => $options,
1286
+        'default'  => '',
1287
+        'desc_tip' => true,
1288
+        'group'    => __( 'Typography', 'super-duper' ),
1289
+    );
1290
+
1291
+    $input = wp_parse_args( $overwrite, $defaults );
1292
+
1293
+    return $input;
1294 1294
 }
1295 1295
 
1296 1296
 /**
@@ -1303,25 +1303,25 @@  discard block
 block discarded – undo
1303 1303
  */
1304 1304
 function sd_get_font_case_input( $type = 'font_weight', $overwrite = array() ) {
1305 1305
 
1306
-	$options = array(
1307
-		''                => __( 'Default', 'super-duper' ),
1308
-		'text-lowercase'  => __( 'lowercase', 'super-duper' ),
1309
-		'text-uppercase'  => __( 'UPPERCASE', 'super-duper' ),
1310
-		'text-capitalize' => __( 'Capitalize', 'super-duper' ),
1311
-	);
1312
-
1313
-	$defaults = array(
1314
-		'type'     => 'select',
1315
-		'title'    => __( 'Letter case', 'super-duper' ),
1316
-		'options'  => $options,
1317
-		'default'  => '',
1318
-		'desc_tip' => true,
1319
-		'group'    => __( 'Typography', 'super-duper' ),
1320
-	);
1321
-
1322
-	$input = wp_parse_args( $overwrite, $defaults );
1323
-
1324
-	return $input;
1306
+    $options = array(
1307
+        ''                => __( 'Default', 'super-duper' ),
1308
+        'text-lowercase'  => __( 'lowercase', 'super-duper' ),
1309
+        'text-uppercase'  => __( 'UPPERCASE', 'super-duper' ),
1310
+        'text-capitalize' => __( 'Capitalize', 'super-duper' ),
1311
+    );
1312
+
1313
+    $defaults = array(
1314
+        'type'     => 'select',
1315
+        'title'    => __( 'Letter case', 'super-duper' ),
1316
+        'options'  => $options,
1317
+        'default'  => '',
1318
+        'desc_tip' => true,
1319
+        'group'    => __( 'Typography', 'super-duper' ),
1320
+    );
1321
+
1322
+    $input = wp_parse_args( $overwrite, $defaults );
1323
+
1324
+    return $input;
1325 1325
 }
1326 1326
 
1327 1327
 /**
@@ -1335,23 +1335,23 @@  discard block
 block discarded – undo
1335 1335
  */
1336 1336
 function sd_get_font_italic_input( $type = 'font_italic', $overwrite = array() ) {
1337 1337
 
1338
-	$options = array(
1339
-		''            => __( 'No', 'super-duper' ),
1340
-		'font-italic' => __( 'Yes', 'super-duper' ),
1341
-	);
1338
+    $options = array(
1339
+        ''            => __( 'No', 'super-duper' ),
1340
+        'font-italic' => __( 'Yes', 'super-duper' ),
1341
+    );
1342 1342
 
1343
-	$defaults = array(
1344
-		'type'     => 'select',
1345
-		'title'    => __( 'Font italic', 'super-duper' ),
1346
-		'options'  => $options,
1347
-		'default'  => '',
1348
-		'desc_tip' => true,
1349
-		'group'    => __( 'Typography', 'super-duper' ),
1350
-	);
1343
+    $defaults = array(
1344
+        'type'     => 'select',
1345
+        'title'    => __( 'Font italic', 'super-duper' ),
1346
+        'options'  => $options,
1347
+        'default'  => '',
1348
+        'desc_tip' => true,
1349
+        'group'    => __( 'Typography', 'super-duper' ),
1350
+    );
1351 1351
 
1352
-	$input = wp_parse_args( $overwrite, $defaults );
1352
+    $input = wp_parse_args( $overwrite, $defaults );
1353 1353
 
1354
-	return $input;
1354
+    return $input;
1355 1355
 }
1356 1356
 
1357 1357
 /**
@@ -1364,18 +1364,18 @@  discard block
 block discarded – undo
1364 1364
  */
1365 1365
 function sd_get_anchor_input( $type = 'anchor', $overwrite = array() ) {
1366 1366
 
1367
-	$defaults = array(
1368
-		'type'     => 'text',
1369
-		'title'    => __( 'HTML anchor', 'super-duper' ),
1370
-		'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.' ),
1371
-		'default'  => '',
1372
-		'desc_tip' => true,
1373
-		'group'    => __( 'Advanced', 'super-duper' ),
1374
-	);
1367
+    $defaults = array(
1368
+        'type'     => 'text',
1369
+        'title'    => __( 'HTML anchor', 'super-duper' ),
1370
+        '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.' ),
1371
+        'default'  => '',
1372
+        'desc_tip' => true,
1373
+        'group'    => __( 'Advanced', 'super-duper' ),
1374
+    );
1375 1375
 
1376
-	$input = wp_parse_args( $overwrite, $defaults );
1376
+    $input = wp_parse_args( $overwrite, $defaults );
1377 1377
 
1378
-	return $input;
1378
+    return $input;
1379 1379
 }
1380 1380
 
1381 1381
 /**
@@ -1388,18 +1388,18 @@  discard block
 block discarded – undo
1388 1388
  */
1389 1389
 function sd_get_class_input( $type = 'css_class', $overwrite = array() ) {
1390 1390
 
1391
-	$defaults = array(
1392
-		'type'     => 'text',
1393
-		'title'    => __( 'Additional CSS class(es)', 'super-duper' ),
1394
-		'desc'     => __( 'Separate multiple classes with spaces.', 'super-duper' ),
1395
-		'default'  => '',
1396
-		'desc_tip' => true,
1397
-		'group'    => __( 'Advanced', 'super-duper' ),
1398
-	);
1391
+    $defaults = array(
1392
+        'type'     => 'text',
1393
+        'title'    => __( 'Additional CSS class(es)', 'super-duper' ),
1394
+        'desc'     => __( 'Separate multiple classes with spaces.', 'super-duper' ),
1395
+        'default'  => '',
1396
+        'desc_tip' => true,
1397
+        'group'    => __( 'Advanced', 'super-duper' ),
1398
+    );
1399 1399
 
1400
-	$input = wp_parse_args( $overwrite, $defaults );
1400
+    $input = wp_parse_args( $overwrite, $defaults );
1401 1401
 
1402
-	return $input;
1402
+    return $input;
1403 1403
 }
1404 1404
 
1405 1405
 /**
@@ -1412,244 +1412,244 @@  discard block
 block discarded – undo
1412 1412
  */
1413 1413
 function sd_get_hover_animations_input( $type = 'hover_animations', $overwrite = array() ) {
1414 1414
 
1415
-	$options = array(
1416
-		''       => __( 'none', 'super-duper' ),
1417
-		'hover-zoom'       => __( 'Zoom', 'super-duper' ),
1418
-		'hover-shadow'     => __( 'Shadow', 'super-duper' ),
1419
-		'hover-move-up'    => __( 'Move up', 'super-duper' ),
1420
-		'hover-move-down'  => __( 'Move down', 'super-duper' ),
1421
-		'hover-move-left'  => __( 'Move left', 'super-duper' ),
1422
-		'hover-move-right' => __( 'Move right', 'super-duper' ),
1423
-	);
1424
-
1425
-	$defaults = array(
1426
-		'type'     => 'select',
1427
-		'multiple' => true,
1428
-		'title'    => __( 'Hover Animations', 'super-duper' ),
1429
-		'options'  => $options,
1430
-		'default'  => '',
1431
-		'desc_tip' => true,
1432
-		'group'    => __( 'Hover Animations', 'super-duper' ),
1433
-	);
1434
-
1435
-	$input = wp_parse_args( $overwrite, $defaults );
1436
-
1437
-	return $input;
1415
+    $options = array(
1416
+        ''       => __( 'none', 'super-duper' ),
1417
+        'hover-zoom'       => __( 'Zoom', 'super-duper' ),
1418
+        'hover-shadow'     => __( 'Shadow', 'super-duper' ),
1419
+        'hover-move-up'    => __( 'Move up', 'super-duper' ),
1420
+        'hover-move-down'  => __( 'Move down', 'super-duper' ),
1421
+        'hover-move-left'  => __( 'Move left', 'super-duper' ),
1422
+        'hover-move-right' => __( 'Move right', 'super-duper' ),
1423
+    );
1424
+
1425
+    $defaults = array(
1426
+        'type'     => 'select',
1427
+        'multiple' => true,
1428
+        'title'    => __( 'Hover Animations', 'super-duper' ),
1429
+        'options'  => $options,
1430
+        'default'  => '',
1431
+        'desc_tip' => true,
1432
+        'group'    => __( 'Hover Animations', 'super-duper' ),
1433
+    );
1434
+
1435
+    $input = wp_parse_args( $overwrite, $defaults );
1436
+
1437
+    return $input;
1438 1438
 }
1439 1439
 
1440 1440
 
1441 1441
 function sd_get_flex_align_items_input( $type = 'align-items', $overwrite = array() ) {
1442
-	$device_size = '';
1443
-	if ( ! empty( $overwrite['device_type'] ) ) {
1444
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1445
-			$device_size = '-md';
1446
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1447
-			$device_size = '-lg';
1448
-		}
1449
-	}
1450
-	$options = array(
1451
-		''                                         => __( 'Default', 'super-duper' ),
1452
-		'align-items' . $device_size . '-start'    => 'align-items-start',
1453
-		'align-items' . $device_size . '-end'      => 'align-items-end',
1454
-		'align-items' . $device_size . '-center'   => 'align-items-center',
1455
-		'align-items' . $device_size . '-baseline' => 'align-items-baseline',
1456
-		'align-items' . $device_size . '-stretch'  => 'align-items-stretch',
1457
-	);
1458
-
1459
-	$defaults = array(
1460
-		'type'            => 'select',
1461
-		'title'           => __( 'Vertical Align Items', 'super-duper' ),
1462
-		'options'         => $options,
1463
-		'default'         => '',
1464
-		'desc_tip'        => true,
1465
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1466
-		'element_require' => ' ( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ',
1467
-
1468
-	);
1469
-
1470
-	$input = wp_parse_args( $overwrite, $defaults );
1471
-
1472
-	return $input;
1442
+    $device_size = '';
1443
+    if ( ! empty( $overwrite['device_type'] ) ) {
1444
+        if ( $overwrite['device_type'] == 'Tablet' ) {
1445
+            $device_size = '-md';
1446
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
1447
+            $device_size = '-lg';
1448
+        }
1449
+    }
1450
+    $options = array(
1451
+        ''                                         => __( 'Default', 'super-duper' ),
1452
+        'align-items' . $device_size . '-start'    => 'align-items-start',
1453
+        'align-items' . $device_size . '-end'      => 'align-items-end',
1454
+        'align-items' . $device_size . '-center'   => 'align-items-center',
1455
+        'align-items' . $device_size . '-baseline' => 'align-items-baseline',
1456
+        'align-items' . $device_size . '-stretch'  => 'align-items-stretch',
1457
+    );
1458
+
1459
+    $defaults = array(
1460
+        'type'            => 'select',
1461
+        'title'           => __( 'Vertical Align Items', 'super-duper' ),
1462
+        'options'         => $options,
1463
+        'default'         => '',
1464
+        'desc_tip'        => true,
1465
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1466
+        'element_require' => ' ( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ',
1467
+
1468
+    );
1469
+
1470
+    $input = wp_parse_args( $overwrite, $defaults );
1471
+
1472
+    return $input;
1473 1473
 }
1474 1474
 
1475 1475
 function sd_get_flex_align_items_input_group( $type = 'flex_align_items', $overwrite = array() ) {
1476
-	$inputs = array();
1477
-	$sizes  = array(
1478
-		''    => 'Mobile',
1479
-		'_md' => 'Tablet',
1480
-		'_lg' => 'Desktop',
1481
-	);
1482
-
1483
-	if ( $overwrite !== false ) {
1484
-
1485
-		foreach ( $sizes as $ds => $dt ) {
1486
-			$overwrite['device_type'] = $dt;
1487
-			$inputs[ $type . $ds ]    = sd_get_flex_align_items_input( $type, $overwrite );
1488
-		}
1489
-	}
1490
-
1491
-	return $inputs;
1476
+    $inputs = array();
1477
+    $sizes  = array(
1478
+        ''    => 'Mobile',
1479
+        '_md' => 'Tablet',
1480
+        '_lg' => 'Desktop',
1481
+    );
1482
+
1483
+    if ( $overwrite !== false ) {
1484
+
1485
+        foreach ( $sizes as $ds => $dt ) {
1486
+            $overwrite['device_type'] = $dt;
1487
+            $inputs[ $type . $ds ]    = sd_get_flex_align_items_input( $type, $overwrite );
1488
+        }
1489
+    }
1490
+
1491
+    return $inputs;
1492 1492
 }
1493 1493
 
1494 1494
 function sd_get_flex_justify_content_input( $type = 'flex_justify_content', $overwrite = array() ) {
1495
-	$device_size = '';
1496
-	if ( ! empty( $overwrite['device_type'] ) ) {
1497
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1498
-			$device_size = '-md';
1499
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1500
-			$device_size = '-lg';
1501
-		}
1502
-	}
1503
-	$options = array(
1504
-		''                                             => __( 'Default', 'super-duper' ),
1505
-		'justify-content' . $device_size . '-start'    => 'justify-content-start',
1506
-		'justify-content' . $device_size . '-end'      => 'justify-content-end',
1507
-		'justify-content' . $device_size . '-center'   => 'justify-content-center',
1508
-		'justify-content' . $device_size . '-between' => 'justify-content-between',
1509
-		'justify-content' . $device_size . '-stretch'  => 'justify-content-around',
1510
-	);
1511
-
1512
-	$defaults = array(
1513
-		'type'            => 'select',
1514
-		'title'           => __( 'Justify content' ),
1515
-		'options'         => $options,
1516
-		'default'         => '',
1517
-		'desc_tip'        => true,
1518
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1519
-		'element_require' => '( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ',
1520
-
1521
-	);
1522
-
1523
-	$input = wp_parse_args( $overwrite, $defaults );
1524
-
1525
-	return $input;
1495
+    $device_size = '';
1496
+    if ( ! empty( $overwrite['device_type'] ) ) {
1497
+        if ( $overwrite['device_type'] == 'Tablet' ) {
1498
+            $device_size = '-md';
1499
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
1500
+            $device_size = '-lg';
1501
+        }
1502
+    }
1503
+    $options = array(
1504
+        ''                                             => __( 'Default', 'super-duper' ),
1505
+        'justify-content' . $device_size . '-start'    => 'justify-content-start',
1506
+        'justify-content' . $device_size . '-end'      => 'justify-content-end',
1507
+        'justify-content' . $device_size . '-center'   => 'justify-content-center',
1508
+        'justify-content' . $device_size . '-between' => 'justify-content-between',
1509
+        'justify-content' . $device_size . '-stretch'  => 'justify-content-around',
1510
+    );
1511
+
1512
+    $defaults = array(
1513
+        'type'            => 'select',
1514
+        'title'           => __( 'Justify content' ),
1515
+        'options'         => $options,
1516
+        'default'         => '',
1517
+        'desc_tip'        => true,
1518
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1519
+        'element_require' => '( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ',
1520
+
1521
+    );
1522
+
1523
+    $input = wp_parse_args( $overwrite, $defaults );
1524
+
1525
+    return $input;
1526 1526
 }
1527 1527
 
1528 1528
 function sd_get_flex_justify_content_input_group( $type = 'flex_justify_content', $overwrite = array() ) {
1529
-	$inputs = array();
1530
-	$sizes  = array(
1531
-		''    => 'Mobile',
1532
-		'_md' => 'Tablet',
1533
-		'_lg' => 'Desktop',
1534
-	);
1535
-
1536
-	if ( $overwrite !== false ) {
1537
-
1538
-		foreach ( $sizes as $ds => $dt ) {
1539
-			$overwrite['device_type'] = $dt;
1540
-			$inputs[ $type . $ds ]    = sd_get_flex_justify_content_input( $type, $overwrite );
1541
-		}
1542
-	}
1543
-
1544
-	return $inputs;
1529
+    $inputs = array();
1530
+    $sizes  = array(
1531
+        ''    => 'Mobile',
1532
+        '_md' => 'Tablet',
1533
+        '_lg' => 'Desktop',
1534
+    );
1535
+
1536
+    if ( $overwrite !== false ) {
1537
+
1538
+        foreach ( $sizes as $ds => $dt ) {
1539
+            $overwrite['device_type'] = $dt;
1540
+            $inputs[ $type . $ds ]    = sd_get_flex_justify_content_input( $type, $overwrite );
1541
+        }
1542
+    }
1543
+
1544
+    return $inputs;
1545 1545
 }
1546 1546
 
1547 1547
 
1548 1548
 function sd_get_flex_align_self_input( $type = 'flex_align_self', $overwrite = array() ) {
1549
-	$device_size = '';
1550
-	if ( ! empty( $overwrite['device_type'] ) ) {
1551
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1552
-			$device_size = '-md';
1553
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1554
-			$device_size = '-lg';
1555
-		}
1556
-	}
1557
-	$options = array(
1558
-		''                                         => __( 'Default', 'super-duper' ),
1559
-		'align-items' . $device_size . '-start'    => 'align-items-start',
1560
-		'align-items' . $device_size . '-end'      => 'align-items-end',
1561
-		'align-items' . $device_size . '-center'   => 'align-items-center',
1562
-		'align-items' . $device_size . '-baseline' => 'align-items-baseline',
1563
-		'align-items' . $device_size . '-stretch'  => 'align-items-stretch',
1564
-	);
1565
-
1566
-	$defaults = array(
1567
-		'type'            => 'select',
1568
-		'title'           => __( 'Align Self', 'super-duper' ),
1569
-		'options'         => $options,
1570
-		'default'         => '',
1571
-		'desc_tip'        => true,
1572
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1573
-		'element_require' => ' [%container%]=="col" ',
1574
-
1575
-	);
1576
-
1577
-	$input = wp_parse_args( $overwrite, $defaults );
1578
-
1579
-	return $input;
1549
+    $device_size = '';
1550
+    if ( ! empty( $overwrite['device_type'] ) ) {
1551
+        if ( $overwrite['device_type'] == 'Tablet' ) {
1552
+            $device_size = '-md';
1553
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
1554
+            $device_size = '-lg';
1555
+        }
1556
+    }
1557
+    $options = array(
1558
+        ''                                         => __( 'Default', 'super-duper' ),
1559
+        'align-items' . $device_size . '-start'    => 'align-items-start',
1560
+        'align-items' . $device_size . '-end'      => 'align-items-end',
1561
+        'align-items' . $device_size . '-center'   => 'align-items-center',
1562
+        'align-items' . $device_size . '-baseline' => 'align-items-baseline',
1563
+        'align-items' . $device_size . '-stretch'  => 'align-items-stretch',
1564
+    );
1565
+
1566
+    $defaults = array(
1567
+        'type'            => 'select',
1568
+        'title'           => __( 'Align Self', 'super-duper' ),
1569
+        'options'         => $options,
1570
+        'default'         => '',
1571
+        'desc_tip'        => true,
1572
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1573
+        'element_require' => ' [%container%]=="col" ',
1574
+
1575
+    );
1576
+
1577
+    $input = wp_parse_args( $overwrite, $defaults );
1578
+
1579
+    return $input;
1580 1580
 }
1581 1581
 
1582 1582
 function sd_get_flex_align_self_input_group( $type = 'flex_align_self', $overwrite = array() ) {
1583
-	$inputs = array();
1584
-	$sizes  = array(
1585
-		''    => 'Mobile',
1586
-		'_md' => 'Tablet',
1587
-		'_lg' => 'Desktop',
1588
-	);
1589
-
1590
-	if ( $overwrite !== false ) {
1591
-
1592
-		foreach ( $sizes as $ds => $dt ) {
1593
-			$overwrite['device_type'] = $dt;
1594
-			$inputs[ $type . $ds ]    = sd_get_flex_align_self_input( $type, $overwrite );
1595
-		}
1596
-	}
1597
-
1598
-	return $inputs;
1583
+    $inputs = array();
1584
+    $sizes  = array(
1585
+        ''    => 'Mobile',
1586
+        '_md' => 'Tablet',
1587
+        '_lg' => 'Desktop',
1588
+    );
1589
+
1590
+    if ( $overwrite !== false ) {
1591
+
1592
+        foreach ( $sizes as $ds => $dt ) {
1593
+            $overwrite['device_type'] = $dt;
1594
+            $inputs[ $type . $ds ]    = sd_get_flex_align_self_input( $type, $overwrite );
1595
+        }
1596
+    }
1597
+
1598
+    return $inputs;
1599 1599
 }
1600 1600
 
1601 1601
 function sd_get_flex_order_input( $type = 'flex_order', $overwrite = array() ) {
1602
-	$device_size = '';
1603
-	if ( ! empty( $overwrite['device_type'] ) ) {
1604
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1605
-			$device_size = '-md';
1606
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1607
-			$device_size = '-lg';
1608
-		}
1609
-	}
1610
-	$options = array(
1611
-		'' => __( 'Default', 'super-duper' ),
1612
-	);
1613
-
1614
-	$i = 0;
1615
-	while ( $i <= 12 ) {
1616
-		$options[ 'order' . $device_size . '-' . $i ] = $i;
1617
-		$i++;
1618
-	}
1619
-
1620
-	$defaults = array(
1621
-		'type'            => 'select',
1622
-		'title'           => __( 'Flex Order', 'super-duper' ),
1623
-		'options'         => $options,
1624
-		'default'         => '',
1625
-		'desc_tip'        => true,
1626
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1627
-		'element_require' => ' [%container%]=="col" ',
1628
-
1629
-	);
1630
-
1631
-	$input = wp_parse_args( $overwrite, $defaults );
1632
-
1633
-	return $input;
1602
+    $device_size = '';
1603
+    if ( ! empty( $overwrite['device_type'] ) ) {
1604
+        if ( $overwrite['device_type'] == 'Tablet' ) {
1605
+            $device_size = '-md';
1606
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
1607
+            $device_size = '-lg';
1608
+        }
1609
+    }
1610
+    $options = array(
1611
+        '' => __( 'Default', 'super-duper' ),
1612
+    );
1613
+
1614
+    $i = 0;
1615
+    while ( $i <= 12 ) {
1616
+        $options[ 'order' . $device_size . '-' . $i ] = $i;
1617
+        $i++;
1618
+    }
1619
+
1620
+    $defaults = array(
1621
+        'type'            => 'select',
1622
+        'title'           => __( 'Flex Order', 'super-duper' ),
1623
+        'options'         => $options,
1624
+        'default'         => '',
1625
+        'desc_tip'        => true,
1626
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1627
+        'element_require' => ' [%container%]=="col" ',
1628
+
1629
+    );
1630
+
1631
+    $input = wp_parse_args( $overwrite, $defaults );
1632
+
1633
+    return $input;
1634 1634
 }
1635 1635
 
1636 1636
 function sd_get_flex_order_input_group( $type = 'flex_order', $overwrite = array() ) {
1637
-	$inputs = array();
1638
-	$sizes  = array(
1639
-		''    => 'Mobile',
1640
-		'_md' => 'Tablet',
1641
-		'_lg' => 'Desktop',
1642
-	);
1643
-
1644
-	if ( $overwrite !== false ) {
1645
-
1646
-		foreach ( $sizes as $ds => $dt ) {
1647
-			$overwrite['device_type'] = $dt;
1648
-			$inputs[ $type . $ds ]    = sd_get_flex_order_input( $type, $overwrite );
1649
-		}
1650
-	}
1651
-
1652
-	return $inputs;
1637
+    $inputs = array();
1638
+    $sizes  = array(
1639
+        ''    => 'Mobile',
1640
+        '_md' => 'Tablet',
1641
+        '_lg' => 'Desktop',
1642
+    );
1643
+
1644
+    if ( $overwrite !== false ) {
1645
+
1646
+        foreach ( $sizes as $ds => $dt ) {
1647
+            $overwrite['device_type'] = $dt;
1648
+            $inputs[ $type . $ds ]    = sd_get_flex_order_input( $type, $overwrite );
1649
+        }
1650
+    }
1651
+
1652
+    return $inputs;
1653 1653
 }
1654 1654
 
1655 1655
 /**
@@ -1662,345 +1662,345 @@  discard block
 block discarded – undo
1662 1662
  */
1663 1663
 function sd_build_aui_class( $args ) {
1664 1664
 
1665
-	$classes = array();
1666
-
1667
-	// margins.
1668
-	if ( isset( $args['mt'] ) && $args['mt'] !== '' ) {
1669
-		$classes[] = 'mt-' . sanitize_html_class( $args['mt'] );
1670
-		$mt        = $args['mt'];
1671
-	} else {
1672
-		$mt = null;
1673
-	}
1674
-	if ( isset( $args['mr'] ) && $args['mr'] !== '' ) {
1675
-		$classes[] = 'mr-' . sanitize_html_class( $args['mr'] );
1676
-		$mr        = $args['mr'];
1677
-	} else {
1678
-		$mr = null;
1679
-	}
1680
-	if ( isset( $args['mb'] ) && $args['mb'] !== '' ) {
1681
-		$classes[] = 'mb-' . sanitize_html_class( $args['mb'] );
1682
-		$mb        = $args['mb'];
1683
-	} else {
1684
-		$mb = null;
1685
-	}
1686
-	if ( isset( $args['ml'] ) && $args['ml'] !== '' ) {
1687
-		$classes[] = 'ml-' . sanitize_html_class( $args['ml'] );
1688
-		$ml        = $args['ml'];
1689
-	} else {
1690
-		$ml = null;
1691
-	}
1692
-
1693
-	// margins tablet.
1694
-	if ( isset( $args['mt_md'] ) && $args['mt_md'] !== '' ) {
1695
-		$classes[] = 'mt-md-' . sanitize_html_class( $args['mt_md'] );
1696
-		$mt_md     = $args['mt_md'];
1697
-	} else {
1698
-		$mt_md = null;
1699
-	}
1700
-	if ( isset( $args['mr_md'] ) && $args['mr_md'] !== '' ) {
1701
-		$classes[] = 'mr-md-' . sanitize_html_class( $args['mr_md'] );
1702
-		$mt_md     = $args['mr_md'];
1703
-	} else {
1704
-		$mr_md = null;
1705
-	}
1706
-	if ( isset( $args['mb_md'] ) && $args['mb_md'] !== '' ) {
1707
-		$classes[] = 'mb-md-' . sanitize_html_class( $args['mb_md'] );
1708
-		$mt_md     = $args['mb_md'];
1709
-	} else {
1710
-		$mb_md = null;
1711
-	}
1712
-	if ( isset( $args['ml_md'] ) && $args['ml_md'] !== '' ) {
1713
-		$classes[] = 'ml-md-' . sanitize_html_class( $args['ml_md'] );
1714
-		$mt_md     = $args['ml_md'];
1715
-	} else {
1716
-		$ml_md = null;
1717
-	}
1718
-
1719
-	// margins desktop.
1720
-	if ( isset( $args['mt_lg'] ) && $args['mt_lg'] !== '' ) {
1721
-		if ( $mt == null && $mt_md == null ) {
1722
-			$classes[] = 'mt-' . sanitize_html_class( $args['mt_lg'] );
1723
-		} else {
1724
-			$classes[] = 'mt-lg-' . sanitize_html_class( $args['mt_lg'] );
1725
-		}
1726
-	}
1727
-	if ( isset( $args['mr_lg'] ) && $args['mr_lg'] !== '' ) {
1728
-		if ( $mr == null && $mr_md == null ) {
1729
-			$classes[] = 'mr-' . sanitize_html_class( $args['mr_lg'] );
1730
-		} else {
1731
-			$classes[] = 'mr-lg-' . sanitize_html_class( $args['mr_lg'] );
1732
-		}
1733
-	}
1734
-	if ( isset( $args['mb_lg'] ) && $args['mb_lg'] !== '' ) {
1735
-		if ( $mb == null && $mb_md == null ) {
1736
-			$classes[] = 'mb-' . sanitize_html_class( $args['mb_lg'] );
1737
-		} else {
1738
-			$classes[] = 'mb-lg-' . sanitize_html_class( $args['mb_lg'] );
1739
-		}
1740
-	}
1741
-	if ( isset( $args['ml_lg'] ) && $args['ml_lg'] !== '' ) {
1742
-		if ( $ml == null && $ml_md == null ) {
1743
-			$classes[] = 'ml-' . sanitize_html_class( $args['ml_lg'] );
1744
-		} else {
1745
-			$classes[] = 'ml-lg-' . sanitize_html_class( $args['ml_lg'] );
1746
-		}
1747
-	}
1748
-
1749
-	// padding.
1750
-	if ( isset( $args['pt'] ) && $args['pt'] !== '' ) {
1751
-		$classes[] = 'pt-' . sanitize_html_class( $args['pt'] );
1752
-		$pt        = $args['pt'];
1753
-	} else {
1754
-		$pt = null;
1755
-	}
1756
-	if ( isset( $args['pr'] ) && $args['pr'] !== '' ) {
1757
-		$classes[] = 'pr-' . sanitize_html_class( $args['pr'] );
1758
-		$pr        = $args['pr'];
1759
-	} else {
1760
-		$pr = null;
1761
-	}
1762
-	if ( isset( $args['pb'] ) && $args['pb'] !== '' ) {
1763
-		$classes[] = 'pb-' . sanitize_html_class( $args['pb'] );
1764
-		$pb        = $args['pb'];
1765
-	} else {
1766
-		$pb = null;
1767
-	}
1768
-	if ( isset( $args['pl'] ) && $args['pl'] !== '' ) {
1769
-		$classes[] = 'pl-' . sanitize_html_class( $args['pl'] );
1770
-		$pl        = $args['pl'];
1771
-	} else {
1772
-		$pl = null;
1773
-	}
1774
-
1775
-	// padding tablet.
1776
-	if ( isset( $args['pt_md'] ) && $args['pt_md'] !== '' ) {
1777
-		$classes[] = 'pt-md-' . sanitize_html_class( $args['pt_md'] );
1778
-		$pt_md     = $args['pt_md'];
1779
-	} else {
1780
-		$pt_md = null;
1781
-	}
1782
-	if ( isset( $args['pr_md'] ) && $args['pr_md'] !== '' ) {
1783
-		$classes[] = 'pr-md-' . sanitize_html_class( $args['pr_md'] );
1784
-		$pt_md     = $args['pr_md'];
1785
-	} else {
1786
-		$pr_md = null;
1787
-	}
1788
-	if ( isset( $args['pb_md'] ) && $args['pb_md'] !== '' ) {
1789
-		$classes[] = 'pb-md-' . sanitize_html_class( $args['pb_md'] );
1790
-		$pt_md     = $args['pb_md'];
1791
-	} else {
1792
-		$pb_md = null;
1793
-	}
1794
-	if ( isset( $args['pl_md'] ) && $args['pl_md'] !== '' ) {
1795
-		$classes[] = 'pl-md-' . sanitize_html_class( $args['pl_md'] );
1796
-		$pt_md     = $args['pl_md'];
1797
-	} else {
1798
-		$pl_md = null;
1799
-	}
1800
-
1801
-	// padding desktop.
1802
-	if ( isset( $args['pt_lg'] ) && $args['pt_lg'] !== '' ) {
1803
-		if ( $pt == null && $pt_md == null ) {
1804
-			$classes[] = 'pt-' . sanitize_html_class( $args['pt_lg'] );
1805
-		} else {
1806
-			$classes[] = 'pt-lg-' . sanitize_html_class( $args['pt_lg'] );
1807
-		}
1808
-	}
1809
-	if ( isset( $args['pr_lg'] ) && $args['pr_lg'] !== '' ) {
1810
-		if ( $pr == null && $pr_md == null ) {
1811
-			$classes[] = 'pr-' . sanitize_html_class( $args['pr_lg'] );
1812
-		} else {
1813
-			$classes[] = 'pr-lg-' . sanitize_html_class( $args['pr_lg'] );
1814
-		}
1815
-	}
1816
-	if ( isset( $args['pb_lg'] ) && $args['pb_lg'] !== '' ) {
1817
-		if ( $pb == null && $pb_md == null ) {
1818
-			$classes[] = 'pb-' . sanitize_html_class( $args['pb_lg'] );
1819
-		} else {
1820
-			$classes[] = 'pb-lg-' . sanitize_html_class( $args['pb_lg'] );
1821
-		}
1822
-	}
1823
-	if ( isset( $args['pl_lg'] ) && $args['pl_lg'] !== '' ) {
1824
-		if ( $pl == null && $pl_md == null ) {
1825
-			$classes[] = 'pl-' . sanitize_html_class( $args['pl_lg'] );
1826
-		} else {
1827
-			$classes[] = 'pl-lg-' . sanitize_html_class( $args['pl_lg'] );
1828
-		}
1829
-	}
1830
-
1831
-	// row cols, mobile, tablet, desktop
1832
-	if ( ! empty( $args['row_cols'] ) && $args['row_cols'] !== '' ) {
1833
-		$classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols'] );
1834
-		$row_cols  = $args['row_cols'];
1835
-	} else {
1836
-		$row_cols = null;
1837
-	}
1838
-	if ( ! empty( $args['row_cols_md'] ) && $args['row_cols_md'] !== '' ) {
1839
-		$classes[]   = sanitize_html_class( 'row-cols-md-' . $args['row_cols_md'] );
1840
-		$row_cols_md = $args['row_cols_md'];
1841
-	} else {
1842
-		$row_cols_md = null;
1843
-	}
1844
-	if ( ! empty( $args['row_cols_lg'] ) && $args['row_cols_lg'] !== '' ) {
1845
-		if ( $row_cols == null && $row_cols_md == null ) {
1846
-			$classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols_lg'] );
1847
-		} else {
1848
-			$classes[] = sanitize_html_class( 'row-cols-lg-' . $args['row_cols_lg'] );
1849
-		}
1850
-	}
1851
-
1852
-	// columns , mobile, tablet, desktop
1853
-	if ( ! empty( $args['col'] ) && $args['col'] !== '' ) {
1854
-		$classes[] = sanitize_html_class( 'col-' . $args['col'] );
1855
-		$col       = $args['col'];
1856
-	} else {
1857
-		$col = null;
1858
-	}
1859
-	if ( ! empty( $args['col_md'] ) && $args['col_md'] !== '' ) {
1860
-		$classes[] = sanitize_html_class( 'col-md-' . $args['col_md'] );
1861
-		$col_md    = $args['col_md'];
1862
-	} else {
1863
-		$col_md = null;
1864
-	}
1865
-	if ( ! empty( $args['col_lg'] ) && $args['col_lg'] !== '' ) {
1866
-		if ( $col == null && $col_md == null ) {
1867
-			$classes[] = sanitize_html_class( 'col-' . $args['col_lg'] );
1868
-		} else {
1869
-			$classes[] = sanitize_html_class( 'col-lg-' . $args['col_lg'] );
1870
-		}
1871
-	}
1872
-
1873
-	// border
1874
-	if ( ! empty( $args['border'] ) && ( $args['border'] == 'none' || $args['border'] === '0' ) ) {
1875
-		$classes[] = 'border-0';
1876
-	} elseif ( ! empty( $args['border'] ) ) {
1877
-		$classes[] = 'border border-' . sanitize_html_class( $args['border'] );
1878
-	}
1879
-
1880
-	// border radius type
1881
-	if ( ! empty( $args['rounded'] ) ) {
1882
-		$classes[] = sanitize_html_class( $args['rounded'] );
1883
-	}
1884
-
1885
-	// border radius size
1886
-	if ( ! empty( $args['rounded_size'] ) ) {
1887
-		$classes[] = 'rounded-' . sanitize_html_class( $args['rounded_size'] );
1888
-		// if we set a size then we need to remove "rounded" if set
1889
-		if ( ( $key = array_search( 'rounded', $classes ) ) !== false ) {
1890
-			unset( $classes[ $key ] );
1891
-		}
1892
-	}
1893
-
1894
-	// shadow
1895
-	//if ( !empty( $args['shadow'] ) ) { $classes[] = sanitize_html_class($args['shadow']); }
1896
-
1897
-	// background
1898
-	if ( ! empty( $args['bg'] ) ) {
1899
-		$classes[] = 'bg-' . sanitize_html_class( $args['bg'] );
1900
-	}
1901
-
1902
-	// text_color
1903
-	if ( ! empty( $args['text_color'] ) ) {
1904
-		$classes[] = 'text-' . sanitize_html_class( $args['text_color'] );
1905
-	}
1906
-
1907
-	// text_align
1908
-	if ( ! empty( $args['text_justify'] ) ) {
1909
-		$classes[] = 'text-justify';
1910
-	} else {
1911
-		if ( ! empty( $args['text_align'] ) ) {
1912
-			$classes[]  = sanitize_html_class( $args['text_align'] );
1913
-			$text_align = $args['text_align'];
1914
-		} else {
1915
-			$text_align = null;
1916
-		}
1917
-		if ( ! empty( $args['text_align_md'] ) && $args['text_align_md'] !== '' ) {
1918
-			$classes[]     = sanitize_html_class( $args['text_align_md'] );
1919
-			$text_align_md = $args['text_align_md'];
1920
-		} else {
1921
-			$text_align_md = null;
1922
-		}
1923
-		if ( ! empty( $args['text_align_lg'] ) && $args['text_align_lg'] !== '' ) {
1924
-			if ( $text_align == null && $text_align_md == null ) {
1925
-				$classes[] = sanitize_html_class( str_replace( '-lg', '', $args['text_align_lg'] ) );
1926
-			} else {
1927
-				$classes[] = sanitize_html_class( $args['text_align_lg'] );
1928
-			}
1929
-		}
1930
-	}
1931
-
1932
-	// display
1933
-	if ( ! empty( $args['display'] ) ) {
1934
-		$classes[] = sanitize_html_class( $args['display'] );
1935
-		$display   = $args['display'];
1936
-	} else {
1937
-		$display = null;
1938
-	}
1939
-	if ( ! empty( $args['display_md'] ) && $args['display_md'] !== '' ) {
1940
-		$classes[]  = sanitize_html_class( $args['display_md'] );
1941
-		$display_md = $args['display_md'];
1942
-	} else {
1943
-		$display_md = null;
1944
-	}
1945
-	if ( ! empty( $args['display_lg'] ) && $args['display_lg'] !== '' ) {
1946
-		if ( $display == null && $display_md == null ) {
1947
-			$classes[] = sanitize_html_class( str_replace( '-lg', '', $args['display_lg'] ) );
1948
-		} else {
1949
-			$classes[] = sanitize_html_class( $args['display_lg'] );
1950
-		}
1951
-	}
1952
-
1953
-	// bgtus - background transparent until scroll
1954
-	if ( ! empty( $args['bgtus'] ) ) {
1955
-		$classes[] = sanitize_html_class( 'bg-transparent-until-scroll' );
1956
-	}
1957
-
1958
-	// hover animations
1959
-	if ( ! empty( $args['hover_animations'] ) ) {
1960
-		$classes[] = sd_sanitize_html_classes( str_replace( ',', ' ', $args['hover_animations'] ) );
1961
-	}
1962
-
1963
-	// build classes from build keys
1964
-	$build_keys = sd_get_class_build_keys();
1965
-	if ( ! empty( $build_keys ) ) {
1966
-		foreach ( $build_keys as $key ) {
1967
-
1968
-			if ( substr( $key, -4 ) == '-MTD' ) {
1969
-
1970
-				$k = str_replace( '_MTD', '', $key );
1971
-
1972
-				// Mobile, Tablet, Desktop
1973
-				if ( ! empty( $args[ $k ] ) && $args[ $k ] !== '' ) {
1974
-					$classes[] = sanitize_html_class( $args[ $k ] );
1975
-					$v         = $args[ $k ];
1976
-				} else {
1977
-					$v = null;
1978
-				}
1979
-				if ( ! empty( $args[ $k . '_md' ] ) && $args[ $k . '_md' ] !== '' ) {
1980
-					$classes[] = sanitize_html_class( $args[ $k . '_md' ] );
1981
-					$v_md      = $args[ $k . '_md' ];
1982
-				} else {
1983
-					$v_md = null;
1984
-				}
1985
-				if ( ! empty( $args[ $k . '_lg' ] ) && $args[ $k . '_lg' ] !== '' ) {
1986
-					if ( $v == null && $v_md == null ) {
1987
-						$classes[] = sanitize_html_class( str_replace( '-lg', '', $args[ $k . '_lg' ] ) );
1988
-					} else {
1989
-						$classes[] = sanitize_html_class( $args[ $k . '_lg' ] );
1990
-					}
1991
-				}
1992
-			} else {
1993
-				if ( $key == 'font_size' && ! empty( $args[ $key ] ) && $args[ $key ] == 'custom' ) {
1994
-					continue;
1995
-				}
1996
-				if ( ! empty( $args[ $key ] ) ) {
1997
-					$classes[] = sd_sanitize_html_classes( $args[ $key ] );
1998
-				}
1999
-			}
2000
-		}
2001
-	}
2002
-
2003
-	return implode( ' ', $classes );
1665
+    $classes = array();
1666
+
1667
+    // margins.
1668
+    if ( isset( $args['mt'] ) && $args['mt'] !== '' ) {
1669
+        $classes[] = 'mt-' . sanitize_html_class( $args['mt'] );
1670
+        $mt        = $args['mt'];
1671
+    } else {
1672
+        $mt = null;
1673
+    }
1674
+    if ( isset( $args['mr'] ) && $args['mr'] !== '' ) {
1675
+        $classes[] = 'mr-' . sanitize_html_class( $args['mr'] );
1676
+        $mr        = $args['mr'];
1677
+    } else {
1678
+        $mr = null;
1679
+    }
1680
+    if ( isset( $args['mb'] ) && $args['mb'] !== '' ) {
1681
+        $classes[] = 'mb-' . sanitize_html_class( $args['mb'] );
1682
+        $mb        = $args['mb'];
1683
+    } else {
1684
+        $mb = null;
1685
+    }
1686
+    if ( isset( $args['ml'] ) && $args['ml'] !== '' ) {
1687
+        $classes[] = 'ml-' . sanitize_html_class( $args['ml'] );
1688
+        $ml        = $args['ml'];
1689
+    } else {
1690
+        $ml = null;
1691
+    }
1692
+
1693
+    // margins tablet.
1694
+    if ( isset( $args['mt_md'] ) && $args['mt_md'] !== '' ) {
1695
+        $classes[] = 'mt-md-' . sanitize_html_class( $args['mt_md'] );
1696
+        $mt_md     = $args['mt_md'];
1697
+    } else {
1698
+        $mt_md = null;
1699
+    }
1700
+    if ( isset( $args['mr_md'] ) && $args['mr_md'] !== '' ) {
1701
+        $classes[] = 'mr-md-' . sanitize_html_class( $args['mr_md'] );
1702
+        $mt_md     = $args['mr_md'];
1703
+    } else {
1704
+        $mr_md = null;
1705
+    }
1706
+    if ( isset( $args['mb_md'] ) && $args['mb_md'] !== '' ) {
1707
+        $classes[] = 'mb-md-' . sanitize_html_class( $args['mb_md'] );
1708
+        $mt_md     = $args['mb_md'];
1709
+    } else {
1710
+        $mb_md = null;
1711
+    }
1712
+    if ( isset( $args['ml_md'] ) && $args['ml_md'] !== '' ) {
1713
+        $classes[] = 'ml-md-' . sanitize_html_class( $args['ml_md'] );
1714
+        $mt_md     = $args['ml_md'];
1715
+    } else {
1716
+        $ml_md = null;
1717
+    }
1718
+
1719
+    // margins desktop.
1720
+    if ( isset( $args['mt_lg'] ) && $args['mt_lg'] !== '' ) {
1721
+        if ( $mt == null && $mt_md == null ) {
1722
+            $classes[] = 'mt-' . sanitize_html_class( $args['mt_lg'] );
1723
+        } else {
1724
+            $classes[] = 'mt-lg-' . sanitize_html_class( $args['mt_lg'] );
1725
+        }
1726
+    }
1727
+    if ( isset( $args['mr_lg'] ) && $args['mr_lg'] !== '' ) {
1728
+        if ( $mr == null && $mr_md == null ) {
1729
+            $classes[] = 'mr-' . sanitize_html_class( $args['mr_lg'] );
1730
+        } else {
1731
+            $classes[] = 'mr-lg-' . sanitize_html_class( $args['mr_lg'] );
1732
+        }
1733
+    }
1734
+    if ( isset( $args['mb_lg'] ) && $args['mb_lg'] !== '' ) {
1735
+        if ( $mb == null && $mb_md == null ) {
1736
+            $classes[] = 'mb-' . sanitize_html_class( $args['mb_lg'] );
1737
+        } else {
1738
+            $classes[] = 'mb-lg-' . sanitize_html_class( $args['mb_lg'] );
1739
+        }
1740
+    }
1741
+    if ( isset( $args['ml_lg'] ) && $args['ml_lg'] !== '' ) {
1742
+        if ( $ml == null && $ml_md == null ) {
1743
+            $classes[] = 'ml-' . sanitize_html_class( $args['ml_lg'] );
1744
+        } else {
1745
+            $classes[] = 'ml-lg-' . sanitize_html_class( $args['ml_lg'] );
1746
+        }
1747
+    }
1748
+
1749
+    // padding.
1750
+    if ( isset( $args['pt'] ) && $args['pt'] !== '' ) {
1751
+        $classes[] = 'pt-' . sanitize_html_class( $args['pt'] );
1752
+        $pt        = $args['pt'];
1753
+    } else {
1754
+        $pt = null;
1755
+    }
1756
+    if ( isset( $args['pr'] ) && $args['pr'] !== '' ) {
1757
+        $classes[] = 'pr-' . sanitize_html_class( $args['pr'] );
1758
+        $pr        = $args['pr'];
1759
+    } else {
1760
+        $pr = null;
1761
+    }
1762
+    if ( isset( $args['pb'] ) && $args['pb'] !== '' ) {
1763
+        $classes[] = 'pb-' . sanitize_html_class( $args['pb'] );
1764
+        $pb        = $args['pb'];
1765
+    } else {
1766
+        $pb = null;
1767
+    }
1768
+    if ( isset( $args['pl'] ) && $args['pl'] !== '' ) {
1769
+        $classes[] = 'pl-' . sanitize_html_class( $args['pl'] );
1770
+        $pl        = $args['pl'];
1771
+    } else {
1772
+        $pl = null;
1773
+    }
1774
+
1775
+    // padding tablet.
1776
+    if ( isset( $args['pt_md'] ) && $args['pt_md'] !== '' ) {
1777
+        $classes[] = 'pt-md-' . sanitize_html_class( $args['pt_md'] );
1778
+        $pt_md     = $args['pt_md'];
1779
+    } else {
1780
+        $pt_md = null;
1781
+    }
1782
+    if ( isset( $args['pr_md'] ) && $args['pr_md'] !== '' ) {
1783
+        $classes[] = 'pr-md-' . sanitize_html_class( $args['pr_md'] );
1784
+        $pt_md     = $args['pr_md'];
1785
+    } else {
1786
+        $pr_md = null;
1787
+    }
1788
+    if ( isset( $args['pb_md'] ) && $args['pb_md'] !== '' ) {
1789
+        $classes[] = 'pb-md-' . sanitize_html_class( $args['pb_md'] );
1790
+        $pt_md     = $args['pb_md'];
1791
+    } else {
1792
+        $pb_md = null;
1793
+    }
1794
+    if ( isset( $args['pl_md'] ) && $args['pl_md'] !== '' ) {
1795
+        $classes[] = 'pl-md-' . sanitize_html_class( $args['pl_md'] );
1796
+        $pt_md     = $args['pl_md'];
1797
+    } else {
1798
+        $pl_md = null;
1799
+    }
1800
+
1801
+    // padding desktop.
1802
+    if ( isset( $args['pt_lg'] ) && $args['pt_lg'] !== '' ) {
1803
+        if ( $pt == null && $pt_md == null ) {
1804
+            $classes[] = 'pt-' . sanitize_html_class( $args['pt_lg'] );
1805
+        } else {
1806
+            $classes[] = 'pt-lg-' . sanitize_html_class( $args['pt_lg'] );
1807
+        }
1808
+    }
1809
+    if ( isset( $args['pr_lg'] ) && $args['pr_lg'] !== '' ) {
1810
+        if ( $pr == null && $pr_md == null ) {
1811
+            $classes[] = 'pr-' . sanitize_html_class( $args['pr_lg'] );
1812
+        } else {
1813
+            $classes[] = 'pr-lg-' . sanitize_html_class( $args['pr_lg'] );
1814
+        }
1815
+    }
1816
+    if ( isset( $args['pb_lg'] ) && $args['pb_lg'] !== '' ) {
1817
+        if ( $pb == null && $pb_md == null ) {
1818
+            $classes[] = 'pb-' . sanitize_html_class( $args['pb_lg'] );
1819
+        } else {
1820
+            $classes[] = 'pb-lg-' . sanitize_html_class( $args['pb_lg'] );
1821
+        }
1822
+    }
1823
+    if ( isset( $args['pl_lg'] ) && $args['pl_lg'] !== '' ) {
1824
+        if ( $pl == null && $pl_md == null ) {
1825
+            $classes[] = 'pl-' . sanitize_html_class( $args['pl_lg'] );
1826
+        } else {
1827
+            $classes[] = 'pl-lg-' . sanitize_html_class( $args['pl_lg'] );
1828
+        }
1829
+    }
1830
+
1831
+    // row cols, mobile, tablet, desktop
1832
+    if ( ! empty( $args['row_cols'] ) && $args['row_cols'] !== '' ) {
1833
+        $classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols'] );
1834
+        $row_cols  = $args['row_cols'];
1835
+    } else {
1836
+        $row_cols = null;
1837
+    }
1838
+    if ( ! empty( $args['row_cols_md'] ) && $args['row_cols_md'] !== '' ) {
1839
+        $classes[]   = sanitize_html_class( 'row-cols-md-' . $args['row_cols_md'] );
1840
+        $row_cols_md = $args['row_cols_md'];
1841
+    } else {
1842
+        $row_cols_md = null;
1843
+    }
1844
+    if ( ! empty( $args['row_cols_lg'] ) && $args['row_cols_lg'] !== '' ) {
1845
+        if ( $row_cols == null && $row_cols_md == null ) {
1846
+            $classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols_lg'] );
1847
+        } else {
1848
+            $classes[] = sanitize_html_class( 'row-cols-lg-' . $args['row_cols_lg'] );
1849
+        }
1850
+    }
1851
+
1852
+    // columns , mobile, tablet, desktop
1853
+    if ( ! empty( $args['col'] ) && $args['col'] !== '' ) {
1854
+        $classes[] = sanitize_html_class( 'col-' . $args['col'] );
1855
+        $col       = $args['col'];
1856
+    } else {
1857
+        $col = null;
1858
+    }
1859
+    if ( ! empty( $args['col_md'] ) && $args['col_md'] !== '' ) {
1860
+        $classes[] = sanitize_html_class( 'col-md-' . $args['col_md'] );
1861
+        $col_md    = $args['col_md'];
1862
+    } else {
1863
+        $col_md = null;
1864
+    }
1865
+    if ( ! empty( $args['col_lg'] ) && $args['col_lg'] !== '' ) {
1866
+        if ( $col == null && $col_md == null ) {
1867
+            $classes[] = sanitize_html_class( 'col-' . $args['col_lg'] );
1868
+        } else {
1869
+            $classes[] = sanitize_html_class( 'col-lg-' . $args['col_lg'] );
1870
+        }
1871
+    }
1872
+
1873
+    // border
1874
+    if ( ! empty( $args['border'] ) && ( $args['border'] == 'none' || $args['border'] === '0' ) ) {
1875
+        $classes[] = 'border-0';
1876
+    } elseif ( ! empty( $args['border'] ) ) {
1877
+        $classes[] = 'border border-' . sanitize_html_class( $args['border'] );
1878
+    }
1879
+
1880
+    // border radius type
1881
+    if ( ! empty( $args['rounded'] ) ) {
1882
+        $classes[] = sanitize_html_class( $args['rounded'] );
1883
+    }
1884
+
1885
+    // border radius size
1886
+    if ( ! empty( $args['rounded_size'] ) ) {
1887
+        $classes[] = 'rounded-' . sanitize_html_class( $args['rounded_size'] );
1888
+        // if we set a size then we need to remove "rounded" if set
1889
+        if ( ( $key = array_search( 'rounded', $classes ) ) !== false ) {
1890
+            unset( $classes[ $key ] );
1891
+        }
1892
+    }
1893
+
1894
+    // shadow
1895
+    //if ( !empty( $args['shadow'] ) ) { $classes[] = sanitize_html_class($args['shadow']); }
1896
+
1897
+    // background
1898
+    if ( ! empty( $args['bg'] ) ) {
1899
+        $classes[] = 'bg-' . sanitize_html_class( $args['bg'] );
1900
+    }
1901
+
1902
+    // text_color
1903
+    if ( ! empty( $args['text_color'] ) ) {
1904
+        $classes[] = 'text-' . sanitize_html_class( $args['text_color'] );
1905
+    }
1906
+
1907
+    // text_align
1908
+    if ( ! empty( $args['text_justify'] ) ) {
1909
+        $classes[] = 'text-justify';
1910
+    } else {
1911
+        if ( ! empty( $args['text_align'] ) ) {
1912
+            $classes[]  = sanitize_html_class( $args['text_align'] );
1913
+            $text_align = $args['text_align'];
1914
+        } else {
1915
+            $text_align = null;
1916
+        }
1917
+        if ( ! empty( $args['text_align_md'] ) && $args['text_align_md'] !== '' ) {
1918
+            $classes[]     = sanitize_html_class( $args['text_align_md'] );
1919
+            $text_align_md = $args['text_align_md'];
1920
+        } else {
1921
+            $text_align_md = null;
1922
+        }
1923
+        if ( ! empty( $args['text_align_lg'] ) && $args['text_align_lg'] !== '' ) {
1924
+            if ( $text_align == null && $text_align_md == null ) {
1925
+                $classes[] = sanitize_html_class( str_replace( '-lg', '', $args['text_align_lg'] ) );
1926
+            } else {
1927
+                $classes[] = sanitize_html_class( $args['text_align_lg'] );
1928
+            }
1929
+        }
1930
+    }
1931
+
1932
+    // display
1933
+    if ( ! empty( $args['display'] ) ) {
1934
+        $classes[] = sanitize_html_class( $args['display'] );
1935
+        $display   = $args['display'];
1936
+    } else {
1937
+        $display = null;
1938
+    }
1939
+    if ( ! empty( $args['display_md'] ) && $args['display_md'] !== '' ) {
1940
+        $classes[]  = sanitize_html_class( $args['display_md'] );
1941
+        $display_md = $args['display_md'];
1942
+    } else {
1943
+        $display_md = null;
1944
+    }
1945
+    if ( ! empty( $args['display_lg'] ) && $args['display_lg'] !== '' ) {
1946
+        if ( $display == null && $display_md == null ) {
1947
+            $classes[] = sanitize_html_class( str_replace( '-lg', '', $args['display_lg'] ) );
1948
+        } else {
1949
+            $classes[] = sanitize_html_class( $args['display_lg'] );
1950
+        }
1951
+    }
1952
+
1953
+    // bgtus - background transparent until scroll
1954
+    if ( ! empty( $args['bgtus'] ) ) {
1955
+        $classes[] = sanitize_html_class( 'bg-transparent-until-scroll' );
1956
+    }
1957
+
1958
+    // hover animations
1959
+    if ( ! empty( $args['hover_animations'] ) ) {
1960
+        $classes[] = sd_sanitize_html_classes( str_replace( ',', ' ', $args['hover_animations'] ) );
1961
+    }
1962
+
1963
+    // build classes from build keys
1964
+    $build_keys = sd_get_class_build_keys();
1965
+    if ( ! empty( $build_keys ) ) {
1966
+        foreach ( $build_keys as $key ) {
1967
+
1968
+            if ( substr( $key, -4 ) == '-MTD' ) {
1969
+
1970
+                $k = str_replace( '_MTD', '', $key );
1971
+
1972
+                // Mobile, Tablet, Desktop
1973
+                if ( ! empty( $args[ $k ] ) && $args[ $k ] !== '' ) {
1974
+                    $classes[] = sanitize_html_class( $args[ $k ] );
1975
+                    $v         = $args[ $k ];
1976
+                } else {
1977
+                    $v = null;
1978
+                }
1979
+                if ( ! empty( $args[ $k . '_md' ] ) && $args[ $k . '_md' ] !== '' ) {
1980
+                    $classes[] = sanitize_html_class( $args[ $k . '_md' ] );
1981
+                    $v_md      = $args[ $k . '_md' ];
1982
+                } else {
1983
+                    $v_md = null;
1984
+                }
1985
+                if ( ! empty( $args[ $k . '_lg' ] ) && $args[ $k . '_lg' ] !== '' ) {
1986
+                    if ( $v == null && $v_md == null ) {
1987
+                        $classes[] = sanitize_html_class( str_replace( '-lg', '', $args[ $k . '_lg' ] ) );
1988
+                    } else {
1989
+                        $classes[] = sanitize_html_class( $args[ $k . '_lg' ] );
1990
+                    }
1991
+                }
1992
+            } else {
1993
+                if ( $key == 'font_size' && ! empty( $args[ $key ] ) && $args[ $key ] == 'custom' ) {
1994
+                    continue;
1995
+                }
1996
+                if ( ! empty( $args[ $key ] ) ) {
1997
+                    $classes[] = sd_sanitize_html_classes( $args[ $key ] );
1998
+                }
1999
+            }
2000
+        }
2001
+    }
2002
+
2003
+    return implode( ' ', $classes );
2004 2004
 }
2005 2005
 
2006 2006
 /**
@@ -2012,85 +2012,85 @@  discard block
 block discarded – undo
2012 2012
  */
2013 2013
 function sd_build_aui_styles( $args ) {
2014 2014
 
2015
-	$styles = array();
2016
-
2017
-	// background color
2018
-	if ( ! empty( $args['bg'] ) && $args['bg'] !== '' ) {
2019
-		if ( $args['bg'] == 'custom-color' ) {
2020
-			$styles['background-color'] = $args['bg_color'];
2021
-		} elseif ( $args['bg'] == 'custom-gradient' ) {
2022
-			$styles['background-image'] = $args['bg_gradient'];
2023
-
2024
-			// use background on text.
2025
-			if ( ! empty( $args['bg_on_text'] ) && $args['bg_on_text'] ) {
2026
-				$styles['background-clip']         = 'text';
2027
-				$styles['-webkit-background-clip'] = 'text';
2028
-				$styles['text-fill-color']         = 'transparent';
2029
-				$styles['-webkit-text-fill-color'] = 'transparent';
2030
-			}
2031
-		}
2032
-	}
2033
-
2034
-	if ( ! empty( $args['bg_image'] ) && $args['bg_image'] !== '' ) {
2035
-		$hasImage = true;
2036
-		if ( ! empty( $styles['background-color'] ) && $args['bg'] == 'custom-color' ) {
2037
-			$styles['background-image']      = 'url(' . $args['bg_image'] . ')';
2038
-			$styles['background-blend-mode'] = 'overlay';
2039
-		} elseif ( ! empty( $styles['background-image'] ) && $args['bg'] == 'custom-gradient' ) {
2040
-			$styles['background-image'] .= ',url(' . $args['bg_image'] . ')';
2041
-		} elseif ( ! empty( $args['bg'] ) && $args['bg'] != '' && $args['bg'] != 'transparent' ) {
2042
-			// do nothing as we alreay have a preset
2043
-			$hasImage = false;
2044
-		} else {
2045
-			$styles['background-image'] = 'url(' . $args['bg_image'] . ')';
2046
-		}
2047
-
2048
-		if ( $hasImage ) {
2049
-			$styles['background-size'] = 'cover';
2050
-
2051
-			if ( ! empty( $args['bg_image_fixed'] ) && $args['bg_image_fixed'] ) {
2052
-				$styles['background-attachment'] = 'fixed';
2053
-			}
2054
-		}
2055
-
2056
-		if ( $hasImage && ! empty( $args['bg_image_xy'] ) && ! empty( $args['bg_image_xy']['x'] ) ) {
2057
-			$styles['background-position'] = ( $args['bg_image_xy']['x'] * 100 ) . '% ' . ( $args['bg_image_xy']['y'] * 100 ) . '%';
2058
-		}
2059
-	}
2060
-
2061
-	// sticky offset top
2062
-	if ( ! empty( $args['sticky_offset_top'] ) && $args['sticky_offset_top'] !== '' ) {
2063
-		$styles['top'] = absint( $args['sticky_offset_top'] );
2064
-	}
2065
-
2066
-	// sticky offset bottom
2067
-	if ( ! empty( $args['sticky_offset_bottom'] ) && $args['sticky_offset_bottom'] !== '' ) {
2068
-		$styles['bottom'] = absint( $args['sticky_offset_bottom'] );
2069
-	}
2070
-
2071
-	// font size
2072
-	if ( ! empty( $args['font_size_custom'] ) && $args['font_size_custom'] !== '' ) {
2073
-		$styles['font-size'] = (float) $args['font_size_custom'] . 'rem';
2074
-	}
2075
-
2076
-	// font color
2077
-	if ( ! empty( $args['text_color_custom'] ) && $args['text_color_custom'] !== '' ) {
2078
-		$styles['color'] = esc_attr( $args['text_color_custom'] );
2079
-	}
2080
-
2081
-	// font line height
2082
-	if ( ! empty( $args['font_line_height'] ) && $args['font_line_height'] !== '' ) {
2083
-		$styles['line-height'] = esc_attr( $args['font_line_height'] );
2084
-	}
2085
-
2086
-	$style_string = '';
2087
-	if ( ! empty( $styles ) ) {
2088
-		foreach ( $styles as $key => $val ) {
2089
-			$style_string .= esc_attr( $key ) . ':' . esc_attr( $val ) . ';';
2090
-		}
2091
-	}
2092
-
2093
-	return $style_string;
2015
+    $styles = array();
2016
+
2017
+    // background color
2018
+    if ( ! empty( $args['bg'] ) && $args['bg'] !== '' ) {
2019
+        if ( $args['bg'] == 'custom-color' ) {
2020
+            $styles['background-color'] = $args['bg_color'];
2021
+        } elseif ( $args['bg'] == 'custom-gradient' ) {
2022
+            $styles['background-image'] = $args['bg_gradient'];
2023
+
2024
+            // use background on text.
2025
+            if ( ! empty( $args['bg_on_text'] ) && $args['bg_on_text'] ) {
2026
+                $styles['background-clip']         = 'text';
2027
+                $styles['-webkit-background-clip'] = 'text';
2028
+                $styles['text-fill-color']         = 'transparent';
2029
+                $styles['-webkit-text-fill-color'] = 'transparent';
2030
+            }
2031
+        }
2032
+    }
2033
+
2034
+    if ( ! empty( $args['bg_image'] ) && $args['bg_image'] !== '' ) {
2035
+        $hasImage = true;
2036
+        if ( ! empty( $styles['background-color'] ) && $args['bg'] == 'custom-color' ) {
2037
+            $styles['background-image']      = 'url(' . $args['bg_image'] . ')';
2038
+            $styles['background-blend-mode'] = 'overlay';
2039
+        } elseif ( ! empty( $styles['background-image'] ) && $args['bg'] == 'custom-gradient' ) {
2040
+            $styles['background-image'] .= ',url(' . $args['bg_image'] . ')';
2041
+        } elseif ( ! empty( $args['bg'] ) && $args['bg'] != '' && $args['bg'] != 'transparent' ) {
2042
+            // do nothing as we alreay have a preset
2043
+            $hasImage = false;
2044
+        } else {
2045
+            $styles['background-image'] = 'url(' . $args['bg_image'] . ')';
2046
+        }
2047
+
2048
+        if ( $hasImage ) {
2049
+            $styles['background-size'] = 'cover';
2050
+
2051
+            if ( ! empty( $args['bg_image_fixed'] ) && $args['bg_image_fixed'] ) {
2052
+                $styles['background-attachment'] = 'fixed';
2053
+            }
2054
+        }
2055
+
2056
+        if ( $hasImage && ! empty( $args['bg_image_xy'] ) && ! empty( $args['bg_image_xy']['x'] ) ) {
2057
+            $styles['background-position'] = ( $args['bg_image_xy']['x'] * 100 ) . '% ' . ( $args['bg_image_xy']['y'] * 100 ) . '%';
2058
+        }
2059
+    }
2060
+
2061
+    // sticky offset top
2062
+    if ( ! empty( $args['sticky_offset_top'] ) && $args['sticky_offset_top'] !== '' ) {
2063
+        $styles['top'] = absint( $args['sticky_offset_top'] );
2064
+    }
2065
+
2066
+    // sticky offset bottom
2067
+    if ( ! empty( $args['sticky_offset_bottom'] ) && $args['sticky_offset_bottom'] !== '' ) {
2068
+        $styles['bottom'] = absint( $args['sticky_offset_bottom'] );
2069
+    }
2070
+
2071
+    // font size
2072
+    if ( ! empty( $args['font_size_custom'] ) && $args['font_size_custom'] !== '' ) {
2073
+        $styles['font-size'] = (float) $args['font_size_custom'] . 'rem';
2074
+    }
2075
+
2076
+    // font color
2077
+    if ( ! empty( $args['text_color_custom'] ) && $args['text_color_custom'] !== '' ) {
2078
+        $styles['color'] = esc_attr( $args['text_color_custom'] );
2079
+    }
2080
+
2081
+    // font line height
2082
+    if ( ! empty( $args['font_line_height'] ) && $args['font_line_height'] !== '' ) {
2083
+        $styles['line-height'] = esc_attr( $args['font_line_height'] );
2084
+    }
2085
+
2086
+    $style_string = '';
2087
+    if ( ! empty( $styles ) ) {
2088
+        foreach ( $styles as $key => $val ) {
2089
+            $style_string .= esc_attr( $key ) . ':' . esc_attr( $val ) . ';';
2090
+        }
2091
+    }
2092
+
2093
+    return $style_string;
2094 2094
 
2095 2095
 }
2096 2096
 
@@ -2103,19 +2103,19 @@  discard block
 block discarded – undo
2103 2103
  * @return string
2104 2104
  */
2105 2105
 function sd_sanitize_html_classes( $classes, $sep = ' ' ) {
2106
-	$return = '';
2106
+    $return = '';
2107 2107
 
2108
-	if ( ! is_array( $classes ) ) {
2109
-		$classes = explode( $sep, $classes );
2110
-	}
2108
+    if ( ! is_array( $classes ) ) {
2109
+        $classes = explode( $sep, $classes );
2110
+    }
2111 2111
 
2112
-	if ( ! empty( $classes ) ) {
2113
-		foreach ( $classes as $class ) {
2114
-			$return .= sanitize_html_class( $class ) . ' ';
2115
-		}
2116
-	}
2112
+    if ( ! empty( $classes ) ) {
2113
+        foreach ( $classes as $class ) {
2114
+            $return .= sanitize_html_class( $class ) . ' ';
2115
+        }
2116
+    }
2117 2117
 
2118
-	return $return;
2118
+    return $return;
2119 2119
 }
2120 2120
 
2121 2121
 
@@ -2125,26 +2125,26 @@  discard block
 block discarded – undo
2125 2125
  * @return void
2126 2126
  */
2127 2127
 function sd_get_class_build_keys() {
2128
-	$keys = array(
2129
-		'container',
2130
-		'position',
2131
-		'flex_direction',
2132
-		'shadow',
2133
-		'rounded',
2134
-		'nav_style',
2135
-		'horizontal_alignment',
2136
-		'nav_fill',
2137
-		'width',
2138
-		'font_weight',
2139
-		'font_size',
2140
-		'font_case',
2141
-		'css_class',
2142
-		'flex_align_items-MTD',
2143
-		'flex_justify_content-MTD',
2144
-		'flex_align_self-MTD',
2145
-		'flex_order-MTD',
2146
-		'styleid',
2147
-	);
2148
-
2149
-	return apply_filters( 'sd_class_build_keys', $keys );
2128
+    $keys = array(
2129
+        'container',
2130
+        'position',
2131
+        'flex_direction',
2132
+        'shadow',
2133
+        'rounded',
2134
+        'nav_style',
2135
+        'horizontal_alignment',
2136
+        'nav_fill',
2137
+        'width',
2138
+        'font_weight',
2139
+        'font_size',
2140
+        'font_case',
2141
+        'css_class',
2142
+        'flex_align_items-MTD',
2143
+        'flex_justify_content-MTD',
2144
+        'flex_align_self-MTD',
2145
+        'flex_order-MTD',
2146
+        'styleid',
2147
+    );
2148
+
2149
+    return apply_filters( 'sd_class_build_keys', $keys );
2150 2150
 }
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/wp-super-duper.php 1 patch
Indentation   +1995 added lines, -1995 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.10' );
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.10' );
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;" onclick="sd_show_view_options(this);"></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,22 +3047,22 @@  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
-			$after_elements	   = '';
3060
+            $after_elements	   = '';
3061 3061
 
3062
-			// `content` is a protected and special argument
3063
-			if ( $key == 'content' ) {
3064
-				return;
3065
-			}
3062
+            // `content` is a protected and special argument
3063
+            if ( $key == 'content' ) {
3064
+                return;
3065
+            }
3066 3066
 
3067 3067
             $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
3068 3068
             $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
@@ -3075,51 +3075,51 @@  discard block
 block discarded – undo
3075 3075
                 $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3076 3076
             }
3077 3077
 
3078
-			// icon
3079
-			$icon = '';
3080
-			if( !empty( $args['icon'] ) ){
3081
-				$icon .= "el('div', {";
3082
-									$icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},";
3083
-									$icon .= "className: 'text-center',";
3084
-									$icon .= "title: '".addslashes( $args['title'] )."',";
3085
-								$icon .= "}),";
3086
-
3087
-				// blank title as its added to the icon.
3088
-				$args['title'] = '';
3089
-			}
3078
+            // icon
3079
+            $icon = '';
3080
+            if( !empty( $args['icon'] ) ){
3081
+                $icon .= "el('div', {";
3082
+                                    $icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},";
3083
+                                    $icon .= "className: 'text-center',";
3084
+                                    $icon .= "title: '".addslashes( $args['title'] )."',";
3085
+                                $icon .= "}),";
3086
+
3087
+                // blank title as its added to the icon.
3088
+                $args['title'] = '';
3089
+            }
3090 3090
 
3091
-			// require advanced
3092
-			$require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
3091
+            // require advanced
3092
+            $require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
3093 3093
 
3094
-			// element require
3095
-			$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3094
+            // element require
3095
+            $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3096 3096
 
3097 3097
 
3098
-			$onchange  = "props.setAttributes({ $key: $key } )";
3099
-			$onchangecomplete  = "";
3100
-			$value     = "props.attributes.$key";
3101
-			$text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' );
3102
-			if ( in_array( $args['type'], $text_type ) ) {
3103
-				$type = 'TextControl';
3104
-				// Save numbers as numbers and not strings
3105
-				if ( $args['type'] == 'number' ) {
3106
-					$onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )";
3107
-				}
3108
-			}else if ( $args['type'] == 'styleid' ) {
3109
-				$type = 'TextControl';
3110
-				$args['type'] == 'text';
3111
-				// Save numbers as numbers and not strings
3112
-				$value     = "props.attributes.$key ? props.attributes.$key : 'aaabbbccc'";
3113
-			}else if ( $args['type'] == 'notice' ) {
3114
-
3115
-				$notice_message = !empty($args['desc']) ? addslashes($args['desc']) : '';
3116
-				$notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info';
3117
-
3118
-				$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'}}))),";
3119
-				echo $notice_message ? $element_require . $notice : '';
3120
-				return;
3121
-			}
3122
-			/*
3098
+            $onchange  = "props.setAttributes({ $key: $key } )";
3099
+            $onchangecomplete  = "";
3100
+            $value     = "props.attributes.$key";
3101
+            $text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' );
3102
+            if ( in_array( $args['type'], $text_type ) ) {
3103
+                $type = 'TextControl';
3104
+                // Save numbers as numbers and not strings
3105
+                if ( $args['type'] == 'number' ) {
3106
+                    $onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )";
3107
+                }
3108
+            }else if ( $args['type'] == 'styleid' ) {
3109
+                $type = 'TextControl';
3110
+                $args['type'] == 'text';
3111
+                // Save numbers as numbers and not strings
3112
+                $value     = "props.attributes.$key ? props.attributes.$key : 'aaabbbccc'";
3113
+            }else if ( $args['type'] == 'notice' ) {
3114
+
3115
+                $notice_message = !empty($args['desc']) ? addslashes($args['desc']) : '';
3116
+                $notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info';
3117
+
3118
+                $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'}}))),";
3119
+                echo $notice_message ? $element_require . $notice : '';
3120
+                return;
3121
+            }
3122
+            /*
3123 3123
 			 * https://www.wptricks.com/question/set-current-tab-on-a-gutenberg-tabpanel-component-from-outside-that-component/ es5 layout
3124 3124
 						elseif($args['type']=='tabs'){
3125 3125
 							?>
@@ -3172,23 +3172,23 @@  discard block
 block discarded – undo
3172 3172
 							return;
3173 3173
 						}
3174 3174
 */
3175
-			elseif ( $args['type'] == 'color' ) {
3176
-				$type = 'ColorPicker';
3177
-				$onchange = "";
3178
-				$extra = "color: $value,";
3179
-				if(!empty($args['disable_alpha'])){
3180
-					$extra .= "disableAlpha: true,";
3181
-				}
3182
-				$onchangecomplete = "onChangeComplete: function($key) {
3175
+            elseif ( $args['type'] == 'color' ) {
3176
+                $type = 'ColorPicker';
3177
+                $onchange = "";
3178
+                $extra = "color: $value,";
3179
+                if(!empty($args['disable_alpha'])){
3180
+                    $extra .= "disableAlpha: true,";
3181
+                }
3182
+                $onchangecomplete = "onChangeComplete: function($key) {
3183 3183
 				value =  $key.rgb.a && $key.rgb.a < 1 ? \"rgba(\"+$key.rgb.r+\",\"+$key.rgb.g+\",\"+$key.rgb.b+\",\"+$key.rgb.a+\")\" : $key.hex;
3184 3184
                         props.setAttributes({
3185 3185
                             $key: value
3186 3186
                         });
3187 3187
                     },";
3188
-			}elseif ( $args['type'] == 'gradient' ) {
3189
-				$type = 'GradientPicker';
3188
+            }elseif ( $args['type'] == 'gradient' ) {
3189
+                $type = 'GradientPicker';
3190 3190
 
3191
-			}elseif ( $args['type'] == 'image' ) {
3191
+            }elseif ( $args['type'] == 'image' ) {
3192 3192
 //                print_r($args);
3193 3193
 
3194 3194
                 $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,{
@@ -3213,15 +3213,15 @@  discard block
 block discarded – undo
3213 3213
 
3214 3214
 
3215 3215
                 $value = '""';
3216
-				$type = 'MediaUpload';
3216
+                $type = 'MediaUpload';
3217 3217
                 $extra .= "onSelect: function(media){
3218 3218
                       return props.setAttributes({
3219 3219
                           $key: media.url,
3220 3220
                           {$key}_id: media.id
3221 3221
                         });
3222 3222
                       },";
3223
-                   $extra .= "type: 'image',";
3224
-                   $extra .= "render: function (obj) {
3223
+                    $extra .= "type: 'image',";
3224
+                    $extra .= "render: function (obj) {
3225 3225
                         return el( 'div',{},
3226 3226
                         ( !props.attributes.$key && !props.attributes.{$key}_use_featured ) && el( wp.components.Button, {
3227 3227
                           className: 'components-button components-circular-option-picker__clear is-primary is-smallx',
@@ -3250,8 +3250,8 @@  discard block
 block discarded – undo
3250 3250
                 $onchange = "";
3251 3251
 
3252 3252
                 //$inside_elements = ",el('div',{},'file upload')";
3253
-			}elseif ( $args['type'] == 'images' ) {
3254
-				//                print_r($args);
3253
+            }elseif ( $args['type'] == 'images' ) {
3254
+                //                print_r($args);
3255 3255
 
3256 3256
                 $img_preview = "props.attributes.$key && (function() {
3257 3257
 
@@ -3280,7 +3280,7 @@  discard block
 block discarded – undo
3280 3280
 
3281 3281
 
3282 3282
                 $value = '""';
3283
-				$type = 'MediaUpload';
3283
+                $type = 'MediaUpload';
3284 3284
                 $extra .= "onSelect: function(media){
3285 3285
 
3286 3286
                 let slim_images = props.attributes.$key ? JSON.parse('['+props.attributes.$key+']') : [];
@@ -3294,9 +3294,9 @@  discard block
 block discarded – undo
3294 3294
                           $key: JSON.stringify(slim_images).replace('[','').replace(']',''),
3295 3295
                         });
3296 3296
                       },";
3297
-                   $extra .= "type: 'image',";
3298
-                   $extra .= "multiple: true,";
3299
-                   $extra .= "render: function (obj) {
3297
+                    $extra .= "type: 'image',";
3298
+                    $extra .= "multiple: true,";
3299
+                    $extra .= "render: function (obj) {
3300 3300
 
3301 3301
                    // init the sort
3302 3302
 				enableDragSort('sd-sortable');
@@ -3335,37 +3335,37 @@  discard block
 block discarded – undo
3335 3335
                 $onchange = "";
3336 3336
 
3337 3337
                 //$inside_elements = ",el('div',{},'file upload')";
3338
-			}
3339
-			elseif ( $args['type'] == 'checkbox' ) {
3340
-				$type = 'CheckboxControl';
3341
-				$extra .= "checked: props.attributes.$key,";
3342
-				$onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
3343
-			} elseif ( $args['type'] == 'textarea' ) {
3344
-				$type = 'TextareaControl';
3345
-
3346
-			} elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
3347
-				$type = 'SelectControl';
3348
-
3349
-				if($args['name'] == 'category' && !empty($args['post_type_linked'])){
3350
-					$options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
3351
-				}elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3352
-					$options .= "options: sort_by_".str_replace("-","_", $this->id).",";
3353
-				}else {
3354
-
3355
-					if ( ! empty( $args['options'] ) ) {
3356
-						$options .= "options: [";
3357
-						foreach ( $args['options'] as $option_val => $option_label ) {
3358
-							$options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . addslashes( $option_label ) . "' },";
3359
-						}
3360
-						$options .= "],";
3361
-					}
3362
-				}
3363
-				if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
3364
-					$extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, ';
3365
-				}
3338
+            }
3339
+            elseif ( $args['type'] == 'checkbox' ) {
3340
+                $type = 'CheckboxControl';
3341
+                $extra .= "checked: props.attributes.$key,";
3342
+                $onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
3343
+            } elseif ( $args['type'] == 'textarea' ) {
3344
+                $type = 'TextareaControl';
3345
+
3346
+            } elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
3347
+                $type = 'SelectControl';
3348
+
3349
+                if($args['name'] == 'category' && !empty($args['post_type_linked'])){
3350
+                    $options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
3351
+                }elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3352
+                    $options .= "options: sort_by_".str_replace("-","_", $this->id).",";
3353
+                }else {
3354
+
3355
+                    if ( ! empty( $args['options'] ) ) {
3356
+                        $options .= "options: [";
3357
+                        foreach ( $args['options'] as $option_val => $option_label ) {
3358
+                            $options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . addslashes( $option_label ) . "' },";
3359
+                        }
3360
+                        $options .= "],";
3361
+                    }
3362
+                }
3363
+                if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
3364
+                    $extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, ';
3365
+                }
3366 3366
 
3367
-				if($args['type'] == 'multiselect' ||  ( isset( $args['multiple'] ) && $args['multiple'] ) ){
3368
-					$after_elements	 .= "props.attributes.$key && el( wp.components.Button, {
3367
+                if($args['type'] == 'multiselect' ||  ( isset( $args['multiple'] ) && $args['multiple'] ) ){
3368
+                    $after_elements	 .= "props.attributes.$key && el( wp.components.Button, {
3369 3369
                                       className: 'components-button components-circular-option-picker__clear is-secondary is-small',
3370 3370
                                       style: {margin:'-8px 0 8px 0',display: 'block'},
3371 3371
                                       onClick: function(){
@@ -3376,8 +3376,8 @@  discard block
 block discarded – undo
3376 3376
                                     },
3377 3377
                                     'Clear'
3378 3378
                             ),";
3379
-				}
3380
-			} elseif ( $args['type'] == 'tagselect' ) {
3379
+                }
3380
+            } elseif ( $args['type'] == 'tagselect' ) {
3381 3381
 //				$type = 'FormTokenField';
3382 3382
 //
3383 3383
 //				if ( ! empty( $args['options'] ) ) {
@@ -3412,39 +3412,39 @@  discard block
 block discarded – undo
3412 3412
 //				$value     = "[]";
3413 3413
 //				$extra .= ' __experimentalExpandOnFocus: true,';
3414 3414
 
3415
-			} elseif ( $args['type'] == 'alignment' ) {
3416
-				$type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
3417
-			}elseif ( $args['type'] == 'margins' ) {
3415
+            } elseif ( $args['type'] == 'alignment' ) {
3416
+                $type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
3417
+            }elseif ( $args['type'] == 'margins' ) {
3418 3418
 
3419
-			} else {
3420
-				return;// if we have not implemented the control then don't break the JS.
3421
-			}
3419
+            } else {
3420
+                return;// if we have not implemented the control then don't break the JS.
3421
+            }
3422 3422
 
3423 3423
 
3424 3424
 
3425
-			// color input does not show the labels so we add them
3426
-			if($args['type']=='color'){
3427
-				// add show only if advanced
3428
-				echo $require_advanced;
3429
-				// add setting require if defined
3430
-				echo $element_require;
3431
-				echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
3432
-			}
3425
+            // color input does not show the labels so we add them
3426
+            if($args['type']=='color'){
3427
+                // add show only if advanced
3428
+                echo $require_advanced;
3429
+                // add setting require if defined
3430
+                echo $element_require;
3431
+                echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
3432
+            }
3433 3433
 
3434
-			// add show only if advanced
3435
-			echo $require_advanced;
3436
-			// add setting require if defined
3437
-			echo $element_require;
3434
+            // add show only if advanced
3435
+            echo $require_advanced;
3436
+            // add setting require if defined
3437
+            echo $element_require;
3438 3438
             echo $device_type_require;
3439 3439
 
3440
-			// icon
3441
-			echo $icon;
3442
-			?>
3440
+            // icon
3441
+            echo $icon;
3442
+            ?>
3443 3443
 			el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type  : "wp.components.".$type; ?>, {
3444 3444
 			label: <?php
3445
-			if(empty($args['title'])){
3445
+            if(empty($args['title'])){
3446 3446
                 echo "''";
3447
-			}elseif(empty($args['row']) && !empty($args['device_type'])){
3447
+            }elseif(empty($args['row']) && !empty($args['device_type'])){
3448 3448
                 ?>el('label', {
3449 3449
 									className: 'components-base-control__label',
3450 3450
 									style: {width:"100%"}
@@ -3459,22 +3459,22 @@  discard block
 block discarded – undo
3459 3459
 
3460 3460
 							)<?php
3461 3461
 
3462
-			}else{
3463
-                 ?>'<?php echo addslashes( $args['title'] ); ?>'<?php
3462
+            }else{
3463
+                    ?>'<?php echo addslashes( $args['title'] ); ?>'<?php
3464 3464
 
3465
-			}
3465
+            }
3466 3466
 
3467
-			?>,
3467
+            ?>,
3468 3468
 			help: <?php if ( isset( $args['desc'] ) ) {
3469
-				echo "el('span',{dangerouslySetInnerHTML: {__html: '".wp_kses_post( addslashes($args['desc']) )."'}})";
3470
-			}else{ echo "''"; } ?>,
3469
+                echo "el('span',{dangerouslySetInnerHTML: {__html: '".wp_kses_post( addslashes($args['desc']) )."'}})";
3470
+            }else{ echo "''"; } ?>,
3471 3471
 			value: <?php echo $value; ?>,
3472 3472
 			<?php if ( $type == 'TextControl' && $args['type'] != 'text' ) {
3473
-				echo "type: '" . addslashes( $args['type'] ) . "',";
3474
-			} ?>
3473
+                echo "type: '" . addslashes( $args['type'] ) . "',";
3474
+            } ?>
3475 3475
 			<?php if ( ! empty( $args['placeholder'] ) ) {
3476
-				echo "placeholder: '" . addslashes( $args['placeholder'] ) . "',";
3477
-			} ?>
3476
+                echo "placeholder: '" . addslashes( $args['placeholder'] ) . "',";
3477
+            } ?>
3478 3478
 			<?php echo $options; ?>
3479 3479
 			<?php echo $extra; ?>
3480 3480
 			<?php echo $custom_attributes; ?>
@@ -3487,69 +3487,69 @@  discard block
 block discarded – undo
3487 3487
 			<?php }?>
3488 3488
 			} <?php echo $inside_elements; ?> ),
3489 3489
 			<?php
3490
-			echo $after_elements;
3490
+            echo $after_elements;
3491 3491
 
3492
-		}
3492
+        }
3493 3493
 
3494
-		/**
3495
-		 * Convert an array of attributes to block string.
3496
-		 *
3497
-		 * @param $custom_attributes
3498
-		 *
3499
-		 * @return string
3500
-		 *@todo there is prob a faster way to do this, also we could add some validation here.
3501
-		 *
3502
-		 */
3503
-		public function array_to_attributes( $custom_attributes, $html = false ) {
3504
-			$attributes = '';
3505
-			if ( ! empty( $custom_attributes ) ) {
3506
-
3507
-				foreach ( $custom_attributes as $key => $val ) {
3508
-					if(is_array($val)){
3509
-						$attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},';
3510
-					}else{
3511
-						$attributes .= $html ?  " $key='$val' " : "'$key': '$val',";
3512
-					}
3513
-				}
3494
+        /**
3495
+         * Convert an array of attributes to block string.
3496
+         *
3497
+         * @param $custom_attributes
3498
+         *
3499
+         * @return string
3500
+         *@todo there is prob a faster way to do this, also we could add some validation here.
3501
+         *
3502
+         */
3503
+        public function array_to_attributes( $custom_attributes, $html = false ) {
3504
+            $attributes = '';
3505
+            if ( ! empty( $custom_attributes ) ) {
3514 3506
 
3515
-			}
3507
+                foreach ( $custom_attributes as $key => $val ) {
3508
+                    if(is_array($val)){
3509
+                        $attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},';
3510
+                    }else{
3511
+                        $attributes .= $html ?  " $key='$val' " : "'$key': '$val',";
3512
+                    }
3513
+                }
3516 3514
 
3517
-			return $attributes;
3518
-		}
3515
+            }
3516
+
3517
+            return $attributes;
3518
+        }
3519 3519
 
3520 3520
 
3521 3521
 
3522
-		/**
3523
-		 * A self looping function to create the output for JS block elements.
3524
-		 *
3525
-		 * This is what is output in the WP Editor visual view.
3526
-		 *
3527
-		 * @param $args
3528
-		 */
3529
-		public function block_element( $args, $save = false ) {
3522
+        /**
3523
+         * A self looping function to create the output for JS block elements.
3524
+         *
3525
+         * This is what is output in the WP Editor visual view.
3526
+         *
3527
+         * @param $args
3528
+         */
3529
+        public function block_element( $args, $save = false ) {
3530 3530
 
3531 3531
 
3532
-			if ( ! empty( $args ) ) {
3533
-				foreach ( $args as $element => $new_args ) {
3532
+            if ( ! empty( $args ) ) {
3533
+                foreach ( $args as $element => $new_args ) {
3534 3534
 
3535
-					if ( is_array( $new_args ) ) { // its an element
3535
+                    if ( is_array( $new_args ) ) { // its an element
3536 3536
 
3537 3537
 
3538
-						if ( isset( $new_args['element'] ) ) {
3538
+                        if ( isset( $new_args['element'] ) ) {
3539 3539
 
3540
-							if ( isset( $new_args['element_require'] ) ) {
3541
-								echo str_replace( array(
3542
-										"'+",
3543
-										"+'"
3544
-									), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
3545
-								unset( $new_args['element_require'] );
3546
-							}
3540
+                            if ( isset( $new_args['element_require'] ) ) {
3541
+                                echo str_replace( array(
3542
+                                        "'+",
3543
+                                        "+'"
3544
+                                    ), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
3545
+                                unset( $new_args['element_require'] );
3546
+                            }
3547 3547
 
3548 3548
                             if($new_args['element']=='InnerBlocks'){
3549 3549
                                 echo "\n el( InnerBlocks, {";
3550 3550
                             }elseif($new_args['element']=='innerBlocksProps'){
3551 3551
                                 $element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div';
3552
-                              //  echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {";
3552
+                                //  echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {";
3553 3553
 //                                echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
3554 3554
                                 echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
3555 3555
                                 echo $save ? "wp.blockEditor.useBlockProps.save( {" : "wp.blockEditor.useBlockProps( {";
@@ -3559,74 +3559,74 @@  discard block
 block discarded – undo
3559 3559
                                 echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element( $new_args['innerBlocksProps'],$save ) : '';
3560 3560
                             //    echo '###';
3561 3561
 
3562
-                              //  echo '###';
3562
+                                //  echo '###';
3563 3563
                             }elseif($new_args['element']=='BlocksProps'){
3564 3564
 
3565
-								if ( isset($new_args['if_inner_element']) ) {
3566
-									$element = $new_args['if_inner_element'];
3567
-								}else {
3568
-									$element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'";
3569
-								}
3565
+                                if ( isset($new_args['if_inner_element']) ) {
3566
+                                    $element = $new_args['if_inner_element'];
3567
+                                }else {
3568
+                                    $element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'";
3569
+                                }
3570 3570
 
3571
-								unset($new_args['inner_element']);
3571
+                                unset($new_args['inner_element']);
3572 3572
                                 echo $save ? "\n el( $element, wp.blockEditor.useBlockProps.save( {" : "\n el( $element, wp.blockEditor.useBlockProps( {";
3573 3573
                                 echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
3574 3574
 
3575 3575
 
3576
-                               // echo "} ),";
3576
+                                // echo "} ),";
3577 3577
 
3578 3578
                             }else{
3579 3579
                                 echo "\n el( '" . $new_args['element'] . "', {";
3580 3580
                             }
3581 3581
 
3582 3582
 
3583
-							// get the attributes
3584
-							foreach ( $new_args as $new_key => $new_value ) {
3583
+                            // get the attributes
3584
+                            foreach ( $new_args as $new_key => $new_value ) {
3585 3585
 
3586 3586
 
3587
-								if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
3588
-									// do nothing
3589
-								} else {
3590
-									echo $this->block_element( array( $new_key => $new_value ),$save );
3591
-								}
3592
-							}
3587
+                                if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
3588
+                                    // do nothing
3589
+                                } else {
3590
+                                    echo $this->block_element( array( $new_key => $new_value ),$save );
3591
+                                }
3592
+                            }
3593 3593
 
3594
-							echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes
3594
+                            echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes
3595 3595
 
3596
-							// get the content
3597
-							$first_item = 0;
3598
-							foreach ( $new_args as $new_key => $new_value ) {
3599
-								if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) {
3596
+                            // get the content
3597
+                            $first_item = 0;
3598
+                            foreach ( $new_args as $new_key => $new_value ) {
3599
+                                if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) {
3600 3600
 
3601
-									if ( $new_key === 'content' ) {
3602
-										echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
3603
-									}else if ( $new_key === 'if_content' ) {
3604
-										echo  $this->block_props_replace(  $new_value  );
3605
-									}
3601
+                                    if ( $new_key === 'content' ) {
3602
+                                        echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
3603
+                                    }else if ( $new_key === 'if_content' ) {
3604
+                                        echo  $this->block_props_replace(  $new_value  );
3605
+                                    }
3606 3606
 
3607
-									if ( is_array( $new_value ) ) {
3607
+                                    if ( is_array( $new_value ) ) {
3608 3608
 
3609
-										if ( isset( $new_value['element_require'] ) ) {
3610
-											echo str_replace( array(
3611
-													"'+",
3612
-													"+'"
3613
-												), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
3614
-											unset( $new_value['element_require'] );
3615
-										}
3609
+                                        if ( isset( $new_value['element_require'] ) ) {
3610
+                                            echo str_replace( array(
3611
+                                                    "'+",
3612
+                                                    "+'"
3613
+                                                ), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
3614
+                                            unset( $new_value['element_require'] );
3615
+                                        }
3616 3616
 
3617
-										if ( isset( $new_value['element_repeat'] ) ) {
3618
-											$x = 1;
3619
-											while ( $x <= absint( $new_value['element_repeat'] ) ) {
3620
-												$this->block_element( array( '' => $new_value ),$save );
3621
-												$x ++;
3622
-											}
3623
-										} else {
3624
-											$this->block_element( array( '' => $new_value ),$save );
3625
-										}
3626
-									}
3627
-									$first_item ++;
3628
-								}
3629
-							}
3617
+                                        if ( isset( $new_value['element_repeat'] ) ) {
3618
+                                            $x = 1;
3619
+                                            while ( $x <= absint( $new_value['element_repeat'] ) ) {
3620
+                                                $this->block_element( array( '' => $new_value ),$save );
3621
+                                                $x ++;
3622
+                                            }
3623
+                                        } else {
3624
+                                            $this->block_element( array( '' => $new_value ),$save );
3625
+                                        }
3626
+                                    }
3627
+                                    $first_item ++;
3628
+                                }
3629
+                            }
3630 3630
 
3631 3631
                             if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){
3632 3632
                                 echo "))";// end content
@@ -3635,517 +3635,517 @@  discard block
 block discarded – undo
3635 3635
                             }
3636 3636
 
3637 3637
 
3638
-							echo ", \n";
3638
+                            echo ", \n";
3639 3639
 
3640
-						}
3641
-					} else {
3640
+                        }
3641
+                    } else {
3642 3642
 
3643
-						if ( substr( $element, 0, 3 ) === "if_" ) {
3644
-							$extra = '';
3645
-							if( strpos($new_args, '[%WrapClass%]') !== false ){
3646
-								$new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args);
3647
-								$new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args);
3648
-							}
3649
-							echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
3650
-						} elseif ( $element == 'style' &&  strpos($new_args, '[%WrapStyle%]') !== false ) {
3643
+                        if ( substr( $element, 0, 3 ) === "if_" ) {
3644
+                            $extra = '';
3645
+                            if( strpos($new_args, '[%WrapClass%]') !== false ){
3646
+                                $new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args);
3647
+                                $new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args);
3648
+                            }
3649
+                            echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
3650
+                        } elseif ( $element == 'style' &&  strpos($new_args, '[%WrapStyle%]') !== false ) {
3651 3651
                             $new_args = str_replace('[%WrapStyle%]','',$new_args);
3652 3652
                             echo $element . ": {..." . $this->block_props_replace( $new_args ) . " , ...sd_build_aui_styles(props.attributes) },";
3653 3653
 //                            echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
3654
-						} elseif ( $element == 'style' ) {
3655
-							echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
3656
-						} elseif ( ( $element == 'class' || $element == 'className'  ) &&  strpos($new_args, '[%WrapClass%]') !== false ) {
3654
+                        } elseif ( $element == 'style' ) {
3655
+                            echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
3656
+                        } elseif ( ( $element == 'class' || $element == 'className'  ) &&  strpos($new_args, '[%WrapClass%]') !== false ) {
3657 3657
                             $new_args = str_replace('[%WrapClass%]','',$new_args);
3658 3658
                             echo $element . ": '" . $this->block_props_replace( $new_args ) . "' + sd_build_aui_class(props.attributes),";
3659
-						} elseif ( $element == 'template' && $new_args ) {
3660
-							echo $element . ": $new_args,";
3661
-						} else {
3662
-							echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
3663
-						}
3659
+                        } elseif ( $element == 'template' && $new_args ) {
3660
+                            echo $element . ": $new_args,";
3661
+                        } else {
3662
+                            echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
3663
+                        }
3664 3664
 
3665
-					}
3666
-				}
3667
-			}
3668
-		}
3665
+                    }
3666
+                }
3667
+            }
3668
+        }
3669 3669
 
3670
-		/**
3671
-		 * Replace block attributes placeholders with the proper naming.
3672
-		 *
3673
-		 * @param $string
3674
-		 *
3675
-		 * @return mixed
3676
-		 */
3677
-		public function block_props_replace( $string, $no_wrap = false ) {
3678
-
3679
-			if ( $no_wrap ) {
3680
-				$string = str_replace( array( "[%", "%]" ), array( "props.attributes.", "" ), $string );
3681
-			} else {
3682
-				$string = str_replace( array( "[%", "%]" ), array( "'+props.attributes.", "+'" ), $string );
3683
-			}
3670
+        /**
3671
+         * Replace block attributes placeholders with the proper naming.
3672
+         *
3673
+         * @param $string
3674
+         *
3675
+         * @return mixed
3676
+         */
3677
+        public function block_props_replace( $string, $no_wrap = false ) {
3684 3678
 
3685
-			return $string;
3686
-		}
3679
+            if ( $no_wrap ) {
3680
+                $string = str_replace( array( "[%", "%]" ), array( "props.attributes.", "" ), $string );
3681
+            } else {
3682
+                $string = str_replace( array( "[%", "%]" ), array( "'+props.attributes.", "+'" ), $string );
3683
+            }
3687 3684
 
3688
-		/**
3689
-		 * Outputs the content of the widget
3690
-		 *
3691
-		 * @param array $args
3692
-		 * @param array $instance
3693
-		 */
3694
-		public function widget( $args, $instance ) {
3695
-
3696
-			// get the filtered values
3697
-			$argument_values = $this->argument_values( $instance );
3698
-			$argument_values = $this->string_to_bool( $argument_values );
3699
-			$output          = $this->output( $argument_values, $args );
3700
-
3701
-			$no_wrap = false;
3702
-			if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
3703
-				$no_wrap = true;
3704
-			}
3685
+            return $string;
3686
+        }
3705 3687
 
3706
-			ob_start();
3707
-			if ( $output && ! $no_wrap ) {
3688
+        /**
3689
+         * Outputs the content of the widget
3690
+         *
3691
+         * @param array $args
3692
+         * @param array $instance
3693
+         */
3694
+        public function widget( $args, $instance ) {
3708 3695
 
3709
-				$class_original = $this->options['widget_ops']['classname'];
3710
-				$class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
3696
+            // get the filtered values
3697
+            $argument_values = $this->argument_values( $instance );
3698
+            $argument_values = $this->string_to_bool( $argument_values );
3699
+            $output          = $this->output( $argument_values, $args );
3711 3700
 
3712
-				// Before widget
3713
-				$before_widget = $args['before_widget'];
3714
-				$before_widget = str_replace($class_original,$class,$before_widget);
3715
-				$before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
3716
-				$before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
3701
+            $no_wrap = false;
3702
+            if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
3703
+                $no_wrap = true;
3704
+            }
3717 3705
 
3718
-				// After widget
3719
-				$after_widget = $args['after_widget'];
3720
-				$after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
3721
-				$after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
3706
+            ob_start();
3707
+            if ( $output && ! $no_wrap ) {
3722 3708
 
3723
-				echo $before_widget;
3724
-				// elementor strips the widget wrapping div so we check for and add it back if needed
3725
-				if ( $this->is_elementor_widget_output() ) {
3726
-					// Filter class & attrs for elementor widget output.
3727
-					$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
3728
-					$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
3709
+                $class_original = $this->options['widget_ops']['classname'];
3710
+                $class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
3729 3711
 
3730
-					$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
3731
-					$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
3712
+                // Before widget
3713
+                $before_widget = $args['before_widget'];
3714
+                $before_widget = str_replace($class_original,$class,$before_widget);
3715
+                $before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
3716
+                $before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
3732 3717
 
3733
-					echo "<span class='" . esc_attr( $class  ) . "' " . $attrs . ">";
3734
-				}
3735
-				echo $this->output_title( $args, $instance );
3736
-				echo $output;
3737
-				if ( $this->is_elementor_widget_output() ) {
3738
-					echo "</span>";
3739
-				}
3740
-				echo $after_widget;
3741
-			} elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
3742
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
3743
-				echo $output;
3744
-			} elseif ( $output && $no_wrap ) {
3745
-				echo $output;
3746
-			}
3747
-			$output = ob_get_clean();
3718
+                // After widget
3719
+                $after_widget = $args['after_widget'];
3720
+                $after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
3721
+                $after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
3748 3722
 
3749
-			$output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
3723
+                echo $before_widget;
3724
+                // elementor strips the widget wrapping div so we check for and add it back if needed
3725
+                if ( $this->is_elementor_widget_output() ) {
3726
+                    // Filter class & attrs for elementor widget output.
3727
+                    $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
3728
+                    $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
3750 3729
 
3751
-			echo $output;
3752
-		}
3730
+                    $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
3731
+                    $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
3753 3732
 
3754
-		/**
3755
-		 * Tests if the current output is inside a elementor container.
3756
-		 *
3757
-		 * @return bool
3758
-		 *@since 1.0.4
3759
-		 */
3760
-		public function is_elementor_widget_output() {
3761
-			$result = false;
3762
-			if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
3763
-				$result = true;
3764
-			}
3733
+                    echo "<span class='" . esc_attr( $class  ) . "' " . $attrs . ">";
3734
+                }
3735
+                echo $this->output_title( $args, $instance );
3736
+                echo $output;
3737
+                if ( $this->is_elementor_widget_output() ) {
3738
+                    echo "</span>";
3739
+                }
3740
+                echo $after_widget;
3741
+            } elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
3742
+                $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
3743
+                echo $output;
3744
+            } elseif ( $output && $no_wrap ) {
3745
+                echo $output;
3746
+            }
3747
+            $output = ob_get_clean();
3765 3748
 
3766
-			return $result;
3767
-		}
3749
+            $output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
3768 3750
 
3769
-		/**
3770
-		 * Tests if the current output is inside a elementor preview.
3771
-		 *
3772
-		 * @return bool
3773
-		 *@since 1.0.4
3774
-		 */
3775
-		public function is_elementor_preview() {
3776
-			$result = false;
3777
-			if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
3778
-				$result = true;
3779
-			}
3751
+            echo $output;
3752
+        }
3780 3753
 
3781
-			return $result;
3782
-		}
3754
+        /**
3755
+         * Tests if the current output is inside a elementor container.
3756
+         *
3757
+         * @return bool
3758
+         *@since 1.0.4
3759
+         */
3760
+        public function is_elementor_widget_output() {
3761
+            $result = false;
3762
+            if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
3763
+                $result = true;
3764
+            }
3783 3765
 
3784
-		/**
3785
-		 * Tests if the current output is inside a Divi preview.
3786
-		 *
3787
-		 * @return bool
3788
-		 *@since 1.0.6
3789
-		 */
3790
-		public function is_divi_preview() {
3791
-			$result = false;
3792
-			if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
3793
-				$result = true;
3794
-			}
3766
+            return $result;
3767
+        }
3795 3768
 
3796
-			return $result;
3797
-		}
3769
+        /**
3770
+         * Tests if the current output is inside a elementor preview.
3771
+         *
3772
+         * @return bool
3773
+         *@since 1.0.4
3774
+         */
3775
+        public function is_elementor_preview() {
3776
+            $result = false;
3777
+            if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
3778
+                $result = true;
3779
+            }
3798 3780
 
3799
-		/**
3800
-		 * Tests if the current output is inside a Beaver builder preview.
3801
-		 *
3802
-		 * @return bool
3803
-		 *@since 1.0.6
3804
-		 */
3805
-		public function is_beaver_preview() {
3806
-			$result = false;
3807
-			if ( isset( $_REQUEST['fl_builder'] ) ) {
3808
-				$result = true;
3809
-			}
3781
+            return $result;
3782
+        }
3810 3783
 
3811
-			return $result;
3812
-		}
3784
+        /**
3785
+         * Tests if the current output is inside a Divi preview.
3786
+         *
3787
+         * @return bool
3788
+         *@since 1.0.6
3789
+         */
3790
+        public function is_divi_preview() {
3791
+            $result = false;
3792
+            if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
3793
+                $result = true;
3794
+            }
3813 3795
 
3814
-		/**
3815
-		 * Tests if the current output is inside a siteorigin builder preview.
3816
-		 *
3817
-		 * @return bool
3818
-		 *@since 1.0.6
3819
-		 */
3820
-		public function is_siteorigin_preview() {
3821
-			$result = false;
3822
-			if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
3823
-				$result = true;
3824
-			}
3796
+            return $result;
3797
+        }
3825 3798
 
3826
-			return $result;
3827
-		}
3799
+        /**
3800
+         * Tests if the current output is inside a Beaver builder preview.
3801
+         *
3802
+         * @return bool
3803
+         *@since 1.0.6
3804
+         */
3805
+        public function is_beaver_preview() {
3806
+            $result = false;
3807
+            if ( isset( $_REQUEST['fl_builder'] ) ) {
3808
+                $result = true;
3809
+            }
3828 3810
 
3829
-		/**
3830
-		 * Tests if the current output is inside a cornerstone builder preview.
3831
-		 *
3832
-		 * @return bool
3833
-		 *@since 1.0.8
3834
-		 */
3835
-		public function is_cornerstone_preview() {
3836
-			$result = false;
3837
-			if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
3838
-				$result = true;
3839
-			}
3811
+            return $result;
3812
+        }
3840 3813
 
3841
-			return $result;
3842
-		}
3814
+        /**
3815
+         * Tests if the current output is inside a siteorigin builder preview.
3816
+         *
3817
+         * @return bool
3818
+         *@since 1.0.6
3819
+         */
3820
+        public function is_siteorigin_preview() {
3821
+            $result = false;
3822
+            if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
3823
+                $result = true;
3824
+            }
3843 3825
 
3844
-		/**
3845
-		 * Tests if the current output is inside a fusion builder preview.
3846
-		 *
3847
-		 * @return bool
3848
-		 *@since 1.1.0
3849
-		 */
3850
-		public function is_fusion_preview() {
3851
-			$result = false;
3852
-			if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
3853
-				$result = true;
3854
-			}
3826
+            return $result;
3827
+        }
3855 3828
 
3856
-			return $result;
3857
-		}
3829
+        /**
3830
+         * Tests if the current output is inside a cornerstone builder preview.
3831
+         *
3832
+         * @return bool
3833
+         *@since 1.0.8
3834
+         */
3835
+        public function is_cornerstone_preview() {
3836
+            $result = false;
3837
+            if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
3838
+                $result = true;
3839
+            }
3858 3840
 
3859
-		/**
3860
-		 * Tests if the current output is inside a Oxygen builder preview.
3861
-		 *
3862
-		 * @return bool
3863
-		 *@since 1.0.18
3864
-		 */
3865
-		public function is_oxygen_preview() {
3866
-			$result = false;
3867
-			if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
3868
-				$result = true;
3869
-			}
3841
+            return $result;
3842
+        }
3870 3843
 
3871
-			return $result;
3872
-		}
3844
+        /**
3845
+         * Tests if the current output is inside a fusion builder preview.
3846
+         *
3847
+         * @return bool
3848
+         *@since 1.1.0
3849
+         */
3850
+        public function is_fusion_preview() {
3851
+            $result = false;
3852
+            if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
3853
+                $result = true;
3854
+            }
3873 3855
 
3874
-		/**
3875
-		 * General function to check if we are in a preview situation.
3876
-		 *
3877
-		 * @return bool
3878
-		 *@since 1.0.6
3879
-		 */
3880
-		public function is_preview() {
3881
-			$preview = false;
3882
-			if ( $this->is_divi_preview() ) {
3883
-				$preview = true;
3884
-			} elseif ( $this->is_elementor_preview() ) {
3885
-				$preview = true;
3886
-			} elseif ( $this->is_beaver_preview() ) {
3887
-				$preview = true;
3888
-			} elseif ( $this->is_siteorigin_preview() ) {
3889
-				$preview = true;
3890
-			} elseif ( $this->is_cornerstone_preview() ) {
3891
-				$preview = true;
3892
-			} elseif ( $this->is_fusion_preview() ) {
3893
-				$preview = true;
3894
-			} elseif ( $this->is_oxygen_preview() ) {
3895
-				$preview = true;
3896
-			} elseif( $this->is_block_content_call() ) {
3897
-				$preview = true;
3898
-			}
3856
+            return $result;
3857
+        }
3899 3858
 
3900
-			return $preview;
3901
-		}
3859
+        /**
3860
+         * Tests if the current output is inside a Oxygen builder preview.
3861
+         *
3862
+         * @return bool
3863
+         *@since 1.0.18
3864
+         */
3865
+        public function is_oxygen_preview() {
3866
+            $result = false;
3867
+            if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
3868
+                $result = true;
3869
+            }
3902 3870
 
3903
-		/**
3904
-		 * Output the super title.
3905
-		 *
3906
-		 * @param $args
3907
-		 * @param array $instance
3908
-		 *
3909
-		 * @return string
3910
-		 */
3911
-		public function output_title( $args, $instance = array() ) {
3912
-			$output = '';
3913
-			if ( ! empty( $instance['title'] ) ) {
3914
-				/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
3915
-				$title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
3916
-
3917
-				if(empty($instance['widget_title_tag'])){
3918
-					$output = $args['before_title'] . $title . $args['after_title'];
3919
-				}else{
3920
-					$title_tag = esc_attr( $instance['widget_title_tag'] );
3921
-
3922
-					// classes
3923
-					$title_classes = array();
3924
-					$title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
3925
-					$title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
3926
-					$title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
3927
-					$title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
3928
-					$title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
3929
-					$title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
3930
-					$title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
3931
-					$title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
3932
-					$title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
3933
-					$title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
3934
-					$title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
3935
-					$title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
3936
-					$title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
3937
-
3938
-					$class = !empty( $title_classes ) ? implode(" ",$title_classes) : '';
3939
-					$output = "<$title_tag class='$class' >$title</$title_tag>";
3940
-				}
3871
+            return $result;
3872
+        }
3941 3873
 
3942
-			}
3874
+        /**
3875
+         * General function to check if we are in a preview situation.
3876
+         *
3877
+         * @return bool
3878
+         *@since 1.0.6
3879
+         */
3880
+        public function is_preview() {
3881
+            $preview = false;
3882
+            if ( $this->is_divi_preview() ) {
3883
+                $preview = true;
3884
+            } elseif ( $this->is_elementor_preview() ) {
3885
+                $preview = true;
3886
+            } elseif ( $this->is_beaver_preview() ) {
3887
+                $preview = true;
3888
+            } elseif ( $this->is_siteorigin_preview() ) {
3889
+                $preview = true;
3890
+            } elseif ( $this->is_cornerstone_preview() ) {
3891
+                $preview = true;
3892
+            } elseif ( $this->is_fusion_preview() ) {
3893
+                $preview = true;
3894
+            } elseif ( $this->is_oxygen_preview() ) {
3895
+                $preview = true;
3896
+            } elseif( $this->is_block_content_call() ) {
3897
+                $preview = true;
3898
+            }
3943 3899
 
3944
-			return $output;
3945
-		}
3900
+            return $preview;
3901
+        }
3902
+
3903
+        /**
3904
+         * Output the super title.
3905
+         *
3906
+         * @param $args
3907
+         * @param array $instance
3908
+         *
3909
+         * @return string
3910
+         */
3911
+        public function output_title( $args, $instance = array() ) {
3912
+            $output = '';
3913
+            if ( ! empty( $instance['title'] ) ) {
3914
+                /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
3915
+                $title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
3916
+
3917
+                if(empty($instance['widget_title_tag'])){
3918
+                    $output = $args['before_title'] . $title . $args['after_title'];
3919
+                }else{
3920
+                    $title_tag = esc_attr( $instance['widget_title_tag'] );
3921
+
3922
+                    // classes
3923
+                    $title_classes = array();
3924
+                    $title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
3925
+                    $title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
3926
+                    $title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
3927
+                    $title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
3928
+                    $title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
3929
+                    $title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
3930
+                    $title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
3931
+                    $title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
3932
+                    $title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
3933
+                    $title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
3934
+                    $title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
3935
+                    $title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
3936
+                    $title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
3937
+
3938
+                    $class = !empty( $title_classes ) ? implode(" ",$title_classes) : '';
3939
+                    $output = "<$title_tag class='$class' >$title</$title_tag>";
3940
+                }
3941
+
3942
+            }
3946 3943
 
3947
-		/**
3948
-		 * Outputs the options form inputs for the widget.
3949
-		 *
3950
-		 * @param array $instance The widget options.
3951
-		 */
3952
-		public function form( $instance ) {
3944
+            return $output;
3945
+        }
3946
+
3947
+        /**
3948
+         * Outputs the options form inputs for the widget.
3949
+         *
3950
+         * @param array $instance The widget options.
3951
+         */
3952
+        public function form( $instance ) {
3953 3953
 
3954
-			// set widget instance
3955
-			$this->instance = $instance;
3954
+            // set widget instance
3955
+            $this->instance = $instance;
3956 3956
 
3957
-			// set it as a SD widget
3958
-			echo $this->widget_advanced_toggle();
3957
+            // set it as a SD widget
3958
+            echo $this->widget_advanced_toggle();
3959 3959
 
3960
-			echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
3961
-			$arguments_raw = $this->get_arguments();
3960
+            echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
3961
+            $arguments_raw = $this->get_arguments();
3962 3962
 
3963
-			if ( is_array( $arguments_raw ) ) {
3963
+            if ( is_array( $arguments_raw ) ) {
3964 3964
 
3965
-				$arguments = $this->group_arguments( $arguments_raw );
3965
+                $arguments = $this->group_arguments( $arguments_raw );
3966 3966
 
3967
-				// Do we have sections?
3968
-				$has_sections = $arguments == $arguments_raw ? false : true;
3967
+                // Do we have sections?
3968
+                $has_sections = $arguments == $arguments_raw ? false : true;
3969 3969
 
3970 3970
 
3971
-				if ( $has_sections ) {
3972
-					$panel_count = 0;
3973
-					foreach ( $arguments as $key => $args ) {
3971
+                if ( $has_sections ) {
3972
+                    $panel_count = 0;
3973
+                    foreach ( $arguments as $key => $args ) {
3974 3974
 
3975
-						?>
3975
+                        ?>
3976 3976
 						<script>
3977 3977
 							//							jQuery(this).find("i").toggleClass("fas fa-chevron-up fas fa-chevron-down");jQuery(this).next().toggle();
3978 3978
 						</script>
3979 3979
 						<?php
3980 3980
 
3981
-						$hide       = $panel_count ? ' style="display:none;" ' : '';
3982
-						$icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
3983
-						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>";
3984
-						echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
3981
+                        $hide       = $panel_count ? ' style="display:none;" ' : '';
3982
+                        $icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
3983
+                        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>";
3984
+                        echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
3985 3985
 
3986
-						foreach ( $args as $k => $a ) {
3986
+                        foreach ( $args as $k => $a ) {
3987 3987
 
3988
-							$this->widget_inputs_row_start($k, $a);
3989
-							$this->widget_inputs( $a, $instance );
3990
-							$this->widget_inputs_row_end($k, $a);
3988
+                            $this->widget_inputs_row_start($k, $a);
3989
+                            $this->widget_inputs( $a, $instance );
3990
+                            $this->widget_inputs_row_end($k, $a);
3991 3991
 
3992
-						}
3992
+                        }
3993 3993
 
3994
-						echo "</div>";
3994
+                        echo "</div>";
3995 3995
 
3996
-						$panel_count ++;
3996
+                        $panel_count ++;
3997 3997
 
3998
-					}
3999
-				} else {
4000
-					foreach ( $arguments as $key => $args ) {
4001
-						$this->widget_inputs_row_start($key, $args);
4002
-						$this->widget_inputs( $args, $instance );
4003
-						$this->widget_inputs_row_end($key, $args);
4004
-					}
4005
-				}
3998
+                    }
3999
+                } else {
4000
+                    foreach ( $arguments as $key => $args ) {
4001
+                        $this->widget_inputs_row_start($key, $args);
4002
+                        $this->widget_inputs( $args, $instance );
4003
+                        $this->widget_inputs_row_end($key, $args);
4004
+                    }
4005
+                }
4006 4006
 
4007
-			}
4008
-		}
4007
+            }
4008
+        }
4009 4009
 
4010
-		public function widget_inputs_row_start($key, $args){
4011
-			if(!empty($args['row'])){
4012
-				// maybe open
4013
-				if(!empty($args['row']['open'])){
4014
-					?>
4010
+        public function widget_inputs_row_start($key, $args){
4011
+            if(!empty($args['row'])){
4012
+                // maybe open
4013
+                if(!empty($args['row']['open'])){
4014
+                    ?>
4015 4015
 					<div class='bsui sd-argument ' data-argument='<?php echo esc_attr( $args['row']['key'] ); ?>' data-element_require='<?php if ( !empty($args['row']['element_require'])) {
4016
-						echo $this->convert_element_require( $args['row']['element_require'] );
4017
-					} ?>'>
4016
+                        echo $this->convert_element_require( $args['row']['element_require'] );
4017
+                    } ?>'>
4018 4018
 					<?php if(!empty($args['row']['title'])){ ?>
4019 4019
 					<label class="mb-0 "><?php echo esc_attr( $args['row']['title'] ); ?><?php echo $this->widget_field_desc( $args['row'] ); ?></label>
4020 4020
 					<?php }?>
4021 4021
 					<div class='row <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>'>
4022 4022
 					<div class='col pr-2'>
4023 4023
 					<?php
4024
-				}elseif(!empty($args['row']['close'])){
4025
-					echo "<div class='col pl-0'>";
4026
-				}else{
4027
-					echo "<div class='col pl-0 pr-2'>";
4028
-				}
4029
-			}
4030
-		}
4024
+                }elseif(!empty($args['row']['close'])){
4025
+                    echo "<div class='col pl-0'>";
4026
+                }else{
4027
+                    echo "<div class='col pl-0 pr-2'>";
4028
+                }
4029
+            }
4030
+        }
4031 4031
 
4032
-		public function widget_inputs_row_end($key, $args){
4032
+        public function widget_inputs_row_end($key, $args){
4033 4033
 
4034
-			if(!empty($args['row'])){
4035
-				// maybe close
4036
-				if(!empty($args['row']['close'])){
4037
-					echo "</div></div>";
4038
-				}
4034
+            if(!empty($args['row'])){
4035
+                // maybe close
4036
+                if(!empty($args['row']['close'])){
4037
+                    echo "</div></div>";
4038
+                }
4039 4039
 
4040
-				echo "</div>";
4041
-			}
4042
-		}
4040
+                echo "</div>";
4041
+            }
4042
+        }
4043 4043
 
4044
-		/**
4045
-		 * Get the hidden input that when added makes the advanced button show on widget settings.
4046
-		 *
4047
-		 * @return string
4048
-		 */
4049
-		public function widget_advanced_toggle() {
4050
-
4051
-			$output = '';
4052
-			if ( $this->block_show_advanced() ) {
4053
-				$val = 1;
4054
-			} else {
4055
-				$val = 0;
4056
-			}
4044
+        /**
4045
+         * Get the hidden input that when added makes the advanced button show on widget settings.
4046
+         *
4047
+         * @return string
4048
+         */
4049
+        public function widget_advanced_toggle() {
4057 4050
 
4058
-			$output .= "<input type='hidden'  class='sd-show-advanced' value='$val' />";
4051
+            $output = '';
4052
+            if ( $this->block_show_advanced() ) {
4053
+                $val = 1;
4054
+            } else {
4055
+                $val = 0;
4056
+            }
4059 4057
 
4060
-			return $output;
4061
-		}
4058
+            $output .= "<input type='hidden'  class='sd-show-advanced' value='$val' />";
4062 4059
 
4063
-		/**
4064
-		 * Convert require element.
4065
-		 *
4066
-		 * @param string $input Input element.
4067
-		 *
4068
-		 * @return string $output
4069
-		 *@since 1.0.0
4070
-		 *
4071
-		 */
4072
-		public function convert_element_require( $input ) {
4073
-
4074
-			$input = str_replace( "'", '"', $input );// we only want double quotes
4075
-
4076
-			$output = esc_attr( str_replace( array( "[%", "%]" ), array(
4077
-				"jQuery(form).find('[data-argument=\"",
4078
-				"\"]').find('input,select,textarea').val()"
4079
-			), $input ) );
4080
-
4081
-			return $output;
4082
-		}
4060
+            return $output;
4061
+        }
4083 4062
 
4084
-		/**
4085
-		 * Builds the inputs for the widget options.
4086
-		 *
4087
-		 * @param $args
4088
-		 * @param $instance
4089
-		 */
4090
-		public function widget_inputs( $args, $instance ) {
4091
-
4092
-			$class             = "";
4093
-			$element_require   = "";
4094
-			$custom_attributes = "";
4095
-
4096
-			// get value
4097
-			if ( isset( $instance[ $args['name'] ] ) ) {
4098
-				$value = $instance[ $args['name'] ];
4099
-			} elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
4100
-				$value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
4101
-			} else {
4102
-				$value = '';
4103
-			}
4063
+        /**
4064
+         * Convert require element.
4065
+         *
4066
+         * @param string $input Input element.
4067
+         *
4068
+         * @return string $output
4069
+         *@since 1.0.0
4070
+         *
4071
+         */
4072
+        public function convert_element_require( $input ) {
4104 4073
 
4105
-			// get placeholder
4106
-			if ( ! empty( $args['placeholder'] ) ) {
4107
-				$placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
4108
-			} else {
4109
-				$placeholder = '';
4110
-			}
4074
+            $input = str_replace( "'", '"', $input );// we only want double quotes
4111 4075
 
4112
-			// get if advanced
4113
-			if ( isset( $args['advanced'] ) && $args['advanced'] ) {
4114
-				$class .= " sd-advanced-setting ";
4115
-			}
4076
+            $output = esc_attr( str_replace( array( "[%", "%]" ), array(
4077
+                "jQuery(form).find('[data-argument=\"",
4078
+                "\"]').find('input,select,textarea').val()"
4079
+            ), $input ) );
4116 4080
 
4117
-			// element_require
4118
-			if ( isset( $args['element_require'] ) && $args['element_require'] ) {
4119
-				$element_require = $args['element_require'];
4120
-			}
4081
+            return $output;
4082
+        }
4121 4083
 
4122
-			// custom_attributes
4123
-			if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
4124
-				$custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
4125
-			}
4084
+        /**
4085
+         * Builds the inputs for the widget options.
4086
+         *
4087
+         * @param $args
4088
+         * @param $instance
4089
+         */
4090
+        public function widget_inputs( $args, $instance ) {
4091
+
4092
+            $class             = "";
4093
+            $element_require   = "";
4094
+            $custom_attributes = "";
4095
+
4096
+            // get value
4097
+            if ( isset( $instance[ $args['name'] ] ) ) {
4098
+                $value = $instance[ $args['name'] ];
4099
+            } elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
4100
+                $value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
4101
+            } else {
4102
+                $value = '';
4103
+            }
4104
+
4105
+            // get placeholder
4106
+            if ( ! empty( $args['placeholder'] ) ) {
4107
+                $placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
4108
+            } else {
4109
+                $placeholder = '';
4110
+            }
4126 4111
 
4112
+            // get if advanced
4113
+            if ( isset( $args['advanced'] ) && $args['advanced'] ) {
4114
+                $class .= " sd-advanced-setting ";
4115
+            }
4127 4116
 
4128
-			// before wrapper
4129
-			?>
4117
+            // element_require
4118
+            if ( isset( $args['element_require'] ) && $args['element_require'] ) {
4119
+                $element_require = $args['element_require'];
4120
+            }
4121
+
4122
+            // custom_attributes
4123
+            if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
4124
+                $custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
4125
+            }
4126
+
4127
+
4128
+            // before wrapper
4129
+            ?>
4130 4130
 			<p class="sd-argument <?php echo esc_attr( $class ); ?>"
4131 4131
 			data-argument='<?php echo esc_attr( $args['name'] ); ?>'
4132 4132
 			data-element_require='<?php if ( $element_require ) {
4133
-				echo $this->convert_element_require( $element_require );
4134
-			} ?>'
4133
+                echo $this->convert_element_require( $element_require );
4134
+            } ?>'
4135 4135
 			>
4136 4136
 			<?php
4137 4137
 
4138 4138
 
4139
-			switch ( $args['type'] ) {
4140
-				//array('text','password','number','email','tel','url','color')
4141
-				case "text":
4142
-				case "password":
4143
-				case "number":
4144
-				case "email":
4145
-				case "tel":
4146
-				case "url":
4147
-				case "color":
4148
-					?>
4139
+            switch ( $args['type'] ) {
4140
+                //array('text','password','number','email','tel','url','color')
4141
+                case "text":
4142
+                case "password":
4143
+                case "number":
4144
+                case "email":
4145
+                case "tel":
4146
+                case "url":
4147
+                case "color":
4148
+                    ?>
4149 4149
 					<label
4150 4150
 						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>
4151 4151
 					<input <?php echo $placeholder; ?> class="widefat"
@@ -4156,47 +4156,47 @@  discard block
 block discarded – undo
4156 4156
 						                               value="<?php echo esc_attr( $value ); ?>">
4157 4157
 					<?php
4158 4158
 
4159
-					break;
4160
-				case "select":
4161
-					$multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
4162
-					if ( $multiple ) {
4163
-						if ( empty( $value ) ) {
4164
-							$value = array();
4165
-						}
4166
-					}
4167
-					?>
4159
+                    break;
4160
+                case "select":
4161
+                    $multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
4162
+                    if ( $multiple ) {
4163
+                        if ( empty( $value ) ) {
4164
+                            $value = array();
4165
+                        }
4166
+                    }
4167
+                    ?>
4168 4168
 					<label
4169 4169
 						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>
4170 4170
 					<select <?php echo $placeholder; ?> class="widefat"
4171 4171
 						<?php echo $custom_attributes; ?>
4172 4172
 						                                id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
4173 4173
 						                                name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) );
4174
-						                                if ( $multiple ) {
4175
-							                                echo "[]";
4176
-						                                } ?>"
4174
+                                                        if ( $multiple ) {
4175
+                                                            echo "[]";
4176
+                                                        } ?>"
4177 4177
 						<?php if ( $multiple ) {
4178
-							echo "multiple";
4179
-						} //@todo not implemented yet due to gutenberg not supporting it
4180
-						?>
4178
+                            echo "multiple";
4179
+                        } //@todo not implemented yet due to gutenberg not supporting it
4180
+                        ?>
4181 4181
 					>
4182 4182
 						<?php
4183 4183
 
4184
-						if ( ! empty( $args['options'] ) ) {
4185
-							foreach ( $args['options'] as $val => $label ) {
4186
-								if ( $multiple ) {
4187
-									$selected = in_array( $val, $value ) ? 'selected="selected"' : '';
4188
-								} else {
4189
-									$selected = selected( $value, $val, false );
4190
-								}
4191
-								echo "<option value='$val' " . $selected . ">$label</option>";
4192
-							}
4193
-						}
4194
-						?>
4184
+                        if ( ! empty( $args['options'] ) ) {
4185
+                            foreach ( $args['options'] as $val => $label ) {
4186
+                                if ( $multiple ) {
4187
+                                    $selected = in_array( $val, $value ) ? 'selected="selected"' : '';
4188
+                                } else {
4189
+                                    $selected = selected( $value, $val, false );
4190
+                                }
4191
+                                echo "<option value='$val' " . $selected . ">$label</option>";
4192
+                            }
4193
+                        }
4194
+                        ?>
4195 4195
 					</select>
4196 4196
 					<?php
4197
-					break;
4198
-				case "checkbox":
4199
-					?>
4197
+                    break;
4198
+                case "checkbox":
4199
+                    ?>
4200 4200
 					<input <?php echo $placeholder; ?>
4201 4201
 						<?php checked( 1, $value, true ) ?>
4202 4202
 						<?php echo $custom_attributes; ?>
@@ -4206,9 +4206,9 @@  discard block
 block discarded – undo
4206 4206
 					<label
4207 4207
 						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>
4208 4208
 					<?php
4209
-					break;
4210
-				case "textarea":
4211
-					?>
4209
+                    break;
4210
+                case "textarea":
4211
+                    ?>
4212 4212
 					<label
4213 4213
 						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>
4214 4214
 					<textarea <?php echo $placeholder; ?> class="widefat"
@@ -4218,282 +4218,282 @@  discard block
 block discarded – undo
4218 4218
 					><?php echo esc_attr( $value ); ?></textarea>
4219 4219
 					<?php
4220 4220
 
4221
-					break;
4222
-				case "hidden":
4223
-					?>
4221
+                    break;
4222
+                case "hidden":
4223
+                    ?>
4224 4224
 					<input id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
4225 4225
 					       name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="hidden"
4226 4226
 					       value="<?php echo esc_attr( $value ); ?>">
4227 4227
 					<?php
4228
-					break;
4229
-				default:
4230
-					echo "No input type found!"; // @todo we need to add more input types.
4231
-			}
4228
+                    break;
4229
+                default:
4230
+                    echo "No input type found!"; // @todo we need to add more input types.
4231
+            }
4232 4232
 
4233
-			// after wrapper
4234
-			?>
4233
+            // after wrapper
4234
+            ?>
4235 4235
 			</p>
4236 4236
 			<?php
4237 4237
 
4238 4238
 
4239
-		}
4239
+        }
4240 4240
 
4241
-		public function get_widget_icon($icon = 'box-top', $title = ''){
4242
-			if($icon=='box-top'){
4243
-				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>';
4244
-			}elseif($icon=='box-right'){
4245
-				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>';
4246
-			}elseif($icon=='box-bottom'){
4247
-				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>';
4248
-			}elseif($icon=='box-left'){
4249
-				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>';
4250
-			}
4251
-		}
4241
+        public function get_widget_icon($icon = 'box-top', $title = ''){
4242
+            if($icon=='box-top'){
4243
+                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>';
4244
+            }elseif($icon=='box-right'){
4245
+                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>';
4246
+            }elseif($icon=='box-bottom'){
4247
+                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>';
4248
+            }elseif($icon=='box-left'){
4249
+                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>';
4250
+            }
4251
+        }
4252 4252
 
4253
-		/**
4254
-		 * Get the widget input description html.
4255
-		 *
4256
-		 * @param $args
4257
-		 *
4258
-		 * @return string
4259
-		 * @todo, need to make its own tooltip script
4260
-		 */
4261
-		public function widget_field_desc( $args ) {
4262
-
4263
-			$description = '';
4264
-			if ( isset( $args['desc'] ) && $args['desc'] ) {
4265
-				if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
4266
-					$description = $this->desc_tip( $args['desc'] );
4267
-				} else {
4268
-					$description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
4269
-				}
4270
-			}
4253
+        /**
4254
+         * Get the widget input description html.
4255
+         *
4256
+         * @param $args
4257
+         *
4258
+         * @return string
4259
+         * @todo, need to make its own tooltip script
4260
+         */
4261
+        public function widget_field_desc( $args ) {
4262
+
4263
+            $description = '';
4264
+            if ( isset( $args['desc'] ) && $args['desc'] ) {
4265
+                if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
4266
+                    $description = $this->desc_tip( $args['desc'] );
4267
+                } else {
4268
+                    $description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
4269
+                }
4270
+            }
4271 4271
 
4272
-			return $description;
4273
-		}
4272
+            return $description;
4273
+        }
4274 4274
 
4275
-		/**
4276
-		 * Get the widget input title html.
4277
-		 *
4278
-		 * @param $args
4279
-		 *
4280
-		 * @return string
4281
-		 */
4282
-		public function widget_field_title( $args ) {
4283
-
4284
-			$title = '';
4285
-			if ( isset( $args['title'] ) && $args['title'] ) {
4286
-				if ( isset( $args['icon'] ) && $args['icon'] ) {
4287
-					$title = self::get_widget_icon( $args['icon'], $args['title']  );
4288
-				} else {
4289
-					$title = esc_attr($args['title']);
4290
-				}
4291
-			}
4275
+        /**
4276
+         * Get the widget input title html.
4277
+         *
4278
+         * @param $args
4279
+         *
4280
+         * @return string
4281
+         */
4282
+        public function widget_field_title( $args ) {
4283
+
4284
+            $title = '';
4285
+            if ( isset( $args['title'] ) && $args['title'] ) {
4286
+                if ( isset( $args['icon'] ) && $args['icon'] ) {
4287
+                    $title = self::get_widget_icon( $args['icon'], $args['title']  );
4288
+                } else {
4289
+                    $title = esc_attr($args['title']);
4290
+                }
4291
+            }
4292 4292
 
4293
-			return $title;
4294
-		}
4293
+            return $title;
4294
+        }
4295 4295
 
4296
-		/**
4297
-		 * Get the tool tip html.
4298
-		 *
4299
-		 * @param $tip
4300
-		 * @param bool $allow_html
4301
-		 *
4302
-		 * @return string
4303
-		 */
4304
-		function desc_tip( $tip, $allow_html = false ) {
4305
-			if ( $allow_html ) {
4306
-				$tip = $this->sanitize_tooltip( $tip );
4307
-			} else {
4308
-				$tip = esc_attr( $tip );
4309
-			}
4296
+        /**
4297
+         * Get the tool tip html.
4298
+         *
4299
+         * @param $tip
4300
+         * @param bool $allow_html
4301
+         *
4302
+         * @return string
4303
+         */
4304
+        function desc_tip( $tip, $allow_html = false ) {
4305
+            if ( $allow_html ) {
4306
+                $tip = $this->sanitize_tooltip( $tip );
4307
+            } else {
4308
+                $tip = esc_attr( $tip );
4309
+            }
4310 4310
 
4311
-			return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
4312
-		}
4311
+            return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
4312
+        }
4313 4313
 
4314
-		/**
4315
-		 * Sanitize a string destined to be a tooltip.
4316
-		 *
4317
-		 * @param string $var
4318
-		 *
4319
-		 * @return string
4320
-		 */
4321
-		public function sanitize_tooltip( $var ) {
4322
-			return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
4323
-				'br'     => array(),
4324
-				'em'     => array(),
4325
-				'strong' => array(),
4326
-				'small'  => array(),
4327
-				'span'   => array(),
4328
-				'ul'     => array(),
4329
-				'li'     => array(),
4330
-				'ol'     => array(),
4331
-				'p'      => array(),
4332
-			) ) );
4333
-		}
4314
+        /**
4315
+         * Sanitize a string destined to be a tooltip.
4316
+         *
4317
+         * @param string $var
4318
+         *
4319
+         * @return string
4320
+         */
4321
+        public function sanitize_tooltip( $var ) {
4322
+            return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
4323
+                'br'     => array(),
4324
+                'em'     => array(),
4325
+                'strong' => array(),
4326
+                'small'  => array(),
4327
+                'span'   => array(),
4328
+                'ul'     => array(),
4329
+                'li'     => array(),
4330
+                'ol'     => array(),
4331
+                'p'      => array(),
4332
+            ) ) );
4333
+        }
4334 4334
 
4335
-		/**
4336
-		 * Processing widget options on save
4337
-		 *
4338
-		 * @param array $new_instance The new options
4339
-		 * @param array $old_instance The previous options
4340
-		 *
4341
-		 * @return array
4342
-		 * @todo we should add some sanitation here.
4343
-		 */
4344
-		public function update( $new_instance, $old_instance ) {
4345
-
4346
-			//save the widget
4347
-			$instance = array_merge( (array) $old_instance, (array) $new_instance );
4348
-
4349
-			// set widget instance
4350
-			$this->instance = $instance;
4351
-
4352
-			if ( empty( $this->arguments ) ) {
4353
-				$this->get_arguments();
4354
-			}
4335
+        /**
4336
+         * Processing widget options on save
4337
+         *
4338
+         * @param array $new_instance The new options
4339
+         * @param array $old_instance The previous options
4340
+         *
4341
+         * @return array
4342
+         * @todo we should add some sanitation here.
4343
+         */
4344
+        public function update( $new_instance, $old_instance ) {
4355 4345
 
4356
-			// check for checkboxes
4357
-			if ( ! empty( $this->arguments ) ) {
4358
-				foreach ( $this->arguments as $argument ) {
4359
-					if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
4360
-						$instance[ $argument['name'] ] = '0';
4361
-					}
4362
-				}
4363
-			}
4346
+            //save the widget
4347
+            $instance = array_merge( (array) $old_instance, (array) $new_instance );
4364 4348
 
4365
-			return $instance;
4366
-		}
4349
+            // set widget instance
4350
+            $this->instance = $instance;
4367 4351
 
4368
-		/**
4369
-		 * Checks if the current call is a ajax call to get the block content.
4370
-		 *
4371
-		 * This can be used in your widget to return different content as the block content.
4372
-		 *
4373
-		 * @return bool
4374
-		 *@since 1.0.3
4375
-		 */
4376
-		public function is_block_content_call() {
4377
-			$result = false;
4378
-			if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
4379
-				$result = true;
4380
-			}
4352
+            if ( empty( $this->arguments ) ) {
4353
+                $this->get_arguments();
4354
+            }
4381 4355
 
4382
-			return $result;
4383
-		}
4356
+            // check for checkboxes
4357
+            if ( ! empty( $this->arguments ) ) {
4358
+                foreach ( $this->arguments as $argument ) {
4359
+                    if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
4360
+                        $instance[ $argument['name'] ] = '0';
4361
+                    }
4362
+                }
4363
+            }
4384 4364
 
4385
-		/**
4386
-		 * Get an instance hash that will be unique to the type and settings.
4387
-		 *
4388
-		 * @return string
4389
-		 *@since 1.0.20
4390
-		 */
4391
-		public function get_instance_hash(){
4392
-			$instance_string = $this->base_id.serialize($this->instance);
4393
-			return hash('crc32b',$instance_string);
4394
-		}
4365
+            return $instance;
4366
+        }
4395 4367
 
4396
-		/**
4397
-		 * Generate and return inline styles from CSS rules that will match the unique class of the instance.
4398
-		 *
4399
-		 * @param array $rules
4400
-		 *
4401
-		 * @return string
4402
-		 *@since 1.0.20
4403
-		 */
4404
-		public function get_instance_style($rules = array()){
4405
-			$css = '';
4406
-
4407
-			if(!empty($rules)){
4408
-				$rules = array_unique($rules);
4409
-				$instance_hash = $this->get_instance_hash();
4410
-				$css .= "<style>";
4411
-				foreach($rules as $rule){
4412
-					$css .= ".sdel-$instance_hash $rule";
4413
-				}
4414
-				$css .= "</style>";
4415
-			}
4368
+        /**
4369
+         * Checks if the current call is a ajax call to get the block content.
4370
+         *
4371
+         * This can be used in your widget to return different content as the block content.
4372
+         *
4373
+         * @return bool
4374
+         *@since 1.0.3
4375
+         */
4376
+        public function is_block_content_call() {
4377
+            $result = false;
4378
+            if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
4379
+                $result = true;
4380
+            }
4416 4381
 
4417
-			return $css;
4418
-		}
4382
+            return $result;
4383
+        }
4384
+
4385
+        /**
4386
+         * Get an instance hash that will be unique to the type and settings.
4387
+         *
4388
+         * @return string
4389
+         *@since 1.0.20
4390
+         */
4391
+        public function get_instance_hash(){
4392
+            $instance_string = $this->base_id.serialize($this->instance);
4393
+            return hash('crc32b',$instance_string);
4394
+        }
4395
+
4396
+        /**
4397
+         * Generate and return inline styles from CSS rules that will match the unique class of the instance.
4398
+         *
4399
+         * @param array $rules
4400
+         *
4401
+         * @return string
4402
+         *@since 1.0.20
4403
+         */
4404
+        public function get_instance_style($rules = array()){
4405
+            $css = '';
4406
+
4407
+            if(!empty($rules)){
4408
+                $rules = array_unique($rules);
4409
+                $instance_hash = $this->get_instance_hash();
4410
+                $css .= "<style>";
4411
+                foreach($rules as $rule){
4412
+                    $css .= ".sdel-$instance_hash $rule";
4413
+                }
4414
+                $css .= "</style>";
4415
+            }
4416
+
4417
+            return $css;
4418
+        }
4419 4419
 
4420
-		/**
4421
-		 * Encode shortcodes tags.
4422
-		 *
4423
-		 * @param string $content Content to search for shortcode tags.
4424
-		 *
4420
+        /**
4421
+         * Encode shortcodes tags.
4422
+         *
4423
+         * @param string $content Content to search for shortcode tags.
4424
+         *
4425 4425
 *@return string Content with shortcode tags removed.
4426
-		 *@since 1.0.28
4427
-		 *
4428
-		 */
4429
-		public function encode_shortcodes( $content ) {
4430
-			// Avoids existing encoded tags.
4431
-			$trans   = array(
4432
-				'&#91;' => '&#091;',
4433
-				'&#93;' => '&#093;',
4434
-				'&amp;#91;' => '&#091;',
4435
-				'&amp;#93;' => '&#093;',
4436
-				'&lt;' => '&0lt;',
4437
-				'&gt;' => '&0gt;',
4438
-				'&amp;lt;' => '&0lt;',
4439
-				'&amp;gt;' => '&0gt;',
4440
-			);
4441
-
4442
-			$content = strtr( $content, $trans );
4443
-
4444
-			$trans   = array(
4445
-				'[' => '&#91;',
4446
-				']' => '&#93;',
4447
-				'<' => '&lt;',
4448
-				'>' => '&gt;',
4449
-				'"' => '&quot;',
4450
-				"'" => '&apos;',
4451
-			);
4452
-
4453
-			$content = strtr( $content, $trans );
4454
-
4455
-			return $content;
4456
-		}
4426
+         *@since 1.0.28
4427
+         *
4428
+         */
4429
+        public function encode_shortcodes( $content ) {
4430
+            // Avoids existing encoded tags.
4431
+            $trans   = array(
4432
+                '&#91;' => '&#091;',
4433
+                '&#93;' => '&#093;',
4434
+                '&amp;#91;' => '&#091;',
4435
+                '&amp;#93;' => '&#093;',
4436
+                '&lt;' => '&0lt;',
4437
+                '&gt;' => '&0gt;',
4438
+                '&amp;lt;' => '&0lt;',
4439
+                '&amp;gt;' => '&0gt;',
4440
+            );
4441
+
4442
+            $content = strtr( $content, $trans );
4443
+
4444
+            $trans   = array(
4445
+                '[' => '&#91;',
4446
+                ']' => '&#93;',
4447
+                '<' => '&lt;',
4448
+                '>' => '&gt;',
4449
+                '"' => '&quot;',
4450
+                "'" => '&apos;',
4451
+            );
4452
+
4453
+            $content = strtr( $content, $trans );
4454
+
4455
+            return $content;
4456
+        }
4457 4457
 
4458
-		/**
4459
-		 * Remove encoded shortcod tags.
4460
-		 *
4461
-		 * @param string $content Content to search for shortcode tags.
4462
-		 *
4458
+        /**
4459
+         * Remove encoded shortcod tags.
4460
+         *
4461
+         * @param string $content Content to search for shortcode tags.
4462
+         *
4463 4463
 *@return string Content with decoded shortcode tags.
4464
-		 *@since 1.0.28
4465
-		 *
4466
-		 */
4467
-		public function decode_shortcodes( $content ) {
4468
-			$trans   = array(
4469
-				'&#91;' => '[',
4470
-				'&#93;' => ']',
4471
-				'&amp;#91;' => '[',
4472
-				'&amp;#93;' => ']',
4473
-				'&lt;' => '<',
4474
-				'&gt;' => '>',
4475
-				'&amp;lt;' => '<',
4476
-				'&amp;gt;' => '>',
4477
-				'&quot;' => '"',
4478
-				'&apos;' => "'",
4479
-			);
4480
-
4481
-			$content = strtr( $content, $trans );
4482
-
4483
-			$trans   = array(
4484
-				'&#091;' => '&#91;',
4485
-				'&#093;' => '&#93;',
4486
-				'&amp;#091;' => '&#91;',
4487
-				'&amp;#093;' => '&#93;',
4488
-				'&0lt;' => '&lt;',
4489
-				'&0gt;' => '&gt;',
4490
-				'&amp;0lt;' => '&lt;',
4491
-				'&amp;0gt;' => '&gt;',
4492
-			);
4493
-
4494
-			$content = strtr( $content, $trans );
4495
-
4496
-			return $content;
4497
-		}
4498
-	}
4464
+         *@since 1.0.28
4465
+         *
4466
+         */
4467
+        public function decode_shortcodes( $content ) {
4468
+            $trans   = array(
4469
+                '&#91;' => '[',
4470
+                '&#93;' => ']',
4471
+                '&amp;#91;' => '[',
4472
+                '&amp;#93;' => ']',
4473
+                '&lt;' => '<',
4474
+                '&gt;' => '>',
4475
+                '&amp;lt;' => '<',
4476
+                '&amp;gt;' => '>',
4477
+                '&quot;' => '"',
4478
+                '&apos;' => "'",
4479
+            );
4480
+
4481
+            $content = strtr( $content, $trans );
4482
+
4483
+            $trans   = array(
4484
+                '&#091;' => '&#91;',
4485
+                '&#093;' => '&#93;',
4486
+                '&amp;#091;' => '&#91;',
4487
+                '&amp;#093;' => '&#93;',
4488
+                '&0lt;' => '&lt;',
4489
+                '&0gt;' => '&gt;',
4490
+                '&amp;0lt;' => '&lt;',
4491
+                '&amp;0gt;' => '&gt;',
4492
+            );
4493
+
4494
+            $content = strtr( $content, $trans );
4495
+
4496
+            return $content;
4497
+        }
4498
+    }
4499 4499
 }
Please login to merge, or discard this patch.
includes/class-getpaid-subscriptions-query.php 1 patch
Indentation   +505 added lines, -505 removed lines patch added patch discarded remove patch
@@ -16,512 +16,512 @@
 block discarded – undo
16 16
  */
17 17
 class GetPaid_Subscriptions_Query {
18 18
 
19
-	/**
20
-	 * Query vars, after parsing
21
-	 *
22
-	 * @since 1.0.19
23
-	 * @var array
24
-	 */
25
-	public $query_vars = array();
26
-
27
-	/**
28
-	 * List of found subscriptions.
29
-	 *
30
-	 * @since 1.0.19
31
-	 * @var array
32
-	 */
33
-	private $results;
34
-
35
-	/**
36
-	 * Total number of found subscriptions for the current query
37
-	 *
38
-	 * @since 1.0.19
39
-	 * @var int
40
-	 */
41
-	private $total_subscriptions = 0;
42
-
43
-	/**
44
-	 * The SQL query used to fetch matching subscriptions.
45
-	 *
46
-	 * @since 1.0.19
47
-	 * @var string
48
-	 */
49
-	public $request;
50
-
51
-	// SQL clauses
52
-
53
-	/**
54
-	 * Contains the 'FIELDS' sql clause
55
-	 *
56
-	 * @since 1.0.19
57
-	 * @var string
58
-	 */
59
-	public $query_fields;
60
-
61
-	/**
62
-	 * Contains the 'FROM' sql clause
63
-	 *
64
-	 * @since 1.0.19
65
-	 * @var string
66
-	 */
67
-	public $query_from;
68
-
69
-	/**
70
-	 * Contains the 'WHERE' sql clause
71
-	 *
72
-	 * @since 1.0.19
73
-	 * @var string
74
-	 */
75
-	public $query_where;
76
-
77
-	/**
78
-	 * Contains the 'ORDER BY' sql clause
79
-	 *
80
-	 * @since 1.0.19
81
-	 * @var string
82
-	 */
83
-	public $query_orderby;
84
-
85
-	/**
86
-	 * Contains the 'LIMIT' sql clause
87
-	 *
88
-	 * @since 1.0.19
89
-	 * @var string
90
-	 */
91
-	public $query_limit;
92
-
93
-	/**
94
-	 * Class constructor.
95
-	 *
96
-	 * @since 1.0.19
97
-	 *
98
-	 * @param null|string|array $query Optional. The query variables.
99
-	 */
100
-	public function __construct( $query = null ) {
101
-		if ( ! is_null( $query ) ) {
102
-			$this->prepare_query( $query );
103
-			$this->query();
104
-		}
105
-	}
106
-
107
-	/**
108
-	 * Fills in missing query variables with default values.
109
-	 *
110
-	 * @since 1.0.19
111
-	 *
112
-	 * @param  string|array $args Query vars, as passed to `GetPaid_Subscriptions_Query`.
113
-	 * @return array Complete query variables with undefined ones filled in with defaults.
114
-	 */
115
-	public static function fill_query_vars( $args ) {
116
-		$defaults = array(
117
-			'status'          => 'all',
118
-			'customer_in'     => array(),
119
-			'customer_not_in' => array(),
120
-			'product_in'      => array(),
121
-			'product_not_in'  => array(),
122
-			'include'         => array(),
123
-			'exclude'         => array(),
124
-			'orderby'         => 'id',
125
-			'order'           => 'DESC',
126
-			'offset'          => '',
127
-			'number'          => 10,
128
-			'paged'           => 1,
129
-			'count_total'     => true,
130
-			'fields'          => 'all',
131
-		);
132
-
133
-		return wp_parse_args( $args, $defaults );
134
-	}
135
-
136
-	/**
137
-	 * Prepare the query variables.
138
-	 *
139
-	 * @since 1.0.19
140
-	 *
141
-	 * @global wpdb $wpdb WordPress database abstraction object.
142
-	 *
143
-	 * @param string|array $query {
144
-	 *     Optional. Array or string of Query parameters.
145
-	 *
146
-	 *     @type string|array $status              The subscription status to filter by. Can either be a single status or an array of statuses.
147
-	 *                                             Default is all.
148
-	 *     @type int[]        $customer_in         An array of customer ids to filter by.
149
-	 *     @type int[]        $customer_not_in     An array of customer ids whose subscriptions should be excluded.
150
-	 *     @type int[]        $invoice_in          An array of invoice ids to filter by.
151
-	 *     @type int[]        $invoice_not_in      An array of invoice ids whose subscriptions should be excluded.
152
-	 *     @type int[]        $product_in          An array of product ids to filter by.
153
-	 *     @type int[]        $product_not_in      An array of product ids whose subscriptions should be excluded.
154
-	 *     @type array        $date_created_query  A WP_Date_Query compatible array use to filter subscriptions by their date of creation.
155
-	 *     @type array        $date_expires_query  A WP_Date_Query compatible array use to filter subscriptions by their expiration date.
156
-	 *     @type array        $include             An array of subscription IDs to include. Default empty array.
157
-	 *     @type array        $exclude             An array of subscription IDs to exclude. Default empty array.
158
-	 *     @type string|array $orderby             Field(s) to sort the retrieved subscription by. May be a single value,
159
-	 *                                             an array of values, or a multi-dimensional array with fields as
160
-	 *                                             keys and orders ('ASC' or 'DESC') as values. Accepted values are
161
-	 *                                             'id', 'customer_id', 'frequency', 'period', 'initial_amount,
162
-	 *                                             'recurring_amount', 'bill_times', 'parent_payment_id', 'created', 'expiration'
163
-	 *                                             'transaction_id', 'product_id', 'trial_period', 'include', 'status', 'profile_id'. Default array( 'id' ).
164
-	 *     @type string       $order               Designates ascending or descending order of subscriptions. Order values
165
-	 *                                             passed as part of an `$orderby` array take precedence over this
166
-	 *                                             parameter. Accepts 'ASC', 'DESC'. Default 'DESC'.
167
-	 *     @type int          $offset              Number of subscriptions to offset in retrieved results. Can be used in
168
-	 *                                             conjunction with pagination. Default 0.
169
-	 *     @type int          $number              Number of subscriptions to limit the query for. Can be used in
170
-	 *                                             conjunction with pagination. Value -1 (all) is supported, but
171
-	 *                                             should be used with caution on larger sites.
172
-	 *                                             Default 10.
173
-	 *     @type int          $paged               When used with number, defines the page of results to return.
174
-	 *                                             Default 1.
175
-	 *     @type bool         $count_total         Whether to count the total number of subscriptions found. If pagination
176
-	 *                                             is not needed, setting this to false can improve performance.
177
-	 *                                             Default true.
178
-	 *     @type string|array $fields              Which fields to return. Single or all fields (string), or array
179
-	 *                                             of fields. Accepts 'id', 'customer_id', 'frequency', 'period', 'initial_amount,
180
-	 *                                             'recurring_amount', 'bill_times', 'parent_payment_id', 'created', 'expiration'
181
-	 *                                             'transaction_id', 'product_id', 'trial_period', 'status', 'profile_id'.
182
-	 *                                             Use 'all' for all fields. Default 'all'.
183
-	 * }
184
-	 */
185
-	public function prepare_query( $query = array() ) {
186
-		global $wpdb;
187
-
188
-		if ( empty( $this->query_vars ) || ! empty( $query ) ) {
189
-			$this->query_limit = null;
190
-			$this->query_vars  = $this->fill_query_vars( $query );
191
-		}
192
-
193
-		if ( ! empty( $this->query_vars['fields'] ) && 'all' !== $this->query_vars['fields'] ) {
194
-			$this->query_vars['fields'] = wpinv_parse_list( $this->query_vars['fields'] );
195
-		}
196
-
197
-		do_action( 'getpaid_pre_get_subscriptions', array( &$this ) );
198
-
199
-		// Ensure that query vars are filled after 'getpaid_pre_get_subscriptions'.
200
-		$qv                =& $this->query_vars;
201
-		$qv                = $this->fill_query_vars( $qv );
202
-		$table             = $wpdb->prefix . 'wpinv_subscriptions';
203
-		$this->query_from  = "FROM $table";
204
-
205
-		// Prepare query fields.
206
-		$this->prepare_query_fields( $qv, $table );
207
-
208
-		// Prepare query where.
209
-		$this->prepare_query_where( $qv, $table );
210
-
211
-		// Prepare query order.
212
-		$this->prepare_query_order( $qv, $table );
213
-
214
-		// limit
215
-		if ( isset( $qv['number'] ) && $qv['number'] > 0 ) {
216
-			if ( $qv['offset'] ) {
217
-				$this->query_limit = $wpdb->prepare( 'LIMIT %d, %d', $qv['offset'], $qv['number'] );
218
-			} else {
219
-				$this->query_limit = $wpdb->prepare( 'LIMIT %d, %d', $qv['number'] * ( $qv['paged'] - 1 ), $qv['number'] );
220
-			}
221
-		}
222
-
223
-		do_action_ref_array( 'getpaid_after_subscriptions_query', array( &$this ) );
224
-	}
225
-
226
-	/**
227
-	 * Prepares the query fields.
228
-	 *
229
-	 * @since 1.0.19
230
-	 *
231
-	 * @param array $qv Query vars.
232
-	 * @param string $table Table name.
233
-	 */
234
-	protected function prepare_query_fields( &$qv, $table ) {
235
-
236
-		if ( is_array( $qv['fields'] ) ) {
237
-			$qv['fields'] = array_unique( $qv['fields'] );
238
-
239
-			$query_fields = array();
240
-			foreach ( $qv['fields'] as $field ) {
241
-				$field          = sanitize_key( $field );
242
-				$query_fields[] = "$table.`$field`";
243
-			}
244
-			$this->query_fields = implode( ',', $query_fields );
245
-		} else {
246
-			$this->query_fields = "$table.*";
247
-		}
248
-
249
-		if ( isset( $qv['count_total'] ) && $qv['count_total'] ) {
250
-			$this->query_fields = 'SQL_CALC_FOUND_ROWS ' . $this->query_fields;
251
-		}
252
-
253
-	}
254
-
255
-	/**
256
-	 * Prepares the query where.
257
-	 *
258
-	 * @since 1.0.19
259
-	 *
260
-	 * @param array $qv Query vars.
261
-	 * @param string $table Table name.
262
-	 */
263
-	protected function prepare_query_where( &$qv, $table ) {
264
-		global $wpdb;
265
-		$this->query_where = 'WHERE 1=1';
266
-
267
-		// Status.
268
-		if ( 'all' !== $qv['status'] ) {
269
-			$statuses           = wpinv_clean( wpinv_parse_list( $qv['status'] ) );
270
-			$prepared_statuses  = join( ',', array_fill( 0, count( $statuses ), '%s' ) );
271
-			$this->query_where .= $wpdb->prepare( " AND $table.`status` IN ( $prepared_statuses )", $statuses );
272
-		}
273
-
274
-		if ( ! empty( $qv['customer_in'] ) ) {
275
-			$customer_in        = implode( ',', wp_parse_id_list( $qv['customer_in'] ) );
276
-			$this->query_where .= " AND $table.`customer_id` IN ($customer_in)";
277
-		} elseif ( ! empty( $qv['customer_not_in'] ) ) {
278
-			$customer_not_in    = implode( ',', wp_parse_id_list( $qv['customer_not_in'] ) );
279
-			$this->query_where .= " AND $table.`customer_id` NOT IN ($customer_not_in)";
280
-		}
281
-
282
-		if ( ! empty( $qv['product_in'] ) ) {
283
-			$product_in         = implode( ',', wp_parse_id_list( $qv['product_in'] ) );
284
-			$this->query_where .= " AND $table.`product_id` IN ($product_in)";
285
-		} elseif ( ! empty( $qv['product_not_in'] ) ) {
286
-			$product_not_in     = implode( ',', wp_parse_id_list( $qv['product_not_in'] ) );
287
-			$this->query_where .= " AND $table.`product_id` NOT IN ($product_not_in)";
288
-		}
289
-
290
-		if ( ! empty( $qv['invoice_in'] ) ) {
291
-			$invoice_in         = implode( ',', wp_parse_id_list( $qv['invoice_in'] ) );
292
-			$this->query_where .= " AND $table.`parent_payment_id` IN ($invoice_in)";
293
-		} elseif ( ! empty( $qv['invoice_not_in'] ) ) {
294
-			$invoice_not_in     = implode( ',', wp_parse_id_list( $qv['invoice_not_in'] ) );
295
-			$this->query_where .= " AND $table.`parent_payment_id` NOT IN ($invoice_not_in)";
296
-		}
297
-
298
-		if ( ! empty( $qv['include'] ) ) {
299
-			$include            = implode( ',', wp_parse_id_list( $qv['include'] ) );
300
-			$this->query_where .= " AND $table.`id` IN ($include)";
301
-		} elseif ( ! empty( $qv['exclude'] ) ) {
302
-			$exclude            = implode( ',', wp_parse_id_list( $qv['exclude'] ) );
303
-			$this->query_where .= " AND $table.`id` NOT IN ($exclude)";
304
-		}
305
-
306
-		// Date queries are allowed for the subscription creation date.
307
-		if ( ! empty( $qv['date_created_query'] ) && is_array( $qv['date_created_query'] ) ) {
308
-			$date_created_query = new WP_Date_Query( $qv['date_created_query'], "$table.created" );
309
-			$this->query_where .= $date_created_query->get_sql();
310
-		}
311
-
312
-		// Date queries are also allowed for the subscription expiration date.
313
-		if ( ! empty( $qv['date_expires_query'] ) && is_array( $qv['date_expires_query'] ) ) {
314
-			$date_expires_query = new WP_Date_Query( $qv['date_expires_query'], "$table.expiration" );
315
-			$this->query_where .= $date_expires_query->get_sql();
316
-		}
317
-
318
-	}
319
-
320
-	/**
321
-	 * Prepares the query order.
322
-	 *
323
-	 * @since 1.0.19
324
-	 *
325
-	 * @param array $qv Query vars.
326
-	 * @param string $table Table name.
327
-	 */
328
-	protected function prepare_query_order( &$qv, $table ) {
329
-
330
-		// sorting.
331
-		$qv['order'] = isset( $qv['order'] ) ? strtoupper( $qv['order'] ) : '';
332
-		$order       = $this->parse_order( $qv['order'] );
333
-
334
-		// Default order is by 'id' (latest subscriptions).
335
-		if ( empty( $qv['orderby'] ) ) {
336
-			$qv['orderby'] = array( 'id' );
337
-		}
338
-
339
-		// 'orderby' values may be an array, comma- or space-separated list.
340
-		$ordersby      = array_filter( wpinv_parse_list( $qv['orderby'] ) );
341
-
342
-		$orderby_array = array();
343
-		foreach ( $ordersby as $_key => $_value ) {
344
-
345
-			if ( is_int( $_key ) ) {
346
-				// Integer key means this is a flat array of 'orderby' fields.
347
-				$_orderby = $_value;
348
-				$_order   = $order;
349
-			} else {
350
-				// Non-integer key means that the key is the field and the value is ASC/DESC.
351
-				$_orderby = $_key;
352
-				$_order   = $_value;
353
-			}
354
-
355
-			$parsed = $this->parse_orderby( $_orderby, $table );
356
-
357
-			if ( $parsed ) {
358
-				$orderby_array[] = $parsed . ' ' . $this->parse_order( $_order );
359
-			}
19
+    /**
20
+     * Query vars, after parsing
21
+     *
22
+     * @since 1.0.19
23
+     * @var array
24
+     */
25
+    public $query_vars = array();
26
+
27
+    /**
28
+     * List of found subscriptions.
29
+     *
30
+     * @since 1.0.19
31
+     * @var array
32
+     */
33
+    private $results;
34
+
35
+    /**
36
+     * Total number of found subscriptions for the current query
37
+     *
38
+     * @since 1.0.19
39
+     * @var int
40
+     */
41
+    private $total_subscriptions = 0;
42
+
43
+    /**
44
+     * The SQL query used to fetch matching subscriptions.
45
+     *
46
+     * @since 1.0.19
47
+     * @var string
48
+     */
49
+    public $request;
50
+
51
+    // SQL clauses
52
+
53
+    /**
54
+     * Contains the 'FIELDS' sql clause
55
+     *
56
+     * @since 1.0.19
57
+     * @var string
58
+     */
59
+    public $query_fields;
60
+
61
+    /**
62
+     * Contains the 'FROM' sql clause
63
+     *
64
+     * @since 1.0.19
65
+     * @var string
66
+     */
67
+    public $query_from;
68
+
69
+    /**
70
+     * Contains the 'WHERE' sql clause
71
+     *
72
+     * @since 1.0.19
73
+     * @var string
74
+     */
75
+    public $query_where;
76
+
77
+    /**
78
+     * Contains the 'ORDER BY' sql clause
79
+     *
80
+     * @since 1.0.19
81
+     * @var string
82
+     */
83
+    public $query_orderby;
84
+
85
+    /**
86
+     * Contains the 'LIMIT' sql clause
87
+     *
88
+     * @since 1.0.19
89
+     * @var string
90
+     */
91
+    public $query_limit;
92
+
93
+    /**
94
+     * Class constructor.
95
+     *
96
+     * @since 1.0.19
97
+     *
98
+     * @param null|string|array $query Optional. The query variables.
99
+     */
100
+    public function __construct( $query = null ) {
101
+        if ( ! is_null( $query ) ) {
102
+            $this->prepare_query( $query );
103
+            $this->query();
104
+        }
105
+    }
106
+
107
+    /**
108
+     * Fills in missing query variables with default values.
109
+     *
110
+     * @since 1.0.19
111
+     *
112
+     * @param  string|array $args Query vars, as passed to `GetPaid_Subscriptions_Query`.
113
+     * @return array Complete query variables with undefined ones filled in with defaults.
114
+     */
115
+    public static function fill_query_vars( $args ) {
116
+        $defaults = array(
117
+            'status'          => 'all',
118
+            'customer_in'     => array(),
119
+            'customer_not_in' => array(),
120
+            'product_in'      => array(),
121
+            'product_not_in'  => array(),
122
+            'include'         => array(),
123
+            'exclude'         => array(),
124
+            'orderby'         => 'id',
125
+            'order'           => 'DESC',
126
+            'offset'          => '',
127
+            'number'          => 10,
128
+            'paged'           => 1,
129
+            'count_total'     => true,
130
+            'fields'          => 'all',
131
+        );
132
+
133
+        return wp_parse_args( $args, $defaults );
134
+    }
135
+
136
+    /**
137
+     * Prepare the query variables.
138
+     *
139
+     * @since 1.0.19
140
+     *
141
+     * @global wpdb $wpdb WordPress database abstraction object.
142
+     *
143
+     * @param string|array $query {
144
+     *     Optional. Array or string of Query parameters.
145
+     *
146
+     *     @type string|array $status              The subscription status to filter by. Can either be a single status or an array of statuses.
147
+     *                                             Default is all.
148
+     *     @type int[]        $customer_in         An array of customer ids to filter by.
149
+     *     @type int[]        $customer_not_in     An array of customer ids whose subscriptions should be excluded.
150
+     *     @type int[]        $invoice_in          An array of invoice ids to filter by.
151
+     *     @type int[]        $invoice_not_in      An array of invoice ids whose subscriptions should be excluded.
152
+     *     @type int[]        $product_in          An array of product ids to filter by.
153
+     *     @type int[]        $product_not_in      An array of product ids whose subscriptions should be excluded.
154
+     *     @type array        $date_created_query  A WP_Date_Query compatible array use to filter subscriptions by their date of creation.
155
+     *     @type array        $date_expires_query  A WP_Date_Query compatible array use to filter subscriptions by their expiration date.
156
+     *     @type array        $include             An array of subscription IDs to include. Default empty array.
157
+     *     @type array        $exclude             An array of subscription IDs to exclude. Default empty array.
158
+     *     @type string|array $orderby             Field(s) to sort the retrieved subscription by. May be a single value,
159
+     *                                             an array of values, or a multi-dimensional array with fields as
160
+     *                                             keys and orders ('ASC' or 'DESC') as values. Accepted values are
161
+     *                                             'id', 'customer_id', 'frequency', 'period', 'initial_amount,
162
+     *                                             'recurring_amount', 'bill_times', 'parent_payment_id', 'created', 'expiration'
163
+     *                                             'transaction_id', 'product_id', 'trial_period', 'include', 'status', 'profile_id'. Default array( 'id' ).
164
+     *     @type string       $order               Designates ascending or descending order of subscriptions. Order values
165
+     *                                             passed as part of an `$orderby` array take precedence over this
166
+     *                                             parameter. Accepts 'ASC', 'DESC'. Default 'DESC'.
167
+     *     @type int          $offset              Number of subscriptions to offset in retrieved results. Can be used in
168
+     *                                             conjunction with pagination. Default 0.
169
+     *     @type int          $number              Number of subscriptions to limit the query for. Can be used in
170
+     *                                             conjunction with pagination. Value -1 (all) is supported, but
171
+     *                                             should be used with caution on larger sites.
172
+     *                                             Default 10.
173
+     *     @type int          $paged               When used with number, defines the page of results to return.
174
+     *                                             Default 1.
175
+     *     @type bool         $count_total         Whether to count the total number of subscriptions found. If pagination
176
+     *                                             is not needed, setting this to false can improve performance.
177
+     *                                             Default true.
178
+     *     @type string|array $fields              Which fields to return. Single or all fields (string), or array
179
+     *                                             of fields. Accepts 'id', 'customer_id', 'frequency', 'period', 'initial_amount,
180
+     *                                             'recurring_amount', 'bill_times', 'parent_payment_id', 'created', 'expiration'
181
+     *                                             'transaction_id', 'product_id', 'trial_period', 'status', 'profile_id'.
182
+     *                                             Use 'all' for all fields. Default 'all'.
183
+     * }
184
+     */
185
+    public function prepare_query( $query = array() ) {
186
+        global $wpdb;
187
+
188
+        if ( empty( $this->query_vars ) || ! empty( $query ) ) {
189
+            $this->query_limit = null;
190
+            $this->query_vars  = $this->fill_query_vars( $query );
191
+        }
192
+
193
+        if ( ! empty( $this->query_vars['fields'] ) && 'all' !== $this->query_vars['fields'] ) {
194
+            $this->query_vars['fields'] = wpinv_parse_list( $this->query_vars['fields'] );
195
+        }
196
+
197
+        do_action( 'getpaid_pre_get_subscriptions', array( &$this ) );
198
+
199
+        // Ensure that query vars are filled after 'getpaid_pre_get_subscriptions'.
200
+        $qv                =& $this->query_vars;
201
+        $qv                = $this->fill_query_vars( $qv );
202
+        $table             = $wpdb->prefix . 'wpinv_subscriptions';
203
+        $this->query_from  = "FROM $table";
204
+
205
+        // Prepare query fields.
206
+        $this->prepare_query_fields( $qv, $table );
207
+
208
+        // Prepare query where.
209
+        $this->prepare_query_where( $qv, $table );
210
+
211
+        // Prepare query order.
212
+        $this->prepare_query_order( $qv, $table );
213
+
214
+        // limit
215
+        if ( isset( $qv['number'] ) && $qv['number'] > 0 ) {
216
+            if ( $qv['offset'] ) {
217
+                $this->query_limit = $wpdb->prepare( 'LIMIT %d, %d', $qv['offset'], $qv['number'] );
218
+            } else {
219
+                $this->query_limit = $wpdb->prepare( 'LIMIT %d, %d', $qv['number'] * ( $qv['paged'] - 1 ), $qv['number'] );
220
+            }
221
+        }
222
+
223
+        do_action_ref_array( 'getpaid_after_subscriptions_query', array( &$this ) );
224
+    }
225
+
226
+    /**
227
+     * Prepares the query fields.
228
+     *
229
+     * @since 1.0.19
230
+     *
231
+     * @param array $qv Query vars.
232
+     * @param string $table Table name.
233
+     */
234
+    protected function prepare_query_fields( &$qv, $table ) {
235
+
236
+        if ( is_array( $qv['fields'] ) ) {
237
+            $qv['fields'] = array_unique( $qv['fields'] );
238
+
239
+            $query_fields = array();
240
+            foreach ( $qv['fields'] as $field ) {
241
+                $field          = sanitize_key( $field );
242
+                $query_fields[] = "$table.`$field`";
243
+            }
244
+            $this->query_fields = implode( ',', $query_fields );
245
+        } else {
246
+            $this->query_fields = "$table.*";
247
+        }
248
+
249
+        if ( isset( $qv['count_total'] ) && $qv['count_total'] ) {
250
+            $this->query_fields = 'SQL_CALC_FOUND_ROWS ' . $this->query_fields;
251
+        }
252
+
253
+    }
254
+
255
+    /**
256
+     * Prepares the query where.
257
+     *
258
+     * @since 1.0.19
259
+     *
260
+     * @param array $qv Query vars.
261
+     * @param string $table Table name.
262
+     */
263
+    protected function prepare_query_where( &$qv, $table ) {
264
+        global $wpdb;
265
+        $this->query_where = 'WHERE 1=1';
266
+
267
+        // Status.
268
+        if ( 'all' !== $qv['status'] ) {
269
+            $statuses           = wpinv_clean( wpinv_parse_list( $qv['status'] ) );
270
+            $prepared_statuses  = join( ',', array_fill( 0, count( $statuses ), '%s' ) );
271
+            $this->query_where .= $wpdb->prepare( " AND $table.`status` IN ( $prepared_statuses )", $statuses );
272
+        }
273
+
274
+        if ( ! empty( $qv['customer_in'] ) ) {
275
+            $customer_in        = implode( ',', wp_parse_id_list( $qv['customer_in'] ) );
276
+            $this->query_where .= " AND $table.`customer_id` IN ($customer_in)";
277
+        } elseif ( ! empty( $qv['customer_not_in'] ) ) {
278
+            $customer_not_in    = implode( ',', wp_parse_id_list( $qv['customer_not_in'] ) );
279
+            $this->query_where .= " AND $table.`customer_id` NOT IN ($customer_not_in)";
280
+        }
281
+
282
+        if ( ! empty( $qv['product_in'] ) ) {
283
+            $product_in         = implode( ',', wp_parse_id_list( $qv['product_in'] ) );
284
+            $this->query_where .= " AND $table.`product_id` IN ($product_in)";
285
+        } elseif ( ! empty( $qv['product_not_in'] ) ) {
286
+            $product_not_in     = implode( ',', wp_parse_id_list( $qv['product_not_in'] ) );
287
+            $this->query_where .= " AND $table.`product_id` NOT IN ($product_not_in)";
288
+        }
289
+
290
+        if ( ! empty( $qv['invoice_in'] ) ) {
291
+            $invoice_in         = implode( ',', wp_parse_id_list( $qv['invoice_in'] ) );
292
+            $this->query_where .= " AND $table.`parent_payment_id` IN ($invoice_in)";
293
+        } elseif ( ! empty( $qv['invoice_not_in'] ) ) {
294
+            $invoice_not_in     = implode( ',', wp_parse_id_list( $qv['invoice_not_in'] ) );
295
+            $this->query_where .= " AND $table.`parent_payment_id` NOT IN ($invoice_not_in)";
296
+        }
297
+
298
+        if ( ! empty( $qv['include'] ) ) {
299
+            $include            = implode( ',', wp_parse_id_list( $qv['include'] ) );
300
+            $this->query_where .= " AND $table.`id` IN ($include)";
301
+        } elseif ( ! empty( $qv['exclude'] ) ) {
302
+            $exclude            = implode( ',', wp_parse_id_list( $qv['exclude'] ) );
303
+            $this->query_where .= " AND $table.`id` NOT IN ($exclude)";
304
+        }
305
+
306
+        // Date queries are allowed for the subscription creation date.
307
+        if ( ! empty( $qv['date_created_query'] ) && is_array( $qv['date_created_query'] ) ) {
308
+            $date_created_query = new WP_Date_Query( $qv['date_created_query'], "$table.created" );
309
+            $this->query_where .= $date_created_query->get_sql();
310
+        }
311
+
312
+        // Date queries are also allowed for the subscription expiration date.
313
+        if ( ! empty( $qv['date_expires_query'] ) && is_array( $qv['date_expires_query'] ) ) {
314
+            $date_expires_query = new WP_Date_Query( $qv['date_expires_query'], "$table.expiration" );
315
+            $this->query_where .= $date_expires_query->get_sql();
316
+        }
317
+
318
+    }
319
+
320
+    /**
321
+     * Prepares the query order.
322
+     *
323
+     * @since 1.0.19
324
+     *
325
+     * @param array $qv Query vars.
326
+     * @param string $table Table name.
327
+     */
328
+    protected function prepare_query_order( &$qv, $table ) {
329
+
330
+        // sorting.
331
+        $qv['order'] = isset( $qv['order'] ) ? strtoupper( $qv['order'] ) : '';
332
+        $order       = $this->parse_order( $qv['order'] );
333
+
334
+        // Default order is by 'id' (latest subscriptions).
335
+        if ( empty( $qv['orderby'] ) ) {
336
+            $qv['orderby'] = array( 'id' );
337
+        }
338
+
339
+        // 'orderby' values may be an array, comma- or space-separated list.
340
+        $ordersby      = array_filter( wpinv_parse_list( $qv['orderby'] ) );
341
+
342
+        $orderby_array = array();
343
+        foreach ( $ordersby as $_key => $_value ) {
344
+
345
+            if ( is_int( $_key ) ) {
346
+                // Integer key means this is a flat array of 'orderby' fields.
347
+                $_orderby = $_value;
348
+                $_order   = $order;
349
+            } else {
350
+                // Non-integer key means that the key is the field and the value is ASC/DESC.
351
+                $_orderby = $_key;
352
+                $_order   = $_value;
353
+            }
354
+
355
+            $parsed = $this->parse_orderby( $_orderby, $table );
356
+
357
+            if ( $parsed ) {
358
+                $orderby_array[] = $parsed . ' ' . $this->parse_order( $_order );
359
+            }
360 360
 }
361 361
 
362
-		// If no valid clauses were found, order by id.
363
-		if ( empty( $orderby_array ) ) {
364
-			$orderby_array[] = "id $order";
365
-		}
366
-
367
-		$this->query_orderby = 'ORDER BY ' . implode( ', ', $orderby_array );
368
-
369
-	}
370
-
371
-	/**
372
-	 * Execute the query, with the current variables.
373
-	 *
374
-	 * @since 1.0.19
375
-	 *
376
-	 * @global wpdb $wpdb WordPress database abstraction object.
377
-	 */
378
-	public function query() {
379
-		global $wpdb;
380
-
381
-		$qv =& $this->query_vars;
382
-
383
-		// Return a non-null value to bypass the default GetPaid subscriptions query and remember to set the
384
-		// total_subscriptions property.
385
-		$this->results = apply_filters_ref_array( 'getpaid_subscriptions_pre_query', array( null, &$this ) );
386
-
387
-		if ( null === $this->results ) {
388
-			$this->request = "SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit";
389
-
390
-			if ( ( is_array( $qv['fields'] ) && 1 != count( $qv['fields'] ) ) || 'all' == $qv['fields'] ) {
391
-				$this->results = $wpdb->get_results( $this->request );
392
-			} else {
393
-				$this->results = $wpdb->get_col( $this->request );
394
-			}
395
-
396
-			if ( isset( $qv['count_total'] ) && $qv['count_total'] ) {
397
-				$found_subscriptions_query = apply_filters( 'getpaid_found_subscriptions_query', 'SELECT FOUND_ROWS()', $this );
398
-				$this->total_subscriptions   = (int) $wpdb->get_var( $found_subscriptions_query );
399
-			}
400
-		}
401
-
402
-		if ( 'all' == $qv['fields'] ) {
403
-			foreach ( $this->results as $key => $subscription ) {
404
-				$this->set_cache( $subscription->id, $subscription, 'getpaid_subscriptions' );
405
-				$this->set_cache( $subscription->profile_id, $subscription->id, 'getpaid_subscription_profile_ids_to_subscription_ids' );
406
-				$this->set_cache( $subscription->transaction_id, $subscription->id, 'getpaid_subscription_transaction_ids_to_subscription_ids' );
407
-				$this->set_cache( $subscription->transaction_id, $subscription->id, 'getpaid_subscription_transaction_ids_to_subscription_ids' );
408
-				$this->results[ $key ] = new WPInv_Subscription( $subscription );
409
-			}
410
-		}
411
-
412
-	}
413
-
414
-	/**
415
-	 * Set cache
416
-	 *
417
-	 * @param string  $id
418
-	 * @param mixed   $data
419
-	 * @param string  $group
420
-	 * @param integer $expire
421
-	 * @return boolean
422
-	 */
423
-	public function set_cache( $key, $data, $group = '', $expire = 0 ) {
424
-
425
-		if ( empty( $key ) ) {
426
-			return false;
427
-		}
428
-
429
-		wp_cache_set( $key, $data, $group, $expire );
430
-	}
431
-
432
-	/**
433
-	 * Retrieve query variable.
434
-	 *
435
-	 * @since 1.0.19
436
-	 *
437
-	 * @param string $query_var Query variable key.
438
-	 * @return mixed
439
-	 */
440
-	public function get( $query_var ) {
441
-		if ( isset( $this->query_vars[ $query_var ] ) ) {
442
-			return $this->query_vars[ $query_var ];
443
-		}
444
-
445
-		return null;
446
-	}
447
-
448
-	/**
449
-	 * Set query variable.
450
-	 *
451
-	 * @since 1.0.19
452
-	 *
453
-	 * @param string $query_var Query variable key.
454
-	 * @param mixed $value Query variable value.
455
-	 */
456
-	public function set( $query_var, $value ) {
457
-		$this->query_vars[ $query_var ] = $value;
458
-	}
459
-
460
-	/**
461
-	 * Return the list of subscriptions.
462
-	 *
463
-	 * @since 1.0.19
464
-	 *
465
-	 * @return WPInv_Subscription[]|array Found subscriptions.
466
-	 */
467
-	public function get_results() {
468
-		return $this->results;
469
-	}
470
-
471
-	/**
472
-	 * Return the total number of subscriptions for the current query.
473
-	 *
474
-	 * @since 1.0.19
475
-	 *
476
-	 * @return int Number of total subscriptions.
477
-	 */
478
-	public function get_total() {
479
-		return $this->total_subscriptions;
480
-	}
481
-
482
-	/**
483
-	 * Parse and sanitize 'orderby' keys passed to the subscriptions query.
484
-	 *
485
-	 * @since 1.0.19
486
-	 *
487
-	 * @param string $orderby Alias for the field to order by.
488
-	 *  @param string $table The current table.
489
-	 * @return string Value to use in the ORDER clause, if `$orderby` is valid.
490
-	 */
491
-	protected function parse_orderby( $orderby, $table ) {
492
-
493
-		$_orderby = '';
494
-		if ( in_array( $orderby, array( 'customer_id', 'frequency', 'period', 'initial_amount', 'recurring_amount', 'bill_times', 'transaction_id', 'parent_payment_id', 'product_id', 'created', 'expiration', 'trial_period', 'status', 'profile_id' ) ) ) {
495
-			$_orderby = "$table.`$orderby`";
496
-		} elseif ( 'id' === strtolower( $orderby ) ) {
497
-			$_orderby = "$table.id";
498
-		} elseif ( 'include' === $orderby && ! empty( $this->query_vars['include'] ) ) {
499
-			$include     = wp_parse_id_list( $this->query_vars['include'] );
500
-			$include_sql = implode( ',', $include );
501
-			$_orderby    = "FIELD( $table.id, $include_sql )";
502
-		}
503
-
504
-		return $_orderby;
505
-	}
506
-
507
-	/**
508
-	 * Parse an 'order' query variable and cast it to ASC or DESC as necessary.
509
-	 *
510
-	 * @since 1.0.19
511
-	 *
512
-	 * @param string $order The 'order' query variable.
513
-	 * @return string The sanitized 'order' query variable.
514
-	 */
515
-	protected function parse_order( $order ) {
516
-		if ( ! is_string( $order ) || empty( $order ) ) {
517
-			return 'DESC';
518
-		}
519
-
520
-		if ( 'ASC' === strtoupper( $order ) ) {
521
-			return 'ASC';
522
-		} else {
523
-			return 'DESC';
524
-		}
525
-	}
362
+        // If no valid clauses were found, order by id.
363
+        if ( empty( $orderby_array ) ) {
364
+            $orderby_array[] = "id $order";
365
+        }
366
+
367
+        $this->query_orderby = 'ORDER BY ' . implode( ', ', $orderby_array );
368
+
369
+    }
370
+
371
+    /**
372
+     * Execute the query, with the current variables.
373
+     *
374
+     * @since 1.0.19
375
+     *
376
+     * @global wpdb $wpdb WordPress database abstraction object.
377
+     */
378
+    public function query() {
379
+        global $wpdb;
380
+
381
+        $qv =& $this->query_vars;
382
+
383
+        // Return a non-null value to bypass the default GetPaid subscriptions query and remember to set the
384
+        // total_subscriptions property.
385
+        $this->results = apply_filters_ref_array( 'getpaid_subscriptions_pre_query', array( null, &$this ) );
386
+
387
+        if ( null === $this->results ) {
388
+            $this->request = "SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit";
389
+
390
+            if ( ( is_array( $qv['fields'] ) && 1 != count( $qv['fields'] ) ) || 'all' == $qv['fields'] ) {
391
+                $this->results = $wpdb->get_results( $this->request );
392
+            } else {
393
+                $this->results = $wpdb->get_col( $this->request );
394
+            }
395
+
396
+            if ( isset( $qv['count_total'] ) && $qv['count_total'] ) {
397
+                $found_subscriptions_query = apply_filters( 'getpaid_found_subscriptions_query', 'SELECT FOUND_ROWS()', $this );
398
+                $this->total_subscriptions   = (int) $wpdb->get_var( $found_subscriptions_query );
399
+            }
400
+        }
401
+
402
+        if ( 'all' == $qv['fields'] ) {
403
+            foreach ( $this->results as $key => $subscription ) {
404
+                $this->set_cache( $subscription->id, $subscription, 'getpaid_subscriptions' );
405
+                $this->set_cache( $subscription->profile_id, $subscription->id, 'getpaid_subscription_profile_ids_to_subscription_ids' );
406
+                $this->set_cache( $subscription->transaction_id, $subscription->id, 'getpaid_subscription_transaction_ids_to_subscription_ids' );
407
+                $this->set_cache( $subscription->transaction_id, $subscription->id, 'getpaid_subscription_transaction_ids_to_subscription_ids' );
408
+                $this->results[ $key ] = new WPInv_Subscription( $subscription );
409
+            }
410
+        }
411
+
412
+    }
413
+
414
+    /**
415
+     * Set cache
416
+     *
417
+     * @param string  $id
418
+     * @param mixed   $data
419
+     * @param string  $group
420
+     * @param integer $expire
421
+     * @return boolean
422
+     */
423
+    public function set_cache( $key, $data, $group = '', $expire = 0 ) {
424
+
425
+        if ( empty( $key ) ) {
426
+            return false;
427
+        }
428
+
429
+        wp_cache_set( $key, $data, $group, $expire );
430
+    }
431
+
432
+    /**
433
+     * Retrieve query variable.
434
+     *
435
+     * @since 1.0.19
436
+     *
437
+     * @param string $query_var Query variable key.
438
+     * @return mixed
439
+     */
440
+    public function get( $query_var ) {
441
+        if ( isset( $this->query_vars[ $query_var ] ) ) {
442
+            return $this->query_vars[ $query_var ];
443
+        }
444
+
445
+        return null;
446
+    }
447
+
448
+    /**
449
+     * Set query variable.
450
+     *
451
+     * @since 1.0.19
452
+     *
453
+     * @param string $query_var Query variable key.
454
+     * @param mixed $value Query variable value.
455
+     */
456
+    public function set( $query_var, $value ) {
457
+        $this->query_vars[ $query_var ] = $value;
458
+    }
459
+
460
+    /**
461
+     * Return the list of subscriptions.
462
+     *
463
+     * @since 1.0.19
464
+     *
465
+     * @return WPInv_Subscription[]|array Found subscriptions.
466
+     */
467
+    public function get_results() {
468
+        return $this->results;
469
+    }
470
+
471
+    /**
472
+     * Return the total number of subscriptions for the current query.
473
+     *
474
+     * @since 1.0.19
475
+     *
476
+     * @return int Number of total subscriptions.
477
+     */
478
+    public function get_total() {
479
+        return $this->total_subscriptions;
480
+    }
481
+
482
+    /**
483
+     * Parse and sanitize 'orderby' keys passed to the subscriptions query.
484
+     *
485
+     * @since 1.0.19
486
+     *
487
+     * @param string $orderby Alias for the field to order by.
488
+     *  @param string $table The current table.
489
+     * @return string Value to use in the ORDER clause, if `$orderby` is valid.
490
+     */
491
+    protected function parse_orderby( $orderby, $table ) {
492
+
493
+        $_orderby = '';
494
+        if ( in_array( $orderby, array( 'customer_id', 'frequency', 'period', 'initial_amount', 'recurring_amount', 'bill_times', 'transaction_id', 'parent_payment_id', 'product_id', 'created', 'expiration', 'trial_period', 'status', 'profile_id' ) ) ) {
495
+            $_orderby = "$table.`$orderby`";
496
+        } elseif ( 'id' === strtolower( $orderby ) ) {
497
+            $_orderby = "$table.id";
498
+        } elseif ( 'include' === $orderby && ! empty( $this->query_vars['include'] ) ) {
499
+            $include     = wp_parse_id_list( $this->query_vars['include'] );
500
+            $include_sql = implode( ',', $include );
501
+            $_orderby    = "FIELD( $table.id, $include_sql )";
502
+        }
503
+
504
+        return $_orderby;
505
+    }
506
+
507
+    /**
508
+     * Parse an 'order' query variable and cast it to ASC or DESC as necessary.
509
+     *
510
+     * @since 1.0.19
511
+     *
512
+     * @param string $order The 'order' query variable.
513
+     * @return string The sanitized 'order' query variable.
514
+     */
515
+    protected function parse_order( $order ) {
516
+        if ( ! is_string( $order ) || empty( $order ) ) {
517
+            return 'DESC';
518
+        }
519
+
520
+        if ( 'ASC' === strtoupper( $order ) ) {
521
+            return 'ASC';
522
+        } else {
523
+            return 'DESC';
524
+        }
525
+    }
526 526
 
527 527
 }
Please login to merge, or discard this patch.
includes/class-wpinv-invoice.php 1 patch
Indentation   +2656 added lines, -2656 removed lines patch added patch discarded remove patch
@@ -14,30 +14,30 @@  discard block
 block discarded – undo
14 14
 class WPInv_Invoice extends GetPaid_Data {
15 15
 
16 16
     /**
17
-	 * Which data store to load.
18
-	 *
19
-	 * @var string
20
-	 */
17
+     * Which data store to load.
18
+     *
19
+     * @var string
20
+     */
21 21
     protected $data_store_name = 'invoice';
22 22
 
23 23
     /**
24
-	 * This is the name of this object type.
25
-	 *
26
-	 * @var string
27
-	 */
24
+     * This is the name of this object type.
25
+     *
26
+     * @var string
27
+     */
28 28
     protected $object_type = 'invoice';
29 29
 
30 30
     /**
31
-	 * Item Data array. This is the core item data exposed in APIs.
32
-	 *
33
-	 * @since 1.0.19
34
-	 * @var array
35
-	 */
36
-	protected $data = array(
37
-		'parent_id'              => 0,
38
-		'status'                 => 'wpi-pending',
39
-		'version'                => '',
40
-		'date_created'           => null,
31
+     * Item Data array. This is the core item data exposed in APIs.
32
+     *
33
+     * @since 1.0.19
34
+     * @var array
35
+     */
36
+    protected $data = array(
37
+        'parent_id'              => 0,
38
+        'status'                 => 'wpi-pending',
39
+        'version'                => '',
40
+        'date_created'           => null,
41 41
         'date_modified'          => null,
42 42
         'due_date'               => null,
43 43
         'completed_date'         => null,
@@ -60,17 +60,17 @@  discard block
 block discarded – undo
60 60
         'state'                  => null,
61 61
         'zip'                    => null,
62 62
         'company'                => null,
63
-		'company_id'             => null,
63
+        'company_id'             => null,
64 64
         'vat_number'             => null,
65 65
         'vat_rate'               => null,
66 66
         'address'                => null,
67 67
         'address_confirmed'      => false,
68 68
         'shipping'               => null,
69
-		'subtotal'               => 0,
69
+        'subtotal'               => 0,
70 70
         'total_discount'         => 0,
71 71
         'total_tax'              => 0,
72
-		'total_fees'             => 0,
73
-		'total'                  => 0,
72
+        'total_fees'             => 0,
73
+        'total'                  => 0,
74 74
         'fees'                   => array(),
75 75
         'discounts'              => array(),
76 76
         'taxes'                  => array(),
@@ -82,22 +82,22 @@  discard block
 block discarded – undo
82 82
         'transaction_id'         => '',
83 83
         'currency'               => '',
84 84
         'disable_taxes'          => false,
85
-		'subscription_id'        => null,
86
-		'remote_subscription_id' => null,
87
-		'is_viewed'              => false,
88
-		'email_cc'               => '',
89
-		'template'               => 'quantity', // hours, amount only
90
-		'created_via'            => null,
85
+        'subscription_id'        => null,
86
+        'remote_subscription_id' => null,
87
+        'is_viewed'              => false,
88
+        'email_cc'               => '',
89
+        'template'               => 'quantity', // hours, amount only
90
+        'created_via'            => null,
91 91
     );
92 92
 
93 93
     /**
94
-	 * Stores meta in cache for future reads.
95
-	 *
96
-	 * A group must be set to to enable caching.
97
-	 *
98
-	 * @var string
99
-	 */
100
-	protected $cache_group = 'getpaid_invoices';
94
+     * Stores meta in cache for future reads.
95
+     *
96
+     * A group must be set to to enable caching.
97
+     *
98
+     * @var string
99
+     */
100
+    protected $cache_group = 'getpaid_invoices';
101 101
 
102 102
     /**
103 103
      * Stores a reference to the original WP_Post object
@@ -111,110 +111,110 @@  discard block
 block discarded – undo
111 111
      *
112 112
      * @var int
113 113
      */
114
-	protected $recurring_item = null;
114
+    protected $recurring_item = null;
115 115
 
116
-	/**
116
+    /**
117 117
      * Stores an array of item totals.
118
-	 *
119
-	 * e.g $totals['discount'] = array(
120
-	 *      'initial'   => 10,
121
-	 *      'recurring' => 10,
122
-	 * )
118
+     *
119
+     * e.g $totals['discount'] = array(
120
+     *      'initial'   => 10,
121
+     *      'recurring' => 10,
122
+     * )
123 123
      *
124 124
      * @var array
125 125
      */
126
-	protected $totals = array();
126
+    protected $totals = array();
127 127
 
128
-	/**
128
+    /**
129 129
      * Tax rate.
130
-	 *
130
+     *
131 131
      * @var float
132 132
      */
133
-	protected $tax_rate = 0;
133
+    protected $tax_rate = 0;
134 134
 
135
-	/**
136
-	 * Stores the status transition information.
137
-	 *
138
-	 * @since 1.0.19
139
-	 * @var bool|array
140
-	 */
141
-	protected $status_transition = false;
135
+    /**
136
+     * Stores the status transition information.
137
+     *
138
+     * @since 1.0.19
139
+     * @var bool|array
140
+     */
141
+    protected $status_transition = false;
142 142
 
143 143
     /**
144
-	 * Get the invoice if ID is passed, otherwise the invoice is new and empty.
145
-	 *
146
-	 * @param  int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object to read.
147
-	 */
144
+     * Get the invoice if ID is passed, otherwise the invoice is new and empty.
145
+     *
146
+     * @param  int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object to read.
147
+     */
148 148
     public function __construct( $invoice = 0 ) {
149 149
 
150 150
         parent::__construct( $invoice );
151 151
 
152
-		if ( ! empty( $invoice ) && is_numeric( $invoice ) && getpaid_is_invoice_post_type( get_post_type( (int) $invoice ) ) ) {
153
-			$this->set_id( (int) $invoice );
154
-		} elseif ( $invoice instanceof self ) {
155
-			$this->set_id( $invoice->get_id() );
156
-		} elseif ( ! empty( $invoice->ID ) ) {
157
-			$this->set_id( $invoice->ID );
158
-		} elseif ( is_array( $invoice ) ) {
159
-			$this->set_props( $invoice );
160
-
161
-			if ( isset( $invoice['ID'] ) ) {
162
-				$this->set_id( $invoice['ID'] );
163
-			}
152
+        if ( ! empty( $invoice ) && is_numeric( $invoice ) && getpaid_is_invoice_post_type( get_post_type( (int) $invoice ) ) ) {
153
+            $this->set_id( (int) $invoice );
154
+        } elseif ( $invoice instanceof self ) {
155
+            $this->set_id( $invoice->get_id() );
156
+        } elseif ( ! empty( $invoice->ID ) ) {
157
+            $this->set_id( $invoice->ID );
158
+        } elseif ( is_array( $invoice ) ) {
159
+            $this->set_props( $invoice );
160
+
161
+            if ( isset( $invoice['ID'] ) ) {
162
+                $this->set_id( $invoice['ID'] );
163
+            }
164 164
 } elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'key' ) ) {
165
-			$this->set_id( $invoice_id );
166
-		} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'number' ) ) {
167
-			$this->set_id( $invoice_id );
168
-		} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'transaction_id' ) ) {
169
-			$this->set_id( $invoice_id );
170
-		} else {
171
-			$this->set_object_read( true );
172
-		}
165
+            $this->set_id( $invoice_id );
166
+        } elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'number' ) ) {
167
+            $this->set_id( $invoice_id );
168
+        } elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'transaction_id' ) ) {
169
+            $this->set_id( $invoice_id );
170
+        } else {
171
+            $this->set_object_read( true );
172
+        }
173 173
 
174 174
         // Load the datastore.
175
-		$this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
175
+        $this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
176 176
 
177
-		if ( $this->get_id() > 0 ) {
177
+        if ( $this->get_id() > 0 ) {
178 178
             $this->post = get_post( $this->get_id() );
179 179
             $this->ID   = $this->get_id();
180
-			$this->data_store->read( $this );
180
+            $this->data_store->read( $this );
181 181
         }
182 182
 
183 183
     }
184 184
 
185 185
     /**
186
-	 * Given an invoice key/number, it returns its id.
187
-	 *
188
-	 *
189
-	 * @static
190
-	 * @param string $value The invoice key or number
191
-	 * @param string $field Either key, transaction_id or number.
192
-	 * @since 1.0.15
193
-	 * @return int
194
-	 */
195
-	public static function get_invoice_id_by_field( $value, $field = 'key' ) {
186
+     * Given an invoice key/number, it returns its id.
187
+     *
188
+     *
189
+     * @static
190
+     * @param string $value The invoice key or number
191
+     * @param string $field Either key, transaction_id or number.
192
+     * @since 1.0.15
193
+     * @return int
194
+     */
195
+    public static function get_invoice_id_by_field( $value, $field = 'key' ) {
196 196
         global $wpdb;
197 197
 
198
-		// Trim the value.
199
-		$value = trim( $value );
198
+        // Trim the value.
199
+        $value = trim( $value );
200 200
 
201
-		if ( empty( $value ) ) {
202
-			return 0;
203
-		}
201
+        if ( empty( $value ) ) {
202
+            return 0;
203
+        }
204 204
 
205 205
         // Valid fields.
206 206
         $fields = array( 'key', 'number', 'transaction_id' );
207 207
 
208
-		// Ensure a field has been passed.
209
-		if ( empty( $field ) || ! in_array( $field, $fields ) ) {
210
-			return 0;
211
-		}
208
+        // Ensure a field has been passed.
209
+        if ( empty( $field ) || ! in_array( $field, $fields ) ) {
210
+            return 0;
211
+        }
212 212
 
213
-		// Maybe retrieve from the cache.
214
-		$invoice_id   = wp_cache_get( $value, "getpaid_invoice_{$field}s_to_invoice_ids" );
215
-		if ( false !== $invoice_id ) {
216
-			return $invoice_id;
217
-		}
213
+        // Maybe retrieve from the cache.
214
+        $invoice_id   = wp_cache_get( $value, "getpaid_invoice_{$field}s_to_invoice_ids" );
215
+        if ( false !== $invoice_id ) {
216
+            return $invoice_id;
217
+        }
218 218
 
219 219
         // Fetch from the db.
220 220
         $table       = $wpdb->prefix . 'getpaid_invoices';
@@ -222,10 +222,10 @@  discard block
 block discarded – undo
222 222
             $wpdb->prepare( "SELECT `post_id` FROM $table WHERE `$field`=%s LIMIT 1", $value )
223 223
         );
224 224
 
225
-		// Update the cache with our data
226
-		wp_cache_set( $value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids" );
225
+        // Update the cache with our data
226
+        wp_cache_set( $value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids" );
227 227
 
228
-		return $invoice_id;
228
+        return $invoice_id;
229 229
     }
230 230
 
231 231
     /**
@@ -251,83 +251,83 @@  discard block
 block discarded – undo
251 251
     */
252 252
 
253 253
     /**
254
-	 * Get parent invoice ID.
255
-	 *
256
-	 * @since 1.0.19
257
-	 * @param  string $context View or edit context.
258
-	 * @return int
259
-	 */
260
-	public function get_parent_id( $context = 'view' ) {
261
-		return (int) $this->get_prop( 'parent_id', $context );
254
+     * Get parent invoice ID.
255
+     *
256
+     * @since 1.0.19
257
+     * @param  string $context View or edit context.
258
+     * @return int
259
+     */
260
+    public function get_parent_id( $context = 'view' ) {
261
+        return (int) $this->get_prop( 'parent_id', $context );
262 262
     }
263 263
 
264 264
     /**
265
-	 * Get parent invoice.
266
-	 *
267
-	 * @since 1.0.19
268
-	 * @return WPInv_Invoice
269
-	 */
265
+     * Get parent invoice.
266
+     *
267
+     * @since 1.0.19
268
+     * @return WPInv_Invoice
269
+     */
270 270
     public function get_parent_payment() {
271 271
         return new WPInv_Invoice( $this->get_parent_id() );
272 272
     }
273 273
 
274 274
     /**
275
-	 * Alias for self::get_parent_payment().
276
-	 *
277
-	 * @since 1.0.19
278
-	 * @return WPInv_Invoice
279
-	 */
275
+     * Alias for self::get_parent_payment().
276
+     *
277
+     * @since 1.0.19
278
+     * @return WPInv_Invoice
279
+     */
280 280
     public function get_parent() {
281 281
         return $this->get_parent_payment();
282 282
     }
283 283
 
284 284
     /**
285
-	 * Get invoice status.
286
-	 *
287
-	 * @since 1.0.19
288
-	 * @param  string $context View or edit context.
289
-	 * @return string
290
-	 */
291
-	public function get_status( $context = 'view' ) {
292
-		return $this->get_prop( 'status', $context );
293
-	}
285
+     * Get invoice status.
286
+     *
287
+     * @since 1.0.19
288
+     * @param  string $context View or edit context.
289
+     * @return string
290
+     */
291
+    public function get_status( $context = 'view' ) {
292
+        return $this->get_prop( 'status', $context );
293
+    }
294 294
 
295
-	/**
296
-	 * Retrieves an array of possible invoice statuses.
297
-	 *
298
-	 * @since 1.0.19
299
-	 * @return array
300
-	 */
301
-	public function get_all_statuses() {
302
-		return wpinv_get_invoice_statuses( true, true, $this );
295
+    /**
296
+     * Retrieves an array of possible invoice statuses.
297
+     *
298
+     * @since 1.0.19
299
+     * @return array
300
+     */
301
+    public function get_all_statuses() {
302
+        return wpinv_get_invoice_statuses( true, true, $this );
303 303
     }
304 304
 
305 305
     /**
306
-	 * Get invoice status nice name.
307
-	 *
308
-	 * @since 1.0.19
309
-	 * @return string
310
-	 */
306
+     * Get invoice status nice name.
307
+     *
308
+     * @since 1.0.19
309
+     * @return string
310
+     */
311 311
     public function get_status_nicename() {
312
-		$statuses = $this->get_all_statuses();
312
+        $statuses = $this->get_all_statuses();
313 313
 
314 314
         $status = isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : $this->get_status();
315 315
 
316 316
         return apply_filters( 'wpinv_get_invoice_status_nicename', $status, $this );
317 317
     }
318 318
 
319
-	/**
320
-	 * Retrieves the invoice status class
321
-	 *
322
-	 * @since  1.0.19
323
-	 * @return string
324
-	 */
325
-	public function get_status_class() {
326
-		$statuses = getpaid_get_invoice_status_classes();
327
-		return isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : 'badge-dark';
328
-	}
319
+    /**
320
+     * Retrieves the invoice status class
321
+     *
322
+     * @since  1.0.19
323
+     * @return string
324
+     */
325
+    public function get_status_class() {
326
+        $statuses = getpaid_get_invoice_status_classes();
327
+        return isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : 'badge-dark';
328
+    }
329 329
 
330
-	/**
330
+    /**
331 331
      * Retrieves the invoice status label html
332 332
      *
333 333
      * @since  1.0.0
@@ -335,263 +335,263 @@  discard block
 block discarded – undo
335 335
      */
336 336
     public function get_status_label_html() {
337 337
 
338
-		$status_label = sanitize_text_field( $this->get_status_nicename() );
339
-		$status       = sanitize_html_class( $this->get_status() );
340
-		$class        = esc_attr( $this->get_status_class() );
341
-
342
-		return "<span class='bsui'><span class='badge $class $status'>$status_label</span></span>";
343
-	}
344
-
345
-    /**
346
-	 * Get plugin version when the invoice was created.
347
-	 *
348
-	 * @since 1.0.19
349
-	 * @param  string $context View or edit context.
350
-	 * @return string
351
-	 */
352
-	public function get_version( $context = 'view' ) {
353
-		return $this->get_prop( 'version', $context );
354
-	}
355
-
356
-	/**
357
-	 * @deprecated
358
-	 */
359
-	public function get_invoice_date( $format = true ) {
360
-		$date      = getpaid_format_date( $this->get_date_completed() );
361
-		$date      = empty( $date ) ? $this->get_date_created() : $this->get_date_completed();
362
-		$formatted = getpaid_format_date( $date );
363
-
364
-		if ( $format ) {
365
-			return $formatted;
366
-		}
367
-
368
-		return empty( $formatted ) ? '' : $date;
369
-
370
-    }
371
-
372
-    /**
373
-	 * Get date when the invoice was created.
374
-	 *
375
-	 * @since 1.0.19
376
-	 * @param  string $context View or edit context.
377
-	 * @return string
378
-	 */
379
-	public function get_date_created( $context = 'view' ) {
380
-		return $this->get_prop( 'date_created', $context );
381
-	}
382
-
383
-	/**
384
-	 * Alias for self::get_date_created().
385
-	 *
386
-	 * @since 1.0.19
387
-	 * @param  string $context View or edit context.
388
-	 * @return string
389
-	 */
390
-	public function get_created_date( $context = 'view' ) {
391
-		return $this->get_date_created( $context );
392
-    }
393
-
394
-    /**
395
-	 * Get GMT date when the invoice was created.
396
-	 *
397
-	 * @since 1.0.19
398
-	 * @param  string $context View or edit context.
399
-	 * @return string
400
-	 */
401
-	public function get_date_created_gmt( $context = 'view' ) {
338
+        $status_label = sanitize_text_field( $this->get_status_nicename() );
339
+        $status       = sanitize_html_class( $this->get_status() );
340
+        $class        = esc_attr( $this->get_status_class() );
341
+
342
+        return "<span class='bsui'><span class='badge $class $status'>$status_label</span></span>";
343
+    }
344
+
345
+    /**
346
+     * Get plugin version when the invoice was created.
347
+     *
348
+     * @since 1.0.19
349
+     * @param  string $context View or edit context.
350
+     * @return string
351
+     */
352
+    public function get_version( $context = 'view' ) {
353
+        return $this->get_prop( 'version', $context );
354
+    }
355
+
356
+    /**
357
+     * @deprecated
358
+     */
359
+    public function get_invoice_date( $format = true ) {
360
+        $date      = getpaid_format_date( $this->get_date_completed() );
361
+        $date      = empty( $date ) ? $this->get_date_created() : $this->get_date_completed();
362
+        $formatted = getpaid_format_date( $date );
363
+
364
+        if ( $format ) {
365
+            return $formatted;
366
+        }
367
+
368
+        return empty( $formatted ) ? '' : $date;
369
+
370
+    }
371
+
372
+    /**
373
+     * Get date when the invoice was created.
374
+     *
375
+     * @since 1.0.19
376
+     * @param  string $context View or edit context.
377
+     * @return string
378
+     */
379
+    public function get_date_created( $context = 'view' ) {
380
+        return $this->get_prop( 'date_created', $context );
381
+    }
382
+
383
+    /**
384
+     * Alias for self::get_date_created().
385
+     *
386
+     * @since 1.0.19
387
+     * @param  string $context View or edit context.
388
+     * @return string
389
+     */
390
+    public function get_created_date( $context = 'view' ) {
391
+        return $this->get_date_created( $context );
392
+    }
393
+
394
+    /**
395
+     * Get GMT date when the invoice was created.
396
+     *
397
+     * @since 1.0.19
398
+     * @param  string $context View or edit context.
399
+     * @return string
400
+     */
401
+    public function get_date_created_gmt( $context = 'view' ) {
402 402
         $date = $this->get_date_created( $context );
403 403
 
404 404
         if ( $date ) {
405 405
             $date = get_gmt_from_date( $date );
406 406
         }
407
-		return $date;
407
+        return $date;
408 408
     }
409 409
 
410 410
     /**
411
-	 * Get date when the invoice was last modified.
412
-	 *
413
-	 * @since 1.0.19
414
-	 * @param  string $context View or edit context.
415
-	 * @return string
416
-	 */
417
-	public function get_date_modified( $context = 'view' ) {
418
-		return $this->get_prop( 'date_modified', $context );
419
-	}
411
+     * Get date when the invoice was last modified.
412
+     *
413
+     * @since 1.0.19
414
+     * @param  string $context View or edit context.
415
+     * @return string
416
+     */
417
+    public function get_date_modified( $context = 'view' ) {
418
+        return $this->get_prop( 'date_modified', $context );
419
+    }
420 420
 
421
-	/**
422
-	 * Alias for self::get_date_modified().
423
-	 *
424
-	 * @since 1.0.19
425
-	 * @param  string $context View or edit context.
426
-	 * @return string
427
-	 */
428
-	public function get_modified_date( $context = 'view' ) {
429
-		return $this->get_date_modified( $context );
421
+    /**
422
+     * Alias for self::get_date_modified().
423
+     *
424
+     * @since 1.0.19
425
+     * @param  string $context View or edit context.
426
+     * @return string
427
+     */
428
+    public function get_modified_date( $context = 'view' ) {
429
+        return $this->get_date_modified( $context );
430 430
     }
431 431
 
432 432
     /**
433
-	 * Get GMT date when the invoice was last modified.
434
-	 *
435
-	 * @since 1.0.19
436
-	 * @param  string $context View or edit context.
437
-	 * @return string
438
-	 */
439
-	public function get_date_modified_gmt( $context = 'view' ) {
433
+     * Get GMT date when the invoice was last modified.
434
+     *
435
+     * @since 1.0.19
436
+     * @param  string $context View or edit context.
437
+     * @return string
438
+     */
439
+    public function get_date_modified_gmt( $context = 'view' ) {
440 440
         $date = $this->get_date_modified( $context );
441 441
 
442 442
         if ( $date ) {
443 443
             $date = get_gmt_from_date( $date );
444 444
         }
445
-		return $date;
445
+        return $date;
446 446
     }
447 447
 
448 448
     /**
449
-	 * Get the invoice due date.
450
-	 *
451
-	 * @since 1.0.19
452
-	 * @param  string $context View or edit context.
453
-	 * @return string
454
-	 */
455
-	public function get_due_date( $context = 'view' ) {
456
-		return $this->get_prop( 'due_date', $context );
449
+     * Get the invoice due date.
450
+     *
451
+     * @since 1.0.19
452
+     * @param  string $context View or edit context.
453
+     * @return string
454
+     */
455
+    public function get_due_date( $context = 'view' ) {
456
+        return $this->get_prop( 'due_date', $context );
457 457
     }
458 458
 
459 459
     /**
460
-	 * Alias for self::get_due_date().
461
-	 *
462
-	 * @since 1.0.19
463
-	 * @param  string $context View or edit context.
464
-	 * @return string
465
-	 */
466
-	public function get_date_due( $context = 'view' ) {
467
-		return $this->get_due_date( $context );
460
+     * Alias for self::get_due_date().
461
+     *
462
+     * @since 1.0.19
463
+     * @param  string $context View or edit context.
464
+     * @return string
465
+     */
466
+    public function get_date_due( $context = 'view' ) {
467
+        return $this->get_due_date( $context );
468 468
     }
469 469
 
470 470
     /**
471
-	 * Get the invoice GMT due date.
472
-	 *
473
-	 * @since 1.0.19
474
-	 * @param  string $context View or edit context.
475
-	 * @return string
476
-	 */
477
-	public function get_due_date_gmt( $context = 'view' ) {
471
+     * Get the invoice GMT due date.
472
+     *
473
+     * @since 1.0.19
474
+     * @param  string $context View or edit context.
475
+     * @return string
476
+     */
477
+    public function get_due_date_gmt( $context = 'view' ) {
478 478
         $date = $this->get_due_date( $context );
479 479
 
480 480
         if ( $date ) {
481 481
             $date = get_gmt_from_date( $date );
482 482
         }
483
-		return $date;
483
+        return $date;
484 484
     }
485 485
 
486 486
     /**
487
-	 * Alias for self::get_due_date_gmt().
488
-	 *
489
-	 * @since 1.0.19
490
-	 * @param  string $context View or edit context.
491
-	 * @return string
492
-	 */
493
-	public function get_gmt_date_due( $context = 'view' ) {
494
-		return $this->get_due_date_gmt( $context );
487
+     * Alias for self::get_due_date_gmt().
488
+     *
489
+     * @since 1.0.19
490
+     * @param  string $context View or edit context.
491
+     * @return string
492
+     */
493
+    public function get_gmt_date_due( $context = 'view' ) {
494
+        return $this->get_due_date_gmt( $context );
495 495
     }
496 496
 
497 497
     /**
498
-	 * Get date when the invoice was completed.
499
-	 *
500
-	 * @since 1.0.19
501
-	 * @param  string $context View or edit context.
502
-	 * @return string
503
-	 */
504
-	public function get_completed_date( $context = 'view' ) {
505
-		return $this->get_prop( 'completed_date', $context );
498
+     * Get date when the invoice was completed.
499
+     *
500
+     * @since 1.0.19
501
+     * @param  string $context View or edit context.
502
+     * @return string
503
+     */
504
+    public function get_completed_date( $context = 'view' ) {
505
+        return $this->get_prop( 'completed_date', $context );
506 506
     }
507 507
 
508 508
     /**
509
-	 * Alias for self::get_completed_date().
510
-	 *
511
-	 * @since 1.0.19
512
-	 * @param  string $context View or edit context.
513
-	 * @return string
514
-	 */
515
-	public function get_date_completed( $context = 'view' ) {
516
-		return $this->get_completed_date( $context );
509
+     * Alias for self::get_completed_date().
510
+     *
511
+     * @since 1.0.19
512
+     * @param  string $context View or edit context.
513
+     * @return string
514
+     */
515
+    public function get_date_completed( $context = 'view' ) {
516
+        return $this->get_completed_date( $context );
517 517
     }
518 518
 
519 519
     /**
520
-	 * Get GMT date when the invoice was was completed.
521
-	 *
522
-	 * @since 1.0.19
523
-	 * @param  string $context View or edit context.
524
-	 * @return string
525
-	 */
526
-	public function get_completed_date_gmt( $context = 'view' ) {
520
+     * Get GMT date when the invoice was was completed.
521
+     *
522
+     * @since 1.0.19
523
+     * @param  string $context View or edit context.
524
+     * @return string
525
+     */
526
+    public function get_completed_date_gmt( $context = 'view' ) {
527 527
         $date = $this->get_completed_date( $context );
528 528
 
529 529
         if ( $date ) {
530 530
             $date = get_gmt_from_date( $date );
531 531
         }
532
-		return $date;
532
+        return $date;
533 533
     }
534 534
 
535 535
     /**
536
-	 * Alias for self::get_completed_date_gmt().
537
-	 *
538
-	 * @since 1.0.19
539
-	 * @param  string $context View or edit context.
540
-	 * @return string
541
-	 */
542
-	public function get_gmt_completed_date( $context = 'view' ) {
543
-		return $this->get_completed_date_gmt( $context );
536
+     * Alias for self::get_completed_date_gmt().
537
+     *
538
+     * @since 1.0.19
539
+     * @param  string $context View or edit context.
540
+     * @return string
541
+     */
542
+    public function get_gmt_completed_date( $context = 'view' ) {
543
+        return $this->get_completed_date_gmt( $context );
544 544
     }
545 545
 
546 546
     /**
547
-	 * Get the invoice number.
548
-	 *
549
-	 * @since 1.0.19
550
-	 * @param  string $context View or edit context.
551
-	 * @return string
552
-	 */
553
-	public function get_number( $context = 'view' ) {
554
-		$number = $this->get_prop( 'number', $context );
547
+     * Get the invoice number.
548
+     *
549
+     * @since 1.0.19
550
+     * @param  string $context View or edit context.
551
+     * @return string
552
+     */
553
+    public function get_number( $context = 'view' ) {
554
+        $number = $this->get_prop( 'number', $context );
555 555
 
556
-		if ( empty( $number ) ) {
557
-			$number = $this->generate_number();
558
-			$this->set_number( $this->generate_number() );
559
-		}
556
+        if ( empty( $number ) ) {
557
+            $number = $this->generate_number();
558
+            $this->set_number( $this->generate_number() );
559
+        }
560 560
 
561
-		return $number;
561
+        return $number;
562 562
     }
563 563
 
564
-	/**
565
-	 * Set the invoice number.
566
-	 *
567
-	 * @since 1.0.19
568
-	 */
569
-	public function maybe_set_number() {
564
+    /**
565
+     * Set the invoice number.
566
+     *
567
+     * @since 1.0.19
568
+     */
569
+    public function maybe_set_number() {
570 570
         $number = $this->get_number();
571 571
 
572 572
         if ( empty( $number ) || $this->get_id() == $number ) {
573
-			$this->set_number( $this->generate_number() );
573
+            $this->set_number( $this->generate_number() );
574 574
         }
575 575
 
576
-	}
576
+    }
577 577
 
578 578
     /**
579
-	 * Get the invoice key.
580
-	 *
581
-	 * @since 1.0.19
582
-	 * @param  string $context View or edit context.
583
-	 * @return string
584
-	 */
585
-	public function get_key( $context = 'view' ) {
579
+     * Get the invoice key.
580
+     *
581
+     * @since 1.0.19
582
+     * @param  string $context View or edit context.
583
+     * @return string
584
+     */
585
+    public function get_key( $context = 'view' ) {
586 586
         return $this->get_prop( 'key', $context );
587
-	}
588
-
589
-	/**
590
-	 * Set the invoice key.
591
-	 *
592
-	 * @since 1.0.19
593
-	 */
594
-	public function maybe_set_key() {
587
+    }
588
+
589
+    /**
590
+     * Set the invoice key.
591
+     *
592
+     * @since 1.0.19
593
+     */
594
+    public function maybe_set_key() {
595 595
         $key = $this->get_key();
596 596
 
597 597
         if ( empty( $key ) ) {
@@ -602,140 +602,140 @@  discard block
 block discarded – undo
602 602
     }
603 603
 
604 604
     /**
605
-	 * Get the invoice type.
606
-	 *
607
-	 * @since 1.0.19
608
-	 * @param  string $context View or edit context.
609
-	 * @return string
610
-	 */
611
-	public function get_type( $context = 'view' ) {
605
+     * Get the invoice type.
606
+     *
607
+     * @since 1.0.19
608
+     * @param  string $context View or edit context.
609
+     * @return string
610
+     */
611
+    public function get_type( $context = 'view' ) {
612 612
         return $this->get_prop( 'type', $context );
613
-	}
614
-
615
-	/**
616
-	 * Returns the post type name.
617
-	 *
618
-	 * @since 1.0.19
619
-	 * @return string
620
-	 */
621
-	public function get_invoice_quote_type() {
613
+    }
614
+
615
+    /**
616
+     * Returns the post type name.
617
+     *
618
+     * @since 1.0.19
619
+     * @return string
620
+     */
621
+    public function get_invoice_quote_type() {
622 622
         return getpaid_get_post_type_label( $this->get_post_type(), false );
623 623
     }
624 624
 
625 625
     /**
626
-	 * Get the invoice post type label.
627
-	 *
628
-	 * @since 1.0.19
629
-	 * @param  string $context View or edit context.
630
-	 * @return string
631
-	 */
632
-	public function get_label( $context = 'view' ) {
626
+     * Get the invoice post type label.
627
+     *
628
+     * @since 1.0.19
629
+     * @param  string $context View or edit context.
630
+     * @return string
631
+     */
632
+    public function get_label( $context = 'view' ) {
633 633
         return getpaid_get_post_type_label( $this->get_post_type( $context ), false );
634
-	}
635
-
636
-	/**
637
-	 * Get the invoice post type.
638
-	 *
639
-	 * @since 1.0.19
640
-	 * @param  string $context View or edit context.
641
-	 * @return string
642
-	 */
643
-	public function get_post_type( $context = 'view' ) {
634
+    }
635
+
636
+    /**
637
+     * Get the invoice post type.
638
+     *
639
+     * @since 1.0.19
640
+     * @param  string $context View or edit context.
641
+     * @return string
642
+     */
643
+    public function get_post_type( $context = 'view' ) {
644 644
         return $this->get_prop( 'post_type', $context );
645 645
     }
646 646
 
647 647
     /**
648
-	 * Get the invoice mode.
649
-	 *
650
-	 * @since 1.0.19
651
-	 * @param  string $context View or edit context.
652
-	 * @return string
653
-	 */
654
-	public function get_mode( $context = 'view' ) {
648
+     * Get the invoice mode.
649
+     *
650
+     * @since 1.0.19
651
+     * @param  string $context View or edit context.
652
+     * @return string
653
+     */
654
+    public function get_mode( $context = 'view' ) {
655 655
         return $this->get_prop( 'mode', $context );
656 656
     }
657 657
 
658 658
     /**
659
-	 * Get the invoice path.
660
-	 *
661
-	 * @since 1.0.19
662
-	 * @param  string $context View or edit context.
663
-	 * @return string
664
-	 */
665
-	public function get_path( $context = 'view' ) {
659
+     * Get the invoice path.
660
+     *
661
+     * @since 1.0.19
662
+     * @param  string $context View or edit context.
663
+     * @return string
664
+     */
665
+    public function get_path( $context = 'view' ) {
666 666
         $path   = $this->get_prop( 'path', $context );
667
-		$prefix = $this->get_type();
667
+        $prefix = $this->get_type();
668 668
 
669
-		if ( 0 !== strpos( $path, $prefix ) ) {
670
-			$path = sanitize_title( $prefix . '-' . $this->get_id() );
671
-			$this->set_path( $path );
672
-		}
669
+        if ( 0 !== strpos( $path, $prefix ) ) {
670
+            $path = sanitize_title( $prefix . '-' . $this->get_id() );
671
+            $this->set_path( $path );
672
+        }
673 673
 
674
-		return $path;
674
+        return $path;
675 675
     }
676 676
 
677 677
     /**
678
-	 * Get the invoice name/title.
679
-	 *
680
-	 * @since 1.0.19
681
-	 * @param  string $context View or edit context.
682
-	 * @return string
683
-	 */
684
-	public function get_name( $context = 'view' ) {
678
+     * Get the invoice name/title.
679
+     *
680
+     * @since 1.0.19
681
+     * @param  string $context View or edit context.
682
+     * @return string
683
+     */
684
+    public function get_name( $context = 'view' ) {
685 685
         return $this->get_prop( 'title', $context );
686 686
     }
687 687
 
688 688
     /**
689
-	 * Alias of self::get_name().
690
-	 *
691
-	 * @since 1.0.19
692
-	 * @param  string $context View or edit context.
693
-	 * @return string
694
-	 */
695
-	public function get_title( $context = 'view' ) {
696
-		return $this->get_name( $context );
689
+     * Alias of self::get_name().
690
+     *
691
+     * @since 1.0.19
692
+     * @param  string $context View or edit context.
693
+     * @return string
694
+     */
695
+    public function get_title( $context = 'view' ) {
696
+        return $this->get_name( $context );
697 697
     }
698 698
 
699 699
     /**
700
-	 * Get the invoice description.
701
-	 *
702
-	 * @since 1.0.19
703
-	 * @param  string $context View or edit context.
704
-	 * @return string
705
-	 */
706
-	public function get_description( $context = 'view' ) {
707
-		return $this->get_prop( 'description', $context );
700
+     * Get the invoice description.
701
+     *
702
+     * @since 1.0.19
703
+     * @param  string $context View or edit context.
704
+     * @return string
705
+     */
706
+    public function get_description( $context = 'view' ) {
707
+        return $this->get_prop( 'description', $context );
708 708
     }
709 709
 
710 710
     /**
711
-	 * Alias of self::get_description().
712
-	 *
713
-	 * @since 1.0.19
714
-	 * @param  string $context View or edit context.
715
-	 * @return string
716
-	 */
717
-	public function get_excerpt( $context = 'view' ) {
718
-		return $this->get_description( $context );
711
+     * Alias of self::get_description().
712
+     *
713
+     * @since 1.0.19
714
+     * @param  string $context View or edit context.
715
+     * @return string
716
+     */
717
+    public function get_excerpt( $context = 'view' ) {
718
+        return $this->get_description( $context );
719 719
     }
720 720
 
721 721
     /**
722
-	 * Alias of self::get_description().
723
-	 *
724
-	 * @since 1.0.19
725
-	 * @param  string $context View or edit context.
726
-	 * @return string
727
-	 */
728
-	public function get_summary( $context = 'view' ) {
729
-		return $this->get_description( $context );
722
+     * Alias of self::get_description().
723
+     *
724
+     * @since 1.0.19
725
+     * @param  string $context View or edit context.
726
+     * @return string
727
+     */
728
+    public function get_summary( $context = 'view' ) {
729
+        return $this->get_description( $context );
730 730
     }
731 731
 
732 732
     /**
733
-	 * Returns the user info.
734
-	 *
735
-	 * @since 1.0.19
733
+     * Returns the user info.
734
+     *
735
+     * @since 1.0.19
736 736
      * @param  string $context View or edit context.
737
-	 * @return array
738
-	 */
737
+     * @return array
738
+     */
739 739
     public function get_user_info( $context = 'view' ) {
740 740
 
741 741
         $user_info = array(
@@ -750,683 +750,683 @@  discard block
 block discarded – undo
750 750
             'state'      => $this->get_state( $context ),
751 751
             'zip'        => $this->get_zip( $context ),
752 752
             'company'    => $this->get_company( $context ),
753
-			'company_id' => $this->get_company_id( $context ),
753
+            'company_id' => $this->get_company_id( $context ),
754 754
             'vat_number' => $this->get_vat_number( $context ),
755 755
             'discount'   => $this->get_discount_code( $context ),
756
-		);
756
+        );
757 757
 
758
-		return apply_filters( 'wpinv_user_info', $user_info, $this->get_id(), $this );
758
+        return apply_filters( 'wpinv_user_info', $user_info, $this->get_id(), $this );
759 759
 
760 760
     }
761 761
 
762 762
     /**
763
-	 * Get the customer id.
764
-	 *
765
-	 * @since 1.0.19
766
-	 * @param  string $context View or edit context.
767
-	 * @return int
768
-	 */
769
-	public function get_author( $context = 'view' ) {
770
-		return (int) $this->get_prop( 'author', $context );
763
+     * Get the customer id.
764
+     *
765
+     * @since 1.0.19
766
+     * @param  string $context View or edit context.
767
+     * @return int
768
+     */
769
+    public function get_author( $context = 'view' ) {
770
+        return (int) $this->get_prop( 'author', $context );
771 771
     }
772 772
 
773 773
     /**
774
-	 * Alias of self::get_author().
775
-	 *
776
-	 * @since 1.0.19
777
-	 * @param  string $context View or edit context.
778
-	 * @return int
779
-	 */
780
-	public function get_user_id( $context = 'view' ) {
781
-		return $this->get_author( $context );
774
+     * Alias of self::get_author().
775
+     *
776
+     * @since 1.0.19
777
+     * @param  string $context View or edit context.
778
+     * @return int
779
+     */
780
+    public function get_user_id( $context = 'view' ) {
781
+        return $this->get_author( $context );
782 782
     }
783 783
 
784
-     /**
785
-	 * Alias of self::get_author().
786
-	 *
787
-	 * @since 1.0.19
788
-	 * @param  string $context View or edit context.
789
-	 * @return int
790
-	 */
791
-	public function get_customer_id( $context = 'view' ) {
792
-		return $this->get_author( $context );
784
+        /**
785
+         * Alias of self::get_author().
786
+         *
787
+         * @since 1.0.19
788
+         * @param  string $context View or edit context.
789
+         * @return int
790
+         */
791
+    public function get_customer_id( $context = 'view' ) {
792
+        return $this->get_author( $context );
793 793
     }
794 794
 
795 795
     /**
796
-	 * Get the customer's ip.
797
-	 *
798
-	 * @since 1.0.19
799
-	 * @param  string $context View or edit context.
800
-	 * @return string
801
-	 */
802
-	public function get_ip( $context = 'view' ) {
803
-		return $this->get_prop( 'user_ip', $context );
796
+     * Get the customer's ip.
797
+     *
798
+     * @since 1.0.19
799
+     * @param  string $context View or edit context.
800
+     * @return string
801
+     */
802
+    public function get_ip( $context = 'view' ) {
803
+        return $this->get_prop( 'user_ip', $context );
804 804
     }
805 805
 
806 806
     /**
807
-	 * Alias of self::get_ip().
808
-	 *
809
-	 * @since 1.0.19
810
-	 * @param  string $context View or edit context.
811
-	 * @return string
812
-	 */
813
-	public function get_user_ip( $context = 'view' ) {
814
-		return $this->get_ip( $context );
807
+     * Alias of self::get_ip().
808
+     *
809
+     * @since 1.0.19
810
+     * @param  string $context View or edit context.
811
+     * @return string
812
+     */
813
+    public function get_user_ip( $context = 'view' ) {
814
+        return $this->get_ip( $context );
815 815
     }
816 816
 
817
-     /**
818
-	 * Alias of self::get_ip().
819
-	 *
820
-	 * @since 1.0.19
821
-	 * @param  string $context View or edit context.
822
-	 * @return string
823
-	 */
824
-	public function get_customer_ip( $context = 'view' ) {
825
-		return $this->get_ip( $context );
817
+        /**
818
+         * Alias of self::get_ip().
819
+         *
820
+         * @since 1.0.19
821
+         * @param  string $context View or edit context.
822
+         * @return string
823
+         */
824
+    public function get_customer_ip( $context = 'view' ) {
825
+        return $this->get_ip( $context );
826 826
     }
827 827
 
828 828
     /**
829
-	 * Get the customer's first name.
830
-	 *
831
-	 * @since 1.0.19
832
-	 * @param  string $context View or edit context.
833
-	 * @return string
834
-	 */
835
-	public function get_first_name( $context = 'view' ) {
836
-		return $this->get_prop( 'first_name', $context );
829
+     * Get the customer's first name.
830
+     *
831
+     * @since 1.0.19
832
+     * @param  string $context View or edit context.
833
+     * @return string
834
+     */
835
+    public function get_first_name( $context = 'view' ) {
836
+        return $this->get_prop( 'first_name', $context );
837 837
     }
838 838
 
839 839
     /**
840
-	 * Alias of self::get_first_name().
841
-	 *
842
-	 * @since 1.0.19
843
-	 * @param  string $context View or edit context.
844
-	 * @return string
845
-	 */
846
-	public function get_user_first_name( $context = 'view' ) {
847
-		return $this->get_first_name( $context );
840
+     * Alias of self::get_first_name().
841
+     *
842
+     * @since 1.0.19
843
+     * @param  string $context View or edit context.
844
+     * @return string
845
+     */
846
+    public function get_user_first_name( $context = 'view' ) {
847
+        return $this->get_first_name( $context );
848 848
     }
849 849
 
850
-     /**
851
-	 * Alias of self::get_first_name().
852
-	 *
853
-	 * @since 1.0.19
854
-	 * @param  string $context View or edit context.
855
-	 * @return string
856
-	 */
857
-	public function get_customer_first_name( $context = 'view' ) {
858
-		return $this->get_first_name( $context );
850
+        /**
851
+         * Alias of self::get_first_name().
852
+         *
853
+         * @since 1.0.19
854
+         * @param  string $context View or edit context.
855
+         * @return string
856
+         */
857
+    public function get_customer_first_name( $context = 'view' ) {
858
+        return $this->get_first_name( $context );
859 859
     }
860 860
 
861 861
     /**
862
-	 * Get the customer's last name.
863
-	 *
864
-	 * @since 1.0.19
865
-	 * @param  string $context View or edit context.
866
-	 * @return string
867
-	 */
868
-	public function get_last_name( $context = 'view' ) {
869
-		return $this->get_prop( 'last_name', $context );
862
+     * Get the customer's last name.
863
+     *
864
+     * @since 1.0.19
865
+     * @param  string $context View or edit context.
866
+     * @return string
867
+     */
868
+    public function get_last_name( $context = 'view' ) {
869
+        return $this->get_prop( 'last_name', $context );
870 870
     }
871 871
 
872 872
     /**
873
-	 * Alias of self::get_last_name().
874
-	 *
875
-	 * @since 1.0.19
876
-	 * @param  string $context View or edit context.
877
-	 * @return string
878
-	 */
879
-	public function get_user_last_name( $context = 'view' ) {
880
-		return $this->get_last_name( $context );
873
+     * Alias of self::get_last_name().
874
+     *
875
+     * @since 1.0.19
876
+     * @param  string $context View or edit context.
877
+     * @return string
878
+     */
879
+    public function get_user_last_name( $context = 'view' ) {
880
+        return $this->get_last_name( $context );
881 881
     }
882 882
 
883 883
     /**
884
-	 * Alias of self::get_last_name().
885
-	 *
886
-	 * @since 1.0.19
887
-	 * @param  string $context View or edit context.
888
-	 * @return string
889
-	 */
890
-	public function get_customer_last_name( $context = 'view' ) {
891
-		return $this->get_last_name( $context );
884
+     * Alias of self::get_last_name().
885
+     *
886
+     * @since 1.0.19
887
+     * @param  string $context View or edit context.
888
+     * @return string
889
+     */
890
+    public function get_customer_last_name( $context = 'view' ) {
891
+        return $this->get_last_name( $context );
892 892
     }
893 893
 
894 894
     /**
895
-	 * Get the customer's full name.
896
-	 *
897
-	 * @since 1.0.19
898
-	 * @param  string $context View or edit context.
899
-	 * @return string
900
-	 */
901
-	public function get_full_name( $context = 'view' ) {
902
-		$name = trim( $this->get_first_name( $context ) . ' ' . $this->get_last_name( $context ) );
895
+     * Get the customer's full name.
896
+     *
897
+     * @since 1.0.19
898
+     * @param  string $context View or edit context.
899
+     * @return string
900
+     */
901
+    public function get_full_name( $context = 'view' ) {
902
+        $name = trim( $this->get_first_name( $context ) . ' ' . $this->get_last_name( $context ) );
903 903
 
904
-		if ( ! $name ) {
905
-			$user = get_userdata( $this->get_author( $context ) );
904
+        if ( ! $name ) {
905
+            $user = get_userdata( $this->get_author( $context ) );
906 906
 
907
-			if ( $user ) {
908
-				$name = $user->display_name;
909
-			}
910
-		}
907
+            if ( $user ) {
908
+                $name = $user->display_name;
909
+            }
910
+        }
911 911
 
912
-		if ( ! $name ) {
913
-			$name = $this->get_email( $context );
914
-		}
912
+        if ( ! $name ) {
913
+            $name = $this->get_email( $context );
914
+        }
915 915
 
916
-		return apply_filters( 'wpinv_invoice_user_full_name', $name, $this );
916
+        return apply_filters( 'wpinv_invoice_user_full_name', $name, $this );
917 917
     }
918 918
 
919 919
     /**
920
-	 * Alias of self::get_full_name().
921
-	 *
922
-	 * @since 1.0.19
923
-	 * @param  string $context View or edit context.
924
-	 * @return string
925
-	 */
926
-	public function get_user_full_name( $context = 'view' ) {
927
-		return $this->get_full_name( $context );
920
+     * Alias of self::get_full_name().
921
+     *
922
+     * @since 1.0.19
923
+     * @param  string $context View or edit context.
924
+     * @return string
925
+     */
926
+    public function get_user_full_name( $context = 'view' ) {
927
+        return $this->get_full_name( $context );
928 928
     }
929 929
 
930 930
     /**
931
-	 * Alias of self::get_full_name().
932
-	 *
933
-	 * @since 1.0.19
934
-	 * @param  string $context View or edit context.
935
-	 * @return string
936
-	 */
937
-	public function get_customer_full_name( $context = 'view' ) {
938
-		return $this->get_full_name( $context );
931
+     * Alias of self::get_full_name().
932
+     *
933
+     * @since 1.0.19
934
+     * @param  string $context View or edit context.
935
+     * @return string
936
+     */
937
+    public function get_customer_full_name( $context = 'view' ) {
938
+        return $this->get_full_name( $context );
939 939
     }
940 940
 
941 941
     /**
942
-	 * Get the customer's phone number.
943
-	 *
944
-	 * @since 1.0.19
945
-	 * @param  string $context View or edit context.
946
-	 * @return string
947
-	 */
948
-	public function get_phone( $context = 'view' ) {
949
-		return $this->get_prop( 'phone', $context );
942
+     * Get the customer's phone number.
943
+     *
944
+     * @since 1.0.19
945
+     * @param  string $context View or edit context.
946
+     * @return string
947
+     */
948
+    public function get_phone( $context = 'view' ) {
949
+        return $this->get_prop( 'phone', $context );
950
+    }
951
+
952
+    /**
953
+     * Alias of self::get_phone().
954
+     *
955
+     * @since 1.0.19
956
+     * @param  string $context View or edit context.
957
+     * @return string
958
+     */
959
+    public function get_phone_number( $context = 'view' ) {
960
+        return $this->get_phone( $context );
950 961
     }
951 962
 
952 963
     /**
953
-	 * Alias of self::get_phone().
954
-	 *
955
-	 * @since 1.0.19
956
-	 * @param  string $context View or edit context.
957
-	 * @return string
958
-	 */
959
-	public function get_phone_number( $context = 'view' ) {
960
-		return $this->get_phone( $context );
964
+     * Alias of self::get_phone().
965
+     *
966
+     * @since 1.0.19
967
+     * @param  string $context View or edit context.
968
+     * @return string
969
+     */
970
+    public function get_user_phone( $context = 'view' ) {
971
+        return $this->get_phone( $context );
972
+    }
973
+
974
+    /**
975
+     * Alias of self::get_phone().
976
+     *
977
+     * @since 1.0.19
978
+     * @param  string $context View or edit context.
979
+     * @return string
980
+     */
981
+    public function get_customer_phone( $context = 'view' ) {
982
+        return $this->get_phone( $context );
961 983
     }
962 984
 
963 985
     /**
964
-	 * Alias of self::get_phone().
965
-	 *
966
-	 * @since 1.0.19
967
-	 * @param  string $context View or edit context.
968
-	 * @return string
969
-	 */
970
-	public function get_user_phone( $context = 'view' ) {
971
-		return $this->get_phone( $context );
986
+     * Get the customer's email address.
987
+     *
988
+     * @since 1.0.19
989
+     * @param  string $context View or edit context.
990
+     * @return string
991
+     */
992
+    public function get_email( $context = 'view' ) {
993
+        return $this->get_prop( 'email', $context );
972 994
     }
973 995
 
974 996
     /**
975
-	 * Alias of self::get_phone().
976
-	 *
977
-	 * @since 1.0.19
978
-	 * @param  string $context View or edit context.
979
-	 * @return string
980
-	 */
981
-	public function get_customer_phone( $context = 'view' ) {
982
-		return $this->get_phone( $context );
997
+     * Alias of self::get_email().
998
+     *
999
+     * @since 1.0.19
1000
+     * @param  string $context View or edit context.
1001
+     * @return string
1002
+     */
1003
+    public function get_email_address( $context = 'view' ) {
1004
+        return $this->get_email( $context );
983 1005
     }
984 1006
 
985 1007
     /**
986
-	 * Get the customer's email address.
987
-	 *
988
-	 * @since 1.0.19
989
-	 * @param  string $context View or edit context.
990
-	 * @return string
991
-	 */
992
-	public function get_email( $context = 'view' ) {
993
-		return $this->get_prop( 'email', $context );
1008
+     * Alias of self::get_email().
1009
+     *
1010
+     * @since 1.0.19
1011
+     * @param  string $context View or edit context.
1012
+     * @return string
1013
+     */
1014
+    public function get_user_email( $context = 'view' ) {
1015
+        return $this->get_email( $context );
994 1016
     }
995 1017
 
996 1018
     /**
997
-	 * Alias of self::get_email().
998
-	 *
999
-	 * @since 1.0.19
1000
-	 * @param  string $context View or edit context.
1001
-	 * @return string
1002
-	 */
1003
-	public function get_email_address( $context = 'view' ) {
1004
-		return $this->get_email( $context );
1019
+     * Alias of self::get_email().
1020
+     *
1021
+     * @since 1.0.19
1022
+     * @param  string $context View or edit context.
1023
+     * @return string
1024
+     */
1025
+    public function get_customer_email( $context = 'view' ) {
1026
+        return $this->get_email( $context );
1005 1027
     }
1006 1028
 
1007 1029
     /**
1008
-	 * Alias of self::get_email().
1009
-	 *
1010
-	 * @since 1.0.19
1011
-	 * @param  string $context View or edit context.
1012
-	 * @return string
1013
-	 */
1014
-	public function get_user_email( $context = 'view' ) {
1015
-		return $this->get_email( $context );
1030
+     * Get the customer's country.
1031
+     *
1032
+     * @since 1.0.19
1033
+     * @param  string $context View or edit context.
1034
+     * @return string
1035
+     */
1036
+    public function get_country( $context = 'view' ) {
1037
+        $country = $this->get_prop( 'country', $context );
1038
+        return empty( $country ) ? wpinv_get_default_country() : $country;
1039
+    }
1040
+
1041
+    /**
1042
+     * Alias of self::get_country().
1043
+     *
1044
+     * @since 1.0.19
1045
+     * @param  string $context View or edit context.
1046
+     * @return string
1047
+     */
1048
+    public function get_user_country( $context = 'view' ) {
1049
+        return $this->get_country( $context );
1050
+    }
1051
+
1052
+    /**
1053
+     * Alias of self::get_country().
1054
+     *
1055
+     * @since 1.0.19
1056
+     * @param  string $context View or edit context.
1057
+     * @return string
1058
+     */
1059
+    public function get_customer_country( $context = 'view' ) {
1060
+        return $this->get_country( $context );
1061
+    }
1062
+
1063
+    /**
1064
+     * Get the customer's state.
1065
+     *
1066
+     * @since 1.0.19
1067
+     * @param  string $context View or edit context.
1068
+     * @return string
1069
+     */
1070
+    public function get_state( $context = 'view' ) {
1071
+        $state = $this->get_prop( 'state', $context );
1072
+        return empty( $state ) ? wpinv_get_default_state() : $state;
1073
+    }
1074
+
1075
+    /**
1076
+     * Alias of self::get_state().
1077
+     *
1078
+     * @since 1.0.19
1079
+     * @param  string $context View or edit context.
1080
+     * @return string
1081
+     */
1082
+    public function get_user_state( $context = 'view' ) {
1083
+        return $this->get_state( $context );
1084
+    }
1085
+
1086
+    /**
1087
+     * Alias of self::get_state().
1088
+     *
1089
+     * @since 1.0.19
1090
+     * @param  string $context View or edit context.
1091
+     * @return string
1092
+     */
1093
+    public function get_customer_state( $context = 'view' ) {
1094
+        return $this->get_state( $context );
1095
+    }
1096
+
1097
+    /**
1098
+     * Get the customer's city.
1099
+     *
1100
+     * @since 1.0.19
1101
+     * @param  string $context View or edit context.
1102
+     * @return string
1103
+     */
1104
+    public function get_city( $context = 'view' ) {
1105
+        return $this->get_prop( 'city', $context );
1016 1106
     }
1017 1107
 
1018 1108
     /**
1019
-	 * Alias of self::get_email().
1020
-	 *
1021
-	 * @since 1.0.19
1022
-	 * @param  string $context View or edit context.
1023
-	 * @return string
1024
-	 */
1025
-	public function get_customer_email( $context = 'view' ) {
1026
-		return $this->get_email( $context );
1109
+     * Alias of self::get_city().
1110
+     *
1111
+     * @since 1.0.19
1112
+     * @param  string $context View or edit context.
1113
+     * @return string
1114
+     */
1115
+    public function get_user_city( $context = 'view' ) {
1116
+        return $this->get_city( $context );
1027 1117
     }
1028 1118
 
1029 1119
     /**
1030
-	 * Get the customer's country.
1031
-	 *
1032
-	 * @since 1.0.19
1033
-	 * @param  string $context View or edit context.
1034
-	 * @return string
1035
-	 */
1036
-	public function get_country( $context = 'view' ) {
1037
-		$country = $this->get_prop( 'country', $context );
1038
-		return empty( $country ) ? wpinv_get_default_country() : $country;
1120
+     * Alias of self::get_city().
1121
+     *
1122
+     * @since 1.0.19
1123
+     * @param  string $context View or edit context.
1124
+     * @return string
1125
+     */
1126
+    public function get_customer_city( $context = 'view' ) {
1127
+        return $this->get_city( $context );
1039 1128
     }
1040 1129
 
1041 1130
     /**
1042
-	 * Alias of self::get_country().
1043
-	 *
1044
-	 * @since 1.0.19
1045
-	 * @param  string $context View or edit context.
1046
-	 * @return string
1047
-	 */
1048
-	public function get_user_country( $context = 'view' ) {
1049
-		return $this->get_country( $context );
1131
+     * Get the customer's zip.
1132
+     *
1133
+     * @since 1.0.19
1134
+     * @param  string $context View or edit context.
1135
+     * @return string
1136
+     */
1137
+    public function get_zip( $context = 'view' ) {
1138
+        return $this->get_prop( 'zip', $context );
1050 1139
     }
1051 1140
 
1052 1141
     /**
1053
-	 * Alias of self::get_country().
1054
-	 *
1055
-	 * @since 1.0.19
1056
-	 * @param  string $context View or edit context.
1057
-	 * @return string
1058
-	 */
1059
-	public function get_customer_country( $context = 'view' ) {
1060
-		return $this->get_country( $context );
1142
+     * Alias of self::get_zip().
1143
+     *
1144
+     * @since 1.0.19
1145
+     * @param  string $context View or edit context.
1146
+     * @return string
1147
+     */
1148
+    public function get_user_zip( $context = 'view' ) {
1149
+        return $this->get_zip( $context );
1061 1150
     }
1062 1151
 
1063 1152
     /**
1064
-	 * Get the customer's state.
1065
-	 *
1066
-	 * @since 1.0.19
1067
-	 * @param  string $context View or edit context.
1068
-	 * @return string
1069
-	 */
1070
-	public function get_state( $context = 'view' ) {
1071
-		$state = $this->get_prop( 'state', $context );
1072
-		return empty( $state ) ? wpinv_get_default_state() : $state;
1153
+     * Alias of self::get_zip().
1154
+     *
1155
+     * @since 1.0.19
1156
+     * @param  string $context View or edit context.
1157
+     * @return string
1158
+     */
1159
+    public function get_customer_zip( $context = 'view' ) {
1160
+        return $this->get_zip( $context );
1073 1161
     }
1074 1162
 
1075 1163
     /**
1076
-	 * Alias of self::get_state().
1077
-	 *
1078
-	 * @since 1.0.19
1079
-	 * @param  string $context View or edit context.
1080
-	 * @return string
1081
-	 */
1082
-	public function get_user_state( $context = 'view' ) {
1083
-		return $this->get_state( $context );
1164
+     * Get the customer's company.
1165
+     *
1166
+     * @since 1.0.19
1167
+     * @param  string $context View or edit context.
1168
+     * @return string
1169
+     */
1170
+    public function get_company( $context = 'view' ) {
1171
+        return $this->get_prop( 'company', $context );
1084 1172
     }
1085 1173
 
1086 1174
     /**
1087
-	 * Alias of self::get_state().
1088
-	 *
1089
-	 * @since 1.0.19
1090
-	 * @param  string $context View or edit context.
1091
-	 * @return string
1092
-	 */
1093
-	public function get_customer_state( $context = 'view' ) {
1094
-		return $this->get_state( $context );
1175
+     * Alias of self::get_company().
1176
+     *
1177
+     * @since 1.0.19
1178
+     * @param  string $context View or edit context.
1179
+     * @return string
1180
+     */
1181
+    public function get_user_company( $context = 'view' ) {
1182
+        return $this->get_company( $context );
1095 1183
     }
1096 1184
 
1097 1185
     /**
1098
-	 * Get the customer's city.
1099
-	 *
1100
-	 * @since 1.0.19
1101
-	 * @param  string $context View or edit context.
1102
-	 * @return string
1103
-	 */
1104
-	public function get_city( $context = 'view' ) {
1105
-		return $this->get_prop( 'city', $context );
1186
+     * Alias of self::get_company().
1187
+     *
1188
+     * @since 1.0.19
1189
+     * @param  string $context View or edit context.
1190
+     * @return string
1191
+     */
1192
+    public function get_customer_company( $context = 'view' ) {
1193
+        return $this->get_company( $context );
1106 1194
     }
1107 1195
 
1108 1196
     /**
1109
-	 * Alias of self::get_city().
1110
-	 *
1111
-	 * @since 1.0.19
1112
-	 * @param  string $context View or edit context.
1113
-	 * @return string
1114
-	 */
1115
-	public function get_user_city( $context = 'view' ) {
1116
-		return $this->get_city( $context );
1197
+     * Get the customer's company id.
1198
+     *
1199
+     * @since 1.0.19
1200
+     * @param  string $context View or edit context.
1201
+     * @return string
1202
+     */
1203
+    public function get_company_id( $context = 'view' ) {
1204
+        return $this->get_prop( 'company_id', $context );
1117 1205
     }
1118 1206
 
1119 1207
     /**
1120
-	 * Alias of self::get_city().
1121
-	 *
1122
-	 * @since 1.0.19
1123
-	 * @param  string $context View or edit context.
1124
-	 * @return string
1125
-	 */
1126
-	public function get_customer_city( $context = 'view' ) {
1127
-		return $this->get_city( $context );
1208
+     * Get the customer's vat number.
1209
+     *
1210
+     * @since 1.0.19
1211
+     * @param  string $context View or edit context.
1212
+     * @return string
1213
+     */
1214
+    public function get_vat_number( $context = 'view' ) {
1215
+        return $this->get_prop( 'vat_number', $context );
1128 1216
     }
1129 1217
 
1130 1218
     /**
1131
-	 * Get the customer's zip.
1132
-	 *
1133
-	 * @since 1.0.19
1134
-	 * @param  string $context View or edit context.
1135
-	 * @return string
1136
-	 */
1137
-	public function get_zip( $context = 'view' ) {
1138
-		return $this->get_prop( 'zip', $context );
1219
+     * Alias of self::get_vat_number().
1220
+     *
1221
+     * @since 1.0.19
1222
+     * @param  string $context View or edit context.
1223
+     * @return string
1224
+     */
1225
+    public function get_user_vat_number( $context = 'view' ) {
1226
+        return $this->get_vat_number( $context );
1139 1227
     }
1140 1228
 
1141 1229
     /**
1142
-	 * Alias of self::get_zip().
1143
-	 *
1144
-	 * @since 1.0.19
1145
-	 * @param  string $context View or edit context.
1146
-	 * @return string
1147
-	 */
1148
-	public function get_user_zip( $context = 'view' ) {
1149
-		return $this->get_zip( $context );
1230
+     * Alias of self::get_vat_number().
1231
+     *
1232
+     * @since 1.0.19
1233
+     * @param  string $context View or edit context.
1234
+     * @return string
1235
+     */
1236
+    public function get_customer_vat_number( $context = 'view' ) {
1237
+        return $this->get_vat_number( $context );
1150 1238
     }
1151 1239
 
1152 1240
     /**
1153
-	 * Alias of self::get_zip().
1154
-	 *
1155
-	 * @since 1.0.19
1156
-	 * @param  string $context View or edit context.
1157
-	 * @return string
1158
-	 */
1159
-	public function get_customer_zip( $context = 'view' ) {
1160
-		return $this->get_zip( $context );
1241
+     * Get the customer's vat rate.
1242
+     *
1243
+     * @since 1.0.19
1244
+     * @param  string $context View or edit context.
1245
+     * @return string
1246
+     */
1247
+    public function get_vat_rate( $context = 'view' ) {
1248
+        return $this->get_prop( 'vat_rate', $context );
1161 1249
     }
1162 1250
 
1163 1251
     /**
1164
-	 * Get the customer's company.
1165
-	 *
1166
-	 * @since 1.0.19
1167
-	 * @param  string $context View or edit context.
1168
-	 * @return string
1169
-	 */
1170
-	public function get_company( $context = 'view' ) {
1171
-		return $this->get_prop( 'company', $context );
1252
+     * Alias of self::get_vat_rate().
1253
+     *
1254
+     * @since 1.0.19
1255
+     * @param  string $context View or edit context.
1256
+     * @return string
1257
+     */
1258
+    public function get_user_vat_rate( $context = 'view' ) {
1259
+        return $this->get_vat_rate( $context );
1172 1260
     }
1173 1261
 
1174 1262
     /**
1175
-	 * Alias of self::get_company().
1176
-	 *
1177
-	 * @since 1.0.19
1178
-	 * @param  string $context View or edit context.
1179
-	 * @return string
1180
-	 */
1181
-	public function get_user_company( $context = 'view' ) {
1182
-		return $this->get_company( $context );
1263
+     * Alias of self::get_vat_rate().
1264
+     *
1265
+     * @since 1.0.19
1266
+     * @param  string $context View or edit context.
1267
+     * @return string
1268
+     */
1269
+    public function get_customer_vat_rate( $context = 'view' ) {
1270
+        return $this->get_vat_rate( $context );
1183 1271
     }
1184 1272
 
1185 1273
     /**
1186
-	 * Alias of self::get_company().
1187
-	 *
1188
-	 * @since 1.0.19
1189
-	 * @param  string $context View or edit context.
1190
-	 * @return string
1191
-	 */
1192
-	public function get_customer_company( $context = 'view' ) {
1193
-		return $this->get_company( $context );
1274
+     * Get the customer's address.
1275
+     *
1276
+     * @since 1.0.19
1277
+     * @param  string $context View or edit context.
1278
+     * @return string
1279
+     */
1280
+    public function get_address( $context = 'view' ) {
1281
+        return $this->get_prop( 'address', $context );
1194 1282
     }
1195 1283
 
1196
-	/**
1197
-	 * Get the customer's company id.
1198
-	 *
1199
-	 * @since 1.0.19
1200
-	 * @param  string $context View or edit context.
1201
-	 * @return string
1202
-	 */
1203
-	public function get_company_id( $context = 'view' ) {
1204
-		return $this->get_prop( 'company_id', $context );
1284
+    /**
1285
+     * Alias of self::get_address().
1286
+     *
1287
+     * @since 1.0.19
1288
+     * @param  string $context View or edit context.
1289
+     * @return string
1290
+     */
1291
+    public function get_user_address( $context = 'view' ) {
1292
+        return $this->get_address( $context );
1205 1293
     }
1206 1294
 
1207 1295
     /**
1208
-	 * Get the customer's vat number.
1209
-	 *
1210
-	 * @since 1.0.19
1211
-	 * @param  string $context View or edit context.
1212
-	 * @return string
1213
-	 */
1214
-	public function get_vat_number( $context = 'view' ) {
1215
-		return $this->get_prop( 'vat_number', $context );
1296
+     * Alias of self::get_address().
1297
+     *
1298
+     * @since 1.0.19
1299
+     * @param  string $context View or edit context.
1300
+     * @return string
1301
+     */
1302
+    public function get_customer_address( $context = 'view' ) {
1303
+        return $this->get_address( $context );
1216 1304
     }
1217 1305
 
1218 1306
     /**
1219
-	 * Alias of self::get_vat_number().
1220
-	 *
1221
-	 * @since 1.0.19
1222
-	 * @param  string $context View or edit context.
1223
-	 * @return string
1224
-	 */
1225
-	public function get_user_vat_number( $context = 'view' ) {
1226
-		return $this->get_vat_number( $context );
1307
+     * Get whether the customer has viewed the invoice or not.
1308
+     *
1309
+     * @since 1.0.19
1310
+     * @param  string $context View or edit context.
1311
+     * @return bool
1312
+     */
1313
+    public function get_is_viewed( $context = 'view' ) {
1314
+        return (bool) $this->get_prop( 'is_viewed', $context );
1227 1315
     }
1228 1316
 
1229 1317
     /**
1230
-	 * Alias of self::get_vat_number().
1231
-	 *
1232
-	 * @since 1.0.19
1233
-	 * @param  string $context View or edit context.
1234
-	 * @return string
1235
-	 */
1236
-	public function get_customer_vat_number( $context = 'view' ) {
1237
-		return $this->get_vat_number( $context );
1318
+     * Get other recipients for invoice communications.
1319
+     *
1320
+     * @since 1.0.19
1321
+     * @param  string $context View or edit context.
1322
+     * @return bool
1323
+     */
1324
+    public function get_email_cc( $context = 'view' ) {
1325
+        return $this->get_prop( 'email_cc', $context );
1238 1326
     }
1239 1327
 
1240
-    /**
1241
-	 * Get the customer's vat rate.
1242
-	 *
1243
-	 * @since 1.0.19
1244
-	 * @param  string $context View or edit context.
1245
-	 * @return string
1246
-	 */
1247
-	public function get_vat_rate( $context = 'view' ) {
1248
-		return $this->get_prop( 'vat_rate', $context );
1249
-    }
1250
-
1251
-    /**
1252
-	 * Alias of self::get_vat_rate().
1253
-	 *
1254
-	 * @since 1.0.19
1255
-	 * @param  string $context View or edit context.
1256
-	 * @return string
1257
-	 */
1258
-	public function get_user_vat_rate( $context = 'view' ) {
1259
-		return $this->get_vat_rate( $context );
1260
-    }
1261
-
1262
-    /**
1263
-	 * Alias of self::get_vat_rate().
1264
-	 *
1265
-	 * @since 1.0.19
1266
-	 * @param  string $context View or edit context.
1267
-	 * @return string
1268
-	 */
1269
-	public function get_customer_vat_rate( $context = 'view' ) {
1270
-		return $this->get_vat_rate( $context );
1271
-    }
1272
-
1273
-    /**
1274
-	 * Get the customer's address.
1275
-	 *
1276
-	 * @since 1.0.19
1277
-	 * @param  string $context View or edit context.
1278
-	 * @return string
1279
-	 */
1280
-	public function get_address( $context = 'view' ) {
1281
-		return $this->get_prop( 'address', $context );
1282
-    }
1283
-
1284
-    /**
1285
-	 * Alias of self::get_address().
1286
-	 *
1287
-	 * @since 1.0.19
1288
-	 * @param  string $context View or edit context.
1289
-	 * @return string
1290
-	 */
1291
-	public function get_user_address( $context = 'view' ) {
1292
-		return $this->get_address( $context );
1293
-    }
1294
-
1295
-    /**
1296
-	 * Alias of self::get_address().
1297
-	 *
1298
-	 * @since 1.0.19
1299
-	 * @param  string $context View or edit context.
1300
-	 * @return string
1301
-	 */
1302
-	public function get_customer_address( $context = 'view' ) {
1303
-		return $this->get_address( $context );
1304
-    }
1305
-
1306
-    /**
1307
-	 * Get whether the customer has viewed the invoice or not.
1308
-	 *
1309
-	 * @since 1.0.19
1310
-	 * @param  string $context View or edit context.
1311
-	 * @return bool
1312
-	 */
1313
-	public function get_is_viewed( $context = 'view' ) {
1314
-		return (bool) $this->get_prop( 'is_viewed', $context );
1315
-	}
1316
-
1317
-	/**
1318
-	 * Get other recipients for invoice communications.
1319
-	 *
1320
-	 * @since 1.0.19
1321
-	 * @param  string $context View or edit context.
1322
-	 * @return bool
1323
-	 */
1324
-	public function get_email_cc( $context = 'view' ) {
1325
-		return $this->get_prop( 'email_cc', $context );
1326
-	}
1327
-
1328
-	/**
1329
-	 * Get invoice template.
1330
-	 *
1331
-	 * @since 1.0.19
1332
-	 * @param  string $context View or edit context.
1333
-	 * @return bool
1334
-	 */
1335
-	public function get_template( $context = 'view' ) {
1336
-		return $this->get_prop( 'template', $context );
1337
-	}
1338
-
1339
-	/**
1340
-	 * Get invoice source.
1341
-	 *
1342
-	 * @since 1.0.19
1343
-	 * @param  string $context View or edit context.
1344
-	 * @return bool
1345
-	 */
1346
-	public function get_created_via( $context = 'view' ) {
1347
-		return $this->get_prop( 'created_via', $context );
1348
-	}
1349
-
1350
-	/**
1351
-	 * Get whether the customer has confirmed their address.
1352
-	 *
1353
-	 * @since 1.0.19
1354
-	 * @param  string $context View or edit context.
1355
-	 * @return bool
1356
-	 */
1357
-	public function get_address_confirmed( $context = 'view' ) {
1358
-		return (bool) $this->get_prop( 'address_confirmed', $context );
1359
-    }
1360
-
1361
-    /**
1362
-	 * Alias of self::get_address_confirmed().
1363
-	 *
1364
-	 * @since 1.0.19
1365
-	 * @param  string $context View or edit context.
1366
-	 * @return bool
1367
-	 */
1368
-	public function get_user_address_confirmed( $context = 'view' ) {
1369
-		return $this->get_address_confirmed( $context );
1370
-    }
1371
-
1372
-    /**
1373
-	 * Alias of self::get_address().
1374
-	 *
1375
-	 * @since 1.0.19
1376
-	 * @param  string $context View or edit context.
1377
-	 * @return bool
1378
-	 */
1379
-	public function get_customer_address_confirmed( $context = 'view' ) {
1380
-		return $this->get_address_confirmed( $context );
1381
-    }
1382
-
1383
-	/**
1384
-	 * Get the shipping address.
1385
-	 *
1386
-	 * @since 1.0.19
1387
-	 * @return array|false
1388
-	 */
1389
-	public function get_shipping_address() {
1390
-
1391
-		$shipping_address = get_post_meta( $this->get_id(), 'shipping_address', true );
1392
-		return is_array( $shipping_address ) ? $shipping_address : false;
1393
-    }
1394
-
1395
-	/**
1396
-	 * Check if the invoice has a shipping address.
1397
-	 */
1398
-	public function has_shipping_address() {
1399
-		return false !== $this->get_shipping_address();
1400
-    }
1401
-
1402
-	/**
1403
-	 * Get the shipping amount.
1404
-	 *
1405
-	 * @since 1.0.19
1406
-	 * @param  string $context View or edit context.
1407
-	 * @return float
1408
-	 */
1409
-	public function get_shipping( $context = 'view' ) {
1410
-
1411
-		if ( $context = 'view' ) {
1412
-			return floatval( $this->get_prop( 'shipping', $context ) );
1413
-		}
1414
-
1415
-		return $this->get_prop( 'shipping', $context );
1416
-    }
1417
-
1418
-	public function has_shipping() {
1419
-		return defined( 'GETPAID_SHIPPING_CALCULATOR_VERSION' ) && null !== $this->get_prop( 'shipping', 'edit' );
1420
-    }
1421
-
1422
-    /**
1423
-	 * Get the invoice subtotal.
1424
-	 *
1425
-	 * @since 1.0.19
1426
-	 * @param  string $context View or edit context.
1427
-	 * @return float
1428
-	 */
1429
-	public function get_subtotal( $context = 'view' ) {
1328
+    /**
1329
+     * Get invoice template.
1330
+     *
1331
+     * @since 1.0.19
1332
+     * @param  string $context View or edit context.
1333
+     * @return bool
1334
+     */
1335
+    public function get_template( $context = 'view' ) {
1336
+        return $this->get_prop( 'template', $context );
1337
+    }
1338
+
1339
+    /**
1340
+     * Get invoice source.
1341
+     *
1342
+     * @since 1.0.19
1343
+     * @param  string $context View or edit context.
1344
+     * @return bool
1345
+     */
1346
+    public function get_created_via( $context = 'view' ) {
1347
+        return $this->get_prop( 'created_via', $context );
1348
+    }
1349
+
1350
+    /**
1351
+     * Get whether the customer has confirmed their address.
1352
+     *
1353
+     * @since 1.0.19
1354
+     * @param  string $context View or edit context.
1355
+     * @return bool
1356
+     */
1357
+    public function get_address_confirmed( $context = 'view' ) {
1358
+        return (bool) $this->get_prop( 'address_confirmed', $context );
1359
+    }
1360
+
1361
+    /**
1362
+     * Alias of self::get_address_confirmed().
1363
+     *
1364
+     * @since 1.0.19
1365
+     * @param  string $context View or edit context.
1366
+     * @return bool
1367
+     */
1368
+    public function get_user_address_confirmed( $context = 'view' ) {
1369
+        return $this->get_address_confirmed( $context );
1370
+    }
1371
+
1372
+    /**
1373
+     * Alias of self::get_address().
1374
+     *
1375
+     * @since 1.0.19
1376
+     * @param  string $context View or edit context.
1377
+     * @return bool
1378
+     */
1379
+    public function get_customer_address_confirmed( $context = 'view' ) {
1380
+        return $this->get_address_confirmed( $context );
1381
+    }
1382
+
1383
+    /**
1384
+     * Get the shipping address.
1385
+     *
1386
+     * @since 1.0.19
1387
+     * @return array|false
1388
+     */
1389
+    public function get_shipping_address() {
1390
+
1391
+        $shipping_address = get_post_meta( $this->get_id(), 'shipping_address', true );
1392
+        return is_array( $shipping_address ) ? $shipping_address : false;
1393
+    }
1394
+
1395
+    /**
1396
+     * Check if the invoice has a shipping address.
1397
+     */
1398
+    public function has_shipping_address() {
1399
+        return false !== $this->get_shipping_address();
1400
+    }
1401
+
1402
+    /**
1403
+     * Get the shipping amount.
1404
+     *
1405
+     * @since 1.0.19
1406
+     * @param  string $context View or edit context.
1407
+     * @return float
1408
+     */
1409
+    public function get_shipping( $context = 'view' ) {
1410
+
1411
+        if ( $context = 'view' ) {
1412
+            return floatval( $this->get_prop( 'shipping', $context ) );
1413
+        }
1414
+
1415
+        return $this->get_prop( 'shipping', $context );
1416
+    }
1417
+
1418
+    public function has_shipping() {
1419
+        return defined( 'GETPAID_SHIPPING_CALCULATOR_VERSION' ) && null !== $this->get_prop( 'shipping', 'edit' );
1420
+    }
1421
+
1422
+    /**
1423
+     * Get the invoice subtotal.
1424
+     *
1425
+     * @since 1.0.19
1426
+     * @param  string $context View or edit context.
1427
+     * @return float
1428
+     */
1429
+    public function get_subtotal( $context = 'view' ) {
1430 1430
         $subtotal = (float) $this->get_prop( 'subtotal', $context );
1431 1431
 
1432 1432
         // Backwards compatibility.
@@ -1438,198 +1438,198 @@  discard block
 block discarded – undo
1438 1438
     }
1439 1439
 
1440 1440
     /**
1441
-	 * Get the invoice discount total.
1442
-	 *
1443
-	 * @since 1.0.19
1444
-	 * @param  string $context View or edit context.
1445
-	 * @return float
1446
-	 */
1447
-	public function get_total_discount( $context = 'view' ) {
1448
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_discount', $context ) ) );
1441
+     * Get the invoice discount total.
1442
+     *
1443
+     * @since 1.0.19
1444
+     * @param  string $context View or edit context.
1445
+     * @return float
1446
+     */
1447
+    public function get_total_discount( $context = 'view' ) {
1448
+        return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_discount', $context ) ) );
1449 1449
     }
1450 1450
 
1451 1451
     /**
1452
-	 * Get the invoice tax total.
1453
-	 *
1454
-	 * @since 1.0.19
1455
-	 * @param  string $context View or edit context.
1456
-	 * @return float
1457
-	 */
1458
-	public function get_total_tax( $context = 'view' ) {
1459
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_tax', $context ) ) );
1460
-	}
1452
+     * Get the invoice tax total.
1453
+     *
1454
+     * @since 1.0.19
1455
+     * @param  string $context View or edit context.
1456
+     * @return float
1457
+     */
1458
+    public function get_total_tax( $context = 'view' ) {
1459
+        return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_tax', $context ) ) );
1460
+    }
1461 1461
 
1462
-	/**
1463
-	 * @deprecated
1464
-	 */
1465
-	public function get_final_tax( $currency = false ) {
1466
-		$tax = $this->get_total_tax();
1462
+    /**
1463
+     * @deprecated
1464
+     */
1465
+    public function get_final_tax( $currency = false ) {
1466
+        $tax = $this->get_total_tax();
1467 1467
 
1468 1468
         if ( $currency ) {
1469
-			return wpinv_price( $tax, $this->get_currency() );
1469
+            return wpinv_price( $tax, $this->get_currency() );
1470 1470
         }
1471 1471
 
1472 1472
         return $tax;
1473 1473
     }
1474 1474
 
1475 1475
     /**
1476
-	 * Get the invoice fees total.
1477
-	 *
1478
-	 * @since 1.0.19
1479
-	 * @param  string $context View or edit context.
1480
-	 * @return float
1481
-	 */
1482
-	public function get_total_fees( $context = 'view' ) {
1483
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_fees', $context ) ) );
1476
+     * Get the invoice fees total.
1477
+     *
1478
+     * @since 1.0.19
1479
+     * @param  string $context View or edit context.
1480
+     * @return float
1481
+     */
1482
+    public function get_total_fees( $context = 'view' ) {
1483
+        return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_fees', $context ) ) );
1484 1484
     }
1485 1485
 
1486 1486
     /**
1487
-	 * Alias for self::get_total_fees().
1488
-	 *
1489
-	 * @since 1.0.19
1490
-	 * @param  string $context View or edit context.
1491
-	 * @return float
1492
-	 */
1493
-	public function get_fees_total( $context = 'view' ) {
1494
-		return $this->get_total_fees( $context );
1487
+     * Alias for self::get_total_fees().
1488
+     *
1489
+     * @since 1.0.19
1490
+     * @param  string $context View or edit context.
1491
+     * @return float
1492
+     */
1493
+    public function get_fees_total( $context = 'view' ) {
1494
+        return $this->get_total_fees( $context );
1495 1495
     }
1496 1496
 
1497 1497
     /**
1498
-	 * Get the invoice total.
1499
-	 *
1500
-	 * @since 1.0.19
1498
+     * Get the invoice total.
1499
+     *
1500
+     * @since 1.0.19
1501 1501
      * @return float
1502
-	 */
1503
-	public function get_total( $context = 'view' ) {
1504
-		$total = $this->get_prop( 'total', $context );
1505
-
1506
-		if ( $this->has_shipping() && $context == 'view' ) {
1507
-			$total = $this->get_prop( 'total', $context ) + $this->get_shipping( $context );
1508
-		}
1509
-
1510
-		return wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1511
-	}
1512
-
1513
-	/**
1514
-	 * Retrieves the non-recurring total of items.
1515
-	 *
1516
-	 * @since 2.3.0
1517
-	 * @return float
1518
-	 */
1519
-	public function get_non_recurring_total() {
1520
-
1521
-		$subtotal = 0;
1522
-		foreach ( $this->get_items() as $item ) {
1523
-			if ( ! $item->is_recurring() ) {
1524
-				$subtotal += $item->get_sub_total();
1525
-			}
1526
-		}
1527
-
1528
-		foreach ( $this->get_fees() as $fee ) {
1529
-			if ( empty( $fee['recurring_fee'] ) ) {
1530
-				$subtotal += wpinv_sanitize_amount( $fee['initial_fee'] );
1531
-			}
1532
-		}
1533
-
1534
-		$subtotal = wpinv_round_amount( wpinv_sanitize_amount( $subtotal ) );
1502
+     */
1503
+    public function get_total( $context = 'view' ) {
1504
+        $total = $this->get_prop( 'total', $context );
1505
+
1506
+        if ( $this->has_shipping() && $context == 'view' ) {
1507
+            $total = $this->get_prop( 'total', $context ) + $this->get_shipping( $context );
1508
+        }
1509
+
1510
+        return wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1511
+    }
1512
+
1513
+    /**
1514
+     * Retrieves the non-recurring total of items.
1515
+     *
1516
+     * @since 2.3.0
1517
+     * @return float
1518
+     */
1519
+    public function get_non_recurring_total() {
1520
+
1521
+        $subtotal = 0;
1522
+        foreach ( $this->get_items() as $item ) {
1523
+            if ( ! $item->is_recurring() ) {
1524
+                $subtotal += $item->get_sub_total();
1525
+            }
1526
+        }
1527
+
1528
+        foreach ( $this->get_fees() as $fee ) {
1529
+            if ( empty( $fee['recurring_fee'] ) ) {
1530
+                $subtotal += wpinv_sanitize_amount( $fee['initial_fee'] );
1531
+            }
1532
+        }
1533
+
1534
+        $subtotal = wpinv_round_amount( wpinv_sanitize_amount( $subtotal ) );
1535 1535
         return apply_filters( 'wpinv_get_non_recurring_invoice_total', $subtotal, $this );
1536 1536
 
1537 1537
     }
1538 1538
 
1539
-	/**
1540
-	 * Get the invoice totals.
1541
-	 *
1542
-	 * @since 1.0.19
1539
+    /**
1540
+     * Get the invoice totals.
1541
+     *
1542
+     * @since 1.0.19
1543 1543
      * @return array
1544
-	 */
1545
-	public function get_totals() {
1546
-		return $this->totals;
1544
+     */
1545
+    public function get_totals() {
1546
+        return $this->totals;
1547 1547
     }
1548 1548
 
1549 1549
     /**
1550
-	 * Get the initial invoice total.
1551
-	 *
1552
-	 * @since 1.0.19
1550
+     * Get the initial invoice total.
1551
+     *
1552
+     * @since 1.0.19
1553 1553
      * @param  string $context View or edit context.
1554 1554
      * @return float
1555
-	 */
1555
+     */
1556 1556
     public function get_initial_total() {
1557 1557
 
1558
-		if ( empty( $this->totals ) ) {
1559
-			$this->recalculate_total();
1560
-		}
1558
+        if ( empty( $this->totals ) ) {
1559
+            $this->recalculate_total();
1560
+        }
1561 1561
 
1562
-		$tax      = $this->totals['tax']['initial'];
1563
-		$fee      = $this->totals['fee']['initial'];
1564
-		$discount = $this->totals['discount']['initial'];
1565
-		$subtotal = $this->totals['subtotal']['initial'];
1566
-		$total    = $tax + $fee - $discount + $subtotal;
1562
+        $tax      = $this->totals['tax']['initial'];
1563
+        $fee      = $this->totals['fee']['initial'];
1564
+        $discount = $this->totals['discount']['initial'];
1565
+        $subtotal = $this->totals['subtotal']['initial'];
1566
+        $total    = $tax + $fee - $discount + $subtotal;
1567 1567
 
1568
-		if ( 0 > $total ) {
1569
-			$total = 0;
1570
-		}
1568
+        if ( 0 > $total ) {
1569
+            $total = 0;
1570
+        }
1571 1571
 
1572
-		$total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1572
+        $total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1573 1573
         return apply_filters( 'wpinv_get_initial_invoice_total', $total, $this );
1574
-	}
1574
+    }
1575 1575
 
1576
-	/**
1577
-	 * Get the recurring invoice total.
1578
-	 *
1579
-	 * @since 1.0.19
1576
+    /**
1577
+     * Get the recurring invoice total.
1578
+     *
1579
+     * @since 1.0.19
1580 1580
      * @param  string $context View or edit context.
1581 1581
      * @return float
1582
-	 */
1582
+     */
1583 1583
     public function get_recurring_total() {
1584 1584
 
1585
-		if ( empty( $this->totals ) ) {
1586
-			$this->recalculate_total();
1587
-		}
1585
+        if ( empty( $this->totals ) ) {
1586
+            $this->recalculate_total();
1587
+        }
1588 1588
 
1589
-		$tax      = $this->totals['tax']['recurring'];
1590
-		$fee      = $this->totals['fee']['recurring'];
1591
-		$discount = $this->totals['discount']['recurring'];
1592
-		$subtotal = $this->totals['subtotal']['recurring'];
1593
-		$total    = $tax + $fee - $discount + $subtotal;
1589
+        $tax      = $this->totals['tax']['recurring'];
1590
+        $fee      = $this->totals['fee']['recurring'];
1591
+        $discount = $this->totals['discount']['recurring'];
1592
+        $subtotal = $this->totals['subtotal']['recurring'];
1593
+        $total    = $tax + $fee - $discount + $subtotal;
1594 1594
 
1595
-		if ( 0 > $total ) {
1596
-			$total = 0;
1597
-		}
1595
+        if ( 0 > $total ) {
1596
+            $total = 0;
1597
+        }
1598 1598
 
1599
-		$total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1599
+        $total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1600 1600
         return apply_filters( 'wpinv_get_recurring_invoice_total', $total, $this );
1601
-	}
1601
+    }
1602 1602
 
1603
-	/**
1604
-	 * Returns recurring payment details.
1605
-	 *
1606
-	 * @since 1.0.19
1603
+    /**
1604
+     * Returns recurring payment details.
1605
+     *
1606
+     * @since 1.0.19
1607 1607
      * @param  string $field Optionally provide a field to return.
1608
-	 * @param string $currency Whether to include the currency.
1608
+     * @param string $currency Whether to include the currency.
1609 1609
      * @return float|string
1610
-	 */
1610
+     */
1611 1611
     public function get_recurring_details( $field = '', $currency = false ) {
1612 1612
 
1613
-		// Maybe recalculate totals.
1614
-		if ( empty( $this->totals ) ) {
1615
-			$this->recalculate_total();
1616
-		}
1613
+        // Maybe recalculate totals.
1614
+        if ( empty( $this->totals ) ) {
1615
+            $this->recalculate_total();
1616
+        }
1617 1617
 
1618
-		// Prepare recurring totals.
1618
+        // Prepare recurring totals.
1619 1619
         $data = apply_filters(
1620
-			'wpinv_get_invoice_recurring_details',
1621
-			array(
1622
-				'cart_details' => $this->get_cart_details(),
1623
-				'subtotal'     => $this->totals['subtotal']['recurring'],
1624
-				'discount'     => $this->totals['discount']['recurring'],
1625
-				'tax'          => $this->totals['tax']['recurring'],
1626
-				'fee'          => $this->totals['fee']['recurring'],
1627
-				'total'        => $this->get_recurring_total(),
1628
-			),
1629
-			$this,
1630
-			$field,
1631
-			$currency
1632
-		);
1620
+            'wpinv_get_invoice_recurring_details',
1621
+            array(
1622
+                'cart_details' => $this->get_cart_details(),
1623
+                'subtotal'     => $this->totals['subtotal']['recurring'],
1624
+                'discount'     => $this->totals['discount']['recurring'],
1625
+                'tax'          => $this->totals['tax']['recurring'],
1626
+                'fee'          => $this->totals['fee']['recurring'],
1627
+                'total'        => $this->get_recurring_total(),
1628
+            ),
1629
+            $this,
1630
+            $field,
1631
+            $currency
1632
+        );
1633 1633
 
1634 1634
         if ( isset( $data[ $field ] ) ) {
1635 1635
             return ( $currency ? wpinv_price( $data[ $field ], $this->get_currency() ) : $data[ $field ] );
@@ -1639,166 +1639,166 @@  discard block
 block discarded – undo
1639 1639
     }
1640 1640
 
1641 1641
     /**
1642
-	 * Get the invoice fees.
1643
-	 *
1644
-	 * @since 1.0.19
1645
-	 * @param  string $context View or edit context.
1646
-	 * @return array
1647
-	 */
1648
-	public function get_fees( $context = 'view' ) {
1649
-		return wpinv_parse_list( $this->get_prop( 'fees', $context ) );
1642
+     * Get the invoice fees.
1643
+     *
1644
+     * @since 1.0.19
1645
+     * @param  string $context View or edit context.
1646
+     * @return array
1647
+     */
1648
+    public function get_fees( $context = 'view' ) {
1649
+        return wpinv_parse_list( $this->get_prop( 'fees', $context ) );
1650 1650
     }
1651 1651
 
1652 1652
     /**
1653
-	 * Get the invoice discounts.
1654
-	 *
1655
-	 * @since 1.0.19
1656
-	 * @param  string $context View or edit context.
1657
-	 * @return array
1658
-	 */
1659
-	public function get_discounts( $context = 'view' ) {
1660
-		return wpinv_parse_list( $this->get_prop( 'discounts', $context ) );
1653
+     * Get the invoice discounts.
1654
+     *
1655
+     * @since 1.0.19
1656
+     * @param  string $context View or edit context.
1657
+     * @return array
1658
+     */
1659
+    public function get_discounts( $context = 'view' ) {
1660
+        return wpinv_parse_list( $this->get_prop( 'discounts', $context ) );
1661 1661
     }
1662 1662
 
1663 1663
     /**
1664
-	 * Get the invoice taxes.
1665
-	 *
1666
-	 * @since 1.0.19
1667
-	 * @param  string $context View or edit context.
1668
-	 * @return array
1669
-	 */
1670
-	public function get_taxes( $context = 'view' ) {
1671
-		return wpinv_parse_list( $this->get_prop( 'taxes', $context ) );
1664
+     * Get the invoice taxes.
1665
+     *
1666
+     * @since 1.0.19
1667
+     * @param  string $context View or edit context.
1668
+     * @return array
1669
+     */
1670
+    public function get_taxes( $context = 'view' ) {
1671
+        return wpinv_parse_list( $this->get_prop( 'taxes', $context ) );
1672 1672
     }
1673 1673
 
1674 1674
     /**
1675
-	 * Get the invoice items.
1676
-	 *
1677
-	 * @since 1.0.19
1678
-	 * @param  string $context View or edit context.
1679
-	 * @return GetPaid_Form_Item[]
1680
-	 */
1681
-	public function get_items( $context = 'view' ) {
1675
+     * Get the invoice items.
1676
+     *
1677
+     * @since 1.0.19
1678
+     * @param  string $context View or edit context.
1679
+     * @return GetPaid_Form_Item[]
1680
+     */
1681
+    public function get_items( $context = 'view' ) {
1682 1682
         return $this->get_prop( 'items', $context );
1683
-	}
1683
+    }
1684 1684
 
1685
-	/**
1686
-	 * Get the invoice item ids.
1687
-	 *
1688
-	 * @since 1.0.19
1689
-	 * @return string
1690
-	 */
1691
-	public function get_item_ids() {
1692
-		return implode( ', ', wp_list_pluck( $this->get_cart_details(), 'item_id' ) );
1685
+    /**
1686
+     * Get the invoice item ids.
1687
+     *
1688
+     * @since 1.0.19
1689
+     * @return string
1690
+     */
1691
+    public function get_item_ids() {
1692
+        return implode( ', ', wp_list_pluck( $this->get_cart_details(), 'item_id' ) );
1693 1693
     }
1694 1694
 
1695 1695
     /**
1696
-	 * Get the invoice's payment form.
1697
-	 *
1698
-	 * @since 1.0.19
1699
-	 * @param  string $context View or edit context.
1700
-	 * @return int
1701
-	 */
1702
-	public function get_payment_form( $context = 'view' ) {
1703
-		return intval( $this->get_prop( 'payment_form', $context ) );
1696
+     * Get the invoice's payment form.
1697
+     *
1698
+     * @since 1.0.19
1699
+     * @param  string $context View or edit context.
1700
+     * @return int
1701
+     */
1702
+    public function get_payment_form( $context = 'view' ) {
1703
+        return intval( $this->get_prop( 'payment_form', $context ) );
1704 1704
     }
1705 1705
 
1706 1706
     /**
1707
-	 * Get the invoice's submission id.
1708
-	 *
1709
-	 * @since 1.0.19
1710
-	 * @param  string $context View or edit context.
1711
-	 * @return string
1712
-	 */
1713
-	public function get_submission_id( $context = 'view' ) {
1714
-		return $this->get_prop( 'submission_id', $context );
1707
+     * Get the invoice's submission id.
1708
+     *
1709
+     * @since 1.0.19
1710
+     * @param  string $context View or edit context.
1711
+     * @return string
1712
+     */
1713
+    public function get_submission_id( $context = 'view' ) {
1714
+        return $this->get_prop( 'submission_id', $context );
1715 1715
     }
1716 1716
 
1717 1717
     /**
1718
-	 * Get the invoice's discount code.
1719
-	 *
1720
-	 * @since 1.0.19
1721
-	 * @param  string $context View or edit context.
1722
-	 * @return string
1723
-	 */
1724
-	public function get_discount_code( $context = 'view' ) {
1725
-		return $this->get_prop( 'discount_code', $context );
1718
+     * Get the invoice's discount code.
1719
+     *
1720
+     * @since 1.0.19
1721
+     * @param  string $context View or edit context.
1722
+     * @return string
1723
+     */
1724
+    public function get_discount_code( $context = 'view' ) {
1725
+        return $this->get_prop( 'discount_code', $context );
1726 1726
     }
1727 1727
 
1728 1728
     /**
1729
-	 * Get the invoice's gateway.
1730
-	 *
1731
-	 * @since 1.0.19
1732
-	 * @param  string $context View or edit context.
1733
-	 * @return string
1734
-	 */
1735
-	public function get_gateway( $context = 'view' ) {
1736
-		return $this->get_prop( 'gateway', $context );
1729
+     * Get the invoice's gateway.
1730
+     *
1731
+     * @since 1.0.19
1732
+     * @param  string $context View or edit context.
1733
+     * @return string
1734
+     */
1735
+    public function get_gateway( $context = 'view' ) {
1736
+        return $this->get_prop( 'gateway', $context );
1737 1737
     }
1738 1738
 
1739 1739
     /**
1740
-	 * Get the invoice's gateway display title.
1741
-	 *
1742
-	 * @since 1.0.19
1743
-	 * @return string
1744
-	 */
1740
+     * Get the invoice's gateway display title.
1741
+     *
1742
+     * @since 1.0.19
1743
+     * @return string
1744
+     */
1745 1745
     public function get_gateway_title() {
1746 1746
         $title = wpinv_get_gateway_checkout_label( $this->get_gateway() );
1747 1747
         return apply_filters( 'wpinv_gateway_title', $title, $this->get_id(), $this );
1748 1748
     }
1749 1749
 
1750 1750
     /**
1751
-	 * Get the invoice's transaction id.
1752
-	 *
1753
-	 * @since 1.0.19
1754
-	 * @param  string $context View or edit context.
1755
-	 * @return string
1756
-	 */
1757
-	public function get_transaction_id( $context = 'view' ) {
1758
-		return $this->get_prop( 'transaction_id', $context );
1751
+     * Get the invoice's transaction id.
1752
+     *
1753
+     * @since 1.0.19
1754
+     * @param  string $context View or edit context.
1755
+     * @return string
1756
+     */
1757
+    public function get_transaction_id( $context = 'view' ) {
1758
+        return $this->get_prop( 'transaction_id', $context );
1759 1759
     }
1760 1760
 
1761 1761
     /**
1762
-	 * Get the invoice's currency.
1763
-	 *
1764
-	 * @since 1.0.19
1765
-	 * @param  string $context View or edit context.
1766
-	 * @return string
1767
-	 */
1768
-	public function get_currency( $context = 'view' ) {
1762
+     * Get the invoice's currency.
1763
+     *
1764
+     * @since 1.0.19
1765
+     * @param  string $context View or edit context.
1766
+     * @return string
1767
+     */
1768
+    public function get_currency( $context = 'view' ) {
1769 1769
         $currency = $this->get_prop( 'currency', $context );
1770 1770
         return empty( $currency ) ? wpinv_get_currency() : $currency;
1771 1771
     }
1772 1772
 
1773 1773
     /**
1774
-	 * Checks if we are charging taxes for this invoice.
1775
-	 *
1776
-	 * @since 1.0.19
1777
-	 * @param  string $context View or edit context.
1778
-	 * @return bool
1779
-	 */
1780
-	public function get_disable_taxes( $context = 'view' ) {
1774
+     * Checks if we are charging taxes for this invoice.
1775
+     *
1776
+     * @since 1.0.19
1777
+     * @param  string $context View or edit context.
1778
+     * @return bool
1779
+     */
1780
+    public function get_disable_taxes( $context = 'view' ) {
1781 1781
         return (bool) $this->get_prop( 'disable_taxes', $context );
1782 1782
     }
1783 1783
 
1784 1784
     /**
1785
-	 * Retrieves the subscription id for an invoice.
1786
-	 *
1787
-	 * @since 1.0.19
1788
-	 * @param  string $context View or edit context.
1789
-	 * @return int
1790
-	 */
1785
+     * Retrieves the subscription id for an invoice.
1786
+     *
1787
+     * @since 1.0.19
1788
+     * @param  string $context View or edit context.
1789
+     * @return int
1790
+     */
1791 1791
     public function get_subscription_id( $context = 'view' ) {
1792
-		return $this->is_renewal() ? $this->get_parent()->get_subscription_id( $context ) : $this->get_prop( 'subscription_id', $context );
1793
-	}
1794
-
1795
-	/**
1796
-	 * Retrieves the remote subscription id for an invoice.
1797
-	 *
1798
-	 * @since 1.0.19
1799
-	 * @param  string $context View or edit context.
1800
-	 * @return int
1801
-	 */
1792
+        return $this->is_renewal() ? $this->get_parent()->get_subscription_id( $context ) : $this->get_prop( 'subscription_id', $context );
1793
+    }
1794
+
1795
+    /**
1796
+     * Retrieves the remote subscription id for an invoice.
1797
+     *
1798
+     * @since 1.0.19
1799
+     * @param  string $context View or edit context.
1800
+     * @return int
1801
+     */
1802 1802
     public function get_remote_subscription_id( $context = 'view' ) {
1803 1803
         $subscription_id = $this->get_prop( 'remote_subscription_id', $context );
1804 1804
 
@@ -1811,12 +1811,12 @@  discard block
 block discarded – undo
1811 1811
     }
1812 1812
 
1813 1813
     /**
1814
-	 * Retrieves the payment meta for an invoice.
1815
-	 *
1816
-	 * @since 1.0.19
1817
-	 * @param  string $context View or edit context.
1818
-	 * @return array
1819
-	 */
1814
+     * Retrieves the payment meta for an invoice.
1815
+     *
1816
+     * @since 1.0.19
1817
+     * @param  string $context View or edit context.
1818
+     * @return array
1819
+     */
1820 1820
     public function get_payment_meta( $context = 'view' ) {
1821 1821
 
1822 1822
         return array(
@@ -1836,31 +1836,31 @@  discard block
 block discarded – undo
1836 1836
     }
1837 1837
 
1838 1838
     /**
1839
-	 * Retrieves the cart details for an invoice.
1840
-	 *
1841
-	 * @since 1.0.19
1842
-	 * @return array
1843
-	 */
1839
+     * Retrieves the cart details for an invoice.
1840
+     *
1841
+     * @since 1.0.19
1842
+     * @return array
1843
+     */
1844 1844
     public function get_cart_details() {
1845 1845
         $items        = $this->get_items();
1846 1846
         $cart_details = array();
1847 1847
 
1848 1848
         foreach ( $items as $item ) {
1849
-			$item->invoice_id = $this->get_id();
1849
+            $item->invoice_id = $this->get_id();
1850 1850
             $cart_details[]   = $item->prepare_data_for_saving();
1851 1851
         }
1852 1852
 
1853 1853
         return $cart_details;
1854
-	}
1854
+    }
1855 1855
 
1856
-	/**
1857
-	 * Retrieves the recurring item.
1858
-	 *
1859
-	 * @return null|GetPaid_Form_Item|int
1860
-	 */
1861
-	public function get_recurring( $object = false ) {
1856
+    /**
1857
+     * Retrieves the recurring item.
1858
+     *
1859
+     * @return null|GetPaid_Form_Item|int
1860
+     */
1861
+    public function get_recurring( $object = false ) {
1862 1862
 
1863
-		// Are we returning an object?
1863
+        // Are we returning an object?
1864 1864
         if ( $object ) {
1865 1865
             return $this->get_item( $this->recurring_item );
1866 1866
         }
@@ -1868,124 +1868,124 @@  discard block
 block discarded – undo
1868 1868
         return $this->recurring_item;
1869 1869
     }
1870 1870
 
1871
-	/**
1872
-	 * Retrieves the subscription name.
1873
-	 *
1874
-	 * @since 1.0.19
1875
-	 * @return string
1876
-	 */
1877
-	public function get_subscription_name() {
1871
+    /**
1872
+     * Retrieves the subscription name.
1873
+     *
1874
+     * @since 1.0.19
1875
+     * @return string
1876
+     */
1877
+    public function get_subscription_name() {
1878 1878
 
1879
-		// Retrieve the recurring name
1879
+        // Retrieve the recurring name
1880 1880
         $item = $this->get_recurring( true );
1881 1881
 
1882
-		// Abort if it does not exist.
1882
+        // Abort if it does not exist.
1883 1883
         if ( empty( $item ) ) {
1884 1884
             return '';
1885 1885
         }
1886 1886
 
1887
-		// Return the item name.
1887
+        // Return the item name.
1888 1888
         return apply_filters( 'wpinv_invoice_get_subscription_name', $item->get_name(), $this );
1889
-	}
1890
-
1891
-	/**
1892
-	 * Retrieves the view url.
1893
-	 *
1894
-	 * @since 1.0.19
1895
-	 * @return string
1896
-	 */
1897
-	public function get_view_url() {
1889
+    }
1890
+
1891
+    /**
1892
+     * Retrieves the view url.
1893
+     *
1894
+     * @since 1.0.19
1895
+     * @return string
1896
+     */
1897
+    public function get_view_url() {
1898 1898
         $invoice_url = get_permalink( $this->get_id() );
1899
-		$invoice_url = add_query_arg( 'invoice_key', $this->get_key(), $invoice_url );
1899
+        $invoice_url = add_query_arg( 'invoice_key', $this->get_key(), $invoice_url );
1900 1900
         return apply_filters( 'wpinv_get_view_url', $invoice_url, $this );
1901
-	}
1901
+    }
1902 1902
 
1903
-	/**
1904
-	 * Retrieves the payment url.
1905
-	 *
1906
-	 * @since 1.0.19
1907
-	 * @return string
1908
-	 */
1909
-	public function get_checkout_payment_url( $deprecated = false, $secret = false ) {
1903
+    /**
1904
+     * Retrieves the payment url.
1905
+     *
1906
+     * @since 1.0.19
1907
+     * @return string
1908
+     */
1909
+    public function get_checkout_payment_url( $deprecated = false, $secret = false ) {
1910 1910
 
1911
-		// Retrieve the checkout url.
1911
+        // Retrieve the checkout url.
1912 1912
         $pay_url = wpinv_get_checkout_uri();
1913 1913
 
1914
-		// Maybe force ssl.
1914
+        // Maybe force ssl.
1915 1915
         if ( is_ssl() ) {
1916 1916
             $pay_url = str_replace( 'http:', 'https:', $pay_url );
1917 1917
         }
1918 1918
 
1919
-		// Add the invoice key.
1920
-		$pay_url = add_query_arg( 'invoice_key', $this->get_key(), $pay_url );
1919
+        // Add the invoice key.
1920
+        $pay_url = add_query_arg( 'invoice_key', $this->get_key(), $pay_url );
1921 1921
 
1922
-		// (Maybe?) add a secret
1922
+        // (Maybe?) add a secret
1923 1923
         if ( $secret ) {
1924 1924
             $pay_url = add_query_arg( array( '_wpipay' => md5( $this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key() ) ), $pay_url );
1925 1925
         }
1926 1926
 
1927 1927
         return apply_filters( 'wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret );
1928
-	}
1928
+    }
1929 1929
 
1930
-	/**
1931
-	 * Retrieves the receipt url.
1932
-	 *
1933
-	 * @since 1.0.19
1934
-	 * @return string
1935
-	 */
1936
-	public function get_receipt_url() {
1930
+    /**
1931
+     * Retrieves the receipt url.
1932
+     *
1933
+     * @since 1.0.19
1934
+     * @return string
1935
+     */
1936
+    public function get_receipt_url() {
1937 1937
 
1938
-		// Retrieve the checkout url.
1938
+        // Retrieve the checkout url.
1939 1939
         $receipt_url = wpinv_get_success_page_uri();
1940 1940
 
1941
-		// Maybe force ssl.
1941
+        // Maybe force ssl.
1942 1942
         if ( is_ssl() ) {
1943 1943
             $receipt_url = str_replace( 'http:', 'https:', $receipt_url );
1944 1944
         }
1945 1945
 
1946
-		// Add the invoice key.
1947
-		$receipt_url = add_query_arg( 'invoice_key', $this->get_key(), $receipt_url );
1946
+        // Add the invoice key.
1947
+        $receipt_url = add_query_arg( 'invoice_key', $this->get_key(), $receipt_url );
1948 1948
 
1949 1949
         return apply_filters( 'getpaid_get_invoice_receipt_url', $receipt_url, $this );
1950
-	}
1951
-
1952
-	/**
1953
-	 * Retrieves the remote transaction url.
1954
-	 *
1955
-	 * @since 1.6.0
1956
-	 * @return string
1957
-	 */
1958
-	public function get_transaction_url() {
1959
-		return apply_filters( 'getpaid_gateway_' . $this->get_gateway() . '_transaction_url', '', $this );
1960
-	}
1961
-
1962
-	/**
1963
-	 * Retrieves the default status.
1964
-	 *
1965
-	 * @since 1.0.19
1966
-	 * @return string
1967
-	 */
1968
-	public function get_default_status() {
1969
-
1970
-		$type   = $this->get_type();
1971
-		$status = "wpi-$type-pending";
1972
-		return str_replace( '-invoice', '', $status );
1973
-
1974
-	}
1975
-
1976
-    /**
1977
-	 * Magic method for accessing invoice properties.
1978
-	 *
1979
-	 * @since 1.0.15
1980
-	 * @access public
1981
-	 *
1982
-	 * @param string $key Discount data to retrieve
1983
-	 * @param  string $context View or edit context.
1984
-	 * @return mixed Value of the given invoice property (if set).
1985
-	 */
1986
-	public function get( $key, $context = 'view' ) {
1950
+    }
1951
+
1952
+    /**
1953
+     * Retrieves the remote transaction url.
1954
+     *
1955
+     * @since 1.6.0
1956
+     * @return string
1957
+     */
1958
+    public function get_transaction_url() {
1959
+        return apply_filters( 'getpaid_gateway_' . $this->get_gateway() . '_transaction_url', '', $this );
1960
+    }
1961
+
1962
+    /**
1963
+     * Retrieves the default status.
1964
+     *
1965
+     * @since 1.0.19
1966
+     * @return string
1967
+     */
1968
+    public function get_default_status() {
1969
+
1970
+        $type   = $this->get_type();
1971
+        $status = "wpi-$type-pending";
1972
+        return str_replace( '-invoice', '', $status );
1973
+
1974
+    }
1975
+
1976
+    /**
1977
+     * Magic method for accessing invoice properties.
1978
+     *
1979
+     * @since 1.0.15
1980
+     * @access public
1981
+     *
1982
+     * @param string $key Discount data to retrieve
1983
+     * @param  string $context View or edit context.
1984
+     * @return mixed Value of the given invoice property (if set).
1985
+     */
1986
+    public function get( $key, $context = 'view' ) {
1987 1987
         return $this->get_prop( $key, $context );
1988
-	}
1988
+    }
1989 1989
 
1990 1990
     /*
1991 1991
 	|--------------------------------------------------------------------------
@@ -1998,129 +1998,129 @@  discard block
 block discarded – undo
1998 1998
     */
1999 1999
 
2000 2000
     /**
2001
-	 * Magic method for setting invoice properties.
2002
-	 *
2003
-	 * @since 1.0.19
2004
-	 * @access public
2005
-	 *
2006
-	 * @param string $key Discount data to retrieve
2007
-	 * @param  mixed $value new value.
2008
-	 * @return mixed Value of the given invoice property (if set).
2009
-	 */
2010
-	public function set( $key, $value ) {
2001
+     * Magic method for setting invoice properties.
2002
+     *
2003
+     * @since 1.0.19
2004
+     * @access public
2005
+     *
2006
+     * @param string $key Discount data to retrieve
2007
+     * @param  mixed $value new value.
2008
+     * @return mixed Value of the given invoice property (if set).
2009
+     */
2010
+    public function set( $key, $value ) {
2011 2011
 
2012 2012
         $setter = "set_$key";
2013 2013
         if ( is_callable( array( $this, $setter ) ) ) {
2014 2014
             $this->{$setter}( $value );
2015 2015
         }
2016 2016
 
2017
-	}
2018
-
2019
-	/**
2020
-	 * Sets item status.
2021
-	 *
2022
-	 * @since 1.0.19
2023
-	 * @param string $new_status    New status.
2024
-	 * @param string $note          Optional note to add.
2025
-	 * @param bool   $manual_update Is this a manual status change?.
2026
-	 * @return array details of change.
2027
-	 */
2028
-	public function set_status( $new_status, $note = '', $manual_update = false ) {
2029
-		$old_status = $this->get_status();
2030
-
2031
-		$statuses = $this->get_all_statuses();
2032
-
2033
-		if ( isset( $statuses['draft'] ) ) {
2034
-			unset( $statuses['draft'] );
2035
-		}
2036
-
2037
-		$this->set_prop( 'status', $new_status );
2038
-
2039
-		// If setting the status, ensure it's set to a valid status.
2040
-		if ( true === $this->object_read ) {
2041
-
2042
-			// Only allow valid new status.
2043
-			if ( ! array_key_exists( $new_status, $statuses ) ) {
2044
-				$new_status = $this->get_default_status();
2045
-			}
2046
-
2047
-			// If the old status is set but unknown (e.g. draft) assume its pending for action usage.
2048
-			if ( $old_status && ! array_key_exists( $new_status, $statuses ) ) {
2049
-				$old_status = $this->get_default_status();
2050
-			}
2051
-
2052
-			// Paid - Renewal (i.e when duplicating a parent invoice )
2053
-			if ( $new_status == 'wpi-pending' && $old_status == 'publish' && ! $this->get_id() ) {
2054
-				$old_status = 'wpi-pending';
2055
-			}
2056
-
2057
-			if ( $old_status !== $new_status ) {
2058
-				$this->status_transition = array(
2059
-					'from'   => ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $old_status,
2060
-					'to'     => $new_status,
2061
-					'note'   => $note,
2062
-					'manual' => (bool) $manual_update,
2063
-				);
2064
-
2065
-				if ( $manual_update ) {
2066
-					do_action( 'getpaid_' . $this->object_type . '_edit_status', $this->get_id(), $new_status );
2067
-				}
2068
-
2069
-				$this->maybe_set_date_paid();
2070
-
2071
-			}
2072
-		}
2073
-
2074
-		return array(
2075
-			'from' => $old_status,
2076
-			'to'   => $new_status,
2077
-		);
2078
-	}
2079
-
2080
-	/**
2081
-	 * Maybe set date paid.
2082
-	 *
2083
-	 * Sets the date paid variable when transitioning to the payment complete
2084
-	 * order status.
2085
-	 *
2086
-	 * @since 1.0.19
2087
-	 */
2088
-	public function maybe_set_date_paid() {
2089
-
2090
-		if ( ! $this->get_date_completed( 'edit' ) && $this->is_paid() ) {
2091
-			$this->set_date_completed( current_time( 'mysql' ) );
2092
-		}
2093
-	}
2094
-
2095
-    /**
2096
-	 * Set parent invoice ID.
2097
-	 *
2098
-	 * @since 1.0.19
2099
-	 */
2100
-	public function set_parent_id( $value ) {
2101
-		if ( $value && ( $value === $this->get_id() ) ) {
2102
-			return;
2103
-		}
2104
-		$this->set_prop( 'parent_id', absint( $value ) );
2105
-    }
2106
-
2107
-    /**
2108
-	 * Set plugin version when the invoice was created.
2109
-	 *
2110
-	 * @since 1.0.19
2111
-	 */
2112
-	public function set_version( $value ) {
2113
-		$this->set_prop( 'version', $value );
2114
-    }
2115
-
2116
-    /**
2117
-	 * Set date when the invoice was created.
2118
-	 *
2119
-	 * @since 1.0.19
2120
-	 * @param string $value Value to set.
2017
+    }
2018
+
2019
+    /**
2020
+     * Sets item status.
2021
+     *
2022
+     * @since 1.0.19
2023
+     * @param string $new_status    New status.
2024
+     * @param string $note          Optional note to add.
2025
+     * @param bool   $manual_update Is this a manual status change?.
2026
+     * @return array details of change.
2027
+     */
2028
+    public function set_status( $new_status, $note = '', $manual_update = false ) {
2029
+        $old_status = $this->get_status();
2030
+
2031
+        $statuses = $this->get_all_statuses();
2032
+
2033
+        if ( isset( $statuses['draft'] ) ) {
2034
+            unset( $statuses['draft'] );
2035
+        }
2036
+
2037
+        $this->set_prop( 'status', $new_status );
2038
+
2039
+        // If setting the status, ensure it's set to a valid status.
2040
+        if ( true === $this->object_read ) {
2041
+
2042
+            // Only allow valid new status.
2043
+            if ( ! array_key_exists( $new_status, $statuses ) ) {
2044
+                $new_status = $this->get_default_status();
2045
+            }
2046
+
2047
+            // If the old status is set but unknown (e.g. draft) assume its pending for action usage.
2048
+            if ( $old_status && ! array_key_exists( $new_status, $statuses ) ) {
2049
+                $old_status = $this->get_default_status();
2050
+            }
2051
+
2052
+            // Paid - Renewal (i.e when duplicating a parent invoice )
2053
+            if ( $new_status == 'wpi-pending' && $old_status == 'publish' && ! $this->get_id() ) {
2054
+                $old_status = 'wpi-pending';
2055
+            }
2056
+
2057
+            if ( $old_status !== $new_status ) {
2058
+                $this->status_transition = array(
2059
+                    'from'   => ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $old_status,
2060
+                    'to'     => $new_status,
2061
+                    'note'   => $note,
2062
+                    'manual' => (bool) $manual_update,
2063
+                );
2064
+
2065
+                if ( $manual_update ) {
2066
+                    do_action( 'getpaid_' . $this->object_type . '_edit_status', $this->get_id(), $new_status );
2067
+                }
2068
+
2069
+                $this->maybe_set_date_paid();
2070
+
2071
+            }
2072
+        }
2073
+
2074
+        return array(
2075
+            'from' => $old_status,
2076
+            'to'   => $new_status,
2077
+        );
2078
+    }
2079
+
2080
+    /**
2081
+     * Maybe set date paid.
2082
+     *
2083
+     * Sets the date paid variable when transitioning to the payment complete
2084
+     * order status.
2085
+     *
2086
+     * @since 1.0.19
2087
+     */
2088
+    public function maybe_set_date_paid() {
2089
+
2090
+        if ( ! $this->get_date_completed( 'edit' ) && $this->is_paid() ) {
2091
+            $this->set_date_completed( current_time( 'mysql' ) );
2092
+        }
2093
+    }
2094
+
2095
+    /**
2096
+     * Set parent invoice ID.
2097
+     *
2098
+     * @since 1.0.19
2099
+     */
2100
+    public function set_parent_id( $value ) {
2101
+        if ( $value && ( $value === $this->get_id() ) ) {
2102
+            return;
2103
+        }
2104
+        $this->set_prop( 'parent_id', absint( $value ) );
2105
+    }
2106
+
2107
+    /**
2108
+     * Set plugin version when the invoice was created.
2109
+     *
2110
+     * @since 1.0.19
2111
+     */
2112
+    public function set_version( $value ) {
2113
+        $this->set_prop( 'version', $value );
2114
+    }
2115
+
2116
+    /**
2117
+     * Set date when the invoice was created.
2118
+     *
2119
+     * @since 1.0.19
2120
+     * @param string $value Value to set.
2121 2121
      * @return bool Whether or not the date was set.
2122
-	 */
2123
-	public function set_date_created( $value ) {
2122
+     */
2123
+    public function set_date_created( $value ) {
2124 2124
         $date = strtotime( $value );
2125 2125
 
2126 2126
         if ( $date && $value !== '0000-00-00 00:00:00' ) {
@@ -2128,19 +2128,19 @@  discard block
 block discarded – undo
2128 2128
             return true;
2129 2129
         }
2130 2130
 
2131
-		$this->set_prop( 'date_created', '' );
2132
-		return false;
2131
+        $this->set_prop( 'date_created', '' );
2132
+        return false;
2133 2133
 
2134 2134
     }
2135 2135
 
2136 2136
     /**
2137
-	 * Set date invoice due date.
2138
-	 *
2139
-	 * @since 1.0.19
2140
-	 * @param string $value Value to set.
2137
+     * Set date invoice due date.
2138
+     *
2139
+     * @since 1.0.19
2140
+     * @param string $value Value to set.
2141 2141
      * @return bool Whether or not the date was set.
2142
-	 */
2143
-	public function set_due_date( $value ) {
2142
+     */
2143
+    public function set_due_date( $value ) {
2144 2144
         $date = strtotime( $value );
2145 2145
 
2146 2146
         if ( $date && $value !== '0000-00-00 00:00:00' ) {
@@ -2148,29 +2148,29 @@  discard block
 block discarded – undo
2148 2148
             return true;
2149 2149
         }
2150 2150
 
2151
-		$this->set_prop( 'due_date', '' );
2151
+        $this->set_prop( 'due_date', '' );
2152 2152
         return false;
2153 2153
 
2154 2154
     }
2155 2155
 
2156 2156
     /**
2157
-	 * Alias of self::set_due_date().
2158
-	 *
2159
-	 * @since 1.0.19
2160
-	 * @param  string $value New name.
2161
-	 */
2162
-	public function set_date_due( $value ) {
2163
-		$this->set_due_date( $value );
2157
+     * Alias of self::set_due_date().
2158
+     *
2159
+     * @since 1.0.19
2160
+     * @param  string $value New name.
2161
+     */
2162
+    public function set_date_due( $value ) {
2163
+        $this->set_due_date( $value );
2164 2164
     }
2165 2165
 
2166 2166
     /**
2167
-	 * Set date invoice was completed.
2168
-	 *
2169
-	 * @since 1.0.19
2170
-	 * @param string $value Value to set.
2167
+     * Set date invoice was completed.
2168
+     *
2169
+     * @since 1.0.19
2170
+     * @param string $value Value to set.
2171 2171
      * @return bool Whether or not the date was set.
2172
-	 */
2173
-	public function set_completed_date( $value ) {
2172
+     */
2173
+    public function set_completed_date( $value ) {
2174 2174
         $date = strtotime( $value );
2175 2175
 
2176 2176
         if ( $date && $value !== '0000-00-00 00:00:00' ) {
@@ -2178,29 +2178,29 @@  discard block
 block discarded – undo
2178 2178
             return true;
2179 2179
         }
2180 2180
 
2181
-		$this->set_prop( 'completed_date', '' );
2181
+        $this->set_prop( 'completed_date', '' );
2182 2182
         return false;
2183 2183
 
2184 2184
     }
2185 2185
 
2186 2186
     /**
2187
-	 * Alias of self::set_completed_date().
2188
-	 *
2189
-	 * @since 1.0.19
2190
-	 * @param  string $value New name.
2191
-	 */
2192
-	public function set_date_completed( $value ) {
2193
-		$this->set_completed_date( $value );
2187
+     * Alias of self::set_completed_date().
2188
+     *
2189
+     * @since 1.0.19
2190
+     * @param  string $value New name.
2191
+     */
2192
+    public function set_date_completed( $value ) {
2193
+        $this->set_completed_date( $value );
2194 2194
     }
2195 2195
 
2196 2196
     /**
2197
-	 * Set date when the invoice was last modified.
2198
-	 *
2199
-	 * @since 1.0.19
2200
-	 * @param string $value Value to set.
2197
+     * Set date when the invoice was last modified.
2198
+     *
2199
+     * @since 1.0.19
2200
+     * @param string $value Value to set.
2201 2201
      * @return bool Whether or not the date was set.
2202
-	 */
2203
-	public function set_date_modified( $value ) {
2202
+     */
2203
+    public function set_date_modified( $value ) {
2204 2204
         $date = strtotime( $value );
2205 2205
 
2206 2206
         if ( $date && $value !== '0000-00-00 00:00:00' ) {
@@ -2208,813 +2208,813 @@  discard block
 block discarded – undo
2208 2208
             return true;
2209 2209
         }
2210 2210
 
2211
-		$this->set_prop( 'date_modified', '' );
2211
+        $this->set_prop( 'date_modified', '' );
2212 2212
         return false;
2213 2213
 
2214 2214
     }
2215 2215
 
2216 2216
     /**
2217
-	 * Set the invoice number.
2218
-	 *
2219
-	 * @since 1.0.19
2220
-	 * @param  string $value New number.
2221
-	 */
2222
-	public function set_number( $value ) {
2217
+     * Set the invoice number.
2218
+     *
2219
+     * @since 1.0.19
2220
+     * @param  string $value New number.
2221
+     */
2222
+    public function set_number( $value ) {
2223 2223
         $number = sanitize_text_field( $value );
2224
-		$this->set_prop( 'number', $number );
2224
+        $this->set_prop( 'number', $number );
2225 2225
     }
2226 2226
 
2227 2227
     /**
2228
-	 * Set the invoice type.
2229
-	 *
2230
-	 * @since 1.0.19
2231
-	 * @param  string $value Type.
2232
-	 */
2233
-	public function set_type( $value ) {
2228
+     * Set the invoice type.
2229
+     *
2230
+     * @since 1.0.19
2231
+     * @param  string $value Type.
2232
+     */
2233
+    public function set_type( $value ) {
2234 2234
         $type = sanitize_text_field( str_replace( 'wpi_', '', $value ) );
2235
-		$this->set_prop( 'type', $type );
2236
-	}
2235
+        $this->set_prop( 'type', $type );
2236
+    }
2237 2237
 
2238 2238
     /**
2239
-	 * Set the invoice post type.
2240
-	 *
2241
-	 * @since 1.0.19
2242
-	 * @param  string $value Post type.
2243
-	 */
2244
-	public function set_post_type( $value ) {
2239
+     * Set the invoice post type.
2240
+     *
2241
+     * @since 1.0.19
2242
+     * @param  string $value Post type.
2243
+     */
2244
+    public function set_post_type( $value ) {
2245 2245
         if ( getpaid_is_invoice_post_type( $value ) ) {
2246
-			$this->set_type( $value );
2246
+            $this->set_type( $value );
2247 2247
             $this->set_prop( 'post_type', $value );
2248 2248
         }
2249 2249
     }
2250 2250
 
2251 2251
     /**
2252
-	 * Set the invoice key.
2253
-	 *
2254
-	 * @since 1.0.19
2255
-	 * @param  string $value New key.
2256
-	 */
2257
-	public function set_key( $value ) {
2252
+     * Set the invoice key.
2253
+     *
2254
+     * @since 1.0.19
2255
+     * @param  string $value New key.
2256
+     */
2257
+    public function set_key( $value ) {
2258 2258
         $key = sanitize_text_field( $value );
2259
-		$this->set_prop( 'key', $key );
2259
+        $this->set_prop( 'key', $key );
2260 2260
     }
2261 2261
 
2262 2262
     /**
2263
-	 * Set the invoice mode.
2264
-	 *
2265
-	 * @since 1.0.19
2266
-	 * @param  string $value mode.
2267
-	 */
2268
-	public function set_mode( $value ) {
2263
+     * Set the invoice mode.
2264
+     *
2265
+     * @since 1.0.19
2266
+     * @param  string $value mode.
2267
+     */
2268
+    public function set_mode( $value ) {
2269 2269
         if ( in_array( $value, array( 'live', 'test' ) ) ) {
2270 2270
             $this->set_prop( 'mode', $value );
2271 2271
         }
2272 2272
     }
2273 2273
 
2274 2274
     /**
2275
-	 * Set the invoice path.
2276
-	 *
2277
-	 * @since 1.0.19
2278
-	 * @param  string $value path.
2279
-	 */
2280
-	public function set_path( $value ) {
2275
+     * Set the invoice path.
2276
+     *
2277
+     * @since 1.0.19
2278
+     * @param  string $value path.
2279
+     */
2280
+    public function set_path( $value ) {
2281 2281
         $this->set_prop( 'path', $value );
2282 2282
     }
2283 2283
 
2284 2284
     /**
2285
-	 * Set the invoice name.
2286
-	 *
2287
-	 * @since 1.0.19
2288
-	 * @param  string $value New name.
2289
-	 */
2290
-	public function set_name( $value ) {
2285
+     * Set the invoice name.
2286
+     *
2287
+     * @since 1.0.19
2288
+     * @param  string $value New name.
2289
+     */
2290
+    public function set_name( $value ) {
2291 2291
         $name = sanitize_text_field( $value );
2292
-		$this->set_prop( 'name', $name );
2292
+        $this->set_prop( 'name', $name );
2293 2293
     }
2294 2294
 
2295 2295
     /**
2296
-	 * Alias of self::set_name().
2297
-	 *
2298
-	 * @since 1.0.19
2299
-	 * @param  string $value New name.
2300
-	 */
2301
-	public function set_title( $value ) {
2302
-		$this->set_name( $value );
2296
+     * Alias of self::set_name().
2297
+     *
2298
+     * @since 1.0.19
2299
+     * @param  string $value New name.
2300
+     */
2301
+    public function set_title( $value ) {
2302
+        $this->set_name( $value );
2303 2303
     }
2304 2304
 
2305 2305
     /**
2306
-	 * Set the invoice description.
2307
-	 *
2308
-	 * @since 1.0.19
2309
-	 * @param  string $value New description.
2310
-	 */
2311
-	public function set_description( $value ) {
2306
+     * Set the invoice description.
2307
+     *
2308
+     * @since 1.0.19
2309
+     * @param  string $value New description.
2310
+     */
2311
+    public function set_description( $value ) {
2312 2312
         $description = wp_kses_post( $value );
2313
-		$this->set_prop( 'description', $description );
2313
+        $this->set_prop( 'description', $description );
2314
+    }
2315
+
2316
+    /**
2317
+     * Alias of self::set_description().
2318
+     *
2319
+     * @since 1.0.19
2320
+     * @param  string $value New description.
2321
+     */
2322
+    public function set_excerpt( $value ) {
2323
+        $this->set_description( $value );
2324
+    }
2325
+
2326
+    /**
2327
+     * Alias of self::set_description().
2328
+     *
2329
+     * @since 1.0.19
2330
+     * @param  string $value New description.
2331
+     */
2332
+    public function set_summary( $value ) {
2333
+        $this->set_description( $value );
2334
+    }
2335
+
2336
+    /**
2337
+     * Set the receiver of the invoice.
2338
+     *
2339
+     * @since 1.0.19
2340
+     * @param  int $value New author.
2341
+     */
2342
+    public function set_author( $value ) {
2343
+        $user = get_user_by( 'id', (int) $value );
2344
+
2345
+        if ( $user && $user->ID ) {
2346
+            $this->set_prop( 'author', $user->ID );
2347
+            $this->set_prop( 'email', $user->user_email );
2348
+        }
2349
+
2350
+    }
2351
+
2352
+    /**
2353
+     * Alias of self::set_author().
2354
+     *
2355
+     * @since 1.0.19
2356
+     * @param  int $value New user id.
2357
+     */
2358
+    public function set_user_id( $value ) {
2359
+        $this->set_author( $value );
2360
+    }
2361
+
2362
+    /**
2363
+     * Alias of self::set_author().
2364
+     *
2365
+     * @since 1.0.19
2366
+     * @param  int $value New user id.
2367
+     */
2368
+    public function set_customer_id( $value ) {
2369
+        $this->set_author( $value );
2370
+    }
2371
+
2372
+    /**
2373
+     * Set the customer's ip.
2374
+     *
2375
+     * @since 1.0.19
2376
+     * @param  string $value ip address.
2377
+     */
2378
+    public function set_ip( $value ) {
2379
+        $this->set_prop( 'ip', $value );
2380
+    }
2381
+
2382
+    /**
2383
+     * Alias of self::set_ip().
2384
+     *
2385
+     * @since 1.0.19
2386
+     * @param  string $value ip address.
2387
+     */
2388
+    public function set_user_ip( $value ) {
2389
+        $this->set_ip( $value );
2390
+    }
2391
+
2392
+    /**
2393
+     * Set the customer's first name.
2394
+     *
2395
+     * @since 1.0.19
2396
+     * @param  string $value first name.
2397
+     */
2398
+    public function set_first_name( $value ) {
2399
+        $this->set_prop( 'first_name', $value );
2400
+    }
2401
+
2402
+    /**
2403
+     * Alias of self::set_first_name().
2404
+     *
2405
+     * @since 1.0.19
2406
+     * @param  string $value first name.
2407
+     */
2408
+    public function set_user_first_name( $value ) {
2409
+        $this->set_first_name( $value );
2410
+    }
2411
+
2412
+    /**
2413
+     * Alias of self::set_first_name().
2414
+     *
2415
+     * @since 1.0.19
2416
+     * @param  string $value first name.
2417
+     */
2418
+    public function set_customer_first_name( $value ) {
2419
+        $this->set_first_name( $value );
2420
+    }
2421
+
2422
+    /**
2423
+     * Set the customer's last name.
2424
+     *
2425
+     * @since 1.0.19
2426
+     * @param  string $value last name.
2427
+     */
2428
+    public function set_last_name( $value ) {
2429
+        $this->set_prop( 'last_name', $value );
2430
+    }
2431
+
2432
+    /**
2433
+     * Alias of self::set_last_name().
2434
+     *
2435
+     * @since 1.0.19
2436
+     * @param  string $value last name.
2437
+     */
2438
+    public function set_user_last_name( $value ) {
2439
+        $this->set_last_name( $value );
2440
+    }
2441
+
2442
+    /**
2443
+     * Alias of self::set_last_name().
2444
+     *
2445
+     * @since 1.0.19
2446
+     * @param  string $value last name.
2447
+     */
2448
+    public function set_customer_last_name( $value ) {
2449
+        $this->set_last_name( $value );
2450
+    }
2451
+
2452
+    /**
2453
+     * Set the customer's phone number.
2454
+     *
2455
+     * @since 1.0.19
2456
+     * @param  string $value phone.
2457
+     */
2458
+    public function set_phone( $value ) {
2459
+        $this->set_prop( 'phone', $value );
2314 2460
     }
2315 2461
 
2316 2462
     /**
2317
-	 * Alias of self::set_description().
2318
-	 *
2319
-	 * @since 1.0.19
2320
-	 * @param  string $value New description.
2321
-	 */
2322
-	public function set_excerpt( $value ) {
2323
-		$this->set_description( $value );
2463
+     * Alias of self::set_phone().
2464
+     *
2465
+     * @since 1.0.19
2466
+     * @param  string $value phone.
2467
+     */
2468
+    public function set_user_phone( $value ) {
2469
+        $this->set_phone( $value );
2324 2470
     }
2325 2471
 
2326 2472
     /**
2327
-	 * Alias of self::set_description().
2328
-	 *
2329
-	 * @since 1.0.19
2330
-	 * @param  string $value New description.
2331
-	 */
2332
-	public function set_summary( $value ) {
2333
-		$this->set_description( $value );
2473
+     * Alias of self::set_phone().
2474
+     *
2475
+     * @since 1.0.19
2476
+     * @param  string $value phone.
2477
+     */
2478
+    public function set_customer_phone( $value ) {
2479
+        $this->set_phone( $value );
2334 2480
     }
2335 2481
 
2336 2482
     /**
2337
-	 * Set the receiver of the invoice.
2338
-	 *
2339
-	 * @since 1.0.19
2340
-	 * @param  int $value New author.
2341
-	 */
2342
-	public function set_author( $value ) {
2343
-		$user = get_user_by( 'id', (int) $value );
2483
+     * Alias of self::set_phone().
2484
+     *
2485
+     * @since 1.0.19
2486
+     * @param  string $value phone.
2487
+     */
2488
+    public function set_phone_number( $value ) {
2489
+        $this->set_phone( $value );
2490
+    }
2344 2491
 
2345
-		if ( $user && $user->ID ) {
2346
-			$this->set_prop( 'author', $user->ID );
2347
-			$this->set_prop( 'email', $user->user_email );
2348
-		}
2492
+    /**
2493
+     * Set the customer's email address.
2494
+     *
2495
+     * @since 1.0.19
2496
+     * @param  string $value email address.
2497
+     */
2498
+    public function set_email( $value ) {
2499
+        $this->set_prop( 'email', $value );
2500
+    }
2349 2501
 
2502
+    /**
2503
+     * Alias of self::set_email().
2504
+     *
2505
+     * @since 1.0.19
2506
+     * @param  string $value email address.
2507
+     */
2508
+    public function set_user_email( $value ) {
2509
+        $this->set_email( $value );
2350 2510
     }
2351 2511
 
2352 2512
     /**
2353
-	 * Alias of self::set_author().
2354
-	 *
2355
-	 * @since 1.0.19
2356
-	 * @param  int $value New user id.
2357
-	 */
2358
-	public function set_user_id( $value ) {
2359
-		$this->set_author( $value );
2513
+     * Alias of self::set_email().
2514
+     *
2515
+     * @since 1.0.19
2516
+     * @param  string $value email address.
2517
+     */
2518
+    public function set_email_address( $value ) {
2519
+        $this->set_email( $value );
2360 2520
     }
2361 2521
 
2362 2522
     /**
2363
-	 * Alias of self::set_author().
2364
-	 *
2365
-	 * @since 1.0.19
2366
-	 * @param  int $value New user id.
2367
-	 */
2368
-	public function set_customer_id( $value ) {
2369
-		$this->set_author( $value );
2523
+     * Alias of self::set_email().
2524
+     *
2525
+     * @since 1.0.19
2526
+     * @param  string $value email address.
2527
+     */
2528
+    public function set_customer_email( $value ) {
2529
+        $this->set_email( $value );
2370 2530
     }
2371 2531
 
2372 2532
     /**
2373
-	 * Set the customer's ip.
2374
-	 *
2375
-	 * @since 1.0.19
2376
-	 * @param  string $value ip address.
2377
-	 */
2378
-	public function set_ip( $value ) {
2379
-		$this->set_prop( 'ip', $value );
2533
+     * Set the customer's country.
2534
+     *
2535
+     * @since 1.0.19
2536
+     * @param  string $value country.
2537
+     */
2538
+    public function set_country( $value ) {
2539
+        $this->set_prop( 'country', $value );
2380 2540
     }
2381 2541
 
2382 2542
     /**
2383
-	 * Alias of self::set_ip().
2384
-	 *
2385
-	 * @since 1.0.19
2386
-	 * @param  string $value ip address.
2387
-	 */
2388
-	public function set_user_ip( $value ) {
2389
-		$this->set_ip( $value );
2543
+     * Alias of self::set_country().
2544
+     *
2545
+     * @since 1.0.19
2546
+     * @param  string $value country.
2547
+     */
2548
+    public function set_user_country( $value ) {
2549
+        $this->set_country( $value );
2390 2550
     }
2391 2551
 
2392 2552
     /**
2393
-	 * Set the customer's first name.
2394
-	 *
2395
-	 * @since 1.0.19
2396
-	 * @param  string $value first name.
2397
-	 */
2398
-	public function set_first_name( $value ) {
2399
-		$this->set_prop( 'first_name', $value );
2553
+     * Alias of self::set_country().
2554
+     *
2555
+     * @since 1.0.19
2556
+     * @param  string $value country.
2557
+     */
2558
+    public function set_customer_country( $value ) {
2559
+        $this->set_country( $value );
2400 2560
     }
2401 2561
 
2402 2562
     /**
2403
-	 * Alias of self::set_first_name().
2404
-	 *
2405
-	 * @since 1.0.19
2406
-	 * @param  string $value first name.
2407
-	 */
2408
-	public function set_user_first_name( $value ) {
2409
-		$this->set_first_name( $value );
2563
+     * Set the customer's state.
2564
+     *
2565
+     * @since 1.0.19
2566
+     * @param  string $value state.
2567
+     */
2568
+    public function set_state( $value ) {
2569
+        $this->set_prop( 'state', $value );
2410 2570
     }
2411 2571
 
2412 2572
     /**
2413
-	 * Alias of self::set_first_name().
2414
-	 *
2415
-	 * @since 1.0.19
2416
-	 * @param  string $value first name.
2417
-	 */
2418
-	public function set_customer_first_name( $value ) {
2419
-		$this->set_first_name( $value );
2573
+     * Alias of self::set_state().
2574
+     *
2575
+     * @since 1.0.19
2576
+     * @param  string $value state.
2577
+     */
2578
+    public function set_user_state( $value ) {
2579
+        $this->set_state( $value );
2420 2580
     }
2421 2581
 
2422 2582
     /**
2423
-	 * Set the customer's last name.
2424
-	 *
2425
-	 * @since 1.0.19
2426
-	 * @param  string $value last name.
2427
-	 */
2428
-	public function set_last_name( $value ) {
2429
-		$this->set_prop( 'last_name', $value );
2583
+     * Alias of self::set_state().
2584
+     *
2585
+     * @since 1.0.19
2586
+     * @param  string $value state.
2587
+     */
2588
+    public function set_customer_state( $value ) {
2589
+        $this->set_state( $value );
2430 2590
     }
2431 2591
 
2432 2592
     /**
2433
-	 * Alias of self::set_last_name().
2434
-	 *
2435
-	 * @since 1.0.19
2436
-	 * @param  string $value last name.
2437
-	 */
2438
-	public function set_user_last_name( $value ) {
2439
-		$this->set_last_name( $value );
2593
+     * Set the customer's city.
2594
+     *
2595
+     * @since 1.0.19
2596
+     * @param  string $value city.
2597
+     */
2598
+    public function set_city( $value ) {
2599
+        $this->set_prop( 'city', $value );
2440 2600
     }
2441 2601
 
2442 2602
     /**
2443
-	 * Alias of self::set_last_name().
2444
-	 *
2445
-	 * @since 1.0.19
2446
-	 * @param  string $value last name.
2447
-	 */
2448
-	public function set_customer_last_name( $value ) {
2449
-		$this->set_last_name( $value );
2603
+     * Alias of self::set_city().
2604
+     *
2605
+     * @since 1.0.19
2606
+     * @param  string $value city.
2607
+     */
2608
+    public function set_user_city( $value ) {
2609
+        $this->set_city( $value );
2450 2610
     }
2451 2611
 
2452 2612
     /**
2453
-	 * Set the customer's phone number.
2454
-	 *
2455
-	 * @since 1.0.19
2456
-	 * @param  string $value phone.
2457
-	 */
2458
-	public function set_phone( $value ) {
2459
-		$this->set_prop( 'phone', $value );
2613
+     * Alias of self::set_city().
2614
+     *
2615
+     * @since 1.0.19
2616
+     * @param  string $value city.
2617
+     */
2618
+    public function set_customer_city( $value ) {
2619
+        $this->set_city( $value );
2460 2620
     }
2461 2621
 
2462 2622
     /**
2463
-	 * Alias of self::set_phone().
2464
-	 *
2465
-	 * @since 1.0.19
2466
-	 * @param  string $value phone.
2467
-	 */
2468
-	public function set_user_phone( $value ) {
2469
-		$this->set_phone( $value );
2623
+     * Set the customer's zip code.
2624
+     *
2625
+     * @since 1.0.19
2626
+     * @param  string $value zip.
2627
+     */
2628
+    public function set_zip( $value ) {
2629
+        $this->set_prop( 'zip', $value );
2470 2630
     }
2471 2631
 
2472 2632
     /**
2473
-	 * Alias of self::set_phone().
2474
-	 *
2475
-	 * @since 1.0.19
2476
-	 * @param  string $value phone.
2477
-	 */
2478
-	public function set_customer_phone( $value ) {
2479
-		$this->set_phone( $value );
2633
+     * Alias of self::set_zip().
2634
+     *
2635
+     * @since 1.0.19
2636
+     * @param  string $value zip.
2637
+     */
2638
+    public function set_user_zip( $value ) {
2639
+        $this->set_zip( $value );
2480 2640
     }
2481 2641
 
2482 2642
     /**
2483
-	 * Alias of self::set_phone().
2484
-	 *
2485
-	 * @since 1.0.19
2486
-	 * @param  string $value phone.
2487
-	 */
2488
-	public function set_phone_number( $value ) {
2489
-		$this->set_phone( $value );
2643
+     * Alias of self::set_zip().
2644
+     *
2645
+     * @since 1.0.19
2646
+     * @param  string $value zip.
2647
+     */
2648
+    public function set_customer_zip( $value ) {
2649
+        $this->set_zip( $value );
2490 2650
     }
2491 2651
 
2492 2652
     /**
2493
-	 * Set the customer's email address.
2494
-	 *
2495
-	 * @since 1.0.19
2496
-	 * @param  string $value email address.
2497
-	 */
2498
-	public function set_email( $value ) {
2499
-		$this->set_prop( 'email', $value );
2653
+     * Set the customer's company.
2654
+     *
2655
+     * @since 1.0.19
2656
+     * @param  string $value company.
2657
+     */
2658
+    public function set_company( $value ) {
2659
+        $this->set_prop( 'company', $value );
2500 2660
     }
2501 2661
 
2502 2662
     /**
2503
-	 * Alias of self::set_email().
2504
-	 *
2505
-	 * @since 1.0.19
2506
-	 * @param  string $value email address.
2507
-	 */
2508
-	public function set_user_email( $value ) {
2509
-		$this->set_email( $value );
2663
+     * Alias of self::set_company().
2664
+     *
2665
+     * @since 1.0.19
2666
+     * @param  string $value company.
2667
+     */
2668
+    public function set_user_company( $value ) {
2669
+        $this->set_company( $value );
2510 2670
     }
2511 2671
 
2512 2672
     /**
2513
-	 * Alias of self::set_email().
2514
-	 *
2515
-	 * @since 1.0.19
2516
-	 * @param  string $value email address.
2517
-	 */
2518
-	public function set_email_address( $value ) {
2519
-		$this->set_email( $value );
2673
+     * Alias of self::set_company().
2674
+     *
2675
+     * @since 1.0.19
2676
+     * @param  string $value company.
2677
+     */
2678
+    public function set_customer_company( $value ) {
2679
+        $this->set_company( $value );
2520 2680
     }
2521 2681
 
2522 2682
     /**
2523
-	 * Alias of self::set_email().
2524
-	 *
2525
-	 * @since 1.0.19
2526
-	 * @param  string $value email address.
2527
-	 */
2528
-	public function set_customer_email( $value ) {
2529
-		$this->set_email( $value );
2683
+     * Set the customer's company id.
2684
+     *
2685
+     * @since 1.0.19
2686
+     * @param  string $value company id.
2687
+     */
2688
+    public function set_company_id( $value ) {
2689
+        $this->set_prop( 'company_id', $value );
2530 2690
     }
2531 2691
 
2532 2692
     /**
2533
-	 * Set the customer's country.
2534
-	 *
2535
-	 * @since 1.0.19
2536
-	 * @param  string $value country.
2537
-	 */
2538
-	public function set_country( $value ) {
2539
-		$this->set_prop( 'country', $value );
2693
+     * Set the customer's var number.
2694
+     *
2695
+     * @since 1.0.19
2696
+     * @param  string $value var number.
2697
+     */
2698
+    public function set_vat_number( $value ) {
2699
+        $this->set_prop( 'vat_number', $value );
2540 2700
     }
2541 2701
 
2542 2702
     /**
2543
-	 * Alias of self::set_country().
2544
-	 *
2545
-	 * @since 1.0.19
2546
-	 * @param  string $value country.
2547
-	 */
2548
-	public function set_user_country( $value ) {
2549
-		$this->set_country( $value );
2703
+     * Alias of self::set_vat_number().
2704
+     *
2705
+     * @since 1.0.19
2706
+     * @param  string $value var number.
2707
+     */
2708
+    public function set_user_vat_number( $value ) {
2709
+        $this->set_vat_number( $value );
2550 2710
     }
2551 2711
 
2552 2712
     /**
2553
-	 * Alias of self::set_country().
2554
-	 *
2555
-	 * @since 1.0.19
2556
-	 * @param  string $value country.
2557
-	 */
2558
-	public function set_customer_country( $value ) {
2559
-		$this->set_country( $value );
2713
+     * Alias of self::set_vat_number().
2714
+     *
2715
+     * @since 1.0.19
2716
+     * @param  string $value var number.
2717
+     */
2718
+    public function set_customer_vat_number( $value ) {
2719
+        $this->set_vat_number( $value );
2560 2720
     }
2561 2721
 
2562 2722
     /**
2563
-	 * Set the customer's state.
2564
-	 *
2565
-	 * @since 1.0.19
2566
-	 * @param  string $value state.
2567
-	 */
2568
-	public function set_state( $value ) {
2569
-		$this->set_prop( 'state', $value );
2723
+     * Set the customer's vat rate.
2724
+     *
2725
+     * @since 1.0.19
2726
+     * @param  string $value var rate.
2727
+     */
2728
+    public function set_vat_rate( $value ) {
2729
+        $this->set_prop( 'vat_rate', $value );
2570 2730
     }
2571 2731
 
2572 2732
     /**
2573
-	 * Alias of self::set_state().
2574
-	 *
2575
-	 * @since 1.0.19
2576
-	 * @param  string $value state.
2577
-	 */
2578
-	public function set_user_state( $value ) {
2579
-		$this->set_state( $value );
2733
+     * Alias of self::set_vat_rate().
2734
+     *
2735
+     * @since 1.0.19
2736
+     * @param  string $value var number.
2737
+     */
2738
+    public function set_user_vat_rate( $value ) {
2739
+        $this->set_vat_rate( $value );
2580 2740
     }
2581 2741
 
2582 2742
     /**
2583
-	 * Alias of self::set_state().
2584
-	 *
2585
-	 * @since 1.0.19
2586
-	 * @param  string $value state.
2587
-	 */
2588
-	public function set_customer_state( $value ) {
2589
-		$this->set_state( $value );
2743
+     * Alias of self::set_vat_rate().
2744
+     *
2745
+     * @since 1.0.19
2746
+     * @param  string $value var number.
2747
+     */
2748
+    public function set_customer_vat_rate( $value ) {
2749
+        $this->set_vat_rate( $value );
2590 2750
     }
2591 2751
 
2592 2752
     /**
2593
-	 * Set the customer's city.
2594
-	 *
2595
-	 * @since 1.0.19
2596
-	 * @param  string $value city.
2597
-	 */
2598
-	public function set_city( $value ) {
2599
-		$this->set_prop( 'city', $value );
2753
+     * Set the customer's address.
2754
+     *
2755
+     * @since 1.0.19
2756
+     * @param  string $value address.
2757
+     */
2758
+    public function set_address( $value ) {
2759
+        $this->set_prop( 'address', $value );
2600 2760
     }
2601 2761
 
2602 2762
     /**
2603
-	 * Alias of self::set_city().
2604
-	 *
2605
-	 * @since 1.0.19
2606
-	 * @param  string $value city.
2607
-	 */
2608
-	public function set_user_city( $value ) {
2609
-		$this->set_city( $value );
2763
+     * Alias of self::set_address().
2764
+     *
2765
+     * @since 1.0.19
2766
+     * @param  string $value address.
2767
+     */
2768
+    public function set_user_address( $value ) {
2769
+        $this->set_address( $value );
2610 2770
     }
2611 2771
 
2612 2772
     /**
2613
-	 * Alias of self::set_city().
2614
-	 *
2615
-	 * @since 1.0.19
2616
-	 * @param  string $value city.
2617
-	 */
2618
-	public function set_customer_city( $value ) {
2619
-		$this->set_city( $value );
2773
+     * Alias of self::set_address().
2774
+     *
2775
+     * @since 1.0.19
2776
+     * @param  string $value address.
2777
+     */
2778
+    public function set_customer_address( $value ) {
2779
+        $this->set_address( $value );
2620 2780
     }
2621 2781
 
2622 2782
     /**
2623
-	 * Set the customer's zip code.
2624
-	 *
2625
-	 * @since 1.0.19
2626
-	 * @param  string $value zip.
2627
-	 */
2628
-	public function set_zip( $value ) {
2629
-		$this->set_prop( 'zip', $value );
2783
+     * Set whether the customer has viewed the invoice or not.
2784
+     *
2785
+     * @since 1.0.19
2786
+     * @param  int|bool $value confirmed.
2787
+     */
2788
+    public function set_is_viewed( $value ) {
2789
+        $this->set_prop( 'is_viewed', $value );
2630 2790
     }
2631 2791
 
2632 2792
     /**
2633
-	 * Alias of self::set_zip().
2634
-	 *
2635
-	 * @since 1.0.19
2636
-	 * @param  string $value zip.
2637
-	 */
2638
-	public function set_user_zip( $value ) {
2639
-		$this->set_zip( $value );
2793
+     * Set extra email recipients.
2794
+     *
2795
+     * @since 1.0.19
2796
+     * @param  string $value email recipients.
2797
+     */
2798
+    public function set_email_cc( $value ) {
2799
+        $this->set_prop( 'email_cc', $value );
2640 2800
     }
2641 2801
 
2642 2802
     /**
2643
-	 * Alias of self::set_zip().
2644
-	 *
2645
-	 * @since 1.0.19
2646
-	 * @param  string $value zip.
2647
-	 */
2648
-	public function set_customer_zip( $value ) {
2649
-		$this->set_zip( $value );
2803
+     * Set the invoice template.
2804
+     *
2805
+     * @since 1.0.19
2806
+     * @param  string $value template.
2807
+     */
2808
+    public function set_template( $value ) {
2809
+        if ( in_array( $value, array( 'quantity', 'hours', 'amount' ) ) ) {
2810
+            $this->set_prop( 'template', $value );
2811
+        }
2650 2812
     }
2651 2813
 
2652 2814
     /**
2653
-	 * Set the customer's company.
2654
-	 *
2655
-	 * @since 1.0.19
2656
-	 * @param  string $value company.
2657
-	 */
2658
-	public function set_company( $value ) {
2659
-		$this->set_prop( 'company', $value );
2815
+     * Set the invoice source.
2816
+     *
2817
+     * @since 1.0.19
2818
+     * @param  string $value source.
2819
+     * @deprecated
2820
+     */
2821
+    public function created_via( $value ) {
2822
+        $this->set_created_via( sanitize_text_field( $value ) );
2660 2823
     }
2661 2824
 
2662 2825
     /**
2663
-	 * Alias of self::set_company().
2664
-	 *
2665
-	 * @since 1.0.19
2666
-	 * @param  string $value company.
2667
-	 */
2668
-	public function set_user_company( $value ) {
2669
-		$this->set_company( $value );
2826
+     * Set the invoice source.
2827
+     *
2828
+     * @since 1.0.19
2829
+     * @param  string $value source.
2830
+     */
2831
+    public function set_created_via( $value ) {
2832
+        $this->set_prop( 'created_via', sanitize_text_field( $value ) );
2670 2833
     }
2671 2834
 
2672 2835
     /**
2673
-	 * Alias of self::set_company().
2674
-	 *
2675
-	 * @since 1.0.19
2676
-	 * @param  string $value company.
2677
-	 */
2678
-	public function set_customer_company( $value ) {
2679
-		$this->set_company( $value );
2680
-    }
2681
-
2682
-	/**
2683
-	 * Set the customer's company id.
2684
-	 *
2685
-	 * @since 1.0.19
2686
-	 * @param  string $value company id.
2687
-	 */
2688
-	public function set_company_id( $value ) {
2689
-		$this->set_prop( 'company_id', $value );
2836
+     * Set the customer's address confirmed status.
2837
+     *
2838
+     * @since 1.0.19
2839
+     * @param  int|bool $value confirmed.
2840
+     */
2841
+    public function set_address_confirmed( $value ) {
2842
+        $this->set_prop( 'address_confirmed', $value );
2690 2843
     }
2691 2844
 
2692 2845
     /**
2693
-	 * Set the customer's var number.
2694
-	 *
2695
-	 * @since 1.0.19
2696
-	 * @param  string $value var number.
2697
-	 */
2698
-	public function set_vat_number( $value ) {
2699
-		$this->set_prop( 'vat_number', $value );
2846
+     * Alias of self::set_address_confirmed().
2847
+     *
2848
+     * @since 1.0.19
2849
+     * @param  int|bool $value confirmed.
2850
+     */
2851
+    public function set_user_address_confirmed( $value ) {
2852
+        $this->set_address_confirmed( $value );
2700 2853
     }
2701 2854
 
2702 2855
     /**
2703
-	 * Alias of self::set_vat_number().
2704
-	 *
2705
-	 * @since 1.0.19
2706
-	 * @param  string $value var number.
2707
-	 */
2708
-	public function set_user_vat_number( $value ) {
2709
-		$this->set_vat_number( $value );
2856
+     * Alias of self::set_address_confirmed().
2857
+     *
2858
+     * @since 1.0.19
2859
+     * @param  int|bool $value confirmed.
2860
+     */
2861
+    public function set_customer_address_confirmed( $value ) {
2862
+        $this->set_address_confirmed( $value );
2710 2863
     }
2711 2864
 
2712 2865
     /**
2713
-	 * Alias of self::set_vat_number().
2714
-	 *
2715
-	 * @since 1.0.19
2716
-	 * @param  string $value var number.
2717
-	 */
2718
-	public function set_customer_vat_number( $value ) {
2719
-		$this->set_vat_number( $value );
2866
+     * Set the shipping fee
2867
+     *
2868
+     * @since 1.0.19
2869
+     * @param  float $value shipping amount.
2870
+     */
2871
+    public function set_shipping( $value ) {
2872
+
2873
+        if ( ! is_numeric( $value ) ) {
2874
+            return $this->set_prop( 'shipping', null );
2875
+        }
2876
+
2877
+        $this->set_prop( 'shipping', max( 0, floatval( $value ) ) );
2720 2878
     }
2721 2879
 
2722 2880
     /**
2723
-	 * Set the customer's vat rate.
2724
-	 *
2725
-	 * @since 1.0.19
2726
-	 * @param  string $value var rate.
2727
-	 */
2728
-	public function set_vat_rate( $value ) {
2729
-		$this->set_prop( 'vat_rate', $value );
2881
+     * Set the invoice sub total.
2882
+     *
2883
+     * @since 1.0.19
2884
+     * @param  float $value sub total.
2885
+     */
2886
+    public function set_subtotal( $value ) {
2887
+        $this->set_prop( 'subtotal', max( 0, $value ) );
2730 2888
     }
2731 2889
 
2732
-    /**
2733
-	 * Alias of self::set_vat_rate().
2734
-	 *
2735
-	 * @since 1.0.19
2736
-	 * @param  string $value var number.
2737
-	 */
2738
-	public function set_user_vat_rate( $value ) {
2739
-		$this->set_vat_rate( $value );
2740
-    }
2741
-
2742
-    /**
2743
-	 * Alias of self::set_vat_rate().
2744
-	 *
2745
-	 * @since 1.0.19
2746
-	 * @param  string $value var number.
2747
-	 */
2748
-	public function set_customer_vat_rate( $value ) {
2749
-		$this->set_vat_rate( $value );
2750
-    }
2751
-
2752
-    /**
2753
-	 * Set the customer's address.
2754
-	 *
2755
-	 * @since 1.0.19
2756
-	 * @param  string $value address.
2757
-	 */
2758
-	public function set_address( $value ) {
2759
-		$this->set_prop( 'address', $value );
2760
-    }
2761
-
2762
-    /**
2763
-	 * Alias of self::set_address().
2764
-	 *
2765
-	 * @since 1.0.19
2766
-	 * @param  string $value address.
2767
-	 */
2768
-	public function set_user_address( $value ) {
2769
-		$this->set_address( $value );
2770
-    }
2771
-
2772
-    /**
2773
-	 * Alias of self::set_address().
2774
-	 *
2775
-	 * @since 1.0.19
2776
-	 * @param  string $value address.
2777
-	 */
2778
-	public function set_customer_address( $value ) {
2779
-		$this->set_address( $value );
2780
-    }
2781
-
2782
-    /**
2783
-	 * Set whether the customer has viewed the invoice or not.
2784
-	 *
2785
-	 * @since 1.0.19
2786
-	 * @param  int|bool $value confirmed.
2787
-	 */
2788
-	public function set_is_viewed( $value ) {
2789
-		$this->set_prop( 'is_viewed', $value );
2790
-	}
2791
-
2792
-	/**
2793
-	 * Set extra email recipients.
2794
-	 *
2795
-	 * @since 1.0.19
2796
-	 * @param  string $value email recipients.
2797
-	 */
2798
-	public function set_email_cc( $value ) {
2799
-		$this->set_prop( 'email_cc', $value );
2800
-	}
2801
-
2802
-	/**
2803
-	 * Set the invoice template.
2804
-	 *
2805
-	 * @since 1.0.19
2806
-	 * @param  string $value template.
2807
-	 */
2808
-	public function set_template( $value ) {
2809
-		if ( in_array( $value, array( 'quantity', 'hours', 'amount' ) ) ) {
2810
-			$this->set_prop( 'template', $value );
2811
-		}
2812
-	}
2813
-
2814
-	/**
2815
-	 * Set the invoice source.
2816
-	 *
2817
-	 * @since 1.0.19
2818
-	 * @param  string $value source.
2819
-	 * @deprecated
2820
-	 */
2821
-	public function created_via( $value ) {
2822
-		$this->set_created_via( sanitize_text_field( $value ) );
2823
-	}
2824
-
2825
-	/**
2826
-	 * Set the invoice source.
2827
-	 *
2828
-	 * @since 1.0.19
2829
-	 * @param  string $value source.
2830
-	 */
2831
-	public function set_created_via( $value ) {
2832
-		$this->set_prop( 'created_via', sanitize_text_field( $value ) );
2833
-	}
2834
-
2835
-	/**
2836
-	 * Set the customer's address confirmed status.
2837
-	 *
2838
-	 * @since 1.0.19
2839
-	 * @param  int|bool $value confirmed.
2840
-	 */
2841
-	public function set_address_confirmed( $value ) {
2842
-		$this->set_prop( 'address_confirmed', $value );
2843
-    }
2844
-
2845
-    /**
2846
-	 * Alias of self::set_address_confirmed().
2847
-	 *
2848
-	 * @since 1.0.19
2849
-	 * @param  int|bool $value confirmed.
2850
-	 */
2851
-	public function set_user_address_confirmed( $value ) {
2852
-		$this->set_address_confirmed( $value );
2853
-    }
2854
-
2855
-    /**
2856
-	 * Alias of self::set_address_confirmed().
2857
-	 *
2858
-	 * @since 1.0.19
2859
-	 * @param  int|bool $value confirmed.
2860
-	 */
2861
-	public function set_customer_address_confirmed( $value ) {
2862
-		$this->set_address_confirmed( $value );
2863
-    }
2864
-
2865
-    /**
2866
-	 * Set the shipping fee
2867
-	 *
2868
-	 * @since 1.0.19
2869
-	 * @param  float $value shipping amount.
2870
-	 */
2871
-	public function set_shipping( $value ) {
2872
-
2873
-		if ( ! is_numeric( $value ) ) {
2874
-			return $this->set_prop( 'shipping', null );
2875
-		}
2876
-
2877
-		$this->set_prop( 'shipping', max( 0, floatval( $value ) ) );
2878
-	}
2879
-
2880
-	/**
2881
-	 * Set the invoice sub total.
2882
-	 *
2883
-	 * @since 1.0.19
2884
-	 * @param  float $value sub total.
2885
-	 */
2886
-	public function set_subtotal( $value ) {
2887
-		$this->set_prop( 'subtotal', max( 0, $value ) );
2888
-	}
2889
-
2890
-	/**
2891
-	 * Set the invoice total.
2892
-	 *
2893
-	 * @since 1.0.19
2894
-	 * @param  float $value sub total.
2895
-	 */
2896
-	public function set_total( $value ) {
2897
-		$this->set_prop( 'total', max( 0, $value ) );
2890
+    /**
2891
+     * Set the invoice total.
2892
+     *
2893
+     * @since 1.0.19
2894
+     * @param  float $value sub total.
2895
+     */
2896
+    public function set_total( $value ) {
2897
+        $this->set_prop( 'total', max( 0, $value ) );
2898 2898
     }
2899 2899
 
2900 2900
     /**
2901
-	 * Set the invoice discount amount.
2902
-	 *
2903
-	 * @since 1.0.19
2904
-	 * @param  float $value discount total.
2905
-	 */
2906
-	public function set_total_discount( $value ) {
2907
-		$this->set_prop( 'total_discount', max( 0, $value ) );
2901
+     * Set the invoice discount amount.
2902
+     *
2903
+     * @since 1.0.19
2904
+     * @param  float $value discount total.
2905
+     */
2906
+    public function set_total_discount( $value ) {
2907
+        $this->set_prop( 'total_discount', max( 0, $value ) );
2908 2908
     }
2909 2909
 
2910 2910
     /**
2911
-	 * Alias of self::set_total_discount().
2912
-	 *
2913
-	 * @since 1.0.19
2914
-	 * @param  float $value discount total.
2915
-	 */
2916
-	public function set_discount( $value ) {
2917
-		$this->set_total_discount( $value );
2911
+     * Alias of self::set_total_discount().
2912
+     *
2913
+     * @since 1.0.19
2914
+     * @param  float $value discount total.
2915
+     */
2916
+    public function set_discount( $value ) {
2917
+        $this->set_total_discount( $value );
2918 2918
     }
2919 2919
 
2920 2920
     /**
2921
-	 * Set the invoice tax amount.
2922
-	 *
2923
-	 * @since 1.0.19
2924
-	 * @param  float $value tax total.
2925
-	 */
2926
-	public function set_total_tax( $value ) {
2927
-		$this->set_prop( 'total_tax', max( 0, $value ) );
2921
+     * Set the invoice tax amount.
2922
+     *
2923
+     * @since 1.0.19
2924
+     * @param  float $value tax total.
2925
+     */
2926
+    public function set_total_tax( $value ) {
2927
+        $this->set_prop( 'total_tax', max( 0, $value ) );
2928 2928
     }
2929 2929
 
2930 2930
     /**
2931
-	 * Alias of self::set_total_tax().
2932
-	 *
2933
-	 * @since 1.0.19
2934
-	 * @param  float $value tax total.
2935
-	 */
2936
-	public function set_tax_total( $value ) {
2937
-		$this->set_total_tax( $value );
2931
+     * Alias of self::set_total_tax().
2932
+     *
2933
+     * @since 1.0.19
2934
+     * @param  float $value tax total.
2935
+     */
2936
+    public function set_tax_total( $value ) {
2937
+        $this->set_total_tax( $value );
2938 2938
     }
2939 2939
 
2940 2940
     /**
2941
-	 * Set the invoice fees amount.
2942
-	 *
2943
-	 * @since 1.0.19
2944
-	 * @param  float $value fees total.
2945
-	 */
2946
-	public function set_total_fees( $value ) {
2947
-		$this->set_prop( 'total_fees', max( 0, $value ) );
2941
+     * Set the invoice fees amount.
2942
+     *
2943
+     * @since 1.0.19
2944
+     * @param  float $value fees total.
2945
+     */
2946
+    public function set_total_fees( $value ) {
2947
+        $this->set_prop( 'total_fees', max( 0, $value ) );
2948 2948
     }
2949 2949
 
2950 2950
     /**
2951
-	 * Alias of self::set_total_fees().
2952
-	 *
2953
-	 * @since 1.0.19
2954
-	 * @param  float $value fees total.
2955
-	 */
2956
-	public function set_fees_total( $value ) {
2957
-		$this->set_total_fees( $value );
2951
+     * Alias of self::set_total_fees().
2952
+     *
2953
+     * @since 1.0.19
2954
+     * @param  float $value fees total.
2955
+     */
2956
+    public function set_fees_total( $value ) {
2957
+        $this->set_total_fees( $value );
2958 2958
     }
2959 2959
 
2960 2960
     /**
2961
-	 * Set the invoice fees.
2962
-	 *
2963
-	 * @since 1.0.19
2964
-	 * @param  array $value fees.
2965
-	 */
2966
-	public function set_fees( $value ) {
2961
+     * Set the invoice fees.
2962
+     *
2963
+     * @since 1.0.19
2964
+     * @param  array $value fees.
2965
+     */
2966
+    public function set_fees( $value ) {
2967 2967
 
2968
-		if ( ! is_array( $value ) ) {
2969
-			$value = array();
2970
-		}
2968
+        if ( ! is_array( $value ) ) {
2969
+            $value = array();
2970
+        }
2971 2971
 
2972
-		$this->set_prop( 'fees', $value );
2972
+        $this->set_prop( 'fees', $value );
2973 2973
 
2974 2974
     }
2975 2975
 
2976 2976
     /**
2977
-	 * Set the invoice taxes.
2978
-	 *
2979
-	 * @since 1.0.19
2980
-	 * @param  array $value taxes.
2981
-	 */
2982
-	public function set_taxes( $value ) {
2977
+     * Set the invoice taxes.
2978
+     *
2979
+     * @since 1.0.19
2980
+     * @param  array $value taxes.
2981
+     */
2982
+    public function set_taxes( $value ) {
2983 2983
 
2984
-		if ( ! is_array( $value ) ) {
2985
-			$value = array();
2986
-		}
2984
+        if ( ! is_array( $value ) ) {
2985
+            $value = array();
2986
+        }
2987 2987
 
2988
-		$this->set_prop( 'taxes', $value );
2988
+        $this->set_prop( 'taxes', $value );
2989 2989
 
2990 2990
     }
2991 2991
 
2992 2992
     /**
2993
-	 * Set the invoice discounts.
2994
-	 *
2995
-	 * @since 1.0.19
2996
-	 * @param  array $value discounts.
2997
-	 */
2998
-	public function set_discounts( $value ) {
2993
+     * Set the invoice discounts.
2994
+     *
2995
+     * @since 1.0.19
2996
+     * @param  array $value discounts.
2997
+     */
2998
+    public function set_discounts( $value ) {
2999 2999
 
3000
-		if ( ! is_array( $value ) ) {
3001
-			$value = array();
3002
-		}
3000
+        if ( ! is_array( $value ) ) {
3001
+            $value = array();
3002
+        }
3003 3003
 
3004
-		$this->set_prop( 'discounts', $value );
3004
+        $this->set_prop( 'discounts', $value );
3005 3005
     }
3006 3006
 
3007 3007
     /**
3008
-	 * Set the invoice items.
3009
-	 *
3010
-	 * @since 1.0.19
3011
-	 * @param  GetPaid_Form_Item[] $value items.
3012
-	 */
3013
-	public function set_items( $value ) {
3008
+     * Set the invoice items.
3009
+     *
3010
+     * @since 1.0.19
3011
+     * @param  GetPaid_Form_Item[] $value items.
3012
+     */
3013
+    public function set_items( $value ) {
3014 3014
 
3015 3015
         // Remove existing items.
3016 3016
         $this->set_prop( 'items', array() );
3017
-		$this->recurring_item = null;
3017
+        $this->recurring_item = null;
3018 3018
 
3019 3019
         // Ensure that we have an array.
3020 3020
         if ( ! is_array( $value ) ) {
@@ -3028,95 +3028,95 @@  discard block
 block discarded – undo
3028 3028
     }
3029 3029
 
3030 3030
     /**
3031
-	 * Set the payment form.
3032
-	 *
3033
-	 * @since 1.0.19
3034
-	 * @param  int $value payment form.
3035
-	 */
3036
-	public function set_payment_form( $value ) {
3037
-		$this->set_prop( 'payment_form', $value );
3031
+     * Set the payment form.
3032
+     *
3033
+     * @since 1.0.19
3034
+     * @param  int $value payment form.
3035
+     */
3036
+    public function set_payment_form( $value ) {
3037
+        $this->set_prop( 'payment_form', $value );
3038 3038
     }
3039 3039
 
3040 3040
     /**
3041
-	 * Set the submission id.
3042
-	 *
3043
-	 * @since 1.0.19
3044
-	 * @param  string $value submission id.
3045
-	 */
3046
-	public function set_submission_id( $value ) {
3047
-		$this->set_prop( 'submission_id', $value );
3041
+     * Set the submission id.
3042
+     *
3043
+     * @since 1.0.19
3044
+     * @param  string $value submission id.
3045
+     */
3046
+    public function set_submission_id( $value ) {
3047
+        $this->set_prop( 'submission_id', $value );
3048 3048
     }
3049 3049
 
3050 3050
     /**
3051
-	 * Set the discount code.
3052
-	 *
3053
-	 * @since 1.0.19
3054
-	 * @param  string $value discount code.
3055
-	 */
3056
-	public function set_discount_code( $value ) {
3057
-		$this->set_prop( 'discount_code', sanitize_text_field( $value ) );
3051
+     * Set the discount code.
3052
+     *
3053
+     * @since 1.0.19
3054
+     * @param  string $value discount code.
3055
+     */
3056
+    public function set_discount_code( $value ) {
3057
+        $this->set_prop( 'discount_code', sanitize_text_field( $value ) );
3058 3058
     }
3059 3059
 
3060 3060
     /**
3061
-	 * Set the gateway.
3062
-	 *
3063
-	 * @since 1.0.19
3064
-	 * @param  string $value gateway.
3065
-	 */
3066
-	public function set_gateway( $value ) {
3067
-		$this->set_prop( 'gateway', $value );
3061
+     * Set the gateway.
3062
+     *
3063
+     * @since 1.0.19
3064
+     * @param  string $value gateway.
3065
+     */
3066
+    public function set_gateway( $value ) {
3067
+        $this->set_prop( 'gateway', $value );
3068 3068
     }
3069 3069
 
3070 3070
     /**
3071
-	 * Set the transaction id.
3072
-	 *
3073
-	 * @since 1.0.19
3074
-	 * @param  string $value transaction id.
3075
-	 */
3076
-	public function set_transaction_id( $value ) {
3077
-		if ( ! empty( $value ) ) {
3078
-			$this->set_prop( 'transaction_id', $value );
3079
-		}
3071
+     * Set the transaction id.
3072
+     *
3073
+     * @since 1.0.19
3074
+     * @param  string $value transaction id.
3075
+     */
3076
+    public function set_transaction_id( $value ) {
3077
+        if ( ! empty( $value ) ) {
3078
+            $this->set_prop( 'transaction_id', $value );
3079
+        }
3080 3080
     }
3081 3081
 
3082 3082
     /**
3083
-	 * Set the currency id.
3084
-	 *
3085
-	 * @since 1.0.19
3086
-	 * @param  string $value currency id.
3087
-	 */
3088
-	public function set_currency( $value ) {
3089
-		$this->set_prop( 'currency', $value );
3083
+     * Set the currency id.
3084
+     *
3085
+     * @since 1.0.19
3086
+     * @param  string $value currency id.
3087
+     */
3088
+    public function set_currency( $value ) {
3089
+        $this->set_prop( 'currency', $value );
3090 3090
     }
3091 3091
 
3092
-	/**
3093
-	 * Set whether to disable taxes.
3094
-	 *
3095
-	 * @since 1.0.19
3096
-	 * @param  bool $value value.
3097
-	 */
3098
-	public function set_disable_taxes( $value ) {
3099
-		$this->set_prop( 'disable_taxes', (bool) $value );
3100
-	}
3092
+    /**
3093
+     * Set whether to disable taxes.
3094
+     *
3095
+     * @since 1.0.19
3096
+     * @param  bool $value value.
3097
+     */
3098
+    public function set_disable_taxes( $value ) {
3099
+        $this->set_prop( 'disable_taxes', (bool) $value );
3100
+    }
3101 3101
 
3102 3102
     /**
3103
-	 * Set the subscription id.
3104
-	 *
3105
-	 * @since 1.0.19
3106
-	 * @param  string $value subscription id.
3107
-	 */
3108
-	public function set_subscription_id( $value ) {
3109
-		$this->set_prop( 'subscription_id', $value );
3110
-	}
3103
+     * Set the subscription id.
3104
+     *
3105
+     * @since 1.0.19
3106
+     * @param  string $value subscription id.
3107
+     */
3108
+    public function set_subscription_id( $value ) {
3109
+        $this->set_prop( 'subscription_id', $value );
3110
+    }
3111 3111
 
3112
-	/**
3113
-	 * Set the remote subscription id.
3114
-	 *
3115
-	 * @since 1.0.19
3116
-	 * @param  string $value subscription id.
3117
-	 */
3118
-	public function set_remote_subscription_id( $value ) {
3119
-		$this->set_prop( 'remote_subscription_id', $value );
3112
+    /**
3113
+     * Set the remote subscription id.
3114
+     *
3115
+     * @since 1.0.19
3116
+     * @param  string $value subscription id.
3117
+     */
3118
+    public function set_remote_subscription_id( $value ) {
3119
+        $this->set_prop( 'remote_subscription_id', $value );
3120 3120
     }
3121 3121
 
3122 3122
     /*
@@ -3155,24 +3155,24 @@  discard block
 block discarded – undo
3155 3155
      */
3156 3156
     public function is_taxable() {
3157 3157
         return ! $this->get_disable_taxes();
3158
-	}
3158
+    }
3159 3159
 
3160
-	/**
3161
-	 * @deprecated
3162
-	 */
3163
-	public function has_vat() {
3160
+    /**
3161
+     * @deprecated
3162
+     */
3163
+    public function has_vat() {
3164 3164
         return $this->is_taxable();
3165
-	}
3165
+    }
3166 3166
 
3167
-	/**
3168
-	 * Checks to see if the invoice requires payment.
3169
-	 */
3170
-	public function is_free() {
3167
+    /**
3168
+     * Checks to see if the invoice requires payment.
3169
+     */
3170
+    public function is_free() {
3171 3171
         $is_free = ( (float) wpinv_round_amount( $this->get_initial_total() ) == 0 );
3172 3172
 
3173
-		if ( $this->is_recurring() && $this->get_recurring_total() > 0 ) {
3174
-			$is_free = false;
3175
-		}
3173
+        if ( $this->is_recurring() && $this->get_recurring_total() > 0 ) {
3174
+            $is_free = false;
3175
+        }
3176 3176
 
3177 3177
         return apply_filters( 'wpinv_invoice_is_free', $is_free, $this );
3178 3178
     }
@@ -3183,46 +3183,46 @@  discard block
 block discarded – undo
3183 3183
     public function is_paid() {
3184 3184
         $is_paid = $this->has_status( array( 'publish', 'wpi-processing', 'wpi-renewal' ) );
3185 3185
         return apply_filters( 'wpinv_invoice_is_paid', $is_paid, $this );
3186
-	}
3186
+    }
3187 3187
 
3188
-	/**
3188
+    /**
3189 3189
      * Checks if the invoice needs payment.
3190 3190
      */
3191
-	public function needs_payment() {
3192
-		$needs_payment = ! $this->is_paid() && ! $this->is_refunded() && ! $this->is_free();
3191
+    public function needs_payment() {
3192
+        $needs_payment = ! $this->is_paid() && ! $this->is_refunded() && ! $this->is_free();
3193 3193
         return apply_filters( 'wpinv_needs_payment', $needs_payment, $this );
3194 3194
     }
3195 3195
 
3196
-	/**
3196
+    /**
3197 3197
      * Checks if the invoice is refunded.
3198 3198
      */
3199
-	public function is_refunded() {
3199
+    public function is_refunded() {
3200 3200
         $is_refunded = $this->has_status( 'wpi-refunded' );
3201 3201
         return apply_filters( 'wpinv_invoice_is_refunded', $is_refunded, $this );
3202
-	}
3202
+    }
3203 3203
 
3204
-	/**
3204
+    /**
3205 3205
      * Checks if the invoice is held.
3206 3206
      */
3207
-	public function is_held() {
3207
+    public function is_held() {
3208 3208
         $is_held = $this->has_status( 'wpi-onhold' );
3209 3209
         return apply_filters( 'wpinv_invoice_is_held', $is_held, $this );
3210
-	}
3210
+    }
3211 3211
 
3212
-	/**
3212
+    /**
3213 3213
      * Checks if the invoice is due.
3214 3214
      */
3215
-	public function is_due() {
3216
-		$due_date = $this->get_due_date();
3217
-		return empty( $due_date ) ? false : current_time( 'timestamp' ) > strtotime( $due_date );
3218
-	}
3215
+    public function is_due() {
3216
+        $due_date = $this->get_due_date();
3217
+        return empty( $due_date ) ? false : current_time( 'timestamp' ) > strtotime( $due_date );
3218
+    }
3219 3219
 
3220
-	/**
3220
+    /**
3221 3221
      * Checks if the invoice is draft.
3222 3222
      */
3223
-	public function is_draft() {
3223
+    public function is_draft() {
3224 3224
         return $this->has_status( 'draft, auto-draft' );
3225
-	}
3225
+    }
3226 3226
 
3227 3227
     /**
3228 3228
      * Checks if the invoice has a given status.
@@ -3230,9 +3230,9 @@  discard block
 block discarded – undo
3230 3230
     public function has_status( $status ) {
3231 3231
         $status = wpinv_parse_list( $status );
3232 3232
         return apply_filters( 'wpinv_has_status', in_array( $this->get_status(), $status ), $status );
3233
-	}
3233
+    }
3234 3234
 
3235
-	/**
3235
+    /**
3236 3236
      * Checks if the invoice is of a given type.
3237 3237
      */
3238 3238
     public function is_type( $type ) {
@@ -3255,25 +3255,25 @@  discard block
 block discarded – undo
3255 3255
      */
3256 3256
     public function has_free_trial() {
3257 3257
         return $this->is_recurring() && 0 == $this->get_initial_total();
3258
-	}
3258
+    }
3259 3259
 
3260
-	/**
3260
+    /**
3261 3261
      * @deprecated
3262 3262
      */
3263 3263
     public function is_free_trial() {
3264 3264
         $this->has_free_trial();
3265 3265
     }
3266 3266
 
3267
-	/**
3267
+    /**
3268 3268
      * Check if the initial payment if 0.
3269 3269
      *
3270 3270
      */
3271
-	public function is_initial_free() {
3271
+    public function is_initial_free() {
3272 3272
         $is_initial_free = ! ( (float) wpinv_round_amount( $this->get_initial_total() ) > 0 );
3273 3273
         return apply_filters( 'wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this );
3274 3274
     }
3275 3275
 
3276
-	/**
3276
+    /**
3277 3277
      * Check if the recurring item has a free trial.
3278 3278
      *
3279 3279
      */
@@ -3286,21 +3286,21 @@  discard block
 block discarded – undo
3286 3286
 
3287 3287
         $item = $this->get_recurring( true );
3288 3288
         return $item->has_free_trial();
3289
-	}
3289
+    }
3290 3290
 
3291
-	/**
3291
+    /**
3292 3292
      * Check if the free trial is a result of a discount.
3293 3293
      */
3294 3294
     public function is_free_trial_from_discount() {
3295
-		return $this->has_free_trial() && ! $this->item_has_free_trial();
3296
-	}
3295
+        return $this->has_free_trial() && ! $this->item_has_free_trial();
3296
+    }
3297 3297
 
3298
-	/**
3298
+    /**
3299 3299
      * @deprecated
3300 3300
      */
3301 3301
     public function discount_first_payment_only() {
3302 3302
 
3303
-		$discount = wpinv_get_discount_obj( $this->get_discount_code() );
3303
+        $discount = wpinv_get_discount_obj( $this->get_discount_code() );
3304 3304
         if ( ! $discount->exists() || ! $this->is_recurring() ) {
3305 3305
             return true;
3306 3306
         }
@@ -3325,146 +3325,146 @@  discard block
 block discarded – undo
3325 3325
      */
3326 3326
     public function add_item( $item ) {
3327 3327
 
3328
-		if ( is_array( $item ) ) {
3329
-			$item = $this->process_array_item( $item );
3330
-		}
3328
+        if ( is_array( $item ) ) {
3329
+            $item = $this->process_array_item( $item );
3330
+        }
3331 3331
 
3332
-		if ( is_numeric( $item ) ) {
3333
-			$item = new GetPaid_Form_Item( $item );
3334
-		}
3332
+        if ( is_numeric( $item ) ) {
3333
+            $item = new GetPaid_Form_Item( $item );
3334
+        }
3335 3335
 
3336 3336
         // Make sure that it is available for purchase.
3337
-		if ( $item->get_id() > 0 && ! $item->can_purchase() ) {
3338
-			return new WP_Error( 'invalid_item', __( 'This item is not available for purchase', 'invoicing' ) );
3337
+        if ( $item->get_id() > 0 && ! $item->can_purchase() ) {
3338
+            return new WP_Error( 'invalid_item', __( 'This item is not available for purchase', 'invoicing' ) );
3339 3339
         }
3340 3340
 
3341 3341
         // Do we have a recurring item?
3342
-		if ( $item->is_recurring() ) {
3343
-			$this->recurring_item = $item->get_id();
3342
+        if ( $item->is_recurring() ) {
3343
+            $this->recurring_item = $item->get_id();
3344 3344
         }
3345 3345
 
3346 3346
         // Invoice id.
3347 3347
         $item->invoice_id = (int) $this->get_id();
3348 3348
 
3349
-		// Remove duplicates.
3350
-		$this->remove_item( $item->get_id() );
3349
+        // Remove duplicates.
3350
+        $this->remove_item( $item->get_id() );
3351 3351
 
3352
-		if ( 0 == $item->get_quantity() ) {
3353
-			return;
3354
-		}
3352
+        if ( 0 == $item->get_quantity() ) {
3353
+            return;
3354
+        }
3355 3355
 
3356
-		// Retrieve all items.
3356
+        // Retrieve all items.
3357 3357
         $items   = $this->get_items();
3358 3358
 
3359
-		// Add new item.
3359
+        // Add new item.
3360 3360
         $items[] = $item;
3361 3361
 
3362 3362
         $this->set_prop( 'items', $items );
3363 3363
 
3364
-		return true;
3365
-	}
3364
+        return true;
3365
+    }
3366 3366
 
3367
-	/**
3368
-	 * Converts an array to an item.
3369
-	 *
3370
-	 * @since 1.0.19
3371
-	 * @return GetPaid_Form_Item
3372
-	 */
3373
-	protected function process_array_item( $array ) {
3367
+    /**
3368
+     * Converts an array to an item.
3369
+     *
3370
+     * @since 1.0.19
3371
+     * @return GetPaid_Form_Item
3372
+     */
3373
+    protected function process_array_item( $array ) {
3374 3374
 
3375
-		$item_id = isset( $array['item_id'] ) ? $array['item_id'] : 0;
3376
-		$item    = new GetPaid_Form_Item( $item_id );
3375
+        $item_id = isset( $array['item_id'] ) ? $array['item_id'] : 0;
3376
+        $item    = new GetPaid_Form_Item( $item_id );
3377 3377
 
3378
-		// Set item data.
3379
-		foreach ( array( 'name', 'price', 'description' ) as $key ) {
3380
-			if ( isset( $array[ "item_$key" ] ) ) {
3381
-				$method = "set_$key";
3382
-				$item->$method( $array[ "item_$key" ] );
3383
-			}
3384
-		}
3378
+        // Set item data.
3379
+        foreach ( array( 'name', 'price', 'description' ) as $key ) {
3380
+            if ( isset( $array[ "item_$key" ] ) ) {
3381
+                $method = "set_$key";
3382
+                $item->$method( $array[ "item_$key" ] );
3383
+            }
3384
+        }
3385 3385
 
3386
-		if ( isset( $array['quantity'] ) ) {
3387
-			$item->set_quantity( $array['quantity'] );
3388
-		}
3386
+        if ( isset( $array['quantity'] ) ) {
3387
+            $item->set_quantity( $array['quantity'] );
3388
+        }
3389 3389
 
3390
-		// Set item meta.
3391
-		if ( isset( $array['meta'] ) && is_array( $array['meta'] ) ) {
3392
-			$item->set_item_meta( $array['meta'] );
3393
-		}
3390
+        // Set item meta.
3391
+        if ( isset( $array['meta'] ) && is_array( $array['meta'] ) ) {
3392
+            $item->set_item_meta( $array['meta'] );
3393
+        }
3394 3394
 
3395
-		return $item;
3395
+        return $item;
3396 3396
 
3397
-	}
3397
+    }
3398 3398
 
3399 3399
     /**
3400
-	 * Retrieves a specific item.
3401
-	 *
3402
-	 * @since 1.0.19
3403
-	 * @return GetPaid_Form_Item|null
3404
-	 */
3405
-	public function get_item( $item_id ) {
3400
+     * Retrieves a specific item.
3401
+     *
3402
+     * @since 1.0.19
3403
+     * @return GetPaid_Form_Item|null
3404
+     */
3405
+    public function get_item( $item_id ) {
3406 3406
 
3407
-		foreach ( $this->get_items() as $item ) {
3408
-			if ( (int) $item_id == $item->get_id() ) {
3409
-				return $item;
3410
-			}
3411
-		}
3407
+        foreach ( $this->get_items() as $item ) {
3408
+            if ( (int) $item_id == $item->get_id() ) {
3409
+                return $item;
3410
+            }
3411
+        }
3412 3412
 
3413
-		return null;
3413
+        return null;
3414 3414
     }
3415 3415
 
3416 3416
     /**
3417
-	 * Removes a specific item.
3418
-	 *
3419
-	 * @since 1.0.19
3420
-	 */
3421
-	public function remove_item( $item_id ) {
3422
-		$items   = $this->get_items();
3423
-		$item_id = (int) $item_id;
3417
+     * Removes a specific item.
3418
+     *
3419
+     * @since 1.0.19
3420
+     */
3421
+    public function remove_item( $item_id ) {
3422
+        $items   = $this->get_items();
3423
+        $item_id = (int) $item_id;
3424 3424
 
3425
-		foreach ( $items as $index => $item ) {
3426
-			if ( (int) $item_id == $item->get_id() ) {
3427
-				unset( $items[ $index ] );
3428
-				$this->set_prop( 'items', $items );
3425
+        foreach ( $items as $index => $item ) {
3426
+            if ( (int) $item_id == $item->get_id() ) {
3427
+                unset( $items[ $index ] );
3428
+                $this->set_prop( 'items', $items );
3429 3429
 
3430
-				if ( $item_id == $this->recurring_item ) {
3431
-					$this->recurring_item = null;
3432
-				}
3430
+                if ( $item_id == $this->recurring_item ) {
3431
+                    $this->recurring_item = null;
3432
+                }
3433 3433
 }
3434
-		}
3434
+        }
3435 3435
 
3436 3436
     }
3437 3437
 
3438 3438
     /**
3439
-	 * Adds a fee to the invoice.
3440
-	 *
3441
-	 * @param array $fee An array of fee details. name, initial_fee, and recurring_fee are required.
3442
-	 * @since 1.0.19
3443
-	 */
3439
+     * Adds a fee to the invoice.
3440
+     *
3441
+     * @param array $fee An array of fee details. name, initial_fee, and recurring_fee are required.
3442
+     * @since 1.0.19
3443
+     */
3444 3444
     public function add_fee( $fee ) {
3445 3445
 
3446
-		$fees                 = $this->get_fees();
3447
-		$fees[ $fee['name'] ] = $fee;
3448
-		$this->set_prop( 'fees', $fees );
3446
+        $fees                 = $this->get_fees();
3447
+        $fees[ $fee['name'] ] = $fee;
3448
+        $this->set_prop( 'fees', $fees );
3449 3449
 
3450 3450
     }
3451 3451
 
3452 3452
     /**
3453
-	 * Retrieves a specific fee.
3454
-	 *
3455
-	 * @since 1.0.19
3456
-	 */
3457
-	public function get_fee( $fee ) {
3453
+     * Retrieves a specific fee.
3454
+     *
3455
+     * @since 1.0.19
3456
+     */
3457
+    public function get_fee( $fee ) {
3458 3458
         $fees = $this->get_fees();
3459
-		return isset( $fees[ $fee ] ) ? $fees[ $fee ] : null;
3459
+        return isset( $fees[ $fee ] ) ? $fees[ $fee ] : null;
3460 3460
     }
3461 3461
 
3462 3462
     /**
3463
-	 * Removes a specific fee.
3464
-	 *
3465
-	 * @since 1.0.19
3466
-	 */
3467
-	public function remove_fee( $fee ) {
3463
+     * Removes a specific fee.
3464
+     *
3465
+     * @since 1.0.19
3466
+     */
3467
+    public function remove_fee( $fee ) {
3468 3468
         $fees = $this->get_fees();
3469 3469
         if ( isset( $fees[ $fee ] ) ) {
3470 3470
             unset( $fees[ $fee ] );
@@ -3472,55 +3472,55 @@  discard block
 block discarded – undo
3472 3472
         }
3473 3473
     }
3474 3474
 
3475
-	/**
3476
-	 * Adds a discount to the invoice.
3477
-	 *
3478
-	 * @param array $discount An array of discount details. name, initial_discount, and recurring_discount are required. Include discount_code if the discount is from a discount code.
3479
-	 * @since 1.0.19
3480
-	 */
3481
-	public function add_discount( $discount ) {
3475
+    /**
3476
+     * Adds a discount to the invoice.
3477
+     *
3478
+     * @param array $discount An array of discount details. name, initial_discount, and recurring_discount are required. Include discount_code if the discount is from a discount code.
3479
+     * @since 1.0.19
3480
+     */
3481
+    public function add_discount( $discount ) {
3482 3482
 
3483
-		$discounts = $this->get_discounts();
3484
-		$discounts[ $discount['name'] ] = $discount;
3485
-		$this->set_prop( 'discounts', $discounts );
3483
+        $discounts = $this->get_discounts();
3484
+        $discounts[ $discount['name'] ] = $discount;
3485
+        $this->set_prop( 'discounts', $discounts );
3486 3486
 
3487
-	}
3487
+    }
3488 3488
 
3489 3489
     /**
3490
-	 * Retrieves a specific discount.
3491
-	 *
3492
-	 * @since 1.0.19
3493
-	 * @return float
3494
-	 */
3495
-	public function get_discount( $discount = false ) {
3490
+     * Retrieves a specific discount.
3491
+     *
3492
+     * @since 1.0.19
3493
+     * @return float
3494
+     */
3495
+    public function get_discount( $discount = false ) {
3496 3496
 
3497
-		// Backwards compatibilty.
3498
-		if ( empty( $discount ) ) {
3499
-			return $this->get_total_discount();
3500
-		}
3497
+        // Backwards compatibilty.
3498
+        if ( empty( $discount ) ) {
3499
+            return $this->get_total_discount();
3500
+        }
3501 3501
 
3502 3502
         $discounts = $this->get_discounts();
3503
-		return isset( $discounts[ $discount ] ) ? $discounts[ $discount ] : null;
3503
+        return isset( $discounts[ $discount ] ) ? $discounts[ $discount ] : null;
3504 3504
     }
3505 3505
 
3506 3506
     /**
3507
-	 * Removes a specific discount.
3508
-	 *
3509
-	 * @since 1.0.19
3510
-	 */
3511
-	public function remove_discount( $discount ) {
3507
+     * Removes a specific discount.
3508
+     *
3509
+     * @since 1.0.19
3510
+     */
3511
+    public function remove_discount( $discount ) {
3512 3512
         $discounts = $this->get_discounts();
3513 3513
         if ( isset( $discounts[ $discount ] ) ) {
3514 3514
             unset( $discounts[ $discount ] );
3515 3515
             $this->set_prop( 'discounts', $discounts );
3516 3516
         }
3517 3517
 
3518
-		if ( 'discount_code' == $discount ) {
3519
-			foreach ( $this->get_items() as $item ) {
3520
-				$item->item_discount           = 0;
3521
-				$item->recurring_item_discount = 0;
3522
-			}
3523
-		}
3518
+        if ( 'discount_code' == $discount ) {
3519
+            foreach ( $this->get_items() as $item ) {
3520
+                $item->item_discount           = 0;
3521
+                $item->recurring_item_discount = 0;
3522
+            }
3523
+        }
3524 3524
 
3525 3525
     }
3526 3526
 
@@ -3533,34 +3533,34 @@  discard block
 block discarded – undo
3533 3533
         if ( $this->is_taxable() ) {
3534 3534
 
3535 3535
             $taxes                 = $this->get_taxes();
3536
-			$taxes[ $tax['name'] ] = $tax;
3537
-			$this->set_prop( 'taxes', $tax );
3536
+            $taxes[ $tax['name'] ] = $tax;
3537
+            $this->set_prop( 'taxes', $tax );
3538 3538
 
3539 3539
         }
3540 3540
     }
3541 3541
 
3542 3542
     /**
3543
-	 * Retrieves a specific tax.
3544
-	 *
3545
-	 * @since 1.0.19
3546
-	 */
3547
-	public function get_tax( $tax = null ) {
3543
+     * Retrieves a specific tax.
3544
+     *
3545
+     * @since 1.0.19
3546
+     */
3547
+    public function get_tax( $tax = null ) {
3548 3548
 
3549
-		// Backwards compatility.
3550
-		if ( empty( $tax ) ) {
3551
-			return $this->get_total_tax();
3552
-		}
3549
+        // Backwards compatility.
3550
+        if ( empty( $tax ) ) {
3551
+            return $this->get_total_tax();
3552
+        }
3553 3553
 
3554 3554
         $taxes = $this->get_taxes();
3555
-		return isset( $taxes[ $tax ] ) ? $taxes[ $tax ] : null;
3555
+        return isset( $taxes[ $tax ] ) ? $taxes[ $tax ] : null;
3556 3556
     }
3557 3557
 
3558 3558
     /**
3559
-	 * Removes a specific tax.
3560
-	 *
3561
-	 * @since 1.0.19
3562
-	 */
3563
-	public function remove_tax( $tax ) {
3559
+     * Removes a specific tax.
3560
+     *
3561
+     * @since 1.0.19
3562
+     */
3563
+    public function remove_tax( $tax ) {
3564 3564
         $taxes = $this->get_taxes();
3565 3565
         if ( isset( $taxes[ $tax ] ) ) {
3566 3566
             unset( $taxes[ $tax ] );
@@ -3569,184 +3569,184 @@  discard block
 block discarded – undo
3569 3569
     }
3570 3570
 
3571 3571
     /**
3572
-	 * Recalculates the invoice subtotal.
3573
-	 *
3574
-	 * @since 1.0.19
3575
-	 * @return float The recalculated subtotal
3576
-	 */
3577
-	public function recalculate_subtotal() {
3572
+     * Recalculates the invoice subtotal.
3573
+     *
3574
+     * @since 1.0.19
3575
+     * @return float The recalculated subtotal
3576
+     */
3577
+    public function recalculate_subtotal() {
3578 3578
         $items     = $this->get_items();
3579
-		$subtotal  = 0;
3580
-		$recurring = 0;
3579
+        $subtotal  = 0;
3580
+        $recurring = 0;
3581 3581
 
3582 3582
         foreach ( $items as $item ) {
3583
-			$subtotal  += $item->get_sub_total( 'edit' );
3584
-			$recurring += $item->get_recurring_sub_total( 'edit' );
3583
+            $subtotal  += $item->get_sub_total( 'edit' );
3584
+            $recurring += $item->get_recurring_sub_total( 'edit' );
3585 3585
         }
3586 3586
 
3587
-		if ( wpinv_prices_include_tax() ) {
3588
-			$subtotal  = max( 0, $subtotal - $this->totals['tax']['initial'] );
3589
-			$recurring = max( 0, $recurring - $this->totals['tax']['recurring'] );
3590
-		}
3587
+        if ( wpinv_prices_include_tax() ) {
3588
+            $subtotal  = max( 0, $subtotal - $this->totals['tax']['initial'] );
3589
+            $recurring = max( 0, $recurring - $this->totals['tax']['recurring'] );
3590
+        }
3591 3591
 
3592
-		$current = $this->is_renewal() ? $recurring : $subtotal;
3593
-		$this->set_subtotal( $current );
3592
+        $current = $this->is_renewal() ? $recurring : $subtotal;
3593
+        $this->set_subtotal( $current );
3594 3594
 
3595
-		$this->totals['subtotal'] = array(
3596
-			'initial'   => $subtotal,
3597
-			'recurring' => $recurring,
3598
-		);
3595
+        $this->totals['subtotal'] = array(
3596
+            'initial'   => $subtotal,
3597
+            'recurring' => $recurring,
3598
+        );
3599 3599
 
3600 3600
         return $current;
3601 3601
     }
3602 3602
 
3603 3603
     /**
3604
-	 * Recalculates the invoice discount total.
3605
-	 *
3606
-	 * @since 1.0.19
3607
-	 * @return float The recalculated discount
3608
-	 */
3609
-	public function recalculate_total_discount() {
3604
+     * Recalculates the invoice discount total.
3605
+     *
3606
+     * @since 1.0.19
3607
+     * @return float The recalculated discount
3608
+     */
3609
+    public function recalculate_total_discount() {
3610 3610
         $discounts = $this->get_discounts();
3611
-		$discount  = 0;
3612
-		$recurring = 0;
3611
+        $discount  = 0;
3612
+        $recurring = 0;
3613 3613
 
3614 3614
         foreach ( $discounts as $data ) {
3615
-			$discount  += wpinv_sanitize_amount( $data['initial_discount'] );
3616
-			$recurring += wpinv_sanitize_amount( $data['recurring_discount'] );
3617
-		}
3615
+            $discount  += wpinv_sanitize_amount( $data['initial_discount'] );
3616
+            $recurring += wpinv_sanitize_amount( $data['recurring_discount'] );
3617
+        }
3618 3618
 
3619
-		$current = $this->is_renewal() ? $recurring : $discount;
3619
+        $current = $this->is_renewal() ? $recurring : $discount;
3620 3620
 
3621
-		$this->set_total_discount( $current );
3621
+        $this->set_total_discount( $current );
3622 3622
 
3623
-		$this->totals['discount'] = array(
3624
-			'initial'   => $discount,
3625
-			'recurring' => $recurring,
3626
-		);
3623
+        $this->totals['discount'] = array(
3624
+            'initial'   => $discount,
3625
+            'recurring' => $recurring,
3626
+        );
3627 3627
 
3628
-		return $current;
3628
+        return $current;
3629 3629
 
3630 3630
     }
3631 3631
 
3632 3632
     /**
3633
-	 * Recalculates the invoice tax total.
3634
-	 *
3635
-	 * @since 1.0.19
3636
-	 * @return float The recalculated tax
3637
-	 */
3638
-	public function recalculate_total_tax() {
3633
+     * Recalculates the invoice tax total.
3634
+     *
3635
+     * @since 1.0.19
3636
+     * @return float The recalculated tax
3637
+     */
3638
+    public function recalculate_total_tax() {
3639 3639
 
3640
-		// Maybe disable taxes.
3641
-		$vat_number = $this->get_vat_number();
3642
-		$skip_tax   = GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $this->get_country() ) && ! empty( $vat_number );
3640
+        // Maybe disable taxes.
3641
+        $vat_number = $this->get_vat_number();
3642
+        $skip_tax   = GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $this->get_country() ) && ! empty( $vat_number );
3643 3643
 
3644
-		if ( wpinv_is_base_country( $this->get_country() ) && 'vat_too' === wpinv_get_option( 'vat_same_country_rule', 'vat_too' ) ) {
3645
-			$skip_tax = false;
3646
-		}
3644
+        if ( wpinv_is_base_country( $this->get_country() ) && 'vat_too' === wpinv_get_option( 'vat_same_country_rule', 'vat_too' ) ) {
3645
+            $skip_tax = false;
3646
+        }
3647 3647
 
3648
-		if ( ! wpinv_use_taxes() || $this->get_disable_taxes() || ! wpinv_is_country_taxable( $this->get_country() ) || $skip_tax ) {
3648
+        if ( ! wpinv_use_taxes() || $this->get_disable_taxes() || ! wpinv_is_country_taxable( $this->get_country() ) || $skip_tax ) {
3649 3649
 
3650
-			$this->totals['tax'] = array(
3651
-				'initial'   => 0,
3652
-				'recurring' => 0,
3653
-			);
3650
+            $this->totals['tax'] = array(
3651
+                'initial'   => 0,
3652
+                'recurring' => 0,
3653
+            );
3654 3654
 
3655
-			$this->tax_rate = 0;
3655
+            $this->tax_rate = 0;
3656 3656
 
3657
-			$this->set_taxes( array() );
3658
-			$current = 0;
3659
-		} else {
3657
+            $this->set_taxes( array() );
3658
+            $current = 0;
3659
+        } else {
3660 3660
 
3661
-			$item_taxes = array();
3661
+            $item_taxes = array();
3662 3662
 
3663
-			foreach ( $this->get_items() as $item ) {
3664
-				$rates    = getpaid_get_item_tax_rates( $item, $this->get_country(), $this->get_state() );
3665
-				$rates    = getpaid_filter_item_tax_rates( $item, $rates );
3666
-				$taxes    = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, false ), $rates );
3667
-				$r_taxes  = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, true ), $rates );
3668
-				foreach ( $taxes as $name => $amount ) {
3669
-					$recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0;
3670
-					$tax       = getpaid_prepare_item_tax( $item, $name, $amount, $recurring );
3663
+            foreach ( $this->get_items() as $item ) {
3664
+                $rates    = getpaid_get_item_tax_rates( $item, $this->get_country(), $this->get_state() );
3665
+                $rates    = getpaid_filter_item_tax_rates( $item, $rates );
3666
+                $taxes    = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, false ), $rates );
3667
+                $r_taxes  = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, true ), $rates );
3668
+                foreach ( $taxes as $name => $amount ) {
3669
+                    $recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0;
3670
+                    $tax       = getpaid_prepare_item_tax( $item, $name, $amount, $recurring );
3671 3671
 
3672
-					if ( ! isset( $item_taxes[ $name ] ) ) {
3673
-						$item_taxes[ $name ] = $tax;
3674
-						continue;
3675
-					}
3672
+                    if ( ! isset( $item_taxes[ $name ] ) ) {
3673
+                        $item_taxes[ $name ] = $tax;
3674
+                        continue;
3675
+                    }
3676 3676
 
3677
-					$item_taxes[ $name ]['initial_tax']   += $tax['initial_tax'];
3678
-					$item_taxes[ $name ]['recurring_tax'] += $tax['recurring_tax'];
3677
+                    $item_taxes[ $name ]['initial_tax']   += $tax['initial_tax'];
3678
+                    $item_taxes[ $name ]['recurring_tax'] += $tax['recurring_tax'];
3679 3679
 
3680
-				}
3681
-			}
3680
+                }
3681
+            }
3682 3682
 
3683
-			$item_taxes = array_replace( $this->get_taxes(), $item_taxes );
3684
-			$this->set_taxes( $item_taxes );
3683
+            $item_taxes = array_replace( $this->get_taxes(), $item_taxes );
3684
+            $this->set_taxes( $item_taxes );
3685 3685
 
3686
-			$initial_tax   = array_sum( wp_list_pluck( $item_taxes, 'initial_tax' ) );
3687
-			$recurring_tax = array_sum( wp_list_pluck( $item_taxes, 'recurring_tax' ) );
3686
+            $initial_tax   = array_sum( wp_list_pluck( $item_taxes, 'initial_tax' ) );
3687
+            $recurring_tax = array_sum( wp_list_pluck( $item_taxes, 'recurring_tax' ) );
3688 3688
 
3689
-			$current = $this->is_renewal() ? $recurring_tax : $initial_tax;
3689
+            $current = $this->is_renewal() ? $recurring_tax : $initial_tax;
3690 3690
 
3691
-			$this->totals['tax'] = array(
3692
-				'initial'   => $initial_tax,
3693
-				'recurring' => $recurring_tax,
3694
-			);
3691
+            $this->totals['tax'] = array(
3692
+                'initial'   => $initial_tax,
3693
+                'recurring' => $recurring_tax,
3694
+            );
3695 3695
 
3696
-		}
3696
+        }
3697 3697
 
3698
-		$this->set_total_tax( $current );
3698
+        $this->set_total_tax( $current );
3699 3699
 
3700
-		return $current;
3700
+        return $current;
3701 3701
 
3702 3702
     }
3703 3703
 
3704 3704
     /**
3705
-	 * Recalculates the invoice fees total.
3706
-	 *
3707
-	 * @since 1.0.19
3708
-	 * @return float The recalculated fee
3709
-	 */
3710
-	public function recalculate_total_fees() {
3711
-		$fees      = $this->get_fees();
3712
-		$fee       = 0;
3713
-		$recurring = 0;
3705
+     * Recalculates the invoice fees total.
3706
+     *
3707
+     * @since 1.0.19
3708
+     * @return float The recalculated fee
3709
+     */
3710
+    public function recalculate_total_fees() {
3711
+        $fees      = $this->get_fees();
3712
+        $fee       = 0;
3713
+        $recurring = 0;
3714 3714
 
3715 3715
         foreach ( $fees as $data ) {
3716
-			$fee       += wpinv_sanitize_amount( $data['initial_fee'] );
3717
-			$recurring += wpinv_sanitize_amount( $data['recurring_fee'] );
3718
-		}
3716
+            $fee       += wpinv_sanitize_amount( $data['initial_fee'] );
3717
+            $recurring += wpinv_sanitize_amount( $data['recurring_fee'] );
3718
+        }
3719 3719
 
3720
-		$current = $this->is_renewal() ? $recurring : $fee;
3721
-		$this->set_total_fees( $current );
3720
+        $current = $this->is_renewal() ? $recurring : $fee;
3721
+        $this->set_total_fees( $current );
3722 3722
 
3723
-		$this->totals['fee'] = array(
3724
-			'initial'   => $fee,
3725
-			'recurring' => $recurring,
3726
-		);
3723
+        $this->totals['fee'] = array(
3724
+            'initial'   => $fee,
3725
+            'recurring' => $recurring,
3726
+        );
3727 3727
 
3728 3728
         $this->set_total_fees( $fee );
3729 3729
         return $current;
3730 3730
     }
3731 3731
 
3732 3732
     /**
3733
-	 * Recalculates the invoice total.
3734
-	 *
3735
-	 * @since 1.0.19
3733
+     * Recalculates the invoice total.
3734
+     *
3735
+     * @since 1.0.19
3736 3736
      * @return float The invoice total
3737
-	 */
3738
-	public function recalculate_total() {
3737
+     */
3738
+    public function recalculate_total() {
3739 3739
         $this->recalculate_total_fees();
3740 3740
         $this->recalculate_total_discount();
3741
-		$this->recalculate_total_tax();
3742
-		$this->recalculate_subtotal();
3743
-		$this->set_total( $this->get_total_tax( 'edit' ) + $this->get_total_fees( 'edit' ) + $this->get_subtotal( 'edit' ) - $this->get_total_discount( 'edit' ) );
3744
-		return $this->get_total();
3745
-	}
3746
-
3747
-	/**
3748
-	 * @deprecated
3749
-	 */
3741
+        $this->recalculate_total_tax();
3742
+        $this->recalculate_subtotal();
3743
+        $this->set_total( $this->get_total_tax( 'edit' ) + $this->get_total_fees( 'edit' ) + $this->get_subtotal( 'edit' ) - $this->get_total_discount( 'edit' ) );
3744
+        return $this->get_total();
3745
+    }
3746
+
3747
+    /**
3748
+     * @deprecated
3749
+     */
3750 3750
     public function recalculate_totals() {
3751 3751
         $this->recalculate_total();
3752 3752
         $this->save( true );
@@ -3760,22 +3760,22 @@  discard block
 block discarded – undo
3760 3760
         return $this->get_data();
3761 3761
     }
3762 3762
 
3763
-	/**
3763
+    /**
3764 3764
      * Adds a system note to an invoice.
3765 3765
      *
3766 3766
      * @param string $note The note being added.
3767
-	 * @return int|false The new note's ID on success, false on failure.
3767
+     * @return int|false The new note's ID on success, false on failure.
3768 3768
      *
3769 3769
      */
3770 3770
     public function add_system_note( $note ) {
3771
-		return $this->add_note( $note, false, false, true );
3772
-	}
3771
+        return $this->add_note( $note, false, false, true );
3772
+    }
3773 3773
 
3774 3774
     /**
3775 3775
      * Adds a note to an invoice.
3776 3776
      *
3777 3777
      * @param string $note The note being added.
3778
-	 * @return int|false The new note's ID on success, false on failure.
3778
+     * @return int|false The new note's ID on success, false on failure.
3779 3779
      *
3780 3780
      */
3781 3781
     public function add_note( $note = '', $customer_type = false, $added_by_user = false, $system = false ) {
@@ -3785,21 +3785,21 @@  discard block
 block discarded – undo
3785 3785
             return false;
3786 3786
         }
3787 3787
 
3788
-		$author       = 'System';
3789
-		$author_email = '[email protected]';
3788
+        $author       = 'System';
3789
+        $author_email = '[email protected]';
3790 3790
 
3791
-		// If this is an admin comment or it has been added by the user.
3792
-		if ( is_user_logged_in() && ( ! $system || $added_by_user ) ) {
3793
-			$user         = get_user_by( 'id', get_current_user_id() );
3791
+        // If this is an admin comment or it has been added by the user.
3792
+        if ( is_user_logged_in() && ( ! $system || $added_by_user ) ) {
3793
+            $user         = get_user_by( 'id', get_current_user_id() );
3794 3794
             $author       = $user->display_name;
3795 3795
             $author_email = $user->user_email;
3796
-		}
3796
+        }
3797 3797
 
3798
-		return getpaid_notes()->add_invoice_note( $this, $note, $author, $author_email, $customer_type );
3798
+        return getpaid_notes()->add_invoice_note( $this, $note, $author, $author_email, $customer_type );
3799 3799
 
3800
-	}
3800
+    }
3801 3801
 
3802
-	/**
3802
+    /**
3803 3803
      * Generates a unique key for the invoice.
3804 3804
      */
3805 3805
     public function generate_key( $string = '' ) {
@@ -3819,113 +3819,113 @@  discard block
 block discarded – undo
3819 3819
             $number = wpinv_get_next_invoice_number( $this->get_post_type() );
3820 3820
         }
3821 3821
 
3822
-		return wpinv_format_invoice_number( $number, $this->get_post_type() );
3823
-
3824
-	}
3825
-
3826
-	/**
3827
-	 * Handle the status transition.
3828
-	 */
3829
-	protected function status_transition() {
3830
-		$status_transition = $this->status_transition;
3831
-
3832
-		// Reset status transition variable.
3833
-		$this->status_transition = false;
3834
-
3835
-		if ( $status_transition ) {
3836
-			try {
3837
-
3838
-				// Fire a hook for the status change.
3839
-				do_action( 'getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition );
3840
-
3841
-				// @deprecated this is deprecated and will be removed in the future.
3842
-				do_action( 'wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3843
-
3844
-				if ( ! empty( $status_transition['from'] ) ) {
3845
-
3846
-					/* translators: 1: old invoice status 2: new invoice status */
3847
-					$transition_note = sprintf( __( 'Status changed from %1$s to %2$s.', 'invoicing' ), wpinv_status_nicename( $status_transition['from'], $this ), wpinv_status_nicename( $status_transition['to'], $this ) );
3848
-
3849
-					// Fire another hook.
3850
-					do_action( 'getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this );
3851
-					do_action( 'getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to'] );
3822
+        return wpinv_format_invoice_number( $number, $this->get_post_type() );
3852 3823
 
3853
-					// @deprecated this is deprecated and will be removed in the future.
3854
-					do_action( 'wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3855
-
3856
-					// Note the transition occurred.
3857
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), false, $status_transition['manual'] );
3858
-
3859
-					// Work out if this was for a payment, and trigger a payment_status hook instead.
3860
-					if (
3861
-						in_array( $status_transition['from'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
3862
-						&& in_array( $status_transition['to'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3863
-					) {
3864
-						do_action( 'getpaid_invoice_payment_status_changed', $this, $status_transition );
3865
-					}
3866
-
3867
-					// Work out if this was for a payment reversal, and trigger a payment_status_reversed hook instead.
3868
-					if (
3869
-						in_array( $status_transition['from'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3870
-						&& in_array( $status_transition['to'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
3871
-					) {
3872
-						do_action( 'getpaid_invoice_payment_status_reversed', $this, $status_transition );
3873
-					}
3874
-				} else {
3875
-					/* translators: %s: new invoice status */
3876
-					$transition_note = sprintf( __( 'Status set to %s.', 'invoicing' ), wpinv_status_nicename( $status_transition['to'], $this ) );
3877
-
3878
-					// Note the transition occurred.
3879
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3824
+    }
3880 3825
 
3881
-				}
3882
-			} catch ( Exception $e ) {
3883
-				$this->add_note( __( 'Error during status transition.', 'invoicing' ) . ' ' . $e->getMessage() );
3884
-			}
3885
-		}
3886
-	}
3826
+    /**
3827
+     * Handle the status transition.
3828
+     */
3829
+    protected function status_transition() {
3830
+        $status_transition = $this->status_transition;
3831
+
3832
+        // Reset status transition variable.
3833
+        $this->status_transition = false;
3834
+
3835
+        if ( $status_transition ) {
3836
+            try {
3837
+
3838
+                // Fire a hook for the status change.
3839
+                do_action( 'getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition );
3840
+
3841
+                // @deprecated this is deprecated and will be removed in the future.
3842
+                do_action( 'wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3843
+
3844
+                if ( ! empty( $status_transition['from'] ) ) {
3845
+
3846
+                    /* translators: 1: old invoice status 2: new invoice status */
3847
+                    $transition_note = sprintf( __( 'Status changed from %1$s to %2$s.', 'invoicing' ), wpinv_status_nicename( $status_transition['from'], $this ), wpinv_status_nicename( $status_transition['to'], $this ) );
3848
+
3849
+                    // Fire another hook.
3850
+                    do_action( 'getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this );
3851
+                    do_action( 'getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to'] );
3852
+
3853
+                    // @deprecated this is deprecated and will be removed in the future.
3854
+                    do_action( 'wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3855
+
3856
+                    // Note the transition occurred.
3857
+                    $this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), false, $status_transition['manual'] );
3858
+
3859
+                    // Work out if this was for a payment, and trigger a payment_status hook instead.
3860
+                    if (
3861
+                        in_array( $status_transition['from'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
3862
+                        && in_array( $status_transition['to'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3863
+                    ) {
3864
+                        do_action( 'getpaid_invoice_payment_status_changed', $this, $status_transition );
3865
+                    }
3866
+
3867
+                    // Work out if this was for a payment reversal, and trigger a payment_status_reversed hook instead.
3868
+                    if (
3869
+                        in_array( $status_transition['from'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3870
+                        && in_array( $status_transition['to'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
3871
+                    ) {
3872
+                        do_action( 'getpaid_invoice_payment_status_reversed', $this, $status_transition );
3873
+                    }
3874
+                } else {
3875
+                    /* translators: %s: new invoice status */
3876
+                    $transition_note = sprintf( __( 'Status set to %s.', 'invoicing' ), wpinv_status_nicename( $status_transition['to'], $this ) );
3877
+
3878
+                    // Note the transition occurred.
3879
+                    $this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3880
+
3881
+                }
3882
+            } catch ( Exception $e ) {
3883
+                $this->add_note( __( 'Error during status transition.', 'invoicing' ) . ' ' . $e->getMessage() );
3884
+            }
3885
+        }
3886
+    }
3887 3887
 
3888
-	/**
3889
-	 * Updates an invoice status.
3890
-	 */
3891
-	public function update_status( $new_status = false, $note = '', $manual = false ) {
3888
+    /**
3889
+     * Updates an invoice status.
3890
+     */
3891
+    public function update_status( $new_status = false, $note = '', $manual = false ) {
3892 3892
 
3893
-		// Fires before updating a status.
3894
-		do_action( 'wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status( 'edit' ) );
3893
+        // Fires before updating a status.
3894
+        do_action( 'wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status( 'edit' ) );
3895 3895
 
3896
-		// Update the status.
3897
-		$this->set_status( $new_status, $note, $manual );
3896
+        // Update the status.
3897
+        $this->set_status( $new_status, $note, $manual );
3898 3898
 
3899
-		// Save the order.
3900
-		return $this->save();
3899
+        // Save the order.
3900
+        return $this->save();
3901 3901
 
3902
-	}
3902
+    }
3903 3903
 
3904
-	/**
3905
-	 * @deprecated
3906
-	 */
3907
-	public function refresh_item_ids() {
3904
+    /**
3905
+     * @deprecated
3906
+     */
3907
+    public function refresh_item_ids() {
3908 3908
         $item_ids = implode( ',', array_unique( wp_list_pluck( $this->get_cart_details(), 'item_id' ) ) );
3909 3909
         update_post_meta( $this->get_id(), '_wpinv_item_ids', $item_ids );
3910
-	}
3910
+    }
3911 3911
 
3912
-	/**
3913
-	 * @deprecated
3914
-	 */
3915
-	public function update_items( $temp = false ) {
3912
+    /**
3913
+     * @deprecated
3914
+     */
3915
+    public function update_items( $temp = false ) {
3916 3916
 
3917
-		$this->set_items( $this->get_items() );
3917
+        $this->set_items( $this->get_items() );
3918 3918
 
3919
-		if ( ! $temp ) {
3920
-			$this->save();
3921
-		}
3919
+        if ( ! $temp ) {
3920
+            $this->save();
3921
+        }
3922 3922
 
3923 3923
         return $this;
3924
-	}
3924
+    }
3925 3925
 
3926
-	/**
3927
-	 * @deprecated
3928
-	 */
3926
+    /**
3927
+     * @deprecated
3928
+     */
3929 3929
     public function validate_discount() {
3930 3930
 
3931 3931
         $discount_code = $this->get_discount_code();
@@ -3941,101 +3941,101 @@  discard block
 block discarded – undo
3941 3941
 
3942 3942
     }
3943 3943
 
3944
-	/**
3945
-	 * Refunds an invoice.
3946
-	 */
3944
+    /**
3945
+     * Refunds an invoice.
3946
+     */
3947 3947
     public function refund() {
3948
-		$this->set_status( 'wpi-refunded' );
3948
+        $this->set_status( 'wpi-refunded' );
3949 3949
         $this->save();
3950
-	}
3950
+    }
3951 3951
 
3952
-	/**
3953
-	 * Marks an invoice as paid.
3954
-	 *
3955
-	 * @param string $transaction_id
3956
-	 */
3952
+    /**
3953
+     * Marks an invoice as paid.
3954
+     *
3955
+     * @param string $transaction_id
3956
+     */
3957 3957
     public function mark_paid( $transaction_id = null, $note = '' ) {
3958 3958
 
3959
-		// Set the transaction id.
3960
-		if ( empty( $transaction_id ) ) {
3961
-			$transaction_id = $this->generate_key( 'trans_' );
3962
-		}
3959
+        // Set the transaction id.
3960
+        if ( empty( $transaction_id ) ) {
3961
+            $transaction_id = $this->generate_key( 'trans_' );
3962
+        }
3963 3963
 
3964
-		if ( ! $this->get_transaction_id() ) {
3965
-			$this->set_transaction_id( $transaction_id );
3966
-		}
3964
+        if ( ! $this->get_transaction_id() ) {
3965
+            $this->set_transaction_id( $transaction_id );
3966
+        }
3967 3967
 
3968
-		if ( $this->is_paid() && 'wpi-processing' != $this->get_status() ) {
3969
-			return $this->save();
3970
-		}
3968
+        if ( $this->is_paid() && 'wpi-processing' != $this->get_status() ) {
3969
+            return $this->save();
3970
+        }
3971 3971
 
3972
-		// Set the completed date.
3973
-		$this->set_date_completed( current_time( 'mysql' ) );
3972
+        // Set the completed date.
3973
+        $this->set_date_completed( current_time( 'mysql' ) );
3974 3974
 
3975
-		// Set the new status.
3976
-		$gateway = sanitize_text_field( $this->get_gateway_title() );
3977
-		if ( $this->is_renewal() || ! $this->is_parent() ) {
3975
+        // Set the new status.
3976
+        $gateway = sanitize_text_field( $this->get_gateway_title() );
3977
+        if ( $this->is_renewal() || ! $this->is_parent() ) {
3978 3978
 
3979
-			$_note = wp_sprintf( __( 'Renewed via %s', 'invoicing' ), $gateway );
3980
-			$_note = $_note . empty( $note ) ? '' : " ($note)";
3979
+            $_note = wp_sprintf( __( 'Renewed via %s', 'invoicing' ), $gateway );
3980
+            $_note = $_note . empty( $note ) ? '' : " ($note)";
3981 3981
 
3982
-			if ( 'none' == $this->get_gateway() ) {
3983
-				$_note = $note;
3984
-			}
3982
+            if ( 'none' == $this->get_gateway() ) {
3983
+                $_note = $note;
3984
+            }
3985 3985
 
3986
-			$this->set_status( 'wpi-renewal', $_note );
3986
+            $this->set_status( 'wpi-renewal', $_note );
3987 3987
 
3988
-		} else {
3988
+        } else {
3989 3989
 
3990
-			$_note = wp_sprintf( __( 'Paid via %s', 'invoicing' ), $gateway );
3991
-			$_note = $_note . empty( $note ) ? '' : " ($note)";
3990
+            $_note = wp_sprintf( __( 'Paid via %s', 'invoicing' ), $gateway );
3991
+            $_note = $_note . empty( $note ) ? '' : " ($note)";
3992 3992
 
3993
-			if ( 'none' == $this->get_gateway() ) {
3994
-				$_note = $note;
3995
-			}
3993
+            if ( 'none' == $this->get_gateway() ) {
3994
+                $_note = $note;
3995
+            }
3996 3996
 
3997
-			$this->set_status( 'publish', $_note );
3997
+            $this->set_status( 'publish', $_note );
3998 3998
 
3999
-		}
3999
+        }
4000 4000
 
4001
-		// Set checkout mode.
4002
-		$mode = wpinv_is_test_mode( $this->get_gateway() ) ? 'test' : 'live';
4003
-		$this->set_mode( $mode );
4001
+        // Set checkout mode.
4002
+        $mode = wpinv_is_test_mode( $this->get_gateway() ) ? 'test' : 'live';
4003
+        $this->set_mode( $mode );
4004 4004
 
4005
-		// Save the invoice.
4005
+        // Save the invoice.
4006 4006
         $this->save();
4007
-	}
4008
-
4009
-	/**
4010
-	 * Save data to the database.
4011
-	 *
4012
-	 * @since 1.0.19
4013
-	 * @return int invoice ID
4014
-	 */
4015
-	public function save() {
4016
-		$this->maybe_set_date_paid();
4017
-		$this->maybe_set_key();
4018
-		parent::save();
4019
-		$this->clear_cache();
4020
-		$this->status_transition();
4021
-		return $this->get_id();
4022
-	}
4023
-
4024
-	/**
4007
+    }
4008
+
4009
+    /**
4010
+     * Save data to the database.
4011
+     *
4012
+     * @since 1.0.19
4013
+     * @return int invoice ID
4014
+     */
4015
+    public function save() {
4016
+        $this->maybe_set_date_paid();
4017
+        $this->maybe_set_key();
4018
+        parent::save();
4019
+        $this->clear_cache();
4020
+        $this->status_transition();
4021
+        return $this->get_id();
4022
+    }
4023
+
4024
+    /**
4025 4025
      * Clears the subscription's cache.
4026 4026
      */
4027 4027
     public function clear_cache() {
4028
-		if ( $this->get_key() ) {
4029
-			wp_cache_delete( $this->get_key(), 'getpaid_invoice_keys_to_invoice_ids' );
4030
-		}
4031
-
4032
-		if ( $this->get_number() ) {
4033
-			wp_cache_delete( $this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids' );
4034
-		}
4035
-
4036
-		if ( $this->get_transaction_id() ) {
4037
-			wp_cache_delete( $this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids' );
4038
-		}
4039
-	}
4028
+        if ( $this->get_key() ) {
4029
+            wp_cache_delete( $this->get_key(), 'getpaid_invoice_keys_to_invoice_ids' );
4030
+        }
4031
+
4032
+        if ( $this->get_number() ) {
4033
+            wp_cache_delete( $this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids' );
4034
+        }
4035
+
4036
+        if ( $this->get_transaction_id() ) {
4037
+            wp_cache_delete( $this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids' );
4038
+        }
4039
+    }
4040 4040
 
4041 4041
 }
Please login to merge, or discard this patch.
includes/gateways/class-getpaid-bank-transfer-gateway.php 1 patch
Indentation   +222 added lines, -222 removed lines patch added patch discarded remove patch
@@ -13,30 +13,30 @@  discard block
 block discarded – undo
13 13
 class GetPaid_Bank_Transfer_Gateway extends GetPaid_Payment_Gateway {
14 14
 
15 15
     /**
16
-	 * Payment method id.
17
-	 *
18
-	 * @var string
19
-	 */
16
+     * Payment method id.
17
+     *
18
+     * @var string
19
+     */
20 20
     public $id = 'bank_transfer';
21 21
 
22
-	/**
23
-	 * An array of features that this gateway supports.
24
-	 *
25
-	 * @var array
26
-	 */
27
-	protected $supports = array( 'subscription', 'addons', 'single_subscription_group', 'multiple_subscription_groups' );
22
+    /**
23
+     * An array of features that this gateway supports.
24
+     *
25
+     * @var array
26
+     */
27
+    protected $supports = array( 'subscription', 'addons', 'single_subscription_group', 'multiple_subscription_groups' );
28 28
 
29 29
     /**
30
-	 * Payment method order.
31
-	 *
32
-	 * @var int
33
-	 */
34
-	public $order = 8;
30
+     * Payment method order.
31
+     *
32
+     * @var int
33
+     */
34
+    public $order = 8;
35 35
 
36 36
     /**
37
-	 * Class constructor.
38
-	 */
39
-	public function __construct() {
37
+     * Class constructor.
38
+     */
39
+    public function __construct() {
40 40
         parent::__construct();
41 41
 
42 42
         $this->title                = __( 'Direct bank transfer', 'invoicing' );
@@ -44,24 +44,24 @@  discard block
 block discarded – undo
44 44
         $this->checkout_button_text = __( 'Proceed', 'invoicing' );
45 45
         $this->instructions         = apply_filters( 'wpinv_bank_instructions', $this->get_option( 'info' ) );
46 46
 
47
-		add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
48
-		add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
49
-		add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 );
50
-		add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
51
-		add_action( 'getpaid_should_renew_subscription', array( $this, 'maybe_renew_subscription' ) );
52
-		add_action( 'getpaid_invoice_status_publish', array( $this, 'invoice_paid' ), 20 );
47
+        add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
48
+        add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
49
+        add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 );
50
+        add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
51
+        add_action( 'getpaid_should_renew_subscription', array( $this, 'maybe_renew_subscription' ) );
52
+        add_action( 'getpaid_invoice_status_publish', array( $this, 'invoice_paid' ), 20 );
53 53
 
54 54
     }
55 55
 
56 56
     /**
57
-	 * Process Payment.
58
-	 *
59
-	 * @param WPInv_Invoice $invoice Invoice.
60
-	 * @param array $submission_data Posted checkout fields.
61
-	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
62
-	 * @return array
63
-	 */
64
-	public function process_payment( $invoice, $submission_data, $submission ) {
57
+     * Process Payment.
58
+     *
59
+     * @param WPInv_Invoice $invoice Invoice.
60
+     * @param array $submission_data Posted checkout fields.
61
+     * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
62
+     * @return array
63
+     */
64
+    public function process_payment( $invoice, $submission_data, $submission ) {
65 65
 
66 66
         // Add a transaction id.
67 67
         $invoice->set_transaction_id( $invoice->generate_key( 'bt_' ) );
@@ -82,66 +82,66 @@  discard block
 block discarded – undo
82 82
     }
83 83
 
84 84
     /**
85
-	 * Output for the order received page.
86
-	 *
87
-	 * @param WPInv_Invoice $invoice Invoice.
88
-	 */
89
-	public function thankyou_page( $invoice ) {
85
+     * Output for the order received page.
86
+     *
87
+     * @param WPInv_Invoice $invoice Invoice.
88
+     */
89
+    public function thankyou_page( $invoice ) {
90 90
 
91 91
         if ( 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
92 92
 
93
-			echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
93
+            echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
94 94
 
95 95
             if ( ! empty( $this->instructions ) ) {
96 96
                 echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) );
97
-			}
97
+            }
98 98
 
99
-			$this->bank_details( $invoice );
99
+            $this->bank_details( $invoice );
100 100
 
101
-			echo '</div>';
101
+            echo '</div>';
102 102
 
103 103
         }
104 104
 
105
-	}
105
+    }
106 106
 
107 107
     /**
108
-	 * Add content to the WPI emails.
109
-	 *
110
-	 * @param WPInv_Invoice $invoice Invoice.
111
-	 * @param string     $email_type Email format: plain text or HTML.
112
-	 * @param bool     $sent_to_admin Sent to admin.
113
-	 */
114
-	public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
108
+     * Add content to the WPI emails.
109
+     *
110
+     * @param WPInv_Invoice $invoice Invoice.
111
+     * @param string     $email_type Email format: plain text or HTML.
112
+     * @param bool     $sent_to_admin Sent to admin.
113
+     */
114
+    public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
115 115
 
116
-		if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
116
+        if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
117 117
 
118
-			echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
118
+            echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
119 119
 
120
-			if ( $this->instructions ) {
121
-				echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
120
+            if ( $this->instructions ) {
121
+                echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
122 122
             }
123 123
 
124
-			$this->bank_details( $invoice );
124
+            $this->bank_details( $invoice );
125 125
 
126
-			echo '</div>';
126
+            echo '</div>';
127 127
 
128
-		}
128
+        }
129 129
 
130 130
     }
131 131
 
132 132
     /**
133
-	 * Get bank details and place into a list format.
134
-	 *
135
-	 * @param WPInv_Invoice $invoice Invoice.
136
-	 */
137
-	protected function bank_details( $invoice ) {
133
+     * Get bank details and place into a list format.
134
+     *
135
+     * @param WPInv_Invoice $invoice Invoice.
136
+     */
137
+    protected function bank_details( $invoice ) {
138 138
 
139
-		// Get the invoice country and country $locale.
140
-		$country = $invoice->get_country();
141
-		$locale  = $this->get_country_locale();
139
+        // Get the invoice country and country $locale.
140
+        $country = $invoice->get_country();
141
+        $locale  = $this->get_country_locale();
142 142
 
143
-		// Get sortcode label in the $locale array and use appropriate one.
144
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
143
+        // Get sortcode label in the $locale array and use appropriate one.
144
+        $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
145 145
 
146 146
         $bank_fields = array(
147 147
             'ac_name'   => __( 'Account Name', 'invoicing' ),
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
 
161 161
             if ( ! empty( $value ) ) {
162 162
                 $bank_info[ $field ] = array(
163
-					'label' => $label,
164
-					'value' => $value,
165
-				);
163
+                    'label' => $label,
164
+                    'value' => $value,
165
+                );
166 166
             }
167
-		}
167
+        }
168 168
 
169 169
         $bank_info = apply_filters( 'wpinv_bank_info', $bank_info, $invoice );
170 170
 
@@ -172,139 +172,139 @@  discard block
 block discarded – undo
172 172
             return;
173 173
         }
174 174
 
175
-		echo '<h3 class="getpaid-bank-transfer-title"> ' . esc_html( apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ), $invoice ) ) . '</h3>' . PHP_EOL;
175
+        echo '<h3 class="getpaid-bank-transfer-title"> ' . esc_html( apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ), $invoice ) ) . '</h3>' . PHP_EOL;
176
+
177
+        echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
178
+
179
+        foreach ( $bank_info as $key => $data ) {
180
+            echo "<tr class='getpaid-bank-transfer-" . esc_attr( $key ) . "'><th class='font-weight-bold'>" . wp_kses_post( $data['label'] ) . "</th><td class='w-75'>" . wp_kses_post( wptexturize( $data['value'] ) ) . '</td></tr>' . PHP_EOL;
181
+        }
182
+
183
+        echo '</table>';
176 184
 
177
-		echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
185
+    }
178 186
 
179
-		foreach ( $bank_info as $key => $data ) {
180
-			echo "<tr class='getpaid-bank-transfer-" . esc_attr( $key ) . "'><th class='font-weight-bold'>" . wp_kses_post( $data['label'] ) . "</th><td class='w-75'>" . wp_kses_post( wptexturize( $data['value'] ) ) . '</td></tr>' . PHP_EOL;
181
-		}
187
+    /**
188
+     * Get country locale if localized.
189
+     *
190
+     * @return array
191
+     */
192
+    public function get_country_locale() {
193
+
194
+        if ( empty( $this->locale ) ) {
195
+
196
+            // Locale information to be used - only those that are not 'Sort Code'.
197
+            $this->locale = apply_filters(
198
+                'getpaid_get_bank_transfer_locale',
199
+                array(
200
+                    'AU' => array(
201
+                        'sortcode' => array(
202
+                            'label' => __( 'BSB', 'invoicing' ),
203
+                        ),
204
+                    ),
205
+                    'CA' => array(
206
+                        'sortcode' => array(
207
+                            'label' => __( 'Bank transit number', 'invoicing' ),
208
+                        ),
209
+                    ),
210
+                    'IN' => array(
211
+                        'sortcode' => array(
212
+                            'label' => __( 'IFSC', 'invoicing' ),
213
+                        ),
214
+                    ),
215
+                    'IT' => array(
216
+                        'sortcode' => array(
217
+                            'label' => __( 'Branch sort', 'invoicing' ),
218
+                        ),
219
+                    ),
220
+                    'NZ' => array(
221
+                        'sortcode' => array(
222
+                            'label' => __( 'Bank code', 'invoicing' ),
223
+                        ),
224
+                    ),
225
+                    'SE' => array(
226
+                        'sortcode' => array(
227
+                            'label' => __( 'Bank code', 'invoicing' ),
228
+                        ),
229
+                    ),
230
+                    'US' => array(
231
+                        'sortcode' => array(
232
+                            'label' => __( 'Routing number', 'invoicing' ),
233
+                        ),
234
+                    ),
235
+                    'ZA' => array(
236
+                        'sortcode' => array(
237
+                            'label' => __( 'Branch code', 'invoicing' ),
238
+                        ),
239
+                    ),
240
+                )
241
+            );
182 242
 
183
-		echo '</table>';
243
+        }
244
+
245
+        return $this->locale;
184 246
 
185 247
     }
186 248
 
187 249
     /**
188
-	 * Get country locale if localized.
189
-	 *
190
-	 * @return array
191
-	 */
192
-	public function get_country_locale() {
193
-
194
-		if ( empty( $this->locale ) ) {
195
-
196
-			// Locale information to be used - only those that are not 'Sort Code'.
197
-			$this->locale = apply_filters(
198
-				'getpaid_get_bank_transfer_locale',
199
-				array(
200
-					'AU' => array(
201
-						'sortcode' => array(
202
-							'label' => __( 'BSB', 'invoicing' ),
203
-						),
204
-					),
205
-					'CA' => array(
206
-						'sortcode' => array(
207
-							'label' => __( 'Bank transit number', 'invoicing' ),
208
-						),
209
-					),
210
-					'IN' => array(
211
-						'sortcode' => array(
212
-							'label' => __( 'IFSC', 'invoicing' ),
213
-						),
214
-					),
215
-					'IT' => array(
216
-						'sortcode' => array(
217
-							'label' => __( 'Branch sort', 'invoicing' ),
218
-						),
219
-					),
220
-					'NZ' => array(
221
-						'sortcode' => array(
222
-							'label' => __( 'Bank code', 'invoicing' ),
223
-						),
224
-					),
225
-					'SE' => array(
226
-						'sortcode' => array(
227
-							'label' => __( 'Bank code', 'invoicing' ),
228
-						),
229
-					),
230
-					'US' => array(
231
-						'sortcode' => array(
232
-							'label' => __( 'Routing number', 'invoicing' ),
233
-						),
234
-					),
235
-					'ZA' => array(
236
-						'sortcode' => array(
237
-							'label' => __( 'Branch code', 'invoicing' ),
238
-						),
239
-					),
240
-				)
241
-			);
242
-
243
-		}
244
-
245
-		return $this->locale;
246
-
247
-	}
248
-
249
-	/**
250
-	 * Filters the gateway settings.
251
-	 *
252
-	 * @param array $admin_settings
253
-	 */
254
-	public function admin_settings( $admin_settings ) {
250
+     * Filters the gateway settings.
251
+     *
252
+     * @param array $admin_settings
253
+     */
254
+    public function admin_settings( $admin_settings ) {
255 255
 
256 256
         $admin_settings['bank_transfer_desc']['std']    = __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' );
257
-		$admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
257
+        $admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
258 258
 
259
-		$locale  = $this->get_country_locale();
259
+        $locale  = $this->get_country_locale();
260 260
 
261
-		// Get sortcode label in the $locale array and use appropriate one.
262
-		$country  = wpinv_default_billing_country();
263
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
261
+        // Get sortcode label in the $locale array and use appropriate one.
262
+        $country  = wpinv_default_billing_country();
263
+        $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
264 264
 
265
-		$admin_settings['bank_transfer_ac_name'] = array(
265
+        $admin_settings['bank_transfer_ac_name'] = array(
266 266
             'type' => 'text',
267 267
             'id'   => 'bank_transfer_ac_name',
268 268
             'name' => __( 'Account Name', 'invoicing' ),
269
-		);
269
+        );
270 270
 
271
-		$admin_settings['bank_transfer_ac_no'] = array(
271
+        $admin_settings['bank_transfer_ac_no'] = array(
272 272
             'type' => 'text',
273 273
             'id'   => 'bank_transfer_ac_no',
274 274
             'name' => __( 'Account Number', 'invoicing' ),
275
-		);
275
+        );
276 276
 
277
-		$admin_settings['bank_transfer_bank_name'] = array(
277
+        $admin_settings['bank_transfer_bank_name'] = array(
278 278
             'type' => 'text',
279 279
             'id'   => 'bank_transfer_bank_name',
280 280
             'name' => __( 'Bank Name', 'invoicing' ),
281
-		);
281
+        );
282 282
 
283
-		$admin_settings['bank_transfer_ifsc'] = array(
283
+        $admin_settings['bank_transfer_ifsc'] = array(
284 284
             'type' => 'text',
285 285
             'id'   => 'bank_transfer_ifsc',
286 286
             'name' => __( 'IFSC Code', 'invoicing' ),
287
-		);
287
+        );
288 288
 
289
-		$admin_settings['bank_transfer_iban'] = array(
289
+        $admin_settings['bank_transfer_iban'] = array(
290 290
             'type' => 'text',
291 291
             'id'   => 'bank_transfer_iban',
292 292
             'name' => __( 'IBAN', 'invoicing' ),
293
-		);
293
+        );
294 294
 
295
-		$admin_settings['bank_transfer_bic'] = array(
295
+        $admin_settings['bank_transfer_bic'] = array(
296 296
             'type' => 'text',
297 297
             'id'   => 'bank_transfer_bic',
298 298
             'name' => __( 'BIC/Swift Code', 'invoicing' ),
299
-		);
299
+        );
300 300
 
301
-		$admin_settings['bank_transfer_sort_code'] = array(
302
-			'type' => 'text',
303
-			'id'   => 'bank_transfer_sort_code',
304
-			'name' => $sortcode,
305
-		);
301
+        $admin_settings['bank_transfer_sort_code'] = array(
302
+            'type' => 'text',
303
+            'id'   => 'bank_transfer_sort_code',
304
+            'name' => $sortcode,
305
+        );
306 306
 
307
-		$admin_settings['bank_transfer_info'] = array(
307
+        $admin_settings['bank_transfer_info'] = array(
308 308
             'id'   => 'bank_transfer_info',
309 309
             'name' => __( 'Instructions', 'invoicing' ),
310 310
             'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ),
@@ -314,17 +314,17 @@  discard block
 block discarded – undo
314 314
             'rows' => 5,
315 315
         );
316 316
 
317
-		return $admin_settings;
318
-	}
317
+        return $admin_settings;
318
+    }
319 319
 
320
-	/**
321
-	 * Processes invoice addons.
322
-	 *
323
-	 * @param WPInv_Invoice $invoice
324
-	 * @param GetPaid_Form_Item[] $items
325
-	 * @return WPInv_Invoice
326
-	 */
327
-	public function process_addons( $invoice, $items ) {
320
+    /**
321
+     * Processes invoice addons.
322
+     *
323
+     * @param WPInv_Invoice $invoice
324
+     * @param GetPaid_Form_Item[] $items
325
+     * @return WPInv_Invoice
326
+     */
327
+    public function process_addons( $invoice, $items ) {
328 328
 
329 329
         foreach ( $items as $item ) {
330 330
             $invoice->add_item( $item );
@@ -332,66 +332,66 @@  discard block
 block discarded – undo
332 332
 
333 333
         $invoice->recalculate_total();
334 334
         $invoice->save();
335
-	}
335
+    }
336 336
 
337
-	/**
338
-	 * (Maybe) renews a bank transfer subscription profile.
339
-	 *
340
-	 *
337
+    /**
338
+     * (Maybe) renews a bank transfer subscription profile.
339
+     *
340
+     *
341 341
      * @param WPInv_Subscription $subscription
342
-	 */
343
-	public function maybe_renew_subscription( $subscription ) {
342
+     */
343
+    public function maybe_renew_subscription( $subscription ) {
344 344
 
345 345
         // Ensure its our subscription && it's active.
346 346
         if ( $this->id === $subscription->get_gateway() && $subscription->has_status( 'active trialling' ) ) {
347
-			$subscription->create_payment();
347
+            $subscription->create_payment();
348 348
         }
349 349
 
350 350
     }
351 351
 
352
-	/**
353
-	 * Process a bank transfer payment.
354
-	 *
355
-	 *
352
+    /**
353
+     * Process a bank transfer payment.
354
+     *
355
+     *
356 356
      * @param WPInv_Invoice $invoice
357
-	 */
358
-	public function invoice_paid( $invoice ) {
359
-
360
-		// Abort if not paid by bank transfer.
361
-		if ( $this->id !== $invoice->get_gateway() || ! $invoice->is_recurring() ) {
362
-			return;
363
-		}
364
-
365
-		// Is it a parent payment?
366
-		if ( 0 == $invoice->get_parent_id() ) {
367
-
368
-			// (Maybe) activate subscriptions.
369
-			$subscriptions = getpaid_get_invoice_subscriptions( $invoice );
370
-
371
-			if ( ! empty( $subscriptions ) ) {
372
-				$subscriptions = is_array( $subscriptions ) ? $subscriptions : array( $subscriptions );
373
-
374
-				foreach ( $subscriptions as $subscription ) {
375
-					if ( $subscription->exists() ) {
376
-						$duration = strtotime( $subscription->get_expiration() ) - strtotime( $subscription->get_date_created() );
377
-						$expiry   = date( 'Y-m-d H:i:s', ( current_time( 'timestamp' ) + $duration ) );
378
-
379
-						$subscription->set_next_renewal_date( $expiry );
380
-						$subscription->set_date_created( current_time( 'mysql' ) );
381
-						$subscription->set_profile_id( 'bt_sub_' . $invoice->get_id() . '_' . $subscription->get_id() );
382
-						$subscription->activate();
383
-					}
384
-				}
357
+     */
358
+    public function invoice_paid( $invoice ) {
359
+
360
+        // Abort if not paid by bank transfer.
361
+        if ( $this->id !== $invoice->get_gateway() || ! $invoice->is_recurring() ) {
362
+            return;
363
+        }
364
+
365
+        // Is it a parent payment?
366
+        if ( 0 == $invoice->get_parent_id() ) {
367
+
368
+            // (Maybe) activate subscriptions.
369
+            $subscriptions = getpaid_get_invoice_subscriptions( $invoice );
370
+
371
+            if ( ! empty( $subscriptions ) ) {
372
+                $subscriptions = is_array( $subscriptions ) ? $subscriptions : array( $subscriptions );
373
+
374
+                foreach ( $subscriptions as $subscription ) {
375
+                    if ( $subscription->exists() ) {
376
+                        $duration = strtotime( $subscription->get_expiration() ) - strtotime( $subscription->get_date_created() );
377
+                        $expiry   = date( 'Y-m-d H:i:s', ( current_time( 'timestamp' ) + $duration ) );
378
+
379
+                        $subscription->set_next_renewal_date( $expiry );
380
+                        $subscription->set_date_created( current_time( 'mysql' ) );
381
+                        $subscription->set_profile_id( 'bt_sub_' . $invoice->get_id() . '_' . $subscription->get_id() );
382
+                        $subscription->activate();
383
+                    }
384
+                }
385 385
 }
386 386
 } else {
387 387
 
388
-			$subscription = getpaid_get_subscription( $invoice->get_subscription_id() );
388
+            $subscription = getpaid_get_subscription( $invoice->get_subscription_id() );
389 389
 
390
-			// Renew the subscription.
391
-			if ( $subscription && $subscription->exists() ) {
392
-				$subscription->add_payment( array(), $invoice );
393
-				$subscription->renew( strtotime( $invoice->get_date_created() ) );
394
-					}
390
+            // Renew the subscription.
391
+            if ( $subscription && $subscription->exists() ) {
392
+                $subscription->add_payment( array(), $invoice );
393
+                $subscription->renew( strtotime( $invoice->get_date_created() ) );
394
+                    }
395 395
 }
396 396
 
397 397
     }
Please login to merge, or discard this patch.
templates/payment-forms/cart-item.php 1 patch
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -26,71 +26,71 @@  discard block
 block discarded – undo
26 26
 
27 27
 				<?php
28 28
 
29
-					// Fires before printing a line item column.
30
-					do_action( "getpaid_form_cart_item_before_$key", $item, $form );
29
+                    // Fires before printing a line item column.
30
+                    do_action( "getpaid_form_cart_item_before_$key", $item, $form );
31 31
 
32
-					// Item name.
33
-					if ( 'name' === $key ) {
32
+                    // Item name.
33
+                    if ( 'name' === $key ) {
34 34
 
35 35
 
36
-						ob_start();
36
+                        ob_start();
37 37
 
38
-						// Add an optional description.
39
-						$description = $item->get_description();
38
+                        // Add an optional description.
39
+                        $description = $item->get_description();
40 40
 
41
-						if ( ! empty( $description ) ) {
42
-							echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>';
43
-						}
41
+                        if ( ! empty( $description ) ) {
42
+                            echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>';
43
+                        }
44 44
 
45
-						// Price help text.
46
-						$description = getpaid_item_recurring_price_help_text( $item, $currency );
47
-						if ( $description ) {
48
-							echo "<small class='getpaid-form-item-price-desc form-text text-muted font-italic pr-2 m-0'>" . wp_kses_post( $description ) . '</small>';
49
-						}
45
+                        // Price help text.
46
+                        $description = getpaid_item_recurring_price_help_text( $item, $currency );
47
+                        if ( $description ) {
48
+                            echo "<small class='getpaid-form-item-price-desc form-text text-muted font-italic pr-2 m-0'>" . wp_kses_post( $description ) . '</small>';
49
+                        }
50 50
 
51
-						do_action( 'getpaid_payment_form_cart_item_description', $item, $form );
51
+                        do_action( 'getpaid_payment_form_cart_item_description', $item, $form );
52 52
 
53
-						if ( wpinv_current_user_can_manage_invoicing() ) {
53
+                        if ( wpinv_current_user_can_manage_invoicing() ) {
54 54
 
55
-							edit_post_link(
56
-								__( 'Edit this item.', 'invoicing' ),
57
-								'<small class="form-text text-muted">',
58
-								'</small>',
59
-								$item->get_id(),
60
-								'text-danger'
61
-							);
55
+                            edit_post_link(
56
+                                __( 'Edit this item.', 'invoicing' ),
57
+                                '<small class="form-text text-muted">',
58
+                                '</small>',
59
+                                $item->get_id(),
60
+                                'text-danger'
61
+                            );
62 62
 
63
-						}
63
+                        }
64 64
 
65
-						$description = ob_get_clean();
65
+                        $description = ob_get_clean();
66 66
 
67
-						// Display the name.
68
-						$tootip = empty( $description ) ? '' : '&nbsp;<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>';
67
+                        // Display the name.
68
+                        $tootip = empty( $description ) ? '' : '&nbsp;<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>';
69 69
 
70
-						$has_featured_image = has_post_thumbnail( $item->get_id() );
70
+                        $has_featured_image = has_post_thumbnail( $item->get_id() );
71 71
 
72
-						if ( $has_featured_image ) {
73
-							echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">';
74
-							echo '<div class="getpaid-form-item-image-container mr-2">';
75
-							echo get_the_post_thumbnail( $item->get_id(), 'thumbnail', array( 'class' => 'getpaid-form-item-image mb-0' ) );
76
-							echo '</div>';
77
-							echo '<div class="getpaid-form-item-name-container">';
78
-						}
72
+                        if ( $has_featured_image ) {
73
+                            echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">';
74
+                            echo '<div class="getpaid-form-item-image-container mr-2">';
75
+                            echo get_the_post_thumbnail( $item->get_id(), 'thumbnail', array( 'class' => 'getpaid-form-item-image mb-0' ) );
76
+                            echo '</div>';
77
+                            echo '<div class="getpaid-form-item-name-container">';
78
+                        }
79 79
 
80
-						echo '<div class="mb-1 font-weight-bold">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>';
80
+                        echo '<div class="mb-1 font-weight-bold">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>';
81 81
 
82
-						if ( ! empty( $description ) ) {
83
-							printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post( $description ) );
84
-						}
82
+                        if ( ! empty( $description ) ) {
83
+                            printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post( $description ) );
84
+                        }
85 85
 
86
-						if ( $item->allows_quantities() ) {
87
-							printf(
88
-								'<small class="d-sm-none text-muted form-text">%s</small>',
89
-								sprintf(
90
-									// translators: %s is the item quantity.
91
-									esc_html__( 'Qty %s', 'invoicing' ),
92
-									sprintf(
93
-										'<input
86
+                        if ( $item->allows_quantities() ) {
87
+                            printf(
88
+                                '<small class="d-sm-none text-muted form-text">%s</small>',
89
+                                sprintf(
90
+                                    // translators: %s is the item quantity.
91
+                                    esc_html__( 'Qty %s', 'invoicing' ),
92
+                                    sprintf(
93
+                                        '<input
94 94
 												type="number"
95 95
 												step="0.01"
96 96
 												style="width: 48px;"
@@ -99,62 +99,62 @@  discard block
 block discarded – undo
99 99
 												min="1"
100 100
 												max="%s"
101 101
 												>',
102
-										(float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(),
103
-										floatval( null !== $max_qty ? $max_qty : 1000000000000 )
104
-									)
105
-								)
106
-							);
107
-						} else {
108
-							printf(
109
-								'<small class="d-sm-none text-muted form-text">%s</small>',
110
-								sprintf(
111
-									// translators: %s is the item quantity.
112
-									esc_html__( 'Qty %s', 'invoicing' ),
113
-									(float) $item->get_quantity()
114
-								)
115
-							);
116
-						}
117
-
118
-						if ( $has_featured_image ) {
119
-							echo '</div>';
120
-							echo '</div>';
121
-						}
122
-					}
123
-
124
-					// Item price.
125
-					if ( 'price' === $key ) {
126
-
127
-					// Set the currency position.
128
-					$position = wpinv_currency_position();
129
-
130
-					if ( 'left_space' === $position ) {
131
-						$position = 'left';
132
-					}
133
-
134
-					if ( 'right_space' === $position ) {
135
-						$position = 'right';
136
-					}
137
-
138
-					if ( $item->user_can_set_their_price() ) {
139
-						$price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
140
-						$minimum          = (float) $item->get_minimum_price();
141
-						$validate_minimum = '';
142
-						$class            = '';
143
-						$data_minimum     = '';
144
-
145
-						if ( $minimum > 0 ) {
146
-							$validate_minimum = sprintf(
147
-								// translators: %s is the minimum price.
148
-								esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
149
-								wp_strip_all_tags( wpinv_price( $minimum, $currency ) )
150
-							);
151
-
152
-							$class = 'getpaid-validate-minimum-amount';
153
-
154
-							$data_minimum     = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'";
155
-						}
156
-
157
-						?>
102
+                                        (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(),
103
+                                        floatval( null !== $max_qty ? $max_qty : 1000000000000 )
104
+                                    )
105
+                                )
106
+                            );
107
+                        } else {
108
+                            printf(
109
+                                '<small class="d-sm-none text-muted form-text">%s</small>',
110
+                                sprintf(
111
+                                    // translators: %s is the item quantity.
112
+                                    esc_html__( 'Qty %s', 'invoicing' ),
113
+                                    (float) $item->get_quantity()
114
+                                )
115
+                            );
116
+                        }
117
+
118
+                        if ( $has_featured_image ) {
119
+                            echo '</div>';
120
+                            echo '</div>';
121
+                        }
122
+                    }
123
+
124
+                    // Item price.
125
+                    if ( 'price' === $key ) {
126
+
127
+                    // Set the currency position.
128
+                    $position = wpinv_currency_position();
129
+
130
+                    if ( 'left_space' === $position ) {
131
+                        $position = 'left';
132
+                    }
133
+
134
+                    if ( 'right_space' === $position ) {
135
+                        $position = 'right';
136
+                    }
137
+
138
+                    if ( $item->user_can_set_their_price() ) {
139
+                        $price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
140
+                        $minimum          = (float) $item->get_minimum_price();
141
+                        $validate_minimum = '';
142
+                        $class            = '';
143
+                        $data_minimum     = '';
144
+
145
+                        if ( $minimum > 0 ) {
146
+                            $validate_minimum = sprintf(
147
+                                // translators: %s is the minimum price.
148
+                                esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
149
+                                wp_strip_all_tags( wpinv_price( $minimum, $currency ) )
150
+                            );
151
+
152
+                            $class = 'getpaid-validate-minimum-amount';
153
+
154
+                            $data_minimum     = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'";
155
+                        }
156
+
157
+                        ?>
158 158
 								<div class="input-group input-group-sm">
159 159
 									<?php if ( 'left' === $position ) : ?>
160 160
 										<?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?>
@@ -195,44 +195,44 @@  discard block
 block discarded – undo
195 195
 
196 196
 							<?php
197 197
 
198
-						} else {
199
-						echo wp_kses_post( wpinv_price( $item->get_price(), $currency ) );
198
+                        } else {
199
+                        echo wp_kses_post( wpinv_price( $item->get_price(), $currency ) );
200 200
 
201
-						?>
201
+                        ?>
202 202
 								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'>
203 203
 						<?php
204
-						}
204
+                        }
205 205
 
206
-					printf(
206
+                    printf(
207 207
                         '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>',
208
-						// translators: %s is the item subtotal.
208
+                        // translators: %s is the item subtotal.
209 209
                         sprintf( esc_html__( 'Subtotal: %s', 'invoicing' ), wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ) )
210 210
                     );
211
-					}
211
+                    }
212 212
 
213
-					// Item quantity.
214
-					if ( 'quantity' === $key ) {
213
+                    // Item quantity.
214
+                    if ( 'quantity' === $key ) {
215 215
 
216
-					if ( $item->allows_quantities() ) {
217
-						?>
216
+                    if ( $item->allows_quantities() ) {
217
+                        ?>
218 218
 								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type="number" step="any" style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(); ?>' min='1' <?php echo null !== $max_qty ? 'max="' . (float) $max_qty . '"' : ''; ?> required>
219 219
 							<?php
220
-						} else {
221
-						echo (float) $item->get_quantity();
222
-						echo '&nbsp;&nbsp;&nbsp;';
223
-						?>
220
+                        } else {
221
+                        echo (float) $item->get_quantity();
222
+                        echo '&nbsp;&nbsp;&nbsp;';
223
+                        ?>
224 224
 								<input type='hidden' name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' class='getpaid-item-quantity-input' value='<?php echo (float) $item->get_quantity(); ?>'>
225 225
 						<?php
226
-						}
226
+                        }
227 227
 }
228 228
 
229
-					// Item sub total.
230
-					if ( 'subtotal' === $key ) {
231
-					echo wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) );
232
-					}
229
+                    // Item sub total.
230
+                    if ( 'subtotal' === $key ) {
231
+                    echo wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) );
232
+                    }
233 233
 
234
-					do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
235
-				?>
234
+                    do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
235
+                ?>
236 236
 
237 237
 			</div>
238 238
 
Please login to merge, or discard this patch.