@@ -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.7' ); |
|
25 | +if (!defined('WPINV_VERSION')) { |
|
26 | + define('WPINV_VERSION', '2.8.7'); |
|
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,27 +3,27 @@ discard block |
||
3 | 3 | * Admin View: Page - Addons |
4 | 4 | * |
5 | 5 | */ |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if (!defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | add_ThickBox(); |
10 | 10 | ?> |
11 | 11 | <div class="wrap wpi_addons_wrap"> |
12 | - <h1><?php echo esc_html( get_admin_page_title() ); ?></h1> |
|
12 | + <h1><?php echo esc_html(get_admin_page_title()); ?></h1> |
|
13 | 13 | |
14 | - <?php if ( $tabs ) { ?> |
|
14 | + <?php if ($tabs) { ?> |
|
15 | 15 | <nav class="nav-tab-wrapper wpi-nav-tab-wrapper"> |
16 | 16 | <?php |
17 | - foreach ( $tabs as $name => $label ) { |
|
18 | - echo '<a href="' . esc_url( admin_url( 'admin.php?page=wpi-addons&tab=' . $name ) ) . '" class="nav-tab ' . ( $current_tab == $name ? 'nav-tab-active' : '' ) . '">' . esc_html( $label ) . '</a>'; |
|
17 | + foreach ($tabs as $name => $label) { |
|
18 | + echo '<a href="' . esc_url(admin_url('admin.php?page=wpi-addons&tab=' . $name)) . '" class="nav-tab ' . ($current_tab == $name ? 'nav-tab-active' : '') . '">' . esc_html($label) . '</a>'; |
|
19 | 19 | } |
20 | - do_action( 'wpi_addons_tabs' ); |
|
20 | + do_action('wpi_addons_tabs'); |
|
21 | 21 | ?> |
22 | 22 | </nav> |
23 | 23 | |
24 | 24 | <?php |
25 | 25 | |
26 | - if ( $current_tab == 'membership' ) { |
|
26 | + if ($current_tab == 'membership') { |
|
27 | 27 | |
28 | 28 | ?> |
29 | 29 | |
@@ -32,42 +32,42 @@ discard block |
||
32 | 32 | <!-- |
33 | 33 | <h2>With our WPInvoicing Membership you get access to all our products!</h2> |
34 | 34 | <p><a class="button button-primary" href="https://wpinvoicing.com/downloads/membership/">View Memberships</a></p>--> |
35 | - <?php if ( defined( 'WP_EASY_UPDATES_ACTIVE' ) ) { ?> |
|
36 | - <h2><?php esc_html_e( 'Have a membership key?', 'invoicing' ); ?></h2> |
|
35 | + <?php if (defined('WP_EASY_UPDATES_ACTIVE')) { ?> |
|
36 | + <h2><?php esc_html_e('Have a membership key?', 'invoicing'); ?></h2> |
|
37 | 37 | <p> |
38 | 38 | <?php |
39 | - $wpeu_admin = new External_Updates_Admin( 'wpinvoicing.com', '1' ); |
|
40 | - echo $wpeu_admin->render_licence_actions( 'wpinvoicing.com', 'membership', array( 95, 106, 108, 12351 ) ); |
|
39 | + $wpeu_admin = new External_Updates_Admin('wpinvoicing.com', '1'); |
|
40 | + echo $wpeu_admin->render_licence_actions('wpinvoicing.com', 'membership', array(95, 106, 108, 12351)); |
|
41 | 41 | ?> |
42 | 42 | </p> |
43 | 43 | <?php } ?> |
44 | 44 | |
45 | 45 | <div class="membership-cta-contet"> |
46 | 46 | <div class="main-cta"> |
47 | - <h2><?php esc_html_e( 'Membership benefits Include:', 'invoicing' ); ?></h2> |
|
47 | + <h2><?php esc_html_e('Membership benefits Include:', 'invoicing'); ?></h2> |
|
48 | 48 | <div class="feature-list"> |
49 | 49 | <ul> |
50 | 50 | <?php |
51 | 51 | $addon_obj = new WPInv_Admin_Addons(); |
52 | - if ( $addons = $addon_obj->get_section_data( 'addons' ) ) { |
|
53 | - foreach ( $addons as $addon ) { |
|
54 | - echo '<li><i class="far fa-check-circle fa-sm"></i> ' . esc_html( $addon->info->title ) . '</li>'; |
|
52 | + if ($addons = $addon_obj->get_section_data('addons')) { |
|
53 | + foreach ($addons as $addon) { |
|
54 | + echo '<li><i class="far fa-check-circle fa-sm"></i> ' . esc_html($addon->info->title) . '</li>'; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | ?> |
58 | 58 | </ul> |
59 | 59 | |
60 | 60 | <div class="feature-cta"> |
61 | - <h3><?php esc_html_e( 'Membership Starts from', 'invoicing' ); ?></h3> |
|
61 | + <h3><?php esc_html_e('Membership Starts from', 'invoicing'); ?></h3> |
|
62 | 62 | <h4>$99</h4> |
63 | - <a href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php esc_attr_e( 'Buy Membership', 'invoicing' ); ?></a> |
|
63 | + <a href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php esc_attr_e('Buy Membership', 'invoicing'); ?></a> |
|
64 | 64 | </div> |
65 | - <h3><?php esc_html_e( 'Included Gateways:', 'invoicing' ); ?></h3> |
|
65 | + <h3><?php esc_html_e('Included Gateways:', 'invoicing'); ?></h3> |
|
66 | 66 | <ul> |
67 | 67 | <?php |
68 | - if ( $addons = $addon_obj->get_section_data( 'gateways' ) ) { |
|
69 | - foreach ( $addons as $addon ) { |
|
70 | - echo '<li><i class="far fa-check-circle fa-sm"></i> ' . esc_html( $addon->info->title ) . '</li>'; |
|
68 | + if ($addons = $addon_obj->get_section_data('gateways')) { |
|
69 | + foreach ($addons as $addon) { |
|
70 | + echo '<li><i class="far fa-check-circle fa-sm"></i> ' . esc_html($addon->info->title) . '</li>'; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | ?> |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | <div class="testimonial-content"> |
82 | 82 | <div class="t-image"> |
83 | 83 | <?php |
84 | - echo '<img src="' . esc_url( plugins_url( 'images/t-image2.png', dirname( __FILE__ ) ) ) . '" > '; |
|
84 | + echo '<img src="' . esc_url(plugins_url('images/t-image2.png', dirname(__FILE__))) . '" > '; |
|
85 | 85 | ?> |
86 | 86 | </div> |
87 | 87 | <div class="t-content"> |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | <div class="testimonial-content"> |
102 | 102 | <div class="t-image"> |
103 | 103 | <?php |
104 | - echo '<img src="' . esc_url( plugins_url( 'images/t-image1.png', dirname( __FILE__ ) ) ) . '" > '; |
|
104 | + echo '<img src="' . esc_url(plugins_url('images/t-image1.png', dirname(__FILE__))) . '" > '; |
|
105 | 105 | ?> |
106 | 106 | </div> |
107 | 107 | <div class="t-content"> |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | </div> |
118 | 118 | </div> |
119 | 119 | <div class="member-footer"> |
120 | - <a class="footer-btn" href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php esc_html_e( 'Buy Membership', 'invoicing' ); ?></a> |
|
121 | - <a class="footer-link" href="post-new.php?post_type=wpi_invoice"><?php esc_html_e( 'Create Invoice', 'invoicing' ); ?></a> |
|
120 | + <a class="footer-btn" href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php esc_html_e('Buy Membership', 'invoicing'); ?></a> |
|
121 | + <a class="footer-link" href="post-new.php?post_type=wpi_invoice"><?php esc_html_e('Create Invoice', 'invoicing'); ?></a> |
|
122 | 122 | </div> |
123 | 123 | </div> |
124 | 124 | |
@@ -129,63 +129,63 @@ discard block |
||
129 | 129 | } else { |
130 | 130 | $installed_plugins = get_plugins(); |
131 | 131 | $addon_obj = new WPInv_Admin_Addons(); |
132 | - if ( $addons = $addon_obj->get_section_data( $current_tab ) ) : |
|
132 | + if ($addons = $addon_obj->get_section_data($current_tab)) : |
|
133 | 133 | //print_r($addons); |
134 | 134 | ?> |
135 | 135 | <ul class="wpi-products"> |
136 | 136 | <?php |
137 | - foreach ( $addons as $addon ) : |
|
138 | - if ( 965 == $addon->info->id ) { |
|
139 | -continue;}// don't show quote add on |
|
137 | + foreach ($addons as $addon) : |
|
138 | + if (965 == $addon->info->id) { |
|
139 | +continue; }// don't show quote add on |
|
140 | 140 | ?> |
141 | 141 | <li class="wpi-product"> |
142 | 142 | <div class="wpi-product-title"> |
143 | 143 | <h3> |
144 | 144 | <?php |
145 | - if ( ! empty( $addon->info->excerpt ) ) { |
|
146 | - wpi_help_tip( $addon->info->excerpt, false, false, true ); |
|
145 | + if (!empty($addon->info->excerpt)) { |
|
146 | + wpi_help_tip($addon->info->excerpt, false, false, true); |
|
147 | 147 | } |
148 | - echo esc_html( $addon->info->title ); |
|
148 | + echo esc_html($addon->info->title); |
|
149 | 149 | ?> |
150 | 150 | </h3> |
151 | 151 | </div> |
152 | 152 | |
153 | 153 | <span class="wpi-product-image"> |
154 | - <?php if ( ! empty( $addon->info->thumbnail ) ) : ?> |
|
155 | - <img src="<?php echo esc_attr( $addon->info->thumbnail ); ?>"/> |
|
154 | + <?php if (!empty($addon->info->thumbnail)) : ?> |
|
155 | + <img src="<?php echo esc_attr($addon->info->thumbnail); ?>"/> |
|
156 | 156 | <?php |
157 | 157 | endif; |
158 | 158 | |
159 | - if ( 'stripe-payment-gateway' == $addon->info->slug ) { |
|
159 | + if ('stripe-payment-gateway' == $addon->info->slug) { |
|
160 | 160 | $addon->info->slug = 'getpaid-stripe-payments'; |
161 | 161 | $addon->info->link = 'https://wordpress.org/plugins/getpaid-stripe-payments/'; |
162 | 162 | } |
163 | - elseif( 'wallet' == $addon->info->slug ){ |
|
163 | + elseif ('wallet' == $addon->info->slug) { |
|
164 | 164 | $addon->info->slug = 'getpaid-wallet'; |
165 | 165 | $addon->info->link = 'https://wordpress.org/plugins/getpaid-wallet/'; |
166 | 166 | } |
167 | - elseif( 'item-inventory' == $addon->info->slug ){ |
|
167 | + elseif ('item-inventory' == $addon->info->slug) { |
|
168 | 168 | $addon->info->slug = 'getpaid-item-inventory'; |
169 | 169 | $addon->info->link = 'https://wordpress.org/plugins/getpaid-item-inventory/'; |
170 | 170 | } |
171 | 171 | |
172 | - if ( isset( $addon->info->link ) && substr( $addon->info->link, 0, 21 ) === 'https://wordpress.org' ) { |
|
173 | - echo '<a href="' . esc_url( admin_url( '/plugin-install.php?tab=plugin-information&plugin=' . $addon->info->slug ) ) . '&width=770&height=660&TB_iframe=true" class="thickbox" >'; |
|
174 | - echo '<span class="wpi-product-info">' . esc_html__( 'More info', 'invoicing' ) . '</span>'; |
|
172 | + if (isset($addon->info->link) && substr($addon->info->link, 0, 21) === 'https://wordpress.org') { |
|
173 | + echo '<a href="' . esc_url(admin_url('/plugin-install.php?tab=plugin-information&plugin=' . $addon->info->slug)) . '&width=770&height=660&TB_iframe=true" class="thickbox" >'; |
|
174 | + echo '<span class="wpi-product-info">' . esc_html__('More info', 'invoicing') . '</span>'; |
|
175 | 175 | echo '</a>'; |
176 | - } elseif ( isset( $addon->info->link ) && ( substr( $addon->info->link, 0, 23 ) === 'https://wpinvoicing.com' || substr( $addon->info->link, 0, 21 ) === 'https://wpgetpaid.com' ) ) { |
|
177 | - if ( defined( 'WP_EASY_UPDATES_ACTIVE' ) ) { |
|
178 | - $url = admin_url( '/plugin-install.php?tab=plugin-information&plugin=' . $addon->info->slug . '&width=770&height=660&item_id=' . $addon->info->id . '&update_url=https://wpgetpaid.com&TB_iframe=true' ); |
|
176 | + } elseif (isset($addon->info->link) && (substr($addon->info->link, 0, 23) === 'https://wpinvoicing.com' || substr($addon->info->link, 0, 21) === 'https://wpgetpaid.com')) { |
|
177 | + if (defined('WP_EASY_UPDATES_ACTIVE')) { |
|
178 | + $url = admin_url('/plugin-install.php?tab=plugin-information&plugin=' . $addon->info->slug . '&width=770&height=660&item_id=' . $addon->info->id . '&update_url=https://wpgetpaid.com&TB_iframe=true'); |
|
179 | 179 | } else { |
180 | 180 | // if installed show activation link |
181 | - if ( isset( $installed_plugins['wp-easy-updates/external-updates.php'] ) ) { |
|
181 | + if (isset($installed_plugins['wp-easy-updates/external-updates.php'])) { |
|
182 | 182 | $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation'; |
183 | 183 | } else { |
184 | 184 | $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external'; |
185 | 185 | } |
186 | 186 | } |
187 | - echo '<a href="' . esc_url( $url ) . '" class="thickbox">'; |
|
188 | - echo '<span class="wpi-product-info">' . esc_html__( 'More info', 'invoicing' ) . '</span>'; |
|
187 | + echo '<a href="' . esc_url($url) . '" class="thickbox">'; |
|
188 | + echo '<span class="wpi-product-info">' . esc_html__('More info', 'invoicing') . '</span>'; |
|
189 | 189 | echo '</a>'; |
190 | 190 | } |
191 | 191 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | <span class="wpi-product-button"> |
198 | 198 | <?php |
199 | - $addon_obj->output_button( $addon ); |
|
199 | + $addon_obj->output_button($addon); |
|
200 | 200 | ?> |
201 | 201 | </span> |
202 | 202 | |
@@ -210,21 +210,21 @@ discard block |
||
210 | 210 | |
211 | 211 | <div class="clearfix" ></div> |
212 | 212 | |
213 | - <?php if ( $current_tab == 'addons' ) { ?> |
|
214 | - <p><?php printf( esc_attr__( 'All of our Addons can be found on wpGetPaid.com here: %sInvoicing Addons%s', 'invoicing' ), '<a href="https://wpinvoicing.com/downloads/category/addons/">','</a>' ); ?></p> |
|
215 | - <?php } if ( $current_tab == 'gateways' ) { ?> |
|
216 | - <p><?php printf( esc_attr__( 'All of our Payment Gateways can be found on wpGetPaid.com here: %sGetPaid Payment Gateways %s', 'invoicing' ), '<a href="https://wpinvoicing.com/downloads/category/gateways/">','</a>' ); ?></p> |
|
213 | + <?php if ($current_tab == 'addons') { ?> |
|
214 | + <p><?php printf(esc_attr__('All of our Addons can be found on wpGetPaid.com here: %sInvoicing Addons%s', 'invoicing'), '<a href="https://wpinvoicing.com/downloads/category/addons/">', '</a>'); ?></p> |
|
215 | + <?php } if ($current_tab == 'gateways') { ?> |
|
216 | + <p><?php printf(esc_attr__('All of our Payment Gateways can be found on wpGetPaid.com here: %sGetPaid Payment Gateways %s', 'invoicing'), '<a href="https://wpinvoicing.com/downloads/category/gateways/">', '</a>'); ?></p> |
|
217 | 217 | <?php } ?> |
218 | 218 | |
219 | - <div id="wpi-wpeu-required-activation" style="display:none;"><span class="wpi-notification "><?php echo wp_kses_post( sprintf( __( "The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s'>activate</a> it now.", 'invoicing' ), wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=wp-easy-updates/external-updates.php' ), 'activate-plugin_wp-easy-updates/external-updates.php' ) ) ); ?></span></div> |
|
220 | - <div id="wpi-wpeu-required-for-external" style="display:none;"><span class="wpi-notification "><?php echo wp_kses_post( sprintf( __( "The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s' onclick='window.open(\"https://wpeasyupdates.com/wp-easy-updates.zip\", \"_blank\");' >download</a> and install it now.", 'invoicing' ), admin_url( 'plugin-install.php?tab=upload&wpeu-install=true' ) ) ); ?></span></div> |
|
219 | + <div id="wpi-wpeu-required-activation" style="display:none;"><span class="wpi-notification "><?php echo wp_kses_post(sprintf(__("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s'>activate</a> it now.", 'invoicing'), wp_nonce_url(admin_url('plugins.php?action=activate&plugin=wp-easy-updates/external-updates.php'), 'activate-plugin_wp-easy-updates/external-updates.php'))); ?></span></div> |
|
220 | + <div id="wpi-wpeu-required-for-external" style="display:none;"><span class="wpi-notification "><?php echo wp_kses_post(sprintf(__("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s' onclick='window.open(\"https://wpeasyupdates.com/wp-easy-updates.zip\", \"_blank\");' >download</a> and install it now.", 'invoicing'), admin_url('plugin-install.php?tab=upload&wpeu-install=true'))); ?></span></div> |
|
221 | 221 | <div id="wpeu-licence-popup" style="display:none;"> |
222 | 222 | <span class="wpi-notification noti-white"> |
223 | - <h3 class="wpeu-licence-title"><?php esc_html_e( 'Licence key', 'invoicing' ); ?></h3> |
|
224 | - <input class="wpeu-licence-key" type="text" placeholder="<?php esc_attr_e( 'Enter your licence key', 'invoicing' ); ?>"> <button class="button-primary wpeu-licence-popup-button" ><?php esc_html_e( 'Install', 'invoicing' ); ?></button> |
|
223 | + <h3 class="wpeu-licence-title"><?php esc_html_e('Licence key', 'invoicing'); ?></h3> |
|
224 | + <input class="wpeu-licence-key" type="text" placeholder="<?php esc_attr_e('Enter your licence key', 'invoicing'); ?>"> <button class="button-primary wpeu-licence-popup-button" ><?php esc_html_e('Install', 'invoicing'); ?></button> |
|
225 | 225 | <br> |
226 | 226 | <?php |
227 | - printf( esc_html__( '%1$sFind your licence key here%2$s OR %3$sBuy one here%4$s', 'invoicing' ), '<a href="https://wpinvoicing.com/your-account/" target="_blank">', '</a>', '<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">', '</a>' ); |
|
227 | + printf(esc_html__('%1$sFind your licence key here%2$s OR %3$sBuy one here%4$s', 'invoicing'), '<a href="https://wpinvoicing.com/your-account/" target="_blank">', '</a>', '<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">', '</a>'); |
|
228 | 228 | ?> |
229 | 229 | </span> |
230 | 230 | </div> |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * All Invoicing extensions screen related functions can be found here. |
6 | 6 | * |
7 | 7 | */ |
8 | -if ( ! defined( 'ABSPATH' ) ) { |
|
8 | +if (!defined('ABSPATH')) { |
|
9 | 9 | exit; |
10 | 10 | } |
11 | 11 | |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function get_tabs() { |
24 | 24 | $tabs = array( |
25 | - 'addons' => __( 'Addons', 'invoicing' ), |
|
26 | - 'gateways' => __( 'Payment Gateways', 'invoicing' ), |
|
27 | - 'recommended_plugins' => __( 'Recommended plugins', 'invoicing' ), |
|
28 | - 'membership' => __( 'Membership', 'invoicing' ), |
|
25 | + 'addons' => __('Addons', 'invoicing'), |
|
26 | + 'gateways' => __('Payment Gateways', 'invoicing'), |
|
27 | + 'recommended_plugins' => __('Recommended plugins', 'invoicing'), |
|
28 | + 'membership' => __('Membership', 'invoicing'), |
|
29 | 29 | ); |
30 | 30 | |
31 | 31 | return $tabs; |
@@ -38,57 +38,57 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @return array |
40 | 40 | */ |
41 | - public function get_section_data( $section_id ) { |
|
42 | - $section = self::get_tab( $section_id ); |
|
41 | + public function get_section_data($section_id) { |
|
42 | + $section = self::get_tab($section_id); |
|
43 | 43 | $api_url = 'https://wpinvoicing.com/edd-api/v2/products/'; |
44 | 44 | $section_data = new stdClass(); |
45 | 45 | |
46 | - if ( $section_id == 'recommended_plugins' ) { |
|
46 | + if ($section_id == 'recommended_plugins') { |
|
47 | 47 | $section_data->products = self::get_recommend_wp_plugins_edd_formatted(); |
48 | - } elseif ( ! empty( $section ) ) { |
|
49 | - if ( false === ( $section_data = get_transient( 'wpi_addons_section_' . $section_id ) ) ) { //@todo restore after testing |
|
48 | + } elseif (!empty($section)) { |
|
49 | + if (false === ($section_data = get_transient('wpi_addons_section_' . $section_id))) { //@todo restore after testing |
|
50 | 50 | //if ( 1==1) { |
51 | 51 | |
52 | 52 | $query_args = array( |
53 | 53 | 'category' => $section_id, |
54 | 54 | 'number' => 100, |
55 | 55 | ); |
56 | - $query_args = apply_filters( 'wpeu_edd_api_query_args', $query_args, $api_url, $section_id ); |
|
56 | + $query_args = apply_filters('wpeu_edd_api_query_args', $query_args, $api_url, $section_id); |
|
57 | 57 | |
58 | 58 | $raw_section = wp_safe_remote_get( |
59 | - esc_url_raw( add_query_arg( $query_args, $api_url ) ), |
|
59 | + esc_url_raw(add_query_arg($query_args, $api_url)), |
|
60 | 60 | array( |
61 | 61 | 'user-agent' => 'Invoicing Addons Page', |
62 | 62 | 'timeout' => 15, |
63 | 63 | ) |
64 | 64 | ); |
65 | 65 | |
66 | - if ( ! is_wp_error( $raw_section ) ) { |
|
67 | - $section_data = json_decode( wp_remote_retrieve_body( $raw_section ) ); |
|
66 | + if (!is_wp_error($raw_section)) { |
|
67 | + $section_data = json_decode(wp_remote_retrieve_body($raw_section)); |
|
68 | 68 | |
69 | - if ( ! empty( $section_data->products ) ) { |
|
70 | - set_transient( 'wpi_addons_section_' . $section_id, $section_data, DAY_IN_SECONDS ); |
|
69 | + if (!empty($section_data->products)) { |
|
70 | + set_transient('wpi_addons_section_' . $section_id, $section_data, DAY_IN_SECONDS); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
76 | - $products = isset( $section_data->products ) ? $section_data->products : array(); |
|
77 | - if ( 'addons' == $section_id ) { |
|
76 | + $products = isset($section_data->products) ? $section_data->products : array(); |
|
77 | + if ('addons' == $section_id) { |
|
78 | 78 | |
79 | 79 | $quotes = new stdClass(); |
80 | 80 | $quotes->info = new stdClass(); |
81 | 81 | $quotes->info->id = ''; |
82 | 82 | $quotes->info->slug = 'invoicing-quotes'; |
83 | - $quotes->info->title = __( 'Quotes', 'invoicing' ); |
|
84 | - $quotes->info->excerpt = __( 'Create quotes and estimates', 'invoicing' ); |
|
83 | + $quotes->info->title = __('Quotes', 'invoicing'); |
|
84 | + $quotes->info->excerpt = __('Create quotes and estimates', 'invoicing'); |
|
85 | 85 | $quotes->info->link = 'https://wordpress.org/plugins/invoicing-quotes/'; |
86 | 86 | $quotes->info->thumbnail = WPINV_PLUGIN_URL . 'assets/images/Quotes-1-768x384.png'; |
87 | 87 | |
88 | 88 | $products[] = $quotes; |
89 | 89 | } |
90 | 90 | |
91 | - return apply_filters( 'wpi_addons_section_data', $products, $section_id ); |
|
91 | + return apply_filters('wpi_addons_section_data', $products, $section_id); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | * @param string $theme |
100 | 100 | * @param string $plugin |
101 | 101 | */ |
102 | - public function output_button( $addon ) { |
|
102 | + public function output_button($addon) { |
|
103 | 103 | |
104 | 104 | // print_r($addon); |
105 | - $current_tab = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] ); |
|
105 | + $current_tab = empty($_GET['tab']) ? 'addons' : sanitize_title($_GET['tab']); |
|
106 | 106 | // $button_text = __('Free','invoicing'); |
107 | 107 | // $licensing = false; |
108 | 108 | // $installed = false; |
@@ -114,30 +114,30 @@ discard block |
||
114 | 114 | // $install_status = 'get'; |
115 | 115 | // $onclick = ''; |
116 | 116 | |
117 | - $wp_org_themes = array( 'supreme-directory', 'directory-starter' ); |
|
117 | + $wp_org_themes = array('supreme-directory', 'directory-starter'); |
|
118 | 118 | |
119 | 119 | $button_args = array( |
120 | 120 | 'type' => ($current_tab == 'addons' || $current_tab == 'gateways') ? 'addons' : $current_tab, |
121 | - 'id' => isset( $addon->info->id ) ? absint( $addon->info->id ) : '', |
|
122 | - 'title' => isset( $addon->info->title ) ? $addon->info->title : '', |
|
123 | - 'button_text' => __( 'Free', 'invoicing' ), |
|
124 | - 'price_text' => __( 'Free', 'invoicing' ), |
|
125 | - 'link' => isset( $addon->info->link ) ? $addon->info->link : '', // link to product |
|
126 | - 'url' => isset( $addon->info->link ) ? $addon->info->link : '', // button url |
|
121 | + 'id' => isset($addon->info->id) ? absint($addon->info->id) : '', |
|
122 | + 'title' => isset($addon->info->title) ? $addon->info->title : '', |
|
123 | + 'button_text' => __('Free', 'invoicing'), |
|
124 | + 'price_text' => __('Free', 'invoicing'), |
|
125 | + 'link' => isset($addon->info->link) ? $addon->info->link : '', // link to product |
|
126 | + 'url' => isset($addon->info->link) ? $addon->info->link : '', // button url |
|
127 | 127 | 'class' => 'button-primary', |
128 | 128 | 'install_status' => 'get', |
129 | 129 | 'installed' => false, |
130 | 130 | 'price' => '', |
131 | - 'licensing' => isset( $addon->licensing->enabled ) && $addon->licensing->enabled ? true : false, |
|
132 | - 'license' => isset( $addon->licensing->license ) && $addon->licensing->license ? $addon->licensing->license : '', |
|
131 | + 'licensing' => isset($addon->licensing->enabled) && $addon->licensing->enabled ? true : false, |
|
132 | + 'license' => isset($addon->licensing->license) && $addon->licensing->license ? $addon->licensing->license : '', |
|
133 | 133 | 'onclick' => '', |
134 | - 'slug' => isset( $addon->info->slug ) ? $addon->info->slug : '', |
|
134 | + 'slug' => isset($addon->info->slug) ? $addon->info->slug : '', |
|
135 | 135 | 'active' => false, |
136 | 136 | 'file' => '', |
137 | 137 | 'update_url' => '', |
138 | 138 | ); |
139 | 139 | |
140 | - if ( 'invoicing-quotes' == $addon->info->slug || 'getpaid-stripe-payments' == $addon->info->slug || ( $current_tab == 'recommended_plugins' && isset( $addon->info->slug ) && $addon->info->slug ) ) { |
|
140 | + if ('invoicing-quotes' == $addon->info->slug || 'getpaid-stripe-payments' == $addon->info->slug || ($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug)) { |
|
141 | 141 | include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; //for plugins_api.. |
142 | 142 | $status = install_plugin_install_status( |
143 | 143 | array( |
@@ -145,81 +145,81 @@ discard block |
||
145 | 145 | 'version' => '', |
146 | 146 | ) |
147 | 147 | ); |
148 | - $button_args['install_status'] = isset( $status['status'] ) ? $status['status'] : 'install'; |
|
149 | - $button_args['file'] = isset( $status['file'] ) ? $status['file'] : ''; |
|
150 | - } elseif ( ($current_tab == 'addons' || $current_tab == 'gateways') && isset( $addon->info->id ) && $addon->info->id ) { |
|
148 | + $button_args['install_status'] = isset($status['status']) ? $status['status'] : 'install'; |
|
149 | + $button_args['file'] = isset($status['file']) ? $status['file'] : ''; |
|
150 | + } elseif (($current_tab == 'addons' || $current_tab == 'gateways') && isset($addon->info->id) && $addon->info->id) { |
|
151 | 151 | include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; //for plugins_api.. |
152 | - if ( ! empty( $addon->licensing->edd_slug ) ) { |
|
153 | -$button_args['slug'] = $addon->licensing->edd_slug;} |
|
154 | - $status = self::install_plugin_install_status( $addon ); |
|
155 | - $button_args['file'] = isset( $status['file'] ) ? $status['file'] : ''; |
|
156 | - if ( isset( $status['status'] ) ) { |
|
157 | -$button_args['install_status'] = $status['status'];} |
|
152 | + if (!empty($addon->licensing->edd_slug)) { |
|
153 | +$button_args['slug'] = $addon->licensing->edd_slug; } |
|
154 | + $status = self::install_plugin_install_status($addon); |
|
155 | + $button_args['file'] = isset($status['file']) ? $status['file'] : ''; |
|
156 | + if (isset($status['status'])) { |
|
157 | +$button_args['install_status'] = $status['status']; } |
|
158 | 158 | $button_args['update_url'] = 'https://wpinvoicing.com'; |
159 | - } elseif ( $current_tab == 'themes' && isset( $addon->info->id ) && $addon->info->id ) { |
|
160 | - if ( ! empty( $addon->licensing->edd_slug ) ) { |
|
161 | -$button_args['slug'] = $addon->licensing->edd_slug;} |
|
162 | - $button_args['installed'] = self::is_theme_installed( $addon ); |
|
163 | - if ( ! in_array( $button_args['slug'], $wp_org_themes ) ) { |
|
159 | + } elseif ($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) { |
|
160 | + if (!empty($addon->licensing->edd_slug)) { |
|
161 | +$button_args['slug'] = $addon->licensing->edd_slug; } |
|
162 | + $button_args['installed'] = self::is_theme_installed($addon); |
|
163 | + if (!in_array($button_args['slug'], $wp_org_themes)) { |
|
164 | 164 | $button_args['update_url'] = 'https://wpinvoicing.com'; |
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | 168 | // set price |
169 | - if ( isset( $addon->pricing ) && ! empty( $addon->pricing ) ) { |
|
170 | - if ( is_object( $addon->pricing ) ) { |
|
171 | - $prices = (array)$addon->pricing; |
|
172 | - $button_args['price'] = reset( $prices ); |
|
173 | - } elseif ( isset( $addon->pricing ) ) { |
|
169 | + if (isset($addon->pricing) && !empty($addon->pricing)) { |
|
170 | + if (is_object($addon->pricing)) { |
|
171 | + $prices = (array) $addon->pricing; |
|
172 | + $button_args['price'] = reset($prices); |
|
173 | + } elseif (isset($addon->pricing)) { |
|
174 | 174 | $button_args['price'] = $addon->pricing; |
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
178 | 178 | // set price text |
179 | - if ( $button_args['price'] && $button_args['price'] != '0.00' ) { |
|
180 | - $button_args['price_text'] = sprintf( __( 'From: $%d', 'invoicing' ), $button_args['price'] ); |
|
179 | + if ($button_args['price'] && $button_args['price'] != '0.00') { |
|
180 | + $button_args['price_text'] = sprintf(__('From: $%d', 'invoicing'), $button_args['price']); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | // set if installed |
184 | - if ( in_array( $button_args['install_status'], array( 'installed', 'latest_installed', 'update_available', 'newer_installed' ) ) ) { |
|
184 | + if (in_array($button_args['install_status'], array('installed', 'latest_installed', 'update_available', 'newer_installed'))) { |
|
185 | 185 | $button_args['installed'] = true; |
186 | 186 | } |
187 | 187 | |
188 | 188 | // print_r($button_args); |
189 | 189 | // set if active |
190 | - if ( $button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes') ) { |
|
191 | - if ( $button_args['type'] != 'themes' ) { |
|
192 | - $button_args['active'] = is_plugin_active( $button_args['file'] ); |
|
190 | + if ($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')) { |
|
191 | + if ($button_args['type'] != 'themes') { |
|
192 | + $button_args['active'] = is_plugin_active($button_args['file']); |
|
193 | 193 | } else { |
194 | - $button_args['active'] = self::is_theme_active( $addon ); |
|
194 | + $button_args['active'] = self::is_theme_active($addon); |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | |
198 | 198 | // set button text and class |
199 | - if ( $button_args['active'] ) { |
|
200 | - $button_args['button_text'] = __( 'Active', 'invoicing' ); |
|
199 | + if ($button_args['active']) { |
|
200 | + $button_args['button_text'] = __('Active', 'invoicing'); |
|
201 | 201 | $button_args['class'] = ' button-secondary disabled '; |
202 | - } elseif ( $button_args['installed'] ) { |
|
203 | - $button_args['button_text'] = __( 'Activate', 'invoicing' ); |
|
202 | + } elseif ($button_args['installed']) { |
|
203 | + $button_args['button_text'] = __('Activate', 'invoicing'); |
|
204 | 204 | |
205 | - if ( $button_args['type'] != 'themes' ) { |
|
206 | - if ( current_user_can( 'manage_options' ) ) { |
|
207 | - $button_args['url'] = wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $button_args['file'] ), 'activate-plugin_' . $button_args['file'] ); |
|
205 | + if ($button_args['type'] != 'themes') { |
|
206 | + if (current_user_can('manage_options')) { |
|
207 | + $button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $button_args['file']), 'activate-plugin_' . $button_args['file']); |
|
208 | 208 | } else { |
209 | 209 | $button_args['url'] = '#'; |
210 | 210 | } |
211 | 211 | } else { |
212 | - if ( current_user_can( 'switch_themes' ) ) { |
|
213 | - $button_args['url'] = self::get_theme_activation_url( $addon ); |
|
212 | + if (current_user_can('switch_themes')) { |
|
213 | + $button_args['url'] = self::get_theme_activation_url($addon); |
|
214 | 214 | } else { |
215 | 215 | $button_args['url'] = '#'; |
216 | 216 | } |
217 | 217 | } |
218 | 218 | } else { |
219 | - if ( $button_args['type'] == 'recommended_plugins' ) { |
|
220 | - $button_args['button_text'] = __( 'Install', 'invoicing' ); |
|
219 | + if ($button_args['type'] == 'recommended_plugins') { |
|
220 | + $button_args['button_text'] = __('Install', 'invoicing'); |
|
221 | 221 | } else { |
222 | - $button_args['button_text'] = __( 'Get it', 'invoicing' ); |
|
222 | + $button_args['button_text'] = __('Get it', 'invoicing'); |
|
223 | 223 | |
224 | 224 | /*if($button_args['type'] == 'themes' && in_array($button_args['slug'],$wp_org_themes) ){ |
225 | 225 | $button_args['button_text'] = __('Install','invoicing'); |
@@ -231,41 +231,41 @@ discard block |
||
231 | 231 | } |
232 | 232 | |
233 | 233 | // filter the button arguments |
234 | - $button_args = apply_filters( 'edd_api_button_args', $button_args ); |
|
234 | + $button_args = apply_filters('edd_api_button_args', $button_args); |
|
235 | 235 | // print_r($button_args); |
236 | 236 | // set price text |
237 | - if ( isset( $button_args['price_text'] ) ) { |
|
237 | + if (isset($button_args['price_text'])) { |
|
238 | 238 | ?> |
239 | 239 | <a |
240 | 240 | target="_blank" |
241 | 241 | class="addons-price-text" |
242 | - href="<?php echo esc_url( $button_args['link'] ); ?>"> |
|
243 | - <?php echo esc_html( $button_args['price_text'] ); ?> |
|
242 | + href="<?php echo esc_url($button_args['link']); ?>"> |
|
243 | + <?php echo esc_html($button_args['price_text']); ?> |
|
244 | 244 | </a> |
245 | 245 | <?php |
246 | 246 | } |
247 | 247 | |
248 | 248 | ?> |
249 | 249 | <a |
250 | - data-licence="<?php echo esc_attr( $button_args['license'] ); ?>" |
|
250 | + data-licence="<?php echo esc_attr($button_args['license']); ?>" |
|
251 | 251 | data-licensing="<?php echo $button_args['licensing'] ? 1 : 0; ?>" |
252 | - data-title="<?php echo esc_attr( $button_args['title'] ); ?>" |
|
253 | - data-type="<?php echo esc_attr( $button_args['type'] ); ?>" |
|
254 | - data-text-error-message="<?php esc_attr_e( 'Something went wrong!', 'invoicing' ); ?>" |
|
255 | - data-text-activate="<?php esc_attr_e( 'Activate', 'invoicing' ); ?>" |
|
256 | - data-text-activating="<?php esc_attr_e( 'Activating', 'invoicing' ); ?>" |
|
257 | - data-text-deactivate="<?php esc_attr_e( 'Deactivate', 'invoicing' ); ?>" |
|
258 | - data-text-installed="<?php esc_attr_e( 'Installed', 'invoicing' ); ?>" |
|
259 | - data-text-install="<?php esc_attr_e( 'Install', 'invoicing' ); ?>" |
|
260 | - data-text-installing="<?php esc_attr_e( 'Installing', 'invoicing' ); ?>" |
|
261 | - data-text-error="<?php esc_attr_e( 'Error', 'invoicing' ); ?>" |
|
252 | + data-title="<?php echo esc_attr($button_args['title']); ?>" |
|
253 | + data-type="<?php echo esc_attr($button_args['type']); ?>" |
|
254 | + data-text-error-message="<?php esc_attr_e('Something went wrong!', 'invoicing'); ?>" |
|
255 | + data-text-activate="<?php esc_attr_e('Activate', 'invoicing'); ?>" |
|
256 | + data-text-activating="<?php esc_attr_e('Activating', 'invoicing'); ?>" |
|
257 | + data-text-deactivate="<?php esc_attr_e('Deactivate', 'invoicing'); ?>" |
|
258 | + data-text-installed="<?php esc_attr_e('Installed', 'invoicing'); ?>" |
|
259 | + data-text-install="<?php esc_attr_e('Install', 'invoicing'); ?>" |
|
260 | + data-text-installing="<?php esc_attr_e('Installing', 'invoicing'); ?>" |
|
261 | + data-text-error="<?php esc_attr_e('Error', 'invoicing'); ?>" |
|
262 | 262 | <?php |
263 | - if ( ! empty( $button_args['onclick'] ) ) { |
|
264 | -echo " onclick='" . esc_attr( $button_args['onclick'] ) . "' ";} |
|
263 | + if (!empty($button_args['onclick'])) { |
|
264 | +echo " onclick='" . esc_attr($button_args['onclick']) . "' "; } |
|
265 | 265 | ?> |
266 | - class="addons-button <?php echo esc_attr( $button_args['class'] ); ?>" |
|
267 | - href="<?php echo esc_url( $button_args['url'] ); ?>"> |
|
268 | - <?php echo esc_html( $button_args['button_text'] ); ?> |
|
266 | + class="addons-button <?php echo esc_attr($button_args['class']); ?>" |
|
267 | + href="<?php echo esc_url($button_args['url']); ?>"> |
|
268 | + <?php echo esc_html($button_args['button_text']); ?> |
|
269 | 269 | </a> |
270 | 270 | <?php |
271 | 271 | |
@@ -279,9 +279,9 @@ discard block |
||
279 | 279 | $tabs = self::get_tabs(); |
280 | 280 | $sections = self::get_sections(); |
281 | 281 | $theme = wp_get_theme(); |
282 | - $section_keys = array_keys( $sections ); |
|
283 | - $current_section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : current( $section_keys ); |
|
284 | - $current_tab = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] ); |
|
282 | + $section_keys = array_keys($sections); |
|
283 | + $current_section = isset($_GET['section']) ? sanitize_text_field($_GET['section']) : current($section_keys); |
|
284 | + $current_tab = empty($_GET['tab']) ? 'addons' : sanitize_title($_GET['tab']); |
|
285 | 285 | include_once WPINV_PLUGIN_DIR . '/includes/admin/html-admin-page-addons.php'; |
286 | 286 | } |
287 | 287 | |
@@ -296,19 +296,19 @@ discard block |
||
296 | 296 | 'slug' => 'invoicing-quotes', |
297 | 297 | 'name' => 'Quotes', |
298 | 298 | 'thumbnail' => 'https://ps.w.org/invoicing-quotes/assets/banner-772x250.png', |
299 | - 'desc' => __( 'Allows you to create quotes, send them to clients and convert them to Invoices when accepted by the customer.', 'invoicing' ), |
|
299 | + 'desc' => __('Allows you to create quotes, send them to clients and convert them to Invoices when accepted by the customer.', 'invoicing'), |
|
300 | 300 | ), |
301 | 301 | 'geodirectory' => array( |
302 | 302 | 'url' => 'https://wordpress.org/plugins/geodirectory/', |
303 | 303 | 'slug' => 'geodirectory', |
304 | 304 | 'name' => 'GeoDirectory', |
305 | - 'desc' => __( 'Turn any WordPress theme into a global business directory portal.', 'invoicing' ), |
|
305 | + 'desc' => __('Turn any WordPress theme into a global business directory portal.', 'invoicing'), |
|
306 | 306 | ), |
307 | 307 | 'userswp' => array( |
308 | 308 | 'url' => 'https://wordpress.org/plugins/userswp/', |
309 | 309 | 'slug' => 'userswp', |
310 | 310 | 'name' => 'UsersWP', |
311 | - 'desc' => __( 'Allow frontend user login and registration as well as have slick profile pages.', 'invoicing' ), |
|
311 | + 'desc' => __('Allow frontend user login and registration as well as have slick profile pages.', 'invoicing'), |
|
312 | 312 | ), |
313 | 313 | ); |
314 | 314 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if (!defined('ABSPATH')) { |
|
4 | 4 | exit; // Exit if accessed directly |
5 | 5 | } |
6 | 6 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @return AUI|null |
36 | 36 | */ |
37 | 37 | public static function instance() { |
38 | - if ( self::$instance == null ) { |
|
38 | + if (self::$instance == null) { |
|
39 | 39 | self::$instance = new AUI(); |
40 | 40 | } |
41 | 41 | |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | * @since 1.0.0 |
49 | 49 | */ |
50 | 50 | private function __construct() { |
51 | - if ( function_exists( "__autoload" ) ) { |
|
52 | - spl_autoload_register( "__autoload" ); |
|
51 | + if (function_exists("__autoload")) { |
|
52 | + spl_autoload_register("__autoload"); |
|
53 | 53 | } |
54 | - spl_autoload_register( array( $this, 'autoload' ) ); |
|
54 | + spl_autoload_register(array($this, 'autoload')); |
|
55 | 55 | |
56 | 56 | // load options |
57 | 57 | self::$options = get_option('aui_options'); |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @param $classname |
66 | 66 | */ |
67 | - private function autoload( $classname ) { |
|
68 | - $class = str_replace( '_', '-', strtolower( $classname ) ); |
|
69 | - $file_path = trailingslashit( dirname( __FILE__ ) ) . "components/class-" . $class . '.php'; |
|
70 | - if ( $file_path && is_readable( $file_path ) ) { |
|
71 | - include_once( $file_path ); |
|
67 | + private function autoload($classname) { |
|
68 | + $class = str_replace('_', '-', strtolower($classname)); |
|
69 | + $file_path = trailingslashit(dirname(__FILE__)) . "components/class-" . $class . '.php'; |
|
70 | + if ($file_path && is_readable($file_path)) { |
|
71 | + include_once($file_path); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
@@ -79,34 +79,34 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @return string|void |
81 | 81 | */ |
82 | - public function get_option( $option ){ |
|
82 | + public function get_option($option) { |
|
83 | 83 | $result = isset(self::$options[$option]) ? esc_attr(self::$options[$option]) : ''; |
84 | 84 | |
85 | - if ( ! $result && $option) { |
|
86 | - if( $option == 'color_primary' ){ |
|
85 | + if (!$result && $option) { |
|
86 | + if ($option == 'color_primary') { |
|
87 | 87 | $result = AUI_PRIMARY_COLOR; |
88 | - }elseif( $option == 'color_secondary' ){ |
|
88 | + }elseif ($option == 'color_secondary') { |
|
89 | 89 | $result = AUI_SECONDARY_COLOR; |
90 | 90 | } |
91 | 91 | } |
92 | 92 | return $result; |
93 | 93 | } |
94 | 94 | |
95 | - public function render( $items = array(), $echo = false ) { |
|
95 | + public function render($items = array(), $echo = false) { |
|
96 | 96 | $output = ''; |
97 | 97 | |
98 | - if ( ! empty( $items ) ) { |
|
99 | - foreach ( $items as $args ) { |
|
100 | - $render = isset( $args['render'] ) ? $args['render'] : ''; |
|
101 | - if ( $render && method_exists( __CLASS__, $render ) ) { |
|
102 | - $output .= $this->$render( $args ); |
|
98 | + if (!empty($items)) { |
|
99 | + foreach ($items as $args) { |
|
100 | + $render = isset($args['render']) ? $args['render'] : ''; |
|
101 | + if ($render && method_exists(__CLASS__, $render)) { |
|
102 | + $output .= $this->$render($args); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | - if ( $echo ) { |
|
107 | + if ($echo) { |
|
108 | 108 | echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
109 | - }else{ |
|
109 | + } else { |
|
110 | 110 | return $output; |
111 | 111 | } |
112 | 112 | |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @return string The rendered component. |
124 | 124 | */ |
125 | - public function alert( $args = array(), $echo = false ) { |
|
126 | - $output = AUI_Component_Alert::get( $args ); |
|
125 | + public function alert($args = array(), $echo = false) { |
|
126 | + $output = AUI_Component_Alert::get($args); |
|
127 | 127 | |
128 | - if ( $echo ) { |
|
128 | + if ($echo) { |
|
129 | 129 | echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
130 | - }else{ |
|
130 | + } else { |
|
131 | 131 | return $output; |
132 | 132 | } |
133 | 133 | } |
@@ -142,12 +142,12 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @return string The rendered component. |
144 | 144 | */ |
145 | - public function input( $args = array(), $echo = false ) { |
|
146 | - $output = AUI_Component_Input::input( $args ); |
|
145 | + public function input($args = array(), $echo = false) { |
|
146 | + $output = AUI_Component_Input::input($args); |
|
147 | 147 | |
148 | - if ( $echo ) { |
|
148 | + if ($echo) { |
|
149 | 149 | echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
150 | - }else{ |
|
150 | + } else { |
|
151 | 151 | return $output; |
152 | 152 | } |
153 | 153 | } |
@@ -162,12 +162,12 @@ discard block |
||
162 | 162 | * |
163 | 163 | * @return string The rendered component. |
164 | 164 | */ |
165 | - public function textarea( $args = array(), $echo = false ) { |
|
166 | - $output = AUI_Component_Input::textarea( $args ); |
|
165 | + public function textarea($args = array(), $echo = false) { |
|
166 | + $output = AUI_Component_Input::textarea($args); |
|
167 | 167 | |
168 | - if ( $echo ) { |
|
168 | + if ($echo) { |
|
169 | 169 | echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
170 | - }else{ |
|
170 | + } else { |
|
171 | 171 | return $output; |
172 | 172 | } |
173 | 173 | } |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | * |
183 | 183 | * @return string The rendered component. |
184 | 184 | */ |
185 | - public function button( $args = array(), $echo = false ) { |
|
186 | - $output = AUI_Component_Button::get( $args ); |
|
185 | + public function button($args = array(), $echo = false) { |
|
186 | + $output = AUI_Component_Button::get($args); |
|
187 | 187 | |
188 | - if ( $echo ) { |
|
188 | + if ($echo) { |
|
189 | 189 | echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
190 | - }else{ |
|
190 | + } else { |
|
191 | 191 | return $output; |
192 | 192 | } |
193 | 193 | } |
@@ -202,26 +202,26 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @return string The rendered component. |
204 | 204 | */ |
205 | - public function badge( $args = array(), $echo = false ) { |
|
205 | + public function badge($args = array(), $echo = false) { |
|
206 | 206 | $defaults = array( |
207 | 207 | 'class' => 'badge badge-primary align-middle', |
208 | 208 | ); |
209 | 209 | |
210 | 210 | // maybe set type. |
211 | - if ( empty( $args['href'] ) ) { |
|
211 | + if (empty($args['href'])) { |
|
212 | 212 | $defaults['type'] = 'badge'; |
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
216 | 216 | * Parse incoming $args into an array and merge it with $defaults |
217 | 217 | */ |
218 | - $args = wp_parse_args( $args, $defaults ); |
|
218 | + $args = wp_parse_args($args, $defaults); |
|
219 | 219 | |
220 | - $output = AUI_Component_Button::get( $args ); |
|
220 | + $output = AUI_Component_Button::get($args); |
|
221 | 221 | |
222 | - if ( $echo ) { |
|
222 | + if ($echo) { |
|
223 | 223 | echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
224 | - }else{ |
|
224 | + } else { |
|
225 | 225 | return $output; |
226 | 226 | } |
227 | 227 | } |
@@ -236,12 +236,12 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @return string The rendered component. |
238 | 238 | */ |
239 | - public function dropdown( $args = array(), $echo = false ) { |
|
240 | - $output = AUI_Component_Dropdown::get( $args ); |
|
239 | + public function dropdown($args = array(), $echo = false) { |
|
240 | + $output = AUI_Component_Dropdown::get($args); |
|
241 | 241 | |
242 | - if ( $echo ) { |
|
242 | + if ($echo) { |
|
243 | 243 | echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
244 | - }else{ |
|
244 | + } else { |
|
245 | 245 | return $output; |
246 | 246 | } |
247 | 247 | } |
@@ -256,12 +256,12 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @return string The rendered component. |
258 | 258 | */ |
259 | - public function select( $args = array(), $echo = false ) { |
|
260 | - $output = AUI_Component_Input::select( $args ); |
|
259 | + public function select($args = array(), $echo = false) { |
|
260 | + $output = AUI_Component_Input::select($args); |
|
261 | 261 | |
262 | - if ( $echo ) { |
|
262 | + if ($echo) { |
|
263 | 263 | echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
264 | - }else{ |
|
264 | + } else { |
|
265 | 265 | return $output; |
266 | 266 | } |
267 | 267 | } |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | * |
277 | 277 | * @return string The rendered component. |
278 | 278 | */ |
279 | - public function radio( $args = array(), $echo = false ) { |
|
280 | - $output = AUI_Component_Input::radio( $args ); |
|
279 | + public function radio($args = array(), $echo = false) { |
|
280 | + $output = AUI_Component_Input::radio($args); |
|
281 | 281 | |
282 | - if ( $echo ) { |
|
282 | + if ($echo) { |
|
283 | 283 | echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
284 | - }else{ |
|
284 | + } else { |
|
285 | 285 | return $output; |
286 | 286 | } |
287 | 287 | } |
@@ -296,12 +296,12 @@ discard block |
||
296 | 296 | * |
297 | 297 | * @return string The rendered component. |
298 | 298 | */ |
299 | - public function pagination( $args = array(), $echo = false ) { |
|
300 | - $output = AUI_Component_Pagination::get( $args ); |
|
299 | + public function pagination($args = array(), $echo = false) { |
|
300 | + $output = AUI_Component_Pagination::get($args); |
|
301 | 301 | |
302 | - if ( $echo ) { |
|
302 | + if ($echo) { |
|
303 | 303 | echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
304 | - }else{ |
|
304 | + } else { |
|
305 | 305 | return $output; |
306 | 306 | } |
307 | 307 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | function aui_init_flatpickr(){ |
253 | 253 | if ( typeof jQuery.fn.flatpickr === "function" && !$aui_doing_init_flatpickr) { |
254 | 254 | $aui_doing_init_flatpickr = true; |
255 | - <?php if ( ! empty( $flatpickr_locale ) ) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>);}catch(err){console.log(err.message);}<?php } ?> |
|
255 | + <?php if (!empty($flatpickr_locale)) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>);}catch(err){console.log(err.message);}<?php } ?> |
|
256 | 256 | jQuery('input[data-aui-init="flatpickr"]:not(.flatpickr-input)').flatpickr(); |
257 | 257 | } |
258 | 258 | $aui_doing_init_flatpickr = false; |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | |
1014 | 1014 | <?php |
1015 | 1015 | // FSE tweaks. |
1016 | - if(!empty($_REQUEST['postType'])){ ?> |
|
1016 | + if (!empty($_REQUEST['postType'])) { ?> |
|
1017 | 1017 | function aui_fse_set_data_scroll() { |
1018 | 1018 | console.log('init scroll'); |
1019 | 1019 | let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas"); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | function aui_init_flatpickr(){ |
243 | 243 | if ( typeof jQuery.fn.flatpickr === "function" && !$aui_doing_init_flatpickr) { |
244 | 244 | $aui_doing_init_flatpickr = true; |
245 | - <?php if ( ! empty( $flatpickr_locale ) ) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>);}catch(err){console.log(err.message);}<?php } ?> |
|
245 | + <?php if (!empty($flatpickr_locale)) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>);}catch(err){console.log(err.message);}<?php } ?> |
|
246 | 246 | jQuery('input[data-aui-init="flatpickr"]:not(.flatpickr-input)').flatpickr(); |
247 | 247 | } |
248 | 248 | $aui_doing_init_flatpickr = false; |
@@ -971,7 +971,7 @@ discard block |
||
971 | 971 | |
972 | 972 | <?php |
973 | 973 | // FSE tweaks. |
974 | - if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template'){ ?> |
|
974 | + if (!empty($_REQUEST['postType']) && $_REQUEST['postType'] == 'wp_template') { ?> |
|
975 | 975 | function aui_fse_set_data_scroll() { |
976 | 976 | console.log('init scroll'); |
977 | 977 | let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas"); |
@@ -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,40 +460,40 @@ 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 | - }else{ |
|
465 | + } else { |
|
466 | 466 | $css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend'; |
467 | 467 | |
468 | - $rtl = is_rtl() && ! $aui_bs5 ? '-rtl' : ''; |
|
468 | + $rtl = is_rtl() && !$aui_bs5 ? '-rtl' : ''; |
|
469 | 469 | |
470 | 470 | $bs_ver = $this->settings['bs_ver'] == '5' ? '-v5' : ''; |
471 | 471 | |
472 | - if($this->settings[$css_setting]){ |
|
473 | - $compatibility = $this->settings[$css_setting]=='core' ? false : true; |
|
474 | - $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'; |
|
472 | + if ($this->settings[$css_setting]) { |
|
473 | + $compatibility = $this->settings[$css_setting] == 'core' ? false : true; |
|
474 | + $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'; |
|
475 | 475 | |
476 | 476 | |
477 | 477 | |
478 | - wp_register_style( 'ayecode-ui', $url, array(), $this->version ); |
|
479 | - wp_enqueue_style( 'ayecode-ui' ); |
|
478 | + wp_register_style('ayecode-ui', $url, array(), $this->version); |
|
479 | + wp_enqueue_style('ayecode-ui'); |
|
480 | 480 | |
481 | - $current_screen = function_exists('get_current_screen' ) ? get_current_screen() : ''; |
|
481 | + $current_screen = function_exists('get_current_screen') ? get_current_screen() : ''; |
|
482 | 482 | |
483 | 483 | // if ( is_admin() && !empty($_REQUEST['postType']) ) { |
484 | - if ( is_admin() && ( !empty($_REQUEST['postType']) || $current_screen->is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) ) ) { |
|
485 | - $url = $this->url.'assets'.$bs_ver.'/css/ayecode-ui-fse.css'; |
|
486 | - wp_register_style( 'ayecode-ui-fse', $url, array(), $this->version ); |
|
487 | - wp_enqueue_style( 'ayecode-ui-fse' ); |
|
484 | + if (is_admin() && (!empty($_REQUEST['postType']) || $current_screen->is_block_editor()) && (defined('BLOCKSTRAP_VERSION') || defined('AUI_FSE'))) { |
|
485 | + $url = $this->url . 'assets' . $bs_ver . '/css/ayecode-ui-fse.css'; |
|
486 | + wp_register_style('ayecode-ui-fse', $url, array(), $this->version); |
|
487 | + wp_enqueue_style('ayecode-ui-fse'); |
|
488 | 488 | $load_fse = true; |
489 | 489 | } |
490 | 490 | |
491 | 491 | |
492 | 492 | // flatpickr |
493 | - wp_register_style( 'flatpickr', $this->url.'assets'.$bs_ver.'/css/flatpickr.min.css', array(), $this->version ); |
|
493 | + wp_register_style('flatpickr', $this->url . 'assets' . $bs_ver . '/css/flatpickr.min.css', array(), $this->version); |
|
494 | 494 | |
495 | 495 | // fix some wp-admin issues |
496 | - if(is_admin()){ |
|
496 | + if (is_admin()) { |
|
497 | 497 | $custom_css = " |
498 | 498 | body{ |
499 | 499 | background-color: #f1f1f1; |
@@ -541,14 +541,14 @@ discard block |
||
541 | 541 | padding: 0; |
542 | 542 | } |
543 | 543 | "; |
544 | - wp_add_inline_style( 'ayecode-ui', $custom_css ); |
|
544 | + wp_add_inline_style('ayecode-ui', $custom_css); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | // custom changes |
548 | - if ( $load_fse ) { |
|
549 | - wp_add_inline_style( 'ayecode-ui-fse', self::custom_css($compatibility) ); |
|
550 | - }else{ |
|
551 | - wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) ); |
|
548 | + if ($load_fse) { |
|
549 | + wp_add_inline_style('ayecode-ui-fse', self::custom_css($compatibility)); |
|
550 | + } else { |
|
551 | + wp_add_inline_style('ayecode-ui', self::custom_css($compatibility)); |
|
552 | 552 | |
553 | 553 | } |
554 | 554 | |
@@ -569,10 +569,10 @@ discard block |
||
569 | 569 | $flatpickr_locale = self::flatpickr_locale(); |
570 | 570 | |
571 | 571 | ob_start(); |
572 | - if ( $aui_bs5 ) { |
|
573 | - include_once( dirname( __FILE__ ) . '/inc/bs5-js.php' ); |
|
574 | - }else{ |
|
575 | - include_once( dirname( __FILE__ ) . '/inc/bs4-js.php' ); |
|
572 | + if ($aui_bs5) { |
|
573 | + include_once(dirname(__FILE__) . '/inc/bs5-js.php'); |
|
574 | + } else { |
|
575 | + include_once(dirname(__FILE__) . '/inc/bs4-js.php'); |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | $output = ob_get_clean(); |
@@ -580,10 +580,10 @@ discard block |
||
580 | 580 | /* |
581 | 581 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
582 | 582 | */ |
583 | - return str_replace( array( |
|
583 | + return str_replace(array( |
|
584 | 584 | '<script>', |
585 | 585 | '</script>' |
586 | - ), '', self::minify_js($output) ); |
|
586 | + ), '', self::minify_js($output)); |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | |
@@ -597,13 +597,13 @@ discard block |
||
597 | 597 | ob_start(); |
598 | 598 | ?> |
599 | 599 | <script> |
600 | - <?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?> |
|
600 | + <?php if (defined('FUSION_BUILDER_VERSION')) { ?> |
|
601 | 601 | /* With Avada builder */ |
602 | 602 | |
603 | 603 | <?php } ?> |
604 | 604 | </script> |
605 | 605 | <?php |
606 | - return str_replace( array( |
|
606 | + return str_replace(array( |
|
607 | 607 | '<script>', |
608 | 608 | '</script>' |
609 | 609 | ), '', ob_get_clean()); |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | * |
615 | 615 | * If this remains small then its best to use this than to add another JS file. |
616 | 616 | */ |
617 | - public function inline_script_file_browser(){ |
|
617 | + public function inline_script_file_browser() { |
|
618 | 618 | ob_start(); |
619 | 619 | ?> |
620 | 620 | <script> |
@@ -629,10 +629,10 @@ discard block |
||
629 | 629 | /* |
630 | 630 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
631 | 631 | */ |
632 | - return str_replace( array( |
|
632 | + return str_replace(array( |
|
633 | 633 | '<script>', |
634 | 634 | '</script>' |
635 | - ), '', $output ); |
|
635 | + ), '', $output); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | /** |
@@ -640,59 +640,59 @@ discard block |
||
640 | 640 | */ |
641 | 641 | public function enqueue_scripts() { |
642 | 642 | |
643 | - if( is_admin() && !$this->is_aui_screen()){ |
|
643 | + if (is_admin() && !$this->is_aui_screen()) { |
|
644 | 644 | // don't add wp-admin scripts if not requested to |
645 | - }else { |
|
645 | + } else { |
|
646 | 646 | |
647 | 647 | $js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend'; |
648 | 648 | |
649 | 649 | $bs_ver = $this->settings['bs_ver'] == '5' ? '-v5' : ''; |
650 | 650 | |
651 | 651 | // select2 |
652 | - wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version ); |
|
652 | + wp_register_script('select2', $this->url . 'assets/js/select2.min.js', array('jquery'), $this->select2_version); |
|
653 | 653 | |
654 | 654 | // flatpickr |
655 | - wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version ); |
|
655 | + wp_register_script('flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version); |
|
656 | 656 | |
657 | 657 | // iconpicker |
658 | - if ( defined( 'FAS_ICONPICKER_JS_URL' ) ) { |
|
659 | - wp_register_script( 'iconpicker', FAS_ICONPICKER_JS_URL, array(), $this->version ); |
|
660 | - }else{ |
|
661 | - wp_register_script( 'iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version ); |
|
658 | + if (defined('FAS_ICONPICKER_JS_URL')) { |
|
659 | + wp_register_script('iconpicker', FAS_ICONPICKER_JS_URL, array(), $this->version); |
|
660 | + } else { |
|
661 | + wp_register_script('iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version); |
|
662 | 662 | } |
663 | 663 | |
664 | 664 | // Bootstrap file browser |
665 | - wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version ); |
|
666 | - wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() ); |
|
665 | + wp_register_script('aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version); |
|
666 | + wp_add_inline_script('aui-custom-file-input', $this->inline_script_file_browser()); |
|
667 | 667 | |
668 | 668 | $load_inline = false; |
669 | 669 | |
670 | - if ( $this->settings[ $js_setting ] == 'core-popper' ) { |
|
670 | + if ($this->settings[$js_setting] == 'core-popper') { |
|
671 | 671 | // Bootstrap bundle |
672 | 672 | $url = $this->url . 'assets' . $bs_ver . '/js/bootstrap.bundle.min.js'; |
673 | - wp_register_script( 'bootstrap-js-bundle', $url, array( |
|
673 | + wp_register_script('bootstrap-js-bundle', $url, array( |
|
674 | 674 | 'select2', |
675 | 675 | 'jquery' |
676 | - ), $this->version, $this->is_bs3_compat() ); |
|
676 | + ), $this->version, $this->is_bs3_compat()); |
|
677 | 677 | // if in admin then add to footer for compatibility. |
678 | - is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' ); |
|
678 | + is_admin() ? wp_enqueue_script('bootstrap-js-bundle', '', null, null, true) : wp_enqueue_script('bootstrap-js-bundle'); |
|
679 | 679 | $script = $this->inline_script(); |
680 | - wp_add_inline_script( 'bootstrap-js-bundle', $script ); |
|
681 | - } elseif ( $this->settings[ $js_setting ] == 'popper' ) { |
|
680 | + wp_add_inline_script('bootstrap-js-bundle', $script); |
|
681 | + } elseif ($this->settings[$js_setting] == 'popper') { |
|
682 | 682 | $url = $this->url . 'assets/js/popper.min.js'; //@todo we need to update this to bs5 |
683 | - wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->version ); |
|
684 | - wp_enqueue_script( 'bootstrap-js-popper' ); |
|
683 | + wp_register_script('bootstrap-js-popper', $url, array('select2', 'jquery'), $this->version); |
|
684 | + wp_enqueue_script('bootstrap-js-popper'); |
|
685 | 685 | $load_inline = true; |
686 | 686 | } else { |
687 | 687 | $load_inline = true; |
688 | 688 | } |
689 | 689 | |
690 | 690 | // Load needed inline scripts by faking the loading of a script if the main script is not being loaded |
691 | - if ( $load_inline ) { |
|
692 | - wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) ); |
|
693 | - wp_enqueue_script( 'bootstrap-dummy' ); |
|
691 | + if ($load_inline) { |
|
692 | + wp_register_script('bootstrap-dummy', '', array('select2', 'jquery')); |
|
693 | + wp_enqueue_script('bootstrap-dummy'); |
|
694 | 694 | $script = $this->inline_script(); |
695 | - wp_add_inline_script( 'bootstrap-dummy', $script ); |
|
695 | + wp_add_inline_script('bootstrap-dummy', $script); |
|
696 | 696 | } |
697 | 697 | } |
698 | 698 | |
@@ -701,17 +701,17 @@ discard block |
||
701 | 701 | /** |
702 | 702 | * Enqueue flatpickr if called. |
703 | 703 | */ |
704 | - public function enqueue_flatpickr(){ |
|
705 | - wp_enqueue_style( 'flatpickr' ); |
|
706 | - wp_enqueue_script( 'flatpickr' ); |
|
704 | + public function enqueue_flatpickr() { |
|
705 | + wp_enqueue_style('flatpickr'); |
|
706 | + wp_enqueue_script('flatpickr'); |
|
707 | 707 | } |
708 | 708 | |
709 | 709 | /** |
710 | 710 | * Enqueue iconpicker if called. |
711 | 711 | */ |
712 | - public function enqueue_iconpicker(){ |
|
713 | - wp_enqueue_style( 'iconpicker' ); |
|
714 | - wp_enqueue_script( 'iconpicker' ); |
|
712 | + public function enqueue_iconpicker() { |
|
713 | + wp_enqueue_style('iconpicker'); |
|
714 | + wp_enqueue_script('iconpicker'); |
|
715 | 715 | } |
716 | 716 | |
717 | 717 | /** |
@@ -720,19 +720,19 @@ discard block |
||
720 | 720 | * @return string |
721 | 721 | */ |
722 | 722 | public function get_url() { |
723 | - $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) ); |
|
724 | - $content_url = untrailingslashit( WP_CONTENT_URL ); |
|
723 | + $content_dir = wp_normalize_path(untrailingslashit(WP_CONTENT_DIR)); |
|
724 | + $content_url = untrailingslashit(WP_CONTENT_URL); |
|
725 | 725 | |
726 | 726 | // Replace http:// to https://. |
727 | - if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) { |
|
728 | - $content_url = str_replace( 'http://', 'https://', $content_url ); |
|
727 | + if (strpos($content_url, 'http://') === 0 && strpos(plugins_url(), 'https://') === 0) { |
|
728 | + $content_url = str_replace('http://', 'https://', $content_url); |
|
729 | 729 | } |
730 | 730 | |
731 | 731 | // Check if we are inside a plugin |
732 | - $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) ); |
|
733 | - $url = str_replace( $content_dir, $content_url, $file_dir ); |
|
732 | + $file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__))); |
|
733 | + $url = str_replace($content_dir, $content_url, $file_dir); |
|
734 | 734 | |
735 | - return trailingslashit( $url ); |
|
735 | + return trailingslashit($url); |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | /** |
@@ -744,15 +744,15 @@ discard block |
||
744 | 744 | |
745 | 745 | $url = ''; |
746 | 746 | // check if we are inside a plugin |
747 | - $file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) ); |
|
747 | + $file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__))); |
|
748 | 748 | |
749 | 749 | // add check in-case user has changed wp-content dir name. |
750 | 750 | $wp_content_folder_name = basename(WP_CONTENT_DIR); |
751 | - $dir_parts = explode("/$wp_content_folder_name/",$file_dir); |
|
752 | - $url_parts = explode("/$wp_content_folder_name/",plugins_url()); |
|
751 | + $dir_parts = explode("/$wp_content_folder_name/", $file_dir); |
|
752 | + $url_parts = explode("/$wp_content_folder_name/", plugins_url()); |
|
753 | 753 | |
754 | - if(!empty($url_parts[0]) && !empty($dir_parts[1])){ |
|
755 | - $url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] ); |
|
754 | + if (!empty($url_parts[0]) && !empty($dir_parts[1])) { |
|
755 | + $url = trailingslashit($url_parts[0] . "/$wp_content_folder_name/" . $dir_parts[1]); |
|
756 | 756 | } |
757 | 757 | |
758 | 758 | return $url; |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | * Register the database settings with WordPress. |
763 | 763 | */ |
764 | 764 | public function register_settings() { |
765 | - register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' ); |
|
765 | + register_setting('ayecode-ui-settings', 'ayecode-ui-settings'); |
|
766 | 766 | } |
767 | 767 | |
768 | 768 | /** |
@@ -771,10 +771,10 @@ discard block |
||
771 | 771 | */ |
772 | 772 | public function menu_item() { |
773 | 773 | $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme |
774 | - call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array( |
|
774 | + call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array( |
|
775 | 775 | $this, |
776 | 776 | 'settings_page' |
777 | - ) ); |
|
777 | + )); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | /** |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | * |
783 | 783 | * @return array |
784 | 784 | */ |
785 | - public function theme_js_settings(){ |
|
785 | + public function theme_js_settings() { |
|
786 | 786 | return array( |
787 | 787 | 'ayetheme' => 'popper', |
788 | 788 | 'listimia' => 'required', |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | $query = "SELECT MIN(user_registered) AS oldest_registration_date FROM {$wpdb->users}"; |
804 | 804 | |
805 | 805 | // Execute the query |
806 | - $date = $wpdb->get_var( $query ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching |
|
806 | + $date = $wpdb->get_var($query); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching |
|
807 | 807 | |
808 | 808 | return $date ? $date : false; |
809 | 809 | } |
@@ -811,11 +811,11 @@ discard block |
||
811 | 811 | /** |
812 | 812 | * Show admin notice if backend scripts not loaded. |
813 | 813 | */ |
814 | - public function show_admin_version_notice(){ |
|
815 | - $fix_url = admin_url("options-general.php?page=ayecode-ui-settings" ); |
|
816 | - $button = '<a href="'.esc_url($fix_url).'" class="button-primary">View Settings</a>'; |
|
817 | - $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; |
|
818 | - echo '<div class="notice notice-error aui-settings-error-notice"><p>'. wp_kses_post( $message ).'</p></div>'; |
|
814 | + public function show_admin_version_notice() { |
|
815 | + $fix_url = admin_url("options-general.php?page=ayecode-ui-settings"); |
|
816 | + $button = '<a href="' . esc_url($fix_url) . '" class="button-primary">View Settings</a>'; |
|
817 | + $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; |
|
818 | + echo '<div class="notice notice-error aui-settings-error-notice"><p>' . wp_kses_post($message) . '</p></div>'; |
|
819 | 819 | } |
820 | 820 | |
821 | 821 | /** |
@@ -825,32 +825,32 @@ discard block |
||
825 | 825 | */ |
826 | 826 | public function get_settings() { |
827 | 827 | |
828 | - $db_settings = get_option( 'ayecode-ui-settings' ); |
|
828 | + $db_settings = get_option('ayecode-ui-settings'); |
|
829 | 829 | |
830 | 830 | // Maybe show default version notice |
831 | - $site_install_date = new DateTime( self::get_site_install_date() ); |
|
831 | + $site_install_date = new DateTime(self::get_site_install_date()); |
|
832 | 832 | $switch_over_date = new DateTime("2024-02-01"); |
833 | - if ( empty( $db_settings ) && $site_install_date < $switch_over_date ) { |
|
834 | - add_action( 'admin_notices', array( $this, 'show_admin_version_notice' ) ); |
|
833 | + if (empty($db_settings) && $site_install_date < $switch_over_date) { |
|
834 | + add_action('admin_notices', array($this, 'show_admin_version_notice')); |
|
835 | 835 | } |
836 | 836 | |
837 | 837 | $js_default = 'core-popper'; |
838 | 838 | $js_default_backend = $js_default; |
839 | 839 | |
840 | 840 | // maybe set defaults (if no settings set) |
841 | - if(empty($db_settings)){ |
|
842 | - $active_theme = strtolower( get_template() ); // active parent theme. |
|
841 | + if (empty($db_settings)) { |
|
842 | + $active_theme = strtolower(get_template()); // active parent theme. |
|
843 | 843 | $theme_js_settings = self::theme_js_settings(); |
844 | - if(isset($theme_js_settings[$active_theme])){ |
|
844 | + if (isset($theme_js_settings[$active_theme])) { |
|
845 | 845 | $js_default = $theme_js_settings[$active_theme]; |
846 | - $js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default; |
|
846 | + $js_default_backend = isset($theme_js_settings[$active_theme . "_backend"]) ? $theme_js_settings[$active_theme . "_backend"] : $js_default; |
|
847 | 847 | } |
848 | 848 | } |
849 | 849 | |
850 | 850 | /** |
851 | 851 | * Filter the default settings. |
852 | 852 | */ |
853 | - $defaults = apply_filters( 'ayecode-ui-default-settings', array( |
|
853 | + $defaults = apply_filters('ayecode-ui-default-settings', array( |
|
854 | 854 | 'css' => 'compatibility', // core, compatibility |
855 | 855 | 'js' => $js_default, // js to load, core-popper, popper |
856 | 856 | 'html_font_size' => '16', // js to load, core-popper, popper |
@@ -858,16 +858,16 @@ discard block |
||
858 | 858 | 'js_backend' => $js_default_backend, // js to load, core-popper, popper |
859 | 859 | 'disable_admin' => '', // URL snippets to disable loading on admin |
860 | 860 | 'bs_ver' => '5', // The default bootstrap version to sue by default |
861 | - ), $db_settings ); |
|
861 | + ), $db_settings); |
|
862 | 862 | |
863 | - $settings = wp_parse_args( $db_settings, $defaults ); |
|
863 | + $settings = wp_parse_args($db_settings, $defaults); |
|
864 | 864 | |
865 | 865 | /** |
866 | 866 | * Filter the Bootstrap settings. |
867 | 867 | * |
868 | 868 | * @todo if we add this filer people might use it and then it defeats the purpose of this class :/ |
869 | 869 | */ |
870 | - return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults ); |
|
870 | + return $this->settings = apply_filters('ayecode-ui-settings', $settings, $db_settings, $defaults); |
|
871 | 871 | } |
872 | 872 | |
873 | 873 | |
@@ -875,109 +875,109 @@ discard block |
||
875 | 875 | * The settings page html output. |
876 | 876 | */ |
877 | 877 | public function settings_page() { |
878 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
879 | - wp_die( esc_attr__( 'You do not have sufficient permissions to access this page.', 'ayecode-connect' ) ); |
|
878 | + if (!current_user_can('manage_options')) { |
|
879 | + wp_die(esc_attr__('You do not have sufficient permissions to access this page.', 'ayecode-connect')); |
|
880 | 880 | } |
881 | - $overrides = apply_filters( 'ayecode-ui-settings', array(), array(), array() ); |
|
881 | + $overrides = apply_filters('ayecode-ui-settings', array(), array(), array()); |
|
882 | 882 | |
883 | 883 | ?> |
884 | 884 | <div class="wrap"> |
885 | - <h1><?php echo esc_attr( $this->name ); ?></h1> |
|
886 | - <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> |
|
885 | + <h1><?php echo esc_attr($this->name); ?></h1> |
|
886 | + <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> |
|
887 | 887 | <form method="post" action="options.php"> |
888 | 888 | <?php |
889 | - settings_fields( 'ayecode-ui-settings' ); |
|
890 | - do_settings_sections( 'ayecode-ui-settings' ); |
|
889 | + settings_fields('ayecode-ui-settings'); |
|
890 | + do_settings_sections('ayecode-ui-settings'); |
|
891 | 891 | ?> |
892 | 892 | |
893 | - <h2><?php esc_html_e( 'BootStrap Version', 'ayecode-connect' ); ?></h2> |
|
894 | - <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> |
|
893 | + <h2><?php esc_html_e('BootStrap Version', 'ayecode-connect'); ?></h2> |
|
894 | + <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> |
|
895 | 895 | <div class="bsui"><?php |
896 | - if ( ! empty( $overrides ) ) { |
|
896 | + if (!empty($overrides)) { |
|
897 | 897 | echo aui()->alert(array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
898 | 898 | 'type'=> 'info', |
899 | - 'content'=> esc_attr__("Some options are disabled as your current theme is overriding them.", 'ayecode-connect' ) |
|
899 | + 'content'=> esc_attr__("Some options are disabled as your current theme is overriding them.", 'ayecode-connect') |
|
900 | 900 | )); |
901 | 901 | } |
902 | 902 | ?> |
903 | 903 | </div> |
904 | 904 | <table class="form-table wpbs-table-version-settings"> |
905 | 905 | <tr valign="top"> |
906 | - <th scope="row"><label for="wpbs-css"><?php esc_html_e( 'Version', 'ayecode-connect' ); ?></label></th> |
|
906 | + <th scope="row"><label for="wpbs-css"><?php esc_html_e('Version', 'ayecode-connect'); ?></label></th> |
|
907 | 907 | <td> |
908 | 908 | <select name="ayecode-ui-settings[bs_ver]" id="wpbs-css" <?php echo !empty($overrides['bs_ver']) ? 'disabled' : ''; ?>> |
909 | - <option value="5" <?php selected( $this->settings['bs_ver'], '5' ); ?>><?php esc_html_e( 'v5 (recommended)', 'ayecode-connect' ); ?></option> |
|
910 | - <option value="4" <?php selected( $this->settings['bs_ver'], '4' ); ?>><?php esc_html_e( 'v4 (legacy)', 'ayecode-connect' ); ?></option> |
|
909 | + <option value="5" <?php selected($this->settings['bs_ver'], '5'); ?>><?php esc_html_e('v5 (recommended)', 'ayecode-connect'); ?></option> |
|
910 | + <option value="4" <?php selected($this->settings['bs_ver'], '4'); ?>><?php esc_html_e('v4 (legacy)', 'ayecode-connect'); ?></option> |
|
911 | 911 | </select> |
912 | 912 | </td> |
913 | 913 | </tr> |
914 | 914 | </table> |
915 | 915 | |
916 | - <h2><?php esc_html_e( 'Frontend', 'ayecode-connect' ); ?></h2> |
|
916 | + <h2><?php esc_html_e('Frontend', 'ayecode-connect'); ?></h2> |
|
917 | 917 | <table class="form-table wpbs-table-settings"> |
918 | 918 | <tr valign="top"> |
919 | - <th scope="row"><label for="wpbs-css"><?php esc_html_e( 'Load CSS', 'ayecode-connect' ); ?></label></th> |
|
919 | + <th scope="row"><label for="wpbs-css"><?php esc_html_e('Load CSS', 'ayecode-connect'); ?></label></th> |
|
920 | 920 | <td> |
921 | 921 | <select name="ayecode-ui-settings[css]" id="wpbs-css" <?php echo !empty($overrides['css']) ? 'disabled' : ''; ?>> |
922 | - <option value="compatibility" <?php selected( $this->settings['css'], 'compatibility' ); ?>><?php esc_html_e( 'Compatibility Mode (default)', 'ayecode-connect' ); ?></option> |
|
923 | - <option value="core" <?php selected( $this->settings['css'], 'core' ); ?>><?php esc_html_e( 'Full Mode', 'ayecode-connect' ); ?></option> |
|
924 | - <option value="" <?php selected( $this->settings['css'], '' ); ?>><?php esc_html_e( 'Disabled', 'ayecode-connect' ); ?></option> |
|
922 | + <option value="compatibility" <?php selected($this->settings['css'], 'compatibility'); ?>><?php esc_html_e('Compatibility Mode (default)', 'ayecode-connect'); ?></option> |
|
923 | + <option value="core" <?php selected($this->settings['css'], 'core'); ?>><?php esc_html_e('Full Mode', 'ayecode-connect'); ?></option> |
|
924 | + <option value="" <?php selected($this->settings['css'], ''); ?>><?php esc_html_e('Disabled', '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-js"><?php esc_html_e( 'Load JS', 'ayecode-connect' ); ?></label></th> |
|
930 | + <th scope="row"><label for="wpbs-js"><?php esc_html_e('Load JS', 'ayecode-connect'); ?></label></th> |
|
931 | 931 | <td> |
932 | 932 | <select name="ayecode-ui-settings[js]" id="wpbs-js" <?php echo !empty($overrides['js']) ? 'disabled' : ''; ?>> |
933 | - <option value="core-popper" <?php selected( $this->settings['js'], 'core-popper' ); ?>><?php esc_html_e( 'Core + Popper (default)', 'ayecode-connect' ); ?></option> |
|
934 | - <option value="popper" <?php selected( $this->settings['js'], 'popper' ); ?>><?php esc_html_e( 'Popper', 'ayecode-connect' ); ?></option> |
|
935 | - <option value="required" <?php selected( $this->settings['js'], 'required' ); ?>><?php esc_html_e( 'Required functions only', 'ayecode-connect' ); ?></option> |
|
936 | - <option value="" <?php selected( $this->settings['js'], '' ); ?>><?php esc_html_e( 'Disabled (not recommended)', 'ayecode-connect' ); ?></option> |
|
933 | + <option value="core-popper" <?php selected($this->settings['js'], 'core-popper'); ?>><?php esc_html_e('Core + Popper (default)', 'ayecode-connect'); ?></option> |
|
934 | + <option value="popper" <?php selected($this->settings['js'], 'popper'); ?>><?php esc_html_e('Popper', 'ayecode-connect'); ?></option> |
|
935 | + <option value="required" <?php selected($this->settings['js'], 'required'); ?>><?php esc_html_e('Required functions only', 'ayecode-connect'); ?></option> |
|
936 | + <option value="" <?php selected($this->settings['js'], ''); ?>><?php esc_html_e('Disabled (not recommended)', 'ayecode-connect'); ?></option> |
|
937 | 937 | </select> |
938 | 938 | </td> |
939 | 939 | </tr> |
940 | 940 | |
941 | 941 | <tr valign="top"> |
942 | - <th scope="row"><label for="wpbs-font_size"><?php esc_html_e( 'HTML Font Size (px)', 'ayecode-connect' ); ?></label></th> |
|
942 | + <th scope="row"><label for="wpbs-font_size"><?php esc_html_e('HTML Font Size (px)', 'ayecode-connect'); ?></label></th> |
|
943 | 943 | <td> |
944 | - <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' : ''; ?> /> |
|
945 | - <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> |
|
944 | + <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' : ''; ?> /> |
|
945 | + <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> |
|
946 | 946 | </td> |
947 | 947 | </tr> |
948 | 948 | |
949 | 949 | </table> |
950 | 950 | |
951 | - <h2><?php esc_html_e( 'Backend', 'ayecode-connect' ); ?> (wp-admin)</h2> |
|
951 | + <h2><?php esc_html_e('Backend', 'ayecode-connect'); ?> (wp-admin)</h2> |
|
952 | 952 | <table class="form-table wpbs-table-settings"> |
953 | 953 | <tr valign="top"> |
954 | - <th scope="row"><label for="wpbs-css-admin"><?php esc_html_e( 'Load CSS', 'ayecode-connect' ); ?></label></th> |
|
954 | + <th scope="row"><label for="wpbs-css-admin"><?php esc_html_e('Load CSS', 'ayecode-connect'); ?></label></th> |
|
955 | 955 | <td> |
956 | 956 | <select name="ayecode-ui-settings[css_backend]" id="wpbs-css-admin" <?php echo !empty($overrides['css_backend']) ? 'disabled' : ''; ?>> |
957 | - <option value="compatibility" <?php selected( $this->settings['css_backend'], 'compatibility' ); ?>><?php esc_html_e( 'Compatibility Mode (default)', 'ayecode-connect' ); ?></option> |
|
958 | - <option value="core" <?php selected( $this->settings['css_backend'], 'core' ); ?>><?php esc_html_e( 'Full Mode (will cause style issues)', 'ayecode-connect' ); ?></option> |
|
959 | - <option value="" <?php selected( $this->settings['css_backend'], '' ); ?>><?php esc_html_e( 'Disabled', 'ayecode-connect' ); ?></option> |
|
957 | + <option value="compatibility" <?php selected($this->settings['css_backend'], 'compatibility'); ?>><?php esc_html_e('Compatibility Mode (default)', 'ayecode-connect'); ?></option> |
|
958 | + <option value="core" <?php selected($this->settings['css_backend'], 'core'); ?>><?php esc_html_e('Full Mode (will cause style issues)', 'ayecode-connect'); ?></option> |
|
959 | + <option value="" <?php selected($this->settings['css_backend'], ''); ?>><?php esc_html_e('Disabled', '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-js-admin"><?php esc_html_e( 'Load JS', 'ayecode-connect' ); ?></label></th> |
|
965 | + <th scope="row"><label for="wpbs-js-admin"><?php esc_html_e('Load JS', 'ayecode-connect'); ?></label></th> |
|
966 | 966 | <td> |
967 | 967 | <select name="ayecode-ui-settings[js_backend]" id="wpbs-js-admin" <?php echo !empty($overrides['js_backend']) ? 'disabled' : ''; ?>> |
968 | - <option value="core-popper" <?php selected( $this->settings['js_backend'], 'core-popper' ); ?>><?php esc_html_e( 'Core + Popper (default)', 'ayecode-connect' ); ?></option> |
|
969 | - <option value="popper" <?php selected( $this->settings['js_backend'], 'popper' ); ?>><?php esc_html_e( 'Popper', 'ayecode-connect' ); ?></option> |
|
970 | - <option value="required" <?php selected( $this->settings['js_backend'], 'required' ); ?>><?php esc_html_e( 'Required functions only', 'ayecode-connect' ); ?></option> |
|
971 | - <option value="" <?php selected( $this->settings['js_backend'], '' ); ?>><?php esc_html_e( 'Disabled (not recommended)', 'ayecode-connect' ); ?></option> |
|
968 | + <option value="core-popper" <?php selected($this->settings['js_backend'], 'core-popper'); ?>><?php esc_html_e('Core + Popper (default)', 'ayecode-connect'); ?></option> |
|
969 | + <option value="popper" <?php selected($this->settings['js_backend'], 'popper'); ?>><?php esc_html_e('Popper', 'ayecode-connect'); ?></option> |
|
970 | + <option value="required" <?php selected($this->settings['js_backend'], 'required'); ?>><?php esc_html_e('Required functions only', 'ayecode-connect'); ?></option> |
|
971 | + <option value="" <?php selected($this->settings['js_backend'], ''); ?>><?php esc_html_e('Disabled (not recommended)', 'ayecode-connect'); ?></option> |
|
972 | 972 | </select> |
973 | 973 | </td> |
974 | 974 | </tr> |
975 | 975 | |
976 | 976 | <tr valign="top"> |
977 | - <th scope="row"><label for="wpbs-disable-admin"><?php esc_html_e( 'Disable load on URL', 'ayecode-connect' ); ?></label></th> |
|
977 | + <th scope="row"><label for="wpbs-disable-admin"><?php esc_html_e('Disable load on URL', 'ayecode-connect'); ?></label></th> |
|
978 | 978 | <td> |
979 | - <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> |
|
980 | - <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> |
|
979 | + <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> |
|
980 | + <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> |
|
981 | 981 | </td> |
982 | 982 | </tr> |
983 | 983 | </table> |
@@ -986,33 +986,33 @@ discard block |
||
986 | 986 | submit_button(); |
987 | 987 | ?> |
988 | 988 | </form> |
989 | - <div id="wpbs-version" data-aui-source="<?php echo esc_attr( $this->get_load_source() ); ?>"><?php echo esc_html( $this->version ); ?></div> |
|
989 | + <div id="wpbs-version" data-aui-source="<?php echo esc_attr($this->get_load_source()); ?>"><?php echo esc_html($this->version); ?></div> |
|
990 | 990 | </div> |
991 | 991 | <?php |
992 | 992 | } |
993 | 993 | |
994 | - public function get_load_source(){ |
|
995 | - $file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) ); |
|
996 | - $plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) ); |
|
994 | + public function get_load_source() { |
|
995 | + $file = str_replace(array("/", "\\"), "/", realpath(__FILE__)); |
|
996 | + $plugins_dir = str_replace(array("/", "\\"), "/", realpath(WP_PLUGIN_DIR)); |
|
997 | 997 | |
998 | 998 | // Find source plugin/theme of SD |
999 | 999 | $source = array(); |
1000 | - if ( strpos( $file, $plugins_dir ) !== false ) { |
|
1001 | - $source = explode( "/", plugin_basename( $file ) ); |
|
1002 | - } else if ( function_exists( 'get_theme_root' ) ) { |
|
1003 | - $themes_dir = str_replace( array( "/", "\\" ), "/", realpath( get_theme_root() ) ); |
|
1000 | + if (strpos($file, $plugins_dir) !== false) { |
|
1001 | + $source = explode("/", plugin_basename($file)); |
|
1002 | + } else if (function_exists('get_theme_root')) { |
|
1003 | + $themes_dir = str_replace(array("/", "\\"), "/", realpath(get_theme_root())); |
|
1004 | 1004 | |
1005 | - if ( strpos( $file, $themes_dir ) !== false ) { |
|
1006 | - $source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) ); |
|
1005 | + if (strpos($file, $themes_dir) !== false) { |
|
1006 | + $source = explode("/", ltrim(str_replace($themes_dir, "", $file), "/")); |
|
1007 | 1007 | } |
1008 | 1008 | } |
1009 | 1009 | |
1010 | 1010 | return isset($source[0]) ? esc_attr($source[0]) : ''; |
1011 | 1011 | } |
1012 | 1012 | |
1013 | - public function customizer_settings($wp_customize){ |
|
1013 | + public function customizer_settings($wp_customize) { |
|
1014 | 1014 | $wp_customize->add_section('aui_settings', array( |
1015 | - 'title' => __('AyeCode UI', 'ayecode-connect' ), |
|
1015 | + 'title' => __('AyeCode UI', 'ayecode-connect'), |
|
1016 | 1016 | 'priority' => 120, |
1017 | 1017 | )); |
1018 | 1018 | |
@@ -1026,8 +1026,8 @@ discard block |
||
1026 | 1026 | 'type' => 'option', |
1027 | 1027 | 'transport' => 'refresh', |
1028 | 1028 | )); |
1029 | - $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array( |
|
1030 | - 'label' => __('Primary Color', 'ayecode-connect' ), |
|
1029 | + $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_primary', array( |
|
1030 | + 'label' => __('Primary Color', 'ayecode-connect'), |
|
1031 | 1031 | 'section' => 'aui_settings', |
1032 | 1032 | 'settings' => 'aui_options[color_primary]', |
1033 | 1033 | ))); |
@@ -1039,8 +1039,8 @@ discard block |
||
1039 | 1039 | 'type' => 'option', |
1040 | 1040 | 'transport' => 'refresh', |
1041 | 1041 | )); |
1042 | - $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array( |
|
1043 | - 'label' => __('Secondary Color', 'ayecode-connect' ), |
|
1042 | + $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_secondary', array( |
|
1043 | + 'label' => __('Secondary Color', 'ayecode-connect'), |
|
1044 | 1044 | 'section' => 'aui_settings', |
1045 | 1045 | 'settings' => 'aui_options[color_secondary]', |
1046 | 1046 | ))); |
@@ -1066,12 +1066,12 @@ discard block |
||
1066 | 1066 | .collapse.show:not(.in){display: inherit;} |
1067 | 1067 | .fade.show{opacity: 1;} |
1068 | 1068 | |
1069 | - <?php if( defined( 'SVQ_THEME_VERSION' ) ){ ?> |
|
1069 | + <?php if (defined('SVQ_THEME_VERSION')) { ?> |
|
1070 | 1070 | /* KLEO theme specific */ |
1071 | 1071 | .kleo-main-header .navbar-collapse.collapse.show:not(.in){display: block !important;} |
1072 | 1072 | <?php } ?> |
1073 | 1073 | |
1074 | - <?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?> |
|
1074 | + <?php if (defined('FUSION_BUILDER_VERSION')) { ?> |
|
1075 | 1075 | /* With Avada builder */ |
1076 | 1076 | body.modal-open .modal.in {opacity:1;z-index: 99999} |
1077 | 1077 | body.modal-open .modal.bsui.in .modal-content {box-shadow: none;} |
@@ -1082,10 +1082,10 @@ discard block |
||
1082 | 1082 | <?php } ?> |
1083 | 1083 | </style> |
1084 | 1084 | <?php |
1085 | - return str_replace( array( |
|
1085 | + return str_replace(array( |
|
1086 | 1086 | '<style>', |
1087 | 1087 | '</style>' |
1088 | - ), '', self::minify_css( ob_get_clean() ) ); |
|
1088 | + ), '', self::minify_css(ob_get_clean())); |
|
1089 | 1089 | } |
1090 | 1090 | |
1091 | 1091 | |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | global $aui_bs5; |
1094 | 1094 | |
1095 | 1095 | $colors = array(); |
1096 | - if ( defined( 'BLOCKSTRAP_VERSION' ) ) { |
|
1096 | + if (defined('BLOCKSTRAP_VERSION')) { |
|
1097 | 1097 | |
1098 | 1098 | |
1099 | 1099 | $setting = wp_get_global_settings(); |
@@ -1102,22 +1102,22 @@ discard block |
||
1102 | 1102 | // print_r(get_default_block_editor_settings());exit; |
1103 | 1103 | |
1104 | 1104 | // print_r($setting);echo '###';exit; |
1105 | - if(!empty($setting['color']['palette']['theme'])){ |
|
1106 | - foreach($setting['color']['palette']['theme'] as $color){ |
|
1105 | + if (!empty($setting['color']['palette']['theme'])) { |
|
1106 | + foreach ($setting['color']['palette']['theme'] as $color) { |
|
1107 | 1107 | $colors[$color['slug']] = esc_attr($color['color']); |
1108 | 1108 | } |
1109 | 1109 | } |
1110 | 1110 | |
1111 | - if(!empty($setting['color']['palette']['custom'])){ |
|
1112 | - foreach($setting['color']['palette']['custom'] as $color){ |
|
1111 | + if (!empty($setting['color']['palette']['custom'])) { |
|
1112 | + foreach ($setting['color']['palette']['custom'] as $color) { |
|
1113 | 1113 | $colors[$color['slug']] = esc_attr($color['color']); |
1114 | 1114 | } |
1115 | 1115 | } |
1116 | - }else{ |
|
1116 | + } else { |
|
1117 | 1117 | $settings = get_option('aui_options'); |
1118 | 1118 | $colors = array( |
1119 | - 'primary' => ! empty( $settings['color_primary'] ) ? $settings['color_primary'] : AUI_PRIMARY_COLOR, |
|
1120 | - 'secondary' => ! empty( $settings['color_secondary'] ) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR |
|
1119 | + 'primary' => !empty($settings['color_primary']) ? $settings['color_primary'] : AUI_PRIMARY_COLOR, |
|
1120 | + 'secondary' => !empty($settings['color_secondary']) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR |
|
1121 | 1121 | ); |
1122 | 1122 | } |
1123 | 1123 | |
@@ -1128,25 +1128,25 @@ discard block |
||
1128 | 1128 | <?php |
1129 | 1129 | |
1130 | 1130 | // BS v3 compat |
1131 | - if( self::is_bs3_compat() ){ |
|
1131 | + if (self::is_bs3_compat()) { |
|
1132 | 1132 | echo self::bs3_compat_css(); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
1133 | 1133 | } |
1134 | 1134 | |
1135 | - $current_screen = function_exists('get_current_screen' ) ? get_current_screen() : ''; |
|
1135 | + $current_screen = function_exists('get_current_screen') ? get_current_screen() : ''; |
|
1136 | 1136 | $is_fse = false; |
1137 | - if ( is_admin() && ( !empty($_REQUEST['postType']) || $current_screen->is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) ) ) { |
|
1137 | + if (is_admin() && (!empty($_REQUEST['postType']) || $current_screen->is_block_editor()) && (defined('BLOCKSTRAP_VERSION') || defined('AUI_FSE'))) { |
|
1138 | 1138 | $is_fse = true; |
1139 | 1139 | } |
1140 | 1140 | |
1141 | - if(!empty($colors)){ |
|
1141 | + if (!empty($colors)) { |
|
1142 | 1142 | $d_colors = self::get_colors(true); |
1143 | 1143 | |
1144 | 1144 | // $is_fse = !empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template'; |
1145 | - foreach($colors as $key => $color ){ |
|
1146 | - if((empty( $d_colors[$key]) || $d_colors[$key] != $color) || $is_fse ) { |
|
1145 | + foreach ($colors as $key => $color) { |
|
1146 | + if ((empty($d_colors[$key]) || $d_colors[$key] != $color) || $is_fse) { |
|
1147 | 1147 | $var = $is_fse ? "var(--wp--preset--color--$key)" : $color; |
1148 | 1148 | $compat = $is_fse ? '.editor-styles-wrapper' : $compatibility; |
1149 | - echo $aui_bs5 ? self::css_overwrite_bs5($key,$var,$compat,$color) : self::css_overwrite($key,$var,$compat,$color); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1149 | + echo $aui_bs5 ? self::css_overwrite_bs5($key, $var, $compat, $color) : self::css_overwrite($key, $var, $compat, $color); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1150 | 1150 | } |
1151 | 1151 | } |
1152 | 1152 | // exit; |
@@ -1155,71 +1155,71 @@ discard block |
||
1155 | 1155 | // Set admin bar z-index lower when modal is open. |
1156 | 1156 | echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}'; |
1157 | 1157 | |
1158 | - if(is_admin()){ |
|
1158 | + if (is_admin()) { |
|
1159 | 1159 | echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}'; |
1160 | 1160 | } |
1161 | 1161 | |
1162 | - if( $aui_bs5 && defined( 'BLOCKSTRAP_VERSION' ) ){ |
|
1162 | + if ($aui_bs5 && defined('BLOCKSTRAP_VERSION')) { |
|
1163 | 1163 | $css = ''; |
1164 | 1164 | $theme_settings = wp_get_global_styles(); |
1165 | 1165 | |
1166 | 1166 | // print_r( $theme_settings);exit; |
1167 | 1167 | |
1168 | 1168 | // font face |
1169 | - if( !empty( $theme_settings['typography']['fontFamily'] ) ){ |
|
1170 | - $t_fontface = str_replace( array('var:preset|','font-family|'), array('--wp--preset--','font-family--'), $theme_settings['typography']['fontFamily'] ); //var(--wp--preset--font-family--poppins) |
|
1169 | + if (!empty($theme_settings['typography']['fontFamily'])) { |
|
1170 | + $t_fontface = str_replace(array('var:preset|', 'font-family|'), array('--wp--preset--', 'font-family--'), $theme_settings['typography']['fontFamily']); //var(--wp--preset--font-family--poppins) |
|
1171 | 1171 | $css .= '--bs-body-font-family: ' . esc_attr($t_fontface) . ';'; |
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | // font size |
1175 | - if( !empty( $theme_settings['typography']['fontSize'] ) ){ |
|
1176 | - $css .= '--bs-body-font-size: ' . esc_attr( $theme_settings['typography']['fontSize'] ) . ' ;'; |
|
1175 | + if (!empty($theme_settings['typography']['fontSize'])) { |
|
1176 | + $css .= '--bs-body-font-size: ' . esc_attr($theme_settings['typography']['fontSize']) . ' ;'; |
|
1177 | 1177 | } |
1178 | 1178 | |
1179 | 1179 | // line height |
1180 | - if( !empty( $theme_settings['typography']['lineHeight'] ) ){ |
|
1181 | - $css .= '--bs-body-line-height: ' . esc_attr( $theme_settings['typography']['lineHeight'] ) . ';'; |
|
1180 | + if (!empty($theme_settings['typography']['lineHeight'])) { |
|
1181 | + $css .= '--bs-body-line-height: ' . esc_attr($theme_settings['typography']['lineHeight']) . ';'; |
|
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | |
1185 | 1185 | // font weight |
1186 | - if( !empty( $theme_settings['typography']['fontWeight'] ) ){ |
|
1187 | - $css .= '--bs-body-font-weight: ' . esc_attr( $theme_settings['typography']['fontWeight'] ) . ';'; |
|
1186 | + if (!empty($theme_settings['typography']['fontWeight'])) { |
|
1187 | + $css .= '--bs-body-font-weight: ' . esc_attr($theme_settings['typography']['fontWeight']) . ';'; |
|
1188 | 1188 | } |
1189 | 1189 | |
1190 | 1190 | // Background |
1191 | - if( !empty( $theme_settings['color']['background'] ) ){ |
|
1192 | - $css .= '--bs-body-bg: ' . esc_attr( $theme_settings['color']['background'] ) . ';'; |
|
1191 | + if (!empty($theme_settings['color']['background'])) { |
|
1192 | + $css .= '--bs-body-bg: ' . esc_attr($theme_settings['color']['background']) . ';'; |
|
1193 | 1193 | } |
1194 | 1194 | |
1195 | 1195 | // Background Gradient |
1196 | - if( !empty( $theme_settings['color']['gradient'] ) ){ |
|
1197 | - $css .= 'background: ' . esc_attr( $theme_settings['color']['gradient'] ) . ';'; |
|
1196 | + if (!empty($theme_settings['color']['gradient'])) { |
|
1197 | + $css .= 'background: ' . esc_attr($theme_settings['color']['gradient']) . ';'; |
|
1198 | 1198 | } |
1199 | 1199 | |
1200 | 1200 | // Background Gradient |
1201 | - if( !empty( $theme_settings['color']['gradient'] ) ){ |
|
1202 | - $css .= 'background: ' . esc_attr( $theme_settings['color']['gradient'] ) . ';'; |
|
1201 | + if (!empty($theme_settings['color']['gradient'])) { |
|
1202 | + $css .= 'background: ' . esc_attr($theme_settings['color']['gradient']) . ';'; |
|
1203 | 1203 | } |
1204 | 1204 | |
1205 | 1205 | // text color |
1206 | - if( !empty( $theme_settings['color']['text'] ) ){ |
|
1207 | - $css .= '--bs-body-color: ' . esc_attr( $theme_settings['color']['text'] ) . ';'; |
|
1206 | + if (!empty($theme_settings['color']['text'])) { |
|
1207 | + $css .= '--bs-body-color: ' . esc_attr($theme_settings['color']['text']) . ';'; |
|
1208 | 1208 | } |
1209 | 1209 | |
1210 | 1210 | |
1211 | 1211 | // link colors |
1212 | - if( !empty( $theme_settings['elements']['link']['color']['text'] ) ){ |
|
1213 | - $css .= '--bs-link-color: ' . esc_attr( $theme_settings['elements']['link']['color']['text'] ) . ';'; |
|
1212 | + if (!empty($theme_settings['elements']['link']['color']['text'])) { |
|
1213 | + $css .= '--bs-link-color: ' . esc_attr($theme_settings['elements']['link']['color']['text']) . ';'; |
|
1214 | 1214 | } |
1215 | - if( !empty( $theme_settings['elements']['link'][':hover']['color']['text'] ) ){ |
|
1216 | - $css .= '--bs-link-hover-color: ' . esc_attr( $theme_settings['elements']['link'][':hover']['color']['text'] ) . ';'; |
|
1215 | + if (!empty($theme_settings['elements']['link'][':hover']['color']['text'])) { |
|
1216 | + $css .= '--bs-link-hover-color: ' . esc_attr($theme_settings['elements']['link'][':hover']['color']['text']) . ';'; |
|
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | |
1220 | 1220 | |
1221 | - if($css){ |
|
1222 | - echo $is_fse ? 'body.editor-styles-wrapper{' . esc_attr( $css ) . '}' : 'body{' . esc_attr( $css ) . '}'; |
|
1221 | + if ($css) { |
|
1222 | + echo $is_fse ? 'body.editor-styles-wrapper{' . esc_attr($css) . '}' : 'body{' . esc_attr($css) . '}'; |
|
1223 | 1223 | } |
1224 | 1224 | |
1225 | 1225 | $bep = $is_fse ? 'body.editor-styles-wrapper ' : ''; |
@@ -1227,42 +1227,42 @@ discard block |
||
1227 | 1227 | |
1228 | 1228 | // Headings |
1229 | 1229 | $headings_css = ''; |
1230 | - if( !empty( $theme_settings['elements']['heading']['color']['text'] ) ){ |
|
1231 | - $headings_css .= "color: " . esc_attr( $theme_settings['elements']['heading']['color']['text'] ) . ";"; |
|
1230 | + if (!empty($theme_settings['elements']['heading']['color']['text'])) { |
|
1231 | + $headings_css .= "color: " . esc_attr($theme_settings['elements']['heading']['color']['text']) . ";"; |
|
1232 | 1232 | } |
1233 | 1233 | |
1234 | 1234 | // heading background |
1235 | - if( !empty( $theme_settings['elements']['heading']['color']['background'] ) ){ |
|
1236 | - $headings_css .= 'background: ' . esc_attr( $theme_settings['elements']['heading']['color']['background'] ) . ';'; |
|
1235 | + if (!empty($theme_settings['elements']['heading']['color']['background'])) { |
|
1236 | + $headings_css .= 'background: ' . esc_attr($theme_settings['elements']['heading']['color']['background']) . ';'; |
|
1237 | 1237 | } |
1238 | 1238 | |
1239 | 1239 | // heading font family |
1240 | - if( !empty( $theme_settings['elements']['heading']['typography']['fontFamily'] ) ){ |
|
1241 | - $headings_css .= 'font-family: ' . esc_attr( $theme_settings['elements']['heading']['typography']['fontFamily'] ) . ';'; |
|
1240 | + if (!empty($theme_settings['elements']['heading']['typography']['fontFamily'])) { |
|
1241 | + $headings_css .= 'font-family: ' . esc_attr($theme_settings['elements']['heading']['typography']['fontFamily']) . ';'; |
|
1242 | 1242 | } |
1243 | 1243 | |
1244 | - if( $headings_css ){ |
|
1245 | - echo "$bep h1,$bep h2,$bep h3, $bep h4,$bep h5,$bep h6{ " . esc_attr( $headings_css ) . "}"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1244 | + if ($headings_css) { |
|
1245 | + echo "$bep h1,$bep h2,$bep h3, $bep h4,$bep h5,$bep h6{ " . esc_attr($headings_css) . "}"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1246 | 1246 | } |
1247 | 1247 | |
1248 | - $hs = array('h1','h2','h3','h4','h5','h6'); |
|
1248 | + $hs = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6'); |
|
1249 | 1249 | |
1250 | - foreach($hs as $hn){ |
|
1250 | + foreach ($hs as $hn) { |
|
1251 | 1251 | $h_css = ''; |
1252 | - if( !empty( $theme_settings['elements'][$hn]['color']['text'] ) ){ |
|
1253 | - $h_css .= 'color: ' . esc_attr( $theme_settings['elements'][$hn]['color']['text'] ) . ';'; |
|
1252 | + if (!empty($theme_settings['elements'][$hn]['color']['text'])) { |
|
1253 | + $h_css .= 'color: ' . esc_attr($theme_settings['elements'][$hn]['color']['text']) . ';'; |
|
1254 | 1254 | } |
1255 | 1255 | |
1256 | - if( !empty( $theme_settings['elements'][$hn]['typography']['fontSize'] ) ){ |
|
1257 | - $h_css .= 'font-size: ' . esc_attr( $theme_settings['elements'][$hn]['typography']['fontSize'] ) . ';'; |
|
1256 | + if (!empty($theme_settings['elements'][$hn]['typography']['fontSize'])) { |
|
1257 | + $h_css .= 'font-size: ' . esc_attr($theme_settings['elements'][$hn]['typography']['fontSize']) . ';'; |
|
1258 | 1258 | } |
1259 | 1259 | |
1260 | - if( !empty( $theme_settings['elements'][$hn]['typography']['fontFamily'] ) ){ |
|
1261 | - $h_css .= 'font-family: ' . esc_attr( $theme_settings['elements'][$hn]['typography']['fontFamily'] ) . ';'; |
|
1260 | + if (!empty($theme_settings['elements'][$hn]['typography']['fontFamily'])) { |
|
1261 | + $h_css .= 'font-family: ' . esc_attr($theme_settings['elements'][$hn]['typography']['fontFamily']) . ';'; |
|
1262 | 1262 | } |
1263 | 1263 | |
1264 | - if($h_css){ |
|
1265 | - echo esc_attr( $bep . $hn ) . '{'.esc_attr( $h_css ).'}'; |
|
1264 | + if ($h_css) { |
|
1265 | + echo esc_attr($bep . $hn) . '{' . esc_attr($h_css) . '}'; |
|
1266 | 1266 | } |
1267 | 1267 | } |
1268 | 1268 | |
@@ -1275,10 +1275,10 @@ discard block |
||
1275 | 1275 | /* |
1276 | 1276 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
1277 | 1277 | */ |
1278 | - return str_replace( array( |
|
1278 | + return str_replace(array( |
|
1279 | 1279 | '<style>', |
1280 | 1280 | '</style>' |
1281 | - ), '', self::minify_css( ob_get_clean() ) ); |
|
1281 | + ), '', self::minify_css(ob_get_clean())); |
|
1282 | 1282 | } |
1283 | 1283 | |
1284 | 1284 | |
@@ -1288,7 +1288,7 @@ discard block |
||
1288 | 1288 | * |
1289 | 1289 | * @return bool |
1290 | 1290 | */ |
1291 | - public static function is_bs3_compat(){ |
|
1291 | + public static function is_bs3_compat() { |
|
1292 | 1292 | return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION'); |
1293 | 1293 | } |
1294 | 1294 | |
@@ -1297,7 +1297,7 @@ discard block |
||
1297 | 1297 | $hex = str_replace('#', '', $hex); |
1298 | 1298 | |
1299 | 1299 | // Convert 3-digit hex to 6-digit hex |
1300 | - if(strlen($hex) == 3) { |
|
1300 | + if (strlen($hex) == 3) { |
|
1301 | 1301 | $hex = str_repeat(substr($hex, 0, 1), 2) . str_repeat(substr($hex, 1, 1), 2) . str_repeat(substr($hex, 2, 1), 2); |
1302 | 1302 | } |
1303 | 1303 | |
@@ -1319,13 +1319,13 @@ discard block |
||
1319 | 1319 | * |
1320 | 1320 | * @return string |
1321 | 1321 | */ |
1322 | - public static function css_overwrite_bs5($type,$color_code,$compatibility, $hex = '' ){ |
|
1322 | + public static function css_overwrite_bs5($type, $color_code, $compatibility, $hex = '') { |
|
1323 | 1323 | global $aui_bs5; |
1324 | 1324 | |
1325 | 1325 | $is_var = false; |
1326 | 1326 | $is_custom = strpos($type, 'custom-') !== false ? true : false; |
1327 | - if(!$color_code){return '';} |
|
1328 | - if(strpos($color_code, 'var') !== false){ |
|
1327 | + if (!$color_code) {return ''; } |
|
1328 | + if (strpos($color_code, 'var') !== false) { |
|
1329 | 1329 | //if(!sanitize_hex_color($color_code)){ |
1330 | 1330 | $color_code = esc_attr($color_code); |
1331 | 1331 | $is_var = true; |
@@ -1335,15 +1335,15 @@ discard block |
||
1335 | 1335 | |
1336 | 1336 | // echo '@@@'.$color_code.'==='.self::hex_to_rgb($color_code);exit; |
1337 | 1337 | |
1338 | - if(!$color_code){return '';} |
|
1338 | + if (!$color_code) {return ''; } |
|
1339 | 1339 | |
1340 | 1340 | $rgb = self::hex_to_rgb($hex); |
1341 | 1341 | |
1342 | - if($compatibility===true || $compatibility===1){ |
|
1342 | + if ($compatibility === true || $compatibility === 1) { |
|
1343 | 1343 | $compatibility = '.bsui'; |
1344 | - }elseif(!$compatibility){ |
|
1344 | + }elseif (!$compatibility) { |
|
1345 | 1345 | $compatibility = ''; |
1346 | - }else{ |
|
1346 | + } else { |
|
1347 | 1347 | $compatibility = esc_attr($compatibility); |
1348 | 1348 | } |
1349 | 1349 | |
@@ -1360,30 +1360,30 @@ discard block |
||
1360 | 1360 | * c = color, b = background color, o = border-color, f = fill |
1361 | 1361 | */ |
1362 | 1362 | $selectors = array( |
1363 | - ".btn-{$type}" => array( 'b', 'o' ), |
|
1364 | - ".btn-{$type}.disabled" => array( 'b', 'o' ), |
|
1365 | - ".btn-{$type}:disabled" => array( 'b', 'o' ), |
|
1366 | - ".btn-outline-{$type}" => array( 'c', 'o' ), |
|
1367 | - ".btn-outline-{$type}:hover" => array( 'b', 'o' ), |
|
1368 | - ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ), |
|
1369 | - ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ), |
|
1370 | - ".show>.btn-outline-{$type}.dropdown-toggle" => array( 'b', 'o' ), |
|
1371 | - ".badge-{$type}" => array( 'b' ), |
|
1372 | - ".alert-{$type}" => array( 'b', 'o' ), |
|
1373 | - ".bg-{$type}" => array( 'b', 'f' ), |
|
1374 | - ".btn-link.btn-{$type}" => array( 'c' ), |
|
1375 | - ".text-{$type}" => array( 'c' ), |
|
1363 | + ".btn-{$type}" => array('b', 'o'), |
|
1364 | + ".btn-{$type}.disabled" => array('b', 'o'), |
|
1365 | + ".btn-{$type}:disabled" => array('b', 'o'), |
|
1366 | + ".btn-outline-{$type}" => array('c', 'o'), |
|
1367 | + ".btn-outline-{$type}:hover" => array('b', 'o'), |
|
1368 | + ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array('b', 'o'), |
|
1369 | + ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array('b', 'o'), |
|
1370 | + ".show>.btn-outline-{$type}.dropdown-toggle" => array('b', 'o'), |
|
1371 | + ".badge-{$type}" => array('b'), |
|
1372 | + ".alert-{$type}" => array('b', 'o'), |
|
1373 | + ".bg-{$type}" => array('b', 'f'), |
|
1374 | + ".btn-link.btn-{$type}" => array('c'), |
|
1375 | + ".text-{$type}" => array('c'), |
|
1376 | 1376 | ); |
1377 | 1377 | |
1378 | - if ( $aui_bs5 ) { |
|
1379 | - unset($selectors[".alert-{$type}" ]); |
|
1378 | + if ($aui_bs5) { |
|
1379 | + unset($selectors[".alert-{$type}"]); |
|
1380 | 1380 | } |
1381 | 1381 | |
1382 | - if ( $type == 'primary' ) { |
|
1382 | + if ($type == 'primary') { |
|
1383 | 1383 | $selectors = $selectors + array( |
1384 | - 'a' => array( 'c' ), |
|
1385 | - '.btn-link' => array( 'c' ), |
|
1386 | - '.dropdown-item.active' => array( 'b' ), |
|
1384 | + 'a' => array('c'), |
|
1385 | + '.btn-link' => array('c'), |
|
1386 | + '.dropdown-item.active' => array('b'), |
|
1387 | 1387 | '.custom-control-input:checked~.custom-control-label::before' => array( |
1388 | 1388 | 'b', |
1389 | 1389 | 'o' |
@@ -1392,56 +1392,56 @@ discard block |
||
1392 | 1392 | 'b', |
1393 | 1393 | 'o' |
1394 | 1394 | ), |
1395 | - '.nav-pills .nav-link.active' => array( 'b' ), |
|
1396 | - '.nav-pills .show>.nav-link' => array( 'b' ), |
|
1397 | - '.page-link' => array( 'c' ), |
|
1395 | + '.nav-pills .nav-link.active' => array('b'), |
|
1396 | + '.nav-pills .show>.nav-link' => array('b'), |
|
1397 | + '.page-link' => array('c'), |
|
1398 | 1398 | '.page-item.active .page-link' => array( |
1399 | 1399 | 'b', |
1400 | 1400 | 'o' |
1401 | 1401 | ), |
1402 | - '.progress-bar' => array( 'b' ), |
|
1402 | + '.progress-bar' => array('b'), |
|
1403 | 1403 | '.list-group-item.active' => array( |
1404 | 1404 | 'b', |
1405 | 1405 | 'o' |
1406 | 1406 | ), |
1407 | - '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ), |
|
1407 | + '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'), |
|
1408 | 1408 | ); |
1409 | 1409 | } |
1410 | 1410 | |
1411 | 1411 | |
1412 | 1412 | |
1413 | 1413 | // link |
1414 | - if ( $type === 'primary' ) { |
|
1415 | - $output .= 'html body {--bs-link-hover-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .75); --bs-link-color: var(--bs-'.esc_attr($type).'); }'; |
|
1416 | - $output .= $prefix . ' .breadcrumb{--bs-breadcrumb-item-active-color: '.esc_attr($color_code).'; }'; |
|
1417 | - $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).'; }'; |
|
1414 | + if ($type === 'primary') { |
|
1415 | + $output .= 'html body {--bs-link-hover-color: rgba(var(--bs-' . esc_attr($type) . '-rgb), .75); --bs-link-color: var(--bs-' . esc_attr($type) . '); }'; |
|
1416 | + $output .= $prefix . ' .breadcrumb{--bs-breadcrumb-item-active-color: ' . esc_attr($color_code) . '; }'; |
|
1417 | + $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) . '; }'; |
|
1418 | 1418 | |
1419 | - $output .= $prefix . ' a{color: var(--bs-'.esc_attr($type).');}'; |
|
1420 | - $output .= $prefix . ' .text-primary{color: var(--bs-'.esc_attr($type).') !important;}'; |
|
1419 | + $output .= $prefix . ' a{color: var(--bs-' . esc_attr($type) . ');}'; |
|
1420 | + $output .= $prefix . ' .text-primary{color: var(--bs-' . esc_attr($type) . ') !important;}'; |
|
1421 | 1421 | |
1422 | 1422 | // dropdown |
1423 | - $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 | + $output .= $prefix . ' .dropdown-menu{--bs-dropdown-link-hover-color: var(--bs-' . esc_attr($type) . '); --bs-dropdown-link-active-color: var(--bs-' . esc_attr($type) . ');}'; |
|
1424 | 1424 | |
1425 | 1425 | // pagination |
1426 | - $output .= $prefix . ' .pagination{--bs-pagination-hover-color: var(--bs-'.esc_attr($type).'); --bs-pagination-active-bg: var(--bs-'.esc_attr($type).');}'; |
|
1426 | + $output .= $prefix . ' .pagination{--bs-pagination-hover-color: var(--bs-' . esc_attr($type) . '); --bs-pagination-active-bg: var(--bs-' . esc_attr($type) . ');}'; |
|
1427 | 1427 | |
1428 | 1428 | } |
1429 | 1429 | |
1430 | - $output .= $prefix . ' .link-'.esc_attr($type).':hover {color: rgba(var(--bs-'.esc_attr($type).'-rgb), .8) !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,17 +1452,17 @@ 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-border-color: '.esc_attr($color_code).'; |
|
1458 | - --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1459 | - --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1460 | - --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type).'-rgb; |
|
1461 | - --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1462 | - --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9); |
|
1457 | + --bs-btn-border-color: '.esc_attr($color_code) . '; |
|
1458 | + --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1459 | + --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1460 | + --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type) . '-rgb; |
|
1461 | + --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1462 | + --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9); |
|
1463 | 1463 | --bs-btn-active-shadow: unset; |
1464 | - --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .5); |
|
1465 | - --bs-btn-disabled-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .1); |
|
1464 | + --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .5); |
|
1465 | + --bs-btn-disabled-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .1); |
|
1466 | 1466 | '; |
1467 | 1467 | // $output .= ' |
1468 | 1468 | // --bs-btn-color: #fff; |
@@ -1474,32 +1474,32 @@ discard block |
||
1474 | 1474 | |
1475 | 1475 | |
1476 | 1476 | // button hover |
1477 | - $output .= $prefix . ' .btn-'.esc_attr($type).':hover{'; |
|
1477 | + $output .= $prefix . ' .btn-' . esc_attr($type) . ':hover{'; |
|
1478 | 1478 | $output .= ' |
1479 | - 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); |
|
1479 | + 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 | 1480 | } |
1481 | 1481 | '; |
1482 | 1482 | |
1483 | 1483 | |
1484 | - if ( $aui_bs5 ) { |
|
1484 | + if ($aui_bs5) { |
|
1485 | 1485 | // $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).'; }'; |
1486 | - $output .= 'html body {--bs-'.esc_attr($type).': '.esc_attr($color_code).'; }'; |
|
1487 | - $output .= 'html body {--bs-'.esc_attr($type).'-rgb: '.$rgb.'; }'; |
|
1486 | + $output .= 'html body {--bs-' . esc_attr($type) . ': ' . esc_attr($color_code) . '; }'; |
|
1487 | + $output .= 'html body {--bs-' . esc_attr($type) . '-rgb: ' . $rgb . '; }'; |
|
1488 | 1488 | } |
1489 | 1489 | |
1490 | 1490 | |
1491 | - if ( $is_custom ) { |
|
1491 | + if ($is_custom) { |
|
1492 | 1492 | |
1493 | 1493 | // echo '###'.$type;exit; |
1494 | 1494 | |
1495 | 1495 | // build rules into each type |
1496 | - foreach($selectors as $selector => $types){ |
|
1497 | - $selector = $compatibility ? $compatibility . " ".$selector : $selector; |
|
1498 | - $types = array_combine($types,$types); |
|
1499 | - if(isset($types['c'])){$color[] = $selector;} |
|
1500 | - if(isset($types['b'])){$background[] = $selector;} |
|
1501 | - if(isset($types['o'])){$border[] = $selector;} |
|
1502 | - if(isset($types['f'])){$fill[] = $selector;} |
|
1496 | + foreach ($selectors as $selector => $types) { |
|
1497 | + $selector = $compatibility ? $compatibility . " " . $selector : $selector; |
|
1498 | + $types = array_combine($types, $types); |
|
1499 | + if (isset($types['c'])) {$color[] = $selector; } |
|
1500 | + if (isset($types['b'])) {$background[] = $selector; } |
|
1501 | + if (isset($types['o'])) {$border[] = $selector; } |
|
1502 | + if (isset($types['f'])) {$fill[] = $selector; } |
|
1503 | 1503 | } |
1504 | 1504 | |
1505 | 1505 | // // build rules into each type |
@@ -1513,36 +1513,36 @@ discard block |
||
1513 | 1513 | // } |
1514 | 1514 | |
1515 | 1515 | // add any color rules |
1516 | - if(!empty($color)){ |
|
1517 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
1516 | + if (!empty($color)) { |
|
1517 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
1518 | 1518 | } |
1519 | - if(!empty($color_i)){ |
|
1520 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
1519 | + if (!empty($color_i)) { |
|
1520 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
1521 | 1521 | } |
1522 | 1522 | |
1523 | 1523 | // add any background color rules |
1524 | - if(!empty($background)){ |
|
1525 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
1524 | + if (!empty($background)) { |
|
1525 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
1526 | 1526 | } |
1527 | - if(!empty($background_i)){ |
|
1528 | - $output .= $aui_bs5 ? '' : implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
1527 | + if (!empty($background_i)) { |
|
1528 | + $output .= $aui_bs5 ? '' : implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
1529 | 1529 | // $output .= implode(",",$background_i) . "{background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important;} "; |
1530 | 1530 | } |
1531 | 1531 | |
1532 | 1532 | // add any border color rules |
1533 | - if(!empty($border)){ |
|
1534 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
1533 | + if (!empty($border)) { |
|
1534 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
1535 | 1535 | } |
1536 | - if(!empty($border_i)){ |
|
1537 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
1536 | + if (!empty($border_i)) { |
|
1537 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
1538 | 1538 | } |
1539 | 1539 | |
1540 | 1540 | // add any fill color rules |
1541 | - if(!empty($fill)){ |
|
1542 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
1541 | + if (!empty($fill)) { |
|
1542 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
1543 | 1543 | } |
1544 | - if(!empty($fill_i)){ |
|
1545 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
1544 | + if (!empty($fill_i)) { |
|
1545 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
1546 | 1546 | } |
1547 | 1547 | |
1548 | 1548 | } |
@@ -1552,25 +1552,25 @@ discard block |
||
1552 | 1552 | |
1553 | 1553 | $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;' : ''; |
1554 | 1554 | // darken |
1555 | - $darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075"); |
|
1556 | - $darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10"); |
|
1557 | - $darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125"); |
|
1558 | - $darker_40 = $is_var ? $color_code.';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code,"-0.4"); |
|
1555 | + $darker_075 = $is_var ? $color_code . ';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code, "-0.075"); |
|
1556 | + $darker_10 = $is_var ? $color_code . ';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code, "-0.10"); |
|
1557 | + $darker_125 = $is_var ? $color_code . ';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code, "-0.125"); |
|
1558 | + $darker_40 = $is_var ? $color_code . ';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code, "-0.4"); |
|
1559 | 1559 | |
1560 | 1560 | // lighten |
1561 | - $lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25"); |
|
1561 | + $lighten_25 = $is_var ? $color_code . ';filter:brightness(1.25)' : self::css_hex_lighten_darken($color_code, "0.25"); |
|
1562 | 1562 | |
1563 | 1563 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
1564 | - $op_25 = $color_code."40"; // 25% opacity |
|
1564 | + $op_25 = $color_code . "40"; // 25% opacity |
|
1565 | 1565 | |
1566 | 1566 | |
1567 | 1567 | // button states |
1568 | - $output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : ''; |
|
1569 | - $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075."; border-color: ".$darker_10.";} "; |
|
1568 | + $output .= $is_var ? $prefix . " .btn-{$type}{{$transition }} " : ''; |
|
1569 | + $output .= $prefix . " .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: " . $darker_075 . "; border-color: " . $darker_10 . ";} "; |
|
1570 | 1570 | // $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000; border-color: #000;} "; |
1571 | - $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;} "; |
|
1572 | - $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.";} "; |
|
1573 | - $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;} "; |
|
1571 | + $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;} "; |
|
1572 | + $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 . ";} "; |
|
1573 | + $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;} "; |
|
1574 | 1574 | |
1575 | 1575 | // text |
1576 | 1576 | // $output .= $prefix .".xxx, .text-{$type} {color: var(--bs-".esc_attr($type).");} "; |
@@ -1588,9 +1588,9 @@ discard block |
||
1588 | 1588 | // } |
1589 | 1589 | |
1590 | 1590 | // alerts |
1591 | - if ( $aui_bs5 ) { |
|
1591 | + if ($aui_bs5) { |
|
1592 | 1592 | // $output .= $is_var ? '' : $prefix ." .alert-{$type} {background-color: ".$color_code."20; border-color: ".$color_code."30;color:$darker_40} "; |
1593 | - $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;} "; |
|
1593 | + $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;} "; |
|
1594 | 1594 | } |
1595 | 1595 | |
1596 | 1596 | return $output; |
@@ -1605,12 +1605,12 @@ discard block |
||
1605 | 1605 | * |
1606 | 1606 | * @return string |
1607 | 1607 | */ |
1608 | - public static function css_overwrite($type,$color_code,$compatibility, $hex = '' ){ |
|
1608 | + public static function css_overwrite($type, $color_code, $compatibility, $hex = '') { |
|
1609 | 1609 | global $aui_bs5; |
1610 | 1610 | |
1611 | 1611 | $is_var = false; |
1612 | - if(!$color_code){return '';} |
|
1613 | - if(strpos($color_code, 'var') !== false){ |
|
1612 | + if (!$color_code) {return ''; } |
|
1613 | + if (strpos($color_code, 'var') !== false) { |
|
1614 | 1614 | //if(!sanitize_hex_color($color_code)){ |
1615 | 1615 | $color_code = esc_attr($color_code); |
1616 | 1616 | $is_var = true; |
@@ -1620,15 +1620,15 @@ discard block |
||
1620 | 1620 | |
1621 | 1621 | // echo '@@@'.$color_code.'==='.self::hex_to_rgb($color_code);exit; |
1622 | 1622 | |
1623 | - if(!$color_code){return '';} |
|
1623 | + if (!$color_code) {return ''; } |
|
1624 | 1624 | |
1625 | 1625 | $rgb = self::hex_to_rgb($hex); |
1626 | 1626 | |
1627 | - if($compatibility===true || $compatibility===1){ |
|
1627 | + if ($compatibility === true || $compatibility === 1) { |
|
1628 | 1628 | $compatibility = '.bsui'; |
1629 | - }elseif(!$compatibility){ |
|
1629 | + }elseif (!$compatibility) { |
|
1630 | 1630 | $compatibility = ''; |
1631 | - }else{ |
|
1631 | + } else { |
|
1632 | 1632 | $compatibility = esc_attr($compatibility); |
1633 | 1633 | } |
1634 | 1634 | |
@@ -1642,29 +1642,29 @@ discard block |
||
1642 | 1642 | * c = color, b = background color, o = border-color, f = fill |
1643 | 1643 | */ |
1644 | 1644 | $selectors = array( |
1645 | - ".btn-{$type}" => array( 'b', 'o' ), |
|
1646 | - ".btn-{$type}.disabled" => array( 'b', 'o' ), |
|
1647 | - ".btn-{$type}:disabled" => array( 'b', 'o' ), |
|
1648 | - ".btn-outline-{$type}" => array( 'c', 'o' ), |
|
1649 | - ".btn-outline-{$type}:hover" => array( 'b', 'o' ), |
|
1650 | - ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ), |
|
1651 | - ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ), |
|
1652 | - ".show>.btn-outline-{$type}.dropdown-toggle" => array( 'b', 'o' ), |
|
1653 | - ".badge-{$type}" => array( 'b' ), |
|
1654 | - ".alert-{$type}" => array( 'b', 'o' ), |
|
1655 | - ".bg-{$type}" => array( 'b', 'f' ), |
|
1656 | - ".btn-link.btn-{$type}" => array( 'c' ), |
|
1645 | + ".btn-{$type}" => array('b', 'o'), |
|
1646 | + ".btn-{$type}.disabled" => array('b', 'o'), |
|
1647 | + ".btn-{$type}:disabled" => array('b', 'o'), |
|
1648 | + ".btn-outline-{$type}" => array('c', 'o'), |
|
1649 | + ".btn-outline-{$type}:hover" => array('b', 'o'), |
|
1650 | + ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array('b', 'o'), |
|
1651 | + ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array('b', 'o'), |
|
1652 | + ".show>.btn-outline-{$type}.dropdown-toggle" => array('b', 'o'), |
|
1653 | + ".badge-{$type}" => array('b'), |
|
1654 | + ".alert-{$type}" => array('b', 'o'), |
|
1655 | + ".bg-{$type}" => array('b', 'f'), |
|
1656 | + ".btn-link.btn-{$type}" => array('c'), |
|
1657 | 1657 | ); |
1658 | 1658 | |
1659 | - if ( $aui_bs5 ) { |
|
1660 | - unset($selectors[".alert-{$type}" ]); |
|
1659 | + if ($aui_bs5) { |
|
1660 | + unset($selectors[".alert-{$type}"]); |
|
1661 | 1661 | } |
1662 | 1662 | |
1663 | - if ( $type == 'primary' ) { |
|
1663 | + if ($type == 'primary') { |
|
1664 | 1664 | $selectors = $selectors + array( |
1665 | - 'a' => array( 'c' ), |
|
1666 | - '.btn-link' => array( 'c' ), |
|
1667 | - '.dropdown-item.active' => array( 'b' ), |
|
1665 | + 'a' => array('c'), |
|
1666 | + '.btn-link' => array('c'), |
|
1667 | + '.dropdown-item.active' => array('b'), |
|
1668 | 1668 | '.custom-control-input:checked~.custom-control-label::before' => array( |
1669 | 1669 | 'b', |
1670 | 1670 | 'o' |
@@ -1673,19 +1673,19 @@ discard block |
||
1673 | 1673 | 'b', |
1674 | 1674 | 'o' |
1675 | 1675 | ), |
1676 | - '.nav-pills .nav-link.active' => array( 'b' ), |
|
1677 | - '.nav-pills .show>.nav-link' => array( 'b' ), |
|
1678 | - '.page-link' => array( 'c' ), |
|
1676 | + '.nav-pills .nav-link.active' => array('b'), |
|
1677 | + '.nav-pills .show>.nav-link' => array('b'), |
|
1678 | + '.page-link' => array('c'), |
|
1679 | 1679 | '.page-item.active .page-link' => array( |
1680 | 1680 | 'b', |
1681 | 1681 | 'o' |
1682 | 1682 | ), |
1683 | - '.progress-bar' => array( 'b' ), |
|
1683 | + '.progress-bar' => array('b'), |
|
1684 | 1684 | '.list-group-item.active' => array( |
1685 | 1685 | 'b', |
1686 | 1686 | 'o' |
1687 | 1687 | ), |
1688 | - '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ), |
|
1688 | + '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'), |
|
1689 | 1689 | // '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules... |
1690 | 1690 | // '.custom-range::-moz-range-thumb' => array('b'), |
1691 | 1691 | // '.custom-range::-ms-thumb' => array('b'), |
@@ -1693,7 +1693,7 @@ discard block |
||
1693 | 1693 | } |
1694 | 1694 | |
1695 | 1695 | $important_selectors = array( |
1696 | - ".bg-{$type}" => array('b','f'), |
|
1696 | + ".bg-{$type}" => array('b', 'f'), |
|
1697 | 1697 | ".border-{$type}" => array('o'), |
1698 | 1698 | ".text-{$type}" => array('c'), |
1699 | 1699 | ); |
@@ -1709,62 +1709,62 @@ discard block |
||
1709 | 1709 | |
1710 | 1710 | $output = ''; |
1711 | 1711 | |
1712 | - if ( $aui_bs5 ) { |
|
1712 | + if ($aui_bs5) { |
|
1713 | 1713 | // $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).'; }'; |
1714 | - $output .= 'html body {--bs-'.esc_attr($type).'-rgb: '.$rgb.'; }'; |
|
1714 | + $output .= 'html body {--bs-' . esc_attr($type) . '-rgb: ' . $rgb . '; }'; |
|
1715 | 1715 | } |
1716 | 1716 | |
1717 | 1717 | // build rules into each type |
1718 | - foreach($selectors as $selector => $types){ |
|
1719 | - $selector = $compatibility ? $compatibility . " ".$selector : $selector; |
|
1720 | - $types = array_combine($types,$types); |
|
1721 | - if(isset($types['c'])){$color[] = $selector;} |
|
1722 | - if(isset($types['b'])){$background[] = $selector;} |
|
1723 | - if(isset($types['o'])){$border[] = $selector;} |
|
1724 | - if(isset($types['f'])){$fill[] = $selector;} |
|
1718 | + foreach ($selectors as $selector => $types) { |
|
1719 | + $selector = $compatibility ? $compatibility . " " . $selector : $selector; |
|
1720 | + $types = array_combine($types, $types); |
|
1721 | + if (isset($types['c'])) {$color[] = $selector; } |
|
1722 | + if (isset($types['b'])) {$background[] = $selector; } |
|
1723 | + if (isset($types['o'])) {$border[] = $selector; } |
|
1724 | + if (isset($types['f'])) {$fill[] = $selector; } |
|
1725 | 1725 | } |
1726 | 1726 | |
1727 | 1727 | // build rules into each type |
1728 | - foreach($important_selectors as $selector => $types){ |
|
1729 | - $selector = $compatibility ? $compatibility . " ".$selector : $selector; |
|
1730 | - $types = array_combine($types,$types); |
|
1731 | - if(isset($types['c'])){$color_i[] = $selector;} |
|
1732 | - if(isset($types['b'])){$background_i[] = $selector;} |
|
1733 | - if(isset($types['o'])){$border_i[] = $selector;} |
|
1734 | - if(isset($types['f'])){$fill_i[] = $selector;} |
|
1728 | + foreach ($important_selectors as $selector => $types) { |
|
1729 | + $selector = $compatibility ? $compatibility . " " . $selector : $selector; |
|
1730 | + $types = array_combine($types, $types); |
|
1731 | + if (isset($types['c'])) {$color_i[] = $selector; } |
|
1732 | + if (isset($types['b'])) {$background_i[] = $selector; } |
|
1733 | + if (isset($types['o'])) {$border_i[] = $selector; } |
|
1734 | + if (isset($types['f'])) {$fill_i[] = $selector; } |
|
1735 | 1735 | } |
1736 | 1736 | |
1737 | 1737 | // add any color rules |
1738 | - if(!empty($color)){ |
|
1739 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
1738 | + if (!empty($color)) { |
|
1739 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
1740 | 1740 | } |
1741 | - if(!empty($color_i)){ |
|
1742 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
1741 | + if (!empty($color_i)) { |
|
1742 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
1743 | 1743 | } |
1744 | 1744 | |
1745 | 1745 | // add any background color rules |
1746 | - if(!empty($background)){ |
|
1747 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
1746 | + if (!empty($background)) { |
|
1747 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
1748 | 1748 | } |
1749 | - if(!empty($background_i)){ |
|
1750 | - $output .= $aui_bs5 ? '' : implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
1749 | + if (!empty($background_i)) { |
|
1750 | + $output .= $aui_bs5 ? '' : implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
1751 | 1751 | // $output .= implode(",",$background_i) . "{background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important;} "; |
1752 | 1752 | } |
1753 | 1753 | |
1754 | 1754 | // add any border color rules |
1755 | - if(!empty($border)){ |
|
1756 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
1755 | + if (!empty($border)) { |
|
1756 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
1757 | 1757 | } |
1758 | - if(!empty($border_i)){ |
|
1759 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
1758 | + if (!empty($border_i)) { |
|
1759 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
1760 | 1760 | } |
1761 | 1761 | |
1762 | 1762 | // add any fill color rules |
1763 | - if(!empty($fill)){ |
|
1764 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
1763 | + if (!empty($fill)) { |
|
1764 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
1765 | 1765 | } |
1766 | - if(!empty($fill_i)){ |
|
1767 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
1766 | + if (!empty($fill_i)) { |
|
1767 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
1768 | 1768 | } |
1769 | 1769 | |
1770 | 1770 | |
@@ -1772,27 +1772,27 @@ discard block |
||
1772 | 1772 | |
1773 | 1773 | $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;' : ''; |
1774 | 1774 | // darken |
1775 | - $darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075"); |
|
1776 | - $darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10"); |
|
1777 | - $darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125"); |
|
1778 | - $darker_40 = $is_var ? $color_code.';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code,"-0.4"); |
|
1775 | + $darker_075 = $is_var ? $color_code . ';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code, "-0.075"); |
|
1776 | + $darker_10 = $is_var ? $color_code . ';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code, "-0.10"); |
|
1777 | + $darker_125 = $is_var ? $color_code . ';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code, "-0.125"); |
|
1778 | + $darker_40 = $is_var ? $color_code . ';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code, "-0.4"); |
|
1779 | 1779 | |
1780 | 1780 | // lighten |
1781 | - $lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25"); |
|
1781 | + $lighten_25 = $is_var ? $color_code . ';filter:brightness(1.25)' : self::css_hex_lighten_darken($color_code, "0.25"); |
|
1782 | 1782 | |
1783 | 1783 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
1784 | - $op_25 = $color_code."40"; // 25% opacity |
|
1784 | + $op_25 = $color_code . "40"; // 25% opacity |
|
1785 | 1785 | |
1786 | 1786 | |
1787 | 1787 | // button states |
1788 | - $output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : ''; |
|
1789 | - $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075."; border-color: ".$darker_10.";} "; |
|
1788 | + $output .= $is_var ? $prefix . " .btn-{$type}{{$transition }} " : ''; |
|
1789 | + $output .= $prefix . " .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: " . $darker_075 . "; border-color: " . $darker_10 . ";} "; |
|
1790 | 1790 | // $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000; border-color: #000;} "; |
1791 | - $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;} "; |
|
1792 | - $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.";} "; |
|
1793 | - $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;} "; |
|
1791 | + $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;} "; |
|
1792 | + $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 . ";} "; |
|
1793 | + $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;} "; |
|
1794 | 1794 | |
1795 | - if ( $type == 'primary' ) { |
|
1795 | + if ($type == 'primary') { |
|
1796 | 1796 | // dropdown's |
1797 | 1797 | $output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} "; |
1798 | 1798 | |
@@ -1804,9 +1804,9 @@ discard block |
||
1804 | 1804 | } |
1805 | 1805 | |
1806 | 1806 | // alerts |
1807 | - if ( $aui_bs5 ) { |
|
1807 | + if ($aui_bs5) { |
|
1808 | 1808 | // $output .= $is_var ? '' : $prefix ." .alert-{$type} {background-color: ".$color_code."20; border-color: ".$color_code."30;color:$darker_40} "; |
1809 | - $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;} "; |
|
1809 | + $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;} "; |
|
1810 | 1810 | } |
1811 | 1811 | |
1812 | 1812 | return $output; |
@@ -1822,11 +1822,11 @@ discard block |
||
1822 | 1822 | * |
1823 | 1823 | * @return string |
1824 | 1824 | */ |
1825 | - public static function css_primary($color_code,$compatibility, $use_variable = false){ |
|
1825 | + public static function css_primary($color_code, $compatibility, $use_variable = false) { |
|
1826 | 1826 | |
1827 | - if(!$use_variable){ |
|
1827 | + if (!$use_variable) { |
|
1828 | 1828 | $color_code = sanitize_hex_color($color_code); |
1829 | - if(!$color_code){return '';} |
|
1829 | + if (!$color_code) {return ''; } |
|
1830 | 1830 | } |
1831 | 1831 | |
1832 | 1832 | /** |
@@ -1834,36 +1834,36 @@ discard block |
||
1834 | 1834 | */ |
1835 | 1835 | $selectors = array( |
1836 | 1836 | 'a' => array('c'), |
1837 | - '.btn-primary' => array('b','o'), |
|
1838 | - '.btn-primary.disabled' => array('b','o'), |
|
1839 | - '.btn-primary:disabled' => array('b','o'), |
|
1840 | - '.btn-outline-primary' => array('c','o'), |
|
1841 | - '.btn-outline-primary:hover' => array('b','o'), |
|
1842 | - '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'), |
|
1843 | - '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'), |
|
1844 | - '.show>.btn-outline-primary.dropdown-toggle' => array('b','o'), |
|
1837 | + '.btn-primary' => array('b', 'o'), |
|
1838 | + '.btn-primary.disabled' => array('b', 'o'), |
|
1839 | + '.btn-primary:disabled' => array('b', 'o'), |
|
1840 | + '.btn-outline-primary' => array('c', 'o'), |
|
1841 | + '.btn-outline-primary:hover' => array('b', 'o'), |
|
1842 | + '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b', 'o'), |
|
1843 | + '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b', 'o'), |
|
1844 | + '.show>.btn-outline-primary.dropdown-toggle' => array('b', 'o'), |
|
1845 | 1845 | '.btn-link' => array('c'), |
1846 | 1846 | '.dropdown-item.active' => array('b'), |
1847 | - '.custom-control-input:checked~.custom-control-label::before' => array('b','o'), |
|
1848 | - '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'), |
|
1847 | + '.custom-control-input:checked~.custom-control-label::before' => array('b', 'o'), |
|
1848 | + '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b', 'o'), |
|
1849 | 1849 | // '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules... |
1850 | 1850 | // '.custom-range::-moz-range-thumb' => array('b'), |
1851 | 1851 | // '.custom-range::-ms-thumb' => array('b'), |
1852 | 1852 | '.nav-pills .nav-link.active' => array('b'), |
1853 | 1853 | '.nav-pills .show>.nav-link' => array('b'), |
1854 | 1854 | '.page-link' => array('c'), |
1855 | - '.page-item.active .page-link' => array('b','o'), |
|
1855 | + '.page-item.active .page-link' => array('b', 'o'), |
|
1856 | 1856 | '.badge-primary' => array('b'), |
1857 | - '.alert-primary' => array('b','o'), |
|
1857 | + '.alert-primary' => array('b', 'o'), |
|
1858 | 1858 | '.progress-bar' => array('b'), |
1859 | - '.list-group-item.active' => array('b','o'), |
|
1860 | - '.bg-primary' => array('b','f'), |
|
1859 | + '.list-group-item.active' => array('b', 'o'), |
|
1860 | + '.bg-primary' => array('b', 'f'), |
|
1861 | 1861 | '.btn-link.btn-primary' => array('c'), |
1862 | 1862 | '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'), |
1863 | 1863 | ); |
1864 | 1864 | |
1865 | 1865 | $important_selectors = array( |
1866 | - '.bg-primary' => array('b','f'), |
|
1866 | + '.bg-primary' => array('b', 'f'), |
|
1867 | 1867 | '.border-primary' => array('o'), |
1868 | 1868 | '.text-primary' => array('c'), |
1869 | 1869 | ); |
@@ -1880,88 +1880,88 @@ discard block |
||
1880 | 1880 | $output = ''; |
1881 | 1881 | |
1882 | 1882 | // build rules into each type |
1883 | - foreach($selectors as $selector => $types){ |
|
1884 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
1885 | - $types = array_combine($types,$types); |
|
1886 | - if(isset($types['c'])){$color[] = $selector;} |
|
1887 | - if(isset($types['b'])){$background[] = $selector;} |
|
1888 | - if(isset($types['o'])){$border[] = $selector;} |
|
1889 | - if(isset($types['f'])){$fill[] = $selector;} |
|
1883 | + foreach ($selectors as $selector => $types) { |
|
1884 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
1885 | + $types = array_combine($types, $types); |
|
1886 | + if (isset($types['c'])) {$color[] = $selector; } |
|
1887 | + if (isset($types['b'])) {$background[] = $selector; } |
|
1888 | + if (isset($types['o'])) {$border[] = $selector; } |
|
1889 | + if (isset($types['f'])) {$fill[] = $selector; } |
|
1890 | 1890 | } |
1891 | 1891 | |
1892 | 1892 | // build rules into each type |
1893 | - foreach($important_selectors as $selector => $types){ |
|
1894 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
1895 | - $types = array_combine($types,$types); |
|
1896 | - if(isset($types['c'])){$color_i[] = $selector;} |
|
1897 | - if(isset($types['b'])){$background_i[] = $selector;} |
|
1898 | - if(isset($types['o'])){$border_i[] = $selector;} |
|
1899 | - if(isset($types['f'])){$fill_i[] = $selector;} |
|
1893 | + foreach ($important_selectors as $selector => $types) { |
|
1894 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
1895 | + $types = array_combine($types, $types); |
|
1896 | + if (isset($types['c'])) {$color_i[] = $selector; } |
|
1897 | + if (isset($types['b'])) {$background_i[] = $selector; } |
|
1898 | + if (isset($types['o'])) {$border_i[] = $selector; } |
|
1899 | + if (isset($types['f'])) {$fill_i[] = $selector; } |
|
1900 | 1900 | } |
1901 | 1901 | |
1902 | 1902 | // add any color rules |
1903 | - if(!empty($color)){ |
|
1904 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
1903 | + if (!empty($color)) { |
|
1904 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
1905 | 1905 | } |
1906 | - if(!empty($color_i)){ |
|
1907 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
1906 | + if (!empty($color_i)) { |
|
1907 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
1908 | 1908 | } |
1909 | 1909 | |
1910 | 1910 | // add any background color rules |
1911 | - if(!empty($background)){ |
|
1912 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
1911 | + if (!empty($background)) { |
|
1912 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
1913 | 1913 | } |
1914 | - if(!empty($background_i)){ |
|
1915 | - $output .= implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
1914 | + if (!empty($background_i)) { |
|
1915 | + $output .= implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
1916 | 1916 | } |
1917 | 1917 | |
1918 | 1918 | // add any border color rules |
1919 | - if(!empty($border)){ |
|
1920 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
1919 | + if (!empty($border)) { |
|
1920 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
1921 | 1921 | } |
1922 | - if(!empty($border_i)){ |
|
1923 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
1922 | + if (!empty($border_i)) { |
|
1923 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
1924 | 1924 | } |
1925 | 1925 | |
1926 | 1926 | // add any fill color rules |
1927 | - if(!empty($fill)){ |
|
1928 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
1927 | + if (!empty($fill)) { |
|
1928 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
1929 | 1929 | } |
1930 | - if(!empty($fill_i)){ |
|
1931 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
1930 | + if (!empty($fill_i)) { |
|
1931 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
1932 | 1932 | } |
1933 | 1933 | |
1934 | 1934 | |
1935 | 1935 | $prefix = $compatibility ? ".bsui " : ""; |
1936 | 1936 | |
1937 | 1937 | // darken |
1938 | - $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075"); |
|
1939 | - $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10"); |
|
1940 | - $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125"); |
|
1938 | + $darker_075 = self::css_hex_lighten_darken($color_code, "-0.075"); |
|
1939 | + $darker_10 = self::css_hex_lighten_darken($color_code, "-0.10"); |
|
1940 | + $darker_125 = self::css_hex_lighten_darken($color_code, "-0.125"); |
|
1941 | 1941 | |
1942 | 1942 | // lighten |
1943 | - $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25"); |
|
1943 | + $lighten_25 = self::css_hex_lighten_darken($color_code, "0.25"); |
|
1944 | 1944 | |
1945 | 1945 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
1946 | - $op_25 = $color_code."40"; // 25% opacity |
|
1946 | + $op_25 = $color_code . "40"; // 25% opacity |
|
1947 | 1947 | |
1948 | 1948 | |
1949 | 1949 | // button states |
1950 | - $output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075."; border-color: ".$darker_10.";} "; |
|
1951 | - $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;} "; |
|
1952 | - $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.";} "; |
|
1953 | - $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;} "; |
|
1950 | + $output .= $prefix . " .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: " . $darker_075 . "; border-color: " . $darker_10 . ";} "; |
|
1951 | + $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;} "; |
|
1952 | + $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 . ";} "; |
|
1953 | + $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;} "; |
|
1954 | 1954 | |
1955 | 1955 | |
1956 | 1956 | // dropdown's |
1957 | - $output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} "; |
|
1957 | + $output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} "; |
|
1958 | 1958 | |
1959 | 1959 | |
1960 | 1960 | // input states |
1961 | - $output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
1961 | + $output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
1962 | 1962 | |
1963 | 1963 | // page link |
1964 | - $output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
1964 | + $output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
1965 | 1965 | |
1966 | 1966 | return $output; |
1967 | 1967 | } |
@@ -1975,30 +1975,30 @@ discard block |
||
1975 | 1975 | * |
1976 | 1976 | * @return string |
1977 | 1977 | */ |
1978 | - public static function css_secondary($color_code,$compatibility){; |
|
1978 | + public static function css_secondary($color_code, $compatibility) {; |
|
1979 | 1979 | $color_code = sanitize_hex_color($color_code); |
1980 | - if(!$color_code){return '';} |
|
1980 | + if (!$color_code) {return ''; } |
|
1981 | 1981 | /** |
1982 | 1982 | * c = color, b = background color, o = border-color, f = fill |
1983 | 1983 | */ |
1984 | 1984 | $selectors = array( |
1985 | - '.btn-secondary' => array('b','o'), |
|
1986 | - '.btn-secondary.disabled' => array('b','o'), |
|
1987 | - '.btn-secondary:disabled' => array('b','o'), |
|
1988 | - '.btn-outline-secondary' => array('c','o'), |
|
1989 | - '.btn-outline-secondary:hover' => array('b','o'), |
|
1985 | + '.btn-secondary' => array('b', 'o'), |
|
1986 | + '.btn-secondary.disabled' => array('b', 'o'), |
|
1987 | + '.btn-secondary:disabled' => array('b', 'o'), |
|
1988 | + '.btn-outline-secondary' => array('c', 'o'), |
|
1989 | + '.btn-outline-secondary:hover' => array('b', 'o'), |
|
1990 | 1990 | '.btn-outline-secondary.disabled' => array('c'), |
1991 | 1991 | '.btn-outline-secondary:disabled' => array('c'), |
1992 | - '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'), |
|
1993 | - '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'), |
|
1994 | - '.btn-outline-secondary.dropdown-toggle' => array('b','o'), |
|
1992 | + '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b', 'o'), |
|
1993 | + '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b', 'o'), |
|
1994 | + '.btn-outline-secondary.dropdown-toggle' => array('b', 'o'), |
|
1995 | 1995 | '.badge-secondary' => array('b'), |
1996 | - '.alert-secondary' => array('b','o'), |
|
1996 | + '.alert-secondary' => array('b', 'o'), |
|
1997 | 1997 | '.btn-link.btn-secondary' => array('c'), |
1998 | 1998 | ); |
1999 | 1999 | |
2000 | 2000 | $important_selectors = array( |
2001 | - '.bg-secondary' => array('b','f'), |
|
2001 | + '.bg-secondary' => array('b', 'f'), |
|
2002 | 2002 | '.border-secondary' => array('o'), |
2003 | 2003 | '.text-secondary' => array('c'), |
2004 | 2004 | ); |
@@ -2015,77 +2015,77 @@ discard block |
||
2015 | 2015 | $output = ''; |
2016 | 2016 | |
2017 | 2017 | // build rules into each type |
2018 | - foreach($selectors as $selector => $types){ |
|
2019 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
2020 | - $types = array_combine($types,$types); |
|
2021 | - if(isset($types['c'])){$color[] = $selector;} |
|
2022 | - if(isset($types['b'])){$background[] = $selector;} |
|
2023 | - if(isset($types['o'])){$border[] = $selector;} |
|
2024 | - if(isset($types['f'])){$fill[] = $selector;} |
|
2018 | + foreach ($selectors as $selector => $types) { |
|
2019 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
2020 | + $types = array_combine($types, $types); |
|
2021 | + if (isset($types['c'])) {$color[] = $selector; } |
|
2022 | + if (isset($types['b'])) {$background[] = $selector; } |
|
2023 | + if (isset($types['o'])) {$border[] = $selector; } |
|
2024 | + if (isset($types['f'])) {$fill[] = $selector; } |
|
2025 | 2025 | } |
2026 | 2026 | |
2027 | 2027 | // build rules into each type |
2028 | - foreach($important_selectors as $selector => $types){ |
|
2029 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
2030 | - $types = array_combine($types,$types); |
|
2031 | - if(isset($types['c'])){$color_i[] = $selector;} |
|
2032 | - if(isset($types['b'])){$background_i[] = $selector;} |
|
2033 | - if(isset($types['o'])){$border_i[] = $selector;} |
|
2034 | - if(isset($types['f'])){$fill_i[] = $selector;} |
|
2028 | + foreach ($important_selectors as $selector => $types) { |
|
2029 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
2030 | + $types = array_combine($types, $types); |
|
2031 | + if (isset($types['c'])) {$color_i[] = $selector; } |
|
2032 | + if (isset($types['b'])) {$background_i[] = $selector; } |
|
2033 | + if (isset($types['o'])) {$border_i[] = $selector; } |
|
2034 | + if (isset($types['f'])) {$fill_i[] = $selector; } |
|
2035 | 2035 | } |
2036 | 2036 | |
2037 | 2037 | // add any color rules |
2038 | - if(!empty($color)){ |
|
2039 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
2038 | + if (!empty($color)) { |
|
2039 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
2040 | 2040 | } |
2041 | - if(!empty($color_i)){ |
|
2042 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
2041 | + if (!empty($color_i)) { |
|
2042 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
2043 | 2043 | } |
2044 | 2044 | |
2045 | 2045 | // add any background color rules |
2046 | - if(!empty($background)){ |
|
2047 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
2046 | + if (!empty($background)) { |
|
2047 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
2048 | 2048 | } |
2049 | - if(!empty($background_i)){ |
|
2050 | - $output .= implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
2049 | + if (!empty($background_i)) { |
|
2050 | + $output .= implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
2051 | 2051 | } |
2052 | 2052 | |
2053 | 2053 | // add any border color rules |
2054 | - if(!empty($border)){ |
|
2055 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
2054 | + if (!empty($border)) { |
|
2055 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
2056 | 2056 | } |
2057 | - if(!empty($border_i)){ |
|
2058 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
2057 | + if (!empty($border_i)) { |
|
2058 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
2059 | 2059 | } |
2060 | 2060 | |
2061 | 2061 | // add any fill color rules |
2062 | - if(!empty($fill)){ |
|
2063 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
2062 | + if (!empty($fill)) { |
|
2063 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
2064 | 2064 | } |
2065 | - if(!empty($fill_i)){ |
|
2066 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
2065 | + if (!empty($fill_i)) { |
|
2066 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
2067 | 2067 | } |
2068 | 2068 | |
2069 | 2069 | |
2070 | 2070 | $prefix = $compatibility ? ".bsui " : ""; |
2071 | 2071 | |
2072 | 2072 | // darken |
2073 | - $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075"); |
|
2074 | - $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10"); |
|
2075 | - $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125"); |
|
2073 | + $darker_075 = self::css_hex_lighten_darken($color_code, "-0.075"); |
|
2074 | + $darker_10 = self::css_hex_lighten_darken($color_code, "-0.10"); |
|
2075 | + $darker_125 = self::css_hex_lighten_darken($color_code, "-0.125"); |
|
2076 | 2076 | |
2077 | 2077 | // lighten |
2078 | - $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25"); |
|
2078 | + $lighten_25 = self::css_hex_lighten_darken($color_code, "0.25"); |
|
2079 | 2079 | |
2080 | 2080 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
2081 | - $op_25 = $color_code."40"; // 25% opacity |
|
2081 | + $op_25 = $color_code . "40"; // 25% opacity |
|
2082 | 2082 | |
2083 | 2083 | |
2084 | 2084 | // button states |
2085 | - $output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075."; border-color: ".$darker_10.";} "; |
|
2086 | - $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;} "; |
|
2087 | - $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.";} "; |
|
2088 | - $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;} "; |
|
2085 | + $output .= $prefix . " .btn-secondary:hover{background-color: " . $darker_075 . "; border-color: " . $darker_10 . ";} "; |
|
2086 | + $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;} "; |
|
2087 | + $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 . ";} "; |
|
2088 | + $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;} "; |
|
2089 | 2089 | |
2090 | 2090 | |
2091 | 2091 | return $output; |
@@ -2121,8 +2121,8 @@ discard block |
||
2121 | 2121 | /** |
2122 | 2122 | * Check if we should display examples. |
2123 | 2123 | */ |
2124 | - public function maybe_show_examples(){ |
|
2125 | - if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){ |
|
2124 | + public function maybe_show_examples() { |
|
2125 | + if (current_user_can('manage_options') && isset($_REQUEST['preview-aui'])) { |
|
2126 | 2126 | echo "<head>"; |
2127 | 2127 | wp_head(); |
2128 | 2128 | echo "</head>"; |
@@ -2138,7 +2138,7 @@ discard block |
||
2138 | 2138 | * |
2139 | 2139 | * @return string |
2140 | 2140 | */ |
2141 | - public function get_examples(){ |
|
2141 | + public function get_examples() { |
|
2142 | 2142 | $output = ''; |
2143 | 2143 | |
2144 | 2144 | |
@@ -2244,74 +2244,74 @@ discard block |
||
2244 | 2244 | */ |
2245 | 2245 | public static function calendar_params() { |
2246 | 2246 | $params = array( |
2247 | - 'month_long_1' => __( 'January', 'ayecode-connect' ), |
|
2248 | - 'month_long_2' => __( 'February', 'ayecode-connect' ), |
|
2249 | - 'month_long_3' => __( 'March', 'ayecode-connect' ), |
|
2250 | - 'month_long_4' => __( 'April', 'ayecode-connect' ), |
|
2251 | - 'month_long_5' => __( 'May', 'ayecode-connect' ), |
|
2252 | - 'month_long_6' => __( 'June', 'ayecode-connect' ), |
|
2253 | - 'month_long_7' => __( 'July', 'ayecode-connect' ), |
|
2254 | - 'month_long_8' => __( 'August', 'ayecode-connect' ), |
|
2255 | - 'month_long_9' => __( 'September', 'ayecode-connect' ), |
|
2256 | - 'month_long_10' => __( 'October', 'ayecode-connect' ), |
|
2257 | - 'month_long_11' => __( 'November', 'ayecode-connect' ), |
|
2258 | - 'month_long_12' => __( 'December', 'ayecode-connect' ), |
|
2259 | - 'month_s_1' => _x( 'Jan', 'January abbreviation', 'ayecode-connect' ), |
|
2260 | - 'month_s_2' => _x( 'Feb', 'February abbreviation', 'ayecode-connect' ), |
|
2261 | - 'month_s_3' => _x( 'Mar', 'March abbreviation', 'ayecode-connect' ), |
|
2262 | - 'month_s_4' => _x( 'Apr', 'April abbreviation', 'ayecode-connect' ), |
|
2263 | - 'month_s_5' => _x( 'May', 'May abbreviation', 'ayecode-connect' ), |
|
2264 | - 'month_s_6' => _x( 'Jun', 'June abbreviation', 'ayecode-connect' ), |
|
2265 | - 'month_s_7' => _x( 'Jul', 'July abbreviation', 'ayecode-connect' ), |
|
2266 | - 'month_s_8' => _x( 'Aug', 'August abbreviation', 'ayecode-connect' ), |
|
2267 | - 'month_s_9' => _x( 'Sep', 'September abbreviation', 'ayecode-connect' ), |
|
2268 | - 'month_s_10' => _x( 'Oct', 'October abbreviation', 'ayecode-connect' ), |
|
2269 | - 'month_s_11' => _x( 'Nov', 'November abbreviation', 'ayecode-connect' ), |
|
2270 | - 'month_s_12' => _x( 'Dec', 'December abbreviation', 'ayecode-connect' ), |
|
2271 | - 'day_s1_1' => _x( 'S', 'Sunday initial', 'ayecode-connect' ), |
|
2272 | - 'day_s1_2' => _x( 'M', 'Monday initial', 'ayecode-connect' ), |
|
2273 | - 'day_s1_3' => _x( 'T', 'Tuesday initial', 'ayecode-connect' ), |
|
2274 | - 'day_s1_4' => _x( 'W', 'Wednesday initial', 'ayecode-connect' ), |
|
2275 | - 'day_s1_5' => _x( 'T', 'Friday initial', 'ayecode-connect' ), |
|
2276 | - 'day_s1_6' => _x( 'F', 'Thursday initial', 'ayecode-connect' ), |
|
2277 | - 'day_s1_7' => _x( 'S', 'Saturday initial', 'ayecode-connect' ), |
|
2278 | - 'day_s2_1' => __( 'Su', 'ayecode-connect' ), |
|
2279 | - 'day_s2_2' => __( 'Mo', 'ayecode-connect' ), |
|
2280 | - 'day_s2_3' => __( 'Tu', 'ayecode-connect' ), |
|
2281 | - 'day_s2_4' => __( 'We', 'ayecode-connect' ), |
|
2282 | - 'day_s2_5' => __( 'Th', 'ayecode-connect' ), |
|
2283 | - 'day_s2_6' => __( 'Fr', 'ayecode-connect' ), |
|
2284 | - 'day_s2_7' => __( 'Sa', 'ayecode-connect' ), |
|
2285 | - 'day_s3_1' => __( 'Sun', 'ayecode-connect' ), |
|
2286 | - 'day_s3_2' => __( 'Mon', 'ayecode-connect' ), |
|
2287 | - 'day_s3_3' => __( 'Tue', 'ayecode-connect' ), |
|
2288 | - 'day_s3_4' => __( 'Wed', 'ayecode-connect' ), |
|
2289 | - 'day_s3_5' => __( 'Thu', 'ayecode-connect' ), |
|
2290 | - 'day_s3_6' => __( 'Fri', 'ayecode-connect' ), |
|
2291 | - 'day_s3_7' => __( 'Sat', 'ayecode-connect' ), |
|
2292 | - 'day_s5_1' => __( 'Sunday', 'ayecode-connect' ), |
|
2293 | - 'day_s5_2' => __( 'Monday', 'ayecode-connect' ), |
|
2294 | - 'day_s5_3' => __( 'Tuesday', 'ayecode-connect' ), |
|
2295 | - 'day_s5_4' => __( 'Wednesday', 'ayecode-connect' ), |
|
2296 | - 'day_s5_5' => __( 'Thursday', 'ayecode-connect' ), |
|
2297 | - 'day_s5_6' => __( 'Friday', 'ayecode-connect' ), |
|
2298 | - 'day_s5_7' => __( 'Saturday', 'ayecode-connect' ), |
|
2299 | - 'am_lower' => __( 'am', 'ayecode-connect' ), |
|
2300 | - 'pm_lower' => __( 'pm', 'ayecode-connect' ), |
|
2301 | - 'am_upper' => __( 'AM', 'ayecode-connect' ), |
|
2302 | - 'pm_upper' => __( 'PM', 'ayecode-connect' ), |
|
2303 | - 'firstDayOfWeek' => (int) get_option( 'start_of_week' ), |
|
2247 | + 'month_long_1' => __('January', 'ayecode-connect'), |
|
2248 | + 'month_long_2' => __('February', 'ayecode-connect'), |
|
2249 | + 'month_long_3' => __('March', 'ayecode-connect'), |
|
2250 | + 'month_long_4' => __('April', 'ayecode-connect'), |
|
2251 | + 'month_long_5' => __('May', 'ayecode-connect'), |
|
2252 | + 'month_long_6' => __('June', 'ayecode-connect'), |
|
2253 | + 'month_long_7' => __('July', 'ayecode-connect'), |
|
2254 | + 'month_long_8' => __('August', 'ayecode-connect'), |
|
2255 | + 'month_long_9' => __('September', 'ayecode-connect'), |
|
2256 | + 'month_long_10' => __('October', 'ayecode-connect'), |
|
2257 | + 'month_long_11' => __('November', 'ayecode-connect'), |
|
2258 | + 'month_long_12' => __('December', 'ayecode-connect'), |
|
2259 | + 'month_s_1' => _x('Jan', 'January abbreviation', 'ayecode-connect'), |
|
2260 | + 'month_s_2' => _x('Feb', 'February abbreviation', 'ayecode-connect'), |
|
2261 | + 'month_s_3' => _x('Mar', 'March abbreviation', 'ayecode-connect'), |
|
2262 | + 'month_s_4' => _x('Apr', 'April abbreviation', 'ayecode-connect'), |
|
2263 | + 'month_s_5' => _x('May', 'May abbreviation', 'ayecode-connect'), |
|
2264 | + 'month_s_6' => _x('Jun', 'June abbreviation', 'ayecode-connect'), |
|
2265 | + 'month_s_7' => _x('Jul', 'July abbreviation', 'ayecode-connect'), |
|
2266 | + 'month_s_8' => _x('Aug', 'August abbreviation', 'ayecode-connect'), |
|
2267 | + 'month_s_9' => _x('Sep', 'September abbreviation', 'ayecode-connect'), |
|
2268 | + 'month_s_10' => _x('Oct', 'October abbreviation', 'ayecode-connect'), |
|
2269 | + 'month_s_11' => _x('Nov', 'November abbreviation', 'ayecode-connect'), |
|
2270 | + 'month_s_12' => _x('Dec', 'December abbreviation', 'ayecode-connect'), |
|
2271 | + 'day_s1_1' => _x('S', 'Sunday initial', 'ayecode-connect'), |
|
2272 | + 'day_s1_2' => _x('M', 'Monday initial', 'ayecode-connect'), |
|
2273 | + 'day_s1_3' => _x('T', 'Tuesday initial', 'ayecode-connect'), |
|
2274 | + 'day_s1_4' => _x('W', 'Wednesday initial', 'ayecode-connect'), |
|
2275 | + 'day_s1_5' => _x('T', 'Friday initial', 'ayecode-connect'), |
|
2276 | + 'day_s1_6' => _x('F', 'Thursday initial', 'ayecode-connect'), |
|
2277 | + 'day_s1_7' => _x('S', 'Saturday initial', 'ayecode-connect'), |
|
2278 | + 'day_s2_1' => __('Su', 'ayecode-connect'), |
|
2279 | + 'day_s2_2' => __('Mo', 'ayecode-connect'), |
|
2280 | + 'day_s2_3' => __('Tu', 'ayecode-connect'), |
|
2281 | + 'day_s2_4' => __('We', 'ayecode-connect'), |
|
2282 | + 'day_s2_5' => __('Th', 'ayecode-connect'), |
|
2283 | + 'day_s2_6' => __('Fr', 'ayecode-connect'), |
|
2284 | + 'day_s2_7' => __('Sa', 'ayecode-connect'), |
|
2285 | + 'day_s3_1' => __('Sun', 'ayecode-connect'), |
|
2286 | + 'day_s3_2' => __('Mon', 'ayecode-connect'), |
|
2287 | + 'day_s3_3' => __('Tue', 'ayecode-connect'), |
|
2288 | + 'day_s3_4' => __('Wed', 'ayecode-connect'), |
|
2289 | + 'day_s3_5' => __('Thu', 'ayecode-connect'), |
|
2290 | + 'day_s3_6' => __('Fri', 'ayecode-connect'), |
|
2291 | + 'day_s3_7' => __('Sat', 'ayecode-connect'), |
|
2292 | + 'day_s5_1' => __('Sunday', 'ayecode-connect'), |
|
2293 | + 'day_s5_2' => __('Monday', 'ayecode-connect'), |
|
2294 | + 'day_s5_3' => __('Tuesday', 'ayecode-connect'), |
|
2295 | + 'day_s5_4' => __('Wednesday', 'ayecode-connect'), |
|
2296 | + 'day_s5_5' => __('Thursday', 'ayecode-connect'), |
|
2297 | + 'day_s5_6' => __('Friday', 'ayecode-connect'), |
|
2298 | + 'day_s5_7' => __('Saturday', 'ayecode-connect'), |
|
2299 | + 'am_lower' => __('am', 'ayecode-connect'), |
|
2300 | + 'pm_lower' => __('pm', 'ayecode-connect'), |
|
2301 | + 'am_upper' => __('AM', 'ayecode-connect'), |
|
2302 | + 'pm_upper' => __('PM', 'ayecode-connect'), |
|
2303 | + 'firstDayOfWeek' => (int) get_option('start_of_week'), |
|
2304 | 2304 | 'time_24hr' => false, |
2305 | - 'year' => __( 'Year', 'ayecode-connect' ), |
|
2306 | - 'hour' => __( 'Hour', 'ayecode-connect' ), |
|
2307 | - 'minute' => __( 'Minute', 'ayecode-connect' ), |
|
2308 | - 'weekAbbreviation' => __( 'Wk', 'ayecode-connect' ), |
|
2309 | - 'rangeSeparator' => __( ' to ', 'ayecode-connect' ), |
|
2310 | - 'scrollTitle' => __( 'Scroll to increment', 'ayecode-connect' ), |
|
2311 | - 'toggleTitle' => __( 'Click to toggle', 'ayecode-connect' ) |
|
2305 | + 'year' => __('Year', 'ayecode-connect'), |
|
2306 | + 'hour' => __('Hour', 'ayecode-connect'), |
|
2307 | + 'minute' => __('Minute', 'ayecode-connect'), |
|
2308 | + 'weekAbbreviation' => __('Wk', 'ayecode-connect'), |
|
2309 | + 'rangeSeparator' => __(' to ', 'ayecode-connect'), |
|
2310 | + 'scrollTitle' => __('Scroll to increment', 'ayecode-connect'), |
|
2311 | + 'toggleTitle' => __('Click to toggle', 'ayecode-connect') |
|
2312 | 2312 | ); |
2313 | 2313 | |
2314 | - return apply_filters( 'ayecode_ui_calendar_params', $params ); |
|
2314 | + return apply_filters('ayecode_ui_calendar_params', $params); |
|
2315 | 2315 | } |
2316 | 2316 | |
2317 | 2317 | /** |
@@ -2324,47 +2324,47 @@ discard block |
||
2324 | 2324 | public static function flatpickr_locale() { |
2325 | 2325 | $params = self::calendar_params(); |
2326 | 2326 | |
2327 | - if ( is_string( $params ) ) { |
|
2328 | - $params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' ); |
|
2327 | + if (is_string($params)) { |
|
2328 | + $params = html_entity_decode($params, ENT_QUOTES, 'UTF-8'); |
|
2329 | 2329 | } else { |
2330 | - foreach ( (array) $params as $key => $value ) { |
|
2331 | - if ( ! is_scalar( $value ) ) { |
|
2330 | + foreach ((array) $params as $key => $value) { |
|
2331 | + if (!is_scalar($value)) { |
|
2332 | 2332 | continue; |
2333 | 2333 | } |
2334 | 2334 | |
2335 | - $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); |
|
2335 | + $params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
2336 | 2336 | } |
2337 | 2337 | } |
2338 | 2338 | |
2339 | 2339 | $day_s3 = array(); |
2340 | 2340 | $day_s5 = array(); |
2341 | 2341 | |
2342 | - for ( $i = 1; $i <= 7; $i ++ ) { |
|
2343 | - $day_s3[] = addslashes( $params[ 'day_s3_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2344 | - $day_s5[] = addslashes( $params[ 'day_s3_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2342 | + for ($i = 1; $i <= 7; $i++) { |
|
2343 | + $day_s3[] = addslashes($params['day_s3_' . $i]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2344 | + $day_s5[] = addslashes($params['day_s3_' . $i]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2345 | 2345 | } |
2346 | 2346 | |
2347 | 2347 | $month_s = array(); |
2348 | 2348 | $month_long = array(); |
2349 | 2349 | |
2350 | - for ( $i = 1; $i <= 12; $i ++ ) { |
|
2351 | - $month_s[] = addslashes( $params[ 'month_s_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2352 | - $month_long[] = addslashes( $params[ 'month_long_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2350 | + for ($i = 1; $i <= 12; $i++) { |
|
2351 | + $month_s[] = addslashes($params['month_s_' . $i]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2352 | + $month_long[] = addslashes($params['month_long_' . $i]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2353 | 2353 | } |
2354 | 2354 | |
2355 | 2355 | ob_start(); |
2356 | - if ( 0 ) { ?><script><?php } ?> |
|
2356 | + if (0) { ?><script><?php } ?> |
|
2357 | 2357 | { |
2358 | 2358 | weekdays: { |
2359 | - shorthand: ['<?php echo implode( "','", $day_s3 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2360 | - longhand: ['<?php echo implode( "','", $day_s5 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2359 | + shorthand: ['<?php echo implode("','", $day_s3); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2360 | + longhand: ['<?php echo implode("','", $day_s5); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2361 | 2361 | }, |
2362 | 2362 | months: { |
2363 | - shorthand: ['<?php echo implode( "','", $month_s ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2364 | - longhand: ['<?php echo implode( "','", $month_long ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2363 | + shorthand: ['<?php echo implode("','", $month_s); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2364 | + longhand: ['<?php echo implode("','", $month_long); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'], |
|
2365 | 2365 | }, |
2366 | 2366 | daysInMonth: [31,28,31,30,31,30,31,31,30,31,30,31], |
2367 | - firstDayOfWeek: <?php echo (int) $params[ 'firstDayOfWeek' ]; ?>, |
|
2367 | + firstDayOfWeek: <?php echo (int) $params['firstDayOfWeek']; ?>, |
|
2368 | 2368 | ordinal: function (nth) { |
2369 | 2369 | var s = nth % 100; |
2370 | 2370 | if (s > 3 && s < 21) |
@@ -2380,21 +2380,21 @@ discard block |
||
2380 | 2380 | return "th"; |
2381 | 2381 | } |
2382 | 2382 | }, |
2383 | - rangeSeparator: '<?php echo esc_attr( $params[ 'rangeSeparator' ] ); ?>', |
|
2384 | - weekAbbreviation: '<?php echo esc_attr( $params[ 'weekAbbreviation' ] ); ?>', |
|
2385 | - scrollTitle: '<?php echo esc_attr( $params[ 'scrollTitle' ] ); ?>', |
|
2386 | - toggleTitle: '<?php echo esc_attr( $params[ 'toggleTitle' ] ); ?>', |
|
2387 | - amPM: ['<?php echo esc_attr( $params[ 'am_upper' ] ); ?>','<?php echo esc_attr( $params[ 'pm_upper' ] ); ?>'], |
|
2388 | - yearAriaLabel: '<?php echo esc_attr( $params[ 'year' ] ); ?>', |
|
2389 | - hourAriaLabel: '<?php echo esc_attr( $params[ 'hour' ] ); ?>', |
|
2390 | - minuteAriaLabel: '<?php echo esc_attr( $params[ 'minute' ] ); ?>', |
|
2391 | - time_24hr: <?php echo ( $params[ 'time_24hr' ] ? 'true' : 'false' ) ; ?> |
|
2383 | + rangeSeparator: '<?php echo esc_attr($params['rangeSeparator']); ?>', |
|
2384 | + weekAbbreviation: '<?php echo esc_attr($params['weekAbbreviation']); ?>', |
|
2385 | + scrollTitle: '<?php echo esc_attr($params['scrollTitle']); ?>', |
|
2386 | + toggleTitle: '<?php echo esc_attr($params['toggleTitle']); ?>', |
|
2387 | + amPM: ['<?php echo esc_attr($params['am_upper']); ?>','<?php echo esc_attr($params['pm_upper']); ?>'], |
|
2388 | + yearAriaLabel: '<?php echo esc_attr($params['year']); ?>', |
|
2389 | + hourAriaLabel: '<?php echo esc_attr($params['hour']); ?>', |
|
2390 | + minuteAriaLabel: '<?php echo esc_attr($params['minute']); ?>', |
|
2391 | + time_24hr: <?php echo ($params['time_24hr'] ? 'true' : 'false'); ?> |
|
2392 | 2392 | } |
2393 | - <?php if ( 0 ) { ?></script><?php } ?> |
|
2393 | + <?php if (0) { ?></script><?php } ?> |
|
2394 | 2394 | <?php |
2395 | 2395 | $locale = ob_get_clean(); |
2396 | 2396 | |
2397 | - return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) ); |
|
2397 | + return apply_filters('ayecode_ui_flatpickr_locale', trim($locale)); |
|
2398 | 2398 | } |
2399 | 2399 | |
2400 | 2400 | /** |
@@ -2406,20 +2406,20 @@ discard block |
||
2406 | 2406 | */ |
2407 | 2407 | public static function select2_params() { |
2408 | 2408 | $params = array( |
2409 | - 'i18n_select_state_text' => esc_attr__( 'Select an option…', 'ayecode-connect' ), |
|
2410 | - 'i18n_no_matches' => _x( 'No matches found', 'enhanced select', 'ayecode-connect' ), |
|
2411 | - 'i18n_ajax_error' => _x( 'Loading failed', 'enhanced select', 'ayecode-connect' ), |
|
2412 | - 'i18n_input_too_short_1' => _x( 'Please enter 1 or more characters', 'enhanced select', 'ayecode-connect' ), |
|
2413 | - 'i18n_input_too_short_n' => _x( 'Please enter %item% or more characters', 'enhanced select', 'ayecode-connect' ), |
|
2414 | - 'i18n_input_too_long_1' => _x( 'Please delete 1 character', 'enhanced select', 'ayecode-connect' ), |
|
2415 | - 'i18n_input_too_long_n' => _x( 'Please delete %item% characters', 'enhanced select', 'ayecode-connect' ), |
|
2416 | - 'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'ayecode-connect' ), |
|
2417 | - 'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'ayecode-connect' ), |
|
2418 | - 'i18n_load_more' => _x( 'Loading more results…', 'enhanced select', 'ayecode-connect' ), |
|
2419 | - 'i18n_searching' => _x( 'Searching…', 'enhanced select', 'ayecode-connect' ) |
|
2409 | + 'i18n_select_state_text' => esc_attr__('Select an option…', 'ayecode-connect'), |
|
2410 | + 'i18n_no_matches' => _x('No matches found', 'enhanced select', 'ayecode-connect'), |
|
2411 | + 'i18n_ajax_error' => _x('Loading failed', 'enhanced select', 'ayecode-connect'), |
|
2412 | + 'i18n_input_too_short_1' => _x('Please enter 1 or more characters', 'enhanced select', 'ayecode-connect'), |
|
2413 | + 'i18n_input_too_short_n' => _x('Please enter %item% or more characters', 'enhanced select', 'ayecode-connect'), |
|
2414 | + 'i18n_input_too_long_1' => _x('Please delete 1 character', 'enhanced select', 'ayecode-connect'), |
|
2415 | + 'i18n_input_too_long_n' => _x('Please delete %item% characters', 'enhanced select', 'ayecode-connect'), |
|
2416 | + 'i18n_selection_too_long_1' => _x('You can only select 1 item', 'enhanced select', 'ayecode-connect'), |
|
2417 | + 'i18n_selection_too_long_n' => _x('You can only select %item% items', 'enhanced select', 'ayecode-connect'), |
|
2418 | + 'i18n_load_more' => _x('Loading more results…', 'enhanced select', 'ayecode-connect'), |
|
2419 | + 'i18n_searching' => _x('Searching…', 'enhanced select', 'ayecode-connect') |
|
2420 | 2420 | ); |
2421 | 2421 | |
2422 | - return apply_filters( 'ayecode_ui_select2_params', $params ); |
|
2422 | + return apply_filters('ayecode_ui_select2_params', $params); |
|
2423 | 2423 | } |
2424 | 2424 | |
2425 | 2425 | /** |
@@ -2432,17 +2432,17 @@ discard block |
||
2432 | 2432 | public static function select2_locale() { |
2433 | 2433 | $params = self::select2_params(); |
2434 | 2434 | |
2435 | - foreach ( (array) $params as $key => $value ) { |
|
2436 | - if ( ! is_scalar( $value ) ) { |
|
2435 | + foreach ((array) $params as $key => $value) { |
|
2436 | + if (!is_scalar($value)) { |
|
2437 | 2437 | continue; |
2438 | 2438 | } |
2439 | 2439 | |
2440 | - $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); |
|
2440 | + $params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
2441 | 2441 | } |
2442 | 2442 | |
2443 | - $locale = json_encode( $params ); |
|
2443 | + $locale = json_encode($params); |
|
2444 | 2444 | |
2445 | - return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) ); |
|
2445 | + return apply_filters('ayecode_ui_select2_locale', trim($locale)); |
|
2446 | 2446 | } |
2447 | 2447 | |
2448 | 2448 | /** |
@@ -2455,35 +2455,35 @@ discard block |
||
2455 | 2455 | public static function timeago_locale() { |
2456 | 2456 | $params = array( |
2457 | 2457 | 'prefix_ago' => '', |
2458 | - 'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'ayecode-connect' ), |
|
2459 | - 'prefix_after' => _x( 'after', 'time ago', 'ayecode-connect' ) . ' ', |
|
2458 | + 'suffix_ago' => ' ' . _x('ago', 'time ago', 'ayecode-connect'), |
|
2459 | + 'prefix_after' => _x('after', 'time ago', 'ayecode-connect') . ' ', |
|
2460 | 2460 | 'suffix_after' => '', |
2461 | - 'seconds' => _x( 'less than a minute', 'time ago', 'ayecode-connect' ), |
|
2462 | - 'minute' => _x( 'about a minute', 'time ago', 'ayecode-connect' ), |
|
2463 | - 'minutes' => _x( '%d minutes', 'time ago', 'ayecode-connect' ), |
|
2464 | - 'hour' => _x( 'about an hour', 'time ago', 'ayecode-connect' ), |
|
2465 | - 'hours' => _x( 'about %d hours', 'time ago', 'ayecode-connect' ), |
|
2466 | - 'day' => _x( 'a day', 'time ago', 'ayecode-connect' ), |
|
2467 | - 'days' => _x( '%d days', 'time ago', 'ayecode-connect' ), |
|
2468 | - 'month' => _x( 'about a month', 'time ago', 'ayecode-connect' ), |
|
2469 | - 'months' => _x( '%d months', 'time ago', 'ayecode-connect' ), |
|
2470 | - 'year' => _x( 'about a year', 'time ago', 'ayecode-connect' ), |
|
2471 | - 'years' => _x( '%d years', 'time ago', 'ayecode-connect' ), |
|
2461 | + 'seconds' => _x('less than a minute', 'time ago', 'ayecode-connect'), |
|
2462 | + 'minute' => _x('about a minute', 'time ago', 'ayecode-connect'), |
|
2463 | + 'minutes' => _x('%d minutes', 'time ago', 'ayecode-connect'), |
|
2464 | + 'hour' => _x('about an hour', 'time ago', 'ayecode-connect'), |
|
2465 | + 'hours' => _x('about %d hours', 'time ago', 'ayecode-connect'), |
|
2466 | + 'day' => _x('a day', 'time ago', 'ayecode-connect'), |
|
2467 | + 'days' => _x('%d days', 'time ago', 'ayecode-connect'), |
|
2468 | + 'month' => _x('about a month', 'time ago', 'ayecode-connect'), |
|
2469 | + 'months' => _x('%d months', 'time ago', 'ayecode-connect'), |
|
2470 | + 'year' => _x('about a year', 'time ago', 'ayecode-connect'), |
|
2471 | + 'years' => _x('%d years', 'time ago', 'ayecode-connect'), |
|
2472 | 2472 | ); |
2473 | 2473 | |
2474 | - $params = apply_filters( 'ayecode_ui_timeago_params', $params ); |
|
2474 | + $params = apply_filters('ayecode_ui_timeago_params', $params); |
|
2475 | 2475 | |
2476 | - foreach ( (array) $params as $key => $value ) { |
|
2477 | - if ( ! is_scalar( $value ) ) { |
|
2476 | + foreach ((array) $params as $key => $value) { |
|
2477 | + if (!is_scalar($value)) { |
|
2478 | 2478 | continue; |
2479 | 2479 | } |
2480 | 2480 | |
2481 | - $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); |
|
2481 | + $params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
2482 | 2482 | } |
2483 | 2483 | |
2484 | - $locale = json_encode( $params ); |
|
2484 | + $locale = json_encode($params); |
|
2485 | 2485 | |
2486 | - return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) ); |
|
2486 | + return apply_filters('ayecode_ui_timeago_locale', trim($locale)); |
|
2487 | 2487 | } |
2488 | 2488 | |
2489 | 2489 | /** |
@@ -2494,7 +2494,7 @@ discard block |
||
2494 | 2494 | * @return mixed |
2495 | 2495 | */ |
2496 | 2496 | public static function minify_js($input) { |
2497 | - if(trim($input) === "") return $input; |
|
2497 | + if (trim($input) === "") return $input; |
|
2498 | 2498 | return preg_replace( |
2499 | 2499 | array( |
2500 | 2500 | // Remove comment(s) |
@@ -2526,7 +2526,7 @@ discard block |
||
2526 | 2526 | * @return mixed |
2527 | 2527 | */ |
2528 | 2528 | public static function minify_css($input) { |
2529 | - if(trim($input) === "") return $input; |
|
2529 | + if (trim($input) === "") return $input; |
|
2530 | 2530 | return preg_replace( |
2531 | 2531 | array( |
2532 | 2532 | // Remove comment(s) |
@@ -3092,12 +3092,12 @@ discard block |
||
3092 | 3092 | }); |
3093 | 3093 | } |
3094 | 3094 | } |
3095 | - <?php do_action( 'aui_conditional_fields_js', $this ); ?> |
|
3095 | + <?php do_action('aui_conditional_fields_js', $this); ?> |
|
3096 | 3096 | </script> |
3097 | 3097 | <?php |
3098 | 3098 | $output = ob_get_clean(); |
3099 | 3099 | |
3100 | - return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) ); |
|
3100 | + return str_replace(array('<script>', '</script>'), '', self::minify_js($output)); |
|
3101 | 3101 | } |
3102 | 3102 | } |
3103 | 3103 |
@@ -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.9"; |
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.1.35' ); |
|
8 | + define('SUPER_DUPER_VER', '1.1.35'); |
|
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,61 +80,61 @@ 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, 'shortcode_insert_button' ) ); |
|
107 | + add_action('media_buttons', array($this, 'shortcode_insert_button')); |
|
108 | 108 | // generatepress theme sections compatibility |
109 | - if ( function_exists( 'generate_sections_sections_metabox' ) ) { |
|
110 | - add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) ); |
|
109 | + if (function_exists('generate_sections_sections_metabox')) { |
|
110 | + add_action('generate_sections_metabox', array($this, 'shortcode_insert_button_script')); |
|
111 | 111 | } |
112 | 112 | /* Load script on Divi theme builder page */ |
113 | - if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) { |
|
113 | + if (function_exists('et_builder_is_tb_admin_screen') && et_builder_is_tb_admin_screen()) { |
|
114 | 114 | add_thickbox(); |
115 | - add_action( 'admin_footer', array( $this, 'shortcode_insert_button_script' ) ); |
|
115 | + add_action('admin_footer', array($this, 'shortcode_insert_button_script')); |
|
116 | 116 | } |
117 | 117 | |
118 | - if ( $this->is_preview() ) { |
|
119 | - add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) ); |
|
118 | + if ($this->is_preview()) { |
|
119 | + add_action('wp_footer', array($this, 'shortcode_insert_button_script')); |
|
120 | 120 | // this makes the insert button work for elementor |
121 | - add_action( 'elementor/editor/after_enqueue_scripts', array( |
|
121 | + add_action('elementor/editor/after_enqueue_scripts', array( |
|
122 | 122 | $this, |
123 | 123 | 'shortcode_insert_button_script' |
124 | - ) ); // for elementor |
|
124 | + )); // for elementor |
|
125 | 125 | } |
126 | 126 | // this makes the insert button work for cornerstone |
127 | - add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) ); |
|
127 | + add_action('wp_print_footer_scripts', array(__CLASS__, 'maybe_cornerstone_builder')); |
|
128 | 128 | |
129 | - add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) ); |
|
130 | - add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) ); |
|
129 | + add_action('wp_ajax_super_duper_get_widget_settings', array(__CLASS__, 'get_widget_settings')); |
|
130 | + add_action('wp_ajax_super_duper_get_picker', array(__CLASS__, 'get_picker')); |
|
131 | 131 | |
132 | 132 | // add generator text to head |
133 | - add_action( 'admin_head', array( $this, 'generator' ), 99 ); |
|
134 | - add_action( 'wp_head', array( $this, 'generator' ), 99 ); |
|
133 | + add_action('admin_head', array($this, 'generator'), 99); |
|
134 | + add_action('wp_head', array($this, 'generator'), 99); |
|
135 | 135 | } |
136 | 136 | |
137 | - do_action( 'wp_super_duper_widget_init', $options, $this ); |
|
137 | + do_action('wp_super_duper_widget_init', $options, $this); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @return void |
143 | 143 | */ |
144 | 144 | public function _register() { |
145 | - if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){ |
|
145 | + if (empty($this->options['output_types']) || in_array('widget', $this->options['output_types'])) { |
|
146 | 146 | parent::_register(); |
147 | 147 | } |
148 | 148 | } |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | * Add our widget CSS to elementor editor. |
152 | 152 | */ |
153 | 153 | public function elementor_editor_styles() { |
154 | - wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) ); |
|
154 | + wp_add_inline_style('elementor-editor', $this->widget_css(false)); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | public function register_fusion_element() { |
158 | 158 | |
159 | 159 | $options = $this->options; |
160 | 160 | |
161 | - if ( $this->base_id ) { |
|
161 | + if ($this->base_id) { |
|
162 | 162 | |
163 | 163 | $params = $this->get_fusion_params(); |
164 | 164 | |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | 'allow_generator' => true, |
170 | 170 | ); |
171 | 171 | |
172 | - if ( ! empty( $params ) ) { |
|
172 | + if (!empty($params)) { |
|
173 | 173 | $args['params'] = $params; |
174 | 174 | } |
175 | 175 | |
176 | - fusion_builder_map( $args ); |
|
176 | + fusion_builder_map($args); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | } |
@@ -182,8 +182,8 @@ discard block |
||
182 | 182 | $params = array(); |
183 | 183 | $arguments = $this->get_arguments(); |
184 | 184 | |
185 | - if ( ! empty( $arguments ) ) { |
|
186 | - foreach ( $arguments as $key => $val ) { |
|
185 | + if (!empty($arguments)) { |
|
186 | + foreach ($arguments as $key => $val) { |
|
187 | 187 | $param = array(); |
188 | 188 | // type |
189 | 189 | $param['type'] = str_replace( |
@@ -205,38 +205,38 @@ discard block |
||
205 | 205 | $val['type'] ); |
206 | 206 | |
207 | 207 | // multiselect |
208 | - if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) { |
|
208 | + if ($val['type'] == 'multiselect' || (($param['type'] == 'select' || $val['type'] == 'select') && !empty($val['multiple']))) { |
|
209 | 209 | $param['type'] = 'multiple_select'; |
210 | 210 | $param['multiple'] = true; |
211 | 211 | } |
212 | 212 | |
213 | 213 | // heading |
214 | - $param['heading'] = isset( $val['title'] ) ? $val['title'] : ''; |
|
214 | + $param['heading'] = isset($val['title']) ? $val['title'] : ''; |
|
215 | 215 | |
216 | 216 | // description |
217 | - $param['description'] = isset( $val['desc'] ) ? $val['desc'] : ''; |
|
217 | + $param['description'] = isset($val['desc']) ? $val['desc'] : ''; |
|
218 | 218 | |
219 | 219 | // param_name |
220 | 220 | $param['param_name'] = $key; |
221 | 221 | |
222 | 222 | // Default |
223 | - $param['default'] = isset( $val['default'] ) ? $val['default'] : ''; |
|
223 | + $param['default'] = isset($val['default']) ? $val['default'] : ''; |
|
224 | 224 | |
225 | 225 | // Group |
226 | - if ( isset( $val['group'] ) ) { |
|
226 | + if (isset($val['group'])) { |
|
227 | 227 | $param['group'] = $val['group']; |
228 | 228 | } |
229 | 229 | |
230 | 230 | // value |
231 | - if ( $val['type'] == 'checkbox' ) { |
|
232 | - if ( isset( $val['default'] ) && $val['default'] == '0' ) { |
|
233 | - unset( $param['default'] ); |
|
231 | + if ($val['type'] == 'checkbox') { |
|
232 | + if (isset($val['default']) && $val['default'] == '0') { |
|
233 | + unset($param['default']); |
|
234 | 234 | } |
235 | - $param['value'] = array( '0' => __( "No", 'ayecode-connect' ), '1' => __( "Yes", 'ayecode-connect' ) ); |
|
236 | - } elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) { |
|
237 | - $param['value'] = isset( $val['options'] ) ? $val['options'] : array(); |
|
235 | + $param['value'] = array('0' => __("No", 'ayecode-connect'), '1' => __("Yes", 'ayecode-connect')); |
|
236 | + } elseif ($param['type'] == 'select' || $param['type'] == 'multiple_select') { |
|
237 | + $param['value'] = isset($val['options']) ? $val['options'] : array(); |
|
238 | 238 | } else { |
239 | - $param['value'] = isset( $val['default'] ) ? $val['default'] : ''; |
|
239 | + $param['value'] = isset($val['default']) ? $val['default'] : ''; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | // setup the param |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder |
254 | 254 | */ |
255 | 255 | public static function maybe_cornerstone_builder() { |
256 | - if ( did_action( 'cornerstone_before_boot_app' ) ) { |
|
256 | + if (did_action('cornerstone_before_boot_app')) { |
|
257 | 257 | self::shortcode_insert_button_script(); |
258 | 258 | } |
259 | 259 | } |
@@ -265,12 +265,12 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @return string |
267 | 267 | */ |
268 | - public static function get_picker( $editor_id = '' ) { |
|
268 | + public static function get_picker($editor_id = '') { |
|
269 | 269 | |
270 | 270 | ob_start(); |
271 | - if ( isset( $_POST['editor_id'] ) ) { |
|
272 | - $editor_id = esc_attr( $_POST['editor_id'] ); |
|
273 | - } elseif ( isset( $_REQUEST['et_fb'] ) ) { |
|
271 | + if (isset($_POST['editor_id'])) { |
|
272 | + $editor_id = esc_attr($_POST['editor_id']); |
|
273 | + } elseif (isset($_REQUEST['et_fb'])) { |
|
274 | 274 | $editor_id = 'main_content_content_vb_tiny_mce'; |
275 | 275 | } |
276 | 276 | |
@@ -281,14 +281,14 @@ discard block |
||
281 | 281 | |
282 | 282 | <div class="sd-shortcode-left-wrap"> |
283 | 283 | <?php |
284 | - ksort( $sd_widgets ); |
|
284 | + ksort($sd_widgets); |
|
285 | 285 | // print_r($sd_widgets);exit; |
286 | - if ( ! empty( $sd_widgets ) ) { |
|
286 | + if (!empty($sd_widgets)) { |
|
287 | 287 | echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">'; |
288 | - echo "<option>" . __( 'Select shortcode', 'ayecode-connect' ) . "</option>"; |
|
289 | - foreach ( $sd_widgets as $shortcode => $class ) { |
|
290 | - if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; } |
|
291 | - echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>"; |
|
288 | + echo "<option>" . __('Select shortcode', 'ayecode-connect') . "</option>"; |
|
289 | + foreach ($sd_widgets as $shortcode => $class) { |
|
290 | + if (!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])) { continue; } |
|
291 | + echo "<option value='" . esc_attr($shortcode) . "'>" . esc_attr($shortcode) . " (" . esc_attr($class['name']) . ")</option>"; |
|
292 | 292 | } |
293 | 293 | echo "</select>"; |
294 | 294 | |
@@ -301,37 +301,37 @@ discard block |
||
301 | 301 | <div class="sd-shortcode-right-wrap"> |
302 | 302 | <textarea id='sd-shortcode-output' disabled></textarea> |
303 | 303 | <div id='sd-shortcode-output-actions'> |
304 | - <?php if ( $editor_id != '' ) { ?> |
|
304 | + <?php if ($editor_id != '') { ?> |
|
305 | 305 | <button class="button sd-insert-shortcode-button" |
306 | - onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) { |
|
306 | + onclick="sd_insert_shortcode(<?php if (!empty($editor_id)) { |
|
307 | 307 | echo "'" . $editor_id . "'"; |
308 | - } ?>)"><?php _e( 'Insert shortcode', 'ayecode-connect' ); ?></button> |
|
308 | + } ?>)"><?php _e('Insert shortcode', 'ayecode-connect'); ?></button> |
|
309 | 309 | <?php } ?> |
310 | 310 | <button class="button" |
311 | - onclick="sd_copy_to_clipboard()"><?php _e( 'Copy shortcode' ); ?></button> |
|
311 | + onclick="sd_copy_to_clipboard()"><?php _e('Copy shortcode'); ?></button> |
|
312 | 312 | </div> |
313 | 313 | </div> |
314 | 314 | <?php |
315 | 315 | |
316 | 316 | $html = ob_get_clean(); |
317 | 317 | |
318 | - if ( wp_doing_ajax() ) { |
|
318 | + if (wp_doing_ajax()) { |
|
319 | 319 | echo $html; |
320 | 320 | $should_die = true; |
321 | 321 | |
322 | 322 | // some builder get the editor via ajax so we should not die on those occasions |
323 | 323 | $dont_die = array( |
324 | - 'parent_tag',// WP Bakery |
|
324 | + 'parent_tag', // WP Bakery |
|
325 | 325 | 'avia_request' // enfold |
326 | 326 | ); |
327 | 327 | |
328 | - foreach ( $dont_die as $request ) { |
|
329 | - if ( isset( $_REQUEST[ $request ] ) ) { |
|
328 | + foreach ($dont_die as $request) { |
|
329 | + if (isset($_REQUEST[$request])) { |
|
330 | 330 | $should_die = false; |
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
334 | - if ( $should_die ) { |
|
334 | + if ($should_die) { |
|
335 | 335 | wp_die(); |
336 | 336 | } |
337 | 337 | |
@@ -347,22 +347,22 @@ discard block |
||
347 | 347 | * Output the version in the header. |
348 | 348 | */ |
349 | 349 | public function generator() { |
350 | - $file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) ); |
|
351 | - $plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) ); |
|
350 | + $file = str_replace(array("/", "\\"), "/", realpath(__FILE__)); |
|
351 | + $plugins_dir = str_replace(array("/", "\\"), "/", realpath(WP_PLUGIN_DIR)); |
|
352 | 352 | |
353 | 353 | // Find source plugin/theme of SD |
354 | 354 | $source = array(); |
355 | - if ( strpos( $file, $plugins_dir ) !== false ) { |
|
356 | - $source = explode( "/", plugin_basename( $file ) ); |
|
357 | - } else if ( function_exists( 'get_theme_root' ) ) { |
|
358 | - $themes_dir = str_replace( array( "/", "\\" ), "/", realpath( get_theme_root() ) ); |
|
355 | + if (strpos($file, $plugins_dir) !== false) { |
|
356 | + $source = explode("/", plugin_basename($file)); |
|
357 | + } else if (function_exists('get_theme_root')) { |
|
358 | + $themes_dir = str_replace(array("/", "\\"), "/", realpath(get_theme_root())); |
|
359 | 359 | |
360 | - if ( strpos( $file, $themes_dir ) !== false ) { |
|
361 | - $source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) ); |
|
360 | + if (strpos($file, $themes_dir) !== false) { |
|
361 | + $source = explode("/", ltrim(str_replace($themes_dir, "", $file), "/")); |
|
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
365 | - echo '<meta name="generator" content="WP Super Duper v' . esc_attr( $this->version ) . '"' . ( ! empty( $source[0] ) ? ' data-sd-source="' . esc_attr( $source[0] ) . '"' : '' ) . ' />'; |
|
365 | + echo '<meta name="generator" content="WP Super Duper v' . esc_attr($this->version) . '"' . (!empty($source[0]) ? ' data-sd-source="' . esc_attr($source[0]) . '"' : '') . ' />'; |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | /** |
@@ -373,16 +373,16 @@ discard block |
||
373 | 373 | public static function get_widget_settings() { |
374 | 374 | global $sd_widgets; |
375 | 375 | |
376 | - $shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : ''; |
|
377 | - if ( ! $shortcode ) { |
|
376 | + $shortcode = isset($_REQUEST['shortcode']) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes($_REQUEST['shortcode']) : ''; |
|
377 | + if (!$shortcode) { |
|
378 | 378 | wp_die(); |
379 | 379 | } |
380 | - $widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : ''; |
|
381 | - if ( ! $widget_args ) { |
|
380 | + $widget_args = isset($sd_widgets[$shortcode]) ? $sd_widgets[$shortcode] : ''; |
|
381 | + if (!$widget_args) { |
|
382 | 382 | wp_die(); |
383 | 383 | } |
384 | - $class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : ''; |
|
385 | - if ( ! $class_name ) { |
|
384 | + $class_name = isset($widget_args['class_name']) && $widget_args['class_name'] ? $widget_args['class_name'] : ''; |
|
385 | + if (!$class_name) { |
|
386 | 386 | wp_die(); |
387 | 387 | } |
388 | 388 | |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | $widget = new $class_name; |
391 | 391 | |
392 | 392 | ob_start(); |
393 | - $widget->form( array() ); |
|
393 | + $widget->form(array()); |
|
394 | 394 | $form = ob_get_clean(); |
395 | 395 | echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>"; |
396 | 396 | echo "<style>" . $widget->widget_css() . "</style>"; |
@@ -409,9 +409,9 @@ discard block |
||
409 | 409 | *@since 1.0.0 |
410 | 410 | * |
411 | 411 | */ |
412 | - public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) { |
|
412 | + public static function shortcode_insert_button($editor_id = '', $insert_shortcode_function = '') { |
|
413 | 413 | global $sd_widgets, $shortcode_insert_button_once; |
414 | - if ( $shortcode_insert_button_once ) { |
|
414 | + if ($shortcode_insert_button_once) { |
|
415 | 415 | return; |
416 | 416 | } |
417 | 417 | add_thickbox(); |
@@ -421,21 +421,21 @@ discard block |
||
421 | 421 | * Cornerstone makes us play dirty tricks :/ |
422 | 422 | * 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. |
423 | 423 | */ |
424 | - if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) { |
|
424 | + if (function_exists('cornerstone_plugin_init') && !is_admin()) { |
|
425 | 425 | echo '<span id="insert-media-button">'; |
426 | 426 | } |
427 | 427 | |
428 | - echo self::shortcode_button( 'this', 'true' ); |
|
428 | + echo self::shortcode_button('this', 'true'); |
|
429 | 429 | |
430 | 430 | // see opening note |
431 | - if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) { |
|
431 | + if (function_exists('cornerstone_plugin_init') && !is_admin()) { |
|
432 | 432 | echo '</span>'; // end #insert-media-button |
433 | 433 | } |
434 | 434 | |
435 | 435 | // Add separate script for generatepress theme sections |
436 | - if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) { |
|
436 | + if (function_exists('generate_sections_sections_metabox') && did_action('generate_sections_metabox')) { |
|
437 | 437 | } else { |
438 | - self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function ); |
|
438 | + self::shortcode_insert_button_script($editor_id, $insert_shortcode_function); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | $shortcode_insert_button_once = true; |
@@ -449,12 +449,12 @@ discard block |
||
449 | 449 | * |
450 | 450 | * @return mixed |
451 | 451 | */ |
452 | - public static function shortcode_button( $id = '', $search_for_id = '' ) { |
|
452 | + public static function shortcode_button($id = '', $search_for_id = '') { |
|
453 | 453 | ob_start(); |
454 | 454 | ?> |
455 | 455 | <span class="sd-lable-shortcode-inserter"> |
456 | 456 | <a onclick="sd_ajax_get_picker(<?php echo $id; |
457 | - if ( $search_for_id ) { |
|
457 | + if ($search_for_id) { |
|
458 | 458 | echo "," . $search_for_id; |
459 | 459 | } ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed" |
460 | 460 | class="thickbox button super-duper-content-open" title="Add Shortcode"> |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | $html = ob_get_clean(); |
471 | 471 | |
472 | 472 | // remove line breaks so we can use it in js |
473 | - return preg_replace( "/\r|\n/", "", trim( $html ) ); |
|
473 | + return preg_replace("/\r|\n/", "", trim($html)); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | jQuery($this).data('sd-widget-enabled', true); |
529 | 529 | } |
530 | 530 | |
531 | - 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>'; |
|
531 | + 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 | 532 | var form = jQuery($this).parents('' + $selector + ''); |
533 | 533 | |
534 | 534 | if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) { |
@@ -563,10 +563,10 @@ discard block |
||
563 | 563 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
564 | 564 | */ |
565 | 565 | |
566 | - return str_replace( array( |
|
566 | + return str_replace(array( |
|
567 | 567 | '<script>', |
568 | 568 | '</script>' |
569 | - ), '', $output ); |
|
569 | + ), '', $output); |
|
570 | 570 | } |
571 | 571 | |
572 | 572 | /** |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | *@since 1.0.6 |
579 | 579 | * |
580 | 580 | */ |
581 | - public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) { |
|
581 | + public static function shortcode_insert_button_script($editor_id = '', $insert_shortcode_function = '') { |
|
582 | 582 | ?> |
583 | 583 | <style> |
584 | 584 | .sd-shortcode-left-wrap { |
@@ -697,25 +697,25 @@ discard block |
||
697 | 697 | width: 100%; |
698 | 698 | } |
699 | 699 | |
700 | - <?php if ( function_exists( 'generate_sections_sections_metabox' ) ) { ?> |
|
700 | + <?php if (function_exists('generate_sections_sections_metabox')) { ?> |
|
701 | 701 | .generate-sections-modal #custom-media-buttons > .sd-lable-shortcode-inserter { |
702 | 702 | display: inline; |
703 | 703 | } |
704 | 704 | <?php } ?> |
705 | - <?php if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) { ?> |
|
705 | + <?php if (function_exists('et_builder_is_tb_admin_screen') && et_builder_is_tb_admin_screen()) { ?> |
|
706 | 706 | body.divi_page_et_theme_builder div#TB_window.gd-tb-window{z-index:9999999} |
707 | 707 | <?php } ?> |
708 | 708 | </style> |
709 | 709 | <?php |
710 | - if ( class_exists( 'SiteOrigin_Panels' ) ) { |
|
710 | + if (class_exists('SiteOrigin_Panels')) { |
|
711 | 711 | echo "<script>" . self::siteorigin_js() . "</script>"; |
712 | 712 | } |
713 | 713 | ?> |
714 | 714 | <script> |
715 | 715 | <?php |
716 | - if(! empty( $insert_shortcode_function )){ |
|
716 | + if (!empty($insert_shortcode_function)) { |
|
717 | 717 | echo $insert_shortcode_function; |
718 | - }else{ |
|
718 | + } else { |
|
719 | 719 | |
720 | 720 | /** |
721 | 721 | * Function for super duper insert shortcode. |
@@ -728,9 +728,9 @@ discard block |
||
728 | 728 | if ($shortcode) { |
729 | 729 | if (!$editor_id) { |
730 | 730 | <?php |
731 | - if ( isset( $_REQUEST['et_fb'] ) ) { |
|
731 | + if (isset($_REQUEST['et_fb'])) { |
|
732 | 732 | echo '$editor_id = "#main_content_content_vb_tiny_mce";'; |
733 | - } elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) { |
|
733 | + } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') { |
|
734 | 734 | echo '$editor_id = "#elementor-controls .wp-editor-container textarea";'; |
735 | 735 | } else { |
736 | 736 | echo '$editor_id = "#wp-content-editor-container textarea";'; |
@@ -813,11 +813,11 @@ discard block |
||
813 | 813 | 'shortcode': $short_code, |
814 | 814 | 'attributes': 123, |
815 | 815 | 'post_id': 321, |
816 | - '_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>' |
|
816 | + '_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>' |
|
817 | 817 | }; |
818 | 818 | |
819 | 819 | if (typeof ajaxurl === 'undefined') { |
820 | - var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' );?>"; |
|
820 | + var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>"; |
|
821 | 821 | } |
822 | 822 | |
823 | 823 | jQuery.post(ajaxurl, data, function (response) { |
@@ -1016,11 +1016,11 @@ discard block |
||
1016 | 1016 | var data = { |
1017 | 1017 | 'action': 'super_duper_get_picker', |
1018 | 1018 | 'editor_id': $id, |
1019 | - '_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_picker' );?>' |
|
1019 | + '_ajax_nonce': '<?php echo wp_create_nonce('super_duper_picker'); ?>' |
|
1020 | 1020 | }; |
1021 | 1021 | |
1022 | 1022 | if (!ajaxurl) { |
1023 | - var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' ); ?>"; |
|
1023 | + var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>"; |
|
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | jQuery.post(ajaxurl, data, function (response) { |
@@ -1042,9 +1042,9 @@ discard block |
||
1042 | 1042 | */ |
1043 | 1043 | function sd_shortcode_button($id) { |
1044 | 1044 | if ($id) { |
1045 | - return '<?php echo self::shortcode_button( "\\''+\$id+'\\'" );?>'; |
|
1045 | + return '<?php echo self::shortcode_button("\\''+\$id+'\\'"); ?>'; |
|
1046 | 1046 | } else { |
1047 | - return '<?php echo self::shortcode_button();?>'; |
|
1047 | + return '<?php echo self::shortcode_button(); ?>'; |
|
1048 | 1048 | } |
1049 | 1049 | } |
1050 | 1050 | </script> |
@@ -1058,11 +1058,11 @@ discard block |
||
1058 | 1058 | * |
1059 | 1059 | * @return mixed |
1060 | 1060 | */ |
1061 | - public function widget_css( $advanced = true ) { |
|
1061 | + public function widget_css($advanced = true) { |
|
1062 | 1062 | ob_start(); |
1063 | 1063 | ?> |
1064 | 1064 | <style> |
1065 | - <?php if( $advanced ){ ?> |
|
1065 | + <?php if ($advanced) { ?> |
|
1066 | 1066 | .sd-advanced-setting { |
1067 | 1067 | display: none; |
1068 | 1068 | } |
@@ -1106,10 +1106,10 @@ discard block |
||
1106 | 1106 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
1107 | 1107 | */ |
1108 | 1108 | |
1109 | - return str_replace( array( |
|
1109 | + return str_replace(array( |
|
1110 | 1110 | '<style>', |
1111 | 1111 | '</style>' |
1112 | - ), '', $output ); |
|
1112 | + ), '', $output); |
|
1113 | 1113 | } |
1114 | 1114 | |
1115 | 1115 | /** |
@@ -1176,7 +1176,7 @@ discard block |
||
1176 | 1176 | jQuery($this).data('sd-widget-enabled', true); |
1177 | 1177 | } |
1178 | 1178 | |
1179 | - 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>'; |
|
1179 | + 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 | 1180 | var form = $form ? $form : jQuery($this).parents('' + $selector + ''); |
1181 | 1181 | |
1182 | 1182 | if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) { |
@@ -1267,7 +1267,7 @@ discard block |
||
1267 | 1267 | }); |
1268 | 1268 | |
1269 | 1269 | } |
1270 | - <?php do_action( 'wp_super_duper_widget_js', $this ); ?> |
|
1270 | + <?php do_action('wp_super_duper_widget_js', $this); ?> |
|
1271 | 1271 | </script> |
1272 | 1272 | <?php |
1273 | 1273 | $output = ob_get_clean(); |
@@ -1276,10 +1276,10 @@ discard block |
||
1276 | 1276 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
1277 | 1277 | */ |
1278 | 1278 | |
1279 | - return str_replace( array( |
|
1279 | + return str_replace(array( |
|
1280 | 1280 | '<script>', |
1281 | 1281 | '</script>' |
1282 | - ), '', $output ); |
|
1282 | + ), '', $output); |
|
1283 | 1283 | } |
1284 | 1284 | |
1285 | 1285 | |
@@ -1290,14 +1290,14 @@ discard block |
||
1290 | 1290 | * |
1291 | 1291 | * @return mixed |
1292 | 1292 | */ |
1293 | - private function add_name_from_key( $options, $arguments = false ) { |
|
1294 | - if ( ! empty( $options['arguments'] ) ) { |
|
1295 | - foreach ( $options['arguments'] as $key => $val ) { |
|
1296 | - $options['arguments'][ $key ]['name'] = $key; |
|
1293 | + private function add_name_from_key($options, $arguments = false) { |
|
1294 | + if (!empty($options['arguments'])) { |
|
1295 | + foreach ($options['arguments'] as $key => $val) { |
|
1296 | + $options['arguments'][$key]['name'] = $key; |
|
1297 | 1297 | } |
1298 | - } elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) { |
|
1299 | - foreach ( $options as $key => $val ) { |
|
1300 | - $options[ $key ]['name'] = $key; |
|
1298 | + } elseif ($arguments && is_array($options) && !empty($options)) { |
|
1299 | + foreach ($options as $key => $val) { |
|
1300 | + $options[$key]['name'] = $key; |
|
1301 | 1301 | } |
1302 | 1302 | } |
1303 | 1303 | |
@@ -1310,8 +1310,8 @@ discard block |
||
1310 | 1310 | * @since 1.0.0 |
1311 | 1311 | */ |
1312 | 1312 | public function register_shortcode() { |
1313 | - add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) ); |
|
1314 | - add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) ); |
|
1313 | + add_shortcode($this->base_id, array($this, 'shortcode_output')); |
|
1314 | + add_action('wp_ajax_super_duper_output_shortcode', array($this, 'render_shortcode')); |
|
1315 | 1315 | } |
1316 | 1316 | |
1317 | 1317 | /** |
@@ -1320,50 +1320,50 @@ discard block |
||
1320 | 1320 | * @since 1.0.0 |
1321 | 1321 | */ |
1322 | 1322 | public function render_shortcode() { |
1323 | - check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true ); |
|
1324 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
1323 | + check_ajax_referer('super_duper_output_shortcode', '_ajax_nonce', true); |
|
1324 | + if (!current_user_can('manage_options')) { |
|
1325 | 1325 | wp_die(); |
1326 | 1326 | } |
1327 | 1327 | |
1328 | 1328 | // we might need the $post value here so lets set it. |
1329 | - if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) { |
|
1330 | - $post_obj = get_post( absint( $_POST['post_id'] ) ); |
|
1331 | - if ( ! empty( $post_obj ) && empty( $post ) ) { |
|
1329 | + if (isset($_POST['post_id']) && $_POST['post_id']) { |
|
1330 | + $post_obj = get_post(absint($_POST['post_id'])); |
|
1331 | + if (!empty($post_obj) && empty($post)) { |
|
1332 | 1332 | global $post; |
1333 | 1333 | $post = $post_obj; |
1334 | 1334 | } |
1335 | 1335 | } |
1336 | 1336 | |
1337 | - if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) { |
|
1337 | + if (isset($_POST['shortcode']) && $_POST['shortcode']) { |
|
1338 | 1338 | $is_preview = $this->is_preview(); |
1339 | - $shortcode_name = sanitize_title_with_dashes( $_POST['shortcode'] ); |
|
1340 | - $attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array(); |
|
1339 | + $shortcode_name = sanitize_title_with_dashes($_POST['shortcode']); |
|
1340 | + $attributes_array = isset($_POST['attributes']) && $_POST['attributes'] ? $_POST['attributes'] : array(); |
|
1341 | 1341 | $attributes = ''; |
1342 | - if ( ! empty( $attributes_array ) ) { |
|
1343 | - foreach ( $attributes_array as $key => $value ) { |
|
1344 | - if ( is_array( $value ) ) { |
|
1345 | - $value = implode( ",", $value ); |
|
1342 | + if (!empty($attributes_array)) { |
|
1343 | + foreach ($attributes_array as $key => $value) { |
|
1344 | + if (is_array($value)) { |
|
1345 | + $value = implode(",", $value); |
|
1346 | 1346 | } |
1347 | 1347 | |
1348 | - if ( ! empty( $value ) ) { |
|
1349 | - $value = wp_unslash( $value ); |
|
1348 | + if (!empty($value)) { |
|
1349 | + $value = wp_unslash($value); |
|
1350 | 1350 | |
1351 | 1351 | // Encode [ and ]. |
1352 | - if ( $is_preview ) { |
|
1353 | - $value = $this->encode_shortcodes( $value ); |
|
1352 | + if ($is_preview) { |
|
1353 | + $value = $this->encode_shortcodes($value); |
|
1354 | 1354 | } |
1355 | 1355 | } |
1356 | - $attributes .= " " . sanitize_title_with_dashes( $key ) . "='" . esc_attr( $value ) . "' "; |
|
1356 | + $attributes .= " " . sanitize_title_with_dashes($key) . "='" . esc_attr($value) . "' "; |
|
1357 | 1357 | } |
1358 | 1358 | } |
1359 | 1359 | |
1360 | 1360 | $shortcode = "[" . $shortcode_name . " " . $attributes . "]"; |
1361 | 1361 | |
1362 | - $content = do_shortcode( $shortcode ); |
|
1362 | + $content = do_shortcode($shortcode); |
|
1363 | 1363 | |
1364 | 1364 | // Decode [ and ]. |
1365 | - if ( ! empty( $content ) && $is_preview ) { |
|
1366 | - $content = $this->decode_shortcodes( $content ); |
|
1365 | + if (!empty($content) && $is_preview) { |
|
1366 | + $content = $this->decode_shortcodes($content); |
|
1367 | 1367 | } |
1368 | 1368 | |
1369 | 1369 | echo $content; |
@@ -1379,21 +1379,21 @@ discard block |
||
1379 | 1379 | * |
1380 | 1380 | * @return string |
1381 | 1381 | */ |
1382 | - public function shortcode_output( $args = array(), $content = '' ) { |
|
1382 | + public function shortcode_output($args = array(), $content = '') { |
|
1383 | 1383 | $_instance = $args; |
1384 | 1384 | |
1385 | - $args = $this->argument_values( $args ); |
|
1385 | + $args = $this->argument_values($args); |
|
1386 | 1386 | |
1387 | 1387 | // add extra argument so we know its a output to gutenberg |
1388 | 1388 | //$args |
1389 | - $args = $this->string_to_bool( $args ); |
|
1389 | + $args = $this->string_to_bool($args); |
|
1390 | 1390 | |
1391 | 1391 | // if we have a enclosed shortcode we add it to the special `html` argument |
1392 | - if ( ! empty( $content ) ) { |
|
1392 | + if (!empty($content)) { |
|
1393 | 1393 | $args['html'] = $content; |
1394 | 1394 | } |
1395 | 1395 | |
1396 | - if ( ! $this->is_preview() ) { |
|
1396 | + if (!$this->is_preview()) { |
|
1397 | 1397 | /** |
1398 | 1398 | * Filters the settings for a particular widget args. |
1399 | 1399 | * |
@@ -1404,40 +1404,40 @@ discard block |
||
1404 | 1404 | *@since 1.0.28 |
1405 | 1405 | * |
1406 | 1406 | */ |
1407 | - $args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance ); |
|
1407 | + $args = apply_filters('wp_super_duper_widget_display_callback', $args, $this, $_instance); |
|
1408 | 1408 | |
1409 | - if ( ! is_array( $args ) ) { |
|
1409 | + if (!is_array($args)) { |
|
1410 | 1410 | return $args; |
1411 | 1411 | } |
1412 | 1412 | } |
1413 | 1413 | |
1414 | - $class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : ''; |
|
1415 | - $class .= " sdel-".$this->get_instance_hash(); |
|
1414 | + $class = isset($this->options['widget_ops']['classname']) ? esc_attr($this->options['widget_ops']['classname']) : ''; |
|
1415 | + $class .= " sdel-" . $this->get_instance_hash(); |
|
1416 | 1416 | |
1417 | - $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this ); |
|
1418 | - $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this ); |
|
1417 | + $class = apply_filters('wp_super_duper_div_classname', $class, $args, $this); |
|
1418 | + $class = apply_filters('wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this); |
|
1419 | 1419 | |
1420 | - $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this ); |
|
1421 | - $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this ); |
|
1420 | + $attrs = apply_filters('wp_super_duper_div_attrs', '', $args, $this); |
|
1421 | + $attrs = apply_filters('wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this); |
|
1422 | 1422 | |
1423 | 1423 | $shortcode_args = array(); |
1424 | 1424 | $output = ''; |
1425 | - $no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false; |
|
1426 | - if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) { |
|
1425 | + $no_wrap = isset($this->options['no_wrap']) && $this->options['no_wrap'] ? true : false; |
|
1426 | + if (isset($args['no_wrap']) && $args['no_wrap']) { |
|
1427 | 1427 | $no_wrap = true; |
1428 | 1428 | } |
1429 | - $main_content = $this->output( $args, $shortcode_args, $content ); |
|
1430 | - if ( $main_content && ! $no_wrap ) { |
|
1429 | + $main_content = $this->output($args, $shortcode_args, $content); |
|
1430 | + if ($main_content && !$no_wrap) { |
|
1431 | 1431 | // wrap the shortcode in a div with the same class as the widget |
1432 | 1432 | $output .= '<div class="' . $class . '" ' . $attrs . '>'; |
1433 | - if ( ! empty( $args['title'] ) ) { |
|
1433 | + if (!empty($args['title'])) { |
|
1434 | 1434 | // if its a shortcode and there is a title try to grab the title wrappers |
1435 | - $shortcode_args = array( 'before_title' => '', 'after_title' => '' ); |
|
1436 | - if ( empty( $instance ) ) { |
|
1435 | + $shortcode_args = array('before_title' => '', 'after_title' => ''); |
|
1436 | + if (empty($instance)) { |
|
1437 | 1437 | global $wp_registered_sidebars; |
1438 | - if ( ! empty( $wp_registered_sidebars ) ) { |
|
1439 | - foreach ( $wp_registered_sidebars as $sidebar ) { |
|
1440 | - if ( ! empty( $sidebar['before_title'] ) ) { |
|
1438 | + if (!empty($wp_registered_sidebars)) { |
|
1439 | + foreach ($wp_registered_sidebars as $sidebar) { |
|
1440 | + if (!empty($sidebar['before_title'])) { |
|
1441 | 1441 | $shortcode_args['before_title'] = $sidebar['before_title']; |
1442 | 1442 | $shortcode_args['after_title'] = $sidebar['after_title']; |
1443 | 1443 | break; |
@@ -1445,20 +1445,20 @@ discard block |
||
1445 | 1445 | } |
1446 | 1446 | } |
1447 | 1447 | } |
1448 | - $output .= $this->output_title( $shortcode_args, $args ); |
|
1448 | + $output .= $this->output_title($shortcode_args, $args); |
|
1449 | 1449 | } |
1450 | 1450 | $output .= $main_content; |
1451 | 1451 | $output .= '</div>'; |
1452 | - } elseif ( $main_content && $no_wrap ) { |
|
1452 | + } elseif ($main_content && $no_wrap) { |
|
1453 | 1453 | $output .= $main_content; |
1454 | 1454 | } |
1455 | 1455 | |
1456 | 1456 | // if preview show a placeholder if empty |
1457 | - if ( $this->is_preview() && $output == '' ) { |
|
1458 | - $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" ); |
|
1457 | + if ($this->is_preview() && $output == '') { |
|
1458 | + $output = $this->preview_placeholder_text("{{" . $this->base_id . "}}"); |
|
1459 | 1459 | } |
1460 | 1460 | |
1461 | - return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this ); |
|
1461 | + return apply_filters('wp_super_duper_widget_output', $output, $args, $shortcode_args, $this); |
|
1462 | 1462 | } |
1463 | 1463 | |
1464 | 1464 | /** |
@@ -1468,8 +1468,8 @@ discard block |
||
1468 | 1468 | * |
1469 | 1469 | * @return string |
1470 | 1470 | */ |
1471 | - public function preview_placeholder_text( $name = '' ) { |
|
1472 | - return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . wp_sprintf( __( 'Placeholder for: %s', 'ayecode-connect' ), $name ) . "</div>"; |
|
1471 | + public function preview_placeholder_text($name = '') { |
|
1472 | + return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . wp_sprintf(__('Placeholder for: %s', 'ayecode-connect'), $name) . "</div>"; |
|
1473 | 1473 | } |
1474 | 1474 | |
1475 | 1475 | /** |
@@ -1479,13 +1479,13 @@ discard block |
||
1479 | 1479 | * |
1480 | 1480 | * @return mixed |
1481 | 1481 | */ |
1482 | - public function string_to_bool( $options ) { |
|
1482 | + public function string_to_bool($options) { |
|
1483 | 1483 | // convert bool strings to booleans |
1484 | - foreach ( $options as $key => $val ) { |
|
1485 | - if ( $val == 'false' ) { |
|
1486 | - $options[ $key ] = false; |
|
1487 | - } elseif ( $val == 'true' ) { |
|
1488 | - $options[ $key ] = true; |
|
1484 | + foreach ($options as $key => $val) { |
|
1485 | + if ($val == 'false') { |
|
1486 | + $options[$key] = false; |
|
1487 | + } elseif ($val == 'true') { |
|
1488 | + $options[$key] = true; |
|
1489 | 1489 | } |
1490 | 1490 | } |
1491 | 1491 | |
@@ -1501,26 +1501,26 @@ discard block |
||
1501 | 1501 | *@since 1.0.12 Don't set checkbox default value if the value is empty. |
1502 | 1502 | * |
1503 | 1503 | */ |
1504 | - public function argument_values( $instance ) { |
|
1504 | + public function argument_values($instance) { |
|
1505 | 1505 | $argument_values = array(); |
1506 | 1506 | |
1507 | 1507 | // set widget instance |
1508 | 1508 | $this->instance = $instance; |
1509 | 1509 | |
1510 | - if ( empty( $this->arguments ) ) { |
|
1510 | + if (empty($this->arguments)) { |
|
1511 | 1511 | $this->arguments = $this->get_arguments(); |
1512 | 1512 | } |
1513 | 1513 | |
1514 | - if ( ! empty( $this->arguments ) ) { |
|
1515 | - foreach ( $this->arguments as $key => $args ) { |
|
1514 | + if (!empty($this->arguments)) { |
|
1515 | + foreach ($this->arguments as $key => $args) { |
|
1516 | 1516 | // set the input name from the key |
1517 | 1517 | $args['name'] = $key; |
1518 | 1518 | // |
1519 | - $argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : ''; |
|
1520 | - if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) { |
|
1519 | + $argument_values[$key] = isset($instance[$key]) ? $instance[$key] : ''; |
|
1520 | + if ($args['type'] == 'checkbox' && $argument_values[$key] == '') { |
|
1521 | 1521 | // don't set default for an empty checkbox |
1522 | - } elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) { |
|
1523 | - $argument_values[ $key ] = $args['default']; |
|
1522 | + } elseif ($argument_values[$key] == '' && isset($args['default'])) { |
|
1523 | + $argument_values[$key] = $args['default']; |
|
1524 | 1524 | } |
1525 | 1525 | } |
1526 | 1526 | } |
@@ -1547,12 +1547,12 @@ discard block |
||
1547 | 1547 | * |
1548 | 1548 | */ |
1549 | 1549 | public function get_arguments() { |
1550 | - if ( empty( $this->arguments ) ) { |
|
1550 | + if (empty($this->arguments)) { |
|
1551 | 1551 | $this->arguments = $this->set_arguments(); |
1552 | 1552 | } |
1553 | 1553 | |
1554 | - $this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance ); |
|
1555 | - $this->arguments = $this->add_name_from_key( $this->arguments, true ); |
|
1554 | + $this->arguments = apply_filters('wp_super_duper_arguments', $this->arguments, $this->options, $this->instance); |
|
1555 | + $this->arguments = $this->add_name_from_key($this->arguments, true); |
|
1556 | 1556 | |
1557 | 1557 | return $this->arguments; |
1558 | 1558 | } |
@@ -1564,7 +1564,7 @@ discard block |
||
1564 | 1564 | * @param array $widget_args |
1565 | 1565 | * @param string $content |
1566 | 1566 | */ |
1567 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
1567 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
1568 | 1568 | |
1569 | 1569 | } |
1570 | 1570 | |
@@ -1572,9 +1572,9 @@ discard block |
||
1572 | 1572 | * Add the dynamic block code inline when the wp-block in enqueued. |
1573 | 1573 | */ |
1574 | 1574 | public function register_block() { |
1575 | - wp_add_inline_script( 'wp-blocks', $this->block() ); |
|
1576 | - if ( class_exists( 'SiteOrigin_Panels' ) ) { |
|
1577 | - wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() ); |
|
1575 | + wp_add_inline_script('wp-blocks', $this->block()); |
|
1576 | + if (class_exists('SiteOrigin_Panels')) { |
|
1577 | + wp_add_inline_script('wp-blocks', $this->siteorigin_js()); |
|
1578 | 1578 | } |
1579 | 1579 | } |
1580 | 1580 | |
@@ -1588,9 +1588,9 @@ discard block |
||
1588 | 1588 | $show = false; |
1589 | 1589 | $arguments = $this->get_arguments(); |
1590 | 1590 | |
1591 | - if ( ! empty( $arguments ) ) { |
|
1592 | - foreach ( $arguments as $argument ) { |
|
1593 | - if ( isset( $argument['advanced'] ) && $argument['advanced'] ) { |
|
1591 | + if (!empty($arguments)) { |
|
1592 | + foreach ($arguments as $argument) { |
|
1593 | + if (isset($argument['advanced']) && $argument['advanced']) { |
|
1594 | 1594 | $show = true; |
1595 | 1595 | break; // no need to continue if we know we have it |
1596 | 1596 | } |
@@ -1608,19 +1608,19 @@ discard block |
||
1608 | 1608 | public function get_url() { |
1609 | 1609 | $url = $this->url; |
1610 | 1610 | |
1611 | - if ( ! $url ) { |
|
1612 | - $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) ); |
|
1613 | - $content_url = untrailingslashit( WP_CONTENT_URL ); |
|
1611 | + if (!$url) { |
|
1612 | + $content_dir = wp_normalize_path(untrailingslashit(WP_CONTENT_DIR)); |
|
1613 | + $content_url = untrailingslashit(WP_CONTENT_URL); |
|
1614 | 1614 | |
1615 | 1615 | // Replace http:// to https://. |
1616 | - if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) { |
|
1617 | - $content_url = str_replace( 'http://', 'https://', $content_url ); |
|
1616 | + if (strpos($content_url, 'http://') === 0 && strpos(plugins_url(), 'https://') === 0) { |
|
1617 | + $content_url = str_replace('http://', 'https://', $content_url); |
|
1618 | 1618 | } |
1619 | 1619 | |
1620 | 1620 | // Check if we are inside a plugin |
1621 | - $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) ); |
|
1622 | - $url = str_replace( $content_dir, $content_url, $file_dir ); |
|
1623 | - $url = trailingslashit( $url ); |
|
1621 | + $file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__))); |
|
1622 | + $url = str_replace($content_dir, $content_url, $file_dir); |
|
1623 | + $url = trailingslashit($url); |
|
1624 | 1624 | $this->url = $url; |
1625 | 1625 | } |
1626 | 1626 | |
@@ -1636,15 +1636,15 @@ discard block |
||
1636 | 1636 | |
1637 | 1637 | $url = $this->url; |
1638 | 1638 | |
1639 | - if ( ! $url ) { |
|
1639 | + if (!$url) { |
|
1640 | 1640 | // check if we are inside a plugin |
1641 | - $file_dir = str_replace( "/includes", "", dirname( __FILE__ ) ); |
|
1641 | + $file_dir = str_replace("/includes", "", dirname(__FILE__)); |
|
1642 | 1642 | |
1643 | - $dir_parts = explode( "/wp-content/", $file_dir ); |
|
1644 | - $url_parts = explode( "/wp-content/", plugins_url() ); |
|
1643 | + $dir_parts = explode("/wp-content/", $file_dir); |
|
1644 | + $url_parts = explode("/wp-content/", plugins_url()); |
|
1645 | 1645 | |
1646 | - if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) { |
|
1647 | - $url = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] ); |
|
1646 | + if (!empty($url_parts[0]) && !empty($dir_parts[1])) { |
|
1647 | + $url = trailingslashit($url_parts[0] . "/wp-content/" . $dir_parts[1]); |
|
1648 | 1648 | $this->url = $url; |
1649 | 1649 | } |
1650 | 1650 | } |
@@ -1665,45 +1665,45 @@ discard block |
||
1665 | 1665 | * @return string |
1666 | 1666 | *@since 1.1.0 |
1667 | 1667 | */ |
1668 | - public function get_block_icon( $icon ) { |
|
1668 | + public function get_block_icon($icon) { |
|
1669 | 1669 | |
1670 | 1670 | // check if we have a Font Awesome icon |
1671 | 1671 | $fa_type = ''; |
1672 | - if ( substr( $icon, 0, 7 ) === "fas fa-" ) { |
|
1672 | + if (substr($icon, 0, 7) === "fas fa-") { |
|
1673 | 1673 | $fa_type = 'solid'; |
1674 | - } elseif ( substr( $icon, 0, 7 ) === "far fa-" ) { |
|
1674 | + } elseif (substr($icon, 0, 7) === "far fa-") { |
|
1675 | 1675 | $fa_type = 'regular'; |
1676 | - } elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) { |
|
1676 | + } elseif (substr($icon, 0, 7) === "fab fa-") { |
|
1677 | 1677 | $fa_type = 'brands'; |
1678 | 1678 | } else { |
1679 | 1679 | $icon = "'" . $icon . "'"; |
1680 | 1680 | } |
1681 | 1681 | |
1682 | 1682 | // set the icon if we found one |
1683 | - if ( $fa_type ) { |
|
1684 | - $fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon ); |
|
1683 | + if ($fa_type) { |
|
1684 | + $fa_icon = str_replace(array("fas fa-", "far fa-", "fab fa-"), "", $icon); |
|
1685 | 1685 | $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 . "'}))"; |
1686 | 1686 | } |
1687 | 1687 | |
1688 | 1688 | return $icon; |
1689 | 1689 | } |
1690 | 1690 | |
1691 | - public function group_arguments( $arguments ) { |
|
1692 | - if ( ! empty( $arguments ) ) { |
|
1691 | + public function group_arguments($arguments) { |
|
1692 | + if (!empty($arguments)) { |
|
1693 | 1693 | $temp_arguments = array(); |
1694 | - $general = __( "General", 'ayecode-connect' ); |
|
1694 | + $general = __("General", 'ayecode-connect'); |
|
1695 | 1695 | $add_sections = false; |
1696 | - foreach ( $arguments as $key => $args ) { |
|
1697 | - if ( isset( $args['group'] ) ) { |
|
1698 | - $temp_arguments[ $args['group'] ][ $key ] = $args; |
|
1696 | + foreach ($arguments as $key => $args) { |
|
1697 | + if (isset($args['group'])) { |
|
1698 | + $temp_arguments[$args['group']][$key] = $args; |
|
1699 | 1699 | $add_sections = true; |
1700 | 1700 | } else { |
1701 | - $temp_arguments[ $general ][ $key ] = $args; |
|
1701 | + $temp_arguments[$general][$key] = $args; |
|
1702 | 1702 | } |
1703 | 1703 | } |
1704 | 1704 | |
1705 | 1705 | // only add sections if more than one |
1706 | - if ( $add_sections ) { |
|
1706 | + if ($add_sections) { |
|
1707 | 1707 | $arguments = $temp_arguments; |
1708 | 1708 | } |
1709 | 1709 | } |
@@ -1716,38 +1716,38 @@ discard block |
||
1716 | 1716 | * |
1717 | 1717 | * @since 1.1.17 |
1718 | 1718 | */ |
1719 | - public function group_block_tabs( $tabs, $arguments ) { |
|
1720 | - if ( ! empty( $tabs ) && ! empty( $arguments ) ) { |
|
1719 | + public function group_block_tabs($tabs, $arguments) { |
|
1720 | + if (!empty($tabs) && !empty($arguments)) { |
|
1721 | 1721 | $has_sections = false; |
1722 | 1722 | |
1723 | - foreach ( $this->arguments as $key => $args ) { |
|
1724 | - if ( isset( $args['group'] ) ) { |
|
1723 | + foreach ($this->arguments as $key => $args) { |
|
1724 | + if (isset($args['group'])) { |
|
1725 | 1725 | $has_sections = true; |
1726 | 1726 | break; |
1727 | 1727 | } |
1728 | 1728 | } |
1729 | 1729 | |
1730 | - if ( ! $has_sections ) { |
|
1730 | + if (!$has_sections) { |
|
1731 | 1731 | return $tabs; |
1732 | 1732 | } |
1733 | 1733 | |
1734 | 1734 | $new_tabs = array(); |
1735 | 1735 | |
1736 | - foreach ( $tabs as $tab_key => $tab ) { |
|
1736 | + foreach ($tabs as $tab_key => $tab) { |
|
1737 | 1737 | $new_groups = array(); |
1738 | 1738 | |
1739 | - if ( ! empty( $tab['groups'] ) && is_array( $tab['groups'] ) ) { |
|
1740 | - foreach ( $tab['groups'] as $group ) { |
|
1741 | - if ( isset( $arguments[ $group ] ) ) { |
|
1739 | + if (!empty($tab['groups']) && is_array($tab['groups'])) { |
|
1740 | + foreach ($tab['groups'] as $group) { |
|
1741 | + if (isset($arguments[$group])) { |
|
1742 | 1742 | $new_groups[] = $group; |
1743 | 1743 | } |
1744 | 1744 | } |
1745 | 1745 | } |
1746 | 1746 | |
1747 | - if ( ! empty( $new_groups ) ) { |
|
1747 | + if (!empty($new_groups)) { |
|
1748 | 1748 | $tab['groups'] = $new_groups; |
1749 | 1749 | |
1750 | - $new_tabs[ $tab_key ] = $tab; |
|
1750 | + $new_tabs[$tab_key] = $tab; |
|
1751 | 1751 | } |
1752 | 1752 | } |
1753 | 1753 | |
@@ -1774,7 +1774,7 @@ discard block |
||
1774 | 1774 | ?> |
1775 | 1775 | <script> |
1776 | 1776 | <?php |
1777 | - if ( ! $sd_is_js_functions_loaded ) { |
|
1777 | + if (!$sd_is_js_functions_loaded) { |
|
1778 | 1778 | $sd_is_js_functions_loaded = true; |
1779 | 1779 | ?> |
1780 | 1780 | function sd_show_view_options($this){ |
@@ -2151,7 +2151,7 @@ discard block |
||
2151 | 2151 | |
2152 | 2152 | // maybe use featured image. |
2153 | 2153 | if( $args['bg_image_use_featured'] !== undefined && $args['bg_image_use_featured'] ){ |
2154 | - $bg_image = '<?php echo $this->get_url();?>icons/placeholder.png'; |
|
2154 | + $bg_image = '<?php echo $this->get_url(); ?>icons/placeholder.png'; |
|
2155 | 2155 | } |
2156 | 2156 | |
2157 | 2157 | if( $bg_image !== undefined && $bg_image !== '' ){ |
@@ -2226,7 +2226,7 @@ discard block |
||
2226 | 2226 | $classes = []; |
2227 | 2227 | |
2228 | 2228 | <?php |
2229 | - if($aui_bs5){ |
|
2229 | + if ($aui_bs5) { |
|
2230 | 2230 | ?> |
2231 | 2231 | $aui_bs5 = true; |
2232 | 2232 | $p_ml = 'ms-'; |
@@ -2235,7 +2235,7 @@ discard block |
||
2235 | 2235 | $p_pl = 'ps-'; |
2236 | 2236 | $p_pr = 'pe-'; |
2237 | 2237 | <?php |
2238 | - }else{ |
|
2238 | + } else { |
|
2239 | 2239 | ?> |
2240 | 2240 | $aui_bs5 = false; |
2241 | 2241 | $p_ml = 'ml-'; |
@@ -2420,7 +2420,7 @@ discard block |
||
2420 | 2420 | } |
2421 | 2421 | |
2422 | 2422 | function sd_get_class_build_keys(){ |
2423 | - return <?php echo json_encode(sd_get_class_build_keys());?>; |
|
2423 | + return <?php echo json_encode(sd_get_class_build_keys()); ?>; |
|
2424 | 2424 | } |
2425 | 2425 | |
2426 | 2426 | <?php |
@@ -2428,7 +2428,7 @@ discard block |
||
2428 | 2428 | |
2429 | 2429 | } |
2430 | 2430 | |
2431 | - if(method_exists($this,'block_global_js')){ |
|
2431 | + if (method_exists($this, 'block_global_js')) { |
|
2432 | 2432 | echo $this->block_global_js(); |
2433 | 2433 | } |
2434 | 2434 | ?> |
@@ -2457,9 +2457,9 @@ discard block |
||
2457 | 2457 | var InnerBlocks = blockEditor.InnerBlocks; |
2458 | 2458 | |
2459 | 2459 | var term_query_type = ''; |
2460 | - 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 "[]";} ?>; |
|
2461 | - const taxonomies_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}]; |
|
2462 | - const sort_by_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}]; |
|
2460 | + 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 "[]"; } ?>; |
|
2461 | + const taxonomies_<?php echo str_replace("-", "_", $this->id); ?> = [{label: "Please wait", value: 0}]; |
|
2462 | + const sort_by_<?php echo str_replace("-", "_", $this->id); ?> = [{label: "Please wait", value: 0}]; |
|
2463 | 2463 | const MediaUpload = wp.blockEditor.MediaUpload; |
2464 | 2464 | |
2465 | 2465 | /** |
@@ -2474,20 +2474,20 @@ discard block |
||
2474 | 2474 | * @return {?WPBlock} The block, if it has been successfully |
2475 | 2475 | * registered; otherwise `undefined`. |
2476 | 2476 | */ |
2477 | - 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. |
|
2478 | - apiVersion: <?php echo isset($this->options['block-api-version']) ? absint($this->options['block-api-version']) : 2 ; ?>, |
|
2479 | - title: '<?php echo addslashes( $this->options['name'] ); ?>', // Block title. |
|
2480 | - description: '<?php echo addslashes( $this->options['widget_ops']['description'] )?>', // Block title. |
|
2481 | - 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/. |
|
2477 | + 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. |
|
2478 | + apiVersion: <?php echo isset($this->options['block-api-version']) ? absint($this->options['block-api-version']) : 2; ?>, |
|
2479 | + title: '<?php echo addslashes($this->options['name']); ?>', // Block title. |
|
2480 | + description: '<?php echo addslashes($this->options['widget_ops']['description'])?>', // Block title. |
|
2481 | + 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/. |
|
2482 | 2482 | supports: { |
2483 | 2483 | <?php |
2484 | - if ( isset( $this->options['block-supports'] ) ) { |
|
2485 | - echo $this->array_to_attributes( $this->options['block-supports'] ); |
|
2484 | + if (isset($this->options['block-supports'])) { |
|
2485 | + echo $this->array_to_attributes($this->options['block-supports']); |
|
2486 | 2486 | } |
2487 | 2487 | ?> |
2488 | 2488 | }, |
2489 | 2489 | <?php |
2490 | - if ( isset( $this->options['block-label'] ) ) { |
|
2490 | + if (isset($this->options['block-label'])) { |
|
2491 | 2491 | ?> |
2492 | 2492 | __experimentalLabel( attributes, { context } ) { |
2493 | 2493 | return <?php echo $this->options['block-label']; ?>; |
@@ -2495,8 +2495,8 @@ discard block |
||
2495 | 2495 | <?php |
2496 | 2496 | } |
2497 | 2497 | ?> |
2498 | - 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. |
|
2499 | - <?php if ( isset( $this->options['block-keywords'] ) ) { |
|
2498 | + 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. |
|
2499 | + <?php if (isset($this->options['block-keywords'])) { |
|
2500 | 2500 | echo "keywords : " . $this->options['block-keywords'] . ","; |
2501 | 2501 | |
2502 | 2502 | // // block hover preview. |
@@ -2523,11 +2523,11 @@ discard block |
||
2523 | 2523 | } |
2524 | 2524 | |
2525 | 2525 | // maybe set no_wrap |
2526 | - $no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false; |
|
2527 | - if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) { |
|
2526 | + $no_wrap = isset($this->options['no_wrap']) && $this->options['no_wrap'] ? true : false; |
|
2527 | + if (isset($this->arguments['no_wrap']) && $this->arguments['no_wrap']) { |
|
2528 | 2528 | $no_wrap = true; |
2529 | 2529 | } |
2530 | - if ( $no_wrap ) { |
|
2530 | + if ($no_wrap) { |
|
2531 | 2531 | $this->options['block-wrap'] = ''; |
2532 | 2532 | } |
2533 | 2533 | |
@@ -2541,10 +2541,10 @@ discard block |
||
2541 | 2541 | echo " html: false"; |
2542 | 2542 | echo "},";*/ |
2543 | 2543 | |
2544 | - if ( ! empty( $this->arguments ) ) { |
|
2544 | + if (!empty($this->arguments)) { |
|
2545 | 2545 | echo "attributes : {"; |
2546 | 2546 | |
2547 | - if ( $show_advanced ) { |
|
2547 | + if ($show_advanced) { |
|
2548 | 2548 | echo "show_advanced: {"; |
2549 | 2549 | echo " type: 'boolean',"; |
2550 | 2550 | echo " default: false,"; |
@@ -2552,56 +2552,56 @@ discard block |
||
2552 | 2552 | } |
2553 | 2553 | |
2554 | 2554 | // block wrap element |
2555 | - if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this? |
|
2555 | + if (!empty($this->options['block-wrap'])) { //@todo we should validate this? |
|
2556 | 2556 | echo "block_wrap: {"; |
2557 | 2557 | echo " type: 'string',"; |
2558 | - echo " default: '" . esc_attr( $this->options['block-wrap'] ) . "',"; |
|
2558 | + echo " default: '" . esc_attr($this->options['block-wrap']) . "',"; |
|
2559 | 2559 | echo "},"; |
2560 | 2560 | } |
2561 | 2561 | |
2562 | 2562 | |
2563 | 2563 | |
2564 | - foreach ( $this->arguments as $key => $args ) { |
|
2564 | + foreach ($this->arguments as $key => $args) { |
|
2565 | 2565 | |
2566 | - if( $args['type'] == 'image' || $args['type'] == 'images' ){ |
|
2566 | + if ($args['type'] == 'image' || $args['type'] == 'images') { |
|
2567 | 2567 | $img_drag_drop = true; |
2568 | 2568 | } |
2569 | 2569 | |
2570 | 2570 | // set if we should show alignment |
2571 | - if ( $key == 'alignment' ) { |
|
2571 | + if ($key == 'alignment') { |
|
2572 | 2572 | $show_alignment = true; |
2573 | 2573 | } |
2574 | 2574 | |
2575 | 2575 | $extra = ''; |
2576 | 2576 | |
2577 | - if ( $args['type'] == 'notice' || $args['type'] == 'tab' ) { |
|
2577 | + if ($args['type'] == 'notice' || $args['type'] == 'tab') { |
|
2578 | 2578 | continue; |
2579 | 2579 | } |
2580 | - elseif ( $args['type'] == 'checkbox' ) { |
|
2580 | + elseif ($args['type'] == 'checkbox') { |
|
2581 | 2581 | $type = 'boolean'; |
2582 | - $default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false'; |
|
2583 | - } elseif ( $args['type'] == 'number' ) { |
|
2582 | + $default = isset($args['default']) && $args['default'] ? 'true' : 'false'; |
|
2583 | + } elseif ($args['type'] == 'number') { |
|
2584 | 2584 | $type = 'number'; |
2585 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2586 | - } elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) { |
|
2585 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2586 | + } elseif ($args['type'] == 'select' && !empty($args['multiple'])) { |
|
2587 | 2587 | $type = 'array'; |
2588 | - if ( isset( $args['default'] ) && is_array( $args['default'] ) ) { |
|
2589 | - $default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]"; |
|
2588 | + if (isset($args['default']) && is_array($args['default'])) { |
|
2589 | + $default = !empty($args['default']) ? "['" . implode("','", $args['default']) . "']" : "[]"; |
|
2590 | 2590 | } else { |
2591 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2591 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2592 | 2592 | } |
2593 | - } elseif ( $args['type'] == 'tagselect' ) { |
|
2593 | + } elseif ($args['type'] == 'tagselect') { |
|
2594 | 2594 | $type = 'array'; |
2595 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2596 | - } elseif ( $args['type'] == 'multiselect' ) { |
|
2595 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2596 | + } elseif ($args['type'] == 'multiselect') { |
|
2597 | 2597 | $type = 'array'; |
2598 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2599 | - } elseif ( $args['type'] == 'image_xy' ) { |
|
2598 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2599 | + } elseif ($args['type'] == 'image_xy') { |
|
2600 | 2600 | $type = 'object'; |
2601 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2602 | - } elseif ( $args['type'] == 'image' ) { |
|
2601 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2602 | + } elseif ($args['type'] == 'image') { |
|
2603 | 2603 | $type = 'string'; |
2604 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2604 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2605 | 2605 | |
2606 | 2606 | // add a field for ID |
2607 | 2607 | // echo $key . "_id : {"; |
@@ -2613,7 +2613,7 @@ discard block |
||
2613 | 2613 | |
2614 | 2614 | } else { |
2615 | 2615 | $type = !empty($args['hidden_type']) ? esc_attr($args['hidden_type']) : 'string'; |
2616 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2616 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2617 | 2617 | |
2618 | 2618 | } |
2619 | 2619 | echo $key . " : {"; |
@@ -2637,7 +2637,7 @@ discard block |
||
2637 | 2637 | |
2638 | 2638 | <?php |
2639 | 2639 | // only include the drag/drop functions if required. |
2640 | -if( $img_drag_drop ){ |
|
2640 | +if ($img_drag_drop) { |
|
2641 | 2641 | |
2642 | 2642 | ?> |
2643 | 2643 | |
@@ -2703,9 +2703,9 @@ discard block |
||
2703 | 2703 | } |
2704 | 2704 | |
2705 | 2705 | <?php |
2706 | - if(!empty($this->options['block-edit-raw'])) { |
|
2706 | + if (!empty($this->options['block-edit-raw'])) { |
|
2707 | 2707 | echo $this->options['block-edit-raw']; // strings have to be in single quotes, may cause issues |
2708 | - }else{ |
|
2708 | + } else { |
|
2709 | 2709 | ?> |
2710 | 2710 | |
2711 | 2711 | function hasSelectedInnerBlock(props) { |
@@ -2729,7 +2729,7 @@ discard block |
||
2729 | 2729 | var $value = ''; |
2730 | 2730 | <?php |
2731 | 2731 | // if we have a post_type and a category then link them |
2732 | - if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){ |
|
2732 | + if (isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked'])) { |
|
2733 | 2733 | ?> |
2734 | 2734 | if(typeof(prev_attributes[props.clientId]) != 'undefined'){ |
2735 | 2735 | $pt = props.attributes.post_type; |
@@ -2744,9 +2744,9 @@ discard block |
||
2744 | 2744 | } |
2745 | 2745 | <?php |
2746 | 2746 | $cat_path = ''; |
2747 | - if ( ! empty( $this->arguments['post_type']['onchange_rest']['path'] ) ) { |
|
2748 | - $cat_path = esc_js( strip_tags( $this->arguments['post_type']['onchange_rest']['path'] ) ); |
|
2749 | - $cat_path = str_replace( array( '"', ''' ), array( '"', "'" ), $cat_path ); |
|
2747 | + if (!empty($this->arguments['post_type']['onchange_rest']['path'])) { |
|
2748 | + $cat_path = esc_js(strip_tags($this->arguments['post_type']['onchange_rest']['path'])); |
|
2749 | + $cat_path = str_replace(array('"', '''), array('"', "'"), $cat_path); |
|
2750 | 2750 | } |
2751 | 2751 | ?> |
2752 | 2752 | /* taxonomies */ |
@@ -2754,15 +2754,15 @@ discard block |
||
2754 | 2754 | if (!window.gdCPTCats) { |
2755 | 2755 | window.gdCPTCats = []; |
2756 | 2756 | } |
2757 | - var gdCatPath = "<?php echo ( ! empty( $cat_path ) ? $cat_path : "/wp/v2/" + $value + "/categories/?per_page=100" ); ?>"; |
|
2757 | + var gdCatPath = "<?php echo (!empty($cat_path) ? $cat_path : "/wp/v2/" +$value + "/categories/?per_page=100"); ?>"; |
|
2758 | 2758 | if (window.gdCPTCats[gdCatPath]) { |
2759 | 2759 | terms = window.gdCPTCats[gdCatPath]; |
2760 | - while (taxonomies_<?php echo str_replace("-","_", $this->id);?>.length) { |
|
2761 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.pop(); |
|
2760 | + while (taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.length) { |
|
2761 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.pop(); |
|
2762 | 2762 | } |
2763 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: "All", value: 0}); |
|
2763 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: "All", value: 0}); |
|
2764 | 2764 | jQuery.each( terms, function( key, val ) { |
2765 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: val.name, value: val.id}); |
|
2765 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val.name, value: val.id}); |
|
2766 | 2766 | }); |
2767 | 2767 | |
2768 | 2768 | /* Setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. */ |
@@ -2772,12 +2772,12 @@ discard block |
||
2772 | 2772 | } else { |
2773 | 2773 | wp.apiFetch({path: gdCatPath}).then(terms => { |
2774 | 2774 | window.gdCPTCats[gdCatPath] = terms; |
2775 | - while (taxonomies_<?php echo str_replace("-","_", $this->id);?>.length) { |
|
2776 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.pop(); |
|
2775 | + while (taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.length) { |
|
2776 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.pop(); |
|
2777 | 2777 | } |
2778 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: "All", value: 0}); |
|
2778 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: "All", value: 0}); |
|
2779 | 2779 | jQuery.each( terms, function( key, val ) { |
2780 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: val.name, value: val.id}); |
|
2780 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val.name, value: val.id}); |
|
2781 | 2781 | }); |
2782 | 2782 | |
2783 | 2783 | /* Setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. */ |
@@ -2785,7 +2785,7 @@ discard block |
||
2785 | 2785 | props.setAttributes({category: [0] }); |
2786 | 2786 | props.setAttributes({category: $old_cat_value }); |
2787 | 2787 | |
2788 | - return taxonomies_<?php echo str_replace("-","_", $this->id);?>; |
|
2788 | + return taxonomies_<?php echo str_replace("-", "_", $this->id); ?>; |
|
2789 | 2789 | }); |
2790 | 2790 | } |
2791 | 2791 | } |
@@ -2797,12 +2797,12 @@ discard block |
||
2797 | 2797 | } |
2798 | 2798 | if (window.gdCPTSort[$pt]) { |
2799 | 2799 | response = window.gdCPTSort[$pt]; |
2800 | - while (sort_by_<?php echo str_replace("-","_", $this->id);?>.length) { |
|
2801 | - sort_by_<?php echo str_replace("-","_", $this->id);?>.pop(); |
|
2800 | + while (sort_by_<?php echo str_replace("-", "_", $this->id); ?>.length) { |
|
2801 | + sort_by_<?php echo str_replace("-", "_", $this->id); ?>.pop(); |
|
2802 | 2802 | } |
2803 | 2803 | |
2804 | 2804 | jQuery.each( response, function( key, val ) { |
2805 | - sort_by_<?php echo str_replace("-","_", $this->id);?>.push({label: val, value: key}); |
|
2805 | + sort_by_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val, value: key}); |
|
2806 | 2806 | }); |
2807 | 2807 | |
2808 | 2808 | // setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. |
@@ -2817,12 +2817,12 @@ discard block |
||
2817 | 2817 | jQuery.post(ajaxurl, data, function(response) { |
2818 | 2818 | response = JSON.parse(response); |
2819 | 2819 | window.gdCPTSort[$pt] = response; |
2820 | - while (sort_by_<?php echo str_replace("-","_", $this->id);?>.length) { |
|
2821 | - sort_by_<?php echo str_replace("-","_", $this->id);?>.pop(); |
|
2820 | + while (sort_by_<?php echo str_replace("-", "_", $this->id); ?>.length) { |
|
2821 | + sort_by_<?php echo str_replace("-", "_", $this->id); ?>.pop(); |
|
2822 | 2822 | } |
2823 | 2823 | |
2824 | 2824 | jQuery.each( response, function( key, val ) { |
2825 | - sort_by_<?php echo str_replace("-","_", $this->id);?>.push({label: val, value: key}); |
|
2825 | + sort_by_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val, value: key}); |
|
2826 | 2826 | }); |
2827 | 2827 | |
2828 | 2828 | // setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. |
@@ -2830,7 +2830,7 @@ discard block |
||
2830 | 2830 | props.setAttributes({sort_by: [0] }); |
2831 | 2831 | props.setAttributes({sort_by: $old_sort_by_value }); |
2832 | 2832 | |
2833 | - return sort_by_<?php echo str_replace("-","_", $this->id);?>; |
|
2833 | + return sort_by_<?php echo str_replace("-", "_", $this->id); ?>; |
|
2834 | 2834 | }); |
2835 | 2835 | } |
2836 | 2836 | } |
@@ -2838,9 +2838,9 @@ discard block |
||
2838 | 2838 | <?php } ?> |
2839 | 2839 | <?php |
2840 | 2840 | $current_screen = function_exists('get_current_screen') ? get_current_screen() : ''; |
2841 | -if(!empty($current_screen->base) && $current_screen->base==='widgets'){ |
|
2841 | +if (!empty($current_screen->base) && $current_screen->base === 'widgets') { |
|
2842 | 2842 | echo 'const { deviceType } = "";'; |
2843 | -}else{ |
|
2843 | +} else { |
|
2844 | 2844 | ?> |
2845 | 2845 | /** Get device type const. */ |
2846 | 2846 | const { deviceType } = wp.data.useSelect != 'undefined' ? wp.data.useSelect(select => { |
@@ -2869,13 +2869,13 @@ discard block |
||
2869 | 2869 | |
2870 | 2870 | var data = { |
2871 | 2871 | 'action': 'super_duper_output_shortcode', |
2872 | - 'shortcode': '<?php echo $this->options['base_id'];?>', |
|
2872 | + 'shortcode': '<?php echo $this->options['base_id']; ?>', |
|
2873 | 2873 | 'attributes': props.attributes, |
2874 | 2874 | 'block_parent_name': parentBlocks.length ? parentBlocks[parentBlocks.length - 1].name : '', |
2875 | - 'post_id': <?php global $post; if ( isset( $post->ID ) ) { |
|
2875 | + 'post_id': <?php global $post; if (isset($post->ID)) { |
|
2876 | 2876 | echo $post->ID; |
2877 | - }else{echo '0';}?>, |
|
2878 | - '_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>' |
|
2877 | + } else {echo '0'; }?>, |
|
2878 | + '_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>' |
|
2879 | 2879 | }; |
2880 | 2880 | |
2881 | 2881 | jQuery.post(ajaxurl, data, function (response) { |
@@ -2884,17 +2884,17 @@ discard block |
||
2884 | 2884 | |
2885 | 2885 | // if the content is empty then we place some placeholder text |
2886 | 2886 | if (env == '') { |
2887 | - env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e( 'Placeholder for:', 'ayecode-connect' );?> " + props.name + "</div>"; |
|
2887 | + env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e('Placeholder for:', 'ayecode-connect'); ?> " + props.name + "</div>"; |
|
2888 | 2888 | } |
2889 | 2889 | |
2890 | 2890 | <?php |
2891 | - if(!empty($this->options['nested-block'])){ |
|
2891 | + if (!empty($this->options['nested-block'])) { |
|
2892 | 2892 | ?> |
2893 | 2893 | // props.setAttributes({content: env}); |
2894 | 2894 | is_fetching = false; |
2895 | 2895 | prev_attributes[props.clientId] = props.attributes; |
2896 | 2896 | <?php |
2897 | - }else{ |
|
2897 | + } else { |
|
2898 | 2898 | ?> |
2899 | 2899 | props.setAttributes({content: env}); |
2900 | 2900 | is_fetching = false; |
@@ -2919,8 +2919,8 @@ discard block |
||
2919 | 2919 | } |
2920 | 2920 | |
2921 | 2921 | <?php |
2922 | - if(!empty($this->options['block-edit-js'])) { |
|
2923 | - echo $this->options['block-edit-js'] ; // strings have to be in single quotes, may cause issues |
|
2922 | + if (!empty($this->options['block-edit-js'])) { |
|
2923 | + echo $this->options['block-edit-js']; // strings have to be in single quotes, may cause issues |
|
2924 | 2924 | } |
2925 | 2925 | |
2926 | 2926 | |
@@ -2933,7 +2933,7 @@ discard block |
||
2933 | 2933 | |
2934 | 2934 | el(wp.blockEditor.BlockControls, {key: 'controls'}, |
2935 | 2935 | |
2936 | - <?php if($show_alignment){?> |
|
2936 | + <?php if ($show_alignment) {?> |
|
2937 | 2937 | el( |
2938 | 2938 | wp.blockEditor.AlignmentToolbar, |
2939 | 2939 | { |
@@ -2951,9 +2951,9 @@ discard block |
||
2951 | 2951 | |
2952 | 2952 | <?php |
2953 | 2953 | |
2954 | - if(! empty( $this->arguments )){ |
|
2954 | + if (!empty($this->arguments)) { |
|
2955 | 2955 | |
2956 | - if ( $show_advanced ) { |
|
2956 | + if ($show_advanced) { |
|
2957 | 2957 | ?> |
2958 | 2958 | el('div', { |
2959 | 2959 | style: {'padding-left': '16px','padding-right': '16px'} |
@@ -2973,42 +2973,42 @@ discard block |
||
2973 | 2973 | <?php |
2974 | 2974 | } |
2975 | 2975 | |
2976 | - $arguments = $this->group_arguments( $this->arguments ); |
|
2977 | - $block_group_tabs = ! empty( $this->options['block_group_tabs'] ) ? $this->group_block_tabs( $this->options['block_group_tabs'], $arguments ) : array(); |
|
2976 | + $arguments = $this->group_arguments($this->arguments); |
|
2977 | + $block_group_tabs = !empty($this->options['block_group_tabs']) ? $this->group_block_tabs($this->options['block_group_tabs'], $arguments) : array(); |
|
2978 | 2978 | |
2979 | 2979 | // Do we have sections? |
2980 | 2980 | $has_sections = $arguments == $this->arguments ? false : true; |
2981 | 2981 | |
2982 | - if($has_sections){ |
|
2982 | + if ($has_sections) { |
|
2983 | 2983 | $panel_count = 0; |
2984 | 2984 | $open_tab = ''; |
2985 | 2985 | |
2986 | 2986 | $open_tab_groups = array(); |
2987 | 2987 | $used_tabs = array(); |
2988 | 2988 | |
2989 | - foreach ( $arguments as $key => $args ) { |
|
2989 | + foreach ($arguments as $key => $args) { |
|
2990 | 2990 | $close_tab = false; |
2991 | 2991 | $close_tabs = false; |
2992 | 2992 | |
2993 | - if ( ! empty( $block_group_tabs ) ) { |
|
2994 | - foreach ( $block_group_tabs as $tab_name => $tab_args ) { |
|
2995 | - if ( in_array( $key, $tab_args['groups'] ) ) { |
|
2993 | + if (!empty($block_group_tabs)) { |
|
2994 | + foreach ($block_group_tabs as $tab_name => $tab_args) { |
|
2995 | + if (in_array($key, $tab_args['groups'])) { |
|
2996 | 2996 | $open_tab_groups[] = $key; |
2997 | 2997 | |
2998 | - if ( $open_tab != $tab_name ) { |
|
2998 | + if ($open_tab != $tab_name) { |
|
2999 | 2999 | $tab_args['tab']['tabs_open'] = $open_tab == '' ? true : false; |
3000 | 3000 | $tab_args['tab']['open'] = true; |
3001 | 3001 | |
3002 | - $this->block_tab_start( '', $tab_args ); |
|
3002 | + $this->block_tab_start('', $tab_args); |
|
3003 | 3003 | $open_tab = $tab_name; |
3004 | 3004 | $used_tabs[] = $tab_name; |
3005 | 3005 | } |
3006 | 3006 | |
3007 | - if ( $open_tab_groups == $tab_args['groups'] ) { |
|
3007 | + if ($open_tab_groups == $tab_args['groups']) { |
|
3008 | 3008 | $close_tab = true; |
3009 | 3009 | $open_tab_groups = array(); |
3010 | 3010 | |
3011 | - if ( $used_tabs == array_keys( $block_group_tabs ) ) { |
|
3011 | + if ($used_tabs == array_keys($block_group_tabs)) { |
|
3012 | 3012 | $close_tabs = true; |
3013 | 3013 | } |
3014 | 3014 | } |
@@ -3017,27 +3017,27 @@ discard block |
||
3017 | 3017 | } |
3018 | 3018 | ?> |
3019 | 3019 | el(wp.components.PanelBody, { |
3020 | - title: '<?php esc_attr_e( $key ); ?>', |
|
3021 | - initialOpen: <?php if ( $panel_count ) { |
|
3020 | + title: '<?php esc_attr_e($key); ?>', |
|
3021 | + initialOpen: <?php if ($panel_count) { |
|
3022 | 3022 | echo "false"; |
3023 | 3023 | } else { |
3024 | 3024 | echo "true"; |
3025 | 3025 | }?> |
3026 | 3026 | }, |
3027 | 3027 | <?php |
3028 | - foreach ( $args as $k => $a ) { |
|
3029 | - $this->block_tab_start( $k, $a ); |
|
3030 | - $this->block_row_start( $k, $a ); |
|
3031 | - $this->build_block_arguments( $k, $a ); |
|
3032 | - $this->block_row_end( $k, $a ); |
|
3033 | - $this->block_tab_end( $k, $a ); |
|
3028 | + foreach ($args as $k => $a) { |
|
3029 | + $this->block_tab_start($k, $a); |
|
3030 | + $this->block_row_start($k, $a); |
|
3031 | + $this->build_block_arguments($k, $a); |
|
3032 | + $this->block_row_end($k, $a); |
|
3033 | + $this->block_tab_end($k, $a); |
|
3034 | 3034 | } |
3035 | 3035 | ?> |
3036 | 3036 | ), |
3037 | 3037 | <?php |
3038 | - $panel_count ++; |
|
3038 | + $panel_count++; |
|
3039 | 3039 | |
3040 | - if($close_tab || $close_tabs){ |
|
3040 | + if ($close_tab || $close_tabs) { |
|
3041 | 3041 | $tab_args = array( |
3042 | 3042 | 'tab' => array( |
3043 | 3043 | 'tabs_close' => $close_tabs, |
@@ -3045,24 +3045,24 @@ discard block |
||
3045 | 3045 | ) |
3046 | 3046 | |
3047 | 3047 | ); |
3048 | - $this->block_tab_end( '', $tab_args ); |
|
3048 | + $this->block_tab_end('', $tab_args); |
|
3049 | 3049 | // echo '###close'; print_r($tab_args); |
3050 | 3050 | $panel_count = 0; |
3051 | 3051 | } |
3052 | 3052 | // |
3053 | 3053 | |
3054 | 3054 | } |
3055 | - }else { |
|
3055 | + } else { |
|
3056 | 3056 | ?> |
3057 | 3057 | el(wp.components.PanelBody, { |
3058 | - title: '<?php esc_attr_e( "Settings", 'ayecode-connect' ); ?>', |
|
3058 | + title: '<?php esc_attr_e("Settings", 'ayecode-connect'); ?>', |
|
3059 | 3059 | initialOpen: true |
3060 | 3060 | }, |
3061 | 3061 | <?php |
3062 | - foreach ( $this->arguments as $key => $args ) { |
|
3063 | - $this->block_row_start( $key, $args ); |
|
3064 | - $this->build_block_arguments( $key, $args ); |
|
3065 | - $this->block_row_end( $key, $args ); |
|
3062 | + foreach ($this->arguments as $key => $args) { |
|
3063 | + $this->block_row_start($key, $args); |
|
3064 | + $this->build_block_arguments($key, $args); |
|
3065 | + $this->block_row_end($key, $args); |
|
3066 | 3066 | } |
3067 | 3067 | ?> |
3068 | 3068 | ), |
@@ -3076,11 +3076,11 @@ discard block |
||
3076 | 3076 | |
3077 | 3077 | <?php |
3078 | 3078 | // If the user sets block-output array then build it |
3079 | - if ( ! empty( $this->options['block-output'] ) ) { |
|
3080 | - $this->block_element( $this->options['block-output'] ); |
|
3081 | - }elseif(!empty($this->options['block-edit-return'])){ |
|
3079 | + if (!empty($this->options['block-output'])) { |
|
3080 | + $this->block_element($this->options['block-output']); |
|
3081 | + }elseif (!empty($this->options['block-edit-return'])) { |
|
3082 | 3082 | echo $this->options['block-edit-return']; |
3083 | - }else{ |
|
3083 | + } else { |
|
3084 | 3084 | // if no block-output is set then we try and get the shortcode html output via ajax. |
3085 | 3085 | $block_edit_wrap_tag = !empty($this->options['block_edit_wrap_tag']) ? esc_attr($this->options['block_edit_wrap_tag']) : 'div'; |
3086 | 3086 | ?> |
@@ -3106,22 +3106,22 @@ discard block |
||
3106 | 3106 | var align = ''; |
3107 | 3107 | |
3108 | 3108 | // build the shortcode. |
3109 | - var content = "[<?php echo $this->options['base_id'];?>"; |
|
3109 | + var content = "[<?php echo $this->options['base_id']; ?>"; |
|
3110 | 3110 | $html = ''; |
3111 | 3111 | <?php |
3112 | 3112 | |
3113 | - if(! empty( $this->arguments )){ |
|
3113 | + if (!empty($this->arguments)) { |
|
3114 | 3114 | |
3115 | - foreach($this->arguments as $key => $args){ |
|
3115 | + foreach ($this->arguments as $key => $args) { |
|
3116 | 3116 | // if($args['type']=='tabs'){continue;} |
3117 | 3117 | ?> |
3118 | - if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) { |
|
3119 | - if ('<?php echo esc_attr( $key );?>' == 'html') { |
|
3120 | - $html = attr.<?php echo esc_attr( $key );?>; |
|
3121 | - } else if ('<?php echo esc_attr( $args['type'] );?>' == 'image_xy') { |
|
3122 | - content += " <?php echo esc_attr( $key );?>='{x:" + attr.<?php echo esc_attr( $key );?>.x + ",y:"+attr.<?php echo esc_attr( $key );?>.y +"}' "; |
|
3118 | + if (attr.hasOwnProperty("<?php echo esc_attr($key); ?>")) { |
|
3119 | + if ('<?php echo esc_attr($key); ?>' == 'html') { |
|
3120 | + $html = attr.<?php echo esc_attr($key); ?>; |
|
3121 | + } else if ('<?php echo esc_attr($args['type']); ?>' == 'image_xy') { |
|
3122 | + content += " <?php echo esc_attr($key); ?>='{x:" + attr.<?php echo esc_attr($key); ?>.x + ",y:"+attr.<?php echo esc_attr($key); ?>.y +"}' "; |
|
3123 | 3123 | } else { |
3124 | - content += " <?php echo esc_attr( $key );?>='" + attr.<?php echo esc_attr( $key );?>.toString().replace('\'',''') + "' "; |
|
3124 | + content += " <?php echo esc_attr($key); ?>='" + attr.<?php echo esc_attr($key); ?>.toString().replace('\'',''') + "' "; |
|
3125 | 3125 | } |
3126 | 3126 | } |
3127 | 3127 | <?php |
@@ -3140,7 +3140,7 @@ discard block |
||
3140 | 3140 | ?> |
3141 | 3141 | // if has html element |
3142 | 3142 | if ($html) { |
3143 | - content += $html + "[/<?php echo $this->options['base_id'];?>]"; |
|
3143 | + content += $html + "[/<?php echo $this->options['base_id']; ?>]"; |
|
3144 | 3144 | } |
3145 | 3145 | |
3146 | 3146 | // @todo should we add inline style here or just css classes? |
@@ -3170,7 +3170,7 @@ discard block |
||
3170 | 3170 | // <x?php |
3171 | 3171 | // }else |
3172 | 3172 | |
3173 | - if(!empty($this->options['block-output'])){ |
|
3173 | + if (!empty($this->options['block-output'])) { |
|
3174 | 3174 | // echo "return"; |
3175 | 3175 | // $this->block_element( $this->options['block-output'], true ); |
3176 | 3176 | // echo ";"; |
@@ -3180,30 +3180,30 @@ discard block |
||
3180 | 3180 | '', |
3181 | 3181 | {}, |
3182 | 3182 | el('', {dangerouslySetInnerHTML: {__html: content}}), |
3183 | - <?php $this->block_element( $this->options['block-output'], true ); ?> |
|
3184 | - el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}}) |
|
3183 | + <?php $this->block_element($this->options['block-output'], true); ?> |
|
3184 | + el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id']; ?>]"}}) |
|
3185 | 3185 | ); |
3186 | 3186 | <?php |
3187 | 3187 | |
3188 | - }elseif(!empty($this->options['block-save-return'])){ |
|
3188 | + }elseif (!empty($this->options['block-save-return'])) { |
|
3189 | 3189 | echo 'return ' . $this->options['block-save-return']; |
3190 | - }elseif(!empty($this->options['nested-block'])){ |
|
3190 | + }elseif (!empty($this->options['nested-block'])) { |
|
3191 | 3191 | ?> |
3192 | 3192 | return el( |
3193 | 3193 | '', |
3194 | 3194 | {}, |
3195 | 3195 | el('', {dangerouslySetInnerHTML: {__html: content+"\n"}}), |
3196 | 3196 | InnerBlocks.Content ? el( InnerBlocks.Content ) : '', // @todo i think we need a comma here |
3197 | - el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}}) |
|
3197 | + el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id']; ?>]"}}) |
|
3198 | 3198 | ); |
3199 | 3199 | <?php |
3200 | - }elseif(!empty( $this->options['block-save-return'] ) ){ |
|
3201 | - echo "return ". $this->options['block-edit-return'].";"; |
|
3202 | - }elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){ |
|
3200 | + }elseif (!empty($this->options['block-save-return'])) { |
|
3201 | + echo "return " . $this->options['block-edit-return'] . ";"; |
|
3202 | + }elseif (isset($this->options['block-wrap']) && $this->options['block-wrap'] == '') { |
|
3203 | 3203 | ?> |
3204 | 3204 | return content; |
3205 | 3205 | <?php |
3206 | - }else{ |
|
3206 | + } else { |
|
3207 | 3207 | ?> |
3208 | 3208 | var block_wrap = 'div'; |
3209 | 3209 | if (attr.hasOwnProperty("block_wrap")) { |
@@ -3232,48 +3232,48 @@ discard block |
||
3232 | 3232 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
3233 | 3233 | */ |
3234 | 3234 | |
3235 | - return str_replace( array( |
|
3235 | + return str_replace(array( |
|
3236 | 3236 | '<script>', |
3237 | 3237 | '</script>' |
3238 | - ), '', $output ); |
|
3238 | + ), '', $output); |
|
3239 | 3239 | } |
3240 | 3240 | |
3241 | 3241 | |
3242 | 3242 | |
3243 | - public function block_row_start($key, $args){ |
|
3243 | + public function block_row_start($key, $args) { |
|
3244 | 3244 | |
3245 | 3245 | // check for row |
3246 | - if(!empty($args['row'])){ |
|
3246 | + if (!empty($args['row'])) { |
|
3247 | 3247 | |
3248 | - if(!empty($args['row']['open'])){ |
|
3248 | + if (!empty($args['row']['open'])) { |
|
3249 | 3249 | |
3250 | 3250 | // element require |
3251 | - $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : ""; |
|
3252 | - $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : ''; |
|
3253 | - $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; |
|
3251 | + $element_require = !empty($args['element_require']) ? $this->block_props_replace($args['element_require'], true) . " && " : ""; |
|
3252 | + $device_type = !empty($args['device_type']) ? esc_attr($args['device_type']) : ''; |
|
3253 | + $device_type_require = !empty($args['device_type']) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; |
|
3254 | 3254 | $device_type_icon = ''; |
3255 | - if($device_type=='Desktop'){ |
|
3255 | + if ($device_type == 'Desktop') { |
|
3256 | 3256 | $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
3257 | - }elseif($device_type=='Tablet'){ |
|
3257 | + }elseif ($device_type == 'Tablet') { |
|
3258 | 3258 | $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
3259 | - }elseif($device_type=='Mobile'){ |
|
3259 | + }elseif ($device_type == 'Mobile') { |
|
3260 | 3260 | $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
3261 | 3261 | } |
3262 | 3262 | echo $element_require; |
3263 | 3263 | echo $device_type_require; |
3264 | 3264 | |
3265 | - if(false){?><script><?php }?> |
|
3265 | + if (false) {?><script><?php }?> |
|
3266 | 3266 | el('div', { |
3267 | 3267 | className: 'bsui components-base-control', |
3268 | 3268 | }, |
3269 | - <?php if(!empty($args['row']['title'])){ ?> |
|
3269 | + <?php if (!empty($args['row']['title'])) { ?> |
|
3270 | 3270 | el('label', { |
3271 | 3271 | className: 'components-base-control__label position-relative', |
3272 | 3272 | style: {width:"100%"} |
3273 | 3273 | }, |
3274 | - el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes( $args['row']['title'] ) ?>'}}), |
|
3275 | - <?php if($device_type_icon){ ?> |
|
3276 | - 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)"}}) |
|
3274 | + el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes($args['row']['title']) ?>'}}), |
|
3275 | + <?php if ($device_type_icon) { ?> |
|
3276 | + 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)"}}) |
|
3277 | 3277 | <?php |
3278 | 3278 | } |
3279 | 3279 | ?> |
@@ -3281,17 +3281,17 @@ discard block |
||
3281 | 3281 | |
3282 | 3282 | ), |
3283 | 3283 | <?php }?> |
3284 | - <?php if(!empty($args['row']['desc'])){ ?> |
|
3284 | + <?php if (!empty($args['row']['desc'])) { ?> |
|
3285 | 3285 | el('p', { |
3286 | 3286 | className: 'components-base-control__help mb-0', |
3287 | 3287 | }, |
3288 | - '<?php echo addslashes( $args['row']['desc'] ); ?>' |
|
3288 | + '<?php echo addslashes($args['row']['desc']); ?>' |
|
3289 | 3289 | ), |
3290 | 3290 | <?php }?> |
3291 | 3291 | el( |
3292 | 3292 | 'div', |
3293 | 3293 | { |
3294 | - className: 'row mb-n2 <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>', |
|
3294 | + className: 'row mb-n2 <?php if (!empty($args['row']['class'])) { echo esc_attr($args['row']['class']); } ?>', |
|
3295 | 3295 | }, |
3296 | 3296 | el( |
3297 | 3297 | 'div', |
@@ -3300,36 +3300,36 @@ discard block |
||
3300 | 3300 | }, |
3301 | 3301 | |
3302 | 3302 | <?php |
3303 | - if(false){?></script><?php } |
|
3304 | - }elseif(!empty($args['row']['close'])){ |
|
3305 | - if(false){?><script><?php }?> |
|
3303 | + if (false) {?></script><?php } |
|
3304 | + }elseif (!empty($args['row']['close'])) { |
|
3305 | + if (false) {?><script><?php }?> |
|
3306 | 3306 | el( |
3307 | 3307 | 'div', |
3308 | 3308 | { |
3309 | 3309 | className: 'col pl-0 ps-0', |
3310 | 3310 | }, |
3311 | 3311 | <?php |
3312 | - if(false){?></script><?php } |
|
3313 | - }else{ |
|
3314 | - if(false){?><script><?php }?> |
|
3312 | + if (false) {?></script><?php } |
|
3313 | + } else { |
|
3314 | + if (false) {?><script><?php }?> |
|
3315 | 3315 | el( |
3316 | 3316 | 'div', |
3317 | 3317 | { |
3318 | 3318 | className: 'col pl-0 ps-0 pr-2 pe-2', |
3319 | 3319 | }, |
3320 | 3320 | <?php |
3321 | - if(false){?></script><?php } |
|
3321 | + if (false) {?></script><?php } |
|
3322 | 3322 | } |
3323 | 3323 | |
3324 | 3324 | } |
3325 | 3325 | |
3326 | 3326 | } |
3327 | 3327 | |
3328 | - public function block_row_end($key, $args){ |
|
3328 | + public function block_row_end($key, $args) { |
|
3329 | 3329 | |
3330 | - if(!empty($args['row'])){ |
|
3330 | + if (!empty($args['row'])) { |
|
3331 | 3331 | // maybe close |
3332 | - if(!empty($args['row']['close'])){ |
|
3332 | + if (!empty($args['row']['close'])) { |
|
3333 | 3333 | echo "))"; |
3334 | 3334 | } |
3335 | 3335 | |
@@ -3337,14 +3337,14 @@ discard block |
||
3337 | 3337 | } |
3338 | 3338 | } |
3339 | 3339 | |
3340 | - public function block_tab_start($key, $args){ |
|
3340 | + public function block_tab_start($key, $args) { |
|
3341 | 3341 | |
3342 | 3342 | // check for row |
3343 | - if(!empty($args['tab'])){ |
|
3343 | + if (!empty($args['tab'])) { |
|
3344 | 3344 | |
3345 | - if(!empty($args['tab']['tabs_open'])){ |
|
3345 | + if (!empty($args['tab']['tabs_open'])) { |
|
3346 | 3346 | |
3347 | - if(false){?><script><?php }?> |
|
3347 | + if (false) {?><script><?php }?> |
|
3348 | 3348 | |
3349 | 3349 | el('div',{className: 'bsui'}, |
3350 | 3350 | |
@@ -3353,81 +3353,81 @@ discard block |
||
3353 | 3353 | { |
3354 | 3354 | activeClass: 'is-active', |
3355 | 3355 | className: 'btn-groupx', |
3356 | - initialTabName: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>', |
|
3356 | + initialTabName: '<?php echo addslashes(esc_attr($args['tab']['key'])); ?>', |
|
3357 | 3357 | tabs: [ |
3358 | 3358 | |
3359 | 3359 | <?php |
3360 | - if(false){?></script><?php } |
|
3360 | + if (false) {?></script><?php } |
|
3361 | 3361 | } |
3362 | 3362 | |
3363 | - if(!empty($args['tab']['open'])){ |
|
3363 | + if (!empty($args['tab']['open'])) { |
|
3364 | 3364 | |
3365 | - if(false){?><script><?php }?> |
|
3365 | + if (false) {?><script><?php }?> |
|
3366 | 3366 | { |
3367 | - name: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>', |
|
3368 | - title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes( esc_attr( $args['tab']['title']) ); ?>'}}), |
|
3369 | - className: '<?php echo addslashes( esc_attr( $args['tab']['class']) ); ?>', |
|
3370 | - content: el('div',{}, <?php if(!empty($args['tab']['desc'])){ ?>el('p', { |
|
3367 | + name: '<?php echo addslashes(esc_attr($args['tab']['key'])); ?>', |
|
3368 | + title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes(esc_attr($args['tab']['title'])); ?>'}}), |
|
3369 | + className: '<?php echo addslashes(esc_attr($args['tab']['class'])); ?>', |
|
3370 | + content: el('div',{}, <?php if (!empty($args['tab']['desc'])) { ?>el('p', { |
|
3371 | 3371 | className: 'components-base-control__help mb-0', |
3372 | - dangerouslySetInnerHTML: {__html:'<?php echo addslashes( $args['tab']['desc'] ); ?>'} |
|
3372 | + dangerouslySetInnerHTML: {__html:'<?php echo addslashes($args['tab']['desc']); ?>'} |
|
3373 | 3373 | }),<?php } |
3374 | - if(false){?></script><?php } |
|
3374 | + if (false) {?></script><?php } |
|
3375 | 3375 | } |
3376 | 3376 | |
3377 | 3377 | } |
3378 | 3378 | |
3379 | 3379 | } |
3380 | 3380 | |
3381 | - public function block_tab_end($key, $args){ |
|
3381 | + public function block_tab_end($key, $args) { |
|
3382 | 3382 | |
3383 | - if(!empty($args['tab'])){ |
|
3383 | + if (!empty($args['tab'])) { |
|
3384 | 3384 | // maybe close |
3385 | - if(!empty($args['tab']['close'])){ |
|
3385 | + if (!empty($args['tab']['close'])) { |
|
3386 | 3386 | echo ")}, /* tab close */"; |
3387 | 3387 | } |
3388 | 3388 | |
3389 | - if(!empty($args['tab']['tabs_close'])){ |
|
3390 | - if(false){?><script><?php }?> |
|
3389 | + if (!empty($args['tab']['tabs_close'])) { |
|
3390 | + if (false) {?><script><?php }?> |
|
3391 | 3391 | ]}, ( tab ) => { |
3392 | 3392 | return tab.content; |
3393 | 3393 | } |
3394 | 3394 | )), /* tabs close */ |
3395 | - <?php if(false){ ?></script><?php } |
|
3395 | + <?php if (false) { ?></script><?php } |
|
3396 | 3396 | } |
3397 | 3397 | } |
3398 | 3398 | } |
3399 | 3399 | |
3400 | - public function build_block_arguments( $key, $args ) { |
|
3401 | - $custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : ''; |
|
3400 | + public function build_block_arguments($key, $args) { |
|
3401 | + $custom_attributes = !empty($args['custom_attributes']) ? $this->array_to_attributes($args['custom_attributes']) : ''; |
|
3402 | 3402 | $options = ''; |
3403 | 3403 | $extra = ''; |
3404 | 3404 | $require = ''; |
3405 | - $inside_elements = ''; |
|
3405 | + $inside_elements = ''; |
|
3406 | 3406 | $after_elements = ''; |
3407 | 3407 | |
3408 | 3408 | // `content` is a protected and special argument |
3409 | - if ( $key == 'content' ) { |
|
3409 | + if ($key == 'content') { |
|
3410 | 3410 | return; |
3411 | 3411 | } |
3412 | 3412 | |
3413 | - $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : ''; |
|
3414 | - $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; |
|
3413 | + $device_type = !empty($args['device_type']) ? esc_attr($args['device_type']) : ''; |
|
3414 | + $device_type_require = !empty($args['device_type']) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; |
|
3415 | 3415 | $device_type_icon = ''; |
3416 | - if($device_type=='Desktop'){ |
|
3416 | + if ($device_type == 'Desktop') { |
|
3417 | 3417 | $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
3418 | - }elseif($device_type=='Tablet'){ |
|
3418 | + }elseif ($device_type == 'Tablet') { |
|
3419 | 3419 | $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
3420 | - }elseif($device_type=='Mobile'){ |
|
3420 | + }elseif ($device_type == 'Mobile') { |
|
3421 | 3421 | $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
3422 | 3422 | } |
3423 | 3423 | |
3424 | 3424 | // icon |
3425 | 3425 | $icon = ''; |
3426 | - if( !empty( $args['icon'] ) ){ |
|
3426 | + if (!empty($args['icon'])) { |
|
3427 | 3427 | $icon .= "el('div', {"; |
3428 | - $icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},"; |
|
3428 | + $icon .= "dangerouslySetInnerHTML: {__html: '" . self::get_widget_icon(esc_attr($args['icon'])) . "'},"; |
|
3429 | 3429 | $icon .= "className: 'text-center',"; |
3430 | - $icon .= "title: '".addslashes( $args['title'] )."',"; |
|
3430 | + $icon .= "title: '" . addslashes($args['title']) . "',"; |
|
3431 | 3431 | $icon .= "}),"; |
3432 | 3432 | |
3433 | 3433 | // blank title as its added to the icon. |
@@ -3435,20 +3435,20 @@ discard block |
||
3435 | 3435 | } |
3436 | 3436 | |
3437 | 3437 | // require advanced |
3438 | - $require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : ""; |
|
3438 | + $require_advanced = !empty($args['advanced']) ? "props.attributes.show_advanced && " : ""; |
|
3439 | 3439 | |
3440 | 3440 | // element require |
3441 | - $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : ""; |
|
3441 | + $element_require = !empty($args['element_require']) ? $this->block_props_replace($args['element_require'], true) . " && " : ""; |
|
3442 | 3442 | |
3443 | 3443 | |
3444 | 3444 | $onchange = "props.setAttributes({ $key: $key } )"; |
3445 | - $onchangecomplete = ""; |
|
3445 | + $onchangecomplete = ""; |
|
3446 | 3446 | $value = "props.attributes.$key"; |
3447 | - $text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' ); |
|
3448 | - if ( in_array( $args['type'], $text_type ) ) { |
|
3447 | + $text_type = array('text', 'password', 'number', 'email', 'tel', 'url', 'colorx', 'range'); |
|
3448 | + if (in_array($args['type'], $text_type)) { |
|
3449 | 3449 | $type = 'TextControl'; |
3450 | 3450 | // Save numbers as numbers and not strings |
3451 | - if ( $args['type'] == 'number' ) { |
|
3451 | + if ($args['type'] == 'number') { |
|
3452 | 3452 | $onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )"; |
3453 | 3453 | } |
3454 | 3454 | } |
@@ -3469,12 +3469,12 @@ discard block |
||
3469 | 3469 | // |
3470 | 3470 | // $value = "props.attributes.$key ? props.attributes.$key : ''"; |
3471 | 3471 | // } |
3472 | - else if ( $args['type'] == 'styleid' ) { |
|
3472 | + else if ($args['type'] == 'styleid') { |
|
3473 | 3473 | $type = 'TextControl'; |
3474 | 3474 | $args['type'] == 'text'; |
3475 | 3475 | // Save numbers as numbers and not strings |
3476 | - $value = "props.attributes.$key ? props.attributes.$key : ''"; |
|
3477 | - }else if ( $args['type'] == 'notice' ) { |
|
3476 | + $value = "props.attributes.$key ? props.attributes.$key : ''"; |
|
3477 | + } else if ($args['type'] == 'notice') { |
|
3478 | 3478 | |
3479 | 3479 | $notice_message = !empty($args['desc']) ? addslashes($args['desc']) : ''; |
3480 | 3480 | $notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info'; |
@@ -3536,11 +3536,11 @@ discard block |
||
3536 | 3536 | return; |
3537 | 3537 | } |
3538 | 3538 | */ |
3539 | - elseif ( $args['type'] == 'color' ) { |
|
3539 | + elseif ($args['type'] == 'color') { |
|
3540 | 3540 | $type = 'ColorPicker'; |
3541 | 3541 | $onchange = ""; |
3542 | 3542 | $extra = "color: $value,"; |
3543 | - if(!empty($args['disable_alpha'])){ |
|
3543 | + if (!empty($args['disable_alpha'])) { |
|
3544 | 3544 | $extra .= "disableAlpha: true,"; |
3545 | 3545 | } |
3546 | 3546 | $onchangecomplete = "onChangeComplete: function($key) { |
@@ -3549,7 +3549,7 @@ discard block |
||
3549 | 3549 | $key: value |
3550 | 3550 | }); |
3551 | 3551 | },"; |
3552 | - }elseif ( $args['type'] == 'gradient' ) { |
|
3552 | + }elseif ($args['type'] == 'gradient') { |
|
3553 | 3553 | $type = 'GradientPicker'; |
3554 | 3554 | $extra .= "gradients: [{ |
3555 | 3555 | name: 'Vivid cyan blue to vivid purple', |
@@ -3588,11 +3588,11 @@ discard block |
||
3588 | 3588 | slug: 'cool-to-warm-spectrum', |
3589 | 3589 | }],"; |
3590 | 3590 | |
3591 | - }elseif ( $args['type'] == 'image' ) { |
|
3591 | + }elseif ($args['type'] == 'image') { |
|
3592 | 3592 | // print_r($args); |
3593 | 3593 | |
3594 | 3594 | $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,{ |
3595 | - url: props.attributes.{$key}_use_featured === true ? '".$this->get_url()."icons/placeholder.png' : props.attributes.$key, |
|
3595 | + url: props.attributes.{$key}_use_featured === true ? '" . $this->get_url() . "icons/placeholder.png' : props.attributes.$key, |
|
3596 | 3596 | value: props.attributes.{$key}_xy.x !== undefined && props.attributes.{$key}_xy.x >= 0 ? props.attributes.{$key}_xy : {x: 0.5,y: 0.5,}, |
3597 | 3597 | // value: props.attributes.{$key}_xy, |
3598 | 3598 | onChange: function(focalPoint){ |
@@ -3650,7 +3650,7 @@ discard block |
||
3650 | 3650 | $onchange = ""; |
3651 | 3651 | |
3652 | 3652 | //$inside_elements = ",el('div',{},'file upload')"; |
3653 | - } else if ( $args['type'] == 'images' ) { |
|
3653 | + } else if ($args['type'] == 'images') { |
|
3654 | 3654 | $img_preview = "props.attributes.$key && (function() { |
3655 | 3655 | let uploads = JSON.parse('['+props.attributes.$key+']'); |
3656 | 3656 | let images = []; |
@@ -3663,7 +3663,7 @@ discard block |
||
3663 | 3663 | el('i',{ |
3664 | 3664 | className: 'fas fa-times-circle text-danger position-absolute ml-n2 mt-n1 bg-white rounded-circle c-pointer', |
3665 | 3665 | onClick: function() { |
3666 | - aui_confirm('".esc_attr__('Are you sure?')."', '".esc_attr__('Delete')."', '".esc_attr__('Cancel')."', true).then(function(confirmed) { |
|
3666 | + aui_confirm('" . esc_attr__('Are you sure?') . "', '" . esc_attr__('Delete') . "', '" . esc_attr__('Cancel') . "', true).then(function(confirmed) { |
|
3667 | 3667 | if (confirmed) { |
3668 | 3668 | let new_uploads = JSON.parse('['+props.attributes.$key+']'); |
3669 | 3669 | new_uploads.splice(index, 1); |
@@ -3726,36 +3726,36 @@ discard block |
||
3726 | 3726 | |
3727 | 3727 | //$inside_elements = ",el('div',{},'file upload')"; |
3728 | 3728 | } |
3729 | - elseif ( $args['type'] == 'checkbox' ) { |
|
3729 | + elseif ($args['type'] == 'checkbox') { |
|
3730 | 3730 | $type = 'CheckboxControl'; |
3731 | 3731 | $extra .= "checked: props.attributes.$key,"; |
3732 | 3732 | $onchange = "props.setAttributes({ $key: ! props.attributes.$key } )"; |
3733 | - } elseif ( $args['type'] == 'textarea' ) { |
|
3733 | + } elseif ($args['type'] == 'textarea') { |
|
3734 | 3734 | $type = 'TextareaControl'; |
3735 | 3735 | |
3736 | - } elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) { |
|
3736 | + } elseif ($args['type'] == 'select' || $args['type'] == 'multiselect') { |
|
3737 | 3737 | $type = 'SelectControl'; |
3738 | 3738 | |
3739 | - if($args['name'] == 'category' && !empty($args['post_type_linked'])){ |
|
3740 | - $options .= "options: taxonomies_".str_replace("-","_", $this->id).","; |
|
3741 | - }elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){ |
|
3742 | - $options .= "options: sort_by_".str_replace("-","_", $this->id).","; |
|
3743 | - }else { |
|
3739 | + if ($args['name'] == 'category' && !empty($args['post_type_linked'])) { |
|
3740 | + $options .= "options: taxonomies_" . str_replace("-", "_", $this->id) . ","; |
|
3741 | + }elseif ($args['name'] == 'sort_by' && !empty($args['post_type_linked'])) { |
|
3742 | + $options .= "options: sort_by_" . str_replace("-", "_", $this->id) . ","; |
|
3743 | + } else { |
|
3744 | 3744 | |
3745 | - if ( ! empty( $args['options'] ) ) { |
|
3745 | + if (!empty($args['options'])) { |
|
3746 | 3746 | $options .= "options: ["; |
3747 | - foreach ( $args['options'] as $option_val => $option_label ) { |
|
3748 | - $options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . esc_js( addslashes( $option_label ) ) . "' },"; |
|
3747 | + foreach ($args['options'] as $option_val => $option_label) { |
|
3748 | + $options .= "{ value: '" . esc_attr($option_val) . "', label: '" . esc_js(addslashes($option_label)) . "' },"; |
|
3749 | 3749 | } |
3750 | 3750 | $options .= "],"; |
3751 | 3751 | } |
3752 | 3752 | } |
3753 | - if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550 |
|
3753 | + if (isset($args['multiple']) && $args['multiple']) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550 |
|
3754 | 3754 | $extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, '; |
3755 | 3755 | } |
3756 | 3756 | |
3757 | - if($args['type'] == 'multiselect' || ( isset( $args['multiple'] ) && $args['multiple'] ) ){ |
|
3758 | - $after_elements .= "props.attributes.$key && el( wp.components.Button, { |
|
3757 | + if ($args['type'] == 'multiselect' || (isset($args['multiple']) && $args['multiple'])) { |
|
3758 | + $after_elements .= "props.attributes.$key && el( wp.components.Button, { |
|
3759 | 3759 | className: 'components-button components-circular-option-picker__clear is-secondary is-small', |
3760 | 3760 | style: {margin:'-8px 0 8px 0',display: 'block'}, |
3761 | 3761 | onClick: function(){ |
@@ -3767,7 +3767,7 @@ discard block |
||
3767 | 3767 | 'Clear' |
3768 | 3768 | ),"; |
3769 | 3769 | } |
3770 | - } elseif ( $args['type'] == 'tagselect' ) { |
|
3770 | + } elseif ($args['type'] == 'tagselect') { |
|
3771 | 3771 | // $type = 'FormTokenField'; |
3772 | 3772 | // |
3773 | 3773 | // if ( ! empty( $args['options'] ) ) { |
@@ -3802,19 +3802,19 @@ discard block |
||
3802 | 3802 | // $value = "[]"; |
3803 | 3803 | // $extra .= ' __experimentalExpandOnFocus: true,'; |
3804 | 3804 | |
3805 | - } else if ( $args['type'] == 'alignment' ) { |
|
3805 | + } else if ($args['type'] == 'alignment') { |
|
3806 | 3806 | $type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example |
3807 | - } else if ( $args['type'] == 'margins' ) { |
|
3807 | + } else if ($args['type'] == 'margins') { |
|
3808 | 3808 | |
3809 | - } else if ( $args['type'] == 'visibility_conditions' && ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) ) { |
|
3809 | + } else if ($args['type'] == 'visibility_conditions' && (function_exists('wp_is_block_theme') && wp_is_block_theme())) { |
|
3810 | 3810 | $type = 'TextControl'; |
3811 | 3811 | $value = "(props.attributes.$key ? props.attributes.$key : '')"; |
3812 | 3812 | $args['type'] = 'text'; |
3813 | 3813 | $options .= 'disabled:true,'; |
3814 | - $bsvc_title = esc_attr( addslashes( $args['title'] ) ); |
|
3815 | - $bsvc_body = $this->block_visibility_fields( $args ); |
|
3814 | + $bsvc_title = esc_attr(addslashes($args['title'])); |
|
3815 | + $bsvc_body = $this->block_visibility_fields($args); |
|
3816 | 3816 | // @TODO reset button |
3817 | - $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>'; |
|
3817 | + $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>'; |
|
3818 | 3818 | $after_elements .= "el('div', {className: 'components-base-control bs-vc-button-wrap'}, el(wp.components.Button, { |
3819 | 3819 | className: 'components-button components-circular-option-picker__clear is-primary is-smallx', |
3820 | 3820 | onClick: function() { |
@@ -3833,25 +3833,25 @@ discard block |
||
3833 | 3833 | jQuery('.bs-vc-modal-form').trigger('change'); |
3834 | 3834 | } |
3835 | 3835 | }); |
3836 | - aui_modal('" . $bsvc_title . "', '" . addslashes( $bsvc_body ) . "', '" . $bsvc_footer . "', true, 'bs-vc-modal', 'modal-lg', ''); |
|
3836 | + aui_modal('" . $bsvc_title . "', '" . addslashes($bsvc_body) . "', '" . $bsvc_footer . "', true, 'bs-vc-modal', 'modal-lg', ''); |
|
3837 | 3837 | jQuery(document).off('change', '#bsvc_raw_value').on('change', '#bsvc_raw_value', function(e) { |
3838 | 3838 | props.setAttributes({" . $key . ": e.target.value}); |
3839 | 3839 | }); |
3840 | 3840 | } |
3841 | 3841 | }, |
3842 | - '" . addslashes( ! empty( $args['button_title'] ) ? $args['button_title'] : $args['title'] ) . "' |
|
3842 | + '" . addslashes(!empty($args['button_title']) ? $args['button_title'] : $args['title']) . "' |
|
3843 | 3843 | ) ),"; |
3844 | 3844 | } else { |
3845 | - return;// if we have not implemented the control then don't break the JS. |
|
3845 | + return; // if we have not implemented the control then don't break the JS. |
|
3846 | 3846 | } |
3847 | 3847 | |
3848 | 3848 | // color input does not show the labels so we add them |
3849 | - if($args['type']=='color'){ |
|
3849 | + if ($args['type'] == 'color') { |
|
3850 | 3850 | // add show only if advanced |
3851 | 3851 | echo $require_advanced; |
3852 | 3852 | // add setting require if defined |
3853 | 3853 | echo $element_require; |
3854 | - echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),"; |
|
3854 | + echo "el('div', {style: {'marginBottom': '8px'}}, '" . addslashes($args['title']) . "'),"; |
|
3855 | 3855 | } |
3856 | 3856 | |
3857 | 3857 | // add show only if advanced |
@@ -3863,22 +3863,22 @@ discard block |
||
3863 | 3863 | // icon |
3864 | 3864 | echo $icon; |
3865 | 3865 | ?> |
3866 | - el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type : "wp.components.".$type; ?>, { |
|
3867 | - 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 |
|
3868 | - } else { ?>'<?php echo addslashes( trim( esc_html( $args['title'] ) ) ); ?>'<?php } ?>, |
|
3869 | - help: <?php echo ( isset( $args['desc'] ) ? "el('span', {dangerouslySetInnerHTML: {__html: '" . trim( wp_kses_post( addslashes( $args['desc'] ) ) ) . "'}})" : "''" ); ?>, |
|
3866 | + el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type : "wp.components." . $type; ?>, { |
|
3867 | + 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 |
|
3868 | + } else { ?>'<?php echo addslashes(trim(esc_html($args['title']))); ?>'<?php } ?>, |
|
3869 | + help: <?php echo (isset($args['desc']) ? "el('span', {dangerouslySetInnerHTML: {__html: '" . trim(wp_kses_post(addslashes($args['desc']))) . "'}})" : "''"); ?>, |
|
3870 | 3870 | value: <?php echo $value; ?>, |
3871 | - <?php if ( $type == 'TextControl' && $args['type'] != 'text' ) { |
|
3872 | - echo "type: '" . addslashes( $args['type'] ) . "',"; |
|
3871 | + <?php if ($type == 'TextControl' && $args['type'] != 'text') { |
|
3872 | + echo "type: '" . addslashes($args['type']) . "',"; |
|
3873 | 3873 | } ?> |
3874 | - <?php if ( ! empty( $args['placeholder'] ) ) { |
|
3875 | - echo "placeholder: '" . esc_js( addslashes( trim( esc_html( $args['placeholder'] ) ) ) ) . "',"; |
|
3874 | + <?php if (!empty($args['placeholder'])) { |
|
3875 | + echo "placeholder: '" . esc_js(addslashes(trim(esc_html($args['placeholder'])))) . "',"; |
|
3876 | 3876 | } ?> |
3877 | 3877 | <?php echo $options; ?> |
3878 | 3878 | <?php echo $extra; ?> |
3879 | 3879 | <?php echo $custom_attributes; ?> |
3880 | 3880 | <?php echo $onchangecomplete; ?> |
3881 | - <?php if ( $onchange ) { ?> |
|
3881 | + <?php if ($onchange) { ?> |
|
3882 | 3882 | onChange: function ( <?php echo $key; ?> ) { |
3883 | 3883 | <?php echo $onchange; ?> |
3884 | 3884 | } |
@@ -3897,15 +3897,15 @@ discard block |
||
3897 | 3897 | *@todo there is prob a faster way to do this, also we could add some validation here. |
3898 | 3898 | * |
3899 | 3899 | */ |
3900 | - public function array_to_attributes( $custom_attributes, $html = false ) { |
|
3900 | + public function array_to_attributes($custom_attributes, $html = false) { |
|
3901 | 3901 | $attributes = ''; |
3902 | - if ( ! empty( $custom_attributes ) ) { |
|
3902 | + if (!empty($custom_attributes)) { |
|
3903 | 3903 | |
3904 | - foreach ( $custom_attributes as $key => $val ) { |
|
3905 | - if(is_array($val)){ |
|
3906 | - $attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},'; |
|
3907 | - }else{ |
|
3908 | - $attributes .= $html ? " $key='$val' " : "'$key': '$val',"; |
|
3904 | + foreach ($custom_attributes as $key => $val) { |
|
3905 | + if (is_array($val)) { |
|
3906 | + $attributes .= $key . ': {' . $this->array_to_attributes($val, $html) . '},'; |
|
3907 | + } else { |
|
3908 | + $attributes .= $html ? " $key='$val' " : "'$key': '$val',"; |
|
3909 | 3909 | } |
3910 | 3910 | } |
3911 | 3911 | |
@@ -3923,112 +3923,112 @@ discard block |
||
3923 | 3923 | * |
3924 | 3924 | * @param $args |
3925 | 3925 | */ |
3926 | - public function block_element( $args, $save = false ) { |
|
3926 | + public function block_element($args, $save = false) { |
|
3927 | 3927 | |
3928 | 3928 | |
3929 | - if ( ! empty( $args ) ) { |
|
3930 | - foreach ( $args as $element => $new_args ) { |
|
3929 | + if (!empty($args)) { |
|
3930 | + foreach ($args as $element => $new_args) { |
|
3931 | 3931 | |
3932 | - if ( is_array( $new_args ) ) { // its an element |
|
3932 | + if (is_array($new_args)) { // its an element |
|
3933 | 3933 | |
3934 | 3934 | |
3935 | - if ( isset( $new_args['element'] ) ) { |
|
3935 | + if (isset($new_args['element'])) { |
|
3936 | 3936 | |
3937 | - if ( isset( $new_args['element_require'] ) ) { |
|
3938 | - echo str_replace( array( |
|
3937 | + if (isset($new_args['element_require'])) { |
|
3938 | + echo str_replace(array( |
|
3939 | 3939 | "'+", |
3940 | 3940 | "+'" |
3941 | - ), '', $this->block_props_replace( $new_args['element_require'] ) ) . " && "; |
|
3942 | - unset( $new_args['element_require'] ); |
|
3941 | + ), '', $this->block_props_replace($new_args['element_require'])) . " && "; |
|
3942 | + unset($new_args['element_require']); |
|
3943 | 3943 | } |
3944 | 3944 | |
3945 | - if($new_args['element']=='InnerBlocks'){ |
|
3945 | + if ($new_args['element'] == 'InnerBlocks') { |
|
3946 | 3946 | echo "\n el( InnerBlocks, {"; |
3947 | - }elseif($new_args['element']=='innerBlocksProps'){ |
|
3947 | + }elseif ($new_args['element'] == 'innerBlocksProps') { |
|
3948 | 3948 | $element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div'; |
3949 | 3949 | // echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {"; |
3950 | 3950 | // echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( "; |
3951 | 3951 | echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( "; |
3952 | 3952 | echo $save ? "wp.blockEditor.useBlockProps.save( {" : "wp.blockEditor.useBlockProps( {"; |
3953 | - echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : ''; |
|
3953 | + echo !empty($new_args['blockProps']) ? $this->block_element($new_args['blockProps'], $save) : ''; |
|
3954 | 3954 | |
3955 | 3955 | echo "} ), {"; |
3956 | - echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element( $new_args['innerBlocksProps'],$save ) : ''; |
|
3956 | + echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element($new_args['innerBlocksProps'], $save) : ''; |
|
3957 | 3957 | // echo '###'; |
3958 | 3958 | |
3959 | 3959 | // echo '###'; |
3960 | - }elseif($new_args['element']=='BlocksProps'){ |
|
3960 | + }elseif ($new_args['element'] == 'BlocksProps') { |
|
3961 | 3961 | |
3962 | - if ( isset($new_args['if_inner_element']) ) { |
|
3962 | + if (isset($new_args['if_inner_element'])) { |
|
3963 | 3963 | $element = $new_args['if_inner_element']; |
3964 | - }else { |
|
3965 | - $element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'"; |
|
3964 | + } else { |
|
3965 | + $element = isset($new_args['inner_element']) ? "'" . esc_attr($new_args['inner_element']) . "'" : "'div'"; |
|
3966 | 3966 | } |
3967 | 3967 | |
3968 | 3968 | unset($new_args['inner_element']); |
3969 | 3969 | echo $save ? "\n el( $element, wp.blockEditor.useBlockProps.save( {" : "\n el( $element, wp.blockEditor.useBlockProps( {"; |
3970 | - echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : ''; |
|
3970 | + echo !empty($new_args['blockProps']) ? $this->block_element($new_args['blockProps'], $save) : ''; |
|
3971 | 3971 | |
3972 | 3972 | |
3973 | 3973 | // echo "} ),"; |
3974 | 3974 | |
3975 | - }else{ |
|
3975 | + } else { |
|
3976 | 3976 | echo "\n el( '" . $new_args['element'] . "', {"; |
3977 | 3977 | } |
3978 | 3978 | |
3979 | 3979 | |
3980 | 3980 | // get the attributes |
3981 | - foreach ( $new_args as $new_key => $new_value ) { |
|
3981 | + foreach ($new_args as $new_key => $new_value) { |
|
3982 | 3982 | |
3983 | 3983 | |
3984 | - if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) { |
|
3984 | + if ($new_key == 'element' || $new_key == 'content' || $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array($new_value)) { |
|
3985 | 3985 | // do nothing |
3986 | 3986 | } else { |
3987 | - echo $this->block_element( array( $new_key => $new_value ),$save ); |
|
3987 | + echo $this->block_element(array($new_key => $new_value), $save); |
|
3988 | 3988 | } |
3989 | 3989 | } |
3990 | 3990 | |
3991 | - echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes |
|
3991 | + echo $new_args['element'] == 'BlocksProps' ? '} ),' : "},"; // end attributes |
|
3992 | 3992 | |
3993 | 3993 | // get the content |
3994 | 3994 | $first_item = 0; |
3995 | - foreach ( $new_args as $new_key => $new_value ) { |
|
3996 | - if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) { |
|
3995 | + foreach ($new_args as $new_key => $new_value) { |
|
3996 | + if ($new_key === 'content' || $new_key === 'if_content' || is_array($new_value)) { |
|
3997 | 3997 | |
3998 | - if ( $new_key === 'content' ) { |
|
3999 | - echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'"; |
|
4000 | - }else if ( $new_key === 'if_content' ) { |
|
4001 | - echo $this->block_props_replace( $new_value ); |
|
3998 | + if ($new_key === 'content') { |
|
3999 | + echo "'" . $this->block_props_replace(wp_slash($new_value)) . "'"; |
|
4000 | + } else if ($new_key === 'if_content') { |
|
4001 | + echo $this->block_props_replace($new_value); |
|
4002 | 4002 | } |
4003 | 4003 | |
4004 | - if ( is_array( $new_value ) ) { |
|
4004 | + if (is_array($new_value)) { |
|
4005 | 4005 | |
4006 | - if ( isset( $new_value['element_require'] ) ) { |
|
4007 | - echo str_replace( array( |
|
4006 | + if (isset($new_value['element_require'])) { |
|
4007 | + echo str_replace(array( |
|
4008 | 4008 | "'+", |
4009 | 4009 | "+'" |
4010 | - ), '', $this->block_props_replace( $new_value['element_require'] ) ) . " && "; |
|
4011 | - unset( $new_value['element_require'] ); |
|
4010 | + ), '', $this->block_props_replace($new_value['element_require'])) . " && "; |
|
4011 | + unset($new_value['element_require']); |
|
4012 | 4012 | } |
4013 | 4013 | |
4014 | - if ( isset( $new_value['element_repeat'] ) ) { |
|
4014 | + if (isset($new_value['element_repeat'])) { |
|
4015 | 4015 | $x = 1; |
4016 | - while ( $x <= absint( $new_value['element_repeat'] ) ) { |
|
4017 | - $this->block_element( array( '' => $new_value ),$save ); |
|
4018 | - $x ++; |
|
4016 | + while ($x <= absint($new_value['element_repeat'])) { |
|
4017 | + $this->block_element(array('' => $new_value), $save); |
|
4018 | + $x++; |
|
4019 | 4019 | } |
4020 | 4020 | } else { |
4021 | - $this->block_element( array( '' => $new_value ),$save ); |
|
4021 | + $this->block_element(array('' => $new_value), $save); |
|
4022 | 4022 | } |
4023 | 4023 | } |
4024 | - $first_item ++; |
|
4024 | + $first_item++; |
|
4025 | 4025 | } |
4026 | 4026 | } |
4027 | 4027 | |
4028 | - if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){ |
|
4029 | - echo "))";// end content |
|
4030 | - }else{ |
|
4031 | - echo ")";// end content |
|
4028 | + if ($new_args['element'] == 'innerBlocksProps' || $new_args['element'] == 'xBlocksProps') { |
|
4029 | + echo "))"; // end content |
|
4030 | + } else { |
|
4031 | + echo ")"; // end content |
|
4032 | 4032 | } |
4033 | 4033 | |
4034 | 4034 | |
@@ -4037,26 +4037,26 @@ discard block |
||
4037 | 4037 | } |
4038 | 4038 | } else { |
4039 | 4039 | |
4040 | - if ( substr( $element, 0, 3 ) === "if_" ) { |
|
4040 | + if (substr($element, 0, 3) === "if_") { |
|
4041 | 4041 | $extra = ''; |
4042 | - if( strpos($new_args, '[%WrapClass%]') !== false ){ |
|
4043 | - $new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args); |
|
4044 | - $new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args); |
|
4042 | + if (strpos($new_args, '[%WrapClass%]') !== false) { |
|
4043 | + $new_args = str_replace('[%WrapClass%]"', '" + sd_build_aui_class(props.attributes)', $new_args); |
|
4044 | + $new_args = str_replace('[%WrapClass%]', '+ sd_build_aui_class(props.attributes)', $new_args); |
|
4045 | 4045 | } |
4046 | - echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ","; |
|
4047 | - } elseif ( $element == 'style' && strpos($new_args, '[%WrapStyle%]') !== false ) { |
|
4048 | - $new_args = str_replace('[%WrapStyle%]','',$new_args); |
|
4049 | - echo $element . ": {..." . $this->block_props_replace( $new_args ) . " , ...sd_build_aui_styles(props.attributes) },"; |
|
4046 | + echo str_replace("if_", "", $element) . ": " . $this->block_props_replace($new_args, true) . ","; |
|
4047 | + } elseif ($element == 'style' && strpos($new_args, '[%WrapStyle%]') !== false) { |
|
4048 | + $new_args = str_replace('[%WrapStyle%]', '', $new_args); |
|
4049 | + echo $element . ": {..." . $this->block_props_replace($new_args) . " , ...sd_build_aui_styles(props.attributes) },"; |
|
4050 | 4050 | // echo $element . ": " . $this->block_props_replace( $new_args ) . ","; |
4051 | - } elseif ( $element == 'style' ) { |
|
4052 | - echo $element . ": " . $this->block_props_replace( $new_args ) . ","; |
|
4053 | - } elseif ( ( $element == 'class' || $element == 'className' ) && strpos($new_args, '[%WrapClass%]') !== false ) { |
|
4054 | - $new_args = str_replace('[%WrapClass%]','',$new_args); |
|
4055 | - echo $element . ": '" . $this->block_props_replace( $new_args ) . "' + sd_build_aui_class(props.attributes),"; |
|
4056 | - } elseif ( $element == 'template' && $new_args ) { |
|
4051 | + } elseif ($element == 'style') { |
|
4052 | + echo $element . ": " . $this->block_props_replace($new_args) . ","; |
|
4053 | + } elseif (($element == 'class' || $element == 'className') && strpos($new_args, '[%WrapClass%]') !== false) { |
|
4054 | + $new_args = str_replace('[%WrapClass%]', '', $new_args); |
|
4055 | + echo $element . ": '" . $this->block_props_replace($new_args) . "' + sd_build_aui_class(props.attributes),"; |
|
4056 | + } elseif ($element == 'template' && $new_args) { |
|
4057 | 4057 | echo $element . ": $new_args,"; |
4058 | 4058 | } else { |
4059 | - echo $element . ": '" . $this->block_props_replace( $new_args ) . "',"; |
|
4059 | + echo $element . ": '" . $this->block_props_replace($new_args) . "',"; |
|
4060 | 4060 | } |
4061 | 4061 | |
4062 | 4062 | } |
@@ -4071,11 +4071,11 @@ discard block |
||
4071 | 4071 | * |
4072 | 4072 | * @return mixed |
4073 | 4073 | */ |
4074 | - public function block_props_replace( $string, $no_wrap = false ) { |
|
4075 | - if ( $no_wrap ) { |
|
4076 | - $string = str_replace( array( "[%", "%]", "%:checked]" ), array( "props.attributes.", "", "" ), $string ); |
|
4074 | + public function block_props_replace($string, $no_wrap = false) { |
|
4075 | + if ($no_wrap) { |
|
4076 | + $string = str_replace(array("[%", "%]", "%:checked]"), array("props.attributes.", "", ""), $string); |
|
4077 | 4077 | } else { |
4078 | - $string = str_replace( array( "![%", "[%", "%]", "%:checked]" ), array( "'+!props.attributes.", "'+props.attributes.", "+'", "+'" ), $string ); |
|
4078 | + $string = str_replace(array("![%", "[%", "%]", "%:checked]"), array("'+!props.attributes.", "'+props.attributes.", "+'", "+'"), $string); |
|
4079 | 4079 | } |
4080 | 4080 | |
4081 | 4081 | return $string; |
@@ -4087,65 +4087,65 @@ discard block |
||
4087 | 4087 | * @param array $args |
4088 | 4088 | * @param array $instance |
4089 | 4089 | */ |
4090 | - public function widget( $args, $instance ) { |
|
4091 | - if ( ! is_array( $args ) ) { |
|
4090 | + public function widget($args, $instance) { |
|
4091 | + if (!is_array($args)) { |
|
4092 | 4092 | $args = array(); |
4093 | 4093 | } |
4094 | 4094 | |
4095 | 4095 | // Get the filtered values |
4096 | - $argument_values = $this->argument_values( $instance ); |
|
4097 | - $argument_values = $this->string_to_bool( $argument_values ); |
|
4098 | - $output = $this->output( $argument_values, $args ); |
|
4096 | + $argument_values = $this->argument_values($instance); |
|
4097 | + $argument_values = $this->string_to_bool($argument_values); |
|
4098 | + $output = $this->output($argument_values, $args); |
|
4099 | 4099 | |
4100 | 4100 | $no_wrap = false; |
4101 | - if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) { |
|
4101 | + if (isset($argument_values['no_wrap']) && $argument_values['no_wrap']) { |
|
4102 | 4102 | $no_wrap = true; |
4103 | 4103 | } |
4104 | 4104 | |
4105 | 4105 | ob_start(); |
4106 | - if ( $output && ! $no_wrap ) { |
|
4106 | + if ($output && !$no_wrap) { |
|
4107 | 4107 | |
4108 | 4108 | $class_original = $this->options['widget_ops']['classname']; |
4109 | - $class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash(); |
|
4109 | + $class = $this->options['widget_ops']['classname'] . " sdel-" . $this->get_instance_hash(); |
|
4110 | 4110 | |
4111 | 4111 | // Before widget |
4112 | - $before_widget = ! empty( $args['before_widget'] ) ? $args['before_widget'] : ''; |
|
4113 | - $before_widget = $before_widget ? str_replace( $class_original, $class, $before_widget ) : $before_widget; |
|
4114 | - $before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this ); |
|
4115 | - $before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this ); |
|
4112 | + $before_widget = !empty($args['before_widget']) ? $args['before_widget'] : ''; |
|
4113 | + $before_widget = $before_widget ? str_replace($class_original, $class, $before_widget) : $before_widget; |
|
4114 | + $before_widget = apply_filters('wp_super_duper_before_widget', $before_widget, $args, $instance, $this); |
|
4115 | + $before_widget = apply_filters('wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this); |
|
4116 | 4116 | |
4117 | 4117 | // After widget |
4118 | - $after_widget = ! empty( $args['after_widget'] ) ? $args['after_widget'] : ''; |
|
4119 | - $after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this ); |
|
4120 | - $after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this ); |
|
4118 | + $after_widget = !empty($args['after_widget']) ? $args['after_widget'] : ''; |
|
4119 | + $after_widget = apply_filters('wp_super_duper_after_widget', $after_widget, $args, $instance, $this); |
|
4120 | + $after_widget = apply_filters('wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this); |
|
4121 | 4121 | |
4122 | 4122 | echo $before_widget; |
4123 | 4123 | // elementor strips the widget wrapping div so we check for and add it back if needed |
4124 | - if ( $this->is_elementor_widget_output() ) { |
|
4124 | + if ($this->is_elementor_widget_output()) { |
|
4125 | 4125 | // Filter class & attrs for elementor widget output. |
4126 | - $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this ); |
|
4127 | - $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this ); |
|
4126 | + $class = apply_filters('wp_super_duper_div_classname', $class, $args, $this); |
|
4127 | + $class = apply_filters('wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this); |
|
4128 | 4128 | |
4129 | - $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this ); |
|
4130 | - $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this ); |
|
4129 | + $attrs = apply_filters('wp_super_duper_div_attrs', '', $args, $this); |
|
4130 | + $attrs = apply_filters('wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this); |
|
4131 | 4131 | |
4132 | - echo "<span class='" . esc_attr( $class ) . "' " . $attrs . ">"; |
|
4132 | + echo "<span class='" . esc_attr($class) . "' " . $attrs . ">"; |
|
4133 | 4133 | } |
4134 | - echo $this->output_title( $args, $instance ); |
|
4134 | + echo $this->output_title($args, $instance); |
|
4135 | 4135 | echo $output; |
4136 | - if ( $this->is_elementor_widget_output() ) { |
|
4136 | + if ($this->is_elementor_widget_output()) { |
|
4137 | 4137 | echo "</span>"; |
4138 | 4138 | } |
4139 | 4139 | echo $after_widget; |
4140 | - } elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty |
|
4141 | - $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" ); |
|
4140 | + } elseif ($this->is_preview() && $output == '') {// if preview show a placeholder if empty |
|
4141 | + $output = $this->preview_placeholder_text("{{" . $this->base_id . "}}"); |
|
4142 | 4142 | echo $output; |
4143 | - } elseif ( $output && $no_wrap ) { |
|
4143 | + } elseif ($output && $no_wrap) { |
|
4144 | 4144 | echo $output; |
4145 | 4145 | } |
4146 | 4146 | $output = ob_get_clean(); |
4147 | 4147 | |
4148 | - $output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this ); |
|
4148 | + $output = apply_filters('wp_super_duper_widget_output', $output, $instance, $args, $this); |
|
4149 | 4149 | |
4150 | 4150 | echo $output; |
4151 | 4151 | } |
@@ -4158,7 +4158,7 @@ discard block |
||
4158 | 4158 | */ |
4159 | 4159 | public function is_elementor_widget_output() { |
4160 | 4160 | $result = false; |
4161 | - if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) { |
|
4161 | + if (defined('ELEMENTOR_VERSION') && isset($this->number) && $this->number == 'REPLACE_TO_ID') { |
|
4162 | 4162 | $result = true; |
4163 | 4163 | } |
4164 | 4164 | |
@@ -4173,7 +4173,7 @@ discard block |
||
4173 | 4173 | */ |
4174 | 4174 | public function is_elementor_preview() { |
4175 | 4175 | $result = false; |
4176 | - if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) { |
|
4176 | + if (isset($_REQUEST['elementor-preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor_ajax')) { |
|
4177 | 4177 | $result = true; |
4178 | 4178 | } |
4179 | 4179 | |
@@ -4188,7 +4188,7 @@ discard block |
||
4188 | 4188 | */ |
4189 | 4189 | public function is_divi_preview() { |
4190 | 4190 | $result = false; |
4191 | - if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) { |
|
4191 | + if (isset($_REQUEST['et_fb']) || isset($_REQUEST['et_pb_preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor')) { |
|
4192 | 4192 | $result = true; |
4193 | 4193 | } |
4194 | 4194 | |
@@ -4203,7 +4203,7 @@ discard block |
||
4203 | 4203 | */ |
4204 | 4204 | public function is_beaver_preview() { |
4205 | 4205 | $result = false; |
4206 | - if ( isset( $_REQUEST['fl_builder'] ) ) { |
|
4206 | + if (isset($_REQUEST['fl_builder'])) { |
|
4207 | 4207 | $result = true; |
4208 | 4208 | } |
4209 | 4209 | |
@@ -4218,7 +4218,7 @@ discard block |
||
4218 | 4218 | */ |
4219 | 4219 | public function is_siteorigin_preview() { |
4220 | 4220 | $result = false; |
4221 | - if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) { |
|
4221 | + if (!empty($_REQUEST['siteorigin_panels_live_editor'])) { |
|
4222 | 4222 | $result = true; |
4223 | 4223 | } |
4224 | 4224 | |
@@ -4233,7 +4233,7 @@ discard block |
||
4233 | 4233 | */ |
4234 | 4234 | public function is_cornerstone_preview() { |
4235 | 4235 | $result = false; |
4236 | - if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) { |
|
4236 | + if (!empty($_REQUEST['cornerstone_preview']) || basename($_SERVER['REQUEST_URI']) == 'cornerstone-endpoint') { |
|
4237 | 4237 | $result = true; |
4238 | 4238 | } |
4239 | 4239 | |
@@ -4248,7 +4248,7 @@ discard block |
||
4248 | 4248 | */ |
4249 | 4249 | public function is_fusion_preview() { |
4250 | 4250 | $result = false; |
4251 | - if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) { |
|
4251 | + if (!empty($_REQUEST['fb-edit']) || !empty($_REQUEST['fusion_load_nonce'])) { |
|
4252 | 4252 | $result = true; |
4253 | 4253 | } |
4254 | 4254 | |
@@ -4263,7 +4263,7 @@ discard block |
||
4263 | 4263 | */ |
4264 | 4264 | public function is_oxygen_preview() { |
4265 | 4265 | $result = false; |
4266 | - if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) { |
|
4266 | + if (!empty($_REQUEST['ct_builder']) || (!empty($_REQUEST['action']) && (substr($_REQUEST['action'], 0, 11) === "oxy_render_" || substr($_REQUEST['action'], 0, 10) === "ct_render_"))) { |
|
4267 | 4267 | $result = true; |
4268 | 4268 | } |
4269 | 4269 | |
@@ -4280,7 +4280,7 @@ discard block |
||
4280 | 4280 | public function is_kallyas_zion_preview() { |
4281 | 4281 | $result = false; |
4282 | 4282 | |
4283 | - if ( function_exists( 'znhg_kallyas_theme_config' ) && ! empty( $_REQUEST['zn_pb_edit'] ) ) { |
|
4283 | + if (function_exists('znhg_kallyas_theme_config') && !empty($_REQUEST['zn_pb_edit'])) { |
|
4284 | 4284 | $result = true; |
4285 | 4285 | } |
4286 | 4286 | |
@@ -4297,7 +4297,7 @@ discard block |
||
4297 | 4297 | public function is_bricks_preview() { |
4298 | 4298 | $result = false; |
4299 | 4299 | |
4300 | - if ( function_exists( 'bricks_is_builder' ) && ( bricks_is_builder() || bricks_is_builder_call() ) ) { |
|
4300 | + if (function_exists('bricks_is_builder') && (bricks_is_builder() || bricks_is_builder_call())) { |
|
4301 | 4301 | $result = true; |
4302 | 4302 | } |
4303 | 4303 | |
@@ -4312,25 +4312,25 @@ discard block |
||
4312 | 4312 | */ |
4313 | 4313 | public function is_preview() { |
4314 | 4314 | $preview = false; |
4315 | - if ( $this->is_divi_preview() ) { |
|
4315 | + if ($this->is_divi_preview()) { |
|
4316 | 4316 | $preview = true; |
4317 | - } elseif ( $this->is_elementor_preview() ) { |
|
4317 | + } elseif ($this->is_elementor_preview()) { |
|
4318 | 4318 | $preview = true; |
4319 | - } elseif ( $this->is_beaver_preview() ) { |
|
4319 | + } elseif ($this->is_beaver_preview()) { |
|
4320 | 4320 | $preview = true; |
4321 | - } elseif ( $this->is_siteorigin_preview() ) { |
|
4321 | + } elseif ($this->is_siteorigin_preview()) { |
|
4322 | 4322 | $preview = true; |
4323 | - } elseif ( $this->is_cornerstone_preview() ) { |
|
4323 | + } elseif ($this->is_cornerstone_preview()) { |
|
4324 | 4324 | $preview = true; |
4325 | - } elseif ( $this->is_fusion_preview() ) { |
|
4325 | + } elseif ($this->is_fusion_preview()) { |
|
4326 | 4326 | $preview = true; |
4327 | - } elseif ( $this->is_oxygen_preview() ) { |
|
4327 | + } elseif ($this->is_oxygen_preview()) { |
|
4328 | 4328 | $preview = true; |
4329 | - } elseif( $this->is_kallyas_zion_preview() ) { |
|
4329 | + } elseif ($this->is_kallyas_zion_preview()) { |
|
4330 | 4330 | $preview = true; |
4331 | - } elseif( $this->is_block_content_call() ) { |
|
4331 | + } elseif ($this->is_block_content_call()) { |
|
4332 | 4332 | $preview = true; |
4333 | - } elseif( $this->is_bricks_preview() ) { |
|
4333 | + } elseif ($this->is_bricks_preview()) { |
|
4334 | 4334 | $preview = true; |
4335 | 4335 | } |
4336 | 4336 | |
@@ -4345,34 +4345,34 @@ discard block |
||
4345 | 4345 | * |
4346 | 4346 | * @return string |
4347 | 4347 | */ |
4348 | - public function output_title( $args, $instance = array() ) { |
|
4348 | + public function output_title($args, $instance = array()) { |
|
4349 | 4349 | $output = ''; |
4350 | - if ( ! empty( $instance['title'] ) ) { |
|
4350 | + if (!empty($instance['title'])) { |
|
4351 | 4351 | /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ |
4352 | - $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); |
|
4352 | + $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); |
|
4353 | 4353 | |
4354 | - if(empty($instance['widget_title_tag'])){ |
|
4354 | + if (empty($instance['widget_title_tag'])) { |
|
4355 | 4355 | $output = $args['before_title'] . $title . $args['after_title']; |
4356 | - }else{ |
|
4357 | - $title_tag = esc_attr( $instance['widget_title_tag'] ); |
|
4356 | + } else { |
|
4357 | + $title_tag = esc_attr($instance['widget_title_tag']); |
|
4358 | 4358 | |
4359 | 4359 | // classes |
4360 | 4360 | $title_classes = array(); |
4361 | - $title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : ''; |
|
4362 | - $title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : ''; |
|
4363 | - $title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : ''; |
|
4364 | - $title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : ''; |
|
4365 | - $title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : ''; |
|
4366 | - $title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : ''; |
|
4367 | - $title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : ''; |
|
4368 | - $title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : ''; |
|
4369 | - $title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : ''; |
|
4370 | - $title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : ''; |
|
4371 | - $title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : ''; |
|
4372 | - $title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : ''; |
|
4373 | - $title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : ''; |
|
4374 | - |
|
4375 | - $class = !empty( $title_classes ) ? implode(" ",$title_classes) : ''; |
|
4361 | + $title_classes[] = !empty($instance['widget_title_size_class']) ? sanitize_html_class($instance['widget_title_size_class']) : ''; |
|
4362 | + $title_classes[] = !empty($instance['widget_title_align_class']) ? sanitize_html_class($instance['widget_title_align_class']) : ''; |
|
4363 | + $title_classes[] = !empty($instance['widget_title_color_class']) ? "text-" . sanitize_html_class($instance['widget_title_color_class']) : ''; |
|
4364 | + $title_classes[] = !empty($instance['widget_title_border_class']) ? sanitize_html_class($instance['widget_title_border_class']) : ''; |
|
4365 | + $title_classes[] = !empty($instance['widget_title_border_color_class']) ? "border-" . sanitize_html_class($instance['widget_title_border_color_class']) : ''; |
|
4366 | + $title_classes[] = !empty($instance['widget_title_mt_class']) ? "mt-" . absint($instance['widget_title_mt_class']) : ''; |
|
4367 | + $title_classes[] = !empty($instance['widget_title_mr_class']) ? "mr-" . absint($instance['widget_title_mr_class']) : ''; |
|
4368 | + $title_classes[] = !empty($instance['widget_title_mb_class']) ? "mb-" . absint($instance['widget_title_mb_class']) : ''; |
|
4369 | + $title_classes[] = !empty($instance['widget_title_ml_class']) ? "ml-" . absint($instance['widget_title_ml_class']) : ''; |
|
4370 | + $title_classes[] = !empty($instance['widget_title_pt_class']) ? "pt-" . absint($instance['widget_title_pt_class']) : ''; |
|
4371 | + $title_classes[] = !empty($instance['widget_title_pr_class']) ? "pr-" . absint($instance['widget_title_pr_class']) : ''; |
|
4372 | + $title_classes[] = !empty($instance['widget_title_pb_class']) ? "pb-" . absint($instance['widget_title_pb_class']) : ''; |
|
4373 | + $title_classes[] = !empty($instance['widget_title_pl_class']) ? "pl-" . absint($instance['widget_title_pl_class']) : ''; |
|
4374 | + |
|
4375 | + $class = !empty($title_classes) ? implode(" ", $title_classes) : ''; |
|
4376 | 4376 | $output = "<$title_tag class='$class' >$title</$title_tag>"; |
4377 | 4377 | } |
4378 | 4378 | |
@@ -4386,7 +4386,7 @@ discard block |
||
4386 | 4386 | * |
4387 | 4387 | * @param array $instance The widget options. |
4388 | 4388 | */ |
4389 | - public function form( $instance ) { |
|
4389 | + public function form($instance) { |
|
4390 | 4390 | |
4391 | 4391 | // set widget instance |
4392 | 4392 | $this->instance = $instance; |
@@ -4394,20 +4394,20 @@ discard block |
||
4394 | 4394 | // set it as a SD widget |
4395 | 4395 | echo $this->widget_advanced_toggle(); |
4396 | 4396 | |
4397 | - echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>"; |
|
4397 | + echo "<p>" . esc_attr($this->options['widget_ops']['description']) . "</p>"; |
|
4398 | 4398 | $arguments_raw = $this->get_arguments(); |
4399 | 4399 | |
4400 | - if ( is_array( $arguments_raw ) ) { |
|
4400 | + if (is_array($arguments_raw)) { |
|
4401 | 4401 | |
4402 | - $arguments = $this->group_arguments( $arguments_raw ); |
|
4402 | + $arguments = $this->group_arguments($arguments_raw); |
|
4403 | 4403 | |
4404 | 4404 | // Do we have sections? |
4405 | 4405 | $has_sections = $arguments == $arguments_raw ? false : true; |
4406 | 4406 | |
4407 | 4407 | |
4408 | - if ( $has_sections ) { |
|
4408 | + if ($has_sections) { |
|
4409 | 4409 | $panel_count = 0; |
4410 | - foreach ( $arguments as $key => $args ) { |
|
4410 | + foreach ($arguments as $key => $args) { |
|
4411 | 4411 | |
4412 | 4412 | ?> |
4413 | 4413 | <script> |
@@ -4417,26 +4417,26 @@ discard block |
||
4417 | 4417 | |
4418 | 4418 | $hide = $panel_count ? ' style="display:none;" ' : ''; |
4419 | 4419 | $icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down'; |
4420 | - 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>"; |
|
4421 | - echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>"; |
|
4420 | + 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>"; |
|
4421 | + echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes($key) . "' $hide>"; |
|
4422 | 4422 | |
4423 | - foreach ( $args as $k => $a ) { |
|
4423 | + foreach ($args as $k => $a) { |
|
4424 | 4424 | |
4425 | 4425 | $this->widget_inputs_row_start($k, $a); |
4426 | - $this->widget_inputs( $a, $instance ); |
|
4426 | + $this->widget_inputs($a, $instance); |
|
4427 | 4427 | $this->widget_inputs_row_end($k, $a); |
4428 | 4428 | |
4429 | 4429 | } |
4430 | 4430 | |
4431 | 4431 | echo "</div>"; |
4432 | 4432 | |
4433 | - $panel_count ++; |
|
4433 | + $panel_count++; |
|
4434 | 4434 | |
4435 | 4435 | } |
4436 | 4436 | } else { |
4437 | - foreach ( $arguments as $key => $args ) { |
|
4437 | + foreach ($arguments as $key => $args) { |
|
4438 | 4438 | $this->widget_inputs_row_start($key, $args); |
4439 | - $this->widget_inputs( $args, $instance ); |
|
4439 | + $this->widget_inputs($args, $instance); |
|
4440 | 4440 | $this->widget_inputs_row_end($key, $args); |
4441 | 4441 | } |
4442 | 4442 | } |
@@ -4444,28 +4444,28 @@ discard block |
||
4444 | 4444 | } |
4445 | 4445 | } |
4446 | 4446 | |
4447 | - public function widget_inputs_row_start( $key, $args ) { |
|
4448 | - if ( ! empty( $args['row'] ) ) { |
|
4447 | + public function widget_inputs_row_start($key, $args) { |
|
4448 | + if (!empty($args['row'])) { |
|
4449 | 4449 | // Maybe open |
4450 | - if ( ! empty( $args['row']['open'] ) ) { |
|
4450 | + if (!empty($args['row']['open'])) { |
|
4451 | 4451 | ?> |
4452 | - <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'] ) : '' ); ?>'> |
|
4453 | - <?php if ( ! empty( $args['row']['title'] ) ) { ?> |
|
4452 | + <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']) : ''); ?>'> |
|
4453 | + <?php if (!empty($args['row']['title'])) { ?> |
|
4454 | 4454 | <?php |
4455 | - if ( isset( $args['row']['icon'] ) ) { |
|
4455 | + if (isset($args['row']['icon'])) { |
|
4456 | 4456 | $args['row']['icon'] = ''; |
4457 | 4457 | } |
4458 | 4458 | |
4459 | - if ( ! isset( $args['row']['device_type'] ) && isset( $args['device_type'] ) ) { |
|
4459 | + if (!isset($args['row']['device_type']) && isset($args['device_type'])) { |
|
4460 | 4460 | $args['row']['device_type'] = $args['device_type']; |
4461 | 4461 | } |
4462 | 4462 | ?> |
4463 | - <label class="mb-0"><?php echo $this->widget_field_title( $args['row'] ); ?><?php echo $this->widget_field_desc( $args['row'] ); ?></label> |
|
4463 | + <label class="mb-0"><?php echo $this->widget_field_title($args['row']); ?><?php echo $this->widget_field_desc($args['row']); ?></label> |
|
4464 | 4464 | <?php } ?> |
4465 | - <div class='row<?php echo ( ! empty( $args['row']['class'] ) ? ' ' . esc_attr( $args['row']['class'] ) : '' ); ?>'> |
|
4465 | + <div class='row<?php echo (!empty($args['row']['class']) ? ' ' . esc_attr($args['row']['class']) : ''); ?>'> |
|
4466 | 4466 | <div class='col pr-2'> |
4467 | 4467 | <?php |
4468 | - } else if ( ! empty( $args['row']['close'] ) ) { |
|
4468 | + } else if (!empty($args['row']['close'])) { |
|
4469 | 4469 | echo "<div class='col pl-0 ps-0'>"; |
4470 | 4470 | } else { |
4471 | 4471 | echo "<div class='col pl-0 ps-0 pr-2 pe-2'>"; |
@@ -4473,10 +4473,10 @@ discard block |
||
4473 | 4473 | } |
4474 | 4474 | } |
4475 | 4475 | |
4476 | - public function widget_inputs_row_end( $key, $args ) { |
|
4477 | - if ( ! empty( $args['row'] ) ) { |
|
4476 | + public function widget_inputs_row_end($key, $args) { |
|
4477 | + if (!empty($args['row'])) { |
|
4478 | 4478 | // Maybe close |
4479 | - if ( ! empty( $args['row']['close'] ) ) { |
|
4479 | + if (!empty($args['row']['close'])) { |
|
4480 | 4480 | echo "</div></div>"; |
4481 | 4481 | } |
4482 | 4482 | echo "</div>"; |
@@ -4491,7 +4491,7 @@ discard block |
||
4491 | 4491 | public function widget_advanced_toggle() { |
4492 | 4492 | |
4493 | 4493 | $output = ''; |
4494 | - if ( $this->block_show_advanced() ) { |
|
4494 | + if ($this->block_show_advanced()) { |
|
4495 | 4495 | $val = 1; |
4496 | 4496 | } else { |
4497 | 4497 | $val = 0; |
@@ -4511,14 +4511,14 @@ discard block |
||
4511 | 4511 | *@since 1.0.0 |
4512 | 4512 | * |
4513 | 4513 | */ |
4514 | - public function convert_element_require( $input ) { |
|
4515 | - $input = str_replace( "'", '"', $input );// we only want double quotes |
|
4514 | + public function convert_element_require($input) { |
|
4515 | + $input = str_replace("'", '"', $input); // we only want double quotes |
|
4516 | 4516 | |
4517 | - $output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array( |
|
4517 | + $output = esc_attr(str_replace(array("[%", "%]", "%:checked]"), array( |
|
4518 | 4518 | "jQuery(form).find('[data-argument=\"", |
4519 | 4519 | "\"]').find('input,select,textarea').val()", |
4520 | 4520 | "\"]').find('input:checked').val()" |
4521 | - ), $input ) ); |
|
4521 | + ), $input)); |
|
4522 | 4522 | |
4523 | 4523 | return $output; |
4524 | 4524 | } |
@@ -4529,48 +4529,48 @@ discard block |
||
4529 | 4529 | * @param $args |
4530 | 4530 | * @param $instance |
4531 | 4531 | */ |
4532 | - public function widget_inputs( $args, $instance ) { |
|
4532 | + public function widget_inputs($args, $instance) { |
|
4533 | 4533 | |
4534 | 4534 | $class = ""; |
4535 | 4535 | $element_require = ""; |
4536 | 4536 | $custom_attributes = ""; |
4537 | 4537 | |
4538 | 4538 | // get value |
4539 | - if ( isset( $instance[ $args['name'] ] ) ) { |
|
4540 | - $value = $instance[ $args['name'] ]; |
|
4541 | - } elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) { |
|
4542 | - $value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] ); |
|
4539 | + if (isset($instance[$args['name']])) { |
|
4540 | + $value = $instance[$args['name']]; |
|
4541 | + } elseif (!isset($instance[$args['name']]) && !empty($args['default'])) { |
|
4542 | + $value = is_array($args['default']) ? array_map("esc_html", $args['default']) : esc_html($args['default']); |
|
4543 | 4543 | } else { |
4544 | 4544 | $value = ''; |
4545 | 4545 | } |
4546 | 4546 | |
4547 | 4547 | // get placeholder |
4548 | - if ( ! empty( $args['placeholder'] ) ) { |
|
4549 | - $placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'"; |
|
4548 | + if (!empty($args['placeholder'])) { |
|
4549 | + $placeholder = "placeholder='" . esc_html($args['placeholder']) . "'"; |
|
4550 | 4550 | } else { |
4551 | 4551 | $placeholder = ''; |
4552 | 4552 | } |
4553 | 4553 | |
4554 | 4554 | // get if advanced |
4555 | - if ( isset( $args['advanced'] ) && $args['advanced'] ) { |
|
4555 | + if (isset($args['advanced']) && $args['advanced']) { |
|
4556 | 4556 | $class .= " sd-advanced-setting "; |
4557 | 4557 | } |
4558 | 4558 | |
4559 | 4559 | // element_require |
4560 | - if ( isset( $args['element_require'] ) && $args['element_require'] ) { |
|
4560 | + if (isset($args['element_require']) && $args['element_require']) { |
|
4561 | 4561 | $element_require = $args['element_require']; |
4562 | 4562 | } |
4563 | 4563 | |
4564 | 4564 | // custom_attributes |
4565 | - if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) { |
|
4566 | - $custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true ); |
|
4565 | + if (isset($args['custom_attributes']) && $args['custom_attributes']) { |
|
4566 | + $custom_attributes = $this->array_to_attributes($args['custom_attributes'], true); |
|
4567 | 4567 | } |
4568 | 4568 | |
4569 | 4569 | // before wrapper |
4570 | 4570 | ?> |
4571 | - <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 );} ?>'> |
|
4571 | + <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); } ?>'> |
|
4572 | 4572 | <?php |
4573 | - switch ( $args['type'] ) { |
|
4573 | + switch ($args['type']) { |
|
4574 | 4574 | //array('text','password','number','email','tel','url','color') |
4575 | 4575 | case "text": |
4576 | 4576 | case "password": |
@@ -4580,33 +4580,33 @@ discard block |
||
4580 | 4580 | case "url": |
4581 | 4581 | case "color": |
4582 | 4582 | ?> |
4583 | - <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> |
|
4584 | - <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 ); ?>"> |
|
4583 | + <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> |
|
4584 | + <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); ?>"> |
|
4585 | 4585 | <?php |
4586 | 4586 | |
4587 | 4587 | break; |
4588 | 4588 | case "select": |
4589 | - $multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false; |
|
4590 | - if ( $multiple ) { |
|
4591 | - if ( empty( $value ) ) { |
|
4589 | + $multiple = isset($args['multiple']) && $args['multiple'] ? true : false; |
|
4590 | + if ($multiple) { |
|
4591 | + if (empty($value)) { |
|
4592 | 4592 | $value = array(); |
4593 | 4593 | } |
4594 | 4594 | } |
4595 | 4595 | ?> |
4596 | - <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> |
|
4597 | - <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 "[]"; } ?>" |
|
4598 | - <?php if ( $multiple ) { |
|
4596 | + <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> |
|
4597 | + <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 "[]"; } ?>" |
|
4598 | + <?php if ($multiple) { |
|
4599 | 4599 | echo "multiple"; |
4600 | 4600 | } //@todo not implemented yet due to gutenberg not supporting it |
4601 | 4601 | ?>> |
4602 | 4602 | <?php |
4603 | 4603 | |
4604 | - if ( ! empty( $args['options'] ) ) { |
|
4605 | - foreach ( $args['options'] as $val => $label ) { |
|
4606 | - if ( $multiple ) { |
|
4607 | - $selected = in_array( $val, $value ) ? 'selected="selected"' : ''; |
|
4604 | + if (!empty($args['options'])) { |
|
4605 | + foreach ($args['options'] as $val => $label) { |
|
4606 | + if ($multiple) { |
|
4607 | + $selected = in_array($val, $value) ? 'selected="selected"' : ''; |
|
4608 | 4608 | } else { |
4609 | - $selected = selected( $value, $val, false ); |
|
4609 | + $selected = selected($value, $val, false); |
|
4610 | 4610 | } |
4611 | 4611 | echo "<option value='$val' " . $selected . ">$label</option>"; |
4612 | 4612 | } |
@@ -4617,20 +4617,20 @@ discard block |
||
4617 | 4617 | break; |
4618 | 4618 | case "checkbox": |
4619 | 4619 | ?> |
4620 | - <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"> |
|
4621 | - <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> |
|
4620 | + <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"> |
|
4621 | + <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> |
|
4622 | 4622 | <?php |
4623 | 4623 | break; |
4624 | 4624 | case "textarea": |
4625 | 4625 | ?> |
4626 | - <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> |
|
4627 | - <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> |
|
4626 | + <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> |
|
4627 | + <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> |
|
4628 | 4628 | <?php |
4629 | 4629 | |
4630 | 4630 | break; |
4631 | 4631 | case "hidden": |
4632 | 4632 | ?> |
4633 | - <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 ); ?>"> |
|
4633 | + <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); ?>"> |
|
4634 | 4634 | <?php |
4635 | 4635 | break; |
4636 | 4636 | default: |
@@ -4640,15 +4640,15 @@ discard block |
||
4640 | 4640 | ?></p><?php |
4641 | 4641 | } |
4642 | 4642 | |
4643 | - public function get_widget_icon($icon = 'box-top', $title = ''){ |
|
4644 | - if($icon=='box-top'){ |
|
4645 | - 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>'; |
|
4646 | - }elseif($icon=='box-right'){ |
|
4647 | - 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>'; |
|
4648 | - }elseif($icon=='box-bottom'){ |
|
4649 | - 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>'; |
|
4650 | - }elseif($icon=='box-left'){ |
|
4651 | - 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>'; |
|
4643 | + public function get_widget_icon($icon = 'box-top', $title = '') { |
|
4644 | + if ($icon == 'box-top') { |
|
4645 | + 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>'; |
|
4646 | + }elseif ($icon == 'box-right') { |
|
4647 | + 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>'; |
|
4648 | + }elseif ($icon == 'box-bottom') { |
|
4649 | + 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>'; |
|
4650 | + }elseif ($icon == 'box-left') { |
|
4651 | + 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>'; |
|
4652 | 4652 | } |
4653 | 4653 | } |
4654 | 4654 | |
@@ -4660,14 +4660,14 @@ discard block |
||
4660 | 4660 | * @return string |
4661 | 4661 | * @todo, need to make its own tooltip script |
4662 | 4662 | */ |
4663 | - public function widget_field_desc( $args ) { |
|
4663 | + public function widget_field_desc($args) { |
|
4664 | 4664 | |
4665 | 4665 | $description = ''; |
4666 | - if ( isset( $args['desc'] ) && $args['desc'] ) { |
|
4667 | - if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) { |
|
4668 | - $description = $this->desc_tip( $args['desc'] ); |
|
4666 | + if (isset($args['desc']) && $args['desc']) { |
|
4667 | + if (isset($args['desc_tip']) && $args['desc_tip']) { |
|
4668 | + $description = $this->desc_tip($args['desc']); |
|
4669 | 4669 | } else { |
4670 | - $description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>'; |
|
4670 | + $description = '<span class="description">' . wp_kses_post($args['desc']) . '</span>'; |
|
4671 | 4671 | } |
4672 | 4672 | } |
4673 | 4673 | |
@@ -4681,18 +4681,18 @@ discard block |
||
4681 | 4681 | * |
4682 | 4682 | * @return string |
4683 | 4683 | */ |
4684 | - public function widget_field_title( $args ) { |
|
4684 | + public function widget_field_title($args) { |
|
4685 | 4685 | $title = ''; |
4686 | 4686 | |
4687 | - if ( isset( $args['title'] ) && $args['title'] ) { |
|
4688 | - if ( ! empty( $args['device_type'] ) ) { |
|
4687 | + if (isset($args['title']) && $args['title']) { |
|
4688 | + if (!empty($args['device_type'])) { |
|
4689 | 4689 | $args['title'] .= ' (' . $args['device_type'] . ')'; // Append device type to title. |
4690 | 4690 | } |
4691 | 4691 | |
4692 | - if ( isset( $args['icon'] ) && $args['icon'] ) { |
|
4693 | - $title = self::get_widget_icon( $args['icon'], $args['title'] ); |
|
4692 | + if (isset($args['icon']) && $args['icon']) { |
|
4693 | + $title = self::get_widget_icon($args['icon'], $args['title']); |
|
4694 | 4694 | } else { |
4695 | - $title = esc_attr( $args['title'] ); |
|
4695 | + $title = esc_attr($args['title']); |
|
4696 | 4696 | } |
4697 | 4697 | } |
4698 | 4698 | |
@@ -4707,11 +4707,11 @@ discard block |
||
4707 | 4707 | * |
4708 | 4708 | * @return string |
4709 | 4709 | */ |
4710 | - function desc_tip( $tip, $allow_html = false ) { |
|
4711 | - if ( $allow_html ) { |
|
4712 | - $tip = $this->sanitize_tooltip( $tip ); |
|
4710 | + function desc_tip($tip, $allow_html = false) { |
|
4711 | + if ($allow_html) { |
|
4712 | + $tip = $this->sanitize_tooltip($tip); |
|
4713 | 4713 | } else { |
4714 | - $tip = esc_attr( $tip ); |
|
4714 | + $tip = esc_attr($tip); |
|
4715 | 4715 | } |
4716 | 4716 | |
4717 | 4717 | return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>'; |
@@ -4724,8 +4724,8 @@ discard block |
||
4724 | 4724 | * |
4725 | 4725 | * @return string |
4726 | 4726 | */ |
4727 | - public function sanitize_tooltip( $var ) { |
|
4728 | - return htmlspecialchars( wp_kses( html_entity_decode( $var ), array( |
|
4727 | + public function sanitize_tooltip($var) { |
|
4728 | + return htmlspecialchars(wp_kses(html_entity_decode($var), array( |
|
4729 | 4729 | 'br' => array(), |
4730 | 4730 | 'em' => array(), |
4731 | 4731 | 'strong' => array(), |
@@ -4735,7 +4735,7 @@ discard block |
||
4735 | 4735 | 'li' => array(), |
4736 | 4736 | 'ol' => array(), |
4737 | 4737 | 'p' => array(), |
4738 | - ) ) ); |
|
4738 | + ))); |
|
4739 | 4739 | } |
4740 | 4740 | |
4741 | 4741 | /** |
@@ -4747,23 +4747,23 @@ discard block |
||
4747 | 4747 | * @return array |
4748 | 4748 | * @todo we should add some sanitation here. |
4749 | 4749 | */ |
4750 | - public function update( $new_instance, $old_instance ) { |
|
4750 | + public function update($new_instance, $old_instance) { |
|
4751 | 4751 | |
4752 | 4752 | //save the widget |
4753 | - $instance = array_merge( (array) $old_instance, (array) $new_instance ); |
|
4753 | + $instance = array_merge((array) $old_instance, (array) $new_instance); |
|
4754 | 4754 | |
4755 | 4755 | // set widget instance |
4756 | 4756 | $this->instance = $instance; |
4757 | 4757 | |
4758 | - if ( empty( $this->arguments ) ) { |
|
4758 | + if (empty($this->arguments)) { |
|
4759 | 4759 | $this->get_arguments(); |
4760 | 4760 | } |
4761 | 4761 | |
4762 | 4762 | // check for checkboxes |
4763 | - if ( ! empty( $this->arguments ) ) { |
|
4764 | - foreach ( $this->arguments as $argument ) { |
|
4765 | - if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) { |
|
4766 | - $instance[ $argument['name'] ] = '0'; |
|
4763 | + if (!empty($this->arguments)) { |
|
4764 | + foreach ($this->arguments as $argument) { |
|
4765 | + if (isset($argument['type']) && $argument['type'] == 'checkbox' && !isset($new_instance[$argument['name']])) { |
|
4766 | + $instance[$argument['name']] = '0'; |
|
4767 | 4767 | } |
4768 | 4768 | } |
4769 | 4769 | } |
@@ -4781,7 +4781,7 @@ discard block |
||
4781 | 4781 | */ |
4782 | 4782 | public function is_block_content_call() { |
4783 | 4783 | $result = false; |
4784 | - if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) { |
|
4784 | + if (wp_doing_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'super_duper_output_shortcode') { |
|
4785 | 4785 | $result = true; |
4786 | 4786 | } |
4787 | 4787 | |
@@ -4794,9 +4794,9 @@ discard block |
||
4794 | 4794 | * @return string |
4795 | 4795 | *@since 1.0.20 |
4796 | 4796 | */ |
4797 | - public function get_instance_hash(){ |
|
4798 | - $instance_string = $this->base_id.serialize($this->instance); |
|
4799 | - return hash('crc32b',$instance_string); |
|
4797 | + public function get_instance_hash() { |
|
4798 | + $instance_string = $this->base_id . serialize($this->instance); |
|
4799 | + return hash('crc32b', $instance_string); |
|
4800 | 4800 | } |
4801 | 4801 | |
4802 | 4802 | /** |
@@ -4807,14 +4807,14 @@ discard block |
||
4807 | 4807 | * @return string |
4808 | 4808 | *@since 1.0.20 |
4809 | 4809 | */ |
4810 | - public function get_instance_style($rules = array()){ |
|
4810 | + public function get_instance_style($rules = array()) { |
|
4811 | 4811 | $css = ''; |
4812 | 4812 | |
4813 | - if(!empty($rules)){ |
|
4813 | + if (!empty($rules)) { |
|
4814 | 4814 | $rules = array_unique($rules); |
4815 | 4815 | $instance_hash = $this->get_instance_hash(); |
4816 | 4816 | $css .= "<style>"; |
4817 | - foreach($rules as $rule){ |
|
4817 | + foreach ($rules as $rule) { |
|
4818 | 4818 | $css .= ".sdel-$instance_hash $rule"; |
4819 | 4819 | } |
4820 | 4820 | $css .= "</style>"; |
@@ -4832,9 +4832,9 @@ discard block |
||
4832 | 4832 | *@since 1.0.28 |
4833 | 4833 | * |
4834 | 4834 | */ |
4835 | - public function encode_shortcodes( $content ) { |
|
4835 | + public function encode_shortcodes($content) { |
|
4836 | 4836 | // Avoids existing encoded tags. |
4837 | - $trans = array( |
|
4837 | + $trans = array( |
|
4838 | 4838 | '[' => '[', |
4839 | 4839 | ']' => ']', |
4840 | 4840 | '&#91;' => '[', |
@@ -4845,7 +4845,7 @@ discard block |
||
4845 | 4845 | '&gt;' => '&0gt;', |
4846 | 4846 | ); |
4847 | 4847 | |
4848 | - $content = strtr( $content, $trans ); |
|
4848 | + $content = strtr($content, $trans); |
|
4849 | 4849 | |
4850 | 4850 | $trans = array( |
4851 | 4851 | '[' => '[', |
@@ -4856,7 +4856,7 @@ discard block |
||
4856 | 4856 | "'" => ''', |
4857 | 4857 | ); |
4858 | 4858 | |
4859 | - $content = strtr( $content, $trans ); |
|
4859 | + $content = strtr($content, $trans); |
|
4860 | 4860 | |
4861 | 4861 | return $content; |
4862 | 4862 | } |
@@ -4870,8 +4870,8 @@ discard block |
||
4870 | 4870 | *@since 1.0.28 |
4871 | 4871 | * |
4872 | 4872 | */ |
4873 | - public function decode_shortcodes( $content ) { |
|
4874 | - $trans = array( |
|
4873 | + public function decode_shortcodes($content) { |
|
4874 | + $trans = array( |
|
4875 | 4875 | '[' => '[', |
4876 | 4876 | ']' => ']', |
4877 | 4877 | '&#91;' => '[', |
@@ -4884,7 +4884,7 @@ discard block |
||
4884 | 4884 | ''' => "'", |
4885 | 4885 | ); |
4886 | 4886 | |
4887 | - $content = strtr( $content, $trans ); |
|
4887 | + $content = strtr($content, $trans); |
|
4888 | 4888 | |
4889 | 4889 | $trans = array( |
4890 | 4890 | '[' => '[', |
@@ -4897,31 +4897,31 @@ discard block |
||
4897 | 4897 | '&0gt;' => '>', |
4898 | 4898 | ); |
4899 | 4899 | |
4900 | - $content = strtr( $content, $trans ); |
|
4900 | + $content = strtr($content, $trans); |
|
4901 | 4901 | |
4902 | 4902 | return $content; |
4903 | 4903 | } |
4904 | 4904 | |
4905 | - public function block_visibility_fields( $args ) { |
|
4906 | - $value = ! empty( $args['value'] ) ? esc_attr( $args['value'] ) : ''; |
|
4905 | + public function block_visibility_fields($args) { |
|
4906 | + $value = !empty($args['value']) ? esc_attr($args['value']) : ''; |
|
4907 | 4907 | $content = '<div class="bs-vc-rule-template d-none">'; |
4908 | 4908 | $content .= '<div class="p-3 pb-0 mb-3 border border-1 rounded-1 position-relative bs-vc-rule" data-bs-index="BSVCINDEX" >'; |
4909 | 4909 | $content .= '<div class="row">'; |
4910 | 4910 | $content .= '<div class="col-sm-12">'; |
4911 | - $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>'; |
|
4911 | + $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>'; |
|
4912 | 4912 | $content .= aui()->select( |
4913 | 4913 | array( |
4914 | 4914 | 'id' => 'bsvc_rule_BSVCINDEX', |
4915 | 4915 | 'name' => 'bsvc_rule_BSVCINDEX', |
4916 | - 'label' => __( 'Rule', 'ayecode-connect' ), |
|
4917 | - 'placeholder' => __( 'Select Rule...', 'ayecode-connect' ), |
|
4916 | + 'label' => __('Rule', 'ayecode-connect'), |
|
4917 | + 'placeholder' => __('Select Rule...', 'ayecode-connect'), |
|
4918 | 4918 | 'class' => 'bsvc_rule form-select-sm no-select2', |
4919 | 4919 | 'options' => sd_visibility_rules_options(), |
4920 | 4920 | 'default' => '', |
4921 | 4921 | 'value' => '', |
4922 | 4922 | 'label_type' => '', |
4923 | 4923 | 'select2' => false, |
4924 | - 'input_group_left' => __( 'Rule:', 'ayecode-connect' ), |
|
4924 | + 'input_group_left' => __('Rule:', 'ayecode-connect'), |
|
4925 | 4925 | 'extra_attributes' => array( |
4926 | 4926 | 'data-minimum-results-for-search' => '-1' |
4927 | 4927 | ) |
@@ -4930,15 +4930,15 @@ discard block |
||
4930 | 4930 | |
4931 | 4931 | $content .= '</div>'; |
4932 | 4932 | |
4933 | - if ( class_exists( 'GeoDirectory' ) ) { |
|
4933 | + if (class_exists('GeoDirectory')) { |
|
4934 | 4934 | $content .= '<div class="col-md-7 col-sm-12">'; |
4935 | 4935 | |
4936 | 4936 | $content .= aui()->select( |
4937 | 4937 | array( |
4938 | 4938 | 'id' => 'bsvc_gd_field_BSVCINDEX', |
4939 | 4939 | 'name' => 'bsvc_gd_field_BSVCINDEX', |
4940 | - 'label' => __( 'FIELD', 'ayecode-connect' ), |
|
4941 | - 'placeholder' => __( 'FIELD', 'ayecode-connect' ), |
|
4940 | + 'label' => __('FIELD', 'ayecode-connect'), |
|
4941 | + 'placeholder' => __('FIELD', 'ayecode-connect'), |
|
4942 | 4942 | 'class' => 'bsvc_gd_field form-select-sm no-select2', |
4943 | 4943 | 'options' => sd_visibility_gd_field_options(), |
4944 | 4944 | 'default' => '', |
@@ -4959,8 +4959,8 @@ discard block |
||
4959 | 4959 | array( |
4960 | 4960 | 'id' => 'bsvc_gd_field_condition_BSVCINDEX', |
4961 | 4961 | 'name' => 'bsvc_gd_field_condition_BSVCINDEX', |
4962 | - 'label' => __( 'CONDITION', 'ayecode-connect' ), |
|
4963 | - 'placeholder' => __( 'CONDITION', 'ayecode-connect' ), |
|
4962 | + 'label' => __('CONDITION', 'ayecode-connect'), |
|
4963 | + 'placeholder' => __('CONDITION', 'ayecode-connect'), |
|
4964 | 4964 | 'class' => 'bsvc_gd_field_condition form-select-sm no-select2', |
4965 | 4965 | 'options' => sd_visibility_field_condition_options(), |
4966 | 4966 | 'default' => '', |
@@ -4982,9 +4982,9 @@ discard block |
||
4982 | 4982 | 'type' => 'text', |
4983 | 4983 | 'id' => 'bsvc_gd_field_search_BSVCINDEX', |
4984 | 4984 | 'name' => 'bsvc_gd_field_search_BSVCINDEX', |
4985 | - 'label' => __( 'VALUE TO MATCH', 'ayecode-connect' ), |
|
4985 | + 'label' => __('VALUE TO MATCH', 'ayecode-connect'), |
|
4986 | 4986 | 'class' => 'bsvc_gd_field_search form-control-sm', |
4987 | - 'placeholder' => __( 'VALUE TO MATCH', 'ayecode-connect' ), |
|
4987 | + 'placeholder' => __('VALUE TO MATCH', 'ayecode-connect'), |
|
4988 | 4988 | 'label_type' => '', |
4989 | 4989 | 'value' => '', |
4990 | 4990 | '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")' |
@@ -4996,11 +4996,11 @@ discard block |
||
4996 | 4996 | |
4997 | 4997 | $content .= '</div>'; |
4998 | 4998 | |
4999 | - $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>'; |
|
4999 | + $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>'; |
|
5000 | 5000 | $role_options = sd_user_roles_options(); |
5001 | 5001 | |
5002 | 5002 | $role_option_i = 0; |
5003 | - foreach ( $role_options as $role_option_key => $role_option_name ) { |
|
5003 | + foreach ($role_options as $role_option_key => $role_option_name) { |
|
5004 | 5004 | $role_option_i++; |
5005 | 5005 | |
5006 | 5006 | $content .= '<div class="col-sm-6">'; |
@@ -5024,14 +5024,14 @@ discard block |
||
5024 | 5024 | $content .= '</div>'; |
5025 | 5025 | $content .= '<form id="bs-vc-modal-form" class="bs-vc-modal-form">'; |
5026 | 5026 | $content .= '<div class="bs-vc-rule-sets"></div>'; |
5027 | - $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>'; |
|
5027 | + $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>'; |
|
5028 | 5028 | $content .= '<div class="row"><div class="col-md-6 col-sm-12">'; |
5029 | 5029 | $content .= aui()->select( |
5030 | 5030 | array( |
5031 | 5031 | 'id' => 'bsvc_output', |
5032 | 5032 | 'name' => 'bsvc_output', |
5033 | - 'label' => __( 'What should happen if rules met.', 'ayecode-connect' ), |
|
5034 | - 'placeholder' => __( 'Default Output', 'ayecode-connect' ), |
|
5033 | + 'label' => __('What should happen if rules met.', 'ayecode-connect'), |
|
5034 | + 'placeholder' => __('Default Output', 'ayecode-connect'), |
|
5035 | 5035 | 'class' => 'bsvc_output form-select-sm no-select2', |
5036 | 5036 | 'options' => sd_visibility_output_options(), |
5037 | 5037 | 'default' => '', |
@@ -5050,8 +5050,8 @@ discard block |
||
5050 | 5050 | array( |
5051 | 5051 | 'id' => 'bsvc_page', |
5052 | 5052 | 'name' => 'bsvc_page', |
5053 | - 'label' => __( 'Page Content', 'ayecode-connect' ), |
|
5054 | - 'placeholder' => __( 'Select Page ID...', 'ayecode-connect' ), |
|
5053 | + 'label' => __('Page Content', 'ayecode-connect'), |
|
5054 | + 'placeholder' => __('Select Page ID...', 'ayecode-connect'), |
|
5055 | 5055 | 'class' => 'bsvc_page form-select-sm no-select2', |
5056 | 5056 | 'options' => sd_template_page_options(), |
5057 | 5057 | 'default' => '', |
@@ -5066,8 +5066,8 @@ discard block |
||
5066 | 5066 | array( |
5067 | 5067 | 'id' => 'bsvc_tmpl_part', |
5068 | 5068 | 'name' => 'bsvc_tmpl_part', |
5069 | - 'label' => __( 'Template Part', 'ayecode-connect' ), |
|
5070 | - 'placeholder' => __( 'Select Template Part...', 'ayecode-connect' ), |
|
5069 | + 'label' => __('Template Part', 'ayecode-connect'), |
|
5070 | + 'placeholder' => __('Select Template Part...', 'ayecode-connect'), |
|
5071 | 5071 | 'class' => 'bsvc_tmpl_part form-select-sm no-select2', |
5072 | 5072 | 'options' => sd_template_part_options(), |
5073 | 5073 | 'default' => '', |
@@ -5085,8 +5085,8 @@ discard block |
||
5085 | 5085 | array( |
5086 | 5086 | 'id' => 'bsvc_message_type', |
5087 | 5087 | 'name' => 'bsvc_message_type', |
5088 | - 'label' => __( 'Custom Message Type', 'ayecode-connect' ), |
|
5089 | - 'placeholder' => __( 'Default (none)', 'ayecode-connect' ), |
|
5088 | + 'label' => __('Custom Message Type', 'ayecode-connect'), |
|
5089 | + 'placeholder' => __('Default (none)', 'ayecode-connect'), |
|
5090 | 5090 | 'class' => 'bsvc_message_type form-select-sm no-select2', |
5091 | 5091 | 'options' => sd_aui_colors(), |
5092 | 5092 | 'default' => '', |
@@ -5109,7 +5109,7 @@ discard block |
||
5109 | 5109 | 'name' => 'bsvc_message', |
5110 | 5110 | 'label' => '', |
5111 | 5111 | 'class' => 'bsvc_message form-control-sm', |
5112 | - 'placeholder' => __( 'CUSTOM MESSAGE TO SHOW', 'ayecode-connect' ), |
|
5112 | + 'placeholder' => __('CUSTOM MESSAGE TO SHOW', 'ayecode-connect'), |
|
5113 | 5113 | 'label_type' => '', |
5114 | 5114 | 'value' => '', |
5115 | 5115 | 'form_group_class' => ' ', |