@@ -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.1.85"; |
19 | - if(empty($ayecode_ui_version) || version_compare($this_version , $ayecode_ui_version, '>')){ |
|
20 | - $ayecode_ui_version = $this_version ; |
|
21 | - $ayecode_ui_file_key = wp_hash( __FILE__ ); |
|
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(); |
@@ -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, |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | public function init() { |
273 | 273 | |
274 | 274 | // Maybe fix settings |
275 | - if ( ! empty( $_REQUEST['aui-fix-admin'] ) && !empty($_REQUEST['nonce']) && wp_verify_nonce( $_REQUEST['nonce'], "aui-fix-admin" ) ) { |
|
276 | - $db_settings = get_option( 'ayecode-ui-settings' ); |
|
277 | - if ( ! empty( $db_settings ) ) { |
|
275 | + if (!empty($_REQUEST['aui-fix-admin']) && !empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], "aui-fix-admin")) { |
|
276 | + $db_settings = get_option('ayecode-ui-settings'); |
|
277 | + if (!empty($db_settings)) { |
|
278 | 278 | $db_settings['css_backend'] = 'compatibility'; |
279 | 279 | $db_settings['js_backend'] = 'core-popper'; |
280 | - update_option( 'ayecode-ui-settings', $db_settings ); |
|
280 | + update_option('ayecode-ui-settings', $db_settings); |
|
281 | 281 | wp_safe_redirect(admin_url("options-general.php?page=ayecode-ui-settings&updated=true")); |
282 | 282 | } |
283 | 283 | } |
@@ -291,31 +291,31 @@ discard block |
||
291 | 291 | * |
292 | 292 | * We load super early in case there is a theme version that might change the colors |
293 | 293 | */ |
294 | - if ( $this->settings['css'] ) { |
|
294 | + if ($this->settings['css']) { |
|
295 | 295 | $priority = $this->is_bs3_compat() ? 100 : 1; |
296 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), $priority ); |
|
296 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), $priority); |
|
297 | 297 | } |
298 | - if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) { |
|
299 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 ); |
|
298 | + if ($this->settings['css_backend'] && $this->load_admin_scripts()) { |
|
299 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 1); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | // maybe load JS |
303 | - if ( $this->settings['js'] ) { |
|
303 | + if ($this->settings['js']) { |
|
304 | 304 | $priority = $this->is_bs3_compat() ? 100 : 1; |
305 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority ); |
|
305 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), $priority); |
|
306 | 306 | } |
307 | - if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) { |
|
308 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 ); |
|
307 | + if ($this->settings['js_backend'] && $this->load_admin_scripts()) { |
|
308 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 1); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | // Maybe set the HTML font size |
312 | - if ( $this->settings['html_font_size'] ) { |
|
313 | - add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 ); |
|
312 | + if ($this->settings['html_font_size']) { |
|
313 | + add_action('wp_footer', array($this, 'html_font_size'), 10); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | // Maybe show backend style error |
317 | - if( $this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper' ){ |
|
318 | - add_action( 'admin_notices', array( $this, 'show_admin_style_notice' ) ); |
|
317 | + if ($this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper') { |
|
318 | + add_action('admin_notices', array($this, 'show_admin_style_notice')); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | } |
@@ -323,11 +323,11 @@ discard block |
||
323 | 323 | /** |
324 | 324 | * Show admin notice if backend scripts not loaded. |
325 | 325 | */ |
326 | - public function show_admin_style_notice(){ |
|
327 | - $fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=".wp_create_nonce('aui-fix-admin')); |
|
328 | - $button = '<a href="'.esc_url($fix_url).'" class="button-primary">Fix Now</a>'; |
|
329 | - $message = __( '<b>Style Issue:</b> AyeCode UI is disable or set wrong.')." " .$button; |
|
330 | - echo '<div class="notice notice-error aui-settings-error-notice"><p>'.$message.'</p></div>'; |
|
326 | + public function show_admin_style_notice() { |
|
327 | + $fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=" . wp_create_nonce('aui-fix-admin')); |
|
328 | + $button = '<a href="' . esc_url($fix_url) . '" class="button-primary">Fix Now</a>'; |
|
329 | + $message = __('<b>Style Issue:</b> AyeCode UI is disable or set wrong.') . " " . $button; |
|
330 | + echo '<div class="notice notice-error aui-settings-error-notice"><p>' . $message . '</p></div>'; |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | /** |
@@ -335,14 +335,14 @@ discard block |
||
335 | 335 | * |
336 | 336 | * @return bool |
337 | 337 | */ |
338 | - public function load_admin_scripts(){ |
|
338 | + public function load_admin_scripts() { |
|
339 | 339 | $result = true; |
340 | 340 | |
341 | 341 | // check if specifically disabled |
342 | - if(!empty($this->settings['disable_admin'])){ |
|
343 | - $url_parts = explode("\n",$this->settings['disable_admin']); |
|
344 | - foreach($url_parts as $part){ |
|
345 | - if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){ |
|
342 | + if (!empty($this->settings['disable_admin'])) { |
|
343 | + $url_parts = explode("\n", $this->settings['disable_admin']); |
|
344 | + foreach ($url_parts as $part) { |
|
345 | + if (strpos($_SERVER['REQUEST_URI'], trim($part)) !== false) { |
|
346 | 346 | return false; // return early, no point checking further |
347 | 347 | } |
348 | 348 | } |
@@ -354,9 +354,9 @@ discard block |
||
354 | 354 | /** |
355 | 355 | * Add a html font size to the footer. |
356 | 356 | */ |
357 | - public function html_font_size(){ |
|
357 | + public function html_font_size() { |
|
358 | 358 | $this->settings = $this->get_settings(); |
359 | - echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>"; |
|
359 | + echo "<style>html{font-size:" . absint($this->settings['html_font_size']) . "px;}</style>"; |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | /** |
@@ -364,11 +364,11 @@ discard block |
||
364 | 364 | * |
365 | 365 | * @return bool |
366 | 366 | */ |
367 | - public function is_aui_screen(){ |
|
367 | + public function is_aui_screen() { |
|
368 | 368 | // echo '###';exit; |
369 | 369 | $load = false; |
370 | 370 | // check if we should load or not |
371 | - if ( is_admin() ) { |
|
371 | + if (is_admin()) { |
|
372 | 372 | // Only enable on set pages |
373 | 373 | $aui_screens = array( |
374 | 374 | 'page', |
@@ -379,24 +379,24 @@ discard block |
||
379 | 379 | 'ayecode-ui-settings', |
380 | 380 | 'site-editor' |
381 | 381 | ); |
382 | - $screen_ids = apply_filters( 'aui_screen_ids', $aui_screens ); |
|
382 | + $screen_ids = apply_filters('aui_screen_ids', $aui_screens); |
|
383 | 383 | |
384 | 384 | $screen = get_current_screen(); |
385 | 385 | |
386 | 386 | // echo '###'.$screen->id; |
387 | 387 | |
388 | 388 | // check if we are on a AUI screen |
389 | - if ( $screen && in_array( $screen->id, $screen_ids ) ) { |
|
389 | + if ($screen && in_array($screen->id, $screen_ids)) { |
|
390 | 390 | $load = true; |
391 | 391 | } |
392 | 392 | |
393 | 393 | //load for widget previews in WP 5.8 |
394 | - if( !empty($_REQUEST['legacy-widget-preview'])){ |
|
394 | + if (!empty($_REQUEST['legacy-widget-preview'])) { |
|
395 | 395 | $load = true; |
396 | 396 | } |
397 | 397 | } |
398 | 398 | |
399 | - return apply_filters( 'aui_load_on_admin' , $load ); |
|
399 | + return apply_filters('aui_load_on_admin', $load); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | /** |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * @return bool |
406 | 406 | */ |
407 | 407 | public static function is_block_theme() { |
408 | - if ( function_exists( 'wp_is_block_theme' && wp_is_block_theme() ) ) { |
|
408 | + if (function_exists('wp_is_block_theme' && wp_is_block_theme())) { |
|
409 | 409 | return true; |
410 | 410 | } |
411 | 411 | |
@@ -418,37 +418,37 @@ discard block |
||
418 | 418 | public function enqueue_style() { |
419 | 419 | |
420 | 420 | |
421 | - if( is_admin() && !$this->is_aui_screen()){ |
|
421 | + if (is_admin() && !$this->is_aui_screen()) { |
|
422 | 422 | // don't add wp-admin scripts if not requested to |
423 | - }else{ |
|
423 | + } else { |
|
424 | 424 | $css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend'; |
425 | 425 | |
426 | 426 | $rtl = is_rtl() ? '-rtl' : ''; |
427 | 427 | |
428 | - if($this->settings[$css_setting]){ |
|
429 | - $compatibility = $this->settings[$css_setting]=='core' ? false : true; |
|
430 | - $url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets/css/ayecode-ui-compatibility'.$rtl.'.css'; |
|
428 | + if ($this->settings[$css_setting]) { |
|
429 | + $compatibility = $this->settings[$css_setting] == 'core' ? false : true; |
|
430 | + $url = $this->settings[$css_setting] == 'core' ? $this->url . 'assets/css/ayecode-ui' . $rtl . '.css' : $this->url . 'assets/css/ayecode-ui-compatibility' . $rtl . '.css'; |
|
431 | 431 | |
432 | 432 | |
433 | 433 | |
434 | - wp_register_style( 'ayecode-ui', $url, array(), $this->version ); |
|
435 | - wp_enqueue_style( 'ayecode-ui' ); |
|
434 | + wp_register_style('ayecode-ui', $url, array(), $this->version); |
|
435 | + wp_enqueue_style('ayecode-ui'); |
|
436 | 436 | |
437 | - $current_screen = function_exists('get_current_screen' ) ? get_current_screen() : ''; |
|
437 | + $current_screen = function_exists('get_current_screen') ? get_current_screen() : ''; |
|
438 | 438 | |
439 | 439 | // if ( is_admin() && !empty($_REQUEST['postType']) ) { |
440 | - if ( is_admin() && ( !empty($_REQUEST['postType']) || $current_screen->is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) ) ) { |
|
441 | - $url = $this->url.'assets/css/ayecode-ui-fse.css'; |
|
442 | - wp_register_style( 'ayecode-ui-fse', $url, array(), $this->version ); |
|
443 | - wp_enqueue_style( 'ayecode-ui-fse' ); |
|
440 | + if (is_admin() && (!empty($_REQUEST['postType']) || $current_screen->is_block_editor()) && (defined('BLOCKSTRAP_VERSION') || defined('AUI_FSE'))) { |
|
441 | + $url = $this->url . 'assets/css/ayecode-ui-fse.css'; |
|
442 | + wp_register_style('ayecode-ui-fse', $url, array(), $this->version); |
|
443 | + wp_enqueue_style('ayecode-ui-fse'); |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | |
447 | 447 | // flatpickr |
448 | - wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->version ); |
|
448 | + wp_register_style('flatpickr', $this->url . 'assets/css/flatpickr.min.css', array(), $this->version); |
|
449 | 449 | |
450 | 450 | // fix some wp-admin issues |
451 | - if(is_admin()){ |
|
451 | + if (is_admin()) { |
|
452 | 452 | $custom_css = " |
453 | 453 | body{ |
454 | 454 | background-color: #f1f1f1; |
@@ -501,11 +501,11 @@ discard block |
||
501 | 501 | padding: 0; |
502 | 502 | } |
503 | 503 | "; |
504 | - wp_add_inline_style( 'ayecode-ui', $custom_css ); |
|
504 | + wp_add_inline_style('ayecode-ui', $custom_css); |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | // custom changes |
508 | - wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) ); |
|
508 | + wp_add_inline_style('ayecode-ui', self::custom_css($compatibility)); |
|
509 | 509 | |
510 | 510 | } |
511 | 511 | } |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | function aui_init_flatpickr(){ |
769 | 769 | if ( typeof jQuery.fn.flatpickr === "function" && !$aui_doing_init_flatpickr) { |
770 | 770 | $aui_doing_init_flatpickr = true; |
771 | - <?php if ( ! empty( $flatpickr_locale ) ) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; ?>);}catch(err){console.log(err.message);}<?php } ?> |
|
771 | + <?php if (!empty($flatpickr_locale)) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; ?>);}catch(err){console.log(err.message);}<?php } ?> |
|
772 | 772 | jQuery('input[data-aui-init="flatpickr"]:not(.flatpickr-input)').flatpickr(); |
773 | 773 | } |
774 | 774 | $aui_doing_init_flatpickr = false; |
@@ -1461,7 +1461,7 @@ discard block |
||
1461 | 1461 | |
1462 | 1462 | <?php |
1463 | 1463 | // FSE tweaks. |
1464 | - if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template'){ ?> |
|
1464 | + if (!empty($_REQUEST['postType']) && $_REQUEST['postType'] == 'wp_template') { ?> |
|
1465 | 1465 | function aui_fse_set_data_scroll() { |
1466 | 1466 | console.log('init scroll'); |
1467 | 1467 | let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas"); |
@@ -1501,10 +1501,10 @@ discard block |
||
1501 | 1501 | /* |
1502 | 1502 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
1503 | 1503 | */ |
1504 | - return str_replace( array( |
|
1504 | + return str_replace(array( |
|
1505 | 1505 | '<script>', |
1506 | 1506 | '</script>' |
1507 | - ), '', self::minify_js($output) ); |
|
1507 | + ), '', self::minify_js($output)); |
|
1508 | 1508 | } |
1509 | 1509 | |
1510 | 1510 | |
@@ -1518,13 +1518,13 @@ discard block |
||
1518 | 1518 | ob_start(); |
1519 | 1519 | ?> |
1520 | 1520 | <script> |
1521 | - <?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?> |
|
1521 | + <?php if (defined('FUSION_BUILDER_VERSION')) { ?> |
|
1522 | 1522 | /* With Avada builder */ |
1523 | 1523 | |
1524 | 1524 | <?php } ?> |
1525 | 1525 | </script> |
1526 | 1526 | <?php |
1527 | - return str_replace( array( |
|
1527 | + return str_replace(array( |
|
1528 | 1528 | '<script>', |
1529 | 1529 | '</script>' |
1530 | 1530 | ), '', ob_get_clean()); |
@@ -1535,7 +1535,7 @@ discard block |
||
1535 | 1535 | * |
1536 | 1536 | * If this remains small then its best to use this than to add another JS file. |
1537 | 1537 | */ |
1538 | - public function inline_script_file_browser(){ |
|
1538 | + public function inline_script_file_browser() { |
|
1539 | 1539 | ob_start(); |
1540 | 1540 | ?> |
1541 | 1541 | <script> |
@@ -1550,10 +1550,10 @@ discard block |
||
1550 | 1550 | /* |
1551 | 1551 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
1552 | 1552 | */ |
1553 | - return str_replace( array( |
|
1553 | + return str_replace(array( |
|
1554 | 1554 | '<script>', |
1555 | 1555 | '</script>' |
1556 | - ), '', $output ); |
|
1556 | + ), '', $output); |
|
1557 | 1557 | } |
1558 | 1558 | |
1559 | 1559 | /** |
@@ -1561,53 +1561,53 @@ discard block |
||
1561 | 1561 | */ |
1562 | 1562 | public function enqueue_scripts() { |
1563 | 1563 | |
1564 | - if( is_admin() && !$this->is_aui_screen()){ |
|
1564 | + if (is_admin() && !$this->is_aui_screen()) { |
|
1565 | 1565 | // don't add wp-admin scripts if not requested to |
1566 | - }else { |
|
1566 | + } else { |
|
1567 | 1567 | |
1568 | 1568 | $js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend'; |
1569 | 1569 | |
1570 | 1570 | // select2 |
1571 | - wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version ); |
|
1571 | + wp_register_script('select2', $this->url . 'assets/js/select2.min.js', array('jquery'), $this->select2_version); |
|
1572 | 1572 | |
1573 | 1573 | // flatpickr |
1574 | - wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version ); |
|
1574 | + wp_register_script('flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version); |
|
1575 | 1575 | |
1576 | 1576 | // flatpickr |
1577 | - wp_register_script( 'iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version ); |
|
1577 | + wp_register_script('iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version); |
|
1578 | 1578 | |
1579 | 1579 | // Bootstrap file browser |
1580 | - wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version ); |
|
1581 | - wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() ); |
|
1580 | + wp_register_script('aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version); |
|
1581 | + wp_add_inline_script('aui-custom-file-input', $this->inline_script_file_browser()); |
|
1582 | 1582 | |
1583 | 1583 | $load_inline = false; |
1584 | 1584 | |
1585 | - if ( $this->settings[ $js_setting ] == 'core-popper' ) { |
|
1585 | + if ($this->settings[$js_setting] == 'core-popper') { |
|
1586 | 1586 | // Bootstrap bundle |
1587 | 1587 | $url = $this->url . 'assets/js/bootstrap.bundle.min.js'; |
1588 | - wp_register_script( 'bootstrap-js-bundle', $url, array( |
|
1588 | + wp_register_script('bootstrap-js-bundle', $url, array( |
|
1589 | 1589 | 'select2', |
1590 | 1590 | 'jquery' |
1591 | - ), $this->version, $this->is_bs3_compat() ); |
|
1591 | + ), $this->version, $this->is_bs3_compat()); |
|
1592 | 1592 | // if in admin then add to footer for compatibility. |
1593 | - is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' ); |
|
1593 | + is_admin() ? wp_enqueue_script('bootstrap-js-bundle', '', null, null, true) : wp_enqueue_script('bootstrap-js-bundle'); |
|
1594 | 1594 | $script = $this->inline_script(); |
1595 | - wp_add_inline_script( 'bootstrap-js-bundle', $script ); |
|
1596 | - } elseif ( $this->settings[ $js_setting ] == 'popper' ) { |
|
1595 | + wp_add_inline_script('bootstrap-js-bundle', $script); |
|
1596 | + } elseif ($this->settings[$js_setting] == 'popper') { |
|
1597 | 1597 | $url = $this->url . 'assets/js/popper.min.js'; |
1598 | - wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->version ); |
|
1599 | - wp_enqueue_script( 'bootstrap-js-popper' ); |
|
1598 | + wp_register_script('bootstrap-js-popper', $url, array('select2', 'jquery'), $this->version); |
|
1599 | + wp_enqueue_script('bootstrap-js-popper'); |
|
1600 | 1600 | $load_inline = true; |
1601 | 1601 | } else { |
1602 | 1602 | $load_inline = true; |
1603 | 1603 | } |
1604 | 1604 | |
1605 | 1605 | // Load needed inline scripts by faking the loading of a script if the main script is not being loaded |
1606 | - if ( $load_inline ) { |
|
1607 | - wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) ); |
|
1608 | - wp_enqueue_script( 'bootstrap-dummy' ); |
|
1606 | + if ($load_inline) { |
|
1607 | + wp_register_script('bootstrap-dummy', '', array('select2', 'jquery')); |
|
1608 | + wp_enqueue_script('bootstrap-dummy'); |
|
1609 | 1609 | $script = $this->inline_script(); |
1610 | - wp_add_inline_script( 'bootstrap-dummy', $script ); |
|
1610 | + wp_add_inline_script('bootstrap-dummy', $script); |
|
1611 | 1611 | } |
1612 | 1612 | } |
1613 | 1613 | |
@@ -1616,17 +1616,17 @@ discard block |
||
1616 | 1616 | /** |
1617 | 1617 | * Enqueue flatpickr if called. |
1618 | 1618 | */ |
1619 | - public function enqueue_flatpickr(){ |
|
1620 | - wp_enqueue_style( 'flatpickr' ); |
|
1621 | - wp_enqueue_script( 'flatpickr' ); |
|
1619 | + public function enqueue_flatpickr() { |
|
1620 | + wp_enqueue_style('flatpickr'); |
|
1621 | + wp_enqueue_script('flatpickr'); |
|
1622 | 1622 | } |
1623 | 1623 | |
1624 | 1624 | /** |
1625 | 1625 | * Enqueue iconpicker if called. |
1626 | 1626 | */ |
1627 | - public function enqueue_iconpicker(){ |
|
1628 | - wp_enqueue_style( 'iconpicker' ); |
|
1629 | - wp_enqueue_script( 'iconpicker' ); |
|
1627 | + public function enqueue_iconpicker() { |
|
1628 | + wp_enqueue_style('iconpicker'); |
|
1629 | + wp_enqueue_script('iconpicker'); |
|
1630 | 1630 | } |
1631 | 1631 | |
1632 | 1632 | /** |
@@ -1635,19 +1635,19 @@ discard block |
||
1635 | 1635 | * @return string |
1636 | 1636 | */ |
1637 | 1637 | public function get_url() { |
1638 | - $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) ); |
|
1639 | - $content_url = untrailingslashit( WP_CONTENT_URL ); |
|
1638 | + $content_dir = wp_normalize_path(untrailingslashit(WP_CONTENT_DIR)); |
|
1639 | + $content_url = untrailingslashit(WP_CONTENT_URL); |
|
1640 | 1640 | |
1641 | 1641 | // Replace http:// to https://. |
1642 | - if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) { |
|
1643 | - $content_url = str_replace( 'http://', 'https://', $content_url ); |
|
1642 | + if (strpos($content_url, 'http://') === 0 && strpos(plugins_url(), 'https://') === 0) { |
|
1643 | + $content_url = str_replace('http://', 'https://', $content_url); |
|
1644 | 1644 | } |
1645 | 1645 | |
1646 | 1646 | // Check if we are inside a plugin |
1647 | - $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) ); |
|
1648 | - $url = str_replace( $content_dir, $content_url, $file_dir ); |
|
1647 | + $file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__))); |
|
1648 | + $url = str_replace($content_dir, $content_url, $file_dir); |
|
1649 | 1649 | |
1650 | - return trailingslashit( $url ); |
|
1650 | + return trailingslashit($url); |
|
1651 | 1651 | } |
1652 | 1652 | |
1653 | 1653 | /** |
@@ -1659,15 +1659,15 @@ discard block |
||
1659 | 1659 | |
1660 | 1660 | $url = ''; |
1661 | 1661 | // check if we are inside a plugin |
1662 | - $file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) ); |
|
1662 | + $file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__))); |
|
1663 | 1663 | |
1664 | 1664 | // add check in-case user has changed wp-content dir name. |
1665 | 1665 | $wp_content_folder_name = basename(WP_CONTENT_DIR); |
1666 | - $dir_parts = explode("/$wp_content_folder_name/",$file_dir); |
|
1667 | - $url_parts = explode("/$wp_content_folder_name/",plugins_url()); |
|
1666 | + $dir_parts = explode("/$wp_content_folder_name/", $file_dir); |
|
1667 | + $url_parts = explode("/$wp_content_folder_name/", plugins_url()); |
|
1668 | 1668 | |
1669 | - if(!empty($url_parts[0]) && !empty($dir_parts[1])){ |
|
1670 | - $url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] ); |
|
1669 | + if (!empty($url_parts[0]) && !empty($dir_parts[1])) { |
|
1670 | + $url = trailingslashit($url_parts[0] . "/$wp_content_folder_name/" . $dir_parts[1]); |
|
1671 | 1671 | } |
1672 | 1672 | |
1673 | 1673 | return $url; |
@@ -1677,7 +1677,7 @@ discard block |
||
1677 | 1677 | * Register the database settings with WordPress. |
1678 | 1678 | */ |
1679 | 1679 | public function register_settings() { |
1680 | - register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' ); |
|
1680 | + register_setting('ayecode-ui-settings', 'ayecode-ui-settings'); |
|
1681 | 1681 | } |
1682 | 1682 | |
1683 | 1683 | /** |
@@ -1686,10 +1686,10 @@ discard block |
||
1686 | 1686 | */ |
1687 | 1687 | public function menu_item() { |
1688 | 1688 | $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme |
1689 | - call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array( |
|
1689 | + call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array( |
|
1690 | 1690 | $this, |
1691 | 1691 | 'settings_page' |
1692 | - ) ); |
|
1692 | + )); |
|
1693 | 1693 | } |
1694 | 1694 | |
1695 | 1695 | /** |
@@ -1697,7 +1697,7 @@ discard block |
||
1697 | 1697 | * |
1698 | 1698 | * @return array |
1699 | 1699 | */ |
1700 | - public function theme_js_settings(){ |
|
1700 | + public function theme_js_settings() { |
|
1701 | 1701 | return array( |
1702 | 1702 | 'ayetheme' => 'popper', |
1703 | 1703 | 'listimia' => 'required', |
@@ -1713,40 +1713,40 @@ discard block |
||
1713 | 1713 | */ |
1714 | 1714 | public function get_settings() { |
1715 | 1715 | |
1716 | - $db_settings = get_option( 'ayecode-ui-settings' ); |
|
1716 | + $db_settings = get_option('ayecode-ui-settings'); |
|
1717 | 1717 | $js_default = 'core-popper'; |
1718 | 1718 | $js_default_backend = $js_default; |
1719 | 1719 | |
1720 | 1720 | // maybe set defaults (if no settings set) |
1721 | - if(empty($db_settings)){ |
|
1722 | - $active_theme = strtolower( get_template() ); // active parent theme. |
|
1721 | + if (empty($db_settings)) { |
|
1722 | + $active_theme = strtolower(get_template()); // active parent theme. |
|
1723 | 1723 | $theme_js_settings = self::theme_js_settings(); |
1724 | - if(isset($theme_js_settings[$active_theme])){ |
|
1724 | + if (isset($theme_js_settings[$active_theme])) { |
|
1725 | 1725 | $js_default = $theme_js_settings[$active_theme]; |
1726 | - $js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default; |
|
1726 | + $js_default_backend = isset($theme_js_settings[$active_theme . "_backend"]) ? $theme_js_settings[$active_theme . "_backend"] : $js_default; |
|
1727 | 1727 | } |
1728 | 1728 | } |
1729 | 1729 | |
1730 | 1730 | /** |
1731 | 1731 | * Filter the default settings. |
1732 | 1732 | */ |
1733 | - $defaults = apply_filters( 'ayecode-ui-default-settings', array( |
|
1733 | + $defaults = apply_filters('ayecode-ui-default-settings', array( |
|
1734 | 1734 | 'css' => 'compatibility', // core, compatibility |
1735 | 1735 | 'js' => $js_default, // js to load, core-popper, popper |
1736 | 1736 | 'html_font_size' => '16', // js to load, core-popper, popper |
1737 | 1737 | 'css_backend' => 'compatibility', // core, compatibility |
1738 | 1738 | 'js_backend' => $js_default_backend, // js to load, core-popper, popper |
1739 | 1739 | 'disable_admin' => '', // URL snippets to disable loading on admin |
1740 | - ), $db_settings ); |
|
1740 | + ), $db_settings); |
|
1741 | 1741 | |
1742 | - $settings = wp_parse_args( $db_settings, $defaults ); |
|
1742 | + $settings = wp_parse_args($db_settings, $defaults); |
|
1743 | 1743 | |
1744 | 1744 | /** |
1745 | 1745 | * Filter the Bootstrap settings. |
1746 | 1746 | * |
1747 | 1747 | * @todo if we add this filer people might use it and then it defeates the purpose of this class :/ |
1748 | 1748 | */ |
1749 | - return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults ); |
|
1749 | + return $this->settings = apply_filters('ayecode-ui-settings', $settings, $db_settings, $defaults); |
|
1750 | 1750 | } |
1751 | 1751 | |
1752 | 1752 | |
@@ -1754,90 +1754,90 @@ discard block |
||
1754 | 1754 | * The settings page html output. |
1755 | 1755 | */ |
1756 | 1756 | public function settings_page() { |
1757 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
1758 | - wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) ); |
|
1757 | + if (!current_user_can('manage_options')) { |
|
1758 | + wp_die(__('You do not have sufficient permissions to access this page.', 'aui')); |
|
1759 | 1759 | } |
1760 | 1760 | ?> |
1761 | 1761 | <div class="wrap"> |
1762 | 1762 | <h1><?php echo $this->name; ?></h1> |
1763 | - <p><?php echo apply_filters( 'ayecode-ui-settings-message', __("Here you can adjust settings if you are having compatibility issues.",'aui') );?></p> |
|
1763 | + <p><?php echo apply_filters('ayecode-ui-settings-message', __("Here you can adjust settings if you are having compatibility issues.", 'aui')); ?></p> |
|
1764 | 1764 | <form method="post" action="options.php"> |
1765 | 1765 | <?php |
1766 | - settings_fields( 'ayecode-ui-settings' ); |
|
1767 | - do_settings_sections( 'ayecode-ui-settings' ); |
|
1766 | + settings_fields('ayecode-ui-settings'); |
|
1767 | + do_settings_sections('ayecode-ui-settings'); |
|
1768 | 1768 | ?> |
1769 | 1769 | |
1770 | - <h2><?php _e( 'Frontend', 'aui' ); ?></h2> |
|
1770 | + <h2><?php _e('Frontend', 'aui'); ?></h2> |
|
1771 | 1771 | <table class="form-table wpbs-table-settings"> |
1772 | 1772 | <tr valign="top"> |
1773 | 1773 | <th scope="row"><label |
1774 | - for="wpbs-css"><?php _e( 'Load CSS', 'aui' ); ?></label></th> |
|
1774 | + for="wpbs-css"><?php _e('Load CSS', 'aui'); ?></label></th> |
|
1775 | 1775 | <td> |
1776 | 1776 | <select name="ayecode-ui-settings[css]" id="wpbs-css"> |
1777 | - <option value="compatibility" <?php selected( $this->settings['css'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode (default)', 'aui' ); ?></option> |
|
1778 | - <option value="core" <?php selected( $this->settings['css'], 'core' ); ?>><?php _e( 'Full Mode', 'aui' ); ?></option> |
|
1779 | - <option value="" <?php selected( $this->settings['css'], '' ); ?>><?php _e( 'Disabled', 'aui' ); ?></option> |
|
1777 | + <option value="compatibility" <?php selected($this->settings['css'], 'compatibility'); ?>><?php _e('Compatibility Mode (default)', 'aui'); ?></option> |
|
1778 | + <option value="core" <?php selected($this->settings['css'], 'core'); ?>><?php _e('Full Mode', 'aui'); ?></option> |
|
1779 | + <option value="" <?php selected($this->settings['css'], ''); ?>><?php _e('Disabled', 'aui'); ?></option> |
|
1780 | 1780 | </select> |
1781 | 1781 | </td> |
1782 | 1782 | </tr> |
1783 | 1783 | |
1784 | 1784 | <tr valign="top"> |
1785 | 1785 | <th scope="row"><label |
1786 | - for="wpbs-js"><?php _e( 'Load JS', 'aui' ); ?></label></th> |
|
1786 | + for="wpbs-js"><?php _e('Load JS', 'aui'); ?></label></th> |
|
1787 | 1787 | <td> |
1788 | 1788 | <select name="ayecode-ui-settings[js]" id="wpbs-js"> |
1789 | - <option value="core-popper" <?php selected( $this->settings['js'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'aui' ); ?></option> |
|
1790 | - <option value="popper" <?php selected( $this->settings['js'], 'popper' ); ?>><?php _e( 'Popper', 'aui' ); ?></option> |
|
1791 | - <option value="required" <?php selected( $this->settings['js'], 'required' ); ?>><?php _e( 'Required functions only', 'aui' ); ?></option> |
|
1792 | - <option value="" <?php selected( $this->settings['js'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'aui' ); ?></option> |
|
1789 | + <option value="core-popper" <?php selected($this->settings['js'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'aui'); ?></option> |
|
1790 | + <option value="popper" <?php selected($this->settings['js'], 'popper'); ?>><?php _e('Popper', 'aui'); ?></option> |
|
1791 | + <option value="required" <?php selected($this->settings['js'], 'required'); ?>><?php _e('Required functions only', 'aui'); ?></option> |
|
1792 | + <option value="" <?php selected($this->settings['js'], ''); ?>><?php _e('Disabled (not recommended)', 'aui'); ?></option> |
|
1793 | 1793 | </select> |
1794 | 1794 | </td> |
1795 | 1795 | </tr> |
1796 | 1796 | |
1797 | 1797 | <tr valign="top"> |
1798 | 1798 | <th scope="row"><label |
1799 | - for="wpbs-font_size"><?php _e( 'HTML Font Size (px)', 'aui' ); ?></label></th> |
|
1799 | + for="wpbs-font_size"><?php _e('HTML Font Size (px)', 'aui'); ?></label></th> |
|
1800 | 1800 | <td> |
1801 | - <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" /> |
|
1802 | - <p class="description" ><?php _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.",'aui');?></p> |
|
1801 | + <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" /> |
|
1802 | + <p class="description" ><?php _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.", 'aui'); ?></p> |
|
1803 | 1803 | </td> |
1804 | 1804 | </tr> |
1805 | 1805 | |
1806 | 1806 | </table> |
1807 | 1807 | |
1808 | - <h2><?php _e( 'Backend', 'aui' ); ?> (wp-admin)</h2> |
|
1808 | + <h2><?php _e('Backend', 'aui'); ?> (wp-admin)</h2> |
|
1809 | 1809 | <table class="form-table wpbs-table-settings"> |
1810 | 1810 | <tr valign="top"> |
1811 | 1811 | <th scope="row"><label |
1812 | - for="wpbs-css-admin"><?php _e( 'Load CSS', 'aui' ); ?></label></th> |
|
1812 | + for="wpbs-css-admin"><?php _e('Load CSS', 'aui'); ?></label></th> |
|
1813 | 1813 | <td> |
1814 | 1814 | <select name="ayecode-ui-settings[css_backend]" id="wpbs-css-admin"> |
1815 | - <option value="compatibility" <?php selected( $this->settings['css_backend'], 'compatibility' ); ?>><?php _e( 'Compatibility Mode (default)', 'aui' ); ?></option> |
|
1816 | - <option value="core" <?php selected( $this->settings['css_backend'], 'core' ); ?>><?php _e( 'Full Mode (will cause style issues)', 'aui' ); ?></option> |
|
1817 | - <option value="" <?php selected( $this->settings['css_backend'], '' ); ?>><?php _e( 'Disabled', 'aui' ); ?></option> |
|
1815 | + <option value="compatibility" <?php selected($this->settings['css_backend'], 'compatibility'); ?>><?php _e('Compatibility Mode (default)', 'aui'); ?></option> |
|
1816 | + <option value="core" <?php selected($this->settings['css_backend'], 'core'); ?>><?php _e('Full Mode (will cause style issues)', 'aui'); ?></option> |
|
1817 | + <option value="" <?php selected($this->settings['css_backend'], ''); ?>><?php _e('Disabled', 'aui'); ?></option> |
|
1818 | 1818 | </select> |
1819 | 1819 | </td> |
1820 | 1820 | </tr> |
1821 | 1821 | |
1822 | 1822 | <tr valign="top"> |
1823 | 1823 | <th scope="row"><label |
1824 | - for="wpbs-js-admin"><?php _e( 'Load JS', 'aui' ); ?></label></th> |
|
1824 | + for="wpbs-js-admin"><?php _e('Load JS', 'aui'); ?></label></th> |
|
1825 | 1825 | <td> |
1826 | 1826 | <select name="ayecode-ui-settings[js_backend]" id="wpbs-js-admin"> |
1827 | - <option value="core-popper" <?php selected( $this->settings['js_backend'], 'core-popper' ); ?>><?php _e( 'Core + Popper (default)', 'aui' ); ?></option> |
|
1828 | - <option value="popper" <?php selected( $this->settings['js_backend'], 'popper' ); ?>><?php _e( 'Popper', 'aui' ); ?></option> |
|
1829 | - <option value="required" <?php selected( $this->settings['js_backend'], 'required' ); ?>><?php _e( 'Required functions only', 'aui' ); ?></option> |
|
1830 | - <option value="" <?php selected( $this->settings['js_backend'], '' ); ?>><?php _e( 'Disabled (not recommended)', 'aui' ); ?></option> |
|
1827 | + <option value="core-popper" <?php selected($this->settings['js_backend'], 'core-popper'); ?>><?php _e('Core + Popper (default)', 'aui'); ?></option> |
|
1828 | + <option value="popper" <?php selected($this->settings['js_backend'], 'popper'); ?>><?php _e('Popper', 'aui'); ?></option> |
|
1829 | + <option value="required" <?php selected($this->settings['js_backend'], 'required'); ?>><?php _e('Required functions only', 'aui'); ?></option> |
|
1830 | + <option value="" <?php selected($this->settings['js_backend'], ''); ?>><?php _e('Disabled (not recommended)', 'aui'); ?></option> |
|
1831 | 1831 | </select> |
1832 | 1832 | </td> |
1833 | 1833 | </tr> |
1834 | 1834 | |
1835 | 1835 | <tr valign="top"> |
1836 | 1836 | <th scope="row"><label |
1837 | - for="wpbs-disable-admin"><?php _e( 'Disable load on URL', 'aui' ); ?></label></th> |
|
1837 | + for="wpbs-disable-admin"><?php _e('Disable load on URL', 'aui'); ?></label></th> |
|
1838 | 1838 | <td> |
1839 | - <p><?php _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.', 'aui' ); ?></p> |
|
1840 | - <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 $this->settings['disable_admin'];?></textarea> |
|
1839 | + <p><?php _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.', 'aui'); ?></p> |
|
1840 | + <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 $this->settings['disable_admin']; ?></textarea> |
|
1841 | 1841 | |
1842 | 1842 | </td> |
1843 | 1843 | </tr> |
@@ -1855,9 +1855,9 @@ discard block |
||
1855 | 1855 | <?php |
1856 | 1856 | } |
1857 | 1857 | |
1858 | - public function customizer_settings($wp_customize){ |
|
1858 | + public function customizer_settings($wp_customize) { |
|
1859 | 1859 | $wp_customize->add_section('aui_settings', array( |
1860 | - 'title' => __('AyeCode UI','aui'), |
|
1860 | + 'title' => __('AyeCode UI', 'aui'), |
|
1861 | 1861 | 'priority' => 120, |
1862 | 1862 | )); |
1863 | 1863 | |
@@ -1871,8 +1871,8 @@ discard block |
||
1871 | 1871 | 'type' => 'option', |
1872 | 1872 | 'transport' => 'refresh', |
1873 | 1873 | )); |
1874 | - $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array( |
|
1875 | - 'label' => __('Primary Color','aui'), |
|
1874 | + $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_primary', array( |
|
1875 | + 'label' => __('Primary Color', 'aui'), |
|
1876 | 1876 | 'section' => 'aui_settings', |
1877 | 1877 | 'settings' => 'aui_options[color_primary]', |
1878 | 1878 | ))); |
@@ -1884,8 +1884,8 @@ discard block |
||
1884 | 1884 | 'type' => 'option', |
1885 | 1885 | 'transport' => 'refresh', |
1886 | 1886 | )); |
1887 | - $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array( |
|
1888 | - 'label' => __('Secondary Color','aui'), |
|
1887 | + $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_secondary', array( |
|
1888 | + 'label' => __('Secondary Color', 'aui'), |
|
1889 | 1889 | 'section' => 'aui_settings', |
1890 | 1890 | 'settings' => 'aui_options[color_secondary]', |
1891 | 1891 | ))); |
@@ -1911,12 +1911,12 @@ discard block |
||
1911 | 1911 | .collapse.show:not(.in){display: inherit;} |
1912 | 1912 | .fade.show{opacity: 1;} |
1913 | 1913 | |
1914 | - <?php if( defined( 'SVQ_THEME_VERSION' ) ){ ?> |
|
1914 | + <?php if (defined('SVQ_THEME_VERSION')) { ?> |
|
1915 | 1915 | /* KLEO theme specific */ |
1916 | 1916 | .kleo-main-header .navbar-collapse.collapse.show:not(.in){display: block !important;} |
1917 | 1917 | <?php } ?> |
1918 | 1918 | |
1919 | - <?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?> |
|
1919 | + <?php if (defined('FUSION_BUILDER_VERSION')) { ?> |
|
1920 | 1920 | /* With Avada builder */ |
1921 | 1921 | body.modal-open .modal.in {opacity:1;z-index: 99999} |
1922 | 1922 | body.modal-open .modal.bsui.in .modal-content {box-shadow: none;} |
@@ -1927,34 +1927,34 @@ discard block |
||
1927 | 1927 | <?php } ?> |
1928 | 1928 | </style> |
1929 | 1929 | <?php |
1930 | - return str_replace( array( |
|
1930 | + return str_replace(array( |
|
1931 | 1931 | '<style>', |
1932 | 1932 | '</style>' |
1933 | - ), '', self::minify_css( ob_get_clean() ) ); |
|
1933 | + ), '', self::minify_css(ob_get_clean())); |
|
1934 | 1934 | } |
1935 | 1935 | |
1936 | 1936 | |
1937 | 1937 | public static function custom_css($compatibility = true) { |
1938 | 1938 | $colors = array(); |
1939 | - if ( defined( 'BLOCKSTRAP_VERSION' ) ) { |
|
1939 | + if (defined('BLOCKSTRAP_VERSION')) { |
|
1940 | 1940 | |
1941 | 1941 | $setting = wp_get_global_settings(); |
1942 | - if(!empty($setting['color']['palette']['theme'])){ |
|
1943 | - foreach($setting['color']['palette']['theme'] as $color){ |
|
1942 | + if (!empty($setting['color']['palette']['theme'])) { |
|
1943 | + foreach ($setting['color']['palette']['theme'] as $color) { |
|
1944 | 1944 | $colors[$color['slug']] = esc_attr($color['color']); |
1945 | 1945 | } |
1946 | 1946 | } |
1947 | 1947 | |
1948 | - if(!empty($setting['color']['palette']['custom'])){ |
|
1949 | - foreach($setting['color']['palette']['custom'] as $color){ |
|
1948 | + if (!empty($setting['color']['palette']['custom'])) { |
|
1949 | + foreach ($setting['color']['palette']['custom'] as $color) { |
|
1950 | 1950 | $colors[$color['slug']] = esc_attr($color['color']); |
1951 | 1951 | } |
1952 | 1952 | } |
1953 | - }else{ |
|
1953 | + } else { |
|
1954 | 1954 | $settings = get_option('aui_options'); |
1955 | 1955 | $colors = array( |
1956 | - 'primary' => ! empty( $settings['color_primary'] ) ? $settings['color_primary'] : AUI_PRIMARY_COLOR, |
|
1957 | - 'secondary' => ! empty( $settings['color_secondary'] ) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR |
|
1956 | + 'primary' => !empty($settings['color_primary']) ? $settings['color_primary'] : AUI_PRIMARY_COLOR, |
|
1957 | + 'secondary' => !empty($settings['color_secondary']) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR |
|
1958 | 1958 | ); |
1959 | 1959 | } |
1960 | 1960 | |
@@ -1965,20 +1965,20 @@ discard block |
||
1965 | 1965 | <?php |
1966 | 1966 | |
1967 | 1967 | // BS v3 compat |
1968 | - if( self::is_bs3_compat() ){ |
|
1968 | + if (self::is_bs3_compat()) { |
|
1969 | 1969 | echo self::bs3_compat_css(); |
1970 | 1970 | } |
1971 | 1971 | |
1972 | - if(!empty($colors)){ |
|
1972 | + if (!empty($colors)) { |
|
1973 | 1973 | $d_colors = self::get_colors(true); |
1974 | 1974 | //print_r($d_colors );exit; |
1975 | 1975 | // print_r($colors );exit; |
1976 | - $is_fse = !empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template'; |
|
1977 | - foreach($colors as $key => $color ){ |
|
1978 | - if((empty( $d_colors[$key]) || $d_colors[$key] != $color) || $is_fse ) { |
|
1976 | + $is_fse = !empty($_REQUEST['postType']) && $_REQUEST['postType'] == 'wp_template'; |
|
1977 | + foreach ($colors as $key => $color) { |
|
1978 | + if ((empty($d_colors[$key]) || $d_colors[$key] != $color) || $is_fse) { |
|
1979 | 1979 | $var = $is_fse ? "var(--wp--preset--color--$key)" : $color; |
1980 | 1980 | $compat = $is_fse ? '.editor-styles-wrapper' : $compatibility; |
1981 | - echo self::css_overwrite($key,$var,$compat); |
|
1981 | + echo self::css_overwrite($key, $var, $compat); |
|
1982 | 1982 | } |
1983 | 1983 | } |
1984 | 1984 | // exit; |
@@ -1987,7 +1987,7 @@ discard block |
||
1987 | 1987 | // Set admin bar z-index lower when modal is open. |
1988 | 1988 | echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}'; |
1989 | 1989 | |
1990 | - if(is_admin()){ |
|
1990 | + if (is_admin()) { |
|
1991 | 1991 | echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}'; |
1992 | 1992 | } |
1993 | 1993 | ?> |
@@ -1998,10 +1998,10 @@ discard block |
||
1998 | 1998 | /* |
1999 | 1999 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
2000 | 2000 | */ |
2001 | - return str_replace( array( |
|
2001 | + return str_replace(array( |
|
2002 | 2002 | '<style>', |
2003 | 2003 | '</style>' |
2004 | - ), '', self::minify_css( ob_get_clean() ) ); |
|
2004 | + ), '', self::minify_css(ob_get_clean())); |
|
2005 | 2005 | } |
2006 | 2006 | |
2007 | 2007 | |
@@ -2011,7 +2011,7 @@ discard block |
||
2011 | 2011 | * |
2012 | 2012 | * @return bool |
2013 | 2013 | */ |
2014 | - public static function is_bs3_compat(){ |
|
2014 | + public static function is_bs3_compat() { |
|
2015 | 2015 | return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION'); |
2016 | 2016 | } |
2017 | 2017 | |
@@ -2024,22 +2024,22 @@ discard block |
||
2024 | 2024 | * |
2025 | 2025 | * @return string |
2026 | 2026 | */ |
2027 | - public static function css_overwrite($type,$color_code,$compatibility){ |
|
2027 | + public static function css_overwrite($type, $color_code, $compatibility) { |
|
2028 | 2028 | |
2029 | 2029 | $is_var = false; |
2030 | - if(!$color_code){return '';} |
|
2031 | - if(!sanitize_hex_color($color_code)){ |
|
2030 | + if (!$color_code) {return ''; } |
|
2031 | + if (!sanitize_hex_color($color_code)) { |
|
2032 | 2032 | $color_code = esc_attr($color_code); |
2033 | 2033 | $is_var = true; |
2034 | 2034 | // echo '###1'.$color_code;//exit; |
2035 | 2035 | } |
2036 | - if(!$color_code){return '';} |
|
2036 | + if (!$color_code) {return ''; } |
|
2037 | 2037 | |
2038 | - if($compatibility===true || $compatibility===1){ |
|
2038 | + if ($compatibility === true || $compatibility === 1) { |
|
2039 | 2039 | $compatibility = '.bsui'; |
2040 | - }elseif(!$compatibility){ |
|
2040 | + }elseif (!$compatibility) { |
|
2041 | 2041 | $compatibility = ''; |
2042 | - }else{ |
|
2042 | + } else { |
|
2043 | 2043 | $compatibility = esc_attr($compatibility); |
2044 | 2044 | } |
2045 | 2045 | |
@@ -2051,25 +2051,25 @@ discard block |
||
2051 | 2051 | * c = color, b = background color, o = border-color, f = fill |
2052 | 2052 | */ |
2053 | 2053 | $selectors = array( |
2054 | - ".btn-{$type}" => array( 'b', 'o' ), |
|
2055 | - ".btn-{$type}.disabled" => array( 'b', 'o' ), |
|
2056 | - ".btn-{$type}:disabled" => array( 'b', 'o' ), |
|
2057 | - ".btn-outline-{$type}" => array( 'c', 'o' ), |
|
2058 | - ".btn-outline-{$type}:hover" => array( 'b', 'o' ), |
|
2059 | - ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ), |
|
2060 | - ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ), |
|
2061 | - ".show>.btn-outline-{$type}.dropdown-toggle" => array( 'b', 'o' ), |
|
2062 | - ".badge-{$type}" => array( 'b' ), |
|
2063 | - ".alert-{$type}" => array( 'b', 'o' ), |
|
2064 | - ".bg-{$type}" => array( 'b', 'f' ), |
|
2065 | - ".btn-link.btn-{$type}" => array( 'c' ), |
|
2054 | + ".btn-{$type}" => array('b', 'o'), |
|
2055 | + ".btn-{$type}.disabled" => array('b', 'o'), |
|
2056 | + ".btn-{$type}:disabled" => array('b', 'o'), |
|
2057 | + ".btn-outline-{$type}" => array('c', 'o'), |
|
2058 | + ".btn-outline-{$type}:hover" => array('b', 'o'), |
|
2059 | + ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array('b', 'o'), |
|
2060 | + ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array('b', 'o'), |
|
2061 | + ".show>.btn-outline-{$type}.dropdown-toggle" => array('b', 'o'), |
|
2062 | + ".badge-{$type}" => array('b'), |
|
2063 | + ".alert-{$type}" => array('b', 'o'), |
|
2064 | + ".bg-{$type}" => array('b', 'f'), |
|
2065 | + ".btn-link.btn-{$type}" => array('c'), |
|
2066 | 2066 | ); |
2067 | 2067 | |
2068 | - if ( $type == 'primary' ) { |
|
2068 | + if ($type == 'primary') { |
|
2069 | 2069 | $selectors = $selectors + array( |
2070 | - 'a' => array( 'c' ), |
|
2071 | - '.btn-link' => array( 'c' ), |
|
2072 | - '.dropdown-item.active' => array( 'b' ), |
|
2070 | + 'a' => array('c'), |
|
2071 | + '.btn-link' => array('c'), |
|
2072 | + '.dropdown-item.active' => array('b'), |
|
2073 | 2073 | '.custom-control-input:checked~.custom-control-label::before' => array( |
2074 | 2074 | 'b', |
2075 | 2075 | 'o' |
@@ -2078,19 +2078,19 @@ discard block |
||
2078 | 2078 | 'b', |
2079 | 2079 | 'o' |
2080 | 2080 | ), |
2081 | - '.nav-pills .nav-link.active' => array( 'b' ), |
|
2082 | - '.nav-pills .show>.nav-link' => array( 'b' ), |
|
2083 | - '.page-link' => array( 'c' ), |
|
2081 | + '.nav-pills .nav-link.active' => array('b'), |
|
2082 | + '.nav-pills .show>.nav-link' => array('b'), |
|
2083 | + '.page-link' => array('c'), |
|
2084 | 2084 | '.page-item.active .page-link' => array( |
2085 | 2085 | 'b', |
2086 | 2086 | 'o' |
2087 | 2087 | ), |
2088 | - '.progress-bar' => array( 'b' ), |
|
2088 | + '.progress-bar' => array('b'), |
|
2089 | 2089 | '.list-group-item.active' => array( |
2090 | 2090 | 'b', |
2091 | 2091 | 'o' |
2092 | 2092 | ), |
2093 | - '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ), |
|
2093 | + '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'), |
|
2094 | 2094 | // '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules... |
2095 | 2095 | // '.custom-range::-moz-range-thumb' => array('b'), |
2096 | 2096 | // '.custom-range::-ms-thumb' => array('b'), |
@@ -2098,7 +2098,7 @@ discard block |
||
2098 | 2098 | } |
2099 | 2099 | |
2100 | 2100 | $important_selectors = array( |
2101 | - ".bg-{$type}" => array('b','f'), |
|
2101 | + ".bg-{$type}" => array('b', 'f'), |
|
2102 | 2102 | ".border-{$type}" => array('o'), |
2103 | 2103 | ".text-{$type}" => array('c'), |
2104 | 2104 | ); |
@@ -2115,55 +2115,55 @@ discard block |
||
2115 | 2115 | $output = ''; |
2116 | 2116 | |
2117 | 2117 | // build rules into each type |
2118 | - foreach($selectors as $selector => $types){ |
|
2119 | - $selector = $compatibility ? $compatibility . " ".$selector : $selector; |
|
2120 | - $types = array_combine($types,$types); |
|
2121 | - if(isset($types['c'])){$color[] = $selector;} |
|
2122 | - if(isset($types['b'])){$background[] = $selector;} |
|
2123 | - if(isset($types['o'])){$border[] = $selector;} |
|
2124 | - if(isset($types['f'])){$fill[] = $selector;} |
|
2118 | + foreach ($selectors as $selector => $types) { |
|
2119 | + $selector = $compatibility ? $compatibility . " " . $selector : $selector; |
|
2120 | + $types = array_combine($types, $types); |
|
2121 | + if (isset($types['c'])) {$color[] = $selector; } |
|
2122 | + if (isset($types['b'])) {$background[] = $selector; } |
|
2123 | + if (isset($types['o'])) {$border[] = $selector; } |
|
2124 | + if (isset($types['f'])) {$fill[] = $selector; } |
|
2125 | 2125 | } |
2126 | 2126 | |
2127 | 2127 | // build rules into each type |
2128 | - foreach($important_selectors as $selector => $types){ |
|
2129 | - $selector = $compatibility ? $compatibility . " ".$selector : $selector; |
|
2130 | - $types = array_combine($types,$types); |
|
2131 | - if(isset($types['c'])){$color_i[] = $selector;} |
|
2132 | - if(isset($types['b'])){$background_i[] = $selector;} |
|
2133 | - if(isset($types['o'])){$border_i[] = $selector;} |
|
2134 | - if(isset($types['f'])){$fill_i[] = $selector;} |
|
2128 | + foreach ($important_selectors as $selector => $types) { |
|
2129 | + $selector = $compatibility ? $compatibility . " " . $selector : $selector; |
|
2130 | + $types = array_combine($types, $types); |
|
2131 | + if (isset($types['c'])) {$color_i[] = $selector; } |
|
2132 | + if (isset($types['b'])) {$background_i[] = $selector; } |
|
2133 | + if (isset($types['o'])) {$border_i[] = $selector; } |
|
2134 | + if (isset($types['f'])) {$fill_i[] = $selector; } |
|
2135 | 2135 | } |
2136 | 2136 | |
2137 | 2137 | // add any color rules |
2138 | - if(!empty($color)){ |
|
2139 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
2138 | + if (!empty($color)) { |
|
2139 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
2140 | 2140 | } |
2141 | - if(!empty($color_i)){ |
|
2142 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
2141 | + if (!empty($color_i)) { |
|
2142 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
2143 | 2143 | } |
2144 | 2144 | |
2145 | 2145 | // add any background color rules |
2146 | - if(!empty($background)){ |
|
2147 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
2146 | + if (!empty($background)) { |
|
2147 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
2148 | 2148 | } |
2149 | - if(!empty($background_i)){ |
|
2150 | - $output .= implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
2149 | + if (!empty($background_i)) { |
|
2150 | + $output .= implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
2151 | 2151 | } |
2152 | 2152 | |
2153 | 2153 | // add any border color rules |
2154 | - if(!empty($border)){ |
|
2155 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
2154 | + if (!empty($border)) { |
|
2155 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
2156 | 2156 | } |
2157 | - if(!empty($border_i)){ |
|
2158 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
2157 | + if (!empty($border_i)) { |
|
2158 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
2159 | 2159 | } |
2160 | 2160 | |
2161 | 2161 | // add any fill color rules |
2162 | - if(!empty($fill)){ |
|
2163 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
2162 | + if (!empty($fill)) { |
|
2163 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
2164 | 2164 | } |
2165 | - if(!empty($fill_i)){ |
|
2166 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
2165 | + if (!empty($fill_i)) { |
|
2166 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
2167 | 2167 | } |
2168 | 2168 | |
2169 | 2169 | |
@@ -2171,26 +2171,26 @@ discard block |
||
2171 | 2171 | |
2172 | 2172 | $transition = $is_var ? 'transition: color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out,filter 0.15s ease-in-out;' : ''; |
2173 | 2173 | // darken |
2174 | - $darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075"); |
|
2175 | - $darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10"); |
|
2176 | - $darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125"); |
|
2174 | + $darker_075 = $is_var ? $color_code . ';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code, "-0.075"); |
|
2175 | + $darker_10 = $is_var ? $color_code . ';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code, "-0.10"); |
|
2176 | + $darker_125 = $is_var ? $color_code . ';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code, "-0.125"); |
|
2177 | 2177 | |
2178 | 2178 | // lighten |
2179 | - $lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25"); |
|
2179 | + $lighten_25 = $is_var ? $color_code . ';filter:brightness(1.25)' : self::css_hex_lighten_darken($color_code, "0.25"); |
|
2180 | 2180 | |
2181 | 2181 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
2182 | - $op_25 = $color_code."40"; // 25% opacity |
|
2182 | + $op_25 = $color_code . "40"; // 25% opacity |
|
2183 | 2183 | |
2184 | 2184 | |
2185 | 2185 | // button states |
2186 | - $output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : ''; |
|
2187 | - $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075."; border-color: ".$darker_10.";} "; |
|
2186 | + $output .= $is_var ? $prefix . " .btn-{$type}{{$transition }} " : ''; |
|
2187 | + $output .= $prefix . " .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: " . $darker_075 . "; border-color: " . $darker_10 . ";} "; |
|
2188 | 2188 | // $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000; border-color: #000;} "; |
2189 | - $output .= $prefix ." .btn-outline-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-{$type}.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
2190 | - $output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active, $prefix .btn-{$type}:not(:disabled):not(.disabled).active, .show>$prefix .btn-{$type}.dropdown-toggle{background-color: ".$darker_10."; border-color: ".$darker_125.";} "; |
|
2191 | - $output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-{$type}.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
2189 | + $output .= $prefix . " .btn-outline-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-{$type}.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
2190 | + $output .= $prefix . " .btn-{$type}:not(:disabled):not(.disabled):active, $prefix .btn-{$type}:not(:disabled):not(.disabled).active, .show>$prefix .btn-{$type}.dropdown-toggle{background-color: " . $darker_10 . "; border-color: " . $darker_125 . ";} "; |
|
2191 | + $output .= $prefix . " .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-{$type}.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
2192 | 2192 | |
2193 | - if ( $type == 'primary' ) { |
|
2193 | + if ($type == 'primary') { |
|
2194 | 2194 | // dropdown's |
2195 | 2195 | $output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} "; |
2196 | 2196 | |
@@ -2214,11 +2214,11 @@ discard block |
||
2214 | 2214 | * |
2215 | 2215 | * @return string |
2216 | 2216 | */ |
2217 | - public static function css_primary($color_code,$compatibility, $use_variable = false){ |
|
2217 | + public static function css_primary($color_code, $compatibility, $use_variable = false) { |
|
2218 | 2218 | |
2219 | - if(!$use_variable){ |
|
2219 | + if (!$use_variable) { |
|
2220 | 2220 | $color_code = sanitize_hex_color($color_code); |
2221 | - if(!$color_code){return '';} |
|
2221 | + if (!$color_code) {return ''; } |
|
2222 | 2222 | } |
2223 | 2223 | |
2224 | 2224 | /** |
@@ -2226,36 +2226,36 @@ discard block |
||
2226 | 2226 | */ |
2227 | 2227 | $selectors = array( |
2228 | 2228 | 'a' => array('c'), |
2229 | - '.btn-primary' => array('b','o'), |
|
2230 | - '.btn-primary.disabled' => array('b','o'), |
|
2231 | - '.btn-primary:disabled' => array('b','o'), |
|
2232 | - '.btn-outline-primary' => array('c','o'), |
|
2233 | - '.btn-outline-primary:hover' => array('b','o'), |
|
2234 | - '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'), |
|
2235 | - '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'), |
|
2236 | - '.show>.btn-outline-primary.dropdown-toggle' => array('b','o'), |
|
2229 | + '.btn-primary' => array('b', 'o'), |
|
2230 | + '.btn-primary.disabled' => array('b', 'o'), |
|
2231 | + '.btn-primary:disabled' => array('b', 'o'), |
|
2232 | + '.btn-outline-primary' => array('c', 'o'), |
|
2233 | + '.btn-outline-primary:hover' => array('b', 'o'), |
|
2234 | + '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b', 'o'), |
|
2235 | + '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b', 'o'), |
|
2236 | + '.show>.btn-outline-primary.dropdown-toggle' => array('b', 'o'), |
|
2237 | 2237 | '.btn-link' => array('c'), |
2238 | 2238 | '.dropdown-item.active' => array('b'), |
2239 | - '.custom-control-input:checked~.custom-control-label::before' => array('b','o'), |
|
2240 | - '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'), |
|
2239 | + '.custom-control-input:checked~.custom-control-label::before' => array('b', 'o'), |
|
2240 | + '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b', 'o'), |
|
2241 | 2241 | // '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules... |
2242 | 2242 | // '.custom-range::-moz-range-thumb' => array('b'), |
2243 | 2243 | // '.custom-range::-ms-thumb' => array('b'), |
2244 | 2244 | '.nav-pills .nav-link.active' => array('b'), |
2245 | 2245 | '.nav-pills .show>.nav-link' => array('b'), |
2246 | 2246 | '.page-link' => array('c'), |
2247 | - '.page-item.active .page-link' => array('b','o'), |
|
2247 | + '.page-item.active .page-link' => array('b', 'o'), |
|
2248 | 2248 | '.badge-primary' => array('b'), |
2249 | - '.alert-primary' => array('b','o'), |
|
2249 | + '.alert-primary' => array('b', 'o'), |
|
2250 | 2250 | '.progress-bar' => array('b'), |
2251 | - '.list-group-item.active' => array('b','o'), |
|
2252 | - '.bg-primary' => array('b','f'), |
|
2251 | + '.list-group-item.active' => array('b', 'o'), |
|
2252 | + '.bg-primary' => array('b', 'f'), |
|
2253 | 2253 | '.btn-link.btn-primary' => array('c'), |
2254 | 2254 | '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'), |
2255 | 2255 | ); |
2256 | 2256 | |
2257 | 2257 | $important_selectors = array( |
2258 | - '.bg-primary' => array('b','f'), |
|
2258 | + '.bg-primary' => array('b', 'f'), |
|
2259 | 2259 | '.border-primary' => array('o'), |
2260 | 2260 | '.text-primary' => array('c'), |
2261 | 2261 | ); |
@@ -2272,88 +2272,88 @@ discard block |
||
2272 | 2272 | $output = ''; |
2273 | 2273 | |
2274 | 2274 | // build rules into each type |
2275 | - foreach($selectors as $selector => $types){ |
|
2276 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
2277 | - $types = array_combine($types,$types); |
|
2278 | - if(isset($types['c'])){$color[] = $selector;} |
|
2279 | - if(isset($types['b'])){$background[] = $selector;} |
|
2280 | - if(isset($types['o'])){$border[] = $selector;} |
|
2281 | - if(isset($types['f'])){$fill[] = $selector;} |
|
2275 | + foreach ($selectors as $selector => $types) { |
|
2276 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
2277 | + $types = array_combine($types, $types); |
|
2278 | + if (isset($types['c'])) {$color[] = $selector; } |
|
2279 | + if (isset($types['b'])) {$background[] = $selector; } |
|
2280 | + if (isset($types['o'])) {$border[] = $selector; } |
|
2281 | + if (isset($types['f'])) {$fill[] = $selector; } |
|
2282 | 2282 | } |
2283 | 2283 | |
2284 | 2284 | // build rules into each type |
2285 | - foreach($important_selectors as $selector => $types){ |
|
2286 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
2287 | - $types = array_combine($types,$types); |
|
2288 | - if(isset($types['c'])){$color_i[] = $selector;} |
|
2289 | - if(isset($types['b'])){$background_i[] = $selector;} |
|
2290 | - if(isset($types['o'])){$border_i[] = $selector;} |
|
2291 | - if(isset($types['f'])){$fill_i[] = $selector;} |
|
2285 | + foreach ($important_selectors as $selector => $types) { |
|
2286 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
2287 | + $types = array_combine($types, $types); |
|
2288 | + if (isset($types['c'])) {$color_i[] = $selector; } |
|
2289 | + if (isset($types['b'])) {$background_i[] = $selector; } |
|
2290 | + if (isset($types['o'])) {$border_i[] = $selector; } |
|
2291 | + if (isset($types['f'])) {$fill_i[] = $selector; } |
|
2292 | 2292 | } |
2293 | 2293 | |
2294 | 2294 | // add any color rules |
2295 | - if(!empty($color)){ |
|
2296 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
2295 | + if (!empty($color)) { |
|
2296 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
2297 | 2297 | } |
2298 | - if(!empty($color_i)){ |
|
2299 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
2298 | + if (!empty($color_i)) { |
|
2299 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
2300 | 2300 | } |
2301 | 2301 | |
2302 | 2302 | // add any background color rules |
2303 | - if(!empty($background)){ |
|
2304 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
2303 | + if (!empty($background)) { |
|
2304 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
2305 | 2305 | } |
2306 | - if(!empty($background_i)){ |
|
2307 | - $output .= implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
2306 | + if (!empty($background_i)) { |
|
2307 | + $output .= implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
2308 | 2308 | } |
2309 | 2309 | |
2310 | 2310 | // add any border color rules |
2311 | - if(!empty($border)){ |
|
2312 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
2311 | + if (!empty($border)) { |
|
2312 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
2313 | 2313 | } |
2314 | - if(!empty($border_i)){ |
|
2315 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
2314 | + if (!empty($border_i)) { |
|
2315 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
2316 | 2316 | } |
2317 | 2317 | |
2318 | 2318 | // add any fill color rules |
2319 | - if(!empty($fill)){ |
|
2320 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
2319 | + if (!empty($fill)) { |
|
2320 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
2321 | 2321 | } |
2322 | - if(!empty($fill_i)){ |
|
2323 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
2322 | + if (!empty($fill_i)) { |
|
2323 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
2324 | 2324 | } |
2325 | 2325 | |
2326 | 2326 | |
2327 | 2327 | $prefix = $compatibility ? ".bsui " : ""; |
2328 | 2328 | |
2329 | 2329 | // darken |
2330 | - $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075"); |
|
2331 | - $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10"); |
|
2332 | - $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125"); |
|
2330 | + $darker_075 = self::css_hex_lighten_darken($color_code, "-0.075"); |
|
2331 | + $darker_10 = self::css_hex_lighten_darken($color_code, "-0.10"); |
|
2332 | + $darker_125 = self::css_hex_lighten_darken($color_code, "-0.125"); |
|
2333 | 2333 | |
2334 | 2334 | // lighten |
2335 | - $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25"); |
|
2335 | + $lighten_25 = self::css_hex_lighten_darken($color_code, "0.25"); |
|
2336 | 2336 | |
2337 | 2337 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
2338 | - $op_25 = $color_code."40"; // 25% opacity |
|
2338 | + $op_25 = $color_code . "40"; // 25% opacity |
|
2339 | 2339 | |
2340 | 2340 | |
2341 | 2341 | // button states |
2342 | - $output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075."; border-color: ".$darker_10.";} "; |
|
2343 | - $output .= $prefix ." .btn-outline-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-primary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
2344 | - $output .= $prefix ." .btn-primary:not(:disabled):not(.disabled):active, $prefix .btn-primary:not(:disabled):not(.disabled).active, .show>$prefix .btn-primary.dropdown-toggle{background-color: ".$darker_10."; border-color: ".$darker_125.";} "; |
|
2345 | - $output .= $prefix ." .btn-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-primary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
2342 | + $output .= $prefix . " .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: " . $darker_075 . "; border-color: " . $darker_10 . ";} "; |
|
2343 | + $output .= $prefix . " .btn-outline-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-primary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
2344 | + $output .= $prefix . " .btn-primary:not(:disabled):not(.disabled):active, $prefix .btn-primary:not(:disabled):not(.disabled).active, .show>$prefix .btn-primary.dropdown-toggle{background-color: " . $darker_10 . "; border-color: " . $darker_125 . ";} "; |
|
2345 | + $output .= $prefix . " .btn-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-primary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
2346 | 2346 | |
2347 | 2347 | |
2348 | 2348 | // dropdown's |
2349 | - $output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} "; |
|
2349 | + $output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} "; |
|
2350 | 2350 | |
2351 | 2351 | |
2352 | 2352 | // input states |
2353 | - $output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
2353 | + $output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
2354 | 2354 | |
2355 | 2355 | // page link |
2356 | - $output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
2356 | + $output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
2357 | 2357 | |
2358 | 2358 | return $output; |
2359 | 2359 | } |
@@ -2367,30 +2367,30 @@ discard block |
||
2367 | 2367 | * |
2368 | 2368 | * @return string |
2369 | 2369 | */ |
2370 | - public static function css_secondary($color_code,$compatibility){; |
|
2370 | + public static function css_secondary($color_code, $compatibility) {; |
|
2371 | 2371 | $color_code = sanitize_hex_color($color_code); |
2372 | - if(!$color_code){return '';} |
|
2372 | + if (!$color_code) {return ''; } |
|
2373 | 2373 | /** |
2374 | 2374 | * c = color, b = background color, o = border-color, f = fill |
2375 | 2375 | */ |
2376 | 2376 | $selectors = array( |
2377 | - '.btn-secondary' => array('b','o'), |
|
2378 | - '.btn-secondary.disabled' => array('b','o'), |
|
2379 | - '.btn-secondary:disabled' => array('b','o'), |
|
2380 | - '.btn-outline-secondary' => array('c','o'), |
|
2381 | - '.btn-outline-secondary:hover' => array('b','o'), |
|
2377 | + '.btn-secondary' => array('b', 'o'), |
|
2378 | + '.btn-secondary.disabled' => array('b', 'o'), |
|
2379 | + '.btn-secondary:disabled' => array('b', 'o'), |
|
2380 | + '.btn-outline-secondary' => array('c', 'o'), |
|
2381 | + '.btn-outline-secondary:hover' => array('b', 'o'), |
|
2382 | 2382 | '.btn-outline-secondary.disabled' => array('c'), |
2383 | 2383 | '.btn-outline-secondary:disabled' => array('c'), |
2384 | - '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'), |
|
2385 | - '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'), |
|
2386 | - '.btn-outline-secondary.dropdown-toggle' => array('b','o'), |
|
2384 | + '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b', 'o'), |
|
2385 | + '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b', 'o'), |
|
2386 | + '.btn-outline-secondary.dropdown-toggle' => array('b', 'o'), |
|
2387 | 2387 | '.badge-secondary' => array('b'), |
2388 | - '.alert-secondary' => array('b','o'), |
|
2388 | + '.alert-secondary' => array('b', 'o'), |
|
2389 | 2389 | '.btn-link.btn-secondary' => array('c'), |
2390 | 2390 | ); |
2391 | 2391 | |
2392 | 2392 | $important_selectors = array( |
2393 | - '.bg-secondary' => array('b','f'), |
|
2393 | + '.bg-secondary' => array('b', 'f'), |
|
2394 | 2394 | '.border-secondary' => array('o'), |
2395 | 2395 | '.text-secondary' => array('c'), |
2396 | 2396 | ); |
@@ -2407,77 +2407,77 @@ discard block |
||
2407 | 2407 | $output = ''; |
2408 | 2408 | |
2409 | 2409 | // build rules into each type |
2410 | - foreach($selectors as $selector => $types){ |
|
2411 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
2412 | - $types = array_combine($types,$types); |
|
2413 | - if(isset($types['c'])){$color[] = $selector;} |
|
2414 | - if(isset($types['b'])){$background[] = $selector;} |
|
2415 | - if(isset($types['o'])){$border[] = $selector;} |
|
2416 | - if(isset($types['f'])){$fill[] = $selector;} |
|
2410 | + foreach ($selectors as $selector => $types) { |
|
2411 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
2412 | + $types = array_combine($types, $types); |
|
2413 | + if (isset($types['c'])) {$color[] = $selector; } |
|
2414 | + if (isset($types['b'])) {$background[] = $selector; } |
|
2415 | + if (isset($types['o'])) {$border[] = $selector; } |
|
2416 | + if (isset($types['f'])) {$fill[] = $selector; } |
|
2417 | 2417 | } |
2418 | 2418 | |
2419 | 2419 | // build rules into each type |
2420 | - foreach($important_selectors as $selector => $types){ |
|
2421 | - $selector = $compatibility ? ".bsui ".$selector : $selector; |
|
2422 | - $types = array_combine($types,$types); |
|
2423 | - if(isset($types['c'])){$color_i[] = $selector;} |
|
2424 | - if(isset($types['b'])){$background_i[] = $selector;} |
|
2425 | - if(isset($types['o'])){$border_i[] = $selector;} |
|
2426 | - if(isset($types['f'])){$fill_i[] = $selector;} |
|
2420 | + foreach ($important_selectors as $selector => $types) { |
|
2421 | + $selector = $compatibility ? ".bsui " . $selector : $selector; |
|
2422 | + $types = array_combine($types, $types); |
|
2423 | + if (isset($types['c'])) {$color_i[] = $selector; } |
|
2424 | + if (isset($types['b'])) {$background_i[] = $selector; } |
|
2425 | + if (isset($types['o'])) {$border_i[] = $selector; } |
|
2426 | + if (isset($types['f'])) {$fill_i[] = $selector; } |
|
2427 | 2427 | } |
2428 | 2428 | |
2429 | 2429 | // add any color rules |
2430 | - if(!empty($color)){ |
|
2431 | - $output .= implode(",",$color) . "{color: $color_code;} "; |
|
2430 | + if (!empty($color)) { |
|
2431 | + $output .= implode(",", $color) . "{color: $color_code;} "; |
|
2432 | 2432 | } |
2433 | - if(!empty($color_i)){ |
|
2434 | - $output .= implode(",",$color_i) . "{color: $color_code !important;} "; |
|
2433 | + if (!empty($color_i)) { |
|
2434 | + $output .= implode(",", $color_i) . "{color: $color_code !important;} "; |
|
2435 | 2435 | } |
2436 | 2436 | |
2437 | 2437 | // add any background color rules |
2438 | - if(!empty($background)){ |
|
2439 | - $output .= implode(",",$background) . "{background-color: $color_code;} "; |
|
2438 | + if (!empty($background)) { |
|
2439 | + $output .= implode(",", $background) . "{background-color: $color_code;} "; |
|
2440 | 2440 | } |
2441 | - if(!empty($background_i)){ |
|
2442 | - $output .= implode(",",$background_i) . "{background-color: $color_code !important;} "; |
|
2441 | + if (!empty($background_i)) { |
|
2442 | + $output .= implode(",", $background_i) . "{background-color: $color_code !important;} "; |
|
2443 | 2443 | } |
2444 | 2444 | |
2445 | 2445 | // add any border color rules |
2446 | - if(!empty($border)){ |
|
2447 | - $output .= implode(",",$border) . "{border-color: $color_code;} "; |
|
2446 | + if (!empty($border)) { |
|
2447 | + $output .= implode(",", $border) . "{border-color: $color_code;} "; |
|
2448 | 2448 | } |
2449 | - if(!empty($border_i)){ |
|
2450 | - $output .= implode(",",$border_i) . "{border-color: $color_code !important;} "; |
|
2449 | + if (!empty($border_i)) { |
|
2450 | + $output .= implode(",", $border_i) . "{border-color: $color_code !important;} "; |
|
2451 | 2451 | } |
2452 | 2452 | |
2453 | 2453 | // add any fill color rules |
2454 | - if(!empty($fill)){ |
|
2455 | - $output .= implode(",",$fill) . "{fill: $color_code;} "; |
|
2454 | + if (!empty($fill)) { |
|
2455 | + $output .= implode(",", $fill) . "{fill: $color_code;} "; |
|
2456 | 2456 | } |
2457 | - if(!empty($fill_i)){ |
|
2458 | - $output .= implode(",",$fill_i) . "{fill: $color_code !important;} "; |
|
2457 | + if (!empty($fill_i)) { |
|
2458 | + $output .= implode(",", $fill_i) . "{fill: $color_code !important;} "; |
|
2459 | 2459 | } |
2460 | 2460 | |
2461 | 2461 | |
2462 | 2462 | $prefix = $compatibility ? ".bsui " : ""; |
2463 | 2463 | |
2464 | 2464 | // darken |
2465 | - $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075"); |
|
2466 | - $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10"); |
|
2467 | - $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125"); |
|
2465 | + $darker_075 = self::css_hex_lighten_darken($color_code, "-0.075"); |
|
2466 | + $darker_10 = self::css_hex_lighten_darken($color_code, "-0.10"); |
|
2467 | + $darker_125 = self::css_hex_lighten_darken($color_code, "-0.125"); |
|
2468 | 2468 | |
2469 | 2469 | // lighten |
2470 | - $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25"); |
|
2470 | + $lighten_25 = self::css_hex_lighten_darken($color_code, "0.25"); |
|
2471 | 2471 | |
2472 | 2472 | // opacity see https://css-tricks.com/8-digit-hex-codes/ |
2473 | - $op_25 = $color_code."40"; // 25% opacity |
|
2473 | + $op_25 = $color_code . "40"; // 25% opacity |
|
2474 | 2474 | |
2475 | 2475 | |
2476 | 2476 | // button states |
2477 | - $output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075."; border-color: ".$darker_10.";} "; |
|
2478 | - $output .= $prefix ." .btn-outline-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-secondary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
2479 | - $output .= $prefix ." .btn-secondary:not(:disabled):not(.disabled):active, $prefix .btn-secondary:not(:disabled):not(.disabled).active, .show>$prefix .btn-secondary.dropdown-toggle{background-color: ".$darker_10."; border-color: ".$darker_125.";} "; |
|
2480 | - $output .= $prefix ." .btn-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-secondary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
2477 | + $output .= $prefix . " .btn-secondary:hover{background-color: " . $darker_075 . "; border-color: " . $darker_10 . ";} "; |
|
2478 | + $output .= $prefix . " .btn-outline-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-secondary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
2479 | + $output .= $prefix . " .btn-secondary:not(:disabled):not(.disabled):active, $prefix .btn-secondary:not(:disabled):not(.disabled).active, .show>$prefix .btn-secondary.dropdown-toggle{background-color: " . $darker_10 . "; border-color: " . $darker_125 . ";} "; |
|
2480 | + $output .= $prefix . " .btn-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-secondary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} "; |
|
2481 | 2481 | |
2482 | 2482 | |
2483 | 2483 | return $output; |
@@ -2513,8 +2513,8 @@ discard block |
||
2513 | 2513 | /** |
2514 | 2514 | * Check if we should display examples. |
2515 | 2515 | */ |
2516 | - public function maybe_show_examples(){ |
|
2517 | - if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){ |
|
2516 | + public function maybe_show_examples() { |
|
2517 | + if (current_user_can('manage_options') && isset($_REQUEST['preview-aui'])) { |
|
2518 | 2518 | echo "<head>"; |
2519 | 2519 | wp_head(); |
2520 | 2520 | echo "</head>"; |
@@ -2530,7 +2530,7 @@ discard block |
||
2530 | 2530 | * |
2531 | 2531 | * @return string |
2532 | 2532 | */ |
2533 | - public function get_examples(){ |
|
2533 | + public function get_examples() { |
|
2534 | 2534 | $output = ''; |
2535 | 2535 | |
2536 | 2536 | |
@@ -2636,74 +2636,74 @@ discard block |
||
2636 | 2636 | */ |
2637 | 2637 | public static function calendar_params() { |
2638 | 2638 | $params = array( |
2639 | - 'month_long_1' => __( 'January', 'aui' ), |
|
2640 | - 'month_long_2' => __( 'February', 'aui' ), |
|
2641 | - 'month_long_3' => __( 'March', 'aui' ), |
|
2642 | - 'month_long_4' => __( 'April', 'aui' ), |
|
2643 | - 'month_long_5' => __( 'May', 'aui' ), |
|
2644 | - 'month_long_6' => __( 'June', 'aui' ), |
|
2645 | - 'month_long_7' => __( 'July', 'aui' ), |
|
2646 | - 'month_long_8' => __( 'August', 'aui' ), |
|
2647 | - 'month_long_9' => __( 'September', 'aui' ), |
|
2648 | - 'month_long_10' => __( 'October', 'aui' ), |
|
2649 | - 'month_long_11' => __( 'November', 'aui' ), |
|
2650 | - 'month_long_12' => __( 'December', 'aui' ), |
|
2651 | - 'month_s_1' => _x( 'Jan', 'January abbreviation', 'aui' ), |
|
2652 | - 'month_s_2' => _x( 'Feb', 'February abbreviation', 'aui' ), |
|
2653 | - 'month_s_3' => _x( 'Mar', 'March abbreviation', 'aui' ), |
|
2654 | - 'month_s_4' => _x( 'Apr', 'April abbreviation', 'aui' ), |
|
2655 | - 'month_s_5' => _x( 'May', 'May abbreviation', 'aui' ), |
|
2656 | - 'month_s_6' => _x( 'Jun', 'June abbreviation', 'aui' ), |
|
2657 | - 'month_s_7' => _x( 'Jul', 'July abbreviation', 'aui' ), |
|
2658 | - 'month_s_8' => _x( 'Aug', 'August abbreviation', 'aui' ), |
|
2659 | - 'month_s_9' => _x( 'Sep', 'September abbreviation', 'aui' ), |
|
2660 | - 'month_s_10' => _x( 'Oct', 'October abbreviation', 'aui' ), |
|
2661 | - 'month_s_11' => _x( 'Nov', 'November abbreviation', 'aui' ), |
|
2662 | - 'month_s_12' => _x( 'Dec', 'December abbreviation', 'aui' ), |
|
2663 | - 'day_s1_1' => _x( 'S', 'Sunday initial', 'aui' ), |
|
2664 | - 'day_s1_2' => _x( 'M', 'Monday initial', 'aui' ), |
|
2665 | - 'day_s1_3' => _x( 'T', 'Tuesday initial', 'aui' ), |
|
2666 | - 'day_s1_4' => _x( 'W', 'Wednesday initial', 'aui' ), |
|
2667 | - 'day_s1_5' => _x( 'T', 'Friday initial', 'aui' ), |
|
2668 | - 'day_s1_6' => _x( 'F', 'Thursday initial', 'aui' ), |
|
2669 | - 'day_s1_7' => _x( 'S', 'Saturday initial', 'aui' ), |
|
2670 | - 'day_s2_1' => __( 'Su', 'aui' ), |
|
2671 | - 'day_s2_2' => __( 'Mo', 'aui' ), |
|
2672 | - 'day_s2_3' => __( 'Tu', 'aui' ), |
|
2673 | - 'day_s2_4' => __( 'We', 'aui' ), |
|
2674 | - 'day_s2_5' => __( 'Th', 'aui' ), |
|
2675 | - 'day_s2_6' => __( 'Fr', 'aui' ), |
|
2676 | - 'day_s2_7' => __( 'Sa', 'aui' ), |
|
2677 | - 'day_s3_1' => __( 'Sun', 'aui' ), |
|
2678 | - 'day_s3_2' => __( 'Mon', 'aui' ), |
|
2679 | - 'day_s3_3' => __( 'Tue', 'aui' ), |
|
2680 | - 'day_s3_4' => __( 'Wed', 'aui' ), |
|
2681 | - 'day_s3_5' => __( 'Thu', 'aui' ), |
|
2682 | - 'day_s3_6' => __( 'Fri', 'aui' ), |
|
2683 | - 'day_s3_7' => __( 'Sat', 'aui' ), |
|
2684 | - 'day_s5_1' => __( 'Sunday', 'aui' ), |
|
2685 | - 'day_s5_2' => __( 'Monday', 'aui' ), |
|
2686 | - 'day_s5_3' => __( 'Tuesday', 'aui' ), |
|
2687 | - 'day_s5_4' => __( 'Wednesday', 'aui' ), |
|
2688 | - 'day_s5_5' => __( 'Thursday', 'aui' ), |
|
2689 | - 'day_s5_6' => __( 'Friday', 'aui' ), |
|
2690 | - 'day_s5_7' => __( 'Saturday', 'aui' ), |
|
2691 | - 'am_lower' => __( 'am', 'aui' ), |
|
2692 | - 'pm_lower' => __( 'pm', 'aui' ), |
|
2693 | - 'am_upper' => __( 'AM', 'aui' ), |
|
2694 | - 'pm_upper' => __( 'PM', 'aui' ), |
|
2695 | - 'firstDayOfWeek' => (int) get_option( 'start_of_week' ), |
|
2639 | + 'month_long_1' => __('January', 'aui'), |
|
2640 | + 'month_long_2' => __('February', 'aui'), |
|
2641 | + 'month_long_3' => __('March', 'aui'), |
|
2642 | + 'month_long_4' => __('April', 'aui'), |
|
2643 | + 'month_long_5' => __('May', 'aui'), |
|
2644 | + 'month_long_6' => __('June', 'aui'), |
|
2645 | + 'month_long_7' => __('July', 'aui'), |
|
2646 | + 'month_long_8' => __('August', 'aui'), |
|
2647 | + 'month_long_9' => __('September', 'aui'), |
|
2648 | + 'month_long_10' => __('October', 'aui'), |
|
2649 | + 'month_long_11' => __('November', 'aui'), |
|
2650 | + 'month_long_12' => __('December', 'aui'), |
|
2651 | + 'month_s_1' => _x('Jan', 'January abbreviation', 'aui'), |
|
2652 | + 'month_s_2' => _x('Feb', 'February abbreviation', 'aui'), |
|
2653 | + 'month_s_3' => _x('Mar', 'March abbreviation', 'aui'), |
|
2654 | + 'month_s_4' => _x('Apr', 'April abbreviation', 'aui'), |
|
2655 | + 'month_s_5' => _x('May', 'May abbreviation', 'aui'), |
|
2656 | + 'month_s_6' => _x('Jun', 'June abbreviation', 'aui'), |
|
2657 | + 'month_s_7' => _x('Jul', 'July abbreviation', 'aui'), |
|
2658 | + 'month_s_8' => _x('Aug', 'August abbreviation', 'aui'), |
|
2659 | + 'month_s_9' => _x('Sep', 'September abbreviation', 'aui'), |
|
2660 | + 'month_s_10' => _x('Oct', 'October abbreviation', 'aui'), |
|
2661 | + 'month_s_11' => _x('Nov', 'November abbreviation', 'aui'), |
|
2662 | + 'month_s_12' => _x('Dec', 'December abbreviation', 'aui'), |
|
2663 | + 'day_s1_1' => _x('S', 'Sunday initial', 'aui'), |
|
2664 | + 'day_s1_2' => _x('M', 'Monday initial', 'aui'), |
|
2665 | + 'day_s1_3' => _x('T', 'Tuesday initial', 'aui'), |
|
2666 | + 'day_s1_4' => _x('W', 'Wednesday initial', 'aui'), |
|
2667 | + 'day_s1_5' => _x('T', 'Friday initial', 'aui'), |
|
2668 | + 'day_s1_6' => _x('F', 'Thursday initial', 'aui'), |
|
2669 | + 'day_s1_7' => _x('S', 'Saturday initial', 'aui'), |
|
2670 | + 'day_s2_1' => __('Su', 'aui'), |
|
2671 | + 'day_s2_2' => __('Mo', 'aui'), |
|
2672 | + 'day_s2_3' => __('Tu', 'aui'), |
|
2673 | + 'day_s2_4' => __('We', 'aui'), |
|
2674 | + 'day_s2_5' => __('Th', 'aui'), |
|
2675 | + 'day_s2_6' => __('Fr', 'aui'), |
|
2676 | + 'day_s2_7' => __('Sa', 'aui'), |
|
2677 | + 'day_s3_1' => __('Sun', 'aui'), |
|
2678 | + 'day_s3_2' => __('Mon', 'aui'), |
|
2679 | + 'day_s3_3' => __('Tue', 'aui'), |
|
2680 | + 'day_s3_4' => __('Wed', 'aui'), |
|
2681 | + 'day_s3_5' => __('Thu', 'aui'), |
|
2682 | + 'day_s3_6' => __('Fri', 'aui'), |
|
2683 | + 'day_s3_7' => __('Sat', 'aui'), |
|
2684 | + 'day_s5_1' => __('Sunday', 'aui'), |
|
2685 | + 'day_s5_2' => __('Monday', 'aui'), |
|
2686 | + 'day_s5_3' => __('Tuesday', 'aui'), |
|
2687 | + 'day_s5_4' => __('Wednesday', 'aui'), |
|
2688 | + 'day_s5_5' => __('Thursday', 'aui'), |
|
2689 | + 'day_s5_6' => __('Friday', 'aui'), |
|
2690 | + 'day_s5_7' => __('Saturday', 'aui'), |
|
2691 | + 'am_lower' => __('am', 'aui'), |
|
2692 | + 'pm_lower' => __('pm', 'aui'), |
|
2693 | + 'am_upper' => __('AM', 'aui'), |
|
2694 | + 'pm_upper' => __('PM', 'aui'), |
|
2695 | + 'firstDayOfWeek' => (int) get_option('start_of_week'), |
|
2696 | 2696 | 'time_24hr' => false, |
2697 | - 'year' => __( 'Year', 'aui' ), |
|
2698 | - 'hour' => __( 'Hour', 'aui' ), |
|
2699 | - 'minute' => __( 'Minute', 'aui' ), |
|
2700 | - 'weekAbbreviation' => __( 'Wk', 'aui' ), |
|
2701 | - 'rangeSeparator' => __( ' to ', 'aui' ), |
|
2702 | - 'scrollTitle' => __( 'Scroll to increment', 'aui' ), |
|
2703 | - 'toggleTitle' => __( 'Click to toggle', 'aui' ) |
|
2697 | + 'year' => __('Year', 'aui'), |
|
2698 | + 'hour' => __('Hour', 'aui'), |
|
2699 | + 'minute' => __('Minute', 'aui'), |
|
2700 | + 'weekAbbreviation' => __('Wk', 'aui'), |
|
2701 | + 'rangeSeparator' => __(' to ', 'aui'), |
|
2702 | + 'scrollTitle' => __('Scroll to increment', 'aui'), |
|
2703 | + 'toggleTitle' => __('Click to toggle', 'aui') |
|
2704 | 2704 | ); |
2705 | 2705 | |
2706 | - return apply_filters( 'ayecode_ui_calendar_params', $params ); |
|
2706 | + return apply_filters('ayecode_ui_calendar_params', $params); |
|
2707 | 2707 | } |
2708 | 2708 | |
2709 | 2709 | /** |
@@ -2716,47 +2716,47 @@ discard block |
||
2716 | 2716 | public static function flatpickr_locale() { |
2717 | 2717 | $params = self::calendar_params(); |
2718 | 2718 | |
2719 | - if ( is_string( $params ) ) { |
|
2720 | - $params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' ); |
|
2719 | + if (is_string($params)) { |
|
2720 | + $params = html_entity_decode($params, ENT_QUOTES, 'UTF-8'); |
|
2721 | 2721 | } else { |
2722 | - foreach ( (array) $params as $key => $value ) { |
|
2723 | - if ( ! is_scalar( $value ) ) { |
|
2722 | + foreach ((array) $params as $key => $value) { |
|
2723 | + if (!is_scalar($value)) { |
|
2724 | 2724 | continue; |
2725 | 2725 | } |
2726 | 2726 | |
2727 | - $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); |
|
2727 | + $params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
2728 | 2728 | } |
2729 | 2729 | } |
2730 | 2730 | |
2731 | 2731 | $day_s3 = array(); |
2732 | 2732 | $day_s5 = array(); |
2733 | 2733 | |
2734 | - for ( $i = 1; $i <= 7; $i ++ ) { |
|
2735 | - $day_s3[] = addslashes( $params[ 'day_s3_' . $i ] ); |
|
2736 | - $day_s5[] = addslashes( $params[ 'day_s3_' . $i ] ); |
|
2734 | + for ($i = 1; $i <= 7; $i++) { |
|
2735 | + $day_s3[] = addslashes($params['day_s3_' . $i]); |
|
2736 | + $day_s5[] = addslashes($params['day_s3_' . $i]); |
|
2737 | 2737 | } |
2738 | 2738 | |
2739 | 2739 | $month_s = array(); |
2740 | 2740 | $month_long = array(); |
2741 | 2741 | |
2742 | - for ( $i = 1; $i <= 12; $i ++ ) { |
|
2743 | - $month_s[] = addslashes( $params[ 'month_s_' . $i ] ); |
|
2744 | - $month_long[] = addslashes( $params[ 'month_long_' . $i ] ); |
|
2742 | + for ($i = 1; $i <= 12; $i++) { |
|
2743 | + $month_s[] = addslashes($params['month_s_' . $i]); |
|
2744 | + $month_long[] = addslashes($params['month_long_' . $i]); |
|
2745 | 2745 | } |
2746 | 2746 | |
2747 | 2747 | ob_start(); |
2748 | - if ( 0 ) { ?><script><?php } ?> |
|
2748 | + if (0) { ?><script><?php } ?> |
|
2749 | 2749 | { |
2750 | 2750 | weekdays: { |
2751 | - shorthand: ['<?php echo implode( "','", $day_s3 ); ?>'], |
|
2752 | - longhand: ['<?php echo implode( "','", $day_s5 ); ?>'], |
|
2751 | + shorthand: ['<?php echo implode("','", $day_s3); ?>'], |
|
2752 | + longhand: ['<?php echo implode("','", $day_s5); ?>'], |
|
2753 | 2753 | }, |
2754 | 2754 | months: { |
2755 | - shorthand: ['<?php echo implode( "','", $month_s ); ?>'], |
|
2756 | - longhand: ['<?php echo implode( "','", $month_long ); ?>'], |
|
2755 | + shorthand: ['<?php echo implode("','", $month_s); ?>'], |
|
2756 | + longhand: ['<?php echo implode("','", $month_long); ?>'], |
|
2757 | 2757 | }, |
2758 | 2758 | daysInMonth: [31,28,31,30,31,30,31,31,30,31,30,31], |
2759 | - firstDayOfWeek: <?php echo (int) $params[ 'firstDayOfWeek' ]; ?>, |
|
2759 | + firstDayOfWeek: <?php echo (int) $params['firstDayOfWeek']; ?>, |
|
2760 | 2760 | ordinal: function (nth) { |
2761 | 2761 | var s = nth % 100; |
2762 | 2762 | if (s > 3 && s < 21) |
@@ -2772,21 +2772,21 @@ discard block |
||
2772 | 2772 | return "th"; |
2773 | 2773 | } |
2774 | 2774 | }, |
2775 | - rangeSeparator: '<?php echo addslashes( $params[ 'rangeSeparator' ] ); ?>', |
|
2776 | - weekAbbreviation: '<?php echo addslashes( $params[ 'weekAbbreviation' ] ); ?>', |
|
2777 | - scrollTitle: '<?php echo addslashes( $params[ 'scrollTitle' ] ); ?>', |
|
2778 | - toggleTitle: '<?php echo addslashes( $params[ 'toggleTitle' ] ); ?>', |
|
2779 | - amPM: ['<?php echo addslashes( $params[ 'am_upper' ] ); ?>','<?php echo addslashes( $params[ 'pm_upper' ] ); ?>'], |
|
2780 | - yearAriaLabel: '<?php echo addslashes( $params[ 'year' ] ); ?>', |
|
2781 | - hourAriaLabel: '<?php echo addslashes( $params[ 'hour' ] ); ?>', |
|
2782 | - minuteAriaLabel: '<?php echo addslashes( $params[ 'minute' ] ); ?>', |
|
2783 | - time_24hr: <?php echo ( $params[ 'time_24hr' ] ? 'true' : 'false' ) ; ?> |
|
2775 | + rangeSeparator: '<?php echo addslashes($params['rangeSeparator']); ?>', |
|
2776 | + weekAbbreviation: '<?php echo addslashes($params['weekAbbreviation']); ?>', |
|
2777 | + scrollTitle: '<?php echo addslashes($params['scrollTitle']); ?>', |
|
2778 | + toggleTitle: '<?php echo addslashes($params['toggleTitle']); ?>', |
|
2779 | + amPM: ['<?php echo addslashes($params['am_upper']); ?>','<?php echo addslashes($params['pm_upper']); ?>'], |
|
2780 | + yearAriaLabel: '<?php echo addslashes($params['year']); ?>', |
|
2781 | + hourAriaLabel: '<?php echo addslashes($params['hour']); ?>', |
|
2782 | + minuteAriaLabel: '<?php echo addslashes($params['minute']); ?>', |
|
2783 | + time_24hr: <?php echo ($params['time_24hr'] ? 'true' : 'false'); ?> |
|
2784 | 2784 | } |
2785 | - <?php if ( 0 ) { ?></script><?php } ?> |
|
2785 | + <?php if (0) { ?></script><?php } ?> |
|
2786 | 2786 | <?php |
2787 | 2787 | $locale = ob_get_clean(); |
2788 | 2788 | |
2789 | - return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) ); |
|
2789 | + return apply_filters('ayecode_ui_flatpickr_locale', trim($locale)); |
|
2790 | 2790 | } |
2791 | 2791 | |
2792 | 2792 | /** |
@@ -2798,20 +2798,20 @@ discard block |
||
2798 | 2798 | */ |
2799 | 2799 | public static function select2_params() { |
2800 | 2800 | $params = array( |
2801 | - 'i18n_select_state_text' => esc_attr__( 'Select an option…', 'aui' ), |
|
2802 | - 'i18n_no_matches' => _x( 'No matches found', 'enhanced select', 'aui' ), |
|
2803 | - 'i18n_ajax_error' => _x( 'Loading failed', 'enhanced select', 'aui' ), |
|
2804 | - 'i18n_input_too_short_1' => _x( 'Please enter 1 or more characters', 'enhanced select', 'aui' ), |
|
2805 | - 'i18n_input_too_short_n' => _x( 'Please enter %item% or more characters', 'enhanced select', 'aui' ), |
|
2806 | - 'i18n_input_too_long_1' => _x( 'Please delete 1 character', 'enhanced select', 'aui' ), |
|
2807 | - 'i18n_input_too_long_n' => _x( 'Please delete %item% characters', 'enhanced select', 'aui' ), |
|
2808 | - 'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'aui' ), |
|
2809 | - 'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'aui' ), |
|
2810 | - 'i18n_load_more' => _x( 'Loading more results…', 'enhanced select', 'aui' ), |
|
2811 | - 'i18n_searching' => _x( 'Searching…', 'enhanced select', 'aui' ) |
|
2801 | + 'i18n_select_state_text' => esc_attr__('Select an option…', 'aui'), |
|
2802 | + 'i18n_no_matches' => _x('No matches found', 'enhanced select', 'aui'), |
|
2803 | + 'i18n_ajax_error' => _x('Loading failed', 'enhanced select', 'aui'), |
|
2804 | + 'i18n_input_too_short_1' => _x('Please enter 1 or more characters', 'enhanced select', 'aui'), |
|
2805 | + 'i18n_input_too_short_n' => _x('Please enter %item% or more characters', 'enhanced select', 'aui'), |
|
2806 | + 'i18n_input_too_long_1' => _x('Please delete 1 character', 'enhanced select', 'aui'), |
|
2807 | + 'i18n_input_too_long_n' => _x('Please delete %item% characters', 'enhanced select', 'aui'), |
|
2808 | + 'i18n_selection_too_long_1' => _x('You can only select 1 item', 'enhanced select', 'aui'), |
|
2809 | + 'i18n_selection_too_long_n' => _x('You can only select %item% items', 'enhanced select', 'aui'), |
|
2810 | + 'i18n_load_more' => _x('Loading more results…', 'enhanced select', 'aui'), |
|
2811 | + 'i18n_searching' => _x('Searching…', 'enhanced select', 'aui') |
|
2812 | 2812 | ); |
2813 | 2813 | |
2814 | - return apply_filters( 'ayecode_ui_select2_params', $params ); |
|
2814 | + return apply_filters('ayecode_ui_select2_params', $params); |
|
2815 | 2815 | } |
2816 | 2816 | |
2817 | 2817 | /** |
@@ -2824,17 +2824,17 @@ discard block |
||
2824 | 2824 | public static function select2_locale() { |
2825 | 2825 | $params = self::select2_params(); |
2826 | 2826 | |
2827 | - foreach ( (array) $params as $key => $value ) { |
|
2828 | - if ( ! is_scalar( $value ) ) { |
|
2827 | + foreach ((array) $params as $key => $value) { |
|
2828 | + if (!is_scalar($value)) { |
|
2829 | 2829 | continue; |
2830 | 2830 | } |
2831 | 2831 | |
2832 | - $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); |
|
2832 | + $params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
2833 | 2833 | } |
2834 | 2834 | |
2835 | - $locale = json_encode( $params ); |
|
2835 | + $locale = json_encode($params); |
|
2836 | 2836 | |
2837 | - return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) ); |
|
2837 | + return apply_filters('ayecode_ui_select2_locale', trim($locale)); |
|
2838 | 2838 | } |
2839 | 2839 | |
2840 | 2840 | /** |
@@ -2847,35 +2847,35 @@ discard block |
||
2847 | 2847 | public static function timeago_locale() { |
2848 | 2848 | $params = array( |
2849 | 2849 | 'prefix_ago' => '', |
2850 | - 'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'aui' ), |
|
2851 | - 'prefix_after' => _x( 'after', 'time ago', 'aui' ) . ' ', |
|
2850 | + 'suffix_ago' => ' ' . _x('ago', 'time ago', 'aui'), |
|
2851 | + 'prefix_after' => _x('after', 'time ago', 'aui') . ' ', |
|
2852 | 2852 | 'suffix_after' => '', |
2853 | - 'seconds' => _x( 'less than a minute', 'time ago', 'aui' ), |
|
2854 | - 'minute' => _x( 'about a minute', 'time ago', 'aui' ), |
|
2855 | - 'minutes' => _x( '%d minutes', 'time ago', 'aui' ), |
|
2856 | - 'hour' => _x( 'about an hour', 'time ago', 'aui' ), |
|
2857 | - 'hours' => _x( 'about %d hours', 'time ago', 'aui' ), |
|
2858 | - 'day' => _x( 'a day', 'time ago', 'aui' ), |
|
2859 | - 'days' => _x( '%d days', 'time ago', 'aui' ), |
|
2860 | - 'month' => _x( 'about a month', 'time ago', 'aui' ), |
|
2861 | - 'months' => _x( '%d months', 'time ago', 'aui' ), |
|
2862 | - 'year' => _x( 'about a year', 'time ago', 'aui' ), |
|
2863 | - 'years' => _x( '%d years', 'time ago', 'aui' ), |
|
2853 | + 'seconds' => _x('less than a minute', 'time ago', 'aui'), |
|
2854 | + 'minute' => _x('about a minute', 'time ago', 'aui'), |
|
2855 | + 'minutes' => _x('%d minutes', 'time ago', 'aui'), |
|
2856 | + 'hour' => _x('about an hour', 'time ago', 'aui'), |
|
2857 | + 'hours' => _x('about %d hours', 'time ago', 'aui'), |
|
2858 | + 'day' => _x('a day', 'time ago', 'aui'), |
|
2859 | + 'days' => _x('%d days', 'time ago', 'aui'), |
|
2860 | + 'month' => _x('about a month', 'time ago', 'aui'), |
|
2861 | + 'months' => _x('%d months', 'time ago', 'aui'), |
|
2862 | + 'year' => _x('about a year', 'time ago', 'aui'), |
|
2863 | + 'years' => _x('%d years', 'time ago', 'aui'), |
|
2864 | 2864 | ); |
2865 | 2865 | |
2866 | - $params = apply_filters( 'ayecode_ui_timeago_params', $params ); |
|
2866 | + $params = apply_filters('ayecode_ui_timeago_params', $params); |
|
2867 | 2867 | |
2868 | - foreach ( (array) $params as $key => $value ) { |
|
2869 | - if ( ! is_scalar( $value ) ) { |
|
2868 | + foreach ((array) $params as $key => $value) { |
|
2869 | + if (!is_scalar($value)) { |
|
2870 | 2870 | continue; |
2871 | 2871 | } |
2872 | 2872 | |
2873 | - $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' ); |
|
2873 | + $params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
2874 | 2874 | } |
2875 | 2875 | |
2876 | - $locale = json_encode( $params ); |
|
2876 | + $locale = json_encode($params); |
|
2877 | 2877 | |
2878 | - return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) ); |
|
2878 | + return apply_filters('ayecode_ui_timeago_locale', trim($locale)); |
|
2879 | 2879 | } |
2880 | 2880 | |
2881 | 2881 | /** |
@@ -2886,7 +2886,7 @@ discard block |
||
2886 | 2886 | * @return mixed |
2887 | 2887 | */ |
2888 | 2888 | public static function minify_js($input) { |
2889 | - if(trim($input) === "") return $input; |
|
2889 | + if (trim($input) === "") return $input; |
|
2890 | 2890 | return preg_replace( |
2891 | 2891 | array( |
2892 | 2892 | // Remove comment(s) |
@@ -2918,7 +2918,7 @@ discard block |
||
2918 | 2918 | * @return mixed |
2919 | 2919 | */ |
2920 | 2920 | public static function minify_css($input) { |
2921 | - if(trim($input) === "") return $input; |
|
2921 | + if (trim($input) === "") return $input; |
|
2922 | 2922 | return preg_replace( |
2923 | 2923 | array( |
2924 | 2924 | // Remove comment(s) |
@@ -3466,12 +3466,12 @@ discard block |
||
3466 | 3466 | }); |
3467 | 3467 | } |
3468 | 3468 | } |
3469 | - <?php do_action( 'aui_conditional_fields_js', $this ); ?> |
|
3469 | + <?php do_action('aui_conditional_fields_js', $this); ?> |
|
3470 | 3470 | </script> |
3471 | 3471 | <?php |
3472 | 3472 | $output = ob_get_clean(); |
3473 | 3473 | |
3474 | - return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) ); |
|
3474 | + return str_replace(array('<script>', '</script>'), '', self::minify_js($output)); |
|
3475 | 3475 | } |
3476 | 3476 | } |
3477 | 3477 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @return mixed|void |
38 | 38 | */ |
39 | 39 | function sd_widget_exclude() { |
40 | - return apply_filters( 'sd_widget_exclude', array() ); |
|
40 | + return apply_filters('sd_widget_exclude', array()); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | * |
50 | 50 | * @return array |
51 | 51 | */ |
52 | -function sd_get_margin_input( $type = 'mt', $overwrite = array(), $include_negatives = true ) { |
|
52 | +function sd_get_margin_input($type = 'mt', $overwrite = array(), $include_negatives = true) { |
|
53 | 53 | $options = array( |
54 | - '' => __( 'None', 'super-duper' ), |
|
55 | - 'auto' => __( 'auto', 'super-duper' ), |
|
54 | + '' => __('None', 'super-duper'), |
|
55 | + 'auto' => __('auto', 'super-duper'), |
|
56 | 56 | '0' => '0', |
57 | 57 | '1' => '1', |
58 | 58 | '2' => '2', |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | '12' => '12', |
69 | 69 | ); |
70 | 70 | |
71 | - if ( $include_negatives ) { |
|
71 | + if ($include_negatives) { |
|
72 | 72 | $options['n1'] = '-1'; |
73 | 73 | $options['n2'] = '-2'; |
74 | 74 | $options['n3'] = '-3'; |
@@ -85,37 +85,37 @@ discard block |
||
85 | 85 | |
86 | 86 | $defaults = array( |
87 | 87 | 'type' => 'select', |
88 | - 'title' => __( 'Margin top', 'super-duper' ), |
|
88 | + 'title' => __('Margin top', 'super-duper'), |
|
89 | 89 | 'options' => $options, |
90 | 90 | 'default' => '', |
91 | 91 | 'desc_tip' => true, |
92 | - 'group' => __( 'Wrapper Styles', 'super-duper' ), |
|
92 | + 'group' => __('Wrapper Styles', 'super-duper'), |
|
93 | 93 | ); |
94 | 94 | |
95 | 95 | // title |
96 | - if ( $type == 'mt' ) { |
|
97 | - $defaults['title'] = __( 'Margin top', 'super-duper' ); |
|
96 | + if ($type == 'mt') { |
|
97 | + $defaults['title'] = __('Margin top', 'super-duper'); |
|
98 | 98 | $defaults['icon'] = 'box-top'; |
99 | 99 | $defaults['row'] = array( |
100 | - 'title' => __( 'Margins', 'super-duper' ), |
|
100 | + 'title' => __('Margins', 'super-duper'), |
|
101 | 101 | 'key' => 'wrapper-margins', |
102 | 102 | 'open' => true, |
103 | 103 | 'class' => 'text-center', |
104 | 104 | ); |
105 | - } elseif ( $type == 'mr' ) { |
|
106 | - $defaults['title'] = __( 'Margin right', 'super-duper' ); |
|
105 | + } elseif ($type == 'mr') { |
|
106 | + $defaults['title'] = __('Margin right', 'super-duper'); |
|
107 | 107 | $defaults['icon'] = 'box-right'; |
108 | 108 | $defaults['row'] = array( |
109 | 109 | 'key' => 'wrapper-margins', |
110 | 110 | ); |
111 | - } elseif ( $type == 'mb' ) { |
|
112 | - $defaults['title'] = __( 'Margin bottom', 'super-duper' ); |
|
111 | + } elseif ($type == 'mb') { |
|
112 | + $defaults['title'] = __('Margin bottom', 'super-duper'); |
|
113 | 113 | $defaults['icon'] = 'box-bottom'; |
114 | 114 | $defaults['row'] = array( |
115 | 115 | 'key' => 'wrapper-margins', |
116 | 116 | ); |
117 | - } elseif ( $type == 'ml' ) { |
|
118 | - $defaults['title'] = __( 'Margin left', 'super-duper' ); |
|
117 | + } elseif ($type == 'ml') { |
|
118 | + $defaults['title'] = __('Margin left', 'super-duper'); |
|
119 | 119 | $defaults['icon'] = 'box-left'; |
120 | 120 | $defaults['row'] = array( |
121 | 121 | 'key' => 'wrapper-margins', |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | ); |
124 | 124 | } |
125 | 125 | |
126 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
126 | + $input = wp_parse_args($overwrite, $defaults); |
|
127 | 127 | |
128 | 128 | return $input; |
129 | 129 | } |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return array |
138 | 138 | */ |
139 | -function sd_get_padding_input( $type = 'pt', $overwrite = array() ) { |
|
139 | +function sd_get_padding_input($type = 'pt', $overwrite = array()) { |
|
140 | 140 | $options = array( |
141 | - '' => __( 'None', 'super-duper' ), |
|
141 | + '' => __('None', 'super-duper'), |
|
142 | 142 | '0' => '0', |
143 | 143 | '1' => '1', |
144 | 144 | '2' => '2', |
@@ -156,37 +156,37 @@ discard block |
||
156 | 156 | |
157 | 157 | $defaults = array( |
158 | 158 | 'type' => 'select', |
159 | - 'title' => __( 'Padding top', 'super-duper' ), |
|
159 | + 'title' => __('Padding top', 'super-duper'), |
|
160 | 160 | 'options' => $options, |
161 | 161 | 'default' => '', |
162 | 162 | 'desc_tip' => true, |
163 | - 'group' => __( 'Wrapper Styles', 'super-duper' ), |
|
163 | + 'group' => __('Wrapper Styles', 'super-duper'), |
|
164 | 164 | ); |
165 | 165 | |
166 | 166 | // title |
167 | - if ( $type == 'pt' ) { |
|
168 | - $defaults['title'] = __( 'Padding top', 'super-duper' ); |
|
167 | + if ($type == 'pt') { |
|
168 | + $defaults['title'] = __('Padding top', 'super-duper'); |
|
169 | 169 | $defaults['icon'] = 'box-top'; |
170 | 170 | $defaults['row'] = array( |
171 | - 'title' => __( 'Padding', 'super-duper' ), |
|
171 | + 'title' => __('Padding', 'super-duper'), |
|
172 | 172 | 'key' => 'wrapper-padding', |
173 | 173 | 'open' => true, |
174 | 174 | 'class' => 'text-center', |
175 | 175 | ); |
176 | - } elseif ( $type == 'pr' ) { |
|
177 | - $defaults['title'] = __( 'Padding right', 'super-duper' ); |
|
176 | + } elseif ($type == 'pr') { |
|
177 | + $defaults['title'] = __('Padding right', 'super-duper'); |
|
178 | 178 | $defaults['icon'] = 'box-right'; |
179 | 179 | $defaults['row'] = array( |
180 | 180 | 'key' => 'wrapper-padding', |
181 | 181 | ); |
182 | - } elseif ( $type == 'pb' ) { |
|
183 | - $defaults['title'] = __( 'Padding bottom', 'super-duper' ); |
|
182 | + } elseif ($type == 'pb') { |
|
183 | + $defaults['title'] = __('Padding bottom', 'super-duper'); |
|
184 | 184 | $defaults['icon'] = 'box-bottom'; |
185 | 185 | $defaults['row'] = array( |
186 | 186 | 'key' => 'wrapper-padding', |
187 | 187 | ); |
188 | - } elseif ( $type == 'pl' ) { |
|
189 | - $defaults['title'] = __( 'Padding left', 'super-duper' ); |
|
188 | + } elseif ($type == 'pl') { |
|
189 | + $defaults['title'] = __('Padding left', 'super-duper'); |
|
190 | 190 | $defaults['icon'] = 'box-left'; |
191 | 191 | $defaults['row'] = array( |
192 | 192 | 'key' => 'wrapper-padding', |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | ); |
196 | 196 | } |
197 | 197 | |
198 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
198 | + $input = wp_parse_args($overwrite, $defaults); |
|
199 | 199 | |
200 | 200 | return $input; |
201 | 201 | } |
@@ -208,22 +208,22 @@ discard block |
||
208 | 208 | * |
209 | 209 | * @return array |
210 | 210 | */ |
211 | -function sd_get_border_input( $type = 'border', $overwrite = array() ) { |
|
211 | +function sd_get_border_input($type = 'border', $overwrite = array()) { |
|
212 | 212 | |
213 | 213 | $defaults = array( |
214 | 214 | 'type' => 'select', |
215 | - 'title' => __( 'Border' ), |
|
215 | + 'title' => __('Border'), |
|
216 | 216 | 'options' => array(), |
217 | 217 | 'default' => '', |
218 | 218 | 'desc_tip' => true, |
219 | - 'group' => __( 'Wrapper Styles', 'geodirectory' ), |
|
219 | + 'group' => __('Wrapper Styles', 'geodirectory'), |
|
220 | 220 | ); |
221 | 221 | |
222 | 222 | // title |
223 | - if ( $type == 'rounded' ) { |
|
224 | - $defaults['title'] = __( 'Border radius type', 'super-duper' ); |
|
223 | + if ($type == 'rounded') { |
|
224 | + $defaults['title'] = __('Border radius type', 'super-duper'); |
|
225 | 225 | $defaults['options'] = array( |
226 | - '' => __( 'Default', 'super-duper' ), |
|
226 | + '' => __('Default', 'super-duper'), |
|
227 | 227 | 'rounded' => 'rounded', |
228 | 228 | 'rounded-top' => 'rounded-top', |
229 | 229 | 'rounded-right' => 'rounded-right', |
@@ -233,32 +233,32 @@ discard block |
||
233 | 233 | 'rounded-pill' => 'rounded-pill', |
234 | 234 | 'rounded-0' => 'rounded-0', |
235 | 235 | ); |
236 | - } elseif ( $type == 'rounded_size' ) { |
|
237 | - $defaults['title'] = __( 'Border radius size', 'super-duper' ); |
|
236 | + } elseif ($type == 'rounded_size') { |
|
237 | + $defaults['title'] = __('Border radius size', 'super-duper'); |
|
238 | 238 | $defaults['options'] = array( |
239 | - '' => __( 'Default', 'super-duper' ), |
|
240 | - 'sm' => __( 'Small', 'super-duper' ), |
|
241 | - 'lg' => __( 'Large', 'super-duper' ), |
|
239 | + '' => __('Default', 'super-duper'), |
|
240 | + 'sm' => __('Small', 'super-duper'), |
|
241 | + 'lg' => __('Large', 'super-duper'), |
|
242 | 242 | ); |
243 | - } elseif ( $type == 'type' ) { |
|
244 | - $defaults['title'] = __( 'Border type', 'super-duper' ); |
|
243 | + } elseif ($type == 'type') { |
|
244 | + $defaults['title'] = __('Border type', 'super-duper'); |
|
245 | 245 | $defaults['options'] = array( |
246 | - '' => __( 'None', 'super-duper' ), |
|
247 | - 'border' => __( 'Full', 'super-duper' ), |
|
248 | - 'border-top' => __( 'Top', 'super-duper' ), |
|
249 | - 'border-bottom' => __( 'Bottom', 'super-duper' ), |
|
250 | - 'border-left' => __( 'Left', 'super-duper' ), |
|
251 | - 'border-right' => __( 'Right', 'super-duper' ), |
|
246 | + '' => __('None', 'super-duper'), |
|
247 | + 'border' => __('Full', 'super-duper'), |
|
248 | + 'border-top' => __('Top', 'super-duper'), |
|
249 | + 'border-bottom' => __('Bottom', 'super-duper'), |
|
250 | + 'border-left' => __('Left', 'super-duper'), |
|
251 | + 'border-right' => __('Right', 'super-duper'), |
|
252 | 252 | ); |
253 | 253 | } else { |
254 | - $defaults['title'] = __( 'Border color' ); |
|
254 | + $defaults['title'] = __('Border color'); |
|
255 | 255 | $defaults['options'] = array( |
256 | - '' => __( 'Default', 'super-duper' ), |
|
257 | - '0' => __( 'None', 'super-duper' ), |
|
256 | + '' => __('Default', 'super-duper'), |
|
257 | + '0' => __('None', 'super-duper'), |
|
258 | 258 | ) + sd_aui_colors(); |
259 | 259 | } |
260 | 260 | |
261 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
261 | + $input = wp_parse_args($overwrite, $defaults); |
|
262 | 262 | |
263 | 263 | return $input; |
264 | 264 | } |
@@ -271,24 +271,24 @@ discard block |
||
271 | 271 | * |
272 | 272 | * @return array |
273 | 273 | */ |
274 | -function sd_get_shadow_input( $type = 'shadow', $overwrite = array() ) { |
|
274 | +function sd_get_shadow_input($type = 'shadow', $overwrite = array()) { |
|
275 | 275 | $options = array( |
276 | - '' => __( 'None', 'super-duper' ), |
|
277 | - 'shadow-sm' => __( 'Small', 'super-duper' ), |
|
278 | - 'shadow' => __( 'Regular', 'super-duper' ), |
|
279 | - 'shadow-lg' => __( 'Large', 'super-duper' ), |
|
276 | + '' => __('None', 'super-duper'), |
|
277 | + 'shadow-sm' => __('Small', 'super-duper'), |
|
278 | + 'shadow' => __('Regular', 'super-duper'), |
|
279 | + 'shadow-lg' => __('Large', 'super-duper'), |
|
280 | 280 | ); |
281 | 281 | |
282 | 282 | $defaults = array( |
283 | 283 | 'type' => 'select', |
284 | - 'title' => __( 'Shadow', 'super-duper' ), |
|
284 | + 'title' => __('Shadow', 'super-duper'), |
|
285 | 285 | 'options' => $options, |
286 | 286 | 'default' => '', |
287 | 287 | 'desc_tip' => true, |
288 | - 'group' => __( 'Wrapper Styles', 'super-duper' ), |
|
288 | + 'group' => __('Wrapper Styles', 'super-duper'), |
|
289 | 289 | ); |
290 | 290 | |
291 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
291 | + $input = wp_parse_args($overwrite, $defaults); |
|
292 | 292 | |
293 | 293 | return $input; |
294 | 294 | } |
@@ -301,22 +301,22 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @return array |
303 | 303 | */ |
304 | -function sd_get_background_input( $type = 'bg', $overwrite = array() ) { |
|
304 | +function sd_get_background_input($type = 'bg', $overwrite = array()) { |
|
305 | 305 | $options = array( |
306 | - '' => __( 'None', 'super-duper' ), |
|
307 | - 'transparent' => __( 'Transparent', 'super-duper' ), |
|
306 | + '' => __('None', 'super-duper'), |
|
307 | + 'transparent' => __('Transparent', 'super-duper'), |
|
308 | 308 | ) + sd_aui_colors(); |
309 | 309 | |
310 | 310 | $defaults = array( |
311 | 311 | 'type' => 'select', |
312 | - 'title' => __( 'Background color', 'super-duper' ), |
|
312 | + 'title' => __('Background color', 'super-duper'), |
|
313 | 313 | 'options' => $options, |
314 | 314 | 'default' => '', |
315 | 315 | 'desc_tip' => true, |
316 | - 'group' => __( 'Wrapper Styles', 'super-duper' ), |
|
316 | + 'group' => __('Wrapper Styles', 'super-duper'), |
|
317 | 317 | ); |
318 | 318 | |
319 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
319 | + $input = wp_parse_args($overwrite, $defaults); |
|
320 | 320 | |
321 | 321 | return $input; |
322 | 322 | } |
@@ -329,95 +329,95 @@ discard block |
||
329 | 329 | * |
330 | 330 | * @return array |
331 | 331 | */ |
332 | -function sd_get_background_inputs( $type = 'bg', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array() ) { |
|
332 | +function sd_get_background_inputs($type = 'bg', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array()) { |
|
333 | 333 | $options = array( |
334 | - '' => __( 'None', 'super-duper' ), |
|
335 | - 'transparent' => __( 'Transparent', 'super-duper' ), |
|
334 | + '' => __('None', 'super-duper'), |
|
335 | + 'transparent' => __('Transparent', 'super-duper'), |
|
336 | 336 | ) + sd_aui_colors() |
337 | 337 | + array( |
338 | - 'custom-color' => __( 'Custom Color', 'super-duper' ), |
|
339 | - 'custom-gradient' => __( 'Custom Gradient', 'super-duper' ), |
|
338 | + 'custom-color' => __('Custom Color', 'super-duper'), |
|
339 | + 'custom-gradient' => __('Custom Gradient', 'super-duper'), |
|
340 | 340 | ); |
341 | 341 | |
342 | 342 | $defaults = array( |
343 | 343 | 'type' => 'select', |
344 | - 'title' => __( 'Background Color', 'super-duper' ), |
|
344 | + 'title' => __('Background Color', 'super-duper'), |
|
345 | 345 | 'options' => $options, |
346 | 346 | 'default' => '', |
347 | 347 | 'desc_tip' => true, |
348 | - 'group' => __( 'Background', 'super-duper' ), |
|
348 | + 'group' => __('Background', 'super-duper'), |
|
349 | 349 | ); |
350 | 350 | |
351 | - if ( $overwrite !== false ) { |
|
352 | - $input[ $type ] = wp_parse_args( $overwrite, $defaults ); |
|
351 | + if ($overwrite !== false) { |
|
352 | + $input[$type] = wp_parse_args($overwrite, $defaults); |
|
353 | 353 | } |
354 | 354 | |
355 | - if ( $overwrite_color !== false ) { |
|
356 | - $input[ $type . '_color' ] = wp_parse_args( |
|
355 | + if ($overwrite_color !== false) { |
|
356 | + $input[$type . '_color'] = wp_parse_args( |
|
357 | 357 | $overwrite_color, |
358 | 358 | array( |
359 | 359 | 'type' => 'color', |
360 | - 'title' => __( 'Custom color', 'super-duper' ), |
|
360 | + 'title' => __('Custom color', 'super-duper'), |
|
361 | 361 | 'placeholder' => '', |
362 | 362 | 'default' => '#0073aa', |
363 | 363 | 'desc_tip' => true, |
364 | - 'group' => __( 'Background', 'super-duper' ), |
|
364 | + 'group' => __('Background', 'super-duper'), |
|
365 | 365 | 'element_require' => '[%' . $type . '%]=="custom-color"', |
366 | 366 | ) |
367 | 367 | ); |
368 | 368 | } |
369 | 369 | |
370 | - if ( $overwrite_gradient !== false ) { |
|
371 | - $input[ $type . '_gradient' ] = wp_parse_args( |
|
370 | + if ($overwrite_gradient !== false) { |
|
371 | + $input[$type . '_gradient'] = wp_parse_args( |
|
372 | 372 | $overwrite_gradient, |
373 | 373 | array( |
374 | 374 | 'type' => 'gradient', |
375 | - 'title' => __( 'Custom gradient', 'super-duper' ), |
|
375 | + 'title' => __('Custom gradient', 'super-duper'), |
|
376 | 376 | 'placeholder' => '', |
377 | 377 | 'default' => 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)', |
378 | 378 | 'desc_tip' => true, |
379 | - 'group' => __( 'Background', 'super-duper' ), |
|
379 | + 'group' => __('Background', 'super-duper'), |
|
380 | 380 | 'element_require' => '[%' . $type . '%]=="custom-gradient"', |
381 | 381 | ) |
382 | 382 | ); |
383 | 383 | } |
384 | 384 | |
385 | - if ( $overwrite_image !== false ) { |
|
385 | + if ($overwrite_image !== false) { |
|
386 | 386 | |
387 | - $input[ $type . '_image_fixed' ] = array( |
|
387 | + $input[$type . '_image_fixed'] = array( |
|
388 | 388 | 'type' => 'checkbox', |
389 | - 'title' => __( 'Fixed background', 'super-duper' ), |
|
389 | + 'title' => __('Fixed background', 'super-duper'), |
|
390 | 390 | 'default' => '', |
391 | 391 | 'desc_tip' => true, |
392 | - 'group' => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background' ), |
|
392 | + 'group' => !empty($overwrite_image['group']) ? $overwrite_image['group'] : __('Background'), |
|
393 | 393 | 'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )', |
394 | 394 | |
395 | 395 | ); |
396 | 396 | |
397 | - $input[ $type . '_image_use_featured' ] = array( |
|
397 | + $input[$type . '_image_use_featured'] = array( |
|
398 | 398 | 'type' => 'checkbox', |
399 | - 'title' => __( 'Use featured image', 'super-duper' ), |
|
399 | + 'title' => __('Use featured image', 'super-duper'), |
|
400 | 400 | 'default' => '', |
401 | 401 | 'desc_tip' => true, |
402 | - 'group' => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background', 'super-duper' ), |
|
402 | + 'group' => !empty($overwrite_image['group']) ? $overwrite_image['group'] : __('Background', 'super-duper'), |
|
403 | 403 | 'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )', |
404 | 404 | |
405 | 405 | ); |
406 | 406 | |
407 | - $input[ $type . '_image' ] = wp_parse_args( |
|
407 | + $input[$type . '_image'] = wp_parse_args( |
|
408 | 408 | $overwrite_image, |
409 | 409 | array( |
410 | 410 | 'type' => 'image', |
411 | - 'title' => __( 'Custom image', 'super-duper' ), |
|
411 | + 'title' => __('Custom image', 'super-duper'), |
|
412 | 412 | 'placeholder' => '', |
413 | 413 | 'default' => '', |
414 | 414 | 'desc_tip' => true, |
415 | - 'group' => __( 'Background', 'super-duper' ), |
|
415 | + 'group' => __('Background', 'super-duper'), |
|
416 | 416 | // 'element_require' => ' ![%' . $type . '_image_use_featured%] ' |
417 | 417 | ) |
418 | 418 | ); |
419 | 419 | |
420 | - $input[ $type . '_image_id' ] = wp_parse_args( |
|
420 | + $input[$type . '_image_id'] = wp_parse_args( |
|
421 | 421 | $overwrite_image, |
422 | 422 | array( |
423 | 423 | 'type' => 'hidden', |
@@ -425,18 +425,18 @@ discard block |
||
425 | 425 | 'title' => '', |
426 | 426 | 'placeholder' => '', |
427 | 427 | 'default' => '', |
428 | - 'group' => __( 'Background', 'super-duper' ), |
|
428 | + 'group' => __('Background', 'super-duper'), |
|
429 | 429 | ) |
430 | 430 | ); |
431 | 431 | |
432 | - $input[ $type . '_image_xy' ] = wp_parse_args( |
|
432 | + $input[$type . '_image_xy'] = wp_parse_args( |
|
433 | 433 | $overwrite_image, |
434 | 434 | array( |
435 | 435 | 'type' => 'image_xy', |
436 | 436 | 'title' => '', |
437 | 437 | 'placeholder' => '', |
438 | 438 | 'default' => '', |
439 | - 'group' => __( 'Background', 'super-duper' ), |
|
439 | + 'group' => __('Background', 'super-duper'), |
|
440 | 440 | ) |
441 | 441 | ); |
442 | 442 | } |
@@ -452,102 +452,102 @@ discard block |
||
452 | 452 | * |
453 | 453 | * @return array |
454 | 454 | */ |
455 | -function sd_get_shape_divider_inputs( $type = 'sd', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array() ) { |
|
455 | +function sd_get_shape_divider_inputs($type = 'sd', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array()) { |
|
456 | 456 | |
457 | 457 | $options = array( |
458 | - '' => __( 'None', 'super-duper' ), |
|
459 | - 'mountains' => __( 'Mountains', 'super-duper' ), |
|
460 | - 'drops' => __( 'Drops', 'super-duper' ), |
|
461 | - 'clouds' => __( 'Clouds', 'super-duper' ), |
|
462 | - 'zigzag' => __( 'Zigzag', 'super-duper' ), |
|
463 | - 'pyramids' => __( 'Pyramids', 'super-duper' ), |
|
464 | - 'triangle' => __( 'Triangle', 'super-duper' ), |
|
465 | - 'triangle-asymmetrical' => __( 'Triangle Asymmetrical', 'super-duper' ), |
|
466 | - 'tilt' => __( 'Tilt', 'super-duper' ), |
|
467 | - 'opacity-tilt' => __( 'Opacity Tilt', 'super-duper' ), |
|
468 | - 'opacity-fan' => __( 'Opacity Fan', 'super-duper' ), |
|
469 | - 'curve' => __( 'Curve', 'super-duper' ), |
|
470 | - 'curve-asymmetrical' => __( 'Curve Asymmetrical', 'super-duper' ), |
|
471 | - 'waves' => __( 'Waves', 'super-duper' ), |
|
472 | - 'wave-brush' => __( 'Wave Brush', 'super-duper' ), |
|
473 | - 'waves-pattern' => __( 'Waves Pattern', 'super-duper' ), |
|
474 | - 'arrow' => __( 'Arrow', 'super-duper' ), |
|
475 | - 'split' => __( 'Split', 'super-duper' ), |
|
476 | - 'book' => __( 'Book', 'super-duper' ), |
|
458 | + '' => __('None', 'super-duper'), |
|
459 | + 'mountains' => __('Mountains', 'super-duper'), |
|
460 | + 'drops' => __('Drops', 'super-duper'), |
|
461 | + 'clouds' => __('Clouds', 'super-duper'), |
|
462 | + 'zigzag' => __('Zigzag', 'super-duper'), |
|
463 | + 'pyramids' => __('Pyramids', 'super-duper'), |
|
464 | + 'triangle' => __('Triangle', 'super-duper'), |
|
465 | + 'triangle-asymmetrical' => __('Triangle Asymmetrical', 'super-duper'), |
|
466 | + 'tilt' => __('Tilt', 'super-duper'), |
|
467 | + 'opacity-tilt' => __('Opacity Tilt', 'super-duper'), |
|
468 | + 'opacity-fan' => __('Opacity Fan', 'super-duper'), |
|
469 | + 'curve' => __('Curve', 'super-duper'), |
|
470 | + 'curve-asymmetrical' => __('Curve Asymmetrical', 'super-duper'), |
|
471 | + 'waves' => __('Waves', 'super-duper'), |
|
472 | + 'wave-brush' => __('Wave Brush', 'super-duper'), |
|
473 | + 'waves-pattern' => __('Waves Pattern', 'super-duper'), |
|
474 | + 'arrow' => __('Arrow', 'super-duper'), |
|
475 | + 'split' => __('Split', 'super-duper'), |
|
476 | + 'book' => __('Book', 'super-duper'), |
|
477 | 477 | ); |
478 | 478 | |
479 | 479 | $defaults = array( |
480 | 480 | 'type' => 'select', |
481 | - 'title' => __( 'Type', 'super-duper' ), |
|
481 | + 'title' => __('Type', 'super-duper'), |
|
482 | 482 | 'options' => $options, |
483 | 483 | 'default' => '', |
484 | 484 | 'desc_tip' => true, |
485 | - 'group' => __( 'Shape Divider', 'super-duper' ), |
|
485 | + 'group' => __('Shape Divider', 'super-duper'), |
|
486 | 486 | ); |
487 | 487 | |
488 | - $input[ $type ] = wp_parse_args( $overwrite, $defaults ); |
|
488 | + $input[$type] = wp_parse_args($overwrite, $defaults); |
|
489 | 489 | |
490 | - $input[ $type . '_notice' ] = array( |
|
490 | + $input[$type . '_notice'] = array( |
|
491 | 491 | 'type' => 'notice', |
492 | - 'desc' => __( 'Parent element must be position `relative`', 'super-duper' ), |
|
492 | + 'desc' => __('Parent element must be position `relative`', 'super-duper'), |
|
493 | 493 | 'status' => 'warning', |
494 | - 'group' => __( 'Shape Divider', 'super-duper' ), |
|
494 | + 'group' => __('Shape Divider', 'super-duper'), |
|
495 | 495 | 'element_require' => '[%' . $type . '%]!=""', |
496 | 496 | ); |
497 | 497 | |
498 | - $input[ $type . '_position' ] = wp_parse_args( |
|
498 | + $input[$type . '_position'] = wp_parse_args( |
|
499 | 499 | $overwrite_color, |
500 | 500 | array( |
501 | 501 | 'type' => 'select', |
502 | - 'title' => __( 'Position', 'super-duper' ), |
|
502 | + 'title' => __('Position', 'super-duper'), |
|
503 | 503 | 'options' => array( |
504 | - 'top' => __( 'Top', 'super-duper' ), |
|
505 | - 'bottom' => __( 'Bottom', 'super-duper' ), |
|
504 | + 'top' => __('Top', 'super-duper'), |
|
505 | + 'bottom' => __('Bottom', 'super-duper'), |
|
506 | 506 | ), |
507 | 507 | 'desc_tip' => true, |
508 | - 'group' => __( 'Shape Divider', 'super-duper' ), |
|
508 | + 'group' => __('Shape Divider', 'super-duper'), |
|
509 | 509 | 'element_require' => '[%' . $type . '%]!=""', |
510 | 510 | ) |
511 | 511 | ); |
512 | 512 | |
513 | 513 | $options = array( |
514 | - '' => __( 'None', 'super-duper' ), |
|
515 | - 'transparent' => __( 'Transparent', 'super-duper' ), |
|
514 | + '' => __('None', 'super-duper'), |
|
515 | + 'transparent' => __('Transparent', 'super-duper'), |
|
516 | 516 | ) + sd_aui_colors() |
517 | 517 | + array( |
518 | - 'custom-color' => __( 'Custom Color', 'super-duper' ), |
|
518 | + 'custom-color' => __('Custom Color', 'super-duper'), |
|
519 | 519 | ); |
520 | 520 | |
521 | - $input[ $type . '_color' ] = wp_parse_args( |
|
521 | + $input[$type . '_color'] = wp_parse_args( |
|
522 | 522 | $overwrite_color, |
523 | 523 | array( |
524 | 524 | 'type' => 'select', |
525 | - 'title' => __( 'Color', 'super-duper' ), |
|
525 | + 'title' => __('Color', 'super-duper'), |
|
526 | 526 | 'options' => $options, |
527 | 527 | 'desc_tip' => true, |
528 | - 'group' => __( 'Shape Divider', 'super-duper' ), |
|
528 | + 'group' => __('Shape Divider', 'super-duper'), |
|
529 | 529 | 'element_require' => '[%' . $type . '%]!=""', |
530 | 530 | ) |
531 | 531 | ); |
532 | 532 | |
533 | - $input[ $type . '_custom_color' ] = wp_parse_args( |
|
533 | + $input[$type . '_custom_color'] = wp_parse_args( |
|
534 | 534 | $overwrite_color, |
535 | 535 | array( |
536 | 536 | 'type' => 'color', |
537 | - 'title' => __( 'Custom color', 'super-duper' ), |
|
537 | + 'title' => __('Custom color', 'super-duper'), |
|
538 | 538 | 'placeholder' => '', |
539 | 539 | 'default' => '#0073aa', |
540 | 540 | 'desc_tip' => true, |
541 | - 'group' => __( 'Shape Divider', 'super-duper' ), |
|
541 | + 'group' => __('Shape Divider', 'super-duper'), |
|
542 | 542 | 'element_require' => '[%' . $type . '_color%]=="custom-color" && [%' . $type . '%]!=""', |
543 | 543 | ) |
544 | 544 | ); |
545 | 545 | |
546 | - $input[ $type . '_width' ] = wp_parse_args( |
|
546 | + $input[$type . '_width'] = wp_parse_args( |
|
547 | 547 | $overwrite_gradient, |
548 | 548 | array( |
549 | 549 | 'type' => 'range', |
550 | - 'title' => __( 'Width', 'super-duper' ), |
|
550 | + 'title' => __('Width', 'super-duper'), |
|
551 | 551 | 'placeholder' => '', |
552 | 552 | 'default' => '200', |
553 | 553 | 'desc_tip' => true, |
@@ -555,69 +555,69 @@ discard block |
||
555 | 555 | 'min' => 100, |
556 | 556 | 'max' => 300, |
557 | 557 | ), |
558 | - 'group' => __( 'Shape Divider', 'super-duper' ), |
|
558 | + 'group' => __('Shape Divider', 'super-duper'), |
|
559 | 559 | 'element_require' => '[%' . $type . '%]!=""', |
560 | 560 | ) |
561 | 561 | ); |
562 | 562 | |
563 | - $input[ $type . '_height' ] = array( |
|
563 | + $input[$type . '_height'] = array( |
|
564 | 564 | 'type' => 'range', |
565 | - 'title' => __( 'Height', 'super-duper' ), |
|
565 | + 'title' => __('Height', 'super-duper'), |
|
566 | 566 | 'default' => '100', |
567 | 567 | 'desc_tip' => true, |
568 | 568 | 'custom_attributes' => array( |
569 | 569 | 'min' => 0, |
570 | 570 | 'max' => 500, |
571 | 571 | ), |
572 | - 'group' => __( 'Shape Divider', 'super-duper' ), |
|
572 | + 'group' => __('Shape Divider', 'super-duper'), |
|
573 | 573 | 'element_require' => '[%' . $type . '%]!=""', |
574 | 574 | ); |
575 | 575 | |
576 | 576 | $requires = array( |
577 | - 'mountains' => array( 'flip' ), |
|
578 | - 'drops' => array( 'flip', 'invert' ), |
|
579 | - 'clouds' => array( 'flip', 'invert' ), |
|
577 | + 'mountains' => array('flip'), |
|
578 | + 'drops' => array('flip', 'invert'), |
|
579 | + 'clouds' => array('flip', 'invert'), |
|
580 | 580 | 'zigzag' => array(), |
581 | - 'pyramids' => array( 'flip', 'invert' ), |
|
582 | - 'triangle' => array( 'invert' ), |
|
583 | - 'triangle-asymmetrical' => array( 'flip', 'invert' ), |
|
584 | - 'tilt' => array( 'flip' ), |
|
585 | - 'opacity-tilt' => array( 'flip' ), |
|
581 | + 'pyramids' => array('flip', 'invert'), |
|
582 | + 'triangle' => array('invert'), |
|
583 | + 'triangle-asymmetrical' => array('flip', 'invert'), |
|
584 | + 'tilt' => array('flip'), |
|
585 | + 'opacity-tilt' => array('flip'), |
|
586 | 586 | 'opacity-fan' => array(), |
587 | - 'curve' => array( 'invert' ), |
|
588 | - 'curve-asymmetrical' => array( 'flip', 'invert' ), |
|
589 | - 'waves' => array( 'flip', 'invert' ), |
|
590 | - 'wave-brush' => array( 'flip' ), |
|
591 | - 'waves-pattern' => array( 'flip' ), |
|
592 | - 'arrow' => array( 'invert' ), |
|
593 | - 'split' => array( 'invert' ), |
|
594 | - 'book' => array( 'invert' ), |
|
587 | + 'curve' => array('invert'), |
|
588 | + 'curve-asymmetrical' => array('flip', 'invert'), |
|
589 | + 'waves' => array('flip', 'invert'), |
|
590 | + 'wave-brush' => array('flip'), |
|
591 | + 'waves-pattern' => array('flip'), |
|
592 | + 'arrow' => array('invert'), |
|
593 | + 'split' => array('invert'), |
|
594 | + 'book' => array('invert'), |
|
595 | 595 | ); |
596 | 596 | |
597 | - $input[ $type . '_flip' ] = array( |
|
597 | + $input[$type . '_flip'] = array( |
|
598 | 598 | 'type' => 'checkbox', |
599 | - 'title' => __( 'Flip', 'super-duper' ), |
|
599 | + 'title' => __('Flip', 'super-duper'), |
|
600 | 600 | 'default' => '', |
601 | 601 | 'desc_tip' => true, |
602 | - 'group' => __( 'Shape Divider', 'super-duper' ), |
|
603 | - 'element_require' => sd_get_element_require_string( $requires, 'flip', 'sd' ), |
|
602 | + 'group' => __('Shape Divider', 'super-duper'), |
|
603 | + 'element_require' => sd_get_element_require_string($requires, 'flip', 'sd'), |
|
604 | 604 | ); |
605 | 605 | |
606 | - $input[ $type . '_invert' ] = array( |
|
606 | + $input[$type . '_invert'] = array( |
|
607 | 607 | 'type' => 'checkbox', |
608 | - 'title' => __( 'Invert', 'super-duper' ), |
|
608 | + 'title' => __('Invert', 'super-duper'), |
|
609 | 609 | 'default' => '', |
610 | 610 | 'desc_tip' => true, |
611 | - 'group' => __( 'Shape Divider', 'super-duper' ), |
|
612 | - 'element_require' => sd_get_element_require_string( $requires, 'invert', 'sd' ), |
|
611 | + 'group' => __('Shape Divider', 'super-duper'), |
|
612 | + 'element_require' => sd_get_element_require_string($requires, 'invert', 'sd'), |
|
613 | 613 | ); |
614 | 614 | |
615 | - $input[ $type . '_btf' ] = array( |
|
615 | + $input[$type . '_btf'] = array( |
|
616 | 616 | 'type' => 'checkbox', |
617 | - 'title' => __( 'Bring to front', 'super-duper' ), |
|
617 | + 'title' => __('Bring to front', 'super-duper'), |
|
618 | 618 | 'default' => '', |
619 | 619 | 'desc_tip' => true, |
620 | - 'group' => __( 'Shape Divider', 'super-duper' ), |
|
620 | + 'group' => __('Shape Divider', 'super-duper'), |
|
621 | 621 | 'element_require' => '[%' . $type . '%]!=""', |
622 | 622 | |
623 | 623 | ); |
@@ -634,19 +634,19 @@ discard block |
||
634 | 634 | * |
635 | 635 | * @return string |
636 | 636 | */ |
637 | -function sd_get_element_require_string( $args, $key, $type ) { |
|
637 | +function sd_get_element_require_string($args, $key, $type) { |
|
638 | 638 | $output = ''; |
639 | 639 | $requires = array(); |
640 | 640 | |
641 | - if ( ! empty( $args ) ) { |
|
642 | - foreach ( $args as $t => $k ) { |
|
643 | - if ( in_array( $key, $k ) ) { |
|
641 | + if (!empty($args)) { |
|
642 | + foreach ($args as $t => $k) { |
|
643 | + if (in_array($key, $k)) { |
|
644 | 644 | $requires[] = '[%' . $type . '%]=="' . $t . '"'; |
645 | 645 | } |
646 | 646 | } |
647 | 647 | |
648 | - if ( ! empty( $requires ) ) { |
|
649 | - $output = '(' . implode( ' || ', $requires ) . ')'; |
|
648 | + if (!empty($requires)) { |
|
649 | + $output = '(' . implode(' || ', $requires) . ')'; |
|
650 | 650 | } |
651 | 651 | } |
652 | 652 | |
@@ -661,39 +661,39 @@ discard block |
||
661 | 661 | * |
662 | 662 | * @return array |
663 | 663 | */ |
664 | -function sd_get_text_color_input( $type = 'text_color', $overwrite = array(), $has_custom = false ) { |
|
664 | +function sd_get_text_color_input($type = 'text_color', $overwrite = array(), $has_custom = false) { |
|
665 | 665 | $options = array( |
666 | - '' => __( 'None', 'super-duper' ), |
|
666 | + '' => __('None', 'super-duper'), |
|
667 | 667 | ) + sd_aui_colors(); |
668 | 668 | |
669 | - if ( $has_custom ) { |
|
670 | - $options['custom'] = __( 'Custom color', 'super-duper' ); |
|
669 | + if ($has_custom) { |
|
670 | + $options['custom'] = __('Custom color', 'super-duper'); |
|
671 | 671 | } |
672 | 672 | |
673 | 673 | $defaults = array( |
674 | 674 | 'type' => 'select', |
675 | - 'title' => __( 'Text color', 'super-duper' ), |
|
675 | + 'title' => __('Text color', 'super-duper'), |
|
676 | 676 | 'options' => $options, |
677 | 677 | 'default' => '', |
678 | 678 | 'desc_tip' => true, |
679 | - 'group' => __( 'Typography', 'super-duper' ), |
|
679 | + 'group' => __('Typography', 'super-duper'), |
|
680 | 680 | ); |
681 | 681 | |
682 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
682 | + $input = wp_parse_args($overwrite, $defaults); |
|
683 | 683 | |
684 | 684 | return $input; |
685 | 685 | } |
686 | 686 | |
687 | -function sd_get_text_color_input_group( $type = 'text_color', $overwrite = array(), $overwrite_custom = array() ) { |
|
687 | +function sd_get_text_color_input_group($type = 'text_color', $overwrite = array(), $overwrite_custom = array()) { |
|
688 | 688 | $inputs = array(); |
689 | 689 | |
690 | - if ( $overwrite !== false ) { |
|
691 | - $inputs[ $type ] = sd_get_text_color_input( $type, $overwrite, true ); |
|
690 | + if ($overwrite !== false) { |
|
691 | + $inputs[$type] = sd_get_text_color_input($type, $overwrite, true); |
|
692 | 692 | } |
693 | 693 | |
694 | - if ( $overwrite_custom !== false ) { |
|
694 | + if ($overwrite_custom !== false) { |
|
695 | 695 | $custom = $type . '_custom'; |
696 | - $inputs[ $custom ] = sd_get_custom_color_input( $custom, $overwrite_custom, $type ); |
|
696 | + $inputs[$custom] = sd_get_custom_color_input($custom, $overwrite_custom, $type); |
|
697 | 697 | } |
698 | 698 | |
699 | 699 | return $inputs; |
@@ -707,22 +707,22 @@ discard block |
||
707 | 707 | * |
708 | 708 | * @return array |
709 | 709 | */ |
710 | -function sd_get_custom_color_input( $type = 'color_custom', $overwrite = array(), $parent_type = '' ) { |
|
710 | +function sd_get_custom_color_input($type = 'color_custom', $overwrite = array(), $parent_type = '') { |
|
711 | 711 | |
712 | 712 | $defaults = array( |
713 | 713 | 'type' => 'color', |
714 | - 'title' => __( 'Custom color', 'super-duper' ), |
|
714 | + 'title' => __('Custom color', 'super-duper'), |
|
715 | 715 | 'default' => '', |
716 | 716 | 'placeholder' => '', |
717 | 717 | 'desc_tip' => true, |
718 | - 'group' => __( 'Typography', 'super-duper' ), |
|
718 | + 'group' => __('Typography', 'super-duper'), |
|
719 | 719 | ); |
720 | 720 | |
721 | - if ( $parent_type ) { |
|
721 | + if ($parent_type) { |
|
722 | 722 | $defaults['element_require'] = '[%' . $parent_type . '%]=="custom"'; |
723 | 723 | } |
724 | 724 | |
725 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
725 | + $input = wp_parse_args($overwrite, $defaults); |
|
726 | 726 | |
727 | 727 | return $input; |
728 | 728 | } |
@@ -735,18 +735,18 @@ discard block |
||
735 | 735 | * |
736 | 736 | * @return array |
737 | 737 | */ |
738 | -function sd_get_col_input( $type = 'col', $overwrite = array() ) { |
|
738 | +function sd_get_col_input($type = 'col', $overwrite = array()) { |
|
739 | 739 | |
740 | 740 | $device_size = ''; |
741 | - if ( ! empty( $overwrite['device_type'] ) ) { |
|
742 | - if ( $overwrite['device_type'] == 'Tablet' ) { |
|
741 | + if (!empty($overwrite['device_type'])) { |
|
742 | + if ($overwrite['device_type'] == 'Tablet') { |
|
743 | 743 | $device_size = '-md'; |
744 | - } elseif ( $overwrite['device_type'] == 'Desktop' ) { |
|
744 | + } elseif ($overwrite['device_type'] == 'Desktop') { |
|
745 | 745 | $device_size = '-lg'; |
746 | 746 | } |
747 | 747 | } |
748 | 748 | $options = array( |
749 | - '' => __( 'auto', 'super-duper' ), |
|
749 | + '' => __('auto', 'super-duper'), |
|
750 | 750 | '1' => '1/12', |
751 | 751 | '2' => '2/12', |
752 | 752 | '3' => '3/12', |
@@ -763,15 +763,15 @@ discard block |
||
763 | 763 | |
764 | 764 | $defaults = array( |
765 | 765 | 'type' => 'select', |
766 | - 'title' => __( 'Column width', 'super-duper' ), |
|
766 | + 'title' => __('Column width', 'super-duper'), |
|
767 | 767 | 'options' => $options, |
768 | 768 | 'default' => '', |
769 | 769 | 'desc_tip' => true, |
770 | - 'group' => __( 'Container', 'super-duper' ), |
|
770 | + 'group' => __('Container', 'super-duper'), |
|
771 | 771 | 'element_require' => '[%container%]=="col"', |
772 | 772 | ); |
773 | 773 | |
774 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
774 | + $input = wp_parse_args($overwrite, $defaults); |
|
775 | 775 | |
776 | 776 | return $input; |
777 | 777 | } |
@@ -784,18 +784,18 @@ discard block |
||
784 | 784 | * |
785 | 785 | * @return array |
786 | 786 | */ |
787 | -function sd_get_row_cols_input( $type = 'row_cols', $overwrite = array() ) { |
|
787 | +function sd_get_row_cols_input($type = 'row_cols', $overwrite = array()) { |
|
788 | 788 | |
789 | 789 | $device_size = ''; |
790 | - if ( ! empty( $overwrite['device_type'] ) ) { |
|
791 | - if ( $overwrite['device_type'] == 'Tablet' ) { |
|
790 | + if (!empty($overwrite['device_type'])) { |
|
791 | + if ($overwrite['device_type'] == 'Tablet') { |
|
792 | 792 | $device_size = '-md'; |
793 | - } elseif ( $overwrite['device_type'] == 'Desktop' ) { |
|
793 | + } elseif ($overwrite['device_type'] == 'Desktop') { |
|
794 | 794 | $device_size = '-lg'; |
795 | 795 | } |
796 | 796 | } |
797 | 797 | $options = array( |
798 | - '' => __( 'auto', 'super-duper' ), |
|
798 | + '' => __('auto', 'super-duper'), |
|
799 | 799 | '1' => '1', |
800 | 800 | '2' => '2', |
801 | 801 | '3' => '3', |
@@ -806,15 +806,15 @@ discard block |
||
806 | 806 | |
807 | 807 | $defaults = array( |
808 | 808 | 'type' => 'select', |
809 | - 'title' => __( 'Row columns', 'super-duper' ), |
|
809 | + 'title' => __('Row columns', 'super-duper'), |
|
810 | 810 | 'options' => $options, |
811 | 811 | 'default' => '', |
812 | 812 | 'desc_tip' => true, |
813 | - 'group' => __( 'Container', 'super-duper' ), |
|
813 | + 'group' => __('Container', 'super-duper'), |
|
814 | 814 | 'element_require' => '[%container%]=="row"', |
815 | 815 | ); |
816 | 816 | |
817 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
817 | + $input = wp_parse_args($overwrite, $defaults); |
|
818 | 818 | |
819 | 819 | return $input; |
820 | 820 | } |
@@ -827,33 +827,33 @@ discard block |
||
827 | 827 | * |
828 | 828 | * @return array |
829 | 829 | */ |
830 | -function sd_get_text_align_input( $type = 'text_align', $overwrite = array() ) { |
|
830 | +function sd_get_text_align_input($type = 'text_align', $overwrite = array()) { |
|
831 | 831 | |
832 | 832 | $device_size = ''; |
833 | - if ( ! empty( $overwrite['device_type'] ) ) { |
|
834 | - if ( $overwrite['device_type'] == 'Tablet' ) { |
|
833 | + if (!empty($overwrite['device_type'])) { |
|
834 | + if ($overwrite['device_type'] == 'Tablet') { |
|
835 | 835 | $device_size = '-md'; |
836 | - } elseif ( $overwrite['device_type'] == 'Desktop' ) { |
|
836 | + } elseif ($overwrite['device_type'] == 'Desktop') { |
|
837 | 837 | $device_size = '-lg'; |
838 | 838 | } |
839 | 839 | } |
840 | 840 | $options = array( |
841 | - '' => __( 'Default', 'super-duper' ), |
|
842 | - 'text' . $device_size . '-left' => __( 'Left', 'super-duper' ), |
|
843 | - 'text' . $device_size . '-right' => __( 'Right', 'super-duper' ), |
|
844 | - 'text' . $device_size . '-center' => __( 'Center', 'super-duper' ), |
|
841 | + '' => __('Default', 'super-duper'), |
|
842 | + 'text' . $device_size . '-left' => __('Left', 'super-duper'), |
|
843 | + 'text' . $device_size . '-right' => __('Right', 'super-duper'), |
|
844 | + 'text' . $device_size . '-center' => __('Center', 'super-duper'), |
|
845 | 845 | ); |
846 | 846 | |
847 | 847 | $defaults = array( |
848 | 848 | 'type' => 'select', |
849 | - 'title' => __( 'Text align', 'super-duper' ), |
|
849 | + 'title' => __('Text align', 'super-duper'), |
|
850 | 850 | 'options' => $options, |
851 | 851 | 'default' => '', |
852 | 852 | 'desc_tip' => true, |
853 | - 'group' => __( 'Typography', 'super-duper' ), |
|
853 | + 'group' => __('Typography', 'super-duper'), |
|
854 | 854 | ); |
855 | 855 | |
856 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
856 | + $input = wp_parse_args($overwrite, $defaults); |
|
857 | 857 | |
858 | 858 | return $input; |
859 | 859 | } |
@@ -866,18 +866,18 @@ discard block |
||
866 | 866 | * |
867 | 867 | * @return array |
868 | 868 | */ |
869 | -function sd_get_display_input( $type = 'display', $overwrite = array() ) { |
|
869 | +function sd_get_display_input($type = 'display', $overwrite = array()) { |
|
870 | 870 | |
871 | 871 | $device_size = ''; |
872 | - if ( ! empty( $overwrite['device_type'] ) ) { |
|
873 | - if ( $overwrite['device_type'] == 'Tablet' ) { |
|
872 | + if (!empty($overwrite['device_type'])) { |
|
873 | + if ($overwrite['device_type'] == 'Tablet') { |
|
874 | 874 | $device_size = '-md'; |
875 | - } elseif ( $overwrite['device_type'] == 'Desktop' ) { |
|
875 | + } elseif ($overwrite['device_type'] == 'Desktop') { |
|
876 | 876 | $device_size = '-lg'; |
877 | 877 | } |
878 | 878 | } |
879 | 879 | $options = array( |
880 | - '' => __( 'Default', 'super-duper' ), |
|
880 | + '' => __('Default', 'super-duper'), |
|
881 | 881 | 'd' . $device_size . '-none' => 'none', |
882 | 882 | 'd' . $device_size . '-inline' => 'inline', |
883 | 883 | 'd' . $device_size . '-inline-block' => 'inline-block', |
@@ -891,14 +891,14 @@ discard block |
||
891 | 891 | |
892 | 892 | $defaults = array( |
893 | 893 | 'type' => 'select', |
894 | - 'title' => __( 'Display', 'super-duper' ), |
|
894 | + 'title' => __('Display', 'super-duper'), |
|
895 | 895 | 'options' => $options, |
896 | 896 | 'default' => '', |
897 | 897 | 'desc_tip' => true, |
898 | - 'group' => __( 'Wrapper Styles', 'super-duper' ), |
|
898 | + 'group' => __('Wrapper Styles', 'super-duper'), |
|
899 | 899 | ); |
900 | 900 | |
901 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
901 | + $input = wp_parse_args($overwrite, $defaults); |
|
902 | 902 | |
903 | 903 | return $input; |
904 | 904 | } |
@@ -911,17 +911,17 @@ discard block |
||
911 | 911 | * |
912 | 912 | * @return array |
913 | 913 | */ |
914 | -function sd_get_text_justify_input( $type = 'text_justify', $overwrite = array() ) { |
|
914 | +function sd_get_text_justify_input($type = 'text_justify', $overwrite = array()) { |
|
915 | 915 | |
916 | 916 | $defaults = array( |
917 | 917 | 'type' => 'checkbox', |
918 | - 'title' => __( 'Text justify', 'super-duper' ), |
|
918 | + 'title' => __('Text justify', 'super-duper'), |
|
919 | 919 | 'default' => '', |
920 | 920 | 'desc_tip' => true, |
921 | - 'group' => __( 'Typography', 'super-duper' ), |
|
921 | + 'group' => __('Typography', 'super-duper'), |
|
922 | 922 | ); |
923 | 923 | |
924 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
924 | + $input = wp_parse_args($overwrite, $defaults); |
|
925 | 925 | |
926 | 926 | return $input; |
927 | 927 | } |
@@ -935,51 +935,51 @@ discard block |
||
935 | 935 | * |
936 | 936 | * @return array |
937 | 937 | */ |
938 | -function sd_aui_colors( $include_branding = false, $include_outlines = false, $outline_button_only_text = false ) { |
|
938 | +function sd_aui_colors($include_branding = false, $include_outlines = false, $outline_button_only_text = false) { |
|
939 | 939 | $theme_colors = array(); |
940 | 940 | |
941 | - $theme_colors['primary'] = __( 'Primary', 'super-duper' ); |
|
942 | - $theme_colors['secondary'] = __( 'Secondary', 'super-duper' ); |
|
943 | - $theme_colors['success'] = __( 'Success', 'super-duper' ); |
|
944 | - $theme_colors['danger'] = __( 'Danger', 'super-duper' ); |
|
945 | - $theme_colors['warning'] = __( 'Warning', 'super-duper' ); |
|
946 | - $theme_colors['info'] = __( 'Info', 'super-duper' ); |
|
947 | - $theme_colors['light'] = __( 'Light', 'super-duper' ); |
|
948 | - $theme_colors['dark'] = __( 'Dark', 'super-duper' ); |
|
949 | - $theme_colors['white'] = __( 'White', 'super-duper' ); |
|
950 | - $theme_colors['purple'] = __( 'Purple', 'super-duper' ); |
|
951 | - $theme_colors['salmon'] = __( 'Salmon', 'super-duper' ); |
|
952 | - $theme_colors['cyan'] = __( 'Cyan', 'super-duper' ); |
|
953 | - $theme_colors['gray'] = __( 'Gray', 'super-duper' ); |
|
954 | - $theme_colors['gray-dark'] = __( 'Gray dark', 'super-duper' ); |
|
955 | - $theme_colors['indigo'] = __( 'Indigo', 'super-duper' ); |
|
956 | - $theme_colors['orange'] = __( 'Orange', 'super-duper' ); |
|
957 | - |
|
958 | - if ( $include_outlines ) { |
|
959 | - $button_only = $outline_button_only_text ? ' ' . __( '(button only)', 'super-duper' ) : ''; |
|
960 | - $theme_colors['outline-primary'] = __( 'Primary outline', 'super-duper' ) . $button_only; |
|
961 | - $theme_colors['outline-secondary'] = __( 'Secondary outline', 'super-duper' ) . $button_only; |
|
962 | - $theme_colors['outline-success'] = __( 'Success outline', 'super-duper' ) . $button_only; |
|
963 | - $theme_colors['outline-danger'] = __( 'Danger outline', 'super-duper' ) . $button_only; |
|
964 | - $theme_colors['outline-warning'] = __( 'Warning outline', 'super-duper' ) . $button_only; |
|
965 | - $theme_colors['outline-info'] = __( 'Info outline', 'super-duper' ) . $button_only; |
|
966 | - $theme_colors['outline-light'] = __( 'Light outline', 'super-duper' ) . $button_only; |
|
967 | - $theme_colors['outline-dark'] = __( 'Dark outline', 'super-duper' ) . $button_only; |
|
968 | - $theme_colors['outline-white'] = __( 'White outline', 'super-duper' ) . $button_only; |
|
969 | - $theme_colors['outline-purple'] = __( 'Purple outline', 'super-duper' ) . $button_only; |
|
970 | - $theme_colors['outline-salmon'] = __( 'Salmon outline', 'super-duper' ) . $button_only; |
|
971 | - $theme_colors['outline-cyan'] = __( 'Cyan outline', 'super-duper' ) . $button_only; |
|
972 | - $theme_colors['outline-gray'] = __( 'Gray outline', 'super-duper' ) . $button_only; |
|
973 | - $theme_colors['outline-gray-dark'] = __( 'Gray dark outline', 'super-duper' ) . $button_only; |
|
974 | - $theme_colors['outline-indigo'] = __( 'Indigo outline', 'super-duper' ) . $button_only; |
|
975 | - $theme_colors['outline-orange'] = __( 'Orange outline', 'super-duper' ) . $button_only; |
|
976 | - } |
|
977 | - |
|
978 | - if ( $include_branding ) { |
|
941 | + $theme_colors['primary'] = __('Primary', 'super-duper'); |
|
942 | + $theme_colors['secondary'] = __('Secondary', 'super-duper'); |
|
943 | + $theme_colors['success'] = __('Success', 'super-duper'); |
|
944 | + $theme_colors['danger'] = __('Danger', 'super-duper'); |
|
945 | + $theme_colors['warning'] = __('Warning', 'super-duper'); |
|
946 | + $theme_colors['info'] = __('Info', 'super-duper'); |
|
947 | + $theme_colors['light'] = __('Light', 'super-duper'); |
|
948 | + $theme_colors['dark'] = __('Dark', 'super-duper'); |
|
949 | + $theme_colors['white'] = __('White', 'super-duper'); |
|
950 | + $theme_colors['purple'] = __('Purple', 'super-duper'); |
|
951 | + $theme_colors['salmon'] = __('Salmon', 'super-duper'); |
|
952 | + $theme_colors['cyan'] = __('Cyan', 'super-duper'); |
|
953 | + $theme_colors['gray'] = __('Gray', 'super-duper'); |
|
954 | + $theme_colors['gray-dark'] = __('Gray dark', 'super-duper'); |
|
955 | + $theme_colors['indigo'] = __('Indigo', 'super-duper'); |
|
956 | + $theme_colors['orange'] = __('Orange', 'super-duper'); |
|
957 | + |
|
958 | + if ($include_outlines) { |
|
959 | + $button_only = $outline_button_only_text ? ' ' . __('(button only)', 'super-duper') : ''; |
|
960 | + $theme_colors['outline-primary'] = __('Primary outline', 'super-duper') . $button_only; |
|
961 | + $theme_colors['outline-secondary'] = __('Secondary outline', 'super-duper') . $button_only; |
|
962 | + $theme_colors['outline-success'] = __('Success outline', 'super-duper') . $button_only; |
|
963 | + $theme_colors['outline-danger'] = __('Danger outline', 'super-duper') . $button_only; |
|
964 | + $theme_colors['outline-warning'] = __('Warning outline', 'super-duper') . $button_only; |
|
965 | + $theme_colors['outline-info'] = __('Info outline', 'super-duper') . $button_only; |
|
966 | + $theme_colors['outline-light'] = __('Light outline', 'super-duper') . $button_only; |
|
967 | + $theme_colors['outline-dark'] = __('Dark outline', 'super-duper') . $button_only; |
|
968 | + $theme_colors['outline-white'] = __('White outline', 'super-duper') . $button_only; |
|
969 | + $theme_colors['outline-purple'] = __('Purple outline', 'super-duper') . $button_only; |
|
970 | + $theme_colors['outline-salmon'] = __('Salmon outline', 'super-duper') . $button_only; |
|
971 | + $theme_colors['outline-cyan'] = __('Cyan outline', 'super-duper') . $button_only; |
|
972 | + $theme_colors['outline-gray'] = __('Gray outline', 'super-duper') . $button_only; |
|
973 | + $theme_colors['outline-gray-dark'] = __('Gray dark outline', 'super-duper') . $button_only; |
|
974 | + $theme_colors['outline-indigo'] = __('Indigo outline', 'super-duper') . $button_only; |
|
975 | + $theme_colors['outline-orange'] = __('Orange outline', 'super-duper') . $button_only; |
|
976 | + } |
|
977 | + |
|
978 | + if ($include_branding) { |
|
979 | 979 | $theme_colors = $theme_colors + sd_aui_branding_colors(); |
980 | 980 | } |
981 | 981 | |
982 | - return apply_filters( 'sd_aui_colors', $theme_colors, $include_outlines, $include_branding ); |
|
982 | + return apply_filters('sd_aui_colors', $theme_colors, $include_outlines, $include_branding); |
|
983 | 983 | } |
984 | 984 | |
985 | 985 | /** |
@@ -989,17 +989,17 @@ discard block |
||
989 | 989 | */ |
990 | 990 | function sd_aui_branding_colors() { |
991 | 991 | return array( |
992 | - 'facebook' => __( 'Facebook', 'super-duper' ), |
|
993 | - 'twitter' => __( 'Twitter', 'super-duper' ), |
|
994 | - 'instagram' => __( 'Instagram', 'super-duper' ), |
|
995 | - 'linkedin' => __( 'Linkedin', 'super-duper' ), |
|
996 | - 'flickr' => __( 'Flickr', 'super-duper' ), |
|
997 | - 'github' => __( 'GitHub', 'super-duper' ), |
|
998 | - 'youtube' => __( 'YouTube', 'super-duper' ), |
|
999 | - 'wordpress' => __( 'WordPress', 'super-duper' ), |
|
1000 | - 'google' => __( 'Google', 'super-duper' ), |
|
1001 | - 'yahoo' => __( 'Yahoo', 'super-duper' ), |
|
1002 | - 'vkontakte' => __( 'Vkontakte', 'super-duper' ), |
|
992 | + 'facebook' => __('Facebook', 'super-duper'), |
|
993 | + 'twitter' => __('Twitter', 'super-duper'), |
|
994 | + 'instagram' => __('Instagram', 'super-duper'), |
|
995 | + 'linkedin' => __('Linkedin', 'super-duper'), |
|
996 | + 'flickr' => __('Flickr', 'super-duper'), |
|
997 | + 'github' => __('GitHub', 'super-duper'), |
|
998 | + 'youtube' => __('YouTube', 'super-duper'), |
|
999 | + 'wordpress' => __('WordPress', 'super-duper'), |
|
1000 | + 'google' => __('Google', 'super-duper'), |
|
1001 | + 'yahoo' => __('Yahoo', 'super-duper'), |
|
1002 | + 'vkontakte' => __('Vkontakte', 'super-duper'), |
|
1003 | 1003 | ); |
1004 | 1004 | } |
1005 | 1005 | |
@@ -1012,10 +1012,10 @@ discard block |
||
1012 | 1012 | * |
1013 | 1013 | * @return array |
1014 | 1014 | */ |
1015 | -function sd_get_container_class_input( $type = 'container', $overwrite = array() ) { |
|
1015 | +function sd_get_container_class_input($type = 'container', $overwrite = array()) { |
|
1016 | 1016 | |
1017 | 1017 | $options = array( |
1018 | - 'container' => __( 'container (default)', 'super-duper' ), |
|
1018 | + 'container' => __('container (default)', 'super-duper'), |
|
1019 | 1019 | 'container-sm' => 'container-sm', |
1020 | 1020 | 'container-md' => 'container-md', |
1021 | 1021 | 'container-lg' => 'container-lg', |
@@ -1034,14 +1034,14 @@ discard block |
||
1034 | 1034 | |
1035 | 1035 | $defaults = array( |
1036 | 1036 | 'type' => 'select', |
1037 | - 'title' => __( 'Type', 'super-duper' ), |
|
1037 | + 'title' => __('Type', 'super-duper'), |
|
1038 | 1038 | 'options' => $options, |
1039 | 1039 | 'default' => '', |
1040 | 1040 | 'desc_tip' => true, |
1041 | - 'group' => __( 'Container', 'super-duper' ), |
|
1041 | + 'group' => __('Container', 'super-duper'), |
|
1042 | 1042 | ); |
1043 | 1043 | |
1044 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
1044 | + $input = wp_parse_args($overwrite, $defaults); |
|
1045 | 1045 | |
1046 | 1046 | return $input; |
1047 | 1047 | } |
@@ -1054,10 +1054,10 @@ discard block |
||
1054 | 1054 | * |
1055 | 1055 | * @return array |
1056 | 1056 | */ |
1057 | -function sd_get_position_class_input( $type = 'position', $overwrite = array() ) { |
|
1057 | +function sd_get_position_class_input($type = 'position', $overwrite = array()) { |
|
1058 | 1058 | |
1059 | 1059 | $options = array( |
1060 | - '' => __( 'Default', 'super-duper' ), |
|
1060 | + '' => __('Default', 'super-duper'), |
|
1061 | 1061 | 'position-static' => 'static', |
1062 | 1062 | 'position-relative' => 'relative', |
1063 | 1063 | 'position-absolute' => 'absolute', |
@@ -1070,14 +1070,14 @@ discard block |
||
1070 | 1070 | |
1071 | 1071 | $defaults = array( |
1072 | 1072 | 'type' => 'select', |
1073 | - 'title' => __( 'Position', 'super-duper' ), |
|
1073 | + 'title' => __('Position', 'super-duper'), |
|
1074 | 1074 | 'options' => $options, |
1075 | 1075 | 'default' => '', |
1076 | 1076 | 'desc_tip' => true, |
1077 | - 'group' => __( 'Wrapper Styles', 'super-duper' ), |
|
1077 | + 'group' => __('Wrapper Styles', 'super-duper'), |
|
1078 | 1078 | ); |
1079 | 1079 | |
1080 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
1080 | + $input = wp_parse_args($overwrite, $defaults); |
|
1081 | 1081 | |
1082 | 1082 | return $input; |
1083 | 1083 | } |
@@ -1090,30 +1090,30 @@ discard block |
||
1090 | 1090 | * |
1091 | 1091 | * @return array |
1092 | 1092 | */ |
1093 | -function sd_get_sticky_offset_input( $type = 'top', $overwrite = array() ) { |
|
1093 | +function sd_get_sticky_offset_input($type = 'top', $overwrite = array()) { |
|
1094 | 1094 | |
1095 | 1095 | $defaults = array( |
1096 | 1096 | 'type' => 'number', |
1097 | - 'title' => __( 'Sticky offset', 'super-duper' ), |
|
1097 | + 'title' => __('Sticky offset', 'super-duper'), |
|
1098 | 1098 | //'desc' => __('Sticky offset'), |
1099 | 1099 | 'default' => '', |
1100 | 1100 | 'desc_tip' => true, |
1101 | - 'group' => __( 'Wrapper Styles', 'super-duper' ), |
|
1101 | + 'group' => __('Wrapper Styles', 'super-duper'), |
|
1102 | 1102 | 'element_require' => '[%position%]=="sticky" || [%position%]=="sticky-top"', |
1103 | 1103 | ); |
1104 | 1104 | |
1105 | 1105 | // title |
1106 | - if ( $type == 'top' ) { |
|
1107 | - $defaults['title'] = __( 'Top offset', 'super-duper' ); |
|
1106 | + if ($type == 'top') { |
|
1107 | + $defaults['title'] = __('Top offset', 'super-duper'); |
|
1108 | 1108 | $defaults['icon'] = 'box-top'; |
1109 | 1109 | $defaults['row'] = array( |
1110 | - 'title' => __( 'Sticky offset', 'super-duper' ), |
|
1110 | + 'title' => __('Sticky offset', 'super-duper'), |
|
1111 | 1111 | 'key' => 'sticky-offset', |
1112 | 1112 | 'open' => true, |
1113 | 1113 | 'class' => 'text-center', |
1114 | 1114 | ); |
1115 | - } elseif ( $type == 'bottom' ) { |
|
1116 | - $defaults['title'] = __( 'Bottom offset', 'super-duper' ); |
|
1115 | + } elseif ($type == 'bottom') { |
|
1116 | + $defaults['title'] = __('Bottom offset', 'super-duper'); |
|
1117 | 1117 | $defaults['icon'] = 'box-bottom'; |
1118 | 1118 | $defaults['row'] = array( |
1119 | 1119 | 'key' => 'sticky-offset', |
@@ -1121,7 +1121,7 @@ discard block |
||
1121 | 1121 | ); |
1122 | 1122 | } |
1123 | 1123 | |
1124 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
1124 | + $input = wp_parse_args($overwrite, $defaults); |
|
1125 | 1125 | |
1126 | 1126 | return $input; |
1127 | 1127 | } |
@@ -1134,10 +1134,10 @@ discard block |
||
1134 | 1134 | * |
1135 | 1135 | * @return array |
1136 | 1136 | */ |
1137 | -function sd_get_font_size_input( $type = 'font_size', $overwrite = array(), $has_custom = false ) { |
|
1137 | +function sd_get_font_size_input($type = 'font_size', $overwrite = array(), $has_custom = false) { |
|
1138 | 1138 | |
1139 | 1139 | $options = array( |
1140 | - '' => __( 'Inherit from parent', 'super-duper' ), |
|
1140 | + '' => __('Inherit from parent', 'super-duper'), |
|
1141 | 1141 | 'h6' => 'h6', |
1142 | 1142 | 'h5' => 'h5', |
1143 | 1143 | 'h4' => 'h4', |
@@ -1150,20 +1150,20 @@ discard block |
||
1150 | 1150 | 'display-4' => 'display-4', |
1151 | 1151 | ); |
1152 | 1152 | |
1153 | - if ( $has_custom ) { |
|
1154 | - $options['custom'] = __( 'Custom size', 'super-duper' ); |
|
1153 | + if ($has_custom) { |
|
1154 | + $options['custom'] = __('Custom size', 'super-duper'); |
|
1155 | 1155 | } |
1156 | 1156 | |
1157 | 1157 | $defaults = array( |
1158 | 1158 | 'type' => 'select', |
1159 | - 'title' => __( 'Font size', 'super-duper' ), |
|
1159 | + 'title' => __('Font size', 'super-duper'), |
|
1160 | 1160 | 'options' => $options, |
1161 | 1161 | 'default' => '', |
1162 | 1162 | 'desc_tip' => true, |
1163 | - 'group' => __( 'Typography', 'super-duper' ), |
|
1163 | + 'group' => __('Typography', 'super-duper'), |
|
1164 | 1164 | ); |
1165 | 1165 | |
1166 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
1166 | + $input = wp_parse_args($overwrite, $defaults); |
|
1167 | 1167 | |
1168 | 1168 | return $input; |
1169 | 1169 | } |
@@ -1176,11 +1176,11 @@ discard block |
||
1176 | 1176 | * |
1177 | 1177 | * @return array |
1178 | 1178 | */ |
1179 | -function sd_get_font_custom_size_input( $type = 'font_size_custom', $overwrite = array(), $parent_type = '' ) { |
|
1179 | +function sd_get_font_custom_size_input($type = 'font_size_custom', $overwrite = array(), $parent_type = '') { |
|
1180 | 1180 | |
1181 | 1181 | $defaults = array( |
1182 | 1182 | 'type' => 'number', |
1183 | - 'title' => __( 'Font size (rem)', 'super-duper' ), |
|
1183 | + 'title' => __('Font size (rem)', 'super-duper'), |
|
1184 | 1184 | 'default' => '', |
1185 | 1185 | 'placeholder' => '1.25', |
1186 | 1186 | 'custom_attributes' => array( |
@@ -1189,14 +1189,14 @@ discard block |
||
1189 | 1189 | 'max' => '100', |
1190 | 1190 | ), |
1191 | 1191 | 'desc_tip' => true, |
1192 | - 'group' => __( 'Typography', 'super-duper' ), |
|
1192 | + 'group' => __('Typography', 'super-duper'), |
|
1193 | 1193 | ); |
1194 | 1194 | |
1195 | - if ( $parent_type ) { |
|
1195 | + if ($parent_type) { |
|
1196 | 1196 | $defaults['element_require'] = '[%' . $parent_type . '%]=="custom"'; |
1197 | 1197 | } |
1198 | 1198 | |
1199 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
1199 | + $input = wp_parse_args($overwrite, $defaults); |
|
1200 | 1200 | |
1201 | 1201 | return $input; |
1202 | 1202 | } |
@@ -1209,11 +1209,11 @@ discard block |
||
1209 | 1209 | * |
1210 | 1210 | * @return array |
1211 | 1211 | */ |
1212 | -function sd_get_font_line_height_input( $type = 'font_line_height', $overwrite = array() ) { |
|
1212 | +function sd_get_font_line_height_input($type = 'font_line_height', $overwrite = array()) { |
|
1213 | 1213 | |
1214 | 1214 | $defaults = array( |
1215 | 1215 | 'type' => 'number', |
1216 | - 'title' => __( 'Font Line Height', 'super-duper' ), |
|
1216 | + 'title' => __('Font Line Height', 'super-duper'), |
|
1217 | 1217 | 'default' => '', |
1218 | 1218 | 'placeholder' => '1.75', |
1219 | 1219 | 'custom_attributes' => array( |
@@ -1222,10 +1222,10 @@ discard block |
||
1222 | 1222 | 'max' => '100', |
1223 | 1223 | ), |
1224 | 1224 | 'desc_tip' => true, |
1225 | - 'group' => __( 'Typography', 'super-duper' ), |
|
1225 | + 'group' => __('Typography', 'super-duper'), |
|
1226 | 1226 | ); |
1227 | 1227 | |
1228 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
1228 | + $input = wp_parse_args($overwrite, $defaults); |
|
1229 | 1229 | |
1230 | 1230 | return $input; |
1231 | 1231 | } |
@@ -1238,17 +1238,17 @@ discard block |
||
1238 | 1238 | * |
1239 | 1239 | * @return array |
1240 | 1240 | */ |
1241 | -function sd_get_font_size_input_group( $type = 'font_size', $overwrite = array(), $overwrite_custom = array() ) { |
|
1241 | +function sd_get_font_size_input_group($type = 'font_size', $overwrite = array(), $overwrite_custom = array()) { |
|
1242 | 1242 | |
1243 | 1243 | $inputs = array(); |
1244 | 1244 | |
1245 | - if ( $overwrite !== false ) { |
|
1246 | - $inputs[ $type ] = sd_get_font_size_input( $type, $overwrite, true ); |
|
1245 | + if ($overwrite !== false) { |
|
1246 | + $inputs[$type] = sd_get_font_size_input($type, $overwrite, true); |
|
1247 | 1247 | } |
1248 | 1248 | |
1249 | - if ( $overwrite_custom !== false ) { |
|
1249 | + if ($overwrite_custom !== false) { |
|
1250 | 1250 | $custom = $type . '_custom'; |
1251 | - $inputs[ $custom ] = sd_get_font_custom_size_input( $custom, $overwrite_custom, $type ); |
|
1251 | + $inputs[$custom] = sd_get_font_custom_size_input($custom, $overwrite_custom, $type); |
|
1252 | 1252 | } |
1253 | 1253 | |
1254 | 1254 | return $inputs; |
@@ -1262,10 +1262,10 @@ discard block |
||
1262 | 1262 | * |
1263 | 1263 | * @return array |
1264 | 1264 | */ |
1265 | -function sd_get_font_weight_input( $type = 'font_weight', $overwrite = array() ) { |
|
1265 | +function sd_get_font_weight_input($type = 'font_weight', $overwrite = array()) { |
|
1266 | 1266 | |
1267 | 1267 | $options = array( |
1268 | - '' => __( 'Inherit', 'super-duper' ), |
|
1268 | + '' => __('Inherit', 'super-duper'), |
|
1269 | 1269 | 'font-weight-bold' => 'bold', |
1270 | 1270 | 'font-weight-bolder' => 'bolder', |
1271 | 1271 | 'font-weight-normal' => 'normal', |
@@ -1281,14 +1281,14 @@ discard block |
||
1281 | 1281 | |
1282 | 1282 | $defaults = array( |
1283 | 1283 | 'type' => 'select', |
1284 | - 'title' => __( 'Appearance', 'super-duper' ), |
|
1284 | + 'title' => __('Appearance', 'super-duper'), |
|
1285 | 1285 | 'options' => $options, |
1286 | 1286 | 'default' => '', |
1287 | 1287 | 'desc_tip' => true, |
1288 | - 'group' => __( 'Typography', 'super-duper' ), |
|
1288 | + 'group' => __('Typography', 'super-duper'), |
|
1289 | 1289 | ); |
1290 | 1290 | |
1291 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
1291 | + $input = wp_parse_args($overwrite, $defaults); |
|
1292 | 1292 | |
1293 | 1293 | return $input; |
1294 | 1294 | } |
@@ -1301,25 +1301,25 @@ discard block |
||
1301 | 1301 | * |
1302 | 1302 | * @return array |
1303 | 1303 | */ |
1304 | -function sd_get_font_case_input( $type = 'font_weight', $overwrite = array() ) { |
|
1304 | +function sd_get_font_case_input($type = 'font_weight', $overwrite = array()) { |
|
1305 | 1305 | |
1306 | 1306 | $options = array( |
1307 | - '' => __( 'Default', 'super-duper' ), |
|
1308 | - 'text-lowercase' => __( 'lowercase', 'super-duper' ), |
|
1309 | - 'text-uppercase' => __( 'UPPERCASE', 'super-duper' ), |
|
1310 | - 'text-capitalize' => __( 'Capitalize', 'super-duper' ), |
|
1307 | + '' => __('Default', 'super-duper'), |
|
1308 | + 'text-lowercase' => __('lowercase', 'super-duper'), |
|
1309 | + 'text-uppercase' => __('UPPERCASE', 'super-duper'), |
|
1310 | + 'text-capitalize' => __('Capitalize', 'super-duper'), |
|
1311 | 1311 | ); |
1312 | 1312 | |
1313 | 1313 | $defaults = array( |
1314 | 1314 | 'type' => 'select', |
1315 | - 'title' => __( 'Letter case', 'super-duper' ), |
|
1315 | + 'title' => __('Letter case', 'super-duper'), |
|
1316 | 1316 | 'options' => $options, |
1317 | 1317 | 'default' => '', |
1318 | 1318 | 'desc_tip' => true, |
1319 | - 'group' => __( 'Typography', 'super-duper' ), |
|
1319 | + 'group' => __('Typography', 'super-duper'), |
|
1320 | 1320 | ); |
1321 | 1321 | |
1322 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
1322 | + $input = wp_parse_args($overwrite, $defaults); |
|
1323 | 1323 | |
1324 | 1324 | return $input; |
1325 | 1325 | } |
@@ -1333,23 +1333,23 @@ discard block |
||
1333 | 1333 | * A helper function for font size |
1334 | 1334 | * |
1335 | 1335 | */ |
1336 | -function sd_get_font_italic_input( $type = 'font_italic', $overwrite = array() ) { |
|
1336 | +function sd_get_font_italic_input($type = 'font_italic', $overwrite = array()) { |
|
1337 | 1337 | |
1338 | 1338 | $options = array( |
1339 | - '' => __( 'No', 'super-duper' ), |
|
1340 | - 'font-italic' => __( 'Yes', 'super-duper' ), |
|
1339 | + '' => __('No', 'super-duper'), |
|
1340 | + 'font-italic' => __('Yes', 'super-duper'), |
|
1341 | 1341 | ); |
1342 | 1342 | |
1343 | 1343 | $defaults = array( |
1344 | 1344 | 'type' => 'select', |
1345 | - 'title' => __( 'Font italic', 'super-duper' ), |
|
1345 | + 'title' => __('Font italic', 'super-duper'), |
|
1346 | 1346 | 'options' => $options, |
1347 | 1347 | 'default' => '', |
1348 | 1348 | 'desc_tip' => true, |
1349 | - 'group' => __( 'Typography', 'super-duper' ), |
|
1349 | + 'group' => __('Typography', 'super-duper'), |
|
1350 | 1350 | ); |
1351 | 1351 | |
1352 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
1352 | + $input = wp_parse_args($overwrite, $defaults); |
|
1353 | 1353 | |
1354 | 1354 | return $input; |
1355 | 1355 | } |
@@ -1362,18 +1362,18 @@ discard block |
||
1362 | 1362 | * |
1363 | 1363 | * @return array |
1364 | 1364 | */ |
1365 | -function sd_get_anchor_input( $type = 'anchor', $overwrite = array() ) { |
|
1365 | +function sd_get_anchor_input($type = 'anchor', $overwrite = array()) { |
|
1366 | 1366 | |
1367 | 1367 | $defaults = array( |
1368 | 1368 | 'type' => 'text', |
1369 | - 'title' => __( 'HTML anchor', 'super-duper' ), |
|
1370 | - 'desc' => __( 'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.' ), |
|
1369 | + 'title' => __('HTML anchor', 'super-duper'), |
|
1370 | + 'desc' => __('Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.'), |
|
1371 | 1371 | 'default' => '', |
1372 | 1372 | 'desc_tip' => true, |
1373 | - 'group' => __( 'Advanced', 'super-duper' ), |
|
1373 | + 'group' => __('Advanced', 'super-duper'), |
|
1374 | 1374 | ); |
1375 | 1375 | |
1376 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
1376 | + $input = wp_parse_args($overwrite, $defaults); |
|
1377 | 1377 | |
1378 | 1378 | return $input; |
1379 | 1379 | } |
@@ -1386,18 +1386,18 @@ discard block |
||
1386 | 1386 | * |
1387 | 1387 | * @return array |
1388 | 1388 | */ |
1389 | -function sd_get_class_input( $type = 'css_class', $overwrite = array() ) { |
|
1389 | +function sd_get_class_input($type = 'css_class', $overwrite = array()) { |
|
1390 | 1390 | |
1391 | 1391 | $defaults = array( |
1392 | 1392 | 'type' => 'text', |
1393 | - 'title' => __( 'Additional CSS class(es)', 'super-duper' ), |
|
1394 | - 'desc' => __( 'Separate multiple classes with spaces.', 'super-duper' ), |
|
1393 | + 'title' => __('Additional CSS class(es)', 'super-duper'), |
|
1394 | + 'desc' => __('Separate multiple classes with spaces.', 'super-duper'), |
|
1395 | 1395 | 'default' => '', |
1396 | 1396 | 'desc_tip' => true, |
1397 | - 'group' => __( 'Advanced', 'super-duper' ), |
|
1397 | + 'group' => __('Advanced', 'super-duper'), |
|
1398 | 1398 | ); |
1399 | 1399 | |
1400 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
1400 | + $input = wp_parse_args($overwrite, $defaults); |
|
1401 | 1401 | |
1402 | 1402 | return $input; |
1403 | 1403 | } |
@@ -1410,45 +1410,45 @@ discard block |
||
1410 | 1410 | * |
1411 | 1411 | * @return array |
1412 | 1412 | */ |
1413 | -function sd_get_hover_animations_input( $type = 'hover_animations', $overwrite = array() ) { |
|
1413 | +function sd_get_hover_animations_input($type = 'hover_animations', $overwrite = array()) { |
|
1414 | 1414 | |
1415 | 1415 | $options = array( |
1416 | - '' => __( 'none', 'super-duper' ), |
|
1417 | - 'hover-zoom' => __( 'Zoom', 'super-duper' ), |
|
1418 | - 'hover-shadow' => __( 'Shadow', 'super-duper' ), |
|
1419 | - 'hover-move-up' => __( 'Move up', 'super-duper' ), |
|
1420 | - 'hover-move-down' => __( 'Move down', 'super-duper' ), |
|
1421 | - 'hover-move-left' => __( 'Move left', 'super-duper' ), |
|
1422 | - 'hover-move-right' => __( 'Move right', 'super-duper' ), |
|
1416 | + '' => __('none', 'super-duper'), |
|
1417 | + 'hover-zoom' => __('Zoom', 'super-duper'), |
|
1418 | + 'hover-shadow' => __('Shadow', 'super-duper'), |
|
1419 | + 'hover-move-up' => __('Move up', 'super-duper'), |
|
1420 | + 'hover-move-down' => __('Move down', 'super-duper'), |
|
1421 | + 'hover-move-left' => __('Move left', 'super-duper'), |
|
1422 | + 'hover-move-right' => __('Move right', 'super-duper'), |
|
1423 | 1423 | ); |
1424 | 1424 | |
1425 | 1425 | $defaults = array( |
1426 | 1426 | 'type' => 'select', |
1427 | 1427 | 'multiple' => true, |
1428 | - 'title' => __( 'Hover Animations', 'super-duper' ), |
|
1428 | + 'title' => __('Hover Animations', 'super-duper'), |
|
1429 | 1429 | 'options' => $options, |
1430 | 1430 | 'default' => '', |
1431 | 1431 | 'desc_tip' => true, |
1432 | - 'group' => __( 'Hover Animations', 'super-duper' ), |
|
1432 | + 'group' => __('Hover Animations', 'super-duper'), |
|
1433 | 1433 | ); |
1434 | 1434 | |
1435 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
1435 | + $input = wp_parse_args($overwrite, $defaults); |
|
1436 | 1436 | |
1437 | 1437 | return $input; |
1438 | 1438 | } |
1439 | 1439 | |
1440 | 1440 | |
1441 | -function sd_get_flex_align_items_input( $type = 'align-items', $overwrite = array() ) { |
|
1441 | +function sd_get_flex_align_items_input($type = 'align-items', $overwrite = array()) { |
|
1442 | 1442 | $device_size = ''; |
1443 | - if ( ! empty( $overwrite['device_type'] ) ) { |
|
1444 | - if ( $overwrite['device_type'] == 'Tablet' ) { |
|
1443 | + if (!empty($overwrite['device_type'])) { |
|
1444 | + if ($overwrite['device_type'] == 'Tablet') { |
|
1445 | 1445 | $device_size = '-md'; |
1446 | - } elseif ( $overwrite['device_type'] == 'Desktop' ) { |
|
1446 | + } elseif ($overwrite['device_type'] == 'Desktop') { |
|
1447 | 1447 | $device_size = '-lg'; |
1448 | 1448 | } |
1449 | 1449 | } |
1450 | 1450 | $options = array( |
1451 | - '' => __( 'Default', 'super-duper' ), |
|
1451 | + '' => __('Default', 'super-duper'), |
|
1452 | 1452 | 'align-items' . $device_size . '-start' => 'align-items-start', |
1453 | 1453 | 'align-items' . $device_size . '-end' => 'align-items-end', |
1454 | 1454 | 'align-items' . $device_size . '-center' => 'align-items-center', |
@@ -1458,21 +1458,21 @@ discard block |
||
1458 | 1458 | |
1459 | 1459 | $defaults = array( |
1460 | 1460 | 'type' => 'select', |
1461 | - 'title' => __( 'Vertical Align Items', 'super-duper' ), |
|
1461 | + 'title' => __('Vertical Align Items', 'super-duper'), |
|
1462 | 1462 | 'options' => $options, |
1463 | 1463 | 'default' => '', |
1464 | 1464 | 'desc_tip' => true, |
1465 | - 'group' => __( 'Wrapper Styles', 'super-duper' ), |
|
1465 | + 'group' => __('Wrapper Styles', 'super-duper'), |
|
1466 | 1466 | 'element_require' => ' ( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ', |
1467 | 1467 | |
1468 | 1468 | ); |
1469 | 1469 | |
1470 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
1470 | + $input = wp_parse_args($overwrite, $defaults); |
|
1471 | 1471 | |
1472 | 1472 | return $input; |
1473 | 1473 | } |
1474 | 1474 | |
1475 | -function sd_get_flex_align_items_input_group( $type = 'flex_align_items', $overwrite = array() ) { |
|
1475 | +function sd_get_flex_align_items_input_group($type = 'flex_align_items', $overwrite = array()) { |
|
1476 | 1476 | $inputs = array(); |
1477 | 1477 | $sizes = array( |
1478 | 1478 | '' => 'Mobile', |
@@ -1480,28 +1480,28 @@ discard block |
||
1480 | 1480 | '_lg' => 'Desktop', |
1481 | 1481 | ); |
1482 | 1482 | |
1483 | - if ( $overwrite !== false ) { |
|
1483 | + if ($overwrite !== false) { |
|
1484 | 1484 | |
1485 | - foreach ( $sizes as $ds => $dt ) { |
|
1485 | + foreach ($sizes as $ds => $dt) { |
|
1486 | 1486 | $overwrite['device_type'] = $dt; |
1487 | - $inputs[ $type . $ds ] = sd_get_flex_align_items_input( $type, $overwrite ); |
|
1487 | + $inputs[$type . $ds] = sd_get_flex_align_items_input($type, $overwrite); |
|
1488 | 1488 | } |
1489 | 1489 | } |
1490 | 1490 | |
1491 | 1491 | return $inputs; |
1492 | 1492 | } |
1493 | 1493 | |
1494 | -function sd_get_flex_justify_content_input( $type = 'flex_justify_content', $overwrite = array() ) { |
|
1494 | +function sd_get_flex_justify_content_input($type = 'flex_justify_content', $overwrite = array()) { |
|
1495 | 1495 | $device_size = ''; |
1496 | - if ( ! empty( $overwrite['device_type'] ) ) { |
|
1497 | - if ( $overwrite['device_type'] == 'Tablet' ) { |
|
1496 | + if (!empty($overwrite['device_type'])) { |
|
1497 | + if ($overwrite['device_type'] == 'Tablet') { |
|
1498 | 1498 | $device_size = '-md'; |
1499 | - } elseif ( $overwrite['device_type'] == 'Desktop' ) { |
|
1499 | + } elseif ($overwrite['device_type'] == 'Desktop') { |
|
1500 | 1500 | $device_size = '-lg'; |
1501 | 1501 | } |
1502 | 1502 | } |
1503 | 1503 | $options = array( |
1504 | - '' => __( 'Default', 'super-duper' ), |
|
1504 | + '' => __('Default', 'super-duper'), |
|
1505 | 1505 | 'justify-content' . $device_size . '-start' => 'justify-content-start', |
1506 | 1506 | 'justify-content' . $device_size . '-end' => 'justify-content-end', |
1507 | 1507 | 'justify-content' . $device_size . '-center' => 'justify-content-center', |
@@ -1511,21 +1511,21 @@ discard block |
||
1511 | 1511 | |
1512 | 1512 | $defaults = array( |
1513 | 1513 | 'type' => 'select', |
1514 | - 'title' => __( 'Justify content' ), |
|
1514 | + 'title' => __('Justify content'), |
|
1515 | 1515 | 'options' => $options, |
1516 | 1516 | 'default' => '', |
1517 | 1517 | 'desc_tip' => true, |
1518 | - 'group' => __( 'Wrapper Styles', 'super-duper' ), |
|
1518 | + 'group' => __('Wrapper Styles', 'super-duper'), |
|
1519 | 1519 | 'element_require' => '( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ', |
1520 | 1520 | |
1521 | 1521 | ); |
1522 | 1522 | |
1523 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
1523 | + $input = wp_parse_args($overwrite, $defaults); |
|
1524 | 1524 | |
1525 | 1525 | return $input; |
1526 | 1526 | } |
1527 | 1527 | |
1528 | -function sd_get_flex_justify_content_input_group( $type = 'flex_justify_content', $overwrite = array() ) { |
|
1528 | +function sd_get_flex_justify_content_input_group($type = 'flex_justify_content', $overwrite = array()) { |
|
1529 | 1529 | $inputs = array(); |
1530 | 1530 | $sizes = array( |
1531 | 1531 | '' => 'Mobile', |
@@ -1533,11 +1533,11 @@ discard block |
||
1533 | 1533 | '_lg' => 'Desktop', |
1534 | 1534 | ); |
1535 | 1535 | |
1536 | - if ( $overwrite !== false ) { |
|
1536 | + if ($overwrite !== false) { |
|
1537 | 1537 | |
1538 | - foreach ( $sizes as $ds => $dt ) { |
|
1538 | + foreach ($sizes as $ds => $dt) { |
|
1539 | 1539 | $overwrite['device_type'] = $dt; |
1540 | - $inputs[ $type . $ds ] = sd_get_flex_justify_content_input( $type, $overwrite ); |
|
1540 | + $inputs[$type . $ds] = sd_get_flex_justify_content_input($type, $overwrite); |
|
1541 | 1541 | } |
1542 | 1542 | } |
1543 | 1543 | |
@@ -1545,17 +1545,17 @@ discard block |
||
1545 | 1545 | } |
1546 | 1546 | |
1547 | 1547 | |
1548 | -function sd_get_flex_align_self_input( $type = 'flex_align_self', $overwrite = array() ) { |
|
1548 | +function sd_get_flex_align_self_input($type = 'flex_align_self', $overwrite = array()) { |
|
1549 | 1549 | $device_size = ''; |
1550 | - if ( ! empty( $overwrite['device_type'] ) ) { |
|
1551 | - if ( $overwrite['device_type'] == 'Tablet' ) { |
|
1550 | + if (!empty($overwrite['device_type'])) { |
|
1551 | + if ($overwrite['device_type'] == 'Tablet') { |
|
1552 | 1552 | $device_size = '-md'; |
1553 | - } elseif ( $overwrite['device_type'] == 'Desktop' ) { |
|
1553 | + } elseif ($overwrite['device_type'] == 'Desktop') { |
|
1554 | 1554 | $device_size = '-lg'; |
1555 | 1555 | } |
1556 | 1556 | } |
1557 | 1557 | $options = array( |
1558 | - '' => __( 'Default', 'super-duper' ), |
|
1558 | + '' => __('Default', 'super-duper'), |
|
1559 | 1559 | 'align-items' . $device_size . '-start' => 'align-items-start', |
1560 | 1560 | 'align-items' . $device_size . '-end' => 'align-items-end', |
1561 | 1561 | 'align-items' . $device_size . '-center' => 'align-items-center', |
@@ -1565,21 +1565,21 @@ discard block |
||
1565 | 1565 | |
1566 | 1566 | $defaults = array( |
1567 | 1567 | 'type' => 'select', |
1568 | - 'title' => __( 'Align Self', 'super-duper' ), |
|
1568 | + 'title' => __('Align Self', 'super-duper'), |
|
1569 | 1569 | 'options' => $options, |
1570 | 1570 | 'default' => '', |
1571 | 1571 | 'desc_tip' => true, |
1572 | - 'group' => __( 'Wrapper Styles', 'super-duper' ), |
|
1572 | + 'group' => __('Wrapper Styles', 'super-duper'), |
|
1573 | 1573 | 'element_require' => ' [%container%]=="col" ', |
1574 | 1574 | |
1575 | 1575 | ); |
1576 | 1576 | |
1577 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
1577 | + $input = wp_parse_args($overwrite, $defaults); |
|
1578 | 1578 | |
1579 | 1579 | return $input; |
1580 | 1580 | } |
1581 | 1581 | |
1582 | -function sd_get_flex_align_self_input_group( $type = 'flex_align_self', $overwrite = array() ) { |
|
1582 | +function sd_get_flex_align_self_input_group($type = 'flex_align_self', $overwrite = array()) { |
|
1583 | 1583 | $inputs = array(); |
1584 | 1584 | $sizes = array( |
1585 | 1585 | '' => 'Mobile', |
@@ -1587,53 +1587,53 @@ discard block |
||
1587 | 1587 | '_lg' => 'Desktop', |
1588 | 1588 | ); |
1589 | 1589 | |
1590 | - if ( $overwrite !== false ) { |
|
1590 | + if ($overwrite !== false) { |
|
1591 | 1591 | |
1592 | - foreach ( $sizes as $ds => $dt ) { |
|
1592 | + foreach ($sizes as $ds => $dt) { |
|
1593 | 1593 | $overwrite['device_type'] = $dt; |
1594 | - $inputs[ $type . $ds ] = sd_get_flex_align_self_input( $type, $overwrite ); |
|
1594 | + $inputs[$type . $ds] = sd_get_flex_align_self_input($type, $overwrite); |
|
1595 | 1595 | } |
1596 | 1596 | } |
1597 | 1597 | |
1598 | 1598 | return $inputs; |
1599 | 1599 | } |
1600 | 1600 | |
1601 | -function sd_get_flex_order_input( $type = 'flex_order', $overwrite = array() ) { |
|
1601 | +function sd_get_flex_order_input($type = 'flex_order', $overwrite = array()) { |
|
1602 | 1602 | $device_size = ''; |
1603 | - if ( ! empty( $overwrite['device_type'] ) ) { |
|
1604 | - if ( $overwrite['device_type'] == 'Tablet' ) { |
|
1603 | + if (!empty($overwrite['device_type'])) { |
|
1604 | + if ($overwrite['device_type'] == 'Tablet') { |
|
1605 | 1605 | $device_size = '-md'; |
1606 | - } elseif ( $overwrite['device_type'] == 'Desktop' ) { |
|
1606 | + } elseif ($overwrite['device_type'] == 'Desktop') { |
|
1607 | 1607 | $device_size = '-lg'; |
1608 | 1608 | } |
1609 | 1609 | } |
1610 | 1610 | $options = array( |
1611 | - '' => __( 'Default', 'super-duper' ), |
|
1611 | + '' => __('Default', 'super-duper'), |
|
1612 | 1612 | ); |
1613 | 1613 | |
1614 | 1614 | $i = 0; |
1615 | - while ( $i <= 12 ) { |
|
1616 | - $options[ 'order' . $device_size . '-' . $i ] = $i; |
|
1615 | + while ($i <= 12) { |
|
1616 | + $options['order' . $device_size . '-' . $i] = $i; |
|
1617 | 1617 | $i++; |
1618 | 1618 | } |
1619 | 1619 | |
1620 | 1620 | $defaults = array( |
1621 | 1621 | 'type' => 'select', |
1622 | - 'title' => __( 'Flex Order', 'super-duper' ), |
|
1622 | + 'title' => __('Flex Order', 'super-duper'), |
|
1623 | 1623 | 'options' => $options, |
1624 | 1624 | 'default' => '', |
1625 | 1625 | 'desc_tip' => true, |
1626 | - 'group' => __( 'Wrapper Styles', 'super-duper' ), |
|
1626 | + 'group' => __('Wrapper Styles', 'super-duper'), |
|
1627 | 1627 | 'element_require' => ' [%container%]=="col" ', |
1628 | 1628 | |
1629 | 1629 | ); |
1630 | 1630 | |
1631 | - $input = wp_parse_args( $overwrite, $defaults ); |
|
1631 | + $input = wp_parse_args($overwrite, $defaults); |
|
1632 | 1632 | |
1633 | 1633 | return $input; |
1634 | 1634 | } |
1635 | 1635 | |
1636 | -function sd_get_flex_order_input_group( $type = 'flex_order', $overwrite = array() ) { |
|
1636 | +function sd_get_flex_order_input_group($type = 'flex_order', $overwrite = array()) { |
|
1637 | 1637 | $inputs = array(); |
1638 | 1638 | $sizes = array( |
1639 | 1639 | '' => 'Mobile', |
@@ -1641,11 +1641,11 @@ discard block |
||
1641 | 1641 | '_lg' => 'Desktop', |
1642 | 1642 | ); |
1643 | 1643 | |
1644 | - if ( $overwrite !== false ) { |
|
1644 | + if ($overwrite !== false) { |
|
1645 | 1645 | |
1646 | - foreach ( $sizes as $ds => $dt ) { |
|
1646 | + foreach ($sizes as $ds => $dt) { |
|
1647 | 1647 | $overwrite['device_type'] = $dt; |
1648 | - $inputs[ $type . $ds ] = sd_get_flex_order_input( $type, $overwrite ); |
|
1648 | + $inputs[$type . $ds] = sd_get_flex_order_input($type, $overwrite); |
|
1649 | 1649 | } |
1650 | 1650 | } |
1651 | 1651 | |
@@ -1660,234 +1660,234 @@ discard block |
||
1660 | 1660 | * @return string |
1661 | 1661 | * @todo find best way to use px- py- or general p- |
1662 | 1662 | */ |
1663 | -function sd_build_aui_class( $args ) { |
|
1663 | +function sd_build_aui_class($args) { |
|
1664 | 1664 | |
1665 | 1665 | $classes = array(); |
1666 | 1666 | |
1667 | 1667 | // margins. |
1668 | - if ( isset( $args['mt'] ) && $args['mt'] !== '' ) { |
|
1669 | - $classes[] = 'mt-' . sanitize_html_class( $args['mt'] ); |
|
1668 | + if (isset($args['mt']) && $args['mt'] !== '') { |
|
1669 | + $classes[] = 'mt-' . sanitize_html_class($args['mt']); |
|
1670 | 1670 | $mt = $args['mt']; |
1671 | 1671 | } else { |
1672 | 1672 | $mt = null; |
1673 | 1673 | } |
1674 | - if ( isset( $args['mr'] ) && $args['mr'] !== '' ) { |
|
1675 | - $classes[] = 'mr-' . sanitize_html_class( $args['mr'] ); |
|
1674 | + if (isset($args['mr']) && $args['mr'] !== '') { |
|
1675 | + $classes[] = 'mr-' . sanitize_html_class($args['mr']); |
|
1676 | 1676 | $mr = $args['mr']; |
1677 | 1677 | } else { |
1678 | 1678 | $mr = null; |
1679 | 1679 | } |
1680 | - if ( isset( $args['mb'] ) && $args['mb'] !== '' ) { |
|
1681 | - $classes[] = 'mb-' . sanitize_html_class( $args['mb'] ); |
|
1680 | + if (isset($args['mb']) && $args['mb'] !== '') { |
|
1681 | + $classes[] = 'mb-' . sanitize_html_class($args['mb']); |
|
1682 | 1682 | $mb = $args['mb']; |
1683 | 1683 | } else { |
1684 | 1684 | $mb = null; |
1685 | 1685 | } |
1686 | - if ( isset( $args['ml'] ) && $args['ml'] !== '' ) { |
|
1687 | - $classes[] = 'ml-' . sanitize_html_class( $args['ml'] ); |
|
1686 | + if (isset($args['ml']) && $args['ml'] !== '') { |
|
1687 | + $classes[] = 'ml-' . sanitize_html_class($args['ml']); |
|
1688 | 1688 | $ml = $args['ml']; |
1689 | 1689 | } else { |
1690 | 1690 | $ml = null; |
1691 | 1691 | } |
1692 | 1692 | |
1693 | 1693 | // margins tablet. |
1694 | - if ( isset( $args['mt_md'] ) && $args['mt_md'] !== '' ) { |
|
1695 | - $classes[] = 'mt-md-' . sanitize_html_class( $args['mt_md'] ); |
|
1694 | + if (isset($args['mt_md']) && $args['mt_md'] !== '') { |
|
1695 | + $classes[] = 'mt-md-' . sanitize_html_class($args['mt_md']); |
|
1696 | 1696 | $mt_md = $args['mt_md']; |
1697 | 1697 | } else { |
1698 | 1698 | $mt_md = null; |
1699 | 1699 | } |
1700 | - if ( isset( $args['mr_md'] ) && $args['mr_md'] !== '' ) { |
|
1701 | - $classes[] = 'mr-md-' . sanitize_html_class( $args['mr_md'] ); |
|
1700 | + if (isset($args['mr_md']) && $args['mr_md'] !== '') { |
|
1701 | + $classes[] = 'mr-md-' . sanitize_html_class($args['mr_md']); |
|
1702 | 1702 | $mt_md = $args['mr_md']; |
1703 | 1703 | } else { |
1704 | 1704 | $mr_md = null; |
1705 | 1705 | } |
1706 | - if ( isset( $args['mb_md'] ) && $args['mb_md'] !== '' ) { |
|
1707 | - $classes[] = 'mb-md-' . sanitize_html_class( $args['mb_md'] ); |
|
1706 | + if (isset($args['mb_md']) && $args['mb_md'] !== '') { |
|
1707 | + $classes[] = 'mb-md-' . sanitize_html_class($args['mb_md']); |
|
1708 | 1708 | $mt_md = $args['mb_md']; |
1709 | 1709 | } else { |
1710 | 1710 | $mb_md = null; |
1711 | 1711 | } |
1712 | - if ( isset( $args['ml_md'] ) && $args['ml_md'] !== '' ) { |
|
1713 | - $classes[] = 'ml-md-' . sanitize_html_class( $args['ml_md'] ); |
|
1712 | + if (isset($args['ml_md']) && $args['ml_md'] !== '') { |
|
1713 | + $classes[] = 'ml-md-' . sanitize_html_class($args['ml_md']); |
|
1714 | 1714 | $mt_md = $args['ml_md']; |
1715 | 1715 | } else { |
1716 | 1716 | $ml_md = null; |
1717 | 1717 | } |
1718 | 1718 | |
1719 | 1719 | // margins desktop. |
1720 | - if ( isset( $args['mt_lg'] ) && $args['mt_lg'] !== '' ) { |
|
1721 | - if ( $mt == null && $mt_md == null ) { |
|
1722 | - $classes[] = 'mt-' . sanitize_html_class( $args['mt_lg'] ); |
|
1720 | + if (isset($args['mt_lg']) && $args['mt_lg'] !== '') { |
|
1721 | + if ($mt == null && $mt_md == null) { |
|
1722 | + $classes[] = 'mt-' . sanitize_html_class($args['mt_lg']); |
|
1723 | 1723 | } else { |
1724 | - $classes[] = 'mt-lg-' . sanitize_html_class( $args['mt_lg'] ); |
|
1724 | + $classes[] = 'mt-lg-' . sanitize_html_class($args['mt_lg']); |
|
1725 | 1725 | } |
1726 | 1726 | } |
1727 | - if ( isset( $args['mr_lg'] ) && $args['mr_lg'] !== '' ) { |
|
1728 | - if ( $mr == null && $mr_md == null ) { |
|
1729 | - $classes[] = 'mr-' . sanitize_html_class( $args['mr_lg'] ); |
|
1727 | + if (isset($args['mr_lg']) && $args['mr_lg'] !== '') { |
|
1728 | + if ($mr == null && $mr_md == null) { |
|
1729 | + $classes[] = 'mr-' . sanitize_html_class($args['mr_lg']); |
|
1730 | 1730 | } else { |
1731 | - $classes[] = 'mr-lg-' . sanitize_html_class( $args['mr_lg'] ); |
|
1731 | + $classes[] = 'mr-lg-' . sanitize_html_class($args['mr_lg']); |
|
1732 | 1732 | } |
1733 | 1733 | } |
1734 | - if ( isset( $args['mb_lg'] ) && $args['mb_lg'] !== '' ) { |
|
1735 | - if ( $mb == null && $mb_md == null ) { |
|
1736 | - $classes[] = 'mb-' . sanitize_html_class( $args['mb_lg'] ); |
|
1734 | + if (isset($args['mb_lg']) && $args['mb_lg'] !== '') { |
|
1735 | + if ($mb == null && $mb_md == null) { |
|
1736 | + $classes[] = 'mb-' . sanitize_html_class($args['mb_lg']); |
|
1737 | 1737 | } else { |
1738 | - $classes[] = 'mb-lg-' . sanitize_html_class( $args['mb_lg'] ); |
|
1738 | + $classes[] = 'mb-lg-' . sanitize_html_class($args['mb_lg']); |
|
1739 | 1739 | } |
1740 | 1740 | } |
1741 | - if ( isset( $args['ml_lg'] ) && $args['ml_lg'] !== '' ) { |
|
1742 | - if ( $ml == null && $ml_md == null ) { |
|
1743 | - $classes[] = 'ml-' . sanitize_html_class( $args['ml_lg'] ); |
|
1741 | + if (isset($args['ml_lg']) && $args['ml_lg'] !== '') { |
|
1742 | + if ($ml == null && $ml_md == null) { |
|
1743 | + $classes[] = 'ml-' . sanitize_html_class($args['ml_lg']); |
|
1744 | 1744 | } else { |
1745 | - $classes[] = 'ml-lg-' . sanitize_html_class( $args['ml_lg'] ); |
|
1745 | + $classes[] = 'ml-lg-' . sanitize_html_class($args['ml_lg']); |
|
1746 | 1746 | } |
1747 | 1747 | } |
1748 | 1748 | |
1749 | 1749 | // padding. |
1750 | - if ( isset( $args['pt'] ) && $args['pt'] !== '' ) { |
|
1751 | - $classes[] = 'pt-' . sanitize_html_class( $args['pt'] ); |
|
1750 | + if (isset($args['pt']) && $args['pt'] !== '') { |
|
1751 | + $classes[] = 'pt-' . sanitize_html_class($args['pt']); |
|
1752 | 1752 | $pt = $args['pt']; |
1753 | 1753 | } else { |
1754 | 1754 | $pt = null; |
1755 | 1755 | } |
1756 | - if ( isset( $args['pr'] ) && $args['pr'] !== '' ) { |
|
1757 | - $classes[] = 'pr-' . sanitize_html_class( $args['pr'] ); |
|
1756 | + if (isset($args['pr']) && $args['pr'] !== '') { |
|
1757 | + $classes[] = 'pr-' . sanitize_html_class($args['pr']); |
|
1758 | 1758 | $pr = $args['pr']; |
1759 | 1759 | } else { |
1760 | 1760 | $pr = null; |
1761 | 1761 | } |
1762 | - if ( isset( $args['pb'] ) && $args['pb'] !== '' ) { |
|
1763 | - $classes[] = 'pb-' . sanitize_html_class( $args['pb'] ); |
|
1762 | + if (isset($args['pb']) && $args['pb'] !== '') { |
|
1763 | + $classes[] = 'pb-' . sanitize_html_class($args['pb']); |
|
1764 | 1764 | $pb = $args['pb']; |
1765 | 1765 | } else { |
1766 | 1766 | $pb = null; |
1767 | 1767 | } |
1768 | - if ( isset( $args['pl'] ) && $args['pl'] !== '' ) { |
|
1769 | - $classes[] = 'pl-' . sanitize_html_class( $args['pl'] ); |
|
1768 | + if (isset($args['pl']) && $args['pl'] !== '') { |
|
1769 | + $classes[] = 'pl-' . sanitize_html_class($args['pl']); |
|
1770 | 1770 | $pl = $args['pl']; |
1771 | 1771 | } else { |
1772 | 1772 | $pl = null; |
1773 | 1773 | } |
1774 | 1774 | |
1775 | 1775 | // padding tablet. |
1776 | - if ( isset( $args['pt_md'] ) && $args['pt_md'] !== '' ) { |
|
1777 | - $classes[] = 'pt-md-' . sanitize_html_class( $args['pt_md'] ); |
|
1776 | + if (isset($args['pt_md']) && $args['pt_md'] !== '') { |
|
1777 | + $classes[] = 'pt-md-' . sanitize_html_class($args['pt_md']); |
|
1778 | 1778 | $pt_md = $args['pt_md']; |
1779 | 1779 | } else { |
1780 | 1780 | $pt_md = null; |
1781 | 1781 | } |
1782 | - if ( isset( $args['pr_md'] ) && $args['pr_md'] !== '' ) { |
|
1783 | - $classes[] = 'pr-md-' . sanitize_html_class( $args['pr_md'] ); |
|
1782 | + if (isset($args['pr_md']) && $args['pr_md'] !== '') { |
|
1783 | + $classes[] = 'pr-md-' . sanitize_html_class($args['pr_md']); |
|
1784 | 1784 | $pt_md = $args['pr_md']; |
1785 | 1785 | } else { |
1786 | 1786 | $pr_md = null; |
1787 | 1787 | } |
1788 | - if ( isset( $args['pb_md'] ) && $args['pb_md'] !== '' ) { |
|
1789 | - $classes[] = 'pb-md-' . sanitize_html_class( $args['pb_md'] ); |
|
1788 | + if (isset($args['pb_md']) && $args['pb_md'] !== '') { |
|
1789 | + $classes[] = 'pb-md-' . sanitize_html_class($args['pb_md']); |
|
1790 | 1790 | $pt_md = $args['pb_md']; |
1791 | 1791 | } else { |
1792 | 1792 | $pb_md = null; |
1793 | 1793 | } |
1794 | - if ( isset( $args['pl_md'] ) && $args['pl_md'] !== '' ) { |
|
1795 | - $classes[] = 'pl-md-' . sanitize_html_class( $args['pl_md'] ); |
|
1794 | + if (isset($args['pl_md']) && $args['pl_md'] !== '') { |
|
1795 | + $classes[] = 'pl-md-' . sanitize_html_class($args['pl_md']); |
|
1796 | 1796 | $pt_md = $args['pl_md']; |
1797 | 1797 | } else { |
1798 | 1798 | $pl_md = null; |
1799 | 1799 | } |
1800 | 1800 | |
1801 | 1801 | // padding desktop. |
1802 | - if ( isset( $args['pt_lg'] ) && $args['pt_lg'] !== '' ) { |
|
1803 | - if ( $pt == null && $pt_md == null ) { |
|
1804 | - $classes[] = 'pt-' . sanitize_html_class( $args['pt_lg'] ); |
|
1802 | + if (isset($args['pt_lg']) && $args['pt_lg'] !== '') { |
|
1803 | + if ($pt == null && $pt_md == null) { |
|
1804 | + $classes[] = 'pt-' . sanitize_html_class($args['pt_lg']); |
|
1805 | 1805 | } else { |
1806 | - $classes[] = 'pt-lg-' . sanitize_html_class( $args['pt_lg'] ); |
|
1806 | + $classes[] = 'pt-lg-' . sanitize_html_class($args['pt_lg']); |
|
1807 | 1807 | } |
1808 | 1808 | } |
1809 | - if ( isset( $args['pr_lg'] ) && $args['pr_lg'] !== '' ) { |
|
1810 | - if ( $pr == null && $pr_md == null ) { |
|
1811 | - $classes[] = 'pr-' . sanitize_html_class( $args['pr_lg'] ); |
|
1809 | + if (isset($args['pr_lg']) && $args['pr_lg'] !== '') { |
|
1810 | + if ($pr == null && $pr_md == null) { |
|
1811 | + $classes[] = 'pr-' . sanitize_html_class($args['pr_lg']); |
|
1812 | 1812 | } else { |
1813 | - $classes[] = 'pr-lg-' . sanitize_html_class( $args['pr_lg'] ); |
|
1813 | + $classes[] = 'pr-lg-' . sanitize_html_class($args['pr_lg']); |
|
1814 | 1814 | } |
1815 | 1815 | } |
1816 | - if ( isset( $args['pb_lg'] ) && $args['pb_lg'] !== '' ) { |
|
1817 | - if ( $pb == null && $pb_md == null ) { |
|
1818 | - $classes[] = 'pb-' . sanitize_html_class( $args['pb_lg'] ); |
|
1816 | + if (isset($args['pb_lg']) && $args['pb_lg'] !== '') { |
|
1817 | + if ($pb == null && $pb_md == null) { |
|
1818 | + $classes[] = 'pb-' . sanitize_html_class($args['pb_lg']); |
|
1819 | 1819 | } else { |
1820 | - $classes[] = 'pb-lg-' . sanitize_html_class( $args['pb_lg'] ); |
|
1820 | + $classes[] = 'pb-lg-' . sanitize_html_class($args['pb_lg']); |
|
1821 | 1821 | } |
1822 | 1822 | } |
1823 | - if ( isset( $args['pl_lg'] ) && $args['pl_lg'] !== '' ) { |
|
1824 | - if ( $pl == null && $pl_md == null ) { |
|
1825 | - $classes[] = 'pl-' . sanitize_html_class( $args['pl_lg'] ); |
|
1823 | + if (isset($args['pl_lg']) && $args['pl_lg'] !== '') { |
|
1824 | + if ($pl == null && $pl_md == null) { |
|
1825 | + $classes[] = 'pl-' . sanitize_html_class($args['pl_lg']); |
|
1826 | 1826 | } else { |
1827 | - $classes[] = 'pl-lg-' . sanitize_html_class( $args['pl_lg'] ); |
|
1827 | + $classes[] = 'pl-lg-' . sanitize_html_class($args['pl_lg']); |
|
1828 | 1828 | } |
1829 | 1829 | } |
1830 | 1830 | |
1831 | 1831 | // row cols, mobile, tablet, desktop |
1832 | - if ( ! empty( $args['row_cols'] ) && $args['row_cols'] !== '' ) { |
|
1833 | - $classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols'] ); |
|
1832 | + if (!empty($args['row_cols']) && $args['row_cols'] !== '') { |
|
1833 | + $classes[] = sanitize_html_class('row-cols-' . $args['row_cols']); |
|
1834 | 1834 | $row_cols = $args['row_cols']; |
1835 | 1835 | } else { |
1836 | 1836 | $row_cols = null; |
1837 | 1837 | } |
1838 | - if ( ! empty( $args['row_cols_md'] ) && $args['row_cols_md'] !== '' ) { |
|
1839 | - $classes[] = sanitize_html_class( 'row-cols-md-' . $args['row_cols_md'] ); |
|
1838 | + if (!empty($args['row_cols_md']) && $args['row_cols_md'] !== '') { |
|
1839 | + $classes[] = sanitize_html_class('row-cols-md-' . $args['row_cols_md']); |
|
1840 | 1840 | $row_cols_md = $args['row_cols_md']; |
1841 | 1841 | } else { |
1842 | 1842 | $row_cols_md = null; |
1843 | 1843 | } |
1844 | - if ( ! empty( $args['row_cols_lg'] ) && $args['row_cols_lg'] !== '' ) { |
|
1845 | - if ( $row_cols == null && $row_cols_md == null ) { |
|
1846 | - $classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols_lg'] ); |
|
1844 | + if (!empty($args['row_cols_lg']) && $args['row_cols_lg'] !== '') { |
|
1845 | + if ($row_cols == null && $row_cols_md == null) { |
|
1846 | + $classes[] = sanitize_html_class('row-cols-' . $args['row_cols_lg']); |
|
1847 | 1847 | } else { |
1848 | - $classes[] = sanitize_html_class( 'row-cols-lg-' . $args['row_cols_lg'] ); |
|
1848 | + $classes[] = sanitize_html_class('row-cols-lg-' . $args['row_cols_lg']); |
|
1849 | 1849 | } |
1850 | 1850 | } |
1851 | 1851 | |
1852 | 1852 | // columns , mobile, tablet, desktop |
1853 | - if ( ! empty( $args['col'] ) && $args['col'] !== '' ) { |
|
1854 | - $classes[] = sanitize_html_class( 'col-' . $args['col'] ); |
|
1853 | + if (!empty($args['col']) && $args['col'] !== '') { |
|
1854 | + $classes[] = sanitize_html_class('col-' . $args['col']); |
|
1855 | 1855 | $col = $args['col']; |
1856 | 1856 | } else { |
1857 | 1857 | $col = null; |
1858 | 1858 | } |
1859 | - if ( ! empty( $args['col_md'] ) && $args['col_md'] !== '' ) { |
|
1860 | - $classes[] = sanitize_html_class( 'col-md-' . $args['col_md'] ); |
|
1859 | + if (!empty($args['col_md']) && $args['col_md'] !== '') { |
|
1860 | + $classes[] = sanitize_html_class('col-md-' . $args['col_md']); |
|
1861 | 1861 | $col_md = $args['col_md']; |
1862 | 1862 | } else { |
1863 | 1863 | $col_md = null; |
1864 | 1864 | } |
1865 | - if ( ! empty( $args['col_lg'] ) && $args['col_lg'] !== '' ) { |
|
1866 | - if ( $col == null && $col_md == null ) { |
|
1867 | - $classes[] = sanitize_html_class( 'col-' . $args['col_lg'] ); |
|
1865 | + if (!empty($args['col_lg']) && $args['col_lg'] !== '') { |
|
1866 | + if ($col == null && $col_md == null) { |
|
1867 | + $classes[] = sanitize_html_class('col-' . $args['col_lg']); |
|
1868 | 1868 | } else { |
1869 | - $classes[] = sanitize_html_class( 'col-lg-' . $args['col_lg'] ); |
|
1869 | + $classes[] = sanitize_html_class('col-lg-' . $args['col_lg']); |
|
1870 | 1870 | } |
1871 | 1871 | } |
1872 | 1872 | |
1873 | 1873 | // border |
1874 | - if ( ! empty( $args['border'] ) && ( $args['border'] == 'none' || $args['border'] === '0' ) ) { |
|
1874 | + if (!empty($args['border']) && ($args['border'] == 'none' || $args['border'] === '0')) { |
|
1875 | 1875 | $classes[] = 'border-0'; |
1876 | - } elseif ( ! empty( $args['border'] ) ) { |
|
1877 | - $classes[] = 'border border-' . sanitize_html_class( $args['border'] ); |
|
1876 | + } elseif (!empty($args['border'])) { |
|
1877 | + $classes[] = 'border border-' . sanitize_html_class($args['border']); |
|
1878 | 1878 | } |
1879 | 1879 | |
1880 | 1880 | // border radius type |
1881 | - if ( ! empty( $args['rounded'] ) ) { |
|
1882 | - $classes[] = sanitize_html_class( $args['rounded'] ); |
|
1881 | + if (!empty($args['rounded'])) { |
|
1882 | + $classes[] = sanitize_html_class($args['rounded']); |
|
1883 | 1883 | } |
1884 | 1884 | |
1885 | 1885 | // border radius size |
1886 | - if ( ! empty( $args['rounded_size'] ) ) { |
|
1887 | - $classes[] = 'rounded-' . sanitize_html_class( $args['rounded_size'] ); |
|
1886 | + if (!empty($args['rounded_size'])) { |
|
1887 | + $classes[] = 'rounded-' . sanitize_html_class($args['rounded_size']); |
|
1888 | 1888 | // if we set a size then we need to remove "rounded" if set |
1889 | - if ( ( $key = array_search( 'rounded', $classes ) ) !== false ) { |
|
1890 | - unset( $classes[ $key ] ); |
|
1889 | + if (($key = array_search('rounded', $classes)) !== false) { |
|
1890 | + unset($classes[$key]); |
|
1891 | 1891 | } |
1892 | 1892 | } |
1893 | 1893 | |
@@ -1895,112 +1895,112 @@ discard block |
||
1895 | 1895 | //if ( !empty( $args['shadow'] ) ) { $classes[] = sanitize_html_class($args['shadow']); } |
1896 | 1896 | |
1897 | 1897 | // background |
1898 | - if ( ! empty( $args['bg'] ) ) { |
|
1899 | - $classes[] = 'bg-' . sanitize_html_class( $args['bg'] ); |
|
1898 | + if (!empty($args['bg'])) { |
|
1899 | + $classes[] = 'bg-' . sanitize_html_class($args['bg']); |
|
1900 | 1900 | } |
1901 | 1901 | |
1902 | 1902 | // text_color |
1903 | - if ( ! empty( $args['text_color'] ) ) { |
|
1904 | - $classes[] = 'text-' . sanitize_html_class( $args['text_color'] ); |
|
1903 | + if (!empty($args['text_color'])) { |
|
1904 | + $classes[] = 'text-' . sanitize_html_class($args['text_color']); |
|
1905 | 1905 | } |
1906 | 1906 | |
1907 | 1907 | // text_align |
1908 | - if ( ! empty( $args['text_justify'] ) ) { |
|
1908 | + if (!empty($args['text_justify'])) { |
|
1909 | 1909 | $classes[] = 'text-justify'; |
1910 | 1910 | } else { |
1911 | - if ( ! empty( $args['text_align'] ) ) { |
|
1912 | - $classes[] = sanitize_html_class( $args['text_align'] ); |
|
1911 | + if (!empty($args['text_align'])) { |
|
1912 | + $classes[] = sanitize_html_class($args['text_align']); |
|
1913 | 1913 | $text_align = $args['text_align']; |
1914 | 1914 | } else { |
1915 | 1915 | $text_align = null; |
1916 | 1916 | } |
1917 | - if ( ! empty( $args['text_align_md'] ) && $args['text_align_md'] !== '' ) { |
|
1918 | - $classes[] = sanitize_html_class( $args['text_align_md'] ); |
|
1917 | + if (!empty($args['text_align_md']) && $args['text_align_md'] !== '') { |
|
1918 | + $classes[] = sanitize_html_class($args['text_align_md']); |
|
1919 | 1919 | $text_align_md = $args['text_align_md']; |
1920 | 1920 | } else { |
1921 | 1921 | $text_align_md = null; |
1922 | 1922 | } |
1923 | - if ( ! empty( $args['text_align_lg'] ) && $args['text_align_lg'] !== '' ) { |
|
1924 | - if ( $text_align == null && $text_align_md == null ) { |
|
1925 | - $classes[] = sanitize_html_class( str_replace( '-lg', '', $args['text_align_lg'] ) ); |
|
1923 | + if (!empty($args['text_align_lg']) && $args['text_align_lg'] !== '') { |
|
1924 | + if ($text_align == null && $text_align_md == null) { |
|
1925 | + $classes[] = sanitize_html_class(str_replace('-lg', '', $args['text_align_lg'])); |
|
1926 | 1926 | } else { |
1927 | - $classes[] = sanitize_html_class( $args['text_align_lg'] ); |
|
1927 | + $classes[] = sanitize_html_class($args['text_align_lg']); |
|
1928 | 1928 | } |
1929 | 1929 | } |
1930 | 1930 | } |
1931 | 1931 | |
1932 | 1932 | // display |
1933 | - if ( ! empty( $args['display'] ) ) { |
|
1934 | - $classes[] = sanitize_html_class( $args['display'] ); |
|
1933 | + if (!empty($args['display'])) { |
|
1934 | + $classes[] = sanitize_html_class($args['display']); |
|
1935 | 1935 | $display = $args['display']; |
1936 | 1936 | } else { |
1937 | 1937 | $display = null; |
1938 | 1938 | } |
1939 | - if ( ! empty( $args['display_md'] ) && $args['display_md'] !== '' ) { |
|
1940 | - $classes[] = sanitize_html_class( $args['display_md'] ); |
|
1939 | + if (!empty($args['display_md']) && $args['display_md'] !== '') { |
|
1940 | + $classes[] = sanitize_html_class($args['display_md']); |
|
1941 | 1941 | $display_md = $args['display_md']; |
1942 | 1942 | } else { |
1943 | 1943 | $display_md = null; |
1944 | 1944 | } |
1945 | - if ( ! empty( $args['display_lg'] ) && $args['display_lg'] !== '' ) { |
|
1946 | - if ( $display == null && $display_md == null ) { |
|
1947 | - $classes[] = sanitize_html_class( str_replace( '-lg', '', $args['display_lg'] ) ); |
|
1945 | + if (!empty($args['display_lg']) && $args['display_lg'] !== '') { |
|
1946 | + if ($display == null && $display_md == null) { |
|
1947 | + $classes[] = sanitize_html_class(str_replace('-lg', '', $args['display_lg'])); |
|
1948 | 1948 | } else { |
1949 | - $classes[] = sanitize_html_class( $args['display_lg'] ); |
|
1949 | + $classes[] = sanitize_html_class($args['display_lg']); |
|
1950 | 1950 | } |
1951 | 1951 | } |
1952 | 1952 | |
1953 | 1953 | // bgtus - background transparent until scroll |
1954 | - if ( ! empty( $args['bgtus'] ) ) { |
|
1955 | - $classes[] = sanitize_html_class( 'bg-transparent-until-scroll' ); |
|
1954 | + if (!empty($args['bgtus'])) { |
|
1955 | + $classes[] = sanitize_html_class('bg-transparent-until-scroll'); |
|
1956 | 1956 | } |
1957 | 1957 | |
1958 | 1958 | // hover animations |
1959 | - if ( ! empty( $args['hover_animations'] ) ) { |
|
1960 | - $classes[] = sd_sanitize_html_classes( str_replace( ',', ' ', $args['hover_animations'] ) ); |
|
1959 | + if (!empty($args['hover_animations'])) { |
|
1960 | + $classes[] = sd_sanitize_html_classes(str_replace(',', ' ', $args['hover_animations'])); |
|
1961 | 1961 | } |
1962 | 1962 | |
1963 | 1963 | // build classes from build keys |
1964 | 1964 | $build_keys = sd_get_class_build_keys(); |
1965 | - if ( ! empty( $build_keys ) ) { |
|
1966 | - foreach ( $build_keys as $key ) { |
|
1965 | + if (!empty($build_keys)) { |
|
1966 | + foreach ($build_keys as $key) { |
|
1967 | 1967 | |
1968 | - if ( substr( $key, -4 ) == '-MTD' ) { |
|
1968 | + if (substr($key, -4) == '-MTD') { |
|
1969 | 1969 | |
1970 | - $k = str_replace( '_MTD', '', $key ); |
|
1970 | + $k = str_replace('_MTD', '', $key); |
|
1971 | 1971 | |
1972 | 1972 | // Mobile, Tablet, Desktop |
1973 | - if ( ! empty( $args[ $k ] ) && $args[ $k ] !== '' ) { |
|
1974 | - $classes[] = sanitize_html_class( $args[ $k ] ); |
|
1975 | - $v = $args[ $k ]; |
|
1973 | + if (!empty($args[$k]) && $args[$k] !== '') { |
|
1974 | + $classes[] = sanitize_html_class($args[$k]); |
|
1975 | + $v = $args[$k]; |
|
1976 | 1976 | } else { |
1977 | 1977 | $v = null; |
1978 | 1978 | } |
1979 | - if ( ! empty( $args[ $k . '_md' ] ) && $args[ $k . '_md' ] !== '' ) { |
|
1980 | - $classes[] = sanitize_html_class( $args[ $k . '_md' ] ); |
|
1981 | - $v_md = $args[ $k . '_md' ]; |
|
1979 | + if (!empty($args[$k . '_md']) && $args[$k . '_md'] !== '') { |
|
1980 | + $classes[] = sanitize_html_class($args[$k . '_md']); |
|
1981 | + $v_md = $args[$k . '_md']; |
|
1982 | 1982 | } else { |
1983 | 1983 | $v_md = null; |
1984 | 1984 | } |
1985 | - if ( ! empty( $args[ $k . '_lg' ] ) && $args[ $k . '_lg' ] !== '' ) { |
|
1986 | - if ( $v == null && $v_md == null ) { |
|
1987 | - $classes[] = sanitize_html_class( str_replace( '-lg', '', $args[ $k . '_lg' ] ) ); |
|
1985 | + if (!empty($args[$k . '_lg']) && $args[$k . '_lg'] !== '') { |
|
1986 | + if ($v == null && $v_md == null) { |
|
1987 | + $classes[] = sanitize_html_class(str_replace('-lg', '', $args[$k . '_lg'])); |
|
1988 | 1988 | } else { |
1989 | - $classes[] = sanitize_html_class( $args[ $k . '_lg' ] ); |
|
1989 | + $classes[] = sanitize_html_class($args[$k . '_lg']); |
|
1990 | 1990 | } |
1991 | 1991 | } |
1992 | 1992 | } else { |
1993 | - if ( $key == 'font_size' && ! empty( $args[ $key ] ) && $args[ $key ] == 'custom' ) { |
|
1993 | + if ($key == 'font_size' && !empty($args[$key]) && $args[$key] == 'custom') { |
|
1994 | 1994 | continue; |
1995 | 1995 | } |
1996 | - if ( ! empty( $args[ $key ] ) ) { |
|
1997 | - $classes[] = sd_sanitize_html_classes( $args[ $key ] ); |
|
1996 | + if (!empty($args[$key])) { |
|
1997 | + $classes[] = sd_sanitize_html_classes($args[$key]); |
|
1998 | 1998 | } |
1999 | 1999 | } |
2000 | 2000 | } |
2001 | 2001 | } |
2002 | 2002 | |
2003 | - return implode( ' ', $classes ); |
|
2003 | + return implode(' ', $classes); |
|
2004 | 2004 | } |
2005 | 2005 | |
2006 | 2006 | /** |
@@ -2010,19 +2010,19 @@ discard block |
||
2010 | 2010 | * |
2011 | 2011 | * @return array |
2012 | 2012 | */ |
2013 | -function sd_build_aui_styles( $args ) { |
|
2013 | +function sd_build_aui_styles($args) { |
|
2014 | 2014 | |
2015 | 2015 | $styles = array(); |
2016 | 2016 | |
2017 | 2017 | // background color |
2018 | - if ( ! empty( $args['bg'] ) && $args['bg'] !== '' ) { |
|
2019 | - if ( $args['bg'] == 'custom-color' ) { |
|
2018 | + if (!empty($args['bg']) && $args['bg'] !== '') { |
|
2019 | + if ($args['bg'] == 'custom-color') { |
|
2020 | 2020 | $styles['background-color'] = $args['bg_color']; |
2021 | - } elseif ( $args['bg'] == 'custom-gradient' ) { |
|
2021 | + } elseif ($args['bg'] == 'custom-gradient') { |
|
2022 | 2022 | $styles['background-image'] = $args['bg_gradient']; |
2023 | 2023 | |
2024 | 2024 | // use background on text. |
2025 | - if ( ! empty( $args['bg_on_text'] ) && $args['bg_on_text'] ) { |
|
2025 | + if (!empty($args['bg_on_text']) && $args['bg_on_text']) { |
|
2026 | 2026 | $styles['background-clip'] = 'text'; |
2027 | 2027 | $styles['-webkit-background-clip'] = 'text'; |
2028 | 2028 | $styles['text-fill-color'] = 'transparent'; |
@@ -2031,62 +2031,62 @@ discard block |
||
2031 | 2031 | } |
2032 | 2032 | } |
2033 | 2033 | |
2034 | - if ( ! empty( $args['bg_image'] ) && $args['bg_image'] !== '' ) { |
|
2034 | + if (!empty($args['bg_image']) && $args['bg_image'] !== '') { |
|
2035 | 2035 | $hasImage = true; |
2036 | - if ( ! empty( $styles['background-color'] ) && $args['bg'] == 'custom-color' ) { |
|
2036 | + if (!empty($styles['background-color']) && $args['bg'] == 'custom-color') { |
|
2037 | 2037 | $styles['background-image'] = 'url(' . $args['bg_image'] . ')'; |
2038 | 2038 | $styles['background-blend-mode'] = 'overlay'; |
2039 | - } elseif ( ! empty( $styles['background-image'] ) && $args['bg'] == 'custom-gradient' ) { |
|
2039 | + } elseif (!empty($styles['background-image']) && $args['bg'] == 'custom-gradient') { |
|
2040 | 2040 | $styles['background-image'] .= ',url(' . $args['bg_image'] . ')'; |
2041 | - } elseif ( ! empty( $args['bg'] ) && $args['bg'] != '' && $args['bg'] != 'transparent' ) { |
|
2041 | + } elseif (!empty($args['bg']) && $args['bg'] != '' && $args['bg'] != 'transparent') { |
|
2042 | 2042 | // do nothing as we alreay have a preset |
2043 | 2043 | $hasImage = false; |
2044 | 2044 | } else { |
2045 | 2045 | $styles['background-image'] = 'url(' . $args['bg_image'] . ')'; |
2046 | 2046 | } |
2047 | 2047 | |
2048 | - if ( $hasImage ) { |
|
2048 | + if ($hasImage) { |
|
2049 | 2049 | $styles['background-size'] = 'cover'; |
2050 | 2050 | |
2051 | - if ( ! empty( $args['bg_image_fixed'] ) && $args['bg_image_fixed'] ) { |
|
2051 | + if (!empty($args['bg_image_fixed']) && $args['bg_image_fixed']) { |
|
2052 | 2052 | $styles['background-attachment'] = 'fixed'; |
2053 | 2053 | } |
2054 | 2054 | } |
2055 | 2055 | |
2056 | - if ( $hasImage && ! empty( $args['bg_image_xy'] ) && ! empty( $args['bg_image_xy']['x'] ) ) { |
|
2057 | - $styles['background-position'] = ( $args['bg_image_xy']['x'] * 100 ) . '% ' . ( $args['bg_image_xy']['y'] * 100 ) . '%'; |
|
2056 | + if ($hasImage && !empty($args['bg_image_xy']) && !empty($args['bg_image_xy']['x'])) { |
|
2057 | + $styles['background-position'] = ($args['bg_image_xy']['x'] * 100) . '% ' . ($args['bg_image_xy']['y'] * 100) . '%'; |
|
2058 | 2058 | } |
2059 | 2059 | } |
2060 | 2060 | |
2061 | 2061 | // sticky offset top |
2062 | - if ( ! empty( $args['sticky_offset_top'] ) && $args['sticky_offset_top'] !== '' ) { |
|
2063 | - $styles['top'] = absint( $args['sticky_offset_top'] ); |
|
2062 | + if (!empty($args['sticky_offset_top']) && $args['sticky_offset_top'] !== '') { |
|
2063 | + $styles['top'] = absint($args['sticky_offset_top']); |
|
2064 | 2064 | } |
2065 | 2065 | |
2066 | 2066 | // sticky offset bottom |
2067 | - if ( ! empty( $args['sticky_offset_bottom'] ) && $args['sticky_offset_bottom'] !== '' ) { |
|
2068 | - $styles['bottom'] = absint( $args['sticky_offset_bottom'] ); |
|
2067 | + if (!empty($args['sticky_offset_bottom']) && $args['sticky_offset_bottom'] !== '') { |
|
2068 | + $styles['bottom'] = absint($args['sticky_offset_bottom']); |
|
2069 | 2069 | } |
2070 | 2070 | |
2071 | 2071 | // font size |
2072 | - if ( ! empty( $args['font_size_custom'] ) && $args['font_size_custom'] !== '' ) { |
|
2072 | + if (!empty($args['font_size_custom']) && $args['font_size_custom'] !== '') { |
|
2073 | 2073 | $styles['font-size'] = (float) $args['font_size_custom'] . 'rem'; |
2074 | 2074 | } |
2075 | 2075 | |
2076 | 2076 | // font color |
2077 | - if ( ! empty( $args['text_color_custom'] ) && $args['text_color_custom'] !== '' ) { |
|
2078 | - $styles['color'] = esc_attr( $args['text_color_custom'] ); |
|
2077 | + if (!empty($args['text_color_custom']) && $args['text_color_custom'] !== '') { |
|
2078 | + $styles['color'] = esc_attr($args['text_color_custom']); |
|
2079 | 2079 | } |
2080 | 2080 | |
2081 | 2081 | // font line height |
2082 | - if ( ! empty( $args['font_line_height'] ) && $args['font_line_height'] !== '' ) { |
|
2083 | - $styles['line-height'] = esc_attr( $args['font_line_height'] ); |
|
2082 | + if (!empty($args['font_line_height']) && $args['font_line_height'] !== '') { |
|
2083 | + $styles['line-height'] = esc_attr($args['font_line_height']); |
|
2084 | 2084 | } |
2085 | 2085 | |
2086 | 2086 | $style_string = ''; |
2087 | - if ( ! empty( $styles ) ) { |
|
2088 | - foreach ( $styles as $key => $val ) { |
|
2089 | - $style_string .= esc_attr( $key ) . ':' . esc_attr( $val ) . ';'; |
|
2087 | + if (!empty($styles)) { |
|
2088 | + foreach ($styles as $key => $val) { |
|
2089 | + $style_string .= esc_attr($key) . ':' . esc_attr($val) . ';'; |
|
2090 | 2090 | } |
2091 | 2091 | } |
2092 | 2092 | |
@@ -2102,16 +2102,16 @@ discard block |
||
2102 | 2102 | * |
2103 | 2103 | * @return string |
2104 | 2104 | */ |
2105 | -function sd_sanitize_html_classes( $classes, $sep = ' ' ) { |
|
2105 | +function sd_sanitize_html_classes($classes, $sep = ' ') { |
|
2106 | 2106 | $return = ''; |
2107 | 2107 | |
2108 | - if ( ! is_array( $classes ) ) { |
|
2109 | - $classes = explode( $sep, $classes ); |
|
2108 | + if (!is_array($classes)) { |
|
2109 | + $classes = explode($sep, $classes); |
|
2110 | 2110 | } |
2111 | 2111 | |
2112 | - if ( ! empty( $classes ) ) { |
|
2113 | - foreach ( $classes as $class ) { |
|
2114 | - $return .= sanitize_html_class( $class ) . ' '; |
|
2112 | + if (!empty($classes)) { |
|
2113 | + foreach ($classes as $class) { |
|
2114 | + $return .= sanitize_html_class($class) . ' '; |
|
2115 | 2115 | } |
2116 | 2116 | } |
2117 | 2117 | |
@@ -2146,5 +2146,5 @@ discard block |
||
2146 | 2146 | 'styleid', |
2147 | 2147 | ); |
2148 | 2148 | |
2149 | - return apply_filters( 'sd_class_build_keys', $keys ); |
|
2149 | + return apply_filters('sd_class_build_keys', $keys); |
|
2150 | 2150 | } |
@@ -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.10' ); |
|
8 | + define('SUPER_DUPER_VER', '1.1.10'); |
|
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,60 +80,60 @@ 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 admin head |
133 | - add_action( 'admin_head', array( $this, 'generator' ) ); |
|
133 | + add_action('admin_head', array($this, 'generator')); |
|
134 | 134 | } |
135 | 135 | |
136 | - do_action( 'wp_super_duper_widget_init', $options, $this ); |
|
136 | + do_action('wp_super_duper_widget_init', $options, $this); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @return void |
142 | 142 | */ |
143 | 143 | public function _register() { |
144 | - if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){ |
|
144 | + if (empty($this->options['output_types']) || in_array('widget', $this->options['output_types'])) { |
|
145 | 145 | parent::_register(); |
146 | 146 | } |
147 | 147 | } |
@@ -150,14 +150,14 @@ discard block |
||
150 | 150 | * Add our widget CSS to elementor editor. |
151 | 151 | */ |
152 | 152 | public function elementor_editor_styles() { |
153 | - wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) ); |
|
153 | + wp_add_inline_style('elementor-editor', $this->widget_css(false)); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | public function register_fusion_element() { |
157 | 157 | |
158 | 158 | $options = $this->options; |
159 | 159 | |
160 | - if ( $this->base_id ) { |
|
160 | + if ($this->base_id) { |
|
161 | 161 | |
162 | 162 | $params = $this->get_fusion_params(); |
163 | 163 | |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | 'allow_generator' => true, |
169 | 169 | ); |
170 | 170 | |
171 | - if ( ! empty( $params ) ) { |
|
171 | + if (!empty($params)) { |
|
172 | 172 | $args['params'] = $params; |
173 | 173 | } |
174 | 174 | |
175 | - fusion_builder_map( $args ); |
|
175 | + fusion_builder_map($args); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | } |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | $params = array(); |
182 | 182 | $arguments = $this->get_arguments(); |
183 | 183 | |
184 | - if ( ! empty( $arguments ) ) { |
|
185 | - foreach ( $arguments as $key => $val ) { |
|
184 | + if (!empty($arguments)) { |
|
185 | + foreach ($arguments as $key => $val) { |
|
186 | 186 | $param = array(); |
187 | 187 | // type |
188 | 188 | $param['type'] = str_replace( |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $val['type'] ); |
205 | 205 | |
206 | 206 | // multiselect |
207 | - if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) { |
|
207 | + if ($val['type'] == 'multiselect' || (($param['type'] == 'select' || $val['type'] == 'select') && !empty($val['multiple']))) { |
|
208 | 208 | $param['type'] = 'multiple_select'; |
209 | 209 | $param['multiple'] = true; |
210 | 210 | } |
@@ -213,29 +213,29 @@ discard block |
||
213 | 213 | $param['heading'] = $val['title']; |
214 | 214 | |
215 | 215 | // description |
216 | - $param['description'] = isset( $val['desc'] ) ? $val['desc'] : ''; |
|
216 | + $param['description'] = isset($val['desc']) ? $val['desc'] : ''; |
|
217 | 217 | |
218 | 218 | // param_name |
219 | 219 | $param['param_name'] = $key; |
220 | 220 | |
221 | 221 | // Default |
222 | - $param['default'] = isset( $val['default'] ) ? $val['default'] : ''; |
|
222 | + $param['default'] = isset($val['default']) ? $val['default'] : ''; |
|
223 | 223 | |
224 | 224 | // Group |
225 | - if ( isset( $val['group'] ) ) { |
|
225 | + if (isset($val['group'])) { |
|
226 | 226 | $param['group'] = $val['group']; |
227 | 227 | } |
228 | 228 | |
229 | 229 | // value |
230 | - if ( $val['type'] == 'checkbox' ) { |
|
231 | - if ( isset( $val['default'] ) && $val['default'] == '0' ) { |
|
232 | - unset( $param['default'] ); |
|
230 | + if ($val['type'] == 'checkbox') { |
|
231 | + if (isset($val['default']) && $val['default'] == '0') { |
|
232 | + unset($param['default']); |
|
233 | 233 | } |
234 | - $param['value'] = array( '' => __( "No" ), '1' => __( "Yes" ) ); |
|
235 | - } elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) { |
|
236 | - $param['value'] = isset( $val['options'] ) ? $val['options'] : array(); |
|
234 | + $param['value'] = array('' => __("No"), '1' => __("Yes")); |
|
235 | + } elseif ($param['type'] == 'select' || $param['type'] == 'multiple_select') { |
|
236 | + $param['value'] = isset($val['options']) ? $val['options'] : array(); |
|
237 | 237 | } else { |
238 | - $param['value'] = isset( $val['default'] ) ? $val['default'] : ''; |
|
238 | + $param['value'] = isset($val['default']) ? $val['default'] : ''; |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | // setup the param |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder |
253 | 253 | */ |
254 | 254 | public static function maybe_cornerstone_builder() { |
255 | - if ( did_action( 'cornerstone_before_boot_app' ) ) { |
|
255 | + if (did_action('cornerstone_before_boot_app')) { |
|
256 | 256 | self::shortcode_insert_button_script(); |
257 | 257 | } |
258 | 258 | } |
@@ -264,12 +264,12 @@ discard block |
||
264 | 264 | * |
265 | 265 | * @return string |
266 | 266 | */ |
267 | - public static function get_picker( $editor_id = '' ) { |
|
267 | + public static function get_picker($editor_id = '') { |
|
268 | 268 | |
269 | 269 | ob_start(); |
270 | - if ( isset( $_POST['editor_id'] ) ) { |
|
271 | - $editor_id = esc_attr( $_POST['editor_id'] ); |
|
272 | - } elseif ( isset( $_REQUEST['et_fb'] ) ) { |
|
270 | + if (isset($_POST['editor_id'])) { |
|
271 | + $editor_id = esc_attr($_POST['editor_id']); |
|
272 | + } elseif (isset($_REQUEST['et_fb'])) { |
|
273 | 273 | $editor_id = 'main_content_content_vb_tiny_mce'; |
274 | 274 | } |
275 | 275 | |
@@ -280,14 +280,14 @@ discard block |
||
280 | 280 | |
281 | 281 | <div class="sd-shortcode-left-wrap"> |
282 | 282 | <?php |
283 | - ksort( $sd_widgets ); |
|
283 | + ksort($sd_widgets); |
|
284 | 284 | // print_r($sd_widgets);exit; |
285 | - if ( ! empty( $sd_widgets ) ) { |
|
285 | + if (!empty($sd_widgets)) { |
|
286 | 286 | echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">'; |
287 | - echo "<option>" . __( 'Select shortcode' ) . "</option>"; |
|
288 | - foreach ( $sd_widgets as $shortcode => $class ) { |
|
289 | - if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; } |
|
290 | - echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>"; |
|
287 | + echo "<option>" . __('Select shortcode') . "</option>"; |
|
288 | + foreach ($sd_widgets as $shortcode => $class) { |
|
289 | + if (!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])) { continue; } |
|
290 | + echo "<option value='" . esc_attr($shortcode) . "'>" . esc_attr($shortcode) . " (" . esc_attr($class['name']) . ")</option>"; |
|
291 | 291 | } |
292 | 292 | echo "</select>"; |
293 | 293 | |
@@ -300,37 +300,37 @@ discard block |
||
300 | 300 | <div class="sd-shortcode-right-wrap"> |
301 | 301 | <textarea id='sd-shortcode-output' disabled></textarea> |
302 | 302 | <div id='sd-shortcode-output-actions'> |
303 | - <?php if ( $editor_id != '' ) { ?> |
|
303 | + <?php if ($editor_id != '') { ?> |
|
304 | 304 | <button class="button sd-insert-shortcode-button" |
305 | - onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) { |
|
305 | + onclick="sd_insert_shortcode(<?php if (!empty($editor_id)) { |
|
306 | 306 | echo "'" . $editor_id . "'"; |
307 | - } ?>)"><?php _e( 'Insert shortcode' ); ?></button> |
|
307 | + } ?>)"><?php _e('Insert shortcode'); ?></button> |
|
308 | 308 | <?php } ?> |
309 | 309 | <button class="button" |
310 | - onclick="sd_copy_to_clipboard()"><?php _e( 'Copy shortcode' ); ?></button> |
|
310 | + onclick="sd_copy_to_clipboard()"><?php _e('Copy shortcode'); ?></button> |
|
311 | 311 | </div> |
312 | 312 | </div> |
313 | 313 | <?php |
314 | 314 | |
315 | 315 | $html = ob_get_clean(); |
316 | 316 | |
317 | - if ( wp_doing_ajax() ) { |
|
317 | + if (wp_doing_ajax()) { |
|
318 | 318 | echo $html; |
319 | 319 | $should_die = true; |
320 | 320 | |
321 | 321 | // some builder get the editor via ajax so we should not die on those occasions |
322 | 322 | $dont_die = array( |
323 | - 'parent_tag',// WP Bakery |
|
323 | + 'parent_tag', // WP Bakery |
|
324 | 324 | 'avia_request' // enfold |
325 | 325 | ); |
326 | 326 | |
327 | - foreach ( $dont_die as $request ) { |
|
328 | - if ( isset( $_REQUEST[ $request ] ) ) { |
|
327 | + foreach ($dont_die as $request) { |
|
328 | + if (isset($_REQUEST[$request])) { |
|
329 | 329 | $should_die = false; |
330 | 330 | } |
331 | 331 | } |
332 | 332 | |
333 | - if ( $should_die ) { |
|
333 | + if ($should_die) { |
|
334 | 334 | wp_die(); |
335 | 335 | } |
336 | 336 | |
@@ -357,16 +357,16 @@ discard block |
||
357 | 357 | public static function get_widget_settings() { |
358 | 358 | global $sd_widgets; |
359 | 359 | |
360 | - $shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : ''; |
|
361 | - if ( ! $shortcode ) { |
|
360 | + $shortcode = isset($_REQUEST['shortcode']) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes($_REQUEST['shortcode']) : ''; |
|
361 | + if (!$shortcode) { |
|
362 | 362 | wp_die(); |
363 | 363 | } |
364 | - $widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : ''; |
|
365 | - if ( ! $widget_args ) { |
|
364 | + $widget_args = isset($sd_widgets[$shortcode]) ? $sd_widgets[$shortcode] : ''; |
|
365 | + if (!$widget_args) { |
|
366 | 366 | wp_die(); |
367 | 367 | } |
368 | - $class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : ''; |
|
369 | - if ( ! $class_name ) { |
|
368 | + $class_name = isset($widget_args['class_name']) && $widget_args['class_name'] ? $widget_args['class_name'] : ''; |
|
369 | + if (!$class_name) { |
|
370 | 370 | wp_die(); |
371 | 371 | } |
372 | 372 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | $widget = new $class_name; |
375 | 375 | |
376 | 376 | ob_start(); |
377 | - $widget->form( array() ); |
|
377 | + $widget->form(array()); |
|
378 | 378 | $form = ob_get_clean(); |
379 | 379 | echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>"; |
380 | 380 | echo "<style>" . $widget->widget_css() . "</style>"; |
@@ -393,9 +393,9 @@ discard block |
||
393 | 393 | *@since 1.0.0 |
394 | 394 | * |
395 | 395 | */ |
396 | - public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) { |
|
396 | + public static function shortcode_insert_button($editor_id = '', $insert_shortcode_function = '') { |
|
397 | 397 | global $sd_widgets, $shortcode_insert_button_once; |
398 | - if ( $shortcode_insert_button_once ) { |
|
398 | + if ($shortcode_insert_button_once) { |
|
399 | 399 | return; |
400 | 400 | } |
401 | 401 | add_thickbox(); |
@@ -405,21 +405,21 @@ discard block |
||
405 | 405 | * Cornerstone makes us play dirty tricks :/ |
406 | 406 | * All media_buttons are removed via JS unless they are two specific id's so we wrap our content in this ID so it is not removed. |
407 | 407 | */ |
408 | - if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) { |
|
408 | + if (function_exists('cornerstone_plugin_init') && !is_admin()) { |
|
409 | 409 | echo '<span id="insert-media-button">'; |
410 | 410 | } |
411 | 411 | |
412 | - echo self::shortcode_button( 'this', 'true' ); |
|
412 | + echo self::shortcode_button('this', 'true'); |
|
413 | 413 | |
414 | 414 | // see opening note |
415 | - if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) { |
|
415 | + if (function_exists('cornerstone_plugin_init') && !is_admin()) { |
|
416 | 416 | echo '</span>'; // end #insert-media-button |
417 | 417 | } |
418 | 418 | |
419 | 419 | // Add separate script for generatepress theme sections |
420 | - if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) { |
|
420 | + if (function_exists('generate_sections_sections_metabox') && did_action('generate_sections_metabox')) { |
|
421 | 421 | } else { |
422 | - self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function ); |
|
422 | + self::shortcode_insert_button_script($editor_id, $insert_shortcode_function); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | $shortcode_insert_button_once = true; |
@@ -433,12 +433,12 @@ discard block |
||
433 | 433 | * |
434 | 434 | * @return mixed |
435 | 435 | */ |
436 | - public static function shortcode_button( $id = '', $search_for_id = '' ) { |
|
436 | + public static function shortcode_button($id = '', $search_for_id = '') { |
|
437 | 437 | ob_start(); |
438 | 438 | ?> |
439 | 439 | <span class="sd-lable-shortcode-inserter"> |
440 | 440 | <a onclick="sd_ajax_get_picker(<?php echo $id; |
441 | - if ( $search_for_id ) { |
|
441 | + if ($search_for_id) { |
|
442 | 442 | echo "," . $search_for_id; |
443 | 443 | } ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed" |
444 | 444 | class="thickbox button super-duper-content-open" title="Add Shortcode"> |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | $html = ob_get_clean(); |
455 | 455 | |
456 | 456 | // remove line breaks so we can use it in js |
457 | - return preg_replace( "/\r|\n/", "", trim( $html ) ); |
|
457 | + return preg_replace("/\r|\n/", "", trim($html)); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | /** |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | jQuery($this).data('sd-widget-enabled', true); |
513 | 513 | } |
514 | 514 | |
515 | - var $button = '<button title="<?php _e( 'Advanced Settings' );?>" 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>'; |
|
515 | + var $button = '<button title="<?php _e('Advanced Settings'); ?>" 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>'; |
|
516 | 516 | var form = jQuery($this).parents('' + $selector + ''); |
517 | 517 | |
518 | 518 | if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) { |
@@ -547,10 +547,10 @@ discard block |
||
547 | 547 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
548 | 548 | */ |
549 | 549 | |
550 | - return str_replace( array( |
|
550 | + return str_replace(array( |
|
551 | 551 | '<script>', |
552 | 552 | '</script>' |
553 | - ), '', $output ); |
|
553 | + ), '', $output); |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | /** |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | *@since 1.0.6 |
563 | 563 | * |
564 | 564 | */ |
565 | - public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) { |
|
565 | + public static function shortcode_insert_button_script($editor_id = '', $insert_shortcode_function = '') { |
|
566 | 566 | ?> |
567 | 567 | <style> |
568 | 568 | .sd-shortcode-left-wrap { |
@@ -681,25 +681,25 @@ discard block |
||
681 | 681 | width: 100%; |
682 | 682 | } |
683 | 683 | |
684 | - <?php if ( function_exists( 'generate_sections_sections_metabox' ) ) { ?> |
|
684 | + <?php if (function_exists('generate_sections_sections_metabox')) { ?> |
|
685 | 685 | .generate-sections-modal #custom-media-buttons > .sd-lable-shortcode-inserter { |
686 | 686 | display: inline; |
687 | 687 | } |
688 | 688 | <?php } ?> |
689 | - <?php if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) { ?> |
|
689 | + <?php if (function_exists('et_builder_is_tb_admin_screen') && et_builder_is_tb_admin_screen()) { ?> |
|
690 | 690 | body.divi_page_et_theme_builder div#TB_window.gd-tb-window{z-index:9999999} |
691 | 691 | <?php } ?> |
692 | 692 | </style> |
693 | 693 | <?php |
694 | - if ( class_exists( 'SiteOrigin_Panels' ) ) { |
|
694 | + if (class_exists('SiteOrigin_Panels')) { |
|
695 | 695 | echo "<script>" . self::siteorigin_js() . "</script>"; |
696 | 696 | } |
697 | 697 | ?> |
698 | 698 | <script> |
699 | 699 | <?php |
700 | - if(! empty( $insert_shortcode_function )){ |
|
700 | + if (!empty($insert_shortcode_function)) { |
|
701 | 701 | echo $insert_shortcode_function; |
702 | - }else{ |
|
702 | + } else { |
|
703 | 703 | |
704 | 704 | /** |
705 | 705 | * Function for super duper insert shortcode. |
@@ -712,9 +712,9 @@ discard block |
||
712 | 712 | if ($shortcode) { |
713 | 713 | if (!$editor_id) { |
714 | 714 | <?php |
715 | - if ( isset( $_REQUEST['et_fb'] ) ) { |
|
715 | + if (isset($_REQUEST['et_fb'])) { |
|
716 | 716 | echo '$editor_id = "#main_content_content_vb_tiny_mce";'; |
717 | - } elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) { |
|
717 | + } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') { |
|
718 | 718 | echo '$editor_id = "#elementor-controls .wp-editor-container textarea";'; |
719 | 719 | } else { |
720 | 720 | echo '$editor_id = "#wp-content-editor-container textarea";'; |
@@ -799,11 +799,11 @@ discard block |
||
799 | 799 | 'shortcode': $short_code, |
800 | 800 | 'attributes': 123, |
801 | 801 | 'post_id': 321, |
802 | - '_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>' |
|
802 | + '_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>' |
|
803 | 803 | }; |
804 | 804 | |
805 | 805 | if (typeof ajaxurl === 'undefined') { |
806 | - var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' );?>"; |
|
806 | + var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>"; |
|
807 | 807 | } |
808 | 808 | |
809 | 809 | jQuery.post(ajaxurl, data, function (response) { |
@@ -1012,11 +1012,11 @@ discard block |
||
1012 | 1012 | var data = { |
1013 | 1013 | 'action': 'super_duper_get_picker', |
1014 | 1014 | 'editor_id': $id, |
1015 | - '_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_picker' );?>' |
|
1015 | + '_ajax_nonce': '<?php echo wp_create_nonce('super_duper_picker'); ?>' |
|
1016 | 1016 | }; |
1017 | 1017 | |
1018 | 1018 | if (!ajaxurl) { |
1019 | - var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' ); ?>"; |
|
1019 | + var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>"; |
|
1020 | 1020 | } |
1021 | 1021 | |
1022 | 1022 | jQuery.post(ajaxurl, data, function (response) { |
@@ -1038,9 +1038,9 @@ discard block |
||
1038 | 1038 | */ |
1039 | 1039 | function sd_shortcode_button($id) { |
1040 | 1040 | if ($id) { |
1041 | - return '<?php echo self::shortcode_button( "\\''+\$id+'\\'" );?>'; |
|
1041 | + return '<?php echo self::shortcode_button("\\''+\$id+'\\'"); ?>'; |
|
1042 | 1042 | } else { |
1043 | - return '<?php echo self::shortcode_button();?>'; |
|
1043 | + return '<?php echo self::shortcode_button(); ?>'; |
|
1044 | 1044 | } |
1045 | 1045 | } |
1046 | 1046 | |
@@ -1055,11 +1055,11 @@ discard block |
||
1055 | 1055 | * |
1056 | 1056 | * @return mixed |
1057 | 1057 | */ |
1058 | - public function widget_css( $advanced = true ) { |
|
1058 | + public function widget_css($advanced = true) { |
|
1059 | 1059 | ob_start(); |
1060 | 1060 | ?> |
1061 | 1061 | <style> |
1062 | - <?php if( $advanced ){ ?> |
|
1062 | + <?php if ($advanced) { ?> |
|
1063 | 1063 | .sd-advanced-setting { |
1064 | 1064 | display: none; |
1065 | 1065 | } |
@@ -1101,10 +1101,10 @@ discard block |
||
1101 | 1101 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
1102 | 1102 | */ |
1103 | 1103 | |
1104 | - return str_replace( array( |
|
1104 | + return str_replace(array( |
|
1105 | 1105 | '<style>', |
1106 | 1106 | '</style>' |
1107 | - ), '', $output ); |
|
1107 | + ), '', $output); |
|
1108 | 1108 | } |
1109 | 1109 | |
1110 | 1110 | /** |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | jQuery($this).data('sd-widget-enabled', true); |
1172 | 1172 | } |
1173 | 1173 | |
1174 | - var $button = '<button title="<?php _e( 'Advanced Settings' );?>" 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>'; |
|
1174 | + var $button = '<button title="<?php _e('Advanced Settings'); ?>" 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>'; |
|
1175 | 1175 | var form = $form ? $form : jQuery($this).parents('' + $selector + ''); |
1176 | 1176 | |
1177 | 1177 | if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) { |
@@ -1262,7 +1262,7 @@ discard block |
||
1262 | 1262 | }); |
1263 | 1263 | |
1264 | 1264 | } |
1265 | - <?php do_action( 'wp_super_duper_widget_js', $this ); ?> |
|
1265 | + <?php do_action('wp_super_duper_widget_js', $this); ?> |
|
1266 | 1266 | </script> |
1267 | 1267 | <?php |
1268 | 1268 | $output = ob_get_clean(); |
@@ -1271,10 +1271,10 @@ discard block |
||
1271 | 1271 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
1272 | 1272 | */ |
1273 | 1273 | |
1274 | - return str_replace( array( |
|
1274 | + return str_replace(array( |
|
1275 | 1275 | '<script>', |
1276 | 1276 | '</script>' |
1277 | - ), '', $output ); |
|
1277 | + ), '', $output); |
|
1278 | 1278 | } |
1279 | 1279 | |
1280 | 1280 | |
@@ -1285,14 +1285,14 @@ discard block |
||
1285 | 1285 | * |
1286 | 1286 | * @return mixed |
1287 | 1287 | */ |
1288 | - private function add_name_from_key( $options, $arguments = false ) { |
|
1289 | - if ( ! empty( $options['arguments'] ) ) { |
|
1290 | - foreach ( $options['arguments'] as $key => $val ) { |
|
1291 | - $options['arguments'][ $key ]['name'] = $key; |
|
1288 | + private function add_name_from_key($options, $arguments = false) { |
|
1289 | + if (!empty($options['arguments'])) { |
|
1290 | + foreach ($options['arguments'] as $key => $val) { |
|
1291 | + $options['arguments'][$key]['name'] = $key; |
|
1292 | 1292 | } |
1293 | - } elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) { |
|
1294 | - foreach ( $options as $key => $val ) { |
|
1295 | - $options[ $key ]['name'] = $key; |
|
1293 | + } elseif ($arguments && is_array($options) && !empty($options)) { |
|
1294 | + foreach ($options as $key => $val) { |
|
1295 | + $options[$key]['name'] = $key; |
|
1296 | 1296 | } |
1297 | 1297 | } |
1298 | 1298 | |
@@ -1305,8 +1305,8 @@ discard block |
||
1305 | 1305 | * @since 1.0.0 |
1306 | 1306 | */ |
1307 | 1307 | public function register_shortcode() { |
1308 | - add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) ); |
|
1309 | - add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) ); |
|
1308 | + add_shortcode($this->base_id, array($this, 'shortcode_output')); |
|
1309 | + add_action('wp_ajax_super_duper_output_shortcode', array($this, 'render_shortcode')); |
|
1310 | 1310 | } |
1311 | 1311 | |
1312 | 1312 | /** |
@@ -1315,50 +1315,50 @@ discard block |
||
1315 | 1315 | * @since 1.0.0 |
1316 | 1316 | */ |
1317 | 1317 | public function render_shortcode() { |
1318 | - check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true ); |
|
1319 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
1318 | + check_ajax_referer('super_duper_output_shortcode', '_ajax_nonce', true); |
|
1319 | + if (!current_user_can('manage_options')) { |
|
1320 | 1320 | wp_die(); |
1321 | 1321 | } |
1322 | 1322 | |
1323 | 1323 | // we might need the $post value here so lets set it. |
1324 | - if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) { |
|
1325 | - $post_obj = get_post( absint( $_POST['post_id'] ) ); |
|
1326 | - if ( ! empty( $post_obj ) && empty( $post ) ) { |
|
1324 | + if (isset($_POST['post_id']) && $_POST['post_id']) { |
|
1325 | + $post_obj = get_post(absint($_POST['post_id'])); |
|
1326 | + if (!empty($post_obj) && empty($post)) { |
|
1327 | 1327 | global $post; |
1328 | 1328 | $post = $post_obj; |
1329 | 1329 | } |
1330 | 1330 | } |
1331 | 1331 | |
1332 | - if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) { |
|
1332 | + if (isset($_POST['shortcode']) && $_POST['shortcode']) { |
|
1333 | 1333 | $is_preview = $this->is_preview(); |
1334 | - $shortcode_name = sanitize_title_with_dashes( $_POST['shortcode'] ); |
|
1335 | - $attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array(); |
|
1334 | + $shortcode_name = sanitize_title_with_dashes($_POST['shortcode']); |
|
1335 | + $attributes_array = isset($_POST['attributes']) && $_POST['attributes'] ? $_POST['attributes'] : array(); |
|
1336 | 1336 | $attributes = ''; |
1337 | - if ( ! empty( $attributes_array ) ) { |
|
1338 | - foreach ( $attributes_array as $key => $value ) { |
|
1339 | - if ( is_array( $value ) ) { |
|
1340 | - $value = implode( ",", $value ); |
|
1337 | + if (!empty($attributes_array)) { |
|
1338 | + foreach ($attributes_array as $key => $value) { |
|
1339 | + if (is_array($value)) { |
|
1340 | + $value = implode(",", $value); |
|
1341 | 1341 | } |
1342 | 1342 | |
1343 | - if ( ! empty( $value ) ) { |
|
1344 | - $value = wp_unslash( $value ); |
|
1343 | + if (!empty($value)) { |
|
1344 | + $value = wp_unslash($value); |
|
1345 | 1345 | |
1346 | 1346 | // Encode [ and ]. |
1347 | - if ( $is_preview ) { |
|
1348 | - $value = $this->encode_shortcodes( $value ); |
|
1347 | + if ($is_preview) { |
|
1348 | + $value = $this->encode_shortcodes($value); |
|
1349 | 1349 | } |
1350 | 1350 | } |
1351 | - $attributes .= " " . sanitize_title_with_dashes( $key ) . "='" . esc_attr( $value ) . "' "; |
|
1351 | + $attributes .= " " . sanitize_title_with_dashes($key) . "='" . esc_attr($value) . "' "; |
|
1352 | 1352 | } |
1353 | 1353 | } |
1354 | 1354 | |
1355 | 1355 | $shortcode = "[" . $shortcode_name . " " . $attributes . "]"; |
1356 | 1356 | |
1357 | - $content = do_shortcode( $shortcode ); |
|
1357 | + $content = do_shortcode($shortcode); |
|
1358 | 1358 | |
1359 | 1359 | // Decode [ and ]. |
1360 | - if ( ! empty( $content ) && $is_preview ) { |
|
1361 | - $content = $this->decode_shortcodes( $content ); |
|
1360 | + if (!empty($content) && $is_preview) { |
|
1361 | + $content = $this->decode_shortcodes($content); |
|
1362 | 1362 | } |
1363 | 1363 | |
1364 | 1364 | echo $content; |
@@ -1374,21 +1374,21 @@ discard block |
||
1374 | 1374 | * |
1375 | 1375 | * @return string |
1376 | 1376 | */ |
1377 | - public function shortcode_output( $args = array(), $content = '' ) { |
|
1377 | + public function shortcode_output($args = array(), $content = '') { |
|
1378 | 1378 | $_instance = $args; |
1379 | 1379 | |
1380 | - $args = $this->argument_values( $args ); |
|
1380 | + $args = $this->argument_values($args); |
|
1381 | 1381 | |
1382 | 1382 | // add extra argument so we know its a output to gutenberg |
1383 | 1383 | //$args |
1384 | - $args = $this->string_to_bool( $args ); |
|
1384 | + $args = $this->string_to_bool($args); |
|
1385 | 1385 | |
1386 | 1386 | // if we have a enclosed shortcode we add it to the special `html` argument |
1387 | - if ( ! empty( $content ) ) { |
|
1387 | + if (!empty($content)) { |
|
1388 | 1388 | $args['html'] = $content; |
1389 | 1389 | } |
1390 | 1390 | |
1391 | - if ( ! $this->is_preview() ) { |
|
1391 | + if (!$this->is_preview()) { |
|
1392 | 1392 | /** |
1393 | 1393 | * Filters the settings for a particular widget args. |
1394 | 1394 | * |
@@ -1399,40 +1399,40 @@ discard block |
||
1399 | 1399 | *@since 1.0.28 |
1400 | 1400 | * |
1401 | 1401 | */ |
1402 | - $args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance ); |
|
1402 | + $args = apply_filters('wp_super_duper_widget_display_callback', $args, $this, $_instance); |
|
1403 | 1403 | |
1404 | - if ( ! is_array( $args ) ) { |
|
1404 | + if (!is_array($args)) { |
|
1405 | 1405 | return $args; |
1406 | 1406 | } |
1407 | 1407 | } |
1408 | 1408 | |
1409 | - $class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : ''; |
|
1410 | - $class .= " sdel-".$this->get_instance_hash(); |
|
1409 | + $class = isset($this->options['widget_ops']['classname']) ? esc_attr($this->options['widget_ops']['classname']) : ''; |
|
1410 | + $class .= " sdel-" . $this->get_instance_hash(); |
|
1411 | 1411 | |
1412 | - $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this ); |
|
1413 | - $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this ); |
|
1412 | + $class = apply_filters('wp_super_duper_div_classname', $class, $args, $this); |
|
1413 | + $class = apply_filters('wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this); |
|
1414 | 1414 | |
1415 | - $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this ); |
|
1416 | - $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this ); |
|
1415 | + $attrs = apply_filters('wp_super_duper_div_attrs', '', $args, $this); |
|
1416 | + $attrs = apply_filters('wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this); |
|
1417 | 1417 | |
1418 | 1418 | $shortcode_args = array(); |
1419 | 1419 | $output = ''; |
1420 | - $no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false; |
|
1421 | - if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) { |
|
1420 | + $no_wrap = isset($this->options['no_wrap']) && $this->options['no_wrap'] ? true : false; |
|
1421 | + if (isset($args['no_wrap']) && $args['no_wrap']) { |
|
1422 | 1422 | $no_wrap = true; |
1423 | 1423 | } |
1424 | - $main_content = $this->output( $args, $shortcode_args, $content ); |
|
1425 | - if ( $main_content && ! $no_wrap ) { |
|
1424 | + $main_content = $this->output($args, $shortcode_args, $content); |
|
1425 | + if ($main_content && !$no_wrap) { |
|
1426 | 1426 | // wrap the shortcode in a div with the same class as the widget |
1427 | 1427 | $output .= '<div class="' . $class . '" ' . $attrs . '>'; |
1428 | - if ( ! empty( $args['title'] ) ) { |
|
1428 | + if (!empty($args['title'])) { |
|
1429 | 1429 | // if its a shortcode and there is a title try to grab the title wrappers |
1430 | - $shortcode_args = array( 'before_title' => '', 'after_title' => '' ); |
|
1431 | - if ( empty( $instance ) ) { |
|
1430 | + $shortcode_args = array('before_title' => '', 'after_title' => ''); |
|
1431 | + if (empty($instance)) { |
|
1432 | 1432 | global $wp_registered_sidebars; |
1433 | - if ( ! empty( $wp_registered_sidebars ) ) { |
|
1434 | - foreach ( $wp_registered_sidebars as $sidebar ) { |
|
1435 | - if ( ! empty( $sidebar['before_title'] ) ) { |
|
1433 | + if (!empty($wp_registered_sidebars)) { |
|
1434 | + foreach ($wp_registered_sidebars as $sidebar) { |
|
1435 | + if (!empty($sidebar['before_title'])) { |
|
1436 | 1436 | $shortcode_args['before_title'] = $sidebar['before_title']; |
1437 | 1437 | $shortcode_args['after_title'] = $sidebar['after_title']; |
1438 | 1438 | break; |
@@ -1440,20 +1440,20 @@ discard block |
||
1440 | 1440 | } |
1441 | 1441 | } |
1442 | 1442 | } |
1443 | - $output .= $this->output_title( $shortcode_args, $args ); |
|
1443 | + $output .= $this->output_title($shortcode_args, $args); |
|
1444 | 1444 | } |
1445 | 1445 | $output .= $main_content; |
1446 | 1446 | $output .= '</div>'; |
1447 | - } elseif ( $main_content && $no_wrap ) { |
|
1447 | + } elseif ($main_content && $no_wrap) { |
|
1448 | 1448 | $output .= $main_content; |
1449 | 1449 | } |
1450 | 1450 | |
1451 | 1451 | // if preview show a placeholder if empty |
1452 | - if ( $this->is_preview() && $output == '' ) { |
|
1453 | - $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" ); |
|
1452 | + if ($this->is_preview() && $output == '') { |
|
1453 | + $output = $this->preview_placeholder_text("{{" . $this->base_id . "}}"); |
|
1454 | 1454 | } |
1455 | 1455 | |
1456 | - return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this ); |
|
1456 | + return apply_filters('wp_super_duper_widget_output', $output, $args, $shortcode_args, $this); |
|
1457 | 1457 | } |
1458 | 1458 | |
1459 | 1459 | /** |
@@ -1463,8 +1463,8 @@ discard block |
||
1463 | 1463 | * |
1464 | 1464 | * @return string |
1465 | 1465 | */ |
1466 | - public function preview_placeholder_text( $name = '' ) { |
|
1467 | - return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf( __( 'Placeholder for: %s' ), $name ) . "</div>"; |
|
1466 | + public function preview_placeholder_text($name = '') { |
|
1467 | + return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf(__('Placeholder for: %s'), $name) . "</div>"; |
|
1468 | 1468 | } |
1469 | 1469 | |
1470 | 1470 | /** |
@@ -1474,13 +1474,13 @@ discard block |
||
1474 | 1474 | * |
1475 | 1475 | * @return mixed |
1476 | 1476 | */ |
1477 | - public function string_to_bool( $options ) { |
|
1477 | + public function string_to_bool($options) { |
|
1478 | 1478 | // convert bool strings to booleans |
1479 | - foreach ( $options as $key => $val ) { |
|
1480 | - if ( $val == 'false' ) { |
|
1481 | - $options[ $key ] = false; |
|
1482 | - } elseif ( $val == 'true' ) { |
|
1483 | - $options[ $key ] = true; |
|
1479 | + foreach ($options as $key => $val) { |
|
1480 | + if ($val == 'false') { |
|
1481 | + $options[$key] = false; |
|
1482 | + } elseif ($val == 'true') { |
|
1483 | + $options[$key] = true; |
|
1484 | 1484 | } |
1485 | 1485 | } |
1486 | 1486 | |
@@ -1496,26 +1496,26 @@ discard block |
||
1496 | 1496 | *@since 1.0.12 Don't set checkbox default value if the value is empty. |
1497 | 1497 | * |
1498 | 1498 | */ |
1499 | - public function argument_values( $instance ) { |
|
1499 | + public function argument_values($instance) { |
|
1500 | 1500 | $argument_values = array(); |
1501 | 1501 | |
1502 | 1502 | // set widget instance |
1503 | 1503 | $this->instance = $instance; |
1504 | 1504 | |
1505 | - if ( empty( $this->arguments ) ) { |
|
1505 | + if (empty($this->arguments)) { |
|
1506 | 1506 | $this->arguments = $this->get_arguments(); |
1507 | 1507 | } |
1508 | 1508 | |
1509 | - if ( ! empty( $this->arguments ) ) { |
|
1510 | - foreach ( $this->arguments as $key => $args ) { |
|
1509 | + if (!empty($this->arguments)) { |
|
1510 | + foreach ($this->arguments as $key => $args) { |
|
1511 | 1511 | // set the input name from the key |
1512 | 1512 | $args['name'] = $key; |
1513 | 1513 | // |
1514 | - $argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : ''; |
|
1515 | - if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) { |
|
1514 | + $argument_values[$key] = isset($instance[$key]) ? $instance[$key] : ''; |
|
1515 | + if ($args['type'] == 'checkbox' && $argument_values[$key] == '') { |
|
1516 | 1516 | // don't set default for an empty checkbox |
1517 | - } elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) { |
|
1518 | - $argument_values[ $key ] = $args['default']; |
|
1517 | + } elseif ($argument_values[$key] == '' && isset($args['default'])) { |
|
1518 | + $argument_values[$key] = $args['default']; |
|
1519 | 1519 | } |
1520 | 1520 | } |
1521 | 1521 | } |
@@ -1542,12 +1542,12 @@ discard block |
||
1542 | 1542 | * |
1543 | 1543 | */ |
1544 | 1544 | public function get_arguments() { |
1545 | - if ( empty( $this->arguments ) ) { |
|
1545 | + if (empty($this->arguments)) { |
|
1546 | 1546 | $this->arguments = $this->set_arguments(); |
1547 | 1547 | } |
1548 | 1548 | |
1549 | - $this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance ); |
|
1550 | - $this->arguments = $this->add_name_from_key( $this->arguments, true ); |
|
1549 | + $this->arguments = apply_filters('wp_super_duper_arguments', $this->arguments, $this->options, $this->instance); |
|
1550 | + $this->arguments = $this->add_name_from_key($this->arguments, true); |
|
1551 | 1551 | |
1552 | 1552 | return $this->arguments; |
1553 | 1553 | } |
@@ -1559,7 +1559,7 @@ discard block |
||
1559 | 1559 | * @param array $widget_args |
1560 | 1560 | * @param string $content |
1561 | 1561 | */ |
1562 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
1562 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
1563 | 1563 | |
1564 | 1564 | } |
1565 | 1565 | |
@@ -1567,9 +1567,9 @@ discard block |
||
1567 | 1567 | * Add the dynamic block code inline when the wp-block in enqueued. |
1568 | 1568 | */ |
1569 | 1569 | public function register_block() { |
1570 | - wp_add_inline_script( 'wp-blocks', $this->block() ); |
|
1571 | - if ( class_exists( 'SiteOrigin_Panels' ) ) { |
|
1572 | - wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() ); |
|
1570 | + wp_add_inline_script('wp-blocks', $this->block()); |
|
1571 | + if (class_exists('SiteOrigin_Panels')) { |
|
1572 | + wp_add_inline_script('wp-blocks', $this->siteorigin_js()); |
|
1573 | 1573 | } |
1574 | 1574 | } |
1575 | 1575 | |
@@ -1583,9 +1583,9 @@ discard block |
||
1583 | 1583 | $show = false; |
1584 | 1584 | $arguments = $this->get_arguments(); |
1585 | 1585 | |
1586 | - if ( ! empty( $arguments ) ) { |
|
1587 | - foreach ( $arguments as $argument ) { |
|
1588 | - if ( isset( $argument['advanced'] ) && $argument['advanced'] ) { |
|
1586 | + if (!empty($arguments)) { |
|
1587 | + foreach ($arguments as $argument) { |
|
1588 | + if (isset($argument['advanced']) && $argument['advanced']) { |
|
1589 | 1589 | $show = true; |
1590 | 1590 | break; // no need to continue if we know we have it |
1591 | 1591 | } |
@@ -1603,19 +1603,19 @@ discard block |
||
1603 | 1603 | public function get_url() { |
1604 | 1604 | $url = $this->url; |
1605 | 1605 | |
1606 | - if ( ! $url ) { |
|
1607 | - $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) ); |
|
1608 | - $content_url = untrailingslashit( WP_CONTENT_URL ); |
|
1606 | + if (!$url) { |
|
1607 | + $content_dir = wp_normalize_path(untrailingslashit(WP_CONTENT_DIR)); |
|
1608 | + $content_url = untrailingslashit(WP_CONTENT_URL); |
|
1609 | 1609 | |
1610 | 1610 | // Replace http:// to https://. |
1611 | - if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) { |
|
1612 | - $content_url = str_replace( 'http://', 'https://', $content_url ); |
|
1611 | + if (strpos($content_url, 'http://') === 0 && strpos(plugins_url(), 'https://') === 0) { |
|
1612 | + $content_url = str_replace('http://', 'https://', $content_url); |
|
1613 | 1613 | } |
1614 | 1614 | |
1615 | 1615 | // Check if we are inside a plugin |
1616 | - $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) ); |
|
1617 | - $url = str_replace( $content_dir, $content_url, $file_dir ); |
|
1618 | - $url = trailingslashit( $url ); |
|
1616 | + $file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__))); |
|
1617 | + $url = str_replace($content_dir, $content_url, $file_dir); |
|
1618 | + $url = trailingslashit($url); |
|
1619 | 1619 | $this->url = $url; |
1620 | 1620 | } |
1621 | 1621 | |
@@ -1631,15 +1631,15 @@ discard block |
||
1631 | 1631 | |
1632 | 1632 | $url = $this->url; |
1633 | 1633 | |
1634 | - if ( ! $url ) { |
|
1634 | + if (!$url) { |
|
1635 | 1635 | // check if we are inside a plugin |
1636 | - $file_dir = str_replace( "/includes", "", dirname( __FILE__ ) ); |
|
1636 | + $file_dir = str_replace("/includes", "", dirname(__FILE__)); |
|
1637 | 1637 | |
1638 | - $dir_parts = explode( "/wp-content/", $file_dir ); |
|
1639 | - $url_parts = explode( "/wp-content/", plugins_url() ); |
|
1638 | + $dir_parts = explode("/wp-content/", $file_dir); |
|
1639 | + $url_parts = explode("/wp-content/", plugins_url()); |
|
1640 | 1640 | |
1641 | - if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) { |
|
1642 | - $url = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] ); |
|
1641 | + if (!empty($url_parts[0]) && !empty($dir_parts[1])) { |
|
1642 | + $url = trailingslashit($url_parts[0] . "/wp-content/" . $dir_parts[1]); |
|
1643 | 1643 | $this->url = $url; |
1644 | 1644 | } |
1645 | 1645 | } |
@@ -1660,46 +1660,46 @@ discard block |
||
1660 | 1660 | * @return string |
1661 | 1661 | *@since 1.1.0 |
1662 | 1662 | */ |
1663 | - public function get_block_icon( $icon ) { |
|
1663 | + public function get_block_icon($icon) { |
|
1664 | 1664 | |
1665 | 1665 | // check if we have a Font Awesome icon |
1666 | 1666 | $fa_type = ''; |
1667 | - if ( substr( $icon, 0, 7 ) === "fas fa-" ) { |
|
1667 | + if (substr($icon, 0, 7) === "fas fa-") { |
|
1668 | 1668 | $fa_type = 'solid'; |
1669 | - } elseif ( substr( $icon, 0, 7 ) === "far fa-" ) { |
|
1669 | + } elseif (substr($icon, 0, 7) === "far fa-") { |
|
1670 | 1670 | $fa_type = 'regular'; |
1671 | - } elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) { |
|
1671 | + } elseif (substr($icon, 0, 7) === "fab fa-") { |
|
1672 | 1672 | $fa_type = 'brands'; |
1673 | 1673 | } else { |
1674 | 1674 | $icon = "'" . $icon . "'"; |
1675 | 1675 | } |
1676 | 1676 | |
1677 | 1677 | // set the icon if we found one |
1678 | - if ( $fa_type ) { |
|
1679 | - $fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon ); |
|
1678 | + if ($fa_type) { |
|
1679 | + $fa_icon = str_replace(array("fas fa-", "far fa-", "fab fa-"), "", $icon); |
|
1680 | 1680 | $icon = "el('svg',{width: 20, height: 20, viewBox: '0 0 20 20'},el('use', {'xlink:href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "','href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "'}))"; |
1681 | 1681 | } |
1682 | 1682 | |
1683 | 1683 | return $icon; |
1684 | 1684 | } |
1685 | 1685 | |
1686 | - public function group_arguments( $arguments ) { |
|
1686 | + public function group_arguments($arguments) { |
|
1687 | 1687 | // echo '###';print_r($arguments); |
1688 | - if ( ! empty( $arguments ) ) { |
|
1688 | + if (!empty($arguments)) { |
|
1689 | 1689 | $temp_arguments = array(); |
1690 | - $general = __( "General" ); |
|
1690 | + $general = __("General"); |
|
1691 | 1691 | $add_sections = false; |
1692 | - foreach ( $arguments as $key => $args ) { |
|
1693 | - if ( isset( $args['group'] ) ) { |
|
1694 | - $temp_arguments[ $args['group'] ][ $key ] = $args; |
|
1692 | + foreach ($arguments as $key => $args) { |
|
1693 | + if (isset($args['group'])) { |
|
1694 | + $temp_arguments[$args['group']][$key] = $args; |
|
1695 | 1695 | $add_sections = true; |
1696 | 1696 | } else { |
1697 | - $temp_arguments[ $general ][ $key ] = $args; |
|
1697 | + $temp_arguments[$general][$key] = $args; |
|
1698 | 1698 | } |
1699 | 1699 | } |
1700 | 1700 | |
1701 | 1701 | // only add sections if more than one |
1702 | - if ( $add_sections ) { |
|
1702 | + if ($add_sections) { |
|
1703 | 1703 | $arguments = $temp_arguments; |
1704 | 1704 | } |
1705 | 1705 | } |
@@ -1729,7 +1729,7 @@ discard block |
||
1729 | 1729 | <script> |
1730 | 1730 | |
1731 | 1731 | <?php |
1732 | - if(!$sd_is_js_functions_loaded){ |
|
1732 | + if (!$sd_is_js_functions_loaded) { |
|
1733 | 1733 | $sd_is_js_functions_loaded = true; |
1734 | 1734 | ?> |
1735 | 1735 | |
@@ -1909,7 +1909,7 @@ discard block |
||
1909 | 1909 | |
1910 | 1910 | // maybe use featured image. |
1911 | 1911 | if( $args['bg_image_use_featured'] !== undefined && $args['bg_image_use_featured'] ){ |
1912 | - $bg_image = '<?php echo $this->get_url();?>icons/placeholder.png'; |
|
1912 | + $bg_image = '<?php echo $this->get_url(); ?>icons/placeholder.png'; |
|
1913 | 1913 | } |
1914 | 1914 | |
1915 | 1915 | if( $bg_image !== undefined && $bg_image !== '' ){ |
@@ -2095,7 +2095,7 @@ discard block |
||
2095 | 2095 | } |
2096 | 2096 | |
2097 | 2097 | function sd_get_class_build_keys(){ |
2098 | - return <?php echo json_encode(sd_get_class_build_keys());?>; |
|
2098 | + return <?php echo json_encode(sd_get_class_build_keys()); ?>; |
|
2099 | 2099 | } |
2100 | 2100 | |
2101 | 2101 | <?php |
@@ -2103,7 +2103,7 @@ discard block |
||
2103 | 2103 | |
2104 | 2104 | } |
2105 | 2105 | |
2106 | - if(method_exists($this,'block_global_js')){ |
|
2106 | + if (method_exists($this, 'block_global_js')) { |
|
2107 | 2107 | echo $this->block_global_js(); |
2108 | 2108 | } |
2109 | 2109 | ?> |
@@ -2132,9 +2132,9 @@ discard block |
||
2132 | 2132 | var InnerBlocks = blockEditor.InnerBlocks; |
2133 | 2133 | |
2134 | 2134 | var term_query_type = ''; |
2135 | - 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 "[]";} ?>; |
|
2136 | - const taxonomies_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}]; |
|
2137 | - const sort_by_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}]; |
|
2135 | + 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 "[]"; } ?>; |
|
2136 | + const taxonomies_<?php echo str_replace("-", "_", $this->id); ?> = [{label: "Please wait", value: 0}]; |
|
2137 | + const sort_by_<?php echo str_replace("-", "_", $this->id); ?> = [{label: "Please wait", value: 0}]; |
|
2138 | 2138 | const MediaUpload = wp.blockEditor.MediaUpload; |
2139 | 2139 | |
2140 | 2140 | /** |
@@ -2149,20 +2149,20 @@ discard block |
||
2149 | 2149 | * @return {?WPBlock} The block, if it has been successfully |
2150 | 2150 | * registered; otherwise `undefined`. |
2151 | 2151 | */ |
2152 | - 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. |
|
2153 | - apiVersion: <?php echo isset($this->options['block-api-version']) ? absint($this->options['block-api-version']) : 2 ; ?>, |
|
2154 | - title: '<?php echo addslashes( $this->options['name'] ); ?>', // Block title. |
|
2155 | - description: '<?php echo addslashes( $this->options['widget_ops']['description'] )?>', // Block title. |
|
2156 | - icon: <?php echo $this->get_block_icon( $this->options['block-icon'] );?>,//'<?php echo isset( $this->options['block-icon'] ) ? esc_attr( $this->options['block-icon'] ) : 'shield-alt';?>', // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/. |
|
2152 | + 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. |
|
2153 | + apiVersion: <?php echo isset($this->options['block-api-version']) ? absint($this->options['block-api-version']) : 2; ?>, |
|
2154 | + title: '<?php echo addslashes($this->options['name']); ?>', // Block title. |
|
2155 | + description: '<?php echo addslashes($this->options['widget_ops']['description'])?>', // Block title. |
|
2156 | + icon: <?php echo $this->get_block_icon($this->options['block-icon']); ?>,//'<?php echo isset($this->options['block-icon']) ? esc_attr($this->options['block-icon']) : 'shield-alt'; ?>', // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/. |
|
2157 | 2157 | supports: { |
2158 | 2158 | <?php |
2159 | - if ( isset( $this->options['block-supports'] ) ) { |
|
2160 | - echo $this->array_to_attributes( $this->options['block-supports'] ); |
|
2159 | + if (isset($this->options['block-supports'])) { |
|
2160 | + echo $this->array_to_attributes($this->options['block-supports']); |
|
2161 | 2161 | } |
2162 | 2162 | ?> |
2163 | 2163 | }, |
2164 | 2164 | <?php |
2165 | - if ( isset( $this->options['block-label'] ) ) { |
|
2165 | + if (isset($this->options['block-label'])) { |
|
2166 | 2166 | ?> |
2167 | 2167 | __experimentalLabel( attributes, { context } ) { |
2168 | 2168 | return <?php echo $this->options['block-label']; ?>; |
@@ -2170,8 +2170,8 @@ discard block |
||
2170 | 2170 | <?php |
2171 | 2171 | } |
2172 | 2172 | ?> |
2173 | - category: '<?php echo isset( $this->options['block-category'] ) ? esc_attr( $this->options['block-category'] ) : 'common';?>', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed. |
|
2174 | - <?php if ( isset( $this->options['block-keywords'] ) ) { |
|
2173 | + category: '<?php echo isset($this->options['block-category']) ? esc_attr($this->options['block-category']) : 'common'; ?>', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed. |
|
2174 | + <?php if (isset($this->options['block-keywords'])) { |
|
2175 | 2175 | echo "keywords : " . $this->options['block-keywords'] . ","; |
2176 | 2176 | |
2177 | 2177 | // // block hover preview. |
@@ -2198,11 +2198,11 @@ discard block |
||
2198 | 2198 | } |
2199 | 2199 | |
2200 | 2200 | // maybe set no_wrap |
2201 | - $no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false; |
|
2202 | - if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) { |
|
2201 | + $no_wrap = isset($this->options['no_wrap']) && $this->options['no_wrap'] ? true : false; |
|
2202 | + if (isset($this->arguments['no_wrap']) && $this->arguments['no_wrap']) { |
|
2203 | 2203 | $no_wrap = true; |
2204 | 2204 | } |
2205 | - if ( $no_wrap ) { |
|
2205 | + if ($no_wrap) { |
|
2206 | 2206 | $this->options['block-wrap'] = ''; |
2207 | 2207 | } |
2208 | 2208 | |
@@ -2216,10 +2216,10 @@ discard block |
||
2216 | 2216 | echo " html: false"; |
2217 | 2217 | echo "},";*/ |
2218 | 2218 | |
2219 | - if ( ! empty( $this->arguments ) ) { |
|
2219 | + if (!empty($this->arguments)) { |
|
2220 | 2220 | echo "attributes : {"; |
2221 | 2221 | |
2222 | - if ( $show_advanced ) { |
|
2222 | + if ($show_advanced) { |
|
2223 | 2223 | echo "show_advanced: {"; |
2224 | 2224 | echo " type: 'boolean',"; |
2225 | 2225 | echo " default: false,"; |
@@ -2227,56 +2227,56 @@ discard block |
||
2227 | 2227 | } |
2228 | 2228 | |
2229 | 2229 | // block wrap element |
2230 | - if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this? |
|
2230 | + if (!empty($this->options['block-wrap'])) { //@todo we should validate this? |
|
2231 | 2231 | echo "block_wrap: {"; |
2232 | 2232 | echo " type: 'string',"; |
2233 | - echo " default: '" . esc_attr( $this->options['block-wrap'] ) . "',"; |
|
2233 | + echo " default: '" . esc_attr($this->options['block-wrap']) . "',"; |
|
2234 | 2234 | echo "},"; |
2235 | 2235 | } |
2236 | 2236 | |
2237 | 2237 | |
2238 | 2238 | |
2239 | - foreach ( $this->arguments as $key => $args ) { |
|
2239 | + foreach ($this->arguments as $key => $args) { |
|
2240 | 2240 | |
2241 | - if( $args['type'] == 'image' || $args['type'] == 'images' ){ |
|
2241 | + if ($args['type'] == 'image' || $args['type'] == 'images') { |
|
2242 | 2242 | $img_drag_drop = true; |
2243 | 2243 | } |
2244 | 2244 | |
2245 | 2245 | // set if we should show alignment |
2246 | - if ( $key == 'alignment' ) { |
|
2246 | + if ($key == 'alignment') { |
|
2247 | 2247 | $show_alignment = true; |
2248 | 2248 | } |
2249 | 2249 | |
2250 | 2250 | $extra = ''; |
2251 | 2251 | |
2252 | - if ( $args['type'] == 'notice' || $args['type'] == 'tab' ) { |
|
2252 | + if ($args['type'] == 'notice' || $args['type'] == 'tab') { |
|
2253 | 2253 | continue; |
2254 | 2254 | } |
2255 | - elseif ( $args['type'] == 'checkbox' ) { |
|
2255 | + elseif ($args['type'] == 'checkbox') { |
|
2256 | 2256 | $type = 'boolean'; |
2257 | - $default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false'; |
|
2258 | - } elseif ( $args['type'] == 'number' ) { |
|
2257 | + $default = isset($args['default']) && $args['default'] ? 'true' : 'false'; |
|
2258 | + } elseif ($args['type'] == 'number') { |
|
2259 | 2259 | $type = 'number'; |
2260 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2261 | - } elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) { |
|
2260 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2261 | + } elseif ($args['type'] == 'select' && !empty($args['multiple'])) { |
|
2262 | 2262 | $type = 'array'; |
2263 | - if ( isset( $args['default'] ) && is_array( $args['default'] ) ) { |
|
2264 | - $default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]"; |
|
2263 | + if (isset($args['default']) && is_array($args['default'])) { |
|
2264 | + $default = !empty($args['default']) ? "['" . implode("','", $args['default']) . "']" : "[]"; |
|
2265 | 2265 | } else { |
2266 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2266 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2267 | 2267 | } |
2268 | - } elseif ( $args['type'] == 'tagselect' ) { |
|
2268 | + } elseif ($args['type'] == 'tagselect') { |
|
2269 | 2269 | $type = 'array'; |
2270 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2271 | - } elseif ( $args['type'] == 'multiselect' ) { |
|
2270 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2271 | + } elseif ($args['type'] == 'multiselect') { |
|
2272 | 2272 | $type = 'array'; |
2273 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2274 | - } elseif ( $args['type'] == 'image_xy' ) { |
|
2273 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2274 | + } elseif ($args['type'] == 'image_xy') { |
|
2275 | 2275 | $type = 'object'; |
2276 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2277 | - } elseif ( $args['type'] == 'image' ) { |
|
2276 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2277 | + } elseif ($args['type'] == 'image') { |
|
2278 | 2278 | $type = 'string'; |
2279 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2279 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2280 | 2280 | |
2281 | 2281 | // add a field for ID |
2282 | 2282 | // echo $key . "_id : {"; |
@@ -2288,7 +2288,7 @@ discard block |
||
2288 | 2288 | |
2289 | 2289 | } else { |
2290 | 2290 | $type = !empty($args['hidden_type']) ? esc_attr($args['hidden_type']) : 'string'; |
2291 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
2291 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
2292 | 2292 | |
2293 | 2293 | } |
2294 | 2294 | echo $key . " : {"; |
@@ -2312,7 +2312,7 @@ discard block |
||
2312 | 2312 | |
2313 | 2313 | <?php |
2314 | 2314 | // only include the drag/drop functions if required. |
2315 | -if( $img_drag_drop ){ |
|
2315 | +if ($img_drag_drop) { |
|
2316 | 2316 | |
2317 | 2317 | ?> |
2318 | 2318 | |
@@ -2378,9 +2378,9 @@ discard block |
||
2378 | 2378 | } |
2379 | 2379 | |
2380 | 2380 | <?php |
2381 | - if(!empty($this->options['block-edit-raw'])) { |
|
2381 | + if (!empty($this->options['block-edit-raw'])) { |
|
2382 | 2382 | echo $this->options['block-edit-raw']; // strings have to be in single quotes, may cause issues |
2383 | - }else{ |
|
2383 | + } else { |
|
2384 | 2384 | ?> |
2385 | 2385 | |
2386 | 2386 | function hasSelectedInnerBlock(props) { |
@@ -2405,7 +2405,7 @@ discard block |
||
2405 | 2405 | var $value = ''; |
2406 | 2406 | <?php |
2407 | 2407 | // if we have a post_type and a category then link them |
2408 | - if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){ |
|
2408 | + if (isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked'])) { |
|
2409 | 2409 | ?> |
2410 | 2410 | if(typeof(prev_attributes[props.clientId]) != 'undefined' ){ |
2411 | 2411 | $pt = props.attributes.post_type; |
@@ -2421,13 +2421,13 @@ discard block |
||
2421 | 2421 | |
2422 | 2422 | // taxonomies |
2423 | 2423 | if( $value && 'post_type' in prev_attributes[props.clientId] && 'category' in prev_attributes[props.clientId] && run ){ |
2424 | - wp.apiFetch({path: "<?php if(isset($this->arguments['post_type']['onchange_rest']['path'])){echo $this->arguments['post_type']['onchange_rest']['path'];}else{'/wp/v2/"+$value+"/categories/?per_page=100';} ?>"}).then(terms => { |
|
2425 | - while (taxonomies_<?php echo str_replace("-","_", $this->id);?>.length) { |
|
2426 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.pop(); |
|
2424 | + wp.apiFetch({path: "<?php if (isset($this->arguments['post_type']['onchange_rest']['path'])) {echo $this->arguments['post_type']['onchange_rest']['path']; } else {'/wp/v2/"+$value+"/categories/?per_page=100'; } ?>"}).then(terms => { |
|
2425 | + while (taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.length) { |
|
2426 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.pop(); |
|
2427 | 2427 | } |
2428 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: "All", value: 0}); |
|
2428 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: "All", value: 0}); |
|
2429 | 2429 | jQuery.each( terms, function( key, val ) { |
2430 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: val.name, value: val.id}); |
|
2430 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val.name, value: val.id}); |
|
2431 | 2431 | }); |
2432 | 2432 | |
2433 | 2433 | // setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. |
@@ -2435,7 +2435,7 @@ discard block |
||
2435 | 2435 | props.setAttributes({category: [0] }); |
2436 | 2436 | props.setAttributes({category: $old_cat_value }); |
2437 | 2437 | |
2438 | - return taxonomies_<?php echo str_replace("-","_", $this->id);?>; |
|
2438 | + return taxonomies_<?php echo str_replace("-", "_", $this->id); ?>; |
|
2439 | 2439 | }); |
2440 | 2440 | } |
2441 | 2441 | |
@@ -2447,12 +2447,12 @@ discard block |
||
2447 | 2447 | }; |
2448 | 2448 | jQuery.post(ajaxurl, data, function(response) { |
2449 | 2449 | response = JSON.parse(response); |
2450 | - while (sort_by_<?php echo str_replace("-","_", $this->id);?>.length) { |
|
2451 | - sort_by_<?php echo str_replace("-","_", $this->id);?>.pop(); |
|
2450 | + while (sort_by_<?php echo str_replace("-", "_", $this->id); ?>.length) { |
|
2451 | + sort_by_<?php echo str_replace("-", "_", $this->id); ?>.pop(); |
|
2452 | 2452 | } |
2453 | 2453 | |
2454 | 2454 | jQuery.each( response, function( key, val ) { |
2455 | - sort_by_<?php echo str_replace("-","_", $this->id);?>.push({label: val, value: key}); |
|
2455 | + sort_by_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val, value: key}); |
|
2456 | 2456 | }); |
2457 | 2457 | |
2458 | 2458 | // setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. |
@@ -2460,7 +2460,7 @@ discard block |
||
2460 | 2460 | props.setAttributes({sort_by: [0] }); |
2461 | 2461 | props.setAttributes({sort_by: $old_sort_by_value }); |
2462 | 2462 | |
2463 | - return sort_by_<?php echo str_replace("-","_", $this->id);?>; |
|
2463 | + return sort_by_<?php echo str_replace("-", "_", $this->id); ?>; |
|
2464 | 2464 | }); |
2465 | 2465 | |
2466 | 2466 | } |
@@ -2468,9 +2468,9 @@ discard block |
||
2468 | 2468 | <?php } ?> |
2469 | 2469 | <?php |
2470 | 2470 | $current_screen = function_exists('get_current_screen') ? get_current_screen() : ''; |
2471 | -if(!empty($current_screen->base) && $current_screen->base==='widgets'){ |
|
2471 | +if (!empty($current_screen->base) && $current_screen->base === 'widgets') { |
|
2472 | 2472 | echo 'const { deviceType } = "";'; |
2473 | -}else{ |
|
2473 | +} else { |
|
2474 | 2474 | ?> |
2475 | 2475 | /** Get device type const. */ |
2476 | 2476 | const { deviceType } = wp.data.useSelect != 'undefined' ? wp.data.useSelect(select => { |
@@ -2499,13 +2499,13 @@ discard block |
||
2499 | 2499 | |
2500 | 2500 | var data = { |
2501 | 2501 | 'action': 'super_duper_output_shortcode', |
2502 | - 'shortcode': '<?php echo $this->options['base_id'];?>', |
|
2502 | + 'shortcode': '<?php echo $this->options['base_id']; ?>', |
|
2503 | 2503 | 'attributes': props.attributes, |
2504 | 2504 | 'block_parent_name': parentBlocks.length ? parentBlocks[parentBlocks.length - 1].name : '', |
2505 | - 'post_id': <?php global $post; if ( isset( $post->ID ) ) { |
|
2505 | + 'post_id': <?php global $post; if (isset($post->ID)) { |
|
2506 | 2506 | echo $post->ID; |
2507 | - }else{echo '0';}?>, |
|
2508 | - '_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>' |
|
2507 | + } else {echo '0'; }?>, |
|
2508 | + '_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>' |
|
2509 | 2509 | }; |
2510 | 2510 | |
2511 | 2511 | jQuery.post(ajaxurl, data, function (response) { |
@@ -2514,17 +2514,17 @@ discard block |
||
2514 | 2514 | |
2515 | 2515 | // if the content is empty then we place some placeholder text |
2516 | 2516 | if (env == '') { |
2517 | - env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e( 'Placeholder for: ' );?>" + props.name + "</div>"; |
|
2517 | + env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e('Placeholder for: '); ?>" + props.name + "</div>"; |
|
2518 | 2518 | } |
2519 | 2519 | |
2520 | 2520 | <?php |
2521 | - if(!empty($this->options['nested-block'])){ |
|
2521 | + if (!empty($this->options['nested-block'])) { |
|
2522 | 2522 | ?> |
2523 | 2523 | // props.setAttributes({content: env}); |
2524 | 2524 | is_fetching = false; |
2525 | 2525 | prev_attributes[props.clientId] = props.attributes; |
2526 | 2526 | <?php |
2527 | - }else{ |
|
2527 | + } else { |
|
2528 | 2528 | ?> |
2529 | 2529 | props.setAttributes({content: env}); |
2530 | 2530 | is_fetching = false; |
@@ -2549,8 +2549,8 @@ discard block |
||
2549 | 2549 | } |
2550 | 2550 | |
2551 | 2551 | <?php |
2552 | - if(!empty($this->options['block-edit-js'])) { |
|
2553 | - echo $this->options['block-edit-js'] ; // strings have to be in single quotes, may cause issues |
|
2552 | + if (!empty($this->options['block-edit-js'])) { |
|
2553 | + echo $this->options['block-edit-js']; // strings have to be in single quotes, may cause issues |
|
2554 | 2554 | } |
2555 | 2555 | |
2556 | 2556 | |
@@ -2563,7 +2563,7 @@ discard block |
||
2563 | 2563 | |
2564 | 2564 | el(wp.blockEditor.BlockControls, {key: 'controls'}, |
2565 | 2565 | |
2566 | - <?php if($show_alignment){?> |
|
2566 | + <?php if ($show_alignment) {?> |
|
2567 | 2567 | el( |
2568 | 2568 | wp.blockEditor.AlignmentToolbar, |
2569 | 2569 | { |
@@ -2581,9 +2581,9 @@ discard block |
||
2581 | 2581 | |
2582 | 2582 | <?php |
2583 | 2583 | |
2584 | - if(! empty( $this->arguments )){ |
|
2584 | + if (!empty($this->arguments)) { |
|
2585 | 2585 | |
2586 | - if ( $show_advanced ) { |
|
2586 | + if ($show_advanced) { |
|
2587 | 2587 | ?> |
2588 | 2588 | el('div', { |
2589 | 2589 | style: {'padding-left': '16px','padding-right': '16px'} |
@@ -2608,46 +2608,46 @@ discard block |
||
2608 | 2608 | |
2609 | 2609 | //echo '####'; |
2610 | 2610 | |
2611 | - $arguments = $this->group_arguments( $this->arguments ); |
|
2611 | + $arguments = $this->group_arguments($this->arguments); |
|
2612 | 2612 | //print_r($arguments ); exit; |
2613 | 2613 | // Do we have sections? |
2614 | 2614 | $has_sections = $arguments == $this->arguments ? false : true; |
2615 | 2615 | |
2616 | 2616 | |
2617 | - if($has_sections){ |
|
2617 | + if ($has_sections) { |
|
2618 | 2618 | $panel_count = 0; |
2619 | 2619 | $open_tab = ''; |
2620 | 2620 | |
2621 | 2621 | $open_tab_groups = array(); |
2622 | 2622 | $used_tabs = array(); |
2623 | - foreach($arguments as $key => $args){ |
|
2623 | + foreach ($arguments as $key => $args) { |
|
2624 | 2624 | |
2625 | 2625 | $close_tab = false; |
2626 | 2626 | $close_tabs = false; |
2627 | 2627 | |
2628 | - if(!empty($this->options['block_group_tabs'])) { |
|
2629 | - foreach($this->options['block_group_tabs'] as $tab_name => $tab_args){ |
|
2630 | - if(in_array($key,$tab_args['groups'])){ |
|
2628 | + if (!empty($this->options['block_group_tabs'])) { |
|
2629 | + foreach ($this->options['block_group_tabs'] as $tab_name => $tab_args) { |
|
2630 | + if (in_array($key, $tab_args['groups'])) { |
|
2631 | 2631 | |
2632 | 2632 | $open_tab_groups[] = $key; |
2633 | 2633 | |
2634 | - if($open_tab != $tab_name){ |
|
2634 | + if ($open_tab != $tab_name) { |
|
2635 | 2635 | $tab_args['tab']['tabs_open'] = $open_tab == '' ? true : false; |
2636 | 2636 | $tab_args['tab']['open'] = true; |
2637 | 2637 | |
2638 | - $this->block_tab_start( '', $tab_args ); |
|
2638 | + $this->block_tab_start('', $tab_args); |
|
2639 | 2639 | // echo '###open'.$tab_name;print_r($tab_args); |
2640 | 2640 | $open_tab = $tab_name; |
2641 | 2641 | $used_tabs[] = $tab_name; |
2642 | 2642 | } |
2643 | 2643 | |
2644 | - if($open_tab_groups == $tab_args['groups']){ |
|
2644 | + if ($open_tab_groups == $tab_args['groups']) { |
|
2645 | 2645 | //$open_tab = ''; |
2646 | 2646 | $close_tab = true; |
2647 | 2647 | $open_tab_groups = array(); |
2648 | 2648 | |
2649 | 2649 | // print_r(array_keys($this->options['block_group_tabs']));echo '####';print_r($used_tabs); |
2650 | - if($used_tabs == array_keys($this->options['block_group_tabs'])){ |
|
2650 | + if ($used_tabs == array_keys($this->options['block_group_tabs'])) { |
|
2651 | 2651 | // echo '@@@'; |
2652 | 2652 | $close_tabs = true; |
2653 | 2653 | } |
@@ -2663,8 +2663,8 @@ discard block |
||
2663 | 2663 | |
2664 | 2664 | ?> |
2665 | 2665 | el(wp.components.PanelBody, { |
2666 | - title: '<?php esc_attr_e( $key ); ?>', |
|
2667 | - initialOpen: <?php if ( $panel_count ) { |
|
2666 | + title: '<?php esc_attr_e($key); ?>', |
|
2667 | + initialOpen: <?php if ($panel_count) { |
|
2668 | 2668 | echo "false"; |
2669 | 2669 | } else { |
2670 | 2670 | echo "true"; |
@@ -2674,21 +2674,21 @@ discard block |
||
2674 | 2674 | |
2675 | 2675 | |
2676 | 2676 | |
2677 | - foreach ( $args as $k => $a ) { |
|
2677 | + foreach ($args as $k => $a) { |
|
2678 | 2678 | |
2679 | - $this->block_tab_start( $k, $a ); |
|
2680 | - $this->block_row_start( $k, $a ); |
|
2681 | - $this->build_block_arguments( $k, $a ); |
|
2682 | - $this->block_row_end( $k, $a ); |
|
2683 | - $this->block_tab_end( $k, $a ); |
|
2679 | + $this->block_tab_start($k, $a); |
|
2680 | + $this->block_row_start($k, $a); |
|
2681 | + $this->build_block_arguments($k, $a); |
|
2682 | + $this->block_row_end($k, $a); |
|
2683 | + $this->block_tab_end($k, $a); |
|
2684 | 2684 | } |
2685 | 2685 | ?> |
2686 | 2686 | ), |
2687 | 2687 | <?php |
2688 | - $panel_count ++; |
|
2688 | + $panel_count++; |
|
2689 | 2689 | |
2690 | 2690 | |
2691 | - if($close_tab || $close_tabs){ |
|
2691 | + if ($close_tab || $close_tabs) { |
|
2692 | 2692 | $tab_args = array( |
2693 | 2693 | 'tab' => array( |
2694 | 2694 | 'tabs_close' => $close_tabs, |
@@ -2696,24 +2696,24 @@ discard block |
||
2696 | 2696 | ) |
2697 | 2697 | |
2698 | 2698 | ); |
2699 | - $this->block_tab_end( '', $tab_args ); |
|
2699 | + $this->block_tab_end('', $tab_args); |
|
2700 | 2700 | // echo '###close'; print_r($tab_args); |
2701 | 2701 | $panel_count = 0; |
2702 | 2702 | } |
2703 | 2703 | // |
2704 | 2704 | |
2705 | 2705 | } |
2706 | - }else { |
|
2706 | + } else { |
|
2707 | 2707 | ?> |
2708 | 2708 | el(wp.components.PanelBody, { |
2709 | - title: '<?php esc_attr_e( "Settings" ); ?>', |
|
2709 | + title: '<?php esc_attr_e("Settings"); ?>', |
|
2710 | 2710 | initialOpen: true |
2711 | 2711 | }, |
2712 | 2712 | <?php |
2713 | - foreach ( $this->arguments as $key => $args ) { |
|
2714 | - $this->block_row_start( $key, $args ); |
|
2715 | - $this->build_block_arguments( $key, $args ); |
|
2716 | - $this->block_row_end( $key, $args ); |
|
2713 | + foreach ($this->arguments as $key => $args) { |
|
2714 | + $this->block_row_start($key, $args); |
|
2715 | + $this->build_block_arguments($key, $args); |
|
2716 | + $this->block_row_end($key, $args); |
|
2717 | 2717 | } |
2718 | 2718 | ?> |
2719 | 2719 | ), |
@@ -2727,11 +2727,11 @@ discard block |
||
2727 | 2727 | |
2728 | 2728 | <?php |
2729 | 2729 | // If the user sets block-output array then build it |
2730 | - if ( ! empty( $this->options['block-output'] ) ) { |
|
2731 | - $this->block_element( $this->options['block-output'] ); |
|
2732 | - }elseif(!empty($this->options['block-edit-return'])){ |
|
2730 | + if (!empty($this->options['block-output'])) { |
|
2731 | + $this->block_element($this->options['block-output']); |
|
2732 | + }elseif (!empty($this->options['block-edit-return'])) { |
|
2733 | 2733 | echo $this->options['block-edit-return']; |
2734 | - }else{ |
|
2734 | + } else { |
|
2735 | 2735 | // if no block-output is set then we try and get the shortcode html output via ajax. |
2736 | 2736 | ?> |
2737 | 2737 | el('div', wp.blockEditor.useBlockProps({ |
@@ -2756,22 +2756,22 @@ discard block |
||
2756 | 2756 | var align = ''; |
2757 | 2757 | |
2758 | 2758 | // build the shortcode. |
2759 | - var content = "[<?php echo $this->options['base_id'];?>"; |
|
2759 | + var content = "[<?php echo $this->options['base_id']; ?>"; |
|
2760 | 2760 | $html = ''; |
2761 | 2761 | <?php |
2762 | 2762 | |
2763 | - if(! empty( $this->arguments )){ |
|
2763 | + if (!empty($this->arguments)) { |
|
2764 | 2764 | |
2765 | - foreach($this->arguments as $key => $args){ |
|
2765 | + foreach ($this->arguments as $key => $args) { |
|
2766 | 2766 | // if($args['type']=='tabs'){continue;} |
2767 | 2767 | ?> |
2768 | - if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) { |
|
2769 | - if ('<?php echo esc_attr( $key );?>' == 'html') { |
|
2770 | - $html = attr.<?php echo esc_attr( $key );?>; |
|
2771 | - } else if ('<?php echo esc_attr( $args['type'] );?>' == 'image_xy') { |
|
2772 | - content += " <?php echo esc_attr( $key );?>='{x:" + attr.<?php echo esc_attr( $key );?>.x + ",y:"+attr.<?php echo esc_attr( $key );?>.y +"}' "; |
|
2768 | + if (attr.hasOwnProperty("<?php echo esc_attr($key); ?>")) { |
|
2769 | + if ('<?php echo esc_attr($key); ?>' == 'html') { |
|
2770 | + $html = attr.<?php echo esc_attr($key); ?>; |
|
2771 | + } else if ('<?php echo esc_attr($args['type']); ?>' == 'image_xy') { |
|
2772 | + content += " <?php echo esc_attr($key); ?>='{x:" + attr.<?php echo esc_attr($key); ?>.x + ",y:"+attr.<?php echo esc_attr($key); ?>.y +"}' "; |
|
2773 | 2773 | } else { |
2774 | - content += " <?php echo esc_attr( $key );?>='" + attr.<?php echo esc_attr( $key );?>+ "' "; |
|
2774 | + content += " <?php echo esc_attr($key); ?>='" + attr.<?php echo esc_attr($key); ?>+ "' "; |
|
2775 | 2775 | } |
2776 | 2776 | } |
2777 | 2777 | <?php |
@@ -2790,7 +2790,7 @@ discard block |
||
2790 | 2790 | ?> |
2791 | 2791 | // if has html element |
2792 | 2792 | if ($html) { |
2793 | - content += $html + "[/<?php echo $this->options['base_id'];?>]"; |
|
2793 | + content += $html + "[/<?php echo $this->options['base_id']; ?>]"; |
|
2794 | 2794 | } |
2795 | 2795 | |
2796 | 2796 | // @todo should we add inline style here or just css classes? |
@@ -2820,7 +2820,7 @@ discard block |
||
2820 | 2820 | // <x?php |
2821 | 2821 | // }else |
2822 | 2822 | |
2823 | - if(!empty($this->options['block-output'])){ |
|
2823 | + if (!empty($this->options['block-output'])) { |
|
2824 | 2824 | // echo "return"; |
2825 | 2825 | // $this->block_element( $this->options['block-output'], true ); |
2826 | 2826 | // echo ";"; |
@@ -2830,30 +2830,30 @@ discard block |
||
2830 | 2830 | '', |
2831 | 2831 | {}, |
2832 | 2832 | el('', {dangerouslySetInnerHTML: {__html: content}}), |
2833 | - <?php $this->block_element( $this->options['block-output'], true ); ?> |
|
2834 | - el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}}) |
|
2833 | + <?php $this->block_element($this->options['block-output'], true); ?> |
|
2834 | + el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id']; ?>]"}}) |
|
2835 | 2835 | ); |
2836 | 2836 | <?php |
2837 | 2837 | |
2838 | - }elseif(!empty($this->options['block-save-return'])){ |
|
2838 | + }elseif (!empty($this->options['block-save-return'])) { |
|
2839 | 2839 | echo 'return ' . $this->options['block-save-return']; |
2840 | - }elseif(!empty($this->options['nested-block'])){ |
|
2840 | + }elseif (!empty($this->options['nested-block'])) { |
|
2841 | 2841 | ?> |
2842 | 2842 | return el( |
2843 | 2843 | '', |
2844 | 2844 | {}, |
2845 | 2845 | el('', {dangerouslySetInnerHTML: {__html: content+"\n"}}), |
2846 | 2846 | InnerBlocks.Content ? el( InnerBlocks.Content ) : '', // @todo i think we need a comma here |
2847 | - el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}}) |
|
2847 | + el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id']; ?>]"}}) |
|
2848 | 2848 | ); |
2849 | 2849 | <?php |
2850 | - }elseif(!empty( $this->options['block-save-return'] ) ){ |
|
2851 | - echo "return ". $this->options['block-edit-return'].";"; |
|
2852 | - }elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){ |
|
2850 | + }elseif (!empty($this->options['block-save-return'])) { |
|
2851 | + echo "return " . $this->options['block-edit-return'] . ";"; |
|
2852 | + }elseif (isset($this->options['block-wrap']) && $this->options['block-wrap'] == '') { |
|
2853 | 2853 | ?> |
2854 | 2854 | return content; |
2855 | 2855 | <?php |
2856 | - }else{ |
|
2856 | + } else { |
|
2857 | 2857 | ?> |
2858 | 2858 | var block_wrap = 'div'; |
2859 | 2859 | if (attr.hasOwnProperty("block_wrap")) { |
@@ -2882,48 +2882,48 @@ discard block |
||
2882 | 2882 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
2883 | 2883 | */ |
2884 | 2884 | |
2885 | - return str_replace( array( |
|
2885 | + return str_replace(array( |
|
2886 | 2886 | '<script>', |
2887 | 2887 | '</script>' |
2888 | - ), '', $output ); |
|
2888 | + ), '', $output); |
|
2889 | 2889 | } |
2890 | 2890 | |
2891 | 2891 | |
2892 | 2892 | |
2893 | - public function block_row_start($key, $args){ |
|
2893 | + public function block_row_start($key, $args) { |
|
2894 | 2894 | |
2895 | 2895 | // check for row |
2896 | - if(!empty($args['row'])){ |
|
2896 | + if (!empty($args['row'])) { |
|
2897 | 2897 | |
2898 | - if(!empty($args['row']['open'])){ |
|
2898 | + if (!empty($args['row']['open'])) { |
|
2899 | 2899 | |
2900 | 2900 | // element require |
2901 | - $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : ""; |
|
2902 | - $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : ''; |
|
2903 | - $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; |
|
2901 | + $element_require = !empty($args['element_require']) ? $this->block_props_replace($args['element_require'], true) . " && " : ""; |
|
2902 | + $device_type = !empty($args['device_type']) ? esc_attr($args['device_type']) : ''; |
|
2903 | + $device_type_require = !empty($args['device_type']) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; |
|
2904 | 2904 | $device_type_icon = ''; |
2905 | - if($device_type=='Desktop'){ |
|
2905 | + if ($device_type == 'Desktop') { |
|
2906 | 2906 | $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
2907 | - }elseif($device_type=='Tablet'){ |
|
2907 | + }elseif ($device_type == 'Tablet') { |
|
2908 | 2908 | $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
2909 | - }elseif($device_type=='Mobile'){ |
|
2909 | + }elseif ($device_type == 'Mobile') { |
|
2910 | 2910 | $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
2911 | 2911 | } |
2912 | 2912 | echo $element_require; |
2913 | 2913 | echo $device_type_require; |
2914 | 2914 | |
2915 | - if(false){?><script><?php }?> |
|
2915 | + if (false) {?><script><?php }?> |
|
2916 | 2916 | el('div', { |
2917 | 2917 | className: 'bsui components-base-control', |
2918 | 2918 | }, |
2919 | - <?php if(!empty($args['row']['title'])){ ?> |
|
2919 | + <?php if (!empty($args['row']['title'])) { ?> |
|
2920 | 2920 | el('label', { |
2921 | 2921 | className: 'components-base-control__label position-relative', |
2922 | 2922 | style: {width:"100%"} |
2923 | 2923 | }, |
2924 | - el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes( $args['row']['title'] ) ?>'}}), |
|
2925 | - <?php if($device_type_icon){ ?> |
|
2926 | - 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)"}}) |
|
2924 | + el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes($args['row']['title']) ?>'}}), |
|
2925 | + <?php if ($device_type_icon) { ?> |
|
2926 | + 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)"}}) |
|
2927 | 2927 | <?php |
2928 | 2928 | } |
2929 | 2929 | ?> |
@@ -2931,17 +2931,17 @@ discard block |
||
2931 | 2931 | |
2932 | 2932 | ), |
2933 | 2933 | <?php }?> |
2934 | - <?php if(!empty($args['row']['desc'])){ ?> |
|
2934 | + <?php if (!empty($args['row']['desc'])) { ?> |
|
2935 | 2935 | el('p', { |
2936 | 2936 | className: 'components-base-control__help mb-0', |
2937 | 2937 | }, |
2938 | - '<?php echo addslashes( $args['row']['desc'] ); ?>' |
|
2938 | + '<?php echo addslashes($args['row']['desc']); ?>' |
|
2939 | 2939 | ), |
2940 | 2940 | <?php }?> |
2941 | 2941 | el( |
2942 | 2942 | 'div', |
2943 | 2943 | { |
2944 | - className: 'row mb-n2 <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>', |
|
2944 | + className: 'row mb-n2 <?php if (!empty($args['row']['class'])) { echo esc_attr($args['row']['class']); } ?>', |
|
2945 | 2945 | }, |
2946 | 2946 | el( |
2947 | 2947 | 'div', |
@@ -2950,36 +2950,36 @@ discard block |
||
2950 | 2950 | }, |
2951 | 2951 | |
2952 | 2952 | <?php |
2953 | - if(false){?></script><?php } |
|
2954 | - }elseif(!empty($args['row']['close'])){ |
|
2955 | - if(false){?><script><?php }?> |
|
2953 | + if (false) {?></script><?php } |
|
2954 | + }elseif (!empty($args['row']['close'])) { |
|
2955 | + if (false) {?><script><?php }?> |
|
2956 | 2956 | el( |
2957 | 2957 | 'div', |
2958 | 2958 | { |
2959 | 2959 | className: 'col pl-0', |
2960 | 2960 | }, |
2961 | 2961 | <?php |
2962 | - if(false){?></script><?php } |
|
2963 | - }else{ |
|
2964 | - if(false){?><script><?php }?> |
|
2962 | + if (false) {?></script><?php } |
|
2963 | + } else { |
|
2964 | + if (false) {?><script><?php }?> |
|
2965 | 2965 | el( |
2966 | 2966 | 'div', |
2967 | 2967 | { |
2968 | 2968 | className: 'col pl-0 pr-2', |
2969 | 2969 | }, |
2970 | 2970 | <?php |
2971 | - if(false){?></script><?php } |
|
2971 | + if (false) {?></script><?php } |
|
2972 | 2972 | } |
2973 | 2973 | |
2974 | 2974 | } |
2975 | 2975 | |
2976 | 2976 | } |
2977 | 2977 | |
2978 | - public function block_row_end($key, $args){ |
|
2978 | + public function block_row_end($key, $args) { |
|
2979 | 2979 | |
2980 | - if(!empty($args['row'])){ |
|
2980 | + if (!empty($args['row'])) { |
|
2981 | 2981 | // maybe close |
2982 | - if(!empty($args['row']['close'])){ |
|
2982 | + if (!empty($args['row']['close'])) { |
|
2983 | 2983 | echo "))"; |
2984 | 2984 | } |
2985 | 2985 | |
@@ -2987,14 +2987,14 @@ discard block |
||
2987 | 2987 | } |
2988 | 2988 | } |
2989 | 2989 | |
2990 | - public function block_tab_start($key, $args){ |
|
2990 | + public function block_tab_start($key, $args) { |
|
2991 | 2991 | |
2992 | 2992 | // check for row |
2993 | - if(!empty($args['tab'])){ |
|
2993 | + if (!empty($args['tab'])) { |
|
2994 | 2994 | |
2995 | - if(!empty($args['tab']['tabs_open'])){ |
|
2995 | + if (!empty($args['tab']['tabs_open'])) { |
|
2996 | 2996 | |
2997 | - if(false){?><script><?php }?> |
|
2997 | + if (false) {?><script><?php }?> |
|
2998 | 2998 | |
2999 | 2999 | el('div',{className: 'bsui'}, |
3000 | 3000 | |
@@ -3003,41 +3003,41 @@ discard block |
||
3003 | 3003 | { |
3004 | 3004 | activeClass: 'is-active', |
3005 | 3005 | className: 'btn-groupx', |
3006 | - initialTabName: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>', |
|
3006 | + initialTabName: '<?php echo addslashes(esc_attr($args['tab']['key'])); ?>', |
|
3007 | 3007 | tabs: [ |
3008 | 3008 | |
3009 | 3009 | <?php |
3010 | - if(false){?></script><?php } |
|
3010 | + if (false) {?></script><?php } |
|
3011 | 3011 | } |
3012 | 3012 | |
3013 | - if(!empty($args['tab']['open'])){ |
|
3013 | + if (!empty($args['tab']['open'])) { |
|
3014 | 3014 | |
3015 | - if(false){?><script><?php }?> |
|
3015 | + if (false) {?><script><?php }?> |
|
3016 | 3016 | { |
3017 | - name: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>', |
|
3018 | - title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes( esc_attr( $args['tab']['title']) ); ?>'}}), |
|
3019 | - className: '<?php echo addslashes( esc_attr( $args['tab']['class']) ); ?>', |
|
3020 | - content: el('div',{}, <?php if(!empty($args['tab']['desc'])){ ?>el('p', { |
|
3017 | + name: '<?php echo addslashes(esc_attr($args['tab']['key'])); ?>', |
|
3018 | + title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes(esc_attr($args['tab']['title'])); ?>'}}), |
|
3019 | + className: '<?php echo addslashes(esc_attr($args['tab']['class'])); ?>', |
|
3020 | + content: el('div',{}, <?php if (!empty($args['tab']['desc'])) { ?>el('p', { |
|
3021 | 3021 | className: 'components-base-control__help mb-0', |
3022 | - dangerouslySetInnerHTML: {__html:'<?php echo addslashes( $args['tab']['desc'] ); ?>'} |
|
3022 | + dangerouslySetInnerHTML: {__html:'<?php echo addslashes($args['tab']['desc']); ?>'} |
|
3023 | 3023 | }),<?php } |
3024 | - if(false){?></script><?php } |
|
3024 | + if (false) {?></script><?php } |
|
3025 | 3025 | } |
3026 | 3026 | |
3027 | 3027 | } |
3028 | 3028 | |
3029 | 3029 | } |
3030 | 3030 | |
3031 | - public function block_tab_end($key, $args){ |
|
3031 | + public function block_tab_end($key, $args) { |
|
3032 | 3032 | |
3033 | - if(!empty($args['tab'])){ |
|
3033 | + if (!empty($args['tab'])) { |
|
3034 | 3034 | // maybe close |
3035 | - if(!empty($args['tab']['close'])){ |
|
3035 | + if (!empty($args['tab']['close'])) { |
|
3036 | 3036 | echo ")}, /* tab close */"; |
3037 | 3037 | } |
3038 | 3038 | |
3039 | - if(!empty($args['tab']['tabs_close'])){ |
|
3040 | - if(false){?><script><?php }?> |
|
3039 | + if (!empty($args['tab']['tabs_close'])) { |
|
3040 | + if (false) {?><script><?php }?> |
|
3041 | 3041 | ], |
3042 | 3042 | }, |
3043 | 3043 | ( tab ) => { |
@@ -3046,42 +3046,42 @@ discard block |
||
3046 | 3046 | |
3047 | 3047 | } |
3048 | 3048 | )), /* tabs close */ |
3049 | - <?php if(false){ ?></script><?php } |
|
3049 | + <?php if (false) { ?></script><?php } |
|
3050 | 3050 | } |
3051 | 3051 | } |
3052 | 3052 | } |
3053 | 3053 | |
3054 | - public function build_block_arguments( $key, $args ) { |
|
3055 | - $custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : ''; |
|
3054 | + public function build_block_arguments($key, $args) { |
|
3055 | + $custom_attributes = !empty($args['custom_attributes']) ? $this->array_to_attributes($args['custom_attributes']) : ''; |
|
3056 | 3056 | $options = ''; |
3057 | 3057 | $extra = ''; |
3058 | 3058 | $require = ''; |
3059 | - $inside_elements = ''; |
|
3059 | + $inside_elements = ''; |
|
3060 | 3060 | $after_elements = ''; |
3061 | 3061 | |
3062 | 3062 | // `content` is a protected and special argument |
3063 | - if ( $key == 'content' ) { |
|
3063 | + if ($key == 'content') { |
|
3064 | 3064 | return; |
3065 | 3065 | } |
3066 | 3066 | |
3067 | - $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : ''; |
|
3068 | - $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; |
|
3067 | + $device_type = !empty($args['device_type']) ? esc_attr($args['device_type']) : ''; |
|
3068 | + $device_type_require = !empty($args['device_type']) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; |
|
3069 | 3069 | $device_type_icon = ''; |
3070 | - if($device_type=='Desktop'){ |
|
3070 | + if ($device_type == 'Desktop') { |
|
3071 | 3071 | $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
3072 | - }elseif($device_type=='Tablet'){ |
|
3072 | + }elseif ($device_type == 'Tablet') { |
|
3073 | 3073 | $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
3074 | - }elseif($device_type=='Mobile'){ |
|
3074 | + }elseif ($device_type == 'Mobile') { |
|
3075 | 3075 | $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
3076 | 3076 | } |
3077 | 3077 | |
3078 | 3078 | // icon |
3079 | 3079 | $icon = ''; |
3080 | - if( !empty( $args['icon'] ) ){ |
|
3080 | + if (!empty($args['icon'])) { |
|
3081 | 3081 | $icon .= "el('div', {"; |
3082 | - $icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},"; |
|
3082 | + $icon .= "dangerouslySetInnerHTML: {__html: '" . self::get_widget_icon(esc_attr($args['icon'])) . "'},"; |
|
3083 | 3083 | $icon .= "className: 'text-center',"; |
3084 | - $icon .= "title: '".addslashes( $args['title'] )."',"; |
|
3084 | + $icon .= "title: '" . addslashes($args['title']) . "',"; |
|
3085 | 3085 | $icon .= "}),"; |
3086 | 3086 | |
3087 | 3087 | // blank title as its added to the icon. |
@@ -3089,28 +3089,28 @@ discard block |
||
3089 | 3089 | } |
3090 | 3090 | |
3091 | 3091 | // require advanced |
3092 | - $require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : ""; |
|
3092 | + $require_advanced = !empty($args['advanced']) ? "props.attributes.show_advanced && " : ""; |
|
3093 | 3093 | |
3094 | 3094 | // element require |
3095 | - $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : ""; |
|
3095 | + $element_require = !empty($args['element_require']) ? $this->block_props_replace($args['element_require'], true) . " && " : ""; |
|
3096 | 3096 | |
3097 | 3097 | |
3098 | 3098 | $onchange = "props.setAttributes({ $key: $key } )"; |
3099 | - $onchangecomplete = ""; |
|
3099 | + $onchangecomplete = ""; |
|
3100 | 3100 | $value = "props.attributes.$key"; |
3101 | - $text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' ); |
|
3102 | - if ( in_array( $args['type'], $text_type ) ) { |
|
3101 | + $text_type = array('text', 'password', 'number', 'email', 'tel', 'url', 'colorx', 'range'); |
|
3102 | + if (in_array($args['type'], $text_type)) { |
|
3103 | 3103 | $type = 'TextControl'; |
3104 | 3104 | // Save numbers as numbers and not strings |
3105 | - if ( $args['type'] == 'number' ) { |
|
3105 | + if ($args['type'] == 'number') { |
|
3106 | 3106 | $onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )"; |
3107 | 3107 | } |
3108 | - }else if ( $args['type'] == 'styleid' ) { |
|
3108 | + } else if ($args['type'] == 'styleid') { |
|
3109 | 3109 | $type = 'TextControl'; |
3110 | 3110 | $args['type'] == 'text'; |
3111 | 3111 | // Save numbers as numbers and not strings |
3112 | - $value = "props.attributes.$key ? props.attributes.$key : 'aaabbbccc'"; |
|
3113 | - }else if ( $args['type'] == 'notice' ) { |
|
3112 | + $value = "props.attributes.$key ? props.attributes.$key : 'aaabbbccc'"; |
|
3113 | + } else if ($args['type'] == 'notice') { |
|
3114 | 3114 | |
3115 | 3115 | $notice_message = !empty($args['desc']) ? addslashes($args['desc']) : ''; |
3116 | 3116 | $notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info'; |
@@ -3172,11 +3172,11 @@ discard block |
||
3172 | 3172 | return; |
3173 | 3173 | } |
3174 | 3174 | */ |
3175 | - elseif ( $args['type'] == 'color' ) { |
|
3175 | + elseif ($args['type'] == 'color') { |
|
3176 | 3176 | $type = 'ColorPicker'; |
3177 | 3177 | $onchange = ""; |
3178 | 3178 | $extra = "color: $value,"; |
3179 | - if(!empty($args['disable_alpha'])){ |
|
3179 | + if (!empty($args['disable_alpha'])) { |
|
3180 | 3180 | $extra .= "disableAlpha: true,"; |
3181 | 3181 | } |
3182 | 3182 | $onchangecomplete = "onChangeComplete: function($key) { |
@@ -3185,14 +3185,14 @@ discard block |
||
3185 | 3185 | $key: value |
3186 | 3186 | }); |
3187 | 3187 | },"; |
3188 | - }elseif ( $args['type'] == 'gradient' ) { |
|
3188 | + }elseif ($args['type'] == 'gradient') { |
|
3189 | 3189 | $type = 'GradientPicker'; |
3190 | 3190 | |
3191 | - }elseif ( $args['type'] == 'image' ) { |
|
3191 | + }elseif ($args['type'] == 'image') { |
|
3192 | 3192 | // print_r($args); |
3193 | 3193 | |
3194 | 3194 | $img_preview = isset($args['focalpoint']) && !$args['focalpoint'] ? " props.attributes.$key && el('img', { src: props.attributes.$key,style: {maxWidth:'100%',background: '#ccc'}})," : " ( props.attributes.$key || props.attributes.{$key}_use_featured ) && el(wp.components.FocalPointPicker,{ |
3195 | - url: props.attributes.{$key}_use_featured === true ? '".$this->get_url()."icons/placeholder.png' : props.attributes.$key, |
|
3195 | + url: props.attributes.{$key}_use_featured === true ? '" . $this->get_url() . "icons/placeholder.png' : props.attributes.$key, |
|
3196 | 3196 | value: props.attributes.{$key}_xy.x !== undefined && props.attributes.{$key}_xy.x >= 0 ? props.attributes.{$key}_xy : {x: 0.5,y: 0.5,}, |
3197 | 3197 | // value: props.attributes.{$key}_xy, |
3198 | 3198 | onChange: function(focalPoint){ |
@@ -3250,7 +3250,7 @@ discard block |
||
3250 | 3250 | $onchange = ""; |
3251 | 3251 | |
3252 | 3252 | //$inside_elements = ",el('div',{},'file upload')"; |
3253 | - }elseif ( $args['type'] == 'images' ) { |
|
3253 | + }elseif ($args['type'] == 'images') { |
|
3254 | 3254 | // print_r($args); |
3255 | 3255 | |
3256 | 3256 | $img_preview = "props.attributes.$key && (function() { |
@@ -3262,7 +3262,7 @@ discard block |
||
3262 | 3262 | images.push( el('div',{className: 'col p-2',draggable: 'true','data-index': index}, el('img', { src: upload.sizes.thumbnail.url,style: {maxWidth:'100%',background: '#ccc',pointerEvents:'none'}}),el('i',{ |
3263 | 3263 | className: 'fas fa-times-circle text-danger position-absolute ml-n2 mt-n1 bg-white rounded-circle c-pointer', |
3264 | 3264 | onClick: function(){ |
3265 | - aui_confirm('".__('Are you sure?')."', '".__('Delete')."', '".__('Cancel')."', true).then(function(confirmed) { |
|
3265 | + aui_confirm('" . __('Are you sure?') . "', '" . __('Delete') . "', '" . __('Cancel') . "', true).then(function(confirmed) { |
|
3266 | 3266 | if (confirmed) { |
3267 | 3267 | let new_uploads = JSON.parse(props.attributes.$key); |
3268 | 3268 | new_uploads.splice(index, 1); //remove |
@@ -3336,36 +3336,36 @@ discard block |
||
3336 | 3336 | |
3337 | 3337 | //$inside_elements = ",el('div',{},'file upload')"; |
3338 | 3338 | } |
3339 | - elseif ( $args['type'] == 'checkbox' ) { |
|
3339 | + elseif ($args['type'] == 'checkbox') { |
|
3340 | 3340 | $type = 'CheckboxControl'; |
3341 | 3341 | $extra .= "checked: props.attributes.$key,"; |
3342 | 3342 | $onchange = "props.setAttributes({ $key: ! props.attributes.$key } )"; |
3343 | - } elseif ( $args['type'] == 'textarea' ) { |
|
3343 | + } elseif ($args['type'] == 'textarea') { |
|
3344 | 3344 | $type = 'TextareaControl'; |
3345 | 3345 | |
3346 | - } elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) { |
|
3346 | + } elseif ($args['type'] == 'select' || $args['type'] == 'multiselect') { |
|
3347 | 3347 | $type = 'SelectControl'; |
3348 | 3348 | |
3349 | - if($args['name'] == 'category' && !empty($args['post_type_linked'])){ |
|
3350 | - $options .= "options: taxonomies_".str_replace("-","_", $this->id).","; |
|
3351 | - }elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){ |
|
3352 | - $options .= "options: sort_by_".str_replace("-","_", $this->id).","; |
|
3353 | - }else { |
|
3349 | + if ($args['name'] == 'category' && !empty($args['post_type_linked'])) { |
|
3350 | + $options .= "options: taxonomies_" . str_replace("-", "_", $this->id) . ","; |
|
3351 | + }elseif ($args['name'] == 'sort_by' && !empty($args['post_type_linked'])) { |
|
3352 | + $options .= "options: sort_by_" . str_replace("-", "_", $this->id) . ","; |
|
3353 | + } else { |
|
3354 | 3354 | |
3355 | - if ( ! empty( $args['options'] ) ) { |
|
3355 | + if (!empty($args['options'])) { |
|
3356 | 3356 | $options .= "options: ["; |
3357 | - foreach ( $args['options'] as $option_val => $option_label ) { |
|
3358 | - $options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . addslashes( $option_label ) . "' },"; |
|
3357 | + foreach ($args['options'] as $option_val => $option_label) { |
|
3358 | + $options .= "{ value: '" . esc_attr($option_val) . "', label: '" . addslashes($option_label) . "' },"; |
|
3359 | 3359 | } |
3360 | 3360 | $options .= "],"; |
3361 | 3361 | } |
3362 | 3362 | } |
3363 | - if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550 |
|
3363 | + if (isset($args['multiple']) && $args['multiple']) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550 |
|
3364 | 3364 | $extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, '; |
3365 | 3365 | } |
3366 | 3366 | |
3367 | - if($args['type'] == 'multiselect' || ( isset( $args['multiple'] ) && $args['multiple'] ) ){ |
|
3368 | - $after_elements .= "props.attributes.$key && el( wp.components.Button, { |
|
3367 | + if ($args['type'] == 'multiselect' || (isset($args['multiple']) && $args['multiple'])) { |
|
3368 | + $after_elements .= "props.attributes.$key && el( wp.components.Button, { |
|
3369 | 3369 | className: 'components-button components-circular-option-picker__clear is-secondary is-small', |
3370 | 3370 | style: {margin:'-8px 0 8px 0',display: 'block'}, |
3371 | 3371 | onClick: function(){ |
@@ -3377,7 +3377,7 @@ discard block |
||
3377 | 3377 | 'Clear' |
3378 | 3378 | ),"; |
3379 | 3379 | } |
3380 | - } elseif ( $args['type'] == 'tagselect' ) { |
|
3380 | + } elseif ($args['type'] == 'tagselect') { |
|
3381 | 3381 | // $type = 'FormTokenField'; |
3382 | 3382 | // |
3383 | 3383 | // if ( ! empty( $args['options'] ) ) { |
@@ -3412,23 +3412,23 @@ discard block |
||
3412 | 3412 | // $value = "[]"; |
3413 | 3413 | // $extra .= ' __experimentalExpandOnFocus: true,'; |
3414 | 3414 | |
3415 | - } elseif ( $args['type'] == 'alignment' ) { |
|
3415 | + } elseif ($args['type'] == 'alignment') { |
|
3416 | 3416 | $type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example |
3417 | - }elseif ( $args['type'] == 'margins' ) { |
|
3417 | + }elseif ($args['type'] == 'margins') { |
|
3418 | 3418 | |
3419 | 3419 | } else { |
3420 | - return;// if we have not implemented the control then don't break the JS. |
|
3420 | + return; // if we have not implemented the control then don't break the JS. |
|
3421 | 3421 | } |
3422 | 3422 | |
3423 | 3423 | |
3424 | 3424 | |
3425 | 3425 | // color input does not show the labels so we add them |
3426 | - if($args['type']=='color'){ |
|
3426 | + if ($args['type'] == 'color') { |
|
3427 | 3427 | // add show only if advanced |
3428 | 3428 | echo $require_advanced; |
3429 | 3429 | // add setting require if defined |
3430 | 3430 | echo $element_require; |
3431 | - echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),"; |
|
3431 | + echo "el('div', {style: {'marginBottom': '8px'}}, '" . addslashes($args['title']) . "'),"; |
|
3432 | 3432 | } |
3433 | 3433 | |
3434 | 3434 | // add show only if advanced |
@@ -3440,18 +3440,18 @@ discard block |
||
3440 | 3440 | // icon |
3441 | 3441 | echo $icon; |
3442 | 3442 | ?> |
3443 | - el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type : "wp.components.".$type; ?>, { |
|
3443 | + el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type : "wp.components." . $type; ?>, { |
|
3444 | 3444 | label: <?php |
3445 | - if(empty($args['title'])){ |
|
3445 | + if (empty($args['title'])) { |
|
3446 | 3446 | echo "''"; |
3447 | - }elseif(empty($args['row']) && !empty($args['device_type'])){ |
|
3447 | + }elseif (empty($args['row']) && !empty($args['device_type'])) { |
|
3448 | 3448 | ?>el('label', { |
3449 | 3449 | className: 'components-base-control__label', |
3450 | 3450 | style: {width:"100%"} |
3451 | 3451 | }, |
3452 | - el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes( $args['title'] ) ?>'}}), |
|
3453 | - <?php if($device_type_icon){ ?> |
|
3454 | - 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)"}}) |
|
3452 | + el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes($args['title']) ?>'}}), |
|
3453 | + <?php if ($device_type_icon) { ?> |
|
3454 | + 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)"}}) |
|
3455 | 3455 | <?php |
3456 | 3456 | } |
3457 | 3457 | ?> |
@@ -3459,27 +3459,27 @@ discard block |
||
3459 | 3459 | |
3460 | 3460 | )<?php |
3461 | 3461 | |
3462 | - }else{ |
|
3463 | - ?>'<?php echo addslashes( $args['title'] ); ?>'<?php |
|
3462 | + } else { |
|
3463 | + ?>'<?php echo addslashes($args['title']); ?>'<?php |
|
3464 | 3464 | |
3465 | 3465 | } |
3466 | 3466 | |
3467 | 3467 | ?>, |
3468 | - help: <?php if ( isset( $args['desc'] ) ) { |
|
3469 | - echo "el('span',{dangerouslySetInnerHTML: {__html: '".wp_kses_post( addslashes($args['desc']) )."'}})"; |
|
3470 | - }else{ echo "''"; } ?>, |
|
3468 | + help: <?php if (isset($args['desc'])) { |
|
3469 | + echo "el('span',{dangerouslySetInnerHTML: {__html: '" . wp_kses_post(addslashes($args['desc'])) . "'}})"; |
|
3470 | + } else { echo "''"; } ?>, |
|
3471 | 3471 | value: <?php echo $value; ?>, |
3472 | - <?php if ( $type == 'TextControl' && $args['type'] != 'text' ) { |
|
3473 | - echo "type: '" . addslashes( $args['type'] ) . "',"; |
|
3472 | + <?php if ($type == 'TextControl' && $args['type'] != 'text') { |
|
3473 | + echo "type: '" . addslashes($args['type']) . "',"; |
|
3474 | 3474 | } ?> |
3475 | - <?php if ( ! empty( $args['placeholder'] ) ) { |
|
3476 | - echo "placeholder: '" . addslashes( $args['placeholder'] ) . "',"; |
|
3475 | + <?php if (!empty($args['placeholder'])) { |
|
3476 | + echo "placeholder: '" . addslashes($args['placeholder']) . "',"; |
|
3477 | 3477 | } ?> |
3478 | 3478 | <?php echo $options; ?> |
3479 | 3479 | <?php echo $extra; ?> |
3480 | 3480 | <?php echo $custom_attributes; ?> |
3481 | 3481 | <?php echo $onchangecomplete; |
3482 | - if($onchange){ |
|
3482 | + if ($onchange) { |
|
3483 | 3483 | ?> |
3484 | 3484 | onChange: function ( <?php echo $key; ?> ) { |
3485 | 3485 | <?php echo $onchange; ?> |
@@ -3500,15 +3500,15 @@ discard block |
||
3500 | 3500 | *@todo there is prob a faster way to do this, also we could add some validation here. |
3501 | 3501 | * |
3502 | 3502 | */ |
3503 | - public function array_to_attributes( $custom_attributes, $html = false ) { |
|
3503 | + public function array_to_attributes($custom_attributes, $html = false) { |
|
3504 | 3504 | $attributes = ''; |
3505 | - if ( ! empty( $custom_attributes ) ) { |
|
3505 | + if (!empty($custom_attributes)) { |
|
3506 | 3506 | |
3507 | - foreach ( $custom_attributes as $key => $val ) { |
|
3508 | - if(is_array($val)){ |
|
3509 | - $attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},'; |
|
3510 | - }else{ |
|
3511 | - $attributes .= $html ? " $key='$val' " : "'$key': '$val',"; |
|
3507 | + foreach ($custom_attributes as $key => $val) { |
|
3508 | + if (is_array($val)) { |
|
3509 | + $attributes .= $key . ': {' . $this->array_to_attributes($val, $html) . '},'; |
|
3510 | + } else { |
|
3511 | + $attributes .= $html ? " $key='$val' " : "'$key': '$val',"; |
|
3512 | 3512 | } |
3513 | 3513 | } |
3514 | 3514 | |
@@ -3526,112 +3526,112 @@ discard block |
||
3526 | 3526 | * |
3527 | 3527 | * @param $args |
3528 | 3528 | */ |
3529 | - public function block_element( $args, $save = false ) { |
|
3529 | + public function block_element($args, $save = false) { |
|
3530 | 3530 | |
3531 | 3531 | |
3532 | - if ( ! empty( $args ) ) { |
|
3533 | - foreach ( $args as $element => $new_args ) { |
|
3532 | + if (!empty($args)) { |
|
3533 | + foreach ($args as $element => $new_args) { |
|
3534 | 3534 | |
3535 | - if ( is_array( $new_args ) ) { // its an element |
|
3535 | + if (is_array($new_args)) { // its an element |
|
3536 | 3536 | |
3537 | 3537 | |
3538 | - if ( isset( $new_args['element'] ) ) { |
|
3538 | + if (isset($new_args['element'])) { |
|
3539 | 3539 | |
3540 | - if ( isset( $new_args['element_require'] ) ) { |
|
3541 | - echo str_replace( array( |
|
3540 | + if (isset($new_args['element_require'])) { |
|
3541 | + echo str_replace(array( |
|
3542 | 3542 | "'+", |
3543 | 3543 | "+'" |
3544 | - ), '', $this->block_props_replace( $new_args['element_require'] ) ) . " && "; |
|
3545 | - unset( $new_args['element_require'] ); |
|
3544 | + ), '', $this->block_props_replace($new_args['element_require'])) . " && "; |
|
3545 | + unset($new_args['element_require']); |
|
3546 | 3546 | } |
3547 | 3547 | |
3548 | - if($new_args['element']=='InnerBlocks'){ |
|
3548 | + if ($new_args['element'] == 'InnerBlocks') { |
|
3549 | 3549 | echo "\n el( InnerBlocks, {"; |
3550 | - }elseif($new_args['element']=='innerBlocksProps'){ |
|
3550 | + }elseif ($new_args['element'] == 'innerBlocksProps') { |
|
3551 | 3551 | $element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div'; |
3552 | 3552 | // echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {"; |
3553 | 3553 | // echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( "; |
3554 | 3554 | echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( "; |
3555 | 3555 | echo $save ? "wp.blockEditor.useBlockProps.save( {" : "wp.blockEditor.useBlockProps( {"; |
3556 | - echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : ''; |
|
3556 | + echo !empty($new_args['blockProps']) ? $this->block_element($new_args['blockProps'], $save) : ''; |
|
3557 | 3557 | |
3558 | 3558 | echo "} ), {"; |
3559 | - echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element( $new_args['innerBlocksProps'],$save ) : ''; |
|
3559 | + echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element($new_args['innerBlocksProps'], $save) : ''; |
|
3560 | 3560 | // echo '###'; |
3561 | 3561 | |
3562 | 3562 | // echo '###'; |
3563 | - }elseif($new_args['element']=='BlocksProps'){ |
|
3563 | + }elseif ($new_args['element'] == 'BlocksProps') { |
|
3564 | 3564 | |
3565 | - if ( isset($new_args['if_inner_element']) ) { |
|
3565 | + if (isset($new_args['if_inner_element'])) { |
|
3566 | 3566 | $element = $new_args['if_inner_element']; |
3567 | - }else { |
|
3568 | - $element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'"; |
|
3567 | + } else { |
|
3568 | + $element = isset($new_args['inner_element']) ? "'" . esc_attr($new_args['inner_element']) . "'" : "'div'"; |
|
3569 | 3569 | } |
3570 | 3570 | |
3571 | 3571 | unset($new_args['inner_element']); |
3572 | 3572 | echo $save ? "\n el( $element, wp.blockEditor.useBlockProps.save( {" : "\n el( $element, wp.blockEditor.useBlockProps( {"; |
3573 | - echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : ''; |
|
3573 | + echo !empty($new_args['blockProps']) ? $this->block_element($new_args['blockProps'], $save) : ''; |
|
3574 | 3574 | |
3575 | 3575 | |
3576 | 3576 | // echo "} ),"; |
3577 | 3577 | |
3578 | - }else{ |
|
3578 | + } else { |
|
3579 | 3579 | echo "\n el( '" . $new_args['element'] . "', {"; |
3580 | 3580 | } |
3581 | 3581 | |
3582 | 3582 | |
3583 | 3583 | // get the attributes |
3584 | - foreach ( $new_args as $new_key => $new_value ) { |
|
3584 | + foreach ($new_args as $new_key => $new_value) { |
|
3585 | 3585 | |
3586 | 3586 | |
3587 | - if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) { |
|
3587 | + if ($new_key == 'element' || $new_key == 'content' || $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array($new_value)) { |
|
3588 | 3588 | // do nothing |
3589 | 3589 | } else { |
3590 | - echo $this->block_element( array( $new_key => $new_value ),$save ); |
|
3590 | + echo $this->block_element(array($new_key => $new_value), $save); |
|
3591 | 3591 | } |
3592 | 3592 | } |
3593 | 3593 | |
3594 | - echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes |
|
3594 | + echo $new_args['element'] == 'BlocksProps' ? '} ),' : "},"; // end attributes |
|
3595 | 3595 | |
3596 | 3596 | // get the content |
3597 | 3597 | $first_item = 0; |
3598 | - foreach ( $new_args as $new_key => $new_value ) { |
|
3599 | - if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) { |
|
3598 | + foreach ($new_args as $new_key => $new_value) { |
|
3599 | + if ($new_key === 'content' || $new_key === 'if_content' || is_array($new_value)) { |
|
3600 | 3600 | |
3601 | - if ( $new_key === 'content' ) { |
|
3602 | - echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'"; |
|
3603 | - }else if ( $new_key === 'if_content' ) { |
|
3604 | - echo $this->block_props_replace( $new_value ); |
|
3601 | + if ($new_key === 'content') { |
|
3602 | + echo "'" . $this->block_props_replace(wp_slash($new_value)) . "'"; |
|
3603 | + } else if ($new_key === 'if_content') { |
|
3604 | + echo $this->block_props_replace($new_value); |
|
3605 | 3605 | } |
3606 | 3606 | |
3607 | - if ( is_array( $new_value ) ) { |
|
3607 | + if (is_array($new_value)) { |
|
3608 | 3608 | |
3609 | - if ( isset( $new_value['element_require'] ) ) { |
|
3610 | - echo str_replace( array( |
|
3609 | + if (isset($new_value['element_require'])) { |
|
3610 | + echo str_replace(array( |
|
3611 | 3611 | "'+", |
3612 | 3612 | "+'" |
3613 | - ), '', $this->block_props_replace( $new_value['element_require'] ) ) . " && "; |
|
3614 | - unset( $new_value['element_require'] ); |
|
3613 | + ), '', $this->block_props_replace($new_value['element_require'])) . " && "; |
|
3614 | + unset($new_value['element_require']); |
|
3615 | 3615 | } |
3616 | 3616 | |
3617 | - if ( isset( $new_value['element_repeat'] ) ) { |
|
3617 | + if (isset($new_value['element_repeat'])) { |
|
3618 | 3618 | $x = 1; |
3619 | - while ( $x <= absint( $new_value['element_repeat'] ) ) { |
|
3620 | - $this->block_element( array( '' => $new_value ),$save ); |
|
3621 | - $x ++; |
|
3619 | + while ($x <= absint($new_value['element_repeat'])) { |
|
3620 | + $this->block_element(array('' => $new_value), $save); |
|
3621 | + $x++; |
|
3622 | 3622 | } |
3623 | 3623 | } else { |
3624 | - $this->block_element( array( '' => $new_value ),$save ); |
|
3624 | + $this->block_element(array('' => $new_value), $save); |
|
3625 | 3625 | } |
3626 | 3626 | } |
3627 | - $first_item ++; |
|
3627 | + $first_item++; |
|
3628 | 3628 | } |
3629 | 3629 | } |
3630 | 3630 | |
3631 | - if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){ |
|
3632 | - echo "))";// end content |
|
3633 | - }else{ |
|
3634 | - echo ")";// end content |
|
3631 | + if ($new_args['element'] == 'innerBlocksProps' || $new_args['element'] == 'xBlocksProps') { |
|
3632 | + echo "))"; // end content |
|
3633 | + } else { |
|
3634 | + echo ")"; // end content |
|
3635 | 3635 | } |
3636 | 3636 | |
3637 | 3637 | |
@@ -3640,26 +3640,26 @@ discard block |
||
3640 | 3640 | } |
3641 | 3641 | } else { |
3642 | 3642 | |
3643 | - if ( substr( $element, 0, 3 ) === "if_" ) { |
|
3643 | + if (substr($element, 0, 3) === "if_") { |
|
3644 | 3644 | $extra = ''; |
3645 | - if( strpos($new_args, '[%WrapClass%]') !== false ){ |
|
3646 | - $new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args); |
|
3647 | - $new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args); |
|
3645 | + if (strpos($new_args, '[%WrapClass%]') !== false) { |
|
3646 | + $new_args = str_replace('[%WrapClass%]"', '" + sd_build_aui_class(props.attributes)', $new_args); |
|
3647 | + $new_args = str_replace('[%WrapClass%]', '+ sd_build_aui_class(props.attributes)', $new_args); |
|
3648 | 3648 | } |
3649 | - echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ","; |
|
3650 | - } elseif ( $element == 'style' && strpos($new_args, '[%WrapStyle%]') !== false ) { |
|
3651 | - $new_args = str_replace('[%WrapStyle%]','',$new_args); |
|
3652 | - echo $element . ": {..." . $this->block_props_replace( $new_args ) . " , ...sd_build_aui_styles(props.attributes) },"; |
|
3649 | + echo str_replace("if_", "", $element) . ": " . $this->block_props_replace($new_args, true) . ","; |
|
3650 | + } elseif ($element == 'style' && strpos($new_args, '[%WrapStyle%]') !== false) { |
|
3651 | + $new_args = str_replace('[%WrapStyle%]', '', $new_args); |
|
3652 | + echo $element . ": {..." . $this->block_props_replace($new_args) . " , ...sd_build_aui_styles(props.attributes) },"; |
|
3653 | 3653 | // echo $element . ": " . $this->block_props_replace( $new_args ) . ","; |
3654 | - } elseif ( $element == 'style' ) { |
|
3655 | - echo $element . ": " . $this->block_props_replace( $new_args ) . ","; |
|
3656 | - } elseif ( ( $element == 'class' || $element == 'className' ) && strpos($new_args, '[%WrapClass%]') !== false ) { |
|
3657 | - $new_args = str_replace('[%WrapClass%]','',$new_args); |
|
3658 | - echo $element . ": '" . $this->block_props_replace( $new_args ) . "' + sd_build_aui_class(props.attributes),"; |
|
3659 | - } elseif ( $element == 'template' && $new_args ) { |
|
3654 | + } elseif ($element == 'style') { |
|
3655 | + echo $element . ": " . $this->block_props_replace($new_args) . ","; |
|
3656 | + } elseif (($element == 'class' || $element == 'className') && strpos($new_args, '[%WrapClass%]') !== false) { |
|
3657 | + $new_args = str_replace('[%WrapClass%]', '', $new_args); |
|
3658 | + echo $element . ": '" . $this->block_props_replace($new_args) . "' + sd_build_aui_class(props.attributes),"; |
|
3659 | + } elseif ($element == 'template' && $new_args) { |
|
3660 | 3660 | echo $element . ": $new_args,"; |
3661 | 3661 | } else { |
3662 | - echo $element . ": '" . $this->block_props_replace( $new_args ) . "',"; |
|
3662 | + echo $element . ": '" . $this->block_props_replace($new_args) . "',"; |
|
3663 | 3663 | } |
3664 | 3664 | |
3665 | 3665 | } |
@@ -3674,12 +3674,12 @@ discard block |
||
3674 | 3674 | * |
3675 | 3675 | * @return mixed |
3676 | 3676 | */ |
3677 | - public function block_props_replace( $string, $no_wrap = false ) { |
|
3677 | + public function block_props_replace($string, $no_wrap = false) { |
|
3678 | 3678 | |
3679 | - if ( $no_wrap ) { |
|
3680 | - $string = str_replace( array( "[%", "%]" ), array( "props.attributes.", "" ), $string ); |
|
3679 | + if ($no_wrap) { |
|
3680 | + $string = str_replace(array("[%", "%]"), array("props.attributes.", ""), $string); |
|
3681 | 3681 | } else { |
3682 | - $string = str_replace( array( "[%", "%]" ), array( "'+props.attributes.", "+'" ), $string ); |
|
3682 | + $string = str_replace(array("[%", "%]"), array("'+props.attributes.", "+'"), $string); |
|
3683 | 3683 | } |
3684 | 3684 | |
3685 | 3685 | return $string; |
@@ -3691,62 +3691,62 @@ discard block |
||
3691 | 3691 | * @param array $args |
3692 | 3692 | * @param array $instance |
3693 | 3693 | */ |
3694 | - public function widget( $args, $instance ) { |
|
3694 | + public function widget($args, $instance) { |
|
3695 | 3695 | |
3696 | 3696 | // get the filtered values |
3697 | - $argument_values = $this->argument_values( $instance ); |
|
3698 | - $argument_values = $this->string_to_bool( $argument_values ); |
|
3699 | - $output = $this->output( $argument_values, $args ); |
|
3697 | + $argument_values = $this->argument_values($instance); |
|
3698 | + $argument_values = $this->string_to_bool($argument_values); |
|
3699 | + $output = $this->output($argument_values, $args); |
|
3700 | 3700 | |
3701 | 3701 | $no_wrap = false; |
3702 | - if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) { |
|
3702 | + if (isset($argument_values['no_wrap']) && $argument_values['no_wrap']) { |
|
3703 | 3703 | $no_wrap = true; |
3704 | 3704 | } |
3705 | 3705 | |
3706 | 3706 | ob_start(); |
3707 | - if ( $output && ! $no_wrap ) { |
|
3707 | + if ($output && !$no_wrap) { |
|
3708 | 3708 | |
3709 | 3709 | $class_original = $this->options['widget_ops']['classname']; |
3710 | - $class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash(); |
|
3710 | + $class = $this->options['widget_ops']['classname'] . " sdel-" . $this->get_instance_hash(); |
|
3711 | 3711 | |
3712 | 3712 | // Before widget |
3713 | 3713 | $before_widget = $args['before_widget']; |
3714 | - $before_widget = str_replace($class_original,$class,$before_widget); |
|
3715 | - $before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this ); |
|
3716 | - $before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this ); |
|
3714 | + $before_widget = str_replace($class_original, $class, $before_widget); |
|
3715 | + $before_widget = apply_filters('wp_super_duper_before_widget', $before_widget, $args, $instance, $this); |
|
3716 | + $before_widget = apply_filters('wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this); |
|
3717 | 3717 | |
3718 | 3718 | // After widget |
3719 | 3719 | $after_widget = $args['after_widget']; |
3720 | - $after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this ); |
|
3721 | - $after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this ); |
|
3720 | + $after_widget = apply_filters('wp_super_duper_after_widget', $after_widget, $args, $instance, $this); |
|
3721 | + $after_widget = apply_filters('wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this); |
|
3722 | 3722 | |
3723 | 3723 | echo $before_widget; |
3724 | 3724 | // elementor strips the widget wrapping div so we check for and add it back if needed |
3725 | - if ( $this->is_elementor_widget_output() ) { |
|
3725 | + if ($this->is_elementor_widget_output()) { |
|
3726 | 3726 | // Filter class & attrs for elementor widget output. |
3727 | - $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this ); |
|
3728 | - $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this ); |
|
3727 | + $class = apply_filters('wp_super_duper_div_classname', $class, $args, $this); |
|
3728 | + $class = apply_filters('wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this); |
|
3729 | 3729 | |
3730 | - $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this ); |
|
3731 | - $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this ); |
|
3730 | + $attrs = apply_filters('wp_super_duper_div_attrs', '', $args, $this); |
|
3731 | + $attrs = apply_filters('wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this); |
|
3732 | 3732 | |
3733 | - echo "<span class='" . esc_attr( $class ) . "' " . $attrs . ">"; |
|
3733 | + echo "<span class='" . esc_attr($class) . "' " . $attrs . ">"; |
|
3734 | 3734 | } |
3735 | - echo $this->output_title( $args, $instance ); |
|
3735 | + echo $this->output_title($args, $instance); |
|
3736 | 3736 | echo $output; |
3737 | - if ( $this->is_elementor_widget_output() ) { |
|
3737 | + if ($this->is_elementor_widget_output()) { |
|
3738 | 3738 | echo "</span>"; |
3739 | 3739 | } |
3740 | 3740 | echo $after_widget; |
3741 | - } elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty |
|
3742 | - $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" ); |
|
3741 | + } elseif ($this->is_preview() && $output == '') {// if preview show a placeholder if empty |
|
3742 | + $output = $this->preview_placeholder_text("{{" . $this->base_id . "}}"); |
|
3743 | 3743 | echo $output; |
3744 | - } elseif ( $output && $no_wrap ) { |
|
3744 | + } elseif ($output && $no_wrap) { |
|
3745 | 3745 | echo $output; |
3746 | 3746 | } |
3747 | 3747 | $output = ob_get_clean(); |
3748 | 3748 | |
3749 | - $output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this ); |
|
3749 | + $output = apply_filters('wp_super_duper_widget_output', $output, $instance, $args, $this); |
|
3750 | 3750 | |
3751 | 3751 | echo $output; |
3752 | 3752 | } |
@@ -3759,7 +3759,7 @@ discard block |
||
3759 | 3759 | */ |
3760 | 3760 | public function is_elementor_widget_output() { |
3761 | 3761 | $result = false; |
3762 | - if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) { |
|
3762 | + if (defined('ELEMENTOR_VERSION') && isset($this->number) && $this->number == 'REPLACE_TO_ID') { |
|
3763 | 3763 | $result = true; |
3764 | 3764 | } |
3765 | 3765 | |
@@ -3774,7 +3774,7 @@ discard block |
||
3774 | 3774 | */ |
3775 | 3775 | public function is_elementor_preview() { |
3776 | 3776 | $result = false; |
3777 | - if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) { |
|
3777 | + if (isset($_REQUEST['elementor-preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor_ajax')) { |
|
3778 | 3778 | $result = true; |
3779 | 3779 | } |
3780 | 3780 | |
@@ -3789,7 +3789,7 @@ discard block |
||
3789 | 3789 | */ |
3790 | 3790 | public function is_divi_preview() { |
3791 | 3791 | $result = false; |
3792 | - if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) { |
|
3792 | + if (isset($_REQUEST['et_fb']) || isset($_REQUEST['et_pb_preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor')) { |
|
3793 | 3793 | $result = true; |
3794 | 3794 | } |
3795 | 3795 | |
@@ -3804,7 +3804,7 @@ discard block |
||
3804 | 3804 | */ |
3805 | 3805 | public function is_beaver_preview() { |
3806 | 3806 | $result = false; |
3807 | - if ( isset( $_REQUEST['fl_builder'] ) ) { |
|
3807 | + if (isset($_REQUEST['fl_builder'])) { |
|
3808 | 3808 | $result = true; |
3809 | 3809 | } |
3810 | 3810 | |
@@ -3819,7 +3819,7 @@ discard block |
||
3819 | 3819 | */ |
3820 | 3820 | public function is_siteorigin_preview() { |
3821 | 3821 | $result = false; |
3822 | - if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) { |
|
3822 | + if (!empty($_REQUEST['siteorigin_panels_live_editor'])) { |
|
3823 | 3823 | $result = true; |
3824 | 3824 | } |
3825 | 3825 | |
@@ -3834,7 +3834,7 @@ discard block |
||
3834 | 3834 | */ |
3835 | 3835 | public function is_cornerstone_preview() { |
3836 | 3836 | $result = false; |
3837 | - if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) { |
|
3837 | + if (!empty($_REQUEST['cornerstone_preview']) || basename($_SERVER['REQUEST_URI']) == 'cornerstone-endpoint') { |
|
3838 | 3838 | $result = true; |
3839 | 3839 | } |
3840 | 3840 | |
@@ -3849,7 +3849,7 @@ discard block |
||
3849 | 3849 | */ |
3850 | 3850 | public function is_fusion_preview() { |
3851 | 3851 | $result = false; |
3852 | - if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) { |
|
3852 | + if (!empty($_REQUEST['fb-edit']) || !empty($_REQUEST['fusion_load_nonce'])) { |
|
3853 | 3853 | $result = true; |
3854 | 3854 | } |
3855 | 3855 | |
@@ -3864,7 +3864,7 @@ discard block |
||
3864 | 3864 | */ |
3865 | 3865 | public function is_oxygen_preview() { |
3866 | 3866 | $result = false; |
3867 | - if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) { |
|
3867 | + if (!empty($_REQUEST['ct_builder']) || (!empty($_REQUEST['action']) && (substr($_REQUEST['action'], 0, 11) === "oxy_render_" || substr($_REQUEST['action'], 0, 10) === "ct_render_"))) { |
|
3868 | 3868 | $result = true; |
3869 | 3869 | } |
3870 | 3870 | |
@@ -3879,21 +3879,21 @@ discard block |
||
3879 | 3879 | */ |
3880 | 3880 | public function is_preview() { |
3881 | 3881 | $preview = false; |
3882 | - if ( $this->is_divi_preview() ) { |
|
3882 | + if ($this->is_divi_preview()) { |
|
3883 | 3883 | $preview = true; |
3884 | - } elseif ( $this->is_elementor_preview() ) { |
|
3884 | + } elseif ($this->is_elementor_preview()) { |
|
3885 | 3885 | $preview = true; |
3886 | - } elseif ( $this->is_beaver_preview() ) { |
|
3886 | + } elseif ($this->is_beaver_preview()) { |
|
3887 | 3887 | $preview = true; |
3888 | - } elseif ( $this->is_siteorigin_preview() ) { |
|
3888 | + } elseif ($this->is_siteorigin_preview()) { |
|
3889 | 3889 | $preview = true; |
3890 | - } elseif ( $this->is_cornerstone_preview() ) { |
|
3890 | + } elseif ($this->is_cornerstone_preview()) { |
|
3891 | 3891 | $preview = true; |
3892 | - } elseif ( $this->is_fusion_preview() ) { |
|
3892 | + } elseif ($this->is_fusion_preview()) { |
|
3893 | 3893 | $preview = true; |
3894 | - } elseif ( $this->is_oxygen_preview() ) { |
|
3894 | + } elseif ($this->is_oxygen_preview()) { |
|
3895 | 3895 | $preview = true; |
3896 | - } elseif( $this->is_block_content_call() ) { |
|
3896 | + } elseif ($this->is_block_content_call()) { |
|
3897 | 3897 | $preview = true; |
3898 | 3898 | } |
3899 | 3899 | |
@@ -3908,34 +3908,34 @@ discard block |
||
3908 | 3908 | * |
3909 | 3909 | * @return string |
3910 | 3910 | */ |
3911 | - public function output_title( $args, $instance = array() ) { |
|
3911 | + public function output_title($args, $instance = array()) { |
|
3912 | 3912 | $output = ''; |
3913 | - if ( ! empty( $instance['title'] ) ) { |
|
3913 | + if (!empty($instance['title'])) { |
|
3914 | 3914 | /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ |
3915 | - $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); |
|
3915 | + $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); |
|
3916 | 3916 | |
3917 | - if(empty($instance['widget_title_tag'])){ |
|
3917 | + if (empty($instance['widget_title_tag'])) { |
|
3918 | 3918 | $output = $args['before_title'] . $title . $args['after_title']; |
3919 | - }else{ |
|
3920 | - $title_tag = esc_attr( $instance['widget_title_tag'] ); |
|
3919 | + } else { |
|
3920 | + $title_tag = esc_attr($instance['widget_title_tag']); |
|
3921 | 3921 | |
3922 | 3922 | // classes |
3923 | 3923 | $title_classes = array(); |
3924 | - $title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : ''; |
|
3925 | - $title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : ''; |
|
3926 | - $title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : ''; |
|
3927 | - $title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : ''; |
|
3928 | - $title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : ''; |
|
3929 | - $title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : ''; |
|
3930 | - $title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : ''; |
|
3931 | - $title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : ''; |
|
3932 | - $title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : ''; |
|
3933 | - $title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : ''; |
|
3934 | - $title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : ''; |
|
3935 | - $title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : ''; |
|
3936 | - $title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : ''; |
|
3937 | - |
|
3938 | - $class = !empty( $title_classes ) ? implode(" ",$title_classes) : ''; |
|
3924 | + $title_classes[] = !empty($instance['widget_title_size_class']) ? sanitize_html_class($instance['widget_title_size_class']) : ''; |
|
3925 | + $title_classes[] = !empty($instance['widget_title_align_class']) ? sanitize_html_class($instance['widget_title_align_class']) : ''; |
|
3926 | + $title_classes[] = !empty($instance['widget_title_color_class']) ? "text-" . sanitize_html_class($instance['widget_title_color_class']) : ''; |
|
3927 | + $title_classes[] = !empty($instance['widget_title_border_class']) ? sanitize_html_class($instance['widget_title_border_class']) : ''; |
|
3928 | + $title_classes[] = !empty($instance['widget_title_border_color_class']) ? "border-" . sanitize_html_class($instance['widget_title_border_color_class']) : ''; |
|
3929 | + $title_classes[] = !empty($instance['widget_title_mt_class']) ? "mt-" . absint($instance['widget_title_mt_class']) : ''; |
|
3930 | + $title_classes[] = !empty($instance['widget_title_mr_class']) ? "mr-" . absint($instance['widget_title_mr_class']) : ''; |
|
3931 | + $title_classes[] = !empty($instance['widget_title_mb_class']) ? "mb-" . absint($instance['widget_title_mb_class']) : ''; |
|
3932 | + $title_classes[] = !empty($instance['widget_title_ml_class']) ? "ml-" . absint($instance['widget_title_ml_class']) : ''; |
|
3933 | + $title_classes[] = !empty($instance['widget_title_pt_class']) ? "pt-" . absint($instance['widget_title_pt_class']) : ''; |
|
3934 | + $title_classes[] = !empty($instance['widget_title_pr_class']) ? "pr-" . absint($instance['widget_title_pr_class']) : ''; |
|
3935 | + $title_classes[] = !empty($instance['widget_title_pb_class']) ? "pb-" . absint($instance['widget_title_pb_class']) : ''; |
|
3936 | + $title_classes[] = !empty($instance['widget_title_pl_class']) ? "pl-" . absint($instance['widget_title_pl_class']) : ''; |
|
3937 | + |
|
3938 | + $class = !empty($title_classes) ? implode(" ", $title_classes) : ''; |
|
3939 | 3939 | $output = "<$title_tag class='$class' >$title</$title_tag>"; |
3940 | 3940 | } |
3941 | 3941 | |
@@ -3949,7 +3949,7 @@ discard block |
||
3949 | 3949 | * |
3950 | 3950 | * @param array $instance The widget options. |
3951 | 3951 | */ |
3952 | - public function form( $instance ) { |
|
3952 | + public function form($instance) { |
|
3953 | 3953 | |
3954 | 3954 | // set widget instance |
3955 | 3955 | $this->instance = $instance; |
@@ -3957,20 +3957,20 @@ discard block |
||
3957 | 3957 | // set it as a SD widget |
3958 | 3958 | echo $this->widget_advanced_toggle(); |
3959 | 3959 | |
3960 | - echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>"; |
|
3960 | + echo "<p>" . esc_attr($this->options['widget_ops']['description']) . "</p>"; |
|
3961 | 3961 | $arguments_raw = $this->get_arguments(); |
3962 | 3962 | |
3963 | - if ( is_array( $arguments_raw ) ) { |
|
3963 | + if (is_array($arguments_raw)) { |
|
3964 | 3964 | |
3965 | - $arguments = $this->group_arguments( $arguments_raw ); |
|
3965 | + $arguments = $this->group_arguments($arguments_raw); |
|
3966 | 3966 | |
3967 | 3967 | // Do we have sections? |
3968 | 3968 | $has_sections = $arguments == $arguments_raw ? false : true; |
3969 | 3969 | |
3970 | 3970 | |
3971 | - if ( $has_sections ) { |
|
3971 | + if ($has_sections) { |
|
3972 | 3972 | $panel_count = 0; |
3973 | - foreach ( $arguments as $key => $args ) { |
|
3973 | + foreach ($arguments as $key => $args) { |
|
3974 | 3974 | |
3975 | 3975 | ?> |
3976 | 3976 | <script> |
@@ -3980,26 +3980,26 @@ discard block |
||
3980 | 3980 | |
3981 | 3981 | $hide = $panel_count ? ' style="display:none;" ' : ''; |
3982 | 3982 | $icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down'; |
3983 | - echo "<button onclick='jQuery(this).find(\"i\").toggleClass(\"fas fa-chevron-up fas fa-chevron-down\");jQuery(this).next().slideToggle();' type='button' class='sd-toggle-group-button sd-input-group-toggle" . sanitize_title_with_dashes( $key ) . "'>" . esc_attr( $key ) . " <i style='float:right;' class='" . $icon_class . "'></i></button>"; |
|
3984 | - echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>"; |
|
3983 | + echo "<button onclick='jQuery(this).find(\"i\").toggleClass(\"fas fa-chevron-up fas fa-chevron-down\");jQuery(this).next().slideToggle();' type='button' class='sd-toggle-group-button sd-input-group-toggle" . sanitize_title_with_dashes($key) . "'>" . esc_attr($key) . " <i style='float:right;' class='" . $icon_class . "'></i></button>"; |
|
3984 | + echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes($key) . "' $hide>"; |
|
3985 | 3985 | |
3986 | - foreach ( $args as $k => $a ) { |
|
3986 | + foreach ($args as $k => $a) { |
|
3987 | 3987 | |
3988 | 3988 | $this->widget_inputs_row_start($k, $a); |
3989 | - $this->widget_inputs( $a, $instance ); |
|
3989 | + $this->widget_inputs($a, $instance); |
|
3990 | 3990 | $this->widget_inputs_row_end($k, $a); |
3991 | 3991 | |
3992 | 3992 | } |
3993 | 3993 | |
3994 | 3994 | echo "</div>"; |
3995 | 3995 | |
3996 | - $panel_count ++; |
|
3996 | + $panel_count++; |
|
3997 | 3997 | |
3998 | 3998 | } |
3999 | 3999 | } else { |
4000 | - foreach ( $arguments as $key => $args ) { |
|
4000 | + foreach ($arguments as $key => $args) { |
|
4001 | 4001 | $this->widget_inputs_row_start($key, $args); |
4002 | - $this->widget_inputs( $args, $instance ); |
|
4002 | + $this->widget_inputs($args, $instance); |
|
4003 | 4003 | $this->widget_inputs_row_end($key, $args); |
4004 | 4004 | } |
4005 | 4005 | } |
@@ -4007,33 +4007,33 @@ discard block |
||
4007 | 4007 | } |
4008 | 4008 | } |
4009 | 4009 | |
4010 | - public function widget_inputs_row_start($key, $args){ |
|
4011 | - if(!empty($args['row'])){ |
|
4010 | + public function widget_inputs_row_start($key, $args) { |
|
4011 | + if (!empty($args['row'])) { |
|
4012 | 4012 | // maybe open |
4013 | - if(!empty($args['row']['open'])){ |
|
4013 | + if (!empty($args['row']['open'])) { |
|
4014 | 4014 | ?> |
4015 | - <div class='bsui sd-argument ' data-argument='<?php echo esc_attr( $args['row']['key'] ); ?>' data-element_require='<?php if ( !empty($args['row']['element_require'])) { |
|
4016 | - echo $this->convert_element_require( $args['row']['element_require'] ); |
|
4015 | + <div class='bsui sd-argument ' data-argument='<?php echo esc_attr($args['row']['key']); ?>' data-element_require='<?php if (!empty($args['row']['element_require'])) { |
|
4016 | + echo $this->convert_element_require($args['row']['element_require']); |
|
4017 | 4017 | } ?>'> |
4018 | - <?php if(!empty($args['row']['title'])){ ?> |
|
4019 | - <label class="mb-0 "><?php echo esc_attr( $args['row']['title'] ); ?><?php echo $this->widget_field_desc( $args['row'] ); ?></label> |
|
4018 | + <?php if (!empty($args['row']['title'])) { ?> |
|
4019 | + <label class="mb-0 "><?php echo esc_attr($args['row']['title']); ?><?php echo $this->widget_field_desc($args['row']); ?></label> |
|
4020 | 4020 | <?php }?> |
4021 | - <div class='row <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>'> |
|
4021 | + <div class='row <?php if (!empty($args['row']['class'])) { echo esc_attr($args['row']['class']); } ?>'> |
|
4022 | 4022 | <div class='col pr-2'> |
4023 | 4023 | <?php |
4024 | - }elseif(!empty($args['row']['close'])){ |
|
4024 | + }elseif (!empty($args['row']['close'])) { |
|
4025 | 4025 | echo "<div class='col pl-0'>"; |
4026 | - }else{ |
|
4026 | + } else { |
|
4027 | 4027 | echo "<div class='col pl-0 pr-2'>"; |
4028 | 4028 | } |
4029 | 4029 | } |
4030 | 4030 | } |
4031 | 4031 | |
4032 | - public function widget_inputs_row_end($key, $args){ |
|
4032 | + public function widget_inputs_row_end($key, $args) { |
|
4033 | 4033 | |
4034 | - if(!empty($args['row'])){ |
|
4034 | + if (!empty($args['row'])) { |
|
4035 | 4035 | // maybe close |
4036 | - if(!empty($args['row']['close'])){ |
|
4036 | + if (!empty($args['row']['close'])) { |
|
4037 | 4037 | echo "</div></div>"; |
4038 | 4038 | } |
4039 | 4039 | |
@@ -4049,7 +4049,7 @@ discard block |
||
4049 | 4049 | public function widget_advanced_toggle() { |
4050 | 4050 | |
4051 | 4051 | $output = ''; |
4052 | - if ( $this->block_show_advanced() ) { |
|
4052 | + if ($this->block_show_advanced()) { |
|
4053 | 4053 | $val = 1; |
4054 | 4054 | } else { |
4055 | 4055 | $val = 0; |
@@ -4069,14 +4069,14 @@ discard block |
||
4069 | 4069 | *@since 1.0.0 |
4070 | 4070 | * |
4071 | 4071 | */ |
4072 | - public function convert_element_require( $input ) { |
|
4072 | + public function convert_element_require($input) { |
|
4073 | 4073 | |
4074 | - $input = str_replace( "'", '"', $input );// we only want double quotes |
|
4074 | + $input = str_replace("'", '"', $input); // we only want double quotes |
|
4075 | 4075 | |
4076 | - $output = esc_attr( str_replace( array( "[%", "%]" ), array( |
|
4076 | + $output = esc_attr(str_replace(array("[%", "%]"), array( |
|
4077 | 4077 | "jQuery(form).find('[data-argument=\"", |
4078 | 4078 | "\"]').find('input,select,textarea').val()" |
4079 | - ), $input ) ); |
|
4079 | + ), $input)); |
|
4080 | 4080 | |
4081 | 4081 | return $output; |
4082 | 4082 | } |
@@ -4087,56 +4087,56 @@ discard block |
||
4087 | 4087 | * @param $args |
4088 | 4088 | * @param $instance |
4089 | 4089 | */ |
4090 | - public function widget_inputs( $args, $instance ) { |
|
4090 | + public function widget_inputs($args, $instance) { |
|
4091 | 4091 | |
4092 | 4092 | $class = ""; |
4093 | 4093 | $element_require = ""; |
4094 | 4094 | $custom_attributes = ""; |
4095 | 4095 | |
4096 | 4096 | // get value |
4097 | - if ( isset( $instance[ $args['name'] ] ) ) { |
|
4098 | - $value = $instance[ $args['name'] ]; |
|
4099 | - } elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) { |
|
4100 | - $value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] ); |
|
4097 | + if (isset($instance[$args['name']])) { |
|
4098 | + $value = $instance[$args['name']]; |
|
4099 | + } elseif (!isset($instance[$args['name']]) && !empty($args['default'])) { |
|
4100 | + $value = is_array($args['default']) ? array_map("esc_html", $args['default']) : esc_html($args['default']); |
|
4101 | 4101 | } else { |
4102 | 4102 | $value = ''; |
4103 | 4103 | } |
4104 | 4104 | |
4105 | 4105 | // get placeholder |
4106 | - if ( ! empty( $args['placeholder'] ) ) { |
|
4107 | - $placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'"; |
|
4106 | + if (!empty($args['placeholder'])) { |
|
4107 | + $placeholder = "placeholder='" . esc_html($args['placeholder']) . "'"; |
|
4108 | 4108 | } else { |
4109 | 4109 | $placeholder = ''; |
4110 | 4110 | } |
4111 | 4111 | |
4112 | 4112 | // get if advanced |
4113 | - if ( isset( $args['advanced'] ) && $args['advanced'] ) { |
|
4113 | + if (isset($args['advanced']) && $args['advanced']) { |
|
4114 | 4114 | $class .= " sd-advanced-setting "; |
4115 | 4115 | } |
4116 | 4116 | |
4117 | 4117 | // element_require |
4118 | - if ( isset( $args['element_require'] ) && $args['element_require'] ) { |
|
4118 | + if (isset($args['element_require']) && $args['element_require']) { |
|
4119 | 4119 | $element_require = $args['element_require']; |
4120 | 4120 | } |
4121 | 4121 | |
4122 | 4122 | // custom_attributes |
4123 | - if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) { |
|
4124 | - $custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true ); |
|
4123 | + if (isset($args['custom_attributes']) && $args['custom_attributes']) { |
|
4124 | + $custom_attributes = $this->array_to_attributes($args['custom_attributes'], true); |
|
4125 | 4125 | } |
4126 | 4126 | |
4127 | 4127 | |
4128 | 4128 | // before wrapper |
4129 | 4129 | ?> |
4130 | - <p class="sd-argument <?php echo esc_attr( $class ); ?>" |
|
4131 | - data-argument='<?php echo esc_attr( $args['name'] ); ?>' |
|
4132 | - data-element_require='<?php if ( $element_require ) { |
|
4133 | - echo $this->convert_element_require( $element_require ); |
|
4130 | + <p class="sd-argument <?php echo esc_attr($class); ?>" |
|
4131 | + data-argument='<?php echo esc_attr($args['name']); ?>' |
|
4132 | + data-element_require='<?php if ($element_require) { |
|
4133 | + echo $this->convert_element_require($element_require); |
|
4134 | 4134 | } ?>' |
4135 | 4135 | > |
4136 | 4136 | <?php |
4137 | 4137 | |
4138 | 4138 | |
4139 | - switch ( $args['type'] ) { |
|
4139 | + switch ($args['type']) { |
|
4140 | 4140 | //array('text','password','number','email','tel','url','color') |
4141 | 4141 | case "text": |
4142 | 4142 | case "password": |
@@ -4147,46 +4147,46 @@ discard block |
||
4147 | 4147 | case "color": |
4148 | 4148 | ?> |
4149 | 4149 | <label |
4150 | - for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label> |
|
4150 | + for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label> |
|
4151 | 4151 | <input <?php echo $placeholder; ?> class="widefat" |
4152 | 4152 | <?php echo $custom_attributes; ?> |
4153 | - id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" |
|
4154 | - name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" |
|
4155 | - type="<?php echo esc_attr( $args['type'] ); ?>" |
|
4156 | - value="<?php echo esc_attr( $value ); ?>"> |
|
4153 | + id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" |
|
4154 | + name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" |
|
4155 | + type="<?php echo esc_attr($args['type']); ?>" |
|
4156 | + value="<?php echo esc_attr($value); ?>"> |
|
4157 | 4157 | <?php |
4158 | 4158 | |
4159 | 4159 | break; |
4160 | 4160 | case "select": |
4161 | - $multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false; |
|
4162 | - if ( $multiple ) { |
|
4163 | - if ( empty( $value ) ) { |
|
4161 | + $multiple = isset($args['multiple']) && $args['multiple'] ? true : false; |
|
4162 | + if ($multiple) { |
|
4163 | + if (empty($value)) { |
|
4164 | 4164 | $value = array(); |
4165 | 4165 | } |
4166 | 4166 | } |
4167 | 4167 | ?> |
4168 | 4168 | <label |
4169 | - for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label> |
|
4169 | + for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label> |
|
4170 | 4170 | <select <?php echo $placeholder; ?> class="widefat" |
4171 | 4171 | <?php echo $custom_attributes; ?> |
4172 | - id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" |
|
4173 | - name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); |
|
4174 | - if ( $multiple ) { |
|
4172 | + id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" |
|
4173 | + name="<?php echo esc_attr($this->get_field_name($args['name'])); |
|
4174 | + if ($multiple) { |
|
4175 | 4175 | echo "[]"; |
4176 | 4176 | } ?>" |
4177 | - <?php if ( $multiple ) { |
|
4177 | + <?php if ($multiple) { |
|
4178 | 4178 | echo "multiple"; |
4179 | 4179 | } //@todo not implemented yet due to gutenberg not supporting it |
4180 | 4180 | ?> |
4181 | 4181 | > |
4182 | 4182 | <?php |
4183 | 4183 | |
4184 | - if ( ! empty( $args['options'] ) ) { |
|
4185 | - foreach ( $args['options'] as $val => $label ) { |
|
4186 | - if ( $multiple ) { |
|
4187 | - $selected = in_array( $val, $value ) ? 'selected="selected"' : ''; |
|
4184 | + if (!empty($args['options'])) { |
|
4185 | + foreach ($args['options'] as $val => $label) { |
|
4186 | + if ($multiple) { |
|
4187 | + $selected = in_array($val, $value) ? 'selected="selected"' : ''; |
|
4188 | 4188 | } else { |
4189 | - $selected = selected( $value, $val, false ); |
|
4189 | + $selected = selected($value, $val, false); |
|
4190 | 4190 | } |
4191 | 4191 | echo "<option value='$val' " . $selected . ">$label</option>"; |
4192 | 4192 | } |
@@ -4198,32 +4198,32 @@ discard block |
||
4198 | 4198 | case "checkbox": |
4199 | 4199 | ?> |
4200 | 4200 | <input <?php echo $placeholder; ?> |
4201 | - <?php checked( 1, $value, true ) ?> |
|
4201 | + <?php checked(1, $value, true) ?> |
|
4202 | 4202 | <?php echo $custom_attributes; ?> |
4203 | - class="widefat" id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" |
|
4204 | - name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="checkbox" |
|
4203 | + class="widefat" id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" |
|
4204 | + name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="checkbox" |
|
4205 | 4205 | value="1"> |
4206 | 4206 | <label |
4207 | - for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label> |
|
4207 | + for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label> |
|
4208 | 4208 | <?php |
4209 | 4209 | break; |
4210 | 4210 | case "textarea": |
4211 | 4211 | ?> |
4212 | 4212 | <label |
4213 | - for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label> |
|
4213 | + for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label> |
|
4214 | 4214 | <textarea <?php echo $placeholder; ?> class="widefat" |
4215 | 4215 | <?php echo $custom_attributes; ?> |
4216 | - id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" |
|
4217 | - name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" |
|
4218 | - ><?php echo esc_attr( $value ); ?></textarea> |
|
4216 | + id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" |
|
4217 | + name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" |
|
4218 | + ><?php echo esc_attr($value); ?></textarea> |
|
4219 | 4219 | <?php |
4220 | 4220 | |
4221 | 4221 | break; |
4222 | 4222 | case "hidden": |
4223 | 4223 | ?> |
4224 | - <input id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" |
|
4225 | - name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="hidden" |
|
4226 | - value="<?php echo esc_attr( $value ); ?>"> |
|
4224 | + <input id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" |
|
4225 | + name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="hidden" |
|
4226 | + value="<?php echo esc_attr($value); ?>"> |
|
4227 | 4227 | <?php |
4228 | 4228 | break; |
4229 | 4229 | default: |
@@ -4238,15 +4238,15 @@ discard block |
||
4238 | 4238 | |
4239 | 4239 | } |
4240 | 4240 | |
4241 | - public function get_widget_icon($icon = 'box-top', $title = ''){ |
|
4242 | - if($icon=='box-top'){ |
|
4243 | - return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>'; |
|
4244 | - }elseif($icon=='box-right'){ |
|
4245 | - return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>'; |
|
4246 | - }elseif($icon=='box-bottom'){ |
|
4247 | - return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>'; |
|
4248 | - }elseif($icon=='box-left'){ |
|
4249 | - return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>'; |
|
4241 | + public function get_widget_icon($icon = 'box-top', $title = '') { |
|
4242 | + if ($icon == 'box-top') { |
|
4243 | + return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>'; |
|
4244 | + }elseif ($icon == 'box-right') { |
|
4245 | + return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>'; |
|
4246 | + }elseif ($icon == 'box-bottom') { |
|
4247 | + return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>'; |
|
4248 | + }elseif ($icon == 'box-left') { |
|
4249 | + return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>'; |
|
4250 | 4250 | } |
4251 | 4251 | } |
4252 | 4252 | |
@@ -4258,14 +4258,14 @@ discard block |
||
4258 | 4258 | * @return string |
4259 | 4259 | * @todo, need to make its own tooltip script |
4260 | 4260 | */ |
4261 | - public function widget_field_desc( $args ) { |
|
4261 | + public function widget_field_desc($args) { |
|
4262 | 4262 | |
4263 | 4263 | $description = ''; |
4264 | - if ( isset( $args['desc'] ) && $args['desc'] ) { |
|
4265 | - if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) { |
|
4266 | - $description = $this->desc_tip( $args['desc'] ); |
|
4264 | + if (isset($args['desc']) && $args['desc']) { |
|
4265 | + if (isset($args['desc_tip']) && $args['desc_tip']) { |
|
4266 | + $description = $this->desc_tip($args['desc']); |
|
4267 | 4267 | } else { |
4268 | - $description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>'; |
|
4268 | + $description = '<span class="description">' . wp_kses_post($args['desc']) . '</span>'; |
|
4269 | 4269 | } |
4270 | 4270 | } |
4271 | 4271 | |
@@ -4279,12 +4279,12 @@ discard block |
||
4279 | 4279 | * |
4280 | 4280 | * @return string |
4281 | 4281 | */ |
4282 | - public function widget_field_title( $args ) { |
|
4282 | + public function widget_field_title($args) { |
|
4283 | 4283 | |
4284 | 4284 | $title = ''; |
4285 | - if ( isset( $args['title'] ) && $args['title'] ) { |
|
4286 | - if ( isset( $args['icon'] ) && $args['icon'] ) { |
|
4287 | - $title = self::get_widget_icon( $args['icon'], $args['title'] ); |
|
4285 | + if (isset($args['title']) && $args['title']) { |
|
4286 | + if (isset($args['icon']) && $args['icon']) { |
|
4287 | + $title = self::get_widget_icon($args['icon'], $args['title']); |
|
4288 | 4288 | } else { |
4289 | 4289 | $title = esc_attr($args['title']); |
4290 | 4290 | } |
@@ -4301,11 +4301,11 @@ discard block |
||
4301 | 4301 | * |
4302 | 4302 | * @return string |
4303 | 4303 | */ |
4304 | - function desc_tip( $tip, $allow_html = false ) { |
|
4305 | - if ( $allow_html ) { |
|
4306 | - $tip = $this->sanitize_tooltip( $tip ); |
|
4304 | + function desc_tip($tip, $allow_html = false) { |
|
4305 | + if ($allow_html) { |
|
4306 | + $tip = $this->sanitize_tooltip($tip); |
|
4307 | 4307 | } else { |
4308 | - $tip = esc_attr( $tip ); |
|
4308 | + $tip = esc_attr($tip); |
|
4309 | 4309 | } |
4310 | 4310 | |
4311 | 4311 | return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>'; |
@@ -4318,8 +4318,8 @@ discard block |
||
4318 | 4318 | * |
4319 | 4319 | * @return string |
4320 | 4320 | */ |
4321 | - public function sanitize_tooltip( $var ) { |
|
4322 | - return htmlspecialchars( wp_kses( html_entity_decode( $var ), array( |
|
4321 | + public function sanitize_tooltip($var) { |
|
4322 | + return htmlspecialchars(wp_kses(html_entity_decode($var), array( |
|
4323 | 4323 | 'br' => array(), |
4324 | 4324 | 'em' => array(), |
4325 | 4325 | 'strong' => array(), |
@@ -4329,7 +4329,7 @@ discard block |
||
4329 | 4329 | 'li' => array(), |
4330 | 4330 | 'ol' => array(), |
4331 | 4331 | 'p' => array(), |
4332 | - ) ) ); |
|
4332 | + ))); |
|
4333 | 4333 | } |
4334 | 4334 | |
4335 | 4335 | /** |
@@ -4341,23 +4341,23 @@ discard block |
||
4341 | 4341 | * @return array |
4342 | 4342 | * @todo we should add some sanitation here. |
4343 | 4343 | */ |
4344 | - public function update( $new_instance, $old_instance ) { |
|
4344 | + public function update($new_instance, $old_instance) { |
|
4345 | 4345 | |
4346 | 4346 | //save the widget |
4347 | - $instance = array_merge( (array) $old_instance, (array) $new_instance ); |
|
4347 | + $instance = array_merge((array) $old_instance, (array) $new_instance); |
|
4348 | 4348 | |
4349 | 4349 | // set widget instance |
4350 | 4350 | $this->instance = $instance; |
4351 | 4351 | |
4352 | - if ( empty( $this->arguments ) ) { |
|
4352 | + if (empty($this->arguments)) { |
|
4353 | 4353 | $this->get_arguments(); |
4354 | 4354 | } |
4355 | 4355 | |
4356 | 4356 | // check for checkboxes |
4357 | - if ( ! empty( $this->arguments ) ) { |
|
4358 | - foreach ( $this->arguments as $argument ) { |
|
4359 | - if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) { |
|
4360 | - $instance[ $argument['name'] ] = '0'; |
|
4357 | + if (!empty($this->arguments)) { |
|
4358 | + foreach ($this->arguments as $argument) { |
|
4359 | + if (isset($argument['type']) && $argument['type'] == 'checkbox' && !isset($new_instance[$argument['name']])) { |
|
4360 | + $instance[$argument['name']] = '0'; |
|
4361 | 4361 | } |
4362 | 4362 | } |
4363 | 4363 | } |
@@ -4375,7 +4375,7 @@ discard block |
||
4375 | 4375 | */ |
4376 | 4376 | public function is_block_content_call() { |
4377 | 4377 | $result = false; |
4378 | - if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) { |
|
4378 | + if (wp_doing_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'super_duper_output_shortcode') { |
|
4379 | 4379 | $result = true; |
4380 | 4380 | } |
4381 | 4381 | |
@@ -4388,9 +4388,9 @@ discard block |
||
4388 | 4388 | * @return string |
4389 | 4389 | *@since 1.0.20 |
4390 | 4390 | */ |
4391 | - public function get_instance_hash(){ |
|
4392 | - $instance_string = $this->base_id.serialize($this->instance); |
|
4393 | - return hash('crc32b',$instance_string); |
|
4391 | + public function get_instance_hash() { |
|
4392 | + $instance_string = $this->base_id . serialize($this->instance); |
|
4393 | + return hash('crc32b', $instance_string); |
|
4394 | 4394 | } |
4395 | 4395 | |
4396 | 4396 | /** |
@@ -4401,14 +4401,14 @@ discard block |
||
4401 | 4401 | * @return string |
4402 | 4402 | *@since 1.0.20 |
4403 | 4403 | */ |
4404 | - public function get_instance_style($rules = array()){ |
|
4404 | + public function get_instance_style($rules = array()) { |
|
4405 | 4405 | $css = ''; |
4406 | 4406 | |
4407 | - if(!empty($rules)){ |
|
4407 | + if (!empty($rules)) { |
|
4408 | 4408 | $rules = array_unique($rules); |
4409 | 4409 | $instance_hash = $this->get_instance_hash(); |
4410 | 4410 | $css .= "<style>"; |
4411 | - foreach($rules as $rule){ |
|
4411 | + foreach ($rules as $rule) { |
|
4412 | 4412 | $css .= ".sdel-$instance_hash $rule"; |
4413 | 4413 | } |
4414 | 4414 | $css .= "</style>"; |
@@ -4426,9 +4426,9 @@ discard block |
||
4426 | 4426 | *@since 1.0.28 |
4427 | 4427 | * |
4428 | 4428 | */ |
4429 | - public function encode_shortcodes( $content ) { |
|
4429 | + public function encode_shortcodes($content) { |
|
4430 | 4430 | // Avoids existing encoded tags. |
4431 | - $trans = array( |
|
4431 | + $trans = array( |
|
4432 | 4432 | '[' => '[', |
4433 | 4433 | ']' => ']', |
4434 | 4434 | '&#91;' => '[', |
@@ -4439,7 +4439,7 @@ discard block |
||
4439 | 4439 | '&gt;' => '&0gt;', |
4440 | 4440 | ); |
4441 | 4441 | |
4442 | - $content = strtr( $content, $trans ); |
|
4442 | + $content = strtr($content, $trans); |
|
4443 | 4443 | |
4444 | 4444 | $trans = array( |
4445 | 4445 | '[' => '[', |
@@ -4450,7 +4450,7 @@ discard block |
||
4450 | 4450 | "'" => ''', |
4451 | 4451 | ); |
4452 | 4452 | |
4453 | - $content = strtr( $content, $trans ); |
|
4453 | + $content = strtr($content, $trans); |
|
4454 | 4454 | |
4455 | 4455 | return $content; |
4456 | 4456 | } |
@@ -4464,8 +4464,8 @@ discard block |
||
4464 | 4464 | *@since 1.0.28 |
4465 | 4465 | * |
4466 | 4466 | */ |
4467 | - public function decode_shortcodes( $content ) { |
|
4468 | - $trans = array( |
|
4467 | + public function decode_shortcodes($content) { |
|
4468 | + $trans = array( |
|
4469 | 4469 | '[' => '[', |
4470 | 4470 | ']' => ']', |
4471 | 4471 | '&#91;' => '[', |
@@ -4478,7 +4478,7 @@ discard block |
||
4478 | 4478 | ''' => "'", |
4479 | 4479 | ); |
4480 | 4480 | |
4481 | - $content = strtr( $content, $trans ); |
|
4481 | + $content = strtr($content, $trans); |
|
4482 | 4482 | |
4483 | 4483 | $trans = array( |
4484 | 4484 | '[' => '[', |
@@ -4491,7 +4491,7 @@ discard block |
||
4491 | 4491 | '&0gt;' => '>', |
4492 | 4492 | ); |
4493 | 4493 | |
4494 | - $content = strtr( $content, $trans ); |
|
4494 | + $content = strtr($content, $trans); |
|
4495 | 4495 | |
4496 | 4496 | return $content; |
4497 | 4497 | } |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @param null|string|array $query Optional. The query variables. |
99 | 99 | */ |
100 | - public function __construct( $query = null ) { |
|
101 | - if ( ! is_null( $query ) ) { |
|
102 | - $this->prepare_query( $query ); |
|
100 | + public function __construct($query = null) { |
|
101 | + if (!is_null($query)) { |
|
102 | + $this->prepare_query($query); |
|
103 | 103 | $this->query(); |
104 | 104 | } |
105 | 105 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @param string|array $args Query vars, as passed to `GetPaid_Subscriptions_Query`. |
113 | 113 | * @return array Complete query variables with undefined ones filled in with defaults. |
114 | 114 | */ |
115 | - public static function fill_query_vars( $args ) { |
|
115 | + public static function fill_query_vars($args) { |
|
116 | 116 | $defaults = array( |
117 | 117 | 'status' => 'all', |
118 | 118 | 'customer_in' => array(), |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | 'fields' => 'all', |
131 | 131 | ); |
132 | 132 | |
133 | - return wp_parse_args( $args, $defaults ); |
|
133 | + return wp_parse_args($args, $defaults); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -182,45 +182,45 @@ discard block |
||
182 | 182 | * Use 'all' for all fields. Default 'all'. |
183 | 183 | * } |
184 | 184 | */ |
185 | - public function prepare_query( $query = array() ) { |
|
185 | + public function prepare_query($query = array()) { |
|
186 | 186 | global $wpdb; |
187 | 187 | |
188 | - if ( empty( $this->query_vars ) || ! empty( $query ) ) { |
|
188 | + if (empty($this->query_vars) || !empty($query)) { |
|
189 | 189 | $this->query_limit = null; |
190 | - $this->query_vars = $this->fill_query_vars( $query ); |
|
190 | + $this->query_vars = $this->fill_query_vars($query); |
|
191 | 191 | } |
192 | 192 | |
193 | - if ( ! empty( $this->query_vars['fields'] ) && 'all' !== $this->query_vars['fields'] ) { |
|
194 | - $this->query_vars['fields'] = wpinv_parse_list( $this->query_vars['fields'] ); |
|
193 | + if (!empty($this->query_vars['fields']) && 'all' !== $this->query_vars['fields']) { |
|
194 | + $this->query_vars['fields'] = wpinv_parse_list($this->query_vars['fields']); |
|
195 | 195 | } |
196 | 196 | |
197 | - do_action( 'getpaid_pre_get_subscriptions', array( &$this ) ); |
|
197 | + do_action('getpaid_pre_get_subscriptions', array(&$this)); |
|
198 | 198 | |
199 | 199 | // Ensure that query vars are filled after 'getpaid_pre_get_subscriptions'. |
200 | - $qv =& $this->query_vars; |
|
201 | - $qv = $this->fill_query_vars( $qv ); |
|
200 | + $qv = & $this->query_vars; |
|
201 | + $qv = $this->fill_query_vars($qv); |
|
202 | 202 | $table = $wpdb->prefix . 'wpinv_subscriptions'; |
203 | 203 | $this->query_from = "FROM $table"; |
204 | 204 | |
205 | 205 | // Prepare query fields. |
206 | - $this->prepare_query_fields( $qv, $table ); |
|
206 | + $this->prepare_query_fields($qv, $table); |
|
207 | 207 | |
208 | 208 | // Prepare query where. |
209 | - $this->prepare_query_where( $qv, $table ); |
|
209 | + $this->prepare_query_where($qv, $table); |
|
210 | 210 | |
211 | 211 | // Prepare query order. |
212 | - $this->prepare_query_order( $qv, $table ); |
|
212 | + $this->prepare_query_order($qv, $table); |
|
213 | 213 | |
214 | 214 | // limit |
215 | - if ( isset( $qv['number'] ) && $qv['number'] > 0 ) { |
|
216 | - if ( $qv['offset'] ) { |
|
217 | - $this->query_limit = $wpdb->prepare( 'LIMIT %d, %d', $qv['offset'], $qv['number'] ); |
|
215 | + if (isset($qv['number']) && $qv['number'] > 0) { |
|
216 | + if ($qv['offset']) { |
|
217 | + $this->query_limit = $wpdb->prepare('LIMIT %d, %d', $qv['offset'], $qv['number']); |
|
218 | 218 | } else { |
219 | - $this->query_limit = $wpdb->prepare( 'LIMIT %d, %d', $qv['number'] * ( $qv['paged'] - 1 ), $qv['number'] ); |
|
219 | + $this->query_limit = $wpdb->prepare('LIMIT %d, %d', $qv['number'] * ($qv['paged'] - 1), $qv['number']); |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | |
223 | - do_action_ref_array( 'getpaid_after_subscriptions_query', array( &$this ) ); |
|
223 | + do_action_ref_array('getpaid_after_subscriptions_query', array(&$this)); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | /** |
@@ -231,22 +231,22 @@ discard block |
||
231 | 231 | * @param array $qv Query vars. |
232 | 232 | * @param string $table Table name. |
233 | 233 | */ |
234 | - protected function prepare_query_fields( &$qv, $table ) { |
|
234 | + protected function prepare_query_fields(&$qv, $table) { |
|
235 | 235 | |
236 | - if ( is_array( $qv['fields'] ) ) { |
|
237 | - $qv['fields'] = array_unique( $qv['fields'] ); |
|
236 | + if (is_array($qv['fields'])) { |
|
237 | + $qv['fields'] = array_unique($qv['fields']); |
|
238 | 238 | |
239 | 239 | $query_fields = array(); |
240 | - foreach ( $qv['fields'] as $field ) { |
|
241 | - $field = sanitize_key( $field ); |
|
240 | + foreach ($qv['fields'] as $field) { |
|
241 | + $field = sanitize_key($field); |
|
242 | 242 | $query_fields[] = "$table.`$field`"; |
243 | 243 | } |
244 | - $this->query_fields = implode( ',', $query_fields ); |
|
244 | + $this->query_fields = implode(',', $query_fields); |
|
245 | 245 | } else { |
246 | 246 | $this->query_fields = "$table.*"; |
247 | 247 | } |
248 | 248 | |
249 | - if ( isset( $qv['count_total'] ) && $qv['count_total'] ) { |
|
249 | + if (isset($qv['count_total']) && $qv['count_total']) { |
|
250 | 250 | $this->query_fields = 'SQL_CALC_FOUND_ROWS ' . $this->query_fields; |
251 | 251 | } |
252 | 252 | |
@@ -260,58 +260,58 @@ discard block |
||
260 | 260 | * @param array $qv Query vars. |
261 | 261 | * @param string $table Table name. |
262 | 262 | */ |
263 | - protected function prepare_query_where( &$qv, $table ) { |
|
263 | + protected function prepare_query_where(&$qv, $table) { |
|
264 | 264 | global $wpdb; |
265 | 265 | $this->query_where = 'WHERE 1=1'; |
266 | 266 | |
267 | 267 | // Status. |
268 | - if ( 'all' !== $qv['status'] ) { |
|
269 | - $statuses = wpinv_clean( wpinv_parse_list( $qv['status'] ) ); |
|
270 | - $prepared_statuses = join( ',', array_fill( 0, count( $statuses ), '%s' ) ); |
|
271 | - $this->query_where .= $wpdb->prepare( " AND $table.`status` IN ( $prepared_statuses )", $statuses ); |
|
268 | + if ('all' !== $qv['status']) { |
|
269 | + $statuses = wpinv_clean(wpinv_parse_list($qv['status'])); |
|
270 | + $prepared_statuses = join(',', array_fill(0, count($statuses), '%s')); |
|
271 | + $this->query_where .= $wpdb->prepare(" AND $table.`status` IN ( $prepared_statuses )", $statuses); |
|
272 | 272 | } |
273 | 273 | |
274 | - if ( ! empty( $qv['customer_in'] ) ) { |
|
275 | - $customer_in = implode( ',', wp_parse_id_list( $qv['customer_in'] ) ); |
|
274 | + if (!empty($qv['customer_in'])) { |
|
275 | + $customer_in = implode(',', wp_parse_id_list($qv['customer_in'])); |
|
276 | 276 | $this->query_where .= " AND $table.`customer_id` IN ($customer_in)"; |
277 | - } elseif ( ! empty( $qv['customer_not_in'] ) ) { |
|
278 | - $customer_not_in = implode( ',', wp_parse_id_list( $qv['customer_not_in'] ) ); |
|
277 | + } elseif (!empty($qv['customer_not_in'])) { |
|
278 | + $customer_not_in = implode(',', wp_parse_id_list($qv['customer_not_in'])); |
|
279 | 279 | $this->query_where .= " AND $table.`customer_id` NOT IN ($customer_not_in)"; |
280 | 280 | } |
281 | 281 | |
282 | - if ( ! empty( $qv['product_in'] ) ) { |
|
283 | - $product_in = implode( ',', wp_parse_id_list( $qv['product_in'] ) ); |
|
282 | + if (!empty($qv['product_in'])) { |
|
283 | + $product_in = implode(',', wp_parse_id_list($qv['product_in'])); |
|
284 | 284 | $this->query_where .= " AND $table.`product_id` IN ($product_in)"; |
285 | - } elseif ( ! empty( $qv['product_not_in'] ) ) { |
|
286 | - $product_not_in = implode( ',', wp_parse_id_list( $qv['product_not_in'] ) ); |
|
285 | + } elseif (!empty($qv['product_not_in'])) { |
|
286 | + $product_not_in = implode(',', wp_parse_id_list($qv['product_not_in'])); |
|
287 | 287 | $this->query_where .= " AND $table.`product_id` NOT IN ($product_not_in)"; |
288 | 288 | } |
289 | 289 | |
290 | - if ( ! empty( $qv['invoice_in'] ) ) { |
|
291 | - $invoice_in = implode( ',', wp_parse_id_list( $qv['invoice_in'] ) ); |
|
290 | + if (!empty($qv['invoice_in'])) { |
|
291 | + $invoice_in = implode(',', wp_parse_id_list($qv['invoice_in'])); |
|
292 | 292 | $this->query_where .= " AND $table.`parent_payment_id` IN ($invoice_in)"; |
293 | - } elseif ( ! empty( $qv['invoice_not_in'] ) ) { |
|
294 | - $invoice_not_in = implode( ',', wp_parse_id_list( $qv['invoice_not_in'] ) ); |
|
293 | + } elseif (!empty($qv['invoice_not_in'])) { |
|
294 | + $invoice_not_in = implode(',', wp_parse_id_list($qv['invoice_not_in'])); |
|
295 | 295 | $this->query_where .= " AND $table.`parent_payment_id` NOT IN ($invoice_not_in)"; |
296 | 296 | } |
297 | 297 | |
298 | - if ( ! empty( $qv['include'] ) ) { |
|
299 | - $include = implode( ',', wp_parse_id_list( $qv['include'] ) ); |
|
298 | + if (!empty($qv['include'])) { |
|
299 | + $include = implode(',', wp_parse_id_list($qv['include'])); |
|
300 | 300 | $this->query_where .= " AND $table.`id` IN ($include)"; |
301 | - } elseif ( ! empty( $qv['exclude'] ) ) { |
|
302 | - $exclude = implode( ',', wp_parse_id_list( $qv['exclude'] ) ); |
|
301 | + } elseif (!empty($qv['exclude'])) { |
|
302 | + $exclude = implode(',', wp_parse_id_list($qv['exclude'])); |
|
303 | 303 | $this->query_where .= " AND $table.`id` NOT IN ($exclude)"; |
304 | 304 | } |
305 | 305 | |
306 | 306 | // Date queries are allowed for the subscription creation date. |
307 | - if ( ! empty( $qv['date_created_query'] ) && is_array( $qv['date_created_query'] ) ) { |
|
308 | - $date_created_query = new WP_Date_Query( $qv['date_created_query'], "$table.created" ); |
|
307 | + if (!empty($qv['date_created_query']) && is_array($qv['date_created_query'])) { |
|
308 | + $date_created_query = new WP_Date_Query($qv['date_created_query'], "$table.created"); |
|
309 | 309 | $this->query_where .= $date_created_query->get_sql(); |
310 | 310 | } |
311 | 311 | |
312 | 312 | // Date queries are also allowed for the subscription expiration date. |
313 | - if ( ! empty( $qv['date_expires_query'] ) && is_array( $qv['date_expires_query'] ) ) { |
|
314 | - $date_expires_query = new WP_Date_Query( $qv['date_expires_query'], "$table.expiration" ); |
|
313 | + if (!empty($qv['date_expires_query']) && is_array($qv['date_expires_query'])) { |
|
314 | + $date_expires_query = new WP_Date_Query($qv['date_expires_query'], "$table.expiration"); |
|
315 | 315 | $this->query_where .= $date_expires_query->get_sql(); |
316 | 316 | } |
317 | 317 | |
@@ -325,24 +325,24 @@ discard block |
||
325 | 325 | * @param array $qv Query vars. |
326 | 326 | * @param string $table Table name. |
327 | 327 | */ |
328 | - protected function prepare_query_order( &$qv, $table ) { |
|
328 | + protected function prepare_query_order(&$qv, $table) { |
|
329 | 329 | |
330 | 330 | // sorting. |
331 | - $qv['order'] = isset( $qv['order'] ) ? strtoupper( $qv['order'] ) : ''; |
|
332 | - $order = $this->parse_order( $qv['order'] ); |
|
331 | + $qv['order'] = isset($qv['order']) ? strtoupper($qv['order']) : ''; |
|
332 | + $order = $this->parse_order($qv['order']); |
|
333 | 333 | |
334 | 334 | // Default order is by 'id' (latest subscriptions). |
335 | - if ( empty( $qv['orderby'] ) ) { |
|
336 | - $qv['orderby'] = array( 'id' ); |
|
335 | + if (empty($qv['orderby'])) { |
|
336 | + $qv['orderby'] = array('id'); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | // 'orderby' values may be an array, comma- or space-separated list. |
340 | - $ordersby = array_filter( wpinv_parse_list( $qv['orderby'] ) ); |
|
340 | + $ordersby = array_filter(wpinv_parse_list($qv['orderby'])); |
|
341 | 341 | |
342 | 342 | $orderby_array = array(); |
343 | - foreach ( $ordersby as $_key => $_value ) { |
|
343 | + foreach ($ordersby as $_key => $_value) { |
|
344 | 344 | |
345 | - if ( is_int( $_key ) ) { |
|
345 | + if (is_int($_key)) { |
|
346 | 346 | // Integer key means this is a flat array of 'orderby' fields. |
347 | 347 | $_orderby = $_value; |
348 | 348 | $_order = $order; |
@@ -352,19 +352,19 @@ discard block |
||
352 | 352 | $_order = $_value; |
353 | 353 | } |
354 | 354 | |
355 | - $parsed = $this->parse_orderby( $_orderby, $table ); |
|
355 | + $parsed = $this->parse_orderby($_orderby, $table); |
|
356 | 356 | |
357 | - if ( $parsed ) { |
|
358 | - $orderby_array[] = $parsed . ' ' . $this->parse_order( $_order ); |
|
357 | + if ($parsed) { |
|
358 | + $orderby_array[] = $parsed . ' ' . $this->parse_order($_order); |
|
359 | 359 | } |
360 | 360 | } |
361 | 361 | |
362 | 362 | // If no valid clauses were found, order by id. |
363 | - if ( empty( $orderby_array ) ) { |
|
363 | + if (empty($orderby_array)) { |
|
364 | 364 | $orderby_array[] = "id $order"; |
365 | 365 | } |
366 | 366 | |
367 | - $this->query_orderby = 'ORDER BY ' . implode( ', ', $orderby_array ); |
|
367 | + $this->query_orderby = 'ORDER BY ' . implode(', ', $orderby_array); |
|
368 | 368 | |
369 | 369 | } |
370 | 370 | |
@@ -378,34 +378,34 @@ discard block |
||
378 | 378 | public function query() { |
379 | 379 | global $wpdb; |
380 | 380 | |
381 | - $qv =& $this->query_vars; |
|
381 | + $qv = & $this->query_vars; |
|
382 | 382 | |
383 | 383 | // Return a non-null value to bypass the default GetPaid subscriptions query and remember to set the |
384 | 384 | // total_subscriptions property. |
385 | - $this->results = apply_filters_ref_array( 'getpaid_subscriptions_pre_query', array( null, &$this ) ); |
|
385 | + $this->results = apply_filters_ref_array('getpaid_subscriptions_pre_query', array(null, &$this)); |
|
386 | 386 | |
387 | - if ( null === $this->results ) { |
|
387 | + if (null === $this->results) { |
|
388 | 388 | $this->request = "SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit"; |
389 | 389 | |
390 | - if ( ( is_array( $qv['fields'] ) && 1 != count( $qv['fields'] ) ) || 'all' == $qv['fields'] ) { |
|
391 | - $this->results = $wpdb->get_results( $this->request ); |
|
390 | + if ((is_array($qv['fields']) && 1 != count($qv['fields'])) || 'all' == $qv['fields']) { |
|
391 | + $this->results = $wpdb->get_results($this->request); |
|
392 | 392 | } else { |
393 | - $this->results = $wpdb->get_col( $this->request ); |
|
393 | + $this->results = $wpdb->get_col($this->request); |
|
394 | 394 | } |
395 | 395 | |
396 | - if ( isset( $qv['count_total'] ) && $qv['count_total'] ) { |
|
397 | - $found_subscriptions_query = apply_filters( 'getpaid_found_subscriptions_query', 'SELECT FOUND_ROWS()', $this ); |
|
398 | - $this->total_subscriptions = (int) $wpdb->get_var( $found_subscriptions_query ); |
|
396 | + if (isset($qv['count_total']) && $qv['count_total']) { |
|
397 | + $found_subscriptions_query = apply_filters('getpaid_found_subscriptions_query', 'SELECT FOUND_ROWS()', $this); |
|
398 | + $this->total_subscriptions = (int) $wpdb->get_var($found_subscriptions_query); |
|
399 | 399 | } |
400 | 400 | } |
401 | 401 | |
402 | - if ( 'all' == $qv['fields'] ) { |
|
403 | - foreach ( $this->results as $key => $subscription ) { |
|
404 | - $this->set_cache( $subscription->id, $subscription, 'getpaid_subscriptions' ); |
|
405 | - $this->set_cache( $subscription->profile_id, $subscription->id, 'getpaid_subscription_profile_ids_to_subscription_ids' ); |
|
406 | - $this->set_cache( $subscription->transaction_id, $subscription->id, 'getpaid_subscription_transaction_ids_to_subscription_ids' ); |
|
407 | - $this->set_cache( $subscription->transaction_id, $subscription->id, 'getpaid_subscription_transaction_ids_to_subscription_ids' ); |
|
408 | - $this->results[ $key ] = new WPInv_Subscription( $subscription ); |
|
402 | + if ('all' == $qv['fields']) { |
|
403 | + foreach ($this->results as $key => $subscription) { |
|
404 | + $this->set_cache($subscription->id, $subscription, 'getpaid_subscriptions'); |
|
405 | + $this->set_cache($subscription->profile_id, $subscription->id, 'getpaid_subscription_profile_ids_to_subscription_ids'); |
|
406 | + $this->set_cache($subscription->transaction_id, $subscription->id, 'getpaid_subscription_transaction_ids_to_subscription_ids'); |
|
407 | + $this->set_cache($subscription->transaction_id, $subscription->id, 'getpaid_subscription_transaction_ids_to_subscription_ids'); |
|
408 | + $this->results[$key] = new WPInv_Subscription($subscription); |
|
409 | 409 | } |
410 | 410 | } |
411 | 411 | |
@@ -420,13 +420,13 @@ discard block |
||
420 | 420 | * @param integer $expire |
421 | 421 | * @return boolean |
422 | 422 | */ |
423 | - public function set_cache( $key, $data, $group = '', $expire = 0 ) { |
|
423 | + public function set_cache($key, $data, $group = '', $expire = 0) { |
|
424 | 424 | |
425 | - if ( empty( $key ) ) { |
|
425 | + if (empty($key)) { |
|
426 | 426 | return false; |
427 | 427 | } |
428 | 428 | |
429 | - wp_cache_set( $key, $data, $group, $expire ); |
|
429 | + wp_cache_set($key, $data, $group, $expire); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | /** |
@@ -437,9 +437,9 @@ discard block |
||
437 | 437 | * @param string $query_var Query variable key. |
438 | 438 | * @return mixed |
439 | 439 | */ |
440 | - public function get( $query_var ) { |
|
441 | - if ( isset( $this->query_vars[ $query_var ] ) ) { |
|
442 | - return $this->query_vars[ $query_var ]; |
|
440 | + public function get($query_var) { |
|
441 | + if (isset($this->query_vars[$query_var])) { |
|
442 | + return $this->query_vars[$query_var]; |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | return null; |
@@ -453,8 +453,8 @@ discard block |
||
453 | 453 | * @param string $query_var Query variable key. |
454 | 454 | * @param mixed $value Query variable value. |
455 | 455 | */ |
456 | - public function set( $query_var, $value ) { |
|
457 | - $this->query_vars[ $query_var ] = $value; |
|
456 | + public function set($query_var, $value) { |
|
457 | + $this->query_vars[$query_var] = $value; |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | /** |
@@ -488,16 +488,16 @@ discard block |
||
488 | 488 | * @param string $table The current table. |
489 | 489 | * @return string Value to use in the ORDER clause, if `$orderby` is valid. |
490 | 490 | */ |
491 | - protected function parse_orderby( $orderby, $table ) { |
|
491 | + protected function parse_orderby($orderby, $table) { |
|
492 | 492 | |
493 | 493 | $_orderby = ''; |
494 | - if ( in_array( $orderby, array( 'customer_id', 'frequency', 'period', 'initial_amount', 'recurring_amount', 'bill_times', 'transaction_id', 'parent_payment_id', 'product_id', 'created', 'expiration', 'trial_period', 'status', 'profile_id' ) ) ) { |
|
494 | + if (in_array($orderby, array('customer_id', 'frequency', 'period', 'initial_amount', 'recurring_amount', 'bill_times', 'transaction_id', 'parent_payment_id', 'product_id', 'created', 'expiration', 'trial_period', 'status', 'profile_id'))) { |
|
495 | 495 | $_orderby = "$table.`$orderby`"; |
496 | - } elseif ( 'id' === strtolower( $orderby ) ) { |
|
496 | + } elseif ('id' === strtolower($orderby)) { |
|
497 | 497 | $_orderby = "$table.id"; |
498 | - } elseif ( 'include' === $orderby && ! empty( $this->query_vars['include'] ) ) { |
|
499 | - $include = wp_parse_id_list( $this->query_vars['include'] ); |
|
500 | - $include_sql = implode( ',', $include ); |
|
498 | + } elseif ('include' === $orderby && !empty($this->query_vars['include'])) { |
|
499 | + $include = wp_parse_id_list($this->query_vars['include']); |
|
500 | + $include_sql = implode(',', $include); |
|
501 | 501 | $_orderby = "FIELD( $table.id, $include_sql )"; |
502 | 502 | } |
503 | 503 | |
@@ -512,12 +512,12 @@ discard block |
||
512 | 512 | * @param string $order The 'order' query variable. |
513 | 513 | * @return string The sanitized 'order' query variable. |
514 | 514 | */ |
515 | - protected function parse_order( $order ) { |
|
516 | - if ( ! is_string( $order ) || empty( $order ) ) { |
|
515 | + protected function parse_order($order) { |
|
516 | + if (!is_string($order) || empty($order)) { |
|
517 | 517 | return 'DESC'; |
518 | 518 | } |
519 | 519 | |
520 | - if ( 'ASC' === strtoupper( $order ) ) { |
|
520 | + if ('ASC' === strtoupper($order)) { |
|
521 | 521 | return 'ASC'; |
522 | 522 | } else { |
523 | 523 | return 'DESC'; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Bank transfer Payment Gateway class. |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @var array |
26 | 26 | */ |
27 | - protected $supports = array( 'subscription', 'addons', 'single_subscription_group', 'multiple_subscription_groups' ); |
|
27 | + protected $supports = array('subscription', 'addons', 'single_subscription_group', 'multiple_subscription_groups'); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Payment method order. |
@@ -39,17 +39,17 @@ discard block |
||
39 | 39 | public function __construct() { |
40 | 40 | parent::__construct(); |
41 | 41 | |
42 | - $this->title = __( 'Direct bank transfer', 'invoicing' ); |
|
43 | - $this->method_title = __( 'Bank transfer', 'invoicing' ); |
|
44 | - $this->checkout_button_text = __( 'Proceed', 'invoicing' ); |
|
45 | - $this->instructions = apply_filters( 'wpinv_bank_instructions', $this->get_option( 'info' ) ); |
|
42 | + $this->title = __('Direct bank transfer', 'invoicing'); |
|
43 | + $this->method_title = __('Bank transfer', 'invoicing'); |
|
44 | + $this->checkout_button_text = __('Proceed', 'invoicing'); |
|
45 | + $this->instructions = apply_filters('wpinv_bank_instructions', $this->get_option('info')); |
|
46 | 46 | |
47 | - add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) ); |
|
48 | - add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 ); |
|
49 | - add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 ); |
|
50 | - add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 ); |
|
51 | - add_action( 'getpaid_should_renew_subscription', array( $this, 'maybe_renew_subscription' ) ); |
|
52 | - add_action( 'getpaid_invoice_status_publish', array( $this, 'invoice_paid' ), 20 ); |
|
47 | + add_action('wpinv_receipt_end', array($this, 'thankyou_page')); |
|
48 | + add_action('getpaid_invoice_line_items', array($this, 'thankyou_page'), 40); |
|
49 | + add_action('wpinv_pdf_content_billing', array($this, 'thankyou_page'), 11); |
|
50 | + add_action('wpinv_email_invoice_details', array($this, 'email_instructions'), 10, 3); |
|
51 | + add_action('getpaid_should_renew_subscription', array($this, 'maybe_renew_subscription')); |
|
52 | + add_action('getpaid_invoice_status_publish', array($this, 'invoice_paid'), 20); |
|
53 | 53 | |
54 | 54 | } |
55 | 55 | |
@@ -61,23 +61,23 @@ discard block |
||
61 | 61 | * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
62 | 62 | * @return array |
63 | 63 | */ |
64 | - public function process_payment( $invoice, $submission_data, $submission ) { |
|
64 | + public function process_payment($invoice, $submission_data, $submission) { |
|
65 | 65 | |
66 | 66 | // Add a transaction id. |
67 | - $invoice->set_transaction_id( $invoice->generate_key( 'bt_' ) ); |
|
67 | + $invoice->set_transaction_id($invoice->generate_key('bt_')); |
|
68 | 68 | |
69 | 69 | // Set it as pending payment. |
70 | - if ( ! $invoice->needs_payment() ) { |
|
70 | + if (!$invoice->needs_payment()) { |
|
71 | 71 | $invoice->mark_paid(); |
72 | - } elseif ( ! $invoice->is_paid() ) { |
|
73 | - $invoice->set_status( 'wpi-onhold' ); |
|
72 | + } elseif (!$invoice->is_paid()) { |
|
73 | + $invoice->set_status('wpi-onhold'); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | // Save it. |
77 | 77 | $invoice->save(); |
78 | 78 | |
79 | 79 | // Send to the success page. |
80 | - wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) ); |
|
80 | + wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key())); |
|
81 | 81 | |
82 | 82 | } |
83 | 83 | |
@@ -86,17 +86,17 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @param WPInv_Invoice $invoice Invoice. |
88 | 88 | */ |
89 | - public function thankyou_page( $invoice ) { |
|
89 | + public function thankyou_page($invoice) { |
|
90 | 90 | |
91 | - if ( 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) { |
|
91 | + if ('bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) { |
|
92 | 92 | |
93 | 93 | echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL; |
94 | 94 | |
95 | - if ( ! empty( $this->instructions ) ) { |
|
96 | - echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) ); |
|
95 | + if (!empty($this->instructions)) { |
|
96 | + echo wp_kses_post(wpautop(wptexturize($this->instructions))); |
|
97 | 97 | } |
98 | 98 | |
99 | - $this->bank_details( $invoice ); |
|
99 | + $this->bank_details($invoice); |
|
100 | 100 | |
101 | 101 | echo '</div>'; |
102 | 102 | |
@@ -111,17 +111,17 @@ discard block |
||
111 | 111 | * @param string $email_type Email format: plain text or HTML. |
112 | 112 | * @param bool $sent_to_admin Sent to admin. |
113 | 113 | */ |
114 | - public function email_instructions( $invoice, $email_type, $sent_to_admin ) { |
|
114 | + public function email_instructions($invoice, $email_type, $sent_to_admin) { |
|
115 | 115 | |
116 | - if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) { |
|
116 | + if (!$sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) { |
|
117 | 117 | |
118 | 118 | echo '<div class="wpi-email-row getpaid-bank-transfer-details">'; |
119 | 119 | |
120 | - if ( $this->instructions ) { |
|
121 | - echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL ); |
|
120 | + if ($this->instructions) { |
|
121 | + echo wp_kses_post(wpautop(wptexturize($this->instructions)) . PHP_EOL); |
|
122 | 122 | } |
123 | 123 | |
124 | - $this->bank_details( $invoice ); |
|
124 | + $this->bank_details($invoice); |
|
125 | 125 | |
126 | 126 | echo '</div>'; |
127 | 127 | |
@@ -134,50 +134,50 @@ discard block |
||
134 | 134 | * |
135 | 135 | * @param WPInv_Invoice $invoice Invoice. |
136 | 136 | */ |
137 | - protected function bank_details( $invoice ) { |
|
137 | + protected function bank_details($invoice) { |
|
138 | 138 | |
139 | 139 | // Get the invoice country and country $locale. |
140 | 140 | $country = $invoice->get_country(); |
141 | 141 | $locale = $this->get_country_locale(); |
142 | 142 | |
143 | 143 | // Get sortcode label in the $locale array and use appropriate one. |
144 | - $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' ); |
|
144 | + $sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing'); |
|
145 | 145 | |
146 | 146 | $bank_fields = array( |
147 | - 'ac_name' => __( 'Account Name', 'invoicing' ), |
|
148 | - 'ac_no' => __( 'Account Number', 'invoicing' ), |
|
149 | - 'bank_name' => __( 'Bank Name', 'invoicing' ), |
|
150 | - 'ifsc' => __( 'IFSC code', 'invoicing' ), |
|
151 | - 'iban' => __( 'IBAN', 'invoicing' ), |
|
152 | - 'bic' => __( 'BIC/Swift code', 'invoicing' ), |
|
147 | + 'ac_name' => __('Account Name', 'invoicing'), |
|
148 | + 'ac_no' => __('Account Number', 'invoicing'), |
|
149 | + 'bank_name' => __('Bank Name', 'invoicing'), |
|
150 | + 'ifsc' => __('IFSC code', 'invoicing'), |
|
151 | + 'iban' => __('IBAN', 'invoicing'), |
|
152 | + 'bic' => __('BIC/Swift code', 'invoicing'), |
|
153 | 153 | 'sort_code' => $sortcode, |
154 | 154 | ); |
155 | 155 | |
156 | 156 | $bank_info = array(); |
157 | 157 | |
158 | - foreach ( $bank_fields as $field => $label ) { |
|
159 | - $value = $this->get_option( $field ); |
|
158 | + foreach ($bank_fields as $field => $label) { |
|
159 | + $value = $this->get_option($field); |
|
160 | 160 | |
161 | - if ( ! empty( $value ) ) { |
|
162 | - $bank_info[ $field ] = array( |
|
161 | + if (!empty($value)) { |
|
162 | + $bank_info[$field] = array( |
|
163 | 163 | 'label' => $label, |
164 | 164 | 'value' => $value, |
165 | 165 | ); |
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | - $bank_info = apply_filters( 'wpinv_bank_info', $bank_info, $invoice ); |
|
169 | + $bank_info = apply_filters('wpinv_bank_info', $bank_info, $invoice); |
|
170 | 170 | |
171 | - if ( empty( $bank_info ) ) { |
|
171 | + if (empty($bank_info)) { |
|
172 | 172 | return; |
173 | 173 | } |
174 | 174 | |
175 | - echo '<h3 class="getpaid-bank-transfer-title"> ' . esc_html( apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ), $invoice ) ) . '</h3>' . PHP_EOL; |
|
175 | + echo '<h3 class="getpaid-bank-transfer-title"> ' . esc_html(apply_filters('wpinv_receipt_bank_details_title', __('Bank Details', 'invoicing'), $invoice)) . '</h3>' . PHP_EOL; |
|
176 | 176 | |
177 | 177 | echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL; |
178 | 178 | |
179 | - foreach ( $bank_info as $key => $data ) { |
|
180 | - echo "<tr class='getpaid-bank-transfer-" . esc_attr( $key ) . "'><th class='font-weight-bold'>" . wp_kses_post( $data['label'] ) . "</th><td class='w-75'>" . wp_kses_post( wptexturize( $data['value'] ) ) . '</td></tr>' . PHP_EOL; |
|
179 | + foreach ($bank_info as $key => $data) { |
|
180 | + echo "<tr class='getpaid-bank-transfer-" . esc_attr($key) . "'><th class='font-weight-bold'>" . wp_kses_post($data['label']) . "</th><td class='w-75'>" . wp_kses_post(wptexturize($data['value'])) . '</td></tr>' . PHP_EOL; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | echo '</table>'; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function get_country_locale() { |
193 | 193 | |
194 | - if ( empty( $this->locale ) ) { |
|
194 | + if (empty($this->locale)) { |
|
195 | 195 | |
196 | 196 | // Locale information to be used - only those that are not 'Sort Code'. |
197 | 197 | $this->locale = apply_filters( |
@@ -199,42 +199,42 @@ discard block |
||
199 | 199 | array( |
200 | 200 | 'AU' => array( |
201 | 201 | 'sortcode' => array( |
202 | - 'label' => __( 'BSB', 'invoicing' ), |
|
202 | + 'label' => __('BSB', 'invoicing'), |
|
203 | 203 | ), |
204 | 204 | ), |
205 | 205 | 'CA' => array( |
206 | 206 | 'sortcode' => array( |
207 | - 'label' => __( 'Bank transit number', 'invoicing' ), |
|
207 | + 'label' => __('Bank transit number', 'invoicing'), |
|
208 | 208 | ), |
209 | 209 | ), |
210 | 210 | 'IN' => array( |
211 | 211 | 'sortcode' => array( |
212 | - 'label' => __( 'IFSC', 'invoicing' ), |
|
212 | + 'label' => __('IFSC', 'invoicing'), |
|
213 | 213 | ), |
214 | 214 | ), |
215 | 215 | 'IT' => array( |
216 | 216 | 'sortcode' => array( |
217 | - 'label' => __( 'Branch sort', 'invoicing' ), |
|
217 | + 'label' => __('Branch sort', 'invoicing'), |
|
218 | 218 | ), |
219 | 219 | ), |
220 | 220 | 'NZ' => array( |
221 | 221 | 'sortcode' => array( |
222 | - 'label' => __( 'Bank code', 'invoicing' ), |
|
222 | + 'label' => __('Bank code', 'invoicing'), |
|
223 | 223 | ), |
224 | 224 | ), |
225 | 225 | 'SE' => array( |
226 | 226 | 'sortcode' => array( |
227 | - 'label' => __( 'Bank code', 'invoicing' ), |
|
227 | + 'label' => __('Bank code', 'invoicing'), |
|
228 | 228 | ), |
229 | 229 | ), |
230 | 230 | 'US' => array( |
231 | 231 | 'sortcode' => array( |
232 | - 'label' => __( 'Routing number', 'invoicing' ), |
|
232 | + 'label' => __('Routing number', 'invoicing'), |
|
233 | 233 | ), |
234 | 234 | ), |
235 | 235 | 'ZA' => array( |
236 | 236 | 'sortcode' => array( |
237 | - 'label' => __( 'Branch code', 'invoicing' ), |
|
237 | + 'label' => __('Branch code', 'invoicing'), |
|
238 | 238 | ), |
239 | 239 | ), |
240 | 240 | ) |
@@ -251,51 +251,51 @@ discard block |
||
251 | 251 | * |
252 | 252 | * @param array $admin_settings |
253 | 253 | */ |
254 | - public function admin_settings( $admin_settings ) { |
|
254 | + public function admin_settings($admin_settings) { |
|
255 | 255 | |
256 | - $admin_settings['bank_transfer_desc']['std'] = __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' ); |
|
257 | - $admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' ); |
|
256 | + $admin_settings['bank_transfer_desc']['std'] = __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing'); |
|
257 | + $admin_settings['bank_transfer_active']['desc'] = __('Enable bank transfer', 'invoicing'); |
|
258 | 258 | |
259 | - $locale = $this->get_country_locale(); |
|
259 | + $locale = $this->get_country_locale(); |
|
260 | 260 | |
261 | 261 | // Get sortcode label in the $locale array and use appropriate one. |
262 | 262 | $country = wpinv_default_billing_country(); |
263 | - $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' ); |
|
263 | + $sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing'); |
|
264 | 264 | |
265 | 265 | $admin_settings['bank_transfer_ac_name'] = array( |
266 | 266 | 'type' => 'text', |
267 | 267 | 'id' => 'bank_transfer_ac_name', |
268 | - 'name' => __( 'Account Name', 'invoicing' ), |
|
268 | + 'name' => __('Account Name', 'invoicing'), |
|
269 | 269 | ); |
270 | 270 | |
271 | 271 | $admin_settings['bank_transfer_ac_no'] = array( |
272 | 272 | 'type' => 'text', |
273 | 273 | 'id' => 'bank_transfer_ac_no', |
274 | - 'name' => __( 'Account Number', 'invoicing' ), |
|
274 | + 'name' => __('Account Number', 'invoicing'), |
|
275 | 275 | ); |
276 | 276 | |
277 | 277 | $admin_settings['bank_transfer_bank_name'] = array( |
278 | 278 | 'type' => 'text', |
279 | 279 | 'id' => 'bank_transfer_bank_name', |
280 | - 'name' => __( 'Bank Name', 'invoicing' ), |
|
280 | + 'name' => __('Bank Name', 'invoicing'), |
|
281 | 281 | ); |
282 | 282 | |
283 | 283 | $admin_settings['bank_transfer_ifsc'] = array( |
284 | 284 | 'type' => 'text', |
285 | 285 | 'id' => 'bank_transfer_ifsc', |
286 | - 'name' => __( 'IFSC Code', 'invoicing' ), |
|
286 | + 'name' => __('IFSC Code', 'invoicing'), |
|
287 | 287 | ); |
288 | 288 | |
289 | 289 | $admin_settings['bank_transfer_iban'] = array( |
290 | 290 | 'type' => 'text', |
291 | 291 | 'id' => 'bank_transfer_iban', |
292 | - 'name' => __( 'IBAN', 'invoicing' ), |
|
292 | + 'name' => __('IBAN', 'invoicing'), |
|
293 | 293 | ); |
294 | 294 | |
295 | 295 | $admin_settings['bank_transfer_bic'] = array( |
296 | 296 | 'type' => 'text', |
297 | 297 | 'id' => 'bank_transfer_bic', |
298 | - 'name' => __( 'BIC/Swift Code', 'invoicing' ), |
|
298 | + 'name' => __('BIC/Swift Code', 'invoicing'), |
|
299 | 299 | ); |
300 | 300 | |
301 | 301 | $admin_settings['bank_transfer_sort_code'] = array( |
@@ -306,10 +306,10 @@ discard block |
||
306 | 306 | |
307 | 307 | $admin_settings['bank_transfer_info'] = array( |
308 | 308 | 'id' => 'bank_transfer_info', |
309 | - 'name' => __( 'Instructions', 'invoicing' ), |
|
310 | - 'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ), |
|
309 | + 'name' => __('Instructions', 'invoicing'), |
|
310 | + 'desc' => __('Instructions that will be added to the thank you page and emails.', 'invoicing'), |
|
311 | 311 | 'type' => 'textarea', |
312 | - 'std' => __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' ), |
|
312 | + 'std' => __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing'), |
|
313 | 313 | 'cols' => 50, |
314 | 314 | 'rows' => 5, |
315 | 315 | ); |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | * @param GetPaid_Form_Item[] $items |
325 | 325 | * @return WPInv_Invoice |
326 | 326 | */ |
327 | - public function process_addons( $invoice, $items ) { |
|
327 | + public function process_addons($invoice, $items) { |
|
328 | 328 | |
329 | - foreach ( $items as $item ) { |
|
330 | - $invoice->add_item( $item ); |
|
329 | + foreach ($items as $item) { |
|
330 | + $invoice->add_item($item); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | $invoice->recalculate_total(); |
@@ -340,10 +340,10 @@ discard block |
||
340 | 340 | * |
341 | 341 | * @param WPInv_Subscription $subscription |
342 | 342 | */ |
343 | - public function maybe_renew_subscription( $subscription ) { |
|
343 | + public function maybe_renew_subscription($subscription) { |
|
344 | 344 | |
345 | 345 | // Ensure its our subscription && it's active. |
346 | - if ( $this->id === $subscription->get_gateway() && $subscription->has_status( 'active trialling' ) ) { |
|
346 | + if ($this->id === $subscription->get_gateway() && $subscription->has_status('active trialling')) { |
|
347 | 347 | $subscription->create_payment(); |
348 | 348 | } |
349 | 349 | |
@@ -355,42 +355,42 @@ discard block |
||
355 | 355 | * |
356 | 356 | * @param WPInv_Invoice $invoice |
357 | 357 | */ |
358 | - public function invoice_paid( $invoice ) { |
|
358 | + public function invoice_paid($invoice) { |
|
359 | 359 | |
360 | 360 | // Abort if not paid by bank transfer. |
361 | - if ( $this->id !== $invoice->get_gateway() || ! $invoice->is_recurring() ) { |
|
361 | + if ($this->id !== $invoice->get_gateway() || !$invoice->is_recurring()) { |
|
362 | 362 | return; |
363 | 363 | } |
364 | 364 | |
365 | 365 | // Is it a parent payment? |
366 | - if ( 0 == $invoice->get_parent_id() ) { |
|
366 | + if (0 == $invoice->get_parent_id()) { |
|
367 | 367 | |
368 | 368 | // (Maybe) activate subscriptions. |
369 | - $subscriptions = getpaid_get_invoice_subscriptions( $invoice ); |
|
369 | + $subscriptions = getpaid_get_invoice_subscriptions($invoice); |
|
370 | 370 | |
371 | - if ( ! empty( $subscriptions ) ) { |
|
372 | - $subscriptions = is_array( $subscriptions ) ? $subscriptions : array( $subscriptions ); |
|
371 | + if (!empty($subscriptions)) { |
|
372 | + $subscriptions = is_array($subscriptions) ? $subscriptions : array($subscriptions); |
|
373 | 373 | |
374 | - foreach ( $subscriptions as $subscription ) { |
|
375 | - if ( $subscription->exists() ) { |
|
376 | - $duration = strtotime( $subscription->get_expiration() ) - strtotime( $subscription->get_date_created() ); |
|
377 | - $expiry = date( 'Y-m-d H:i:s', ( current_time( 'timestamp' ) + $duration ) ); |
|
374 | + foreach ($subscriptions as $subscription) { |
|
375 | + if ($subscription->exists()) { |
|
376 | + $duration = strtotime($subscription->get_expiration()) - strtotime($subscription->get_date_created()); |
|
377 | + $expiry = date('Y-m-d H:i:s', (current_time('timestamp') + $duration)); |
|
378 | 378 | |
379 | - $subscription->set_next_renewal_date( $expiry ); |
|
380 | - $subscription->set_date_created( current_time( 'mysql' ) ); |
|
381 | - $subscription->set_profile_id( 'bt_sub_' . $invoice->get_id() . '_' . $subscription->get_id() ); |
|
379 | + $subscription->set_next_renewal_date($expiry); |
|
380 | + $subscription->set_date_created(current_time('mysql')); |
|
381 | + $subscription->set_profile_id('bt_sub_' . $invoice->get_id() . '_' . $subscription->get_id()); |
|
382 | 382 | $subscription->activate(); |
383 | 383 | } |
384 | 384 | } |
385 | 385 | } |
386 | 386 | } else { |
387 | 387 | |
388 | - $subscription = getpaid_get_subscription( $invoice->get_subscription_id() ); |
|
388 | + $subscription = getpaid_get_subscription($invoice->get_subscription_id()); |
|
389 | 389 | |
390 | 390 | // Renew the subscription. |
391 | - if ( $subscription && $subscription->exists() ) { |
|
392 | - $subscription->add_payment( array(), $invoice ); |
|
393 | - $subscription->renew( strtotime( $invoice->get_date_created() ) ); |
|
391 | + if ($subscription && $subscription->exists()) { |
|
392 | + $subscription->add_payment(array(), $invoice); |
|
393 | + $subscription->renew(strtotime($invoice->get_date_created())); |
|
394 | 394 | } |
395 | 395 | } |
396 | 396 |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | * @var array $fee |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | +defined('ABSPATH') || exit; |
|
13 | 13 | |
14 | -do_action( 'getpaid_before_invoice_fee_item', $invoice, $fee ); |
|
14 | +do_action('getpaid_before_invoice_fee_item', $invoice, $fee); |
|
15 | 15 | |
16 | 16 | ?> |
17 | 17 | |
@@ -19,64 +19,64 @@ discard block |
||
19 | 19 | |
20 | 20 | <div class="form-row row"> |
21 | 21 | |
22 | - <?php foreach ( array_keys( $columns ) as $column ) : ?> |
|
22 | + <?php foreach (array_keys($columns) as $column) : ?> |
|
23 | 23 | |
24 | - <div class="<?php echo 'name' == $column ? 'col-12 col-sm-6' : 'col-12 col-sm'; ?> getpaid-invoice-item-<?php echo esc_attr( $column ); ?>"> |
|
24 | + <div class="<?php echo 'name' == $column ? 'col-12 col-sm-6' : 'col-12 col-sm'; ?> getpaid-invoice-item-<?php echo esc_attr($column); ?>"> |
|
25 | 25 | |
26 | 26 | <?php |
27 | 27 | |
28 | 28 | // Fires before printing a fee item column. |
29 | - do_action( "getpaid_invoice_fee_item_before_$column", $fee, $invoice ); |
|
29 | + do_action("getpaid_invoice_fee_item_before_$column", $fee, $invoice); |
|
30 | 30 | |
31 | 31 | // Item name. |
32 | - if ( 'name' == $column ) { |
|
32 | + if ('name' == $column) { |
|
33 | 33 | |
34 | 34 | // Display the name. |
35 | - echo '<div class="mb-1">' . esc_html( $fee['name'] ) . '</div>'; |
|
35 | + echo '<div class="mb-1">' . esc_html($fee['name']) . '</div>'; |
|
36 | 36 | |
37 | 37 | // And an optional description. |
38 | - $description = empty( $fee['description'] ) ? esc_html__( 'Fee', 'invoicing' ) : esc_html( $fee['description'] ); |
|
39 | - echo wp_kses_post( "<small class='form-text text-muted pr-2 m-0'>$description</small>" ); |
|
38 | + $description = empty($fee['description']) ? esc_html__('Fee', 'invoicing') : esc_html($fee['description']); |
|
39 | + echo wp_kses_post("<small class='form-text text-muted pr-2 m-0'>$description</small>"); |
|
40 | 40 | |
41 | 41 | } |
42 | 42 | |
43 | 43 | // Item price. |
44 | - if ( 'price' == $column ) { |
|
44 | + if ('price' == $column) { |
|
45 | 45 | |
46 | 46 | // Display the item price (or recurring price if this is a renewal invoice) |
47 | - if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
48 | - wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
47 | + if ($invoice->is_recurring() && $invoice->is_renewal()) { |
|
48 | + wpinv_the_price($fee['recurring_fee'], $invoice->get_currency()); |
|
49 | 49 | } else { |
50 | - wpinv_the_price( $fee['initial_fee'], $invoice->get_currency() ); |
|
50 | + wpinv_the_price($fee['initial_fee'], $invoice->get_currency()); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | 54 | // Item quantity. |
55 | - if ( 'quantity' == $column ) { |
|
55 | + if ('quantity' == $column) { |
|
56 | 56 | echo '—'; |
57 | 57 | } |
58 | 58 | |
59 | 59 | // Item tax. |
60 | - if ( 'tax_rate' == $column ) { |
|
60 | + if ('tax_rate' == $column) { |
|
61 | 61 | echo '—'; |
62 | 62 | } |
63 | 63 | |
64 | 64 | // Item sub total. |
65 | - if ( 'subtotal' == $column ) { |
|
65 | + if ('subtotal' == $column) { |
|
66 | 66 | |
67 | 67 | // Display the item price (or recurring price if this is a renewal invoice) |
68 | - if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
69 | - wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
68 | + if ($invoice->is_recurring() && $invoice->is_renewal()) { |
|
69 | + wpinv_the_price($fee['recurring_fee'], $invoice->get_currency()); |
|
70 | 70 | } else { |
71 | - wpinv_the_price( $fee['initial_fee'], $invoice->get_currency() ); |
|
71 | + wpinv_the_price($fee['initial_fee'], $invoice->get_currency()); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | 75 | // Fires when printing a fee item column. |
76 | - do_action( "getpaid_invoice_fee_item_$column", $fee, $invoice ); |
|
76 | + do_action("getpaid_invoice_fee_item_$column", $fee, $invoice); |
|
77 | 77 | |
78 | 78 | // Fires after printing a fee item column. |
79 | - do_action( "getpaid_invoice_fee_item_after_$column", $fee, $invoice ); |
|
79 | + do_action("getpaid_invoice_fee_item_after_$column", $fee, $invoice); |
|
80 | 80 | |
81 | 81 | ?> |
82 | 82 |
@@ -9,26 +9,26 @@ discard block |
||
9 | 9 | * @var WPInv_Invoice $invoice |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | +defined('ABSPATH') || exit; |
|
13 | 13 | |
14 | 14 | // Totals rows. |
15 | -$totals = getpaid_invoice_totals_rows( $invoice ); |
|
15 | +$totals = getpaid_invoice_totals_rows($invoice); |
|
16 | 16 | |
17 | -do_action( 'getpaid_before_invoice_line_totals', $invoice, $totals ); |
|
17 | +do_action('getpaid_before_invoice_line_totals', $invoice, $totals); |
|
18 | 18 | |
19 | 19 | ?> |
20 | 20 | <div class='getpaid-invoice-line-totals'> |
21 | 21 | <div class="row"> |
22 | 22 | <div class="col-12 offset-sm-6 col-sm-6 border-sm-left pl-sm-0"> |
23 | 23 | |
24 | - <?php foreach ( $totals as $key => $label ) : ?> |
|
24 | + <?php foreach ($totals as $key => $label) : ?> |
|
25 | 25 | |
26 | - <div class="getpaid-invoice-line-totals-col <?php echo esc_attr( $key ); ?>"> |
|
26 | + <div class="getpaid-invoice-line-totals-col <?php echo esc_attr($key); ?>"> |
|
27 | 27 | |
28 | 28 | <div class="form-row row"> |
29 | 29 | |
30 | 30 | <div class="col-8 getpaid-invoice-line-totals-label"> |
31 | - <?php echo esc_html( $label ); ?> |
|
31 | + <?php echo esc_html($label); ?> |
|
32 | 32 | </div> |
33 | 33 | |
34 | 34 | <div class="col-4 getpaid-invoice-line-totals-value pl-0"> |
@@ -36,47 +36,47 @@ discard block |
||
36 | 36 | <?php |
37 | 37 | |
38 | 38 | // Total tax. |
39 | - if ( 'tax' === $key ) { |
|
40 | - wpinv_the_price( $invoice->get_total_tax(), $invoice->get_currency() ); |
|
39 | + if ('tax' === $key) { |
|
40 | + wpinv_the_price($invoice->get_total_tax(), $invoice->get_currency()); |
|
41 | 41 | |
42 | - if ( wpinv_use_taxes() && ! $invoice->get_disable_taxes() ) { |
|
42 | + if (wpinv_use_taxes() && !$invoice->get_disable_taxes()) { |
|
43 | 43 | |
44 | 44 | $taxes = $invoice->get_total_tax(); |
45 | - if ( empty( $taxes ) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $invoice->get_country() ) ) { |
|
45 | + if (empty($taxes) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction($invoice->get_country())) { |
|
46 | 46 | echo ' <em class="text-muted small">'; |
47 | - _x( '(Reverse charged)', 'This is a legal term for reverse charging tax in the EU', 'invoicing' ); |
|
47 | + _x('(Reverse charged)', 'This is a legal term for reverse charging tax in the EU', 'invoicing'); |
|
48 | 48 | echo '</em>'; |
49 | 49 | } |
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | 53 | // Total Fee. |
54 | - if ( 'fee' === $key ) { |
|
55 | - wpinv_the_price( $invoice->get_total_fees(), $invoice->get_currency() ); |
|
54 | + if ('fee' === $key) { |
|
55 | + wpinv_the_price($invoice->get_total_fees(), $invoice->get_currency()); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | // Total discount. |
59 | - if ( 'discount' === $key ) { |
|
60 | - wpinv_the_price( $invoice->get_total_discount(), $invoice->get_currency() ); |
|
59 | + if ('discount' === $key) { |
|
60 | + wpinv_the_price($invoice->get_total_discount(), $invoice->get_currency()); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // Shipping. |
64 | - if ( 'shipping' === $key ) { |
|
65 | - wpinv_the_price( $invoice->get_shipping(), $invoice->get_currency() ); |
|
64 | + if ('shipping' === $key) { |
|
65 | + wpinv_the_price($invoice->get_shipping(), $invoice->get_currency()); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // Sub total. |
69 | - if ( 'subtotal' === $key ) { |
|
70 | - wpinv_the_price( $invoice->get_subtotal(), $invoice->get_currency() ); |
|
69 | + if ('subtotal' === $key) { |
|
70 | + wpinv_the_price($invoice->get_subtotal(), $invoice->get_currency()); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // Total. |
74 | - if ( 'total' === $key ) { |
|
75 | - wpinv_the_price( $invoice->get_total(), $invoice->get_currency() ); |
|
74 | + if ('total' === $key) { |
|
75 | + wpinv_the_price($invoice->get_total(), $invoice->get_currency()); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | // Fires when printing a cart total. |
79 | - do_action( "getpaid_invoice_cart_totals_$key", $invoice ); |
|
79 | + do_action("getpaid_invoice_cart_totals_$key", $invoice); |
|
80 | 80 | |
81 | 81 | ?> |
82 | 82 | |
@@ -90,4 +90,4 @@ discard block |
||
90 | 90 | </div> |
91 | 91 | </div> <!-- end .getpaid-invoice-line-totals --> |
92 | 92 | |
93 | -<?php do_action( 'getpaid_after_invoice_line_totals', $invoice, $totals ); ?> |
|
93 | +<?php do_action('getpaid_after_invoice_line_totals', $invoice, $totals); ?> |
@@ -10,104 +10,104 @@ |
||
10 | 10 | * @var array $columns |
11 | 11 | */ |
12 | 12 | |
13 | -defined( 'ABSPATH' ) || exit; |
|
13 | +defined('ABSPATH') || exit; |
|
14 | 14 | |
15 | -do_action( 'getpaid_before_invoice_line_item', $invoice, $item ); |
|
15 | +do_action('getpaid_before_invoice_line_item', $invoice, $item); |
|
16 | 16 | |
17 | 17 | ?> |
18 | 18 | |
19 | -<div class='getpaid-invoice-item item-<?php echo (int) $item->get_id(); ?> item-type-<?php echo esc_attr( $item->get_type() ); ?> border-bottom'> |
|
19 | +<div class='getpaid-invoice-item item-<?php echo (int) $item->get_id(); ?> item-type-<?php echo esc_attr($item->get_type()); ?> border-bottom'> |
|
20 | 20 | |
21 | 21 | <div class="form-row row align-items-center"> |
22 | 22 | |
23 | - <?php foreach ( array_keys( $columns ) as $column ) : ?> |
|
23 | + <?php foreach (array_keys($columns) as $column) : ?> |
|
24 | 24 | |
25 | - <div class="<?php echo 'name' === $column ? 'col-12 col-sm-6' : 'col-12 col-sm'; ?> getpaid-invoice-item-<?php echo esc_attr( $column ); ?>"> |
|
25 | + <div class="<?php echo 'name' === $column ? 'col-12 col-sm-6' : 'col-12 col-sm'; ?> getpaid-invoice-item-<?php echo esc_attr($column); ?>"> |
|
26 | 26 | |
27 | 27 | <?php |
28 | 28 | |
29 | 29 | // Fires before printing a line item column. |
30 | - do_action( "getpaid_invoice_line_item_before_$column", $item, $invoice ); |
|
30 | + do_action("getpaid_invoice_line_item_before_$column", $item, $invoice); |
|
31 | 31 | |
32 | 32 | // Item name. |
33 | - if ( 'name' === $column ) { |
|
33 | + if ('name' === $column) { |
|
34 | 34 | |
35 | - $has_featured_image = has_post_thumbnail( $item->get_id() ); |
|
35 | + $has_featured_image = has_post_thumbnail($item->get_id()); |
|
36 | 36 | |
37 | - if ( $has_featured_image ) { |
|
37 | + if ($has_featured_image) { |
|
38 | 38 | echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">'; |
39 | 39 | echo '<div class="getpaid-form-item-image-container mr-2">'; |
40 | - echo get_the_post_thumbnail( $item->get_id(), 'thumbnail', array( 'class' => 'getpaid-form-item-image mb-0' ) ); |
|
40 | + echo get_the_post_thumbnail($item->get_id(), 'thumbnail', array('class' => 'getpaid-form-item-image mb-0')); |
|
41 | 41 | echo '</div>'; |
42 | 42 | echo '<div class="getpaid-form-item-name-container">'; |
43 | 43 | } |
44 | 44 | |
45 | 45 | // Display the name. |
46 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>'; |
|
46 | + echo '<div class="mb-1">' . esc_html($item->get_name()) . '</div>'; |
|
47 | 47 | |
48 | 48 | // And an optional description. |
49 | 49 | $description = $item->get_description(); |
50 | 50 | |
51 | - if ( ! empty( $description ) ) { |
|
52 | - echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>'; |
|
51 | + if (!empty($description)) { |
|
52 | + echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post($description) . '</small>'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | // Fires before printing the line item actions. |
56 | - do_action( 'getpaid_before_invoice_line_item_actions', $item, $invoice ); |
|
56 | + do_action('getpaid_before_invoice_line_item_actions', $item, $invoice); |
|
57 | 57 | |
58 | - $actions = apply_filters( 'getpaid-invoice-page-line-item-actions', array(), $item, $invoice ); |
|
58 | + $actions = apply_filters('getpaid-invoice-page-line-item-actions', array(), $item, $invoice); |
|
59 | 59 | |
60 | - if ( ! empty( $actions ) ) { |
|
60 | + if (!empty($actions)) { |
|
61 | 61 | |
62 | - $sanitized = array(); |
|
63 | - foreach ( $actions as $key => $item_action ) { |
|
64 | - $key = sanitize_html_class( $key ); |
|
65 | - $item_action = wp_kses_post( $item_action ); |
|
62 | + $sanitized = array(); |
|
63 | + foreach ($actions as $key => $item_action) { |
|
64 | + $key = sanitize_html_class($key); |
|
65 | + $item_action = wp_kses_post($item_action); |
|
66 | 66 | $sanitized[] = "<span class='$key'>$item_action</span>"; |
67 | 67 | } |
68 | 68 | |
69 | 69 | echo "<small class='form-text getpaid-line-item-actions'>"; |
70 | - echo wp_kses_post( implode( ' | ', $sanitized ) ); |
|
70 | + echo wp_kses_post(implode(' | ', $sanitized)); |
|
71 | 71 | echo '</small>'; |
72 | 72 | |
73 | 73 | } |
74 | 74 | |
75 | - if ( $has_featured_image ) { |
|
75 | + if ($has_featured_image) { |
|
76 | 76 | echo '</div>'; |
77 | 77 | echo '</div>'; |
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | 81 | // Item price. |
82 | - if ( 'price' === $column ) { |
|
82 | + if ('price' === $column) { |
|
83 | 83 | |
84 | 84 | // Display the item price (or recurring price if this is a renewal invoice) |
85 | 85 | $price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price(); |
86 | - wpinv_the_price( $price, $invoice->get_currency() ); |
|
86 | + wpinv_the_price($price, $invoice->get_currency()); |
|
87 | 87 | |
88 | 88 | } |
89 | 89 | |
90 | 90 | // Tax rate. |
91 | - if ( 'tax_rate' === $column ) { |
|
92 | - echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%'; |
|
91 | + if ('tax_rate' === $column) { |
|
92 | + echo floatval(round(getpaid_get_invoice_tax_rate($invoice, $item), 2)) . '%'; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | // Item quantity. |
96 | - if ( 'quantity' === $column ) { |
|
96 | + if ('quantity' === $column) { |
|
97 | 97 | echo (float) $item->get_quantity(); |
98 | 98 | } |
99 | 99 | |
100 | 100 | // Item sub total. |
101 | - if ( 'subtotal' === $column ) { |
|
101 | + if ('subtotal' === $column) { |
|
102 | 102 | $subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total(); |
103 | - wpinv_the_price( $subtotal, $invoice->get_currency() ); |
|
103 | + wpinv_the_price($subtotal, $invoice->get_currency()); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | // Fires when printing a line item column. |
107 | - do_action( "getpaid_invoice_line_item_$column", $item, $invoice ); |
|
107 | + do_action("getpaid_invoice_line_item_$column", $item, $invoice); |
|
108 | 108 | |
109 | 109 | // Fires after printing a line item column. |
110 | - do_action( "getpaid_invoice_line_item_after_$column", $item, $invoice ); |
|
110 | + do_action("getpaid_invoice_line_item_after_$column", $item, $invoice); |
|
111 | 111 | |
112 | 112 | ?> |
113 | 113 |