@@ -15,20 +15,20 @@ discard block |
||
15 | 15 | * @package GetPaid |
16 | 16 | */ |
17 | 17 | |
18 | -defined( 'ABSPATH' ) || exit; |
|
18 | +defined('ABSPATH') || exit; |
|
19 | 19 | |
20 | 20 | // Define constants. |
21 | -if ( ! defined( 'WPINV_PLUGIN_FILE' ) ) { |
|
22 | - define( 'WPINV_PLUGIN_FILE', __FILE__ ); |
|
21 | +if (!defined('WPINV_PLUGIN_FILE')) { |
|
22 | + define('WPINV_PLUGIN_FILE', __FILE__); |
|
23 | 23 | } |
24 | 24 | |
25 | -if ( ! defined( 'WPINV_VERSION' ) ) { |
|
26 | - define( 'WPINV_VERSION', '2.8.17' ); |
|
25 | +if (!defined('WPINV_VERSION')) { |
|
26 | + define('WPINV_VERSION', '2.8.17'); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | // Include the main Invoicing class. |
30 | -if ( ! class_exists( 'WPInv_Plugin', false ) ) { |
|
31 | - require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php'; |
|
30 | +if (!class_exists('WPInv_Plugin', false)) { |
|
31 | + require_once plugin_dir_path(WPINV_PLUGIN_FILE) . 'includes/class-wpinv.php'; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function getpaid() { |
41 | 41 | |
42 | - if ( empty( $GLOBALS['invoicing'] ) ) { |
|
42 | + if (empty($GLOBALS['invoicing'])) { |
|
43 | 43 | $GLOBALS['invoicing'] = new WPInv_Plugin(); |
44 | 44 | } |
45 | 45 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @since 2.0.8 |
53 | 53 | */ |
54 | 54 | function getpaid_deactivation_hook() { |
55 | - update_option( 'wpinv_flush_permalinks', 1 ); |
|
55 | + update_option('wpinv_flush_permalinks', 1); |
|
56 | 56 | } |
57 | -register_deactivation_hook( __FILE__, 'getpaid_deactivation_hook' ); |
|
57 | +register_deactivation_hook(__FILE__, 'getpaid_deactivation_hook'); |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * @deprecated |
@@ -64,4 +64,4 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | // Kickstart the plugin. |
67 | -add_action( 'plugins_loaded', 'getpaid', -100 ); |
|
67 | +add_action('plugins_loaded', 'getpaid', -100); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Setup menus in WP admin. |
4 | 4 | */ |
5 | 5 | |
6 | -defined( 'ABSPATH' ) || exit; |
|
6 | +defined('ABSPATH') || exit; |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * WC_Admin_Menus Class. |
@@ -13,14 +13,14 @@ discard block |
||
13 | 13 | * Hook in tabs. |
14 | 14 | */ |
15 | 15 | public function __construct() { |
16 | - add_action( 'admin_head', array( $this, 'set_admin_menu_class' ) ); |
|
17 | - add_action( 'admin_menu', array( $this, 'admin_menu' ), 10 ); |
|
18 | - add_action( 'admin_menu', array( $this, 'add_customers_menu' ), 18 ); |
|
19 | - add_action( 'admin_menu', array( $this, 'add_subscriptions_menu' ), 40 ); |
|
20 | - add_action( 'admin_menu', array( $this, 'add_addons_menu' ), 100 ); |
|
21 | - add_action( 'admin_menu', array( $this, 'add_settings_menu' ), 60 ); |
|
22 | - add_action( 'admin_menu', array( $this, 'remove_admin_submenus' ), 10 ); |
|
23 | - add_action( 'admin_head-nav-menus.php', array( $this, 'add_nav_menu_meta_boxes' ) ); |
|
16 | + add_action('admin_head', array($this, 'set_admin_menu_class')); |
|
17 | + add_action('admin_menu', array($this, 'admin_menu'), 10); |
|
18 | + add_action('admin_menu', array($this, 'add_customers_menu'), 18); |
|
19 | + add_action('admin_menu', array($this, 'add_subscriptions_menu'), 40); |
|
20 | + add_action('admin_menu', array($this, 'add_addons_menu'), 100); |
|
21 | + add_action('admin_menu', array($this, 'add_settings_menu'), 60); |
|
22 | + add_action('admin_menu', array($this, 'remove_admin_submenus'), 10); |
|
23 | + add_action('admin_head-nav-menus.php', array($this, 'add_nav_menu_meta_boxes')); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function set_admin_menu_class() { |
30 | 30 | global $current_screen, $parent_file, $submenu_file; |
31 | 31 | |
32 | - if ( ! empty( $current_screen->id ) && in_array( $current_screen->id, array( 'wpi_discount', 'wpi_payment_form', 'wpi_invoice' ) ) ) { |
|
32 | + if (!empty($current_screen->id) && in_array($current_screen->id, array('wpi_discount', 'wpi_payment_form', 'wpi_invoice'))) { |
|
33 | 33 | $parent_file = 'wpinv'; |
34 | 34 | $submenu_file = 'edit.php?post_type=' . $current_screen->id; |
35 | 35 | } |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | |
39 | 39 | public function admin_menu() { |
40 | 40 | |
41 | - $capability = apply_filters( 'invoicing_capability', wpinv_get_capability() ); |
|
41 | + $capability = apply_filters('invoicing_capability', wpinv_get_capability()); |
|
42 | 42 | add_menu_page( |
43 | - __( 'GetPaid', 'invoicing' ), |
|
44 | - __( 'GetPaid', 'invoicing' ), |
|
43 | + __('GetPaid', 'invoicing'), |
|
44 | + __('GetPaid', 'invoicing'), |
|
45 | 45 | $capability, |
46 | 46 | 'wpinv', |
47 | 47 | null, |
48 | - 'data:image/svg+xml;base64,' . base64_encode( file_get_contents( WPINV_PLUGIN_DIR . 'assets/images/GetPaid.svg' ) ), |
|
48 | + 'data:image/svg+xml;base64,' . base64_encode(file_get_contents(WPINV_PLUGIN_DIR . 'assets/images/GetPaid.svg')), |
|
49 | 49 | '54.123460' |
50 | 50 | ); |
51 | 51 | |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | public function add_customers_menu() { |
58 | 58 | add_submenu_page( |
59 | 59 | 'wpinv', |
60 | - __( 'Customers', 'invoicing' ), |
|
61 | - __( 'Customers', 'invoicing' ), |
|
60 | + __('Customers', 'invoicing'), |
|
61 | + __('Customers', 'invoicing'), |
|
62 | 62 | wpinv_get_capability(), |
63 | 63 | 'wpinv-customers', |
64 | - array( $this, 'customers_page' ) |
|
64 | + array($this, 'customers_page') |
|
65 | 65 | ); |
66 | 66 | } |
67 | 67 | |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | public function add_subscriptions_menu() { |
72 | 72 | add_submenu_page( |
73 | 73 | 'wpinv', |
74 | - __( 'Subscriptions', 'invoicing' ), |
|
75 | - __( 'Subscriptions', 'invoicing' ), |
|
74 | + __('Subscriptions', 'invoicing'), |
|
75 | + __('Subscriptions', 'invoicing'), |
|
76 | 76 | wpinv_get_capability(), |
77 | 77 | 'wpinv-subscriptions', |
78 | 78 | 'wpinv_subscriptions_page' |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | width: 120px; |
95 | 95 | } |
96 | 96 | </style> |
97 | - <h1><?php echo esc_html( __( 'Customers', 'invoicing' ) ); ?> <a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'getpaid-admin-action', 'download_customers' ), 'getpaid-nonce', 'getpaid-nonce' ) ); ?>" class="page-title-action"><?php esc_html_e( 'Export', 'invoicing' ); ?></a></h1> |
|
98 | - <form method="get" style="overflow: auto; width: 100%" action=<?php echo esc_url( add_query_arg( array() ) ); ?>> |
|
97 | + <h1><?php echo esc_html(__('Customers', 'invoicing')); ?> <a href="<?php echo esc_url(wp_nonce_url(add_query_arg('getpaid-admin-action', 'download_customers'), 'getpaid-nonce', 'getpaid-nonce')); ?>" class="page-title-action"><?php esc_html_e('Export', 'invoicing'); ?></a></h1> |
|
98 | + <form method="get" style="overflow: auto; width: 100%" action=<?php echo esc_url(add_query_arg(array())); ?>> |
|
99 | 99 | <input type="hidden" name="page" value="wpinv-customers" /> |
100 | 100 | <?php |
101 | 101 | $table = new WPInv_Customers_Table(); |
102 | 102 | $table->prepare_items(); |
103 | - $table->search_box( __( 'Search Customers', 'invoicing' ), 'search-customers' ); |
|
103 | + $table->search_box(__('Search Customers', 'invoicing'), 'search-customers'); |
|
104 | 104 | $table->display(); |
105 | 105 | ?> |
106 | 106 | </form> |
@@ -114,26 +114,26 @@ discard block |
||
114 | 114 | public function add_settings_menu() { |
115 | 115 | add_submenu_page( |
116 | 116 | 'wpinv', |
117 | - __( 'Invoice Settings', 'invoicing' ), |
|
118 | - __( 'Settings', 'invoicing' ), |
|
119 | - apply_filters( 'invoicing_capability', wpinv_get_capability() ), |
|
117 | + __('Invoice Settings', 'invoicing'), |
|
118 | + __('Settings', 'invoicing'), |
|
119 | + apply_filters('invoicing_capability', wpinv_get_capability()), |
|
120 | 120 | 'wpinv-settings', |
121 | - array( $this, 'options_page' ) |
|
121 | + array($this, 'options_page') |
|
122 | 122 | ); |
123 | 123 | } |
124 | 124 | |
125 | 125 | public function add_addons_menu() { |
126 | - if ( ! apply_filters( 'wpi_show_addons_page', true ) ) { |
|
126 | + if (!apply_filters('wpi_show_addons_page', true)) { |
|
127 | 127 | return; |
128 | 128 | } |
129 | 129 | |
130 | 130 | add_submenu_page( |
131 | 131 | 'wpinv', |
132 | - __( 'Invoicing extensions', 'invoicing' ), |
|
133 | - __( 'Extensions', 'invoicing' ), |
|
132 | + __('Invoicing extensions', 'invoicing'), |
|
133 | + __('Extensions', 'invoicing'), |
|
134 | 134 | 'manage_options', |
135 | 135 | 'wpi-addons', |
136 | - array( $this, 'addons_page' ) |
|
136 | + array($this, 'addons_page') |
|
137 | 137 | ); |
138 | 138 | } |
139 | 139 | |
@@ -144,29 +144,29 @@ discard block |
||
144 | 144 | |
145 | 145 | function options_page() { |
146 | 146 | |
147 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
147 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
148 | 148 | return; |
149 | 149 | } |
150 | 150 | |
151 | 151 | $settings_tabs = wpinv_get_settings_tabs(); |
152 | - $settings_tabs = empty( $settings_tabs ) ? array() : $settings_tabs; |
|
153 | - $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $settings_tabs ) ? sanitize_text_field( $_GET['tab'] ) : 'general'; |
|
154 | - $sections = wpinv_get_settings_tab_sections( $active_tab ); |
|
152 | + $settings_tabs = empty($settings_tabs) ? array() : $settings_tabs; |
|
153 | + $active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $settings_tabs) ? sanitize_text_field($_GET['tab']) : 'general'; |
|
154 | + $sections = wpinv_get_settings_tab_sections($active_tab); |
|
155 | 155 | $key = 'main'; |
156 | 156 | |
157 | - if ( is_array( $sections ) ) { |
|
158 | - $key = key( $sections ); |
|
157 | + if (is_array($sections)) { |
|
158 | + $key = key($sections); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | add_thickbox(); |
162 | 162 | |
163 | - $registered_sections = wpinv_get_settings_tab_sections( $active_tab ); |
|
164 | - $section = isset( $_GET['section'] ) && ! empty( $registered_sections ) && array_key_exists( $_GET['section'], $registered_sections ) ? sanitize_text_field( $_GET['section'] ) : $key; |
|
163 | + $registered_sections = wpinv_get_settings_tab_sections($active_tab); |
|
164 | + $section = isset($_GET['section']) && !empty($registered_sections) && array_key_exists($_GET['section'], $registered_sections) ? sanitize_text_field($_GET['section']) : $key; |
|
165 | 165 | ?> |
166 | 166 | <div class="wrap"> |
167 | 167 | <h1 class="nav-tab-wrapper"> |
168 | 168 | <?php |
169 | - foreach ( wpinv_get_settings_tabs() as $tab_id => $tab_name ) { |
|
169 | + foreach (wpinv_get_settings_tabs() as $tab_id => $tab_name) { |
|
170 | 170 | $tab_url = add_query_arg( |
171 | 171 | array( |
172 | 172 | 'settings-updated' => false, |
@@ -176,23 +176,23 @@ discard block |
||
176 | 176 | ); |
177 | 177 | |
178 | 178 | // Remove the section from the tabs so we always end up at the main section |
179 | - $tab_url = remove_query_arg( 'section', $tab_url ); |
|
180 | - $tab_url = remove_query_arg( 'wpi_sub', $tab_url ); |
|
179 | + $tab_url = remove_query_arg('section', $tab_url); |
|
180 | + $tab_url = remove_query_arg('wpi_sub', $tab_url); |
|
181 | 181 | |
182 | 182 | $active = $active_tab == $tab_id ? ' nav-tab-active' : ''; |
183 | 183 | |
184 | - echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab ' . esc_attr( $active ) . '">'; |
|
185 | - echo esc_html( $tab_name ); |
|
184 | + echo '<a href="' . esc_url($tab_url) . '" title="' . esc_attr($tab_name) . '" class="nav-tab ' . esc_attr($active) . '">'; |
|
185 | + echo esc_html($tab_name); |
|
186 | 186 | echo '</a>'; |
187 | 187 | } |
188 | 188 | ?> |
189 | 189 | </h1> |
190 | 190 | <?php |
191 | - $number_of_sections = count( $sections ); |
|
191 | + $number_of_sections = count($sections); |
|
192 | 192 | $number = 0; |
193 | - if ( $number_of_sections > 1 ) { |
|
193 | + if ($number_of_sections > 1) { |
|
194 | 194 | echo '<div><ul class="subsubsub">'; |
195 | - foreach ( $sections as $section_id => $section_name ) { |
|
195 | + foreach ($sections as $section_id => $section_name) { |
|
196 | 196 | echo '<li>'; |
197 | 197 | $number++; |
198 | 198 | $tab_url = add_query_arg( |
@@ -201,16 +201,16 @@ discard block |
||
201 | 201 | 'tab' => $active_tab, |
202 | 202 | 'section' => $section_id, |
203 | 203 | ), |
204 | - admin_url( 'admin.php?page=wpinv-settings' ) |
|
204 | + admin_url('admin.php?page=wpinv-settings') |
|
205 | 205 | ); |
206 | - $tab_url = remove_query_arg( 'wpi_sub', $tab_url ); |
|
206 | + $tab_url = remove_query_arg('wpi_sub', $tab_url); |
|
207 | 207 | $class = ''; |
208 | - if ( $section == $section_id ) { |
|
208 | + if ($section == $section_id) { |
|
209 | 209 | $class = 'current'; |
210 | 210 | } |
211 | - echo '<a class="' . esc_attr( $class ) . '" href="' . esc_url( $tab_url ) . '">' . esc_html( $section_name ) . '</a>'; |
|
211 | + echo '<a class="' . esc_attr($class) . '" href="' . esc_url($tab_url) . '">' . esc_html($section_name) . '</a>'; |
|
212 | 212 | |
213 | - if ( $number != $number_of_sections ) { |
|
213 | + if ($number != $number_of_sections) { |
|
214 | 214 | echo ' | '; |
215 | 215 | } |
216 | 216 | echo '</li>'; |
@@ -222,20 +222,20 @@ discard block |
||
222 | 222 | <form method="post" action="options.php"> |
223 | 223 | <table class="form-tablex"> |
224 | 224 | <?php |
225 | - settings_fields( 'wpinv_settings' ); |
|
225 | + settings_fields('wpinv_settings'); |
|
226 | 226 | |
227 | - if ( 'main' === $section ) { |
|
228 | - do_action( 'wpinv_settings_tab_top', $active_tab ); |
|
227 | + if ('main' === $section) { |
|
228 | + do_action('wpinv_settings_tab_top', $active_tab); |
|
229 | 229 | } |
230 | 230 | |
231 | - do_action( 'wpinv_settings_tab_top_' . $active_tab . '_' . $section, $active_tab, $section ); |
|
232 | - do_settings_sections( 'wpinv_settings_' . $active_tab . '_' . $section, $active_tab, $section ); |
|
233 | - do_action( 'wpinv_settings_tab_bottom_' . $active_tab . '_' . $section, $active_tab, $section ); |
|
234 | - do_action( 'getpaid_settings_tab_bottom', $active_tab, $section ); |
|
231 | + do_action('wpinv_settings_tab_top_' . $active_tab . '_' . $section, $active_tab, $section); |
|
232 | + do_settings_sections('wpinv_settings_' . $active_tab . '_' . $section, $active_tab, $section); |
|
233 | + do_action('wpinv_settings_tab_bottom_' . $active_tab . '_' . $section, $active_tab, $section); |
|
234 | + do_action('getpaid_settings_tab_bottom', $active_tab, $section); |
|
235 | 235 | |
236 | 236 | // For backwards compatibility |
237 | - if ( 'main' === $section ) { |
|
238 | - do_action( 'wpinv_settings_tab_bottom', $active_tab ); |
|
237 | + if ('main' === $section) { |
|
238 | + do_action('wpinv_settings_tab_bottom', $active_tab); |
|
239 | 239 | } |
240 | 240 | ?> |
241 | 241 | </table> |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | } |
248 | 248 | |
249 | 249 | public function remove_admin_submenus() { |
250 | - remove_submenu_page( 'edit.php?post_type=wpi_invoice', 'post-new.php?post_type=wpi_invoice' ); |
|
250 | + remove_submenu_page('edit.php?post_type=wpi_invoice', 'post-new.php?post_type=wpi_invoice'); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | |
258 | 258 | add_meta_box( |
259 | 259 | 'wpinv_endpoints_nav_link', |
260 | - __( 'GetPaid endpoints', 'invoicing' ), |
|
261 | - array( $this, 'nav_menu_links' ), |
|
260 | + __('GetPaid endpoints', 'invoicing'), |
|
261 | + array($this, 'nav_menu_links'), |
|
262 | 262 | 'nav-menus', |
263 | 263 | 'side', |
264 | 264 | 'low' |
@@ -273,12 +273,12 @@ discard block |
||
273 | 273 | $endpoints = $this->get_menu_items(); |
274 | 274 | ?> |
275 | 275 | <div id="invoicing-endpoints" class="posttypediv"> |
276 | - <?php if ( ! empty( $endpoints['pages'] ) ) : ?> |
|
276 | + <?php if (!empty($endpoints['pages'])) : ?> |
|
277 | 277 | <div id="tabs-panel-invoicing-endpoints" class="tabs-panel tabs-panel-active"> |
278 | 278 | <ul id="invoicing-endpoints-checklist" class="categorychecklist form-no-clear"> |
279 | 279 | <?php |
280 | - $walker = new Walker_Nav_Menu_Checklist( array() ); |
|
281 | - echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $endpoints['pages'] ), 0, (object) array( 'walker' => $walker ) ); |
|
280 | + $walker = new Walker_Nav_Menu_Checklist(array()); |
|
281 | + echo walk_nav_menu_tree(array_map('wp_setup_nav_menu_item', $endpoints['pages']), 0, (object) array('walker' => $walker)); |
|
282 | 282 | ?> |
283 | 283 | </ul> |
284 | 284 | </div> |
@@ -287,11 +287,11 @@ discard block |
||
287 | 287 | <p class="button-controls wp-clearfix" data-items-type="invoicing-endpoints"> |
288 | 288 | <span class="list-controls hide-if-no-js"> |
289 | 289 | <input type="checkbox" id="invoicing-endpoints-tab" class="select-all"> |
290 | - <label for="invoicing-endpoints-tab"><?php esc_html_e( 'Select all', 'invoicing' ); ?></label> |
|
290 | + <label for="invoicing-endpoints-tab"><?php esc_html_e('Select all', 'invoicing'); ?></label> |
|
291 | 291 | </span> |
292 | 292 | |
293 | 293 | <span class="add-to-menu"> |
294 | - <input type="submit" class="button submit-add-to-menu right" value="<?php esc_attr_e( 'Add to menu', 'invoicing' ); ?>" name="add-invoicing-endpoints-item" id="submit-invoicing-endpoints"> |
|
294 | + <input type="submit" class="button submit-add-to-menu right" value="<?php esc_attr_e('Add to menu', 'invoicing'); ?>" name="add-invoicing-endpoints-item" id="submit-invoicing-endpoints"> |
|
295 | 295 | <span class="spinner"></span> |
296 | 296 | </span> |
297 | 297 | </p> |
@@ -309,18 +309,18 @@ discard block |
||
309 | 309 | |
310 | 310 | $pages = array( |
311 | 311 | array( |
312 | - 'id' => wpinv_get_option( 'invoice_history_page' ), |
|
313 | - 'label' => __( 'My Invoices', 'invoicing' ), |
|
312 | + 'id' => wpinv_get_option('invoice_history_page'), |
|
313 | + 'label' => __('My Invoices', 'invoicing'), |
|
314 | 314 | ), |
315 | 315 | array( |
316 | - 'id' => wpinv_get_option( 'invoice_subscription_page' ), |
|
317 | - 'label' => __( 'My Subscriptions', 'invoicing' ), |
|
316 | + 'id' => wpinv_get_option('invoice_subscription_page'), |
|
317 | + 'label' => __('My Subscriptions', 'invoicing'), |
|
318 | 318 | ), |
319 | 319 | ); |
320 | 320 | |
321 | - foreach ( apply_filters( 'getpaid_menu_pages', $pages ) as $page ) { |
|
321 | + foreach (apply_filters('getpaid_menu_pages', $pages) as $page) { |
|
322 | 322 | |
323 | - if ( (int) $page['id'] > 0 ) { |
|
323 | + if ((int) $page['id'] > 0) { |
|
324 | 324 | |
325 | 325 | $item = new stdClass(); |
326 | 326 | $item->object_id = (int) $page['id']; |
@@ -328,11 +328,11 @@ discard block |
||
328 | 328 | $item->object = 'page'; |
329 | 329 | $item->menu_item_parent = 0; |
330 | 330 | $item->type = 'post_type'; |
331 | - $item->title = esc_html( $page['label'] ); |
|
332 | - $item->url = get_permalink( (int) $page['id'] ); |
|
331 | + $item->title = esc_html($page['label']); |
|
332 | + $item->url = get_permalink((int) $page['id']); |
|
333 | 333 | $item->target = ''; |
334 | 334 | $item->attr_title = ''; |
335 | - $item->classes = array( 'wpinv-menu-item' ); |
|
335 | + $item->classes = array('wpinv-menu-item'); |
|
336 | 336 | $item->xfn = ''; |
337 | 337 | |
338 | 338 | $items['pages'][] = $item; |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | } |
341 | 341 | } |
342 | 342 | |
343 | - return apply_filters( 'wpinv_menu_items', $items ); |
|
343 | + return apply_filters('wpinv_menu_items', $items); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * |
6 | 6 | */ |
7 | 7 | |
8 | -defined( 'ABSPATH' ) || exit; |
|
8 | +defined('ABSPATH') || exit; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * GetPaid_Reports Class. |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | * |
18 | 18 | */ |
19 | 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' ) ); |
|
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 | 25 | |
26 | 26 | } |
27 | 27 | |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | |
34 | 34 | add_submenu_page( |
35 | 35 | 'wpinv', |
36 | - __( 'Reports', 'invoicing' ), |
|
37 | - __( 'Reports', 'invoicing' ), |
|
36 | + __('Reports', 'invoicing'), |
|
37 | + __('Reports', 'invoicing'), |
|
38 | 38 | wpinv_get_capability(), |
39 | 39 | 'wpinv-reports', |
40 | - array( $this, 'display_reports_page' ) |
|
40 | + array($this, 'display_reports_page') |
|
41 | 41 | ); |
42 | 42 | |
43 | 43 | } |
@@ -50,46 +50,46 @@ discard block |
||
50 | 50 | |
51 | 51 | // Prepare variables. |
52 | 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'; |
|
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 | 56 | // Display the current tab. |
57 | 57 | ?> |
58 | 58 | |
59 | 59 | <div class="wrap"> |
60 | 60 | |
61 | - <h1><?php echo esc_html( $tabs[ $current_tab ] ); ?></h1> |
|
61 | + <h1><?php echo esc_html($tabs[$current_tab]); ?></h1> |
|
62 | 62 | |
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 ); |
|
68 | + $key = sanitize_key($key); |
|
69 | + $label = esc_html($label); |
|
70 | 70 | $class = $key == $current_tab ? 'nav-tab nav-tab-active' : 'nav-tab '; |
71 | 71 | $url = esc_url( |
72 | - add_query_arg( 'tab', $key, admin_url( 'admin.php?page=wpinv-reports' ) ) |
|
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 | 77 | } |
78 | 78 | ?> |
79 | 79 | |
80 | 80 | </nav> |
81 | 81 | |
82 | - <div class="bsui <?php echo esc_attr( $current_tab ); ?>"> |
|
83 | - <?php do_action( "wpinv_reports_tab_{$current_tab}" ); ?> |
|
82 | + <div class="bsui <?php echo esc_attr($current_tab); ?>"> |
|
83 | + <?php do_action("wpinv_reports_tab_{$current_tab}"); ?> |
|
84 | 84 | </div> |
85 | 85 | |
86 | 86 | </div> |
87 | 87 | <?php |
88 | 88 | |
89 | 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 ); |
|
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 | |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | public function get_tabs() { |
102 | 102 | |
103 | 103 | $tabs = array( |
104 | - 'reports' => __( 'Reports', 'invoicing' ), |
|
105 | - 'export' => __( 'Export', 'invoicing' ), |
|
104 | + 'reports' => __('Reports', 'invoicing'), |
|
105 | + 'export' => __('Export', 'invoicing'), |
|
106 | 106 | ); |
107 | 107 | |
108 | - return apply_filters( 'getpaid_report_tabs', $tabs ); |
|
108 | + return apply_filters('getpaid_report_tabs', $tabs); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @param array $args |
137 | 137 | */ |
138 | - public function download_graph( $args ) { |
|
138 | + public function download_graph($args) { |
|
139 | 139 | |
140 | - if ( ! empty( $args['graph'] ) ) { |
|
140 | + if (!empty($args['graph'])) { |
|
141 | 141 | $downloader = new GetPaid_Graph_Downloader(); |
142 | - $downloader->download( $args['graph'] ); |
|
142 | + $downloader->download($args['graph']); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | } |
@@ -149,17 +149,17 @@ discard block |
||
149 | 149 | * |
150 | 150 | * @param array $args |
151 | 151 | */ |
152 | - public function export_invoices( $args ) { |
|
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'] ) { |
|
156 | + if ('subscriptions' === $args['post_type']) { |
|
157 | 157 | $downloader = new GetPaid_Subscription_Exporter(); |
158 | 158 | } else { |
159 | 159 | $downloader = new GetPaid_Invoice_Exporter(); |
160 | 160 | } |
161 | 161 | |
162 | - $downloader->export( $args['post_type'], $args ); |
|
162 | + $downloader->export($args['post_type'], $args); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | } |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | /** |
13 | 13 | * Bail if we are not in WP. |
14 | 14 | */ |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if (!defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Only add if the class does not already exist. |
21 | 21 | */ |
22 | -if ( ! class_exists( 'AyeCode_UI_Settings' ) ) { |
|
22 | +if (!class_exists('AyeCode_UI_Settings')) { |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * A Class to be able to change settings for Font Awesome. |
@@ -99,27 +99,27 @@ discard block |
||
99 | 99 | * @return AyeCode_UI_Settings - Main instance. |
100 | 100 | */ |
101 | 101 | public static function instance() { |
102 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) { |
|
102 | + if (!isset(self::$instance) && !(self::$instance instanceof AyeCode_UI_Settings)) { |
|
103 | 103 | |
104 | 104 | self::$instance = new AyeCode_UI_Settings; |
105 | 105 | |
106 | - add_action( 'init', array( self::$instance, 'init' ) ); // set settings |
|
106 | + add_action('init', array(self::$instance, 'init')); // set settings |
|
107 | 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' ) ); |
|
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 | 111 | |
112 | 112 | // Maybe show example page |
113 | - add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) ); |
|
113 | + add_action('template_redirect', array(self::$instance, 'maybe_show_examples')); |
|
114 | 114 | |
115 | - if ( defined( 'BLOCKSTRAP_VERSION' ) ) { |
|
116 | - add_filter( 'sd_aui_colors', array( self::$instance,'sd_aui_colors' ), 10, 3 ); |
|
115 | + if (defined('BLOCKSTRAP_VERSION')) { |
|
116 | + add_filter('sd_aui_colors', array(self::$instance, 'sd_aui_colors'), 10, 3); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | - add_action( 'customize_register', array( self::$instance, 'customizer_settings' )); |
|
120 | + add_action('customize_register', array(self::$instance, 'customizer_settings')); |
|
121 | 121 | |
122 | - do_action( 'ayecode_ui_settings_loaded' ); |
|
122 | + do_action('ayecode_ui_settings_loaded'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | return self::$instance; |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | * |
135 | 135 | * @return mixed |
136 | 136 | */ |
137 | - public function sd_aui_colors( $theme_colors, $include_outlines, $include_branding ){ |
|
137 | + public function sd_aui_colors($theme_colors, $include_outlines, $include_branding) { |
|
138 | 138 | |
139 | 139 | |
140 | 140 | $setting = wp_get_global_settings(); |
141 | 141 | |
142 | - if(!empty($setting['color']['palette']['custom'])){ |
|
143 | - foreach($setting['color']['palette']['custom'] as $color){ |
|
142 | + if (!empty($setting['color']['palette']['custom'])) { |
|
143 | + foreach ($setting['color']['palette']['custom'] as $color) { |
|
144 | 144 | $theme_colors[$color['slug']] = esc_attr($color['name']); |
145 | 145 | } |
146 | 146 | } |
@@ -151,81 +151,81 @@ discard block |
||
151 | 151 | /** |
152 | 152 | * Setup some constants. |
153 | 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' ); |
|
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 | 171 | |
172 | - if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) { |
|
173 | - define( 'AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL ); |
|
172 | + if (!defined('AUI_PRIMARY_COLOR')) { |
|
173 | + define('AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL); |
|
174 | 174 | } |
175 | - if ( ! defined( 'AUI_SECONDARY_COLOR' ) ) { |
|
176 | - define( 'AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL ); |
|
175 | + if (!defined('AUI_SECONDARY_COLOR')) { |
|
176 | + define('AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL); |
|
177 | 177 | } |
178 | - if ( ! defined( 'AUI_INFO_COLOR' ) ) { |
|
179 | - define( 'AUI_INFO_COLOR', AUI_INFO_COLOR_ORIGINAL ); |
|
178 | + if (!defined('AUI_INFO_COLOR')) { |
|
179 | + define('AUI_INFO_COLOR', AUI_INFO_COLOR_ORIGINAL); |
|
180 | 180 | } |
181 | - if ( ! defined( 'AUI_WARNING_COLOR' ) ) { |
|
182 | - define( 'AUI_WARNING_COLOR', AUI_WARNING_COLOR_ORIGINAL ); |
|
181 | + if (!defined('AUI_WARNING_COLOR')) { |
|
182 | + define('AUI_WARNING_COLOR', AUI_WARNING_COLOR_ORIGINAL); |
|
183 | 183 | } |
184 | - if ( ! defined( 'AUI_DANGER_COLOR' ) ) { |
|
185 | - define( 'AUI_DANGER_COLOR', AUI_DANGER_COLOR_ORIGINAL ); |
|
184 | + if (!defined('AUI_DANGER_COLOR')) { |
|
185 | + define('AUI_DANGER_COLOR', AUI_DANGER_COLOR_ORIGINAL); |
|
186 | 186 | } |
187 | - if ( ! defined( 'AUI_SUCCESS_COLOR' ) ) { |
|
188 | - define( 'AUI_SUCCESS_COLOR', AUI_SUCCESS_COLOR_ORIGINAL ); |
|
187 | + if (!defined('AUI_SUCCESS_COLOR')) { |
|
188 | + define('AUI_SUCCESS_COLOR', AUI_SUCCESS_COLOR_ORIGINAL); |
|
189 | 189 | } |
190 | - if ( ! defined( 'AUI_LIGHT_COLOR' ) ) { |
|
191 | - define( 'AUI_LIGHT_COLOR', AUI_LIGHT_COLOR_ORIGINAL ); |
|
190 | + if (!defined('AUI_LIGHT_COLOR')) { |
|
191 | + define('AUI_LIGHT_COLOR', AUI_LIGHT_COLOR_ORIGINAL); |
|
192 | 192 | } |
193 | - if ( ! defined( 'AUI_DARK_COLOR' ) ) { |
|
194 | - define( 'AUI_DARK_COLOR', AUI_DARK_COLOR_ORIGINAL ); |
|
193 | + if (!defined('AUI_DARK_COLOR')) { |
|
194 | + define('AUI_DARK_COLOR', AUI_DARK_COLOR_ORIGINAL); |
|
195 | 195 | } |
196 | - if ( ! defined( 'AUI_WHITE_COLOR' ) ) { |
|
197 | - define( 'AUI_WHITE_COLOR', AUI_WHITE_COLOR_ORIGINAL ); |
|
196 | + if (!defined('AUI_WHITE_COLOR')) { |
|
197 | + define('AUI_WHITE_COLOR', AUI_WHITE_COLOR_ORIGINAL); |
|
198 | 198 | } |
199 | - if ( ! defined( 'AUI_PURPLE_COLOR' ) ) { |
|
200 | - define( 'AUI_PURPLE_COLOR', AUI_PURPLE_COLOR_ORIGINAL ); |
|
199 | + if (!defined('AUI_PURPLE_COLOR')) { |
|
200 | + define('AUI_PURPLE_COLOR', AUI_PURPLE_COLOR_ORIGINAL); |
|
201 | 201 | } |
202 | - if ( ! defined( 'AUI_SALMON_COLOR' ) ) { |
|
203 | - define( 'AUI_SALMON_COLOR', AUI_SALMON_COLOR_ORIGINAL ); |
|
202 | + if (!defined('AUI_SALMON_COLOR')) { |
|
203 | + define('AUI_SALMON_COLOR', AUI_SALMON_COLOR_ORIGINAL); |
|
204 | 204 | } |
205 | - if ( ! defined( 'AUI_CYAN_COLOR' ) ) { |
|
206 | - define( 'AUI_CYAN_COLOR', AUI_CYAN_COLOR_ORIGINAL ); |
|
205 | + if (!defined('AUI_CYAN_COLOR')) { |
|
206 | + define('AUI_CYAN_COLOR', AUI_CYAN_COLOR_ORIGINAL); |
|
207 | 207 | } |
208 | - if ( ! defined( 'AUI_GRAY_COLOR' ) ) { |
|
209 | - define( 'AUI_GRAY_COLOR', AUI_GRAY_COLOR_ORIGINAL ); |
|
208 | + if (!defined('AUI_GRAY_COLOR')) { |
|
209 | + define('AUI_GRAY_COLOR', AUI_GRAY_COLOR_ORIGINAL); |
|
210 | 210 | } |
211 | - if ( ! defined( 'AUI_INDIGO_COLOR' ) ) { |
|
212 | - define( 'AUI_INDIGO_COLOR', AUI_INDIGO_COLOR_ORIGINAL ); |
|
211 | + if (!defined('AUI_INDIGO_COLOR')) { |
|
212 | + define('AUI_INDIGO_COLOR', AUI_INDIGO_COLOR_ORIGINAL); |
|
213 | 213 | } |
214 | - if ( ! defined( 'AUI_ORANGE_COLOR' ) ) { |
|
215 | - define( 'AUI_ORANGE_COLOR', AUI_ORANGE_COLOR_ORIGINAL ); |
|
214 | + if (!defined('AUI_ORANGE_COLOR')) { |
|
215 | + define('AUI_ORANGE_COLOR', AUI_ORANGE_COLOR_ORIGINAL); |
|
216 | 216 | } |
217 | - if ( ! defined( 'AUI_BLACK_COLOR' ) ) { |
|
218 | - define( 'AUI_BLACK_COLOR', AUI_BLACK_COLOR_ORIGINAL ); |
|
217 | + if (!defined('AUI_BLACK_COLOR')) { |
|
218 | + define('AUI_BLACK_COLOR', AUI_BLACK_COLOR_ORIGINAL); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | } |
222 | 222 | |
223 | - public static function get_colors( $original = false){ |
|
223 | + public static function get_colors($original = false) { |
|
224 | 224 | |
225 | - if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) { |
|
225 | + if (!defined('AUI_PRIMARY_COLOR')) { |
|
226 | 226 | return array(); |
227 | 227 | } |
228 | - if ( $original ) { |
|
228 | + if ($original) { |
|
229 | 229 | return array( |
230 | 230 | 'primary' => AUI_PRIMARY_COLOR_ORIGINAL, |
231 | 231 | 'secondary' => AUI_SECONDARY_COLOR_ORIGINAL, |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @return mixed |
275 | 275 | */ |
276 | - public function add_bs5_admin_body_class( $classes = '' ) { |
|
276 | + public function add_bs5_admin_body_class($classes = '') { |
|
277 | 277 | $classes .= ' aui_bs5'; |
278 | 278 | |
279 | 279 | return $classes; |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * |
287 | 287 | * @return mixed |
288 | 288 | */ |
289 | - public function add_bs5_body_class( $classes ) { |
|
289 | + public function add_bs5_body_class($classes) { |
|
290 | 290 | $classes[] = 'aui_bs5'; |
291 | 291 | |
292 | 292 | return $classes; |
@@ -299,12 +299,12 @@ discard block |
||
299 | 299 | global $aui_bs5; |
300 | 300 | |
301 | 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 ) ) { |
|
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 | 305 | $db_settings['css_backend'] = 'compatibility'; |
306 | 306 | $db_settings['js_backend'] = 'core-popper'; |
307 | - update_option( 'ayecode-ui-settings', $db_settings ); |
|
307 | + update_option('ayecode-ui-settings', $db_settings); |
|
308 | 308 | wp_safe_redirect(admin_url("options-general.php?page=ayecode-ui-settings&updated=true")); |
309 | 309 | } |
310 | 310 | } |
@@ -316,10 +316,10 @@ discard block |
||
316 | 316 | // define the version |
317 | 317 | $aui_bs5 = $this->settings['bs_ver'] === '5'; |
318 | 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' ) ); |
|
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 | 323 | } |
324 | 324 | |
325 | 325 | /** |
@@ -327,32 +327,32 @@ discard block |
||
327 | 327 | * |
328 | 328 | * We load super early in case there is a theme version that might change the colors |
329 | 329 | */ |
330 | - if ( $this->settings['css'] ) { |
|
330 | + if ($this->settings['css']) { |
|
331 | 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 ); |
|
333 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), $priority); |
|
334 | 334 | } |
335 | - if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) { |
|
336 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 ); |
|
335 | + if ($this->settings['css_backend'] && $this->load_admin_scripts()) { |
|
336 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 1); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | // maybe load JS |
340 | - if ( $this->settings['js'] ) { |
|
340 | + if ($this->settings['js']) { |
|
341 | 341 | $priority = $this->is_bs3_compat() ? 100 : 1; |
342 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority ); |
|
342 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), $priority); |
|
343 | 343 | } |
344 | - if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) { |
|
345 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 ); |
|
344 | + if ($this->settings['js_backend'] && $this->load_admin_scripts()) { |
|
345 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 1); |
|
346 | 346 | } |
347 | 347 | |
348 | 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 ); |
|
349 | + if ($this->settings['html_font_size']) { |
|
350 | + add_action('wp_footer', array($this, 'html_font_size'), 10); |
|
351 | 351 | } |
352 | 352 | |
353 | 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' ) ); |
|
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 | 356 | } |
357 | 357 | |
358 | 358 | } |
@@ -360,11 +360,11 @@ discard block |
||
360 | 360 | /** |
361 | 361 | * Show admin notice if backend scripts not loaded. |
362 | 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>'; |
|
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 | 368 | } |
369 | 369 | |
370 | 370 | /** |
@@ -372,14 +372,14 @@ discard block |
||
372 | 372 | * |
373 | 373 | * @return bool |
374 | 374 | */ |
375 | - public function load_admin_scripts(){ |
|
375 | + public function load_admin_scripts() { |
|
376 | 376 | $result = true; |
377 | 377 | |
378 | 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 ){ |
|
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 | 383 | return false; // return early, no point checking further |
384 | 384 | } |
385 | 385 | } |
@@ -391,9 +391,9 @@ discard block |
||
391 | 391 | /** |
392 | 392 | * Add a html font size to the footer. |
393 | 393 | */ |
394 | - public function html_font_size(){ |
|
394 | + public function html_font_size() { |
|
395 | 395 | $this->settings = $this->get_settings(); |
396 | - echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>"; |
|
396 | + echo "<style>html{font-size:" . absint($this->settings['html_font_size']) . "px;}</style>"; |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | /** |
@@ -401,11 +401,11 @@ discard block |
||
401 | 401 | * |
402 | 402 | * @return bool |
403 | 403 | */ |
404 | - public function is_aui_screen(){ |
|
404 | + public function is_aui_screen() { |
|
405 | 405 | // echo '###';exit; |
406 | 406 | $load = false; |
407 | 407 | // check if we should load or not |
408 | - if ( is_admin() ) { |
|
408 | + if (is_admin()) { |
|
409 | 409 | // Only enable on set pages |
410 | 410 | $aui_screens = array( |
411 | 411 | 'page', |
@@ -417,26 +417,26 @@ discard block |
||
417 | 417 | 'ayecode-ui-settings', |
418 | 418 | 'site-editor' |
419 | 419 | ); |
420 | - $screen_ids = apply_filters( 'aui_screen_ids', $aui_screens ); |
|
420 | + $screen_ids = apply_filters('aui_screen_ids', $aui_screens); |
|
421 | 421 | |
422 | 422 | $screen = get_current_screen(); |
423 | 423 | |
424 | 424 | // echo '###'.$screen->id; |
425 | 425 | |
426 | 426 | // check if we are on a AUI screen |
427 | - if ( $screen && in_array( $screen->id, $screen_ids ) ) { |
|
427 | + if ($screen && in_array($screen->id, $screen_ids)) { |
|
428 | 428 | $load = true; |
429 | 429 | } |
430 | 430 | |
431 | 431 | //load for widget previews in WP 5.8 |
432 | - if( !empty($_REQUEST['legacy-widget-preview'])){ |
|
432 | + if (!empty($_REQUEST['legacy-widget-preview'])) { |
|
433 | 433 | $load = true; |
434 | 434 | } |
435 | 435 | } |
436 | 436 | |
437 | 437 | |
438 | 438 | |
439 | - return apply_filters( 'aui_load_on_admin' , $load ); |
|
439 | + return apply_filters('aui_load_on_admin', $load); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | /** |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | * @return bool |
446 | 446 | */ |
447 | 447 | public static function is_block_theme() { |
448 | - if ( function_exists( 'wp_is_block_theme' && wp_is_block_theme() ) ) { |
|
448 | + if (function_exists('wp_is_block_theme' && wp_is_block_theme())) { |
|
449 | 449 | return true; |
450 | 450 | } |
451 | 451 | |
@@ -460,32 +460,32 @@ discard block |
||
460 | 460 | |
461 | 461 | $load_fse = false; |
462 | 462 | |
463 | - if ( is_admin() && ! $this->is_aui_screen() ) { |
|
463 | + if (is_admin() && !$this->is_aui_screen()) { |
|
464 | 464 | // Don't add wp-admin scripts if not requested to. |
465 | 465 | } else { |
466 | 466 | $css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend'; |
467 | - $rtl = is_rtl() && ! $aui_bs5 ? '-rtl' : ''; |
|
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' ); |
|
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 | 481 | $load_fse = true; |
482 | 482 | } |
483 | 483 | |
484 | 484 | // flatpickr |
485 | - wp_register_style( 'flatpickr', $this->url.'assets'.$bs_ver.'/css/flatpickr.min.css', array(), $this->version ); |
|
485 | + wp_register_style('flatpickr', $this->url . 'assets' . $bs_ver . '/css/flatpickr.min.css', array(), $this->version); |
|
486 | 486 | |
487 | 487 | // fix some wp-admin issues |
488 | - if(is_admin()){ |
|
488 | + if (is_admin()) { |
|
489 | 489 | $custom_css = " |
490 | 490 | body{ |
491 | 491 | background-color: #f1f1f1; |
@@ -533,14 +533,14 @@ discard block |
||
533 | 533 | padding: 0; |
534 | 534 | } |
535 | 535 | "; |
536 | - wp_add_inline_style( 'ayecode-ui', $custom_css ); |
|
536 | + wp_add_inline_style('ayecode-ui', $custom_css); |
|
537 | 537 | } |
538 | 538 | |
539 | 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) ); |
|
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 | 544 | } |
545 | 545 | } |
546 | 546 | } |
@@ -557,10 +557,10 @@ discard block |
||
557 | 557 | $flatpickr_locale = self::flatpickr_locale(); |
558 | 558 | |
559 | 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' ); |
|
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 | 564 | } |
565 | 565 | |
566 | 566 | $output = ob_get_clean(); |
@@ -568,10 +568,10 @@ discard block |
||
568 | 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( |
|
571 | + return str_replace(array( |
|
572 | 572 | '<script>', |
573 | 573 | '</script>' |
574 | - ), '', self::minify_js($output) ); |
|
574 | + ), '', self::minify_js($output)); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | |
@@ -585,13 +585,13 @@ discard block |
||
585 | 585 | ob_start(); |
586 | 586 | ?> |
587 | 587 | <script> |
588 | - <?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?> |
|
588 | + <?php if (defined('FUSION_BUILDER_VERSION')) { ?> |
|
589 | 589 | /* With Avada builder */ |
590 | 590 | |
591 | 591 | <?php } ?> |
592 | 592 | </script> |
593 | 593 | <?php |
594 | - return str_replace( array( |
|
594 | + return str_replace(array( |
|
595 | 595 | '<script>', |
596 | 596 | '</script>' |
597 | 597 | ), '', ob_get_clean()); |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | * |
603 | 603 | * If this remains small then its best to use this than to add another JS file. |
604 | 604 | */ |
605 | - public function inline_script_file_browser(){ |
|
605 | + public function inline_script_file_browser() { |
|
606 | 606 | ob_start(); |
607 | 607 | ?> |
608 | 608 | <script> |
@@ -617,10 +617,10 @@ discard block |
||
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( |
|
620 | + return str_replace(array( |
|
621 | 621 | '<script>', |
622 | 622 | '</script>' |
623 | - ), '', $output ); |
|
623 | + ), '', $output); |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | /** |
@@ -628,59 +628,59 @@ discard block |
||
628 | 628 | */ |
629 | 629 | public function enqueue_scripts() { |
630 | 630 | |
631 | - if( is_admin() && !$this->is_aui_screen()){ |
|
631 | + if (is_admin() && !$this->is_aui_screen()) { |
|
632 | 632 | // don't add wp-admin scripts if not requested to |
633 | - }else { |
|
633 | + } else { |
|
634 | 634 | |
635 | 635 | $js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend'; |
636 | 636 | |
637 | 637 | $bs_ver = $this->settings['bs_ver'] == '5' ? '-v5' : ''; |
638 | 638 | |
639 | 639 | // select2 |
640 | - wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version ); |
|
640 | + wp_register_script('select2', $this->url . 'assets/js/select2.min.js', array('jquery'), $this->select2_version); |
|
641 | 641 | |
642 | 642 | // flatpickr |
643 | - wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version ); |
|
643 | + wp_register_script('flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version); |
|
644 | 644 | |
645 | 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 ); |
|
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 | 650 | } |
651 | 651 | |
652 | 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() ); |
|
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 | 655 | |
656 | 656 | $load_inline = false; |
657 | 657 | |
658 | - if ( $this->settings[ $js_setting ] == 'core-popper' ) { |
|
658 | + if ($this->settings[$js_setting] == 'core-popper') { |
|
659 | 659 | // Bootstrap bundle |
660 | 660 | $url = $this->url . 'assets' . $bs_ver . '/js/bootstrap.bundle.min.js'; |
661 | - wp_register_script( 'bootstrap-js-bundle', $url, array( |
|
661 | + wp_register_script('bootstrap-js-bundle', $url, array( |
|
662 | 662 | 'select2', |
663 | 663 | 'jquery' |
664 | - ), $this->version, $this->is_bs3_compat() ); |
|
664 | + ), $this->version, $this->is_bs3_compat()); |
|
665 | 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' ); |
|
666 | + is_admin() ? wp_enqueue_script('bootstrap-js-bundle', '', null, null, true) : wp_enqueue_script('bootstrap-js-bundle'); |
|
667 | 667 | $script = $this->inline_script(); |
668 | - wp_add_inline_script( 'bootstrap-js-bundle', $script ); |
|
669 | - } elseif ( $this->settings[ $js_setting ] == 'popper' ) { |
|
668 | + wp_add_inline_script('bootstrap-js-bundle', $script); |
|
669 | + } elseif ($this->settings[$js_setting] == 'popper') { |
|
670 | 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' ); |
|
671 | + wp_register_script('bootstrap-js-popper', $url, array('select2', 'jquery'), $this->version); |
|
672 | + wp_enqueue_script('bootstrap-js-popper'); |
|
673 | 673 | $load_inline = true; |
674 | 674 | } else { |
675 | 675 | $load_inline = true; |
676 | 676 | } |
677 | 677 | |
678 | 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' ); |
|
679 | + if ($load_inline) { |
|
680 | + wp_register_script('bootstrap-dummy', '', array('select2', 'jquery')); |
|
681 | + wp_enqueue_script('bootstrap-dummy'); |
|
682 | 682 | $script = $this->inline_script(); |
683 | - wp_add_inline_script( 'bootstrap-dummy', $script ); |
|
683 | + wp_add_inline_script('bootstrap-dummy', $script); |
|
684 | 684 | } |
685 | 685 | } |
686 | 686 | |
@@ -689,17 +689,17 @@ discard block |
||
689 | 689 | /** |
690 | 690 | * Enqueue flatpickr if called. |
691 | 691 | */ |
692 | - public function enqueue_flatpickr(){ |
|
693 | - wp_enqueue_style( 'flatpickr' ); |
|
694 | - wp_enqueue_script( 'flatpickr' ); |
|
692 | + public function enqueue_flatpickr() { |
|
693 | + wp_enqueue_style('flatpickr'); |
|
694 | + wp_enqueue_script('flatpickr'); |
|
695 | 695 | } |
696 | 696 | |
697 | 697 | /** |
698 | 698 | * Enqueue iconpicker if called. |
699 | 699 | */ |
700 | - public function enqueue_iconpicker(){ |
|
701 | - wp_enqueue_style( 'iconpicker' ); |
|
702 | - wp_enqueue_script( 'iconpicker' ); |
|
700 | + public function enqueue_iconpicker() { |
|
701 | + wp_enqueue_style('iconpicker'); |
|
702 | + wp_enqueue_script('iconpicker'); |
|
703 | 703 | } |
704 | 704 | |
705 | 705 | /** |
@@ -708,19 +708,19 @@ discard block |
||
708 | 708 | * @return string |
709 | 709 | */ |
710 | 710 | public function get_url() { |
711 | - $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) ); |
|
712 | - $content_url = untrailingslashit( WP_CONTENT_URL ); |
|
711 | + $content_dir = wp_normalize_path(untrailingslashit(WP_CONTENT_DIR)); |
|
712 | + $content_url = untrailingslashit(WP_CONTENT_URL); |
|
713 | 713 | |
714 | 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 ); |
|
715 | + if (strpos($content_url, 'http://') === 0 && strpos(plugins_url(), 'https://') === 0) { |
|
716 | + $content_url = str_replace('http://', 'https://', $content_url); |
|
717 | 717 | } |
718 | 718 | |
719 | 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 ); |
|
720 | + $file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__))); |
|
721 | + $url = str_replace($content_dir, $content_url, $file_dir); |
|
722 | 722 | |
723 | - return trailingslashit( $url ); |
|
723 | + return trailingslashit($url); |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | /** |
@@ -732,15 +732,15 @@ discard block |
||
732 | 732 | |
733 | 733 | $url = ''; |
734 | 734 | // check if we are inside a plugin |
735 | - $file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) ); |
|
735 | + $file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__))); |
|
736 | 736 | |
737 | 737 | // add check in-case user has changed wp-content dir name. |
738 | 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()); |
|
739 | + $dir_parts = explode("/$wp_content_folder_name/", $file_dir); |
|
740 | + $url_parts = explode("/$wp_content_folder_name/", plugins_url()); |
|
741 | 741 | |
742 | - if(!empty($url_parts[0]) && !empty($dir_parts[1])){ |
|
743 | - $url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] ); |
|
742 | + if (!empty($url_parts[0]) && !empty($dir_parts[1])) { |
|
743 | + $url = trailingslashit($url_parts[0] . "/$wp_content_folder_name/" . $dir_parts[1]); |
|
744 | 744 | } |
745 | 745 | |
746 | 746 | return $url; |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | * Register the database settings with WordPress. |
751 | 751 | */ |
752 | 752 | public function register_settings() { |
753 | - register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' ); |
|
753 | + register_setting('ayecode-ui-settings', 'ayecode-ui-settings'); |
|
754 | 754 | } |
755 | 755 | |
756 | 756 | /** |
@@ -759,10 +759,10 @@ discard block |
||
759 | 759 | */ |
760 | 760 | public function menu_item() { |
761 | 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( |
|
762 | + call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array( |
|
763 | 763 | $this, |
764 | 764 | 'settings_page' |
765 | - ) ); |
|
765 | + )); |
|
766 | 766 | } |
767 | 767 | |
768 | 768 | /** |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | * |
771 | 771 | * @return array |
772 | 772 | */ |
773 | - public function theme_js_settings(){ |
|
773 | + public function theme_js_settings() { |
|
774 | 774 | return array( |
775 | 775 | 'ayetheme' => 'popper', |
776 | 776 | 'listimia' => 'required', |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | $query = "SELECT MIN(user_registered) AS oldest_registration_date FROM {$wpdb->users}"; |
792 | 792 | |
793 | 793 | // Execute the query |
794 | - $date = $wpdb->get_var( $query ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching |
|
794 | + $date = $wpdb->get_var($query); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching |
|
795 | 795 | |
796 | 796 | return $date ? $date : false; |
797 | 797 | } |
@@ -799,11 +799,11 @@ discard block |
||
799 | 799 | /** |
800 | 800 | * Show admin notice if backend scripts not loaded. |
801 | 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>'; |
|
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 | 807 | } |
808 | 808 | |
809 | 809 | /** |
@@ -813,32 +813,32 @@ discard block |
||
813 | 813 | */ |
814 | 814 | public function get_settings() { |
815 | 815 | |
816 | - $db_settings = get_option( 'ayecode-ui-settings' ); |
|
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() ); |
|
819 | + $site_install_date = new DateTime(self::get_site_install_date()); |
|
820 | 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' ) ); |
|
821 | + if (empty($db_settings) && $site_install_date < $switch_over_date) { |
|
822 | + add_action('admin_notices', array($this, 'show_admin_version_notice')); |
|
823 | 823 | } |
824 | 824 | |
825 | 825 | $js_default = 'core-popper'; |
826 | 826 | $js_default_backend = $js_default; |
827 | 827 | |
828 | 828 | // maybe set defaults (if no settings set) |
829 | - if(empty($db_settings)){ |
|
830 | - $active_theme = strtolower( get_template() ); // active parent theme. |
|
829 | + if (empty($db_settings)) { |
|
830 | + $active_theme = strtolower(get_template()); // active parent theme. |
|
831 | 831 | $theme_js_settings = self::theme_js_settings(); |
832 | - if(isset($theme_js_settings[$active_theme])){ |
|
832 | + if (isset($theme_js_settings[$active_theme])) { |
|
833 | 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; |
|
834 | + $js_default_backend = isset($theme_js_settings[$active_theme . "_backend"]) ? $theme_js_settings[$active_theme . "_backend"] : $js_default; |
|
835 | 835 | } |
836 | 836 | } |
837 | 837 | |
838 | 838 | /** |
839 | 839 | * Filter the default settings. |
840 | 840 | */ |
841 | - $defaults = apply_filters( 'ayecode-ui-default-settings', array( |
|
841 | + $defaults = apply_filters('ayecode-ui-default-settings', array( |
|
842 | 842 | 'css' => 'compatibility', // core, compatibility |
843 | 843 | 'js' => $js_default, // js to load, core-popper, popper |
844 | 844 | 'html_font_size' => '16', // js to load, core-popper, popper |
@@ -846,16 +846,16 @@ discard block |
||
846 | 846 | 'js_backend' => $js_default_backend, // js to load, core-popper, popper |
847 | 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 | 853 | /** |
854 | 854 | * Filter the Bootstrap settings. |
855 | 855 | * |
856 | 856 | * @todo if we add this filer people might use it and then it defeats the purpose of this class :/ |
857 | 857 | */ |
858 | - return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults ); |
|
858 | + return $this->settings = apply_filters('ayecode-ui-settings', $settings, $db_settings, $defaults); |
|
859 | 859 | } |
860 | 860 | |
861 | 861 | |
@@ -863,109 +863,109 @@ discard block |
||
863 | 863 | * The settings page html output. |
864 | 864 | */ |
865 | 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' ) ); |
|
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 | 868 | } |
869 | - $overrides = apply_filters( 'ayecode-ui-settings', array(), array(), array() ); |
|
869 | + $overrides = apply_filters('ayecode-ui-settings', array(), array(), array()); |
|
870 | 870 | |
871 | 871 | ?> |
872 | 872 | <div class="wrap"> |
873 | - <h1><?php echo esc_attr( $this->name ); ?></h1> |
|
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> |
|
873 | + <h1><?php echo esc_attr($this->name); ?></h1> |
|
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' ); |
|
877 | + settings_fields('ayecode-ui-settings'); |
|
878 | + do_settings_sections('ayecode-ui-settings'); |
|
879 | 879 | ?> |
880 | 880 | |
881 | - <h2><?php esc_html_e( 'BootStrap Version', 'ayecode-connect' ); ?></h2> |
|
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> |
|
881 | + <h2><?php esc_html_e('BootStrap Version', 'ayecode-connect'); ?></h2> |
|
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 ) ) { |
|
884 | + if (!empty($overrides)) { |
|
885 | 885 | echo aui()->alert(array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
886 | 886 | 'type'=> 'info', |
887 | - 'content'=> esc_attr__("Some options are disabled as your current theme is overriding them.", 'ayecode-connect' ) |
|
887 | + 'content'=> esc_attr__("Some options are disabled as your current theme is overriding them.", 'ayecode-connect') |
|
888 | 888 | )); |
889 | 889 | } |
890 | 890 | ?> |
891 | 891 | </div> |
892 | 892 | <table class="form-table wpbs-table-version-settings"> |
893 | 893 | <tr valign="top"> |
894 | - <th scope="row"><label for="wpbs-css"><?php esc_html_e( 'Version', 'ayecode-connect' ); ?></label></th> |
|
894 | + <th scope="row"><label for="wpbs-css"><?php esc_html_e('Version', 'ayecode-connect'); ?></label></th> |
|
895 | 895 | <td> |
896 | 896 | <select name="ayecode-ui-settings[bs_ver]" id="wpbs-css" <?php echo !empty($overrides['bs_ver']) ? 'disabled' : ''; ?>> |
897 | - <option value="5" <?php selected( $this->settings['bs_ver'], '5' ); ?>><?php esc_html_e( 'v5 (recommended)', 'ayecode-connect' ); ?></option> |
|
898 | - <option value="4" <?php selected( $this->settings['bs_ver'], '4' ); ?>><?php esc_html_e( 'v4 (legacy)', 'ayecode-connect' ); ?></option> |
|
897 | + <option value="5" <?php selected($this->settings['bs_ver'], '5'); ?>><?php esc_html_e('v5 (recommended)', 'ayecode-connect'); ?></option> |
|
898 | + <option value="4" <?php selected($this->settings['bs_ver'], '4'); ?>><?php esc_html_e('v4 (legacy)', 'ayecode-connect'); ?></option> |
|
899 | 899 | </select> |
900 | 900 | </td> |
901 | 901 | </tr> |
902 | 902 | </table> |
903 | 903 | |
904 | - <h2><?php esc_html_e( 'Frontend', 'ayecode-connect' ); ?></h2> |
|
904 | + <h2><?php esc_html_e('Frontend', 'ayecode-connect'); ?></h2> |
|
905 | 905 | <table class="form-table wpbs-table-settings"> |
906 | 906 | <tr valign="top"> |
907 | - <th scope="row"><label for="wpbs-css"><?php esc_html_e( 'Load CSS', 'ayecode-connect' ); ?></label></th> |
|
907 | + <th scope="row"><label for="wpbs-css"><?php esc_html_e('Load CSS', 'ayecode-connect'); ?></label></th> |
|
908 | 908 | <td> |
909 | 909 | <select name="ayecode-ui-settings[css]" id="wpbs-css" <?php echo !empty($overrides['css']) ? 'disabled' : ''; ?>> |
910 | - <option value="compatibility" <?php selected( $this->settings['css'], 'compatibility' ); ?>><?php esc_html_e( 'Compatibility Mode (default)', 'ayecode-connect' ); ?></option> |
|
911 | - <option value="core" <?php selected( $this->settings['css'], 'core' ); ?>><?php esc_html_e( 'Full Mode', 'ayecode-connect' ); ?></option> |
|
912 | - <option value="" <?php selected( $this->settings['css'], '' ); ?>><?php esc_html_e( 'Disabled', 'ayecode-connect' ); ?></option> |
|
910 | + <option value="compatibility" <?php selected($this->settings['css'], 'compatibility'); ?>><?php esc_html_e('Compatibility Mode (default)', 'ayecode-connect'); ?></option> |
|
911 | + <option value="core" <?php selected($this->settings['css'], 'core'); ?>><?php esc_html_e('Full Mode', 'ayecode-connect'); ?></option> |
|
912 | + <option value="" <?php selected($this->settings['css'], ''); ?>><?php esc_html_e('Disabled', 'ayecode-connect'); ?></option> |
|
913 | 913 | </select> |
914 | 914 | </td> |
915 | 915 | </tr> |
916 | 916 | |
917 | 917 | <tr valign="top"> |
918 | - <th scope="row"><label for="wpbs-js"><?php esc_html_e( 'Load JS', 'ayecode-connect' ); ?></label></th> |
|
918 | + <th scope="row"><label for="wpbs-js"><?php esc_html_e('Load JS', 'ayecode-connect'); ?></label></th> |
|
919 | 919 | <td> |
920 | 920 | <select name="ayecode-ui-settings[js]" id="wpbs-js" <?php echo !empty($overrides['js']) ? 'disabled' : ''; ?>> |
921 | - <option value="core-popper" <?php selected( $this->settings['js'], 'core-popper' ); ?>><?php esc_html_e( 'Core + Popper (default)', 'ayecode-connect' ); ?></option> |
|
922 | - <option value="popper" <?php selected( $this->settings['js'], 'popper' ); ?>><?php esc_html_e( 'Popper', 'ayecode-connect' ); ?></option> |
|
923 | - <option value="required" <?php selected( $this->settings['js'], 'required' ); ?>><?php esc_html_e( 'Required functions only', 'ayecode-connect' ); ?></option> |
|
924 | - <option value="" <?php selected( $this->settings['js'], '' ); ?>><?php esc_html_e( 'Disabled (not recommended)', 'ayecode-connect' ); ?></option> |
|
921 | + <option value="core-popper" <?php selected($this->settings['js'], 'core-popper'); ?>><?php esc_html_e('Core + Popper (default)', 'ayecode-connect'); ?></option> |
|
922 | + <option value="popper" <?php selected($this->settings['js'], 'popper'); ?>><?php esc_html_e('Popper', 'ayecode-connect'); ?></option> |
|
923 | + <option value="required" <?php selected($this->settings['js'], 'required'); ?>><?php esc_html_e('Required functions only', 'ayecode-connect'); ?></option> |
|
924 | + <option value="" <?php selected($this->settings['js'], ''); ?>><?php esc_html_e('Disabled (not recommended)', 'ayecode-connect'); ?></option> |
|
925 | 925 | </select> |
926 | 926 | </td> |
927 | 927 | </tr> |
928 | 928 | |
929 | 929 | <tr valign="top"> |
930 | - <th scope="row"><label for="wpbs-font_size"><?php esc_html_e( 'HTML Font Size (px)', 'ayecode-connect' ); ?></label></th> |
|
930 | + <th scope="row"><label for="wpbs-font_size"><?php esc_html_e('HTML Font Size (px)', 'ayecode-connect'); ?></label></th> |
|
931 | 931 | <td> |
932 | - <input type="number" name="ayecode-ui-settings[html_font_size]" id="wpbs-font_size" value="<?php echo absint( $this->settings['html_font_size']); ?>" placeholder="16" <?php echo !empty($overrides['html_font_size']) ? 'disabled' : ''; ?> /> |
|
933 | - <p class="description" ><?php esc_html_e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.", 'ayecode-connect' );?></p> |
|
932 | + <input type="number" name="ayecode-ui-settings[html_font_size]" id="wpbs-font_size" value="<?php echo absint($this->settings['html_font_size']); ?>" placeholder="16" <?php echo !empty($overrides['html_font_size']) ? 'disabled' : ''; ?> /> |
|
933 | + <p class="description" ><?php esc_html_e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.", 'ayecode-connect'); ?></p> |
|
934 | 934 | </td> |
935 | 935 | </tr> |
936 | 936 | |
937 | 937 | </table> |
938 | 938 | |
939 | - <h2><?php esc_html_e( 'Backend', 'ayecode-connect' ); ?> (wp-admin)</h2> |
|
939 | + <h2><?php esc_html_e('Backend', 'ayecode-connect'); ?> (wp-admin)</h2> |
|
940 | 940 | <table class="form-table wpbs-table-settings"> |
941 | 941 | <tr valign="top"> |
942 | - <th scope="row"><label for="wpbs-css-admin"><?php esc_html_e( 'Load CSS', 'ayecode-connect' ); ?></label></th> |
|
942 | + <th scope="row"><label for="wpbs-css-admin"><?php esc_html_e('Load CSS', 'ayecode-connect'); ?></label></th> |
|
943 | 943 | <td> |
944 | 944 | <select name="ayecode-ui-settings[css_backend]" id="wpbs-css-admin" <?php echo !empty($overrides['css_backend']) ? 'disabled' : ''; ?>> |
945 | - <option value="compatibility" <?php selected( $this->settings['css_backend'], 'compatibility' ); ?>><?php esc_html_e( 'Compatibility Mode (default)', 'ayecode-connect' ); ?></option> |
|
946 | - <option value="core" <?php selected( $this->settings['css_backend'], 'core' ); ?>><?php esc_html_e( 'Full Mode (will cause style issues)', 'ayecode-connect' ); ?></option> |
|
947 | - <option value="" <?php selected( $this->settings['css_backend'], '' ); ?>><?php esc_html_e( 'Disabled', 'ayecode-connect' ); ?></option> |
|
945 | + <option value="compatibility" <?php selected($this->settings['css_backend'], 'compatibility'); ?>><?php esc_html_e('Compatibility Mode (default)', 'ayecode-connect'); ?></option> |
|
946 | + <option value="core" <?php selected($this->settings['css_backend'], 'core'); ?>><?php esc_html_e('Full Mode (will cause style issues)', 'ayecode-connect'); ?></option> |
|
947 | + <option value="" <?php selected($this->settings['css_backend'], ''); ?>><?php esc_html_e('Disabled', 'ayecode-connect'); ?></option> |
|
948 | 948 | </select> |
949 | 949 | </td> |
950 | 950 | </tr> |
951 | 951 | |
952 | 952 | <tr valign="top"> |
953 | - <th scope="row"><label for="wpbs-js-admin"><?php esc_html_e( 'Load JS', 'ayecode-connect' ); ?></label></th> |
|
953 | + <th scope="row"><label for="wpbs-js-admin"><?php esc_html_e('Load JS', 'ayecode-connect'); ?></label></th> |
|
954 | 954 | <td> |
955 | 955 | <select name="ayecode-ui-settings[js_backend]" id="wpbs-js-admin" <?php echo !empty($overrides['js_backend']) ? 'disabled' : ''; ?>> |
956 | - <option value="core-popper" <?php selected( $this->settings['js_backend'], 'core-popper' ); ?>><?php esc_html_e( 'Core + Popper (default)', 'ayecode-connect' ); ?></option> |
|
957 | - <option value="popper" <?php selected( $this->settings['js_backend'], 'popper' ); ?>><?php esc_html_e( 'Popper', 'ayecode-connect' ); ?></option> |
|
958 | - <option value="required" <?php selected( $this->settings['js_backend'], 'required' ); ?>><?php esc_html_e( 'Required functions only', 'ayecode-connect' ); ?></option> |
|
959 | - <option value="" <?php selected( $this->settings['js_backend'], '' ); ?>><?php esc_html_e( 'Disabled (not recommended)', 'ayecode-connect' ); ?></option> |
|
956 | + <option value="core-popper" <?php selected($this->settings['js_backend'], 'core-popper'); ?>><?php esc_html_e('Core + Popper (default)', 'ayecode-connect'); ?></option> |
|
957 | + <option value="popper" <?php selected($this->settings['js_backend'], 'popper'); ?>><?php esc_html_e('Popper', 'ayecode-connect'); ?></option> |
|
958 | + <option value="required" <?php selected($this->settings['js_backend'], 'required'); ?>><?php esc_html_e('Required functions only', 'ayecode-connect'); ?></option> |
|
959 | + <option value="" <?php selected($this->settings['js_backend'], ''); ?>><?php esc_html_e('Disabled (not recommended)', 'ayecode-connect'); ?></option> |
|
960 | 960 | </select> |
961 | 961 | </td> |
962 | 962 | </tr> |
963 | 963 | |
964 | 964 | <tr valign="top"> |
965 | - <th scope="row"><label for="wpbs-disable-admin"><?php esc_html_e( 'Disable load on URL', 'ayecode-connect' ); ?></label></th> |
|
965 | + <th scope="row"><label for="wpbs-disable-admin"><?php esc_html_e('Disable load on URL', 'ayecode-connect'); ?></label></th> |
|
966 | 966 | <td> |
967 | - <p><?php esc_html_e( 'If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'ayecode-connect' ); ?></p> |
|
968 | - <textarea name="ayecode-ui-settings[disable_admin]" rows="10" cols="50" id="wpbs-disable-admin" class="large-text code" spellcheck="false" placeholder="myplugin.php action=go"><?php echo esc_textarea( $this->settings['disable_admin'] );?></textarea> |
|
967 | + <p><?php esc_html_e('If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'ayecode-connect'); ?></p> |
|
968 | + <textarea name="ayecode-ui-settings[disable_admin]" rows="10" cols="50" id="wpbs-disable-admin" class="large-text code" spellcheck="false" placeholder="myplugin.php action=go"><?php echo esc_textarea($this->settings['disable_admin']); ?></textarea> |
|
969 | 969 | </td> |
970 | 970 | </tr> |
971 | 971 | </table> |
@@ -974,33 +974,33 @@ discard block |
||
974 | 974 | submit_button(); |
975 | 975 | ?> |
976 | 976 | </form> |
977 | - <div id="wpbs-version" data-aui-source="<?php echo esc_attr( $this->get_load_source() ); ?>"><?php echo esc_html( $this->version ); ?></div> |
|
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 | - public function get_load_source(){ |
|
983 | - $file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) ); |
|
984 | - $plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) ); |
|
982 | + public function get_load_source() { |
|
983 | + $file = str_replace(array("/", "\\"), "/", realpath(__FILE__)); |
|
984 | + $plugins_dir = str_replace(array("/", "\\"), "/", realpath(WP_PLUGIN_DIR)); |
|
985 | 985 | |
986 | 986 | // Find source plugin/theme of SD |
987 | 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() ) ); |
|
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 | 992 | |
993 | - if ( strpos( $file, $themes_dir ) !== false ) { |
|
994 | - $source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) ); |
|
993 | + if (strpos($file, $themes_dir) !== false) { |
|
994 | + $source = explode("/", ltrim(str_replace($themes_dir, "", $file), "/")); |
|
995 | 995 | } |
996 | 996 | } |
997 | 997 | |
998 | 998 | return isset($source[0]) ? esc_attr($source[0]) : ''; |
999 | 999 | } |
1000 | 1000 | |
1001 | - public function customizer_settings($wp_customize){ |
|
1001 | + public function customizer_settings($wp_customize) { |
|
1002 | 1002 | $wp_customize->add_section('aui_settings', array( |
1003 | - 'title' => __('AyeCode UI', 'ayecode-connect' ), |
|
1003 | + 'title' => __('AyeCode UI', 'ayecode-connect'), |
|
1004 | 1004 | 'priority' => 120, |
1005 | 1005 | )); |
1006 | 1006 | |
@@ -1014,8 +1014,8 @@ discard block |
||
1014 | 1014 | 'type' => 'option', |
1015 | 1015 | 'transport' => 'refresh', |
1016 | 1016 | )); |
1017 | - $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array( |
|
1018 | - 'label' => __('Primary Color', 'ayecode-connect' ), |
|
1017 | + $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_primary', array( |
|
1018 | + 'label' => __('Primary Color', 'ayecode-connect'), |
|
1019 | 1019 | 'section' => 'aui_settings', |
1020 | 1020 | 'settings' => 'aui_options[color_primary]', |
1021 | 1021 | ))); |
@@ -1027,8 +1027,8 @@ discard block |
||
1027 | 1027 | 'type' => 'option', |
1028 | 1028 | 'transport' => 'refresh', |
1029 | 1029 | )); |
1030 | - $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array( |
|
1031 | - 'label' => __('Secondary Color', 'ayecode-connect' ), |
|
1030 | + $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_secondary', array( |
|
1031 | + 'label' => __('Secondary Color', 'ayecode-connect'), |
|
1032 | 1032 | 'section' => 'aui_settings', |
1033 | 1033 | 'settings' => 'aui_options[color_secondary]', |
1034 | 1034 | ))); |
@@ -1054,12 +1054,12 @@ discard block |
||
1054 | 1054 | .collapse.show:not(.in){display: inherit;} |
1055 | 1055 | .fade.show{opacity: 1;} |
1056 | 1056 | |
1057 | - <?php if( defined( 'SVQ_THEME_VERSION' ) ){ ?> |
|
1057 | + <?php if (defined('SVQ_THEME_VERSION')) { ?> |
|
1058 | 1058 | /* KLEO theme specific */ |
1059 | 1059 | .kleo-main-header .navbar-collapse.collapse.show:not(.in){display: block !important;} |
1060 | 1060 | <?php } ?> |
1061 | 1061 | |
1062 | - <?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?> |
|
1062 | + <?php if (defined('FUSION_BUILDER_VERSION')) { ?> |
|
1063 | 1063 | /* With Avada builder */ |
1064 | 1064 | body.modal-open .modal.in {opacity:1;z-index: 99999} |
1065 | 1065 | body.modal-open .modal.bsui.in .modal-content {box-shadow: none;} |
@@ -1070,44 +1070,44 @@ discard block |
||
1070 | 1070 | <?php } ?> |
1071 | 1071 | </style> |
1072 | 1072 | <?php |
1073 | - return str_replace( array( |
|
1073 | + return str_replace(array( |
|
1074 | 1074 | '<style>', |
1075 | 1075 | '</style>' |
1076 | - ), '', self::minify_css( ob_get_clean() ) ); |
|
1076 | + ), '', self::minify_css(ob_get_clean())); |
|
1077 | 1077 | } |
1078 | 1078 | |
1079 | - public static function custom_css( $compatibility = true, $is_fse = false ) { |
|
1079 | + public static function custom_css($compatibility = true, $is_fse = false) { |
|
1080 | 1080 | global $aui_bs5; |
1081 | 1081 | |
1082 | 1082 | $colors = array(); |
1083 | 1083 | |
1084 | - if ( defined( 'BLOCKSTRAP_VERSION' ) ) { |
|
1084 | + if (defined('BLOCKSTRAP_VERSION')) { |
|
1085 | 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'] ); |
|
1087 | + if (!empty($setting['color']['palette']['theme'])) { |
|
1088 | + foreach ($setting['color']['palette']['theme'] as $color) { |
|
1089 | + $colors[$color['slug']] = esc_attr($color['color']); |
|
1090 | 1090 | } |
1091 | 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'] ); |
|
1093 | + if (!empty($setting['color']['palette']['custom'])) { |
|
1094 | + foreach ($setting['color']['palette']['custom'] as $color) { |
|
1095 | + $colors[$color['slug']] = esc_attr($color['color']); |
|
1096 | 1096 | } |
1097 | 1097 | } |
1098 | 1098 | } else { |
1099 | - $settings = get_option( 'aui_options' ); |
|
1099 | + $settings = get_option('aui_options'); |
|
1100 | 1100 | |
1101 | 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 |
|
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 | 1104 | ); |
1105 | 1105 | } |
1106 | 1106 | |
1107 | 1107 | ob_start(); |
1108 | 1108 | ?><style><?php |
1109 | 1109 | // BS v3 compat |
1110 | - if( self::is_bs3_compat() ){ |
|
1110 | + if (self::is_bs3_compat()) { |
|
1111 | 1111 | echo self::bs3_compat_css(); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
1112 | 1112 | } |
1113 | 1113 | |
@@ -1116,147 +1116,147 @@ discard block |
||
1116 | 1116 | //$is_fse = true; |
1117 | 1117 | //} |
1118 | 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 | - $bs_custom_css = apply_filters( 'ayecode_ui_bs_custom_css', $custom_admin || $custom_front ); |
|
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 | + $bs_custom_css = apply_filters('ayecode_ui_bs_custom_css', $custom_admin || $custom_front); |
|
1122 | 1122 | //$bs_custom_css = true; // Force true to fix any color issue. |
1123 | 1123 | |
1124 | 1124 | $colors_css = ''; |
1125 | - if ( ! empty( $colors ) && $bs_custom_css ) { |
|
1125 | + if (!empty($colors) && $bs_custom_css) { |
|
1126 | 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 ) { |
|
1128 | + foreach ($colors as $key => $color) { |
|
1129 | + if ((empty($d_colors[$key]) || $d_colors[$key] != $color) || $is_fse) { |
|
1130 | 1130 | $var = $is_fse ? "var(--wp--preset--color--$key)" : $color; |
1131 | 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 ); |
|
1133 | + $colors_css .= $aui_bs5 ? self::css_overwrite_bs5($key, $var, $compat, $color) : self::css_overwrite($key, $var, $compat, $color); |
|
1134 | 1134 | } |
1135 | 1135 | } |
1136 | 1136 | } |
1137 | 1137 | |
1138 | - if ( $colors_css ) { |
|
1138 | + if ($colors_css) { |
|
1139 | 1139 | echo $colors_css; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
1140 | 1140 | } |
1141 | 1141 | |
1142 | 1142 | // Set admin bar z-index lower when modal is open. |
1143 | 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() ) { |
|
1145 | + if (is_admin()) { |
|
1146 | 1146 | echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}'; |
1147 | 1147 | } |
1148 | 1148 | |
1149 | 1149 | $custom_css = ''; |
1150 | 1150 | |
1151 | - if ( $aui_bs5 && defined( 'BLOCKSTRAP_VERSION' ) && $bs_custom_css ) { |
|
1151 | + if ($aui_bs5 && defined('BLOCKSTRAP_VERSION') && $bs_custom_css) { |
|
1152 | 1152 | $css = ''; |
1153 | 1153 | $theme_settings = wp_get_global_styles(); |
1154 | 1154 | |
1155 | 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) |
|
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 | 1158 | $css .= '--bs-body-font-family: ' . esc_attr($t_fontface) . ';'; |
1159 | 1159 | } |
1160 | 1160 | |
1161 | 1161 | // font size |
1162 | - if( !empty( $theme_settings['typography']['fontSize'] ) ){ |
|
1163 | - $css .= '--bs-body-font-size: ' . esc_attr( $theme_settings['typography']['fontSize'] ) . ' ;'; |
|
1162 | + if (!empty($theme_settings['typography']['fontSize'])) { |
|
1163 | + $css .= '--bs-body-font-size: ' . esc_attr($theme_settings['typography']['fontSize']) . ' ;'; |
|
1164 | 1164 | } |
1165 | 1165 | |
1166 | 1166 | // line height |
1167 | - if( !empty( $theme_settings['typography']['lineHeight'] ) ){ |
|
1168 | - $css .= '--bs-body-line-height: ' . esc_attr( $theme_settings['typography']['lineHeight'] ) . ';'; |
|
1167 | + if (!empty($theme_settings['typography']['lineHeight'])) { |
|
1168 | + $css .= '--bs-body-line-height: ' . esc_attr($theme_settings['typography']['lineHeight']) . ';'; |
|
1169 | 1169 | } |
1170 | 1170 | |
1171 | 1171 | |
1172 | 1172 | // font weight |
1173 | - if( !empty( $theme_settings['typography']['fontWeight'] ) ){ |
|
1174 | - $css .= '--bs-body-font-weight: ' . esc_attr( $theme_settings['typography']['fontWeight'] ) . ';'; |
|
1173 | + if (!empty($theme_settings['typography']['fontWeight'])) { |
|
1174 | + $css .= '--bs-body-font-weight: ' . esc_attr($theme_settings['typography']['fontWeight']) . ';'; |
|
1175 | 1175 | } |
1176 | 1176 | |
1177 | 1177 | // Background |
1178 | - if( !empty( $theme_settings['color']['background'] ) ){ |
|
1179 | - $css .= '--bs-body-bg: ' . esc_attr( $theme_settings['color']['background'] ) . ';'; |
|
1178 | + if (!empty($theme_settings['color']['background'])) { |
|
1179 | + $css .= '--bs-body-bg: ' . esc_attr($theme_settings['color']['background']) . ';'; |
|
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | // Background Gradient |
1183 | - if( !empty( $theme_settings['color']['gradient'] ) ){ |
|
1184 | - $css .= 'background: ' . esc_attr( $theme_settings['color']['gradient'] ) . ';'; |
|
1183 | + if (!empty($theme_settings['color']['gradient'])) { |
|
1184 | + $css .= 'background: ' . esc_attr($theme_settings['color']['gradient']) . ';'; |
|
1185 | 1185 | } |
1186 | 1186 | |
1187 | 1187 | // Background Gradient |
1188 | - if( !empty( $theme_settings['color']['gradient'] ) ){ |
|
1189 | - $css .= 'background: ' . esc_attr( $theme_settings['color']['gradient'] ) . ';'; |
|
1188 | + if (!empty($theme_settings['color']['gradient'])) { |
|
1189 | + $css .= 'background: ' . esc_attr($theme_settings['color']['gradient']) . ';'; |
|
1190 | 1190 | } |
1191 | 1191 | |
1192 | 1192 | // text color |
1193 | - if( !empty( $theme_settings['color']['text'] ) ){ |
|
1194 | - $css .= '--bs-body-color: ' . esc_attr( $theme_settings['color']['text'] ) . ';'; |
|
1193 | + if (!empty($theme_settings['color']['text'])) { |
|
1194 | + $css .= '--bs-body-color: ' . esc_attr($theme_settings['color']['text']) . ';'; |
|
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | |
1198 | 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'] ) . ';'; |
|
1199 | + if (!empty($theme_settings['elements']['link']['color']['text'])) { |
|
1200 | + $css .= '--bs-link-color: ' . esc_attr($theme_settings['elements']['link']['color']['text']) . ';'; |
|
1201 | 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'] ) . ';'; |
|
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 | 1204 | } |
1205 | 1205 | |
1206 | - if($css){ |
|
1207 | - $custom_css .= $is_fse ? 'body.editor-styles-wrapper{' . esc_attr( $css ) . '}' : 'body{' . esc_attr( $css ) . '}'; |
|
1206 | + if ($css) { |
|
1207 | + $custom_css .= $is_fse ? 'body.editor-styles-wrapper{' . esc_attr($css) . '}' : 'body{' . esc_attr($css) . '}'; |
|
1208 | 1208 | } |
1209 | 1209 | |
1210 | 1210 | $bep = $is_fse ? 'body.editor-styles-wrapper ' : ''; |
1211 | 1211 | |
1212 | 1212 | // Headings |
1213 | 1213 | $headings_css = ''; |
1214 | - if( !empty( $theme_settings['elements']['heading']['color']['text'] ) ){ |
|
1215 | - $headings_css .= "color: " . esc_attr( $theme_settings['elements']['heading']['color']['text'] ) . ";"; |
|
1214 | + if (!empty($theme_settings['elements']['heading']['color']['text'])) { |
|
1215 | + $headings_css .= "color: " . esc_attr($theme_settings['elements']['heading']['color']['text']) . ";"; |
|
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | // heading background |
1219 | - if( !empty( $theme_settings['elements']['heading']['color']['background'] ) ){ |
|
1220 | - $headings_css .= 'background: ' . esc_attr( $theme_settings['elements']['heading']['color']['background'] ) . ';'; |
|
1219 | + if (!empty($theme_settings['elements']['heading']['color']['background'])) { |
|
1220 | + $headings_css .= 'background: ' . esc_attr($theme_settings['elements']['heading']['color']['background']) . ';'; |
|
1221 | 1221 | } |
1222 | 1222 | |
1223 | 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'] ) . ';'; |
|
1224 | + if (!empty($theme_settings['elements']['heading']['typography']['fontFamily'])) { |
|
1225 | + $headings_css .= 'font-family: ' . esc_attr($theme_settings['elements']['heading']['typography']['fontFamily']) . ';'; |
|
1226 | 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 ) . "}"; |
|
1228 | + if ($headings_css) { |
|
1229 | + $custom_css .= "$bep h1,$bep h2,$bep h3, $bep h4,$bep h5,$bep h6{ " . esc_attr($headings_css) . "}"; |
|
1230 | 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){ |
|
1234 | + foreach ($hs as $hn) { |
|
1235 | 1235 | $h_css = ''; |
1236 | - if( !empty( $theme_settings['elements'][$hn]['color']['text'] ) ){ |
|
1237 | - $h_css .= 'color: ' . esc_attr( $theme_settings['elements'][$hn]['color']['text'] ) . ';'; |
|
1236 | + if (!empty($theme_settings['elements'][$hn]['color']['text'])) { |
|
1237 | + $h_css .= 'color: ' . esc_attr($theme_settings['elements'][$hn]['color']['text']) . ';'; |
|
1238 | 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'] ) . ';'; |
|
1240 | + if (!empty($theme_settings['elements'][$hn]['typography']['fontSize'])) { |
|
1241 | + $h_css .= 'font-size: ' . esc_attr($theme_settings['elements'][$hn]['typography']['fontSize']) . ';'; |
|
1242 | 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'] ) . ';'; |
|
1244 | + if (!empty($theme_settings['elements'][$hn]['typography']['fontFamily'])) { |
|
1245 | + $h_css .= 'font-family: ' . esc_attr($theme_settings['elements'][$hn]['typography']['fontFamily']) . ';'; |
|
1246 | 1246 | } |
1247 | 1247 | |
1248 | - if($h_css){ |
|
1249 | - $custom_css .= esc_attr( $bep . $hn ) . '{'.esc_attr( $h_css ).'}'; |
|
1248 | + if ($h_css) { |
|
1249 | + $custom_css .= esc_attr($bep . $hn) . '{' . esc_attr($h_css) . '}'; |
|
1250 | 1250 | } |
1251 | 1251 | } |
1252 | 1252 | } |
1253 | 1253 | |
1254 | - if ( $custom_css ) { |
|
1254 | + if ($custom_css) { |
|
1255 | 1255 | echo $custom_css; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
1256 | 1256 | } |
1257 | 1257 | |
1258 | 1258 | // Pagination on Hello Elementor theme. |
1259 | - if ( function_exists( 'hello_elementor_setup' ) ) { |
|
1259 | + if (function_exists('hello_elementor_setup')) { |
|
1260 | 1260 | echo '.aui-nav-links .pagination{justify-content:inherit}'; |
1261 | 1261 | } |
1262 | 1262 | ?></style><?php |
@@ -1265,10 +1265,10 @@ discard block |
||
1265 | 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( |
|
1268 | + return str_replace(array( |
|
1269 | 1269 | '<style>', |
1270 | 1270 | '</style>' |
1271 | - ), '', self::minify_css( $custom_css ) ); |
|
1271 | + ), '', self::minify_css($custom_css)); |
|
1272 | 1272 | } |
1273 | 1273 | |
1274 | 1274 | /** |
@@ -1276,34 +1276,34 @@ discard block |
||
1276 | 1276 | * |
1277 | 1277 | * @return bool |
1278 | 1278 | */ |
1279 | - public static function is_bs3_compat(){ |
|
1279 | + public static function is_bs3_compat() { |
|
1280 | 1280 | return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION'); |
1281 | 1281 | } |
1282 | 1282 | |
1283 | - public static function hex_to_rgb( $hex ) { |
|
1283 | + public static function hex_to_rgb($hex) { |
|
1284 | 1284 | // Remove '#' if present |
1285 | - $hex = str_replace( '#', '', $hex ); |
|
1285 | + $hex = str_replace('#', '', $hex); |
|
1286 | 1286 | |
1287 | 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 ) ); |
|
1288 | + if (strpos($hex, 'rgba(') === 0 || strpos($hex, 'rgb(') === 0) { |
|
1289 | + $_rgb = explode(',', str_replace(array('rgba(', 'rgb(', ')'), '', $hex)); |
|
1290 | 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' ); |
|
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 | 1294 | |
1295 | 1295 | return $rgb; |
1296 | 1296 | } |
1297 | 1297 | |
1298 | 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 ); |
|
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 | 1301 | } |
1302 | 1302 | |
1303 | 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 ) ); |
|
1304 | + $r = hexdec(substr($hex, 0, 2)); |
|
1305 | + $g = hexdec(substr($hex, 2, 2)); |
|
1306 | + $b = hexdec(substr($hex, 4, 2)); |
|
1307 | 1307 | |
1308 | 1308 | // Return RGB values as an array |
1309 | 1309 | return $r . ',' . $g . ',' . $b; |
@@ -1318,13 +1318,13 @@ discard block |
||
1318 | 1318 | * |
1319 | 1319 | * @return string |
1320 | 1320 | */ |
1321 | - public static function css_overwrite_bs5($type,$color_code,$compatibility, $hex = '' ){ |
|
1321 | + public static function css_overwrite_bs5($type, $color_code, $compatibility, $hex = '') { |
|
1322 | 1322 | global $aui_bs5; |
1323 | 1323 | |
1324 | 1324 | $is_var = false; |
1325 | 1325 | $is_custom = strpos($type, 'custom-') !== false ? true : false; |
1326 | - if(!$color_code){return '';} |
|
1327 | - if(strpos($color_code, 'var') !== false){ |
|
1326 | + if (!$color_code) {return ''; } |
|
1327 | + if (strpos($color_code, 'var') !== false) { |
|
1328 | 1328 | //if(!sanitize_hex_color($color_code)){ |
1329 | 1329 | $color_code = esc_attr($color_code); |
1330 | 1330 | $is_var = true; |
@@ -1334,15 +1334,15 @@ discard block |
||
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 | 1339 | $rgb = self::hex_to_rgb($hex); |
1340 | 1340 | |
1341 | - if($compatibility===true || $compatibility===1){ |
|
1341 | + if ($compatibility === true || $compatibility === 1) { |
|
1342 | 1342 | $compatibility = '.bsui'; |
1343 | - }elseif(!$compatibility){ |
|
1343 | + }elseif (!$compatibility) { |
|
1344 | 1344 | $compatibility = ''; |
1345 | - }else{ |
|
1345 | + } else { |
|
1346 | 1346 | $compatibility = esc_attr($compatibility); |
1347 | 1347 | } |
1348 | 1348 | |
@@ -1359,30 +1359,30 @@ discard block |
||
1359 | 1359 | * c = color, b = background color, o = border-color, f = fill |
1360 | 1360 | */ |
1361 | 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' ), |
|
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 | 1375 | ); |
1376 | 1376 | |
1377 | - if ( $aui_bs5 ) { |
|
1378 | - unset($selectors[".alert-{$type}" ]); |
|
1377 | + if ($aui_bs5) { |
|
1378 | + unset($selectors[".alert-{$type}"]); |
|
1379 | 1379 | } |
1380 | 1380 | |
1381 | - if ( $type == 'primary' ) { |
|
1381 | + if ($type == 'primary') { |
|
1382 | 1382 | $selectors = $selectors + array( |
1383 | - 'a' => array( 'c' ), |
|
1384 | - '.btn-link' => array( 'c' ), |
|
1385 | - '.dropdown-item.active' => array( 'b' ), |
|
1383 | + 'a' => array('c'), |
|
1384 | + '.btn-link' => array('c'), |
|
1385 | + '.dropdown-item.active' => array('b'), |
|
1386 | 1386 | '.custom-control-input:checked~.custom-control-label::before' => array( |
1387 | 1387 | 'b', |
1388 | 1388 | 'o' |
@@ -1391,57 +1391,57 @@ discard block |
||
1391 | 1391 | 'b', |
1392 | 1392 | 'o' |
1393 | 1393 | ), |
1394 | - '.nav-pills .nav-link.active' => array( 'b' ), |
|
1395 | - '.nav-pills .show>.nav-link' => array( 'b' ), |
|
1396 | - '.page-link' => array( 'c' ), |
|
1394 | + '.nav-pills .nav-link.active' => array('b'), |
|
1395 | + '.nav-pills .show>.nav-link' => array('b'), |
|
1396 | + '.page-link' => array('c'), |
|
1397 | 1397 | '.page-item.active .page-link' => array( |
1398 | 1398 | 'b', |
1399 | 1399 | 'o' |
1400 | 1400 | ), |
1401 | - '.progress-bar' => array( 'b' ), |
|
1401 | + '.progress-bar' => array('b'), |
|
1402 | 1402 | '.list-group-item.active' => array( |
1403 | 1403 | 'b', |
1404 | 1404 | 'o' |
1405 | 1405 | ), |
1406 | - '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ), |
|
1406 | + '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'), |
|
1407 | 1407 | ); |
1408 | 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 | 1432 | // buttons |
1433 | - $output .= $prefix . ' .btn-'.esc_attr($type).'{'; |
|
1433 | + $output .= $prefix . ' .btn-' . esc_attr($type) . '{'; |
|
1434 | 1434 | $output .= ' |
1435 | - --bs-btn-bg: '.esc_attr($color_code).'; |
|
1436 | - --bs-btn-border-color: '.esc_attr($color_code).'; |
|
1437 | - --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1438 | - --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1439 | - --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type).'-rgb; |
|
1440 | - --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1441 | - --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1435 | + --bs-btn-bg: '.esc_attr($color_code) . '; |
|
1436 | + --bs-btn-border-color: '.esc_attr($color_code) . '; |
|
1437 | + --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1438 | + --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1439 | + --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type) . '-rgb; |
|
1440 | + --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1441 | + --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1442 | 1442 | --bs-btn-active-shadow: unset; |
1443 | - --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .5); |
|
1444 | - --bs-btn-disabled-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .1); |
|
1443 | + --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .5); |
|
1444 | + --bs-btn-disabled-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .1); |
|
1445 | 1445 | '; |
1446 | 1446 | // $output .= ' |
1447 | 1447 | // --bs-btn-color: #fff; |
@@ -1452,18 +1452,18 @@ discard block |
||
1452 | 1452 | $output .= '}'; |
1453 | 1453 | |
1454 | 1454 | // buttons outline |
1455 | - $output .= $prefix . ' .btn-outline-'.esc_attr($type).'{'; |
|
1455 | + $output .= $prefix . ' .btn-outline-' . esc_attr($type) . '{'; |
|
1456 | 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); |
|
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 | 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); |
|
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 | 1467 | '; |
1468 | 1468 | // $output .= ' |
1469 | 1469 | // --bs-btn-color: #fff; |
@@ -1475,32 +1475,32 @@ discard block |
||
1475 | 1475 | |
1476 | 1476 | |
1477 | 1477 | // button hover |
1478 | - $output .= $prefix . ' .btn-'.esc_attr($type).':hover{'; |
|
1478 | + $output .= $prefix . ' .btn-' . esc_attr($type) . ':hover{'; |
|
1479 | 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); |
|
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 | 1481 | } |
1482 | 1482 | '; |
1483 | 1483 | |
1484 | 1484 | |
1485 | - if ( $aui_bs5 ) { |
|
1485 | + if ($aui_bs5) { |
|
1486 | 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.'; }'; |
|
1487 | + $output .= 'html body {--bs-' . esc_attr($type) . ': ' . esc_attr($color_code) . '; }'; |
|
1488 | + $output .= 'html body {--bs-' . esc_attr($type) . '-rgb: ' . $rgb . '; }'; |
|
1489 | 1489 | } |
1490 | 1490 | |
1491 | 1491 | |
1492 | - if ( $is_custom ) { |
|
1492 | + if ($is_custom) { |
|
1493 | 1493 | |
1494 | 1494 | // echo '###'.$type;exit; |
1495 | 1495 | |
1496 | 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;} |
|
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 | 1504 | } |
1505 | 1505 | |
1506 | 1506 | // // build rules into each type |
@@ -1514,36 +1514,36 @@ discard block |
||
1514 | 1514 | // } |
1515 | 1515 | |
1516 | 1516 | // add any color rules |
1517 | - if(!empty($color)){ |
|
1518 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
1517 | + if (!empty($color)) { |
|
1518 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
1519 | 1519 | } |
1520 | - if(!empty($color_i)){ |
|
1521 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
1520 | + if (!empty($color_i)) { |
|
1521 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
1522 | 1522 | } |
1523 | 1523 | |
1524 | 1524 | // add any background color rules |
1525 | - if(!empty($background)){ |
|
1526 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
1525 | + if (!empty($background)) { |
|
1526 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
1527 | 1527 | } |
1528 | - if(!empty($background_i)){ |
|
1529 | - $output .= $aui_bs5 ? '' : implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
1528 | + if (!empty($background_i)) { |
|
1529 | + $output .= $aui_bs5 ? '' : implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
1530 | 1530 | // $output .= implode(",",$background_i) . "{background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important;} "; |
1531 | 1531 | } |
1532 | 1532 | |
1533 | 1533 | // add any border color rules |
1534 | - if(!empty($border)){ |
|
1535 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
1534 | + if (!empty($border)) { |
|
1535 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
1536 | 1536 | } |
1537 | - if(!empty($border_i)){ |
|
1538 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
1537 | + if (!empty($border_i)) { |
|
1538 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
1539 | 1539 | } |
1540 | 1540 | |
1541 | 1541 | // add any fill color rules |
1542 | - if(!empty($fill)){ |
|
1543 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
1542 | + if (!empty($fill)) { |
|
1543 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
1544 | 1544 | } |
1545 | - if(!empty($fill_i)){ |
|
1546 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
1545 | + if (!empty($fill_i)) { |
|
1546 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
1547 | 1547 | } |
1548 | 1548 | |
1549 | 1549 | } |
@@ -1553,26 +1553,26 @@ discard block |
||
1553 | 1553 | |
1554 | 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 | 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"); |
|
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 | 1560 | |
1561 | 1561 | // lighten |
1562 | - $lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25"); |
|
1562 | + $lighten_25 = $is_var ? $color_code . ';filter:brightness(1.25)' : self::css_hex_lighten_darken($color_code, "0.25"); |
|
1563 | 1563 | |
1564 | 1564 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
1565 | - $op_25 = $color_code."40"; // 25% opacity |
|
1565 | + $op_25 = $color_code . "40"; // 25% opacity |
|
1566 | 1566 | |
1567 | 1567 | |
1568 | 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.";} "; |
|
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 | 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);} "; |
|
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 | 1576 | |
1577 | 1577 | // text |
1578 | 1578 | // $output .= $prefix .".xxx, .text-{$type} {color: var(--bs-".esc_attr($type).");} "; |
@@ -1590,9 +1590,9 @@ discard block |
||
1590 | 1590 | // } |
1591 | 1591 | |
1592 | 1592 | // alerts |
1593 | - if ( $aui_bs5 ) { |
|
1593 | + if ($aui_bs5) { |
|
1594 | 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;} "; |
|
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 | 1596 | } |
1597 | 1597 | |
1598 | 1598 | return $output; |
@@ -1607,12 +1607,12 @@ discard block |
||
1607 | 1607 | * |
1608 | 1608 | * @return string |
1609 | 1609 | */ |
1610 | - public static function css_overwrite($type,$color_code,$compatibility, $hex = '' ){ |
|
1610 | + public static function css_overwrite($type, $color_code, $compatibility, $hex = '') { |
|
1611 | 1611 | global $aui_bs5; |
1612 | 1612 | |
1613 | 1613 | $is_var = false; |
1614 | - if(!$color_code){return '';} |
|
1615 | - if(strpos($color_code, 'var') !== false){ |
|
1614 | + if (!$color_code) {return ''; } |
|
1615 | + if (strpos($color_code, 'var') !== false) { |
|
1616 | 1616 | //if(!sanitize_hex_color($color_code)){ |
1617 | 1617 | $color_code = esc_attr($color_code); |
1618 | 1618 | $is_var = true; |
@@ -1622,15 +1622,15 @@ discard block |
||
1622 | 1622 | |
1623 | 1623 | // echo '@@@'.$color_code.'==='.self::hex_to_rgb($color_code);exit; |
1624 | 1624 | |
1625 | - if(!$color_code){return '';} |
|
1625 | + if (!$color_code) {return ''; } |
|
1626 | 1626 | |
1627 | 1627 | $rgb = self::hex_to_rgb($hex); |
1628 | 1628 | |
1629 | - if($compatibility===true || $compatibility===1){ |
|
1629 | + if ($compatibility === true || $compatibility === 1) { |
|
1630 | 1630 | $compatibility = '.bsui'; |
1631 | - }elseif(!$compatibility){ |
|
1631 | + }elseif (!$compatibility) { |
|
1632 | 1632 | $compatibility = ''; |
1633 | - }else{ |
|
1633 | + } else { |
|
1634 | 1634 | $compatibility = esc_attr($compatibility); |
1635 | 1635 | } |
1636 | 1636 | |
@@ -1644,29 +1644,29 @@ discard block |
||
1644 | 1644 | * c = color, b = background color, o = border-color, f = fill |
1645 | 1645 | */ |
1646 | 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' ), |
|
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 | 1659 | ); |
1660 | 1660 | |
1661 | - if ( $aui_bs5 ) { |
|
1662 | - unset($selectors[".alert-{$type}" ]); |
|
1661 | + if ($aui_bs5) { |
|
1662 | + unset($selectors[".alert-{$type}"]); |
|
1663 | 1663 | } |
1664 | 1664 | |
1665 | - if ( $type == 'primary' ) { |
|
1665 | + if ($type == 'primary') { |
|
1666 | 1666 | $selectors = $selectors + array( |
1667 | - 'a' => array( 'c' ), |
|
1668 | - '.btn-link' => array( 'c' ), |
|
1669 | - '.dropdown-item.active' => array( 'b' ), |
|
1667 | + 'a' => array('c'), |
|
1668 | + '.btn-link' => array('c'), |
|
1669 | + '.dropdown-item.active' => array('b'), |
|
1670 | 1670 | '.custom-control-input:checked~.custom-control-label::before' => array( |
1671 | 1671 | 'b', |
1672 | 1672 | 'o' |
@@ -1675,19 +1675,19 @@ discard block |
||
1675 | 1675 | 'b', |
1676 | 1676 | 'o' |
1677 | 1677 | ), |
1678 | - '.nav-pills .nav-link.active' => array( 'b' ), |
|
1679 | - '.nav-pills .show>.nav-link' => array( 'b' ), |
|
1680 | - '.page-link' => array( 'c' ), |
|
1678 | + '.nav-pills .nav-link.active' => array('b'), |
|
1679 | + '.nav-pills .show>.nav-link' => array('b'), |
|
1680 | + '.page-link' => array('c'), |
|
1681 | 1681 | '.page-item.active .page-link' => array( |
1682 | 1682 | 'b', |
1683 | 1683 | 'o' |
1684 | 1684 | ), |
1685 | - '.progress-bar' => array( 'b' ), |
|
1685 | + '.progress-bar' => array('b'), |
|
1686 | 1686 | '.list-group-item.active' => array( |
1687 | 1687 | 'b', |
1688 | 1688 | 'o' |
1689 | 1689 | ), |
1690 | - '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ), |
|
1690 | + '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'), |
|
1691 | 1691 | // '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules... |
1692 | 1692 | // '.custom-range::-moz-range-thumb' => array('b'), |
1693 | 1693 | // '.custom-range::-ms-thumb' => array('b'), |
@@ -1695,7 +1695,7 @@ discard block |
||
1695 | 1695 | } |
1696 | 1696 | |
1697 | 1697 | $important_selectors = array( |
1698 | - ".bg-{$type}" => array('b','f'), |
|
1698 | + ".bg-{$type}" => array('b', 'f'), |
|
1699 | 1699 | ".border-{$type}" => array('o'), |
1700 | 1700 | ".text-{$type}" => array('c'), |
1701 | 1701 | ); |
@@ -1711,62 +1711,62 @@ discard block |
||
1711 | 1711 | |
1712 | 1712 | $output = ''; |
1713 | 1713 | |
1714 | - if ( $aui_bs5 ) { |
|
1714 | + if ($aui_bs5) { |
|
1715 | 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.'; }'; |
|
1716 | + $output .= 'html body {--bs-' . esc_attr($type) . '-rgb: ' . $rgb . '; }'; |
|
1717 | 1717 | } |
1718 | 1718 | |
1719 | 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;} |
|
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 | 1727 | } |
1728 | 1728 | |
1729 | 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;} |
|
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 | 1737 | } |
1738 | 1738 | |
1739 | 1739 | // add any color rules |
1740 | - if(!empty($color)){ |
|
1741 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
1740 | + if (!empty($color)) { |
|
1741 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
1742 | 1742 | } |
1743 | - if(!empty($color_i)){ |
|
1744 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
1743 | + if (!empty($color_i)) { |
|
1744 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
1745 | 1745 | } |
1746 | 1746 | |
1747 | 1747 | // add any background color rules |
1748 | - if(!empty($background)){ |
|
1749 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
1748 | + if (!empty($background)) { |
|
1749 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
1750 | 1750 | } |
1751 | - if(!empty($background_i)){ |
|
1752 | - $output .= $aui_bs5 ? '' : implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
1751 | + if (!empty($background_i)) { |
|
1752 | + $output .= $aui_bs5 ? '' : implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
1753 | 1753 | // $output .= implode(",",$background_i) . "{background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important;} "; |
1754 | 1754 | } |
1755 | 1755 | |
1756 | 1756 | // add any border color rules |
1757 | - if(!empty($border)){ |
|
1758 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
1757 | + if (!empty($border)) { |
|
1758 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
1759 | 1759 | } |
1760 | - if(!empty($border_i)){ |
|
1761 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
1760 | + if (!empty($border_i)) { |
|
1761 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
1762 | 1762 | } |
1763 | 1763 | |
1764 | 1764 | // add any fill color rules |
1765 | - if(!empty($fill)){ |
|
1766 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
1765 | + if (!empty($fill)) { |
|
1766 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
1767 | 1767 | } |
1768 | - if(!empty($fill_i)){ |
|
1769 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
1768 | + if (!empty($fill_i)) { |
|
1769 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
1770 | 1770 | } |
1771 | 1771 | |
1772 | 1772 | |
@@ -1774,27 +1774,27 @@ discard block |
||
1774 | 1774 | |
1775 | 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 | 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"); |
|
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 | 1781 | |
1782 | 1782 | // lighten |
1783 | - $lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25"); |
|
1783 | + $lighten_25 = $is_var ? $color_code . ';filter:brightness(1.25)' : self::css_hex_lighten_darken($color_code, "0.25"); |
|
1784 | 1784 | |
1785 | 1785 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
1786 | - $op_25 = $color_code."40"; // 25% opacity |
|
1786 | + $op_25 = $color_code . "40"; // 25% opacity |
|
1787 | 1787 | |
1788 | 1788 | |
1789 | 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.";} "; |
|
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 | 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;} "; |
|
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 | 1796 | |
1797 | - if ( $type == 'primary' ) { |
|
1797 | + if ($type == 'primary') { |
|
1798 | 1798 | // dropdown's |
1799 | 1799 | $output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} "; |
1800 | 1800 | |
@@ -1806,9 +1806,9 @@ discard block |
||
1806 | 1806 | } |
1807 | 1807 | |
1808 | 1808 | // alerts |
1809 | - if ( $aui_bs5 ) { |
|
1809 | + if ($aui_bs5) { |
|
1810 | 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;} "; |
|
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 | 1812 | } |
1813 | 1813 | |
1814 | 1814 | return $output; |
@@ -1824,11 +1824,11 @@ discard block |
||
1824 | 1824 | * |
1825 | 1825 | * @return string |
1826 | 1826 | */ |
1827 | - public static function css_primary($color_code,$compatibility, $use_variable = false){ |
|
1827 | + public static function css_primary($color_code, $compatibility, $use_variable = false) { |
|
1828 | 1828 | |
1829 | - if(!$use_variable){ |
|
1829 | + if (!$use_variable) { |
|
1830 | 1830 | $color_code = sanitize_hex_color($color_code); |
1831 | - if(!$color_code){return '';} |
|
1831 | + if (!$color_code) {return ''; } |
|
1832 | 1832 | } |
1833 | 1833 | |
1834 | 1834 | /** |
@@ -1836,36 +1836,36 @@ discard block |
||
1836 | 1836 | */ |
1837 | 1837 | $selectors = array( |
1838 | 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'), |
|
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 | 1847 | '.btn-link' => array('c'), |
1848 | 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'), |
|
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 | 1851 | // '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules... |
1852 | 1852 | // '.custom-range::-moz-range-thumb' => array('b'), |
1853 | 1853 | // '.custom-range::-ms-thumb' => array('b'), |
1854 | 1854 | '.nav-pills .nav-link.active' => array('b'), |
1855 | 1855 | '.nav-pills .show>.nav-link' => array('b'), |
1856 | 1856 | '.page-link' => array('c'), |
1857 | - '.page-item.active .page-link' => array('b','o'), |
|
1857 | + '.page-item.active .page-link' => array('b', 'o'), |
|
1858 | 1858 | '.badge-primary' => array('b'), |
1859 | - '.alert-primary' => array('b','o'), |
|
1859 | + '.alert-primary' => array('b', 'o'), |
|
1860 | 1860 | '.progress-bar' => array('b'), |
1861 | - '.list-group-item.active' => array('b','o'), |
|
1862 | - '.bg-primary' => array('b','f'), |
|
1861 | + '.list-group-item.active' => array('b', 'o'), |
|
1862 | + '.bg-primary' => array('b', 'f'), |
|
1863 | 1863 | '.btn-link.btn-primary' => array('c'), |
1864 | 1864 | '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'), |
1865 | 1865 | ); |
1866 | 1866 | |
1867 | 1867 | $important_selectors = array( |
1868 | - '.bg-primary' => array('b','f'), |
|
1868 | + '.bg-primary' => array('b', 'f'), |
|
1869 | 1869 | '.border-primary' => array('o'), |
1870 | 1870 | '.text-primary' => array('c'), |
1871 | 1871 | ); |
@@ -1882,88 +1882,88 @@ discard block |
||
1882 | 1882 | $output = ''; |
1883 | 1883 | |
1884 | 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;} |
|
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 | 1892 | } |
1893 | 1893 | |
1894 | 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;} |
|
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 | 1902 | } |
1903 | 1903 | |
1904 | 1904 | // add any color rules |
1905 | - if(!empty($color)){ |
|
1906 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
1905 | + if (!empty($color)) { |
|
1906 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
1907 | 1907 | } |
1908 | - if(!empty($color_i)){ |
|
1909 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
1908 | + if (!empty($color_i)) { |
|
1909 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
1910 | 1910 | } |
1911 | 1911 | |
1912 | 1912 | // add any background color rules |
1913 | - if(!empty($background)){ |
|
1914 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
1913 | + if (!empty($background)) { |
|
1914 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
1915 | 1915 | } |
1916 | - if(!empty($background_i)){ |
|
1917 | - $output .= implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
1916 | + if (!empty($background_i)) { |
|
1917 | + $output .= implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
1918 | 1918 | } |
1919 | 1919 | |
1920 | 1920 | // add any border color rules |
1921 | - if(!empty($border)){ |
|
1922 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
1921 | + if (!empty($border)) { |
|
1922 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
1923 | 1923 | } |
1924 | - if(!empty($border_i)){ |
|
1925 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
1924 | + if (!empty($border_i)) { |
|
1925 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
1926 | 1926 | } |
1927 | 1927 | |
1928 | 1928 | // add any fill color rules |
1929 | - if(!empty($fill)){ |
|
1930 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
1929 | + if (!empty($fill)) { |
|
1930 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
1931 | 1931 | } |
1932 | - if(!empty($fill_i)){ |
|
1933 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
1932 | + if (!empty($fill_i)) { |
|
1933 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
1934 | 1934 | } |
1935 | 1935 | |
1936 | 1936 | |
1937 | 1937 | $prefix = $compatibility ? ".bsui " : ""; |
1938 | 1938 | |
1939 | 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"); |
|
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 | 1943 | |
1944 | 1944 | // lighten |
1945 | - $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25"); |
|
1945 | + $lighten_25 = self::css_hex_lighten_darken($color_code, "0.25"); |
|
1946 | 1946 | |
1947 | 1947 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
1948 | - $op_25 = $color_code."40"; // 25% opacity |
|
1948 | + $op_25 = $color_code . "40"; // 25% opacity |
|
1949 | 1949 | |
1950 | 1950 | |
1951 | 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;} "; |
|
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 | 1956 | |
1957 | 1957 | |
1958 | 1958 | // dropdown's |
1959 | - $output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} "; |
|
1959 | + $output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} "; |
|
1960 | 1960 | |
1961 | 1961 | |
1962 | 1962 | // input states |
1963 | - $output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
1963 | + $output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
1964 | 1964 | |
1965 | 1965 | // page link |
1966 | - $output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
1966 | + $output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
1967 | 1967 | |
1968 | 1968 | return $output; |
1969 | 1969 | } |
@@ -1977,30 +1977,30 @@ discard block |
||
1977 | 1977 | * |
1978 | 1978 | * @return string |
1979 | 1979 | */ |
1980 | - public static function css_secondary($color_code,$compatibility){; |
|
1980 | + public static function css_secondary($color_code, $compatibility) {; |
|
1981 | 1981 | $color_code = sanitize_hex_color($color_code); |
1982 | - if(!$color_code){return '';} |
|
1982 | + if (!$color_code) {return ''; } |
|
1983 | 1983 | /** |
1984 | 1984 | * c = color, b = background color, o = border-color, f = fill |
1985 | 1985 | */ |
1986 | 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'), |
|
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 | 1992 | '.btn-outline-secondary.disabled' => array('c'), |
1993 | 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'), |
|
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 | 1997 | '.badge-secondary' => array('b'), |
1998 | - '.alert-secondary' => array('b','o'), |
|
1998 | + '.alert-secondary' => array('b', 'o'), |
|
1999 | 1999 | '.btn-link.btn-secondary' => array('c'), |
2000 | 2000 | ); |
2001 | 2001 | |
2002 | 2002 | $important_selectors = array( |
2003 | - '.bg-secondary' => array('b','f'), |
|
2003 | + '.bg-secondary' => array('b', 'f'), |
|
2004 | 2004 | '.border-secondary' => array('o'), |
2005 | 2005 | '.text-secondary' => array('c'), |
2006 | 2006 | ); |
@@ -2017,77 +2017,77 @@ discard block |
||
2017 | 2017 | $output = ''; |
2018 | 2018 | |
2019 | 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;} |
|
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 | 2027 | } |
2028 | 2028 | |
2029 | 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;} |
|
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 | 2037 | } |
2038 | 2038 | |
2039 | 2039 | // add any color rules |
2040 | - if(!empty($color)){ |
|
2041 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
2040 | + if (!empty($color)) { |
|
2041 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
2042 | 2042 | } |
2043 | - if(!empty($color_i)){ |
|
2044 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
2043 | + if (!empty($color_i)) { |
|
2044 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
2045 | 2045 | } |
2046 | 2046 | |
2047 | 2047 | // add any background color rules |
2048 | - if(!empty($background)){ |
|
2049 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
2048 | + if (!empty($background)) { |
|
2049 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
2050 | 2050 | } |
2051 | - if(!empty($background_i)){ |
|
2052 | - $output .= implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
2051 | + if (!empty($background_i)) { |
|
2052 | + $output .= implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
2053 | 2053 | } |
2054 | 2054 | |
2055 | 2055 | // add any border color rules |
2056 | - if(!empty($border)){ |
|
2057 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
2056 | + if (!empty($border)) { |
|
2057 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
2058 | 2058 | } |
2059 | - if(!empty($border_i)){ |
|
2060 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
2059 | + if (!empty($border_i)) { |
|
2060 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
2061 | 2061 | } |
2062 | 2062 | |
2063 | 2063 | // add any fill color rules |
2064 | - if(!empty($fill)){ |
|
2065 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
2064 | + if (!empty($fill)) { |
|
2065 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
2066 | 2066 | } |
2067 | - if(!empty($fill_i)){ |
|
2068 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
2067 | + if (!empty($fill_i)) { |
|
2068 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
2069 | 2069 | } |
2070 | 2070 | |
2071 | 2071 | |
2072 | 2072 | $prefix = $compatibility ? ".bsui " : ""; |
2073 | 2073 | |
2074 | 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"); |
|
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 | 2078 | |
2079 | 2079 | // lighten |
2080 | - $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25"); |
|
2080 | + $lighten_25 = self::css_hex_lighten_darken($color_code, "0.25"); |
|
2081 | 2081 | |
2082 | 2082 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
2083 | - $op_25 = $color_code."40"; // 25% opacity |
|
2083 | + $op_25 = $color_code . "40"; // 25% opacity |
|
2084 | 2084 | |
2085 | 2085 | |
2086 | 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;} "; |
|
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 | 2091 | |
2092 | 2092 | |
2093 | 2093 | return $output; |
@@ -2104,7 +2104,7 @@ discard block |
||
2104 | 2104 | public static function css_hex_lighten_darken($hexCode, $adjustPercent) { |
2105 | 2105 | $hexCode = ltrim($hexCode, '#'); |
2106 | 2106 | |
2107 | - if ( strpos( $hexCode, 'rgba(' ) !== false || strpos( $hexCode, 'rgb(' ) !== false ) { |
|
2107 | + if (strpos($hexCode, 'rgba(') !== false || strpos($hexCode, 'rgb(') !== false) { |
|
2108 | 2108 | return $hexCode; |
2109 | 2109 | } |
2110 | 2110 | |
@@ -2127,8 +2127,8 @@ discard block |
||
2127 | 2127 | /** |
2128 | 2128 | * Check if we should display examples. |
2129 | 2129 | */ |
2130 | - public function maybe_show_examples(){ |
|
2131 | - if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){ |
|
2130 | + public function maybe_show_examples() { |
|
2131 | + if (current_user_can('manage_options') && isset($_REQUEST['preview-aui'])) { |
|
2132 | 2132 | echo "<head>"; |
2133 | 2133 | wp_head(); |
2134 | 2134 | echo "</head>"; |
@@ -2144,7 +2144,7 @@ discard block |
||
2144 | 2144 | * |
2145 | 2145 | * @return string |
2146 | 2146 | */ |
2147 | - public function get_examples(){ |
|
2147 | + public function get_examples() { |
|
2148 | 2148 | $output = ''; |
2149 | 2149 | |
2150 | 2150 | |
@@ -2250,74 +2250,74 @@ discard block |
||
2250 | 2250 | */ |
2251 | 2251 | public static function calendar_params() { |
2252 | 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' ), |
|
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 | 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' ) |
|
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 | 2318 | ); |
2319 | 2319 | |
2320 | - return apply_filters( 'ayecode_ui_calendar_params', $params ); |
|
2320 | + return apply_filters('ayecode_ui_calendar_params', $params); |
|
2321 | 2321 | } |
2322 | 2322 | |
2323 | 2323 | /** |
@@ -2330,47 +2330,47 @@ discard block |
||
2330 | 2330 | public static function flatpickr_locale() { |
2331 | 2331 | $params = self::calendar_params(); |
2332 | 2332 | |
2333 | - if ( is_string( $params ) ) { |
|
2334 | - $params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' ); |
|
2333 | + if (is_string($params)) { |
|
2334 | + $params = html_entity_decode($params, ENT_QUOTES, 'UTF-8'); |
|
2335 | 2335 | } else { |
2336 | - foreach ( (array) $params as $key => $value ) { |
|
2337 | - if ( ! is_scalar( $value ) ) { |
|
2336 | + foreach ((array) $params as $key => $value) { |
|
2337 | + if (!is_scalar($value)) { |
|
2338 | 2338 | continue; |
2339 | 2339 | } |
2340 | 2340 | |
2341 | - $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); |
|
2341 | + $params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
2342 | 2342 | } |
2343 | 2343 | } |
2344 | 2344 | |
2345 | 2345 | $day_s3 = array(); |
2346 | 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 |
|
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 | 2351 | } |
2352 | 2352 | |
2353 | 2353 | $month_s = array(); |
2354 | 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 |
|
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 | 2359 | } |
2360 | 2360 | |
2361 | 2361 | ob_start(); |
2362 | - if ( 0 ) { ?><script><?php } ?> |
|
2362 | + if (0) { ?><script><?php } ?> |
|
2363 | 2363 | { |
2364 | 2364 | weekdays: { |
2365 | - shorthand: ['<?php echo implode( "','", $day_s3 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2366 | - longhand: ['<?php echo implode( "','", $day_s5 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2365 | + shorthand: ['<?php echo implode("','", $day_s3); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2366 | + longhand: ['<?php echo implode("','", $day_s5); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2367 | 2367 | }, |
2368 | 2368 | months: { |
2369 | - shorthand: ['<?php echo implode( "','", $month_s ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2370 | - longhand: ['<?php echo implode( "','", $month_long ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2369 | + shorthand: ['<?php echo implode("','", $month_s); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2370 | + longhand: ['<?php echo implode("','", $month_long); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2371 | 2371 | }, |
2372 | 2372 | daysInMonth: [31,28,31,30,31,30,31,31,30,31,30,31], |
2373 | - firstDayOfWeek: <?php echo (int) $params[ 'firstDayOfWeek' ]; ?>, |
|
2373 | + firstDayOfWeek: <?php echo (int) $params['firstDayOfWeek']; ?>, |
|
2374 | 2374 | ordinal: function (nth) { |
2375 | 2375 | var s = nth % 100; |
2376 | 2376 | if (s > 3 && s < 21) |
@@ -2386,21 +2386,21 @@ discard block |
||
2386 | 2386 | return "th"; |
2387 | 2387 | } |
2388 | 2388 | }, |
2389 | - rangeSeparator: '<?php echo esc_attr( $params[ 'rangeSeparator' ] ); ?>', |
|
2390 | - weekAbbreviation: '<?php echo esc_attr( $params[ 'weekAbbreviation' ] ); ?>', |
|
2391 | - scrollTitle: '<?php echo esc_attr( $params[ 'scrollTitle' ] ); ?>', |
|
2392 | - toggleTitle: '<?php echo esc_attr( $params[ 'toggleTitle' ] ); ?>', |
|
2393 | - amPM: ['<?php echo esc_attr( $params[ 'am_upper' ] ); ?>','<?php echo esc_attr( $params[ 'pm_upper' ] ); ?>'], |
|
2394 | - yearAriaLabel: '<?php echo esc_attr( $params[ 'year' ] ); ?>', |
|
2395 | - hourAriaLabel: '<?php echo esc_attr( $params[ 'hour' ] ); ?>', |
|
2396 | - minuteAriaLabel: '<?php echo esc_attr( $params[ 'minute' ] ); ?>', |
|
2397 | - time_24hr: <?php echo ( $params[ 'time_24hr' ] ? 'true' : 'false' ) ; ?> |
|
2389 | + rangeSeparator: '<?php echo esc_attr($params['rangeSeparator']); ?>', |
|
2390 | + weekAbbreviation: '<?php echo esc_attr($params['weekAbbreviation']); ?>', |
|
2391 | + scrollTitle: '<?php echo esc_attr($params['scrollTitle']); ?>', |
|
2392 | + toggleTitle: '<?php echo esc_attr($params['toggleTitle']); ?>', |
|
2393 | + amPM: ['<?php echo esc_attr($params['am_upper']); ?>','<?php echo esc_attr($params['pm_upper']); ?>'], |
|
2394 | + yearAriaLabel: '<?php echo esc_attr($params['year']); ?>', |
|
2395 | + hourAriaLabel: '<?php echo esc_attr($params['hour']); ?>', |
|
2396 | + minuteAriaLabel: '<?php echo esc_attr($params['minute']); ?>', |
|
2397 | + time_24hr: <?php echo ($params['time_24hr'] ? 'true' : 'false'); ?> |
|
2398 | 2398 | } |
2399 | - <?php if ( 0 ) { ?></script><?php } ?> |
|
2399 | + <?php if (0) { ?></script><?php } ?> |
|
2400 | 2400 | <?php |
2401 | 2401 | $locale = ob_get_clean(); |
2402 | 2402 | |
2403 | - return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) ); |
|
2403 | + return apply_filters('ayecode_ui_flatpickr_locale', trim($locale)); |
|
2404 | 2404 | } |
2405 | 2405 | |
2406 | 2406 | /** |
@@ -2412,20 +2412,20 @@ discard block |
||
2412 | 2412 | */ |
2413 | 2413 | public static function select2_params() { |
2414 | 2414 | $params = array( |
2415 | - 'i18n_select_state_text' => esc_attr__( 'Select an option…', '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…', 'enhanced select', 'ayecode-connect' ), |
|
2425 | - 'i18n_searching' => _x( 'Searching…', 'enhanced select', 'ayecode-connect' ) |
|
2415 | + 'i18n_select_state_text' => esc_attr__('Select an option…', '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…', 'enhanced select', 'ayecode-connect'), |
|
2425 | + 'i18n_searching' => _x('Searching…', 'enhanced select', 'ayecode-connect') |
|
2426 | 2426 | ); |
2427 | 2427 | |
2428 | - return apply_filters( 'ayecode_ui_select2_params', $params ); |
|
2428 | + return apply_filters('ayecode_ui_select2_params', $params); |
|
2429 | 2429 | } |
2430 | 2430 | |
2431 | 2431 | /** |
@@ -2438,17 +2438,17 @@ discard block |
||
2438 | 2438 | public static function select2_locale() { |
2439 | 2439 | $params = self::select2_params(); |
2440 | 2440 | |
2441 | - foreach ( (array) $params as $key => $value ) { |
|
2442 | - if ( ! is_scalar( $value ) ) { |
|
2441 | + foreach ((array) $params as $key => $value) { |
|
2442 | + if (!is_scalar($value)) { |
|
2443 | 2443 | continue; |
2444 | 2444 | } |
2445 | 2445 | |
2446 | - $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); |
|
2446 | + $params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
2447 | 2447 | } |
2448 | 2448 | |
2449 | - $locale = json_encode( $params ); |
|
2449 | + $locale = json_encode($params); |
|
2450 | 2450 | |
2451 | - return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) ); |
|
2451 | + return apply_filters('ayecode_ui_select2_locale', trim($locale)); |
|
2452 | 2452 | } |
2453 | 2453 | |
2454 | 2454 | /** |
@@ -2461,35 +2461,35 @@ discard block |
||
2461 | 2461 | public static function timeago_locale() { |
2462 | 2462 | $params = array( |
2463 | 2463 | 'prefix_ago' => '', |
2464 | - 'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'ayecode-connect' ), |
|
2465 | - 'prefix_after' => _x( 'after', 'time ago', 'ayecode-connect' ) . ' ', |
|
2464 | + 'suffix_ago' => ' ' . _x('ago', 'time ago', 'ayecode-connect'), |
|
2465 | + 'prefix_after' => _x('after', 'time ago', 'ayecode-connect') . ' ', |
|
2466 | 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' ), |
|
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 | 2478 | ); |
2479 | 2479 | |
2480 | - $params = apply_filters( 'ayecode_ui_timeago_params', $params ); |
|
2480 | + $params = apply_filters('ayecode_ui_timeago_params', $params); |
|
2481 | 2481 | |
2482 | - foreach ( (array) $params as $key => $value ) { |
|
2483 | - if ( ! is_scalar( $value ) ) { |
|
2482 | + foreach ((array) $params as $key => $value) { |
|
2483 | + if (!is_scalar($value)) { |
|
2484 | 2484 | continue; |
2485 | 2485 | } |
2486 | 2486 | |
2487 | - $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); |
|
2487 | + $params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
2488 | 2488 | } |
2489 | 2489 | |
2490 | - $locale = json_encode( $params ); |
|
2490 | + $locale = json_encode($params); |
|
2491 | 2491 | |
2492 | - return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) ); |
|
2492 | + return apply_filters('ayecode_ui_timeago_locale', trim($locale)); |
|
2493 | 2493 | } |
2494 | 2494 | |
2495 | 2495 | /** |
@@ -2500,7 +2500,7 @@ discard block |
||
2500 | 2500 | * @return mixed |
2501 | 2501 | */ |
2502 | 2502 | public static function minify_js($input) { |
2503 | - if(trim($input) === "") return $input; |
|
2503 | + if (trim($input) === "") return $input; |
|
2504 | 2504 | return preg_replace( |
2505 | 2505 | array( |
2506 | 2506 | // Remove comment(s) |
@@ -2532,7 +2532,7 @@ discard block |
||
2532 | 2532 | * @return mixed |
2533 | 2533 | */ |
2534 | 2534 | public static function minify_css($input) { |
2535 | - if(trim($input) === "") return $input; |
|
2535 | + if (trim($input) === "") return $input; |
|
2536 | 2536 | return preg_replace( |
2537 | 2537 | array( |
2538 | 2538 | // Remove comment(s) |
@@ -3109,12 +3109,12 @@ discard block |
||
3109 | 3109 | }); |
3110 | 3110 | } |
3111 | 3111 | } |
3112 | - <?php do_action( 'aui_conditional_fields_js', $this ); ?> |
|
3112 | + <?php do_action('aui_conditional_fields_js', $this); ?> |
|
3113 | 3113 | </script> |
3114 | 3114 | <?php |
3115 | 3115 | $output = ob_get_clean(); |
3116 | 3116 | |
3117 | - return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) ); |
|
3117 | + return str_replace(array('<script>', '</script>'), '', self::minify_js($output)); |
|
3118 | 3118 | } |
3119 | 3119 | |
3120 | 3120 | /** |
@@ -3125,10 +3125,10 @@ discard block |
||
3125 | 3125 | * @return bool |
3126 | 3126 | */ |
3127 | 3127 | public static function is_block_editor() { |
3128 | - if ( is_admin() ) { |
|
3129 | - $current_screen = function_exists('get_current_screen' ) ? get_current_screen() : array(); |
|
3128 | + if (is_admin()) { |
|
3129 | + $current_screen = function_exists('get_current_screen') ? get_current_screen() : array(); |
|
3130 | 3130 | |
3131 | - if ( ! empty( $current_screen ) && $current_screen->is_block_editor() ) { |
|
3131 | + if (!empty($current_screen) && $current_screen->is_block_editor()) { |
|
3132 | 3132 | return true; |
3133 | 3133 | } |
3134 | 3134 | } |
@@ -3147,7 +3147,7 @@ discard block |
||
3147 | 3147 | */ |
3148 | 3148 | public static function is_block_content_call() { |
3149 | 3149 | $result = false; |
3150 | - if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) { |
|
3150 | + if (wp_doing_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'super_duper_output_shortcode') { |
|
3151 | 3151 | $result = true; |
3152 | 3152 | } |
3153 | 3153 | |
@@ -3163,7 +3163,7 @@ discard block |
||
3163 | 3163 | */ |
3164 | 3164 | public static function is_divi_preview() { |
3165 | 3165 | $result = false; |
3166 | - if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) { |
|
3166 | + if (isset($_REQUEST['et_fb']) || isset($_REQUEST['et_pb_preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor')) { |
|
3167 | 3167 | $result = true; |
3168 | 3168 | } |
3169 | 3169 | |
@@ -3180,7 +3180,7 @@ discard block |
||
3180 | 3180 | */ |
3181 | 3181 | public static function is_elementor_preview() { |
3182 | 3182 | $result = false; |
3183 | - if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) { |
|
3183 | + if (isset($_REQUEST['elementor-preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor_ajax')) { |
|
3184 | 3184 | $result = true; |
3185 | 3185 | } |
3186 | 3186 | |
@@ -3196,7 +3196,7 @@ discard block |
||
3196 | 3196 | */ |
3197 | 3197 | public static function is_beaver_preview() { |
3198 | 3198 | $result = false; |
3199 | - if ( isset( $_REQUEST['fl_builder'] ) ) { |
|
3199 | + if (isset($_REQUEST['fl_builder'])) { |
|
3200 | 3200 | $result = true; |
3201 | 3201 | } |
3202 | 3202 | |
@@ -3212,7 +3212,7 @@ discard block |
||
3212 | 3212 | */ |
3213 | 3213 | public static function is_siteorigin_preview() { |
3214 | 3214 | $result = false; |
3215 | - if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) { |
|
3215 | + if (!empty($_REQUEST['siteorigin_panels_live_editor'])) { |
|
3216 | 3216 | $result = true; |
3217 | 3217 | } |
3218 | 3218 | |
@@ -3228,7 +3228,7 @@ discard block |
||
3228 | 3228 | */ |
3229 | 3229 | public static function is_cornerstone_preview() { |
3230 | 3230 | $result = false; |
3231 | - if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) { |
|
3231 | + if (!empty($_REQUEST['cornerstone_preview']) || basename($_SERVER['REQUEST_URI']) == 'cornerstone-endpoint') { |
|
3232 | 3232 | $result = true; |
3233 | 3233 | } |
3234 | 3234 | |
@@ -3243,7 +3243,7 @@ discard block |
||
3243 | 3243 | */ |
3244 | 3244 | public static function is_fusion_preview() { |
3245 | 3245 | $result = false; |
3246 | - if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) { |
|
3246 | + if (!empty($_REQUEST['fb-edit']) || !empty($_REQUEST['fusion_load_nonce'])) { |
|
3247 | 3247 | $result = true; |
3248 | 3248 | } |
3249 | 3249 | |
@@ -3258,7 +3258,7 @@ discard block |
||
3258 | 3258 | */ |
3259 | 3259 | public static function is_oxygen_preview() { |
3260 | 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_" ) ) ) { |
|
3261 | + if (!empty($_REQUEST['ct_builder']) || (!empty($_REQUEST['action']) && (substr($_REQUEST['action'], 0, 11) === "oxy_render_" || substr($_REQUEST['action'], 0, 10) === "ct_render_"))) { |
|
3262 | 3262 | $result = true; |
3263 | 3263 | } |
3264 | 3264 | |
@@ -3275,7 +3275,7 @@ discard block |
||
3275 | 3275 | public static function is_kallyas_zion_preview() { |
3276 | 3276 | $result = false; |
3277 | 3277 | |
3278 | - if ( function_exists( 'znhg_kallyas_theme_config' ) && ! empty( $_REQUEST['zn_pb_edit'] ) ) { |
|
3278 | + if (function_exists('znhg_kallyas_theme_config') && !empty($_REQUEST['zn_pb_edit'])) { |
|
3279 | 3279 | $result = true; |
3280 | 3280 | } |
3281 | 3281 | |
@@ -3292,7 +3292,7 @@ discard block |
||
3292 | 3292 | public static function is_bricks_preview() { |
3293 | 3293 | $result = false; |
3294 | 3294 | |
3295 | - if ( function_exists( 'bricks_is_builder' ) && ( bricks_is_builder() || bricks_is_builder_call() ) ) { |
|
3295 | + if (function_exists('bricks_is_builder') && (bricks_is_builder() || bricks_is_builder_call())) { |
|
3296 | 3296 | $result = true; |
3297 | 3297 | } |
3298 | 3298 | |
@@ -3309,29 +3309,29 @@ discard block |
||
3309 | 3309 | public static function is_preview() { |
3310 | 3310 | $preview = false; |
3311 | 3311 | |
3312 | - if ( self::is_block_editor() ) { |
|
3312 | + if (self::is_block_editor()) { |
|
3313 | 3313 | return true; |
3314 | 3314 | } |
3315 | 3315 | |
3316 | - if( self::is_block_content_call() ) { |
|
3316 | + if (self::is_block_content_call()) { |
|
3317 | 3317 | $preview = true; |
3318 | - } elseif ( self::is_divi_preview() ) { |
|
3318 | + } elseif (self::is_divi_preview()) { |
|
3319 | 3319 | $preview = true; |
3320 | - } elseif ( self::is_elementor_preview() ) { |
|
3320 | + } elseif (self::is_elementor_preview()) { |
|
3321 | 3321 | $preview = true; |
3322 | - } elseif ( self::is_beaver_preview() ) { |
|
3322 | + } elseif (self::is_beaver_preview()) { |
|
3323 | 3323 | $preview = true; |
3324 | - } elseif ( self::is_siteorigin_preview() ) { |
|
3324 | + } elseif (self::is_siteorigin_preview()) { |
|
3325 | 3325 | $preview = true; |
3326 | - } elseif ( self::is_cornerstone_preview() ) { |
|
3326 | + } elseif (self::is_cornerstone_preview()) { |
|
3327 | 3327 | $preview = true; |
3328 | - } elseif ( self::is_fusion_preview() ) { |
|
3328 | + } elseif (self::is_fusion_preview()) { |
|
3329 | 3329 | $preview = true; |
3330 | - } elseif ( self::is_oxygen_preview() ) { |
|
3330 | + } elseif (self::is_oxygen_preview()) { |
|
3331 | 3331 | $preview = true; |
3332 | - } elseif( self::is_kallyas_zion_preview() ) { |
|
3332 | + } elseif (self::is_kallyas_zion_preview()) { |
|
3333 | 3333 | $preview = true; |
3334 | - } elseif( self::is_bricks_preview() ) { |
|
3334 | + } elseif (self::is_bricks_preview()) { |
|
3335 | 3335 | $preview = true; |
3336 | 3336 | } |
3337 | 3337 |
@@ -6,39 +6,39 @@ |
||
6 | 6 | /** |
7 | 7 | * Bail if we are not in WP. |
8 | 8 | */ |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if (!defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Set the version only if its the current newest while loading. |
15 | 15 | */ |
16 | -add_action('after_setup_theme', function () { |
|
17 | - global $ayecode_ui_version,$ayecode_ui_file_key; |
|
16 | +add_action('after_setup_theme', function() { |
|
17 | + global $ayecode_ui_version, $ayecode_ui_file_key; |
|
18 | 18 | $this_version = "0.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__ ); |
|
19 | + if (empty($ayecode_ui_version) || version_compare($this_version, $ayecode_ui_version, '>')) { |
|
20 | + $ayecode_ui_version = $this_version; |
|
21 | + $ayecode_ui_file_key = wp_hash(__FILE__); |
|
22 | 22 | } |
23 | 23 | },0); |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Load this version of WP Bootstrap Settings only if the file hash is the current one. |
27 | 27 | */ |
28 | -add_action('after_setup_theme', function () { |
|
28 | +add_action('after_setup_theme', function() { |
|
29 | 29 | global $ayecode_ui_file_key; |
30 | - if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){ |
|
31 | - include_once( dirname( __FILE__ ) . '/includes/class-aui.php' ); |
|
32 | - include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' ); |
|
30 | + if ($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash(__FILE__)) { |
|
31 | + include_once(dirname(__FILE__) . '/includes/class-aui.php'); |
|
32 | + include_once(dirname(__FILE__) . '/includes/ayecode-ui-settings.php'); |
|
33 | 33 | } |
34 | 34 | },1); |
35 | 35 | |
36 | 36 | /** |
37 | 37 | * Add the function that calls the class. |
38 | 38 | */ |
39 | -if(!function_exists('aui')){ |
|
40 | - function aui(){ |
|
41 | - if(!class_exists("AUI",false)){ |
|
39 | +if (!function_exists('aui')) { |
|
40 | + function aui() { |
|
41 | + if (!class_exists("AUI", false)) { |
|
42 | 42 | return false; |
43 | 43 | } |
44 | 44 | return AUI::instance(); |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if (!defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
6 | -if ( ! class_exists( 'WP_Super_Duper' ) ) { |
|
6 | +if (!class_exists('WP_Super_Duper')) { |
|
7 | 7 | |
8 | - define( 'SUPER_DUPER_VER', '1.2.14' ); |
|
8 | + define('SUPER_DUPER_VER', '1.2.14'); |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress. |
@@ -38,40 +38,40 @@ discard block |
||
38 | 38 | /** |
39 | 39 | * Take the array options and use them to build. |
40 | 40 | */ |
41 | - public function __construct( $options ) { |
|
41 | + public function __construct($options) { |
|
42 | 42 | global $sd_widgets; |
43 | 43 | |
44 | - $sd_widgets[ $options['base_id'] ] = array( |
|
44 | + $sd_widgets[$options['base_id']] = array( |
|
45 | 45 | 'name' => $options['name'], |
46 | 46 | 'class_name' => $options['class_name'], |
47 | 47 | 'output_types' => !empty($options['output_types']) ? $options['output_types'] : array() |
48 | 48 | ); |
49 | - $this->base_id = $options['base_id']; |
|
49 | + $this->base_id = $options['base_id']; |
|
50 | 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 ); |
|
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 | 54 | $this->options = $options; |
55 | 55 | |
56 | 56 | $this->base_id = $options['base_id']; |
57 | - $this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array(); |
|
57 | + $this->arguments = isset($options['arguments']) ? $options['arguments'] : array(); |
|
58 | 58 | |
59 | 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'); |
|
60 | + if (!empty($this->options['nested-block'])) { |
|
61 | + if (empty($this->options['output_types'])) { |
|
62 | + $this->options['output_types'] = array('shortcode', 'block'); |
|
63 | 63 | }elseif (($key = array_search('widget', $this->options['output_types'])) !== false) { |
64 | 64 | unset($this->options['output_types'][$key]); |
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | 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'] ); |
|
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 | 71 | } |
72 | 72 | |
73 | 73 | |
74 | - if ( isset( $options['class_name'] ) ) { |
|
74 | + if (isset($options['class_name'])) { |
|
75 | 75 | // register widget |
76 | 76 | $this->class_name = $options['class_name']; |
77 | 77 | |
@@ -80,62 +80,62 @@ discard block |
||
80 | 80 | |
81 | 81 | |
82 | 82 | // Fusion Builder (avada) support |
83 | - if ( function_exists( 'fusion_builder_map' ) ) { |
|
84 | - add_action( 'init', array( $this, 'register_fusion_element' ) ); |
|
83 | + if (function_exists('fusion_builder_map')) { |
|
84 | + add_action('init', array($this, 'register_fusion_element')); |
|
85 | 85 | } |
86 | 86 | |
87 | 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' ) ); |
|
88 | + if (empty($this->options['output_types']) || in_array('block', $this->options['output_types'])) { |
|
89 | + add_action('admin_enqueue_scripts', array($this, 'register_block')); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
93 | 93 | // add the CSS and JS we need ONCE |
94 | 94 | global $sd_widget_scripts; |
95 | 95 | |
96 | - if ( ! $sd_widget_scripts ) { |
|
97 | - wp_add_inline_script( 'admin-widgets', $this->widget_js() ); |
|
98 | - wp_add_inline_script( 'customize-controls', $this->widget_js() ); |
|
99 | - wp_add_inline_style( 'widgets', $this->widget_css() ); |
|
96 | + if (!$sd_widget_scripts) { |
|
97 | + wp_add_inline_script('admin-widgets', $this->widget_js()); |
|
98 | + wp_add_inline_script('customize-controls', $this->widget_js()); |
|
99 | + wp_add_inline_style('widgets', $this->widget_css()); |
|
100 | 100 | |
101 | 101 | // maybe add elementor editor styles |
102 | - add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) ); |
|
102 | + add_action('elementor/editor/after_enqueue_styles', array($this, 'elementor_editor_styles')); |
|
103 | 103 | |
104 | 104 | $sd_widget_scripts = true; |
105 | 105 | |
106 | 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' ) ); |
|
107 | + add_action('media_buttons', array($this, 'wp_media_buttons'), 1); |
|
108 | + add_action('media_buttons', array($this, 'shortcode_insert_button')); |
|
109 | 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' ) ); |
|
110 | + if (function_exists('generate_sections_sections_metabox')) { |
|
111 | + add_action('generate_sections_metabox', array($this, 'shortcode_insert_button_script')); |
|
112 | 112 | } |
113 | 113 | /* Load script on Divi theme builder page */ |
114 | - if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) { |
|
114 | + if (function_exists('et_builder_is_tb_admin_screen') && et_builder_is_tb_admin_screen()) { |
|
115 | 115 | add_thickbox(); |
116 | - add_action( 'admin_footer', array( $this, 'shortcode_insert_button_script' ) ); |
|
116 | + add_action('admin_footer', array($this, 'shortcode_insert_button_script')); |
|
117 | 117 | } |
118 | 118 | |
119 | - if ( $this->is_preview() ) { |
|
120 | - add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) ); |
|
119 | + if ($this->is_preview()) { |
|
120 | + add_action('wp_footer', array($this, 'shortcode_insert_button_script')); |
|
121 | 121 | // this makes the insert button work for elementor |
122 | - add_action( 'elementor/editor/after_enqueue_scripts', array( |
|
122 | + add_action('elementor/editor/after_enqueue_scripts', array( |
|
123 | 123 | $this, |
124 | 124 | 'shortcode_insert_button_script' |
125 | - ) ); // for elementor |
|
125 | + )); // for elementor |
|
126 | 126 | } |
127 | 127 | // this makes the insert button work for cornerstone |
128 | - add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) ); |
|
128 | + add_action('wp_print_footer_scripts', array(__CLASS__, 'maybe_cornerstone_builder')); |
|
129 | 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' ) ); |
|
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 | 132 | |
133 | 133 | // add generator text to head |
134 | - add_action( 'admin_head', array( $this, 'generator' ), 99 ); |
|
135 | - add_action( 'wp_head', array( $this, 'generator' ), 99 ); |
|
134 | + add_action('admin_head', array($this, 'generator'), 99); |
|
135 | + add_action('wp_head', array($this, 'generator'), 99); |
|
136 | 136 | } |
137 | 137 | |
138 | - do_action( 'wp_super_duper_widget_init', $options, $this ); |
|
138 | + do_action('wp_super_duper_widget_init', $options, $this); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return void |
144 | 144 | */ |
145 | 145 | public function _register() { |
146 | - if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){ |
|
146 | + if (empty($this->options['output_types']) || in_array('widget', $this->options['output_types'])) { |
|
147 | 147 | parent::_register(); |
148 | 148 | } |
149 | 149 | } |
@@ -152,14 +152,14 @@ discard block |
||
152 | 152 | * Add our widget CSS to elementor editor. |
153 | 153 | */ |
154 | 154 | public function elementor_editor_styles() { |
155 | - wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) ); |
|
155 | + wp_add_inline_style('elementor-editor', $this->widget_css(false)); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | public function register_fusion_element() { |
159 | 159 | |
160 | 160 | $options = $this->options; |
161 | 161 | |
162 | - if ( $this->base_id ) { |
|
162 | + if ($this->base_id) { |
|
163 | 163 | |
164 | 164 | $params = $this->get_fusion_params(); |
165 | 165 | |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | 'allow_generator' => true, |
171 | 171 | ); |
172 | 172 | |
173 | - if ( ! empty( $params ) ) { |
|
173 | + if (!empty($params)) { |
|
174 | 174 | $args['params'] = $params; |
175 | 175 | } |
176 | 176 | |
177 | - fusion_builder_map( $args ); |
|
177 | + fusion_builder_map($args); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | } |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | $params = array(); |
184 | 184 | $arguments = $this->get_arguments(); |
185 | 185 | |
186 | - if ( ! empty( $arguments ) ) { |
|
187 | - foreach ( $arguments as $key => $val ) { |
|
186 | + if (!empty($arguments)) { |
|
187 | + foreach ($arguments as $key => $val) { |
|
188 | 188 | $param = array(); |
189 | 189 | // type |
190 | 190 | $param['type'] = str_replace( |
@@ -206,38 +206,38 @@ discard block |
||
206 | 206 | $val['type'] ); |
207 | 207 | |
208 | 208 | // multiselect |
209 | - if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) { |
|
209 | + if ($val['type'] == 'multiselect' || (($param['type'] == 'select' || $val['type'] == 'select') && !empty($val['multiple']))) { |
|
210 | 210 | $param['type'] = 'multiple_select'; |
211 | 211 | $param['multiple'] = true; |
212 | 212 | } |
213 | 213 | |
214 | 214 | // heading |
215 | - $param['heading'] = isset( $val['title'] ) ? $val['title'] : ''; |
|
215 | + $param['heading'] = isset($val['title']) ? $val['title'] : ''; |
|
216 | 216 | |
217 | 217 | // description |
218 | - $param['description'] = isset( $val['desc'] ) ? $val['desc'] : ''; |
|
218 | + $param['description'] = isset($val['desc']) ? $val['desc'] : ''; |
|
219 | 219 | |
220 | 220 | // param_name |
221 | 221 | $param['param_name'] = $key; |
222 | 222 | |
223 | 223 | // Default |
224 | - $param['default'] = isset( $val['default'] ) ? $val['default'] : ''; |
|
224 | + $param['default'] = isset($val['default']) ? $val['default'] : ''; |
|
225 | 225 | |
226 | 226 | // Group |
227 | - if ( isset( $val['group'] ) ) { |
|
227 | + if (isset($val['group'])) { |
|
228 | 228 | $param['group'] = $val['group']; |
229 | 229 | } |
230 | 230 | |
231 | 231 | // value |
232 | - if ( $val['type'] == 'checkbox' ) { |
|
233 | - if ( isset( $val['default'] ) && $val['default'] == '0' ) { |
|
234 | - unset( $param['default'] ); |
|
232 | + if ($val['type'] == 'checkbox') { |
|
233 | + if (isset($val['default']) && $val['default'] == '0') { |
|
234 | + unset($param['default']); |
|
235 | 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(); |
|
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 | 239 | } else { |
240 | - $param['value'] = isset( $val['default'] ) ? $val['default'] : ''; |
|
240 | + $param['value'] = isset($val['default']) ? $val['default'] : ''; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | // setup the param |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder |
255 | 255 | */ |
256 | 256 | public static function maybe_cornerstone_builder() { |
257 | - if ( did_action( 'cornerstone_before_boot_app' ) ) { |
|
257 | + if (did_action('cornerstone_before_boot_app')) { |
|
258 | 258 | self::shortcode_insert_button_script(); |
259 | 259 | } |
260 | 260 | } |
@@ -266,12 +266,12 @@ discard block |
||
266 | 266 | * |
267 | 267 | * @return string |
268 | 268 | */ |
269 | - public static function get_picker( $editor_id = '' ) { |
|
269 | + public static function get_picker($editor_id = '') { |
|
270 | 270 | |
271 | 271 | ob_start(); |
272 | - if ( isset( $_POST['editor_id'] ) ) { |
|
273 | - $editor_id = esc_attr( $_POST['editor_id'] ); |
|
274 | - } elseif ( isset( $_REQUEST['et_fb'] ) ) { |
|
272 | + if (isset($_POST['editor_id'])) { |
|
273 | + $editor_id = esc_attr($_POST['editor_id']); |
|
274 | + } elseif (isset($_REQUEST['et_fb'])) { |
|
275 | 275 | $editor_id = 'main_content_content_vb_tiny_mce'; |
276 | 276 | } |
277 | 277 | |
@@ -282,14 +282,14 @@ discard block |
||
282 | 282 | |
283 | 283 | <div class="sd-shortcode-left-wrap"> |
284 | 284 | <?php |
285 | - ksort( $sd_widgets ); |
|
285 | + ksort($sd_widgets); |
|
286 | 286 | // print_r($sd_widgets);exit; |
287 | - if ( ! empty( $sd_widgets ) ) { |
|
287 | + if (!empty($sd_widgets)) { |
|
288 | 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>"; |
|
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 | 293 | } |
294 | 294 | echo "</select>"; |
295 | 295 | |
@@ -302,37 +302,37 @@ discard block |
||
302 | 302 | <div class="sd-shortcode-right-wrap"> |
303 | 303 | <textarea id='sd-shortcode-output' disabled></textarea> |
304 | 304 | <div id='sd-shortcode-output-actions'> |
305 | - <?php if ( $editor_id != '' ) { ?> |
|
305 | + <?php if ($editor_id != '') { ?> |
|
306 | 306 | <button class="button sd-insert-shortcode-button" |
307 | - onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) { |
|
307 | + onclick="sd_insert_shortcode(<?php if (!empty($editor_id)) { |
|
308 | 308 | echo "'" . $editor_id . "'"; |
309 | - } ?>)"><?php _e( 'Insert shortcode', 'ayecode-connect' ); ?></button> |
|
309 | + } ?>)"><?php _e('Insert shortcode', 'ayecode-connect'); ?></button> |
|
310 | 310 | <?php } ?> |
311 | 311 | <button class="button" |
312 | - onclick="sd_copy_to_clipboard()"><?php _e( 'Copy shortcode' ); ?></button> |
|
312 | + onclick="sd_copy_to_clipboard()"><?php _e('Copy shortcode'); ?></button> |
|
313 | 313 | </div> |
314 | 314 | </div> |
315 | 315 | <?php |
316 | 316 | |
317 | 317 | $html = ob_get_clean(); |
318 | 318 | |
319 | - if ( wp_doing_ajax() ) { |
|
319 | + if (wp_doing_ajax()) { |
|
320 | 320 | echo $html; |
321 | 321 | $should_die = true; |
322 | 322 | |
323 | 323 | // some builder get the editor via ajax so we should not die on those occasions |
324 | 324 | $dont_die = array( |
325 | - 'parent_tag',// WP Bakery |
|
325 | + 'parent_tag', // WP Bakery |
|
326 | 326 | 'avia_request' // enfold |
327 | 327 | ); |
328 | 328 | |
329 | - foreach ( $dont_die as $request ) { |
|
330 | - if ( isset( $_REQUEST[ $request ] ) ) { |
|
329 | + foreach ($dont_die as $request) { |
|
330 | + if (isset($_REQUEST[$request])) { |
|
331 | 331 | $should_die = false; |
332 | 332 | } |
333 | 333 | } |
334 | 334 | |
335 | - if ( $should_die ) { |
|
335 | + if ($should_die) { |
|
336 | 336 | wp_die(); |
337 | 337 | } |
338 | 338 | |
@@ -348,22 +348,22 @@ discard block |
||
348 | 348 | * Output the version in the header. |
349 | 349 | */ |
350 | 350 | public function generator() { |
351 | - $file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) ); |
|
352 | - $plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) ); |
|
351 | + $file = str_replace(array("/", "\\"), "/", realpath(__FILE__)); |
|
352 | + $plugins_dir = str_replace(array("/", "\\"), "/", realpath(WP_PLUGIN_DIR)); |
|
353 | 353 | |
354 | 354 | // Find source plugin/theme of SD |
355 | 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() ) ); |
|
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 | 360 | |
361 | - if ( strpos( $file, $themes_dir ) !== false ) { |
|
362 | - $source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) ); |
|
361 | + if (strpos($file, $themes_dir) !== false) { |
|
362 | + $source = explode("/", ltrim(str_replace($themes_dir, "", $file), "/")); |
|
363 | 363 | } |
364 | 364 | } |
365 | 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] ) . '"' : '' ) . ' />'; |
|
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 | 367 | } |
368 | 368 | |
369 | 369 | /** |
@@ -374,16 +374,16 @@ discard block |
||
374 | 374 | public static function get_widget_settings() { |
375 | 375 | global $sd_widgets; |
376 | 376 | |
377 | - $shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : ''; |
|
378 | - if ( ! $shortcode ) { |
|
377 | + $shortcode = isset($_REQUEST['shortcode']) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes($_REQUEST['shortcode']) : ''; |
|
378 | + if (!$shortcode) { |
|
379 | 379 | wp_die(); |
380 | 380 | } |
381 | - $widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : ''; |
|
382 | - if ( ! $widget_args ) { |
|
381 | + $widget_args = isset($sd_widgets[$shortcode]) ? $sd_widgets[$shortcode] : ''; |
|
382 | + if (!$widget_args) { |
|
383 | 383 | wp_die(); |
384 | 384 | } |
385 | - $class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : ''; |
|
386 | - if ( ! $class_name ) { |
|
385 | + $class_name = isset($widget_args['class_name']) && $widget_args['class_name'] ? $widget_args['class_name'] : ''; |
|
386 | + if (!$class_name) { |
|
387 | 387 | wp_die(); |
388 | 388 | } |
389 | 389 | |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | $widget = new $class_name; |
392 | 392 | |
393 | 393 | ob_start(); |
394 | - $widget->form( array() ); |
|
394 | + $widget->form(array()); |
|
395 | 395 | $form = ob_get_clean(); |
396 | 396 | echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>"; |
397 | 397 | echo "<style>" . $widget->widget_css() . "</style>"; |
@@ -410,9 +410,9 @@ discard block |
||
410 | 410 | *@since 1.0.0 |
411 | 411 | * |
412 | 412 | */ |
413 | - public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) { |
|
413 | + public static function shortcode_insert_button($editor_id = '', $insert_shortcode_function = '') { |
|
414 | 414 | global $sd_widgets, $shortcode_insert_button_once; |
415 | - if ( $shortcode_insert_button_once ) { |
|
415 | + if ($shortcode_insert_button_once) { |
|
416 | 416 | return; |
417 | 417 | } |
418 | 418 | add_thickbox(); |
@@ -422,21 +422,21 @@ discard block |
||
422 | 422 | * Cornerstone makes us play dirty tricks :/ |
423 | 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 | 424 | */ |
425 | - if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) { |
|
425 | + if (function_exists('cornerstone_plugin_init') && !is_admin()) { |
|
426 | 426 | echo '<span id="insert-media-button">'; |
427 | 427 | } |
428 | 428 | |
429 | - echo self::shortcode_button( 'this', 'true' ); |
|
429 | + echo self::shortcode_button('this', 'true'); |
|
430 | 430 | |
431 | 431 | // see opening note |
432 | - if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) { |
|
432 | + if (function_exists('cornerstone_plugin_init') && !is_admin()) { |
|
433 | 433 | echo '</span>'; // end #insert-media-button |
434 | 434 | } |
435 | 435 | |
436 | 436 | // Add separate script for generatepress theme sections |
437 | - if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) { |
|
437 | + if (function_exists('generate_sections_sections_metabox') && did_action('generate_sections_metabox')) { |
|
438 | 438 | } else { |
439 | - self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function ); |
|
439 | + self::shortcode_insert_button_script($editor_id, $insert_shortcode_function); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | $shortcode_insert_button_once = true; |
@@ -450,12 +450,12 @@ discard block |
||
450 | 450 | * |
451 | 451 | * @return mixed |
452 | 452 | */ |
453 | - public static function shortcode_button( $id = '', $search_for_id = '' ) { |
|
453 | + public static function shortcode_button($id = '', $search_for_id = '') { |
|
454 | 454 | ob_start(); |
455 | 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 ) { |
|
458 | + if ($search_for_id) { |
|
459 | 459 | echo "," . $search_for_id; |
460 | 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"> |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | $html = ob_get_clean(); |
472 | 472 | |
473 | 473 | // remove line breaks so we can use it in js |
474 | - return preg_replace( "/\r|\n/", "", trim( $html ) ); |
|
474 | + return preg_replace("/\r|\n/", "", trim($html)); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | /** |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | jQuery($this).data('sd-widget-enabled', true); |
530 | 530 | } |
531 | 531 | |
532 | - var $button = '<button title="<?php _e( 'Advanced Settings', 'ayecode-connect' );?>" class="button button-primary right sd-advanced-button" onclick="sd_so_toggle_advanced(this);return false;"><i class="fas fa-sliders-h" aria-hidden="true"></i></button>'; |
|
532 | + var $button = '<button title="<?php _e('Advanced Settings', 'ayecode-connect'); ?>" class="button button-primary right sd-advanced-button" onclick="sd_so_toggle_advanced(this);return false;"><i class="fas fa-sliders-h" aria-hidden="true"></i></button>'; |
|
533 | 533 | var form = jQuery($this).parents('' + $selector + ''); |
534 | 534 | |
535 | 535 | if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) { |
@@ -564,10 +564,10 @@ discard block |
||
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( |
|
567 | + return str_replace(array( |
|
568 | 568 | '<script>', |
569 | 569 | '</script>' |
570 | - ), '', $output ); |
|
570 | + ), '', $output); |
|
571 | 571 | } |
572 | 572 | |
573 | 573 | /** |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | *@since 1.0.6 |
580 | 580 | * |
581 | 581 | */ |
582 | - public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) { |
|
582 | + public static function shortcode_insert_button_script($editor_id = '', $insert_shortcode_function = '') { |
|
583 | 583 | ?> |
584 | 584 | <style> |
585 | 585 | .sd-shortcode-left-wrap { |
@@ -698,25 +698,25 @@ discard block |
||
698 | 698 | width: 100%; |
699 | 699 | } |
700 | 700 | |
701 | - <?php if ( function_exists( 'generate_sections_sections_metabox' ) ) { ?> |
|
701 | + <?php if (function_exists('generate_sections_sections_metabox')) { ?> |
|
702 | 702 | .generate-sections-modal #custom-media-buttons > .sd-lable-shortcode-inserter { |
703 | 703 | display: inline; |
704 | 704 | } |
705 | 705 | <?php } ?> |
706 | - <?php if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) { ?> |
|
706 | + <?php if (function_exists('et_builder_is_tb_admin_screen') && et_builder_is_tb_admin_screen()) { ?> |
|
707 | 707 | body.divi_page_et_theme_builder div#TB_window.gd-tb-window{z-index:9999999} |
708 | 708 | <?php } ?> |
709 | 709 | </style> |
710 | 710 | <?php |
711 | - if ( class_exists( 'SiteOrigin_Panels' ) ) { |
|
711 | + if (class_exists('SiteOrigin_Panels')) { |
|
712 | 712 | echo "<script>" . self::siteorigin_js() . "</script>"; |
713 | 713 | } |
714 | 714 | ?> |
715 | 715 | <script> |
716 | 716 | <?php |
717 | - if(! empty( $insert_shortcode_function )){ |
|
717 | + if (!empty($insert_shortcode_function)) { |
|
718 | 718 | echo $insert_shortcode_function; |
719 | - }else{ |
|
719 | + } else { |
|
720 | 720 | |
721 | 721 | /** |
722 | 722 | * Function for super duper insert shortcode. |
@@ -729,9 +729,9 @@ discard block |
||
729 | 729 | if ($shortcode) { |
730 | 730 | if (!$editor_id) { |
731 | 731 | <?php |
732 | - if ( isset( $_REQUEST['et_fb'] ) ) { |
|
732 | + if (isset($_REQUEST['et_fb'])) { |
|
733 | 733 | echo '$editor_id = "#main_content_content_vb_tiny_mce";'; |
734 | - } elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) { |
|
734 | + } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') { |
|
735 | 735 | echo '$editor_id = "#elementor-controls .wp-editor-container textarea";'; |
736 | 736 | } else { |
737 | 737 | echo '$editor_id = "#wp-content-editor-container textarea";'; |
@@ -814,11 +814,11 @@ discard block |
||
814 | 814 | 'shortcode': $short_code, |
815 | 815 | 'attributes': 123, |
816 | 816 | 'post_id': 321, |
817 | - '_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>' |
|
817 | + '_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>' |
|
818 | 818 | }; |
819 | 819 | |
820 | 820 | if (typeof ajaxurl === 'undefined') { |
821 | - var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' );?>"; |
|
821 | + var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>"; |
|
822 | 822 | } |
823 | 823 | |
824 | 824 | jQuery.post(ajaxurl, data, function (response) { |
@@ -1017,11 +1017,11 @@ discard block |
||
1017 | 1017 | var data = { |
1018 | 1018 | 'action': 'super_duper_get_picker', |
1019 | 1019 | 'editor_id': $id, |
1020 | - '_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_picker' );?>' |
|
1020 | + '_ajax_nonce': '<?php echo wp_create_nonce('super_duper_picker'); ?>' |
|
1021 | 1021 | }; |
1022 | 1022 | |
1023 | 1023 | if (!ajaxurl) { |
1024 | - var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' ); ?>"; |
|
1024 | + var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>"; |
|
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | jQuery.post(ajaxurl, data, function (response) { |
@@ -1043,9 +1043,9 @@ discard block |
||
1043 | 1043 | */ |
1044 | 1044 | function sd_shortcode_button($id) { |
1045 | 1045 | if ($id) { |
1046 | - return '<?php echo self::shortcode_button( "\\''+\$id+'\\'" );?>'; |
|
1046 | + return '<?php echo self::shortcode_button("\\''+\$id+'\\'"); ?>'; |
|
1047 | 1047 | } else { |
1048 | - return '<?php echo self::shortcode_button();?>'; |
|
1048 | + return '<?php echo self::shortcode_button(); ?>'; |
|
1049 | 1049 | } |
1050 | 1050 | } |
1051 | 1051 | </script> |
@@ -1059,11 +1059,11 @@ discard block |
||
1059 | 1059 | * |
1060 | 1060 | * @return mixed |
1061 | 1061 | */ |
1062 | - public function widget_css( $advanced = true ) { |
|
1062 | + public function widget_css($advanced = true) { |
|
1063 | 1063 | ob_start(); |
1064 | 1064 | ?> |
1065 | 1065 | <style> |
1066 | - <?php if( $advanced ){ ?> |
|
1066 | + <?php if ($advanced) { ?> |
|
1067 | 1067 | .sd-advanced-setting { |
1068 | 1068 | display: none; |
1069 | 1069 | } |
@@ -1107,10 +1107,10 @@ discard block |
||
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( |
|
1110 | + return str_replace(array( |
|
1111 | 1111 | '<style>', |
1112 | 1112 | '</style>' |
1113 | - ), '', $output ); |
|
1113 | + ), '', $output); |
|
1114 | 1114 | } |
1115 | 1115 | |
1116 | 1116 | /** |
@@ -1177,7 +1177,7 @@ discard block |
||
1177 | 1177 | jQuery($this).data('sd-widget-enabled', true); |
1178 | 1178 | } |
1179 | 1179 | |
1180 | - var $button = '<button title="<?php _e( 'Advanced Settings', 'ayecode-connect' );?>" style="line-height: 28px;" class="button button-primary right sd-advanced-button" onclick="sd_toggle_advanced(this);return false;"><span class="dashicons dashicons-admin-settings" style="width: 28px;font-size: 28px;"></span></button>'; |
|
1180 | + var $button = '<button title="<?php _e('Advanced Settings', 'ayecode-connect'); ?>" style="line-height: 28px;" class="button button-primary right sd-advanced-button" onclick="sd_toggle_advanced(this);return false;"><span class="dashicons dashicons-admin-settings" style="width: 28px;font-size: 28px;"></span></button>'; |
|
1181 | 1181 | var form = $form ? $form : jQuery($this).parents('' + $selector + ''); |
1182 | 1182 | |
1183 | 1183 | if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) { |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | }); |
1269 | 1269 | |
1270 | 1270 | } |
1271 | - <?php do_action( 'wp_super_duper_widget_js', $this ); ?> |
|
1271 | + <?php do_action('wp_super_duper_widget_js', $this); ?> |
|
1272 | 1272 | </script> |
1273 | 1273 | <?php |
1274 | 1274 | $output = ob_get_clean(); |
@@ -1277,10 +1277,10 @@ discard block |
||
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( |
|
1280 | + return str_replace(array( |
|
1281 | 1281 | '<script>', |
1282 | 1282 | '</script>' |
1283 | - ), '', $output ); |
|
1283 | + ), '', $output); |
|
1284 | 1284 | } |
1285 | 1285 | |
1286 | 1286 | |
@@ -1291,14 +1291,14 @@ discard block |
||
1291 | 1291 | * |
1292 | 1292 | * @return mixed |
1293 | 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; |
|
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 | 1298 | } |
1299 | - } elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) { |
|
1300 | - foreach ( $options as $key => $val ) { |
|
1301 | - $options[ $key ]['name'] = $key; |
|
1299 | + } elseif ($arguments && is_array($options) && !empty($options)) { |
|
1300 | + foreach ($options as $key => $val) { |
|
1301 | + $options[$key]['name'] = $key; |
|
1302 | 1302 | } |
1303 | 1303 | } |
1304 | 1304 | |
@@ -1311,8 +1311,8 @@ discard block |
||
1311 | 1311 | * @since 1.0.0 |
1312 | 1312 | */ |
1313 | 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' ) ); |
|
1314 | + add_shortcode($this->base_id, array($this, 'shortcode_output')); |
|
1315 | + add_action('wp_ajax_super_duper_output_shortcode', array($this, 'render_shortcode')); |
|
1316 | 1316 | } |
1317 | 1317 | |
1318 | 1318 | /** |
@@ -1321,50 +1321,50 @@ discard block |
||
1321 | 1321 | * @since 1.0.0 |
1322 | 1322 | */ |
1323 | 1323 | public function render_shortcode() { |
1324 | - check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true ); |
|
1325 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
1324 | + check_ajax_referer('super_duper_output_shortcode', '_ajax_nonce', true); |
|
1325 | + if (!current_user_can('manage_options')) { |
|
1326 | 1326 | wp_die(); |
1327 | 1327 | } |
1328 | 1328 | |
1329 | 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 ) ) { |
|
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 | 1333 | global $post; |
1334 | 1334 | $post = $post_obj; |
1335 | 1335 | } |
1336 | 1336 | } |
1337 | 1337 | |
1338 | - if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) { |
|
1338 | + if (isset($_POST['shortcode']) && $_POST['shortcode']) { |
|
1339 | 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(); |
|
1340 | + $shortcode_name = sanitize_title_with_dashes($_POST['shortcode']); |
|
1341 | + $attributes_array = isset($_POST['attributes']) && $_POST['attributes'] ? $_POST['attributes'] : array(); |
|
1342 | 1342 | $attributes = ''; |
1343 | - if ( ! empty( $attributes_array ) ) { |
|
1344 | - foreach ( $attributes_array as $key => $value ) { |
|
1345 | - if ( is_array( $value ) ) { |
|
1346 | - $value = implode( ",", $value ); |
|
1343 | + if (!empty($attributes_array)) { |
|
1344 | + foreach ($attributes_array as $key => $value) { |
|
1345 | + if (is_array($value)) { |
|
1346 | + $value = implode(",", $value); |
|
1347 | 1347 | } |
1348 | 1348 | |
1349 | - if ( ! empty( $value ) ) { |
|
1350 | - $value = wp_unslash( $value ); |
|
1349 | + if (!empty($value)) { |
|
1350 | + $value = wp_unslash($value); |
|
1351 | 1351 | |
1352 | 1352 | // Encode [ and ]. |
1353 | - if ( $is_preview ) { |
|
1354 | - $value = $this->encode_shortcodes( $value ); |
|
1353 | + if ($is_preview) { |
|
1354 | + $value = $this->encode_shortcodes($value); |
|
1355 | 1355 | } |
1356 | 1356 | } |
1357 | - $attributes .= " " . esc_attr( sanitize_title_with_dashes( $key ) ) . "='" . esc_attr( $value ) . "' "; |
|
1357 | + $attributes .= " " . esc_attr(sanitize_title_with_dashes($key)) . "='" . esc_attr($value) . "' "; |
|
1358 | 1358 | } |
1359 | 1359 | } |
1360 | 1360 | |
1361 | - $shortcode = "[" . esc_attr( $shortcode_name ) . " " . $attributes . "]"; |
|
1361 | + $shortcode = "[" . esc_attr($shortcode_name) . " " . $attributes . "]"; |
|
1362 | 1362 | |
1363 | - $content = do_shortcode( $shortcode ); |
|
1363 | + $content = do_shortcode($shortcode); |
|
1364 | 1364 | |
1365 | 1365 | // Decode [ and ]. |
1366 | - if ( ! empty( $content ) && $is_preview ) { |
|
1367 | - $content = $this->decode_shortcodes( $content ); |
|
1366 | + if (!empty($content) && $is_preview) { |
|
1367 | + $content = $this->decode_shortcodes($content); |
|
1368 | 1368 | } |
1369 | 1369 | |
1370 | 1370 | echo $content; |
@@ -1380,21 +1380,21 @@ discard block |
||
1380 | 1380 | * |
1381 | 1381 | * @return string |
1382 | 1382 | */ |
1383 | - public function shortcode_output( $args = array(), $content = '' ) { |
|
1383 | + public function shortcode_output($args = array(), $content = '') { |
|
1384 | 1384 | $_instance = $args; |
1385 | 1385 | |
1386 | - $args = $this->argument_values( $args ); |
|
1386 | + $args = $this->argument_values($args); |
|
1387 | 1387 | |
1388 | 1388 | // add extra argument so we know its a output to gutenberg |
1389 | 1389 | //$args |
1390 | - $args = $this->string_to_bool( $args ); |
|
1390 | + $args = $this->string_to_bool($args); |
|
1391 | 1391 | |
1392 | 1392 | // if we have a enclosed shortcode we add it to the special `html` argument |
1393 | - if ( ! empty( $content ) ) { |
|
1393 | + if (!empty($content)) { |
|
1394 | 1394 | $args['html'] = $content; |
1395 | 1395 | } |
1396 | 1396 | |
1397 | - if ( ! $this->is_preview() ) { |
|
1397 | + if (!$this->is_preview()) { |
|
1398 | 1398 | /** |
1399 | 1399 | * Filters the settings for a particular widget args. |
1400 | 1400 | * |
@@ -1405,40 +1405,40 @@ discard block |
||
1405 | 1405 | *@since 1.0.28 |
1406 | 1406 | * |
1407 | 1407 | */ |
1408 | - $args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance ); |
|
1408 | + $args = apply_filters('wp_super_duper_widget_display_callback', $args, $this, $_instance); |
|
1409 | 1409 | |
1410 | - if ( ! is_array( $args ) ) { |
|
1410 | + if (!is_array($args)) { |
|
1411 | 1411 | return $args; |
1412 | 1412 | } |
1413 | 1413 | } |
1414 | 1414 | |
1415 | - $class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : ''; |
|
1416 | - $class .= " sdel-".$this->get_instance_hash(); |
|
1415 | + $class = isset($this->options['widget_ops']['classname']) ? esc_attr($this->options['widget_ops']['classname']) : ''; |
|
1416 | + $class .= " sdel-" . $this->get_instance_hash(); |
|
1417 | 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 ); |
|
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 | 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 ); |
|
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 | 1423 | |
1424 | 1424 | $shortcode_args = array(); |
1425 | 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'] ) { |
|
1426 | + $no_wrap = isset($this->options['no_wrap']) && $this->options['no_wrap'] ? true : false; |
|
1427 | + if (isset($args['no_wrap']) && $args['no_wrap']) { |
|
1428 | 1428 | $no_wrap = true; |
1429 | 1429 | } |
1430 | - $main_content = $this->output( $args, $shortcode_args, $content ); |
|
1431 | - if ( $main_content && ! $no_wrap ) { |
|
1430 | + $main_content = $this->output($args, $shortcode_args, $content); |
|
1431 | + if ($main_content && !$no_wrap) { |
|
1432 | 1432 | // wrap the shortcode in a div with the same class as the widget |
1433 | 1433 | $output .= '<div class="' . $class . '" ' . $attrs . '>'; |
1434 | - if ( ! empty( $args['title'] ) ) { |
|
1434 | + if (!empty($args['title'])) { |
|
1435 | 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 ) ) { |
|
1436 | + $shortcode_args = array('before_title' => '', 'after_title' => ''); |
|
1437 | + if (empty($instance)) { |
|
1438 | 1438 | global $wp_registered_sidebars; |
1439 | - if ( ! empty( $wp_registered_sidebars ) ) { |
|
1440 | - foreach ( $wp_registered_sidebars as $sidebar ) { |
|
1441 | - if ( ! empty( $sidebar['before_title'] ) ) { |
|
1439 | + if (!empty($wp_registered_sidebars)) { |
|
1440 | + foreach ($wp_registered_sidebars as $sidebar) { |
|
1441 | + if (!empty($sidebar['before_title'])) { |
|
1442 | 1442 | $shortcode_args['before_title'] = $sidebar['before_title']; |
1443 | 1443 | $shortcode_args['after_title'] = $sidebar['after_title']; |
1444 | 1444 | break; |
@@ -1446,20 +1446,20 @@ discard block |
||
1446 | 1446 | } |
1447 | 1447 | } |
1448 | 1448 | } |
1449 | - $output .= $this->output_title( $shortcode_args, $args ); |
|
1449 | + $output .= $this->output_title($shortcode_args, $args); |
|
1450 | 1450 | } |
1451 | 1451 | $output .= $main_content; |
1452 | 1452 | $output .= '</div>'; |
1453 | - } elseif ( $main_content && $no_wrap ) { |
|
1453 | + } elseif ($main_content && $no_wrap) { |
|
1454 | 1454 | $output .= $main_content; |
1455 | 1455 | } |
1456 | 1456 | |
1457 | 1457 | // if preview show a placeholder if empty |
1458 | - if ( $this->is_preview() && $output == '' ) { |
|
1459 | - $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" ); |
|
1458 | + if ($this->is_preview() && $output == '') { |
|
1459 | + $output = $this->preview_placeholder_text("{{" . $this->base_id . "}}"); |
|
1460 | 1460 | } |
1461 | 1461 | |
1462 | - return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this ); |
|
1462 | + return apply_filters('wp_super_duper_widget_output', $output, $args, $shortcode_args, $this); |
|
1463 | 1463 | } |
1464 | 1464 | |
1465 | 1465 | /** |
@@ -1469,8 +1469,8 @@ discard block |
||
1469 | 1469 | * |
1470 | 1470 | * @return string |
1471 | 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>"; |
|
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 | 1474 | } |
1475 | 1475 | |
1476 | 1476 | /** |
@@ -1480,13 +1480,13 @@ discard block |
||
1480 | 1480 | * |
1481 | 1481 | * @return mixed |
1482 | 1482 | */ |
1483 | - public function string_to_bool( $options ) { |
|
1483 | + public function string_to_bool($options) { |
|
1484 | 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; |
|
1485 | + foreach ($options as $key => $val) { |
|
1486 | + if ($val == 'false') { |
|
1487 | + $options[$key] = false; |
|
1488 | + } elseif ($val == 'true') { |
|
1489 | + $options[$key] = true; |
|
1490 | 1490 | } |
1491 | 1491 | } |
1492 | 1492 | |
@@ -1502,26 +1502,26 @@ discard block |
||
1502 | 1502 | *@since 1.0.12 Don't set checkbox default value if the value is empty. |
1503 | 1503 | * |
1504 | 1504 | */ |
1505 | - public function argument_values( $instance ) { |
|
1505 | + public function argument_values($instance) { |
|
1506 | 1506 | $argument_values = array(); |
1507 | 1507 | |
1508 | 1508 | // set widget instance |
1509 | 1509 | $this->instance = $instance; |
1510 | 1510 | |
1511 | - if ( empty( $this->arguments ) ) { |
|
1511 | + if (empty($this->arguments)) { |
|
1512 | 1512 | $this->arguments = $this->get_arguments(); |
1513 | 1513 | } |
1514 | 1514 | |
1515 | - if ( ! empty( $this->arguments ) ) { |
|
1516 | - foreach ( $this->arguments as $key => $args ) { |
|
1515 | + if (!empty($this->arguments)) { |
|
1516 | + foreach ($this->arguments as $key => $args) { |
|
1517 | 1517 | // set the input name from the key |
1518 | 1518 | $args['name'] = $key; |
1519 | 1519 | // |
1520 | - $argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : ''; |
|
1521 | - if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) { |
|
1520 | + $argument_values[$key] = isset($instance[$key]) ? $instance[$key] : ''; |
|
1521 | + if ($args['type'] == 'checkbox' && $argument_values[$key] == '') { |
|
1522 | 1522 | // don't set default for an empty checkbox |
1523 | - } elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) { |
|
1524 | - $argument_values[ $key ] = $args['default']; |
|
1523 | + } elseif ($argument_values[$key] == '' && isset($args['default'])) { |
|
1524 | + $argument_values[$key] = $args['default']; |
|
1525 | 1525 | } |
1526 | 1526 | } |
1527 | 1527 | } |
@@ -1548,12 +1548,12 @@ discard block |
||
1548 | 1548 | * |
1549 | 1549 | */ |
1550 | 1550 | public function get_arguments() { |
1551 | - if ( empty( $this->arguments ) ) { |
|
1551 | + if (empty($this->arguments)) { |
|
1552 | 1552 | $this->arguments = $this->set_arguments(); |
1553 | 1553 | } |
1554 | 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 ); |
|
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 | 1557 | |
1558 | 1558 | return $this->arguments; |
1559 | 1559 | } |
@@ -1565,7 +1565,7 @@ discard block |
||
1565 | 1565 | * @param array $widget_args |
1566 | 1566 | * @param string $content |
1567 | 1567 | */ |
1568 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
1568 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
1569 | 1569 | |
1570 | 1570 | } |
1571 | 1571 | |
@@ -1573,9 +1573,9 @@ discard block |
||
1573 | 1573 | * Add the dynamic block code inline when the wp-block in enqueued. |
1574 | 1574 | */ |
1575 | 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() ); |
|
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 | 1579 | } |
1580 | 1580 | } |
1581 | 1581 | |
@@ -1589,9 +1589,9 @@ discard block |
||
1589 | 1589 | $show = false; |
1590 | 1590 | $arguments = $this->get_arguments(); |
1591 | 1591 | |
1592 | - if ( ! empty( $arguments ) ) { |
|
1593 | - foreach ( $arguments as $argument ) { |
|
1594 | - if ( isset( $argument['advanced'] ) && $argument['advanced'] ) { |
|
1592 | + if (!empty($arguments)) { |
|
1593 | + foreach ($arguments as $argument) { |
|
1594 | + if (isset($argument['advanced']) && $argument['advanced']) { |
|
1595 | 1595 | $show = true; |
1596 | 1596 | break; // no need to continue if we know we have it |
1597 | 1597 | } |
@@ -1609,19 +1609,19 @@ discard block |
||
1609 | 1609 | public function get_url() { |
1610 | 1610 | $url = $this->url; |
1611 | 1611 | |
1612 | - if ( ! $url ) { |
|
1613 | - $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) ); |
|
1614 | - $content_url = untrailingslashit( WP_CONTENT_URL ); |
|
1612 | + if (!$url) { |
|
1613 | + $content_dir = wp_normalize_path(untrailingslashit(WP_CONTENT_DIR)); |
|
1614 | + $content_url = untrailingslashit(WP_CONTENT_URL); |
|
1615 | 1615 | |
1616 | 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 ); |
|
1617 | + if (strpos($content_url, 'http://') === 0 && strpos(plugins_url(), 'https://') === 0) { |
|
1618 | + $content_url = str_replace('http://', 'https://', $content_url); |
|
1619 | 1619 | } |
1620 | 1620 | |
1621 | 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 ); |
|
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 | 1625 | $this->url = $url; |
1626 | 1626 | } |
1627 | 1627 | |
@@ -1637,15 +1637,15 @@ discard block |
||
1637 | 1637 | |
1638 | 1638 | $url = $this->url; |
1639 | 1639 | |
1640 | - if ( ! $url ) { |
|
1640 | + if (!$url) { |
|
1641 | 1641 | // check if we are inside a plugin |
1642 | - $file_dir = str_replace( "/includes", "", dirname( __FILE__ ) ); |
|
1642 | + $file_dir = str_replace("/includes", "", dirname(__FILE__)); |
|
1643 | 1643 | |
1644 | - $dir_parts = explode( "/wp-content/", $file_dir ); |
|
1645 | - $url_parts = explode( "/wp-content/", plugins_url() ); |
|
1644 | + $dir_parts = explode("/wp-content/", $file_dir); |
|
1645 | + $url_parts = explode("/wp-content/", plugins_url()); |
|
1646 | 1646 | |
1647 | - if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) { |
|
1648 | - $url = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] ); |
|
1647 | + if (!empty($url_parts[0]) && !empty($dir_parts[1])) { |
|
1648 | + $url = trailingslashit($url_parts[0] . "/wp-content/" . $dir_parts[1]); |
|
1649 | 1649 | $this->url = $url; |
1650 | 1650 | } |
1651 | 1651 | } |
@@ -1666,45 +1666,45 @@ discard block |
||
1666 | 1666 | * @return string |
1667 | 1667 | *@since 1.1.0 |
1668 | 1668 | */ |
1669 | - public function get_block_icon( $icon ) { |
|
1669 | + public function get_block_icon($icon) { |
|
1670 | 1670 | |
1671 | 1671 | // check if we have a Font Awesome icon |
1672 | 1672 | $fa_type = ''; |
1673 | - if ( substr( $icon, 0, 7 ) === "fas fa-" ) { |
|
1673 | + if (substr($icon, 0, 7) === "fas fa-") { |
|
1674 | 1674 | $fa_type = 'solid'; |
1675 | - } elseif ( substr( $icon, 0, 7 ) === "far fa-" ) { |
|
1675 | + } elseif (substr($icon, 0, 7) === "far fa-") { |
|
1676 | 1676 | $fa_type = 'regular'; |
1677 | - } elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) { |
|
1677 | + } elseif (substr($icon, 0, 7) === "fab fa-") { |
|
1678 | 1678 | $fa_type = 'brands'; |
1679 | 1679 | } else { |
1680 | 1680 | $icon = "'" . $icon . "'"; |
1681 | 1681 | } |
1682 | 1682 | |
1683 | 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 ); |
|
1684 | + if ($fa_type) { |
|
1685 | + $fa_icon = str_replace(array("fas fa-", "far fa-", "fab fa-"), "", $icon); |
|
1686 | 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 | 1687 | } |
1688 | 1688 | |
1689 | 1689 | return $icon; |
1690 | 1690 | } |
1691 | 1691 | |
1692 | - public function group_arguments( $arguments ) { |
|
1693 | - if ( ! empty( $arguments ) ) { |
|
1692 | + public function group_arguments($arguments) { |
|
1693 | + if (!empty($arguments)) { |
|
1694 | 1694 | $temp_arguments = array(); |
1695 | - $general = __( "General", 'ayecode-connect' ); |
|
1695 | + $general = __("General", 'ayecode-connect'); |
|
1696 | 1696 | $add_sections = false; |
1697 | - foreach ( $arguments as $key => $args ) { |
|
1698 | - if ( isset( $args['group'] ) ) { |
|
1699 | - $temp_arguments[ $args['group'] ][ $key ] = $args; |
|
1697 | + foreach ($arguments as $key => $args) { |
|
1698 | + if (isset($args['group'])) { |
|
1699 | + $temp_arguments[$args['group']][$key] = $args; |
|
1700 | 1700 | $add_sections = true; |
1701 | 1701 | } else { |
1702 | - $temp_arguments[ $general ][ $key ] = $args; |
|
1702 | + $temp_arguments[$general][$key] = $args; |
|
1703 | 1703 | } |
1704 | 1704 | } |
1705 | 1705 | |
1706 | 1706 | // only add sections if more than one |
1707 | - if ( $add_sections ) { |
|
1707 | + if ($add_sections) { |
|
1708 | 1708 | $arguments = $temp_arguments; |
1709 | 1709 | } |
1710 | 1710 | } |
@@ -1717,38 +1717,38 @@ discard block |
||
1717 | 1717 | * |
1718 | 1718 | * @since 1.1.17 |
1719 | 1719 | */ |
1720 | - public function group_block_tabs( $tabs, $arguments ) { |
|
1721 | - if ( ! empty( $tabs ) && ! empty( $arguments ) ) { |
|
1720 | + public function group_block_tabs($tabs, $arguments) { |
|
1721 | + if (!empty($tabs) && !empty($arguments)) { |
|
1722 | 1722 | $has_sections = false; |
1723 | 1723 | |
1724 | - foreach ( $this->arguments as $key => $args ) { |
|
1725 | - if ( isset( $args['group'] ) ) { |
|
1724 | + foreach ($this->arguments as $key => $args) { |
|
1725 | + if (isset($args['group'])) { |
|
1726 | 1726 | $has_sections = true; |
1727 | 1727 | break; |
1728 | 1728 | } |
1729 | 1729 | } |
1730 | 1730 | |
1731 | - if ( ! $has_sections ) { |
|
1731 | + if (!$has_sections) { |
|
1732 | 1732 | return $tabs; |
1733 | 1733 | } |
1734 | 1734 | |
1735 | 1735 | $new_tabs = array(); |
1736 | 1736 | |
1737 | - foreach ( $tabs as $tab_key => $tab ) { |
|
1737 | + foreach ($tabs as $tab_key => $tab) { |
|
1738 | 1738 | $new_groups = array(); |
1739 | 1739 | |
1740 | - if ( ! empty( $tab['groups'] ) && is_array( $tab['groups'] ) ) { |
|
1741 | - foreach ( $tab['groups'] as $group ) { |
|
1742 | - if ( isset( $arguments[ $group ] ) ) { |
|
1740 | + if (!empty($tab['groups']) && is_array($tab['groups'])) { |
|
1741 | + foreach ($tab['groups'] as $group) { |
|
1742 | + if (isset($arguments[$group])) { |
|
1743 | 1743 | $new_groups[] = $group; |
1744 | 1744 | } |
1745 | 1745 | } |
1746 | 1746 | } |
1747 | 1747 | |
1748 | - if ( ! empty( $new_groups ) ) { |
|
1748 | + if (!empty($new_groups)) { |
|
1749 | 1749 | $tab['groups'] = $new_groups; |
1750 | 1750 | |
1751 | - $new_tabs[ $tab_key ] = $tab; |
|
1751 | + $new_tabs[$tab_key] = $tab; |
|
1752 | 1752 | } |
1753 | 1753 | } |
1754 | 1754 | |
@@ -1775,7 +1775,7 @@ discard block |
||
1775 | 1775 | ?> |
1776 | 1776 | <script> |
1777 | 1777 | <?php |
1778 | - if ( ! $sd_is_js_functions_loaded ) { |
|
1778 | + if (!$sd_is_js_functions_loaded) { |
|
1779 | 1779 | $sd_is_js_functions_loaded = true; |
1780 | 1780 | ?> |
1781 | 1781 | function sd_show_view_options($this){ |
@@ -2052,7 +2052,7 @@ discard block |
||
2052 | 2052 | } |
2053 | 2053 | } |
2054 | 2054 | |
2055 | -<?php if( !isset( $_REQUEST['sd-block-recover-debug'] ) ){ ?> |
|
2055 | +<?php if (!isset($_REQUEST['sd-block-recover-debug'])) { ?> |
|
2056 | 2056 | // Wait will window is loaded before calling. |
2057 | 2057 | window.onload = function() { |
2058 | 2058 | sd_auto_recover_blocks(); |
@@ -2231,7 +2231,7 @@ discard block |
||
2231 | 2231 | $classes = []; |
2232 | 2232 | |
2233 | 2233 | <?php |
2234 | - if($aui_bs5){ |
|
2234 | + if ($aui_bs5) { |
|
2235 | 2235 | ?> |
2236 | 2236 | $aui_bs5 = true; |
2237 | 2237 | $p_ml = 'ms-'; |
@@ -2240,7 +2240,7 @@ discard block |
||
2240 | 2240 | $p_pl = 'ps-'; |
2241 | 2241 | $p_pr = 'pe-'; |
2242 | 2242 | <?php |
2243 | - }else{ |
|
2243 | + } else { |
|
2244 | 2244 | ?> |
2245 | 2245 | $aui_bs5 = false; |
2246 | 2246 | $p_ml = 'ml-'; |
@@ -2428,7 +2428,7 @@ discard block |
||
2428 | 2428 | } |
2429 | 2429 | |
2430 | 2430 | function sd_get_class_build_keys(){ |
2431 | - return <?php echo json_encode(sd_get_class_build_keys());?>; |
|
2431 | + return <?php echo json_encode(sd_get_class_build_keys()); ?>; |
|
2432 | 2432 | } |
2433 | 2433 | |
2434 | 2434 | <?php |
@@ -2436,7 +2436,7 @@ discard block |
||
2436 | 2436 | |
2437 | 2437 | } |
2438 | 2438 | |
2439 | - if(method_exists($this,'block_global_js')){ |
|
2439 | + if (method_exists($this, 'block_global_js')) { |
|
2440 | 2440 | echo $this->block_global_js(); |
2441 | 2441 | } |
2442 | 2442 | ?> |
@@ -2468,9 +2468,9 @@ discard block |
||
2468 | 2468 | var InnerBlocks = blockEditor.InnerBlocks; |
2469 | 2469 | |
2470 | 2470 | var term_query_type = ''; |
2471 | - var post_type_rest_slugs = <?php if(! empty( $this->arguments ) && isset($this->arguments['post_type']['onchange_rest']['values'])){echo "[".json_encode($this->arguments['post_type']['onchange_rest']['values'])."]";}else{echo "[]";} ?>; |
|
2472 | - const taxonomies_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}]; |
|
2473 | - const sort_by_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}]; |
|
2471 | + var post_type_rest_slugs = <?php if (!empty($this->arguments) && isset($this->arguments['post_type']['onchange_rest']['values'])) {echo "[" . json_encode($this->arguments['post_type']['onchange_rest']['values']) . "]"; } else {echo "[]"; } ?>; |
|
2472 | + const taxonomies_<?php echo str_replace("-", "_", $this->id); ?> = [{label: "Please wait", value: 0}]; |
|
2473 | + const sort_by_<?php echo str_replace("-", "_", $this->id); ?> = [{label: "Please wait", value: 0}]; |
|
2474 | 2474 | const MediaUpload = wp.blockEditor.MediaUpload; |
2475 | 2475 | |
2476 | 2476 | /** |
@@ -2485,87 +2485,87 @@ discard block |
||
2485 | 2485 | * @return {?WPBlock} The block, if it has been successfully |
2486 | 2486 | * registered; otherwise `undefined`. |
2487 | 2487 | */ |
2488 | - registerBlockType('<?php echo str_replace( "_", "-", sanitize_title_with_dashes( $this->options['textdomain'] ) . '/' . sanitize_title_with_dashes( $this->options['class_name'] ) ); ?>', { // Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block. |
|
2489 | - apiVersion: <?php echo isset($this->options['block-api-version']) ? absint($this->options['block-api-version']) : 2 ; ?>, |
|
2490 | - title: '<?php echo addslashes( $this->options['name'] ); ?>', // Block title. |
|
2491 | - description: '<?php echo addslashes( $this->options['widget_ops']['description'] )?>', // Block title. |
|
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/. |
|
2488 | + registerBlockType('<?php echo str_replace("_", "-", sanitize_title_with_dashes($this->options['textdomain']) . '/' . sanitize_title_with_dashes($this->options['class_name'])); ?>', { // Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block. |
|
2489 | + apiVersion: <?php echo isset($this->options['block-api-version']) ? absint($this->options['block-api-version']) : 2; ?>, |
|
2490 | + title: '<?php echo addslashes($this->options['name']); ?>', // Block title. |
|
2491 | + description: '<?php echo addslashes($this->options['widget_ops']['description'])?>', // Block title. |
|
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'])){ |
|
2495 | + if (!isset($this->options['block-supports']['renaming'])) { |
|
2496 | 2496 | $this->options['block-supports']['renaming'] = false; |
2497 | 2497 | } |
2498 | - if ( isset( $this->options['block-supports'] ) ) { |
|
2499 | - echo $this->array_to_attributes( $this->options['block-supports'] ); |
|
2498 | + if (isset($this->options['block-supports'])) { |
|
2499 | + echo $this->array_to_attributes($this->options['block-supports']); |
|
2500 | 2500 | } |
2501 | 2501 | ?> |
2502 | 2502 | }, |
2503 | 2503 | __experimentalLabel( attributes, { context } ) { |
2504 | 2504 | var visibility_html = attributes && attributes.visibility_conditions ? ' 👁' : ''; |
2505 | 2505 | var metadata_name = attributes && attributes.metadata && attributes.metadata.name ? attributes.metadata.name : ''; |
2506 | - var label_name = <?php echo !empty($this->options['block-label']) ? $this->options['block-label'] : "'" . esc_attr( addslashes( $this->options['name'] ) ) . "'"; ?>; |
|
2506 | + var label_name = <?php echo !empty($this->options['block-label']) ? $this->options['block-label'] : "'" . esc_attr(addslashes($this->options['name'])) . "'"; ?>; |
|
2507 | 2507 | return metadata_name ? metadata_name + visibility_html : label_name + visibility_html; |
2508 | 2508 | }, |
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 | - <?php if ( isset( $this->options['block-keywords'] ) ) { |
|
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 | + <?php if (isset($this->options['block-keywords'])) { |
|
2511 | 2511 | echo "keywords : " . $this->options['block-keywords'] . ","; |
2512 | 2512 | } |
2513 | 2513 | |
2514 | 2514 | |
2515 | 2515 | // block hover preview. |
2516 | 2516 | $example_args = array(); |
2517 | - if(!empty($this->arguments)){ |
|
2518 | - foreach($this->arguments as $key => $a_args){ |
|
2519 | - if(isset($a_args['example'])){ |
|
2517 | + if (!empty($this->arguments)) { |
|
2518 | + foreach ($this->arguments as $key => $a_args) { |
|
2519 | + if (isset($a_args['example'])) { |
|
2520 | 2520 | $example_args[$key] = $a_args['example']; |
2521 | 2521 | } |
2522 | 2522 | } |
2523 | 2523 | } |
2524 | - $viewport_width = isset($this->options['example']['viewportWidth']) ? 'viewportWidth: '.absint($this->options['example']['viewportWidth']) : ''; |
|
2524 | + $viewport_width = isset($this->options['example']['viewportWidth']) ? 'viewportWidth: ' . absint($this->options['example']['viewportWidth']) : ''; |
|
2525 | 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 ){ |
|
2526 | + if (isset($this->options['example']) && $this->options['example'] === false) { |
|
2527 | 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'] ) ){ |
|
2528 | + }elseif (!empty($example_args)) { |
|
2529 | + echo "example : {attributes:{" . $this->array_to_attributes($example_args) . "},$viewport_width},"; |
|
2530 | + }elseif (!empty($this->options['example'])) { |
|
2531 | 2531 | unset($this->options['example']['viewportWidth']); |
2532 | 2532 | unset($this->options['example']['innerBlocks']); |
2533 | - $example_atts = $this->array_to_attributes( $this->options['example'] ); |
|
2533 | + $example_atts = $this->array_to_attributes($this->options['example']); |
|
2534 | 2534 | $example_parts = array(); |
2535 | - if($example_atts){ |
|
2536 | - $example_parts[] = rtrim($example_atts,","); |
|
2535 | + if ($example_atts) { |
|
2536 | + $example_parts[] = rtrim($example_atts, ","); |
|
2537 | 2537 | } |
2538 | - if($viewport_width){ |
|
2538 | + if ($viewport_width) { |
|
2539 | 2539 | $example_parts[] = $viewport_width; |
2540 | 2540 | } |
2541 | - if($example_inner_blocks){ |
|
2541 | + if ($example_inner_blocks) { |
|
2542 | 2542 | $example_parts[] = $example_inner_blocks; |
2543 | 2543 | } |
2544 | - if(!empty($example_parts)){ |
|
2545 | - echo "example : {".implode(',', $example_parts)."},"; |
|
2544 | + if (!empty($example_parts)) { |
|
2545 | + echo "example : {" . implode(',', $example_parts) . "},"; |
|
2546 | 2546 | } |
2547 | - }else{ |
|
2547 | + } else { |
|
2548 | 2548 | echo 'example : {viewportWidth: 500},'; |
2549 | 2549 | } |
2550 | 2550 | |
2551 | 2551 | |
2552 | 2552 | |
2553 | 2553 | // limit to parent |
2554 | - if( !empty( $this->options['parent'] ) ){ |
|
2555 | - echo "parent : " . wp_json_encode( $this->options['parent'] ) . ","; |
|
2554 | + if (!empty($this->options['parent'])) { |
|
2555 | + echo "parent : " . wp_json_encode($this->options['parent']) . ","; |
|
2556 | 2556 | } |
2557 | 2557 | |
2558 | 2558 | // limit allowed blocks |
2559 | - if( !empty( $this->options['allowed-blocks'] ) ){ |
|
2560 | - echo "allowedBlocks : " . wp_json_encode( $this->options['allowed-blocks'] ) . ","; |
|
2559 | + if (!empty($this->options['allowed-blocks'])) { |
|
2560 | + echo "allowedBlocks : " . wp_json_encode($this->options['allowed-blocks']) . ","; |
|
2561 | 2561 | } |
2562 | 2562 | |
2563 | 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'] ) { |
|
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 | 2566 | $no_wrap = true; |
2567 | 2567 | } |
2568 | - if ( $no_wrap ) { |
|
2568 | + if ($no_wrap) { |
|
2569 | 2569 | $this->options['block-wrap'] = ''; |
2570 | 2570 | } |
2571 | 2571 | |
@@ -2582,7 +2582,7 @@ discard block |
||
2582 | 2582 | |
2583 | 2583 | echo "attributes : {"; |
2584 | 2584 | |
2585 | - if ( $show_advanced ) { |
|
2585 | + if ($show_advanced) { |
|
2586 | 2586 | echo "show_advanced: {"; |
2587 | 2587 | echo " type: 'boolean',"; |
2588 | 2588 | echo " default: false,"; |
@@ -2590,57 +2590,57 @@ discard block |
||
2590 | 2590 | } |
2591 | 2591 | |
2592 | 2592 | // block wrap element |
2593 | - if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this? |
|
2593 | + if (!empty($this->options['block-wrap'])) { //@todo we should validate this? |
|
2594 | 2594 | echo "block_wrap: {"; |
2595 | 2595 | echo " type: 'string',"; |
2596 | - echo " default: '" . esc_attr( $this->options['block-wrap'] ) . "',"; |
|
2596 | + echo " default: '" . esc_attr($this->options['block-wrap']) . "',"; |
|
2597 | 2597 | echo "},"; |
2598 | 2598 | } |
2599 | 2599 | |
2600 | 2600 | |
2601 | - if ( ! empty( $this->arguments ) ) { |
|
2601 | + if (!empty($this->arguments)) { |
|
2602 | 2602 | |
2603 | - foreach ( $this->arguments as $key => $args ) { |
|
2603 | + foreach ($this->arguments as $key => $args) { |
|
2604 | 2604 | |
2605 | - if( $args['type'] == 'image' || $args['type'] == 'images' ){ |
|
2605 | + if ($args['type'] == 'image' || $args['type'] == 'images') { |
|
2606 | 2606 | $img_drag_drop = true; |
2607 | 2607 | } |
2608 | 2608 | |
2609 | 2609 | // set if we should show alignment |
2610 | - if ( $key == 'alignment' ) { |
|
2610 | + if ($key == 'alignment') { |
|
2611 | 2611 | $show_alignment = true; |
2612 | 2612 | } |
2613 | 2613 | |
2614 | 2614 | $extra = ''; |
2615 | 2615 | |
2616 | - if ( $args['type'] == 'notice' || $args['type'] == 'tab' ) { |
|
2616 | + if ($args['type'] == 'notice' || $args['type'] == 'tab') { |
|
2617 | 2617 | continue; |
2618 | 2618 | } |
2619 | - elseif ( $args['type'] == 'checkbox' ) { |
|
2619 | + elseif ($args['type'] == 'checkbox') { |
|
2620 | 2620 | $type = 'boolean'; |
2621 | - $default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false'; |
|
2622 | - } elseif ( $args['type'] == 'number' ) { |
|
2621 | + $default = isset($args['default']) && $args['default'] ? 'true' : 'false'; |
|
2622 | + } elseif ($args['type'] == 'number') { |
|
2623 | 2623 | $type = 'number'; |
2624 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2625 | - } elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) { |
|
2624 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2625 | + } elseif ($args['type'] == 'select' && !empty($args['multiple'])) { |
|
2626 | 2626 | $type = 'array'; |
2627 | - if ( isset( $args['default'] ) && is_array( $args['default'] ) ) { |
|
2628 | - $default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]"; |
|
2627 | + if (isset($args['default']) && is_array($args['default'])) { |
|
2628 | + $default = !empty($args['default']) ? "['" . implode("','", $args['default']) . "']" : "[]"; |
|
2629 | 2629 | } else { |
2630 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2630 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2631 | 2631 | } |
2632 | - } elseif ( $args['type'] == 'tagselect' ) { |
|
2632 | + } elseif ($args['type'] == 'tagselect') { |
|
2633 | 2633 | $type = 'array'; |
2634 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2635 | - } elseif ( $args['type'] == 'multiselect' ) { |
|
2634 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2635 | + } elseif ($args['type'] == 'multiselect') { |
|
2636 | 2636 | $type = 'array'; |
2637 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2638 | - } elseif ( $args['type'] == 'image_xy' ) { |
|
2637 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2638 | + } elseif ($args['type'] == 'image_xy') { |
|
2639 | 2639 | $type = 'object'; |
2640 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2641 | - } elseif ( $args['type'] == 'image' ) { |
|
2640 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2641 | + } elseif ($args['type'] == 'image') { |
|
2642 | 2642 | $type = 'string'; |
2643 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2643 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2644 | 2644 | |
2645 | 2645 | // add a field for ID |
2646 | 2646 | // echo $key . "_id : {"; |
@@ -2652,7 +2652,7 @@ discard block |
||
2652 | 2652 | |
2653 | 2653 | } else { |
2654 | 2654 | $type = !empty($args['hidden_type']) ? esc_attr($args['hidden_type']) : 'string'; |
2655 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2655 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2656 | 2656 | |
2657 | 2657 | } |
2658 | 2658 | echo $key . " : {"; |
@@ -2665,7 +2665,7 @@ discard block |
||
2665 | 2665 | echo "content : {type : 'string',default: 'Please select the attributes in the block settings'},"; |
2666 | 2666 | echo "sd_shortcode : {type : 'string',default: ''},"; |
2667 | 2667 | |
2668 | - if(!empty($this->options['nested-block']) || !empty($this->arguments['html']) ){ |
|
2668 | + if (!empty($this->options['nested-block']) || !empty($this->arguments['html'])) { |
|
2669 | 2669 | echo "sd_shortcode_close : {type : 'string',default: ''},"; |
2670 | 2670 | } |
2671 | 2671 | |
@@ -2684,7 +2684,7 @@ discard block |
||
2684 | 2684 | |
2685 | 2685 | <?php |
2686 | 2686 | // only include the drag/drop functions if required. |
2687 | -if( $img_drag_drop ){ |
|
2687 | +if ($img_drag_drop) { |
|
2688 | 2688 | |
2689 | 2689 | ?> |
2690 | 2690 | |
@@ -2750,9 +2750,9 @@ discard block |
||
2750 | 2750 | } |
2751 | 2751 | |
2752 | 2752 | <?php |
2753 | - if(!empty($this->options['block-edit-raw'])) { |
|
2753 | + if (!empty($this->options['block-edit-raw'])) { |
|
2754 | 2754 | echo $this->options['block-edit-raw']; // strings have to be in single quotes, may cause issues |
2755 | - }else{ |
|
2755 | + } else { |
|
2756 | 2756 | ?> |
2757 | 2757 | |
2758 | 2758 | function hasSelectedInnerBlock(props) { |
@@ -2776,7 +2776,7 @@ discard block |
||
2776 | 2776 | var $value = ''; |
2777 | 2777 | <?php |
2778 | 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']) ){ |
|
2779 | + if (isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked'])) { |
|
2780 | 2780 | ?> |
2781 | 2781 | if(typeof(prev_attributes[props.clientId]) != 'undefined' && selectedBlock && selectedBlock.clientId === props.clientId){ |
2782 | 2782 | $pt = props.attributes.post_type; |
@@ -2791,9 +2791,9 @@ discard block |
||
2791 | 2791 | } |
2792 | 2792 | <?php |
2793 | 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( '"', ''' ), array( '"', "'" ), $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('"', '''), array('"', "'"), $cat_path); |
|
2797 | 2797 | } |
2798 | 2798 | ?> |
2799 | 2799 | /* taxonomies */ |
@@ -2801,15 +2801,15 @@ discard block |
||
2801 | 2801 | if (!window.gdCPTCats) { |
2802 | 2802 | window.gdCPTCats = []; |
2803 | 2803 | } |
2804 | - var gdCatPath = "<?php echo ( ! empty( $cat_path ) ? $cat_path : "/wp/v2/" + $value + "/categories/?per_page=100" ); ?>"; |
|
2804 | + var gdCatPath = "<?php echo (!empty($cat_path) ? $cat_path : "/wp/v2/" +$value + "/categories/?per_page=100"); ?>"; |
|
2805 | 2805 | if (window.gdCPTCats[gdCatPath]) { |
2806 | 2806 | terms = window.gdCPTCats[gdCatPath]; |
2807 | - while (taxonomies_<?php echo str_replace("-","_", $this->id);?>.length) { |
|
2808 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.pop(); |
|
2807 | + while (taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.length) { |
|
2808 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.pop(); |
|
2809 | 2809 | } |
2810 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: "All", value: 0}); |
|
2810 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: "All", value: 0}); |
|
2811 | 2811 | jQuery.each( terms, function( key, val ) { |
2812 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: val.name, value: val.id}); |
|
2812 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val.name, value: val.id}); |
|
2813 | 2813 | }); |
2814 | 2814 | |
2815 | 2815 | /* Setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. */ |
@@ -2819,12 +2819,12 @@ discard block |
||
2819 | 2819 | } else { |
2820 | 2820 | wp.apiFetch({path: gdCatPath}).then(terms => { |
2821 | 2821 | window.gdCPTCats[gdCatPath] = terms; |
2822 | - while (taxonomies_<?php echo str_replace("-","_", $this->id);?>.length) { |
|
2823 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.pop(); |
|
2822 | + while (taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.length) { |
|
2823 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.pop(); |
|
2824 | 2824 | } |
2825 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: "All", value: 0}); |
|
2825 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: "All", value: 0}); |
|
2826 | 2826 | jQuery.each( terms, function( key, val ) { |
2827 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: val.name, value: val.id}); |
|
2827 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val.name, value: val.id}); |
|
2828 | 2828 | }); |
2829 | 2829 | |
2830 | 2830 | /* Setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. */ |
@@ -2832,7 +2832,7 @@ discard block |
||
2832 | 2832 | props.setAttributes({category: [0] }); |
2833 | 2833 | props.setAttributes({category: $old_cat_value }); |
2834 | 2834 | |
2835 | - return taxonomies_<?php echo str_replace("-","_", $this->id);?>; |
|
2835 | + return taxonomies_<?php echo str_replace("-", "_", $this->id); ?>; |
|
2836 | 2836 | }); |
2837 | 2837 | } |
2838 | 2838 | } |
@@ -2844,12 +2844,12 @@ discard block |
||
2844 | 2844 | } |
2845 | 2845 | if (window.gdCPTSort[$pt]) { |
2846 | 2846 | response = window.gdCPTSort[$pt]; |
2847 | - while (sort_by_<?php echo str_replace("-","_", $this->id);?>.length) { |
|
2848 | - sort_by_<?php echo str_replace("-","_", $this->id);?>.pop(); |
|
2847 | + while (sort_by_<?php echo str_replace("-", "_", $this->id); ?>.length) { |
|
2848 | + sort_by_<?php echo str_replace("-", "_", $this->id); ?>.pop(); |
|
2849 | 2849 | } |
2850 | 2850 | |
2851 | 2851 | jQuery.each( response, function( key, val ) { |
2852 | - sort_by_<?php echo str_replace("-","_", $this->id);?>.push({label: val, value: key}); |
|
2852 | + sort_by_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val, value: key}); |
|
2853 | 2853 | }); |
2854 | 2854 | |
2855 | 2855 | // setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. |
@@ -2864,12 +2864,12 @@ discard block |
||
2864 | 2864 | jQuery.post(ajaxurl, data, function(response) { |
2865 | 2865 | response = JSON.parse(response); |
2866 | 2866 | window.gdCPTSort[$pt] = response; |
2867 | - while (sort_by_<?php echo str_replace("-","_", $this->id);?>.length) { |
|
2868 | - sort_by_<?php echo str_replace("-","_", $this->id);?>.pop(); |
|
2867 | + while (sort_by_<?php echo str_replace("-", "_", $this->id); ?>.length) { |
|
2868 | + sort_by_<?php echo str_replace("-", "_", $this->id); ?>.pop(); |
|
2869 | 2869 | } |
2870 | 2870 | |
2871 | 2871 | jQuery.each( response, function( key, val ) { |
2872 | - sort_by_<?php echo str_replace("-","_", $this->id);?>.push({label: val, value: key}); |
|
2872 | + sort_by_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val, value: key}); |
|
2873 | 2873 | }); |
2874 | 2874 | |
2875 | 2875 | // setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. |
@@ -2877,7 +2877,7 @@ discard block |
||
2877 | 2877 | props.setAttributes({sort_by: [0] }); |
2878 | 2878 | props.setAttributes({sort_by: $old_sort_by_value }); |
2879 | 2879 | |
2880 | - return sort_by_<?php echo str_replace("-","_", $this->id);?>; |
|
2880 | + return sort_by_<?php echo str_replace("-", "_", $this->id); ?>; |
|
2881 | 2881 | }); |
2882 | 2882 | } |
2883 | 2883 | } |
@@ -2885,9 +2885,9 @@ discard block |
||
2885 | 2885 | <?php } ?> |
2886 | 2886 | <?php |
2887 | 2887 | $current_screen = function_exists('get_current_screen') ? get_current_screen() : ''; |
2888 | -if(!empty($current_screen->base) && $current_screen->base==='widgets'){ |
|
2888 | +if (!empty($current_screen->base) && $current_screen->base === 'widgets') { |
|
2889 | 2889 | echo 'const { deviceType } = "";'; |
2890 | -}else{ |
|
2890 | +} else { |
|
2891 | 2891 | ?> |
2892 | 2892 | /** Get device type const. */ |
2893 | 2893 | const wpVersion = '<?php global $wp_version; echo esc_attr($wp_version); ?>'; |
@@ -2946,13 +2946,13 @@ discard block |
||
2946 | 2946 | |
2947 | 2947 | var data = { |
2948 | 2948 | 'action': 'super_duper_output_shortcode', |
2949 | - 'shortcode': '<?php echo $this->options['base_id'];?>', |
|
2949 | + 'shortcode': '<?php echo $this->options['base_id']; ?>', |
|
2950 | 2950 | 'attributes': props.attributes, |
2951 | 2951 | 'block_parent_name': parentBlocks.length ? parentBlocks[parentBlocks.length - 1].name : '', |
2952 | - 'post_id': <?php global $post; if ( isset( $post->ID ) ) { |
|
2952 | + 'post_id': <?php global $post; if (isset($post->ID)) { |
|
2953 | 2953 | echo $post->ID; |
2954 | - }else{echo '0';}?>, |
|
2955 | - '_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>' |
|
2954 | + } else {echo '0'; }?>, |
|
2955 | + '_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>' |
|
2956 | 2956 | }; |
2957 | 2957 | |
2958 | 2958 | jQuery.post(ajaxurl, data, function (response) { |
@@ -2961,17 +2961,17 @@ discard block |
||
2961 | 2961 | |
2962 | 2962 | // if the content is empty then we place some placeholder text |
2963 | 2963 | if (env == '') { |
2964 | - env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e( 'Placeholder for:', 'ayecode-connect' );?> " + props.name + "</div>"; |
|
2964 | + env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e('Placeholder for:', 'ayecode-connect'); ?> " + props.name + "</div>"; |
|
2965 | 2965 | } |
2966 | 2966 | |
2967 | 2967 | <?php |
2968 | - if(!empty($this->options['nested-block'])){ |
|
2968 | + if (!empty($this->options['nested-block'])) { |
|
2969 | 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{ |
|
2974 | + } else { |
|
2975 | 2975 | ?> |
2976 | 2976 | props.setAttributes({content: env}); |
2977 | 2977 | is_fetching = false; |
@@ -2997,38 +2997,38 @@ discard block |
||
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 |
|
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 | 3002 | } |
3003 | 3003 | |
3004 | 3004 | |
3005 | 3005 | |
3006 | 3006 | |
3007 | - if(empty($this->options['block-save-return'])){ |
|
3007 | + if (empty($this->options['block-save-return'])) { |
|
3008 | 3008 | ?> |
3009 | 3009 | /////////////////////////////////////////////////////////////////////// |
3010 | 3010 | |
3011 | 3011 | // build the shortcode. |
3012 | - shortcode = "[<?php echo $this->options['base_id'];?>"; |
|
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){ |
|
3017 | + foreach ($this->arguments as $key => $args) { |
|
3018 | 3018 | // if($args['type']=='tabs'){continue;} |
3019 | 3019 | |
3020 | 3020 | // don't add metadata arguments |
3021 | - if (substr($key, 0, 9 ) === 'metadata_') { |
|
3021 | + if (substr($key, 0, 9) === 'metadata_') { |
|
3022 | 3022 | continue; |
3023 | 3023 | } |
3024 | 3024 | ?> |
3025 | - if (props.attributes.hasOwnProperty("<?php echo esc_attr( $key );?>")) { |
|
3026 | - if ('<?php echo esc_attr( $key );?>' == 'html') { |
|
3027 | - } else if ('<?php echo esc_attr( $args['type'] );?>' == 'image_xy') { |
|
3028 | - shortcode += props.attributes.<?php echo esc_attr( $key );?>.length && ( props.attributes.<?php echo esc_attr( $key );?>.x.length || props.attributes.<?php echo esc_attr( $key );?>.y.length ) ? " <?php echo esc_attr( $key );?>='{x:" + props.attributes.<?php echo esc_attr( $key );?>.x + ",y:"+props.attributes.<?php echo esc_attr( $key );?>.y +"}' " : ""; |
|
3025 | + if (props.attributes.hasOwnProperty("<?php echo esc_attr($key); ?>")) { |
|
3026 | + if ('<?php echo esc_attr($key); ?>' == 'html') { |
|
3027 | + } else if ('<?php echo esc_attr($args['type']); ?>' == 'image_xy') { |
|
3028 | + shortcode += props.attributes.<?php echo esc_attr($key); ?>.length && ( props.attributes.<?php echo esc_attr($key); ?>.x.length || props.attributes.<?php echo esc_attr($key); ?>.y.length ) ? " <?php echo esc_attr($key); ?>='{x:" + props.attributes.<?php echo esc_attr($key); ?>.x + ",y:"+props.attributes.<?php echo esc_attr($key); ?>.y +"}' " : ""; |
|
3029 | 3029 | } else { |
3030 | - //shortcode += props.attributes.<?php echo esc_attr( $key );?>.length ? " <?php echo esc_attr( $key );?>='" + props.attributes.<?php echo esc_attr( $key );?>.toString().replace('\'',''') + "' " : ""; |
|
3031 | - shortcode += " <?php echo esc_attr( $key );?>='" + props.attributes.<?php echo esc_attr( $key );?>.toString().replace('\'',''') + "' "; |
|
3030 | + //shortcode += props.attributes.<?php echo esc_attr($key); ?>.length ? " <?php echo esc_attr($key); ?>='" + props.attributes.<?php echo esc_attr($key); ?>.toString().replace('\'',''') + "' " : ""; |
|
3031 | + shortcode += " <?php echo esc_attr($key); ?>='" + props.attributes.<?php echo esc_attr($key); ?>.toString().replace('\'',''') + "' "; |
|
3032 | 3032 | } |
3033 | 3033 | } |
3034 | 3034 | <?php |
@@ -3047,8 +3047,8 @@ discard block |
||
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'] )."]'});"; |
|
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 | 3052 | } |
3053 | 3053 | ?> |
3054 | 3054 | } |
@@ -3063,7 +3063,7 @@ discard block |
||
3063 | 3063 | |
3064 | 3064 | el(wp.blockEditor.BlockControls, {key: 'controls'}, |
3065 | 3065 | |
3066 | - <?php if($show_alignment){?> |
|
3066 | + <?php if ($show_alignment) {?> |
|
3067 | 3067 | el( |
3068 | 3068 | wp.blockEditor.AlignmentToolbar, |
3069 | 3069 | { |
@@ -3081,9 +3081,9 @@ discard block |
||
3081 | 3081 | |
3082 | 3082 | <?php |
3083 | 3083 | |
3084 | - if(! empty( $this->arguments )){ |
|
3084 | + if (!empty($this->arguments)) { |
|
3085 | 3085 | |
3086 | - if ( $show_advanced ) { |
|
3086 | + if ($show_advanced) { |
|
3087 | 3087 | ?> |
3088 | 3088 | el('div', { |
3089 | 3089 | style: {'padding-left': '16px','padding-right': '16px'} |
@@ -3103,42 +3103,42 @@ discard block |
||
3103 | 3103 | <?php |
3104 | 3104 | } |
3105 | 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(); |
|
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 | 3108 | |
3109 | 3109 | // Do we have sections? |
3110 | 3110 | $has_sections = $arguments == $this->arguments ? false : true; |
3111 | 3111 | |
3112 | - if($has_sections){ |
|
3112 | + if ($has_sections) { |
|
3113 | 3113 | $panel_count = 0; |
3114 | 3114 | $open_tab = ''; |
3115 | 3115 | |
3116 | 3116 | $open_tab_groups = array(); |
3117 | 3117 | $used_tabs = array(); |
3118 | 3118 | |
3119 | - foreach ( $arguments as $key => $args ) { |
|
3119 | + foreach ($arguments as $key => $args) { |
|
3120 | 3120 | $close_tab = false; |
3121 | 3121 | $close_tabs = false; |
3122 | 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'] ) ) { |
|
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 | 3126 | $open_tab_groups[] = $key; |
3127 | 3127 | |
3128 | - if ( $open_tab != $tab_name ) { |
|
3128 | + if ($open_tab != $tab_name) { |
|
3129 | 3129 | $tab_args['tab']['tabs_open'] = $open_tab == '' ? true : false; |
3130 | 3130 | $tab_args['tab']['open'] = true; |
3131 | 3131 | |
3132 | - $this->block_tab_start( '', $tab_args ); |
|
3132 | + $this->block_tab_start('', $tab_args); |
|
3133 | 3133 | $open_tab = $tab_name; |
3134 | 3134 | $used_tabs[] = $tab_name; |
3135 | 3135 | } |
3136 | 3136 | |
3137 | - if ( $open_tab_groups == $tab_args['groups'] ) { |
|
3137 | + if ($open_tab_groups == $tab_args['groups']) { |
|
3138 | 3138 | $close_tab = true; |
3139 | 3139 | $open_tab_groups = array(); |
3140 | 3140 | |
3141 | - if ( $used_tabs == array_keys( $block_group_tabs ) ) { |
|
3141 | + if ($used_tabs == array_keys($block_group_tabs)) { |
|
3142 | 3142 | $close_tabs = true; |
3143 | 3143 | } |
3144 | 3144 | } |
@@ -3147,27 +3147,27 @@ discard block |
||
3147 | 3147 | } |
3148 | 3148 | ?> |
3149 | 3149 | el(wp.components.PanelBody, { |
3150 | - title: '<?php esc_attr_e( $key ); ?>', |
|
3151 | - initialOpen: <?php if ( $panel_count ) { |
|
3150 | + title: '<?php esc_attr_e($key); ?>', |
|
3151 | + initialOpen: <?php if ($panel_count) { |
|
3152 | 3152 | echo "false"; |
3153 | 3153 | } else { |
3154 | 3154 | echo "true"; |
3155 | 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 ); |
|
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 | 3164 | } |
3165 | 3165 | ?> |
3166 | 3166 | ), |
3167 | 3167 | <?php |
3168 | - $panel_count ++; |
|
3168 | + $panel_count++; |
|
3169 | 3169 | |
3170 | - if($close_tab || $close_tabs){ |
|
3170 | + if ($close_tab || $close_tabs) { |
|
3171 | 3171 | $tab_args = array( |
3172 | 3172 | 'tab' => array( |
3173 | 3173 | 'tabs_close' => $close_tabs, |
@@ -3175,24 +3175,24 @@ discard block |
||
3175 | 3175 | ) |
3176 | 3176 | |
3177 | 3177 | ); |
3178 | - $this->block_tab_end( '', $tab_args ); |
|
3178 | + $this->block_tab_end('', $tab_args); |
|
3179 | 3179 | // echo '###close'; print_r($tab_args); |
3180 | 3180 | $panel_count = 0; |
3181 | 3181 | } |
3182 | 3182 | // |
3183 | 3183 | |
3184 | 3184 | } |
3185 | - }else { |
|
3185 | + } else { |
|
3186 | 3186 | ?> |
3187 | 3187 | el(wp.components.PanelBody, { |
3188 | - title: '<?php esc_attr_e( "Settings", 'ayecode-connect' ); ?>', |
|
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 ); |
|
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 | 3196 | } |
3197 | 3197 | ?> |
3198 | 3198 | ), |
@@ -3206,11 +3206,11 @@ discard block |
||
3206 | 3206 | |
3207 | 3207 | <?php |
3208 | 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'])){ |
|
3209 | + if (!empty($this->options['block-output'])) { |
|
3210 | + $this->block_element($this->options['block-output']); |
|
3211 | + }elseif (!empty($this->options['block-edit-return'])) { |
|
3212 | 3212 | echo $this->options['block-edit-return']; |
3213 | - }else{ |
|
3213 | + } else { |
|
3214 | 3214 | // if no block-output is set then we try and get the shortcode html output via ajax. |
3215 | 3215 | $block_edit_wrap_tag = !empty($this->options['block_edit_wrap_tag']) ? esc_attr($this->options['block_edit_wrap_tag']) : 'div'; |
3216 | 3216 | ?> |
@@ -3237,27 +3237,27 @@ discard block |
||
3237 | 3237 | var align = ''; |
3238 | 3238 | |
3239 | 3239 | // build the shortcode. |
3240 | - var content = "[<?php echo $this->options['base_id'];?>"; |
|
3240 | + var content = "[<?php echo $this->options['base_id']; ?>"; |
|
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){ |
|
3246 | + foreach ($this->arguments as $key => $args) { |
|
3247 | 3247 | // if($args['type']=='tabs'){continue;} |
3248 | 3248 | |
3249 | 3249 | // don't add metadata arguments |
3250 | - if (substr($key, 0, 9 ) === 'metadata_') { |
|
3250 | + if (substr($key, 0, 9) === 'metadata_') { |
|
3251 | 3251 | continue; |
3252 | 3252 | } |
3253 | 3253 | ?> |
3254 | - if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) { |
|
3255 | - if ('<?php echo esc_attr( $key );?>' == 'html') { |
|
3256 | - $html = attr.<?php echo esc_attr( $key );?>; |
|
3257 | - } else if ('<?php echo esc_attr( $args['type'] );?>' == 'image_xy') { |
|
3258 | - content += " <?php echo esc_attr( $key );?>='{x:" + attr.<?php echo esc_attr( $key );?>.x + ",y:"+attr.<?php echo esc_attr( $key );?>.y +"}' "; |
|
3254 | + if (attr.hasOwnProperty("<?php echo esc_attr($key); ?>")) { |
|
3255 | + if ('<?php echo esc_attr($key); ?>' == 'html') { |
|
3256 | + $html = attr.<?php echo esc_attr($key); ?>; |
|
3257 | + } else if ('<?php echo esc_attr($args['type']); ?>' == 'image_xy') { |
|
3258 | + content += " <?php echo esc_attr($key); ?>='{x:" + attr.<?php echo esc_attr($key); ?>.x + ",y:"+attr.<?php echo esc_attr($key); ?>.y +"}' "; |
|
3259 | 3259 | } else { |
3260 | - content += " <?php echo esc_attr( $key );?>='" + attr.<?php echo esc_attr( $key );?>.toString().replace('\'',''') + "' "; |
|
3260 | + content += " <?php echo esc_attr($key); ?>='" + attr.<?php echo esc_attr($key); ?>.toString().replace('\'',''') + "' "; |
|
3261 | 3261 | } |
3262 | 3262 | } |
3263 | 3263 | <?php |
@@ -3277,7 +3277,7 @@ discard block |
||
3277 | 3277 | ?> |
3278 | 3278 | // if has html element |
3279 | 3279 | if ($html) { |
3280 | - //content += $html + "[/<?php echo $this->options['base_id'];?>]"; |
|
3280 | + //content += $html + "[/<?php echo $this->options['base_id']; ?>]"; |
|
3281 | 3281 | } |
3282 | 3282 | |
3283 | 3283 | // @todo should we add inline style here or just css classes? |
@@ -3307,7 +3307,7 @@ discard block |
||
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 ";"; |
@@ -3317,30 +3317,30 @@ discard block |
||
3317 | 3317 | '', |
3318 | 3318 | {}, |
3319 | 3319 | // el('', {dangerouslySetInnerHTML: {__html: content}}), |
3320 | - <?php $this->block_element( $this->options['block-output'], true ); ?> |
|
3321 | - // el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}}) |
|
3320 | + <?php $this->block_element($this->options['block-output'], true); ?> |
|
3321 | + // el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id']; ?>]"}}) |
|
3322 | 3322 | ); |
3323 | 3323 | <?php |
3324 | 3324 | |
3325 | - }elseif(!empty($this->options['block-save-return'])){ |
|
3325 | + }elseif (!empty($this->options['block-save-return'])) { |
|
3326 | 3326 | echo 'return ' . $this->options['block-save-return']; |
3327 | - }elseif(!empty($this->options['nested-block'])){ |
|
3327 | + }elseif (!empty($this->options['nested-block'])) { |
|
3328 | 3328 | ?> |
3329 | 3329 | return el( |
3330 | 3330 | '', |
3331 | 3331 | {}, |
3332 | 3332 | el('', {dangerouslySetInnerHTML: {__html: content+"\n"}}), |
3333 | 3333 | InnerBlocks.Content ? el( InnerBlocks.Content ) : '', // @todo i think we need a comma here |
3334 | - // el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}}) |
|
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'] == ''){ |
|
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 | 3340 | ?> |
3341 | 3341 | return content; |
3342 | 3342 | <?php |
3343 | - }else{ |
|
3343 | + } else { |
|
3344 | 3344 | ?> |
3345 | 3345 | var block_wrap = 'div'; |
3346 | 3346 | if (attr.hasOwnProperty("block_wrap")) { |
@@ -3369,48 +3369,48 @@ discard block |
||
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( |
|
3372 | + return str_replace(array( |
|
3373 | 3373 | '<script>', |
3374 | 3374 | '</script>' |
3375 | - ), '', $output ); |
|
3375 | + ), '', $output); |
|
3376 | 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 | 3382 | // check for row |
3383 | - if(!empty($args['row'])){ |
|
3383 | + if (!empty($args['row'])) { |
|
3384 | 3384 | |
3385 | - if(!empty($args['row']['open'])){ |
|
3385 | + if (!empty($args['row']['open'])) { |
|
3386 | 3386 | |
3387 | 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) . "' && " : ''; |
|
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 | 3391 | $device_type_icon = ''; |
3392 | - if($device_type=='Desktop'){ |
|
3392 | + if ($device_type == 'Desktop') { |
|
3393 | 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'){ |
|
3394 | + }elseif ($device_type == 'Tablet') { |
|
3395 | 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'){ |
|
3396 | + }elseif ($device_type == 'Mobile') { |
|
3397 | 3397 | $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
3398 | 3398 | } |
3399 | 3399 | echo $element_require; |
3400 | 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 | }, |
3406 | - <?php if(!empty($args['row']['title'])){ ?> |
|
3406 | + <?php if (!empty($args['row']['title'])) { ?> |
|
3407 | 3407 | el('label', { |
3408 | 3408 | className: 'components-base-control__label position-relative', |
3409 | 3409 | style: {width:"100%"} |
3410 | 3410 | }, |
3411 | - el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes( $args['row']['title'] ) ?>'}}), |
|
3412 | - <?php if($device_type_icon){ ?> |
|
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)"}}) |
|
3411 | + el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes($args['row']['title']) ?>'}}), |
|
3412 | + <?php if ($device_type_icon) { ?> |
|
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 | 3415 | } |
3416 | 3416 | ?> |
@@ -3418,17 +3418,17 @@ discard block |
||
3418 | 3418 | |
3419 | 3419 | ), |
3420 | 3420 | <?php }?> |
3421 | - <?php if(!empty($args['row']['desc'])){ ?> |
|
3421 | + <?php if (!empty($args['row']['desc'])) { ?> |
|
3422 | 3422 | el('p', { |
3423 | 3423 | className: 'components-base-control__help mb-0', |
3424 | 3424 | }, |
3425 | - '<?php echo addslashes( $args['row']['desc'] ); ?>' |
|
3425 | + '<?php echo addslashes($args['row']['desc']); ?>' |
|
3426 | 3426 | ), |
3427 | 3427 | <?php }?> |
3428 | 3428 | el( |
3429 | 3429 | 'div', |
3430 | 3430 | { |
3431 | - className: 'row mb-n2 <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>', |
|
3431 | + className: 'row mb-n2 <?php if (!empty($args['row']['class'])) { echo esc_attr($args['row']['class']); } ?>', |
|
3432 | 3432 | }, |
3433 | 3433 | el( |
3434 | 3434 | 'div', |
@@ -3437,36 +3437,36 @@ discard block |
||
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 } |
|
3458 | + if (false) {?></script><?php } |
|
3459 | 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'])){ |
|
3467 | + if (!empty($args['row'])) { |
|
3468 | 3468 | // maybe close |
3469 | - if(!empty($args['row']['close'])){ |
|
3469 | + if (!empty($args['row']['close'])) { |
|
3470 | 3470 | echo "))"; |
3471 | 3471 | } |
3472 | 3472 | |
@@ -3474,14 +3474,14 @@ discard block |
||
3474 | 3474 | } |
3475 | 3475 | } |
3476 | 3476 | |
3477 | - public function block_tab_start($key, $args){ |
|
3477 | + public function block_tab_start($key, $args) { |
|
3478 | 3478 | |
3479 | 3479 | // check for row |
3480 | - if(!empty($args['tab'])){ |
|
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 | |
@@ -3490,52 +3490,52 @@ discard block |
||
3490 | 3490 | { |
3491 | 3491 | activeClass: 'is-active', |
3492 | 3492 | className: 'btn-groupx', |
3493 | - initialTabName: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>', |
|
3493 | + initialTabName: '<?php echo addslashes(esc_attr($args['tab']['key'])); ?>', |
|
3494 | 3494 | tabs: [ |
3495 | 3495 | |
3496 | 3496 | <?php |
3497 | - if(false){?></script><?php } |
|
3497 | + if (false) {?></script><?php } |
|
3498 | 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 | - name: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>', |
|
3505 | - title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes( esc_attr( $args['tab']['title']) ); ?>'}}), |
|
3506 | - className: '<?php echo addslashes( esc_attr( $args['tab']['class']) ); ?>', |
|
3507 | - content: el('div',{}, <?php if(!empty($args['tab']['desc'])){ ?>el('p', { |
|
3504 | + name: '<?php echo addslashes(esc_attr($args['tab']['key'])); ?>', |
|
3505 | + title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes(esc_attr($args['tab']['title'])); ?>'}}), |
|
3506 | + className: '<?php echo addslashes(esc_attr($args['tab']['class'])); ?>', |
|
3507 | + content: el('div',{}, <?php if (!empty($args['tab']['desc'])) { ?>el('p', { |
|
3508 | 3508 | className: 'components-base-control__help mb-0', |
3509 | - dangerouslySetInnerHTML: {__html:'<?php echo addslashes( $args['tab']['desc'] ); ?>'} |
|
3509 | + dangerouslySetInnerHTML: {__html:'<?php echo addslashes($args['tab']['desc']); ?>'} |
|
3510 | 3510 | }),<?php } |
3511 | - if(false){?></script><?php } |
|
3511 | + if (false) {?></script><?php } |
|
3512 | 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'])){ |
|
3520 | + if (!empty($args['tab'])) { |
|
3521 | 3521 | // maybe close |
3522 | - if(!empty($args['tab']['close'])){ |
|
3522 | + if (!empty($args['tab']['close'])) { |
|
3523 | 3523 | echo ")}, /* tab close */"; |
3524 | 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 | - <?php if(false){ ?></script><?php } |
|
3532 | + <?php if (false) { ?></script><?php } |
|
3533 | 3533 | } |
3534 | 3534 | } |
3535 | 3535 | } |
3536 | 3536 | |
3537 | - public function build_block_arguments( $key, $args ) { |
|
3538 | - $custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : ''; |
|
3537 | + public function build_block_arguments($key, $args) { |
|
3538 | + $custom_attributes = !empty($args['custom_attributes']) ? $this->array_to_attributes($args['custom_attributes']) : ''; |
|
3539 | 3539 | $options = ''; |
3540 | 3540 | $extra = ''; |
3541 | 3541 | $require = ''; |
@@ -3543,28 +3543,28 @@ discard block |
||
3543 | 3543 | $after_elements = ''; |
3544 | 3544 | |
3545 | 3545 | // `content` is a protected and special argument |
3546 | - if ( $key == 'content' ) { |
|
3546 | + if ($key == 'content') { |
|
3547 | 3547 | return; |
3548 | 3548 | } |
3549 | 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) . "' && " : ''; |
|
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 | 3552 | $device_type_icon = ''; |
3553 | - if($device_type=='Desktop'){ |
|
3553 | + if ($device_type == 'Desktop') { |
|
3554 | 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'){ |
|
3555 | + }elseif ($device_type == 'Tablet') { |
|
3556 | 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'){ |
|
3557 | + }elseif ($device_type == 'Mobile') { |
|
3558 | 3558 | $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
3559 | 3559 | } |
3560 | 3560 | |
3561 | 3561 | // icon |
3562 | 3562 | $icon = ''; |
3563 | - if( !empty( $args['icon'] ) ){ |
|
3563 | + if (!empty($args['icon'])) { |
|
3564 | 3564 | $icon .= "el('div', {"; |
3565 | - $icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},"; |
|
3565 | + $icon .= "dangerouslySetInnerHTML: {__html: '" . self::get_widget_icon(esc_attr($args['icon'])) . "'},"; |
|
3566 | 3566 | $icon .= "className: 'text-center',"; |
3567 | - $icon .= "title: '".addslashes( $args['title'] )."',"; |
|
3567 | + $icon .= "title: '" . addslashes($args['title']) . "',"; |
|
3568 | 3568 | $icon .= "}),"; |
3569 | 3569 | |
3570 | 3570 | // blank title as its added to the icon. |
@@ -3572,27 +3572,27 @@ discard block |
||
3572 | 3572 | } |
3573 | 3573 | |
3574 | 3574 | // require advanced |
3575 | - $require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : ""; |
|
3575 | + $require_advanced = !empty($args['advanced']) ? "props.attributes.show_advanced && " : ""; |
|
3576 | 3576 | |
3577 | 3577 | // element require |
3578 | - $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : ""; |
|
3578 | + $element_require = !empty($args['element_require']) ? $this->block_props_replace($args['element_require'], true) . " && " : ""; |
|
3579 | 3579 | |
3580 | 3580 | |
3581 | 3581 | $onchange = "props.setAttributes({ $key: $key } )"; |
3582 | - $onchangecomplete = ""; |
|
3582 | + $onchangecomplete = ""; |
|
3583 | 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 ) ) { |
|
3584 | + $text_type = array('text', 'password', 'number', 'email', 'tel', 'url', 'colorx', 'range'); |
|
3585 | + if (in_array($args['type'], $text_type)) { |
|
3586 | 3586 | $type = 'TextControl'; |
3587 | 3587 | // Save numbers as numbers and not strings |
3588 | - if ( $args['type'] == 'number' ) { |
|
3588 | + if ($args['type'] == 'number') { |
|
3589 | 3589 | $onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )"; |
3590 | 3590 | } |
3591 | 3591 | |
3592 | - if (substr($key, 0, 9 ) === 'metadata_') { |
|
3593 | - $real_key = str_replace('metadata_','', $key ); |
|
3592 | + if (substr($key, 0, 9) === 'metadata_') { |
|
3593 | + $real_key = str_replace('metadata_', '', $key); |
|
3594 | 3594 | $onchange = "props.setAttributes({ metadata: { $real_key: $key } } )"; |
3595 | - $value = "props.attributes.metadata && props.attributes.metadata.$real_key ? props.attributes.metadata.$real_key : ''"; |
|
3595 | + $value = "props.attributes.metadata && props.attributes.metadata.$real_key ? props.attributes.metadata.$real_key : ''"; |
|
3596 | 3596 | } |
3597 | 3597 | } |
3598 | 3598 | // else if ( $args['type'] == 'popup' ) { |
@@ -3612,12 +3612,12 @@ discard block |
||
3612 | 3612 | // |
3613 | 3613 | // $value = "props.attributes.$key ? props.attributes.$key : ''"; |
3614 | 3614 | // } |
3615 | - else if ( $args['type'] == 'styleid' ) { |
|
3615 | + else if ($args['type'] == 'styleid') { |
|
3616 | 3616 | $type = 'TextControl'; |
3617 | 3617 | $args['type'] == 'text'; |
3618 | 3618 | // Save numbers as numbers and not strings |
3619 | - $value = "props.attributes.$key ? props.attributes.$key : ''"; |
|
3620 | - }else if ( $args['type'] == 'notice' ) { |
|
3619 | + $value = "props.attributes.$key ? props.attributes.$key : ''"; |
|
3620 | + } else if ($args['type'] == 'notice') { |
|
3621 | 3621 | |
3622 | 3622 | $notice_message = !empty($args['desc']) ? addslashes($args['desc']) : ''; |
3623 | 3623 | $notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info'; |
@@ -3679,11 +3679,11 @@ discard block |
||
3679 | 3679 | return; |
3680 | 3680 | } |
3681 | 3681 | */ |
3682 | - elseif ( $args['type'] == 'color' ) { |
|
3682 | + elseif ($args['type'] == 'color') { |
|
3683 | 3683 | $type = 'ColorPicker'; |
3684 | 3684 | $onchange = ""; |
3685 | 3685 | $extra = "color: $value,"; |
3686 | - if(!empty($args['disable_alpha'])){ |
|
3686 | + if (!empty($args['disable_alpha'])) { |
|
3687 | 3687 | $extra .= "disableAlpha: true,"; |
3688 | 3688 | } |
3689 | 3689 | $onchangecomplete = "onChangeComplete: function($key) { |
@@ -3692,7 +3692,7 @@ discard block |
||
3692 | 3692 | $key: value |
3693 | 3693 | }); |
3694 | 3694 | },"; |
3695 | - }elseif ( $args['type'] == 'gradient' ) { |
|
3695 | + }elseif ($args['type'] == 'gradient') { |
|
3696 | 3696 | $type = 'GradientPicker'; |
3697 | 3697 | $extra .= "gradients: [{ |
3698 | 3698 | name: 'Vivid cyan blue to vivid purple', |
@@ -3731,7 +3731,7 @@ discard block |
||
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 | 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,{ |
@@ -3793,7 +3793,7 @@ discard block |
||
3793 | 3793 | $onchange = ""; |
3794 | 3794 | |
3795 | 3795 | //$inside_elements = ",el('div',{},'file upload')"; |
3796 | - } else if ( $args['type'] == 'images' ) { |
|
3796 | + } else if ($args['type'] == 'images') { |
|
3797 | 3797 | $img_preview = "props.attributes.$key && (function() { |
3798 | 3798 | let uploads = JSON.parse('['+props.attributes.$key+']'); |
3799 | 3799 | let images = []; |
@@ -3806,7 +3806,7 @@ discard block |
||
3806 | 3806 | el('i',{ |
3807 | 3807 | className: 'fas fa-times-circle text-danger position-absolute ml-n2 mt-n1 bg-white rounded-circle c-pointer', |
3808 | 3808 | onClick: function() { |
3809 | - aui_confirm('".esc_attr__('Are you sure?')."', '".esc_attr__('Delete')."', '".esc_attr__('Cancel')."', true).then(function(confirmed) { |
|
3809 | + aui_confirm('" . esc_attr__('Are you sure?') . "', '" . esc_attr__('Delete') . "', '" . esc_attr__('Cancel') . "', true).then(function(confirmed) { |
|
3810 | 3810 | if (confirmed) { |
3811 | 3811 | let new_uploads = JSON.parse('['+props.attributes.$key+']'); |
3812 | 3812 | new_uploads.splice(index, 1); |
@@ -3869,36 +3869,36 @@ discard block |
||
3869 | 3869 | |
3870 | 3870 | //$inside_elements = ",el('div',{},'file upload')"; |
3871 | 3871 | } |
3872 | - elseif ( $args['type'] == 'checkbox' ) { |
|
3872 | + elseif ($args['type'] == 'checkbox') { |
|
3873 | 3873 | $type = 'CheckboxControl'; |
3874 | 3874 | $extra .= "checked: props.attributes.$key,"; |
3875 | 3875 | $onchange = "props.setAttributes({ $key: ! props.attributes.$key } )"; |
3876 | - } elseif ( $args['type'] == 'textarea' ) { |
|
3876 | + } elseif ($args['type'] == 'textarea') { |
|
3877 | 3877 | $type = 'TextareaControl'; |
3878 | 3878 | |
3879 | - } elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) { |
|
3879 | + } elseif ($args['type'] == 'select' || $args['type'] == 'multiselect') { |
|
3880 | 3880 | $type = 'SelectControl'; |
3881 | 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 { |
|
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 | 3887 | |
3888 | - if ( ! empty( $args['options'] ) ) { |
|
3888 | + if (!empty($args['options'])) { |
|
3889 | 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 ) ) . "' },"; |
|
3890 | + foreach ($args['options'] as $option_val => $option_label) { |
|
3891 | + $options .= "{ value: '" . esc_attr($option_val) . "', label: '" . esc_js(addslashes($option_label)) . "' },"; |
|
3892 | 3892 | } |
3893 | 3893 | $options .= "],"; |
3894 | 3894 | } |
3895 | 3895 | } |
3896 | - if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550 |
|
3896 | + if (isset($args['multiple']) && $args['multiple']) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550 |
|
3897 | 3897 | $extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, '; |
3898 | 3898 | } |
3899 | 3899 | |
3900 | - if($args['type'] == 'multiselect' || ( isset( $args['multiple'] ) && $args['multiple'] ) ){ |
|
3901 | - $after_elements .= "props.attributes.$key && el( wp.components.Button, { |
|
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(){ |
@@ -3910,7 +3910,7 @@ discard block |
||
3910 | 3910 | 'Clear' |
3911 | 3911 | ),"; |
3912 | 3912 | } |
3913 | - } elseif ( $args['type'] == 'tagselect' ) { |
|
3913 | + } elseif ($args['type'] == 'tagselect') { |
|
3914 | 3914 | // $type = 'FormTokenField'; |
3915 | 3915 | // |
3916 | 3916 | // if ( ! empty( $args['options'] ) ) { |
@@ -3945,19 +3945,19 @@ discard block |
||
3945 | 3945 | // $value = "[]"; |
3946 | 3946 | // $extra .= ' __experimentalExpandOnFocus: true,'; |
3947 | 3947 | |
3948 | - } else if ( $args['type'] == 'alignment' ) { |
|
3948 | + } else if ($args['type'] == 'alignment') { |
|
3949 | 3949 | $type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example |
3950 | - } else if ( $args['type'] == 'margins' ) { |
|
3950 | + } else if ($args['type'] == 'margins') { |
|
3951 | 3951 | |
3952 | - } else if ( $args['type'] == 'visibility_conditions' && ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) ) { |
|
3952 | + } else if ($args['type'] == 'visibility_conditions' && (function_exists('wp_is_block_theme') && wp_is_block_theme())) { |
|
3953 | 3953 | $type = 'TextControl'; |
3954 | 3954 | $value = "(props.attributes.$key ? props.attributes.$key : '')"; |
3955 | 3955 | $args['type'] = 'text'; |
3956 | 3956 | $options .= 'disabled:true,'; |
3957 | - $bsvc_title = esc_attr( addslashes( $args['title'] ) ); |
|
3958 | - $bsvc_body = $this->block_visibility_fields( $args ); |
|
3957 | + $bsvc_title = esc_attr(addslashes($args['title'])); |
|
3958 | + $bsvc_body = $this->block_visibility_fields($args); |
|
3959 | 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>'; |
|
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 | 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() { |
@@ -3976,25 +3976,25 @@ discard block |
||
3976 | 3976 | jQuery('.bs-vc-modal-form').trigger('change'); |
3977 | 3977 | } |
3978 | 3978 | }); |
3979 | - aui_modal('" . $bsvc_title . "', '" . addslashes( $bsvc_body ) . "', '" . $bsvc_footer . "', true, 'bs-vc-modal', 'modal-lg', ''); |
|
3979 | + aui_modal('" . $bsvc_title . "', '" . addslashes($bsvc_body) . "', '" . $bsvc_footer . "', true, 'bs-vc-modal', 'modal-lg', ''); |
|
3980 | 3980 | jQuery(document).off('change', '#bsvc_raw_value').on('change', '#bsvc_raw_value', function(e) { |
3981 | 3981 | props.setAttributes({" . $key . ": e.target.value}); |
3982 | 3982 | }); |
3983 | 3983 | } |
3984 | 3984 | }, |
3985 | - '" . addslashes( ! empty( $args['button_title'] ) ? $args['button_title'] : $args['title'] ) . "' |
|
3985 | + '" . addslashes(!empty($args['button_title']) ? $args['button_title'] : $args['title']) . "' |
|
3986 | 3986 | ) ),"; |
3987 | 3987 | } else { |
3988 | - return;// if we have not implemented the control then don't break the JS. |
|
3988 | + return; // if we have not implemented the control then don't break the JS. |
|
3989 | 3989 | } |
3990 | 3990 | |
3991 | 3991 | // color input does not show the labels so we add them |
3992 | - if($args['type']=='color'){ |
|
3992 | + if ($args['type'] == 'color') { |
|
3993 | 3993 | // add show only if advanced |
3994 | 3994 | echo $require_advanced; |
3995 | 3995 | // add setting require if defined |
3996 | 3996 | echo $element_require; |
3997 | - echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),"; |
|
3997 | + echo "el('div', {style: {'marginBottom': '8px'}}, '" . addslashes($args['title']) . "'),"; |
|
3998 | 3998 | } |
3999 | 3999 | |
4000 | 4000 | // add show only if advanced |
@@ -4006,22 +4006,22 @@ discard block |
||
4006 | 4006 | // icon |
4007 | 4007 | echo $icon; |
4008 | 4008 | ?> |
4009 | - el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type : "wp.components.".$type; ?>, { |
|
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 } ?>, |
|
4012 | - help: <?php echo ( isset( $args['desc'] ) ? "el('span', {dangerouslySetInnerHTML: {__html: '" . trim( wp_kses_post( addslashes( $args['desc'] ) ) ) . "'}})" : "''" ); ?>, |
|
4009 | + el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type : "wp.components." . $type; ?>, { |
|
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 } ?>, |
|
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 | - <?php if ( $type == 'TextControl' && $args['type'] != 'text' ) { |
|
4015 | - echo "type: '" . addslashes( $args['type'] ) . "',"; |
|
4014 | + <?php if ($type == 'TextControl' && $args['type'] != 'text') { |
|
4015 | + echo "type: '" . addslashes($args['type']) . "',"; |
|
4016 | 4016 | } ?> |
4017 | - <?php if ( ! empty( $args['placeholder'] ) ) { |
|
4018 | - echo "placeholder: '" . esc_js( addslashes( trim( esc_html( $args['placeholder'] ) ) ) ) . "',"; |
|
4017 | + <?php if (!empty($args['placeholder'])) { |
|
4018 | + echo "placeholder: '" . esc_js(addslashes(trim(esc_html($args['placeholder'])))) . "',"; |
|
4019 | 4019 | } ?> |
4020 | 4020 | <?php echo $options; ?> |
4021 | 4021 | <?php echo $extra; ?> |
4022 | 4022 | <?php echo $custom_attributes; ?> |
4023 | 4023 | <?php echo $onchangecomplete; ?> |
4024 | - <?php if ( $onchange ) { ?> |
|
4024 | + <?php if ($onchange) { ?> |
|
4025 | 4025 | onChange: function ( <?php echo $key; ?> ) { |
4026 | 4026 | <?php echo $onchange; ?> |
4027 | 4027 | } |
@@ -4040,15 +4040,15 @@ discard block |
||
4040 | 4040 | *@todo there is prob a faster way to do this, also we could add some validation here. |
4041 | 4041 | * |
4042 | 4042 | */ |
4043 | - public function array_to_attributes( $custom_attributes, $html = false ) { |
|
4043 | + public function array_to_attributes($custom_attributes, $html = false) { |
|
4044 | 4044 | $attributes = ''; |
4045 | - if ( ! empty( $custom_attributes ) ) { |
|
4045 | + if (!empty($custom_attributes)) { |
|
4046 | 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',"; |
|
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 | 4052 | } |
4053 | 4053 | } |
4054 | 4054 | |
@@ -4066,113 +4066,113 @@ discard block |
||
4066 | 4066 | * |
4067 | 4067 | * @param $args |
4068 | 4068 | */ |
4069 | - public function block_element( $args, $save = false ) { |
|
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( |
|
4081 | + if (isset($new_args['element_require'])) { |
|
4082 | + echo str_replace(array( |
|
4083 | 4083 | "'+", |
4084 | 4084 | "+'" |
4085 | - ), '', $this->block_props_replace( $new_args['element_require'] ) ) . " && "; |
|
4086 | - unset( $new_args['element_require'] ); |
|
4085 | + ), '', $this->block_props_replace($new_args['element_require'])) . " && "; |
|
4086 | + unset($new_args['element_require']); |
|
4087 | 4087 | } |
4088 | 4088 | |
4089 | - if($new_args['element']=='InnerBlocks'){ |
|
4089 | + if ($new_args['element'] == 'InnerBlocks') { |
|
4090 | 4090 | echo "\n el( InnerBlocks, {"; |
4091 | - }elseif($new_args['element']=='innerBlocksProps'){ |
|
4091 | + }elseif ($new_args['element'] == 'innerBlocksProps') { |
|
4092 | 4092 | $element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div'; |
4093 | 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 | 4095 | echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( "; |
4096 | 4096 | echo $save ? "wp.blockEditor.useBlockProps.save( {" : "wp.blockEditor.useBlockProps( {"; |
4097 | - echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : ''; |
|
4097 | + echo !empty($new_args['blockProps']) ? $this->block_element($new_args['blockProps'], $save) : ''; |
|
4098 | 4098 | |
4099 | 4099 | echo "} ), {"; |
4100 | - echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element( $new_args['innerBlocksProps'],$save ) : ''; |
|
4100 | + echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element($new_args['innerBlocksProps'], $save) : ''; |
|
4101 | 4101 | // echo '###'; |
4102 | 4102 | |
4103 | 4103 | // echo '###'; |
4104 | - }elseif($new_args['element']=='BlocksProps'){ |
|
4104 | + }elseif ($new_args['element'] == 'BlocksProps') { |
|
4105 | 4105 | |
4106 | - if ( isset($new_args['if_inner_element']) ) { |
|
4106 | + if (isset($new_args['if_inner_element'])) { |
|
4107 | 4107 | $element = $new_args['if_inner_element']; |
4108 | - }else { |
|
4109 | - $element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'"; |
|
4108 | + } else { |
|
4109 | + $element = isset($new_args['inner_element']) ? "'" . esc_attr($new_args['inner_element']) . "'" : "'div'"; |
|
4110 | 4110 | } |
4111 | 4111 | |
4112 | 4112 | unset($new_args['inner_element']); |
4113 | 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 ) : ''; |
|
4114 | + echo !empty($new_args['blockProps']) ? $this->block_element($new_args['blockProps'], $save) : ''; |
|
4115 | 4115 | |
4116 | 4116 | |
4117 | 4117 | // echo "} ),"; |
4118 | 4118 | |
4119 | - }else{ |
|
4119 | + } else { |
|
4120 | 4120 | echo "\n el( '" . $new_args['element'] . "', {"; |
4121 | 4121 | } |
4122 | 4122 | |
4123 | 4123 | |
4124 | 4124 | // get the attributes |
4125 | - foreach ( $new_args as $new_key => $new_value ) { |
|
4125 | + foreach ($new_args as $new_key => $new_value) { |
|
4126 | 4126 | |
4127 | 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 ) ) { |
|
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 | 4129 | // do nothing |
4130 | 4130 | } else { |
4131 | - echo $this->block_element( array( $new_key => $new_value ),$save ); |
|
4131 | + echo $this->block_element(array($new_key => $new_value), $save); |
|
4132 | 4132 | } |
4133 | 4133 | } |
4134 | 4134 | |
4135 | - echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes |
|
4135 | + echo $new_args['element'] == 'BlocksProps' ? '} ),' : "},"; // end attributes |
|
4136 | 4136 | |
4137 | 4137 | // get the content |
4138 | 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 ) ) { |
|
4139 | + foreach ($new_args as $new_key => $new_value) { |
|
4140 | + if ($new_key === 'content' || $new_key === 'if_content' || is_array($new_value)) { |
|
4141 | 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 ); |
|
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 | 4146 | } |
4147 | 4147 | |
4148 | - if ( is_array( $new_value ) ) { |
|
4148 | + if (is_array($new_value)) { |
|
4149 | 4149 | |
4150 | - if ( isset( $new_value['element_require'] ) ) { |
|
4151 | - echo str_replace( array( |
|
4150 | + if (isset($new_value['element_require'])) { |
|
4151 | + echo str_replace(array( |
|
4152 | 4152 | "'+", |
4153 | 4153 | "+'" |
4154 | - ), '', $this->block_props_replace( $new_value['element_require'] ) ) . " && "; |
|
4155 | - unset( $new_value['element_require'] ); |
|
4154 | + ), '', $this->block_props_replace($new_value['element_require'])) . " && "; |
|
4155 | + unset($new_value['element_require']); |
|
4156 | 4156 | } |
4157 | 4157 | |
4158 | - if ( isset( $new_value['element_repeat'] ) ) { |
|
4158 | + if (isset($new_value['element_repeat'])) { |
|
4159 | 4159 | $x = 1; |
4160 | - while ( $x <= absint( $new_value['element_repeat'] ) ) { |
|
4161 | - $this->block_element( array( '' => $new_value ),$save ); |
|
4162 | - $x ++; |
|
4160 | + while ($x <= absint($new_value['element_repeat'])) { |
|
4161 | + $this->block_element(array('' => $new_value), $save); |
|
4162 | + $x++; |
|
4163 | 4163 | } |
4164 | 4164 | } else { |
4165 | - $this->block_element( array( '' => $new_value ),$save ); |
|
4165 | + $this->block_element(array('' => $new_value), $save); |
|
4166 | 4166 | } |
4167 | 4167 | } |
4168 | - $first_item ++; |
|
4168 | + $first_item++; |
|
4169 | 4169 | } |
4170 | 4170 | } |
4171 | 4171 | |
4172 | - if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){ |
|
4173 | - echo "))";// end content |
|
4174 | - }else{ |
|
4175 | - echo ")";// end content |
|
4172 | + if ($new_args['element'] == 'innerBlocksProps' || $new_args['element'] == 'xBlocksProps') { |
|
4173 | + echo "))"; // end content |
|
4174 | + } else { |
|
4175 | + echo ")"; // end content |
|
4176 | 4176 | } |
4177 | 4177 | |
4178 | 4178 | |
@@ -4181,26 +4181,26 @@ discard block |
||
4181 | 4181 | } |
4182 | 4182 | } else { |
4183 | 4183 | |
4184 | - if ( substr( $element, 0, 3 ) === "if_" ) { |
|
4184 | + if (substr($element, 0, 3) === "if_") { |
|
4185 | 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); |
|
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 | 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) },"; |
|
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 ) { |
|
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 | 4201 | echo $element . ": $new_args,"; |
4202 | 4202 | } else { |
4203 | - echo $element . ": '" . $this->block_props_replace( $new_args ) . "',"; |
|
4203 | + echo $element . ": '" . $this->block_props_replace($new_args) . "',"; |
|
4204 | 4204 | } |
4205 | 4205 | |
4206 | 4206 | } |
@@ -4215,11 +4215,11 @@ discard block |
||
4215 | 4215 | * |
4216 | 4216 | * @return mixed |
4217 | 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 ); |
|
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 | 4221 | } else { |
4222 | - $string = str_replace( array( "![%", "[%", "%]", "%:checked]" ), array( "'+!props.attributes.", "'+props.attributes.", "+'", "+'" ), $string ); |
|
4222 | + $string = str_replace(array("![%", "[%", "%]", "%:checked]"), array("'+!props.attributes.", "'+props.attributes.", "+'", "+'"), $string); |
|
4223 | 4223 | } |
4224 | 4224 | |
4225 | 4225 | return $string; |
@@ -4231,65 +4231,65 @@ discard block |
||
4231 | 4231 | * @param array $args |
4232 | 4232 | * @param array $instance |
4233 | 4233 | */ |
4234 | - public function widget( $args, $instance ) { |
|
4235 | - if ( ! is_array( $args ) ) { |
|
4234 | + public function widget($args, $instance) { |
|
4235 | + if (!is_array($args)) { |
|
4236 | 4236 | $args = array(); |
4237 | 4237 | } |
4238 | 4238 | |
4239 | 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 ); |
|
4240 | + $argument_values = $this->argument_values($instance); |
|
4241 | + $argument_values = $this->string_to_bool($argument_values); |
|
4242 | + $output = $this->output($argument_values, $args); |
|
4243 | 4243 | |
4244 | 4244 | $no_wrap = false; |
4245 | - if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) { |
|
4245 | + if (isset($argument_values['no_wrap']) && $argument_values['no_wrap']) { |
|
4246 | 4246 | $no_wrap = true; |
4247 | 4247 | } |
4248 | 4248 | |
4249 | 4249 | ob_start(); |
4250 | - if ( $output && ! $no_wrap ) { |
|
4250 | + if ($output && !$no_wrap) { |
|
4251 | 4251 | |
4252 | 4252 | $class_original = $this->options['widget_ops']['classname']; |
4253 | - $class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash(); |
|
4253 | + $class = $this->options['widget_ops']['classname'] . " sdel-" . $this->get_instance_hash(); |
|
4254 | 4254 | |
4255 | 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 ); |
|
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 | 4260 | |
4261 | 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 ); |
|
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 | 4265 | |
4266 | 4266 | echo $before_widget; |
4267 | 4267 | // elementor strips the widget wrapping div so we check for and add it back if needed |
4268 | - if ( $this->is_elementor_widget_output() ) { |
|
4268 | + if ($this->is_elementor_widget_output()) { |
|
4269 | 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 ); |
|
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 | 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 ); |
|
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 | 4275 | |
4276 | - echo "<span class='" . esc_attr( $class ) . "' " . $attrs . ">"; |
|
4276 | + echo "<span class='" . esc_attr($class) . "' " . $attrs . ">"; |
|
4277 | 4277 | } |
4278 | - echo $this->output_title( $args, $instance ); |
|
4278 | + echo $this->output_title($args, $instance); |
|
4279 | 4279 | echo $output; |
4280 | - if ( $this->is_elementor_widget_output() ) { |
|
4280 | + if ($this->is_elementor_widget_output()) { |
|
4281 | 4281 | echo "</span>"; |
4282 | 4282 | } |
4283 | 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 . "}}" ); |
|
4284 | + } elseif ($this->is_preview() && $output == '') {// if preview show a placeholder if empty |
|
4285 | + $output = $this->preview_placeholder_text("{{" . $this->base_id . "}}"); |
|
4286 | 4286 | echo $output; |
4287 | - } elseif ( $output && $no_wrap ) { |
|
4287 | + } elseif ($output && $no_wrap) { |
|
4288 | 4288 | echo $output; |
4289 | 4289 | } |
4290 | 4290 | $output = ob_get_clean(); |
4291 | 4291 | |
4292 | - $output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this ); |
|
4292 | + $output = apply_filters('wp_super_duper_widget_output', $output, $instance, $args, $this); |
|
4293 | 4293 | |
4294 | 4294 | echo $output; |
4295 | 4295 | } |
@@ -4302,7 +4302,7 @@ discard block |
||
4302 | 4302 | */ |
4303 | 4303 | public function is_elementor_widget_output() { |
4304 | 4304 | $result = false; |
4305 | - if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) { |
|
4305 | + if (defined('ELEMENTOR_VERSION') && isset($this->number) && $this->number == 'REPLACE_TO_ID') { |
|
4306 | 4306 | $result = true; |
4307 | 4307 | } |
4308 | 4308 | |
@@ -4317,7 +4317,7 @@ discard block |
||
4317 | 4317 | */ |
4318 | 4318 | public function is_elementor_preview() { |
4319 | 4319 | $result = false; |
4320 | - if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) { |
|
4320 | + if (isset($_REQUEST['elementor-preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor_ajax')) { |
|
4321 | 4321 | $result = true; |
4322 | 4322 | } |
4323 | 4323 | |
@@ -4332,7 +4332,7 @@ discard block |
||
4332 | 4332 | */ |
4333 | 4333 | public function is_divi_preview() { |
4334 | 4334 | $result = false; |
4335 | - if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) { |
|
4335 | + if (isset($_REQUEST['et_fb']) || isset($_REQUEST['et_pb_preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor')) { |
|
4336 | 4336 | $result = true; |
4337 | 4337 | } |
4338 | 4338 | |
@@ -4347,7 +4347,7 @@ discard block |
||
4347 | 4347 | */ |
4348 | 4348 | public function is_beaver_preview() { |
4349 | 4349 | $result = false; |
4350 | - if ( isset( $_REQUEST['fl_builder'] ) ) { |
|
4350 | + if (isset($_REQUEST['fl_builder'])) { |
|
4351 | 4351 | $result = true; |
4352 | 4352 | } |
4353 | 4353 | |
@@ -4362,7 +4362,7 @@ discard block |
||
4362 | 4362 | */ |
4363 | 4363 | public function is_siteorigin_preview() { |
4364 | 4364 | $result = false; |
4365 | - if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) { |
|
4365 | + if (!empty($_REQUEST['siteorigin_panels_live_editor'])) { |
|
4366 | 4366 | $result = true; |
4367 | 4367 | } |
4368 | 4368 | |
@@ -4377,7 +4377,7 @@ discard block |
||
4377 | 4377 | */ |
4378 | 4378 | public function is_cornerstone_preview() { |
4379 | 4379 | $result = false; |
4380 | - if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) { |
|
4380 | + if (!empty($_REQUEST['cornerstone_preview']) || basename($_SERVER['REQUEST_URI']) == 'cornerstone-endpoint') { |
|
4381 | 4381 | $result = true; |
4382 | 4382 | } |
4383 | 4383 | |
@@ -4392,7 +4392,7 @@ discard block |
||
4392 | 4392 | */ |
4393 | 4393 | public function is_fusion_preview() { |
4394 | 4394 | $result = false; |
4395 | - if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) { |
|
4395 | + if (!empty($_REQUEST['fb-edit']) || !empty($_REQUEST['fusion_load_nonce'])) { |
|
4396 | 4396 | $result = true; |
4397 | 4397 | } |
4398 | 4398 | |
@@ -4407,7 +4407,7 @@ discard block |
||
4407 | 4407 | */ |
4408 | 4408 | public function is_oxygen_preview() { |
4409 | 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_" ) ) ) { |
|
4410 | + if (!empty($_REQUEST['ct_builder']) || (!empty($_REQUEST['action']) && (substr($_REQUEST['action'], 0, 11) === "oxy_render_" || substr($_REQUEST['action'], 0, 10) === "ct_render_"))) { |
|
4411 | 4411 | $result = true; |
4412 | 4412 | } |
4413 | 4413 | |
@@ -4424,7 +4424,7 @@ discard block |
||
4424 | 4424 | public function is_kallyas_zion_preview() { |
4425 | 4425 | $result = false; |
4426 | 4426 | |
4427 | - if ( function_exists( 'znhg_kallyas_theme_config' ) && ! empty( $_REQUEST['zn_pb_edit'] ) ) { |
|
4427 | + if (function_exists('znhg_kallyas_theme_config') && !empty($_REQUEST['zn_pb_edit'])) { |
|
4428 | 4428 | $result = true; |
4429 | 4429 | } |
4430 | 4430 | |
@@ -4441,7 +4441,7 @@ discard block |
||
4441 | 4441 | public function is_bricks_preview() { |
4442 | 4442 | $result = false; |
4443 | 4443 | |
4444 | - if ( function_exists( 'bricks_is_builder' ) && ( bricks_is_builder() || bricks_is_builder_call() ) ) { |
|
4444 | + if (function_exists('bricks_is_builder') && (bricks_is_builder() || bricks_is_builder_call())) { |
|
4445 | 4445 | $result = true; |
4446 | 4446 | } |
4447 | 4447 | |
@@ -4456,25 +4456,25 @@ discard block |
||
4456 | 4456 | */ |
4457 | 4457 | public function is_preview() { |
4458 | 4458 | $preview = false; |
4459 | - if ( $this->is_divi_preview() ) { |
|
4459 | + if ($this->is_divi_preview()) { |
|
4460 | 4460 | $preview = true; |
4461 | - } elseif ( $this->is_elementor_preview() ) { |
|
4461 | + } elseif ($this->is_elementor_preview()) { |
|
4462 | 4462 | $preview = true; |
4463 | - } elseif ( $this->is_beaver_preview() ) { |
|
4463 | + } elseif ($this->is_beaver_preview()) { |
|
4464 | 4464 | $preview = true; |
4465 | - } elseif ( $this->is_siteorigin_preview() ) { |
|
4465 | + } elseif ($this->is_siteorigin_preview()) { |
|
4466 | 4466 | $preview = true; |
4467 | - } elseif ( $this->is_cornerstone_preview() ) { |
|
4467 | + } elseif ($this->is_cornerstone_preview()) { |
|
4468 | 4468 | $preview = true; |
4469 | - } elseif ( $this->is_fusion_preview() ) { |
|
4469 | + } elseif ($this->is_fusion_preview()) { |
|
4470 | 4470 | $preview = true; |
4471 | - } elseif ( $this->is_oxygen_preview() ) { |
|
4471 | + } elseif ($this->is_oxygen_preview()) { |
|
4472 | 4472 | $preview = true; |
4473 | - } elseif( $this->is_kallyas_zion_preview() ) { |
|
4473 | + } elseif ($this->is_kallyas_zion_preview()) { |
|
4474 | 4474 | $preview = true; |
4475 | - } elseif( $this->is_block_content_call() ) { |
|
4475 | + } elseif ($this->is_block_content_call()) { |
|
4476 | 4476 | $preview = true; |
4477 | - } elseif( $this->is_bricks_preview() ) { |
|
4477 | + } elseif ($this->is_bricks_preview()) { |
|
4478 | 4478 | $preview = true; |
4479 | 4479 | } |
4480 | 4480 | |
@@ -4489,44 +4489,44 @@ discard block |
||
4489 | 4489 | * |
4490 | 4490 | * @return string |
4491 | 4491 | */ |
4492 | - public function output_title( $args, $instance = array() ) { |
|
4492 | + public function output_title($args, $instance = array()) { |
|
4493 | 4493 | $output = ''; |
4494 | - if ( ! empty( $instance['title'] ) ) { |
|
4494 | + if (!empty($instance['title'])) { |
|
4495 | 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 ); |
|
4496 | + $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); |
|
4497 | 4497 | |
4498 | - if ( empty( $instance['widget_title_tag'] ) ) { |
|
4499 | - if ( ! isset( $args['before_title'] ) ) { |
|
4498 | + if (empty($instance['widget_title_tag'])) { |
|
4499 | + if (!isset($args['before_title'])) { |
|
4500 | 4500 | $args['before_title'] = ''; |
4501 | 4501 | } |
4502 | 4502 | |
4503 | - if ( ! isset( $args['after_title'] ) ) { |
|
4503 | + if (!isset($args['after_title'])) { |
|
4504 | 4504 | $args['after_title'] = ''; |
4505 | 4505 | } |
4506 | 4506 | |
4507 | 4507 | $output = $args['before_title'] . $title . $args['after_title']; |
4508 | 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'; |
|
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 | 4512 | |
4513 | 4513 | // classes |
4514 | 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) : ''; |
|
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 | 4530 | $output = "<$title_tag class='$class' >$title</$title_tag>"; |
4531 | 4531 | } |
4532 | 4532 | |
@@ -4540,7 +4540,7 @@ discard block |
||
4540 | 4540 | * |
4541 | 4541 | * @param array $instance The widget options. |
4542 | 4542 | */ |
4543 | - public function form( $instance ) { |
|
4543 | + public function form($instance) { |
|
4544 | 4544 | |
4545 | 4545 | // set widget instance |
4546 | 4546 | $this->instance = $instance; |
@@ -4548,20 +4548,20 @@ discard block |
||
4548 | 4548 | // set it as a SD widget |
4549 | 4549 | echo $this->widget_advanced_toggle(); |
4550 | 4550 | |
4551 | - echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>"; |
|
4551 | + echo "<p>" . esc_attr($this->options['widget_ops']['description']) . "</p>"; |
|
4552 | 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 | 4558 | // Do we have sections? |
4559 | 4559 | $has_sections = $arguments == $arguments_raw ? false : true; |
4560 | 4560 | |
4561 | 4561 | |
4562 | - if ( $has_sections ) { |
|
4562 | + if ($has_sections) { |
|
4563 | 4563 | $panel_count = 0; |
4564 | - foreach ( $arguments as $key => $args ) { |
|
4564 | + foreach ($arguments as $key => $args) { |
|
4565 | 4565 | |
4566 | 4566 | ?> |
4567 | 4567 | <script> |
@@ -4571,26 +4571,26 @@ discard block |
||
4571 | 4571 | |
4572 | 4572 | $hide = $panel_count ? ' style="display:none;" ' : ''; |
4573 | 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>"; |
|
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 | 4579 | $this->widget_inputs_row_start($k, $a); |
4580 | - $this->widget_inputs( $a, $instance ); |
|
4580 | + $this->widget_inputs($a, $instance); |
|
4581 | 4581 | $this->widget_inputs_row_end($k, $a); |
4582 | 4582 | |
4583 | 4583 | } |
4584 | 4584 | |
4585 | 4585 | echo "</div>"; |
4586 | 4586 | |
4587 | - $panel_count ++; |
|
4587 | + $panel_count++; |
|
4588 | 4588 | |
4589 | 4589 | } |
4590 | 4590 | } else { |
4591 | - foreach ( $arguments as $key => $args ) { |
|
4591 | + foreach ($arguments as $key => $args) { |
|
4592 | 4592 | $this->widget_inputs_row_start($key, $args); |
4593 | - $this->widget_inputs( $args, $instance ); |
|
4593 | + $this->widget_inputs($args, $instance); |
|
4594 | 4594 | $this->widget_inputs_row_end($key, $args); |
4595 | 4595 | } |
4596 | 4596 | } |
@@ -4598,28 +4598,28 @@ discard block |
||
4598 | 4598 | } |
4599 | 4599 | } |
4600 | 4600 | |
4601 | - public function widget_inputs_row_start( $key, $args ) { |
|
4602 | - if ( ! empty( $args['row'] ) ) { |
|
4601 | + public function widget_inputs_row_start($key, $args) { |
|
4602 | + if (!empty($args['row'])) { |
|
4603 | 4603 | // Maybe open |
4604 | - if ( ! empty( $args['row']['open'] ) ) { |
|
4604 | + if (!empty($args['row']['open'])) { |
|
4605 | 4605 | ?> |
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 | - <?php if ( ! empty( $args['row']['title'] ) ) { ?> |
|
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 | + <?php if (!empty($args['row']['title'])) { ?> |
|
4608 | 4608 | <?php |
4609 | - if ( isset( $args['row']['icon'] ) ) { |
|
4609 | + if (isset($args['row']['icon'])) { |
|
4610 | 4610 | $args['row']['icon'] = ''; |
4611 | 4611 | } |
4612 | 4612 | |
4613 | - if ( ! isset( $args['row']['device_type'] ) && isset( $args['device_type'] ) ) { |
|
4613 | + if (!isset($args['row']['device_type']) && isset($args['device_type'])) { |
|
4614 | 4614 | $args['row']['device_type'] = $args['device_type']; |
4615 | 4615 | } |
4616 | 4616 | ?> |
4617 | - <label class="mb-0"><?php echo $this->widget_field_title( $args['row'] ); ?><?php echo $this->widget_field_desc( $args['row'] ); ?></label> |
|
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 | - <div class='row<?php echo ( ! empty( $args['row']['class'] ) ? ' ' . esc_attr( $args['row']['class'] ) : '' ); ?>'> |
|
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'] ) ) { |
|
4622 | + } else if (!empty($args['row']['close'])) { |
|
4623 | 4623 | echo "<div class='col pl-0 ps-0'>"; |
4624 | 4624 | } else { |
4625 | 4625 | echo "<div class='col pl-0 ps-0 pr-2 pe-2'>"; |
@@ -4627,10 +4627,10 @@ discard block |
||
4627 | 4627 | } |
4628 | 4628 | } |
4629 | 4629 | |
4630 | - public function widget_inputs_row_end( $key, $args ) { |
|
4631 | - if ( ! empty( $args['row'] ) ) { |
|
4630 | + public function widget_inputs_row_end($key, $args) { |
|
4631 | + if (!empty($args['row'])) { |
|
4632 | 4632 | // Maybe close |
4633 | - if ( ! empty( $args['row']['close'] ) ) { |
|
4633 | + if (!empty($args['row']['close'])) { |
|
4634 | 4634 | echo "</div></div>"; |
4635 | 4635 | } |
4636 | 4636 | echo "</div>"; |
@@ -4645,7 +4645,7 @@ discard block |
||
4645 | 4645 | public function widget_advanced_toggle() { |
4646 | 4646 | |
4647 | 4647 | $output = ''; |
4648 | - if ( $this->block_show_advanced() ) { |
|
4648 | + if ($this->block_show_advanced()) { |
|
4649 | 4649 | $val = 1; |
4650 | 4650 | } else { |
4651 | 4651 | $val = 0; |
@@ -4665,14 +4665,14 @@ discard block |
||
4665 | 4665 | *@since 1.0.0 |
4666 | 4666 | * |
4667 | 4667 | */ |
4668 | - public function convert_element_require( $input ) { |
|
4669 | - $input = str_replace( "'", '"', $input );// we only want double quotes |
|
4668 | + public function convert_element_require($input) { |
|
4669 | + $input = str_replace("'", '"', $input); // we only want double quotes |
|
4670 | 4670 | |
4671 | - $output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array( |
|
4671 | + $output = esc_attr(str_replace(array("[%", "%]", "%:checked]"), array( |
|
4672 | 4672 | "jQuery(form).find('[data-argument=\"", |
4673 | 4673 | "\"]').find('input,select,textarea').val()", |
4674 | 4674 | "\"]').find('input:checked').val()" |
4675 | - ), $input ) ); |
|
4675 | + ), $input)); |
|
4676 | 4676 | |
4677 | 4677 | return $output; |
4678 | 4678 | } |
@@ -4683,48 +4683,48 @@ discard block |
||
4683 | 4683 | * @param $args |
4684 | 4684 | * @param $instance |
4685 | 4685 | */ |
4686 | - public function widget_inputs( $args, $instance ) { |
|
4686 | + public function widget_inputs($args, $instance) { |
|
4687 | 4687 | |
4688 | 4688 | $class = ""; |
4689 | 4689 | $element_require = ""; |
4690 | 4690 | $custom_attributes = ""; |
4691 | 4691 | |
4692 | 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'] ); |
|
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 | 4697 | } else { |
4698 | 4698 | $value = ''; |
4699 | 4699 | } |
4700 | 4700 | |
4701 | 4701 | // get placeholder |
4702 | - if ( ! empty( $args['placeholder'] ) ) { |
|
4703 | - $placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'"; |
|
4702 | + if (!empty($args['placeholder'])) { |
|
4703 | + $placeholder = "placeholder='" . esc_html($args['placeholder']) . "'"; |
|
4704 | 4704 | } else { |
4705 | 4705 | $placeholder = ''; |
4706 | 4706 | } |
4707 | 4707 | |
4708 | 4708 | // get if advanced |
4709 | - if ( isset( $args['advanced'] ) && $args['advanced'] ) { |
|
4709 | + if (isset($args['advanced']) && $args['advanced']) { |
|
4710 | 4710 | $class .= " sd-advanced-setting "; |
4711 | 4711 | } |
4712 | 4712 | |
4713 | 4713 | // element_require |
4714 | - if ( isset( $args['element_require'] ) && $args['element_require'] ) { |
|
4714 | + if (isset($args['element_require']) && $args['element_require']) { |
|
4715 | 4715 | $element_require = $args['element_require']; |
4716 | 4716 | } |
4717 | 4717 | |
4718 | 4718 | // custom_attributes |
4719 | - if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) { |
|
4720 | - $custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true ); |
|
4719 | + if (isset($args['custom_attributes']) && $args['custom_attributes']) { |
|
4720 | + $custom_attributes = $this->array_to_attributes($args['custom_attributes'], true); |
|
4721 | 4721 | } |
4722 | 4722 | |
4723 | 4723 | // before wrapper |
4724 | 4724 | ?> |
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 );} ?>'> |
|
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'] ) { |
|
4727 | + switch ($args['type']) { |
|
4728 | 4728 | //array('text','password','number','email','tel','url','color') |
4729 | 4729 | case "text": |
4730 | 4730 | case "password": |
@@ -4734,33 +4734,33 @@ discard block |
||
4734 | 4734 | case "url": |
4735 | 4735 | case "color": |
4736 | 4736 | ?> |
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 | - <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 ); ?>"> |
|
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 | + <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 | 4741 | break; |
4742 | 4742 | case "select": |
4743 | - $multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false; |
|
4744 | - if ( $multiple ) { |
|
4745 | - if ( empty( $value ) ) { |
|
4743 | + $multiple = isset($args['multiple']) && $args['multiple'] ? true : false; |
|
4744 | + if ($multiple) { |
|
4745 | + if (empty($value)) { |
|
4746 | 4746 | $value = array(); |
4747 | 4747 | } |
4748 | 4748 | } |
4749 | 4749 | ?> |
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 | - <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 | - <?php if ( $multiple ) { |
|
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 | + <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 | + <?php if ($multiple) { |
|
4753 | 4753 | echo "multiple"; |
4754 | 4754 | } //@todo not implemented yet due to gutenberg not supporting it |
4755 | 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"' : ''; |
|
4758 | + if (!empty($args['options'])) { |
|
4759 | + foreach ($args['options'] as $val => $label) { |
|
4760 | + if ($multiple) { |
|
4761 | + $selected = in_array($val, $value) ? 'selected="selected"' : ''; |
|
4762 | 4762 | } else { |
4763 | - $selected = selected( $value, $val, false ); |
|
4763 | + $selected = selected($value, $val, false); |
|
4764 | 4764 | } |
4765 | 4765 | echo "<option value='$val' " . $selected . ">$label</option>"; |
4766 | 4766 | } |
@@ -4771,20 +4771,20 @@ discard block |
||
4771 | 4771 | break; |
4772 | 4772 | case "checkbox": |
4773 | 4773 | ?> |
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 | - <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> |
|
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 | + <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 | 4777 | break; |
4778 | 4778 | case "textarea": |
4779 | 4779 | ?> |
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 | - <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> |
|
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 | + <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 | 4784 | break; |
4785 | 4785 | case "hidden": |
4786 | 4786 | ?> |
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 ); ?>"> |
|
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 | 4789 | break; |
4790 | 4790 | default: |
@@ -4794,15 +4794,15 @@ discard block |
||
4794 | 4794 | ?></p><?php |
4795 | 4795 | } |
4796 | 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>'; |
|
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 | 4806 | } |
4807 | 4807 | } |
4808 | 4808 | |
@@ -4814,14 +4814,14 @@ discard block |
||
4814 | 4814 | * @return string |
4815 | 4815 | * @todo, need to make its own tooltip script |
4816 | 4816 | */ |
4817 | - public function widget_field_desc( $args ) { |
|
4817 | + public function widget_field_desc($args) { |
|
4818 | 4818 | |
4819 | 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'] ); |
|
4820 | + if (isset($args['desc']) && $args['desc']) { |
|
4821 | + if (isset($args['desc_tip']) && $args['desc_tip']) { |
|
4822 | + $description = $this->desc_tip($args['desc']); |
|
4823 | 4823 | } else { |
4824 | - $description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>'; |
|
4824 | + $description = '<span class="description">' . wp_kses_post($args['desc']) . '</span>'; |
|
4825 | 4825 | } |
4826 | 4826 | } |
4827 | 4827 | |
@@ -4835,18 +4835,18 @@ discard block |
||
4835 | 4835 | * |
4836 | 4836 | * @return string |
4837 | 4837 | */ |
4838 | - public function widget_field_title( $args ) { |
|
4838 | + public function widget_field_title($args) { |
|
4839 | 4839 | $title = ''; |
4840 | 4840 | |
4841 | - if ( isset( $args['title'] ) && $args['title'] ) { |
|
4842 | - if ( ! empty( $args['device_type'] ) ) { |
|
4841 | + if (isset($args['title']) && $args['title']) { |
|
4842 | + if (!empty($args['device_type'])) { |
|
4843 | 4843 | $args['title'] .= ' (' . $args['device_type'] . ')'; // Append device type to title. |
4844 | 4844 | } |
4845 | 4845 | |
4846 | - if ( isset( $args['icon'] ) && $args['icon'] ) { |
|
4847 | - $title = self::get_widget_icon( $args['icon'], $args['title'] ); |
|
4846 | + if (isset($args['icon']) && $args['icon']) { |
|
4847 | + $title = self::get_widget_icon($args['icon'], $args['title']); |
|
4848 | 4848 | } else { |
4849 | - $title = esc_attr( $args['title'] ); |
|
4849 | + $title = esc_attr($args['title']); |
|
4850 | 4850 | } |
4851 | 4851 | } |
4852 | 4852 | |
@@ -4861,11 +4861,11 @@ discard block |
||
4861 | 4861 | * |
4862 | 4862 | * @return string |
4863 | 4863 | */ |
4864 | - function desc_tip( $tip, $allow_html = false ) { |
|
4865 | - if ( $allow_html ) { |
|
4866 | - $tip = $this->sanitize_tooltip( $tip ); |
|
4864 | + function desc_tip($tip, $allow_html = false) { |
|
4865 | + if ($allow_html) { |
|
4866 | + $tip = $this->sanitize_tooltip($tip); |
|
4867 | 4867 | } else { |
4868 | - $tip = esc_attr( $tip ); |
|
4868 | + $tip = esc_attr($tip); |
|
4869 | 4869 | } |
4870 | 4870 | |
4871 | 4871 | return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>'; |
@@ -4878,8 +4878,8 @@ discard block |
||
4878 | 4878 | * |
4879 | 4879 | * @return string |
4880 | 4880 | */ |
4881 | - public function sanitize_tooltip( $var ) { |
|
4882 | - return htmlspecialchars( wp_kses( html_entity_decode( $var ), array( |
|
4881 | + public function sanitize_tooltip($var) { |
|
4882 | + return htmlspecialchars(wp_kses(html_entity_decode($var), array( |
|
4883 | 4883 | 'br' => array(), |
4884 | 4884 | 'em' => array(), |
4885 | 4885 | 'strong' => array(), |
@@ -4889,7 +4889,7 @@ discard block |
||
4889 | 4889 | 'li' => array(), |
4890 | 4890 | 'ol' => array(), |
4891 | 4891 | 'p' => array(), |
4892 | - ) ) ); |
|
4892 | + ))); |
|
4893 | 4893 | } |
4894 | 4894 | |
4895 | 4895 | /** |
@@ -4901,23 +4901,23 @@ discard block |
||
4901 | 4901 | * @return array |
4902 | 4902 | * @todo we should add some sanitation here. |
4903 | 4903 | */ |
4904 | - public function update( $new_instance, $old_instance ) { |
|
4904 | + public function update($new_instance, $old_instance) { |
|
4905 | 4905 | |
4906 | 4906 | //save the widget |
4907 | - $instance = array_merge( (array) $old_instance, (array) $new_instance ); |
|
4907 | + $instance = array_merge((array) $old_instance, (array) $new_instance); |
|
4908 | 4908 | |
4909 | 4909 | // set widget instance |
4910 | 4910 | $this->instance = $instance; |
4911 | 4911 | |
4912 | - if ( empty( $this->arguments ) ) { |
|
4912 | + if (empty($this->arguments)) { |
|
4913 | 4913 | $this->get_arguments(); |
4914 | 4914 | } |
4915 | 4915 | |
4916 | 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'; |
|
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 | 4921 | } |
4922 | 4922 | } |
4923 | 4923 | } |
@@ -4935,7 +4935,7 @@ discard block |
||
4935 | 4935 | */ |
4936 | 4936 | public function is_block_content_call() { |
4937 | 4937 | $result = false; |
4938 | - if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) { |
|
4938 | + if (wp_doing_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'super_duper_output_shortcode') { |
|
4939 | 4939 | $result = true; |
4940 | 4940 | } |
4941 | 4941 | |
@@ -4948,9 +4948,9 @@ discard block |
||
4948 | 4948 | * @return string |
4949 | 4949 | *@since 1.0.20 |
4950 | 4950 | */ |
4951 | - public function get_instance_hash(){ |
|
4952 | - $instance_string = $this->base_id.serialize($this->instance); |
|
4953 | - return hash('crc32b',$instance_string); |
|
4951 | + public function get_instance_hash() { |
|
4952 | + $instance_string = $this->base_id . serialize($this->instance); |
|
4953 | + return hash('crc32b', $instance_string); |
|
4954 | 4954 | } |
4955 | 4955 | |
4956 | 4956 | /** |
@@ -4961,14 +4961,14 @@ discard block |
||
4961 | 4961 | * @return string |
4962 | 4962 | *@since 1.0.20 |
4963 | 4963 | */ |
4964 | - public function get_instance_style($rules = array()){ |
|
4964 | + public function get_instance_style($rules = array()) { |
|
4965 | 4965 | $css = ''; |
4966 | 4966 | |
4967 | - if(!empty($rules)){ |
|
4967 | + if (!empty($rules)) { |
|
4968 | 4968 | $rules = array_unique($rules); |
4969 | 4969 | $instance_hash = $this->get_instance_hash(); |
4970 | 4970 | $css .= "<style>"; |
4971 | - foreach($rules as $rule){ |
|
4971 | + foreach ($rules as $rule) { |
|
4972 | 4972 | $css .= ".sdel-$instance_hash $rule"; |
4973 | 4973 | } |
4974 | 4974 | $css .= "</style>"; |
@@ -4986,9 +4986,9 @@ discard block |
||
4986 | 4986 | *@since 1.0.28 |
4987 | 4987 | * |
4988 | 4988 | */ |
4989 | - public function encode_shortcodes( $content ) { |
|
4989 | + public function encode_shortcodes($content) { |
|
4990 | 4990 | // Avoids existing encoded tags. |
4991 | - $trans = array( |
|
4991 | + $trans = array( |
|
4992 | 4992 | '[' => '[', |
4993 | 4993 | ']' => ']', |
4994 | 4994 | '&#91;' => '[', |
@@ -4999,7 +4999,7 @@ discard block |
||
4999 | 4999 | '&gt;' => '&0gt;', |
5000 | 5000 | ); |
5001 | 5001 | |
5002 | - $content = strtr( $content, $trans ); |
|
5002 | + $content = strtr($content, $trans); |
|
5003 | 5003 | |
5004 | 5004 | $trans = array( |
5005 | 5005 | '[' => '[', |
@@ -5010,7 +5010,7 @@ discard block |
||
5010 | 5010 | "'" => ''', |
5011 | 5011 | ); |
5012 | 5012 | |
5013 | - $content = strtr( $content, $trans ); |
|
5013 | + $content = strtr($content, $trans); |
|
5014 | 5014 | |
5015 | 5015 | return $content; |
5016 | 5016 | } |
@@ -5024,8 +5024,8 @@ discard block |
||
5024 | 5024 | *@since 1.0.28 |
5025 | 5025 | * |
5026 | 5026 | */ |
5027 | - public function decode_shortcodes( $content ) { |
|
5028 | - $trans = array( |
|
5027 | + public function decode_shortcodes($content) { |
|
5028 | + $trans = array( |
|
5029 | 5029 | '[' => '[', |
5030 | 5030 | ']' => ']', |
5031 | 5031 | '&#91;' => '[', |
@@ -5038,7 +5038,7 @@ discard block |
||
5038 | 5038 | ''' => "'", |
5039 | 5039 | ); |
5040 | 5040 | |
5041 | - $content = strtr( $content, $trans ); |
|
5041 | + $content = strtr($content, $trans); |
|
5042 | 5042 | |
5043 | 5043 | $trans = array( |
5044 | 5044 | '[' => '[', |
@@ -5051,31 +5051,31 @@ discard block |
||
5051 | 5051 | '&0gt;' => '>', |
5052 | 5052 | ); |
5053 | 5053 | |
5054 | - $content = strtr( $content, $trans ); |
|
5054 | + $content = strtr($content, $trans); |
|
5055 | 5055 | |
5056 | 5056 | return $content; |
5057 | 5057 | } |
5058 | 5058 | |
5059 | - public function block_visibility_fields( $args ) { |
|
5060 | - $value = ! empty( $args['value'] ) ? esc_attr( $args['value'] ) : ''; |
|
5059 | + public function block_visibility_fields($args) { |
|
5060 | + $value = !empty($args['value']) ? esc_attr($args['value']) : ''; |
|
5061 | 5061 | $content = '<div class="bs-vc-rule-template d-none">'; |
5062 | 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 | 5063 | $content .= '<div class="row">'; |
5064 | 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>'; |
|
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 | 5066 | $content .= aui()->select( |
5067 | 5067 | array( |
5068 | 5068 | 'id' => 'bsvc_rule_BSVCINDEX', |
5069 | 5069 | 'name' => 'bsvc_rule_BSVCINDEX', |
5070 | - 'label' => __( 'Rule', 'ayecode-connect' ), |
|
5071 | - 'placeholder' => __( 'Select Rule...', 'ayecode-connect' ), |
|
5070 | + 'label' => __('Rule', 'ayecode-connect'), |
|
5071 | + 'placeholder' => __('Select Rule...', 'ayecode-connect'), |
|
5072 | 5072 | 'class' => 'bsvc_rule form-select-sm no-select2 mw-100', |
5073 | 5073 | 'options' => sd_visibility_rules_options(), |
5074 | 5074 | 'default' => '', |
5075 | 5075 | 'value' => '', |
5076 | 5076 | 'label_type' => '', |
5077 | 5077 | 'select2' => false, |
5078 | - 'input_group_left' => __( 'Rule:', 'ayecode-connect' ), |
|
5078 | + 'input_group_left' => __('Rule:', 'ayecode-connect'), |
|
5079 | 5079 | 'extra_attributes' => array( |
5080 | 5080 | 'data-minimum-results-for-search' => '-1' |
5081 | 5081 | ) |
@@ -5084,15 +5084,15 @@ discard block |
||
5084 | 5084 | |
5085 | 5085 | $content .= '</div>'; |
5086 | 5086 | |
5087 | - if ( class_exists( 'GeoDirectory' ) ) { |
|
5087 | + if (class_exists('GeoDirectory')) { |
|
5088 | 5088 | $content .= '<div class="col-md-7 col-sm-12">'; |
5089 | 5089 | |
5090 | 5090 | $content .= aui()->select( |
5091 | 5091 | array( |
5092 | 5092 | 'id' => 'bsvc_gd_field_BSVCINDEX', |
5093 | 5093 | 'name' => 'bsvc_gd_field_BSVCINDEX', |
5094 | - 'label' => __( 'FIELD', 'ayecode-connect' ), |
|
5095 | - 'placeholder' => __( 'FIELD', 'ayecode-connect' ), |
|
5094 | + 'label' => __('FIELD', 'ayecode-connect'), |
|
5095 | + 'placeholder' => __('FIELD', 'ayecode-connect'), |
|
5096 | 5096 | 'class' => 'bsvc_gd_field form-select-sm no-select2 mw-100', |
5097 | 5097 | 'options' => sd_visibility_gd_field_options(), |
5098 | 5098 | 'default' => '', |
@@ -5113,8 +5113,8 @@ discard block |
||
5113 | 5113 | array( |
5114 | 5114 | 'id' => 'bsvc_gd_field_condition_BSVCINDEX', |
5115 | 5115 | 'name' => 'bsvc_gd_field_condition_BSVCINDEX', |
5116 | - 'label' => __( 'CONDITION', 'ayecode-connect' ), |
|
5117 | - 'placeholder' => __( 'CONDITION', 'ayecode-connect' ), |
|
5116 | + 'label' => __('CONDITION', 'ayecode-connect'), |
|
5117 | + 'placeholder' => __('CONDITION', 'ayecode-connect'), |
|
5118 | 5118 | 'class' => 'bsvc_gd_field_condition form-select-sm no-select2 mw-100', |
5119 | 5119 | 'options' => sd_visibility_field_condition_options(), |
5120 | 5120 | 'default' => '', |
@@ -5136,9 +5136,9 @@ discard block |
||
5136 | 5136 | 'type' => 'text', |
5137 | 5137 | 'id' => 'bsvc_gd_field_search_BSVCINDEX', |
5138 | 5138 | 'name' => 'bsvc_gd_field_search_BSVCINDEX', |
5139 | - 'label' => __( 'VALUE TO MATCH', 'ayecode-connect' ), |
|
5139 | + 'label' => __('VALUE TO MATCH', 'ayecode-connect'), |
|
5140 | 5140 | 'class' => 'bsvc_gd_field_search form-control-sm', |
5141 | - 'placeholder' => __( 'VALUE TO MATCH', 'ayecode-connect' ), |
|
5141 | + 'placeholder' => __('VALUE TO MATCH', 'ayecode-connect'), |
|
5142 | 5142 | 'label_type' => '', |
5143 | 5143 | 'value' => '', |
5144 | 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")' |
@@ -5150,11 +5150,11 @@ discard block |
||
5150 | 5150 | |
5151 | 5151 | $content .= '</div>'; |
5152 | 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>'; |
|
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 | 5154 | $role_options = sd_user_roles_options(); |
5155 | 5155 | |
5156 | 5156 | $role_option_i = 0; |
5157 | - foreach ( $role_options as $role_option_key => $role_option_name ) { |
|
5157 | + foreach ($role_options as $role_option_key => $role_option_name) { |
|
5158 | 5158 | $role_option_i++; |
5159 | 5159 | |
5160 | 5160 | $content .= '<div class="col-sm-6">'; |
@@ -5178,14 +5178,14 @@ discard block |
||
5178 | 5178 | $content .= '</div>'; |
5179 | 5179 | $content .= '<form id="bs-vc-modal-form" class="bs-vc-modal-form">'; |
5180 | 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>'; |
|
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 | 5182 | $content .= '<div class="row"><div class="col-md-6 col-sm-12">'; |
5183 | 5183 | $content .= aui()->select( |
5184 | 5184 | array( |
5185 | 5185 | 'id' => 'bsvc_output', |
5186 | 5186 | 'name' => 'bsvc_output', |
5187 | - 'label' => __( 'What should happen if rules met.', 'ayecode-connect' ), |
|
5188 | - 'placeholder' => __( 'Default Output', 'ayecode-connect' ), |
|
5187 | + 'label' => __('What should happen if rules met.', 'ayecode-connect'), |
|
5188 | + 'placeholder' => __('Default Output', 'ayecode-connect'), |
|
5189 | 5189 | 'class' => 'bsvc_output form-select-sm no-select2 mw-100', |
5190 | 5190 | 'options' => sd_visibility_output_options(), |
5191 | 5191 | 'default' => '', |
@@ -5204,8 +5204,8 @@ discard block |
||
5204 | 5204 | array( |
5205 | 5205 | 'id' => 'bsvc_page', |
5206 | 5206 | 'name' => 'bsvc_page', |
5207 | - 'label' => __( 'Page Content', 'ayecode-connect' ), |
|
5208 | - 'placeholder' => __( 'Select Page ID...', 'ayecode-connect' ), |
|
5207 | + 'label' => __('Page Content', 'ayecode-connect'), |
|
5208 | + 'placeholder' => __('Select Page ID...', 'ayecode-connect'), |
|
5209 | 5209 | 'class' => 'bsvc_page form-select-sm no-select2 mw-100', |
5210 | 5210 | 'options' => sd_template_page_options(), |
5211 | 5211 | 'default' => '', |
@@ -5220,8 +5220,8 @@ discard block |
||
5220 | 5220 | array( |
5221 | 5221 | 'id' => 'bsvc_tmpl_part', |
5222 | 5222 | 'name' => 'bsvc_tmpl_part', |
5223 | - 'label' => __( 'Template Part', 'ayecode-connect' ), |
|
5224 | - 'placeholder' => __( 'Select Template Part...', 'ayecode-connect' ), |
|
5223 | + 'label' => __('Template Part', 'ayecode-connect'), |
|
5224 | + 'placeholder' => __('Select Template Part...', 'ayecode-connect'), |
|
5225 | 5225 | 'class' => 'bsvc_tmpl_part form-select-sm no-select2 mw-100', |
5226 | 5226 | 'options' => sd_template_part_options(), |
5227 | 5227 | 'default' => '', |
@@ -5239,8 +5239,8 @@ discard block |
||
5239 | 5239 | array( |
5240 | 5240 | 'id' => 'bsvc_message_type', |
5241 | 5241 | 'name' => 'bsvc_message_type', |
5242 | - 'label' => __( 'Custom Message Type', 'ayecode-connect' ), |
|
5243 | - 'placeholder' => __( 'Default (none)', 'ayecode-connect' ), |
|
5242 | + 'label' => __('Custom Message Type', 'ayecode-connect'), |
|
5243 | + 'placeholder' => __('Default (none)', 'ayecode-connect'), |
|
5244 | 5244 | 'class' => 'bsvc_message_type form-select-sm no-select2 mw-100', |
5245 | 5245 | 'options' => sd_aui_colors(), |
5246 | 5246 | 'default' => '', |
@@ -5263,7 +5263,7 @@ discard block |
||
5263 | 5263 | 'name' => 'bsvc_message', |
5264 | 5264 | 'label' => '', |
5265 | 5265 | 'class' => 'bsvc_message form-control-sm', |
5266 | - 'placeholder' => __( 'CUSTOM MESSAGE TO SHOW', 'ayecode-connect' ), |
|
5266 | + 'placeholder' => __('CUSTOM MESSAGE TO SHOW', 'ayecode-connect'), |
|
5267 | 5267 | 'label_type' => '', |
5268 | 5268 | 'value' => '', |
5269 | 5269 | 'form_group_class' => ' ', |
@@ -5285,7 +5285,7 @@ discard block |
||
5285 | 5285 | global $shortcode_insert_button_once; |
5286 | 5286 | |
5287 | 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' ) { |
|
5288 | + if (defined('US_CORE_DIR') && !empty($_REQUEST['action']) && $_REQUEST['action'] == 'us_ajax_hb_get_ebuilder_html') { |
|
5289 | 5289 | $shortcode_insert_button_once = true; |
5290 | 5290 | } |
5291 | 5291 | } |