Passed
Push — master ( 9dee83...fe7410 )
by Stiofan
06:39
created
invoicing.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,16 +19,16 @@  discard block
 block discarded – undo
19 19
 
20 20
 // Define constants.
21 21
 if ( ! defined( 'WPINV_PLUGIN_FILE' ) ) {
22
-	define( 'WPINV_PLUGIN_FILE', __FILE__ );
22
+    define( 'WPINV_PLUGIN_FILE', __FILE__ );
23 23
 }
24 24
 
25 25
 if ( ! defined( 'WPINV_VERSION' ) ) {
26
-	define( 'WPINV_VERSION', '2.8.17' );
26
+    define( 'WPINV_VERSION', '2.8.17' );
27 27
 }
28 28
 
29 29
 // Include the main Invoicing class.
30 30
 if ( ! class_exists( 'WPInv_Plugin', false ) ) {
31
-	require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php';
31
+    require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php';
32 32
 }
33 33
 
34 34
 /**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $GLOBALS['invoicing'] = new WPInv_Plugin();
44 44
     }
45 45
 
46
-	return $GLOBALS['invoicing'];
46
+    return $GLOBALS['invoicing'];
47 47
 }
48 48
 
49 49
 /**
Please login to merge, or discard this patch.
includes/reports/class-getpaid-reports.php 1 patch
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -12,49 +12,49 @@  discard block
 block discarded – undo
12 12
  */
13 13
 class GetPaid_Reports {
14 14
 
15
-	/**
16
-	 * Class constructor.
17
-	 *
18
-	 */
19
-	public function __construct() {
20
-		add_action( 'admin_menu', array( $this, 'register_reports_page' ), 20 );
21
-		add_action( 'wpinv_reports_tab_reports', array( $this, 'display_reports_tab' ) );
22
-		add_action( 'wpinv_reports_tab_export', array( $this, 'display_exports_tab' ) );
23
-		add_action( 'getpaid_authenticated_admin_action_download_graph', array( $this, 'download_graph' ) );
24
-		add_action( 'getpaid_authenticated_admin_action_export_invoices', array( $this, 'export_invoices' ) );
25
-
26
-	}
27
-
28
-	/**
29
-	 * Registers the reports page.
30
-	 *
31
-	 */
32
-	public function register_reports_page() {
33
-
34
-		add_submenu_page(
15
+    /**
16
+     * Class constructor.
17
+     *
18
+     */
19
+    public function __construct() {
20
+        add_action( 'admin_menu', array( $this, 'register_reports_page' ), 20 );
21
+        add_action( 'wpinv_reports_tab_reports', array( $this, 'display_reports_tab' ) );
22
+        add_action( 'wpinv_reports_tab_export', array( $this, 'display_exports_tab' ) );
23
+        add_action( 'getpaid_authenticated_admin_action_download_graph', array( $this, 'download_graph' ) );
24
+        add_action( 'getpaid_authenticated_admin_action_export_invoices', array( $this, 'export_invoices' ) );
25
+
26
+    }
27
+
28
+    /**
29
+     * Registers the reports page.
30
+     *
31
+     */
32
+    public function register_reports_page() {
33
+
34
+        add_submenu_page(
35 35
             'wpinv',
36 36
             __( 'Reports', 'invoicing' ),
37 37
             __( 'Reports', 'invoicing' ),
38 38
             wpinv_get_capability(),
39 39
             'wpinv-reports',
40 40
             array( $this, 'display_reports_page' )
41
-		);
41
+        );
42 42
 
43
-	}
43
+    }
44 44
 
45
-	/**
46
-	 * Displays the reports page.
47
-	 *
48
-	 */
49
-	public function display_reports_page() {
45
+    /**
46
+     * Displays the reports page.
47
+     *
48
+     */
49
+    public function display_reports_page() {
50 50
 
51
-		// Prepare variables.
52
-		$tabs        = $this->get_tabs();
53
-		$current_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'reports';
54
-		$current_tab = array_key_exists( $current_tab, $tabs ) ? $current_tab : 'reports';
51
+        // Prepare variables.
52
+        $tabs        = $this->get_tabs();
53
+        $current_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'reports';
54
+        $current_tab = array_key_exists( $current_tab, $tabs ) ? $current_tab : 'reports';
55 55
 
56
-		// Display the current tab.
57
-		?>
56
+        // Display the current tab.
57
+        ?>
58 58
 
59 59
         <div class="wrap">
60 60
 
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
 			<nav class="nav-tab-wrapper">
64 64
 
65 65
 				<?php
66
-					foreach ( $tabs as $key => $label ) {
66
+                    foreach ( $tabs as $key => $label ) {
67 67
 
68
-					$key   = sanitize_key( $key );
69
-					$label = esc_html( $label );
70
-					$class = $key == $current_tab ? 'nav-tab nav-tab-active' : 'nav-tab ';
71
-					$url   = esc_url(
68
+                    $key   = sanitize_key( $key );
69
+                    $label = esc_html( $label );
70
+                    $class = $key == $current_tab ? 'nav-tab nav-tab-active' : 'nav-tab ';
71
+                    $url   = esc_url(
72 72
                         add_query_arg( 'tab', $key, admin_url( 'admin.php?page=wpinv-reports' ) )
73 73
                     );
74 74
 
75
-				echo wp_kses_post( "\n\t\t\t<a href='$url' class='" . $class . "'>$label</a>" );
75
+                echo wp_kses_post( "\n\t\t\t<a href='$url' class='" . $class . "'>$label</a>" );
76 76
 
77
-					}
78
-				?>
77
+                    }
78
+                ?>
79 79
 
80 80
 			</nav>
81 81
 
@@ -86,82 +86,82 @@  discard block
 block discarded – undo
86 86
         </div>
87 87
 		<?php
88 88
 
89
-			// Wordfence loads an unsupported version of chart js on our page.
90
-			wp_deregister_style( 'chart-js' );
91
-			wp_deregister_script( 'chart-js' );
92
-			wp_enqueue_script( 'chart-js', WPINV_PLUGIN_URL . 'assets/js/chart.min.js', array( 'jquery' ), '3.7.1', true );
89
+            // Wordfence loads an unsupported version of chart js on our page.
90
+            wp_deregister_style( 'chart-js' );
91
+            wp_deregister_script( 'chart-js' );
92
+            wp_enqueue_script( 'chart-js', WPINV_PLUGIN_URL . 'assets/js/chart.min.js', array( 'jquery' ), '3.7.1', true );
93 93
 
94
-	}
94
+    }
95 95
 
96
-	/**
97
-	 * Retrieves reports page tabs.
98
-	 *
99
-	 * @return array
100
-	 */
101
-	public function get_tabs() {
96
+    /**
97
+     * Retrieves reports page tabs.
98
+     *
99
+     * @return array
100
+     */
101
+    public function get_tabs() {
102 102
 
103
-		$tabs = array(
104
-			'reports' => __( 'Reports', 'invoicing' ),
105
-			'export'  => __( 'Export', 'invoicing' ),
106
-		);
103
+        $tabs = array(
104
+            'reports' => __( 'Reports', 'invoicing' ),
105
+            'export'  => __( 'Export', 'invoicing' ),
106
+        );
107 107
 
108
-		return apply_filters( 'getpaid_report_tabs', $tabs );
109
-	}
108
+        return apply_filters( 'getpaid_report_tabs', $tabs );
109
+    }
110 110
 
111
-	/**
112
-	 * Displays the reports tab.
113
-	 *
114
-	 */
115
-	public function display_reports_tab() {
111
+    /**
112
+     * Displays the reports tab.
113
+     *
114
+     */
115
+    public function display_reports_tab() {
116 116
 
117
-		$reports = new GetPaid_Reports_Report();
118
-		$reports->display();
117
+        $reports = new GetPaid_Reports_Report();
118
+        $reports->display();
119 119
 
120
-	}
120
+    }
121 121
 
122
-	/**
123
-	 * Displays the exports tab.
124
-	 *
125
-	 */
126
-	public function display_exports_tab() {
122
+    /**
123
+     * Displays the exports tab.
124
+     *
125
+     */
126
+    public function display_exports_tab() {
127 127
 
128
-		$exports = new GetPaid_Reports_Export();
129
-		$exports->display();
128
+        $exports = new GetPaid_Reports_Export();
129
+        $exports->display();
130 130
 
131
-	}
131
+    }
132 132
 
133
-	/**
134
-	 * Donwnloads a graph.
135
-	 *
136
-	 * @param array $args
137
-	 */
138
-	public function download_graph( $args ) {
133
+    /**
134
+     * Donwnloads a graph.
135
+     *
136
+     * @param array $args
137
+     */
138
+    public function download_graph( $args ) {
139 139
 
140
-		if ( ! empty( $args['graph'] ) ) {
141
-			$downloader = new GetPaid_Graph_Downloader();
142
-			$downloader->download( $args['graph'] );
143
-		}
140
+        if ( ! empty( $args['graph'] ) ) {
141
+            $downloader = new GetPaid_Graph_Downloader();
142
+            $downloader->download( $args['graph'] );
143
+        }
144 144
 
145
-	}
145
+    }
146 146
 
147
-	/**
148
-	 * Exports invoices.
149
-	 *
150
-	 * @param array $args
151
-	 */
152
-	public function export_invoices( $args ) {
147
+    /**
148
+     * Exports invoices.
149
+     *
150
+     * @param array $args
151
+     */
152
+    public function export_invoices( $args ) {
153 153
 
154
-		if ( ! empty( $args['post_type'] ) ) {
154
+        if ( ! empty( $args['post_type'] ) ) {
155 155
 
156
-			if ( 'subscriptions' === $args['post_type'] ) {
157
-				$downloader = new GetPaid_Subscription_Exporter();
158
-			} else {
159
-				$downloader = new GetPaid_Invoice_Exporter();
160
-			}
156
+            if ( 'subscriptions' === $args['post_type'] ) {
157
+                $downloader = new GetPaid_Subscription_Exporter();
158
+            } else {
159
+                $downloader = new GetPaid_Invoice_Exporter();
160
+            }
161 161
 
162
-			$downloader->export( $args['post_type'], $args );
163
-		}
162
+            $downloader->export( $args['post_type'], $args );
163
+        }
164 164
 
165
-	}
165
+    }
166 166
 
167 167
 }
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/ayecode-ui-settings.php 1 patch
Indentation   +2353 added lines, -2353 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,472 +21,472 @@  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.2.28';
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 = "5.2.2";
53
-
54
-		/**
55
-		 * Current version of select2 being used.
56
-		 *
57
-		 * @var string
58
-		 */
59
-		public $select2_version = "4.0.11";
60
-
61
-		/**
62
-		 * The title.
63
-		 *
64
-		 * @var string
65
-		 */
66
-		public $name = 'AyeCode UI';
67
-
68
-		/**
69
-		 * The relative url to the assets.
70
-		 *
71
-		 * @var string
72
-		 */
73
-		public $url = '';
74
-
75
-		/**
76
-		 * Holds the settings values.
77
-		 *
78
-		 * @var array
79
-		 */
80
-		private $settings;
81
-
82
-		/**
83
-		 * AyeCode_UI_Settings instance.
84
-		 *
85
-		 * @access private
86
-		 * @since  1.0.0
87
-		 * @var    AyeCode_UI_Settings There can be only one!
88
-		 */
89
-		private static $instance = null;
90
-
91
-
92
-		/**
93
-		 * Main AyeCode_UI_Settings Instance.
94
-		 *
95
-		 * Ensures only one instance of AyeCode_UI_Settings is loaded or can be loaded.
96
-		 *
97
-		 * @since 1.0.0
98
-		 * @static
99
-		 * @return AyeCode_UI_Settings - Main instance.
100
-		 */
101
-		public static function instance() {
102
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) {
103
-
104
-				self::$instance = new AyeCode_UI_Settings;
105
-
106
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
107
-
108
-				if ( is_admin() ) {
109
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
110
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
111
-
112
-					// Maybe show example page
113
-					add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
114
-
115
-					if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
116
-						add_filter( 'sd_aui_colors', array( self::$instance,'sd_aui_colors' ), 10, 3 );
117
-					}
118
-				}
24
+    /**
25
+     * A Class to be able to change settings for Font Awesome.
26
+     *
27
+     * Class AyeCode_UI_Settings
28
+     * @ver 1.0.0
29
+     * @todo decide how to implement textdomain
30
+     */
31
+    class AyeCode_UI_Settings {
32
+
33
+        /**
34
+         * Class version version.
35
+         *
36
+         * @var string
37
+         */
38
+        public $version = '0.2.28';
39
+
40
+        /**
41
+         * Class textdomain.
42
+         *
43
+         * @var string
44
+         */
45
+        public $textdomain = 'aui';
119 46
 
120
-				add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
47
+        /**
48
+         * Latest version of Bootstrap at time of publish published.
49
+         *
50
+         * @var string
51
+         */
52
+        public $latest = "5.2.2";
53
+
54
+        /**
55
+         * Current version of select2 being used.
56
+         *
57
+         * @var string
58
+         */
59
+        public $select2_version = "4.0.11";
121 60
 
122
-				do_action( 'ayecode_ui_settings_loaded' );
123
-			}
61
+        /**
62
+         * The title.
63
+         *
64
+         * @var string
65
+         */
66
+        public $name = 'AyeCode UI';
124 67
 
125
-			return self::$instance;
126
-		}
68
+        /**
69
+         * The relative url to the assets.
70
+         *
71
+         * @var string
72
+         */
73
+        public $url = '';
127 74
 
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 ){
75
+        /**
76
+         * Holds the settings values.
77
+         *
78
+         * @var array
79
+         */
80
+        private $settings;
138 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;
139 90
 
140
-			$setting = wp_get_global_settings();
141 91
 
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
-		 * Add admin body class to show when BS5 is active.
271
-		 *
272
-		 * @param $classes
273
-		 *
274
-		 * @return mixed
275
-		 */
276
-		public function add_bs5_admin_body_class( $classes = '' ) {
277
-			$classes .= ' aui_bs5';
278
-
279
-			return $classes;
280
-		}
281
-
282
-		/**
283
-		 * Add a body class to show when BS5 is active.
284
-		 *
285
-		 * @param $classes
286
-		 *
287
-		 * @return mixed
288
-		 */
289
-		public function add_bs5_body_class( $classes ) {
290
-			$classes[] = 'aui_bs5';
291
-
292
-			return $classes;
293
-		}
294
-
295
-		/**
296
-		 * Initiate the settings and add the required action hooks.
297
-		 */
298
-		public function init() {
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
+            }
124
+
125
+            return self::$instance;
126
+        }
127
+
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 ){
138
+
139
+
140
+            $setting = wp_get_global_settings();
141
+
142
+            if(!empty($setting['color']['palette']['custom'])){
143
+                foreach($setting['color']['palette']['custom'] as $color){
144
+                    $theme_colors[$color['slug']] = esc_attr($color['name']);
145
+                }
146
+            }
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
+         * Add admin body class to show when BS5 is active.
271
+         *
272
+         * @param $classes
273
+         *
274
+         * @return mixed
275
+         */
276
+        public function add_bs5_admin_body_class( $classes = '' ) {
277
+            $classes .= ' aui_bs5';
278
+
279
+            return $classes;
280
+        }
281
+
282
+        /**
283
+         * Add a body class to show when BS5 is active.
284
+         *
285
+         * @param $classes
286
+         *
287
+         * @return mixed
288
+         */
289
+        public function add_bs5_body_class( $classes ) {
290
+            $classes[] = 'aui_bs5';
291
+
292
+            return $classes;
293
+        }
294
+
295
+        /**
296
+         * Initiate the settings and add the required action hooks.
297
+         */
298
+        public function init() {
299 299
             global $aui_bs5;
300 300
 
301
-			// Maybe fix settings
302
-			if ( ! empty( $_REQUEST['aui-fix-admin'] ) && !empty($_REQUEST['nonce']) && wp_verify_nonce( $_REQUEST['nonce'], "aui-fix-admin" ) ) {
303
-				$db_settings = get_option( 'ayecode-ui-settings' );
304
-				if ( ! empty( $db_settings ) ) {
305
-					$db_settings['css_backend'] = 'compatibility';
306
-					$db_settings['js_backend'] = 'core-popper';
307
-					update_option( 'ayecode-ui-settings', $db_settings );
308
-					wp_safe_redirect(admin_url("options-general.php?page=ayecode-ui-settings&updated=true"));
309
-				}
310
-			}
301
+            // Maybe fix settings
302
+            if ( ! empty( $_REQUEST['aui-fix-admin'] ) && !empty($_REQUEST['nonce']) && wp_verify_nonce( $_REQUEST['nonce'], "aui-fix-admin" ) ) {
303
+                $db_settings = get_option( 'ayecode-ui-settings' );
304
+                if ( ! empty( $db_settings ) ) {
305
+                    $db_settings['css_backend'] = 'compatibility';
306
+                    $db_settings['js_backend'] = 'core-popper';
307
+                    update_option( 'ayecode-ui-settings', $db_settings );
308
+                    wp_safe_redirect(admin_url("options-general.php?page=ayecode-ui-settings&updated=true"));
309
+                }
310
+            }
311 311
 
312
-			$this->constants();
313
-			$this->settings = $this->get_settings();
314
-			$this->url = $this->get_url();
312
+            $this->constants();
313
+            $this->settings = $this->get_settings();
314
+            $this->url = $this->get_url();
315 315
 
316 316
             // define the version
317
-			$aui_bs5 = $this->settings['bs_ver'] === '5';
318
-
319
-			if ( $aui_bs5 ) {
320
-				include_once( dirname( __FILE__ ) . '/inc/bs-conversion.php' );
321
-				add_filter( 'admin_body_class', array( $this, 'add_bs5_admin_body_class' ), 99, 1 );
322
-				add_filter( 'body_class', array( $this, 'add_bs5_body_class' ) );
323
-			}
324
-
325
-			/**
326
-			 * Maybe load CSS
327
-			 *
328
-			 * We load super early in case there is a theme version that might change the colors
329
-			 */
330
-			if ( $this->settings['css'] ) {
331
-				$priority = $this->is_bs3_compat() ? 100 : 1;
317
+            $aui_bs5 = $this->settings['bs_ver'] === '5';
318
+
319
+            if ( $aui_bs5 ) {
320
+                include_once( dirname( __FILE__ ) . '/inc/bs-conversion.php' );
321
+                add_filter( 'admin_body_class', array( $this, 'add_bs5_admin_body_class' ), 99, 1 );
322
+                add_filter( 'body_class', array( $this, 'add_bs5_body_class' ) );
323
+            }
324
+
325
+            /**
326
+             * Maybe load CSS
327
+             *
328
+             * We load super early in case there is a theme version that might change the colors
329
+             */
330
+            if ( $this->settings['css'] ) {
331
+                $priority = $this->is_bs3_compat() ? 100 : 1;
332 332
                 $priority = $aui_bs5 ? 10 : $priority;
333
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), $priority );
334
-			}
335
-			if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
336
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
337
-			}
338
-
339
-			// maybe load JS
340
-			if ( $this->settings['js'] ) {
341
-				$priority = $this->is_bs3_compat() ? 100 : 1;
342
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority );
343
-			}
344
-			if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
345
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
346
-			}
347
-
348
-			// Maybe set the HTML font size
349
-			if ( $this->settings['html_font_size'] ) {
350
-				add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
351
-			}
352
-
353
-			// Maybe show backend style error
354
-			if( $this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper' ){
355
-				add_action( 'admin_notices', array( $this, 'show_admin_style_notice' ) );
356
-			}
357
-
358
-		}
359
-
360
-		/**
361
-		 * Show admin notice if backend scripts not loaded.
362
-		 */
363
-		public function show_admin_style_notice(){
364
-			$fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=".wp_create_nonce('aui-fix-admin'));
365
-			$button = '<a href="'.esc_url($fix_url).'" class="button-primary">Fix Now</a>';
366
-			$message = __( '<b>Style Issue:</b> AyeCode UI is disable or set wrong.')." " .$button;
367
-			echo '<div class="notice notice-error aui-settings-error-notice"><p>'. wp_kses_post( $message ).'</p></div>';
368
-		}
369
-
370
-		/**
371
-		 * Check if we should load the admin scripts or not.
372
-		 *
373
-		 * @return bool
374
-		 */
375
-		public function load_admin_scripts(){
376
-			$result = true;
377
-
378
-			// check if specifically disabled
379
-			if(!empty($this->settings['disable_admin'])){
380
-				$url_parts = explode("\n",$this->settings['disable_admin']);
381
-				foreach($url_parts as $part){
382
-					if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
383
-						return false; // return early, no point checking further
384
-					}
385
-				}
386
-			}
387
-
388
-			return $result;
389
-		}
390
-
391
-		/**
392
-		 * Add a html font size to the footer.
393
-		 */
394
-		public function html_font_size(){
395
-			$this->settings = $this->get_settings();
396
-			echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
397
-		}
398
-
399
-		/**
400
-		 * Check if the current admin screen should load scripts.
401
-		 *
402
-		 * @return bool
403
-		 */
404
-		public function is_aui_screen(){
333
+                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), $priority );
334
+            }
335
+            if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
336
+                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
337
+            }
338
+
339
+            // maybe load JS
340
+            if ( $this->settings['js'] ) {
341
+                $priority = $this->is_bs3_compat() ? 100 : 1;
342
+                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority );
343
+            }
344
+            if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
345
+                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
346
+            }
347
+
348
+            // Maybe set the HTML font size
349
+            if ( $this->settings['html_font_size'] ) {
350
+                add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
351
+            }
352
+
353
+            // Maybe show backend style error
354
+            if( $this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper' ){
355
+                add_action( 'admin_notices', array( $this, 'show_admin_style_notice' ) );
356
+            }
357
+
358
+        }
359
+
360
+        /**
361
+         * Show admin notice if backend scripts not loaded.
362
+         */
363
+        public function show_admin_style_notice(){
364
+            $fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=".wp_create_nonce('aui-fix-admin'));
365
+            $button = '<a href="'.esc_url($fix_url).'" class="button-primary">Fix Now</a>';
366
+            $message = __( '<b>Style Issue:</b> AyeCode UI is disable or set wrong.')." " .$button;
367
+            echo '<div class="notice notice-error aui-settings-error-notice"><p>'. wp_kses_post( $message ).'</p></div>';
368
+        }
369
+
370
+        /**
371
+         * Check if we should load the admin scripts or not.
372
+         *
373
+         * @return bool
374
+         */
375
+        public function load_admin_scripts(){
376
+            $result = true;
377
+
378
+            // check if specifically disabled
379
+            if(!empty($this->settings['disable_admin'])){
380
+                $url_parts = explode("\n",$this->settings['disable_admin']);
381
+                foreach($url_parts as $part){
382
+                    if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
383
+                        return false; // return early, no point checking further
384
+                    }
385
+                }
386
+            }
387
+
388
+            return $result;
389
+        }
390
+
391
+        /**
392
+         * Add a html font size to the footer.
393
+         */
394
+        public function html_font_size(){
395
+            $this->settings = $this->get_settings();
396
+            echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
397
+        }
398
+
399
+        /**
400
+         * Check if the current admin screen should load scripts.
401
+         *
402
+         * @return bool
403
+         */
404
+        public function is_aui_screen(){
405 405
 //			echo '###';exit;
406
-			$load = false;
407
-			// check if we should load or not
408
-			if ( is_admin() ) {
409
-				// Only enable on set pages
410
-				$aui_screens = array(
411
-					'page',
406
+            $load = false;
407
+            // check if we should load or not
408
+            if ( is_admin() ) {
409
+                // Only enable on set pages
410
+                $aui_screens = array(
411
+                    'page',
412 412
                     //'docs',
413
-					'post',
414
-					'settings_page_ayecode-ui-settings',
415
-					'appearance_page_gutenberg-widgets',
416
-					'widgets',
417
-					'ayecode-ui-settings',
418
-					'site-editor'
419
-				);
420
-				$screen_ids = apply_filters( 'aui_screen_ids', $aui_screens );
413
+                    'post',
414
+                    'settings_page_ayecode-ui-settings',
415
+                    'appearance_page_gutenberg-widgets',
416
+                    'widgets',
417
+                    'ayecode-ui-settings',
418
+                    'site-editor'
419
+                );
420
+                $screen_ids = apply_filters( 'aui_screen_ids', $aui_screens );
421 421
 
422
-				$screen = get_current_screen();
422
+                $screen = get_current_screen();
423 423
 
424 424
 //				echo '###'.$screen->id;
425 425
 
426
-				// check if we are on a AUI screen
427
-				if ( $screen && in_array( $screen->id, $screen_ids ) ) {
428
-					$load = true;
429
-				}
426
+                // check if we are on a AUI screen
427
+                if ( $screen && in_array( $screen->id, $screen_ids ) ) {
428
+                    $load = true;
429
+                }
430 430
 
431
-				//load for widget previews in WP 5.8
432
-				if( !empty($_REQUEST['legacy-widget-preview'])){
433
-					$load = true;
434
-				}
435
-			}
431
+                //load for widget previews in WP 5.8
432
+                if( !empty($_REQUEST['legacy-widget-preview'])){
433
+                    $load = true;
434
+                }
435
+            }
436 436
 
437 437
 
438 438
 
439
-			return apply_filters( 'aui_load_on_admin' , $load );
440
-		}
439
+            return apply_filters( 'aui_load_on_admin' , $load );
440
+        }
441 441
 
442
-		/**
443
-		 * Check if the current theme is a block theme.
444
-		 *
445
-		 * @return bool
446
-		 */
447
-		public static function is_block_theme() {
448
-			if ( function_exists( 'wp_is_block_theme' && wp_is_block_theme() ) ) {
449
-				return true;
450
-			}
442
+        /**
443
+         * Check if the current theme is a block theme.
444
+         *
445
+         * @return bool
446
+         */
447
+        public static function is_block_theme() {
448
+            if ( function_exists( 'wp_is_block_theme' && wp_is_block_theme() ) ) {
449
+                return true;
450
+            }
451 451
 
452
-			return false;
453
-		}
452
+            return false;
453
+        }
454 454
 
455
-		/**
456
-		 * Adds the styles.
457
-		 */
458
-		public function enqueue_style() {
455
+        /**
456
+         * Adds the styles.
457
+         */
458
+        public function enqueue_style() {
459 459
             global $aui_bs5;
460 460
 
461 461
             $load_fse = false;
462 462
 
463
-			if ( is_admin() && ! $this->is_aui_screen() ) {
464
-				// Don't add wp-admin scripts if not requested to.
465
-			} else {
466
-				$css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
467
-				$rtl = is_rtl() && ! $aui_bs5 ? '-rtl' : '';
463
+            if ( is_admin() && ! $this->is_aui_screen() ) {
464
+                // Don't add wp-admin scripts if not requested to.
465
+            } else {
466
+                $css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
467
+                $rtl = is_rtl() && ! $aui_bs5 ? '-rtl' : '';
468 468
                 $bs_ver = $this->settings['bs_ver'] == '5' ? '-v5' : '';
469 469
 
470
-				if ( $this->settings[ $css_setting ] ) {
471
-					$compatibility = $this->settings[$css_setting]=='core' ? false : true;
472
-					$url = $this->settings[$css_setting]=='core' ? $this->url.'assets'.$bs_ver.'/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets'.$bs_ver.'/css/ayecode-ui-compatibility'.$rtl.'.css';
470
+                if ( $this->settings[ $css_setting ] ) {
471
+                    $compatibility = $this->settings[$css_setting]=='core' ? false : true;
472
+                    $url = $this->settings[$css_setting]=='core' ? $this->url.'assets'.$bs_ver.'/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets'.$bs_ver.'/css/ayecode-ui-compatibility'.$rtl.'.css';
473 473
 
474
-					wp_register_style( 'ayecode-ui', $url, array(), $this->version );
475
-					wp_enqueue_style( 'ayecode-ui' );
474
+                    wp_register_style( 'ayecode-ui', $url, array(), $this->version );
475
+                    wp_enqueue_style( 'ayecode-ui' );
476 476
 
477
-					if ( is_admin() && ( !empty($_REQUEST['postType']) || self::is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) )  ) {
478
-						$url = $this->url.'assets'.$bs_ver.'/css/ayecode-ui-fse.css';
479
-						wp_register_style( 'ayecode-ui-fse', $url, array(), $this->version );
480
-						wp_enqueue_style( 'ayecode-ui-fse' );
481
-						$load_fse = true;
482
-					}
477
+                    if ( is_admin() && ( !empty($_REQUEST['postType']) || self::is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) )  ) {
478
+                        $url = $this->url.'assets'.$bs_ver.'/css/ayecode-ui-fse.css';
479
+                        wp_register_style( 'ayecode-ui-fse', $url, array(), $this->version );
480
+                        wp_enqueue_style( 'ayecode-ui-fse' );
481
+                        $load_fse = true;
482
+                    }
483 483
 
484
-					// flatpickr
485
-					wp_register_style( 'flatpickr', $this->url.'assets'.$bs_ver.'/css/flatpickr.min.css', array(), $this->version );
484
+                    // flatpickr
485
+                    wp_register_style( 'flatpickr', $this->url.'assets'.$bs_ver.'/css/flatpickr.min.css', array(), $this->version );
486 486
 
487
-					// fix some wp-admin issues
488
-					if(is_admin()){
489
-						$custom_css = "
487
+                    // fix some wp-admin issues
488
+                    if(is_admin()){
489
+                        $custom_css = "
490 490
                 body{
491 491
                     background-color: #f1f1f1;
492 492
                     font-family: -apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif;
@@ -527,63 +527,63 @@  discard block
 block discarded – undo
527 527
 				}
528 528
                 ";
529 529
 
530
-						// @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
531
-						$custom_css .= "
530
+                        // @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
531
+                        $custom_css .= "
532 532
 						.edit-post-sidebar input[type=color].components-text-control__input{
533 533
 						    padding: 0;
534 534
 						}
535 535
 					";
536
-						wp_add_inline_style( 'ayecode-ui', $custom_css );
537
-					}
538
-
539
-					// custom changes
540
-					if ( $load_fse ) {
541
-						wp_add_inline_style( 'ayecode-ui-fse', self::custom_css($compatibility, true) );
542
-					}else{
543
-						wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
544
-					}
545
-				}
546
-			}
547
-		}
548
-
549
-		/**
550
-		 * Get inline script used if bootstrap enqueued
551
-		 *
552
-		 * If this remains small then its best to use this than to add another JS file.
553
-		 */
554
-		public function inline_script() {
555
-            global $aui_bs5;
556
-			// Flatpickr calendar locale
557
-			$flatpickr_locale = self::flatpickr_locale();
536
+                        wp_add_inline_style( 'ayecode-ui', $custom_css );
537
+                    }
558 538
 
559
-			ob_start();
560
-			if ( $aui_bs5 ) {
561
-				include_once( dirname( __FILE__ ) . '/inc/bs5-js.php' );
562
-			}else{
563
-				include_once( dirname( __FILE__ ) . '/inc/bs4-js.php' );
539
+                    // custom changes
540
+                    if ( $load_fse ) {
541
+                        wp_add_inline_style( 'ayecode-ui-fse', self::custom_css($compatibility, true) );
542
+                    }else{
543
+                        wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
544
+                    }
545
+                }
564 546
             }
547
+        }
565 548
 
566
-			$output = ob_get_clean();
549
+        /**
550
+         * Get inline script used if bootstrap enqueued
551
+         *
552
+         * If this remains small then its best to use this than to add another JS file.
553
+         */
554
+        public function inline_script() {
555
+            global $aui_bs5;
556
+            // Flatpickr calendar locale
557
+            $flatpickr_locale = self::flatpickr_locale();
558
+
559
+            ob_start();
560
+            if ( $aui_bs5 ) {
561
+                include_once( dirname( __FILE__ ) . '/inc/bs5-js.php' );
562
+            }else{
563
+                include_once( dirname( __FILE__ ) . '/inc/bs4-js.php' );
564
+            }
567 565
 
568
-			/*
566
+            $output = ob_get_clean();
567
+
568
+            /*
569 569
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
570 570
 			 */
571
-			return str_replace( array(
572
-				'<script>',
573
-				'</script>'
574
-			), '', self::minify_js($output) );
575
-		}
576
-
577
-
578
-		/**
579
-		 * JS to help with conflict issues with other plugins and themes using bootstrap v3.
580
-		 *
581
-		 * @TODO we may need this when other conflicts arrise.
582
-		 * @return mixed
583
-		 */
584
-		public static function bs3_compat_js() {
585
-			ob_start();
586
-			?>
571
+            return str_replace( array(
572
+                '<script>',
573
+                '</script>'
574
+            ), '', self::minify_js($output) );
575
+        }
576
+
577
+
578
+        /**
579
+         * JS to help with conflict issues with other plugins and themes using bootstrap v3.
580
+         *
581
+         * @TODO we may need this when other conflicts arrise.
582
+         * @return mixed
583
+         */
584
+        public static function bs3_compat_js() {
585
+            ob_start();
586
+            ?>
587 587
             <script>
588 588
 				<?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?>
589 589
                 /* With Avada builder */
@@ -591,20 +591,20 @@  discard block
 block discarded – undo
591 591
 				<?php } ?>
592 592
             </script>
593 593
 			<?php
594
-			return str_replace( array(
595
-				'<script>',
596
-				'</script>'
597
-			), '', ob_get_clean());
598
-		}
599
-
600
-		/**
601
-		 * Get inline script used if bootstrap file browser enqueued.
602
-		 *
603
-		 * If this remains small then its best to use this than to add another JS file.
604
-		 */
605
-		public function inline_script_file_browser(){
606
-			ob_start();
607
-			?>
594
+            return str_replace( array(
595
+                '<script>',
596
+                '</script>'
597
+            ), '', ob_get_clean());
598
+        }
599
+
600
+        /**
601
+         * Get inline script used if bootstrap file browser enqueued.
602
+         *
603
+         * If this remains small then its best to use this than to add another JS file.
604
+         */
605
+        public function inline_script_file_browser(){
606
+            ob_start();
607
+            ?>
608 608
             <script>
609 609
                 // run on doc ready
610 610
                 jQuery(document).ready(function () {
@@ -612,282 +612,282 @@  discard block
 block discarded – undo
612 612
                 });
613 613
             </script>
614 614
 			<?php
615
-			$output = ob_get_clean();
615
+            $output = ob_get_clean();
616 616
 
617
-			/*
617
+            /*
618 618
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
619 619
 			 */
620
-			return str_replace( array(
621
-				'<script>',
622
-				'</script>'
623
-			), '', $output );
624
-		}
620
+            return str_replace( array(
621
+                '<script>',
622
+                '</script>'
623
+            ), '', $output );
624
+        }
625 625
 
626
-		/**
627
-		 * Adds the Font Awesome JS.
628
-		 */
629
-		public function enqueue_scripts() {
626
+        /**
627
+         * Adds the Font Awesome JS.
628
+         */
629
+        public function enqueue_scripts() {
630 630
 
631
-			if( is_admin() && !$this->is_aui_screen()){
632
-				// don't add wp-admin scripts if not requested to
633
-			}else {
631
+            if( is_admin() && !$this->is_aui_screen()){
632
+                // don't add wp-admin scripts if not requested to
633
+            }else {
634 634
 
635
-				$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
635
+                $js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
636 636
 
637
-				$bs_ver = $this->settings['bs_ver'] == '5' ? '-v5' : '';
637
+                $bs_ver = $this->settings['bs_ver'] == '5' ? '-v5' : '';
638 638
 
639
-				// select2
640
-				wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
639
+                // select2
640
+                wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
641 641
 
642
-				// flatpickr
643
-				wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version );
642
+                // flatpickr
643
+                wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version );
644 644
 
645
-				// iconpicker
646
-				if ( defined( 'FAS_ICONPICKER_JS_URL' ) ) {
647
-					wp_register_script( 'iconpicker', FAS_ICONPICKER_JS_URL, array(), $this->version );
648
-				}else{
649
-					wp_register_script( 'iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version );
650
-				}
645
+                // iconpicker
646
+                if ( defined( 'FAS_ICONPICKER_JS_URL' ) ) {
647
+                    wp_register_script( 'iconpicker', FAS_ICONPICKER_JS_URL, array(), $this->version );
648
+                }else{
649
+                    wp_register_script( 'iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version );
650
+                }
651 651
 
652
-				// Bootstrap file browser
653
-				wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
654
-				wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
655
-
656
-				$load_inline = false;
657
-
658
-				if ( $this->settings[ $js_setting ] == 'core-popper' ) {
659
-					// Bootstrap bundle
660
-					$url = $this->url . 'assets' . $bs_ver . '/js/bootstrap.bundle.min.js';
661
-					wp_register_script( 'bootstrap-js-bundle', $url, array(
662
-						'select2',
663
-						'jquery'
664
-					), $this->version, $this->is_bs3_compat() );
665
-					// if in admin then add to footer for compatibility.
666
-					is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
667
-					$script = $this->inline_script();
668
-					wp_add_inline_script( 'bootstrap-js-bundle', $script );
669
-				} elseif ( $this->settings[ $js_setting ] == 'popper' ) {
670
-					$url = $this->url . 'assets/js/popper.min.js'; //@todo we need to update this to bs5
671
-					wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->version );
672
-					wp_enqueue_script( 'bootstrap-js-popper' );
673
-					$load_inline = true;
674
-				} else {
675
-					$load_inline = true;
676
-				}
652
+                // Bootstrap file browser
653
+                wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
654
+                wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
655
+
656
+                $load_inline = false;
657
+
658
+                if ( $this->settings[ $js_setting ] == 'core-popper' ) {
659
+                    // Bootstrap bundle
660
+                    $url = $this->url . 'assets' . $bs_ver . '/js/bootstrap.bundle.min.js';
661
+                    wp_register_script( 'bootstrap-js-bundle', $url, array(
662
+                        'select2',
663
+                        'jquery'
664
+                    ), $this->version, $this->is_bs3_compat() );
665
+                    // if in admin then add to footer for compatibility.
666
+                    is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
667
+                    $script = $this->inline_script();
668
+                    wp_add_inline_script( 'bootstrap-js-bundle', $script );
669
+                } elseif ( $this->settings[ $js_setting ] == 'popper' ) {
670
+                    $url = $this->url . 'assets/js/popper.min.js'; //@todo we need to update this to bs5
671
+                    wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->version );
672
+                    wp_enqueue_script( 'bootstrap-js-popper' );
673
+                    $load_inline = true;
674
+                } else {
675
+                    $load_inline = true;
676
+                }
677 677
 
678
-				// Load needed inline scripts by faking the loading of a script if the main script is not being loaded
679
-				if ( $load_inline ) {
680
-					wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) );
681
-					wp_enqueue_script( 'bootstrap-dummy' );
682
-					$script = $this->inline_script();
683
-					wp_add_inline_script( 'bootstrap-dummy', $script );
684
-				}
685
-			}
686
-
687
-		}
688
-
689
-		/**
690
-		 * Enqueue flatpickr if called.
691
-		 */
692
-		public function enqueue_flatpickr(){
693
-			wp_enqueue_style( 'flatpickr' );
694
-			wp_enqueue_script( 'flatpickr' );
695
-		}
696
-
697
-		/**
698
-		 * Enqueue iconpicker if called.
699
-		 */
700
-		public function enqueue_iconpicker(){
701
-			wp_enqueue_style( 'iconpicker' );
702
-			wp_enqueue_script( 'iconpicker' );
703
-		}
704
-
705
-		/**
706
-		 * Get the url path to the current folder.
707
-		 *
708
-		 * @return string
709
-		 */
710
-		public function get_url() {
711
-			$content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
712
-			$content_url = untrailingslashit( WP_CONTENT_URL );
713
-
714
-			// Replace http:// to https://.
715
-			if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
716
-				$content_url = str_replace( 'http://', 'https://', $content_url );
717
-			}
718
-
719
-			// Check if we are inside a plugin
720
-			$file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
721
-			$url = str_replace( $content_dir, $content_url, $file_dir );
722
-
723
-			return trailingslashit( $url );
724
-		}
725
-
726
-		/**
727
-		 * Get the url path to the current folder.
728
-		 *
729
-		 * @return string
730
-		 */
731
-		public function get_url_old() {
732
-
733
-			$url = '';
734
-			// check if we are inside a plugin
735
-			$file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
736
-
737
-			// add check in-case user has changed wp-content dir name.
738
-			$wp_content_folder_name = basename(WP_CONTENT_DIR);
739
-			$dir_parts = explode("/$wp_content_folder_name/",$file_dir);
740
-			$url_parts = explode("/$wp_content_folder_name/",plugins_url());
741
-
742
-			if(!empty($url_parts[0]) && !empty($dir_parts[1])){
743
-				$url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
744
-			}
745
-
746
-			return $url;
747
-		}
748
-
749
-		/**
750
-		 * Register the database settings with WordPress.
751
-		 */
752
-		public function register_settings() {
753
-			register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
754
-		}
755
-
756
-		/**
757
-		 * Add the WordPress settings menu item.
758
-		 * @since 1.0.10 Calling function name direct will fail theme check so we don't.
759
-		 */
760
-		public function menu_item() {
761
-			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
762
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
763
-				$this,
764
-				'settings_page'
765
-			) );
766
-		}
767
-
768
-		/**
769
-		 * Get a list of themes and their default JS settings.
770
-		 *
771
-		 * @return array
772
-		 */
773
-		public function theme_js_settings(){
774
-			return array(
775
-				'ayetheme' => 'popper',
776
-				'listimia' => 'required',
777
-				'listimia_backend' => 'core-popper',
778
-				//'avada'    => 'required', // removed as we now add compatibility
779
-			);
780
-		}
781
-
782
-		/**
678
+                // Load needed inline scripts by faking the loading of a script if the main script is not being loaded
679
+                if ( $load_inline ) {
680
+                    wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) );
681
+                    wp_enqueue_script( 'bootstrap-dummy' );
682
+                    $script = $this->inline_script();
683
+                    wp_add_inline_script( 'bootstrap-dummy', $script );
684
+                }
685
+            }
686
+
687
+        }
688
+
689
+        /**
690
+         * Enqueue flatpickr if called.
691
+         */
692
+        public function enqueue_flatpickr(){
693
+            wp_enqueue_style( 'flatpickr' );
694
+            wp_enqueue_script( 'flatpickr' );
695
+        }
696
+
697
+        /**
698
+         * Enqueue iconpicker if called.
699
+         */
700
+        public function enqueue_iconpicker(){
701
+            wp_enqueue_style( 'iconpicker' );
702
+            wp_enqueue_script( 'iconpicker' );
703
+        }
704
+
705
+        /**
706
+         * Get the url path to the current folder.
707
+         *
708
+         * @return string
709
+         */
710
+        public function get_url() {
711
+            $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
712
+            $content_url = untrailingslashit( WP_CONTENT_URL );
713
+
714
+            // Replace http:// to https://.
715
+            if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
716
+                $content_url = str_replace( 'http://', 'https://', $content_url );
717
+            }
718
+
719
+            // Check if we are inside a plugin
720
+            $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
721
+            $url = str_replace( $content_dir, $content_url, $file_dir );
722
+
723
+            return trailingslashit( $url );
724
+        }
725
+
726
+        /**
727
+         * Get the url path to the current folder.
728
+         *
729
+         * @return string
730
+         */
731
+        public function get_url_old() {
732
+
733
+            $url = '';
734
+            // check if we are inside a plugin
735
+            $file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
736
+
737
+            // add check in-case user has changed wp-content dir name.
738
+            $wp_content_folder_name = basename(WP_CONTENT_DIR);
739
+            $dir_parts = explode("/$wp_content_folder_name/",$file_dir);
740
+            $url_parts = explode("/$wp_content_folder_name/",plugins_url());
741
+
742
+            if(!empty($url_parts[0]) && !empty($dir_parts[1])){
743
+                $url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
744
+            }
745
+
746
+            return $url;
747
+        }
748
+
749
+        /**
750
+         * Register the database settings with WordPress.
751
+         */
752
+        public function register_settings() {
753
+            register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
754
+        }
755
+
756
+        /**
757
+         * Add the WordPress settings menu item.
758
+         * @since 1.0.10 Calling function name direct will fail theme check so we don't.
759
+         */
760
+        public function menu_item() {
761
+            $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
762
+            call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
763
+                $this,
764
+                'settings_page'
765
+            ) );
766
+        }
767
+
768
+        /**
769
+         * Get a list of themes and their default JS settings.
770
+         *
771
+         * @return array
772
+         */
773
+        public function theme_js_settings(){
774
+            return array(
775
+                'ayetheme' => 'popper',
776
+                'listimia' => 'required',
777
+                'listimia_backend' => 'core-popper',
778
+                //'avada'    => 'required', // removed as we now add compatibility
779
+            );
780
+        }
781
+
782
+        /**
783 783
          * Get the date the site was installed.
784 784
          *
785
-		 * @return false|string
786
-		 */
785
+         * @return false|string
786
+         */
787 787
         public function get_site_install_date() {
788
-	        global $wpdb; // This gives you access to the WordPress database object
788
+            global $wpdb; // This gives you access to the WordPress database object
789
+
790
+            // Prepare the SQL query to get the oldest registration date
791
+            $query = "SELECT MIN(user_registered) AS oldest_registration_date FROM {$wpdb->users}";
789 792
 
790
-	        // Prepare the SQL query to get the oldest registration date
791
-	        $query = "SELECT MIN(user_registered) AS oldest_registration_date FROM {$wpdb->users}";
793
+            // Execute the query
794
+            $date = $wpdb->get_var( $query ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
792 795
 
793
-	        // Execute the query
794
-	        $date = $wpdb->get_var( $query ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
796
+            return $date ? $date : false;
797
+        }
795 798
 
796
-	        return $date ? $date : false;
799
+        /**
800
+         * Show admin notice if backend scripts not loaded.
801
+         */
802
+        public function show_admin_version_notice(){
803
+            $fix_url = admin_url("options-general.php?page=ayecode-ui-settings" );
804
+            $button = '<a href="'.esc_url($fix_url).'" class="button-primary">View Settings</a>';
805
+            $message = __( '<b>Style Issue:</b> AyeCode UI has changed its default version from v4 to v5, if you notice unwanted style changes, please revert to v4 (saving the settings page will remove this notice)')." " .$button;
806
+            echo '<div class="notice notice-error aui-settings-error-notice"><p>'. wp_kses_post( $message ).'</p></div>';
797 807
         }
798 808
 
799
-		/**
800
-		 * Show admin notice if backend scripts not loaded.
801
-		 */
802
-		public function show_admin_version_notice(){
803
-			$fix_url = admin_url("options-general.php?page=ayecode-ui-settings" );
804
-			$button = '<a href="'.esc_url($fix_url).'" class="button-primary">View Settings</a>';
805
-			$message = __( '<b>Style Issue:</b> AyeCode UI has changed its default version from v4 to v5, if you notice unwanted style changes, please revert to v4 (saving the settings page will remove this notice)')." " .$button;
806
-			echo '<div class="notice notice-error aui-settings-error-notice"><p>'. wp_kses_post( $message ).'</p></div>';
807
-		}
808
-
809
-		/**
810
-		 * Get the current Font Awesome output settings.
811
-		 *
812
-		 * @return array The array of settings.
813
-		 */
814
-		public function get_settings() {
815
-
816
-			$db_settings = get_option( 'ayecode-ui-settings' );
809
+        /**
810
+         * Get the current Font Awesome output settings.
811
+         *
812
+         * @return array The array of settings.
813
+         */
814
+        public function get_settings() {
815
+
816
+            $db_settings = get_option( 'ayecode-ui-settings' );
817 817
 
818 818
             // Maybe show default version notice
819
-			$site_install_date = new DateTime( self::get_site_install_date() );
820
-			$switch_over_date = new DateTime("2024-02-01");
821
-			if ( empty( $db_settings ) && $site_install_date < $switch_over_date ) {
822
-				add_action( 'admin_notices', array( $this, 'show_admin_version_notice' ) );
823
-			}
824
-
825
-			$js_default = 'core-popper';
826
-			$js_default_backend = $js_default;
827
-
828
-			// maybe set defaults (if no settings set)
829
-			if(empty($db_settings)){
830
-				$active_theme = strtolower( get_template() ); // active parent theme.
831
-				$theme_js_settings = self::theme_js_settings();
832
-				if(isset($theme_js_settings[$active_theme])){
833
-					$js_default = $theme_js_settings[$active_theme];
834
-					$js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
835
-				}
836
-			}
819
+            $site_install_date = new DateTime( self::get_site_install_date() );
820
+            $switch_over_date = new DateTime("2024-02-01");
821
+            if ( empty( $db_settings ) && $site_install_date < $switch_over_date ) {
822
+                add_action( 'admin_notices', array( $this, 'show_admin_version_notice' ) );
823
+            }
837 824
 
838
-			/**
839
-			 * Filter the default settings.
840
-			 */
841
-			$defaults = apply_filters( 'ayecode-ui-default-settings', array(
842
-				'css'            => 'compatibility', // core, compatibility
843
-				'js'             => $js_default, // js to load, core-popper, popper
844
-				'html_font_size' => '16', // js to load, core-popper, popper
845
-				'css_backend'    => 'compatibility', // core, compatibility
846
-				'js_backend'     => $js_default_backend, // js to load, core-popper, popper
847
-				'disable_admin'  => '', // URL snippets to disable loading on admin
825
+            $js_default = 'core-popper';
826
+            $js_default_backend = $js_default;
827
+
828
+            // maybe set defaults (if no settings set)
829
+            if(empty($db_settings)){
830
+                $active_theme = strtolower( get_template() ); // active parent theme.
831
+                $theme_js_settings = self::theme_js_settings();
832
+                if(isset($theme_js_settings[$active_theme])){
833
+                    $js_default = $theme_js_settings[$active_theme];
834
+                    $js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
835
+                }
836
+            }
837
+
838
+            /**
839
+             * Filter the default settings.
840
+             */
841
+            $defaults = apply_filters( 'ayecode-ui-default-settings', array(
842
+                'css'            => 'compatibility', // core, compatibility
843
+                'js'             => $js_default, // js to load, core-popper, popper
844
+                'html_font_size' => '16', // js to load, core-popper, popper
845
+                'css_backend'    => 'compatibility', // core, compatibility
846
+                'js_backend'     => $js_default_backend, // js to load, core-popper, popper
847
+                'disable_admin'  => '', // URL snippets to disable loading on admin
848 848
                 'bs_ver'         => '5', // The default bootstrap version to sue by default
849
-			), $db_settings );
849
+            ), $db_settings );
850 850
 
851
-			$settings = wp_parse_args( $db_settings, $defaults );
851
+            $settings = wp_parse_args( $db_settings, $defaults );
852 852
 
853
-			/**
854
-			 * Filter the Bootstrap settings.
855
-			 *
856
-			 * @todo if we add this filer people might use it and then it defeats the purpose of this class :/
857
-			 */
858
-			return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
859
-		}
853
+            /**
854
+             * Filter the Bootstrap settings.
855
+             *
856
+             * @todo if we add this filer people might use it and then it defeats the purpose of this class :/
857
+             */
858
+            return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
859
+        }
860 860
 
861 861
 
862
-		/**
863
-		 * The settings page html output.
864
-		 */
865
-		public function settings_page() {
866
-			if ( ! current_user_can( 'manage_options' ) ) {
867
-				wp_die( esc_attr__( 'You do not have sufficient permissions to access this page.', 'ayecode-connect' ) );
868
-			}
862
+        /**
863
+         * The settings page html output.
864
+         */
865
+        public function settings_page() {
866
+            if ( ! current_user_can( 'manage_options' ) ) {
867
+                wp_die( esc_attr__( 'You do not have sufficient permissions to access this page.', 'ayecode-connect' ) );
868
+            }
869 869
             $overrides = apply_filters( 'ayecode-ui-settings', array(), array(), array() );
870 870
 
871
-			?>
871
+            ?>
872 872
             <div class="wrap">
873 873
                 <h1><?php echo esc_attr( $this->name ); ?></h1>
874 874
                 <p><?php echo esc_html( apply_filters( 'ayecode-ui-settings-message', __("Here you can adjust settings if you are having compatibility issues.", 'ayecode-connect' ) ) );?></p>
875 875
                 <form method="post" action="options.php">
876 876
 					<?php
877
-					settings_fields( 'ayecode-ui-settings' );
878
-					do_settings_sections( 'ayecode-ui-settings' );
879
-					?>
877
+                    settings_fields( 'ayecode-ui-settings' );
878
+                    do_settings_sections( 'ayecode-ui-settings' );
879
+                    ?>
880 880
 
881 881
                     <h2><?php esc_html_e( 'BootStrap Version', 'ayecode-connect' ); ?></h2>
882 882
                     <p><?php echo esc_html( apply_filters( 'ayecode-ui-version-settings-message', __("V5 is recommended, however if you have another plugin installed using v4, you may need to use v4 also.", 'ayecode-connect' ) ) );?></p>
883 883
 	                <div class="bsui"><?php
884
-	                if ( ! empty( $overrides ) ) {
885
-		                echo aui()->alert(array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
886
-			                'type'=> 'info',
887
-			                'content'=> esc_attr__("Some options are disabled as your current theme is overriding them.", 'ayecode-connect' )
888
-		                ));
889
-	                }
890
-	                ?>
884
+                    if ( ! empty( $overrides ) ) {
885
+                        echo aui()->alert(array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
886
+                            'type'=> 'info',
887
+                            'content'=> esc_attr__("Some options are disabled as your current theme is overriding them.", 'ayecode-connect' )
888
+                        ));
889
+                    }
890
+                    ?>
891 891
                     </div>
892 892
                     <table class="form-table wpbs-table-version-settings">
893 893
                         <tr valign="top">
@@ -971,77 +971,77 @@  discard block
 block discarded – undo
971 971
                     </table>
972 972
 
973 973
 					<?php
974
-					submit_button();
975
-					?>
974
+                    submit_button();
975
+                    ?>
976 976
                 </form>
977 977
                 <div id="wpbs-version" data-aui-source="<?php echo esc_attr( $this->get_load_source() ); ?>"><?php echo esc_html( $this->version ); ?></div>
978 978
             </div>
979 979
 			<?php
980
-		}
980
+        }
981 981
 
982 982
         public function get_load_source(){
983
-	        $file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) );
984
-	        $plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) );
985
-
986
-	        // Find source plugin/theme of SD
987
-	        $source = array();
988
-	        if ( strpos( $file, $plugins_dir ) !== false ) {
989
-		        $source = explode( "/", plugin_basename( $file ) );
990
-	        } else if ( function_exists( 'get_theme_root' ) ) {
991
-		        $themes_dir = str_replace( array( "/", "\\" ), "/", realpath( get_theme_root() ) );
992
-
993
-		        if ( strpos( $file, $themes_dir ) !== false ) {
994
-			        $source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) );
995
-		        }
996
-	        }
983
+            $file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) );
984
+            $plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) );
985
+
986
+            // Find source plugin/theme of SD
987
+            $source = array();
988
+            if ( strpos( $file, $plugins_dir ) !== false ) {
989
+                $source = explode( "/", plugin_basename( $file ) );
990
+            } else if ( function_exists( 'get_theme_root' ) ) {
991
+                $themes_dir = str_replace( array( "/", "\\" ), "/", realpath( get_theme_root() ) );
992
+
993
+                if ( strpos( $file, $themes_dir ) !== false ) {
994
+                    $source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) );
995
+                }
996
+            }
997 997
 
998 998
             return isset($source[0]) ? esc_attr($source[0]) : '';
999 999
         }
1000 1000
 
1001
-		public function customizer_settings($wp_customize){
1002
-			$wp_customize->add_section('aui_settings', array(
1003
-				'title'    => __('AyeCode UI', 'ayecode-connect' ),
1004
-				'priority' => 120,
1005
-			));
1006
-
1007
-			//  =============================
1008
-			//  = Color Picker              =
1009
-			//  =============================
1010
-			$wp_customize->add_setting('aui_options[color_primary]', array(
1011
-				'default'           => AUI_PRIMARY_COLOR,
1012
-				'sanitize_callback' => 'sanitize_hex_color',
1013
-				'capability'        => 'edit_theme_options',
1014
-				'type'              => 'option',
1015
-				'transport'         => 'refresh',
1016
-			));
1017
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1018
-				'label'    => __('Primary Color', 'ayecode-connect' ),
1019
-				'section'  => 'aui_settings',
1020
-				'settings' => 'aui_options[color_primary]',
1021
-			)));
1022
-
1023
-			$wp_customize->add_setting('aui_options[color_secondary]', array(
1024
-				'default'           => '#6c757d',
1025
-				'sanitize_callback' => 'sanitize_hex_color',
1026
-				'capability'        => 'edit_theme_options',
1027
-				'type'              => 'option',
1028
-				'transport'         => 'refresh',
1029
-			));
1030
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1031
-				'label'    => __('Secondary Color', 'ayecode-connect' ),
1032
-				'section'  => 'aui_settings',
1033
-				'settings' => 'aui_options[color_secondary]',
1034
-			)));
1035
-		}
1036
-
1037
-		/**
1038
-		 * CSS to help with conflict issues with other plugins and themes using bootstrap v3.
1039
-		 *
1040
-		 * @return mixed
1041
-		 */
1042
-		public static function bs3_compat_css() {
1043
-			ob_start();
1044
-			?>
1001
+        public function customizer_settings($wp_customize){
1002
+            $wp_customize->add_section('aui_settings', array(
1003
+                'title'    => __('AyeCode UI', 'ayecode-connect' ),
1004
+                'priority' => 120,
1005
+            ));
1006
+
1007
+            //  =============================
1008
+            //  = Color Picker              =
1009
+            //  =============================
1010
+            $wp_customize->add_setting('aui_options[color_primary]', array(
1011
+                'default'           => AUI_PRIMARY_COLOR,
1012
+                'sanitize_callback' => 'sanitize_hex_color',
1013
+                'capability'        => 'edit_theme_options',
1014
+                'type'              => 'option',
1015
+                'transport'         => 'refresh',
1016
+            ));
1017
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1018
+                'label'    => __('Primary Color', 'ayecode-connect' ),
1019
+                'section'  => 'aui_settings',
1020
+                'settings' => 'aui_options[color_primary]',
1021
+            )));
1022
+
1023
+            $wp_customize->add_setting('aui_options[color_secondary]', array(
1024
+                'default'           => '#6c757d',
1025
+                'sanitize_callback' => 'sanitize_hex_color',
1026
+                'capability'        => 'edit_theme_options',
1027
+                'type'              => 'option',
1028
+                'transport'         => 'refresh',
1029
+            ));
1030
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1031
+                'label'    => __('Secondary Color', 'ayecode-connect' ),
1032
+                'section'  => 'aui_settings',
1033
+                'settings' => 'aui_options[color_secondary]',
1034
+            )));
1035
+        }
1036
+
1037
+        /**
1038
+         * CSS to help with conflict issues with other plugins and themes using bootstrap v3.
1039
+         *
1040
+         * @return mixed
1041
+         */
1042
+        public static function bs3_compat_css() {
1043
+            ob_start();
1044
+            ?>
1045 1045
             <style>
1046 1046
                 /* Bootstrap 3 compatibility */
1047 1047
                 body.modal-open .modal-backdrop.show:not(.in) {opacity:0.5;}
@@ -1070,368 +1070,368 @@  discard block
 block discarded – undo
1070 1070
                 <?php } ?>
1071 1071
             </style>
1072 1072
 			<?php
1073
-			return str_replace( array(
1074
-				'<style>',
1075
-				'</style>'
1076
-			), '', self::minify_css( ob_get_clean() ) );
1077
-		}
1073
+            return str_replace( array(
1074
+                '<style>',
1075
+                '</style>'
1076
+            ), '', self::minify_css( ob_get_clean() ) );
1077
+        }
1078 1078
 
1079
-		public static function custom_css( $compatibility = true, $is_fse = false ) {
1080
-			global $aui_bs5;
1079
+        public static function custom_css( $compatibility = true, $is_fse = false ) {
1080
+            global $aui_bs5;
1081 1081
 
1082
-			$colors = array();
1082
+            $colors = array();
1083 1083
 
1084
-			if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
1085
-				$setting = wp_get_global_settings();
1084
+            if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
1085
+                $setting = wp_get_global_settings();
1086 1086
 
1087
-				if ( ! empty( $setting['color']['palette']['theme'] ) ) {
1088
-					foreach ( $setting['color']['palette']['theme'] as $color ) {
1089
-						$colors[$color['slug']] = esc_attr( $color['color'] );
1090
-					}
1091
-				}
1087
+                if ( ! empty( $setting['color']['palette']['theme'] ) ) {
1088
+                    foreach ( $setting['color']['palette']['theme'] as $color ) {
1089
+                        $colors[$color['slug']] = esc_attr( $color['color'] );
1090
+                    }
1091
+                }
1092 1092
 
1093
-				if ( ! empty( $setting['color']['palette']['custom'] ) ) {
1094
-					foreach ( $setting['color']['palette']['custom'] as $color ) {
1095
-						$colors[$color['slug']] = esc_attr( $color['color'] );
1096
-					}
1097
-				}
1098
-			} else {
1099
-				$settings = get_option( 'aui_options' );
1100
-
1101
-				$colors = array(
1102
-					'primary'   => ! empty( $settings['color_primary'] ) ? $settings['color_primary'] : AUI_PRIMARY_COLOR,
1103
-					'secondary' => ! empty( $settings['color_secondary'] ) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR
1104
-				);
1105
-			}
1106
-
1107
-			ob_start();
1108
-			?><style><?php
1109
-			// BS v3 compat
1110
-			if( self::is_bs3_compat() ){
1111
-				echo self::bs3_compat_css(); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1112
-			}
1113
-
1114
-			//$is_fse = false;
1115
-			//if ( is_admin() && ( !empty($_REQUEST['postType']) || self::is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) )  ) {
1116
-				//$is_fse = true;
1117
-			//}
1118
-
1119
-			$custom_front = ! is_admin() ? true : apply_filters('ayecode_ui_custom_front', false );
1120
-			$custom_admin = $is_fse || self::is_preview() ? true : apply_filters('ayecode_ui_custom_admin', false );
1093
+                if ( ! empty( $setting['color']['palette']['custom'] ) ) {
1094
+                    foreach ( $setting['color']['palette']['custom'] as $color ) {
1095
+                        $colors[$color['slug']] = esc_attr( $color['color'] );
1096
+                    }
1097
+                }
1098
+            } else {
1099
+                $settings = get_option( 'aui_options' );
1100
+
1101
+                $colors = array(
1102
+                    'primary'   => ! empty( $settings['color_primary'] ) ? $settings['color_primary'] : AUI_PRIMARY_COLOR,
1103
+                    'secondary' => ! empty( $settings['color_secondary'] ) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR
1104
+                );
1105
+            }
1106
+
1107
+            ob_start();
1108
+            ?><style><?php
1109
+            // BS v3 compat
1110
+            if( self::is_bs3_compat() ){
1111
+                echo self::bs3_compat_css(); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1112
+            }
1113
+
1114
+            //$is_fse = false;
1115
+            //if ( is_admin() && ( !empty($_REQUEST['postType']) || self::is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) )  ) {
1116
+                //$is_fse = true;
1117
+            //}
1118
+
1119
+            $custom_front = ! is_admin() ? true : apply_filters('ayecode_ui_custom_front', false );
1120
+            $custom_admin = $is_fse || self::is_preview() ? true : apply_filters('ayecode_ui_custom_admin', false );
1121 1121
             $bs_custom_css = apply_filters( 'ayecode_ui_bs_custom_css', $custom_admin || $custom_front );
1122
-			//$bs_custom_css = true; // Force true to fix any color issue.
1122
+            //$bs_custom_css = true; // Force true to fix any color issue.
1123 1123
 
1124
-			$colors_css = '';
1125
-			if ( ! empty( $colors ) && $bs_custom_css ) {
1126
-				$d_colors = self::get_colors(true);
1124
+            $colors_css = '';
1125
+            if ( ! empty( $colors ) && $bs_custom_css ) {
1126
+                $d_colors = self::get_colors(true);
1127 1127
 
1128
-				foreach ( $colors as $key => $color ) {
1129
-					if ( ( empty( $d_colors[$key]) || $d_colors[$key] != $color) || $is_fse ) {
1130
-						$var = $is_fse ? "var(--wp--preset--color--$key)" : $color;
1131
-						$compat = $is_fse ? '.editor-styles-wrapper' : $compatibility;
1128
+                foreach ( $colors as $key => $color ) {
1129
+                    if ( ( empty( $d_colors[$key]) || $d_colors[$key] != $color) || $is_fse ) {
1130
+                        $var = $is_fse ? "var(--wp--preset--color--$key)" : $color;
1131
+                        $compat = $is_fse ? '.editor-styles-wrapper' : $compatibility;
1132 1132
 
1133
-						$colors_css .= $aui_bs5 ? self::css_overwrite_bs5( $key,$var, $compat, $color ) : self::css_overwrite( $key, $var, $compat, $color );
1134
-					}
1135
-				}
1136
-			}
1133
+                        $colors_css .= $aui_bs5 ? self::css_overwrite_bs5( $key,$var, $compat, $color ) : self::css_overwrite( $key, $var, $compat, $color );
1134
+                    }
1135
+                }
1136
+            }
1137 1137
 
1138
-			if ( $colors_css ) {
1139
-				echo $colors_css; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1140
-			}
1138
+            if ( $colors_css ) {
1139
+                echo $colors_css; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1140
+            }
1141 1141
 
1142
-			// Set admin bar z-index lower when modal is open.
1143
-			echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}';
1142
+            // Set admin bar z-index lower when modal is open.
1143
+            echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}';
1144 1144
 
1145
-			if ( is_admin() ) {
1146
-				echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}';
1147
-			}
1145
+            if ( is_admin() ) {
1146
+                echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}';
1147
+            }
1148 1148
 
1149
-			$custom_css = '';
1149
+            $custom_css = '';
1150 1150
 
1151
-			if ( $aui_bs5 && defined( 'BLOCKSTRAP_VERSION' ) && $bs_custom_css ) {
1152
-				$css = '';
1153
-				$theme_settings = wp_get_global_styles();
1151
+            if ( $aui_bs5 && defined( 'BLOCKSTRAP_VERSION' ) && $bs_custom_css ) {
1152
+                $css = '';
1153
+                $theme_settings = wp_get_global_styles();
1154 1154
 
1155
-				// Font face
1156
-				if( !empty( $theme_settings['typography']['fontFamily'] ) ){
1157
-					$t_fontface = str_replace( array('var:preset|','font-family|'), array('--wp--preset--','font-family--'), $theme_settings['typography']['fontFamily']  ); //var(--wp--preset--font-family--poppins)
1158
-					$css .= '--bs-body-font-family: ' . esc_attr($t_fontface) . ';';
1159
-				}
1155
+                // Font face
1156
+                if( !empty( $theme_settings['typography']['fontFamily'] ) ){
1157
+                    $t_fontface = str_replace( array('var:preset|','font-family|'), array('--wp--preset--','font-family--'), $theme_settings['typography']['fontFamily']  ); //var(--wp--preset--font-family--poppins)
1158
+                    $css .= '--bs-body-font-family: ' . esc_attr($t_fontface) . ';';
1159
+                }
1160 1160
 
1161
-				// font size
1162
-				if( !empty( $theme_settings['typography']['fontSize'] ) ){
1163
-					$css .= '--bs-body-font-size: ' . esc_attr( $theme_settings['typography']['fontSize'] ) . ' ;';
1164
-				}
1161
+                // font size
1162
+                if( !empty( $theme_settings['typography']['fontSize'] ) ){
1163
+                    $css .= '--bs-body-font-size: ' . esc_attr( $theme_settings['typography']['fontSize'] ) . ' ;';
1164
+                }
1165 1165
 
1166
-				// line height
1167
-				 if( !empty( $theme_settings['typography']['lineHeight'] ) ){
1168
-					$css .= '--bs-body-line-height: ' . esc_attr( $theme_settings['typography']['lineHeight'] ) . ';';
1169
-				}
1166
+                // line height
1167
+                    if( !empty( $theme_settings['typography']['lineHeight'] ) ){
1168
+                    $css .= '--bs-body-line-height: ' . esc_attr( $theme_settings['typography']['lineHeight'] ) . ';';
1169
+                }
1170 1170
 
1171 1171
 
1172
-				   // font weight
1173
-				 if( !empty( $theme_settings['typography']['fontWeight'] ) ){
1174
-					$css .= '--bs-body-font-weight: ' . esc_attr( $theme_settings['typography']['fontWeight'] ) . ';';
1175
-				}
1172
+                    // font weight
1173
+                    if( !empty( $theme_settings['typography']['fontWeight'] ) ){
1174
+                    $css .= '--bs-body-font-weight: ' . esc_attr( $theme_settings['typography']['fontWeight'] ) . ';';
1175
+                }
1176 1176
 
1177
-				// Background
1178
-				 if( !empty( $theme_settings['color']['background'] ) ){
1179
-					$css .= '--bs-body-bg: ' . esc_attr( $theme_settings['color']['background'] ) . ';';
1180
-				}
1177
+                // Background
1178
+                    if( !empty( $theme_settings['color']['background'] ) ){
1179
+                    $css .= '--bs-body-bg: ' . esc_attr( $theme_settings['color']['background'] ) . ';';
1180
+                }
1181 1181
 
1182
-				 // Background Gradient
1183
-				 if( !empty( $theme_settings['color']['gradient'] ) ){
1184
-					$css .= 'background: ' . esc_attr( $theme_settings['color']['gradient'] ) . ';';
1185
-				}
1182
+                    // Background Gradient
1183
+                    if( !empty( $theme_settings['color']['gradient'] ) ){
1184
+                    $css .= 'background: ' . esc_attr( $theme_settings['color']['gradient'] ) . ';';
1185
+                }
1186 1186
 
1187
-				   // Background Gradient
1188
-				 if( !empty( $theme_settings['color']['gradient'] ) ){
1189
-					$css .= 'background: ' . esc_attr( $theme_settings['color']['gradient'] ) . ';';
1190
-				}
1187
+                    // Background Gradient
1188
+                    if( !empty( $theme_settings['color']['gradient'] ) ){
1189
+                    $css .= 'background: ' . esc_attr( $theme_settings['color']['gradient'] ) . ';';
1190
+                }
1191 1191
 
1192
-				// text color
1193
-				if( !empty( $theme_settings['color']['text'] ) ){
1194
-					$css .= '--bs-body-color: ' . esc_attr( $theme_settings['color']['text'] ) . ';';
1195
-				}
1192
+                // text color
1193
+                if( !empty( $theme_settings['color']['text'] ) ){
1194
+                    $css .= '--bs-body-color: ' . esc_attr( $theme_settings['color']['text'] ) . ';';
1195
+                }
1196 1196
 
1197 1197
 
1198
-				// link colors
1199
-				if( !empty( $theme_settings['elements']['link']['color']['text'] ) ){
1200
-					$css .= '--bs-link-color: ' . esc_attr( $theme_settings['elements']['link']['color']['text'] ) . ';';
1201
-				}
1202
-				if( !empty( $theme_settings['elements']['link'][':hover']['color']['text'] ) ){
1203
-					$css .= '--bs-link-hover-color: ' . esc_attr( $theme_settings['elements']['link'][':hover']['color']['text'] ) . ';';
1204
-				}
1198
+                // link colors
1199
+                if( !empty( $theme_settings['elements']['link']['color']['text'] ) ){
1200
+                    $css .= '--bs-link-color: ' . esc_attr( $theme_settings['elements']['link']['color']['text'] ) . ';';
1201
+                }
1202
+                if( !empty( $theme_settings['elements']['link'][':hover']['color']['text'] ) ){
1203
+                    $css .= '--bs-link-hover-color: ' . esc_attr( $theme_settings['elements']['link'][':hover']['color']['text'] ) . ';';
1204
+                }
1205 1205
 
1206
-				if($css){
1207
-					$custom_css .= $is_fse ? 'body.editor-styles-wrapper{' . esc_attr( $css ) . '}' : 'body{' . esc_attr( $css ) . '}';
1208
-				}
1206
+                if($css){
1207
+                    $custom_css .= $is_fse ? 'body.editor-styles-wrapper{' . esc_attr( $css ) . '}' : 'body{' . esc_attr( $css ) . '}';
1208
+                }
1209 1209
 
1210
-				$bep = $is_fse ? 'body.editor-styles-wrapper ' : '';
1210
+                $bep = $is_fse ? 'body.editor-styles-wrapper ' : '';
1211 1211
 
1212
-				// Headings
1213
-				$headings_css = '';
1214
-				if( !empty( $theme_settings['elements']['heading']['color']['text'] ) ){
1215
-					$headings_css .= "color: " . esc_attr( $theme_settings['elements']['heading']['color']['text'] ) . ";";
1216
-				}
1212
+                // Headings
1213
+                $headings_css = '';
1214
+                if( !empty( $theme_settings['elements']['heading']['color']['text'] ) ){
1215
+                    $headings_css .= "color: " . esc_attr( $theme_settings['elements']['heading']['color']['text'] ) . ";";
1216
+                }
1217 1217
 
1218
-				// heading background
1219
-				if( !empty( $theme_settings['elements']['heading']['color']['background'] ) ){
1220
-					$headings_css .= 'background: ' . esc_attr( $theme_settings['elements']['heading']['color']['background'] ) . ';';
1221
-				}
1218
+                // heading background
1219
+                if( !empty( $theme_settings['elements']['heading']['color']['background'] ) ){
1220
+                    $headings_css .= 'background: ' . esc_attr( $theme_settings['elements']['heading']['color']['background'] ) . ';';
1221
+                }
1222 1222
 
1223
-				 // heading font family
1224
-				if( !empty( $theme_settings['elements']['heading']['typography']['fontFamily'] ) ){
1225
-					$headings_css .= 'font-family: ' . esc_attr( $theme_settings['elements']['heading']['typography']['fontFamily']  ) . ';';
1226
-				}
1223
+                    // heading font family
1224
+                if( !empty( $theme_settings['elements']['heading']['typography']['fontFamily'] ) ){
1225
+                    $headings_css .= 'font-family: ' . esc_attr( $theme_settings['elements']['heading']['typography']['fontFamily']  ) . ';';
1226
+                }
1227 1227
 
1228
-				if( $headings_css ){
1229
-					$custom_css .= "$bep h1,$bep h2,$bep h3, $bep h4,$bep h5,$bep h6{ " . esc_attr( $headings_css ) . "}";
1230
-				}
1228
+                if( $headings_css ){
1229
+                    $custom_css .= "$bep h1,$bep h2,$bep h3, $bep h4,$bep h5,$bep h6{ " . esc_attr( $headings_css ) . "}";
1230
+                }
1231 1231
 
1232
-				$hs = array('h1','h2','h3','h4','h5','h6');
1232
+                $hs = array('h1','h2','h3','h4','h5','h6');
1233 1233
 
1234
-				foreach($hs as $hn){
1235
-					$h_css = '';
1236
-					 if( !empty( $theme_settings['elements'][$hn]['color']['text'] ) ){
1237
-						$h_css .= 'color: ' . esc_attr( $theme_settings['elements'][$hn]['color']['text'] ) . ';';
1238
-					 }
1234
+                foreach($hs as $hn){
1235
+                    $h_css = '';
1236
+                        if( !empty( $theme_settings['elements'][$hn]['color']['text'] ) ){
1237
+                        $h_css .= 'color: ' . esc_attr( $theme_settings['elements'][$hn]['color']['text'] ) . ';';
1238
+                        }
1239 1239
 
1240
-					  if( !empty( $theme_settings['elements'][$hn]['typography']['fontSize'] ) ){
1241
-						$h_css .= 'font-size: ' . esc_attr( $theme_settings['elements'][$hn]['typography']['fontSize']  ) . ';';
1242
-					 }
1240
+                        if( !empty( $theme_settings['elements'][$hn]['typography']['fontSize'] ) ){
1241
+                        $h_css .= 'font-size: ' . esc_attr( $theme_settings['elements'][$hn]['typography']['fontSize']  ) . ';';
1242
+                        }
1243 1243
 
1244
-					  if( !empty( $theme_settings['elements'][$hn]['typography']['fontFamily'] ) ){
1245
-						$h_css .= 'font-family: ' . esc_attr( $theme_settings['elements'][$hn]['typography']['fontFamily']  ) . ';';
1246
-					 }
1244
+                        if( !empty( $theme_settings['elements'][$hn]['typography']['fontFamily'] ) ){
1245
+                        $h_css .= 'font-family: ' . esc_attr( $theme_settings['elements'][$hn]['typography']['fontFamily']  ) . ';';
1246
+                        }
1247 1247
 
1248
-					 if($h_css){
1249
-						$custom_css .= esc_attr( $bep  . $hn ) . '{'.esc_attr( $h_css ).'}';
1250
-					 }
1251
-				}
1252
-			}
1248
+                        if($h_css){
1249
+                        $custom_css .= esc_attr( $bep  . $hn ) . '{'.esc_attr( $h_css ).'}';
1250
+                        }
1251
+                }
1252
+            }
1253 1253
 			
1254
-			if ( $custom_css ) {
1255
-				echo $custom_css; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1256
-			}
1257
-
1258
-			// Pagination on Hello Elementor theme.
1259
-			if ( function_exists( 'hello_elementor_setup' ) ) {
1260
-				echo '.aui-nav-links .pagination{justify-content:inherit}';
1261
-			}
1262
-			?></style><?php
1263
-			$custom_css = ob_get_clean();
1264
-
1265
-			/*
1254
+            if ( $custom_css ) {
1255
+                echo $custom_css; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1256
+            }
1257
+
1258
+            // Pagination on Hello Elementor theme.
1259
+            if ( function_exists( 'hello_elementor_setup' ) ) {
1260
+                echo '.aui-nav-links .pagination{justify-content:inherit}';
1261
+            }
1262
+            ?></style><?php
1263
+            $custom_css = ob_get_clean();
1264
+
1265
+            /*
1266 1266
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1267 1267
 			 */
1268
-			return str_replace( array(
1269
-				'<style>',
1270
-				'</style>'
1271
-			), '', self::minify_css( $custom_css ) );
1272
-		}
1273
-
1274
-		/**
1275
-		 * Check if we should add booststrap 3 compatibility changes.
1276
-		 *
1277
-		 * @return bool
1278
-		 */
1279
-		public static function is_bs3_compat(){
1280
-			return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
1281
-		}
1282
-
1283
-		public static function hex_to_rgb( $hex ) {
1284
-			// Remove '#' if present
1285
-			$hex = str_replace( '#', '', $hex );
1286
-
1287
-			// Check if input is RGB
1288
-			if ( strpos( $hex, 'rgba(' ) === 0 || strpos( $hex, 'rgb(' ) === 0 ) {
1289
-				$_rgb = explode( ',', str_replace( array( 'rgba(', 'rgb(', ')' ), '', $hex ) );
1290
-
1291
-				$rgb = ( isset( $_rgb[0] ) ? (int) trim( $_rgb[0] ) : '0' ) . ',';
1292
-				$rgb .= ( isset( $_rgb[1] ) ? (int) trim( $_rgb[1] ) : '0' ) . ',';
1293
-				$rgb .= ( isset( $_rgb[2] ) ? (int) trim( $_rgb[2] ) : '0' );
1294
-
1295
-				return $rgb;
1296
-			}
1297
-
1298
-			// Convert 3-digit hex to 6-digit hex
1299
-			if ( strlen( $hex ) == 3 ) {
1300
-				$hex = str_repeat( substr( $hex, 0, 1 ), 2 ) . str_repeat( substr( $hex, 1, 1 ), 2 ) . str_repeat( substr( $hex, 2, 1 ), 2 );
1301
-			}
1302
-
1303
-			// Convert hex to RGB
1304
-			$r = hexdec( substr( $hex, 0, 2 ) );
1305
-			$g = hexdec( substr( $hex, 2, 2 ) );
1306
-			$b = hexdec( substr( $hex, 4, 2 ) );
1307
-
1308
-			// Return RGB values as an array
1309
-			return $r . ',' . $g . ',' . $b;
1310
-		}
1311
-
1312
-		/**
1313
-		 * Build the CSS to overwrite a bootstrap color variable.
1314
-		 *
1315
-		 * @param $type
1316
-		 * @param $color_code
1317
-		 * @param $compatibility
1318
-		 *
1319
-		 * @return string
1320
-		 */
1321
-		public static function css_overwrite_bs5($type,$color_code,$compatibility, $hex = '' ){
1322
-			global $aui_bs5;
1323
-
1324
-			$is_var = false;
1325
-			$is_custom = strpos($type, 'custom-') !== false ? true : false;
1326
-			if(!$color_code){return '';}
1327
-			if(strpos($color_code, 'var') !== false){
1328
-				//if(!sanitize_hex_color($color_code)){
1329
-				$color_code = esc_attr($color_code);
1330
-				$is_var = true;
1268
+            return str_replace( array(
1269
+                '<style>',
1270
+                '</style>'
1271
+            ), '', self::minify_css( $custom_css ) );
1272
+        }
1273
+
1274
+        /**
1275
+         * Check if we should add booststrap 3 compatibility changes.
1276
+         *
1277
+         * @return bool
1278
+         */
1279
+        public static function is_bs3_compat(){
1280
+            return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
1281
+        }
1282
+
1283
+        public static function hex_to_rgb( $hex ) {
1284
+            // Remove '#' if present
1285
+            $hex = str_replace( '#', '', $hex );
1286
+
1287
+            // Check if input is RGB
1288
+            if ( strpos( $hex, 'rgba(' ) === 0 || strpos( $hex, 'rgb(' ) === 0 ) {
1289
+                $_rgb = explode( ',', str_replace( array( 'rgba(', 'rgb(', ')' ), '', $hex ) );
1290
+
1291
+                $rgb = ( isset( $_rgb[0] ) ? (int) trim( $_rgb[0] ) : '0' ) . ',';
1292
+                $rgb .= ( isset( $_rgb[1] ) ? (int) trim( $_rgb[1] ) : '0' ) . ',';
1293
+                $rgb .= ( isset( $_rgb[2] ) ? (int) trim( $_rgb[2] ) : '0' );
1294
+
1295
+                return $rgb;
1296
+            }
1297
+
1298
+            // Convert 3-digit hex to 6-digit hex
1299
+            if ( strlen( $hex ) == 3 ) {
1300
+                $hex = str_repeat( substr( $hex, 0, 1 ), 2 ) . str_repeat( substr( $hex, 1, 1 ), 2 ) . str_repeat( substr( $hex, 2, 1 ), 2 );
1301
+            }
1302
+
1303
+            // Convert hex to RGB
1304
+            $r = hexdec( substr( $hex, 0, 2 ) );
1305
+            $g = hexdec( substr( $hex, 2, 2 ) );
1306
+            $b = hexdec( substr( $hex, 4, 2 ) );
1307
+
1308
+            // Return RGB values as an array
1309
+            return $r . ',' . $g . ',' . $b;
1310
+        }
1311
+
1312
+        /**
1313
+         * Build the CSS to overwrite a bootstrap color variable.
1314
+         *
1315
+         * @param $type
1316
+         * @param $color_code
1317
+         * @param $compatibility
1318
+         *
1319
+         * @return string
1320
+         */
1321
+        public static function css_overwrite_bs5($type,$color_code,$compatibility, $hex = '' ){
1322
+            global $aui_bs5;
1323
+
1324
+            $is_var = false;
1325
+            $is_custom = strpos($type, 'custom-') !== false ? true : false;
1326
+            if(!$color_code){return '';}
1327
+            if(strpos($color_code, 'var') !== false){
1328
+                //if(!sanitize_hex_color($color_code)){
1329
+                $color_code = esc_attr($color_code);
1330
+                $is_var = true;
1331 1331
 //				$color_code = "rgba($color_code, 0.5)";
1332 1332
 //                echo '###1'.$color_code.'###';//exit;
1333
-			}
1333
+            }
1334 1334
 
1335 1335
 //            echo '@@@'.$color_code.'==='.self::hex_to_rgb($color_code);exit;
1336 1336
 
1337
-			if(!$color_code){return '';}
1337
+            if(!$color_code){return '';}
1338 1338
 
1339
-			$rgb = self::hex_to_rgb($hex);
1339
+            $rgb = self::hex_to_rgb($hex);
1340 1340
 
1341
-			if($compatibility===true || $compatibility===1){
1342
-				$compatibility = '.bsui';
1343
-			}elseif(!$compatibility){
1344
-				$compatibility = '';
1345
-			}else{
1346
-				$compatibility = esc_attr($compatibility);
1347
-			}
1341
+            if($compatibility===true || $compatibility===1){
1342
+                $compatibility = '.bsui';
1343
+            }elseif(!$compatibility){
1344
+                $compatibility = '';
1345
+            }else{
1346
+                $compatibility = esc_attr($compatibility);
1347
+            }
1348 1348
 
1349
-			$prefix = $compatibility ? $compatibility . " " : "";
1349
+            $prefix = $compatibility ? $compatibility . " " : "";
1350 1350
 
1351 1351
 
1352 1352
             $output = '';
1353 1353
 
1354 1354
 //            echo '####'.$color_code;exit;
1355 1355
 
1356
-			$type = sanitize_html_class($type);
1356
+            $type = sanitize_html_class($type);
1357
+
1358
+            /**
1359
+             * c = color, b = background color, o = border-color, f = fill
1360
+             */
1361
+            $selectors = array(
1362
+                ".btn-{$type}"                                              => array( 'b', 'o' ),
1363
+                ".btn-{$type}.disabled"                                     => array( 'b', 'o' ),
1364
+                ".btn-{$type}:disabled"                                     => array( 'b', 'o' ),
1365
+                ".btn-outline-{$type}"                                      => array( 'c', 'o' ),
1366
+                ".btn-outline-{$type}:hover"                                => array( 'b', 'o' ),
1367
+                ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ),
1368
+                ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ),
1369
+                ".show>.btn-outline-{$type}.dropdown-toggle"                => array( 'b', 'o' ),
1370
+                ".badge-{$type}"                                            => array( 'b' ),
1371
+                ".alert-{$type}"                                            => array( 'b', 'o' ),
1372
+                ".bg-{$type}"                                               => array( 'b', 'f' ),
1373
+                ".btn-link.btn-{$type}"                                     => array( 'c' ),
1374
+                ".text-{$type}"                                     => array( 'c' ),
1375
+            );
1376
+
1377
+            if ( $aui_bs5 ) {
1378
+                unset($selectors[".alert-{$type}" ]);
1379
+            }
1357 1380
 
1358
-			/**
1359
-			 * c = color, b = background color, o = border-color, f = fill
1360
-			 */
1361
-			$selectors = array(
1362
-				".btn-{$type}"                                              => array( 'b', 'o' ),
1363
-				".btn-{$type}.disabled"                                     => array( 'b', 'o' ),
1364
-				".btn-{$type}:disabled"                                     => array( 'b', 'o' ),
1365
-				".btn-outline-{$type}"                                      => array( 'c', 'o' ),
1366
-				".btn-outline-{$type}:hover"                                => array( 'b', 'o' ),
1367
-				".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ),
1368
-				".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ),
1369
-				".show>.btn-outline-{$type}.dropdown-toggle"                => array( 'b', 'o' ),
1370
-				".badge-{$type}"                                            => array( 'b' ),
1371
-				".alert-{$type}"                                            => array( 'b', 'o' ),
1372
-				".bg-{$type}"                                               => array( 'b', 'f' ),
1373
-				".btn-link.btn-{$type}"                                     => array( 'c' ),
1374
-				".text-{$type}"                                     => array( 'c' ),
1375
-			);
1376
-
1377
-			if ( $aui_bs5 ) {
1378
-				unset($selectors[".alert-{$type}" ]);
1379
-			}
1380
-
1381
-			if ( $type == 'primary' ) {
1382
-				$selectors = $selectors + array(
1383
-						'a'                                                                                                    => array( 'c' ),
1384
-						'.btn-link'                                                                                            => array( 'c' ),
1385
-						'.dropdown-item.active'                                                                                => array( 'b' ),
1386
-						'.custom-control-input:checked~.custom-control-label::before'                                          => array(
1387
-							'b',
1388
-							'o'
1389
-						),
1390
-						'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before'                   => array(
1391
-							'b',
1392
-							'o'
1393
-						),
1394
-						'.nav-pills .nav-link.active'                                                                          => array( 'b' ),
1395
-						'.nav-pills .show>.nav-link'                                                                           => array( 'b' ),
1396
-						'.page-link'                                                                                           => array( 'c' ),
1397
-						'.page-item.active .page-link'                                                                         => array(
1398
-							'b',
1399
-							'o'
1400
-						),
1401
-						'.progress-bar'                                                                                        => array( 'b' ),
1402
-						'.list-group-item.active'                                                                              => array(
1403
-							'b',
1404
-							'o'
1405
-						),
1406
-						'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ),
1407
-					);
1408
-			}
1381
+            if ( $type == 'primary' ) {
1382
+                $selectors = $selectors + array(
1383
+                        'a'                                                                                                    => array( 'c' ),
1384
+                        '.btn-link'                                                                                            => array( 'c' ),
1385
+                        '.dropdown-item.active'                                                                                => array( 'b' ),
1386
+                        '.custom-control-input:checked~.custom-control-label::before'                                          => array(
1387
+                            'b',
1388
+                            'o'
1389
+                        ),
1390
+                        '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before'                   => array(
1391
+                            'b',
1392
+                            'o'
1393
+                        ),
1394
+                        '.nav-pills .nav-link.active'                                                                          => array( 'b' ),
1395
+                        '.nav-pills .show>.nav-link'                                                                           => array( 'b' ),
1396
+                        '.page-link'                                                                                           => array( 'c' ),
1397
+                        '.page-item.active .page-link'                                                                         => array(
1398
+                            'b',
1399
+                            'o'
1400
+                        ),
1401
+                        '.progress-bar'                                                                                        => array( 'b' ),
1402
+                        '.list-group-item.active'                                                                              => array(
1403
+                            'b',
1404
+                            'o'
1405
+                        ),
1406
+                        '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ),
1407
+                    );
1408
+            }
1409 1409
 
1410 1410
 
1411 1411
 
1412 1412
             // link
1413
-			if ( $type === 'primary' ) {
1414
-				$output .= 'html body {--bs-link-hover-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .75); --bs-link-color: var(--bs-'.esc_attr($type).'); }';
1415
-				$output .= $prefix . ' .breadcrumb{--bs-breadcrumb-item-active-color: '.esc_attr($color_code).';  }';
1416
-				$output .= $prefix . ' .navbar { --bs-nav-link-hover-color: '.esc_attr($color_code).'; --bs-navbar-hover-color: '.esc_attr($color_code).'; --bs-navbar-active-color: '.esc_attr($color_code).'; }';
1413
+            if ( $type === 'primary' ) {
1414
+                $output .= 'html body {--bs-link-hover-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .75); --bs-link-color: var(--bs-'.esc_attr($type).'); }';
1415
+                $output .= $prefix . ' .breadcrumb{--bs-breadcrumb-item-active-color: '.esc_attr($color_code).';  }';
1416
+                $output .= $prefix . ' .navbar { --bs-nav-link-hover-color: '.esc_attr($color_code).'; --bs-navbar-hover-color: '.esc_attr($color_code).'; --bs-navbar-active-color: '.esc_attr($color_code).'; }';
1417 1417
 
1418
-				$output .= $prefix . ' a{color: var(--bs-'.esc_attr($type).');}';
1419
-				$output .= $prefix . ' .text-primary{color: var(--bs-'.esc_attr($type).') !important;}';
1418
+                $output .= $prefix . ' a{color: var(--bs-'.esc_attr($type).');}';
1419
+                $output .= $prefix . ' .text-primary{color: var(--bs-'.esc_attr($type).') !important;}';
1420 1420
 
1421 1421
                 // dropdown
1422
-				$output .= $prefix . ' .dropdown-menu{--bs-dropdown-link-hover-color: var(--bs-'.esc_attr($type).'); --bs-dropdown-link-active-color: var(--bs-'.esc_attr($type).');}';
1422
+                $output .= $prefix . ' .dropdown-menu{--bs-dropdown-link-hover-color: var(--bs-'.esc_attr($type).'); --bs-dropdown-link-active-color: var(--bs-'.esc_attr($type).');}';
1423 1423
 
1424 1424
                 // pagination
1425
-				$output .= $prefix . ' .pagination{--bs-pagination-hover-color: var(--bs-'.esc_attr($type).'); --bs-pagination-active-bg: var(--bs-'.esc_attr($type).');}';
1425
+                $output .= $prefix . ' .pagination{--bs-pagination-hover-color: var(--bs-'.esc_attr($type).'); --bs-pagination-active-bg: var(--bs-'.esc_attr($type).');}';
1426 1426
 
1427
-			}
1427
+            }
1428 1428
 
1429
-			$output .= $prefix . ' .link-'.esc_attr($type).' {color: var(--bs-'.esc_attr($type).'-rgb) !important;}';
1430
-			$output .= $prefix . ' .link-'.esc_attr($type).':hover {color: rgba(var(--bs-'.esc_attr($type).'-rgb), .8) !important;}';
1429
+            $output .= $prefix . ' .link-'.esc_attr($type).' {color: var(--bs-'.esc_attr($type).'-rgb) !important;}';
1430
+            $output .= $prefix . ' .link-'.esc_attr($type).':hover {color: rgba(var(--bs-'.esc_attr($type).'-rgb), .8) !important;}';
1431 1431
 
1432
-			//  buttons
1433
-			$output .= $prefix . ' .btn-'.esc_attr($type).'{';
1434
-			$output .= ' 
1432
+            //  buttons
1433
+            $output .= $prefix . ' .btn-'.esc_attr($type).'{';
1434
+            $output .= ' 
1435 1435
             --bs-btn-bg: '.esc_attr($color_code).';
1436 1436
             --bs-btn-border-color: '.esc_attr($color_code).';
1437 1437
             --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
@@ -1449,917 +1449,917 @@  discard block
 block discarded – undo
1449 1449
 //			--bs-btn-active-color: #fff;
1450 1450
 //			--bs-btn-disabled-color: #fff;
1451 1451
 //            ';
1452
-			$output .= '}';
1452
+            $output .= '}';
1453
+
1454
+            //  buttons outline
1455
+            $output .= $prefix . ' .btn-outline-'.esc_attr($type).'{';
1456
+            $output .= ' 
1457
+			--bs-btn-color: '.esc_attr($color_code).';
1458
+            --bs-btn-border-color: '.esc_attr($color_code).';
1459
+            --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1460
+            --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1461
+            --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type).'-rgb;
1462
+            --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1463
+            --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1464
+            --bs-btn-active-shadow: unset;
1465
+            --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .5);
1466
+            --bs-btn-disabled-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .1);
1467
+            ';
1468
+//			$output .= '
1469
+//		    --bs-btn-color: #fff;
1470
+//			--bs-btn-hover-color: #fff;
1471
+//			--bs-btn-active-color: #fff;
1472
+//			--bs-btn-disabled-color: #fff;
1473
+//            ';
1474
+            $output .= '}';
1475
+
1476
+
1477
+            // button hover
1478
+            $output .= $prefix . ' .btn-'.esc_attr($type).':hover{';
1479
+            $output .= ' 
1480
+            box-shadow: 0 0.25rem 0.25rem 0.125rem rgb(var(--bs-'.esc_attr($type).'-rgb), .1), 0 0.375rem 0.75rem -0.125rem rgb(var(--bs-'.esc_attr($type).'-rgb) , .4);
1481
+            }
1482
+            ';
1483
+
1484
+
1485
+            if ( $aui_bs5 ) {
1486
+//				$output .= $is_var ? 'html body {--bs-'.esc_attr($type).'-rgb: '.$color_code.'; }' : 'html body {--bs-'.esc_attr($type).'-rgb: '.self::hex_to_rgb($color_code).'; }';
1487
+                $output .= 'html body {--bs-'.esc_attr($type).': '.esc_attr($color_code).'; }';
1488
+                $output .= 'html body {--bs-'.esc_attr($type).'-rgb: '.$rgb.'; }';
1489
+            }
1490
+
1491
+
1492
+            if ( $is_custom ) {
1493
+
1494
+//				echo '###'.$type;exit;
1495
+
1496
+                // build rules into each type
1497
+                foreach($selectors as $selector => $types){
1498
+                    $selector = $compatibility ? $compatibility . " ".$selector : $selector;
1499
+                    $types = array_combine($types,$types);
1500
+                    if(isset($types['c'])){$color[] = $selector;}
1501
+                    if(isset($types['b'])){$background[] = $selector;}
1502
+                    if(isset($types['o'])){$border[] = $selector;}
1503
+                    if(isset($types['f'])){$fill[] = $selector;}
1504
+                }
1505
+
1506
+//				// build rules into each type
1507
+//				foreach($important_selectors as $selector => $types){
1508
+//					$selector = $compatibility ? $compatibility . " ".$selector : $selector;
1509
+//					$types = array_combine($types,$types);
1510
+//					if(isset($types['c'])){$color_i[] = $selector;}
1511
+//					if(isset($types['b'])){$background_i[] = $selector;}
1512
+//					if(isset($types['o'])){$border_i[] = $selector;}
1513
+//					if(isset($types['f'])){$fill_i[] = $selector;}
1514
+//				}
1515
+
1516
+                // add any color rules
1517
+                if(!empty($color)){
1518
+                    $output .= implode(",",$color) . "{color: $color_code;} ";
1519
+                }
1520
+                if(!empty($color_i)){
1521
+                    $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1522
+                }
1523
+
1524
+                // add any background color rules
1525
+                if(!empty($background)){
1526
+                    $output .= implode(",",$background) . "{background-color: $color_code;} ";
1527
+                }
1528
+                if(!empty($background_i)){
1529
+                    $output .= $aui_bs5 ? '' : implode(",",$background_i) . "{background-color: $color_code !important;} ";
1530
+//				$output .= implode(",",$background_i) . "{background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important;} ";
1531
+                }
1532
+
1533
+                // add any border color rules
1534
+                if(!empty($border)){
1535
+                    $output .= implode(",",$border) . "{border-color: $color_code;} ";
1536
+                }
1537
+                if(!empty($border_i)){
1538
+                    $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1539
+                }
1540
+
1541
+                // add any fill color rules
1542
+                if(!empty($fill)){
1543
+                    $output .= implode(",",$fill) . "{fill: $color_code;} ";
1544
+                }
1545
+                if(!empty($fill_i)){
1546
+                    $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1547
+                }
1548
+
1549
+            }
1550
+
1551
+
1552
+
1553
+
1554
+            $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;' : '';
1555
+            // darken
1556
+            $darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075");
1557
+            $darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10");
1558
+            $darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125");
1559
+            $darker_40 = $is_var ? $color_code.';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code,"-0.4");
1560
+
1561
+            // lighten
1562
+            $lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25");
1563
+
1564
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
1565
+            $op_25 = $color_code."40"; // 25% opacity
1566
+
1567
+
1568
+            // button states
1569
+            $output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : '';
1570
+            $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1571
+//			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000;    border-color: #000;} ";
1572
+            $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;} ";
1573
+            $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.";} ";
1574
+            $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;} ";
1575
+            $output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled):focus {box-shadow: 0 0.25rem 0.25rem 0.125rem rgba(var(--bs-{$type}-rgb), 0.1), 0 0.375rem 0.75rem -0.125rem rgba(var(--bs-{$type}-rgb), 0.4);} ";
1576
+
1577
+            // text
1578
+//			$output .= $prefix .".xxx, .text-{$type} {color: var(--bs-".esc_attr($type).");} ";
1579
+
1580
+
1581
+//			if ( $type == 'primary' ) {
1582
+//				// dropdown's
1583
+//				$output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1584
+//
1585
+//				// input states
1586
+//				$output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
1587
+//
1588
+//				// page link
1589
+//				$output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1590
+//			}
1591
+
1592
+            // alerts
1593
+            if ( $aui_bs5 ) {
1594
+//				$output .= $is_var ? '' : $prefix ." .alert-{$type} {background-color: ".$color_code."20;    border-color: ".$color_code."30;color:$darker_40} ";
1595
+                $output .= $prefix ." .alert-{$type} {--bs-alert-bg: rgba(var(--bs-{$type}-rgb), .1 ) !important;--bs-alert-border-color: rgba(var(--bs-{$type}-rgb), .25 ) !important;--bs-alert-color: rgba(var(--bs-{$type}-rgb), 1 ) !important;} ";
1596
+            }
1597
+
1598
+            return $output;
1599
+        }
1600
+
1601
+        /**
1602
+         * Build the CSS to overwrite a bootstrap color variable.
1603
+         *
1604
+         * @param $type
1605
+         * @param $color_code
1606
+         * @param $compatibility
1607
+         *
1608
+         * @return string
1609
+         */
1610
+        public static function css_overwrite($type,$color_code,$compatibility, $hex = '' ){
1611
+            global $aui_bs5;
1612
+
1613
+            $is_var = false;
1614
+            if(!$color_code){return '';}
1615
+            if(strpos($color_code, 'var') !== false){
1616
+                //if(!sanitize_hex_color($color_code)){
1617
+                $color_code = esc_attr($color_code);
1618
+                $is_var = true;
1619
+//				$color_code = "rgba($color_code, 0.5)";
1620
+//                echo '###1'.$color_code.'###';//exit;
1621
+            }
1622
+
1623
+//            echo '@@@'.$color_code.'==='.self::hex_to_rgb($color_code);exit;
1624
+
1625
+            if(!$color_code){return '';}
1626
+
1627
+            $rgb = self::hex_to_rgb($hex);
1628
+
1629
+            if($compatibility===true || $compatibility===1){
1630
+                $compatibility = '.bsui';
1631
+            }elseif(!$compatibility){
1632
+                $compatibility = '';
1633
+            }else{
1634
+                $compatibility = esc_attr($compatibility);
1635
+            }
1636
+
1637
+
1638
+
1639
+//            echo '####'.$color_code;exit;
1640
+
1641
+            $type = sanitize_html_class($type);
1642
+
1643
+            /**
1644
+             * c = color, b = background color, o = border-color, f = fill
1645
+             */
1646
+            $selectors = array(
1647
+                ".btn-{$type}"                                              => array( 'b', 'o' ),
1648
+                ".btn-{$type}.disabled"                                     => array( 'b', 'o' ),
1649
+                ".btn-{$type}:disabled"                                     => array( 'b', 'o' ),
1650
+                ".btn-outline-{$type}"                                      => array( 'c', 'o' ),
1651
+                ".btn-outline-{$type}:hover"                                => array( 'b', 'o' ),
1652
+                ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ),
1653
+                ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ),
1654
+                ".show>.btn-outline-{$type}.dropdown-toggle"                => array( 'b', 'o' ),
1655
+                ".badge-{$type}"                                            => array( 'b' ),
1656
+                ".alert-{$type}"                                            => array( 'b', 'o' ),
1657
+                ".bg-{$type}"                                               => array( 'b', 'f' ),
1658
+                ".btn-link.btn-{$type}"                                     => array( 'c' ),
1659
+            );
1660
+
1661
+            if ( $aui_bs5 ) {
1662
+                unset($selectors[".alert-{$type}" ]);
1663
+            }
1664
+
1665
+            if ( $type == 'primary' ) {
1666
+                $selectors = $selectors + array(
1667
+                        'a'                                                                                                    => array( 'c' ),
1668
+                        '.btn-link'                                                                                            => array( 'c' ),
1669
+                        '.dropdown-item.active'                                                                                => array( 'b' ),
1670
+                        '.custom-control-input:checked~.custom-control-label::before'                                          => array(
1671
+                            'b',
1672
+                            'o'
1673
+                        ),
1674
+                        '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before'                   => array(
1675
+                            'b',
1676
+                            'o'
1677
+                        ),
1678
+                        '.nav-pills .nav-link.active'                                                                          => array( 'b' ),
1679
+                        '.nav-pills .show>.nav-link'                                                                           => array( 'b' ),
1680
+                        '.page-link'                                                                                           => array( 'c' ),
1681
+                        '.page-item.active .page-link'                                                                         => array(
1682
+                            'b',
1683
+                            'o'
1684
+                        ),
1685
+                        '.progress-bar'                                                                                        => array( 'b' ),
1686
+                        '.list-group-item.active'                                                                              => array(
1687
+                            'b',
1688
+                            'o'
1689
+                        ),
1690
+                        '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ),
1691
+//				    '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
1692
+//				    '.custom-range::-moz-range-thumb' => array('b'),
1693
+//				    '.custom-range::-ms-thumb' => array('b'),
1694
+                    );
1695
+            }
1696
+
1697
+            $important_selectors = array(
1698
+                ".bg-{$type}" => array('b','f'),
1699
+                ".border-{$type}" => array('o'),
1700
+                ".text-{$type}" => array('c'),
1701
+            );
1702
+
1703
+            $color = array();
1704
+            $color_i = array();
1705
+            $background = array();
1706
+            $background_i = array();
1707
+            $border = array();
1708
+            $border_i = array();
1709
+            $fill = array();
1710
+            $fill_i = array();
1711
+
1712
+            $output = '';
1713
+
1714
+            if ( $aui_bs5 ) {
1715
+//				$output .= $is_var ? 'html body {--bs-'.esc_attr($type).'-rgb: '.$color_code.'; }' : 'html body {--bs-'.esc_attr($type).'-rgb: '.self::hex_to_rgb($color_code).'; }';
1716
+                $output .= 'html body {--bs-'.esc_attr($type).'-rgb: '.$rgb.'; }';
1717
+            }
1718
+
1719
+            // build rules into each type
1720
+            foreach($selectors as $selector => $types){
1721
+                $selector = $compatibility ? $compatibility . " ".$selector : $selector;
1722
+                $types = array_combine($types,$types);
1723
+                if(isset($types['c'])){$color[] = $selector;}
1724
+                if(isset($types['b'])){$background[] = $selector;}
1725
+                if(isset($types['o'])){$border[] = $selector;}
1726
+                if(isset($types['f'])){$fill[] = $selector;}
1727
+            }
1728
+
1729
+            // build rules into each type
1730
+            foreach($important_selectors as $selector => $types){
1731
+                $selector = $compatibility ? $compatibility . " ".$selector : $selector;
1732
+                $types = array_combine($types,$types);
1733
+                if(isset($types['c'])){$color_i[] = $selector;}
1734
+                if(isset($types['b'])){$background_i[] = $selector;}
1735
+                if(isset($types['o'])){$border_i[] = $selector;}
1736
+                if(isset($types['f'])){$fill_i[] = $selector;}
1737
+            }
1738
+
1739
+            // add any color rules
1740
+            if(!empty($color)){
1741
+                $output .= implode(",",$color) . "{color: $color_code;} ";
1742
+            }
1743
+            if(!empty($color_i)){
1744
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1745
+            }
1746
+
1747
+            // add any background color rules
1748
+            if(!empty($background)){
1749
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
1750
+            }
1751
+            if(!empty($background_i)){
1752
+                $output .= $aui_bs5 ? '' : implode(",",$background_i) . "{background-color: $color_code !important;} ";
1753
+//				$output .= implode(",",$background_i) . "{background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important;} ";
1754
+            }
1755
+
1756
+            // add any border color rules
1757
+            if(!empty($border)){
1758
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
1759
+            }
1760
+            if(!empty($border_i)){
1761
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1762
+            }
1763
+
1764
+            // add any fill color rules
1765
+            if(!empty($fill)){
1766
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
1767
+            }
1768
+            if(!empty($fill_i)){
1769
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1770
+            }
1771
+
1772
+
1773
+            $prefix = $compatibility ? $compatibility . " " : "";
1774
+
1775
+            $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;' : '';
1776
+            // darken
1777
+            $darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075");
1778
+            $darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10");
1779
+            $darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125");
1780
+            $darker_40 = $is_var ? $color_code.';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code,"-0.4");
1781
+
1782
+            // lighten
1783
+            $lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25");
1784
+
1785
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
1786
+            $op_25 = $color_code."40"; // 25% opacity
1787
+
1788
+
1789
+            // button states
1790
+            $output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : '';
1791
+            $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1792
+//			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000;    border-color: #000;} ";
1793
+            $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;} ";
1794
+            $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.";} ";
1795
+            $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;} ";
1796
+
1797
+            if ( $type == 'primary' ) {
1798
+                // dropdown's
1799
+                $output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1800
+
1801
+                // input states
1802
+                $output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
1803
+
1804
+                // page link
1805
+                $output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1806
+            }
1807
+
1808
+            // alerts
1809
+            if ( $aui_bs5 ) {
1810
+//				$output .= $is_var ? '' : $prefix ." .alert-{$type} {background-color: ".$color_code."20;    border-color: ".$color_code."30;color:$darker_40} ";
1811
+                $output .= $prefix ." .alert-{$type} {--bs-alert-bg: rgba(var(--bs-{$type}-rgb), .1 ) !important;--bs-alert-border-color: rgba(var(--bs-{$type}-rgb), .25 ) !important;--bs-alert-color: rgba(var(--bs-{$type}-rgb), 1 ) !important;} ";
1812
+            }
1453 1813
 
1454
-			//  buttons outline
1455
-			$output .= $prefix . ' .btn-outline-'.esc_attr($type).'{';
1456
-			$output .= ' 
1457
-			--bs-btn-color: '.esc_attr($color_code).';
1458
-            --bs-btn-border-color: '.esc_attr($color_code).';
1459
-            --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1460
-            --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1461
-            --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type).'-rgb;
1462
-            --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1463
-            --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1464
-            --bs-btn-active-shadow: unset;
1465
-            --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .5);
1466
-            --bs-btn-disabled-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .1);
1467
-            ';
1468
-//			$output .= '
1469
-//		    --bs-btn-color: #fff;
1470
-//			--bs-btn-hover-color: #fff;
1471
-//			--bs-btn-active-color: #fff;
1472
-//			--bs-btn-disabled-color: #fff;
1473
-//            ';
1474
-			$output .= '}';
1814
+            return $output;
1815
+        }
1475 1816
 
1817
+        /**
1818
+         *
1819
+         * @deprecated 0.1.76 Use css_overwrite()
1820
+         *
1821
+         * @param $color_code
1822
+         * @param $compatibility
1823
+         * @param $use_variable
1824
+         *
1825
+         * @return string
1826
+         */
1827
+        public static function css_primary($color_code,$compatibility, $use_variable = false){
1476 1828
 
1477
-            // button hover
1478
-			$output .= $prefix . ' .btn-'.esc_attr($type).':hover{';
1479
-			$output .= ' 
1480
-            box-shadow: 0 0.25rem 0.25rem 0.125rem rgb(var(--bs-'.esc_attr($type).'-rgb), .1), 0 0.375rem 0.75rem -0.125rem rgb(var(--bs-'.esc_attr($type).'-rgb) , .4);
1829
+            if(!$use_variable){
1830
+                $color_code = sanitize_hex_color($color_code);
1831
+                if(!$color_code){return '';}
1481 1832
             }
1482
-            ';
1483 1833
 
1834
+            /**
1835
+             * c = color, b = background color, o = border-color, f = fill
1836
+             */
1837
+            $selectors = array(
1838
+                'a' => array('c'),
1839
+                '.btn-primary' => array('b','o'),
1840
+                '.btn-primary.disabled' => array('b','o'),
1841
+                '.btn-primary:disabled' => array('b','o'),
1842
+                '.btn-outline-primary' => array('c','o'),
1843
+                '.btn-outline-primary:hover' => array('b','o'),
1844
+                '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
1845
+                '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
1846
+                '.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
1847
+                '.btn-link' => array('c'),
1848
+                '.dropdown-item.active' => array('b'),
1849
+                '.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
1850
+                '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
1851
+//				'.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
1852
+//				'.custom-range::-moz-range-thumb' => array('b'),
1853
+//				'.custom-range::-ms-thumb' => array('b'),
1854
+                '.nav-pills .nav-link.active' => array('b'),
1855
+                '.nav-pills .show>.nav-link' => array('b'),
1856
+                '.page-link' => array('c'),
1857
+                '.page-item.active .page-link' => array('b','o'),
1858
+                '.badge-primary' => array('b'),
1859
+                '.alert-primary' => array('b','o'),
1860
+                '.progress-bar' => array('b'),
1861
+                '.list-group-item.active' => array('b','o'),
1862
+                '.bg-primary' => array('b','f'),
1863
+                '.btn-link.btn-primary' => array('c'),
1864
+                '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
1865
+            );
1866
+
1867
+            $important_selectors = array(
1868
+                '.bg-primary' => array('b','f'),
1869
+                '.border-primary' => array('o'),
1870
+                '.text-primary' => array('c'),
1871
+            );
1872
+
1873
+            $color = array();
1874
+            $color_i = array();
1875
+            $background = array();
1876
+            $background_i = array();
1877
+            $border = array();
1878
+            $border_i = array();
1879
+            $fill = array();
1880
+            $fill_i = array();
1484 1881
 
1485
-			if ( $aui_bs5 ) {
1486
-//				$output .= $is_var ? 'html body {--bs-'.esc_attr($type).'-rgb: '.$color_code.'; }' : 'html body {--bs-'.esc_attr($type).'-rgb: '.self::hex_to_rgb($color_code).'; }';
1487
-				$output .= 'html body {--bs-'.esc_attr($type).': '.esc_attr($color_code).'; }';
1488
-				$output .= 'html body {--bs-'.esc_attr($type).'-rgb: '.$rgb.'; }';
1489
-			}
1882
+            $output = '';
1490 1883
 
1884
+            // build rules into each type
1885
+            foreach($selectors as $selector => $types){
1886
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
1887
+                $types = array_combine($types,$types);
1888
+                if(isset($types['c'])){$color[] = $selector;}
1889
+                if(isset($types['b'])){$background[] = $selector;}
1890
+                if(isset($types['o'])){$border[] = $selector;}
1891
+                if(isset($types['f'])){$fill[] = $selector;}
1892
+            }
1491 1893
 
1492
-			if ( $is_custom ) {
1894
+            // build rules into each type
1895
+            foreach($important_selectors as $selector => $types){
1896
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
1897
+                $types = array_combine($types,$types);
1898
+                if(isset($types['c'])){$color_i[] = $selector;}
1899
+                if(isset($types['b'])){$background_i[] = $selector;}
1900
+                if(isset($types['o'])){$border_i[] = $selector;}
1901
+                if(isset($types['f'])){$fill_i[] = $selector;}
1902
+            }
1493 1903
 
1494
-//				echo '###'.$type;exit;
1904
+            // add any color rules
1905
+            if(!empty($color)){
1906
+                $output .= implode(",",$color) . "{color: $color_code;} ";
1907
+            }
1908
+            if(!empty($color_i)){
1909
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1910
+            }
1495 1911
 
1496
-				// build rules into each type
1497
-				foreach($selectors as $selector => $types){
1498
-					$selector = $compatibility ? $compatibility . " ".$selector : $selector;
1499
-					$types = array_combine($types,$types);
1500
-					if(isset($types['c'])){$color[] = $selector;}
1501
-					if(isset($types['b'])){$background[] = $selector;}
1502
-					if(isset($types['o'])){$border[] = $selector;}
1503
-					if(isset($types['f'])){$fill[] = $selector;}
1504
-				}
1912
+            // add any background color rules
1913
+            if(!empty($background)){
1914
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
1915
+            }
1916
+            if(!empty($background_i)){
1917
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1918
+            }
1505 1919
 
1506
-//				// build rules into each type
1507
-//				foreach($important_selectors as $selector => $types){
1508
-//					$selector = $compatibility ? $compatibility . " ".$selector : $selector;
1509
-//					$types = array_combine($types,$types);
1510
-//					if(isset($types['c'])){$color_i[] = $selector;}
1511
-//					if(isset($types['b'])){$background_i[] = $selector;}
1512
-//					if(isset($types['o'])){$border_i[] = $selector;}
1513
-//					if(isset($types['f'])){$fill_i[] = $selector;}
1514
-//				}
1920
+            // add any border color rules
1921
+            if(!empty($border)){
1922
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
1923
+            }
1924
+            if(!empty($border_i)){
1925
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1926
+            }
1515 1927
 
1516
-				// add any color rules
1517
-				if(!empty($color)){
1518
-					$output .= implode(",",$color) . "{color: $color_code;} ";
1519
-				}
1520
-				if(!empty($color_i)){
1521
-					$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1522
-				}
1928
+            // add any fill color rules
1929
+            if(!empty($fill)){
1930
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
1931
+            }
1932
+            if(!empty($fill_i)){
1933
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1934
+            }
1523 1935
 
1524
-				// add any background color rules
1525
-				if(!empty($background)){
1526
-					$output .= implode(",",$background) . "{background-color: $color_code;} ";
1527
-				}
1528
-				if(!empty($background_i)){
1529
-					$output .= $aui_bs5 ? '' : implode(",",$background_i) . "{background-color: $color_code !important;} ";
1530
-//				$output .= implode(",",$background_i) . "{background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important;} ";
1531
-				}
1532 1936
 
1533
-				// add any border color rules
1534
-				if(!empty($border)){
1535
-					$output .= implode(",",$border) . "{border-color: $color_code;} ";
1536
-				}
1537
-				if(!empty($border_i)){
1538
-					$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1539
-				}
1937
+            $prefix = $compatibility ? ".bsui " : "";
1540 1938
 
1541
-				// add any fill color rules
1542
-				if(!empty($fill)){
1543
-					$output .= implode(",",$fill) . "{fill: $color_code;} ";
1544
-				}
1545
-				if(!empty($fill_i)){
1546
-					$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1547
-				}
1939
+            // darken
1940
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1941
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1942
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1548 1943
 
1549
-			}
1944
+            // lighten
1945
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1550 1946
 
1947
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
1948
+            $op_25 = $color_code."40"; // 25% opacity
1551 1949
 
1552 1950
 
1951
+            // button states
1952
+            $output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1953
+            $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;} ";
1954
+            $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.";} ";
1955
+            $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;} ";
1553 1956
 
1554
-			$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;' : '';
1555
-			// darken
1556
-			$darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075");
1557
-			$darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10");
1558
-			$darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125");
1559
-			$darker_40 = $is_var ? $color_code.';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code,"-0.4");
1560 1957
 
1561
-			// lighten
1562
-			$lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25");
1958
+            // dropdown's
1959
+            $output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1563 1960
 
1564
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
1565
-			$op_25 = $color_code."40"; // 25% opacity
1566 1961
 
1962
+            // input states
1963
+            $output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
1567 1964
 
1568
-			// button states
1569
-			$output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : '';
1570
-			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1571
-//			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000;    border-color: #000;} ";
1572
-			$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;} ";
1573
-			$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.";} ";
1574
-            $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;} ";
1575
-            $output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled):focus {box-shadow: 0 0.25rem 0.25rem 0.125rem rgba(var(--bs-{$type}-rgb), 0.1), 0 0.375rem 0.75rem -0.125rem rgba(var(--bs-{$type}-rgb), 0.4);} ";
1965
+            // page link
1966
+            $output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1576 1967
 
1577
-			// text
1578
-//			$output .= $prefix .".xxx, .text-{$type} {color: var(--bs-".esc_attr($type).");} ";
1968
+            return $output;
1969
+        }
1579 1970
 
1971
+        /**
1972
+         *
1973
+         * @deprecated 0.1.76 Use css_overwrite()
1974
+         *
1975
+         * @param $color_code
1976
+         * @param $compatibility
1977
+         *
1978
+         * @return string
1979
+         */
1980
+        public static function css_secondary($color_code,$compatibility){;
1981
+            $color_code = sanitize_hex_color($color_code);
1982
+            if(!$color_code){return '';}
1983
+            /**
1984
+             * c = color, b = background color, o = border-color, f = fill
1985
+             */
1986
+            $selectors = array(
1987
+                '.btn-secondary' => array('b','o'),
1988
+                '.btn-secondary.disabled' => array('b','o'),
1989
+                '.btn-secondary:disabled' => array('b','o'),
1990
+                '.btn-outline-secondary' => array('c','o'),
1991
+                '.btn-outline-secondary:hover' => array('b','o'),
1992
+                '.btn-outline-secondary.disabled' => array('c'),
1993
+                '.btn-outline-secondary:disabled' => array('c'),
1994
+                '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
1995
+                '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
1996
+                '.btn-outline-secondary.dropdown-toggle' => array('b','o'),
1997
+                '.badge-secondary' => array('b'),
1998
+                '.alert-secondary' => array('b','o'),
1999
+                '.btn-link.btn-secondary' => array('c'),
2000
+            );
2001
+
2002
+            $important_selectors = array(
2003
+                '.bg-secondary' => array('b','f'),
2004
+                '.border-secondary' => array('o'),
2005
+                '.text-secondary' => array('c'),
2006
+            );
2007
+
2008
+            $color = array();
2009
+            $color_i = array();
2010
+            $background = array();
2011
+            $background_i = array();
2012
+            $border = array();
2013
+            $border_i = array();
2014
+            $fill = array();
2015
+            $fill_i = array();
1580 2016
 
1581
-//			if ( $type == 'primary' ) {
1582
-//				// dropdown's
1583
-//				$output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1584
-//
1585
-//				// input states
1586
-//				$output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
1587
-//
1588
-//				// page link
1589
-//				$output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1590
-//			}
2017
+            $output = '';
1591 2018
 
1592
-			// alerts
1593
-			if ( $aui_bs5 ) {
1594
-//				$output .= $is_var ? '' : $prefix ." .alert-{$type} {background-color: ".$color_code."20;    border-color: ".$color_code."30;color:$darker_40} ";
1595
-				$output .= $prefix ." .alert-{$type} {--bs-alert-bg: rgba(var(--bs-{$type}-rgb), .1 ) !important;--bs-alert-border-color: rgba(var(--bs-{$type}-rgb), .25 ) !important;--bs-alert-color: rgba(var(--bs-{$type}-rgb), 1 ) !important;} ";
1596
-			}
1597
-
1598
-			return $output;
1599
-		}
1600
-
1601
-		/**
1602
-		 * Build the CSS to overwrite a bootstrap color variable.
1603
-		 *
1604
-		 * @param $type
1605
-		 * @param $color_code
1606
-		 * @param $compatibility
1607
-		 *
1608
-		 * @return string
1609
-		 */
1610
-		public static function css_overwrite($type,$color_code,$compatibility, $hex = '' ){
1611
-            global $aui_bs5;
2019
+            // build rules into each type
2020
+            foreach($selectors as $selector => $types){
2021
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
2022
+                $types = array_combine($types,$types);
2023
+                if(isset($types['c'])){$color[] = $selector;}
2024
+                if(isset($types['b'])){$background[] = $selector;}
2025
+                if(isset($types['o'])){$border[] = $selector;}
2026
+                if(isset($types['f'])){$fill[] = $selector;}
2027
+            }
1612 2028
 
1613
-			$is_var = false;
1614
-			if(!$color_code){return '';}
1615
-			if(strpos($color_code, 'var') !== false){
1616
-				//if(!sanitize_hex_color($color_code)){
1617
-				$color_code = esc_attr($color_code);
1618
-				$is_var = true;
1619
-//				$color_code = "rgba($color_code, 0.5)";
1620
-//                echo '###1'.$color_code.'###';//exit;
1621
-			}
2029
+            // build rules into each type
2030
+            foreach($important_selectors as $selector => $types){
2031
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
2032
+                $types = array_combine($types,$types);
2033
+                if(isset($types['c'])){$color_i[] = $selector;}
2034
+                if(isset($types['b'])){$background_i[] = $selector;}
2035
+                if(isset($types['o'])){$border_i[] = $selector;}
2036
+                if(isset($types['f'])){$fill_i[] = $selector;}
2037
+            }
1622 2038
 
1623
-//            echo '@@@'.$color_code.'==='.self::hex_to_rgb($color_code);exit;
2039
+            // add any color rules
2040
+            if(!empty($color)){
2041
+                $output .= implode(",",$color) . "{color: $color_code;} ";
2042
+            }
2043
+            if(!empty($color_i)){
2044
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2045
+            }
1624 2046
 
1625
-			if(!$color_code){return '';}
2047
+            // add any background color rules
2048
+            if(!empty($background)){
2049
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
2050
+            }
2051
+            if(!empty($background_i)){
2052
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2053
+            }
1626 2054
 
1627
-            $rgb = self::hex_to_rgb($hex);
2055
+            // add any border color rules
2056
+            if(!empty($border)){
2057
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
2058
+            }
2059
+            if(!empty($border_i)){
2060
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2061
+            }
2062
+
2063
+            // add any fill color rules
2064
+            if(!empty($fill)){
2065
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
2066
+            }
2067
+            if(!empty($fill_i)){
2068
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2069
+            }
1628 2070
 
1629
-			if($compatibility===true || $compatibility===1){
1630
-				$compatibility = '.bsui';
1631
-			}elseif(!$compatibility){
1632
-				$compatibility = '';
1633
-			}else{
1634
-				$compatibility = esc_attr($compatibility);
1635
-			}
1636 2071
 
2072
+            $prefix = $compatibility ? ".bsui " : "";
1637 2073
 
2074
+            // darken
2075
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2076
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2077
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1638 2078
 
1639
-//            echo '####'.$color_code;exit;
2079
+            // lighten
2080
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1640 2081
 
1641
-			$type = sanitize_html_class($type);
2082
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
2083
+            $op_25 = $color_code."40"; // 25% opacity
1642 2084
 
1643
-			/**
1644
-			 * c = color, b = background color, o = border-color, f = fill
1645
-			 */
1646
-			$selectors = array(
1647
-				".btn-{$type}"                                              => array( 'b', 'o' ),
1648
-				".btn-{$type}.disabled"                                     => array( 'b', 'o' ),
1649
-				".btn-{$type}:disabled"                                     => array( 'b', 'o' ),
1650
-				".btn-outline-{$type}"                                      => array( 'c', 'o' ),
1651
-				".btn-outline-{$type}:hover"                                => array( 'b', 'o' ),
1652
-				".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ),
1653
-				".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ),
1654
-				".show>.btn-outline-{$type}.dropdown-toggle"                => array( 'b', 'o' ),
1655
-				".badge-{$type}"                                            => array( 'b' ),
1656
-				".alert-{$type}"                                            => array( 'b', 'o' ),
1657
-				".bg-{$type}"                                               => array( 'b', 'f' ),
1658
-				".btn-link.btn-{$type}"                                     => array( 'c' ),
1659
-			);
1660
-
1661
-			if ( $aui_bs5 ) {
1662
-                unset($selectors[".alert-{$type}" ]);
1663
-			}
1664
-
1665
-			if ( $type == 'primary' ) {
1666
-				$selectors = $selectors + array(
1667
-						'a'                                                                                                    => array( 'c' ),
1668
-						'.btn-link'                                                                                            => array( 'c' ),
1669
-						'.dropdown-item.active'                                                                                => array( 'b' ),
1670
-						'.custom-control-input:checked~.custom-control-label::before'                                          => array(
1671
-							'b',
1672
-							'o'
1673
-						),
1674
-						'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before'                   => array(
1675
-							'b',
1676
-							'o'
1677
-						),
1678
-						'.nav-pills .nav-link.active'                                                                          => array( 'b' ),
1679
-						'.nav-pills .show>.nav-link'                                                                           => array( 'b' ),
1680
-						'.page-link'                                                                                           => array( 'c' ),
1681
-						'.page-item.active .page-link'                                                                         => array(
1682
-							'b',
1683
-							'o'
1684
-						),
1685
-						'.progress-bar'                                                                                        => array( 'b' ),
1686
-						'.list-group-item.active'                                                                              => array(
1687
-							'b',
1688
-							'o'
1689
-						),
1690
-						'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ),
1691
-//				    '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
1692
-//				    '.custom-range::-moz-range-thumb' => array('b'),
1693
-//				    '.custom-range::-ms-thumb' => array('b'),
1694
-					);
1695
-			}
1696
-
1697
-			$important_selectors = array(
1698
-				".bg-{$type}" => array('b','f'),
1699
-				".border-{$type}" => array('o'),
1700
-				".text-{$type}" => array('c'),
1701
-			);
1702
-
1703
-			$color = array();
1704
-			$color_i = array();
1705
-			$background = array();
1706
-			$background_i = array();
1707
-			$border = array();
1708
-			$border_i = array();
1709
-			$fill = array();
1710
-			$fill_i = array();
1711
-
1712
-			$output = '';
1713
-
1714
-			if ( $aui_bs5 ) {
1715
-//				$output .= $is_var ? 'html body {--bs-'.esc_attr($type).'-rgb: '.$color_code.'; }' : 'html body {--bs-'.esc_attr($type).'-rgb: '.self::hex_to_rgb($color_code).'; }';
1716
-				$output .= 'html body {--bs-'.esc_attr($type).'-rgb: '.$rgb.'; }';
1717
-			}
1718
-
1719
-			// build rules into each type
1720
-			foreach($selectors as $selector => $types){
1721
-				$selector = $compatibility ? $compatibility . " ".$selector : $selector;
1722
-				$types = array_combine($types,$types);
1723
-				if(isset($types['c'])){$color[] = $selector;}
1724
-				if(isset($types['b'])){$background[] = $selector;}
1725
-				if(isset($types['o'])){$border[] = $selector;}
1726
-				if(isset($types['f'])){$fill[] = $selector;}
1727
-			}
1728
-
1729
-			// build rules into each type
1730
-			foreach($important_selectors as $selector => $types){
1731
-				$selector = $compatibility ? $compatibility . " ".$selector : $selector;
1732
-				$types = array_combine($types,$types);
1733
-				if(isset($types['c'])){$color_i[] = $selector;}
1734
-				if(isset($types['b'])){$background_i[] = $selector;}
1735
-				if(isset($types['o'])){$border_i[] = $selector;}
1736
-				if(isset($types['f'])){$fill_i[] = $selector;}
1737
-			}
1738
-
1739
-			// add any color rules
1740
-			if(!empty($color)){
1741
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1742
-			}
1743
-			if(!empty($color_i)){
1744
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1745
-			}
1746
-
1747
-			// add any background color rules
1748
-			if(!empty($background)){
1749
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1750
-			}
1751
-			if(!empty($background_i)){
1752
-				$output .= $aui_bs5 ? '' : implode(",",$background_i) . "{background-color: $color_code !important;} ";
1753
-//				$output .= implode(",",$background_i) . "{background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important;} ";
1754
-			}
1755 2085
 
1756
-			// add any border color rules
1757
-			if(!empty($border)){
1758
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1759
-			}
1760
-			if(!empty($border_i)){
1761
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1762
-			}
2086
+            // button states
2087
+            $output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2088
+            $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;} ";
2089
+            $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.";} ";
2090
+            $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;} ";
1763 2091
 
1764
-			// add any fill color rules
1765
-			if(!empty($fill)){
1766
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1767
-			}
1768
-			if(!empty($fill_i)){
1769
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1770
-			}
1771 2092
 
2093
+            return $output;
2094
+        }
1772 2095
 
1773
-			$prefix = $compatibility ? $compatibility . " " : "";
2096
+        /**
2097
+         * Increases or decreases the brightness of a color by a percentage of the current brightness.
2098
+         *
2099
+         * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
2100
+         * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
2101
+         *
2102
+         * @return  string
2103
+         */
2104
+        public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
2105
+            $hexCode = ltrim($hexCode, '#');
1774 2106
 
1775
-			$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;' : '';
1776
-			// darken
1777
-			$darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075");
1778
-			$darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10");
1779
-			$darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125");
1780
-			$darker_40 = $is_var ? $color_code.';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code,"-0.4");
2107
+            if ( strpos( $hexCode, 'rgba(' ) !== false || strpos( $hexCode, 'rgb(' ) !== false ) {
2108
+                return $hexCode;
2109
+            }
1781 2110
 
1782
-			// lighten
1783
-			$lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25");
2111
+            if (strlen($hexCode) == 3) {
2112
+                $hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
2113
+            }
1784 2114
 
1785
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
1786
-			$op_25 = $color_code."40"; // 25% opacity
2115
+            $hexCode = array_map('hexdec', str_split($hexCode, 2));
1787 2116
 
2117
+            foreach ($hexCode as & $color) {
2118
+                $adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
2119
+                $adjustAmount = ceil($adjustableLimit * $adjustPercent);
1788 2120
 
1789
-			// button states
1790
-			$output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : '';
1791
-			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1792
-//			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000;    border-color: #000;} ";
1793
-			$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;} ";
1794
-			$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.";} ";
1795
-			$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;} ";
2121
+                $color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
2122
+            }
1796 2123
 
1797
-			if ( $type == 'primary' ) {
1798
-				// dropdown's
1799
-				$output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2124
+            return '#' . implode($hexCode);
2125
+        }
1800 2126
 
1801
-				// input states
1802
-				$output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
2127
+        /**
2128
+         * Check if we should display examples.
2129
+         */
2130
+        public function maybe_show_examples(){
2131
+            if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
2132
+                echo "<head>";
2133
+                wp_head();
2134
+                echo "</head>";
2135
+                echo "<body>";
2136
+                echo $this->get_examples(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2137
+                echo "</body>";
2138
+                exit;
2139
+            }
2140
+        }
1803 2141
 
1804
-				// page link
1805
-				$output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1806
-			}
2142
+        /**
2143
+         * Get developer examples.
2144
+         *
2145
+         * @return string
2146
+         */
2147
+        public function get_examples(){
2148
+            $output = '';
1807 2149
 
1808
-            // alerts
1809
-			if ( $aui_bs5 ) {
1810
-//				$output .= $is_var ? '' : $prefix ." .alert-{$type} {background-color: ".$color_code."20;    border-color: ".$color_code."30;color:$darker_40} ";
1811
-				$output .= $prefix ." .alert-{$type} {--bs-alert-bg: rgba(var(--bs-{$type}-rgb), .1 ) !important;--bs-alert-border-color: rgba(var(--bs-{$type}-rgb), .25 ) !important;--bs-alert-color: rgba(var(--bs-{$type}-rgb), 1 ) !important;} ";
1812
-			}
1813
-
1814
-			return $output;
1815
-		}
1816
-
1817
-		/**
1818
-		 *
1819
-		 * @deprecated 0.1.76 Use css_overwrite()
1820
-		 *
1821
-		 * @param $color_code
1822
-		 * @param $compatibility
1823
-		 * @param $use_variable
1824
-		 *
1825
-		 * @return string
1826
-		 */
1827
-		public static function css_primary($color_code,$compatibility, $use_variable = false){
1828
-
1829
-			if(!$use_variable){
1830
-				$color_code = sanitize_hex_color($color_code);
1831
-				if(!$color_code){return '';}
1832
-			}
1833
-
1834
-			/**
1835
-			 * c = color, b = background color, o = border-color, f = fill
1836
-			 */
1837
-			$selectors = array(
1838
-				'a' => array('c'),
1839
-				'.btn-primary' => array('b','o'),
1840
-				'.btn-primary.disabled' => array('b','o'),
1841
-				'.btn-primary:disabled' => array('b','o'),
1842
-				'.btn-outline-primary' => array('c','o'),
1843
-				'.btn-outline-primary:hover' => array('b','o'),
1844
-				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
1845
-				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
1846
-				'.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
1847
-				'.btn-link' => array('c'),
1848
-				'.dropdown-item.active' => array('b'),
1849
-				'.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
1850
-				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
1851
-//				'.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
1852
-//				'.custom-range::-moz-range-thumb' => array('b'),
1853
-//				'.custom-range::-ms-thumb' => array('b'),
1854
-				'.nav-pills .nav-link.active' => array('b'),
1855
-				'.nav-pills .show>.nav-link' => array('b'),
1856
-				'.page-link' => array('c'),
1857
-				'.page-item.active .page-link' => array('b','o'),
1858
-				'.badge-primary' => array('b'),
1859
-				'.alert-primary' => array('b','o'),
1860
-				'.progress-bar' => array('b'),
1861
-				'.list-group-item.active' => array('b','o'),
1862
-				'.bg-primary' => array('b','f'),
1863
-				'.btn-link.btn-primary' => array('c'),
1864
-				'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
1865
-			);
1866
-
1867
-			$important_selectors = array(
1868
-				'.bg-primary' => array('b','f'),
1869
-				'.border-primary' => array('o'),
1870
-				'.text-primary' => array('c'),
1871
-			);
1872
-
1873
-			$color = array();
1874
-			$color_i = array();
1875
-			$background = array();
1876
-			$background_i = array();
1877
-			$border = array();
1878
-			$border_i = array();
1879
-			$fill = array();
1880
-			$fill_i = array();
1881
-
1882
-			$output = '';
1883
-
1884
-			// build rules into each type
1885
-			foreach($selectors as $selector => $types){
1886
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1887
-				$types = array_combine($types,$types);
1888
-				if(isset($types['c'])){$color[] = $selector;}
1889
-				if(isset($types['b'])){$background[] = $selector;}
1890
-				if(isset($types['o'])){$border[] = $selector;}
1891
-				if(isset($types['f'])){$fill[] = $selector;}
1892
-			}
1893
-
1894
-			// build rules into each type
1895
-			foreach($important_selectors as $selector => $types){
1896
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1897
-				$types = array_combine($types,$types);
1898
-				if(isset($types['c'])){$color_i[] = $selector;}
1899
-				if(isset($types['b'])){$background_i[] = $selector;}
1900
-				if(isset($types['o'])){$border_i[] = $selector;}
1901
-				if(isset($types['f'])){$fill_i[] = $selector;}
1902
-			}
1903
-
1904
-			// add any color rules
1905
-			if(!empty($color)){
1906
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1907
-			}
1908
-			if(!empty($color_i)){
1909
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1910
-			}
1911
-
1912
-			// add any background color rules
1913
-			if(!empty($background)){
1914
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1915
-			}
1916
-			if(!empty($background_i)){
1917
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1918
-			}
1919
-
1920
-			// add any border color rules
1921
-			if(!empty($border)){
1922
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1923
-			}
1924
-			if(!empty($border_i)){
1925
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1926
-			}
1927
-
1928
-			// add any fill color rules
1929
-			if(!empty($fill)){
1930
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1931
-			}
1932
-			if(!empty($fill_i)){
1933
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1934
-			}
1935
-
1936
-
1937
-			$prefix = $compatibility ? ".bsui " : "";
1938
-
1939
-			// darken
1940
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1941
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1942
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1943
-
1944
-			// lighten
1945
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1946
-
1947
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
1948
-			$op_25 = $color_code."40"; // 25% opacity
1949
-
1950
-
1951
-			// button states
1952
-			$output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1953
-			$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;} ";
1954
-			$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.";} ";
1955
-			$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;} ";
1956
-
1957
-
1958
-			// dropdown's
1959
-			$output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1960
-
1961
-
1962
-			// input states
1963
-			$output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
1964
-
1965
-			// page link
1966
-			$output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1967
-
1968
-			return $output;
1969
-		}
1970
-
1971
-		/**
1972
-		 *
1973
-		 * @deprecated 0.1.76 Use css_overwrite()
1974
-		 *
1975
-		 * @param $color_code
1976
-		 * @param $compatibility
1977
-		 *
1978
-		 * @return string
1979
-		 */
1980
-		public static function css_secondary($color_code,$compatibility){;
1981
-			$color_code = sanitize_hex_color($color_code);
1982
-			if(!$color_code){return '';}
1983
-			/**
1984
-			 * c = color, b = background color, o = border-color, f = fill
1985
-			 */
1986
-			$selectors = array(
1987
-				'.btn-secondary' => array('b','o'),
1988
-				'.btn-secondary.disabled' => array('b','o'),
1989
-				'.btn-secondary:disabled' => array('b','o'),
1990
-				'.btn-outline-secondary' => array('c','o'),
1991
-				'.btn-outline-secondary:hover' => array('b','o'),
1992
-				'.btn-outline-secondary.disabled' => array('c'),
1993
-				'.btn-outline-secondary:disabled' => array('c'),
1994
-				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
1995
-				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
1996
-				'.btn-outline-secondary.dropdown-toggle' => array('b','o'),
1997
-				'.badge-secondary' => array('b'),
1998
-				'.alert-secondary' => array('b','o'),
1999
-				'.btn-link.btn-secondary' => array('c'),
2000
-			);
2001
-
2002
-			$important_selectors = array(
2003
-				'.bg-secondary' => array('b','f'),
2004
-				'.border-secondary' => array('o'),
2005
-				'.text-secondary' => array('c'),
2006
-			);
2007
-
2008
-			$color = array();
2009
-			$color_i = array();
2010
-			$background = array();
2011
-			$background_i = array();
2012
-			$border = array();
2013
-			$border_i = array();
2014
-			$fill = array();
2015
-			$fill_i = array();
2016
-
2017
-			$output = '';
2018
-
2019
-			// build rules into each type
2020
-			foreach($selectors as $selector => $types){
2021
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2022
-				$types = array_combine($types,$types);
2023
-				if(isset($types['c'])){$color[] = $selector;}
2024
-				if(isset($types['b'])){$background[] = $selector;}
2025
-				if(isset($types['o'])){$border[] = $selector;}
2026
-				if(isset($types['f'])){$fill[] = $selector;}
2027
-			}
2028
-
2029
-			// build rules into each type
2030
-			foreach($important_selectors as $selector => $types){
2031
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2032
-				$types = array_combine($types,$types);
2033
-				if(isset($types['c'])){$color_i[] = $selector;}
2034
-				if(isset($types['b'])){$background_i[] = $selector;}
2035
-				if(isset($types['o'])){$border_i[] = $selector;}
2036
-				if(isset($types['f'])){$fill_i[] = $selector;}
2037
-			}
2038
-
2039
-			// add any color rules
2040
-			if(!empty($color)){
2041
-				$output .= implode(",",$color) . "{color: $color_code;} ";
2042
-			}
2043
-			if(!empty($color_i)){
2044
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2045
-			}
2046
-
2047
-			// add any background color rules
2048
-			if(!empty($background)){
2049
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
2050
-			}
2051
-			if(!empty($background_i)){
2052
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2053
-			}
2054
-
2055
-			// add any border color rules
2056
-			if(!empty($border)){
2057
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
2058
-			}
2059
-			if(!empty($border_i)){
2060
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2061
-			}
2062
-
2063
-			// add any fill color rules
2064
-			if(!empty($fill)){
2065
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
2066
-			}
2067
-			if(!empty($fill_i)){
2068
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2069
-			}
2070
-
2071
-
2072
-			$prefix = $compatibility ? ".bsui " : "";
2073
-
2074
-			// darken
2075
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2076
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2077
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2078
-
2079
-			// lighten
2080
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2081
-
2082
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
2083
-			$op_25 = $color_code."40"; // 25% opacity
2084
-
2085
-
2086
-			// button states
2087
-			$output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2088
-			$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;} ";
2089
-			$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.";} ";
2090
-			$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;} ";
2091
-
2092
-
2093
-			return $output;
2094
-		}
2095
-
2096
-		/**
2097
-		 * Increases or decreases the brightness of a color by a percentage of the current brightness.
2098
-		 *
2099
-		 * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
2100
-		 * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
2101
-		 *
2102
-		 * @return  string
2103
-		 */
2104
-		public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
2105
-			$hexCode = ltrim($hexCode, '#');
2106
-
2107
-			if ( strpos( $hexCode, 'rgba(' ) !== false || strpos( $hexCode, 'rgb(' ) !== false ) {
2108
-				return $hexCode;
2109
-			}
2110
-
2111
-			if (strlen($hexCode) == 3) {
2112
-				$hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
2113
-			}
2114
-
2115
-			$hexCode = array_map('hexdec', str_split($hexCode, 2));
2116
-
2117
-			foreach ($hexCode as & $color) {
2118
-				$adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
2119
-				$adjustAmount = ceil($adjustableLimit * $adjustPercent);
2120
-
2121
-				$color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
2122
-			}
2123
-
2124
-			return '#' . implode($hexCode);
2125
-		}
2126
-
2127
-		/**
2128
-		 * Check if we should display examples.
2129
-		 */
2130
-		public function maybe_show_examples(){
2131
-			if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
2132
-				echo "<head>";
2133
-				wp_head();
2134
-				echo "</head>";
2135
-				echo "<body>";
2136
-				echo $this->get_examples(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2137
-				echo "</body>";
2138
-				exit;
2139
-			}
2140
-		}
2141
-
2142
-		/**
2143
-		 * Get developer examples.
2144
-		 *
2145
-		 * @return string
2146
-		 */
2147
-		public function get_examples(){
2148
-			$output = '';
2149
-
2150
-
2151
-			// open form
2152
-			$output .= "<form class='p-5 m-5 border rounded'>";
2153
-
2154
-			// input example
2155
-			$output .= aui()->input(array(
2156
-				'type'  =>  'text',
2157
-				'id'    =>  'text-example',
2158
-				'name'    =>  'text-example',
2159
-				'placeholder'   => 'text placeholder',
2160
-				'title'   => 'Text input example',
2161
-				'value' =>  '',
2162
-				'required'  => false,
2163
-				'help_text' => 'help text',
2164
-				'label' => 'Text input example label'
2165
-			));
2166
-
2167
-			// input example
2168
-			$output .= aui()->input(array(
2169
-				'type'  =>  'url',
2170
-				'id'    =>  'text-example2',
2171
-				'name'    =>  'text-example',
2172
-				'placeholder'   => 'url placeholder',
2173
-				'title'   => 'Text input example',
2174
-				'value' =>  '',
2175
-				'required'  => false,
2176
-				'help_text' => 'help text',
2177
-				'label' => 'Text input example label'
2178
-			));
2179
-
2180
-			// checkbox example
2181
-			$output .= aui()->input(array(
2182
-				'type'  =>  'checkbox',
2183
-				'id'    =>  'checkbox-example',
2184
-				'name'    =>  'checkbox-example',
2185
-				'placeholder'   => 'checkbox-example',
2186
-				'title'   => 'Checkbox example',
2187
-				'value' =>  '1',
2188
-				'checked'   => true,
2189
-				'required'  => false,
2190
-				'help_text' => 'help text',
2191
-				'label' => 'Checkbox checked'
2192
-			));
2193
-
2194
-			// checkbox example
2195
-			$output .= aui()->input(array(
2196
-				'type'  =>  'checkbox',
2197
-				'id'    =>  'checkbox-example2',
2198
-				'name'    =>  'checkbox-example2',
2199
-				'placeholder'   => 'checkbox-example',
2200
-				'title'   => 'Checkbox example',
2201
-				'value' =>  '1',
2202
-				'checked'   => false,
2203
-				'required'  => false,
2204
-				'help_text' => 'help text',
2205
-				'label' => 'Checkbox un-checked'
2206
-			));
2207
-
2208
-			// switch example
2209
-			$output .= aui()->input(array(
2210
-				'type'  =>  'checkbox',
2211
-				'id'    =>  'switch-example',
2212
-				'name'    =>  'switch-example',
2213
-				'placeholder'   => 'checkbox-example',
2214
-				'title'   => 'Switch example',
2215
-				'value' =>  '1',
2216
-				'checked'   => true,
2217
-				'switch'    => true,
2218
-				'required'  => false,
2219
-				'help_text' => 'help text',
2220
-				'label' => 'Switch on'
2221
-			));
2222
-
2223
-			// switch example
2224
-			$output .= aui()->input(array(
2225
-				'type'  =>  'checkbox',
2226
-				'id'    =>  'switch-example2',
2227
-				'name'    =>  'switch-example2',
2228
-				'placeholder'   => 'checkbox-example',
2229
-				'title'   => 'Switch example',
2230
-				'value' =>  '1',
2231
-				'checked'   => false,
2232
-				'switch'    => true,
2233
-				'required'  => false,
2234
-				'help_text' => 'help text',
2235
-				'label' => 'Switch off'
2236
-			));
2237
-
2238
-			// close form
2239
-			$output .= "</form>";
2240
-
2241
-			return $output;
2242
-		}
2243
-
2244
-		/**
2245
-		 * Calendar params.
2246
-		 *
2247
-		 * @since 0.1.44
2248
-		 *
2249
-		 * @return array Calendar params.
2250
-		 */
2251
-		public static function calendar_params() {
2252
-			$params = array(
2253
-				'month_long_1' => __( 'January', 'ayecode-connect' ),
2254
-				'month_long_2' => __( 'February', 'ayecode-connect' ),
2255
-				'month_long_3' => __( 'March', 'ayecode-connect' ),
2256
-				'month_long_4' => __( 'April', 'ayecode-connect' ),
2257
-				'month_long_5' => __( 'May', 'ayecode-connect' ),
2258
-				'month_long_6' => __( 'June', 'ayecode-connect' ),
2259
-				'month_long_7' => __( 'July', 'ayecode-connect' ),
2260
-				'month_long_8' => __( 'August', 'ayecode-connect' ),
2261
-				'month_long_9' => __( 'September', 'ayecode-connect' ),
2262
-				'month_long_10' => __( 'October', 'ayecode-connect' ),
2263
-				'month_long_11' => __( 'November', 'ayecode-connect' ),
2264
-				'month_long_12' => __( 'December', 'ayecode-connect' ),
2265
-				'month_s_1' => _x( 'Jan', 'January abbreviation', 'ayecode-connect' ),
2266
-				'month_s_2' => _x( 'Feb', 'February abbreviation', 'ayecode-connect' ),
2267
-				'month_s_3' => _x( 'Mar', 'March abbreviation', 'ayecode-connect' ),
2268
-				'month_s_4' => _x( 'Apr', 'April abbreviation', 'ayecode-connect' ),
2269
-				'month_s_5' => _x( 'May', 'May abbreviation', 'ayecode-connect' ),
2270
-				'month_s_6' => _x( 'Jun', 'June abbreviation', 'ayecode-connect' ),
2271
-				'month_s_7' => _x( 'Jul', 'July abbreviation', 'ayecode-connect' ),
2272
-				'month_s_8' => _x( 'Aug', 'August abbreviation', 'ayecode-connect' ),
2273
-				'month_s_9' => _x( 'Sep', 'September abbreviation', 'ayecode-connect' ),
2274
-				'month_s_10' => _x( 'Oct', 'October abbreviation', 'ayecode-connect' ),
2275
-				'month_s_11' => _x( 'Nov', 'November abbreviation', 'ayecode-connect' ),
2276
-				'month_s_12' => _x( 'Dec', 'December abbreviation', 'ayecode-connect' ),
2277
-				'day_s1_1' => _x( 'S', 'Sunday initial', 'ayecode-connect' ),
2278
-				'day_s1_2' => _x( 'M', 'Monday initial', 'ayecode-connect' ),
2279
-				'day_s1_3' => _x( 'T', 'Tuesday initial', 'ayecode-connect' ),
2280
-				'day_s1_4' => _x( 'W', 'Wednesday initial', 'ayecode-connect' ),
2281
-				'day_s1_5' => _x( 'T', 'Friday initial', 'ayecode-connect' ),
2282
-				'day_s1_6' => _x( 'F', 'Thursday initial', 'ayecode-connect' ),
2283
-				'day_s1_7' => _x( 'S', 'Saturday initial', 'ayecode-connect' ),
2284
-				'day_s2_1' => __( 'Su', 'ayecode-connect' ),
2285
-				'day_s2_2' => __( 'Mo', 'ayecode-connect' ),
2286
-				'day_s2_3' => __( 'Tu', 'ayecode-connect' ),
2287
-				'day_s2_4' => __( 'We', 'ayecode-connect' ),
2288
-				'day_s2_5' => __( 'Th', 'ayecode-connect' ),
2289
-				'day_s2_6' => __( 'Fr', 'ayecode-connect' ),
2290
-				'day_s2_7' => __( 'Sa', 'ayecode-connect' ),
2291
-				'day_s3_1' => __( 'Sun', 'ayecode-connect' ),
2292
-				'day_s3_2' => __( 'Mon', 'ayecode-connect' ),
2293
-				'day_s3_3' => __( 'Tue', 'ayecode-connect' ),
2294
-				'day_s3_4' => __( 'Wed', 'ayecode-connect' ),
2295
-				'day_s3_5' => __( 'Thu', 'ayecode-connect' ),
2296
-				'day_s3_6' => __( 'Fri', 'ayecode-connect' ),
2297
-				'day_s3_7' => __( 'Sat', 'ayecode-connect' ),
2298
-				'day_s5_1' => __( 'Sunday', 'ayecode-connect' ),
2299
-				'day_s5_2' => __( 'Monday', 'ayecode-connect' ),
2300
-				'day_s5_3' => __( 'Tuesday', 'ayecode-connect' ),
2301
-				'day_s5_4' => __( 'Wednesday', 'ayecode-connect' ),
2302
-				'day_s5_5' => __( 'Thursday', 'ayecode-connect' ),
2303
-				'day_s5_6' => __( 'Friday', 'ayecode-connect' ),
2304
-				'day_s5_7' => __( 'Saturday', 'ayecode-connect' ),
2305
-				'am_lower' => __( 'am', 'ayecode-connect' ),
2306
-				'pm_lower' => __( 'pm', 'ayecode-connect' ),
2307
-				'am_upper' => __( 'AM', 'ayecode-connect' ),
2308
-				'pm_upper' => __( 'PM', 'ayecode-connect' ),
2309
-				'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
2310
-				'time_24hr' => false,
2311
-				'year' => __( 'Year', 'ayecode-connect' ),
2312
-				'hour' => __( 'Hour', 'ayecode-connect' ),
2313
-				'minute' => __( 'Minute', 'ayecode-connect' ),
2314
-				'weekAbbreviation' => __( 'Wk', 'ayecode-connect' ),
2315
-				'rangeSeparator' => __( ' to ', 'ayecode-connect' ),
2316
-				'scrollTitle' => __( 'Scroll to increment', 'ayecode-connect' ),
2317
-				'toggleTitle' => __( 'Click to toggle', 'ayecode-connect' )
2318
-			);
2319
-
2320
-			return apply_filters( 'ayecode_ui_calendar_params', $params );
2321
-		}
2322
-
2323
-		/**
2324
-		 * Flatpickr calendar localize.
2325
-		 *
2326
-		 * @since 0.1.44
2327
-		 *
2328
-		 * @return string Calendar locale.
2329
-		 */
2330
-		public static function flatpickr_locale() {
2331
-			$params = self::calendar_params();
2332
-
2333
-			if ( is_string( $params ) ) {
2334
-				$params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
2335
-			} else {
2336
-				foreach ( (array) $params as $key => $value ) {
2337
-					if ( ! is_scalar( $value ) ) {
2338
-						continue;
2339
-					}
2340
-
2341
-					$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2342
-				}
2343
-			}
2344 2150
 
2345
-			$day_s3 = array();
2346
-			$day_s5 = array();
2151
+            // open form
2152
+            $output .= "<form class='p-5 m-5 border rounded'>";
2153
+
2154
+            // input example
2155
+            $output .= aui()->input(array(
2156
+                'type'  =>  'text',
2157
+                'id'    =>  'text-example',
2158
+                'name'    =>  'text-example',
2159
+                'placeholder'   => 'text placeholder',
2160
+                'title'   => 'Text input example',
2161
+                'value' =>  '',
2162
+                'required'  => false,
2163
+                'help_text' => 'help text',
2164
+                'label' => 'Text input example label'
2165
+            ));
2166
+
2167
+            // input example
2168
+            $output .= aui()->input(array(
2169
+                'type'  =>  'url',
2170
+                'id'    =>  'text-example2',
2171
+                'name'    =>  'text-example',
2172
+                'placeholder'   => 'url placeholder',
2173
+                'title'   => 'Text input example',
2174
+                'value' =>  '',
2175
+                'required'  => false,
2176
+                'help_text' => 'help text',
2177
+                'label' => 'Text input example label'
2178
+            ));
2179
+
2180
+            // checkbox example
2181
+            $output .= aui()->input(array(
2182
+                'type'  =>  'checkbox',
2183
+                'id'    =>  'checkbox-example',
2184
+                'name'    =>  'checkbox-example',
2185
+                'placeholder'   => 'checkbox-example',
2186
+                'title'   => 'Checkbox example',
2187
+                'value' =>  '1',
2188
+                'checked'   => true,
2189
+                'required'  => false,
2190
+                'help_text' => 'help text',
2191
+                'label' => 'Checkbox checked'
2192
+            ));
2193
+
2194
+            // checkbox example
2195
+            $output .= aui()->input(array(
2196
+                'type'  =>  'checkbox',
2197
+                'id'    =>  'checkbox-example2',
2198
+                'name'    =>  'checkbox-example2',
2199
+                'placeholder'   => 'checkbox-example',
2200
+                'title'   => 'Checkbox example',
2201
+                'value' =>  '1',
2202
+                'checked'   => false,
2203
+                'required'  => false,
2204
+                'help_text' => 'help text',
2205
+                'label' => 'Checkbox un-checked'
2206
+            ));
2207
+
2208
+            // switch example
2209
+            $output .= aui()->input(array(
2210
+                'type'  =>  'checkbox',
2211
+                'id'    =>  'switch-example',
2212
+                'name'    =>  'switch-example',
2213
+                'placeholder'   => 'checkbox-example',
2214
+                'title'   => 'Switch example',
2215
+                'value' =>  '1',
2216
+                'checked'   => true,
2217
+                'switch'    => true,
2218
+                'required'  => false,
2219
+                'help_text' => 'help text',
2220
+                'label' => 'Switch on'
2221
+            ));
2222
+
2223
+            // switch example
2224
+            $output .= aui()->input(array(
2225
+                'type'  =>  'checkbox',
2226
+                'id'    =>  'switch-example2',
2227
+                'name'    =>  'switch-example2',
2228
+                'placeholder'   => 'checkbox-example',
2229
+                'title'   => 'Switch example',
2230
+                'value' =>  '1',
2231
+                'checked'   => false,
2232
+                'switch'    => true,
2233
+                'required'  => false,
2234
+                'help_text' => 'help text',
2235
+                'label' => 'Switch off'
2236
+            ));
2237
+
2238
+            // close form
2239
+            $output .= "</form>";
2240
+
2241
+            return $output;
2242
+        }
2243
+
2244
+        /**
2245
+         * Calendar params.
2246
+         *
2247
+         * @since 0.1.44
2248
+         *
2249
+         * @return array Calendar params.
2250
+         */
2251
+        public static function calendar_params() {
2252
+            $params = array(
2253
+                'month_long_1' => __( 'January', 'ayecode-connect' ),
2254
+                'month_long_2' => __( 'February', 'ayecode-connect' ),
2255
+                'month_long_3' => __( 'March', 'ayecode-connect' ),
2256
+                'month_long_4' => __( 'April', 'ayecode-connect' ),
2257
+                'month_long_5' => __( 'May', 'ayecode-connect' ),
2258
+                'month_long_6' => __( 'June', 'ayecode-connect' ),
2259
+                'month_long_7' => __( 'July', 'ayecode-connect' ),
2260
+                'month_long_8' => __( 'August', 'ayecode-connect' ),
2261
+                'month_long_9' => __( 'September', 'ayecode-connect' ),
2262
+                'month_long_10' => __( 'October', 'ayecode-connect' ),
2263
+                'month_long_11' => __( 'November', 'ayecode-connect' ),
2264
+                'month_long_12' => __( 'December', 'ayecode-connect' ),
2265
+                'month_s_1' => _x( 'Jan', 'January abbreviation', 'ayecode-connect' ),
2266
+                'month_s_2' => _x( 'Feb', 'February abbreviation', 'ayecode-connect' ),
2267
+                'month_s_3' => _x( 'Mar', 'March abbreviation', 'ayecode-connect' ),
2268
+                'month_s_4' => _x( 'Apr', 'April abbreviation', 'ayecode-connect' ),
2269
+                'month_s_5' => _x( 'May', 'May abbreviation', 'ayecode-connect' ),
2270
+                'month_s_6' => _x( 'Jun', 'June abbreviation', 'ayecode-connect' ),
2271
+                'month_s_7' => _x( 'Jul', 'July abbreviation', 'ayecode-connect' ),
2272
+                'month_s_8' => _x( 'Aug', 'August abbreviation', 'ayecode-connect' ),
2273
+                'month_s_9' => _x( 'Sep', 'September abbreviation', 'ayecode-connect' ),
2274
+                'month_s_10' => _x( 'Oct', 'October abbreviation', 'ayecode-connect' ),
2275
+                'month_s_11' => _x( 'Nov', 'November abbreviation', 'ayecode-connect' ),
2276
+                'month_s_12' => _x( 'Dec', 'December abbreviation', 'ayecode-connect' ),
2277
+                'day_s1_1' => _x( 'S', 'Sunday initial', 'ayecode-connect' ),
2278
+                'day_s1_2' => _x( 'M', 'Monday initial', 'ayecode-connect' ),
2279
+                'day_s1_3' => _x( 'T', 'Tuesday initial', 'ayecode-connect' ),
2280
+                'day_s1_4' => _x( 'W', 'Wednesday initial', 'ayecode-connect' ),
2281
+                'day_s1_5' => _x( 'T', 'Friday initial', 'ayecode-connect' ),
2282
+                'day_s1_6' => _x( 'F', 'Thursday initial', 'ayecode-connect' ),
2283
+                'day_s1_7' => _x( 'S', 'Saturday initial', 'ayecode-connect' ),
2284
+                'day_s2_1' => __( 'Su', 'ayecode-connect' ),
2285
+                'day_s2_2' => __( 'Mo', 'ayecode-connect' ),
2286
+                'day_s2_3' => __( 'Tu', 'ayecode-connect' ),
2287
+                'day_s2_4' => __( 'We', 'ayecode-connect' ),
2288
+                'day_s2_5' => __( 'Th', 'ayecode-connect' ),
2289
+                'day_s2_6' => __( 'Fr', 'ayecode-connect' ),
2290
+                'day_s2_7' => __( 'Sa', 'ayecode-connect' ),
2291
+                'day_s3_1' => __( 'Sun', 'ayecode-connect' ),
2292
+                'day_s3_2' => __( 'Mon', 'ayecode-connect' ),
2293
+                'day_s3_3' => __( 'Tue', 'ayecode-connect' ),
2294
+                'day_s3_4' => __( 'Wed', 'ayecode-connect' ),
2295
+                'day_s3_5' => __( 'Thu', 'ayecode-connect' ),
2296
+                'day_s3_6' => __( 'Fri', 'ayecode-connect' ),
2297
+                'day_s3_7' => __( 'Sat', 'ayecode-connect' ),
2298
+                'day_s5_1' => __( 'Sunday', 'ayecode-connect' ),
2299
+                'day_s5_2' => __( 'Monday', 'ayecode-connect' ),
2300
+                'day_s5_3' => __( 'Tuesday', 'ayecode-connect' ),
2301
+                'day_s5_4' => __( 'Wednesday', 'ayecode-connect' ),
2302
+                'day_s5_5' => __( 'Thursday', 'ayecode-connect' ),
2303
+                'day_s5_6' => __( 'Friday', 'ayecode-connect' ),
2304
+                'day_s5_7' => __( 'Saturday', 'ayecode-connect' ),
2305
+                'am_lower' => __( 'am', 'ayecode-connect' ),
2306
+                'pm_lower' => __( 'pm', 'ayecode-connect' ),
2307
+                'am_upper' => __( 'AM', 'ayecode-connect' ),
2308
+                'pm_upper' => __( 'PM', 'ayecode-connect' ),
2309
+                'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
2310
+                'time_24hr' => false,
2311
+                'year' => __( 'Year', 'ayecode-connect' ),
2312
+                'hour' => __( 'Hour', 'ayecode-connect' ),
2313
+                'minute' => __( 'Minute', 'ayecode-connect' ),
2314
+                'weekAbbreviation' => __( 'Wk', 'ayecode-connect' ),
2315
+                'rangeSeparator' => __( ' to ', 'ayecode-connect' ),
2316
+                'scrollTitle' => __( 'Scroll to increment', 'ayecode-connect' ),
2317
+                'toggleTitle' => __( 'Click to toggle', 'ayecode-connect' )
2318
+            );
2319
+
2320
+            return apply_filters( 'ayecode_ui_calendar_params', $params );
2321
+        }
2322
+
2323
+        /**
2324
+         * Flatpickr calendar localize.
2325
+         *
2326
+         * @since 0.1.44
2327
+         *
2328
+         * @return string Calendar locale.
2329
+         */
2330
+        public static function flatpickr_locale() {
2331
+            $params = self::calendar_params();
2332
+
2333
+            if ( is_string( $params ) ) {
2334
+                $params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
2335
+            } else {
2336
+                foreach ( (array) $params as $key => $value ) {
2337
+                    if ( ! is_scalar( $value ) ) {
2338
+                        continue;
2339
+                    }
2340
+
2341
+                    $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2342
+                }
2343
+            }
2344
+
2345
+            $day_s3 = array();
2346
+            $day_s5 = array();
2347 2347
 
2348
-			for ( $i = 1; $i <= 7; $i ++ ) {
2349
-				$day_s3[] = addslashes( $params[ 'day_s3_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2350
-				$day_s5[] = addslashes( $params[ 'day_s3_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2351
-			}
2348
+            for ( $i = 1; $i <= 7; $i ++ ) {
2349
+                $day_s3[] = addslashes( $params[ 'day_s3_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2350
+                $day_s5[] = addslashes( $params[ 'day_s3_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2351
+            }
2352 2352
 
2353
-			$month_s = array();
2354
-			$month_long = array();
2353
+            $month_s = array();
2354
+            $month_long = array();
2355 2355
 
2356
-			for ( $i = 1; $i <= 12; $i ++ ) {
2357
-				$month_s[] = addslashes( $params[ 'month_s_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2358
-				$month_long[] = addslashes( $params[ 'month_long_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2359
-			}
2356
+            for ( $i = 1; $i <= 12; $i ++ ) {
2357
+                $month_s[] = addslashes( $params[ 'month_s_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2358
+                $month_long[] = addslashes( $params[ 'month_long_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2359
+            }
2360 2360
 
2361
-			ob_start();
2362
-		if ( 0 ) { ?><script><?php } ?>
2361
+            ob_start();
2362
+        if ( 0 ) { ?><script><?php } ?>
2363 2363
                 {
2364 2364
                     weekdays: {
2365 2365
                         shorthand: ['<?php echo implode( "','", $day_s3 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'],
@@ -2398,189 +2398,189 @@  discard block
 block discarded – undo
2398 2398
                 }
2399 2399
 				<?php if ( 0 ) { ?></script><?php } ?>
2400 2400
 			<?php
2401
-			$locale = ob_get_clean();
2402
-
2403
-			return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
2404
-		}
2405
-
2406
-		/**
2407
-		 * Select2 JS params.
2408
-		 *
2409
-		 * @since 0.1.44
2410
-		 *
2411
-		 * @return array Select2 JS params.
2412
-		 */
2413
-		public static function select2_params() {
2414
-			$params = array(
2415
-				'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'ayecode-connect' ),
2416
-				'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'ayecode-connect' ),
2417
-				'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'ayecode-connect' ),
2418
-				'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'ayecode-connect' ),
2419
-				'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'ayecode-connect' ),
2420
-				'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'ayecode-connect' ),
2421
-				'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'ayecode-connect' ),
2422
-				'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'ayecode-connect' ),
2423
-				'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'ayecode-connect' ),
2424
-				'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'ayecode-connect' ),
2425
-				'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'ayecode-connect' )
2426
-			);
2427
-
2428
-			return apply_filters( 'ayecode_ui_select2_params', $params );
2429
-		}
2430
-
2431
-		/**
2432
-		 * Select2 JS localize.
2433
-		 *
2434
-		 * @since 0.1.44
2435
-		 *
2436
-		 * @return string Select2 JS locale.
2437
-		 */
2438
-		public static function select2_locale() {
2439
-			$params = self::select2_params();
2440
-
2441
-			foreach ( (array) $params as $key => $value ) {
2442
-				if ( ! is_scalar( $value ) ) {
2443
-					continue;
2444
-				}
2401
+            $locale = ob_get_clean();
2445 2402
 
2446
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2447
-			}
2448
-
2449
-			$locale = json_encode( $params );
2450
-
2451
-			return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
2452
-		}
2453
-
2454
-		/**
2455
-		 * Time ago JS localize.
2456
-		 *
2457
-		 * @since 0.1.47
2458
-		 *
2459
-		 * @return string Time ago JS locale.
2460
-		 */
2461
-		public static function timeago_locale() {
2462
-			$params = array(
2463
-				'prefix_ago' => '',
2464
-				'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'ayecode-connect' ),
2465
-				'prefix_after' => _x( 'after', 'time ago', 'ayecode-connect' ) . ' ',
2466
-				'suffix_after' => '',
2467
-				'seconds' => _x( 'less than a minute', 'time ago', 'ayecode-connect' ),
2468
-				'minute' => _x( 'about a minute', 'time ago', 'ayecode-connect' ),
2469
-				'minutes' => _x( '%d minutes', 'time ago', 'ayecode-connect' ),
2470
-				'hour' => _x( 'about an hour', 'time ago', 'ayecode-connect' ),
2471
-				'hours' => _x( 'about %d hours', 'time ago', 'ayecode-connect' ),
2472
-				'day' => _x( 'a day', 'time ago', 'ayecode-connect' ),
2473
-				'days' => _x( '%d days', 'time ago', 'ayecode-connect' ),
2474
-				'month' => _x( 'about a month', 'time ago', 'ayecode-connect' ),
2475
-				'months' => _x( '%d months', 'time ago', 'ayecode-connect' ),
2476
-				'year' => _x( 'about a year', 'time ago', 'ayecode-connect' ),
2477
-				'years' => _x( '%d years', 'time ago', 'ayecode-connect' ),
2478
-			);
2479
-
2480
-			$params = apply_filters( 'ayecode_ui_timeago_params', $params );
2481
-
2482
-			foreach ( (array) $params as $key => $value ) {
2483
-				if ( ! is_scalar( $value ) ) {
2484
-					continue;
2485
-				}
2403
+            return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
2404
+        }
2405
+
2406
+        /**
2407
+         * Select2 JS params.
2408
+         *
2409
+         * @since 0.1.44
2410
+         *
2411
+         * @return array Select2 JS params.
2412
+         */
2413
+        public static function select2_params() {
2414
+            $params = array(
2415
+                'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'ayecode-connect' ),
2416
+                'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'ayecode-connect' ),
2417
+                'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'ayecode-connect' ),
2418
+                'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'ayecode-connect' ),
2419
+                'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'ayecode-connect' ),
2420
+                'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'ayecode-connect' ),
2421
+                'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'ayecode-connect' ),
2422
+                'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'ayecode-connect' ),
2423
+                'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'ayecode-connect' ),
2424
+                'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'ayecode-connect' ),
2425
+                'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'ayecode-connect' )
2426
+            );
2427
+
2428
+            return apply_filters( 'ayecode_ui_select2_params', $params );
2429
+        }
2430
+
2431
+        /**
2432
+         * Select2 JS localize.
2433
+         *
2434
+         * @since 0.1.44
2435
+         *
2436
+         * @return string Select2 JS locale.
2437
+         */
2438
+        public static function select2_locale() {
2439
+            $params = self::select2_params();
2440
+
2441
+            foreach ( (array) $params as $key => $value ) {
2442
+                if ( ! is_scalar( $value ) ) {
2443
+                    continue;
2444
+                }
2445
+
2446
+                $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2447
+            }
2448
+
2449
+            $locale = json_encode( $params );
2450
+
2451
+            return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
2452
+        }
2453
+
2454
+        /**
2455
+         * Time ago JS localize.
2456
+         *
2457
+         * @since 0.1.47
2458
+         *
2459
+         * @return string Time ago JS locale.
2460
+         */
2461
+        public static function timeago_locale() {
2462
+            $params = array(
2463
+                'prefix_ago' => '',
2464
+                'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'ayecode-connect' ),
2465
+                'prefix_after' => _x( 'after', 'time ago', 'ayecode-connect' ) . ' ',
2466
+                'suffix_after' => '',
2467
+                'seconds' => _x( 'less than a minute', 'time ago', 'ayecode-connect' ),
2468
+                'minute' => _x( 'about a minute', 'time ago', 'ayecode-connect' ),
2469
+                'minutes' => _x( '%d minutes', 'time ago', 'ayecode-connect' ),
2470
+                'hour' => _x( 'about an hour', 'time ago', 'ayecode-connect' ),
2471
+                'hours' => _x( 'about %d hours', 'time ago', 'ayecode-connect' ),
2472
+                'day' => _x( 'a day', 'time ago', 'ayecode-connect' ),
2473
+                'days' => _x( '%d days', 'time ago', 'ayecode-connect' ),
2474
+                'month' => _x( 'about a month', 'time ago', 'ayecode-connect' ),
2475
+                'months' => _x( '%d months', 'time ago', 'ayecode-connect' ),
2476
+                'year' => _x( 'about a year', 'time ago', 'ayecode-connect' ),
2477
+                'years' => _x( '%d years', 'time ago', 'ayecode-connect' ),
2478
+            );
2479
+
2480
+            $params = apply_filters( 'ayecode_ui_timeago_params', $params );
2481
+
2482
+            foreach ( (array) $params as $key => $value ) {
2483
+                if ( ! is_scalar( $value ) ) {
2484
+                    continue;
2485
+                }
2486 2486
 
2487
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2488
-			}
2489
-
2490
-			$locale = json_encode( $params );
2491
-
2492
-			return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) );
2493
-		}
2494
-
2495
-		/**
2496
-		 * JavaScript Minifier
2497
-		 *
2498
-		 * @param $input
2499
-		 *
2500
-		 * @return mixed
2501
-		 */
2502
-		public static function minify_js($input) {
2503
-			if(trim($input) === "") return $input;
2504
-			return preg_replace(
2505
-				array(
2506
-					// Remove comment(s)
2507
-					'#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
2508
-					// Remove white-space(s) outside the string and regex
2509
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/)|\/(?!\/)[^\n\r]*?\/(?=[\s.,;]|[gimuy]|$))|\s*([!%&*\(\)\-=+\[\]\{\}|;:,.<>?\/])\s*#s',
2510
-					// Remove the last semicolon
2511
-					'#;+\}#',
2512
-					// Minify object attribute(s) except JSON attribute(s). From `{'foo':'bar'}` to `{foo:'bar'}`
2513
-					'#([\{,])([\'])(\d+|[a-z_][a-z0-9_]*)\2(?=\:)#i',
2514
-					// --ibid. From `foo['bar']` to `foo.bar`
2515
-					'#([a-z0-9_\)\]])\[([\'"])([a-z_][a-z0-9_]*)\2\]#i'
2516
-				),
2517
-				array(
2518
-					'$1',
2519
-					'$1$2',
2520
-					'}',
2521
-					'$1$3',
2522
-					'$1.$3'
2523
-				),
2524
-				$input);
2525
-		}
2526
-
2527
-		/**
2528
-		 * Minify CSS
2529
-		 *
2530
-		 * @param $input
2531
-		 *
2532
-		 * @return mixed
2533
-		 */
2534
-		public static function minify_css($input) {
2535
-			if(trim($input) === "") return $input;
2536
-			return preg_replace(
2537
-				array(
2538
-					// Remove comment(s)
2539
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')|\/\*(?!\!)(?>.*?\*\/)|^\s*|\s*$#s',
2540
-					// Remove unused white-space(s)
2541
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/))|\s*+;\s*+(})\s*+|\s*+([*$~^|]?+=|[{};,>~]|\s(?![0-9\.])|!important\b)\s*+|([[(:])\s++|\s++([])])|\s++(:)\s*+(?!(?>[^{}"\']++|"(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')*+{)|^\s++|\s++\z|(\s)\s+#si',
2542
-					// Replace `0(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)` with `0`
2543
-					'#(?<=[\s:])(0)(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)#si',
2544
-					// Replace `:0 0 0 0` with `:0`
2545
-					'#:(0\s+0|0\s+0\s+0\s+0)(?=[;\}]|\!important)#i',
2546
-					// Replace `background-position:0` with `background-position:0 0`
2547
-					'#(background-position):0(?=[;\}])#si',
2548
-					// Replace `0.6` with `.6`, but only when preceded by `:`, `,`, `-` or a white-space
2549
-					'#(?<=[\s:,\-])0+\.(\d+)#s',
2550
-					// Minify string value
2551
-					'#(\/\*(?>.*?\*\/))|(?<!content\:)([\'"])([a-z_][a-z0-9\-_]*?)\2(?=[\s\{\}\];,])#si',
2552
-					'#(\/\*(?>.*?\*\/))|(\burl\()([\'"])([^\s]+?)\3(\))#si',
2553
-					// Minify HEX color code
2554
-					'#(?<=[\s:,\-]\#)([a-f0-6]+)\1([a-f0-6]+)\2([a-f0-6]+)\3#i',
2555
-					// Replace `(border|outline):none` with `(border|outline):0`
2556
-					'#(?<=[\{;])(border|outline):none(?=[;\}\!])#',
2557
-					// Remove empty selector(s)
2558
-					'#(\/\*(?>.*?\*\/))|(^|[\{\}])(?:[^\s\{\}]+)\{\}#s'
2559
-				),
2560
-				array(
2561
-					'$1',
2562
-					'$1$2$3$4$5$6$7',
2563
-					'$1',
2564
-					':0',
2565
-					'$1:0 0',
2566
-					'.$1',
2567
-					'$1$3',
2568
-					'$1$2$4$5',
2569
-					'$1$2$3',
2570
-					'$1:0',
2571
-					'$1$2'
2572
-				),
2573
-				$input);
2574
-		}
2575
-
2576
-		/**
2577
-		 * Get the conditional fields JavaScript.
2578
-		 *
2579
-		 * @return mixed
2580
-		 */
2581
-		public function conditional_fields_js() {
2582
-			ob_start();
2583
-			?>
2487
+                $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2488
+            }
2489
+
2490
+            $locale = json_encode( $params );
2491
+
2492
+            return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) );
2493
+        }
2494
+
2495
+        /**
2496
+         * JavaScript Minifier
2497
+         *
2498
+         * @param $input
2499
+         *
2500
+         * @return mixed
2501
+         */
2502
+        public static function minify_js($input) {
2503
+            if(trim($input) === "") return $input;
2504
+            return preg_replace(
2505
+                array(
2506
+                    // Remove comment(s)
2507
+                    '#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
2508
+                    // Remove white-space(s) outside the string and regex
2509
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/)|\/(?!\/)[^\n\r]*?\/(?=[\s.,;]|[gimuy]|$))|\s*([!%&*\(\)\-=+\[\]\{\}|;:,.<>?\/])\s*#s',
2510
+                    // Remove the last semicolon
2511
+                    '#;+\}#',
2512
+                    // Minify object attribute(s) except JSON attribute(s). From `{'foo':'bar'}` to `{foo:'bar'}`
2513
+                    '#([\{,])([\'])(\d+|[a-z_][a-z0-9_]*)\2(?=\:)#i',
2514
+                    // --ibid. From `foo['bar']` to `foo.bar`
2515
+                    '#([a-z0-9_\)\]])\[([\'"])([a-z_][a-z0-9_]*)\2\]#i'
2516
+                ),
2517
+                array(
2518
+                    '$1',
2519
+                    '$1$2',
2520
+                    '}',
2521
+                    '$1$3',
2522
+                    '$1.$3'
2523
+                ),
2524
+                $input);
2525
+        }
2526
+
2527
+        /**
2528
+         * Minify CSS
2529
+         *
2530
+         * @param $input
2531
+         *
2532
+         * @return mixed
2533
+         */
2534
+        public static function minify_css($input) {
2535
+            if(trim($input) === "") return $input;
2536
+            return preg_replace(
2537
+                array(
2538
+                    // Remove comment(s)
2539
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')|\/\*(?!\!)(?>.*?\*\/)|^\s*|\s*$#s',
2540
+                    // Remove unused white-space(s)
2541
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/))|\s*+;\s*+(})\s*+|\s*+([*$~^|]?+=|[{};,>~]|\s(?![0-9\.])|!important\b)\s*+|([[(:])\s++|\s++([])])|\s++(:)\s*+(?!(?>[^{}"\']++|"(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')*+{)|^\s++|\s++\z|(\s)\s+#si',
2542
+                    // Replace `0(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)` with `0`
2543
+                    '#(?<=[\s:])(0)(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)#si',
2544
+                    // Replace `:0 0 0 0` with `:0`
2545
+                    '#:(0\s+0|0\s+0\s+0\s+0)(?=[;\}]|\!important)#i',
2546
+                    // Replace `background-position:0` with `background-position:0 0`
2547
+                    '#(background-position):0(?=[;\}])#si',
2548
+                    // Replace `0.6` with `.6`, but only when preceded by `:`, `,`, `-` or a white-space
2549
+                    '#(?<=[\s:,\-])0+\.(\d+)#s',
2550
+                    // Minify string value
2551
+                    '#(\/\*(?>.*?\*\/))|(?<!content\:)([\'"])([a-z_][a-z0-9\-_]*?)\2(?=[\s\{\}\];,])#si',
2552
+                    '#(\/\*(?>.*?\*\/))|(\burl\()([\'"])([^\s]+?)\3(\))#si',
2553
+                    // Minify HEX color code
2554
+                    '#(?<=[\s:,\-]\#)([a-f0-6]+)\1([a-f0-6]+)\2([a-f0-6]+)\3#i',
2555
+                    // Replace `(border|outline):none` with `(border|outline):0`
2556
+                    '#(?<=[\{;])(border|outline):none(?=[;\}\!])#',
2557
+                    // Remove empty selector(s)
2558
+                    '#(\/\*(?>.*?\*\/))|(^|[\{\}])(?:[^\s\{\}]+)\{\}#s'
2559
+                ),
2560
+                array(
2561
+                    '$1',
2562
+                    '$1$2$3$4$5$6$7',
2563
+                    '$1',
2564
+                    ':0',
2565
+                    '$1:0 0',
2566
+                    '.$1',
2567
+                    '$1$3',
2568
+                    '$1$2$4$5',
2569
+                    '$1$2$3',
2570
+                    '$1:0',
2571
+                    '$1$2'
2572
+                ),
2573
+                $input);
2574
+        }
2575
+
2576
+        /**
2577
+         * Get the conditional fields JavaScript.
2578
+         *
2579
+         * @return mixed
2580
+         */
2581
+        public function conditional_fields_js() {
2582
+            ob_start();
2583
+            ?>
2584 2584
             <script>
2585 2585
                 /**
2586 2586
                  * Conditional Fields
@@ -3112,235 +3112,235 @@  discard block
 block discarded – undo
3112 3112
 				<?php do_action( 'aui_conditional_fields_js', $this ); ?>
3113 3113
             </script>
3114 3114
 			<?php
3115
-			$output = ob_get_clean();
3116
-
3117
-			return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) );
3118
-		}
3119
-
3120
-		/**
3121
-		 * Check if block editor page.
3122
-		 *
3123
-		 * @since 0.2.27
3124
-		 *
3125
-		 * @return bool
3126
-		 */
3127
-		public static function is_block_editor() {
3128
-			if ( is_admin() ) {
3129
-				$current_screen = function_exists('get_current_screen' ) ? get_current_screen() : array();
3130
-
3131
-				if ( ! empty( $current_screen ) && $current_screen->is_block_editor() ) {
3132
-					return true;
3133
-				}
3134
-			}
3135
-
3136
-			return false;
3137
-		}
3138
-
3139
-		/**
3140
-		 * Checks if the current call is a ajax call to get the block content.
3141
-		 *
3142
-		 * This can be used in your widget to return different content as the block content.
3143
-		 *
3144
-		 * @since 0.2.27
3145
-		 *
3146
-		 * @return bool
3147
-		 */
3148
-		public static function is_block_content_call() {
3149
-			$result = false;
3150
-			if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
3151
-				$result = true;
3152
-			}
3153
-
3154
-			return $result;
3155
-		}
3156
-
3157
-		/**
3158
-		 * Tests if the current output is inside a Divi preview.
3159
-		 *
3160
-		 * @since 0.2.27
3161
-		 *
3162
-		 * @return bool
3163
-		 */
3164
-		public static function is_divi_preview() {
3165
-			$result = false;
3166
-			if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
3167
-				$result = true;
3168
-			}
3169
-
3170
-			return $result;
3171
-		}
3172
-
3173
-		/**
3174
-		 * Tests if the current output is inside a elementor preview.
3175
-		 *
3176
-		 *
3177
-		 * @since 0.2.27
3178
-		 *
3179
-		 * @return bool
3180
-		 */
3181
-		public static function is_elementor_preview() {
3182
-			$result = false;
3183
-			if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
3184
-				$result = true;
3185
-			}
3186
-
3187
-			return $result;
3188
-		}
3189
-
3190
-		/**
3191
-		 * Tests if the current output is inside a Beaver builder preview.
3192
-		 *
3193
-		 * @since 0.2.27
3194
-		 *
3195
-		 * @return bool
3196
-		 */
3197
-		public static function is_beaver_preview() {
3198
-			$result = false;
3199
-			if ( isset( $_REQUEST['fl_builder'] ) ) {
3200
-				$result = true;
3201
-			}
3202
-
3203
-			return $result;
3204
-		}
3205
-
3206
-		/**
3207
-		 * Tests if the current output is inside a siteorigin builder preview.
3208
-		 *
3209
-		 * @since 0.2.27
3210
-		 *
3211
-		 * @return bool
3212
-		 */
3213
-		public static function is_siteorigin_preview() {
3214
-			$result = false;
3215
-			if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
3216
-				$result = true;
3217
-			}
3218
-
3219
-			return $result;
3220
-		}
3221
-
3222
-		/**
3223
-		 * Tests if the current output is inside a cornerstone builder preview.
3224
-		 *
3225
-		 * @since 0.2.27
3226
-		 *
3227
-		 * @return bool
3228
-		 */
3229
-		public static function is_cornerstone_preview() {
3230
-			$result = false;
3231
-			if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
3232
-				$result = true;
3233
-			}
3234
-
3235
-			return $result;
3236
-		}
3237
-
3238
-		/**
3239
-		 * Tests if the current output is inside a fusion builder preview.
3240
-		 *
3241
-		 * @return bool
3242
-		 *@since 1.1.0
3243
-		 */
3244
-		public static function is_fusion_preview() {
3245
-			$result = false;
3246
-			if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
3247
-				$result = true;
3248
-			}
3249
-
3250
-			return $result;
3251
-		}
3252
-
3253
-		/**
3254
-		 * Tests if the current output is inside a Oxygen builder preview.
3255
-		 *
3256
-		 * @return bool
3257
-		 *@since 1.0.18
3258
-		 */
3259
-		public static function is_oxygen_preview() {
3260
-			$result = false;
3261
-			if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
3262
-				$result = true;
3263
-			}
3264
-
3265
-			return $result;
3266
-		}
3267
-
3268
-		/**
3269
-		 * Check for Kallyas theme Zion builder preview.
3270
-		 *
3271
-		 * @since 0.2.27
3272
-		 *
3273
-		 * @return bool
3274
-		 */
3275
-		public static function is_kallyas_zion_preview() {
3276
-			$result = false;
3277
-
3278
-			if ( function_exists( 'znhg_kallyas_theme_config' ) && ! empty( $_REQUEST['zn_pb_edit'] ) ) {
3279
-				$result = true;
3280
-			}
3281
-
3282
-			return $result;
3283
-		}
3284
-
3285
-		/**
3286
-		 * Check for Bricks theme builder preview.
3287
-		 *
3288
-		 * @since 0.2.27
3289
-		 *
3290
-		 * @return bool
3291
-		 */
3292
-		public static function is_bricks_preview() {
3293
-			$result = false;
3294
-
3295
-			if ( function_exists( 'bricks_is_builder' ) && ( bricks_is_builder() || bricks_is_builder_call() ) ) {
3296
-				$result = true;
3297
-			}
3298
-
3299
-			return $result;
3300
-		}
3301
-
3302
-		/**
3303
-		 * General function to check if we are in a preview situation.
3304
-		 *
3305
-		 * @since 0.2.27
3306
-		 *
3307
-		 * @return bool
3308
-		 */
3309
-		public static function is_preview() {
3310
-			$preview = false;
3311
-
3312
-			if ( self::is_block_editor() ) {
3313
-				return true;
3314
-			}
3315
-
3316
-			if( self::is_block_content_call() ) {
3317
-				$preview = true;
3318
-			} elseif ( self::is_divi_preview() ) {
3319
-				$preview = true;
3320
-			} elseif ( self::is_elementor_preview() ) {
3321
-				$preview = true;
3322
-			} elseif ( self::is_beaver_preview() ) {
3323
-				$preview = true;
3324
-			} elseif ( self::is_siteorigin_preview() ) {
3325
-				$preview = true;
3326
-			} elseif ( self::is_cornerstone_preview() ) {
3327
-				$preview = true;
3328
-			} elseif ( self::is_fusion_preview() ) {
3329
-				$preview = true;
3330
-			} elseif ( self::is_oxygen_preview() ) {
3331
-				$preview = true;
3332
-			} elseif( self::is_kallyas_zion_preview() ) {
3333
-				$preview = true;
3334
-			} elseif( self::is_bricks_preview() ) {
3335
-				$preview = true;
3336
-			}
3337
-
3338
-			return $preview;
3339
-		}
3340
-	}
3341
-
3342
-	/**
3343
-	 * Run the class if found.
3344
-	 */
3345
-	AyeCode_UI_Settings::instance();
3115
+            $output = ob_get_clean();
3116
+
3117
+            return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) );
3118
+        }
3119
+
3120
+        /**
3121
+         * Check if block editor page.
3122
+         *
3123
+         * @since 0.2.27
3124
+         *
3125
+         * @return bool
3126
+         */
3127
+        public static function is_block_editor() {
3128
+            if ( is_admin() ) {
3129
+                $current_screen = function_exists('get_current_screen' ) ? get_current_screen() : array();
3130
+
3131
+                if ( ! empty( $current_screen ) && $current_screen->is_block_editor() ) {
3132
+                    return true;
3133
+                }
3134
+            }
3135
+
3136
+            return false;
3137
+        }
3138
+
3139
+        /**
3140
+         * Checks if the current call is a ajax call to get the block content.
3141
+         *
3142
+         * This can be used in your widget to return different content as the block content.
3143
+         *
3144
+         * @since 0.2.27
3145
+         *
3146
+         * @return bool
3147
+         */
3148
+        public static function is_block_content_call() {
3149
+            $result = false;
3150
+            if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
3151
+                $result = true;
3152
+            }
3153
+
3154
+            return $result;
3155
+        }
3156
+
3157
+        /**
3158
+         * Tests if the current output is inside a Divi preview.
3159
+         *
3160
+         * @since 0.2.27
3161
+         *
3162
+         * @return bool
3163
+         */
3164
+        public static function is_divi_preview() {
3165
+            $result = false;
3166
+            if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
3167
+                $result = true;
3168
+            }
3169
+
3170
+            return $result;
3171
+        }
3172
+
3173
+        /**
3174
+         * Tests if the current output is inside a elementor preview.
3175
+         *
3176
+         *
3177
+         * @since 0.2.27
3178
+         *
3179
+         * @return bool
3180
+         */
3181
+        public static function is_elementor_preview() {
3182
+            $result = false;
3183
+            if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
3184
+                $result = true;
3185
+            }
3186
+
3187
+            return $result;
3188
+        }
3189
+
3190
+        /**
3191
+         * Tests if the current output is inside a Beaver builder preview.
3192
+         *
3193
+         * @since 0.2.27
3194
+         *
3195
+         * @return bool
3196
+         */
3197
+        public static function is_beaver_preview() {
3198
+            $result = false;
3199
+            if ( isset( $_REQUEST['fl_builder'] ) ) {
3200
+                $result = true;
3201
+            }
3202
+
3203
+            return $result;
3204
+        }
3205
+
3206
+        /**
3207
+         * Tests if the current output is inside a siteorigin builder preview.
3208
+         *
3209
+         * @since 0.2.27
3210
+         *
3211
+         * @return bool
3212
+         */
3213
+        public static function is_siteorigin_preview() {
3214
+            $result = false;
3215
+            if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
3216
+                $result = true;
3217
+            }
3218
+
3219
+            return $result;
3220
+        }
3221
+
3222
+        /**
3223
+         * Tests if the current output is inside a cornerstone builder preview.
3224
+         *
3225
+         * @since 0.2.27
3226
+         *
3227
+         * @return bool
3228
+         */
3229
+        public static function is_cornerstone_preview() {
3230
+            $result = false;
3231
+            if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
3232
+                $result = true;
3233
+            }
3234
+
3235
+            return $result;
3236
+        }
3237
+
3238
+        /**
3239
+         * Tests if the current output is inside a fusion builder preview.
3240
+         *
3241
+         * @return bool
3242
+         *@since 1.1.0
3243
+         */
3244
+        public static function is_fusion_preview() {
3245
+            $result = false;
3246
+            if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
3247
+                $result = true;
3248
+            }
3249
+
3250
+            return $result;
3251
+        }
3252
+
3253
+        /**
3254
+         * Tests if the current output is inside a Oxygen builder preview.
3255
+         *
3256
+         * @return bool
3257
+         *@since 1.0.18
3258
+         */
3259
+        public static function is_oxygen_preview() {
3260
+            $result = false;
3261
+            if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
3262
+                $result = true;
3263
+            }
3264
+
3265
+            return $result;
3266
+        }
3267
+
3268
+        /**
3269
+         * Check for Kallyas theme Zion builder preview.
3270
+         *
3271
+         * @since 0.2.27
3272
+         *
3273
+         * @return bool
3274
+         */
3275
+        public static function is_kallyas_zion_preview() {
3276
+            $result = false;
3277
+
3278
+            if ( function_exists( 'znhg_kallyas_theme_config' ) && ! empty( $_REQUEST['zn_pb_edit'] ) ) {
3279
+                $result = true;
3280
+            }
3281
+
3282
+            return $result;
3283
+        }
3284
+
3285
+        /**
3286
+         * Check for Bricks theme builder preview.
3287
+         *
3288
+         * @since 0.2.27
3289
+         *
3290
+         * @return bool
3291
+         */
3292
+        public static function is_bricks_preview() {
3293
+            $result = false;
3294
+
3295
+            if ( function_exists( 'bricks_is_builder' ) && ( bricks_is_builder() || bricks_is_builder_call() ) ) {
3296
+                $result = true;
3297
+            }
3298
+
3299
+            return $result;
3300
+        }
3301
+
3302
+        /**
3303
+         * General function to check if we are in a preview situation.
3304
+         *
3305
+         * @since 0.2.27
3306
+         *
3307
+         * @return bool
3308
+         */
3309
+        public static function is_preview() {
3310
+            $preview = false;
3311
+
3312
+            if ( self::is_block_editor() ) {
3313
+                return true;
3314
+            }
3315
+
3316
+            if( self::is_block_content_call() ) {
3317
+                $preview = true;
3318
+            } elseif ( self::is_divi_preview() ) {
3319
+                $preview = true;
3320
+            } elseif ( self::is_elementor_preview() ) {
3321
+                $preview = true;
3322
+            } elseif ( self::is_beaver_preview() ) {
3323
+                $preview = true;
3324
+            } elseif ( self::is_siteorigin_preview() ) {
3325
+                $preview = true;
3326
+            } elseif ( self::is_cornerstone_preview() ) {
3327
+                $preview = true;
3328
+            } elseif ( self::is_fusion_preview() ) {
3329
+                $preview = true;
3330
+            } elseif ( self::is_oxygen_preview() ) {
3331
+                $preview = true;
3332
+            } elseif( self::is_kallyas_zion_preview() ) {
3333
+                $preview = true;
3334
+            } elseif( self::is_bricks_preview() ) {
3335
+                $preview = true;
3336
+            }
3337
+
3338
+            return $preview;
3339
+        }
3340
+    }
3341
+
3342
+    /**
3343
+     * Run the class if found.
3344
+     */
3345
+    AyeCode_UI_Settings::instance();
3346 3346
 }
3347 3347
\ No newline at end of file
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.2.28";
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.2.28";
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-super-duper/wp-super-duper.php 1 patch
Indentation   +2714 added lines, -2714 removed lines patch added patch discarded remove patch
@@ -1,300 +1,300 @@  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.2.14' );
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
-
59
-			// nested blocks can't work as a widget
60
-			if(!empty($this->options['nested-block'])){
61
-				if(empty($this->options['output_types'])){
62
-					$this->options['output_types'] = array('shortcode','block');
63
-				}elseif (($key = array_search('widget', $this->options['output_types'])) !== false) {
64
-					unset($this->options['output_types'][$key]);
65
-				}
66
-			}
67
-
68
-			// init parent
69
-			if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
70
-				parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] );
71
-			}
72
-
73
-
74
-			if ( isset( $options['class_name'] ) ) {
75
-				// register widget
76
-				$this->class_name = $options['class_name'];
77
-
78
-				// register shortcode, this needs to be done even for blocks and widgets
79
-				$this->register_shortcode();
80
-
81
-
82
-				// Fusion Builder (avada) support
83
-				if ( function_exists( 'fusion_builder_map' ) ) {
84
-					add_action( 'init', array( $this, 'register_fusion_element' ) );
85
-				}
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' ) );
90
-				}
91
-			}
92
-
93
-			// add the CSS and JS we need ONCE
94
-			global $sd_widget_scripts;
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() );
100
-
101
-				// maybe add elementor editor styles
102
-				add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) );
103
-
104
-				$sd_widget_scripts = true;
105
-
106
-				// add shortcode insert button once
107
-				add_action( 'media_buttons', array( $this, 'wp_media_buttons' ), 1 );
108
-				add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
109
-				// generatepress theme sections compatibility
110
-				if ( function_exists( 'generate_sections_sections_metabox' ) ) {
111
-					add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
112
-				}
113
-				/* Load script on Divi theme builder page */
114
-				if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) {
115
-					add_thickbox();
116
-					add_action( 'admin_footer', array( $this, 'shortcode_insert_button_script' ) );
117
-				}
118
-
119
-				if ( $this->is_preview() ) {
120
-					add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
121
-					// this makes the insert button work for elementor
122
-					add_action( 'elementor/editor/after_enqueue_scripts', array(
123
-						$this,
124
-						'shortcode_insert_button_script'
125
-					) ); // for elementor
126
-				}
127
-				// this makes the insert button work for cornerstone
128
-				add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) );
129
-
130
-				add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) );
131
-				add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
132
-
133
-				// add generator text to head
134
-				add_action( 'admin_head', array( $this, 'generator' ), 99 );
135
-				add_action( 'wp_head', array( $this, 'generator' ), 99 );
136
-			}
137
-
138
-			do_action( 'wp_super_duper_widget_init', $options, $this );
139
-		}
140
-
141
-		/**
142
-		 * The register widget function
143
-		 * @return void
144
-		 */
145
-		public function _register() {
146
-			if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
147
-				parent::_register();
148
-			}
149
-		}
150
-
151
-		/**
152
-		 * Add our widget CSS to elementor editor.
153
-		 */
154
-		public function elementor_editor_styles() {
155
-			wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) );
156
-		}
157
-
158
-		public function register_fusion_element() {
159
-
160
-			$options = $this->options;
161
-
162
-			if ( $this->base_id ) {
163
-
164
-				$params = $this->get_fusion_params();
165
-
166
-				$args = array(
167
-					'name'            => $options['name'],
168
-					'shortcode'       => $this->base_id,
169
-					'icon'            => $options['block-icon'] ? $options['block-icon'] : 'far fa-square',
170
-					'allow_generator' => true,
171
-				);
172
-
173
-				if ( ! empty( $params ) ) {
174
-					$args['params'] = $params;
175
-				}
176
-
177
-				fusion_builder_map( $args );
178
-			}
179
-
180
-		}
181
-
182
-		public function get_fusion_params() {
183
-			$params    = array();
184
-			$arguments = $this->get_arguments();
185
-
186
-			if ( ! empty( $arguments ) ) {
187
-				foreach ( $arguments as $key => $val ) {
188
-					$param = array();
189
-					// type
190
-					$param['type'] = str_replace(
191
-						array(
192
-							"text",
193
-							"number",
194
-							"email",
195
-							"color",
196
-							"checkbox"
197
-						),
198
-						array(
199
-							"textfield",
200
-							"textfield",
201
-							"textfield",
202
-							"colorpicker",
203
-							"select",
8
+    define( 'SUPER_DUPER_VER', '1.2.14' );
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
+
59
+            // nested blocks can't work as a widget
60
+            if(!empty($this->options['nested-block'])){
61
+                if(empty($this->options['output_types'])){
62
+                    $this->options['output_types'] = array('shortcode','block');
63
+                }elseif (($key = array_search('widget', $this->options['output_types'])) !== false) {
64
+                    unset($this->options['output_types'][$key]);
65
+                }
66
+            }
67
+
68
+            // init parent
69
+            if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
70
+                parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] );
71
+            }
72
+
73
+
74
+            if ( isset( $options['class_name'] ) ) {
75
+                // register widget
76
+                $this->class_name = $options['class_name'];
77
+
78
+                // register shortcode, this needs to be done even for blocks and widgets
79
+                $this->register_shortcode();
80
+
81
+
82
+                // Fusion Builder (avada) support
83
+                if ( function_exists( 'fusion_builder_map' ) ) {
84
+                    add_action( 'init', array( $this, 'register_fusion_element' ) );
85
+                }
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' ) );
90
+                }
91
+            }
92
+
93
+            // add the CSS and JS we need ONCE
94
+            global $sd_widget_scripts;
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() );
100
+
101
+                // maybe add elementor editor styles
102
+                add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) );
103
+
104
+                $sd_widget_scripts = true;
105
+
106
+                // add shortcode insert button once
107
+                add_action( 'media_buttons', array( $this, 'wp_media_buttons' ), 1 );
108
+                add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
109
+                // generatepress theme sections compatibility
110
+                if ( function_exists( 'generate_sections_sections_metabox' ) ) {
111
+                    add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
112
+                }
113
+                /* Load script on Divi theme builder page */
114
+                if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) {
115
+                    add_thickbox();
116
+                    add_action( 'admin_footer', array( $this, 'shortcode_insert_button_script' ) );
117
+                }
118
+
119
+                if ( $this->is_preview() ) {
120
+                    add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
121
+                    // this makes the insert button work for elementor
122
+                    add_action( 'elementor/editor/after_enqueue_scripts', array(
123
+                        $this,
124
+                        'shortcode_insert_button_script'
125
+                    ) ); // for elementor
126
+                }
127
+                // this makes the insert button work for cornerstone
128
+                add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) );
129
+
130
+                add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) );
131
+                add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
132
+
133
+                // add generator text to head
134
+                add_action( 'admin_head', array( $this, 'generator' ), 99 );
135
+                add_action( 'wp_head', array( $this, 'generator' ), 99 );
136
+            }
137
+
138
+            do_action( 'wp_super_duper_widget_init', $options, $this );
139
+        }
204 140
 
205
-						),
206
-						$val['type'] );
141
+        /**
142
+         * The register widget function
143
+         * @return void
144
+         */
145
+        public function _register() {
146
+            if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
147
+                parent::_register();
148
+            }
149
+        }
207 150
 
208
-					// multiselect
209
-					if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
210
-						$param['type']     = 'multiple_select';
211
-						$param['multiple'] = true;
212
-					}
151
+        /**
152
+         * Add our widget CSS to elementor editor.
153
+         */
154
+        public function elementor_editor_styles() {
155
+            wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) );
156
+        }
213 157
 
214
-					// heading
215
-					$param['heading'] = isset( $val['title'] ) ? $val['title'] : '';
158
+        public function register_fusion_element() {
216 159
 
217
-					// description
218
-					$param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
160
+            $options = $this->options;
219 161
 
220
-					// param_name
221
-					$param['param_name'] = $key;
162
+            if ( $this->base_id ) {
222 163
 
223
-					// Default
224
-					$param['default'] = isset( $val['default'] ) ? $val['default'] : '';
164
+                $params = $this->get_fusion_params();
225 165
 
226
-					// Group
227
-					if ( isset( $val['group'] ) ) {
228
-						$param['group'] = $val['group'];
229
-					}
166
+                $args = array(
167
+                    'name'            => $options['name'],
168
+                    'shortcode'       => $this->base_id,
169
+                    'icon'            => $options['block-icon'] ? $options['block-icon'] : 'far fa-square',
170
+                    'allow_generator' => true,
171
+                );
230 172
 
231
-					// value
232
-					if ( $val['type'] == 'checkbox' ) {
233
-						if ( isset( $val['default'] ) && $val['default'] == '0' ) {
234
-							unset( $param['default'] );
235
-						}
236
-						$param['value'] = array( '0' => __( "No", 'ayecode-connect' ), '1' => __( "Yes", 'ayecode-connect' ) );
237
-					} elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
238
-						$param['value'] = isset( $val['options'] ) ? $val['options'] : array();
239
-					} else {
240
-						$param['value'] = isset( $val['default'] ) ? $val['default'] : '';
241
-					}
173
+                if ( ! empty( $params ) ) {
174
+                    $args['params'] = $params;
175
+                }
242 176
 
243
-					// setup the param
244
-					$params[] = $param;
177
+                fusion_builder_map( $args );
178
+            }
245 179
 
246
-				}
247
-			}
180
+        }
248 181
 
182
+        public function get_fusion_params() {
183
+            $params    = array();
184
+            $arguments = $this->get_arguments();
185
+
186
+            if ( ! empty( $arguments ) ) {
187
+                foreach ( $arguments as $key => $val ) {
188
+                    $param = array();
189
+                    // type
190
+                    $param['type'] = str_replace(
191
+                        array(
192
+                            "text",
193
+                            "number",
194
+                            "email",
195
+                            "color",
196
+                            "checkbox"
197
+                        ),
198
+                        array(
199
+                            "textfield",
200
+                            "textfield",
201
+                            "textfield",
202
+                            "colorpicker",
203
+                            "select",
204
+
205
+                        ),
206
+                        $val['type'] );
207
+
208
+                    // multiselect
209
+                    if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
210
+                        $param['type']     = 'multiple_select';
211
+                        $param['multiple'] = true;
212
+                    }
213
+
214
+                    // heading
215
+                    $param['heading'] = isset( $val['title'] ) ? $val['title'] : '';
216
+
217
+                    // description
218
+                    $param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
219
+
220
+                    // param_name
221
+                    $param['param_name'] = $key;
222
+
223
+                    // Default
224
+                    $param['default'] = isset( $val['default'] ) ? $val['default'] : '';
225
+
226
+                    // Group
227
+                    if ( isset( $val['group'] ) ) {
228
+                        $param['group'] = $val['group'];
229
+                    }
230
+
231
+                    // value
232
+                    if ( $val['type'] == 'checkbox' ) {
233
+                        if ( isset( $val['default'] ) && $val['default'] == '0' ) {
234
+                            unset( $param['default'] );
235
+                        }
236
+                        $param['value'] = array( '0' => __( "No", 'ayecode-connect' ), '1' => __( "Yes", 'ayecode-connect' ) );
237
+                    } elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
238
+                        $param['value'] = isset( $val['options'] ) ? $val['options'] : array();
239
+                    } else {
240
+                        $param['value'] = isset( $val['default'] ) ? $val['default'] : '';
241
+                    }
242
+
243
+                    // setup the param
244
+                    $params[] = $param;
245
+
246
+                }
247
+            }
248
+
249
+
250
+            return $params;
251
+        }
249 252
 
250
-			return $params;
251
-		}
253
+        /**
254
+         * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
255
+         */
256
+        public static function maybe_cornerstone_builder() {
257
+            if ( did_action( 'cornerstone_before_boot_app' ) ) {
258
+                self::shortcode_insert_button_script();
259
+            }
260
+        }
252 261
 
253
-		/**
254
-		 * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
255
-		 */
256
-		public static function maybe_cornerstone_builder() {
257
-			if ( did_action( 'cornerstone_before_boot_app' ) ) {
258
-				self::shortcode_insert_button_script();
259
-			}
260
-		}
262
+        /**
263
+         * A function to ge the shortcode builder picker html.
264
+         *
265
+         * @param string $editor_id
266
+         *
267
+         * @return string
268
+         */
269
+        public static function get_picker( $editor_id = '' ) {
261 270
 
262
-		/**
263
-		 * A function to ge the shortcode builder picker html.
264
-		 *
265
-		 * @param string $editor_id
266
-		 *
267
-		 * @return string
268
-		 */
269
-		public static function get_picker( $editor_id = '' ) {
270
-
271
-			ob_start();
272
-			if ( isset( $_POST['editor_id'] ) ) {
273
-				$editor_id = esc_attr( $_POST['editor_id'] );
274
-			} elseif ( isset( $_REQUEST['et_fb'] ) ) {
275
-				$editor_id = 'main_content_content_vb_tiny_mce';
276
-			}
271
+            ob_start();
272
+            if ( isset( $_POST['editor_id'] ) ) {
273
+                $editor_id = esc_attr( $_POST['editor_id'] );
274
+            } elseif ( isset( $_REQUEST['et_fb'] ) ) {
275
+                $editor_id = 'main_content_content_vb_tiny_mce';
276
+            }
277 277
 
278
-			global $sd_widgets;
278
+            global $sd_widgets;
279 279
 
280 280
 //			print_r($sd_widgets);exit;
281
-			?>
281
+            ?>
282 282
 
283 283
 			<div class="sd-shortcode-left-wrap">
284 284
 				<?php
285
-				ksort( $sd_widgets );
286
-				//				print_r($sd_widgets);exit;
287
-				if ( ! empty( $sd_widgets ) ) {
288
-					echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
289
-					echo "<option>" . __( 'Select shortcode', 'ayecode-connect' ) . "</option>";
290
-					foreach ( $sd_widgets as $shortcode => $class ) {
291
-						if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; }
292
-						echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
293
-					}
294
-					echo "</select>";
295
-
296
-				}
297
-				?>
285
+                ksort( $sd_widgets );
286
+                //				print_r($sd_widgets);exit;
287
+                if ( ! empty( $sd_widgets ) ) {
288
+                    echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
289
+                    echo "<option>" . __( 'Select shortcode', 'ayecode-connect' ) . "</option>";
290
+                    foreach ( $sd_widgets as $shortcode => $class ) {
291
+                        if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; }
292
+                        echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
293
+                    }
294
+                    echo "</select>";
295
+
296
+                }
297
+                ?>
298 298
 				<div class="sd-shortcode-settings"></div>
299 299
 
300 300
 			</div>
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 					<?php if ( $editor_id != '' ) { ?>
306 306
 						<button class="button sd-insert-shortcode-button"
307 307
 								onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) {
308
-									echo "'" . $editor_id . "'";
309
-								} ?>)"><?php _e( 'Insert shortcode', 'ayecode-connect' ); ?></button>
308
+                                    echo "'" . $editor_id . "'";
309
+                                } ?>)"><?php _e( 'Insert shortcode', 'ayecode-connect' ); ?></button>
310 310
 					<?php } ?>
311 311
 					<button class="button"
312 312
 							onclick="sd_copy_to_clipboard()"><?php _e( 'Copy shortcode' ); ?></button>
@@ -314,150 +314,150 @@  discard block
 block discarded – undo
314 314
 			</div>
315 315
 			<?php
316 316
 
317
-			$html = ob_get_clean();
318
-
319
-			if ( wp_doing_ajax() ) {
320
-				echo $html;
321
-				$should_die = true;
322
-
323
-				// some builder get the editor via ajax so we should not die on those occasions
324
-				$dont_die = array(
325
-					'parent_tag',// WP Bakery
326
-					'avia_request' // enfold
327
-				);
328
-
329
-				foreach ( $dont_die as $request ) {
330
-					if ( isset( $_REQUEST[ $request ] ) ) {
331
-						$should_die = false;
332
-					}
333
-				}
317
+            $html = ob_get_clean();
334 318
 
335
-				if ( $should_die ) {
336
-					wp_die();
337
-				}
319
+            if ( wp_doing_ajax() ) {
320
+                echo $html;
321
+                $should_die = true;
338 322
 
339
-			} else {
340
-				return $html;
341
-			}
323
+                // some builder get the editor via ajax so we should not die on those occasions
324
+                $dont_die = array(
325
+                    'parent_tag',// WP Bakery
326
+                    'avia_request' // enfold
327
+                );
342 328
 
343
-			return '';
329
+                foreach ( $dont_die as $request ) {
330
+                    if ( isset( $_REQUEST[ $request ] ) ) {
331
+                        $should_die = false;
332
+                    }
333
+                }
344 334
 
345
-		}
335
+                if ( $should_die ) {
336
+                    wp_die();
337
+                }
346 338
 
347
-		/**
348
-		 * Output the version in the header.
349
-		 */
350
-		public function generator() {
351
-			$file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) );
352
-			$plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) );
353
-
354
-			// Find source plugin/theme of SD
355
-			$source = array();
356
-			if ( strpos( $file, $plugins_dir ) !== false ) {
357
-				$source = explode( "/", plugin_basename( $file ) );
358
-			} else if ( function_exists( 'get_theme_root' ) ) {
359
-				$themes_dir = str_replace( array( "/", "\\" ), "/", realpath( get_theme_root() ) );
360
-
361
-				if ( strpos( $file, $themes_dir ) !== false ) {
362
-					$source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) );
363
-				}
364
-			}
339
+            } else {
340
+                return $html;
341
+            }
365 342
 
366
-			echo '<meta name="generator" content="WP Super Duper v' . esc_attr( $this->version ) . '"' . ( ! empty( $source[0] ) ? ' data-sd-source="' . esc_attr( $source[0] ) . '"' : '' ) . ' />';
367
-		}
343
+            return '';
368 344
 
369
-		/**
370
-		 * Get widget settings.
371
-		 *
372
-		 * @since 1.0.0
373
-		 */
374
-		public static function get_widget_settings() {
375
-			global $sd_widgets;
376
-
377
-			$shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : '';
378
-			if ( ! $shortcode ) {
379
-				wp_die();
380
-			}
381
-			$widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : '';
382
-			if ( ! $widget_args ) {
383
-				wp_die();
384
-			}
385
-			$class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
386
-			if ( ! $class_name ) {
387
-				wp_die();
388
-			}
345
+        }
389 346
 
390
-			// invoke an instance method
391
-			$widget = new $class_name;
347
+        /**
348
+         * Output the version in the header.
349
+         */
350
+        public function generator() {
351
+            $file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) );
352
+            $plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) );
353
+
354
+            // Find source plugin/theme of SD
355
+            $source = array();
356
+            if ( strpos( $file, $plugins_dir ) !== false ) {
357
+                $source = explode( "/", plugin_basename( $file ) );
358
+            } else if ( function_exists( 'get_theme_root' ) ) {
359
+                $themes_dir = str_replace( array( "/", "\\" ), "/", realpath( get_theme_root() ) );
360
+
361
+                if ( strpos( $file, $themes_dir ) !== false ) {
362
+                    $source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) );
363
+                }
364
+            }
365
+
366
+            echo '<meta name="generator" content="WP Super Duper v' . esc_attr( $this->version ) . '"' . ( ! empty( $source[0] ) ? ' data-sd-source="' . esc_attr( $source[0] ) . '"' : '' ) . ' />';
367
+        }
392 368
 
393
-			ob_start();
394
-			$widget->form( array() );
395
-			$form = ob_get_clean();
396
-			echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>";
397
-			echo "<style>" . $widget->widget_css() . "</style>";
398
-			echo "<script>" . $widget->widget_js() . "</script>";
399
-			?>
369
+        /**
370
+         * Get widget settings.
371
+         *
372
+         * @since 1.0.0
373
+         */
374
+        public static function get_widget_settings() {
375
+            global $sd_widgets;
376
+
377
+            $shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : '';
378
+            if ( ! $shortcode ) {
379
+                wp_die();
380
+            }
381
+            $widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : '';
382
+            if ( ! $widget_args ) {
383
+                wp_die();
384
+            }
385
+            $class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
386
+            if ( ! $class_name ) {
387
+                wp_die();
388
+            }
389
+
390
+            // invoke an instance method
391
+            $widget = new $class_name;
392
+
393
+            ob_start();
394
+            $widget->form( array() );
395
+            $form = ob_get_clean();
396
+            echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>";
397
+            echo "<style>" . $widget->widget_css() . "</style>";
398
+            echo "<script>" . $widget->widget_js() . "</script>";
399
+            ?>
400 400
 			<?php
401
-			wp_die();
402
-		}
403
-
404
-		/**
405
-		 * Insert shortcode builder button to classic editor (not inside Gutenberg, not needed).
406
-		 *
407
-		 * @param string $editor_id Optional. Shortcode editor id. Default null.
408
-		 * @param string $insert_shortcode_function Optional. Insert shortcode function. Default null.
409
-		 *
410
-		 *@since 1.0.0
411
-		 *
412
-		 */
413
-		public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
414
-			global $sd_widgets, $shortcode_insert_button_once;
415
-			if ( $shortcode_insert_button_once ) {
416
-				return;
417
-			}
418
-			add_thickbox();
419
-
420
-
421
-			/**
422
-			 * Cornerstone makes us play dirty tricks :/
423
-			 * 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.
424
-			 */
425
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
426
-				echo '<span id="insert-media-button">';
427
-			}
428
-
429
-			echo self::shortcode_button( 'this', 'true' );
430
-
431
-			// see opening note
432
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
433
-				echo '</span>'; // end #insert-media-button
434
-			}
435
-
436
-			// Add separate script for generatepress theme sections
437
-			if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
438
-			} else {
439
-				self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
440
-			}
401
+            wp_die();
402
+        }
441 403
 
442
-			$shortcode_insert_button_once = true;
443
-		}
404
+        /**
405
+         * Insert shortcode builder button to classic editor (not inside Gutenberg, not needed).
406
+         *
407
+         * @param string $editor_id Optional. Shortcode editor id. Default null.
408
+         * @param string $insert_shortcode_function Optional. Insert shortcode function. Default null.
409
+         *
410
+         *@since 1.0.0
411
+         *
412
+         */
413
+        public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
414
+            global $sd_widgets, $shortcode_insert_button_once;
415
+            if ( $shortcode_insert_button_once ) {
416
+                return;
417
+            }
418
+            add_thickbox();
419
+
420
+
421
+            /**
422
+             * Cornerstone makes us play dirty tricks :/
423
+             * 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.
424
+             */
425
+            if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
426
+                echo '<span id="insert-media-button">';
427
+            }
428
+
429
+            echo self::shortcode_button( 'this', 'true' );
430
+
431
+            // see opening note
432
+            if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
433
+                echo '</span>'; // end #insert-media-button
434
+            }
435
+
436
+            // Add separate script for generatepress theme sections
437
+            if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
438
+            } else {
439
+                self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
440
+            }
441
+
442
+            $shortcode_insert_button_once = true;
443
+        }
444 444
 
445
-		/**
446
-		 * Gets the shortcode insert button html.
447
-		 *
448
-		 * @param string $id
449
-		 * @param string $search_for_id
450
-		 *
451
-		 * @return mixed
452
-		 */
453
-		public static function shortcode_button( $id = '', $search_for_id = '' ) {
454
-			ob_start();
455
-			?>
445
+        /**
446
+         * Gets the shortcode insert button html.
447
+         *
448
+         * @param string $id
449
+         * @param string $search_for_id
450
+         *
451
+         * @return mixed
452
+         */
453
+        public static function shortcode_button( $id = '', $search_for_id = '' ) {
454
+            ob_start();
455
+            ?>
456 456
 			<span class="sd-lable-shortcode-inserter">
457 457
 				<a onclick="sd_ajax_get_picker(<?php echo $id;
458
-				if ( $search_for_id ) {
459
-					echo "," . $search_for_id;
460
-				} ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
458
+                if ( $search_for_id ) {
459
+                    echo "," . $search_for_id;
460
+                } ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
461 461
 				   class="thickbox button super-duper-content-open" title="Add Shortcode">
462 462
 					<span style="vertical-align: middle;line-height: 18px;font-size: 20px;"
463 463
 						  class="dashicons dashicons-screenoptions"></span>
@@ -468,21 +468,21 @@  discard block
 block discarded – undo
468 468
 			</span>
469 469
 
470 470
 			<?php
471
-			$html = ob_get_clean();
471
+            $html = ob_get_clean();
472 472
 
473
-			// remove line breaks so we can use it in js
474
-			return preg_replace( "/\r|\n/", "", trim( $html ) );
475
-		}
473
+            // remove line breaks so we can use it in js
474
+            return preg_replace( "/\r|\n/", "", trim( $html ) );
475
+        }
476 476
 
477
-		/**
478
-		 * Makes SD work with the siteOrigin page builder.
479
-		 *
480
-		 * @return mixed
481
-		 *@since 1.0.6
482
-		 */
483
-		public static function siteorigin_js() {
484
-			ob_start();
485
-			?>
477
+        /**
478
+         * Makes SD work with the siteOrigin page builder.
479
+         *
480
+         * @return mixed
481
+         *@since 1.0.6
482
+         */
483
+        public static function siteorigin_js() {
484
+            ob_start();
485
+            ?>
486 486
 			<script>
487 487
 				/**
488 488
 				 * Check a form to see what items should be shown or hidden.
@@ -558,29 +558,29 @@  discard block
 block discarded – undo
558 558
 				});
559 559
 			</script>
560 560
 			<?php
561
-			$output = ob_get_clean();
561
+            $output = ob_get_clean();
562 562
 
563
-			/*
563
+            /*
564 564
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
565 565
 			 */
566 566
 
567
-			return str_replace( array(
568
-				'<script>',
569
-				'</script>'
570
-			), '', $output );
571
-		}
567
+            return str_replace( array(
568
+                '<script>',
569
+                '</script>'
570
+            ), '', $output );
571
+        }
572 572
 
573
-		/**
574
-		 * Output the JS and CSS for the shortcode insert button.
575
-		 *
576
-		 * @param string $editor_id
577
-		 * @param string $insert_shortcode_function
578
-		 *
579
-		 *@since 1.0.6
580
-		 *
581
-		 */
582
-		public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
583
-			?>
573
+        /**
574
+         * Output the JS and CSS for the shortcode insert button.
575
+         *
576
+         * @param string $editor_id
577
+         * @param string $insert_shortcode_function
578
+         *
579
+         *@since 1.0.6
580
+         *
581
+         */
582
+        public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
583
+            ?>
584 584
 			<style>
585 585
 				.sd-shortcode-left-wrap {
586 586
 					float: left;
@@ -708,35 +708,35 @@  discard block
 block discarded – undo
708 708
 				<?php } ?>
709 709
 			</style>
710 710
 			<?php
711
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
712
-				echo "<script>" . self::siteorigin_js() . "</script>";
713
-			}
714
-			?>
711
+            if ( class_exists( 'SiteOrigin_Panels' ) ) {
712
+                echo "<script>" . self::siteorigin_js() . "</script>";
713
+            }
714
+            ?>
715 715
 			<script>
716 716
 				<?php
717
-				if(! empty( $insert_shortcode_function )){
718
-					echo $insert_shortcode_function;
719
-				}else{
720
-
721
-				/**
722
-				 * Function for super duper insert shortcode.
723
-				 *
724
-				 * @since 1.0.0
725
-				 */
726
-				?>
717
+                if(! empty( $insert_shortcode_function )){
718
+                    echo $insert_shortcode_function;
719
+                }else{
720
+
721
+                /**
722
+                 * Function for super duper insert shortcode.
723
+                 *
724
+                 * @since 1.0.0
725
+                 */
726
+                ?>
727 727
 				function sd_insert_shortcode($editor_id) {
728 728
 					$shortcode = jQuery('#TB_ajaxContent #sd-shortcode-output').val();
729 729
 					if ($shortcode) {
730 730
 						if (!$editor_id) {
731 731
 							<?php
732
-							if ( isset( $_REQUEST['et_fb'] ) ) {
733
-								echo '$editor_id = "#main_content_content_vb_tiny_mce";';
734
-							} elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
735
-								echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
736
-							} else {
737
-								echo '$editor_id = "#wp-content-editor-container textarea";';
738
-							}
739
-							?>
732
+                            if ( isset( $_REQUEST['et_fb'] ) ) {
733
+                                echo '$editor_id = "#main_content_content_vb_tiny_mce";';
734
+                            } elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
735
+                                echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
736
+                            } else {
737
+                                echo '$editor_id = "#wp-content-editor-container textarea";';
738
+                            }
739
+                            ?>
740 740
 						} else {
741 741
 							$editor_id = '#' + $editor_id;
742 742
 						}
@@ -1050,18 +1050,18 @@  discard block
 block discarded – undo
1050 1050
 				}
1051 1051
 			</script>
1052 1052
 			<?php
1053
-		}
1053
+        }
1054 1054
 
1055
-		/**
1056
-		 * Gets some CSS for the widgets screen.
1057
-		 *
1058
-		 * @param bool $advanced If we should include advanced CSS.
1059
-		 *
1060
-		 * @return mixed
1061
-		 */
1062
-		public function widget_css( $advanced = true ) {
1063
-			ob_start();
1064
-			?>
1055
+        /**
1056
+         * Gets some CSS for the widgets screen.
1057
+         *
1058
+         * @param bool $advanced If we should include advanced CSS.
1059
+         *
1060
+         * @return mixed
1061
+         */
1062
+        public function widget_css( $advanced = true ) {
1063
+            ob_start();
1064
+            ?>
1065 1065
 			<style>
1066 1066
 				<?php if( $advanced ){ ?>
1067 1067
 				.sd-advanced-setting {
@@ -1101,26 +1101,26 @@  discard block
 block discarded – undo
1101 1101
 				.elementor-control .sd-argument select[multiple] option{padding:3px}
1102 1102
 			</style>
1103 1103
 			<?php
1104
-			$output = ob_get_clean();
1104
+            $output = ob_get_clean();
1105 1105
 
1106
-			/*
1106
+            /*
1107 1107
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1108 1108
 			 */
1109 1109
 
1110
-			return str_replace( array(
1111
-				'<style>',
1112
-				'</style>'
1113
-			), '', $output );
1114
-		}
1110
+            return str_replace( array(
1111
+                '<style>',
1112
+                '</style>'
1113
+            ), '', $output );
1114
+        }
1115 1115
 
1116
-		/**
1117
-		 * Gets some JS for the widgets screen.
1118
-		 *
1119
-		 * @return mixed
1120
-		 */
1121
-		public function widget_js() {
1122
-			ob_start();
1123
-			?>
1116
+        /**
1117
+         * Gets some JS for the widgets screen.
1118
+         *
1119
+         * @return mixed
1120
+         */
1121
+        public function widget_js() {
1122
+            ob_start();
1123
+            ?>
1124 1124
 			<script>
1125 1125
 
1126 1126
 				/**
@@ -1271,513 +1271,513 @@  discard block
 block discarded – undo
1271 1271
 				<?php do_action( 'wp_super_duper_widget_js', $this ); ?>
1272 1272
 			</script>
1273 1273
 			<?php
1274
-			$output = ob_get_clean();
1274
+            $output = ob_get_clean();
1275 1275
 
1276
-			/*
1276
+            /*
1277 1277
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1278 1278
 			 */
1279 1279
 
1280
-			return str_replace( array(
1281
-				'<script>',
1282
-				'</script>'
1283
-			), '', $output );
1284
-		}
1285
-
1286
-
1287
-		/**
1288
-		 * Set the name from the argument key.
1289
-		 *
1290
-		 * @param $options
1291
-		 *
1292
-		 * @return mixed
1293
-		 */
1294
-		private function add_name_from_key( $options, $arguments = false ) {
1295
-			if ( ! empty( $options['arguments'] ) ) {
1296
-				foreach ( $options['arguments'] as $key => $val ) {
1297
-					$options['arguments'][ $key ]['name'] = $key;
1298
-				}
1299
-			} elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
1300
-				foreach ( $options as $key => $val ) {
1301
-					$options[ $key ]['name'] = $key;
1302
-				}
1303
-			}
1304
-
1305
-			return $options;
1306
-		}
1307
-
1308
-		/**
1309
-		 * Register the parent shortcode.
1310
-		 *
1311
-		 * @since 1.0.0
1312
-		 */
1313
-		public function register_shortcode() {
1314
-			add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) );
1315
-			add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) );
1316
-		}
1317
-
1318
-		/**
1319
-		 * Render the shortcode via ajax so we can return it to Gutenberg.
1320
-		 *
1321
-		 * @since 1.0.0
1322
-		 */
1323
-		public function render_shortcode() {
1324
-			check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
1325
-			if ( ! current_user_can( 'manage_options' ) ) {
1326
-				wp_die();
1327
-			}
1328
-
1329
-			// we might need the $post value here so lets set it.
1330
-			if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
1331
-				$post_obj = get_post( absint( $_POST['post_id'] ) );
1332
-				if ( ! empty( $post_obj ) && empty( $post ) ) {
1333
-					global $post;
1334
-					$post = $post_obj;
1335
-				}
1336
-			}
1337
-
1338
-			if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) {
1339
-				$is_preview = $this->is_preview();
1340
-				$shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
1341
-				$attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
1342
-				$attributes       = '';
1343
-				if ( ! empty( $attributes_array ) ) {
1344
-					foreach ( $attributes_array as $key => $value ) {
1345
-						if ( is_array( $value ) ) {
1346
-							$value = implode( ",", $value );
1347
-						}
1348
-
1349
-						if ( ! empty( $value ) ) {
1350
-							$value = wp_unslash( $value );
1351
-
1352
-							// Encode [ and ].
1353
-							if ( $is_preview ) {
1354
-								$value = $this->encode_shortcodes( $value );
1355
-							}
1356
-						}
1357
-						$attributes .= " " . esc_attr( sanitize_title_with_dashes( $key ) ) . "='" . esc_attr( $value ) . "' ";
1358
-					}
1359
-				}
1360
-
1361
-				$shortcode = "[" . esc_attr( $shortcode_name ) . " " . $attributes . "]";
1362
-
1363
-				$content = do_shortcode( $shortcode );
1364
-
1365
-				// Decode [ and ].
1366
-				if ( ! empty( $content ) && $is_preview ) {
1367
-					$content = $this->decode_shortcodes( $content );
1368
-				}
1369
-
1370
-				echo $content;
1371
-			}
1372
-			wp_die();
1373
-		}
1374
-
1375
-		/**
1376
-		 * Output the shortcode.
1377
-		 *
1378
-		 * @param array $args
1379
-		 * @param string $content
1380
-		 *
1381
-		 * @return string
1382
-		 */
1383
-		public function shortcode_output( $args = array(), $content = '' ) {
1384
-			$_instance = $args;
1385
-
1386
-			$args = $this->argument_values( $args );
1387
-
1388
-			// add extra argument so we know its a output to gutenberg
1389
-			//$args
1390
-			$args = $this->string_to_bool( $args );
1391
-
1392
-			// if we have a enclosed shortcode we add it to the special `html` argument
1393
-			if ( ! empty( $content ) ) {
1394
-				$args['html'] = $content;
1395
-			}
1396
-
1397
-			if ( ! $this->is_preview() ) {
1398
-				/**
1399
-				 * Filters the settings for a particular widget args.
1400
-				 *
1401
-				 * @param array          $args      The current widget instance's settings.
1402
-				 * @param WP_Super_Duper $widget    The current widget settings.
1403
-				 * @param array          $_instance An array of default widget arguments.
1404
-				 *
1405
-				 *@since 1.0.28
1406
-				 *
1407
-				 */
1408
-				$args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance );
1409
-
1410
-				if ( ! is_array( $args ) ) {
1411
-					return $args;
1412
-				}
1413
-			}
1414
-
1415
-			$class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : '';
1416
-			$class .= " sdel-".$this->get_instance_hash();
1417
-
1418
-			$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
1419
-			$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
1420
-
1421
-			$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
1422
-			$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
1423
-
1424
-			$shortcode_args = array();
1425
-			$output         = '';
1426
-			$no_wrap        = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1427
-			if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) {
1428
-				$no_wrap = true;
1429
-			}
1430
-			$main_content = $this->output( $args, $shortcode_args, $content );
1431
-			if ( $main_content && ! $no_wrap ) {
1432
-				// wrap the shortcode in a div with the same class as the widget
1433
-				$output .= '<div class="' . $class . '" ' . $attrs . '>';
1434
-				if ( ! empty( $args['title'] ) ) {
1435
-					// if its a shortcode and there is a title try to grab the title wrappers
1436
-					$shortcode_args = array( 'before_title' => '', 'after_title' => '' );
1437
-					if ( empty( $instance ) ) {
1438
-						global $wp_registered_sidebars;
1439
-						if ( ! empty( $wp_registered_sidebars ) ) {
1440
-							foreach ( $wp_registered_sidebars as $sidebar ) {
1441
-								if ( ! empty( $sidebar['before_title'] ) ) {
1442
-									$shortcode_args['before_title'] = $sidebar['before_title'];
1443
-									$shortcode_args['after_title']  = $sidebar['after_title'];
1444
-									break;
1445
-								}
1446
-							}
1447
-						}
1448
-					}
1449
-					$output .= $this->output_title( $shortcode_args, $args );
1450
-				}
1451
-				$output .= $main_content;
1452
-				$output .= '</div>';
1453
-			} elseif ( $main_content && $no_wrap ) {
1454
-				$output .= $main_content;
1455
-			}
1456
-
1457
-			// if preview show a placeholder if empty
1458
-			if ( $this->is_preview() && $output == '' ) {
1459
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
1460
-			}
1461
-
1462
-			return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
1463
-		}
1464
-
1465
-		/**
1466
-		 * Placeholder text to show if output is empty and we are on a preview/builder page.
1467
-		 *
1468
-		 * @param string $name
1469
-		 *
1470
-		 * @return string
1471
-		 */
1472
-		public function preview_placeholder_text( $name = '' ) {
1473
-			return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . wp_sprintf( __( 'Placeholder for: %s', 'ayecode-connect' ), $name ) . "</div>";
1474
-		}
1475
-
1476
-		/**
1477
-		 * Sometimes booleans values can be turned to strings, so we fix that.
1478
-		 *
1479
-		 * @param $options
1480
-		 *
1481
-		 * @return mixed
1482
-		 */
1483
-		public function string_to_bool( $options ) {
1484
-			// convert bool strings to booleans
1485
-			foreach ( $options as $key => $val ) {
1486
-				if ( $val == 'false' ) {
1487
-					$options[ $key ] = false;
1488
-				} elseif ( $val == 'true' ) {
1489
-					$options[ $key ] = true;
1490
-				}
1491
-			}
1492
-
1493
-			return $options;
1494
-		}
1495
-
1496
-		/**
1497
-		 * Get the argument values that are also filterable.
1498
-		 *
1499
-		 * @param $instance
1500
-		 *
1501
-		 * @return array
1502
-		 *@since 1.0.12 Don't set checkbox default value if the value is empty.
1503
-		 *
1504
-		 */
1505
-		public function argument_values( $instance ) {
1506
-			$argument_values = array();
1507
-
1508
-			// set widget instance
1509
-			$this->instance = $instance;
1510
-
1511
-			if ( empty( $this->arguments ) ) {
1512
-				$this->arguments = $this->get_arguments();
1513
-			}
1514
-
1515
-			if ( ! empty( $this->arguments ) ) {
1516
-				foreach ( $this->arguments as $key => $args ) {
1517
-					// set the input name from the key
1518
-					$args['name'] = $key;
1519
-					//
1520
-					$argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
1521
-					if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
1522
-						// don't set default for an empty checkbox
1523
-					} elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
1524
-						$argument_values[ $key ] = $args['default'];
1525
-					}
1526
-				}
1527
-			}
1528
-
1529
-			return $argument_values;
1530
-		}
1531
-
1532
-		/**
1533
-		 * Set arguments in super duper.
1534
-		 *
1535
-		 * @return array Set arguments.
1536
-		 *@since 1.0.0
1537
-		 *
1538
-		 */
1539
-		public function set_arguments() {
1540
-			return $this->arguments;
1541
-		}
1542
-
1543
-		/**
1544
-		 * Get arguments in super duper.
1545
-		 *
1546
-		 * @return array Get arguments.
1547
-		 *@since 1.0.0
1548
-		 *
1549
-		 */
1550
-		public function get_arguments() {
1551
-			if ( empty( $this->arguments ) ) {
1552
-				$this->arguments = $this->set_arguments();
1553
-			}
1554
-
1555
-			$this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
1556
-			$this->arguments = $this->add_name_from_key( $this->arguments, true );
1557
-
1558
-			return $this->arguments;
1559
-		}
1560
-
1561
-		/**
1562
-		 * This is the main output class for all 3 items, widget, shortcode and block, it is extended in the calling class.
1563
-		 *
1564
-		 * @param array $args
1565
-		 * @param array $widget_args
1566
-		 * @param string $content
1567
-		 */
1568
-		public function output( $args = array(), $widget_args = array(), $content = '' ) {
1569
-
1570
-		}
1571
-
1572
-		/**
1573
-		 * Add the dynamic block code inline when the wp-block in enqueued.
1574
-		 */
1575
-		public function register_block() {
1576
-			wp_add_inline_script( 'wp-blocks', $this->block() );
1577
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
1578
-				wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() );
1579
-			}
1580
-		}
1581
-
1582
-		/**
1583
-		 * Check if we need to show advanced options.
1584
-		 *
1585
-		 * @return bool
1586
-		 */
1587
-		public function block_show_advanced() {
1588
-
1589
-			$show      = false;
1590
-			$arguments = $this->get_arguments();
1591
-
1592
-			if ( ! empty( $arguments ) ) {
1593
-				foreach ( $arguments as $argument ) {
1594
-					if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1595
-						$show = true;
1596
-						break; // no need to continue if we know we have it
1597
-					}
1598
-				}
1599
-			}
1600
-
1601
-			return $show;
1602
-		}
1280
+            return str_replace( array(
1281
+                '<script>',
1282
+                '</script>'
1283
+            ), '', $output );
1284
+        }
1603 1285
 
1604
-		/**
1605
-		 * Get the url path to the current folder.
1606
-		 *
1607
-		 * @return string
1608
-		 */
1609
-		public function get_url() {
1610
-			$url = $this->url;
1611
-
1612
-			if ( ! $url ) {
1613
-				$content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1614
-				$content_url = untrailingslashit( WP_CONTENT_URL );
1615
-
1616
-				// Replace http:// to https://.
1617
-				if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1618
-					$content_url = str_replace( 'http://', 'https://', $content_url );
1619
-				}
1620 1286
 
1621
-				// Check if we are inside a plugin
1622
-				$file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1623
-				$url = str_replace( $content_dir, $content_url, $file_dir );
1624
-				$url = trailingslashit( $url );
1625
-				$this->url = $url;
1626
-			}
1287
+        /**
1288
+         * Set the name from the argument key.
1289
+         *
1290
+         * @param $options
1291
+         *
1292
+         * @return mixed
1293
+         */
1294
+        private function add_name_from_key( $options, $arguments = false ) {
1295
+            if ( ! empty( $options['arguments'] ) ) {
1296
+                foreach ( $options['arguments'] as $key => $val ) {
1297
+                    $options['arguments'][ $key ]['name'] = $key;
1298
+                }
1299
+            } elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
1300
+                foreach ( $options as $key => $val ) {
1301
+                    $options[ $key ]['name'] = $key;
1302
+                }
1303
+            }
1304
+
1305
+            return $options;
1306
+        }
1627 1307
 
1628
-			return $url;
1629
-		}
1308
+        /**
1309
+         * Register the parent shortcode.
1310
+         *
1311
+         * @since 1.0.0
1312
+         */
1313
+        public function register_shortcode() {
1314
+            add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) );
1315
+            add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) );
1316
+        }
1630 1317
 
1631
-		/**
1632
-		 * Get the url path to the current folder.
1633
-		 *
1634
-		 * @return string
1635
-		 */
1636
-		public function get_url_old() {
1318
+        /**
1319
+         * Render the shortcode via ajax so we can return it to Gutenberg.
1320
+         *
1321
+         * @since 1.0.0
1322
+         */
1323
+        public function render_shortcode() {
1324
+            check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
1325
+            if ( ! current_user_can( 'manage_options' ) ) {
1326
+                wp_die();
1327
+            }
1328
+
1329
+            // we might need the $post value here so lets set it.
1330
+            if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
1331
+                $post_obj = get_post( absint( $_POST['post_id'] ) );
1332
+                if ( ! empty( $post_obj ) && empty( $post ) ) {
1333
+                    global $post;
1334
+                    $post = $post_obj;
1335
+                }
1336
+            }
1337
+
1338
+            if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) {
1339
+                $is_preview = $this->is_preview();
1340
+                $shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
1341
+                $attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
1342
+                $attributes       = '';
1343
+                if ( ! empty( $attributes_array ) ) {
1344
+                    foreach ( $attributes_array as $key => $value ) {
1345
+                        if ( is_array( $value ) ) {
1346
+                            $value = implode( ",", $value );
1347
+                        }
1348
+
1349
+                        if ( ! empty( $value ) ) {
1350
+                            $value = wp_unslash( $value );
1351
+
1352
+                            // Encode [ and ].
1353
+                            if ( $is_preview ) {
1354
+                                $value = $this->encode_shortcodes( $value );
1355
+                            }
1356
+                        }
1357
+                        $attributes .= " " . esc_attr( sanitize_title_with_dashes( $key ) ) . "='" . esc_attr( $value ) . "' ";
1358
+                    }
1359
+                }
1360
+
1361
+                $shortcode = "[" . esc_attr( $shortcode_name ) . " " . $attributes . "]";
1362
+
1363
+                $content = do_shortcode( $shortcode );
1364
+
1365
+                // Decode [ and ].
1366
+                if ( ! empty( $content ) && $is_preview ) {
1367
+                    $content = $this->decode_shortcodes( $content );
1368
+                }
1369
+
1370
+                echo $content;
1371
+            }
1372
+            wp_die();
1373
+        }
1637 1374
 
1638
-			$url = $this->url;
1375
+        /**
1376
+         * Output the shortcode.
1377
+         *
1378
+         * @param array $args
1379
+         * @param string $content
1380
+         *
1381
+         * @return string
1382
+         */
1383
+        public function shortcode_output( $args = array(), $content = '' ) {
1384
+            $_instance = $args;
1385
+
1386
+            $args = $this->argument_values( $args );
1387
+
1388
+            // add extra argument so we know its a output to gutenberg
1389
+            //$args
1390
+            $args = $this->string_to_bool( $args );
1391
+
1392
+            // if we have a enclosed shortcode we add it to the special `html` argument
1393
+            if ( ! empty( $content ) ) {
1394
+                $args['html'] = $content;
1395
+            }
1396
+
1397
+            if ( ! $this->is_preview() ) {
1398
+                /**
1399
+                 * Filters the settings for a particular widget args.
1400
+                 *
1401
+                 * @param array          $args      The current widget instance's settings.
1402
+                 * @param WP_Super_Duper $widget    The current widget settings.
1403
+                 * @param array          $_instance An array of default widget arguments.
1404
+                 *
1405
+                 *@since 1.0.28
1406
+                 *
1407
+                 */
1408
+                $args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance );
1409
+
1410
+                if ( ! is_array( $args ) ) {
1411
+                    return $args;
1412
+                }
1413
+            }
1414
+
1415
+            $class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : '';
1416
+            $class .= " sdel-".$this->get_instance_hash();
1417
+
1418
+            $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
1419
+            $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
1420
+
1421
+            $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
1422
+            $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
1423
+
1424
+            $shortcode_args = array();
1425
+            $output         = '';
1426
+            $no_wrap        = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1427
+            if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) {
1428
+                $no_wrap = true;
1429
+            }
1430
+            $main_content = $this->output( $args, $shortcode_args, $content );
1431
+            if ( $main_content && ! $no_wrap ) {
1432
+                // wrap the shortcode in a div with the same class as the widget
1433
+                $output .= '<div class="' . $class . '" ' . $attrs . '>';
1434
+                if ( ! empty( $args['title'] ) ) {
1435
+                    // if its a shortcode and there is a title try to grab the title wrappers
1436
+                    $shortcode_args = array( 'before_title' => '', 'after_title' => '' );
1437
+                    if ( empty( $instance ) ) {
1438
+                        global $wp_registered_sidebars;
1439
+                        if ( ! empty( $wp_registered_sidebars ) ) {
1440
+                            foreach ( $wp_registered_sidebars as $sidebar ) {
1441
+                                if ( ! empty( $sidebar['before_title'] ) ) {
1442
+                                    $shortcode_args['before_title'] = $sidebar['before_title'];
1443
+                                    $shortcode_args['after_title']  = $sidebar['after_title'];
1444
+                                    break;
1445
+                                }
1446
+                            }
1447
+                        }
1448
+                    }
1449
+                    $output .= $this->output_title( $shortcode_args, $args );
1450
+                }
1451
+                $output .= $main_content;
1452
+                $output .= '</div>';
1453
+            } elseif ( $main_content && $no_wrap ) {
1454
+                $output .= $main_content;
1455
+            }
1456
+
1457
+            // if preview show a placeholder if empty
1458
+            if ( $this->is_preview() && $output == '' ) {
1459
+                $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
1460
+            }
1461
+
1462
+            return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
1463
+        }
1639 1464
 
1640
-			if ( ! $url ) {
1641
-				// check if we are inside a plugin
1642
-				$file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
1465
+        /**
1466
+         * Placeholder text to show if output is empty and we are on a preview/builder page.
1467
+         *
1468
+         * @param string $name
1469
+         *
1470
+         * @return string
1471
+         */
1472
+        public function preview_placeholder_text( $name = '' ) {
1473
+            return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . wp_sprintf( __( 'Placeholder for: %s', 'ayecode-connect' ), $name ) . "</div>";
1474
+        }
1643 1475
 
1644
-				$dir_parts = explode( "/wp-content/", $file_dir );
1645
-				$url_parts = explode( "/wp-content/", plugins_url() );
1476
+        /**
1477
+         * Sometimes booleans values can be turned to strings, so we fix that.
1478
+         *
1479
+         * @param $options
1480
+         *
1481
+         * @return mixed
1482
+         */
1483
+        public function string_to_bool( $options ) {
1484
+            // convert bool strings to booleans
1485
+            foreach ( $options as $key => $val ) {
1486
+                if ( $val == 'false' ) {
1487
+                    $options[ $key ] = false;
1488
+                } elseif ( $val == 'true' ) {
1489
+                    $options[ $key ] = true;
1490
+                }
1491
+            }
1492
+
1493
+            return $options;
1494
+        }
1646 1495
 
1647
-				if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
1648
-					$url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
1649
-					$this->url = $url;
1650
-				}
1651
-			}
1496
+        /**
1497
+         * Get the argument values that are also filterable.
1498
+         *
1499
+         * @param $instance
1500
+         *
1501
+         * @return array
1502
+         *@since 1.0.12 Don't set checkbox default value if the value is empty.
1503
+         *
1504
+         */
1505
+        public function argument_values( $instance ) {
1506
+            $argument_values = array();
1507
+
1508
+            // set widget instance
1509
+            $this->instance = $instance;
1510
+
1511
+            if ( empty( $this->arguments ) ) {
1512
+                $this->arguments = $this->get_arguments();
1513
+            }
1514
+
1515
+            if ( ! empty( $this->arguments ) ) {
1516
+                foreach ( $this->arguments as $key => $args ) {
1517
+                    // set the input name from the key
1518
+                    $args['name'] = $key;
1519
+                    //
1520
+                    $argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
1521
+                    if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
1522
+                        // don't set default for an empty checkbox
1523
+                    } elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
1524
+                        $argument_values[ $key ] = $args['default'];
1525
+                    }
1526
+                }
1527
+            }
1528
+
1529
+            return $argument_values;
1530
+        }
1652 1531
 
1532
+        /**
1533
+         * Set arguments in super duper.
1534
+         *
1535
+         * @return array Set arguments.
1536
+         *@since 1.0.0
1537
+         *
1538
+         */
1539
+        public function set_arguments() {
1540
+            return $this->arguments;
1541
+        }
1653 1542
 
1654
-			return $url;
1655
-		}
1543
+        /**
1544
+         * Get arguments in super duper.
1545
+         *
1546
+         * @return array Get arguments.
1547
+         *@since 1.0.0
1548
+         *
1549
+         */
1550
+        public function get_arguments() {
1551
+            if ( empty( $this->arguments ) ) {
1552
+                $this->arguments = $this->set_arguments();
1553
+            }
1554
+
1555
+            $this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
1556
+            $this->arguments = $this->add_name_from_key( $this->arguments, true );
1557
+
1558
+            return $this->arguments;
1559
+        }
1656 1560
 
1657
-		/**
1658
-		 * Generate the block icon.
1659
-		 *
1660
-		 * Enables the use of Font Awesome icons.
1661
-		 *
1662
-		 * @note xlink:href is actually deprecated but href is not supported by all so we use both.
1663
-		 *
1664
-		 * @param $icon
1665
-		 *
1666
-		 * @return string
1667
-		 *@since 1.1.0
1668
-		 */
1669
-		public function get_block_icon( $icon ) {
1670
-
1671
-			// check if we have a Font Awesome icon
1672
-			$fa_type = '';
1673
-			if ( substr( $icon, 0, 7 ) === "fas fa-" ) {
1674
-				$fa_type = 'solid';
1675
-			} elseif ( substr( $icon, 0, 7 ) === "far fa-" ) {
1676
-				$fa_type = 'regular';
1677
-			} elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) {
1678
-				$fa_type = 'brands';
1679
-			} else {
1680
-				$icon = "'" . $icon . "'";
1681
-			}
1561
+        /**
1562
+         * This is the main output class for all 3 items, widget, shortcode and block, it is extended in the calling class.
1563
+         *
1564
+         * @param array $args
1565
+         * @param array $widget_args
1566
+         * @param string $content
1567
+         */
1568
+        public function output( $args = array(), $widget_args = array(), $content = '' ) {
1682 1569
 
1683
-			// set the icon if we found one
1684
-			if ( $fa_type ) {
1685
-				$fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon );
1686
-				$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 . "'}))";
1687
-			}
1570
+        }
1688 1571
 
1689
-			return $icon;
1690
-		}
1572
+        /**
1573
+         * Add the dynamic block code inline when the wp-block in enqueued.
1574
+         */
1575
+        public function register_block() {
1576
+            wp_add_inline_script( 'wp-blocks', $this->block() );
1577
+            if ( class_exists( 'SiteOrigin_Panels' ) ) {
1578
+                wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() );
1579
+            }
1580
+        }
1691 1581
 
1692
-		public function group_arguments( $arguments ) {
1693
-			if ( ! empty( $arguments ) ) {
1694
-				$temp_arguments = array();
1695
-				$general        = __( "General", 'ayecode-connect' );
1696
-				$add_sections   = false;
1697
-				foreach ( $arguments as $key => $args ) {
1698
-					if ( isset( $args['group'] ) ) {
1699
-						$temp_arguments[ $args['group'] ][ $key ] = $args;
1700
-						$add_sections                             = true;
1701
-					} else {
1702
-						$temp_arguments[ $general ][ $key ] = $args;
1703
-					}
1704
-				}
1582
+        /**
1583
+         * Check if we need to show advanced options.
1584
+         *
1585
+         * @return bool
1586
+         */
1587
+        public function block_show_advanced() {
1588
+
1589
+            $show      = false;
1590
+            $arguments = $this->get_arguments();
1591
+
1592
+            if ( ! empty( $arguments ) ) {
1593
+                foreach ( $arguments as $argument ) {
1594
+                    if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1595
+                        $show = true;
1596
+                        break; // no need to continue if we know we have it
1597
+                    }
1598
+                }
1599
+            }
1600
+
1601
+            return $show;
1602
+        }
1705 1603
 
1706
-				// only add sections if more than one
1707
-				if ( $add_sections ) {
1708
-					$arguments = $temp_arguments;
1709
-				}
1710
-			}
1604
+        /**
1605
+         * Get the url path to the current folder.
1606
+         *
1607
+         * @return string
1608
+         */
1609
+        public function get_url() {
1610
+            $url = $this->url;
1611
+
1612
+            if ( ! $url ) {
1613
+                $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1614
+                $content_url = untrailingslashit( WP_CONTENT_URL );
1615
+
1616
+                // Replace http:// to https://.
1617
+                if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1618
+                    $content_url = str_replace( 'http://', 'https://', $content_url );
1619
+                }
1620
+
1621
+                // Check if we are inside a plugin
1622
+                $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1623
+                $url = str_replace( $content_dir, $content_url, $file_dir );
1624
+                $url = trailingslashit( $url );
1625
+                $this->url = $url;
1626
+            }
1627
+
1628
+            return $url;
1629
+        }
1711 1630
 
1712
-			return $arguments;
1713
-		}
1631
+        /**
1632
+         * Get the url path to the current folder.
1633
+         *
1634
+         * @return string
1635
+         */
1636
+        public function get_url_old() {
1714 1637
 
1715
-		/**
1716
-		 * Parse used group tabs.
1717
-		 *
1718
-		 * @since 1.1.17
1719
-		 */
1720
-		public function group_block_tabs( $tabs, $arguments ) {
1721
-			if ( ! empty( $tabs ) && ! empty( $arguments ) ) {
1722
-				$has_sections = false;
1723
-
1724
-				foreach ( $this->arguments as $key => $args ) {
1725
-					if ( isset( $args['group'] ) ) {
1726
-						$has_sections = true;
1727
-						break;
1728
-					}
1729
-				}
1638
+            $url = $this->url;
1730 1639
 
1731
-				if ( ! $has_sections ) {
1732
-					return $tabs;
1733
-				}
1640
+            if ( ! $url ) {
1641
+                // check if we are inside a plugin
1642
+                $file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
1734 1643
 
1735
-				$new_tabs = array();
1644
+                $dir_parts = explode( "/wp-content/", $file_dir );
1645
+                $url_parts = explode( "/wp-content/", plugins_url() );
1736 1646
 
1737
-				foreach ( $tabs as $tab_key => $tab ) {
1738
-					$new_groups = array();
1647
+                if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
1648
+                    $url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
1649
+                    $this->url = $url;
1650
+                }
1651
+            }
1739 1652
 
1740
-					if ( ! empty( $tab['groups'] ) && is_array( $tab['groups'] ) ) {
1741
-						foreach ( $tab['groups'] as $group ) {
1742
-							if ( isset( $arguments[ $group ] ) ) {
1743
-								$new_groups[] = $group;
1744
-							}
1745
-						}
1746
-					}
1747 1653
 
1748
-					if ( ! empty( $new_groups ) ) {
1749
-						$tab['groups'] = $new_groups;
1654
+            return $url;
1655
+        }
1750 1656
 
1751
-						$new_tabs[ $tab_key ] = $tab;
1752
-					}
1753
-				}
1657
+        /**
1658
+         * Generate the block icon.
1659
+         *
1660
+         * Enables the use of Font Awesome icons.
1661
+         *
1662
+         * @note xlink:href is actually deprecated but href is not supported by all so we use both.
1663
+         *
1664
+         * @param $icon
1665
+         *
1666
+         * @return string
1667
+         *@since 1.1.0
1668
+         */
1669
+        public function get_block_icon( $icon ) {
1670
+
1671
+            // check if we have a Font Awesome icon
1672
+            $fa_type = '';
1673
+            if ( substr( $icon, 0, 7 ) === "fas fa-" ) {
1674
+                $fa_type = 'solid';
1675
+            } elseif ( substr( $icon, 0, 7 ) === "far fa-" ) {
1676
+                $fa_type = 'regular';
1677
+            } elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) {
1678
+                $fa_type = 'brands';
1679
+            } else {
1680
+                $icon = "'" . $icon . "'";
1681
+            }
1682
+
1683
+            // set the icon if we found one
1684
+            if ( $fa_type ) {
1685
+                $fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon );
1686
+                $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 . "'}))";
1687
+            }
1688
+
1689
+            return $icon;
1690
+        }
1754 1691
 
1755
-				$tabs = $new_tabs;
1756
-			}
1692
+        public function group_arguments( $arguments ) {
1693
+            if ( ! empty( $arguments ) ) {
1694
+                $temp_arguments = array();
1695
+                $general        = __( "General", 'ayecode-connect' );
1696
+                $add_sections   = false;
1697
+                foreach ( $arguments as $key => $args ) {
1698
+                    if ( isset( $args['group'] ) ) {
1699
+                        $temp_arguments[ $args['group'] ][ $key ] = $args;
1700
+                        $add_sections                             = true;
1701
+                    } else {
1702
+                        $temp_arguments[ $general ][ $key ] = $args;
1703
+                    }
1704
+                }
1705
+
1706
+                // only add sections if more than one
1707
+                if ( $add_sections ) {
1708
+                    $arguments = $temp_arguments;
1709
+                }
1710
+            }
1711
+
1712
+            return $arguments;
1713
+        }
1757 1714
 
1758
-			return $tabs;
1759
-		}
1715
+        /**
1716
+         * Parse used group tabs.
1717
+         *
1718
+         * @since 1.1.17
1719
+         */
1720
+        public function group_block_tabs( $tabs, $arguments ) {
1721
+            if ( ! empty( $tabs ) && ! empty( $arguments ) ) {
1722
+                $has_sections = false;
1723
+
1724
+                foreach ( $this->arguments as $key => $args ) {
1725
+                    if ( isset( $args['group'] ) ) {
1726
+                        $has_sections = true;
1727
+                        break;
1728
+                    }
1729
+                }
1730
+
1731
+                if ( ! $has_sections ) {
1732
+                    return $tabs;
1733
+                }
1734
+
1735
+                $new_tabs = array();
1736
+
1737
+                foreach ( $tabs as $tab_key => $tab ) {
1738
+                    $new_groups = array();
1739
+
1740
+                    if ( ! empty( $tab['groups'] ) && is_array( $tab['groups'] ) ) {
1741
+                        foreach ( $tab['groups'] as $group ) {
1742
+                            if ( isset( $arguments[ $group ] ) ) {
1743
+                                $new_groups[] = $group;
1744
+                            }
1745
+                        }
1746
+                    }
1747
+
1748
+                    if ( ! empty( $new_groups ) ) {
1749
+                        $tab['groups'] = $new_groups;
1750
+
1751
+                        $new_tabs[ $tab_key ] = $tab;
1752
+                    }
1753
+                }
1754
+
1755
+                $tabs = $new_tabs;
1756
+            }
1757
+
1758
+            return $tabs;
1759
+        }
1760 1760
 
1761
-		/**
1762
-		 * Output the JS for building the dynamic Guntenberg block.
1763
-		 *
1764
-		 * @return mixed
1765
-		 *@since 1.0.9 Save numbers as numbers and not strings.
1766
-		 * @since 1.1.0 Font Awesome classes can be used for icons.
1767
-		 * @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.
1768
-		 */
1769
-		public function block() {
1770
-			global $sd_is_js_functions_loaded, $aui_bs5;
1771
-
1772
-			$show_advanced = $this->block_show_advanced();
1773
-
1774
-			ob_start();
1775
-			?>
1761
+        /**
1762
+         * Output the JS for building the dynamic Guntenberg block.
1763
+         *
1764
+         * @return mixed
1765
+         *@since 1.0.9 Save numbers as numbers and not strings.
1766
+         * @since 1.1.0 Font Awesome classes can be used for icons.
1767
+         * @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.
1768
+         */
1769
+        public function block() {
1770
+            global $sd_is_js_functions_loaded, $aui_bs5;
1771
+
1772
+            $show_advanced = $this->block_show_advanced();
1773
+
1774
+            ob_start();
1775
+            ?>
1776 1776
 			<script>
1777 1777
 			<?php
1778
-			if ( ! $sd_is_js_functions_loaded ) {
1779
-				$sd_is_js_functions_loaded = true;
1780
-			?>
1778
+            if ( ! $sd_is_js_functions_loaded ) {
1779
+                $sd_is_js_functions_loaded = true;
1780
+            ?>
1781 1781
 function sd_show_view_options($this){
1782 1782
 	if(jQuery($this).html().length){
1783 1783
 		jQuery($this).html('');
@@ -2231,8 +2231,8 @@  discard block
 block discarded – undo
2231 2231
 				$classes = [];
2232 2232
 
2233 2233
 				<?php
2234
-				if($aui_bs5){
2235
-					?>
2234
+                if($aui_bs5){
2235
+                    ?>
2236 2236
 				$aui_bs5 = true;
2237 2237
 				$p_ml = 'ms-';
2238 2238
 				$p_mr = 'me-';
@@ -2240,8 +2240,8 @@  discard block
 block discarded – undo
2240 2240
 				$p_pl = 'ps-';
2241 2241
 				$p_pr = 'pe-';
2242 2242
 					<?php
2243
-				}else{
2244
-						?>
2243
+                }else{
2244
+                        ?>
2245 2245
 				$aui_bs5 = false;
2246 2246
 				$p_ml = 'ml-';
2247 2247
 				$p_mr = 'mr-';
@@ -2249,8 +2249,8 @@  discard block
 block discarded – undo
2249 2249
 				$p_pl = 'pl-';
2250 2250
 				$p_pr = 'pr-';
2251 2251
 					<?php
2252
-				}
2253
-				?>
2252
+                }
2253
+                ?>
2254 2254
 
2255 2255
 				// margins
2256 2256
 				if ( $args['mt'] !== undefined && $args['mt'] !== '' ) { $classes.push( "mt-" + $args['mt'] );  $mt = $args['mt']; }else{$mt = null;}
@@ -2434,12 +2434,12 @@  discard block
 block discarded – undo
2434 2434
 			<?php
2435 2435
 
2436 2436
 
2437
-			}
2437
+            }
2438 2438
 
2439
-			if(method_exists($this,'block_global_js')){
2440
-					echo $this->block_global_js();
2441
-			}
2442
-			?>
2439
+            if(method_exists($this,'block_global_js')){
2440
+                    echo $this->block_global_js();
2441
+            }
2442
+            ?>
2443 2443
 
2444 2444
 jQuery(function() {
2445 2445
 
@@ -2492,13 +2492,13 @@  discard block
 block discarded – undo
2492 2492
 						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/.
2493 2493
 						supports: {
2494 2494
 							<?php
2495
-							if(!isset($this->options['block-supports']['renaming'])){
2496
-								$this->options['block-supports']['renaming'] = false;
2497
-							}
2498
-							if ( isset( $this->options['block-supports'] ) ) {
2499
-								echo $this->array_to_attributes( $this->options['block-supports'] );
2500
-							}
2501
-							?>
2495
+                            if(!isset($this->options['block-supports']['renaming'])){
2496
+                                $this->options['block-supports']['renaming'] = false;
2497
+                            }
2498
+                            if ( isset( $this->options['block-supports'] ) ) {
2499
+                                echo $this->array_to_attributes( $this->options['block-supports'] );
2500
+                            }
2501
+                            ?>
2502 2502
 						},
2503 2503
 						__experimentalLabel( attributes, { context } ) {
2504 2504
 							var visibility_html = attributes && attributes.visibility_conditions ? ' &#128065;' : '';
@@ -2508,174 +2508,174 @@  discard block
 block discarded – undo
2508 2508
 						},
2509 2509
 						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.
2510 2510
 						<?php if ( isset( $this->options['block-keywords'] ) ) {
2511
-						echo "keywords : " . $this->options['block-keywords'] . ",";
2512
-						}
2513
-
2514
-
2515
-						// block hover preview.
2516
-						$example_args = array();
2517
-						if(!empty($this->arguments)){
2518
-							foreach($this->arguments as $key => $a_args){
2519
-								if(isset($a_args['example'])){
2520
-									$example_args[$key] = $a_args['example'];
2521
-								}
2522
-							}
2523
-						}
2524
-						$viewport_width = isset($this->options['example']['viewportWidth']) ? 'viewportWidth: '.absint($this->options['example']['viewportWidth']) : '';
2525
-						$example_inner_blocks = !empty($this->options['example']['innerBlocks']) && is_array($this->options['example']['innerBlocks']) ? 'innerBlocks: ' . wp_json_encode($this->options['example']['innerBlocks']) : '';
2526
-						if( isset( $this->options['example'] ) && $this->options['example'] === false ){
2527
-							// no preview if set to false
2528
-						}elseif( !empty( $example_args ) ){
2529
-							echo "example : {attributes:{".$this->array_to_attributes( $example_args )."},$viewport_width},";
2530
-						}elseif( !empty( $this->options['example'] ) ){
2531
-							unset($this->options['example']['viewportWidth']);
2532
-							unset($this->options['example']['innerBlocks']);
2533
-							$example_atts = $this->array_to_attributes( $this->options['example'] );
2534
-							$example_parts = array();
2535
-							if($example_atts){
2536
-								$example_parts[] = rtrim($example_atts,",");
2537
-							}
2538
-							if($viewport_width){
2539
-								$example_parts[] = $viewport_width;
2540
-							}
2541
-							if($example_inner_blocks){
2542
-								$example_parts[] = $example_inner_blocks;
2543
-							}
2544
-							if(!empty($example_parts)){
2545
-								echo "example : {".implode(',', $example_parts)."},";
2546
-							}
2547
-						}else{
2548
-							echo 'example : {viewportWidth: 500},';
2549
-						}
2550
-
2551
-
2552
-
2553
-						// limit to parent
2554
-						if( !empty( $this->options['parent'] ) ){
2555
-							echo "parent : " . wp_json_encode( $this->options['parent'] ) . ",";
2556
-						}
2557
-
2558
-						// limit allowed blocks
2559
-						if( !empty( $this->options['allowed-blocks'] ) ){
2560
-							echo "allowedBlocks : " . wp_json_encode( $this->options['allowed-blocks'] ) . ",";
2561
-						}
2562
-
2563
-						// maybe set no_wrap
2564
-						$no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
2565
-						if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) {
2566
-							$no_wrap = true;
2567
-						}
2568
-						if ( $no_wrap ) {
2569
-							$this->options['block-wrap'] = '';
2570
-						}
2571
-
2572
-						// maybe load the drag/drop functions.
2573
-						$img_drag_drop = false;
2574
-
2575
-						$show_alignment = false;
2576
-						// align feature
2577
-						/*echo "supports: {";
2511
+                        echo "keywords : " . $this->options['block-keywords'] . ",";
2512
+                        }
2513
+
2514
+
2515
+                        // block hover preview.
2516
+                        $example_args = array();
2517
+                        if(!empty($this->arguments)){
2518
+                            foreach($this->arguments as $key => $a_args){
2519
+                                if(isset($a_args['example'])){
2520
+                                    $example_args[$key] = $a_args['example'];
2521
+                                }
2522
+                            }
2523
+                        }
2524
+                        $viewport_width = isset($this->options['example']['viewportWidth']) ? 'viewportWidth: '.absint($this->options['example']['viewportWidth']) : '';
2525
+                        $example_inner_blocks = !empty($this->options['example']['innerBlocks']) && is_array($this->options['example']['innerBlocks']) ? 'innerBlocks: ' . wp_json_encode($this->options['example']['innerBlocks']) : '';
2526
+                        if( isset( $this->options['example'] ) && $this->options['example'] === false ){
2527
+                            // no preview if set to false
2528
+                        }elseif( !empty( $example_args ) ){
2529
+                            echo "example : {attributes:{".$this->array_to_attributes( $example_args )."},$viewport_width},";
2530
+                        }elseif( !empty( $this->options['example'] ) ){
2531
+                            unset($this->options['example']['viewportWidth']);
2532
+                            unset($this->options['example']['innerBlocks']);
2533
+                            $example_atts = $this->array_to_attributes( $this->options['example'] );
2534
+                            $example_parts = array();
2535
+                            if($example_atts){
2536
+                                $example_parts[] = rtrim($example_atts,",");
2537
+                            }
2538
+                            if($viewport_width){
2539
+                                $example_parts[] = $viewport_width;
2540
+                            }
2541
+                            if($example_inner_blocks){
2542
+                                $example_parts[] = $example_inner_blocks;
2543
+                            }
2544
+                            if(!empty($example_parts)){
2545
+                                echo "example : {".implode(',', $example_parts)."},";
2546
+                            }
2547
+                        }else{
2548
+                            echo 'example : {viewportWidth: 500},';
2549
+                        }
2550
+
2551
+
2552
+
2553
+                        // limit to parent
2554
+                        if( !empty( $this->options['parent'] ) ){
2555
+                            echo "parent : " . wp_json_encode( $this->options['parent'] ) . ",";
2556
+                        }
2557
+
2558
+                        // limit allowed blocks
2559
+                        if( !empty( $this->options['allowed-blocks'] ) ){
2560
+                            echo "allowedBlocks : " . wp_json_encode( $this->options['allowed-blocks'] ) . ",";
2561
+                        }
2562
+
2563
+                        // maybe set no_wrap
2564
+                        $no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
2565
+                        if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) {
2566
+                            $no_wrap = true;
2567
+                        }
2568
+                        if ( $no_wrap ) {
2569
+                            $this->options['block-wrap'] = '';
2570
+                        }
2571
+
2572
+                        // maybe load the drag/drop functions.
2573
+                        $img_drag_drop = false;
2574
+
2575
+                        $show_alignment = false;
2576
+                        // align feature
2577
+                        /*echo "supports: {";
2578 2578
 						echo "	align: true,";
2579 2579
 						echo "  html: false";
2580 2580
 						echo "},";*/
2581 2581
 
2582 2582
 
2583
-							echo "attributes : {";
2584
-
2585
-							if ( $show_advanced ) {
2586
-								echo "show_advanced: {";
2587
-								echo "	type: 'boolean',";
2588
-								echo "  default: false,";
2589
-								echo "},";
2590
-							}
2591
-
2592
-							// block wrap element
2593
-							if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this?
2594
-								echo "block_wrap: {";
2595
-								echo "	type: 'string',";
2596
-								echo "  default: '" . esc_attr( $this->options['block-wrap'] ) . "',";
2597
-								echo "},";
2598
-							}
2599
-
2600
-
2601
-							if ( ! empty( $this->arguments ) ) {
2602
-
2603
-								foreach ( $this->arguments as $key => $args ) {
2604
-
2605
-									if( $args['type'] == 'image' ||  $args['type'] == 'images' ){
2606
-										$img_drag_drop = true;
2607
-									}
2608
-
2609
-									// set if we should show alignment
2610
-									if ( $key == 'alignment' ) {
2611
-										$show_alignment = true;
2612
-									}
2613
-
2614
-									$extra = '';
2615
-
2616
-									if ( $args['type'] == 'notice' ||  $args['type'] == 'tab' ) {
2617
-										continue;
2618
-									}
2619
-									elseif ( $args['type'] == 'checkbox' ) {
2620
-										$type    = 'boolean';
2621
-										$default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false';
2622
-									} elseif ( $args['type'] == 'number' ) {
2623
-										$type    = 'number';
2624
-										$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2625
-									} elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
2626
-										$type = 'array';
2627
-										if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
2628
-											$default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]";
2629
-										} else {
2630
-											$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2631
-										}
2632
-									} elseif ( $args['type'] == 'tagselect' ) {
2633
-										$type    = 'array';
2634
-										$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2635
-									} elseif ( $args['type'] == 'multiselect' ) {
2636
-										$type    = 'array';
2637
-										$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2638
-									} elseif ( $args['type'] == 'image_xy' ) {
2639
-										$type    = 'object';
2640
-										$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2641
-									} elseif ( $args['type'] == 'image' ) {
2642
-										$type    = 'string';
2643
-										$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2644
-
2645
-										// add a field for ID
2646
-	//                                    echo $key . "_id : {";
2647
-	//                                    echo "type : 'number',";
2648
-	//                                    echo "},";
2649
-	//                                    echo $key . "_xy : {";
2650
-	//                                    echo "type : 'object',";
2651
-	//                                    echo "},";
2652
-
2653
-									} else {
2654
-										$type    = !empty($args['hidden_type']) ? esc_attr($args['hidden_type']) : 'string';
2655
-										$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2656
-
2657
-									}
2658
-									echo $key . " : {";
2659
-									echo "type : '$type',";
2660
-									echo "default : $default,";
2661
-									echo "},";
2662
-								}
2663
-							}
2664
-
2665
-							echo "content : {type : 'string',default: 'Please select the attributes in the block settings'},";
2666
-							echo "sd_shortcode : {type : 'string',default: ''},";
2667
-
2668
-							if(!empty($this->options['nested-block']) || !empty($this->arguments['html']) ){
2669
-								echo "sd_shortcode_close : {type : 'string',default: ''},";
2670
-							}
2671
-
2672
-							echo "className: { type: 'string', default: '' },";
2673
-
2674
-							echo "},";
2675
-
2676
-
2677
-
2678
-						?>
2583
+                            echo "attributes : {";
2584
+
2585
+                            if ( $show_advanced ) {
2586
+                                echo "show_advanced: {";
2587
+                                echo "	type: 'boolean',";
2588
+                                echo "  default: false,";
2589
+                                echo "},";
2590
+                            }
2591
+
2592
+                            // block wrap element
2593
+                            if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this?
2594
+                                echo "block_wrap: {";
2595
+                                echo "	type: 'string',";
2596
+                                echo "  default: '" . esc_attr( $this->options['block-wrap'] ) . "',";
2597
+                                echo "},";
2598
+                            }
2599
+
2600
+
2601
+                            if ( ! empty( $this->arguments ) ) {
2602
+
2603
+                                foreach ( $this->arguments as $key => $args ) {
2604
+
2605
+                                    if( $args['type'] == 'image' ||  $args['type'] == 'images' ){
2606
+                                        $img_drag_drop = true;
2607
+                                    }
2608
+
2609
+                                    // set if we should show alignment
2610
+                                    if ( $key == 'alignment' ) {
2611
+                                        $show_alignment = true;
2612
+                                    }
2613
+
2614
+                                    $extra = '';
2615
+
2616
+                                    if ( $args['type'] == 'notice' ||  $args['type'] == 'tab' ) {
2617
+                                        continue;
2618
+                                    }
2619
+                                    elseif ( $args['type'] == 'checkbox' ) {
2620
+                                        $type    = 'boolean';
2621
+                                        $default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false';
2622
+                                    } elseif ( $args['type'] == 'number' ) {
2623
+                                        $type    = 'number';
2624
+                                        $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2625
+                                    } elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
2626
+                                        $type = 'array';
2627
+                                        if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
2628
+                                            $default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]";
2629
+                                        } else {
2630
+                                            $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2631
+                                        }
2632
+                                    } elseif ( $args['type'] == 'tagselect' ) {
2633
+                                        $type    = 'array';
2634
+                                        $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2635
+                                    } elseif ( $args['type'] == 'multiselect' ) {
2636
+                                        $type    = 'array';
2637
+                                        $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2638
+                                    } elseif ( $args['type'] == 'image_xy' ) {
2639
+                                        $type    = 'object';
2640
+                                        $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2641
+                                    } elseif ( $args['type'] == 'image' ) {
2642
+                                        $type    = 'string';
2643
+                                        $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2644
+
2645
+                                        // add a field for ID
2646
+    //                                    echo $key . "_id : {";
2647
+    //                                    echo "type : 'number',";
2648
+    //                                    echo "},";
2649
+    //                                    echo $key . "_xy : {";
2650
+    //                                    echo "type : 'object',";
2651
+    //                                    echo "},";
2652
+
2653
+                                    } else {
2654
+                                        $type    = !empty($args['hidden_type']) ? esc_attr($args['hidden_type']) : 'string';
2655
+                                        $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2656
+
2657
+                                    }
2658
+                                    echo $key . " : {";
2659
+                                    echo "type : '$type',";
2660
+                                    echo "default : $default,";
2661
+                                    echo "},";
2662
+                                }
2663
+                            }
2664
+
2665
+                            echo "content : {type : 'string',default: 'Please select the attributes in the block settings'},";
2666
+                            echo "sd_shortcode : {type : 'string',default: ''},";
2667
+
2668
+                            if(!empty($this->options['nested-block']) || !empty($this->arguments['html']) ){
2669
+                                echo "sd_shortcode_close : {type : 'string',default: ''},";
2670
+                            }
2671
+
2672
+                            echo "className: { type: 'string', default: '' },";
2673
+
2674
+                            echo "},";
2675
+
2676
+
2677
+
2678
+                        ?>
2679 2679
 
2680 2680
 						// The "edit" property must be a valid function.
2681 2681
 						edit: function (props) {
@@ -2750,10 +2750,10 @@  discard block
 block discarded – undo
2750 2750
 							}
2751 2751
 
2752 2752
 							<?php
2753
-							if(!empty($this->options['block-edit-raw'])) {
2754
-								echo $this->options['block-edit-raw']; // strings have to be in single quotes, may cause issues
2755
-							}else{
2756
-							?>
2753
+                            if(!empty($this->options['block-edit-raw'])) {
2754
+                                echo $this->options['block-edit-raw']; // strings have to be in single quotes, may cause issues
2755
+                            }else{
2756
+                            ?>
2757 2757
 
2758 2758
 function hasSelectedInnerBlock(props) {
2759 2759
 	const select = wp.data.select('core/editor');
@@ -2775,9 +2775,9 @@  discard block
 block discarded – undo
2775 2775
 
2776 2776
 	var $value = '';
2777 2777
 	<?php
2778
-	// if we have a post_type and a category then link them
2779
-	if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){
2780
-	?>
2778
+    // if we have a post_type and a category then link them
2779
+    if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){
2780
+    ?>
2781 2781
 	if(typeof(prev_attributes[props.clientId]) != 'undefined' && selectedBlock && selectedBlock.clientId === props.clientId){
2782 2782
 		$pt = props.attributes.post_type;
2783 2783
 		if(post_type_rest_slugs.length){
@@ -2790,11 +2790,11 @@  discard block
 block discarded – undo
2790 2790
 			term_query_type = $pt;
2791 2791
 		}
2792 2792
 <?php
2793
-	$cat_path = '';
2794
-	if ( ! empty( $this->arguments['post_type']['onchange_rest']['path'] ) ) {
2795
-		$cat_path = esc_js( strip_tags( $this->arguments['post_type']['onchange_rest']['path'] ) );
2796
-		$cat_path = str_replace( array( '&quot;', '&#039;' ), array( '"', "'" ), $cat_path );
2797
-	}
2793
+    $cat_path = '';
2794
+    if ( ! empty( $this->arguments['post_type']['onchange_rest']['path'] ) ) {
2795
+        $cat_path = esc_js( strip_tags( $this->arguments['post_type']['onchange_rest']['path'] ) );
2796
+        $cat_path = str_replace( array( '&quot;', '&#039;' ), array( '"', "'" ), $cat_path );
2797
+    }
2798 2798
 ?>
2799 2799
 		/* taxonomies */
2800 2800
 		if($value && 'post_type' in prev_attributes[props.clientId] && 'category' in prev_attributes[props.clientId] && run){
@@ -2886,7 +2886,7 @@  discard block
 block discarded – undo
2886 2886
 <?php
2887 2887
 $current_screen = function_exists('get_current_screen') ? get_current_screen() : '';
2888 2888
 if(!empty($current_screen->base) && $current_screen->base==='widgets'){
2889
-	echo 'const { deviceType } = "";';
2889
+    echo 'const { deviceType } = "";';
2890 2890
 }else{
2891 2891
 ?>
2892 2892
 /** Get device type const. */
@@ -2950,8 +2950,8 @@  discard block
 block discarded – undo
2950 2950
 										'attributes': props.attributes,
2951 2951
 										'block_parent_name': parentBlocks.length ? parentBlocks[parentBlocks.length - 1].name : '',
2952 2952
 										'post_id': <?php global $post; if ( isset( $post->ID ) ) {
2953
-										echo $post->ID;
2954
-									}else{echo '0';}?>,
2953
+                                        echo $post->ID;
2954
+                                    }else{echo '0';}?>,
2955 2955
 										'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
2956 2956
 									};
2957 2957
 
@@ -2965,20 +2965,20 @@  discard block
 block discarded – undo
2965 2965
 										}
2966 2966
 
2967 2967
 										 <?php
2968
-										if(!empty($this->options['nested-block'])){
2969
-											?>
2968
+                                        if(!empty($this->options['nested-block'])){
2969
+                                            ?>
2970 2970
 											// props.setAttributes({content: env});
2971 2971
 										is_fetching = false;
2972 2972
 										prev_attributes[props.clientId] = props.attributes;
2973 2973
 											 <?php
2974
-										}else{
2975
-										?>
2974
+                                        }else{
2975
+                                        ?>
2976 2976
 										props.setAttributes({content: env});
2977 2977
 										is_fetching = false;
2978 2978
 										prev_attributes[props.clientId] = props.attributes;
2979 2979
 										<?php
2980
-										}
2981
-										?>
2980
+                                        }
2981
+                                        ?>
2982 2982
 
2983 2983
 
2984 2984
 										// if AUI is active call the js init function
@@ -2997,31 +2997,31 @@  discard block
 block discarded – undo
2997 2997
 							}
2998 2998
 
2999 2999
 							<?php
3000
-							if(!empty($this->options['block-edit-js'])) {
3001
-								echo  $this->options['block-edit-js'] ; // strings have to be in single quotes, may cause issues
3002
-							}
3000
+                            if(!empty($this->options['block-edit-js'])) {
3001
+                                echo  $this->options['block-edit-js'] ; // strings have to be in single quotes, may cause issues
3002
+                            }
3003 3003
 
3004 3004
 
3005 3005
 
3006 3006
 
3007
-							if(empty($this->options['block-save-return'])){
3008
-							?>
3007
+                            if(empty($this->options['block-save-return'])){
3008
+                            ?>
3009 3009
 								///////////////////////////////////////////////////////////////////////
3010 3010
 
3011 3011
 									 // build the shortcode.
3012 3012
 								shortcode = "[<?php echo $this->options['base_id'];?>";
3013 3013
 								<?php
3014 3014
 
3015
-								if(! empty( $this->arguments )){
3015
+                                if(! empty( $this->arguments )){
3016 3016
 
3017
-								foreach($this->arguments as $key => $args){
3018
-								   // if($args['type']=='tabs'){continue;}
3017
+                                foreach($this->arguments as $key => $args){
3018
+                                    // if($args['type']=='tabs'){continue;}
3019 3019
 
3020
-								   // don't add metadata arguments
3021
-								   if (substr($key, 0, 9 ) === 'metadata_') {
3022
-									   continue;
3023
-								   }
3024
-								?>
3020
+                                    // don't add metadata arguments
3021
+                                    if (substr($key, 0, 9 ) === 'metadata_') {
3022
+                                        continue;
3023
+                                    }
3024
+                                ?>
3025 3025
 								if (props.attributes.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
3026 3026
 									if ('<?php echo esc_attr( $key );?>' == 'html') {
3027 3027
 									} else if ('<?php echo esc_attr( $args['type'] );?>' == 'image_xy') {
@@ -3032,10 +3032,10 @@  discard block
 block discarded – undo
3032 3032
 									}
3033 3033
 								}
3034 3034
 								<?php
3035
-								}
3036
-								}
3035
+                                }
3036
+                                }
3037 3037
 
3038
-								?>
3038
+                                ?>
3039 3039
 								shortcode += "]";
3040 3040
 
3041 3041
 								if(shortcode){
@@ -3047,17 +3047,17 @@  discard block
 block discarded – undo
3047 3047
 
3048 3048
 
3049 3049
 									<?php
3050
-									if(!empty($this->options['nested-block']) || !empty($this->arguments['html']) ){
3051
-										echo "props.setAttributes({sd_shortcode_close: '[/".esc_attr( $this->options['base_id'] )."]'});";
3052
-									}
3053
-									?>
3050
+                                    if(!empty($this->options['nested-block']) || !empty($this->arguments['html']) ){
3051
+                                        echo "props.setAttributes({sd_shortcode_close: '[/".esc_attr( $this->options['base_id'] )."]'});";
3052
+                                    }
3053
+                                    ?>
3054 3054
 								}
3055 3055
 
3056 3056
 
3057 3057
 							///////////////////////////////////////////////////////////////////////
3058 3058
 							<?php
3059
-							} // end nested block check
3060
-							?>
3059
+                            } // end nested block check
3060
+                            ?>
3061 3061
 
3062 3062
 							return [
3063 3063
 
@@ -3081,10 +3081,10 @@  discard block
 block discarded – undo
3081 3081
 
3082 3082
 									<?php
3083 3083
 
3084
-									if(! empty( $this->arguments )){
3084
+                                    if(! empty( $this->arguments )){
3085 3085
 
3086
-									if ( $show_advanced ) {
3087
-									?>
3086
+                                    if ( $show_advanced ) {
3087
+                                    ?>
3088 3088
 									el('div', {
3089 3089
 											style: {'padding-left': '16px','padding-right': '16px'}
3090 3090
 										},
@@ -3101,119 +3101,119 @@  discard block
 block discarded – undo
3101 3101
 									)
3102 3102
 									,
3103 3103
 									<?php
3104
-									}
3105
-
3106
-									$arguments = $this->group_arguments( $this->arguments );
3107
-									$block_group_tabs = ! empty( $this->options['block_group_tabs'] ) ? $this->group_block_tabs( $this->options['block_group_tabs'], $arguments ) : array();
3108
-
3109
-									// Do we have sections?
3110
-									$has_sections = $arguments == $this->arguments ? false : true;
3111
-
3112
-									if($has_sections){
3113
-									$panel_count = 0;
3114
-									$open_tab = '';
3115
-
3116
-									$open_tab_groups = array();
3117
-									$used_tabs = array();
3118
-
3119
-									foreach ( $arguments as $key => $args ) {
3120
-										$close_tab = false;
3121
-										$close_tabs = false;
3122
-
3123
-										 if ( ! empty( $block_group_tabs ) ) {
3124
-											foreach ( $block_group_tabs as $tab_name => $tab_args ) {
3125
-												if ( in_array( $key, $tab_args['groups'] ) ) {
3126
-													$open_tab_groups[] = $key;
3127
-
3128
-													if ( $open_tab != $tab_name ) {
3129
-														$tab_args['tab']['tabs_open'] = $open_tab == '' ? true : false;
3130
-														$tab_args['tab']['open'] = true;
3131
-
3132
-														$this->block_tab_start( '', $tab_args );
3133
-														$open_tab = $tab_name;
3134
-														$used_tabs[] = $tab_name;
3135
-													}
3136
-
3137
-													if ( $open_tab_groups == $tab_args['groups'] ) {
3138
-														$close_tab = true;
3139
-														$open_tab_groups = array();
3140
-
3141
-														if ( $used_tabs == array_keys( $block_group_tabs ) ) {
3142
-															$close_tabs = true;
3143
-														}
3144
-													}
3145
-												}
3146
-											}
3147
-										}
3148
-										?>
3104
+                                    }
3105
+
3106
+                                    $arguments = $this->group_arguments( $this->arguments );
3107
+                                    $block_group_tabs = ! empty( $this->options['block_group_tabs'] ) ? $this->group_block_tabs( $this->options['block_group_tabs'], $arguments ) : array();
3108
+
3109
+                                    // Do we have sections?
3110
+                                    $has_sections = $arguments == $this->arguments ? false : true;
3111
+
3112
+                                    if($has_sections){
3113
+                                    $panel_count = 0;
3114
+                                    $open_tab = '';
3115
+
3116
+                                    $open_tab_groups = array();
3117
+                                    $used_tabs = array();
3118
+
3119
+                                    foreach ( $arguments as $key => $args ) {
3120
+                                        $close_tab = false;
3121
+                                        $close_tabs = false;
3122
+
3123
+                                            if ( ! empty( $block_group_tabs ) ) {
3124
+                                            foreach ( $block_group_tabs as $tab_name => $tab_args ) {
3125
+                                                if ( in_array( $key, $tab_args['groups'] ) ) {
3126
+                                                    $open_tab_groups[] = $key;
3127
+
3128
+                                                    if ( $open_tab != $tab_name ) {
3129
+                                                        $tab_args['tab']['tabs_open'] = $open_tab == '' ? true : false;
3130
+                                                        $tab_args['tab']['open'] = true;
3131
+
3132
+                                                        $this->block_tab_start( '', $tab_args );
3133
+                                                        $open_tab = $tab_name;
3134
+                                                        $used_tabs[] = $tab_name;
3135
+                                                    }
3136
+
3137
+                                                    if ( $open_tab_groups == $tab_args['groups'] ) {
3138
+                                                        $close_tab = true;
3139
+                                                        $open_tab_groups = array();
3140
+
3141
+                                                        if ( $used_tabs == array_keys( $block_group_tabs ) ) {
3142
+                                                            $close_tabs = true;
3143
+                                                        }
3144
+                                                    }
3145
+                                                }
3146
+                                            }
3147
+                                        }
3148
+                                        ?>
3149 3149
 										el(wp.components.PanelBody, {
3150 3150
 												title: '<?php esc_attr_e( $key ); ?>',
3151 3151
 												initialOpen: <?php if ( $panel_count ) {
3152
-												echo "false";
3153
-											} else {
3154
-												echo "true";
3155
-											}?>
3152
+                                                echo "false";
3153
+                                            } else {
3154
+                                                echo "true";
3155
+                                            }?>
3156 3156
 											},
3157 3157
 											<?php
3158
-											foreach ( $args as $k => $a ) {
3159
-												$this->block_tab_start( $k, $a );
3160
-												$this->block_row_start( $k, $a );
3161
-												$this->build_block_arguments( $k, $a );
3162
-												$this->block_row_end( $k, $a );
3163
-												$this->block_tab_end( $k, $a );
3164
-											}
3165
-											?>
3158
+                                            foreach ( $args as $k => $a ) {
3159
+                                                $this->block_tab_start( $k, $a );
3160
+                                                $this->block_row_start( $k, $a );
3161
+                                                $this->build_block_arguments( $k, $a );
3162
+                                                $this->block_row_end( $k, $a );
3163
+                                                $this->block_tab_end( $k, $a );
3164
+                                            }
3165
+                                            ?>
3166 3166
 										),
3167 3167
 										<?php
3168
-										$panel_count ++;
3168
+                                        $panel_count ++;
3169 3169
 
3170
-										if($close_tab || $close_tabs){
3171
-											$tab_args = array(
3172
-												'tab'	=> array(
3173
-													'tabs_close' => $close_tabs,
3174
-												'close' => true,
3175
-												)
3170
+                                        if($close_tab || $close_tabs){
3171
+                                            $tab_args = array(
3172
+                                                'tab'	=> array(
3173
+                                                    'tabs_close' => $close_tabs,
3174
+                                                'close' => true,
3175
+                                                )
3176 3176
 
3177
-											);
3178
-											$this->block_tab_end( '', $tab_args );
3177
+                                            );
3178
+                                            $this->block_tab_end( '', $tab_args );
3179 3179
 //											echo '###close'; print_r($tab_args);
3180
-											$panel_count = 0;
3181
-										}
3180
+                                            $panel_count = 0;
3181
+                                        }
3182 3182
 //
3183 3183
 
3184
-									}
3185
-									}else {
3186
-									?>
3184
+                                    }
3185
+                                    }else {
3186
+                                    ?>
3187 3187
 									el(wp.components.PanelBody, {
3188 3188
 											title: '<?php esc_attr_e( "Settings", 'ayecode-connect' ); ?>',
3189 3189
 											initialOpen: true
3190 3190
 										},
3191 3191
 										<?php
3192
-										foreach ( $this->arguments as $key => $args ) {
3193
-											$this->block_row_start( $key, $args );
3194
-											$this->build_block_arguments( $key, $args );
3195
-											$this->block_row_end( $key, $args );
3196
-										}
3197
-										?>
3192
+                                        foreach ( $this->arguments as $key => $args ) {
3193
+                                            $this->block_row_start( $key, $args );
3194
+                                            $this->build_block_arguments( $key, $args );
3195
+                                            $this->block_row_end( $key, $args );
3196
+                                        }
3197
+                                        ?>
3198 3198
 									),
3199 3199
 									<?php
3200
-									}
3200
+                                    }
3201 3201
 
3202
-									}
3203
-									?>
3202
+                                    }
3203
+                                    ?>
3204 3204
 
3205 3205
 								),
3206 3206
 
3207 3207
 								<?php
3208
-								// If the user sets block-output array then build it
3209
-								if ( ! empty( $this->options['block-output'] ) ) {
3210
-								$this->block_element( $this->options['block-output'] );
3211
-							}elseif(!empty($this->options['block-edit-return'])){
3212
-								   echo $this->options['block-edit-return'];
3213
-							}else{
3214
-								// if no block-output is set then we try and get the shortcode html output via ajax.
3215
-								$block_edit_wrap_tag = !empty($this->options['block_edit_wrap_tag']) ? esc_attr($this->options['block_edit_wrap_tag']) : 'div';
3216
-								?>
3208
+                                // If the user sets block-output array then build it
3209
+                                if ( ! empty( $this->options['block-output'] ) ) {
3210
+                                $this->block_element( $this->options['block-output'] );
3211
+                            }elseif(!empty($this->options['block-edit-return'])){
3212
+                                    echo $this->options['block-edit-return'];
3213
+                            }else{
3214
+                                // if no block-output is set then we try and get the shortcode html output via ajax.
3215
+                                $block_edit_wrap_tag = !empty($this->options['block_edit_wrap_tag']) ? esc_attr($this->options['block_edit_wrap_tag']) : 'div';
3216
+                                ?>
3217 3217
 								el('<?php echo esc_attr($block_edit_wrap_tag); ?>', wp.blockEditor.useBlockProps({
3218 3218
 									dangerouslySetInnerHTML: {__html: onChangeContent()},
3219 3219
 									className: props.className,
@@ -3221,13 +3221,13 @@  discard block
 block discarded – undo
3221 3221
 									style: {'minHeight': '30px'}
3222 3222
 								}))
3223 3223
 								<?php
3224
-								}
3225
-								?>
3224
+                                }
3225
+                                ?>
3226 3226
 							]; // end return
3227 3227
 
3228 3228
 							<?php
3229
-							} // end block-edit-raw else
3230
-							?>
3229
+                            } // end block-edit-raw else
3230
+                            ?>
3231 3231
 						},
3232 3232
 
3233 3233
 						// The "save" property must be specified and must be a valid function.
@@ -3241,16 +3241,16 @@  discard block
 block discarded – undo
3241 3241
 							$html = '';
3242 3242
 							<?php
3243 3243
 
3244
-							if(! empty( $this->arguments )){
3244
+                            if(! empty( $this->arguments )){
3245 3245
 
3246
-							foreach($this->arguments as $key => $args){
3247
-							   // if($args['type']=='tabs'){continue;}
3246
+                            foreach($this->arguments as $key => $args){
3247
+                                // if($args['type']=='tabs'){continue;}
3248 3248
 
3249
-							   // don't add metadata arguments
3250
-							   if (substr($key, 0, 9 ) === 'metadata_') {
3251
-								   continue;
3252
-							   }
3253
-							?>
3249
+                                // don't add metadata arguments
3250
+                                if (substr($key, 0, 9 ) === 'metadata_') {
3251
+                                    continue;
3252
+                                }
3253
+                            ?>
3254 3254
 							if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
3255 3255
 								if ('<?php echo esc_attr( $key );?>' == 'html') {
3256 3256
 									$html = attr.<?php echo esc_attr( $key );?>;
@@ -3261,10 +3261,10 @@  discard block
 block discarded – undo
3261 3261
 								}
3262 3262
 							}
3263 3263
 							<?php
3264
-							}
3265
-							}
3264
+                            }
3265
+                            }
3266 3266
 
3267
-							?>
3267
+                            ?>
3268 3268
 							content += "]";
3269 3269
 							 content = '';
3270 3270
 
@@ -3274,7 +3274,7 @@  discard block
 block discarded – undo
3274 3274
 //                                $html = 'el( InnerBlocks.Content )';
3275 3275
 //                                <?php
3276 3276
 //                            }
3277
-							?>
3277
+                            ?>
3278 3278
 							// if has html element
3279 3279
 							if ($html) {
3280 3280
 								//content += $html + "[/<?php echo $this->options['base_id'];?>]";
@@ -3307,12 +3307,12 @@  discard block
 block discarded – undo
3307 3307
 //                                <x?php
3308 3308
 //							}else
3309 3309
 
3310
-							if(!empty($this->options['block-output'])){
3310
+                            if(!empty($this->options['block-output'])){
3311 3311
 //                               echo "return";
3312 3312
 //                               $this->block_element( $this->options['block-output'], true );
3313 3313
 //                               echo ";";
3314 3314
 
3315
-							   ?>
3315
+                                ?>
3316 3316
 							  return el(
3317 3317
 								   '',
3318 3318
 								   {},
@@ -3322,10 +3322,10 @@  discard block
 block discarded – undo
3322 3322
 							   );
3323 3323
 								<?php
3324 3324
 
3325
-							}elseif(!empty($this->options['block-save-return'])){
3326
-								   echo 'return ' . $this->options['block-save-return'];
3327
-							}elseif(!empty($this->options['nested-block'])){
3328
-								?>
3325
+                            }elseif(!empty($this->options['block-save-return'])){
3326
+                                    echo 'return ' . $this->options['block-save-return'];
3327
+                            }elseif(!empty($this->options['nested-block'])){
3328
+                                ?>
3329 3329
 							  return el(
3330 3330
 								   '',
3331 3331
 								   {},
@@ -3334,22 +3334,22 @@  discard block
 block discarded – undo
3334 3334
 								 //  el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}})
3335 3335
 							   );
3336 3336
 								<?php
3337
-							}elseif(!empty( $this->options['block-save-return'] ) ){
3338
-								echo "return ". $this->options['block-edit-return'].";";
3339
-							}elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
3340
-							?>
3337
+                            }elseif(!empty( $this->options['block-save-return'] ) ){
3338
+                                echo "return ". $this->options['block-edit-return'].";";
3339
+                            }elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
3340
+                            ?>
3341 3341
 							return content;
3342 3342
 							<?php
3343
-							}else{
3344
-							?>
3343
+                            }else{
3344
+                            ?>
3345 3345
 							var block_wrap = 'div';
3346 3346
 							if (attr.hasOwnProperty("block_wrap")) {
3347 3347
 								block_wrap = attr.block_wrap;
3348 3348
 							}
3349 3349
 							return el(block_wrap, wp.blockEditor.useBlockProps.save( {dangerouslySetInnerHTML: {__html: content}, className: align} ));
3350 3350
 							<?php
3351
-							}
3352
-							?>
3351
+                            }
3352
+                            ?>
3353 3353
 
3354 3354
 
3355 3355
 						}
@@ -3363,43 +3363,43 @@  discard block
 block discarded – undo
3363 3363
 				});
3364 3364
 			</script>
3365 3365
 			<?php
3366
-			$output = ob_get_clean();
3366
+            $output = ob_get_clean();
3367 3367
 
3368
-			/*
3368
+            /*
3369 3369
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
3370 3370
 			 */
3371 3371
 
3372
-			return str_replace( array(
3373
-				'<script>',
3374
-				'</script>'
3375
-			), '', $output );
3376
-		}
3372
+            return str_replace( array(
3373
+                '<script>',
3374
+                '</script>'
3375
+            ), '', $output );
3376
+        }
3377 3377
 
3378 3378
 
3379 3379
 
3380
-		public function block_row_start($key, $args){
3380
+        public function block_row_start($key, $args){
3381 3381
 
3382
-			// check for row
3383
-			if(!empty($args['row'])){
3382
+            // check for row
3383
+            if(!empty($args['row'])){
3384 3384
 
3385
-				if(!empty($args['row']['open'])){
3385
+                if(!empty($args['row']['open'])){
3386 3386
 
3387
-				// element require
3388
-				$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3389
-				$device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
3390
-				$device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
3391
-				$device_type_icon = '';
3392
-				if($device_type=='Desktop'){
3393
-					$device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3394
-				}elseif($device_type=='Tablet'){
3395
-					$device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3396
-				}elseif($device_type=='Mobile'){
3397
-					$device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3398
-				}
3399
-				echo $element_require;
3400
-				echo $device_type_require;
3387
+                // element require
3388
+                $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3389
+                $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
3390
+                $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
3391
+                $device_type_icon = '';
3392
+                if($device_type=='Desktop'){
3393
+                    $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3394
+                }elseif($device_type=='Tablet'){
3395
+                    $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3396
+                }elseif($device_type=='Mobile'){
3397
+                    $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3398
+                }
3399
+                echo $element_require;
3400
+                echo $device_type_require;
3401 3401
 
3402
-					if(false){?><script><?php }?>
3402
+                    if(false){?><script><?php }?>
3403 3403
 						el('div', {
3404 3404
 								className: 'bsui components-base-control',
3405 3405
 							},
@@ -3412,8 +3412,8 @@  discard block
 block discarded – undo
3412 3412
 								<?php if($device_type_icon){ ?>
3413 3413
 									deviceType == '<?php echo $device_type;?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}})
3414 3414
 								<?php
3415
-								}
3416
-								?>
3415
+                                }
3416
+                                ?>
3417 3417
 
3418 3418
 
3419 3419
 							),
@@ -3437,51 +3437,51 @@  discard block
 block discarded – undo
3437 3437
 									},
3438 3438
 
3439 3439
 					<?php
3440
-					if(false){?></script><?php }
3441
-				}elseif(!empty($args['row']['close'])){
3442
-					if(false){?><script><?php }?>
3440
+                    if(false){?></script><?php }
3441
+                }elseif(!empty($args['row']['close'])){
3442
+                    if(false){?><script><?php }?>
3443 3443
 						el(
3444 3444
 							'div',
3445 3445
 							{
3446 3446
 								className: 'col pl-0 ps-0',
3447 3447
 							},
3448 3448
 					<?php
3449
-					if(false){?></script><?php }
3450
-				}else{
3451
-					if(false){?><script><?php }?>
3449
+                    if(false){?></script><?php }
3450
+                }else{
3451
+                    if(false){?><script><?php }?>
3452 3452
 						el(
3453 3453
 							'div',
3454 3454
 							{
3455 3455
 								className: 'col pl-0 ps-0 pr-2 pe-2',
3456 3456
 							},
3457 3457
 					<?php
3458
-					if(false){?></script><?php }
3459
-				}
3458
+                    if(false){?></script><?php }
3459
+                }
3460 3460
 
3461
-			}
3461
+            }
3462 3462
 
3463
-		}
3463
+        }
3464 3464
 
3465
-		public function block_row_end($key, $args){
3465
+        public function block_row_end($key, $args){
3466 3466
 
3467
-			if(!empty($args['row'])){
3468
-				// maybe close
3469
-				if(!empty($args['row']['close'])){
3470
-					echo "))";
3471
-				}
3467
+            if(!empty($args['row'])){
3468
+                // maybe close
3469
+                if(!empty($args['row']['close'])){
3470
+                    echo "))";
3471
+                }
3472 3472
 
3473
-				echo "),";
3474
-			}
3475
-		}
3473
+                echo "),";
3474
+            }
3475
+        }
3476 3476
 
3477
-		public function block_tab_start($key, $args){
3477
+        public function block_tab_start($key, $args){
3478 3478
 
3479
-			// check for row
3480
-			if(!empty($args['tab'])){
3479
+            // check for row
3480
+            if(!empty($args['tab'])){
3481 3481
 
3482
-				if(!empty($args['tab']['tabs_open'])){
3482
+                if(!empty($args['tab']['tabs_open'])){
3483 3483
 
3484
-					if(false){?><script><?php }?>
3484
+                    if(false){?><script><?php }?>
3485 3485
 
3486 3486
 el('div',{className: 'bsui'},
3487 3487
 
@@ -3494,12 +3494,12 @@  discard block
 block discarded – undo
3494 3494
 										tabs: [
3495 3495
 
3496 3496
 					<?php
3497
-					if(false){?></script><?php }
3498
-				}
3497
+                    if(false){?></script><?php }
3498
+                }
3499 3499
 
3500
-				if(!empty($args['tab']['open'])){
3500
+                if(!empty($args['tab']['open'])){
3501 3501
 
3502
-					if(false){?><script><?php }?>
3502
+                    if(false){?><script><?php }?>
3503 3503
 							{
3504 3504
 												name: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>',
3505 3505
 												title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes( esc_attr( $args['tab']['title']) ); ?>'}}),
@@ -3508,93 +3508,93 @@  discard block
 block discarded – undo
3508 3508
 									className: 'components-base-control__help mb-0',
3509 3509
 									dangerouslySetInnerHTML: {__html:'<?php echo addslashes( $args['tab']['desc'] ); ?>'}
3510 3510
 								}),<?php }
3511
-					if(false){?></script><?php }
3512
-				}
3511
+                    if(false){?></script><?php }
3512
+                }
3513 3513
 
3514
-			}
3514
+            }
3515 3515
 
3516
-		}
3516
+        }
3517 3517
 
3518
-		public function block_tab_end($key, $args){
3518
+        public function block_tab_end($key, $args){
3519 3519
 
3520
-			if(!empty($args['tab'])){
3521
-				// maybe close
3522
-				if(!empty($args['tab']['close'])){
3523
-					echo ")}, /* tab close */";
3524
-				}
3520
+            if(!empty($args['tab'])){
3521
+                // maybe close
3522
+                if(!empty($args['tab']['close'])){
3523
+                    echo ")}, /* tab close */";
3524
+                }
3525 3525
 
3526
-				if(!empty($args['tab']['tabs_close'])){
3527
-					if(false){?><script><?php }?>
3526
+                if(!empty($args['tab']['tabs_close'])){
3527
+                    if(false){?><script><?php }?>
3528 3528
 						]}, ( tab ) => {
3529 3529
 								return tab.content;
3530 3530
 							}
3531 3531
 						)), /* tabs close */
3532 3532
 					<?php if(false){ ?></script><?php }
3533
-				}
3534
-			}
3535
-		}
3536
-
3537
-		public function build_block_arguments( $key, $args ) {
3538
-			$custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : '';
3539
-			$options           = '';
3540
-			$extra             = '';
3541
-			$require           = '';
3542
-			$inside_elements   = '';
3543
-			$after_elements	   = '';
3544
-
3545
-			// `content` is a protected and special argument
3546
-			if ( $key == 'content' ) {
3547
-				return;
3548
-			}
3549
-
3550
-			$device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
3551
-			$device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
3552
-			$device_type_icon = '';
3553
-			if($device_type=='Desktop'){
3554
-				$device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3555
-			}elseif($device_type=='Tablet'){
3556
-				$device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3557
-			}elseif($device_type=='Mobile'){
3558
-				$device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3559
-			}
3560
-
3561
-			// icon
3562
-			$icon = '';
3563
-			if( !empty( $args['icon'] ) ){
3564
-				$icon .= "el('div', {";
3565
-									$icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},";
3566
-									$icon .= "className: 'text-center',";
3567
-									$icon .= "title: '".addslashes( $args['title'] )."',";
3568
-								$icon .= "}),";
3569
-
3570
-				// blank title as its added to the icon.
3571
-				$args['title'] = '';
3572
-			}
3573
-
3574
-			// require advanced
3575
-			$require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
3576
-
3577
-			// element require
3578
-			$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3579
-
3580
-
3581
-			$onchange  = "props.setAttributes({ $key: $key } )";
3582
-			$onchangecomplete  = "";
3583
-			$value     = "props.attributes.$key";
3584
-			$text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' );
3585
-			if ( in_array( $args['type'], $text_type ) ) {
3586
-				$type = 'TextControl';
3587
-				// Save numbers as numbers and not strings
3588
-				if ( $args['type'] == 'number' ) {
3589
-					$onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )";
3590
-				}
3533
+                }
3534
+            }
3535
+        }
3591 3536
 
3592
-				if (substr($key, 0, 9 ) === 'metadata_') {
3593
-					$real_key = str_replace('metadata_','', $key );
3594
-					$onchange = "props.setAttributes({ metadata: { $real_key: $key } } )";
3595
-					$value     = "props.attributes.metadata && props.attributes.metadata.$real_key ? props.attributes.metadata.$real_key : ''";
3596
-				}
3597
-			}
3537
+        public function build_block_arguments( $key, $args ) {
3538
+            $custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : '';
3539
+            $options           = '';
3540
+            $extra             = '';
3541
+            $require           = '';
3542
+            $inside_elements   = '';
3543
+            $after_elements	   = '';
3544
+
3545
+            // `content` is a protected and special argument
3546
+            if ( $key == 'content' ) {
3547
+                return;
3548
+            }
3549
+
3550
+            $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
3551
+            $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
3552
+            $device_type_icon = '';
3553
+            if($device_type=='Desktop'){
3554
+                $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3555
+            }elseif($device_type=='Tablet'){
3556
+                $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3557
+            }elseif($device_type=='Mobile'){
3558
+                $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3559
+            }
3560
+
3561
+            // icon
3562
+            $icon = '';
3563
+            if( !empty( $args['icon'] ) ){
3564
+                $icon .= "el('div', {";
3565
+                                    $icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},";
3566
+                                    $icon .= "className: 'text-center',";
3567
+                                    $icon .= "title: '".addslashes( $args['title'] )."',";
3568
+                                $icon .= "}),";
3569
+
3570
+                // blank title as its added to the icon.
3571
+                $args['title'] = '';
3572
+            }
3573
+
3574
+            // require advanced
3575
+            $require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
3576
+
3577
+            // element require
3578
+            $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3579
+
3580
+
3581
+            $onchange  = "props.setAttributes({ $key: $key } )";
3582
+            $onchangecomplete  = "";
3583
+            $value     = "props.attributes.$key";
3584
+            $text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' );
3585
+            if ( in_array( $args['type'], $text_type ) ) {
3586
+                $type = 'TextControl';
3587
+                // Save numbers as numbers and not strings
3588
+                if ( $args['type'] == 'number' ) {
3589
+                    $onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )";
3590
+                }
3591
+
3592
+                if (substr($key, 0, 9 ) === 'metadata_') {
3593
+                    $real_key = str_replace('metadata_','', $key );
3594
+                    $onchange = "props.setAttributes({ metadata: { $real_key: $key } } )";
3595
+                    $value     = "props.attributes.metadata && props.attributes.metadata.$real_key ? props.attributes.metadata.$real_key : ''";
3596
+                }
3597
+            }
3598 3598
 //			else if ( $args['type'] == 'popup' ) {
3599 3599
 //				$type = 'TextControl';
3600 3600
 //				$args['type'] == 'text';
@@ -3612,21 +3612,21 @@  discard block
 block discarded – undo
3612 3612
 //
3613 3613
 //				$value     = "props.attributes.$key ? props.attributes.$key : ''";
3614 3614
 //			}
3615
-			else if ( $args['type'] == 'styleid' ) {
3616
-				$type = 'TextControl';
3617
-				$args['type'] == 'text';
3618
-				// Save numbers as numbers and not strings
3619
-				$value     = "props.attributes.$key ? props.attributes.$key : ''";
3620
-			}else if ( $args['type'] == 'notice' ) {
3621
-
3622
-				$notice_message = !empty($args['desc']) ? addslashes($args['desc']) : '';
3623
-				$notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info';
3624
-
3625
-				$notice = "el('div',{className:'bsui'},el(wp.components.Notice, {status: '$notice_status',isDismissible: false,className: 'm-0 pr-0 pe-0 mb-3'},el('div',{dangerouslySetInnerHTML: {__html: '$notice_message'}}))),";
3626
-				echo $notice_message ? $element_require . $notice : '';
3627
-				return;
3628
-			}
3629
-			/*
3615
+            else if ( $args['type'] == 'styleid' ) {
3616
+                $type = 'TextControl';
3617
+                $args['type'] == 'text';
3618
+                // Save numbers as numbers and not strings
3619
+                $value     = "props.attributes.$key ? props.attributes.$key : ''";
3620
+            }else if ( $args['type'] == 'notice' ) {
3621
+
3622
+                $notice_message = !empty($args['desc']) ? addslashes($args['desc']) : '';
3623
+                $notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info';
3624
+
3625
+                $notice = "el('div',{className:'bsui'},el(wp.components.Notice, {status: '$notice_status',isDismissible: false,className: 'm-0 pr-0 pe-0 mb-3'},el('div',{dangerouslySetInnerHTML: {__html: '$notice_message'}}))),";
3626
+                echo $notice_message ? $element_require . $notice : '';
3627
+                return;
3628
+            }
3629
+            /*
3630 3630
 			 * https://www.wptricks.com/question/set-current-tab-on-a-gutenberg-tabpanel-component-from-outside-that-component/ es5 layout
3631 3631
 						elseif($args['type']=='tabs'){
3632 3632
 							?>
@@ -3679,22 +3679,22 @@  discard block
 block discarded – undo
3679 3679
 							return;
3680 3680
 						}
3681 3681
 */
3682
-			elseif ( $args['type'] == 'color' ) {
3683
-				$type = 'ColorPicker';
3684
-				$onchange = "";
3685
-				$extra = "color: $value,";
3686
-				if(!empty($args['disable_alpha'])){
3687
-					$extra .= "disableAlpha: true,";
3688
-				}
3689
-				$onchangecomplete = "onChangeComplete: function($key) {
3682
+            elseif ( $args['type'] == 'color' ) {
3683
+                $type = 'ColorPicker';
3684
+                $onchange = "";
3685
+                $extra = "color: $value,";
3686
+                if(!empty($args['disable_alpha'])){
3687
+                    $extra .= "disableAlpha: true,";
3688
+                }
3689
+                $onchangecomplete = "onChangeComplete: function($key) {
3690 3690
 				value =  $key.rgb.a && $key.rgb.a < 1 ? \"rgba(\"+$key.rgb.r+\",\"+$key.rgb.g+\",\"+$key.rgb.b+\",\"+$key.rgb.a+\")\" : $key.hex;
3691 3691
 						props.setAttributes({
3692 3692
 							$key: value
3693 3693
 						});
3694 3694
 					},";
3695
-			}elseif ( $args['type'] == 'gradient' ) {
3696
-				$type = 'GradientPicker';
3697
-				$extra .= "gradients: [{
3695
+            }elseif ( $args['type'] == 'gradient' ) {
3696
+                $type = 'GradientPicker';
3697
+                $extra .= "gradients: [{
3698 3698
 			name: 'Vivid cyan blue to vivid purple',
3699 3699
 			gradient:
3700 3700
 				'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
@@ -3731,10 +3731,10 @@  discard block
 block discarded – undo
3731 3731
 			slug: 'cool-to-warm-spectrum',
3732 3732
 		}],";
3733 3733
 
3734
-			}elseif ( $args['type'] == 'image' ) {
3734
+            }elseif ( $args['type'] == 'image' ) {
3735 3735
 //                print_r($args);
3736 3736
 
3737
-				$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,{
3737
+                $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,{
3738 3738
 							url:  props.attributes.{$key}_use_featured === true ? 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiID8+CjxzdmcgYmFzZVByb2ZpbGU9InRpbnkiIGhlaWdodD0iNDAwIiB2ZXJzaW9uPSIxLjIiIHdpZHRoPSI0MDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6ZXY9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEveG1sLWV2ZW50cyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzIC8+PHJlY3QgZmlsbD0iI2QzZDNkMyIgaGVpZ2h0PSI0MDAiIHdpZHRoPSI0MDAiIHg9IjAiIHk9IjAiIC8+PGxpbmUgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIxMCIgeDE9IjAiIHgyPSI0MDAiIHkxPSIwIiB5Mj0iNDAwIiAvPjxsaW5lIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMTAiIHgxPSIwIiB4Mj0iNDAwIiB5MT0iNDAwIiB5Mj0iMCIgLz48cmVjdCBmaWxsPSIjZDNkM2QzIiBoZWlnaHQ9IjUwIiB3aWR0aD0iMjE4LjAiIHg9IjkxLjAiIHk9IjE3NS4wIiAvPjx0ZXh0IGZpbGw9IndoaXRlIiBmb250LXNpemU9IjMwIiBmb250LXdlaWdodD0iYm9sZCIgdGV4dC1hbmNob3I9Im1pZGRsZSIgeD0iMjAwLjAiIHk9IjIwNy41Ij5QTEFDRUhPTERFUjwvdGV4dD48L3N2Zz4='  : props.attributes.$key,
3739 3739
 							value: props.attributes.{$key}_xy.x !== undefined && props.attributes.{$key}_xy.x >= 0 ? props.attributes.{$key}_xy  : {x: 0.5,y: 0.5,},
3740 3740
 //                            value: props.attributes.{$key}_xy,
@@ -3755,16 +3755,16 @@  discard block
 block discarded – undo
3755 3755
 						}), ";
3756 3756
 
3757 3757
 
3758
-				$value = '""';
3759
-				$type = 'MediaUpload';
3760
-				$extra .= "onSelect: function(media){
3758
+                $value = '""';
3759
+                $type = 'MediaUpload';
3760
+                $extra .= "onSelect: function(media){
3761 3761
 					  return props.setAttributes({
3762 3762
 						  $key: media.url,
3763 3763
 						  {$key}_id: media.id
3764 3764
 						});
3765 3765
 					  },";
3766
-				   $extra .= "type: 'image',";
3767
-				   $extra .= "render: function (obj) {
3766
+                    $extra .= "type: 'image',";
3767
+                    $extra .= "render: function (obj) {
3768 3768
 						return el( 'div',{},
3769 3769
 						( !props.attributes.$key && !props.attributes.{$key}_use_featured ) && el( wp.components.Button, {
3770 3770
 						  className: 'components-button components-circular-option-picker__clear is-primary is-smallx',
@@ -3790,11 +3790,11 @@  discard block
 block discarded – undo
3790 3790
 
3791 3791
 
3792 3792
 					  }";
3793
-				$onchange = "";
3793
+                $onchange = "";
3794 3794
 
3795
-				//$inside_elements = ",el('div',{},'file upload')";
3796
-			} else if ( $args['type'] == 'images' ) {
3797
-				$img_preview = "props.attributes.$key && (function() {
3795
+                //$inside_elements = ",el('div',{},'file upload')";
3796
+            } else if ( $args['type'] == 'images' ) {
3797
+                $img_preview = "props.attributes.$key && (function() {
3798 3798
 	let uploads = JSON.parse('['+props.attributes.$key+']');
3799 3799
 	let images = [];
3800 3800
 	uploads.map((upload, index) => (
@@ -3821,9 +3821,9 @@  discard block
 block discarded – undo
3821 3821
 })(),";
3822 3822
 
3823 3823
 
3824
-				$value = '""';
3825
-				$type = 'MediaUpload';
3826
-				$extra .= "onSelect: function(media){
3824
+                $value = '""';
3825
+                $type = 'MediaUpload';
3826
+                $extra .= "onSelect: function(media){
3827 3827
 	let slim_images = props.attributes.$key ? JSON.parse('['+props.attributes.$key+']') : [];
3828 3828
 	if(media.length){
3829 3829
 		for (var i=0; i < media.length; i++) {
@@ -3836,9 +3836,9 @@  discard block
 block discarded – undo
3836 3836
 	}
3837 3837
 	return props.setAttributes({ $key: slimImagesV});
3838 3838
 },";
3839
-				$extra .= "type: 'image',";
3840
-				$extra .= "multiple: true,";
3841
-				$extra .= "render: function (obj) {
3839
+                $extra .= "type: 'image',";
3840
+                $extra .= "multiple: true,";
3841
+                $extra .= "render: function (obj) {
3842 3842
 	/* Init the sort */
3843 3843
 	enableDragSort('sd-sortable');
3844 3844
 	return el( 'div',{},
@@ -3865,40 +3865,40 @@  discard block
 block discarded – undo
3865 3865
 		)
3866 3866
 	)
3867 3867
 }";
3868
-				$onchange = "";
3869
-
3870
-				//$inside_elements = ",el('div',{},'file upload')";
3871
-			}
3872
-			elseif ( $args['type'] == 'checkbox' ) {
3873
-				$type = 'CheckboxControl';
3874
-				$extra .= "checked: props.attributes.$key,";
3875
-				$onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
3876
-			} elseif ( $args['type'] == 'textarea' ) {
3877
-				$type = 'TextareaControl';
3878
-
3879
-			} elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
3880
-				$type = 'SelectControl';
3881
-
3882
-				if($args['name'] == 'category' && !empty($args['post_type_linked'])){
3883
-					$options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
3884
-				}elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3885
-					$options .= "options: sort_by_".str_replace("-","_", $this->id).",";
3886
-				}else {
3887
-
3888
-					if ( ! empty( $args['options'] ) ) {
3889
-						$options .= "options: [";
3890
-						foreach ( $args['options'] as $option_val => $option_label ) {
3891
-							$options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . esc_js( addslashes( $option_label ) ) . "' },";
3892
-						}
3893
-						$options .= "],";
3894
-					}
3895
-				}
3896
-				if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
3897
-					$extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, ';
3898
-				}
3899
-
3900
-				if($args['type'] == 'multiselect' ||  ( isset( $args['multiple'] ) && $args['multiple'] ) ){
3901
-					$after_elements	 .= "props.attributes.$key && el( wp.components.Button, {
3868
+                $onchange = "";
3869
+
3870
+                //$inside_elements = ",el('div',{},'file upload')";
3871
+            }
3872
+            elseif ( $args['type'] == 'checkbox' ) {
3873
+                $type = 'CheckboxControl';
3874
+                $extra .= "checked: props.attributes.$key,";
3875
+                $onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
3876
+            } elseif ( $args['type'] == 'textarea' ) {
3877
+                $type = 'TextareaControl';
3878
+
3879
+            } elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
3880
+                $type = 'SelectControl';
3881
+
3882
+                if($args['name'] == 'category' && !empty($args['post_type_linked'])){
3883
+                    $options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
3884
+                }elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3885
+                    $options .= "options: sort_by_".str_replace("-","_", $this->id).",";
3886
+                }else {
3887
+
3888
+                    if ( ! empty( $args['options'] ) ) {
3889
+                        $options .= "options: [";
3890
+                        foreach ( $args['options'] as $option_val => $option_label ) {
3891
+                            $options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . esc_js( addslashes( $option_label ) ) . "' },";
3892
+                        }
3893
+                        $options .= "],";
3894
+                    }
3895
+                }
3896
+                if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
3897
+                    $extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, ';
3898
+                }
3899
+
3900
+                if($args['type'] == 'multiselect' ||  ( isset( $args['multiple'] ) && $args['multiple'] ) ){
3901
+                    $after_elements	 .= "props.attributes.$key && el( wp.components.Button, {
3902 3902
 									  className: 'components-button components-circular-option-picker__clear is-secondary is-small',
3903 3903
 									  style: {margin:'-8px 0 8px 0',display: 'block'},
3904 3904
 									  onClick: function(){
@@ -3909,8 +3909,8 @@  discard block
 block discarded – undo
3909 3909
 									},
3910 3910
 									'Clear'
3911 3911
 							),";
3912
-				}
3913
-			} elseif ( $args['type'] == 'tagselect' ) {
3912
+                }
3913
+            } elseif ( $args['type'] == 'tagselect' ) {
3914 3914
 //				$type = 'FormTokenField';
3915 3915
 //
3916 3916
 //				if ( ! empty( $args['options'] ) ) {
@@ -3945,20 +3945,20 @@  discard block
 block discarded – undo
3945 3945
 //				$value     = "[]";
3946 3946
 //				$extra .= ' __experimentalExpandOnFocus: true,';
3947 3947
 
3948
-			} else if ( $args['type'] == 'alignment' ) {
3949
-				$type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
3950
-			} else if ( $args['type'] == 'margins' ) {
3951
-
3952
-			} else if ( $args['type'] == 'visibility_conditions' && ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) ) {
3953
-				$type = 'TextControl';
3954
-				$value = "(props.attributes.$key ? props.attributes.$key : '')";
3955
-				$args['type'] = 'text';
3956
-				$options .= 'disabled:true,';
3957
-				$bsvc_title = esc_attr( addslashes( $args['title'] ) );
3958
-				$bsvc_body = $this->block_visibility_fields( $args );
3959
-				// @TODO reset button
3960
-				$bsvc_footer = '<button type="button" class="btn btn-danger d-none">' . __( 'Reset', 'ayecode-connect' ) . '</button><button type="button" class="btn btn-secondary bs-vc-close text-white" data-bs-dismiss="modal">' . __( 'Close', 'ayecode-connect' ) . '</button><button type="button" class="btn btn-primary bs-vc-save">' . __( 'Save Rules', 'ayecode-connect' ) . '</button>';
3961
-				$after_elements .= "el('div', {className: 'components-base-control bs-vc-button-wrap'}, el(wp.components.Button, {
3948
+            } else if ( $args['type'] == 'alignment' ) {
3949
+                $type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
3950
+            } else if ( $args['type'] == 'margins' ) {
3951
+
3952
+            } else if ( $args['type'] == 'visibility_conditions' && ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) ) {
3953
+                $type = 'TextControl';
3954
+                $value = "(props.attributes.$key ? props.attributes.$key : '')";
3955
+                $args['type'] = 'text';
3956
+                $options .= 'disabled:true,';
3957
+                $bsvc_title = esc_attr( addslashes( $args['title'] ) );
3958
+                $bsvc_body = $this->block_visibility_fields( $args );
3959
+                // @TODO reset button
3960
+                $bsvc_footer = '<button type="button" class="btn btn-danger d-none">' . __( 'Reset', 'ayecode-connect' ) . '</button><button type="button" class="btn btn-secondary bs-vc-close text-white" data-bs-dismiss="modal">' . __( 'Close', 'ayecode-connect' ) . '</button><button type="button" class="btn btn-primary bs-vc-save">' . __( 'Save Rules', 'ayecode-connect' ) . '</button>';
3961
+                $after_elements .= "el('div', {className: 'components-base-control bs-vc-button-wrap'}, el(wp.components.Button, {
3962 3962
 						className: 'components-button components-circular-option-picker__clear is-primary is-smallx',
3963 3963
 						onClick: function() {
3964 3964
 							var sValue = props.attributes." . $key . ";
@@ -3984,39 +3984,39 @@  discard block
 block discarded – undo
3984 3984
 					},
3985 3985
 					'" . addslashes( ! empty( $args['button_title'] ) ? $args['button_title'] : $args['title'] ) . "'
3986 3986
 				) ),";
3987
-			} else {
3988
-				return;// if we have not implemented the control then don't break the JS.
3989
-			}
3990
-
3991
-			// color input does not show the labels so we add them
3992
-			if($args['type']=='color'){
3993
-				// add show only if advanced
3994
-				echo $require_advanced;
3995
-				// add setting require if defined
3996
-				echo $element_require;
3997
-				echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
3998
-			}
3999
-
4000
-			// add show only if advanced
4001
-			echo $require_advanced;
4002
-			// add setting require if defined
4003
-			echo $element_require;
4004
-			echo $device_type_require;
4005
-
4006
-			// icon
4007
-			echo $icon;
4008
-			?>
3987
+            } else {
3988
+                return;// if we have not implemented the control then don't break the JS.
3989
+            }
3990
+
3991
+            // color input does not show the labels so we add them
3992
+            if($args['type']=='color'){
3993
+                // add show only if advanced
3994
+                echo $require_advanced;
3995
+                // add setting require if defined
3996
+                echo $element_require;
3997
+                echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
3998
+            }
3999
+
4000
+            // add show only if advanced
4001
+            echo $require_advanced;
4002
+            // add setting require if defined
4003
+            echo $element_require;
4004
+            echo $device_type_require;
4005
+
4006
+            // icon
4007
+            echo $icon;
4008
+            ?>
4009 4009
 			el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type  : "wp.components.".$type; ?>, {
4010 4010
 			label: <?php if ( empty( $args['title'] ) ) { echo "''"; } else if ( empty( $args['row'] ) && ! empty( $args['device_type'] ) ) { ?>el('label',{className:'components-base-control__label',style:{width:"100%"}},el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes( $args['title'] ) ?>'}}),<?php if ( $device_type_icon ) { ?>deviceType == '<?php echo $device_type;?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}})<?php } ?>)<?php
4011
-			} else { ?>'<?php echo addslashes( trim( esc_html( $args['title'] ) ) ); ?>'<?php } ?>,
4011
+            } else { ?>'<?php echo addslashes( trim( esc_html( $args['title'] ) ) ); ?>'<?php } ?>,
4012 4012
 			help: <?php echo ( isset( $args['desc'] ) ? "el('span', {dangerouslySetInnerHTML: {__html: '" . trim( wp_kses_post( addslashes( $args['desc'] ) ) ) . "'}})" : "''" ); ?>,
4013 4013
 			value: <?php echo $value; ?>,
4014 4014
 			<?php if ( $type == 'TextControl' && $args['type'] != 'text' ) {
4015
-				echo "type: '" . addslashes( $args['type'] ) . "',";
4016
-			} ?>
4015
+                echo "type: '" . addslashes( $args['type'] ) . "',";
4016
+            } ?>
4017 4017
 			<?php if ( ! empty( $args['placeholder'] ) ) {
4018
-				echo "placeholder: '" . esc_js( addslashes( trim( esc_html( $args['placeholder'] ) ) ) ) . "',";
4019
-			} ?>
4018
+                echo "placeholder: '" . esc_js( addslashes( trim( esc_html( $args['placeholder'] ) ) ) ) . "',";
4019
+            } ?>
4020 4020
 			<?php echo $options; ?>
4021 4021
 			<?php echo $extra; ?>
4022 4022
 			<?php echo $custom_attributes; ?>
@@ -4028,1266 +4028,1266 @@  discard block
 block discarded – undo
4028 4028
 			<?php } ?>
4029 4029
 		} <?php echo $inside_elements; ?> ),
4030 4030
 			<?php
4031
-			echo $after_elements;
4032
-		}
4033
-
4034
-		/**
4035
-		 * Convert an array of attributes to block string.
4036
-		 *
4037
-		 * @param $custom_attributes
4038
-		 *
4039
-		 * @return string
4040
-		 *@todo there is prob a faster way to do this, also we could add some validation here.
4041
-		 *
4042
-		 */
4043
-		public function array_to_attributes( $custom_attributes, $html = false ) {
4044
-			$attributes = '';
4045
-			if ( ! empty( $custom_attributes ) ) {
4046
-
4047
-				foreach ( $custom_attributes as $key => $val ) {
4048
-					if(is_array($val)){
4049
-						$attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},';
4050
-					}else{
4051
-						$attributes .= $html ?  " $key='$val' " : "'$key': '$val',";
4052
-					}
4053
-				}
4054
-
4055
-			}
4031
+            echo $after_elements;
4032
+        }
4056 4033
 
4057
-			return $attributes;
4058
-		}
4034
+        /**
4035
+         * Convert an array of attributes to block string.
4036
+         *
4037
+         * @param $custom_attributes
4038
+         *
4039
+         * @return string
4040
+         *@todo there is prob a faster way to do this, also we could add some validation here.
4041
+         *
4042
+         */
4043
+        public function array_to_attributes( $custom_attributes, $html = false ) {
4044
+            $attributes = '';
4045
+            if ( ! empty( $custom_attributes ) ) {
4046
+
4047
+                foreach ( $custom_attributes as $key => $val ) {
4048
+                    if(is_array($val)){
4049
+                        $attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},';
4050
+                    }else{
4051
+                        $attributes .= $html ?  " $key='$val' " : "'$key': '$val',";
4052
+                    }
4053
+                }
4054
+
4055
+            }
4056
+
4057
+            return $attributes;
4058
+        }
4059 4059
 
4060 4060
 
4061 4061
 
4062
-		/**
4063
-		 * A self looping function to create the output for JS block elements.
4064
-		 *
4065
-		 * This is what is output in the WP Editor visual view.
4066
-		 *
4067
-		 * @param $args
4068
-		 */
4069
-		public function block_element( $args, $save = false ) {
4062
+        /**
4063
+         * A self looping function to create the output for JS block elements.
4064
+         *
4065
+         * This is what is output in the WP Editor visual view.
4066
+         *
4067
+         * @param $args
4068
+         */
4069
+        public function block_element( $args, $save = false ) {
4070 4070
 
4071 4071
 //            print_r($args);echo '###';exit;
4072 4072
 
4073
-			if ( ! empty( $args ) ) {
4074
-				foreach ( $args as $element => $new_args ) {
4073
+            if ( ! empty( $args ) ) {
4074
+                foreach ( $args as $element => $new_args ) {
4075 4075
 
4076
-					if ( is_array( $new_args ) ) { // its an element
4076
+                    if ( is_array( $new_args ) ) { // its an element
4077 4077
 
4078 4078
 
4079
-						if ( isset( $new_args['element'] ) ) {
4079
+                        if ( isset( $new_args['element'] ) ) {
4080 4080
 
4081
-							if ( isset( $new_args['element_require'] ) ) {
4082
-								echo str_replace( array(
4083
-										"'+",
4084
-										"+'"
4085
-									), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
4086
-								unset( $new_args['element_require'] );
4087
-							}
4081
+                            if ( isset( $new_args['element_require'] ) ) {
4082
+                                echo str_replace( array(
4083
+                                        "'+",
4084
+                                        "+'"
4085
+                                    ), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
4086
+                                unset( $new_args['element_require'] );
4087
+                            }
4088 4088
 
4089
-							if($new_args['element']=='InnerBlocks'){
4090
-								echo "\n el( InnerBlocks, {";
4091
-							}elseif($new_args['element']=='innerBlocksProps'){
4092
-								$element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div';
4093
-							  //  echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {";
4089
+                            if($new_args['element']=='InnerBlocks'){
4090
+                                echo "\n el( InnerBlocks, {";
4091
+                            }elseif($new_args['element']=='innerBlocksProps'){
4092
+                                $element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div';
4093
+                                //  echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {";
4094 4094
 //                                echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
4095
-								echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
4096
-								echo $save ? "wp.blockEditor.useBlockProps.save( {" : "wp.blockEditor.useBlockProps( {";
4097
-								echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
4098
-
4099
-								echo "} ), {";
4100
-								echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element( $new_args['innerBlocksProps'],$save ) : '';
4101
-							//    echo '###';
4102
-
4103
-							  //  echo '###';
4104
-							}elseif($new_args['element']=='BlocksProps'){
4105
-
4106
-								if ( isset($new_args['if_inner_element']) ) {
4107
-									$element = $new_args['if_inner_element'];
4108
-								}else {
4109
-									$element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'";
4110
-								}
4111
-
4112
-								unset($new_args['inner_element']);
4113
-								echo $save ? "\n el( $element, wp.blockEditor.useBlockProps.save( {" : "\n el( $element, wp.blockEditor.useBlockProps( {";
4114
-								echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
4115
-
4116
-
4117
-							   // echo "} ),";
4118
-
4119
-							}else{
4120
-								echo "\n el( '" . $new_args['element'] . "', {";
4121
-							}
4122
-
4123
-
4124
-							// get the attributes
4125
-							foreach ( $new_args as $new_key => $new_value ) {
4126
-
4127
-
4128
-								if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
4129
-									// do nothing
4130
-								} else {
4131
-									echo $this->block_element( array( $new_key => $new_value ),$save );
4132
-								}
4133
-							}
4134
-
4135
-							echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes
4136
-
4137
-							// get the content
4138
-							$first_item = 0;
4139
-							foreach ( $new_args as $new_key => $new_value ) {
4140
-								if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) {
4141
-
4142
-									if ( $new_key === 'content' ) {
4143
-										echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
4144
-									}else if ( $new_key === 'if_content' ) {
4145
-										echo  $this->block_props_replace(  $new_value  );
4146
-									}
4147
-
4148
-									if ( is_array( $new_value ) ) {
4149
-
4150
-										if ( isset( $new_value['element_require'] ) ) {
4151
-											echo str_replace( array(
4152
-													"'+",
4153
-													"+'"
4154
-												), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
4155
-											unset( $new_value['element_require'] );
4156
-										}
4157
-
4158
-										if ( isset( $new_value['element_repeat'] ) ) {
4159
-											$x = 1;
4160
-											while ( $x <= absint( $new_value['element_repeat'] ) ) {
4161
-												$this->block_element( array( '' => $new_value ),$save );
4162
-												$x ++;
4163
-											}
4164
-										} else {
4165
-											$this->block_element( array( '' => $new_value ),$save );
4166
-										}
4167
-									}
4168
-									$first_item ++;
4169
-								}
4170
-							}
4171
-
4172
-							if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){
4173
-								echo "))";// end content
4174
-							}else{
4175
-								echo ")";// end content
4176
-							}
4177
-
4178
-
4179
-							echo ", \n";
4180
-
4181
-						}
4182
-					} else {
4183
-
4184
-						if ( substr( $element, 0, 3 ) === "if_" ) {
4185
-							$extra = '';
4186
-							if( strpos($new_args, '[%WrapClass%]') !== false ){
4187
-								$new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args);
4188
-								$new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args);
4189
-							}
4190
-							echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
4191
-						} elseif ( $element == 'style' &&  strpos($new_args, '[%WrapStyle%]') !== false ) {
4192
-							$new_args = str_replace('[%WrapStyle%]','',$new_args);
4193
-							echo $element . ": {..." . $this->block_props_replace( $new_args ) . " , ...sd_build_aui_styles(props.attributes) },";
4095
+                                echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
4096
+                                echo $save ? "wp.blockEditor.useBlockProps.save( {" : "wp.blockEditor.useBlockProps( {";
4097
+                                echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
4098
+
4099
+                                echo "} ), {";
4100
+                                echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element( $new_args['innerBlocksProps'],$save ) : '';
4101
+                            //    echo '###';
4102
+
4103
+                                //  echo '###';
4104
+                            }elseif($new_args['element']=='BlocksProps'){
4105
+
4106
+                                if ( isset($new_args['if_inner_element']) ) {
4107
+                                    $element = $new_args['if_inner_element'];
4108
+                                }else {
4109
+                                    $element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'";
4110
+                                }
4111
+
4112
+                                unset($new_args['inner_element']);
4113
+                                echo $save ? "\n el( $element, wp.blockEditor.useBlockProps.save( {" : "\n el( $element, wp.blockEditor.useBlockProps( {";
4114
+                                echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
4115
+
4116
+
4117
+                                // echo "} ),";
4118
+
4119
+                            }else{
4120
+                                echo "\n el( '" . $new_args['element'] . "', {";
4121
+                            }
4122
+
4123
+
4124
+                            // get the attributes
4125
+                            foreach ( $new_args as $new_key => $new_value ) {
4126
+
4127
+
4128
+                                if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
4129
+                                    // do nothing
4130
+                                } else {
4131
+                                    echo $this->block_element( array( $new_key => $new_value ),$save );
4132
+                                }
4133
+                            }
4134
+
4135
+                            echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes
4136
+
4137
+                            // get the content
4138
+                            $first_item = 0;
4139
+                            foreach ( $new_args as $new_key => $new_value ) {
4140
+                                if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) {
4141
+
4142
+                                    if ( $new_key === 'content' ) {
4143
+                                        echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
4144
+                                    }else if ( $new_key === 'if_content' ) {
4145
+                                        echo  $this->block_props_replace(  $new_value  );
4146
+                                    }
4147
+
4148
+                                    if ( is_array( $new_value ) ) {
4149
+
4150
+                                        if ( isset( $new_value['element_require'] ) ) {
4151
+                                            echo str_replace( array(
4152
+                                                    "'+",
4153
+                                                    "+'"
4154
+                                                ), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
4155
+                                            unset( $new_value['element_require'] );
4156
+                                        }
4157
+
4158
+                                        if ( isset( $new_value['element_repeat'] ) ) {
4159
+                                            $x = 1;
4160
+                                            while ( $x <= absint( $new_value['element_repeat'] ) ) {
4161
+                                                $this->block_element( array( '' => $new_value ),$save );
4162
+                                                $x ++;
4163
+                                            }
4164
+                                        } else {
4165
+                                            $this->block_element( array( '' => $new_value ),$save );
4166
+                                        }
4167
+                                    }
4168
+                                    $first_item ++;
4169
+                                }
4170
+                            }
4171
+
4172
+                            if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){
4173
+                                echo "))";// end content
4174
+                            }else{
4175
+                                echo ")";// end content
4176
+                            }
4177
+
4178
+
4179
+                            echo ", \n";
4180
+
4181
+                        }
4182
+                    } else {
4183
+
4184
+                        if ( substr( $element, 0, 3 ) === "if_" ) {
4185
+                            $extra = '';
4186
+                            if( strpos($new_args, '[%WrapClass%]') !== false ){
4187
+                                $new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args);
4188
+                                $new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args);
4189
+                            }
4190
+                            echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
4191
+                        } elseif ( $element == 'style' &&  strpos($new_args, '[%WrapStyle%]') !== false ) {
4192
+                            $new_args = str_replace('[%WrapStyle%]','',$new_args);
4193
+                            echo $element . ": {..." . $this->block_props_replace( $new_args ) . " , ...sd_build_aui_styles(props.attributes) },";
4194 4194
 //                            echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
4195
-						} elseif ( $element == 'style' ) {
4196
-							echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
4197
-						} elseif ( ( $element == 'class' || $element == 'className'  ) &&  strpos($new_args, '[%WrapClass%]') !== false ) {
4198
-							$new_args = str_replace('[%WrapClass%]','',$new_args);
4199
-							echo $element . ": '" . $this->block_props_replace( $new_args ) . "' + sd_build_aui_class(props.attributes),";
4200
-						} elseif ( $element == 'template' && $new_args ) {
4201
-							echo $element . ": $new_args,";
4202
-						} else {
4203
-							echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
4204
-						}
4205
-
4206
-					}
4207
-				}
4208
-			}
4209
-		}
4210
-
4211
-		/**
4212
-		 * Replace block attributes placeholders with the proper naming.
4213
-		 *
4214
-		 * @param $string
4215
-		 *
4216
-		 * @return mixed
4217
-		 */
4218
-		public function block_props_replace( $string, $no_wrap = false ) {
4219
-			if ( $no_wrap ) {
4220
-				$string = str_replace( array( "[%", "%]", "%:checked]" ), array( "props.attributes.", "", "" ), $string );
4221
-			} else {
4222
-				$string = str_replace( array( "![%", "[%", "%]", "%:checked]" ), array( "'+!props.attributes.", "'+props.attributes.", "+'", "+'" ), $string );
4223
-			}
4224
-
4225
-			return $string;
4226
-		}
4227
-
4228
-		/**
4229
-		 * Outputs the content of the widget
4230
-		 *
4231
-		 * @param array $args
4232
-		 * @param array $instance
4233
-		 */
4234
-		public function widget( $args, $instance ) {
4235
-			if ( ! is_array( $args ) ) {
4236
-				$args = array();
4237
-			}
4238
-
4239
-			// Get the filtered values
4240
-			$argument_values = $this->argument_values( $instance );
4241
-			$argument_values = $this->string_to_bool( $argument_values );
4242
-			$output          = $this->output( $argument_values, $args );
4243
-
4244
-			$no_wrap = false;
4245
-			if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
4246
-				$no_wrap = true;
4247
-			}
4248
-
4249
-			ob_start();
4250
-			if ( $output && ! $no_wrap ) {
4251
-
4252
-				$class_original = $this->options['widget_ops']['classname'];
4253
-				$class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
4254
-
4255
-				// Before widget
4256
-				$before_widget = ! empty( $args['before_widget'] ) ? $args['before_widget'] : '';
4257
-				$before_widget = $before_widget ? str_replace( $class_original, $class, $before_widget ) : $before_widget;
4258
-				$before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
4259
-				$before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
4260
-
4261
-				// After widget
4262
-				$after_widget = ! empty( $args['after_widget'] ) ? $args['after_widget'] : '';
4263
-				$after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
4264
-				$after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
4265
-
4266
-				echo $before_widget;
4267
-				// elementor strips the widget wrapping div so we check for and add it back if needed
4268
-				if ( $this->is_elementor_widget_output() ) {
4269
-					// Filter class & attrs for elementor widget output.
4270
-					$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
4271
-					$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
4272
-
4273
-					$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
4274
-					$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
4275
-
4276
-					echo "<span class='" . esc_attr( $class  ) . "' " . $attrs . ">";
4277
-				}
4278
-				echo $this->output_title( $args, $instance );
4279
-				echo $output;
4280
-				if ( $this->is_elementor_widget_output() ) {
4281
-					echo "</span>";
4282
-				}
4283
-				echo $after_widget;
4284
-			} elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
4285
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
4286
-				echo $output;
4287
-			} elseif ( $output && $no_wrap ) {
4288
-				echo $output;
4289
-			}
4290
-			$output = ob_get_clean();
4291
-
4292
-			$output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
4293
-
4294
-			echo $output;
4295
-		}
4296
-
4297
-		/**
4298
-		 * Tests if the current output is inside a elementor container.
4299
-		 *
4300
-		 * @return bool
4301
-		 *@since 1.0.4
4302
-		 */
4303
-		public function is_elementor_widget_output() {
4304
-			$result = false;
4305
-			if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
4306
-				$result = true;
4307
-			}
4308
-
4309
-			return $result;
4310
-		}
4311
-
4312
-		/**
4313
-		 * Tests if the current output is inside a elementor preview.
4314
-		 *
4315
-		 * @return bool
4316
-		 *@since 1.0.4
4317
-		 */
4318
-		public function is_elementor_preview() {
4319
-			$result = false;
4320
-			if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
4321
-				$result = true;
4322
-			}
4323
-
4324
-			return $result;
4325
-		}
4326
-
4327
-		/**
4328
-		 * Tests if the current output is inside a Divi preview.
4329
-		 *
4330
-		 * @return bool
4331
-		 *@since 1.0.6
4332
-		 */
4333
-		public function is_divi_preview() {
4334
-			$result = false;
4335
-			if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
4336
-				$result = true;
4337
-			}
4338
-
4339
-			return $result;
4340
-		}
4341
-
4342
-		/**
4343
-		 * Tests if the current output is inside a Beaver builder preview.
4344
-		 *
4345
-		 * @return bool
4346
-		 *@since 1.0.6
4347
-		 */
4348
-		public function is_beaver_preview() {
4349
-			$result = false;
4350
-			if ( isset( $_REQUEST['fl_builder'] ) ) {
4351
-				$result = true;
4352
-			}
4353
-
4354
-			return $result;
4355
-		}
4356
-
4357
-		/**
4358
-		 * Tests if the current output is inside a siteorigin builder preview.
4359
-		 *
4360
-		 * @return bool
4361
-		 *@since 1.0.6
4362
-		 */
4363
-		public function is_siteorigin_preview() {
4364
-			$result = false;
4365
-			if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
4366
-				$result = true;
4367
-			}
4368
-
4369
-			return $result;
4370
-		}
4371
-
4372
-		/**
4373
-		 * Tests if the current output is inside a cornerstone builder preview.
4374
-		 *
4375
-		 * @return bool
4376
-		 *@since 1.0.8
4377
-		 */
4378
-		public function is_cornerstone_preview() {
4379
-			$result = false;
4380
-			if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
4381
-				$result = true;
4382
-			}
4383
-
4384
-			return $result;
4385
-		}
4386
-
4387
-		/**
4388
-		 * Tests if the current output is inside a fusion builder preview.
4389
-		 *
4390
-		 * @return bool
4391
-		 *@since 1.1.0
4392
-		 */
4393
-		public function is_fusion_preview() {
4394
-			$result = false;
4395
-			if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
4396
-				$result = true;
4397
-			}
4195
+                        } elseif ( $element == 'style' ) {
4196
+                            echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
4197
+                        } elseif ( ( $element == 'class' || $element == 'className'  ) &&  strpos($new_args, '[%WrapClass%]') !== false ) {
4198
+                            $new_args = str_replace('[%WrapClass%]','',$new_args);
4199
+                            echo $element . ": '" . $this->block_props_replace( $new_args ) . "' + sd_build_aui_class(props.attributes),";
4200
+                        } elseif ( $element == 'template' && $new_args ) {
4201
+                            echo $element . ": $new_args,";
4202
+                        } else {
4203
+                            echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
4204
+                        }
4205
+
4206
+                    }
4207
+                }
4208
+            }
4209
+        }
4398 4210
 
4399
-			return $result;
4400
-		}
4211
+        /**
4212
+         * Replace block attributes placeholders with the proper naming.
4213
+         *
4214
+         * @param $string
4215
+         *
4216
+         * @return mixed
4217
+         */
4218
+        public function block_props_replace( $string, $no_wrap = false ) {
4219
+            if ( $no_wrap ) {
4220
+                $string = str_replace( array( "[%", "%]", "%:checked]" ), array( "props.attributes.", "", "" ), $string );
4221
+            } else {
4222
+                $string = str_replace( array( "![%", "[%", "%]", "%:checked]" ), array( "'+!props.attributes.", "'+props.attributes.", "+'", "+'" ), $string );
4223
+            }
4224
+
4225
+            return $string;
4226
+        }
4401 4227
 
4402
-		/**
4403
-		 * Tests if the current output is inside a Oxygen builder preview.
4404
-		 *
4405
-		 * @return bool
4406
-		 *@since 1.0.18
4407
-		 */
4408
-		public function is_oxygen_preview() {
4409
-			$result = false;
4410
-			if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
4411
-				$result = true;
4412
-			}
4228
+        /**
4229
+         * Outputs the content of the widget
4230
+         *
4231
+         * @param array $args
4232
+         * @param array $instance
4233
+         */
4234
+        public function widget( $args, $instance ) {
4235
+            if ( ! is_array( $args ) ) {
4236
+                $args = array();
4237
+            }
4238
+
4239
+            // Get the filtered values
4240
+            $argument_values = $this->argument_values( $instance );
4241
+            $argument_values = $this->string_to_bool( $argument_values );
4242
+            $output          = $this->output( $argument_values, $args );
4243
+
4244
+            $no_wrap = false;
4245
+            if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
4246
+                $no_wrap = true;
4247
+            }
4248
+
4249
+            ob_start();
4250
+            if ( $output && ! $no_wrap ) {
4251
+
4252
+                $class_original = $this->options['widget_ops']['classname'];
4253
+                $class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
4254
+
4255
+                // Before widget
4256
+                $before_widget = ! empty( $args['before_widget'] ) ? $args['before_widget'] : '';
4257
+                $before_widget = $before_widget ? str_replace( $class_original, $class, $before_widget ) : $before_widget;
4258
+                $before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
4259
+                $before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
4260
+
4261
+                // After widget
4262
+                $after_widget = ! empty( $args['after_widget'] ) ? $args['after_widget'] : '';
4263
+                $after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
4264
+                $after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
4265
+
4266
+                echo $before_widget;
4267
+                // elementor strips the widget wrapping div so we check for and add it back if needed
4268
+                if ( $this->is_elementor_widget_output() ) {
4269
+                    // Filter class & attrs for elementor widget output.
4270
+                    $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
4271
+                    $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
4272
+
4273
+                    $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
4274
+                    $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
4275
+
4276
+                    echo "<span class='" . esc_attr( $class  ) . "' " . $attrs . ">";
4277
+                }
4278
+                echo $this->output_title( $args, $instance );
4279
+                echo $output;
4280
+                if ( $this->is_elementor_widget_output() ) {
4281
+                    echo "</span>";
4282
+                }
4283
+                echo $after_widget;
4284
+            } elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
4285
+                $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
4286
+                echo $output;
4287
+            } elseif ( $output && $no_wrap ) {
4288
+                echo $output;
4289
+            }
4290
+            $output = ob_get_clean();
4291
+
4292
+            $output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
4293
+
4294
+            echo $output;
4295
+        }
4413 4296
 
4414
-			return $result;
4415
-		}
4297
+        /**
4298
+         * Tests if the current output is inside a elementor container.
4299
+         *
4300
+         * @return bool
4301
+         *@since 1.0.4
4302
+         */
4303
+        public function is_elementor_widget_output() {
4304
+            $result = false;
4305
+            if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
4306
+                $result = true;
4307
+            }
4308
+
4309
+            return $result;
4310
+        }
4416 4311
 
4417
-		/**
4418
-		 * Check for Kallyas theme Zion builder preview.
4419
-		 *
4420
-		 * @since 1.1.22
4421
-		 *
4422
-		 * @return bool True when preview page otherwise false.
4423
-		 */
4424
-		public function is_kallyas_zion_preview() {
4425
-			$result = false;
4426
-
4427
-			if ( function_exists( 'znhg_kallyas_theme_config' ) && ! empty( $_REQUEST['zn_pb_edit'] ) ) {
4428
-				$result = true;
4429
-			}
4312
+        /**
4313
+         * Tests if the current output is inside a elementor preview.
4314
+         *
4315
+         * @return bool
4316
+         *@since 1.0.4
4317
+         */
4318
+        public function is_elementor_preview() {
4319
+            $result = false;
4320
+            if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
4321
+                $result = true;
4322
+            }
4323
+
4324
+            return $result;
4325
+        }
4430 4326
 
4431
-			return $result;
4432
-		}
4327
+        /**
4328
+         * Tests if the current output is inside a Divi preview.
4329
+         *
4330
+         * @return bool
4331
+         *@since 1.0.6
4332
+         */
4333
+        public function is_divi_preview() {
4334
+            $result = false;
4335
+            if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
4336
+                $result = true;
4337
+            }
4338
+
4339
+            return $result;
4340
+        }
4433 4341
 
4434
-		/**
4435
-		 * Check for Bricks theme builder preview.
4436
-		 *
4437
-		 * @since 1.1.31
4438
-		 *
4439
-		 * @return bool True when preview page otherwise false.
4440
-		 */
4441
-		public function is_bricks_preview() {
4442
-			$result = false;
4443
-
4444
-			if ( function_exists( 'bricks_is_builder' ) && ( bricks_is_builder() || bricks_is_builder_call() ) ) {
4445
-				$result = true;
4446
-			}
4342
+        /**
4343
+         * Tests if the current output is inside a Beaver builder preview.
4344
+         *
4345
+         * @return bool
4346
+         *@since 1.0.6
4347
+         */
4348
+        public function is_beaver_preview() {
4349
+            $result = false;
4350
+            if ( isset( $_REQUEST['fl_builder'] ) ) {
4351
+                $result = true;
4352
+            }
4353
+
4354
+            return $result;
4355
+        }
4447 4356
 
4448
-			return $result;
4449
-		}
4357
+        /**
4358
+         * Tests if the current output is inside a siteorigin builder preview.
4359
+         *
4360
+         * @return bool
4361
+         *@since 1.0.6
4362
+         */
4363
+        public function is_siteorigin_preview() {
4364
+            $result = false;
4365
+            if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
4366
+                $result = true;
4367
+            }
4368
+
4369
+            return $result;
4370
+        }
4450 4371
 
4451
-		/**
4452
-		 * General function to check if we are in a preview situation.
4453
-		 *
4454
-		 * @return bool
4455
-		 *@since 1.0.6
4456
-		 */
4457
-		public function is_preview() {
4458
-			$preview = false;
4459
-			if ( $this->is_divi_preview() ) {
4460
-				$preview = true;
4461
-			} elseif ( $this->is_elementor_preview() ) {
4462
-				$preview = true;
4463
-			} elseif ( $this->is_beaver_preview() ) {
4464
-				$preview = true;
4465
-			} elseif ( $this->is_siteorigin_preview() ) {
4466
-				$preview = true;
4467
-			} elseif ( $this->is_cornerstone_preview() ) {
4468
-				$preview = true;
4469
-			} elseif ( $this->is_fusion_preview() ) {
4470
-				$preview = true;
4471
-			} elseif ( $this->is_oxygen_preview() ) {
4472
-				$preview = true;
4473
-			} elseif( $this->is_kallyas_zion_preview() ) {
4474
-				$preview = true;
4475
-			} elseif( $this->is_block_content_call() ) {
4476
-				$preview = true;
4477
-			} elseif( $this->is_bricks_preview() ) {
4478
-				$preview = true;
4479
-			}
4372
+        /**
4373
+         * Tests if the current output is inside a cornerstone builder preview.
4374
+         *
4375
+         * @return bool
4376
+         *@since 1.0.8
4377
+         */
4378
+        public function is_cornerstone_preview() {
4379
+            $result = false;
4380
+            if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
4381
+                $result = true;
4382
+            }
4383
+
4384
+            return $result;
4385
+        }
4480 4386
 
4481
-			return $preview;
4482
-		}
4387
+        /**
4388
+         * Tests if the current output is inside a fusion builder preview.
4389
+         *
4390
+         * @return bool
4391
+         *@since 1.1.0
4392
+         */
4393
+        public function is_fusion_preview() {
4394
+            $result = false;
4395
+            if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
4396
+                $result = true;
4397
+            }
4398
+
4399
+            return $result;
4400
+        }
4483 4401
 
4484
-		/**
4485
-		 * Output the super title.
4486
-		 *
4487
-		 * @param $args
4488
-		 * @param array $instance
4489
-		 *
4490
-		 * @return string
4491
-		 */
4492
-		public function output_title( $args, $instance = array() ) {
4493
-			$output = '';
4494
-			if ( ! empty( $instance['title'] ) ) {
4495
-				/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
4496
-				$title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
4497
-
4498
-				if ( empty( $instance['widget_title_tag'] ) ) {
4499
-					if ( ! isset( $args['before_title'] ) ) {
4500
-						$args['before_title'] = '';
4501
-					}
4402
+        /**
4403
+         * Tests if the current output is inside a Oxygen builder preview.
4404
+         *
4405
+         * @return bool
4406
+         *@since 1.0.18
4407
+         */
4408
+        public function is_oxygen_preview() {
4409
+            $result = false;
4410
+            if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
4411
+                $result = true;
4412
+            }
4413
+
4414
+            return $result;
4415
+        }
4502 4416
 
4503
-					if ( ! isset( $args['after_title'] ) ) {
4504
-						$args['after_title'] = '';
4505
-					}
4417
+        /**
4418
+         * Check for Kallyas theme Zion builder preview.
4419
+         *
4420
+         * @since 1.1.22
4421
+         *
4422
+         * @return bool True when preview page otherwise false.
4423
+         */
4424
+        public function is_kallyas_zion_preview() {
4425
+            $result = false;
4426
+
4427
+            if ( function_exists( 'znhg_kallyas_theme_config' ) && ! empty( $_REQUEST['zn_pb_edit'] ) ) {
4428
+                $result = true;
4429
+            }
4430
+
4431
+            return $result;
4432
+        }
4506 4433
 
4507
-					$output = $args['before_title'] . $title . $args['after_title'];
4508
-				} else {
4509
-					$tag 			= esc_attr( $instance['widget_title_tag'] );
4510
-					$allowed_tags 	= array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span', 'div', 'p' );
4511
-					$title_tag      = in_array( $tag, $allowed_tags, true ) ? esc_attr( $tag ) : 'h2';
4512
-
4513
-					// classes
4514
-					$title_classes = array();
4515
-					$title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
4516
-					$title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
4517
-					$title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
4518
-					$title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
4519
-					$title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
4520
-					$title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
4521
-					$title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
4522
-					$title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
4523
-					$title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
4524
-					$title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
4525
-					$title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
4526
-					$title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
4527
-					$title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
4528
-
4529
-					$class = !empty( $title_classes ) ? implode(" ",$title_classes) : '';
4530
-					$output = "<$title_tag class='$class' >$title</$title_tag>";
4531
-				}
4434
+        /**
4435
+         * Check for Bricks theme builder preview.
4436
+         *
4437
+         * @since 1.1.31
4438
+         *
4439
+         * @return bool True when preview page otherwise false.
4440
+         */
4441
+        public function is_bricks_preview() {
4442
+            $result = false;
4443
+
4444
+            if ( function_exists( 'bricks_is_builder' ) && ( bricks_is_builder() || bricks_is_builder_call() ) ) {
4445
+                $result = true;
4446
+            }
4447
+
4448
+            return $result;
4449
+        }
4532 4450
 
4533
-			}
4451
+        /**
4452
+         * General function to check if we are in a preview situation.
4453
+         *
4454
+         * @return bool
4455
+         *@since 1.0.6
4456
+         */
4457
+        public function is_preview() {
4458
+            $preview = false;
4459
+            if ( $this->is_divi_preview() ) {
4460
+                $preview = true;
4461
+            } elseif ( $this->is_elementor_preview() ) {
4462
+                $preview = true;
4463
+            } elseif ( $this->is_beaver_preview() ) {
4464
+                $preview = true;
4465
+            } elseif ( $this->is_siteorigin_preview() ) {
4466
+                $preview = true;
4467
+            } elseif ( $this->is_cornerstone_preview() ) {
4468
+                $preview = true;
4469
+            } elseif ( $this->is_fusion_preview() ) {
4470
+                $preview = true;
4471
+            } elseif ( $this->is_oxygen_preview() ) {
4472
+                $preview = true;
4473
+            } elseif( $this->is_kallyas_zion_preview() ) {
4474
+                $preview = true;
4475
+            } elseif( $this->is_block_content_call() ) {
4476
+                $preview = true;
4477
+            } elseif( $this->is_bricks_preview() ) {
4478
+                $preview = true;
4479
+            }
4480
+
4481
+            return $preview;
4482
+        }
4534 4483
 
4535
-			return $output;
4536
-		}
4484
+        /**
4485
+         * Output the super title.
4486
+         *
4487
+         * @param $args
4488
+         * @param array $instance
4489
+         *
4490
+         * @return string
4491
+         */
4492
+        public function output_title( $args, $instance = array() ) {
4493
+            $output = '';
4494
+            if ( ! empty( $instance['title'] ) ) {
4495
+                /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
4496
+                $title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
4497
+
4498
+                if ( empty( $instance['widget_title_tag'] ) ) {
4499
+                    if ( ! isset( $args['before_title'] ) ) {
4500
+                        $args['before_title'] = '';
4501
+                    }
4502
+
4503
+                    if ( ! isset( $args['after_title'] ) ) {
4504
+                        $args['after_title'] = '';
4505
+                    }
4506
+
4507
+                    $output = $args['before_title'] . $title . $args['after_title'];
4508
+                } else {
4509
+                    $tag 			= esc_attr( $instance['widget_title_tag'] );
4510
+                    $allowed_tags 	= array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span', 'div', 'p' );
4511
+                    $title_tag      = in_array( $tag, $allowed_tags, true ) ? esc_attr( $tag ) : 'h2';
4512
+
4513
+                    // classes
4514
+                    $title_classes = array();
4515
+                    $title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
4516
+                    $title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
4517
+                    $title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
4518
+                    $title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
4519
+                    $title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
4520
+                    $title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
4521
+                    $title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
4522
+                    $title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
4523
+                    $title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
4524
+                    $title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
4525
+                    $title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
4526
+                    $title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
4527
+                    $title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
4528
+
4529
+                    $class = !empty( $title_classes ) ? implode(" ",$title_classes) : '';
4530
+                    $output = "<$title_tag class='$class' >$title</$title_tag>";
4531
+                }
4532
+
4533
+            }
4534
+
4535
+            return $output;
4536
+        }
4537 4537
 
4538
-		/**
4539
-		 * Outputs the options form inputs for the widget.
4540
-		 *
4541
-		 * @param array $instance The widget options.
4542
-		 */
4543
-		public function form( $instance ) {
4538
+        /**
4539
+         * Outputs the options form inputs for the widget.
4540
+         *
4541
+         * @param array $instance The widget options.
4542
+         */
4543
+        public function form( $instance ) {
4544 4544
 
4545
-			// set widget instance
4546
-			$this->instance = $instance;
4545
+            // set widget instance
4546
+            $this->instance = $instance;
4547 4547
 
4548
-			// set it as a SD widget
4549
-			echo $this->widget_advanced_toggle();
4548
+            // set it as a SD widget
4549
+            echo $this->widget_advanced_toggle();
4550 4550
 
4551
-			echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
4552
-			$arguments_raw = $this->get_arguments();
4551
+            echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
4552
+            $arguments_raw = $this->get_arguments();
4553 4553
 
4554
-			if ( is_array( $arguments_raw ) ) {
4554
+            if ( is_array( $arguments_raw ) ) {
4555 4555
 
4556
-				$arguments = $this->group_arguments( $arguments_raw );
4556
+                $arguments = $this->group_arguments( $arguments_raw );
4557 4557
 
4558
-				// Do we have sections?
4559
-				$has_sections = $arguments == $arguments_raw ? false : true;
4558
+                // Do we have sections?
4559
+                $has_sections = $arguments == $arguments_raw ? false : true;
4560 4560
 
4561 4561
 
4562
-				if ( $has_sections ) {
4563
-					$panel_count = 0;
4564
-					foreach ( $arguments as $key => $args ) {
4562
+                if ( $has_sections ) {
4563
+                    $panel_count = 0;
4564
+                    foreach ( $arguments as $key => $args ) {
4565 4565
 
4566
-						?>
4566
+                        ?>
4567 4567
 						<script>
4568 4568
 							//							jQuery(this).find("i").toggleClass("fas fa-chevron-up fas fa-chevron-down");jQuery(this).next().toggle();
4569 4569
 						</script>
4570 4570
 						<?php
4571 4571
 
4572
-						$hide       = $panel_count ? ' style="display:none;" ' : '';
4573
-						$icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
4574
-						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>";
4575
-						echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
4572
+                        $hide       = $panel_count ? ' style="display:none;" ' : '';
4573
+                        $icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
4574
+                        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>";
4575
+                        echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
4576 4576
 
4577
-						foreach ( $args as $k => $a ) {
4577
+                        foreach ( $args as $k => $a ) {
4578 4578
 
4579
-							$this->widget_inputs_row_start($k, $a);
4580
-							$this->widget_inputs( $a, $instance );
4581
-							$this->widget_inputs_row_end($k, $a);
4579
+                            $this->widget_inputs_row_start($k, $a);
4580
+                            $this->widget_inputs( $a, $instance );
4581
+                            $this->widget_inputs_row_end($k, $a);
4582 4582
 
4583
-						}
4583
+                        }
4584 4584
 
4585
-						echo "</div>";
4585
+                        echo "</div>";
4586 4586
 
4587
-						$panel_count ++;
4587
+                        $panel_count ++;
4588 4588
 
4589
-					}
4590
-				} else {
4591
-					foreach ( $arguments as $key => $args ) {
4592
-						$this->widget_inputs_row_start($key, $args);
4593
-						$this->widget_inputs( $args, $instance );
4594
-						$this->widget_inputs_row_end($key, $args);
4595
-					}
4596
-				}
4589
+                    }
4590
+                } else {
4591
+                    foreach ( $arguments as $key => $args ) {
4592
+                        $this->widget_inputs_row_start($key, $args);
4593
+                        $this->widget_inputs( $args, $instance );
4594
+                        $this->widget_inputs_row_end($key, $args);
4595
+                    }
4596
+                }
4597 4597
 
4598
-			}
4599
-		}
4598
+            }
4599
+        }
4600 4600
 
4601
-		public function widget_inputs_row_start( $key, $args ) {
4602
-			if ( ! empty( $args['row'] ) ) {
4603
-				// Maybe open
4604
-				if ( ! empty( $args['row']['open'] ) ) {
4605
-					?>
4601
+        public function widget_inputs_row_start( $key, $args ) {
4602
+            if ( ! empty( $args['row'] ) ) {
4603
+                // Maybe open
4604
+                if ( ! empty( $args['row']['open'] ) ) {
4605
+                    ?>
4606 4606
 					<div class='bsui sd-argument' data-argument='<?php echo esc_attr( $args['row']['key'] ); ?>' data-element_require='<?php echo ( ! empty( $args['row']['element_require'] ) ? $this->convert_element_require( $args['row']['element_require'] ) : '' ); ?>'>
4607 4607
 					<?php if ( ! empty( $args['row']['title'] ) ) { ?>
4608 4608
 					<?php
4609
-						if ( isset( $args['row']['icon'] ) ) {
4610
-							$args['row']['icon'] = '';
4611
-						}
4612
-
4613
-						if ( ! isset( $args['row']['device_type'] ) && isset( $args['device_type'] ) ) {
4614
-							$args['row']['device_type'] = $args['device_type'];
4615
-						}
4616
-					?>
4609
+                        if ( isset( $args['row']['icon'] ) ) {
4610
+                            $args['row']['icon'] = '';
4611
+                        }
4612
+
4613
+                        if ( ! isset( $args['row']['device_type'] ) && isset( $args['device_type'] ) ) {
4614
+                            $args['row']['device_type'] = $args['device_type'];
4615
+                        }
4616
+                    ?>
4617 4617
 					<label class="mb-0"><?php echo $this->widget_field_title( $args['row'] ); ?><?php echo $this->widget_field_desc( $args['row'] ); ?></label>
4618 4618
 					<?php } ?>
4619 4619
 					<div class='row<?php echo ( ! empty( $args['row']['class'] ) ? ' ' . esc_attr( $args['row']['class'] ) : '' ); ?>'>
4620 4620
 					<div class='col pr-2'>
4621 4621
 					<?php
4622
-				} else if ( ! empty( $args['row']['close'] ) ) {
4623
-					echo "<div class='col pl-0 ps-0'>";
4624
-				} else {
4625
-					echo "<div class='col pl-0 ps-0 pr-2 pe-2'>";
4626
-				}
4627
-			}
4628
-		}
4629
-
4630
-		public function widget_inputs_row_end( $key, $args ) {
4631
-			if ( ! empty( $args['row'] ) ) {
4632
-				// Maybe close
4633
-				if ( ! empty( $args['row']['close'] ) ) {
4634
-					echo "</div></div>";
4635
-				}
4636
-				echo "</div>";
4637
-			}
4638
-		}
4639
-
4640
-		/**
4641
-		 * Get the hidden input that when added makes the advanced button show on widget settings.
4642
-		 *
4643
-		 * @return string
4644
-		 */
4645
-		public function widget_advanced_toggle() {
4646
-
4647
-			$output = '';
4648
-			if ( $this->block_show_advanced() ) {
4649
-				$val = 1;
4650
-			} else {
4651
-				$val = 0;
4652
-			}
4653
-
4654
-			$output .= "<input type='hidden'  class='sd-show-advanced' value='$val' />";
4655
-
4656
-			return $output;
4657
-		}
4622
+                } else if ( ! empty( $args['row']['close'] ) ) {
4623
+                    echo "<div class='col pl-0 ps-0'>";
4624
+                } else {
4625
+                    echo "<div class='col pl-0 ps-0 pr-2 pe-2'>";
4626
+                }
4627
+            }
4628
+        }
4658 4629
 
4659
-		/**
4660
-		 * Convert require element.
4661
-		 *
4662
-		 * @param string $input Input element.
4663
-		 *
4664
-		 * @return string $output
4665
-		 *@since 1.0.0
4666
-		 *
4667
-		 */
4668
-		public function convert_element_require( $input ) {
4669
-			$input = str_replace( "'", '"', $input );// we only want double quotes
4670
-
4671
-			$output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array(
4672
-				"jQuery(form).find('[data-argument=\"",
4673
-				"\"]').find('input,select,textarea').val()",
4674
-				"\"]').find('input:checked').val()"
4675
-			), $input ) );
4676
-
4677
-			return $output;
4678
-		}
4630
+        public function widget_inputs_row_end( $key, $args ) {
4631
+            if ( ! empty( $args['row'] ) ) {
4632
+                // Maybe close
4633
+                if ( ! empty( $args['row']['close'] ) ) {
4634
+                    echo "</div></div>";
4635
+                }
4636
+                echo "</div>";
4637
+            }
4638
+        }
4679 4639
 
4680
-		/**
4681
-		 * Builds the inputs for the widget options.
4682
-		 *
4683
-		 * @param $args
4684
-		 * @param $instance
4685
-		 */
4686
-		public function widget_inputs( $args, $instance ) {
4687
-
4688
-			$class             = "";
4689
-			$element_require   = "";
4690
-			$custom_attributes = "";
4691
-
4692
-			// get value
4693
-			if ( isset( $instance[ $args['name'] ] ) ) {
4694
-				$value = $instance[ $args['name'] ];
4695
-			} elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
4696
-				$value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
4697
-			} else {
4698
-				$value = '';
4699
-			}
4640
+        /**
4641
+         * Get the hidden input that when added makes the advanced button show on widget settings.
4642
+         *
4643
+         * @return string
4644
+         */
4645
+        public function widget_advanced_toggle() {
4700 4646
 
4701
-			// get placeholder
4702
-			if ( ! empty( $args['placeholder'] ) ) {
4703
-				$placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
4704
-			} else {
4705
-				$placeholder = '';
4706
-			}
4647
+            $output = '';
4648
+            if ( $this->block_show_advanced() ) {
4649
+                $val = 1;
4650
+            } else {
4651
+                $val = 0;
4652
+            }
4707 4653
 
4708
-			// get if advanced
4709
-			if ( isset( $args['advanced'] ) && $args['advanced'] ) {
4710
-				$class .= " sd-advanced-setting ";
4711
-			}
4654
+            $output .= "<input type='hidden'  class='sd-show-advanced' value='$val' />";
4712 4655
 
4713
-			// element_require
4714
-			if ( isset( $args['element_require'] ) && $args['element_require'] ) {
4715
-				$element_require = $args['element_require'];
4716
-			}
4656
+            return $output;
4657
+        }
4717 4658
 
4718
-			// custom_attributes
4719
-			if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
4720
-				$custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
4721
-			}
4659
+        /**
4660
+         * Convert require element.
4661
+         *
4662
+         * @param string $input Input element.
4663
+         *
4664
+         * @return string $output
4665
+         *@since 1.0.0
4666
+         *
4667
+         */
4668
+        public function convert_element_require( $input ) {
4669
+            $input = str_replace( "'", '"', $input );// we only want double quotes
4670
+
4671
+            $output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array(
4672
+                "jQuery(form).find('[data-argument=\"",
4673
+                "\"]').find('input,select,textarea').val()",
4674
+                "\"]').find('input:checked').val()"
4675
+            ), $input ) );
4676
+
4677
+            return $output;
4678
+        }
4722 4679
 
4723
-			// before wrapper
4724
-			?>
4680
+        /**
4681
+         * Builds the inputs for the widget options.
4682
+         *
4683
+         * @param $args
4684
+         * @param $instance
4685
+         */
4686
+        public function widget_inputs( $args, $instance ) {
4687
+
4688
+            $class             = "";
4689
+            $element_require   = "";
4690
+            $custom_attributes = "";
4691
+
4692
+            // get value
4693
+            if ( isset( $instance[ $args['name'] ] ) ) {
4694
+                $value = $instance[ $args['name'] ];
4695
+            } elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
4696
+                $value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
4697
+            } else {
4698
+                $value = '';
4699
+            }
4700
+
4701
+            // get placeholder
4702
+            if ( ! empty( $args['placeholder'] ) ) {
4703
+                $placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
4704
+            } else {
4705
+                $placeholder = '';
4706
+            }
4707
+
4708
+            // get if advanced
4709
+            if ( isset( $args['advanced'] ) && $args['advanced'] ) {
4710
+                $class .= " sd-advanced-setting ";
4711
+            }
4712
+
4713
+            // element_require
4714
+            if ( isset( $args['element_require'] ) && $args['element_require'] ) {
4715
+                $element_require = $args['element_require'];
4716
+            }
4717
+
4718
+            // custom_attributes
4719
+            if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
4720
+                $custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
4721
+            }
4722
+
4723
+            // before wrapper
4724
+            ?>
4725 4725
 			<p class="sd-argument <?php echo esc_attr( $class ); ?>" data-argument='<?php echo esc_attr( $args['name'] ); ?>' data-element_require='<?php if ( $element_require ) { echo $this->convert_element_require( $element_require );} ?>'>
4726 4726
 			<?php
4727
-			switch ( $args['type'] ) {
4728
-				//array('text','password','number','email','tel','url','color')
4729
-				case "text":
4730
-				case "password":
4731
-				case "number":
4732
-				case "email":
4733
-				case "tel":
4734
-				case "url":
4735
-				case "color":
4736
-					?>
4727
+            switch ( $args['type'] ) {
4728
+                //array('text','password','number','email','tel','url','color')
4729
+                case "text":
4730
+                case "password":
4731
+                case "number":
4732
+                case "email":
4733
+                case "tel":
4734
+                case "url":
4735
+                case "color":
4736
+                    ?>
4737 4737
 					<label 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>
4738 4738
 					<input <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="<?php echo esc_attr( $args['type'] ); ?>" value="<?php echo esc_attr( $value ); ?>">
4739 4739
 					<?php
4740 4740
 
4741
-					break;
4742
-				case "select":
4743
-					$multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
4744
-					if ( $multiple ) {
4745
-						if ( empty( $value ) ) {
4746
-							$value = array();
4747
-						}
4748
-					}
4749
-					?>
4741
+                    break;
4742
+                case "select":
4743
+                    $multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
4744
+                    if ( $multiple ) {
4745
+                        if ( empty( $value ) ) {
4746
+                            $value = array();
4747
+                        }
4748
+                    }
4749
+                    ?>
4750 4750
 					<label 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>
4751 4751
 					<select <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); if ( $multiple ) { echo "[]"; } ?>"
4752 4752
 						<?php if ( $multiple ) {
4753
-							echo "multiple";
4754
-						} //@todo not implemented yet due to gutenberg not supporting it
4755
-						?>>
4753
+                            echo "multiple";
4754
+                        } //@todo not implemented yet due to gutenberg not supporting it
4755
+                        ?>>
4756 4756
 						<?php
4757 4757
 
4758
-						if ( ! empty( $args['options'] ) ) {
4759
-							foreach ( $args['options'] as $val => $label ) {
4760
-								if ( $multiple ) {
4761
-									$selected = in_array( $val, $value ) ? 'selected="selected"' : '';
4762
-								} else {
4763
-									$selected = selected( $value, $val, false );
4764
-								}
4765
-								echo "<option value='$val' " . $selected . ">$label</option>";
4766
-							}
4767
-						}
4768
-						?>
4758
+                        if ( ! empty( $args['options'] ) ) {
4759
+                            foreach ( $args['options'] as $val => $label ) {
4760
+                                if ( $multiple ) {
4761
+                                    $selected = in_array( $val, $value ) ? 'selected="selected"' : '';
4762
+                                } else {
4763
+                                    $selected = selected( $value, $val, false );
4764
+                                }
4765
+                                echo "<option value='$val' " . $selected . ">$label</option>";
4766
+                            }
4767
+                        }
4768
+                        ?>
4769 4769
 					</select>
4770 4770
 					<?php
4771
-					break;
4772
-				case "checkbox":
4773
-					?>
4771
+                    break;
4772
+                case "checkbox":
4773
+                    ?>
4774 4774
 					<input <?php echo $placeholder; ?> <?php checked( 1, $value, true ) ?> <?php echo $custom_attributes; ?> class="widefat" id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="checkbox" value="1">
4775 4775
 					<label 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>
4776 4776
 					<?php
4777
-					break;
4778
-				case "textarea":
4779
-					?>
4777
+                    break;
4778
+                case "textarea":
4779
+                    ?>
4780 4780
 					<label 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>
4781 4781
 					<textarea <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>"><?php echo esc_attr( $value ); ?></textarea>
4782 4782
 					<?php
4783 4783
 
4784
-					break;
4785
-				case "hidden":
4786
-					?>
4784
+                    break;
4785
+                case "hidden":
4786
+                    ?>
4787 4787
 					<input id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="hidden" value="<?php echo esc_attr( $value ); ?>">
4788 4788
 					<?php
4789
-					break;
4790
-				default:
4791
-					echo "No input type found!"; // @todo we need to add more input types.
4792
-			}
4793
-			// after wrapper
4794
-			?></p><?php
4795
-		}
4796
-
4797
-		public function get_widget_icon($icon = 'box-top', $title = ''){
4798
-			if($icon=='box-top'){
4799
-				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>';
4800
-			}elseif($icon=='box-right'){
4801
-				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>';
4802
-			}elseif($icon=='box-bottom'){
4803
-				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>';
4804
-			}elseif($icon=='box-left'){
4805
-				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>';
4806
-			}
4807
-		}
4808
-
4809
-		/**
4810
-		 * Get the widget input description html.
4811
-		 *
4812
-		 * @param $args
4813
-		 *
4814
-		 * @return string
4815
-		 * @todo, need to make its own tooltip script
4816
-		 */
4817
-		public function widget_field_desc( $args ) {
4818
-
4819
-			$description = '';
4820
-			if ( isset( $args['desc'] ) && $args['desc'] ) {
4821
-				if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
4822
-					$description = $this->desc_tip( $args['desc'] );
4823
-				} else {
4824
-					$description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
4825
-				}
4826
-			}
4827
-
4828
-			return $description;
4829
-		}
4830
-
4831
-		/**
4832
-		 * Get the widget input title html.
4833
-		 *
4834
-		 * @param $args
4835
-		 *
4836
-		 * @return string
4837
-		 */
4838
-		public function widget_field_title( $args ) {
4839
-			$title = '';
4840
-
4841
-			if ( isset( $args['title'] ) && $args['title'] ) {
4842
-				if ( ! empty( $args['device_type'] ) ) {
4843
-					$args['title'] .= ' (' . $args['device_type'] . ')'; // Append device type to title.
4844
-				}
4845
-
4846
-				if ( isset( $args['icon'] ) && $args['icon'] ) {
4847
-					$title = self::get_widget_icon( $args['icon'], $args['title']  );
4848
-				} else {
4849
-					$title = esc_attr( $args['title'] );
4850
-				}
4851
-			}
4852
-
4853
-			return $title;
4854
-		}
4855
-
4856
-		/**
4857
-		 * Get the tool tip html.
4858
-		 *
4859
-		 * @param $tip
4860
-		 * @param bool $allow_html
4861
-		 *
4862
-		 * @return string
4863
-		 */
4864
-		function desc_tip( $tip, $allow_html = false ) {
4865
-			if ( $allow_html ) {
4866
-				$tip = $this->sanitize_tooltip( $tip );
4867
-			} else {
4868
-				$tip = esc_attr( $tip );
4869
-			}
4870
-
4871
-			return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
4872
-		}
4789
+                    break;
4790
+                default:
4791
+                    echo "No input type found!"; // @todo we need to add more input types.
4792
+            }
4793
+            // after wrapper
4794
+            ?></p><?php
4795
+        }
4873 4796
 
4874
-		/**
4875
-		 * Sanitize a string destined to be a tooltip.
4876
-		 *
4877
-		 * @param string $var
4878
-		 *
4879
-		 * @return string
4880
-		 */
4881
-		public function sanitize_tooltip( $var ) {
4882
-			return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
4883
-				'br'     => array(),
4884
-				'em'     => array(),
4885
-				'strong' => array(),
4886
-				'small'  => array(),
4887
-				'span'   => array(),
4888
-				'ul'     => array(),
4889
-				'li'     => array(),
4890
-				'ol'     => array(),
4891
-				'p'      => array(),
4892
-			) ) );
4893
-		}
4797
+        public function get_widget_icon($icon = 'box-top', $title = ''){
4798
+            if($icon=='box-top'){
4799
+                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>';
4800
+            }elseif($icon=='box-right'){
4801
+                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>';
4802
+            }elseif($icon=='box-bottom'){
4803
+                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>';
4804
+            }elseif($icon=='box-left'){
4805
+                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>';
4806
+            }
4807
+        }
4894 4808
 
4895
-		/**
4896
-		 * Processing widget options on save
4897
-		 *
4898
-		 * @param array $new_instance The new options
4899
-		 * @param array $old_instance The previous options
4900
-		 *
4901
-		 * @return array
4902
-		 * @todo we should add some sanitation here.
4903
-		 */
4904
-		public function update( $new_instance, $old_instance ) {
4905
-
4906
-			//save the widget
4907
-			$instance = array_merge( (array) $old_instance, (array) $new_instance );
4908
-
4909
-			// set widget instance
4910
-			$this->instance = $instance;
4911
-
4912
-			if ( empty( $this->arguments ) ) {
4913
-				$this->get_arguments();
4914
-			}
4809
+        /**
4810
+         * Get the widget input description html.
4811
+         *
4812
+         * @param $args
4813
+         *
4814
+         * @return string
4815
+         * @todo, need to make its own tooltip script
4816
+         */
4817
+        public function widget_field_desc( $args ) {
4818
+
4819
+            $description = '';
4820
+            if ( isset( $args['desc'] ) && $args['desc'] ) {
4821
+                if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
4822
+                    $description = $this->desc_tip( $args['desc'] );
4823
+                } else {
4824
+                    $description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
4825
+                }
4826
+            }
4827
+
4828
+            return $description;
4829
+        }
4915 4830
 
4916
-			// check for checkboxes
4917
-			if ( ! empty( $this->arguments ) ) {
4918
-				foreach ( $this->arguments as $argument ) {
4919
-					if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
4920
-						$instance[ $argument['name'] ] = '0';
4921
-					}
4922
-				}
4923
-			}
4831
+        /**
4832
+         * Get the widget input title html.
4833
+         *
4834
+         * @param $args
4835
+         *
4836
+         * @return string
4837
+         */
4838
+        public function widget_field_title( $args ) {
4839
+            $title = '';
4840
+
4841
+            if ( isset( $args['title'] ) && $args['title'] ) {
4842
+                if ( ! empty( $args['device_type'] ) ) {
4843
+                    $args['title'] .= ' (' . $args['device_type'] . ')'; // Append device type to title.
4844
+                }
4845
+
4846
+                if ( isset( $args['icon'] ) && $args['icon'] ) {
4847
+                    $title = self::get_widget_icon( $args['icon'], $args['title']  );
4848
+                } else {
4849
+                    $title = esc_attr( $args['title'] );
4850
+                }
4851
+            }
4852
+
4853
+            return $title;
4854
+        }
4924 4855
 
4925
-			return $instance;
4926
-		}
4856
+        /**
4857
+         * Get the tool tip html.
4858
+         *
4859
+         * @param $tip
4860
+         * @param bool $allow_html
4861
+         *
4862
+         * @return string
4863
+         */
4864
+        function desc_tip( $tip, $allow_html = false ) {
4865
+            if ( $allow_html ) {
4866
+                $tip = $this->sanitize_tooltip( $tip );
4867
+            } else {
4868
+                $tip = esc_attr( $tip );
4869
+            }
4870
+
4871
+            return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
4872
+        }
4927 4873
 
4928
-		/**
4929
-		 * Checks if the current call is a ajax call to get the block content.
4930
-		 *
4931
-		 * This can be used in your widget to return different content as the block content.
4932
-		 *
4933
-		 * @return bool
4934
-		 *@since 1.0.3
4935
-		 */
4936
-		public function is_block_content_call() {
4937
-			$result = false;
4938
-			if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
4939
-				$result = true;
4940
-			}
4874
+        /**
4875
+         * Sanitize a string destined to be a tooltip.
4876
+         *
4877
+         * @param string $var
4878
+         *
4879
+         * @return string
4880
+         */
4881
+        public function sanitize_tooltip( $var ) {
4882
+            return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
4883
+                'br'     => array(),
4884
+                'em'     => array(),
4885
+                'strong' => array(),
4886
+                'small'  => array(),
4887
+                'span'   => array(),
4888
+                'ul'     => array(),
4889
+                'li'     => array(),
4890
+                'ol'     => array(),
4891
+                'p'      => array(),
4892
+            ) ) );
4893
+        }
4941 4894
 
4942
-			return $result;
4943
-		}
4895
+        /**
4896
+         * Processing widget options on save
4897
+         *
4898
+         * @param array $new_instance The new options
4899
+         * @param array $old_instance The previous options
4900
+         *
4901
+         * @return array
4902
+         * @todo we should add some sanitation here.
4903
+         */
4904
+        public function update( $new_instance, $old_instance ) {
4905
+
4906
+            //save the widget
4907
+            $instance = array_merge( (array) $old_instance, (array) $new_instance );
4908
+
4909
+            // set widget instance
4910
+            $this->instance = $instance;
4911
+
4912
+            if ( empty( $this->arguments ) ) {
4913
+                $this->get_arguments();
4914
+            }
4915
+
4916
+            // check for checkboxes
4917
+            if ( ! empty( $this->arguments ) ) {
4918
+                foreach ( $this->arguments as $argument ) {
4919
+                    if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
4920
+                        $instance[ $argument['name'] ] = '0';
4921
+                    }
4922
+                }
4923
+            }
4924
+
4925
+            return $instance;
4926
+        }
4944 4927
 
4945
-		/**
4946
-		 * Get an instance hash that will be unique to the type and settings.
4947
-		 *
4948
-		 * @return string
4949
-		 *@since 1.0.20
4950
-		 */
4951
-		public function get_instance_hash(){
4952
-			$instance_string = $this->base_id.serialize($this->instance);
4953
-			return hash('crc32b',$instance_string);
4954
-		}
4928
+        /**
4929
+         * Checks if the current call is a ajax call to get the block content.
4930
+         *
4931
+         * This can be used in your widget to return different content as the block content.
4932
+         *
4933
+         * @return bool
4934
+         *@since 1.0.3
4935
+         */
4936
+        public function is_block_content_call() {
4937
+            $result = false;
4938
+            if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
4939
+                $result = true;
4940
+            }
4941
+
4942
+            return $result;
4943
+        }
4955 4944
 
4956
-		/**
4957
-		 * Generate and return inline styles from CSS rules that will match the unique class of the instance.
4958
-		 *
4959
-		 * @param array $rules
4960
-		 *
4961
-		 * @return string
4962
-		 *@since 1.0.20
4963
-		 */
4964
-		public function get_instance_style($rules = array()){
4965
-			$css = '';
4966
-
4967
-			if(!empty($rules)){
4968
-				$rules = array_unique($rules);
4969
-				$instance_hash = $this->get_instance_hash();
4970
-				$css .= "<style>";
4971
-				foreach($rules as $rule){
4972
-					$css .= ".sdel-$instance_hash $rule";
4973
-				}
4974
-				$css .= "</style>";
4975
-			}
4945
+        /**
4946
+         * Get an instance hash that will be unique to the type and settings.
4947
+         *
4948
+         * @return string
4949
+         *@since 1.0.20
4950
+         */
4951
+        public function get_instance_hash(){
4952
+            $instance_string = $this->base_id.serialize($this->instance);
4953
+            return hash('crc32b',$instance_string);
4954
+        }
4976 4955
 
4977
-			return $css;
4978
-		}
4956
+        /**
4957
+         * Generate and return inline styles from CSS rules that will match the unique class of the instance.
4958
+         *
4959
+         * @param array $rules
4960
+         *
4961
+         * @return string
4962
+         *@since 1.0.20
4963
+         */
4964
+        public function get_instance_style($rules = array()){
4965
+            $css = '';
4966
+
4967
+            if(!empty($rules)){
4968
+                $rules = array_unique($rules);
4969
+                $instance_hash = $this->get_instance_hash();
4970
+                $css .= "<style>";
4971
+                foreach($rules as $rule){
4972
+                    $css .= ".sdel-$instance_hash $rule";
4973
+                }
4974
+                $css .= "</style>";
4975
+            }
4976
+
4977
+            return $css;
4978
+        }
4979 4979
 
4980
-		/**
4981
-		 * Encode shortcodes tags.
4982
-		 *
4983
-		 * @param string $content Content to search for shortcode tags.
4984
-		 *
4980
+        /**
4981
+         * Encode shortcodes tags.
4982
+         *
4983
+         * @param string $content Content to search for shortcode tags.
4984
+         *
4985 4985
 *@return string Content with shortcode tags removed.
4986
-		 *@since 1.0.28
4987
-		 *
4988
-		 */
4989
-		public function encode_shortcodes( $content ) {
4990
-			// Avoids existing encoded tags.
4991
-			$trans   = array(
4992
-				'&#91;' => '&#091;',
4993
-				'&#93;' => '&#093;',
4994
-				'&amp;#91;' => '&#091;',
4995
-				'&amp;#93;' => '&#093;',
4996
-				'&lt;' => '&0lt;',
4997
-				'&gt;' => '&0gt;',
4998
-				'&amp;lt;' => '&0lt;',
4999
-				'&amp;gt;' => '&0gt;',
5000
-			);
5001
-
5002
-			$content = strtr( $content, $trans );
5003
-
5004
-			$trans   = array(
5005
-				'[' => '&#91;',
5006
-				']' => '&#93;',
5007
-				'<' => '&lt;',
5008
-				'>' => '&gt;',
5009
-				'"' => '&quot;',
5010
-				"'" => '&#39;',
5011
-			);
5012
-
5013
-			$content = strtr( $content, $trans );
5014
-
5015
-			return $content;
5016
-		}
4986
+         *@since 1.0.28
4987
+         *
4988
+         */
4989
+        public function encode_shortcodes( $content ) {
4990
+            // Avoids existing encoded tags.
4991
+            $trans   = array(
4992
+                '&#91;' => '&#091;',
4993
+                '&#93;' => '&#093;',
4994
+                '&amp;#91;' => '&#091;',
4995
+                '&amp;#93;' => '&#093;',
4996
+                '&lt;' => '&0lt;',
4997
+                '&gt;' => '&0gt;',
4998
+                '&amp;lt;' => '&0lt;',
4999
+                '&amp;gt;' => '&0gt;',
5000
+            );
5001
+
5002
+            $content = strtr( $content, $trans );
5003
+
5004
+            $trans   = array(
5005
+                '[' => '&#91;',
5006
+                ']' => '&#93;',
5007
+                '<' => '&lt;',
5008
+                '>' => '&gt;',
5009
+                '"' => '&quot;',
5010
+                "'" => '&#39;',
5011
+            );
5012
+
5013
+            $content = strtr( $content, $trans );
5014
+
5015
+            return $content;
5016
+        }
5017 5017
 
5018
-		/**
5019
-		 * Remove encoded shortcod tags.
5020
-		 *
5021
-		 * @param string $content Content to search for shortcode tags.
5022
-		 *
5018
+        /**
5019
+         * Remove encoded shortcod tags.
5020
+         *
5021
+         * @param string $content Content to search for shortcode tags.
5022
+         *
5023 5023
 *@return string Content with decoded shortcode tags.
5024
-		 *@since 1.0.28
5025
-		 *
5026
-		 */
5027
-		public function decode_shortcodes( $content ) {
5028
-			$trans   = array(
5029
-				'&#91;' => '[',
5030
-				'&#93;' => ']',
5031
-				'&amp;#91;' => '[',
5032
-				'&amp;#93;' => ']',
5033
-				'&lt;' => '<',
5034
-				'&gt;' => '>',
5035
-				'&amp;lt;' => '<',
5036
-				'&amp;gt;' => '>',
5037
-				'&quot;' => '"',
5038
-				'&apos;' => "'",
5039
-			);
5040
-
5041
-			$content = strtr( $content, $trans );
5042
-
5043
-			$trans   = array(
5044
-				'&#091;' => '&#91;',
5045
-				'&#093;' => '&#93;',
5046
-				'&amp;#091;' => '&#91;',
5047
-				'&amp;#093;' => '&#93;',
5048
-				'&0lt;' => '&lt;',
5049
-				'&0gt;' => '&gt;',
5050
-				'&amp;0lt;' => '&lt;',
5051
-				'&amp;0gt;' => '&gt;',
5052
-			);
5053
-
5054
-			$content = strtr( $content, $trans );
5055
-
5056
-			return $content;
5057
-		}
5058
-
5059
-		public function block_visibility_fields( $args ) {
5060
-			$value = ! empty( $args['value'] ) ? esc_attr( $args['value'] ) : '';
5061
-			$content = '<div class="bs-vc-rule-template d-none">';
5062
-				$content .= '<div class="p-3 pb-0 mb-3 border border-1 rounded-1 position-relative bs-vc-rule" data-bs-index="BSVCINDEX" >';
5063
-					$content .= '<div class="row">';
5064
-						$content .= '<div class="col-sm-12">';
5065
-							$content .= '<div class="bs-rule-action position-absolute top-0 end-0 p-2 zindex-5"><span class="text-danger c-pointer bs-vc-remove-rule" title="' . esc_attr__( 'Remove Rule', 'ayecode-connect' ) . '"><i class="fas fa-circle-minus fs-6"></i></span></div>';
5066
-							$content .= aui()->select(
5067
-								array(
5068
-									'id'          => 'bsvc_rule_BSVCINDEX',
5069
-									'name'        => 'bsvc_rule_BSVCINDEX',
5070
-									'label'       => __( 'Rule', 'ayecode-connect' ),
5071
-									'placeholder' => __( 'Select Rule...', 'ayecode-connect' ),
5072
-									'class'       => 'bsvc_rule form-select-sm no-select2 mw-100',
5073
-									'options'     => sd_visibility_rules_options(),
5074
-									'default'     => '',
5075
-									'value'       => '',
5076
-									'label_type'  => '',
5077
-									'select2'     => false,
5078
-									'input_group_left' => __( 'Rule:', 'ayecode-connect' ),
5079
-									'extra_attributes' => array(
5080
-										'data-minimum-results-for-search' => '-1'
5081
-									)
5082
-								)
5083
-							);
5084
-
5085
-						$content .= '</div>';
5086
-
5087
-						if ( class_exists( 'GeoDirectory' ) ) {
5088
-							$content .= '<div class="col-md-7 col-sm-12">';
5089
-
5090
-								$content .= aui()->select(
5091
-									array(
5092
-										'id'          => 'bsvc_gd_field_BSVCINDEX',
5093
-										'name'        => 'bsvc_gd_field_BSVCINDEX',
5094
-										'label'       => __( 'FIELD', 'ayecode-connect' ),
5095
-										'placeholder' => __( 'FIELD', 'ayecode-connect' ),
5096
-										'class'       => 'bsvc_gd_field form-select-sm no-select2 mw-100',
5097
-										'options'     => sd_visibility_gd_field_options(),
5098
-										'default'     => '',
5099
-										'value'       => '',
5100
-										'label_type'  => '',
5101
-										'select2'     => false,
5102
-										'element_require'  => '[%bsvc_rule_BSVCINDEX%]=="gd_field"',
5103
-										'extra_attributes' => array(
5104
-											'data-minimum-results-for-search' => '-1'
5105
-										)
5106
-									)
5107
-								);
5108
-
5109
-							$content .= '</div>';
5110
-							$content .= '<div class="col-md-5 col-sm-12">';
5111
-
5112
-								$content .= aui()->select(
5113
-									array(
5114
-										'id'          => 'bsvc_gd_field_condition_BSVCINDEX',
5115
-										'name'        => 'bsvc_gd_field_condition_BSVCINDEX',
5116
-										'label'       => __( 'CONDITION', 'ayecode-connect' ),
5117
-										'placeholder' => __( 'CONDITION', 'ayecode-connect' ),
5118
-										'class'       => 'bsvc_gd_field_condition form-select-sm no-select2 mw-100',
5119
-										'options'     => sd_visibility_field_condition_options(),
5120
-										'default'     => '',
5121
-										'value'       => '',
5122
-										'label_type'  => '',
5123
-										'select2'     => false,
5124
-										'element_require'  => '[%bsvc_rule_BSVCINDEX%]=="gd_field"',
5125
-										'extra_attributes' => array(
5126
-											'data-minimum-results-for-search' => '-1'
5127
-										)
5128
-									)
5129
-								);
5130
-
5131
-							$content .= '</div>';
5132
-							$content .= '<div class="col-sm-12">';
5133
-
5134
-								$content .= aui()->input(
5135
-									array(
5136
-										'type'            => 'text',
5137
-										'id'              => 'bsvc_gd_field_search_BSVCINDEX',
5138
-										'name'            => 'bsvc_gd_field_search_BSVCINDEX',
5139
-										'label'           => __( 'VALUE TO MATCH', 'ayecode-connect' ),
5140
-										'class'           => 'bsvc_gd_field_search form-control-sm',
5141
-										'placeholder'     => __( 'VALUE TO MATCH', 'ayecode-connect' ),
5142
-										'label_type'      => '',
5143
-										'value'           => '',
5144
-										'element_require' => '([%bsvc_rule_BSVCINDEX%]=="gd_field" && [%bsvc_gd_field_condition_BSVCINDEX%] && [%bsvc_gd_field_condition_BSVCINDEX%]!="is_empty" && [%bsvc_gd_field_condition_BSVCINDEX%]!="is_not_empty")'
5145
-									)
5146
-								);
5147
-
5148
-							$content .= '</div>';
5149
-						}
5024
+         *@since 1.0.28
5025
+         *
5026
+         */
5027
+        public function decode_shortcodes( $content ) {
5028
+            $trans   = array(
5029
+                '&#91;' => '[',
5030
+                '&#93;' => ']',
5031
+                '&amp;#91;' => '[',
5032
+                '&amp;#93;' => ']',
5033
+                '&lt;' => '<',
5034
+                '&gt;' => '>',
5035
+                '&amp;lt;' => '<',
5036
+                '&amp;gt;' => '>',
5037
+                '&quot;' => '"',
5038
+                '&apos;' => "'",
5039
+            );
5040
+
5041
+            $content = strtr( $content, $trans );
5042
+
5043
+            $trans   = array(
5044
+                '&#091;' => '&#91;',
5045
+                '&#093;' => '&#93;',
5046
+                '&amp;#091;' => '&#91;',
5047
+                '&amp;#093;' => '&#93;',
5048
+                '&0lt;' => '&lt;',
5049
+                '&0gt;' => '&gt;',
5050
+                '&amp;0lt;' => '&lt;',
5051
+                '&amp;0gt;' => '&gt;',
5052
+            );
5053
+
5054
+            $content = strtr( $content, $trans );
5055
+
5056
+            return $content;
5057
+        }
5150 5058
 
5151
-					$content .= '</div>';
5152
-
5153
-					$content .= '<div class="row aui-conditional-field" data-element-require="jQuery(form).find(\'[name=bsvc_rule_BSVCINDEX]\').val()==\'user_roles\'" data-argument="bsvc_user_roles_BSVCINDEX_1"><label for="bsvc_user_roles_BSVCINDEX_1" class="form-label mb-3">' . __( 'Select User Roles:', 'ayecode-connect' ) . '</label>';
5154
-						$role_options = sd_user_roles_options();
5155
-
5156
-						$role_option_i = 0;
5157
-						foreach ( $role_options as $role_option_key => $role_option_name ) {
5158
-							$role_option_i++;
5159
-
5160
-							$content .= '<div class="col-sm-6">';
5161
-							$content .= aui()->input(
5162
-								array(
5163
-									'id'               => 'bsvc_user_roles_BSVCINDEX_' . $role_option_i,
5164
-									'name'             => 'bsvc_user_roles_BSVCINDEX[]',
5165
-									'type'             => 'checkbox',
5166
-									'label'            => $role_option_name,
5167
-									'label_type'       => 'hidden',
5168
-									'class'            => 'bsvc_user_roles',
5169
-									'value'            => $role_option_key,
5170
-									'switch'           => 'md',
5171
-									'no_wrap'          => true
5172
-								)
5173
-							);
5174
-							$content .= '</div>';
5175
-						}
5176
-					$content .= '</div>';
5177
-				$content .= '</div>';
5178
-			$content .= '</div>';
5179
-			$content .= '<form id="bs-vc-modal-form" class="bs-vc-modal-form">';
5180
-			$content .= '<div class="bs-vc-rule-sets"></div>';
5181
-			$content .= '<div class="row"><div class="col-sm-12 text-center pt-1 pb-4"><button type="button" class="btn btn-sm btn-primary d-block w-100 bs-vc-add-rule"><i class="fas fa-plus"></i> ' . __( 'Add Rule', 'ayecode-connect' ) . '</button></div></div>';
5182
-			$content .= '<div class="row"><div class="col-md-6 col-sm-12">';
5183
-			$content .= aui()->select(
5184
-				array(
5185
-					'id'          => 'bsvc_output',
5186
-					'name'        => 'bsvc_output',
5187
-					'label'       => __( 'What should happen if rules met.', 'ayecode-connect' ),
5188
-					'placeholder' => __( 'Default Output', 'ayecode-connect' ),
5189
-					'class'       => 'bsvc_output form-select-sm no-select2 mw-100',
5190
-					'options'     => sd_visibility_output_options(),
5191
-					'default'     => '',
5192
-					'value'       => '',
5193
-					'label_type'  => 'top',
5194
-					'select2'     => false,
5195
-					'extra_attributes' => array(
5196
-						'data-minimum-results-for-search' => '-1'
5197
-					)
5198
-				)
5199
-			);
5200
-
5201
-			$content .= '</div><div class="col-md-6 col-sm-12">';
5202
-
5203
-			$content .= aui()->select(
5204
-				array(
5205
-					'id'              => 'bsvc_page',
5206
-					'name'            => 'bsvc_page',
5207
-					'label'           => __( 'Page Content', 'ayecode-connect' ),
5208
-					'placeholder'     => __( 'Select Page ID...', 'ayecode-connect' ),
5209
-					'class'           => 'bsvc_page form-select-sm no-select2 mw-100',
5210
-					'options'         => sd_template_page_options(),
5211
-					'default'         => '',
5212
-					'value'           => '',
5213
-					'label_type'      => 'top',
5214
-					'select2'         => false,
5215
-					'element_require' => '[%bsvc_output%]=="page"'
5216
-				)
5217
-			);
5218
-
5219
-			$content .= aui()->select(
5220
-				array(
5221
-					'id'          => 'bsvc_tmpl_part',
5222
-					'name'        => 'bsvc_tmpl_part',
5223
-					'label'       => __( 'Template Part', 'ayecode-connect' ),
5224
-					'placeholder' => __( 'Select Template Part...', 'ayecode-connect' ),
5225
-					'class'       => 'bsvc_tmpl_part form-select-sm no-select2 mw-100',
5226
-					'options'     => sd_template_part_options(),
5227
-					'default'     => '',
5228
-					'value'       => '',
5229
-					'label_type'  => 'top',
5230
-					'select2'     => false,
5231
-					'element_require'  => '[%bsvc_output%]=="template_part"',
5232
-					'extra_attributes' => array(
5233
-						'data-minimum-results-for-search' => '-1'
5234
-					)
5235
-				)
5236
-			);
5237
-
5238
-			$content .= aui()->select(
5239
-				array(
5240
-					'id'               => 'bsvc_message_type',
5241
-					'name'             => 'bsvc_message_type',
5242
-					'label'            => __( 'Custom Message Type', 'ayecode-connect' ),
5243
-					'placeholder'      => __( 'Default (none)', 'ayecode-connect' ),
5244
-					'class'            => 'bsvc_message_type form-select-sm no-select2 mw-100',
5245
-					'options'          => sd_aui_colors(),
5246
-					'default'          => '',
5247
-					'value'            => '',
5248
-					'label_type'       => 'top',
5249
-					'select2'          => false,
5250
-					'element_require'  => '[%bsvc_output%]=="message"',
5251
-					'extra_attributes' => array(
5252
-						'data-minimum-results-for-search' => '-1'
5253
-					)
5254
-				)
5255
-			);
5256
-
5257
-			$content .= '</div><div class="col-sm-12">';
5258
-
5259
-			$content .= aui()->input(
5260
-				array(
5261
-					'type'            => 'text',
5262
-					'id'              => 'bsvc_message',
5263
-					'name'            => 'bsvc_message',
5264
-					'label'           => '',
5265
-					'class'           => 'bsvc_message form-control-sm',
5266
-					'placeholder'     => __( 'CUSTOM MESSAGE TO SHOW', 'ayecode-connect' ),
5267
-					'label_type'      => '',
5268
-					'value'           => '',
5269
-					'form_group_class' => ' ',
5270
-					'element_require' => '[%bsvc_output%]=="message"',
5271
-				)
5272
-			);
5273
-
5274
-			$content .= '</div></div></form><input type="hidden" id="bsvc_raw_value" name="bsvc_raw_value" value="' . $value . '">';
5275
-
5276
-			return $content;
5277
-		}
5059
+        public function block_visibility_fields( $args ) {
5060
+            $value = ! empty( $args['value'] ) ? esc_attr( $args['value'] ) : '';
5061
+            $content = '<div class="bs-vc-rule-template d-none">';
5062
+                $content .= '<div class="p-3 pb-0 mb-3 border border-1 rounded-1 position-relative bs-vc-rule" data-bs-index="BSVCINDEX" >';
5063
+                    $content .= '<div class="row">';
5064
+                        $content .= '<div class="col-sm-12">';
5065
+                            $content .= '<div class="bs-rule-action position-absolute top-0 end-0 p-2 zindex-5"><span class="text-danger c-pointer bs-vc-remove-rule" title="' . esc_attr__( 'Remove Rule', 'ayecode-connect' ) . '"><i class="fas fa-circle-minus fs-6"></i></span></div>';
5066
+                            $content .= aui()->select(
5067
+                                array(
5068
+                                    'id'          => 'bsvc_rule_BSVCINDEX',
5069
+                                    'name'        => 'bsvc_rule_BSVCINDEX',
5070
+                                    'label'       => __( 'Rule', 'ayecode-connect' ),
5071
+                                    'placeholder' => __( 'Select Rule...', 'ayecode-connect' ),
5072
+                                    'class'       => 'bsvc_rule form-select-sm no-select2 mw-100',
5073
+                                    'options'     => sd_visibility_rules_options(),
5074
+                                    'default'     => '',
5075
+                                    'value'       => '',
5076
+                                    'label_type'  => '',
5077
+                                    'select2'     => false,
5078
+                                    'input_group_left' => __( 'Rule:', 'ayecode-connect' ),
5079
+                                    'extra_attributes' => array(
5080
+                                        'data-minimum-results-for-search' => '-1'
5081
+                                    )
5082
+                                )
5083
+                            );
5084
+
5085
+                        $content .= '</div>';
5086
+
5087
+                        if ( class_exists( 'GeoDirectory' ) ) {
5088
+                            $content .= '<div class="col-md-7 col-sm-12">';
5089
+
5090
+                                $content .= aui()->select(
5091
+                                    array(
5092
+                                        'id'          => 'bsvc_gd_field_BSVCINDEX',
5093
+                                        'name'        => 'bsvc_gd_field_BSVCINDEX',
5094
+                                        'label'       => __( 'FIELD', 'ayecode-connect' ),
5095
+                                        'placeholder' => __( 'FIELD', 'ayecode-connect' ),
5096
+                                        'class'       => 'bsvc_gd_field form-select-sm no-select2 mw-100',
5097
+                                        'options'     => sd_visibility_gd_field_options(),
5098
+                                        'default'     => '',
5099
+                                        'value'       => '',
5100
+                                        'label_type'  => '',
5101
+                                        'select2'     => false,
5102
+                                        'element_require'  => '[%bsvc_rule_BSVCINDEX%]=="gd_field"',
5103
+                                        'extra_attributes' => array(
5104
+                                            'data-minimum-results-for-search' => '-1'
5105
+                                        )
5106
+                                    )
5107
+                                );
5108
+
5109
+                            $content .= '</div>';
5110
+                            $content .= '<div class="col-md-5 col-sm-12">';
5111
+
5112
+                                $content .= aui()->select(
5113
+                                    array(
5114
+                                        'id'          => 'bsvc_gd_field_condition_BSVCINDEX',
5115
+                                        'name'        => 'bsvc_gd_field_condition_BSVCINDEX',
5116
+                                        'label'       => __( 'CONDITION', 'ayecode-connect' ),
5117
+                                        'placeholder' => __( 'CONDITION', 'ayecode-connect' ),
5118
+                                        'class'       => 'bsvc_gd_field_condition form-select-sm no-select2 mw-100',
5119
+                                        'options'     => sd_visibility_field_condition_options(),
5120
+                                        'default'     => '',
5121
+                                        'value'       => '',
5122
+                                        'label_type'  => '',
5123
+                                        'select2'     => false,
5124
+                                        'element_require'  => '[%bsvc_rule_BSVCINDEX%]=="gd_field"',
5125
+                                        'extra_attributes' => array(
5126
+                                            'data-minimum-results-for-search' => '-1'
5127
+                                        )
5128
+                                    )
5129
+                                );
5130
+
5131
+                            $content .= '</div>';
5132
+                            $content .= '<div class="col-sm-12">';
5133
+
5134
+                                $content .= aui()->input(
5135
+                                    array(
5136
+                                        'type'            => 'text',
5137
+                                        'id'              => 'bsvc_gd_field_search_BSVCINDEX',
5138
+                                        'name'            => 'bsvc_gd_field_search_BSVCINDEX',
5139
+                                        'label'           => __( 'VALUE TO MATCH', 'ayecode-connect' ),
5140
+                                        'class'           => 'bsvc_gd_field_search form-control-sm',
5141
+                                        'placeholder'     => __( 'VALUE TO MATCH', 'ayecode-connect' ),
5142
+                                        'label_type'      => '',
5143
+                                        'value'           => '',
5144
+                                        'element_require' => '([%bsvc_rule_BSVCINDEX%]=="gd_field" && [%bsvc_gd_field_condition_BSVCINDEX%] && [%bsvc_gd_field_condition_BSVCINDEX%]!="is_empty" && [%bsvc_gd_field_condition_BSVCINDEX%]!="is_not_empty")'
5145
+                                    )
5146
+                                );
5147
+
5148
+                            $content .= '</div>';
5149
+                        }
5150
+
5151
+                    $content .= '</div>';
5152
+
5153
+                    $content .= '<div class="row aui-conditional-field" data-element-require="jQuery(form).find(\'[name=bsvc_rule_BSVCINDEX]\').val()==\'user_roles\'" data-argument="bsvc_user_roles_BSVCINDEX_1"><label for="bsvc_user_roles_BSVCINDEX_1" class="form-label mb-3">' . __( 'Select User Roles:', 'ayecode-connect' ) . '</label>';
5154
+                        $role_options = sd_user_roles_options();
5155
+
5156
+                        $role_option_i = 0;
5157
+                        foreach ( $role_options as $role_option_key => $role_option_name ) {
5158
+                            $role_option_i++;
5159
+
5160
+                            $content .= '<div class="col-sm-6">';
5161
+                            $content .= aui()->input(
5162
+                                array(
5163
+                                    'id'               => 'bsvc_user_roles_BSVCINDEX_' . $role_option_i,
5164
+                                    'name'             => 'bsvc_user_roles_BSVCINDEX[]',
5165
+                                    'type'             => 'checkbox',
5166
+                                    'label'            => $role_option_name,
5167
+                                    'label_type'       => 'hidden',
5168
+                                    'class'            => 'bsvc_user_roles',
5169
+                                    'value'            => $role_option_key,
5170
+                                    'switch'           => 'md',
5171
+                                    'no_wrap'          => true
5172
+                                )
5173
+                            );
5174
+                            $content .= '</div>';
5175
+                        }
5176
+                    $content .= '</div>';
5177
+                $content .= '</div>';
5178
+            $content .= '</div>';
5179
+            $content .= '<form id="bs-vc-modal-form" class="bs-vc-modal-form">';
5180
+            $content .= '<div class="bs-vc-rule-sets"></div>';
5181
+            $content .= '<div class="row"><div class="col-sm-12 text-center pt-1 pb-4"><button type="button" class="btn btn-sm btn-primary d-block w-100 bs-vc-add-rule"><i class="fas fa-plus"></i> ' . __( 'Add Rule', 'ayecode-connect' ) . '</button></div></div>';
5182
+            $content .= '<div class="row"><div class="col-md-6 col-sm-12">';
5183
+            $content .= aui()->select(
5184
+                array(
5185
+                    'id'          => 'bsvc_output',
5186
+                    'name'        => 'bsvc_output',
5187
+                    'label'       => __( 'What should happen if rules met.', 'ayecode-connect' ),
5188
+                    'placeholder' => __( 'Default Output', 'ayecode-connect' ),
5189
+                    'class'       => 'bsvc_output form-select-sm no-select2 mw-100',
5190
+                    'options'     => sd_visibility_output_options(),
5191
+                    'default'     => '',
5192
+                    'value'       => '',
5193
+                    'label_type'  => 'top',
5194
+                    'select2'     => false,
5195
+                    'extra_attributes' => array(
5196
+                        'data-minimum-results-for-search' => '-1'
5197
+                    )
5198
+                )
5199
+            );
5200
+
5201
+            $content .= '</div><div class="col-md-6 col-sm-12">';
5202
+
5203
+            $content .= aui()->select(
5204
+                array(
5205
+                    'id'              => 'bsvc_page',
5206
+                    'name'            => 'bsvc_page',
5207
+                    'label'           => __( 'Page Content', 'ayecode-connect' ),
5208
+                    'placeholder'     => __( 'Select Page ID...', 'ayecode-connect' ),
5209
+                    'class'           => 'bsvc_page form-select-sm no-select2 mw-100',
5210
+                    'options'         => sd_template_page_options(),
5211
+                    'default'         => '',
5212
+                    'value'           => '',
5213
+                    'label_type'      => 'top',
5214
+                    'select2'         => false,
5215
+                    'element_require' => '[%bsvc_output%]=="page"'
5216
+                )
5217
+            );
5218
+
5219
+            $content .= aui()->select(
5220
+                array(
5221
+                    'id'          => 'bsvc_tmpl_part',
5222
+                    'name'        => 'bsvc_tmpl_part',
5223
+                    'label'       => __( 'Template Part', 'ayecode-connect' ),
5224
+                    'placeholder' => __( 'Select Template Part...', 'ayecode-connect' ),
5225
+                    'class'       => 'bsvc_tmpl_part form-select-sm no-select2 mw-100',
5226
+                    'options'     => sd_template_part_options(),
5227
+                    'default'     => '',
5228
+                    'value'       => '',
5229
+                    'label_type'  => 'top',
5230
+                    'select2'     => false,
5231
+                    'element_require'  => '[%bsvc_output%]=="template_part"',
5232
+                    'extra_attributes' => array(
5233
+                        'data-minimum-results-for-search' => '-1'
5234
+                    )
5235
+                )
5236
+            );
5237
+
5238
+            $content .= aui()->select(
5239
+                array(
5240
+                    'id'               => 'bsvc_message_type',
5241
+                    'name'             => 'bsvc_message_type',
5242
+                    'label'            => __( 'Custom Message Type', 'ayecode-connect' ),
5243
+                    'placeholder'      => __( 'Default (none)', 'ayecode-connect' ),
5244
+                    'class'            => 'bsvc_message_type form-select-sm no-select2 mw-100',
5245
+                    'options'          => sd_aui_colors(),
5246
+                    'default'          => '',
5247
+                    'value'            => '',
5248
+                    'label_type'       => 'top',
5249
+                    'select2'          => false,
5250
+                    'element_require'  => '[%bsvc_output%]=="message"',
5251
+                    'extra_attributes' => array(
5252
+                        'data-minimum-results-for-search' => '-1'
5253
+                    )
5254
+                )
5255
+            );
5256
+
5257
+            $content .= '</div><div class="col-sm-12">';
5258
+
5259
+            $content .= aui()->input(
5260
+                array(
5261
+                    'type'            => 'text',
5262
+                    'id'              => 'bsvc_message',
5263
+                    'name'            => 'bsvc_message',
5264
+                    'label'           => '',
5265
+                    'class'           => 'bsvc_message form-control-sm',
5266
+                    'placeholder'     => __( 'CUSTOM MESSAGE TO SHOW', 'ayecode-connect' ),
5267
+                    'label_type'      => '',
5268
+                    'value'           => '',
5269
+                    'form_group_class' => ' ',
5270
+                    'element_require' => '[%bsvc_output%]=="message"',
5271
+                )
5272
+            );
5273
+
5274
+            $content .= '</div></div></form><input type="hidden" id="bsvc_raw_value" name="bsvc_raw_value" value="' . $value . '">';
5275
+
5276
+            return $content;
5277
+        }
5278 5278
 
5279
-		/**
5280
-		 * Handle media_buttons hook.
5281
-		 *
5282
-		 * @since 1.2.7
5283
-		 */
5284
-		public function wp_media_buttons() {
5285
-			global $shortcode_insert_button_once;
5286
-
5287
-			// Fix conflicts with UpSolution Core in header template edit element.
5288
-			if ( defined( 'US_CORE_DIR' ) && ! empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'us_ajax_hb_get_ebuilder_html' ) {
5289
-				$shortcode_insert_button_once = true;
5290
-			}
5291
-		}
5292
-	}
5279
+        /**
5280
+         * Handle media_buttons hook.
5281
+         *
5282
+         * @since 1.2.7
5283
+         */
5284
+        public function wp_media_buttons() {
5285
+            global $shortcode_insert_button_once;
5286
+
5287
+            // Fix conflicts with UpSolution Core in header template edit element.
5288
+            if ( defined( 'US_CORE_DIR' ) && ! empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'us_ajax_hb_get_ebuilder_html' ) {
5289
+                $shortcode_insert_button_once = true;
5290
+            }
5291
+        }
5292
+    }
5293 5293
 }
Please login to merge, or discard this patch.